Removed delays from unit tests
Change-Id: I1107104109e8b0d2454567a48f7aee9135d92f7a
diff --git a/apps/openstacknetworking/src/test/java/org/onosproject/openstacknetworking/impl/OpenstackNetworkManagerTest.java b/apps/openstacknetworking/src/test/java/org/onosproject/openstacknetworking/impl/OpenstackNetworkManagerTest.java
index a33f626..07f12f1 100644
--- a/apps/openstacknetworking/src/test/java/org/onosproject/openstacknetworking/impl/OpenstackNetworkManagerTest.java
+++ b/apps/openstacknetworking/src/test/java/org/onosproject/openstacknetworking/impl/OpenstackNetworkManagerTest.java
@@ -16,10 +16,10 @@
package org.onosproject.openstacknetworking.impl;
import com.google.common.collect.Lists;
+import com.google.common.util.concurrent.MoreExecutors;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-import org.onlab.junit.TestTools;
import org.onlab.junit.TestUtils;
import org.onosproject.core.ApplicationId;
import org.onosproject.core.CoreServiceAdapter;
@@ -97,6 +97,7 @@
osNetworkStore = new DistributedOpenstackNetworkStore();
TestUtils.setField(osNetworkStore, "coreService", new TestCoreService());
TestUtils.setField(osNetworkStore, "storageService", new TestStorageService());
+ TestUtils.setField(osNetworkStore, "eventExecutor", MoreExecutors.newDirectExecutorService());
osNetworkStore.activate();
target = new OpenstackNetworkManager();
@@ -469,8 +470,7 @@
assertEquals("Number of port did not match", 1, target.ports().size());
assertEquals("Port did not match", null, target.port(PORT_ID).getName());
- final Port updated = NeutronPort.builder()
- .from(PORT_COPY)
+ final Port updated = PORT_COPY.toBuilder()
.name(UPDATED_NAME)
.build();
target.updatePort(updated);
@@ -580,14 +580,12 @@
}
private void validateEvents(Enum... types) {
- TestTools.assertAfter(100, () -> {
- int i = 0;
- assertEquals("Number of events did not match", types.length, testListener.events.size());
- for (Event event : testListener.events) {
- assertEquals("Incorrect event received", types[i], event.type());
- i++;
- }
- testListener.events.clear();
- });
+ int i = 0;
+ assertEquals("Number of events did not match", types.length, testListener.events.size());
+ for (Event event : testListener.events) {
+ assertEquals("Incorrect event received", types[i], event.type());
+ i++;
+ }
+ testListener.events.clear();
}
}
\ No newline at end of file
diff --git a/apps/openstacknetworking/src/test/java/org/onosproject/openstacknetworking/impl/OpenstackRouterManagerTest.java b/apps/openstacknetworking/src/test/java/org/onosproject/openstacknetworking/impl/OpenstackRouterManagerTest.java
index 9d47fa5..2adb529 100644
--- a/apps/openstacknetworking/src/test/java/org/onosproject/openstacknetworking/impl/OpenstackRouterManagerTest.java
+++ b/apps/openstacknetworking/src/test/java/org/onosproject/openstacknetworking/impl/OpenstackRouterManagerTest.java
@@ -16,10 +16,10 @@
package org.onosproject.openstacknetworking.impl;
import com.google.common.collect.Lists;
+import com.google.common.util.concurrent.MoreExecutors;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-import org.onlab.junit.TestTools;
import org.onlab.junit.TestUtils;
import org.onosproject.core.ApplicationId;
import org.onosproject.core.CoreServiceAdapter;
@@ -62,6 +62,7 @@
osRouterStore = new DistributedOpenstackRouterStore();
TestUtils.setField(osRouterStore, "coreService", new TestCoreService());
TestUtils.setField(osRouterStore, "storageService", new TestStorageService());
+ TestUtils.setField(osRouterStore, "eventExecutor", MoreExecutors.newDirectExecutorService());
osRouterStore.activate();
target = new OpenstackRouterManager();
@@ -270,14 +271,12 @@
}
private void validateEvents(Enum... types) {
- TestTools.assertAfter(100, () -> {
- int i = 0;
- assertEquals("Number of events did not match", types.length, testListener.events.size());
- for (Event event : testListener.events) {
- assertEquals("Incorrect event received", types[i], event.type());
- i++;
- }
- testListener.events.clear();
- });
+ int i = 0;
+ assertEquals("Number of events did not match", types.length, testListener.events.size());
+ for (Event event : testListener.events) {
+ assertEquals("Incorrect event received", types[i], event.type());
+ i++;
+ }
+ testListener.events.clear();
}
}