summaryrefslogtreecommitdiffstats
path: root/grToolkit
diff options
context:
space:
mode:
Diffstat (limited to 'grToolkit')
-rwxr-xr-xgrToolkit/provider/pom.xml6
-rwxr-xr-xgrToolkit/provider/src/main/java/org/onap/ccsdk/sli/plugins/grtoolkit/GrToolkitProvider.java (renamed from grToolkit/provider/src/main/java/org/onap/ccsdk/sli/plugins/GrToolkitProvider.java)27
-rwxr-xr-xgrToolkit/provider/src/main/java/org/onap/ccsdk/sli/plugins/grtoolkit/data/ClusterActor.java (renamed from grToolkit/provider/src/main/java/org/onap/ccsdk/sli/plugins/data/ClusterActor.java)2
-rwxr-xr-xgrToolkit/provider/src/main/java/org/onap/ccsdk/sli/plugins/grtoolkit/data/MemberBuilder.java (renamed from grToolkit/provider/src/main/java/org/onap/ccsdk/sli/plugins/data/MemberBuilder.java)2
-rwxr-xr-xgrToolkit/provider/src/main/resources/gr-toolkit.properties21
-rwxr-xr-xgrToolkit/provider/src/main/resources/org/opendaylight/blueprint/GrToolkit.xml2
-rw-r--r--grToolkit/provider/src/test/java/org/onap/ccsdk/sli/plugins/grtoolkit/GrToolkitProviderTest.java344
-rw-r--r--grToolkit/provider/src/test/java/org/onap/ccsdk/sli/plugins/grtoolkit/data/MemberBuilderTest.java41
-rw-r--r--grToolkit/provider/src/test/resources/akka.conf49
-rw-r--r--grToolkit/provider/src/test/resources/akka6.conf49
-rwxr-xr-xgrToolkit/provider/src/test/resources/gr-toolkit.properties34
11 files changed, 563 insertions, 14 deletions
diff --git a/grToolkit/provider/pom.xml b/grToolkit/provider/pom.xml
index 951d2da60..51a850b8d 100755
--- a/grToolkit/provider/pom.xml
+++ b/grToolkit/provider/pom.xml
@@ -98,5 +98,11 @@
<version>${akka.version}</version>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>com.github.stefanbirkner</groupId>
+ <artifactId>system-rules</artifactId>
+ <version>1.19.0</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</project>
diff --git a/grToolkit/provider/src/main/java/org/onap/ccsdk/sli/plugins/GrToolkitProvider.java b/grToolkit/provider/src/main/java/org/onap/ccsdk/sli/plugins/grtoolkit/GrToolkitProvider.java
index dc8534be2..4e121e345 100755
--- a/grToolkit/provider/src/main/java/org/onap/ccsdk/sli/plugins/GrToolkitProvider.java
+++ b/grToolkit/provider/src/main/java/org/onap/ccsdk/sli/plugins/grtoolkit/GrToolkitProvider.java
@@ -19,7 +19,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.ccsdk.sli.plugins;
+package org.onap.ccsdk.sli.plugins.grtoolkit;
import java.io.BufferedReader;
import java.io.File;
@@ -31,6 +31,7 @@ import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
+import java.sql.Connection;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collection;
@@ -47,9 +48,10 @@ import javax.annotation.Nonnull;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
+import org.onap.ccsdk.sli.core.dblib.DBLibConnection;
import org.onap.ccsdk.sli.core.dblib.DbLibService;
-import org.onap.ccsdk.sli.plugins.data.ClusterActor;
-import org.onap.ccsdk.sli.plugins.data.MemberBuilder;
+import org.onap.ccsdk.sli.plugins.grtoolkit.data.ClusterActor;
+import org.onap.ccsdk.sli.plugins.grtoolkit.data.MemberBuilder;
import org.json.JSONArray;
import org.json.JSONException;
@@ -195,6 +197,8 @@ public class GrToolkitProvider implements AutoCloseable, GrToolkitService, DataT
}
} catch(IOException e) {
log.error("Couldn't load akka", e);
+ } catch(NullPointerException e) {
+ log.error("akkaConfig is null. Check properties file and restart {} bundle.", APP_NAME);
}
log.info("self:\n{}", self);
}
@@ -831,13 +835,16 @@ public class GrToolkitProvider implements AutoCloseable, GrToolkitService, DataT
private String getDatabaseHealth() {
log.info("Determining database health...");
try {
+ Connection connection = dbLib.getConnection();
log.info("DBLib isActive(): {}", dbLib.isActive());
- log.info("DBLib isReadOnly(): {}", dbLib.getConnection().isReadOnly());
- log.info("DBLib isClosed(): {}", dbLib.getConnection().isClosed());
- if(!dbLib.isActive() || dbLib.getConnection().isClosed() || dbLib.getConnection().isReadOnly()) {
+ log.info("DBLib isReadOnly(): {}", connection.isReadOnly());
+ log.info("DBLib isClosed(): {}", connection.isClosed());
+ if(!dbLib.isActive() || connection.isClosed() || connection.isReadOnly()) {
log.warn("Database is FAULTY");
+ connection.close();
return FAULTY;
}
+ connection.close();
log.info("Database is HEALTHY");
} catch(SQLException e) {
log.error("Database is FAULTY");
@@ -914,18 +921,18 @@ public class GrToolkitProvider implements AutoCloseable, GrToolkitService, DataT
return connection;
}
- private enum IpTables {
+ enum IpTables {
ADD,
DELETE
}
- private enum SiteConfiguration {
+ enum SiteConfiguration {
SOLO,
SINGLE,
GEO
}
- private enum HttpMethod {
+ enum HttpMethod {
GET("GET"),
POST("POST");
@@ -938,7 +945,7 @@ public class GrToolkitProvider implements AutoCloseable, GrToolkitService, DataT
}
}
- private class PropertyKeys {
+ class PropertyKeys {
static final String SITE_IDENTIFIER = "site.identifier";
static final String CONTROLLER_USE_SSL = "controller.useSsl";
static final String CONTROLLER_PORT_SSL = "controller.port.ssl";
diff --git a/grToolkit/provider/src/main/java/org/onap/ccsdk/sli/plugins/data/ClusterActor.java b/grToolkit/provider/src/main/java/org/onap/ccsdk/sli/plugins/grtoolkit/data/ClusterActor.java
index 1c8faac08..7cd503a95 100755
--- a/grToolkit/provider/src/main/java/org/onap/ccsdk/sli/plugins/data/ClusterActor.java
+++ b/grToolkit/provider/src/main/java/org/onap/ccsdk/sli/plugins/grtoolkit/data/ClusterActor.java
@@ -19,7 +19,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.ccsdk.sli.plugins.data;
+package org.onap.ccsdk.sli.plugins.grtoolkit.data;
import java.util.ArrayList;
import java.util.HashMap;
diff --git a/grToolkit/provider/src/main/java/org/onap/ccsdk/sli/plugins/data/MemberBuilder.java b/grToolkit/provider/src/main/java/org/onap/ccsdk/sli/plugins/grtoolkit/data/MemberBuilder.java
index 96dfa64a8..8bbf574d6 100755
--- a/grToolkit/provider/src/main/java/org/onap/ccsdk/sli/plugins/data/MemberBuilder.java
+++ b/grToolkit/provider/src/main/java/org/onap/ccsdk/sli/plugins/grtoolkit/data/MemberBuilder.java
@@ -19,7 +19,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.ccsdk.sli.plugins.data;
+package org.onap.ccsdk.sli.plugins.grtoolkit.data;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.plugins.gr.toolkit.rev180926.cluster.health.output.MembersBuilder;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.plugins.gr.toolkit.rev180926.member.CommitStatusBuilder;
diff --git a/grToolkit/provider/src/main/resources/gr-toolkit.properties b/grToolkit/provider/src/main/resources/gr-toolkit.properties
index 2ddaa9a4e..c008eea98 100755
--- a/grToolkit/provider/src/main/resources/gr-toolkit.properties
+++ b/grToolkit/provider/src/main/resources/gr-toolkit.properties
@@ -1,6 +1,25 @@
+# ============LICENSE_START=======================================================
+# openECOMP : SDN-C
+# ================================================================================
+# Copyright (C) 2019 AT&T Intellectual Property. All rights
+# reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END=========================================================
+
akka.conf.location=/opt/opendaylight/current/controller/configuration/initial/akka.conf
adm.useSsl=true
-adm.fqdn=sdnmlcadm-conexus-it.ecomp.cci.att.com
+adm.fqdn=
adm.healthcheck=/healthcheck
adm.port.http=8181
adm.port.ssl=8443
diff --git a/grToolkit/provider/src/main/resources/org/opendaylight/blueprint/GrToolkit.xml b/grToolkit/provider/src/main/resources/org/opendaylight/blueprint/GrToolkit.xml
index 606ce2771..5a4492c56 100755
--- a/grToolkit/provider/src/main/resources/org/opendaylight/blueprint/GrToolkit.xml
+++ b/grToolkit/provider/src/main/resources/org/opendaylight/blueprint/GrToolkit.xml
@@ -21,7 +21,7 @@
<reference id="configDatastore" interface="org.opendaylight.controller.cluster.datastore.DistributedDataStoreInterface"
odl:type="distributed-config"/>
- <bean id="provider" class="org.onap.ccsdk.sli.plugins.GrToolkitProvider">
+ <bean id="provider" class="org.onap.ccsdk.sli.plugins.grtoolkit.GrToolkitProvider">
<argument ref="dataBroker" />
<argument ref="notificationService" />
<argument ref="rpcRegistry" />
diff --git a/grToolkit/provider/src/test/java/org/onap/ccsdk/sli/plugins/grtoolkit/GrToolkitProviderTest.java b/grToolkit/provider/src/test/java/org/onap/ccsdk/sli/plugins/grtoolkit/GrToolkitProviderTest.java
new file mode 100644
index 000000000..dabdf2065
--- /dev/null
+++ b/grToolkit/provider/src/test/java/org/onap/ccsdk/sli/plugins/grtoolkit/GrToolkitProviderTest.java
@@ -0,0 +1,344 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : SDN-C
+ * ================================================================================
+ * Copyright (C) 2018 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.ccsdk.sli.plugins.grtoolkit;
+import com.google.common.util.concurrent.ListenableFuture;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.contrib.java.lang.system.EnvironmentVariables;
+import org.onap.ccsdk.sli.core.dblib.DBLibConnection;
+import org.onap.ccsdk.sli.core.dblib.DbLibService;
+import org.onap.ccsdk.sli.plugins.grtoolkit.data.ClusterActor;
+import org.opendaylight.controller.cluster.access.concepts.MemberName;
+import org.opendaylight.controller.cluster.datastore.DistributedDataStoreInterface;
+import org.opendaylight.controller.cluster.datastore.utils.ActorContext;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
+import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.plugins.gr.toolkit.rev180926.AdminHealthOutput;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.plugins.gr.toolkit.rev180926.ClusterHealthOutput;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.plugins.gr.toolkit.rev180926.DatabaseHealthOutput;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.plugins.gr.toolkit.rev180926.FailoverOutput;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.plugins.gr.toolkit.rev180926.FailoverOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.plugins.gr.toolkit.rev180926.SiteHealthOutput;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.plugins.gr.toolkit.rev180926.SiteIdentifierOutput;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.ExecutionException;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.when;
+
+public class GrToolkitProviderTest {
+ GrToolkitProvider provider;
+ GrToolkitProvider providerSpy;
+ DataBroker dataBroker;
+ NotificationPublishService notificationProviderService;
+ RpcProviderRegistry rpcProviderRegistry;
+ DistributedDataStoreInterface configDatastore;
+ DbLibService dbLibService;
+ DBLibConnection connection;
+
+ @Rule
+ public final EnvironmentVariables environmentVariables = new EnvironmentVariables();
+
+ @Before
+ public void setup() {
+ environmentVariables.set("SDNC_CONFIG_DIR","src/test/resources/");
+ dataBroker = mock(DataBroker.class);
+ notificationProviderService = mock(NotificationPublishService.class);
+ rpcProviderRegistry = mock(RpcProviderRegistry.class);
+ configDatastore = mock(DistributedDataStoreInterface.class);
+ dbLibService = mock(DbLibService.class);
+ connection = mock(DBLibConnection.class);
+
+ ActorContext actorContext = mock(ActorContext.class);
+ MemberName memberName = MemberName.forName("Test");
+
+ when(actorContext.getCurrentMemberName()).thenReturn(memberName);
+ when(configDatastore.getActorContext()).thenReturn(actorContext);
+
+ try {
+ when(connection.isReadOnly()).thenReturn(false);
+ when(connection.isClosed()).thenReturn(false);
+ when(dbLibService.isActive()).thenReturn(true);
+ when(dbLibService.getConnection()).thenReturn(connection);
+ } catch(SQLException e) {
+ fail();
+ }
+
+ provider = new GrToolkitProvider(dataBroker, notificationProviderService,
+ rpcProviderRegistry, configDatastore, dbLibService);
+ providerSpy = spy(provider);
+ }
+
+ @Test
+ public void closeTest() {
+ try {
+ provider.close();
+ }
+ catch(Exception e) {
+ // Exception expected
+ }
+ }
+
+ @Test
+ public void onDataTreeChangedTest() {
+ provider.onDataTreeChanged(new ArrayList());
+ // onDataTreeChanged is an empty stub
+ }
+
+ @Test
+ public void clusterHealthTest() {
+ ListenableFuture<RpcResult<ClusterHealthOutput>> result = provider.clusterHealth(null);
+ try {
+ assertEquals("200", result.get().getResult().getStatus());
+ } catch(InterruptedException | ExecutionException e) {
+ fail();
+ }
+ }
+
+ @Test
+ public void siteHealthTest() {
+ ListenableFuture<RpcResult<SiteHealthOutput>> result = provider.siteHealth(null);
+ try {
+ assertEquals("200", result.get().getResult().getStatus());
+ } catch(InterruptedException | ExecutionException e) {
+ fail();
+ }
+ }
+
+ @Test
+ public void siteHealth6NodeTest() {
+ Map<String, ClusterActor> memberMap = new HashMap<>();
+ ClusterActor actor;
+ for(int ndx = 0; ndx < 6; ndx++) {
+ actor = new ClusterActor();
+ actor.setNode("member-" + (ndx + 1));
+ actor.setUp(true);
+ actor.setUnreachable(false);
+
+ memberMap.put(actor.getNode(), actor);
+ }
+
+ try {
+ Field field = provider.getClass().getDeclaredField("siteConfiguration");
+ field.setAccessible(true);
+ field.set(provider, GrToolkitProvider.SiteConfiguration.GEO);
+
+ field = provider.getClass().getDeclaredField("memberMap");
+ field.setAccessible(true);
+ field.set(provider, memberMap);
+
+
+ actor = new ClusterActor();
+ actor.setNode("member-1");
+ field = provider.getClass().getDeclaredField("self");
+ field.setAccessible(true);
+ field.set(provider, actor);
+
+ field = provider.getClass().getDeclaredField("member");
+ field.setAccessible(true);
+ field.set(provider, actor.getNode());
+ }
+ catch(IllegalAccessException | NoSuchFieldException e) {
+ fail();
+ }
+
+ ListenableFuture<RpcResult<SiteHealthOutput>> result = provider.siteHealth(null);
+ try {
+ assertEquals("200", result.get().getResult().getStatus());
+ } catch(InterruptedException | ExecutionException e) {
+ fail();
+ }
+ }
+
+ @Test
+ public void databaseHealthTest() {
+ ListenableFuture<RpcResult<DatabaseHealthOutput>> result = provider.databaseHealth(null);
+ try {
+ assertEquals("200", result.get().getResult().getStatus());
+ } catch(InterruptedException | ExecutionException e) {
+ fail();
+ }
+ }
+
+ @Test
+ public void databaseHealthWhenROTest() {
+ try {
+ when(connection.isReadOnly()).thenReturn(true);
+ } catch(SQLException e) {
+ fail();
+ }
+ ListenableFuture<RpcResult<DatabaseHealthOutput>> result = provider.databaseHealth(null);
+ try {
+ assertEquals("200", result.get().getResult().getStatus());
+ } catch(InterruptedException | ExecutionException e) {
+ fail();
+ }
+ }
+
+ @Test
+ public void databaseHealthWhenExceptionTest() {
+ try {
+ when(connection.isReadOnly()).thenThrow(new SQLException());
+ } catch(SQLException e) {
+ //expected
+ }
+ ListenableFuture<RpcResult<DatabaseHealthOutput>> result = provider.databaseHealth(null);
+ try {
+ assertEquals("200", result.get().getResult().getStatus());
+ } catch(InterruptedException | ExecutionException e) {
+ fail();
+ }
+ }
+
+ @Test
+ public void adminHealthTest() {
+ ListenableFuture<RpcResult<AdminHealthOutput>> result = provider.adminHealth(null);
+ try {
+ assertEquals("200", result.get().getResult().getStatus());
+ } catch(InterruptedException | ExecutionException e) {
+ fail();
+ }
+ }
+
+ @Test
+ public void siteIdentifierTest() {
+ ListenableFuture<RpcResult<SiteIdentifierOutput>> result = provider.siteIdentifier(null);
+ try {
+ assertEquals("200", result.get().getResult().getStatus());
+ } catch(InterruptedException | ExecutionException e) {
+ fail();
+ }
+ }
+
+ @Test
+ public void failoverTest() {
+ ListenableFuture<RpcResult<FailoverOutput>> result = provider.failover(null);
+ try {
+ assertEquals("400", result.get().getResult().getStatus());
+ } catch(InterruptedException | ExecutionException e) {
+ fail();
+ }
+ }
+
+ @Test
+ public void executeCommandTest() {
+ try {
+ Method method = provider.getClass().getDeclaredMethod("executeCommand", String.class);
+ method.setAccessible(true);
+ method.invoke(provider, "ls");
+ }
+ catch(NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
+ fail();
+ }
+ }
+
+ @Test
+ public void isolateSiteFromClusterTest() {
+ try {
+ ClusterActor actor = new ClusterActor();
+ actor.setNode("some-node");
+ actor.setAkkaPort("2550");
+ ArrayList<ClusterActor> activeList = new ArrayList<>();
+ activeList.add(actor);
+ ArrayList<ClusterActor> standbyList = new ArrayList<>();
+ standbyList.add(actor);
+ Method method = provider.getClass().getDeclaredMethod("isolateSiteFromCluster", ArrayList.class, ArrayList.class, String.class);
+ method.setAccessible(true);
+ method.invoke(provider, activeList, standbyList, "80");
+ }
+ catch(NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
+ fail();
+ }
+ }
+
+ @Test
+ public void downUnreachableNodesTest() {
+ try {
+ ClusterActor actor = new ClusterActor();
+ actor.setNode("some-node");
+ actor.setAkkaPort("2550");
+ ArrayList<ClusterActor> activeList = new ArrayList<>();
+ activeList.add(actor);
+ ArrayList<ClusterActor> standbyList = new ArrayList<>();
+ standbyList.add(actor);
+ Method method = provider.getClass().getDeclaredMethod("downUnreachableNodes", ArrayList.class, ArrayList.class, String.class);
+ method.setAccessible(true);
+ method.invoke(provider, activeList, standbyList, "80");
+ }
+ catch(NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
+ fail();
+ }
+ }
+
+ @Test
+ public void changeClusterVotingTest() {
+ try {
+ ClusterActor actor = new ClusterActor();
+ actor.setMember("some-member");
+ actor.setNode("some-Node");
+ ArrayList<ClusterActor> activeList = new ArrayList<>();
+ activeList.add(actor);
+ ArrayList<ClusterActor> standbyList = new ArrayList<>();
+ standbyList.add(actor);
+ Field field = provider.getClass().getDeclaredField("self");
+ field.setAccessible(true);
+ field.set(provider, actor);
+ Method method = provider.getClass().getDeclaredMethod("changeClusterVoting", FailoverOutputBuilder.class, ArrayList.class, ArrayList.class, String.class);
+ method.setAccessible(true);
+ method.invoke(provider, new FailoverOutputBuilder(), activeList, standbyList, "80");
+ }
+ catch(NoSuchMethodException | IllegalAccessException | InvocationTargetException | NoSuchFieldException e) {
+ fail();
+ }
+ }
+
+ @Test
+ public void backupMdSalTest() {
+ try {
+ ClusterActor actor = new ClusterActor();
+ actor.setNode("some-Node");
+ actor.setAkkaPort("2550");
+ ArrayList<ClusterActor> activeList = new ArrayList<>();
+ activeList.add(actor);
+ Method method = provider.getClass().getDeclaredMethod("backupMdSal", ArrayList.class, String.class);
+ method.setAccessible(true);
+ method.invoke(provider, activeList, "80");
+ }
+ catch(NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
+ fail();
+ }
+ }
+
+}
diff --git a/grToolkit/provider/src/test/java/org/onap/ccsdk/sli/plugins/grtoolkit/data/MemberBuilderTest.java b/grToolkit/provider/src/test/java/org/onap/ccsdk/sli/plugins/grtoolkit/data/MemberBuilderTest.java
new file mode 100644
index 000000000..4b657cf0a
--- /dev/null
+++ b/grToolkit/provider/src/test/java/org/onap/ccsdk/sli/plugins/grtoolkit/data/MemberBuilderTest.java
@@ -0,0 +1,41 @@
+package org.onap.ccsdk.sli.plugins.grtoolkit.data;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import static org.junit.Assert.*;
+
+public class MemberBuilderTest {
+ MemberBuilder builder;
+ ClusterActor actor;
+
+ @Before
+ public void setUp() {
+ actor = new ClusterActor();
+ actor.setUp(true);
+ actor.setVoting(true);
+ }
+
+ @Test
+ public void constructorTest() {
+ ArrayList<String> actorList = new ArrayList<>();
+ ArrayList<String> shardList = new ArrayList<>();
+ HashMap<String, Integer> commitMap = new HashMap<>();
+ actorList.add("Some-Actor");
+ shardList.add("Some-shard");
+ commitMap.put("Some-shard", 4);
+ commitMap.put("Some-other-shard", -4);
+ actor.setShardLeader(actorList);
+ actor.setReplicaShards(shardList);
+ actor.setNonReplicaShards(shardList);
+ actor.setCommits(commitMap);
+ assertNotNull(actor.toString());
+ assertEquals("", actor.getSite());
+ assertEquals(1, actor.getNonReplicaShards().size());
+ builder = new MemberBuilder(actor);
+ assertNotNull(builder.build());
+ }
+} \ No newline at end of file
diff --git a/grToolkit/provider/src/test/resources/akka.conf b/grToolkit/provider/src/test/resources/akka.conf
new file mode 100644
index 000000000..cbb73d548
--- /dev/null
+++ b/grToolkit/provider/src/test/resources/akka.conf
@@ -0,0 +1,49 @@
+
+odl-cluster-data {
+ akka {
+ remote {
+ artery {
+ enabled = off
+ canonical.hostname = "127.0.0.1"
+ canonical.port = 2550
+ }
+ netty.tcp {
+ hostname = "127.0.0.1"
+ port = 2550
+ }
+ # when under load we might trip a false positive on the failure detector
+ # transport-failure-detector {
+ # heartbeat-interval = 4 s
+ # acceptable-heartbeat-pause = 16s
+ # }
+ }
+
+ cluster {
+ # Remove ".tcp" when using artery.
+ seed-nodes = ["akka.tcp://opendaylight-cluster-data@127.0.0.1:2550"]
+
+ roles = [
+ "member-1"
+ ]
+
+ }
+
+ persistence {
+ # By default the snapshots/journal directories live in KARAF_HOME. You can choose to put it somewhere else by
+ # modifying the following two properties. The directory location specified may be a relative or absolute path.
+ # The relative path is always relative to KARAF_HOME.
+
+ # snapshot-store.local.dir = "target/snapshots"
+ # journal.leveldb.dir = "target/journal"
+
+ journal {
+ leveldb {
+ # Set native = off to use a Java-only implementation of leveldb.
+ # Note that the Java-only version is not currently considered by Akka to be production quality.
+
+ # native = off
+ }
+ }
+ }
+ }
+}
diff --git a/grToolkit/provider/src/test/resources/akka6.conf b/grToolkit/provider/src/test/resources/akka6.conf
new file mode 100644
index 000000000..358218d9c
--- /dev/null
+++ b/grToolkit/provider/src/test/resources/akka6.conf
@@ -0,0 +1,49 @@
+
+odl-cluster-data {
+ akka {
+ remote {
+ artery {
+ enabled = off
+ canonical.hostname = "127.0.0.1"
+ canonical.port = 2550
+ }
+ netty.tcp {
+ hostname = "127.0.0.1"
+ port = 2550
+ }
+ # when under load we might trip a false positive on the failure detector
+ # transport-failure-detector {
+ # heartbeat-interval = 4 s
+ # acceptable-heartbeat-pause = 16s
+ # }
+ }
+
+ cluster {
+ # Remove ".tcp" when using artery.
+ seed-nodes = ["akka.tcp://opendaylight-cluster-data@127.0.0.1:2550", "akka.tcp://opendaylight-cluster-data@127.0.0.2:2550", "akka.tcp://opendaylight-cluster-data@127.0.0.3:2550", "akka.tcp://opendaylight-cluster-data@127.0.0.4:2550", "akka.tcp://opendaylight-cluster-data@127.0.0.5:2550", "akka.tcp://opendaylight-cluster-data@127.0.0.6:2550"]
+
+ roles = [
+ "member-1"
+ ]
+
+ }
+
+ persistence {
+ # By default the snapshots/journal directories live in KARAF_HOME. You can choose to put it somewhere else by
+ # modifying the following two properties. The directory location specified may be a relative or absolute path.
+ # The relative path is always relative to KARAF_HOME.
+
+ # snapshot-store.local.dir = "target/snapshots"
+ # journal.leveldb.dir = "target/journal"
+
+ journal {
+ leveldb {
+ # Set native = off to use a Java-only implementation of leveldb.
+ # Note that the Java-only version is not currently considered by Akka to be production quality.
+
+ # native = off
+ }
+ }
+ }
+ }
+}
diff --git a/grToolkit/provider/src/test/resources/gr-toolkit.properties b/grToolkit/provider/src/test/resources/gr-toolkit.properties
new file mode 100755
index 000000000..d9bc66dcd
--- /dev/null
+++ b/grToolkit/provider/src/test/resources/gr-toolkit.properties
@@ -0,0 +1,34 @@
+# ============LICENSE_START=======================================================
+# openECOMP : SDN-C
+# ================================================================================
+# Copyright (C) 2019 AT&T Intellectual Property. All rights
+# reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END=========================================================
+
+akka.conf.location=src/test/resources/akka.conf
+adm.useSsl=false
+adm.fqdn=wiki.onap.org
+adm.healthcheck=
+adm.port.http=80
+adm.port.ssl=443
+controller.credentials=admin:admin
+controller.useSsl=false
+controller.port.http=8181
+controller.port.ssl=8443
+controller.port.akka=2550
+mbean.cluster=/jolokia/read/akka:type=Cluster
+mbean.shardManager=/jolokia/read/org.opendaylight.controller:Category=ShardManager,name=shard-manager-config,type=DistributedConfigDatastore
+mbean.shard.config=/jolokia/read/org.opendaylight.controller:Category=Shards,name=%s,type=DistributedConfigDatastore
+site.identifier=TestODL