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.devCI;
23 import org.junit.Rule;
24 import org.junit.rules.TestName;
25 import org.openecomp.sdc.be.model.Component;
26 import org.openecomp.sdc.be.model.Service;
27 import org.openecomp.sdc.be.model.User;
28 import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
29 import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
30 import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
31 import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
32 import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
33 import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
34 import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
35 import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils;
36 import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
37 import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils;
38 import org.testng.annotations.Test;
40 public class OpsRejectDistribution extends ComponentBaseTest {
43 public static TestName name = new TestName();
45 public OpsRejectDistribution() {
46 super(name, OpsRejectDistribution.class.getName());
50 public void testOpsRejectDistribution() throws Exception {
51 User designer = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
53 ServiceReqDetails service = ElementFactory.getDefaultService();
54 RestResponse createdService = ServiceRestUtils.createService(service, designer);
55 BaseRestUtils.checkCreateResponse(createdService);
56 Service serviceFirstImport = ResponseParser.parseToObjectUsingMapper(createdService.getResponse(), Service.class);
57 Component serviceObject = AtomicOperationUtils.changeComponentState(serviceFirstImport, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
59 AtomicOperationUtils.approveAndRejectServiceForDistribution(serviceObject);