Changing sever timeouts to reduce test failures.
Change-Id: Idf18e5309a5a14a4dcf51952a2d736035cc95975
diff --git a/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AsyncConsistentSetMultimapTest.java b/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AsyncConsistentSetMultimapTest.java
index e7f932b..e033937 100644
--- a/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AsyncConsistentSetMultimapTest.java
+++ b/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AsyncConsistentSetMultimapTest.java
@@ -23,7 +23,6 @@
import org.apache.commons.collections.keyvalue.DefaultMapEntry;
import org.junit.AfterClass;
import org.junit.BeforeClass;
-import org.junit.Ignore;
import org.junit.Test;
import org.onlab.util.Tools;
@@ -40,7 +39,6 @@
/**
* Tests the {@link AsyncConsistentSetMultimap}.
*/
-@Ignore
public class AsyncConsistentSetMultimapTest extends AtomixTestBase {
private final String keyOne = "hello";
private final String keyTwo = "goodbye";
diff --git a/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixConsistentMapTest.java b/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixConsistentMapTest.java
index f1a3c2f..130662b 100644
--- a/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixConsistentMapTest.java
+++ b/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixConsistentMapTest.java
@@ -20,7 +20,6 @@
import io.atomix.resource.ResourceType;
import org.junit.AfterClass;
import org.junit.BeforeClass;
-import org.junit.Ignore;
import org.junit.Test;
import org.onlab.util.Tools;
import org.onosproject.store.primitives.MapUpdate;
@@ -51,7 +50,6 @@
/**
* Unit tests for {@link AtomixConsistentMap}.
*/
-@Ignore
public class AtomixConsistentMapTest extends AtomixTestBase {
@BeforeClass
diff --git a/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixLeaderElectorTest.java b/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixLeaderElectorTest.java
index a8c99fd..82b7ed8 100644
--- a/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixLeaderElectorTest.java
+++ b/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixLeaderElectorTest.java
@@ -15,30 +15,28 @@
*/
package org.onosproject.store.primitives.resources.impl;
+import io.atomix.Atomix;
+import io.atomix.AtomixClient;
+import io.atomix.resource.ResourceType;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.onosproject.cluster.Leadership;
+import org.onosproject.cluster.NodeId;
+import org.onosproject.event.Change;
+
import java.util.LinkedList;
import java.util.Queue;
import java.util.concurrent.CompletableFuture;
import java.util.function.Consumer;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-import org.onosproject.cluster.Leadership;
-import org.onosproject.cluster.NodeId;
-import org.onosproject.event.Change;
-
-import io.atomix.Atomix;
-import io.atomix.AtomixClient;
-import io.atomix.resource.ResourceType;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
/**
* Unit tests for {@link AtomixLeaderElector}.
*/
-@Ignore
public class AtomixLeaderElectorTest extends AtomixTestBase {
NodeId node1 = new NodeId("node1");
diff --git a/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixLongTest.java b/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixLongTest.java
index d9800a6..b1a5b7c 100644
--- a/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixLongTest.java
+++ b/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixLongTest.java
@@ -20,7 +20,6 @@
import io.atomix.variables.DistributedLong;
import org.junit.AfterClass;
import org.junit.BeforeClass;
-import org.junit.Ignore;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
@@ -30,7 +29,6 @@
/**git s
* Unit tests for {@link AtomixCounter}.
*/
-@Ignore
public class AtomixLongTest extends AtomixTestBase {
@BeforeClass
diff --git a/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixTestBase.java b/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixTestBase.java
index db52ce9..7dfe82f 100644
--- a/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixTestBase.java
+++ b/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixTestBase.java
@@ -30,10 +30,6 @@
import org.onlab.junit.TestTools;
import org.onosproject.store.primitives.impl.CatalystSerializers;
-import java.io.File;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.time.Duration;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CompletableFuture;
@@ -44,7 +40,6 @@
* Base class for various Atomix tests.
*/
public abstract class AtomixTestBase {
- protected static File testDir;
protected static LocalServerRegistry registry = new LocalServerRegistry();
protected static List<Address> members = new ArrayList<>();
protected static List<CopycatClient> copycatClients = new ArrayList<>();
@@ -78,7 +73,6 @@
*/
protected static List<CopycatServer> createCopycatServers(int nodes)
throws Throwable {
- CountDownLatch latch = new CountDownLatch(nodes);
List<CopycatServer> servers = new ArrayList<>();
List<Address> members = new ArrayList<>();
@@ -88,7 +82,7 @@
members.add(address);
CopycatServer server = createCopycatServer(address);
if (members.size() <= 1) {
- server.bootstrap().thenRun(latch::countDown).join();
+ server.bootstrap().join();
} else {
server.join(members).join();
}
@@ -109,9 +103,6 @@
.build())
.withStateMachine(ResourceManagerState::new)
.withSerializer(serializer.clone())
- .withHeartbeatInterval(Duration.ofMillis(25))
- .withElectionTimeout(Duration.ofMillis(50))
- .withSessionTimeout(Duration.ofMillis(100))
.build();
copycatServers.add(server);
return server;
@@ -137,24 +128,6 @@
copycatServers = new ArrayList<>();
}
- /**
- * Deletes a directory recursively.
- */
- private void deleteDirectory(File directory) throws IOException {
- if (directory.exists()) {
- File[] files = directory.listFiles();
- if (files != null) {
- for (File file : files) {
- if (file.isDirectory()) {
- deleteDirectory(file);
- } else {
- Files.delete(file.toPath());
- }
- }
- }
- Files.delete(directory.toPath());
- }
- }
/**
* Creates a Atomix client.