Expose gRPC service in OSGi service registry
[ccsdk/sli/adaptors.git] / aai-service / provider / src / test / java / org / onap / ccsdk / sli / adaptors / aai / NamedQueryRequestTest.java
1 package org.onap.ccsdk.sli.adaptors.aai;
2
3 import static org.junit.Assert.*;
4
5 import java.io.UnsupportedEncodingException;
6 import java.net.MalformedURLException;
7 import java.net.URISyntaxException;
8 import java.net.URL;
9
10 import org.junit.AfterClass;
11 import org.junit.BeforeClass;
12 import org.junit.Test;
13 import org.onap.ccsdk.sli.adaptors.aai.data.AAIDatum;
14 import org.slf4j.Logger;
15 import org.slf4j.LoggerFactory;
16
17 public class NamedQueryRequestTest {
18
19     private static final Logger LOG = LoggerFactory.getLogger(NamedQueryRequestTest.class);
20
21     private static NamedQueryRequest request;
22
23     @BeforeClass
24     public static void setUp() throws Exception {
25
26         request = new NamedQueryRequest();
27         LOG.info("\nEchoRequestTest.setUp\n");
28     }
29
30     @AfterClass
31     public static void tearDown() throws Exception {
32         request = null;
33         LOG.info("----------------------- EchoRequestTest.tearDown -----------------------");
34     }
35
36     @Test
37     public void runGetRequestUrlTest() {
38         LOG.info("----------------------- Test: " + new Object(){}.getClass().getEnclosingMethod().getName() + " -----------------------");
39
40         URL url;
41         try {
42             url = request.getRequestUrl("GET", null);
43             assertNotNull(url);
44         } catch (UnsupportedEncodingException | MalformedURLException exc) {
45             LOG.error("Failed test", exc);
46         }
47
48     }
49
50     @Test
51     public void runToJSONStringTest() {
52         LOG.info("----------------------- Test: " + new Object(){}.getClass().getEnclosingMethod().getName() + " -----------------------");
53
54         try {
55             String json = request.toJSONString();
56             assertNotNull(json);
57         } catch (Exception exc) {
58             LOG.error("Failed test", exc);
59         }
60
61     }
62
63     @Test
64     public void runGetArgsListTest() {
65         LOG.info("----------------------- Test: " + new Object(){}.getClass().getEnclosingMethod().getName() + " -----------------------");
66
67         try {
68             String[] args = request.getArgsList();
69             assertNotNull(args);
70         } catch (Exception exc) {
71             LOG.error("Failed test", exc);
72         }
73
74     }
75
76     @Test
77     public void runGetModelTest() {
78         LOG.info("----------------------- Test: " + new Object(){}.getClass().getEnclosingMethod().getName() + " -----------------------");
79
80         try {
81             Class<?  extends AAIDatum> clazz = request.getModelClass();
82             assertNotNull(clazz);
83         } catch (Exception exc) {
84             LOG.error("Failed test", exc);
85         }
86
87     }
88 }