2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
22 package org.onap.ccsdk.sli.adaptors.aai;
24 import static org.junit.Assert.assertNotNull;
26 import java.io.UnsupportedEncodingException;
27 import java.net.MalformedURLException;
30 import org.junit.AfterClass;
31 import org.junit.BeforeClass;
32 import org.junit.FixMethodOrder;
33 import org.junit.Test;
34 import org.junit.runners.MethodSorters;
35 import org.onap.ccsdk.sli.adaptors.aai.data.AAIDatum;
36 import org.slf4j.Logger;
37 import org.slf4j.LoggerFactory;
39 @FixMethodOrder(MethodSorters.NAME_ASCENDING)
40 public class EchoRequestTest {
42 private static final Logger LOG = LoggerFactory.getLogger(EchoRequestTest.class);
44 private static AAIRequest request;
45 private static AAIService aaiService;
48 public static void setUp() throws Exception {
49 aaiService = new AAIService(
50 AAIService.class.getResource(AAIService.AAICLIENT_PROPERTIES));
51 request = new EchoRequest();
52 LOG.info("\nEchoRequestTest.setUp\n");
56 public static void tearDown() throws Exception {
58 LOG.info("----------------------- EchoRequestTest.tearDown -----------------------");
62 public void runGetRequestUrlTest() {
63 LOG.info("----------------------- Test: " + new Object(){}.getClass().getEnclosingMethod().getName() + " -----------------------");
67 url = request.getRequestUrl("GET", null);
69 } catch (UnsupportedEncodingException | MalformedURLException exc) {
70 LOG.error("Failed test", exc);
76 public void runToJSONStringTest() {
77 LOG.info("----------------------- Test: " + new Object(){}.getClass().getEnclosingMethod().getName() + " -----------------------");
80 String json = request.toJSONString();
82 } catch (Exception exc) {
83 LOG.error("Failed test", exc);
89 public void runGetArgsListTest() {
90 LOG.info("----------------------- Test: " + new Object(){}.getClass().getEnclosingMethod().getName() + " -----------------------");
93 String[] args = request.getArgsList();
95 } catch (Exception exc) {
96 LOG.error("Failed test", exc);
102 public void runGetModelTest() {
103 LOG.info("----------------------- Test: " + new Object(){}.getClass().getEnclosingMethod().getName() + " -----------------------");
106 Class<? extends AAIDatum> clazz = request.getModelClass();
107 assertNotNull(clazz);
108 } catch (Exception exc) {
109 LOG.error("Failed test", exc);