summaryrefslogtreecommitdiffstats
path: root/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/AAIClientRESTExecutorTest.java
blob: f60b2da641d8f7febb671b435aeb46fbb4fc4035 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
package org.onap.ccsdk.sli.adaptors.aai;

import java.util.HashMap;
import java.util.Map;
import java.util.Properties;

import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.assertNotNull;

public class AAIClientRESTExecutorTest {

    private static AAIClientRESTExecutor aaiExecute;
    private static AAIService aaiService;

    @BeforeClass
    public static void setUpBeforeClass() throws Exception {
        Properties properties = new Properties();
        properties.setProperty("org.onap.ccsdk.sli.adaptors.aai.host.certificate.ignore", "true");
        properties.setProperty("org.onap.ccsdk.sli.adaptors.aai.client.name", "SDNC");
        properties.setProperty("org.onap.ccsdk.sli.adaptors.aai.client.psswd", "SDNC");
        properties.setProperty("org.onap.ccsdk.sli.adaptors.aai.application", "CCSDK");
        properties.setProperty("org.onap.ccsdk.sli.adaptors.aai.uri", "http://localhost:8181");
        properties.setProperty("connection.timeout", "60000");
        properties.setProperty("read.timeout", "60000");
        aaiExecute = new AAIClientRESTExecutor(properties);
        aaiService = new AAIService(properties);


    }

    @Test
    public void testGet() {
        Map<String, String> nameValues = new HashMap<>();
        nameValues.put("generic-vnf.vnf-id", "vnf-001");
        AAIRequest request = AAIRequest.createRequest("generic-vnf", nameValues);
        try {
            aaiExecute.get(request);
        } catch (AAIServiceException e) {
        }
        assert(true);
        assertNotNull(nameValues);
    }

    @Test
    public void testPost() {
        Map<String, String> nameValues = new HashMap<>();
        nameValues.put("generic-vnf.vnf-id", "vnf-001");
        AAIRequest request = AAIRequest.createRequest("generic-vnf", nameValues);
        try {
            aaiExecute.get(request);
        } catch (AAIServiceException e) {
        }
        assert(true);
        assertNotNull(nameValues);
    }

    @Test
    public void testDelete() {
        Map<String, String> nameValues = new HashMap<>();
        nameValues.put("generic-vnf.vnf-id", "vnf-001");
        AAIRequest request = AAIRequest.createRequest("generic-vnf", nameValues);
        try {
            aaiExecute.get(request);
        } catch (AAIServiceException e) {
        }
        assert(true);
        assertNotNull(nameValues);
    }

    @Test
    public void testQuery() {
        Map<String, String> nameValues = new HashMap<>();
        nameValues.put("generic-vnf.vnf-id", "vnf-001");
        AAIRequest request = AAIRequest.createRequest("generic-vnf", nameValues);
        try {
            aaiExecute.get(request);
        } catch (AAIServiceException e) {
        }
        assert(true);
        assertNotNull(nameValues);
    }

    @Test
    public void testPatch() {
        Map<String, String> nameValues = new HashMap<>();
        nameValues.put("generic-vnf.vnf-id", "vnf-001");
        AAIRequest request = AAIRequest.createRequest("generic-vnf", nameValues);
        try {
            aaiExecute.patch(request, "1234567890");
        } catch (AAIServiceException e) {
        }
        assert(true);
        assertNotNull(nameValues);
    }



    @Test
    public void testLOGwriteFirstTrace() {
        try {
            aaiExecute.LOGwriteFirstTrace("GET", null);
        } catch (Exception e) {
        }
        assert(true);
    }

    @Test
    public void testLOGwriteDateTrace() {
        try {
            aaiExecute.LOGwriteDateTrace("GET", "<----- test data ------>");
        } catch (Exception e) {
        }
        assert(true);
    }

    @Test
    public void testLOGwriteEndingTrace() {
        try {
            aaiExecute.LOGwriteEndingTrace(200, "GET", "<----- test data ------>");
        } catch (Exception e) {
        }
        assert(true);
    }

}