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.Test;
26 import org.onap.aai.AAISetup;
27 import org.onap.aai.setup.SchemaVersion;
28 import org.springframework.test.annotation.DirtiesContext;
30 import java.util.List;
32 import java.util.Properties;
34 @DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_CLASS)
35 public class ListEndpointsTest extends AAISetup {
37 private Properties properties;
38 private SchemaVersion version;
39 private ListEndpoints listEndpoints;
43 properties = new Properties();
44 version = schemaVersions.getDefaultVersion();
45 listEndpoints = new ListEndpoints(basePath, schemaVersions.getDefaultVersion());
49 public void testGetEndpoints() {
50 Assert.assertNotNull(listEndpoints);
51 List<String> list = listEndpoints.getEndpoints();
52 Assert.assertTrue(list != null && !list.isEmpty());
54 for (String endpoint : list) {
55 System.out.println("endpoints: " + endpoint);
60 public void testGetEndpointsWithParam() {
61 Assert.assertNotNull(listEndpoints);
62 List<String> list = listEndpoints.getEndpoints();
63 Assert.assertTrue(list != null && !list.isEmpty());
66 @Test(expected = RuntimeException.class)
67 public void testGetEndpoints_throwException() {
68 new ListEndpoints(basePath, null);
72 public void testGetLogicalNames() {
73 Assert.assertNotNull(listEndpoints);
74 Map<String, String> map = listEndpoints.getLogicalNames();
75 Assert.assertTrue(map != null && !map.isEmpty());
79 public void testToStrinWithParam() {
80 Assert.assertNotNull(listEndpoints);
81 String endpoints = listEndpoints.toString("complex");
82 Assert.assertTrue(!endpoints.contains("complex"));