2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright © 2017-2018 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.onap.aai.audit;
23 import org.junit.Assert;
24 import org.junit.Before;
25 import org.junit.BeforeClass;
26 import org.junit.Test;
27 import org.junit.rules.ExpectedException;
28 import org.onap.aai.AAISetup;
29 import org.onap.aai.concurrent.AaiCallable;
30 import org.onap.aai.setup.SchemaServiceVersions;
31 import org.onap.aai.setup.SchemaVersion;
32 import org.onap.aai.setup.SchemaVersions;
33 import org.onap.aai.setup.SchemaVersionsBean;
35 import org.springframework.beans.factory.annotation.Autowired;
36 import org.springframework.beans.factory.annotation.Value;
37 import org.springframework.context.annotation.AnnotationConfigApplicationContext;
38 import org.springframework.context.annotation.PropertySource;
39 import org.springframework.stereotype.Component;
40 import org.springframework.test.context.TestPropertySource;
42 import javax.validation.constraints.AssertTrue;
44 import java.io.FileReader;
45 import java.util.List;
47 import java.util.Properties;
49 import static org.junit.Assert.assertTrue;
51 public class ListEndpointsTest extends AAISetup {
53 private Properties properties;
54 private SchemaVersion version;
55 private ListEndpoints listEndpoints;
58 public void setUp() throws Exception {
59 properties = new Properties();
60 version = schemaVersions.getDefaultVersion();
61 listEndpoints = new ListEndpoints(basePath, schemaVersions.getDefaultVersion());
65 public void testGetEndpoints() {
66 Assert.assertTrue(listEndpoints != null);
67 List<String> list = listEndpoints.getEndpoints();
68 Assert.assertTrue(list != null && !list.isEmpty());
70 for (String endpoint : list) {
71 System.out.println("endpoints: " + endpoint);
76 public void testGetEndpointsWithParam() {
77 Assert.assertTrue(listEndpoints != null);
78 List<String> list = listEndpoints.getEndpoints();
79 Assert.assertTrue(list != null && !list.isEmpty());
82 @Test(expected = RuntimeException.class)
83 public void testGetEndpoints_throwException() {
84 ListEndpoints listEndpointsFail = new ListEndpoints(basePath, null);
88 public void testGetLogicalNames() {
89 Assert.assertTrue(listEndpoints != null);
90 Map<String, String> map = listEndpoints.getLogicalNames();
91 Assert.assertTrue(map != null && !map.isEmpty());
95 public void testToString() {
96 Assert.assertTrue(listEndpoints != null);
97 String endpoints = listEndpoints.toString();
101 public void testToStrinWithParam() {
102 Assert.assertTrue(listEndpoints != null);
103 String endpoints = listEndpoints.toString("complex");
104 Assert.assertTrue(!endpoints.contains("complex"));