3aaf17a8f35ac2ab1ec791d9679cc02790c98445
[aai/sparky-be.git] / src / test / java / org / onap / aai / sparky / viewandinspect / SearchableGroupsTest.java
1 /**
2  * ============LICENSE_START===================================================
3  * SPARKY (AAI UI service)
4  * ============================================================================
5  * Copyright © 2017 AT&T Intellectual Property.
6  * Copyright © 2017 Amdocs
7  * All rights reserved.
8  * ============================================================================
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  *      http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  * ============LICENSE_END=====================================================
21  *
22  * ECOMP and OpenECOMP are trademarks
23  * and service marks of AT&T Intellectual Property.
24  */
25
26 package org.onap.aai.sparky.viewandinspect;
27
28 /**
29  * The Class SearchableGroupsTest.
30  */
31 public class SearchableGroupsTest {
32
33   static final String TEST_RESOURCE_PATH = "/src/test/resources";
34
35   static final String GOOD_TEST_CONFIG = "{\"groups\": [" + "{" + "\"group-name\" : \"inventory\","
36       + "\"search-paths\" : [\"cloud-infrastructure\", \"business\", \"network\"]" + "}," + "{"
37       + "\"group-name\" : \"cloud-infrastructure\","
38       + "\"search-paths\" : [\"complexes\", \"cloud-regions\", \"pservers\"]" + "}" + "]" + "}";
39       /*
40        * @Before public void init() throws NoSuchFieldException, SecurityException,
41        * IllegalArgumentException, IllegalAccessException { Field instance =
42        * SearchableGroups.class.getDeclaredField("instance"); instance.setAccessible(true);
43        * instance.set(null, null); }
44        * 
45        * @Test public void test_FileNotFound() throws ElasticSearchOperationException {
46        * System.setProperty("AJSC_HOME", ""); SearchableGroups testGroups =
47        * SearchableGroups.getTestInstance(); assertTrue(testGroups.getGroups().isEmpty()); }
48        * 
49        * @Test public void test_FileFoundWithProperlyFormatedConfig() throws
50        * ElasticSearchOperationException { ResolverUtils testUtils = 
51        * Mockito.mock(ResolverUtils.class);
52        * Mockito.when(testUtils.getConfigSettings(anyString())).thenReturn(GOOD_TEST_CONFIG);
53        * SearchableGroups testGroups = SearchableGroups.getTestInstance();
54        * 
55        * testGroups.setUtils(testUtils); testGroups.initSearchableGroups();
56        * 
57        * assertFalse(testGroups.getGroups().isEmpty());
58        * 
59        * assertFalse(testGroups.getSearchableGroups("inventory").isEmpty()); }
60        * 
61        * @Test public void test_FileFoundGroupDoesNotExist() throws
62        *  ElasticSearchOperationException {
63        * ResolverUtils testUtils = Mockito.mock(ResolverUtils.class);
64        * Mockito.when(testUtils.getConfigSettings(anyString())).thenReturn(GOOD_TEST_CONFIG);
65        * SearchableGroups testGroups = SearchableGroups.getTestInstance();
66        * 
67        * testGroups.setUtils(testUtils); testGroups.initSearchableGroups();
68        * 
69        * assertFalse(testGroups.getGroups().isEmpty());
70        * 
71        * assertEquals(null, testGroups.getSearchableGroups("Test")); }
72        */
73 }