2 * Copyright © 2018 European Support Limited
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package org.openecomp.sdc.ci.tests.execute.globaltypes;
19 import java.util.HashMap;
21 import org.json.simple.JSONObject;
22 import org.json.simple.JSONValue;
23 import org.junit.Rule;
24 import org.junit.rules.TestName;
25 import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
26 import org.openecomp.sdc.ci.tests.api.Urls;
27 import org.openecomp.sdc.ci.tests.config.Config;
28 import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
29 import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum;
30 import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest;
31 import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
32 import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
33 import org.testng.AssertJUnit;
34 import org.testng.annotations.BeforeMethod;
35 import org.testng.annotations.Test;
37 public class InterfaceLifecycleTypesTest extends ComponentBaseTest {
39 protected Config config = Config.instance();
40 protected HttpRequest httpRequest = new HttpRequest();
41 protected Map<String, String> headersMap = new HashMap<>();
43 public static final TestName testName = new TestName();
45 public InterfaceLifecycleTypesTest() {
46 super(testName, InterfaceLifecycleTypesTest.class.getName());
51 headersMap.put(HttpHeaderEnum.USER_ID.getValue(), ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER).getUserId());
55 public void testGetAllInterfaceLifecycleTypes() throws Exception {
56 final String standardType = "tosca.interfaces.node.lifecycle.standard";
57 final String nfvType = "tosca.interfaces.nfv.vnf.lifecycle.nfv";
58 String url = String.format(Urls.GET_All_INTERFACE_LIFECYCLE_TYPES, config.getCatalogBeHost(), config.getCatalogBePort());
59 RestResponse restResponse = httpRequest.httpSendGet(url, headersMap);
60 AssertJUnit.assertTrue(restResponse.getErrorCode() == 200);
61 JSONObject jsonObject = (JSONObject) JSONValue.parse(restResponse.getResponse());
62 AssertJUnit.assertTrue(jsonObject.containsKey(standardType));
63 AssertJUnit.assertTrue(jsonObject.containsKey(nfvType));