summaryrefslogtreecommitdiffstats
path: root/sdnr/wt/websocketmanager2/provider/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'sdnr/wt/websocketmanager2/provider/src/test')
-rw-r--r--sdnr/wt/websocketmanager2/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager2/test/AkkaConfigTest.java74
-rw-r--r--sdnr/wt/websocketmanager2/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager2/test/WebsocketServerConnectTest.java33
-rw-r--r--sdnr/wt/websocketmanager2/provider/src/test/resources/akka-cluster.cfg49
-rw-r--r--sdnr/wt/websocketmanager2/provider/src/test/resources/akka-singlenode.cfg48
4 files changed, 204 insertions, 0 deletions
diff --git a/sdnr/wt/websocketmanager2/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager2/test/AkkaConfigTest.java b/sdnr/wt/websocketmanager2/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager2/test/AkkaConfigTest.java
new file mode 100644
index 000000000..217088b33
--- /dev/null
+++ b/sdnr/wt/websocketmanager2/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager2/test/AkkaConfigTest.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * ============LICENSE_START========================================================================
+ * ONAP : ccsdk feature sdnr wt
+ * =================================================================================================
+ * Copyright (C) 2019 highstreet technologies GmbH 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.features.sdnr.wt.websocketmanager2.test;
+
+import static org.junit.Assert.*;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.nio.file.Paths;
+import org.junit.Test;
+import org.onap.ccsdk.features.sdnr.wt.websocketmanager2.utils.AkkaConfig;
+
+public class AkkaConfigTest {
+
+ @Test
+ public void test() throws URISyntaxException, IOException {
+
+ AkkaConfig config=null;
+ try {
+ //config = AkkaConfig.load("akka-singlenode.cfg", true);
+ config = AkkaConfig.loadContent(loadResourceContentAsString("akka-singlenode.cfg"));
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail("error loading singlenode config");
+ }
+ assertEquals("no singlenode config detected",false,config.isCluster());
+ assertEquals("more than one node detected",1,config.getClusterConfig().getSeedNodes().size());
+
+ try {
+ config = AkkaConfig.loadContent(loadResourceContentAsString("akka-cluster.cfg"));
+ } catch (Exception e) {
+ fail("error loading cluster config");
+ }
+ assertEquals("no cluster config detected",true,config.isCluster());
+ assertTrue("only one node detected",config.getClusterConfig().getSeedNodes().size()>1);
+ }
+
+ private String loadResourceContentAsString(String resourceName) throws URISyntaxException, FileNotFoundException, IOException {
+
+ StringBuilder sb = new StringBuilder();
+
+ ClassLoader classLoader = getClass().getClassLoader();
+ File file = Paths.get(classLoader.getResource(resourceName).toURI()).toFile();
+ try(BufferedReader br = new BufferedReader(new FileReader(file))) {
+ String line = br.readLine();
+
+ while (line != null) {
+ sb.append(line);
+ sb.append(System.lineSeparator());
+ line = br.readLine();
+ }
+ }
+ return sb.toString();
+ }
+}
diff --git a/sdnr/wt/websocketmanager2/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager2/test/WebsocketServerConnectTest.java b/sdnr/wt/websocketmanager2/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager2/test/WebsocketServerConnectTest.java
new file mode 100644
index 000000000..b380beca3
--- /dev/null
+++ b/sdnr/wt/websocketmanager2/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager2/test/WebsocketServerConnectTest.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * ============LICENSE_START========================================================================
+ * ONAP : ccsdk feature sdnr wt
+ * =================================================================================================
+ * Copyright (C) 2019 highstreet technologies GmbH 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.features.sdnr.wt.websocketmanager2.test;
+
+import org.junit.Test;
+import org.onap.ccsdk.features.sdnr.wt.websocketmanager2.WebSocketManager;
+
+public class WebsocketServerConnectTest {
+
+ @Test
+ public void test() {
+
+ WebSocketManager servlet =new WebSocketManager();
+
+
+
+ }
+}
diff --git a/sdnr/wt/websocketmanager2/provider/src/test/resources/akka-cluster.cfg b/sdnr/wt/websocketmanager2/provider/src/test/resources/akka-cluster.cfg
new file mode 100644
index 000000000..465dcad83
--- /dev/null
+++ b/sdnr/wt/websocketmanager2/provider/src/test/resources/akka-cluster.cfg
@@ -0,0 +1,49 @@
+odl-cluster-data {
+ akka {
+ remote {
+ artery {
+ enabled = off
+ canonical.hostname = "192.168.178.143"
+ canonical.port = 2550
+ }
+ netty.tcp {
+ hostname = "192.168.178.143"
+ 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@192.168.178.142:2550",
+ "akka.tcp://opendaylight-cluster-data@192.168.178.143:2550",
+ "akka.tcp://opendaylight-cluster-data@192.168.178.144:2550",
+ "akka.tcp://opendaylight-cluster-data@192.168.178.145:2550"]
+
+ roles = ["member-2"]
+
+ }
+
+ 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/sdnr/wt/websocketmanager2/provider/src/test/resources/akka-singlenode.cfg b/sdnr/wt/websocketmanager2/provider/src/test/resources/akka-singlenode.cfg
new file mode 100644
index 000000000..19e723319
--- /dev/null
+++ b/sdnr/wt/websocketmanager2/provider/src/test/resources/akka-singlenode.cfg
@@ -0,0 +1,48 @@
+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
+ }
+ }
+ }
+ }
+}