2 * ============LICENSE_START=======================================================
\r
4 * ================================================================================
\r
5 * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
\r
6 * Copyright © 2017 Amdocs
\r
7 * ================================================================================
\r
8 * Licensed under the Apache License, Version 2.0 (the "License");
\r
9 * you may not use this file except in compliance with the License.
\r
10 * You may obtain a copy of the License at
\r
12 * http://www.apache.org/licenses/LICENSE-2.0
\r
14 * Unless required by applicable law or agreed to in writing, software
\r
15 * distributed under the License is distributed on an "AS IS" BASIS,
\r
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
17 * See the License for the specific language governing permissions and
\r
18 * limitations under the License.
\r
19 * ============LICENSE_END=========================================================
\r
21 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
\r
23 package org.onap.aai.sparky.synchronizer;
\r
25 import org.junit.Before;
\r
26 import org.junit.Test;
\r
27 import org.mockito.Mockito;
\r
28 import org.onap.aai.sparky.synchronizer.SyncController.SyncActions;
\r
30 public class SyncControllerTest {
\r
32 SyncController controller;
\r
35 public void init() throws Exception {
\r
36 controller = new SyncController("name-1");
\r
39 public void testPerformAction_PreSync() {
\r
40 controller.performAction(SyncActions.SYNCHRONIZE);
\r
41 controller.shutdown();
\r
45 public void testRegisterIndexCleaner_NullIndexName() {
\r
46 IndexCleaner cleaner = new ElasticSearchIndexCleaner(null, null, "index_type-1", "host-1", "port-1", 1, 1);
\r
47 controller.registerIndexCleaner(cleaner);
\r
51 public void testRegisterIndexCleaner_NotNullIndexName() {
\r
52 IndexCleaner cleaner = new ElasticSearchIndexCleaner(null, "index-1", "index_type-1", "host-1", "port-1", 1, 1);
\r
53 controller.registerIndexCleaner(cleaner);
\r
57 public void testRegisterIndexValidator_NullIndexValidator() {
\r
58 IndexValidator validator = new IndexIntegrityValidator(null, null, "index_type-1", "host-1", "port-1", "json-1");
\r
59 controller.registerIndexValidator(validator);
\r
63 public void testRegisterIndexValidator_NotNullIndexValidator() {
\r
64 IndexValidator validator = new IndexIntegrityValidator(null, "index-1", "index_type-1", "host-1", "port-1", "json-1");
\r
65 controller.registerIndexValidator(validator);
\r
69 public void testRegisterEntitySynchronizer_NullEntitySynchronizer() throws Exception {
\r
70 IndexSynchronizer synchroniser = Mockito.mock(SearchableEntitySynchronizer.class);
\r
71 Mockito.when(synchroniser.getIndexName()).thenReturn(null);
\r
72 controller.registerEntitySynchronizer(synchroniser);
\r
76 public void testRegisterEntitySynchronizer_NotNullEntitySynchronizer() throws Exception {
\r
77 IndexSynchronizer synchroniser = Mockito.mock(SearchableEntitySynchronizer.class);
\r
78 Mockito.when(synchroniser.getIndexName()).thenReturn("entity-1");
\r
79 controller.registerEntitySynchronizer(synchroniser);
\r