fix OpenFlowPluginWiringTest to actually start OFP
authorMichael Vorburger <mike@vorburger.ch>
Thu, 20 Dec 2018 23:26:33 +0000 (00:26 +0100)
committerMichael Vorburger <mike@vorburger.ch>
Wed, 1 Jul 2020 23:37:58 +0000 (01:37 +0200)
by using only GuiceRule2 instead of GuiceRule, which makes the
OpenFlowPluginWiringTest actually run the SystemReadyListener's
onSystemBootReady() of OpenFlowPluginProviderImpl.

use GuiceRule2 *everywhere* just to reduce confusion which to use.

TODO upstream GuiceRule2 integrated into infrautils GuiceRule now!

Signed-off-by: Michael Vorburger <mike@vorburger.ch>
src/test/java/org/opendaylight/aaa/simple/test/AAAWiringTest.java
src/test/java/org/opendaylight/controller/simple/test/ControllerWiringTest.java
src/test/java/org/opendaylight/infrautils/inject/guice/tests/AbstractCloseableModuleTest.java
src/test/java/org/opendaylight/infrautils/inject/guice/testutils/tests/GuiceRuleLambdaTest.java
src/test/java/org/opendaylight/infrautils/simple/test/DiagStatusWiringTest.java
src/test/java/org/opendaylight/openflowplugin/simple/test/OpenFlowPluginWiringTest.java
src/test/java/org/opendaylight/restconf/simple/test/RestConfModuleTest.java
src/test/java/org/opendaylight/serviceutils/simple/test/ServiceUtilsModuleTest.java

index 5774b303a2500ff461d2c3f3357e9bd3f3b2bdd2..e04cf188d79a3c2c4dd44e2a185b900ac6debd7c 100644 (file)
@@ -12,13 +12,13 @@ import org.junit.Rule;
 import org.opendaylight.aaa.simple.AAAWiring;
 import org.opendaylight.controller.simple.ControllerWiring;
 import org.opendaylight.infrautils.inject.guice.testutils.AnnotationsModule;
