aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/onos/utils
diff options
context:
space:
mode:
Diffstat (limited to 'framework/src/onos/utils')
-rw-r--r--framework/src/onos/utils/junit/src/main/java/org/onlab/junit/TestTools.java17
-rw-r--r--framework/src/onos/utils/junit/src/main/resources/org/onosproject/openflow/controller/impl/ControllerTestKeystore.jksbin0 -> 1295 bytes
2 files changed, 17 insertions, 0 deletions
diff --git a/framework/src/onos/utils/junit/src/main/java/org/onlab/junit/TestTools.java b/framework/src/onos/utils/junit/src/main/java/org/onlab/junit/TestTools.java
index e2fcefce..40e8686c 100644
--- a/framework/src/onos/utils/junit/src/main/java/org/onlab/junit/TestTools.java
+++ b/framework/src/onos/utils/junit/src/main/java/org/onlab/junit/TestTools.java
@@ -20,6 +20,7 @@ import com.google.common.io.Files;
import java.io.File;
import java.io.IOException;
+import java.net.ServerSocket;
import java.util.List;
import java.util.Random;
@@ -207,4 +208,20 @@ public final class TestTools {
}
}
+ /*
+ * Finds an available port that a test can bind to.
+ */
+ public static int findAvailablePort(int defaultPort) {
+ try {
+ ServerSocket socket = new ServerSocket(0);
+ socket.setReuseAddress(true);
+ int port = socket.getLocalPort();
+ socket.close();
+ return port;
+ } catch (IOException ex) {
+ return defaultPort;
+ }
+ }
+
+
}
diff --git a/framework/src/onos/utils/junit/src/main/resources/org/onosproject/openflow/controller/impl/ControllerTestKeystore.jks b/framework/src/onos/utils/junit/src/main/resources/org/onosproject/openflow/controller/impl/ControllerTestKeystore.jks
new file mode 100644
index 00000000..ba750519
--- /dev/null
+++ b/framework/src/onos/utils/junit/src/main/resources/org/onosproject/openflow/controller/impl/ControllerTestKeystore.jks
Binary files differ