2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.sdc.ci.tests.execute.lifecycle;
23 import static org.testng.AssertJUnit.assertTrue;
25 import org.junit.Rule;
26 import org.junit.rules.TestName;
27 import org.openecomp.sdc.be.model.Service;
28 import org.openecomp.sdc.be.model.User;
29 import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
30 import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
31 import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
32 import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
33 import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
34 import org.testng.annotations.Test;
36 public class ServiceCertWithoutDeploymentArtifacts extends LCSbaseTest {
37 protected ServiceReqDetails serviceDetails;
38 protected User sdncDesignerDetails;
39 protected User sdncAdminDetails;
40 protected Service serviceServ;
43 public static TestName testName = new TestName();
45 public ServiceCertWithoutDeploymentArtifacts() {
46 super(testName, ServiceCertWithoutDeploymentArtifacts.class.getName());
51 * checks possibility to certify service without of deployment artifacts
54 public void testDeploymentArtifactsRestriction() throws Exception {
56 sdncDesignerDetails = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
57 serviceServ = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
58 assertTrue(serviceServ.getDeploymentArtifacts() == null || serviceServ.getDeploymentArtifacts().isEmpty());
59 assertTrue(serviceServ.getComponentInstances() == null || serviceServ.getComponentInstances().isEmpty());
60 serviceDetails = new ServiceReqDetails(serviceServ);
61 RestResponse changeServiceState = LCSbaseTest.certifyService(serviceDetails, sdncDesignerDetails);
62 assertTrue("certify service request returned status:" + changeServiceState.getErrorCode(),
63 changeServiceState.getErrorCode() == 200);