Fix failure of OvsdbTestGetBridgeDomainsIT 38/6838/3
authorDave Tucker <dave@dtucker.co.uk>
Fri, 9 May 2014 19:29:10 +0000 (20:29 +0100)
committerDave Tucker <dave@dtucker.co.uk>
Fri, 9 May 2014 20:16:18 +0000 (21:16 +0100)
OvsdbTestGetBridgeDomainsIT was failing due to a NullPointer to the
ConfigurationService.invetoryServiceInternal

- Add InvetoryService to TestObjects
- Call setInventoryServiceInternal on the ConfigurationService

Change-Id: I1ec373df3b2726aca613ee740b4768bc9d28954e
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestBase.java
ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestGetBridgeDomainsIT.java

index 998d447254ec40bb185cc9953524ab1c851952da..fd43fdfd3567cb428b5a856f3fee17a7cdb40396 100644 (file)
@@ -39,10 +39,12 @@ public abstract class OvsdbTestBase {
 
     public class TestObjects {
         public final ConnectionService connectionService;
+        public final InventoryService inventoryService;
         public final Node node;
 
-        public TestObjects(ConnectionService connectionService, Node node) {
+        public TestObjects(ConnectionService connectionService, Node node, InventoryService inventoryService) {
             this.connectionService = connectionService;
+            this.inventoryService = inventoryService;
             this.node = node;
         }
     }
@@ -66,9 +68,9 @@ public abstract class OvsdbTestBase {
 
         Node node = connectionService.connect(identifier, params);
         if (node == null) {
-            throw new IOException("Failed to connecto to ovsdb server");
+            throw new IOException("Failed to connect to the ovsdb server");
         }
-        return new TestObjects(connectionService, node);
+        return new TestObjects(connectionService, node, inventory);
     }
 
 }
index de1e370ff198d5ec25fd960f680fdf789ba62c5c..0d78f847bf88359877210d553a18184b9234a7d0 100644 (file)
@@ -9,8 +9,11 @@
  */
 package org.opendaylight.ovsdb.plugin;
 
+import java.io.IOException;
 import java.util.List;
+import java.util.Properties;
 
+import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.controller.sal.core.Node;
 import org.slf4j.Logger;
@@ -20,11 +23,19 @@ public class OvsdbTestGetBridgeDomainsIT extends OvsdbTestBase {
     private static final Logger logger = LoggerFactory
             .getLogger(OvsdbTestGetBridgeDomainsIT.class);
 
+    private Properties props;
+
+    @Before
+    public void loadProps() throws IOException {
+        props = loadProperties();
+    }
+
     @Test
     public void getBridgeDomains() throws Throwable{
 
         TestObjects testObjects = getTestConnection();
         ConnectionService connectionService = testObjects.connectionService;
+        InventoryService inventoryService = testObjects.inventoryService;
         Node node = testObjects.node;
 
         /**
@@ -35,7 +46,7 @@ public class OvsdbTestGetBridgeDomainsIT extends OvsdbTestBase {
          */
         ConfigurationService configurationService = new ConfigurationService();
         configurationService.setConnectionServiceInternal(connectionService);
+        configurationService.setInventoryServiceInternal(inventoryService);
         List<String> ls = configurationService.getBridgeDomains(node);
-        System.out.println(ls);
     }
 }