-import org.opendaylight.infrautils.inject.guice.testutils.GuiceRule;
+import org.opendaylight.infrautils.inject.guice.testutils.GuiceRule2;
 import org.opendaylight.infrautils.simple.testutils.AbstractSimpleDistributionTest;
 
 @Ignore // TODO fix NullPointerException at org.opendaylight.aaa.cert.impl.DefaultMdsalSslData.createKeyStores :155
 public class AAAWiringTest extends AbstractSimpleDistributionTest {
 
-    public @Rule GuiceRule guice = new GuiceRule(new AAAWiring(), new ControllerWiring(),
+    public @Rule GuiceRule2 guice = new GuiceRule2(new AAAWiring(), new ControllerWiring(),
             // TODO new WebWiring(true), new ReferencesWiring(),
             new AnnotationsModule());
 
index 7fe485b8e0d8253415e7bd6cdbc8744b68b0ae7f..1cba33a28a90263e3cee947b6a1d2a8f00316d28 100644 (file)
@@ -10,11 +10,11 @@ package org.opendaylight.controller.simple.test;
 import org.junit.Rule;
 import org.opendaylight.controller.simple.ControllerWiring;
 import org.opendaylight.infrautils.inject.guice.testutils.AnnotationsModule;
-import org.opendaylight.infrautils.inject.guice.testutils.GuiceRule;
+import org.opendaylight.infrautils.inject.guice.testutils.GuiceRule2;
 import org.opendaylight.infrautils.simple.testutils.AbstractSimpleDistributionTest;
 
 public class ControllerWiringTest extends AbstractSimpleDistributionTest {
 
-    public @Rule GuiceRule guice = new GuiceRule(ControllerWiring.class, AnnotationsModule.class);
+    public @Rule GuiceRule2 guice = new GuiceRule2(ControllerWiring.class, AnnotationsModule.class);
 
 }
index 5c6f01ff5ef14ba946888e0a89220cdf82726d57..87bd0560982ff60a24597e9dbfe2171857661b9c 100644 (file)
@@ -13,7 +13,7 @@ import org.junit.Test;
 import org.junit.runners.model.Statement;
 import org.opendaylight.infrautils.inject.guice.AbstractCloseableModule;
 import org.opendaylight.infrautils.inject.guice.testutils.AnnotationsModule;
-import org.opendaylight.infrautils.inject.guice.testutils.GuiceRule;
+import org.opendaylight.infrautils.inject.guice.testutils.GuiceRule2;
 
 /**
  * Test PreDestroy in Module.
@@ -39,7 +39,7 @@ public class AbstractCloseableModuleTest {
     @Test public void testModuleWithPreDestroy() throws Throwable {
         @SuppressWarnings("resource")
         TestModule testModule = new TestModule();
-        new GuiceRule(testModule, new AnnotationsModule()).apply(EMPTY_STATEMENT, null, new Object()).evaluate();
+        new GuiceRule2(testModule, new AnnotationsModule()).apply(EMPTY_STATEMENT, null, new Object()).evaluate();
         assertThat(testModule.isClosed).isTrue();
     }
 
index 38199212a5ea40928c191c72ac7ca89ea5c505c4..4d40bdb73f2b9b94e80eae9d0aa73002264a851d 100644 (file)
@@ -13,7 +13,6 @@ import javax.inject.Inject;
 import org.junit.Rule;
 import org.junit.Test;
 import org.opendaylight.infrautils.inject.guice.testutils.AnnotationsModule;
-import org.opendaylight.infrautils.inject.guice.testutils.GuiceRule;
 import org.opendaylight.infrautils.inject.guice.testutils.GuiceRule2;
 
 /**
@@ -24,7 +23,7 @@ import org.opendaylight.infrautils.inject.guice.testutils.GuiceRule2;
 public class GuiceRuleLambdaTest {
 
     @SuppressWarnings("BindingToUnqualifiedCommonType")
-    public @Rule GuiceRule guice = new GuiceRule2(
+    public @Rule GuiceRule2 guice = new GuiceRule2(
         binder -> binder.bind(String.class).toInstance("hello, world"),
         new AnnotationsModule());
 
index 012b0d5fba0f6451d83c6077d0d7a6103069a4de..67342e1475e7355a067635abaeabe2f6082cff90 100644 (file)
@@ -12,7 +12,7 @@ import org.junit.Rule;
 import org.junit.Test;
 import org.opendaylight.infrautils.diagstatus.DiagStatusService;
 import org.opendaylight.infrautils.inject.guice.testutils.AnnotationsModule;
-import org.opendaylight.infrautils.inject.guice.testutils.GuiceRule;
+import org.opendaylight.infrautils.inject.guice.testutils.GuiceRule2;
 import org.opendaylight.infrautils.simple.DiagStatusWiring;
 import org.opendaylight.infrautils.simple.ReadyWiring;
 import org.opendaylight.infrautils.web.WebWiring;
@@ -24,7 +24,7 @@ import org.opendaylight.infrautils.web.WebWiring;
  */
 public class DiagStatusWiringTest {
 
-    public @Rule GuiceRule guice = new GuiceRule(WebWiring.class, DiagStatusWiring.class, ReadyWiring.class,
+    public @Rule GuiceRule2 guice = new GuiceRule2(WebWiring.class, DiagStatusWiring.class, ReadyWiring.class,
             AnnotationsModule.class);
 
     @Inject DiagStatusService diagStatusService;
index a44cacf6b98e5b6e655b40ca3e869f23d9162205..67b0c6a4618a53563aa7137b11f895aebbecb295 100644 (file)
@@ -15,7 +15,7 @@ import org.junit.Test;
 import org.opendaylight.controller.simple.ControllerWiring;
 import org.opendaylight.infrautils.inject.guice.GuiceClassPathBinder;
 import org.opendaylight.infrautils.inject.guice.testutils.AnnotationsModule;
-import org.opendaylight.infrautils.inject.guice.testutils.GuiceRule;
+import org.opendaylight.infrautils.inject.guice.testutils.GuiceRule2;
 import org.opendaylight.infrautils.simple.DiagStatusWiring;
 import org.opendaylight.infrautils.simple.ReadyWiring;
 import org.opendaylight.infrautils.simple.testutils.AbstractSimpleDistributionTest;
@@ -30,15 +30,15 @@ public class OpenFlowPluginWiringTest extends AbstractSimpleDistributionTest {
 
     private static final GuiceClassPathBinder CLASS_PATH_BINDER = new GuiceClassPathBinder("org.opendaylight");
 
-    public @Rule GuiceRule guice = new GuiceRule(new OpenFlowPluginWiring(CLASS_PATH_BINDER), new ServiceUtilsWiring(),
-            new ControllerWiring(), new DiagStatusWiring(), new WebWiring(), new ReadyWiring(),
-            new AnnotationsModule());
+    public @Rule GuiceRule2 guice = new GuiceRule2(new OpenFlowPluginWiring(CLASS_PATH_BINDER),
+            new ServiceUtilsWiring(), new ControllerWiring(), new DiagStatusWiring(), new WebWiring(),
+            new ReadyWiring(), new AnnotationsModule());
 
     @Inject OpenFlowPluginProvider ofpProvider;
     @Inject OpenflowProviderConfig ofpConfig;
     @Inject ForwardingRulesManagerConfig frmConfig;
 
-    @Test public void testConfig() {
+    @Test public void testConfig() throws InterruptedException {
         assertThat(ofpConfig.getGlobalNotificationQuota()).named("globalNotificationQuota").isEqualTo(64000L);
         assertThat(frmConfig.getReconciliationRetryCount()).named("reconciliationRetryCount").isEqualTo(5);
     }
index a590b33eb67f4c066b827a7a7c846d25f58a38e8..552f64be9935c31798fda757a9b5dcd5e2ecb275 100644 (file)
@@ -17,7 +17,6 @@ import org.junit.Test;
 import org.opendaylight.aaa.web.WebServer;
 import org.opendaylight.controller.simple.ControllerWiring;
 import org.opendaylight.infrautils.inject.guice.testutils.AnnotationsModule;
-import org.opendaylight.infrautils.inject.guice.testutils.GuiceRule;
 import org.opendaylight.infrautils.inject.guice.testutils.GuiceRule2;
 import org.opendaylight.infrautils.simple.testutils.AbstractSimpleDistributionTest;
 import org.opendaylight.infrautils.testutils.TestHttpClient;
@@ -31,7 +30,7 @@ import org.opendaylight.restconf.simple.RestConfModule;
  */
 public class RestConfModuleTest extends AbstractSimpleDistributionTest {
 
-    public @Rule GuiceRule guice = new GuiceRule2(
+    public @Rule GuiceRule2 guice = new GuiceRule2(
             RestConfModule.class, ControllerWiring.class, WebWiring.class, AnnotationsModule.class);
 
     @Inject WebServer webServer;
index 4ae44fa274ee2c1d1ddc77c2db5f6aef156b66b7..7ee26a00acfb59202e5f324a3893b71984794522 100644 (file)
@@ -11,7 +11,7 @@ import javax.inject.Inject;
 import org.junit.Rule;
 import org.opendaylight.controller.simple.ControllerWiring;
 import org.opendaylight.infrautils.inject.guice.testutils.AnnotationsModule;
-import org.opendaylight.infrautils.inject.guice.testutils.GuiceRule;
+import org.opendaylight.infrautils.inject.guice.testutils.GuiceRule2;
 import org.opendaylight.infrautils.simple.testutils.AbstractSimpleDistributionTest;
 import org.opendaylight.serviceutils.simple.ServiceUtilsWiring;
 import org.opendaylight.serviceutils.upgrade.UpgradeState;
@@ -23,7 +23,7 @@ import org.opendaylight.serviceutils.upgrade.UpgradeState;
  */
 public class ServiceUtilsModuleTest extends AbstractSimpleDistributionTest {
 
-    public @Rule GuiceRule guice = new GuiceRule(ServiceUtilsWiring.class, ControllerWiring.class,
+    public @Rule GuiceRule2 guice = new GuiceRule2(ServiceUtilsWiring.class, ControllerWiring.class,
             AnnotationsModule.class);
 
     @Inject UpgradeState upgradeState;