From 904be6b7a0750dc395677fac2864a376c96e4ec2 Mon Sep 17 00:00:00 2001 From: Tony Tkacik Date: Tue, 4 Jun 2013 14:26:32 -0700 Subject: [PATCH] Cleaned up Integration Tests - Removed dependency version declarations from Integration Tests. The version of controller bundles and dependencies is loaded from integration test pom files. - Moved integration tests from test phase to verify. The integration tests could be skipped by -DskipITs option. - Added common base POM for integration tests with pax-exam configuration. Change-Id: I4a0320b97a438bbc2f8234beb34ae246b683c353 Signed-off-by: Tony Tkacik --- .../clustering/integrationtest/pom.xml | 6 +- ...ionTest.java => ClusteringServicesIT.java} | 469 +++++++++--------- opendaylight/commons/integrationtest/pom.xml | 69 +++ opendaylight/commons/opendaylight/pom.xml | 26 + .../distribution/opendaylight/pom.xml | 2 + .../integrationtest/pom.xml | 8 +- ...est.java => ForwardingRulesManagerIT.java} | 80 +-- .../hosttracker/integrationtest/pom.xml | 6 +- ...ntegrationTest.java => HostTrackerIT.java} | 227 ++++----- ...IntegrationTest.java => NorthboundIT.java} | 4 +- .../statisticsmanager/integrationtest/pom.xml | 6 +- ...tionTest.java => StatisticsManagerIT.java} | 105 ++-- .../switchmanager/integrationtest/pom.xml | 6 +- ...egrationTest.java => SwitchManagerIT.java} | 141 +++--- 14 files changed, 630 insertions(+), 525 deletions(-) rename opendaylight/clustering/integrationtest/src/test/java/org/opendaylight/controller/clustering/services_implementation/internal/{ClusteringServicesIntegrationTest.java => ClusteringServicesIT.java} (89%) create mode 100644 opendaylight/commons/integrationtest/pom.xml rename opendaylight/forwardingrulesmanager/integrationtest/src/test/java/org/opendaylight/controller/forwardingrulesmanager/internal/{FRMIntegrationTest.java => ForwardingRulesManagerIT.java} (76%) rename opendaylight/hosttracker/integrationtest/src/test/java/org/opendaylight/controller/hosttracker/internal/{HostTrackerIntegrationTest.java => HostTrackerIT.java} (67%) rename opendaylight/northbound/integrationtest/src/test/java/org/opendaylight/controller/northbound/integrationtest/{NorthboundIntegrationTest.java => NorthboundIT.java} (99%) rename opendaylight/statisticsmanager/integrationtest/src/test/java/org/opendaylight/controller/statisticsmanager/internal/{StatisticsManagerIntegrationTest.java => StatisticsManagerIT.java} (82%) rename opendaylight/switchmanager/integrationtest/src/test/java/org/opendaylight/controller/switchmanager/internal/{SwitchmanagerIntegrationTest.java => SwitchManagerIT.java} (66%) diff --git a/opendaylight/clustering/integrationtest/pom.xml b/opendaylight/clustering/integrationtest/pom.xml index f94d205b52..460b09e9da 100644 --- a/opendaylight/clustering/integrationtest/pom.xml +++ b/opendaylight/clustering/integrationtest/pom.xml @@ -3,9 +3,9 @@ 4.0.0 org.opendaylight.controller - commons.opendaylight - 1.4.0-SNAPSHOT - ../../commons/opendaylight + commons.integrationtest + 0.5.0-SNAPSHOT + ../../commons/integrationtest clustering.services.integrationtest diff --git a/opendaylight/clustering/integrationtest/src/test/java/org/opendaylight/controller/clustering/services_implementation/internal/ClusteringServicesIntegrationTest.java b/opendaylight/clustering/integrationtest/src/test/java/org/opendaylight/controller/clustering/services_implementation/internal/ClusteringServicesIT.java similarity index 89% rename from opendaylight/clustering/integrationtest/src/test/java/org/opendaylight/controller/clustering/services_implementation/internal/ClusteringServicesIntegrationTest.java rename to opendaylight/clustering/integrationtest/src/test/java/org/opendaylight/controller/clustering/services_implementation/internal/ClusteringServicesIT.java index 587a4cf729..71a452b4cf 100644 --- a/opendaylight/clustering/integrationtest/src/test/java/org/opendaylight/controller/clustering/services_implementation/internal/ClusteringServicesIntegrationTest.java +++ b/opendaylight/clustering/integrationtest/src/test/java/org/opendaylight/controller/clustering/services_implementation/internal/ClusteringServicesIT.java @@ -1,235 +1,234 @@ -package org.opendaylight.controller.clustering.services_implementation.internal; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.ops4j.pax.exam.CoreOptions.junitBundles; -import static org.ops4j.pax.exam.CoreOptions.mavenBundle; -import static org.ops4j.pax.exam.CoreOptions.options; -import static org.ops4j.pax.exam.CoreOptions.systemPackages; -import static org.ops4j.pax.exam.CoreOptions.systemProperty; - -import java.net.InetAddress; -import java.util.HashSet; -import java.util.List; -import java.util.concurrent.ConcurrentMap; - -import javax.inject.Inject; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.opendaylight.controller.clustering.services.CacheConfigException; -import org.opendaylight.controller.clustering.services.CacheExistException; -import org.opendaylight.controller.clustering.services.CacheListenerAddException; -import org.opendaylight.controller.clustering.services.IClusterServices; -import org.opendaylight.controller.clustering.services.IClusterServices.cacheMode; -import org.opendaylight.controller.clustering.services.IGetUpdates; -import org.ops4j.pax.exam.Option; -import org.ops4j.pax.exam.junit.Configuration; -import org.ops4j.pax.exam.junit.PaxExam; -import org.ops4j.pax.exam.util.PathUtils; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.osgi.framework.ServiceReference; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -@RunWith(PaxExam.class) -public class ClusteringServicesIntegrationTest { - private Logger log = LoggerFactory - .getLogger(ClusteringServicesIntegrationTest.class); - // get the OSGI bundle context - @Inject - private BundleContext bc; - - private IClusterServices clusterServices = null; - - // Configure the OSGi container - @Configuration - public Option[] config() { - return options( - // - systemProperty("logback.configurationFile").value( - "file:" + PathUtils.getBaseDir() - + "/src/test/resources/logback.xml"), - // To start OSGi console for inspection remotely - systemProperty("osgi.console").value("2401"), - // Set the systemPackages (used by clustering) - systemPackages("sun.reflect", "sun.reflect.misc", "sun.misc"), - // List framework bundles - mavenBundle("equinoxSDK381", "org.eclipse.equinox.console", - "1.0.0.v20120522-1841"), - mavenBundle("equinoxSDK381", "org.eclipse.equinox.util", - "1.0.400.v20120522-2049"), - mavenBundle("equinoxSDK381", "org.eclipse.osgi.services", - "3.3.100.v20120522-1822"), - mavenBundle("equinoxSDK381", "org.eclipse.equinox.ds", - "1.4.0.v20120522-1841"), - mavenBundle("equinoxSDK381", "org.apache.felix.gogo.command", - "0.8.0.v201108120515"), - mavenBundle("equinoxSDK381", "org.apache.felix.gogo.runtime", - "0.8.0.v201108120515"), - mavenBundle("equinoxSDK381", "org.apache.felix.gogo.shell", - "0.8.0.v201110170705"), - // List logger bundles - mavenBundle("org.slf4j", "slf4j-api", "1.7.2"), - mavenBundle("org.slf4j", "log4j-over-slf4j", "1.7.2"), - mavenBundle("ch.qos.logback", "logback-core", "1.0.9"), - mavenBundle("ch.qos.logback", "logback-classic", "1.0.9"), - // List all the bundles on which the test case depends - mavenBundle("org.opendaylight.controller", - "clustering.services", "0.4.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", - "clustering.services-implementation", "0.4.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "sal", - "0.5.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", - "sal.implementation", "0.4.0-SNAPSHOT"), - mavenBundle("org.jboss.spec.javax.transaction", - "jboss-transaction-api_1.1_spec", "1.0.1.Final"), - mavenBundle("org.apache.commons", "commons-lang3", "3.1"), - mavenBundle("org.apache.felix", - "org.apache.felix.dependencymanager", "3.1.0"), - junitBundles()); - } - - private String stateToString(int state) { - switch (state) { - case Bundle.ACTIVE: - return "ACTIVE"; - case Bundle.INSTALLED: - return "INSTALLED"; - case Bundle.RESOLVED: - return "RESOLVED"; - case Bundle.UNINSTALLED: - return "UNINSTALLED"; - default: - return "Not CONVERTED"; - } - } - - @Before - public void areWeReady() { - assertNotNull(bc); - boolean debugit = false; - Bundle b[] = bc.getBundles(); - for (int i = 0; i < b.length; i++) { - int state = b[i].getState(); - if (state != Bundle.ACTIVE && state != Bundle.RESOLVED) { - log.debug("Bundle:" + b[i].getSymbolicName() + " state:" - + stateToString(state)); - debugit = true; - } - } - if (debugit) { - log.debug("Do some debugging because some bundle is " - + "unresolved"); - } - - // Assert if true, if false we are good to go! - assertFalse(debugit); - - ServiceReference r = bc.getServiceReference(IClusterServices.class - .getName()); - if (r != null) { - this.clusterServices = (IClusterServices) bc.getService(r); - } - assertNotNull(this.clusterServices); - - } - - @Test - public void clusterTest() throws CacheExistException, CacheConfigException, - CacheListenerAddException { - - String container1 = "Container1"; - String container2 = "Container2"; - String cache1 = "Cache1"; - String cache2 = "Cache2"; - String cache3 = "Cache3"; - - HashSet cacheModeSet = new HashSet(); - cacheModeSet.add(cacheMode.NON_TRANSACTIONAL); - ConcurrentMap cm11 = this.clusterServices.createCache(container1, - cache1, cacheModeSet); - assertNotNull(cm11); - - assertNull(this.clusterServices.getCache(container2, cache2)); - assertEquals(cm11, this.clusterServices.getCache(container1, cache1)); - - assertFalse(this.clusterServices.existCache(container2, cache2)); - assertTrue(this.clusterServices.existCache(container1, cache1)); - - ConcurrentMap cm12 = this.clusterServices.createCache(container1, - cache2, cacheModeSet); - ConcurrentMap cm23 = this.clusterServices.createCache(container2, - cache3, cacheModeSet); - - HashSet cacheList = (HashSet) this.clusterServices - .getCacheList(container1); - assertEquals(2, cacheList.size()); - assertTrue(cacheList.contains(cache1)); - assertTrue(cacheList.contains(cache2)); - assertFalse(cacheList.contains(cache3)); - - assertNotNull(this.clusterServices.getCacheProperties(container1, - cache1)); - - HashSet> listeners = (HashSet>) this.clusterServices - .getListeners(container1, cache1); - assertEquals(0, listeners.size()); - - IGetUpdates getUpdate1 = new GetUpdates(); - this.clusterServices.addListener(container1, cache1, getUpdate1); - listeners = (HashSet>) this.clusterServices - .getListeners(container1, cache1); - assertEquals(1, listeners.size()); - this.clusterServices.addListener(container1, cache1, new GetUpdates()); - listeners = (HashSet>) this.clusterServices - .getListeners(container1, cache1); - assertEquals(2, listeners.size()); - - listeners = (HashSet>) this.clusterServices - .getListeners(container2, cache3); - assertEquals(0, listeners.size()); - - this.clusterServices.removeListener(container1, cache1, getUpdate1); - listeners = (HashSet>) this.clusterServices - .getListeners(container1, cache1); - assertEquals(1, listeners.size()); - - InetAddress addr = this.clusterServices.getMyAddress(); - assertNotNull(addr); - - List addrList = this.clusterServices - .getClusteredControllers(); - - this.clusterServices.destroyCache(container1, cache1); - assertFalse(this.clusterServices.existCache(container1, cache1)); - - } - - private class GetUpdates implements IGetUpdates { - - @Override - public void entryCreated(Integer key, String containerName, - String cacheName, boolean originLocal) { - return; - } - - @Override - public void entryUpdated(Integer key, String new_value, - String containerName, String cacheName, boolean originLocal) { - return; - } - - @Override - public void entryDeleted(Integer key, String containerName, - String cacheName, boolean originLocal) { - return; - } - } -} +package org.opendaylight.controller.clustering.services_implementation.internal; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.ops4j.pax.exam.CoreOptions.junitBundles; +import static org.ops4j.pax.exam.CoreOptions.mavenBundle; +import static org.ops4j.pax.exam.CoreOptions.options; +import static org.ops4j.pax.exam.CoreOptions.systemPackages; +import static org.ops4j.pax.exam.CoreOptions.systemProperty; + +import java.net.InetAddress; +import java.util.HashSet; +import java.util.List; +import java.util.concurrent.ConcurrentMap; + +import javax.inject.Inject; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.opendaylight.controller.clustering.services.CacheConfigException; +import org.opendaylight.controller.clustering.services.CacheExistException; +import org.opendaylight.controller.clustering.services.CacheListenerAddException; +import org.opendaylight.controller.clustering.services.IClusterServices; +import org.opendaylight.controller.clustering.services.IClusterServices.cacheMode; +import org.opendaylight.controller.clustering.services.IGetUpdates; +import org.ops4j.pax.exam.Option; +import org.ops4j.pax.exam.junit.Configuration; +import org.ops4j.pax.exam.junit.PaxExam; +import org.ops4j.pax.exam.util.PathUtils; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceReference; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@RunWith(PaxExam.class) +public class ClusteringServicesIT { + private Logger log = LoggerFactory + .getLogger(ClusteringServicesIT.class); + // get the OSGI bundle context + @Inject + private BundleContext bc; + + private IClusterServices clusterServices = null; + + // Configure the OSGi container + @Configuration + public Option[] config() { + return options( + // + systemProperty("logback.configurationFile").value( + "file:" + PathUtils.getBaseDir() + + "/src/test/resources/logback.xml"), + // To start OSGi console for inspection remotely + systemProperty("osgi.console").value("2401"), + // Set the systemPackages (used by clustering) + systemPackages("sun.reflect", "sun.reflect.misc", "sun.misc"), + // List framework bundles + mavenBundle("equinoxSDK381", "org.eclipse.equinox.console", + "1.0.0.v20120522-1841"), + mavenBundle("equinoxSDK381", "org.eclipse.equinox.util", + "1.0.400.v20120522-2049"), + mavenBundle("equinoxSDK381", "org.eclipse.osgi.services", + "3.3.100.v20120522-1822"), + mavenBundle("equinoxSDK381", "org.eclipse.equinox.ds", + "1.4.0.v20120522-1841"), + mavenBundle("equinoxSDK381", "org.apache.felix.gogo.command", + "0.8.0.v201108120515"), + mavenBundle("equinoxSDK381", "org.apache.felix.gogo.runtime", + "0.8.0.v201108120515"), + mavenBundle("equinoxSDK381", "org.apache.felix.gogo.shell", + "0.8.0.v201110170705"), + // List logger bundles + mavenBundle("org.slf4j", "slf4j-api").versionAsInProject(), + mavenBundle("org.slf4j", "log4j-over-slf4j").versionAsInProject(), + mavenBundle("ch.qos.logback", "logback-core").versionAsInProject(), + mavenBundle("ch.qos.logback", "logback-classic").versionAsInProject(), + // List all the bundles on which the test case depends + mavenBundle("org.opendaylight.controller", + "clustering.services").versionAsInProject(), + mavenBundle("org.opendaylight.controller", + "clustering.services-implementation").versionAsInProject(), + mavenBundle("org.opendaylight.controller", "sal").versionAsInProject(), + mavenBundle("org.opendaylight.controller", + "sal.implementation").versionAsInProject(), + mavenBundle("org.jboss.spec.javax.transaction", + "jboss-transaction-api_1.1_spec").versionAsInProject(), + mavenBundle("org.apache.commons", "commons-lang3").versionAsInProject(), + mavenBundle("org.apache.felix", + "org.apache.felix.dependencymanager").versionAsInProject(), + junitBundles()); + } + + private String stateToString(int state) { + switch (state) { + case Bundle.ACTIVE: + return "ACTIVE"; + case Bundle.INSTALLED: + return "INSTALLED"; + case Bundle.RESOLVED: + return "RESOLVED"; + case Bundle.UNINSTALLED: + return "UNINSTALLED"; + default: + return "Not CONVERTED"; + } + } + + @Before + public void areWeReady() { + assertNotNull(bc); + boolean debugit = false; + Bundle b[] = bc.getBundles(); + for (int i = 0; i < b.length; i++) { + int state = b[i].getState(); + if (state != Bundle.ACTIVE && state != Bundle.RESOLVED) { + log.debug("Bundle:" + b[i].getSymbolicName() + " state:" + + stateToString(state)); + debugit = true; + } + } + if (debugit) { + log.debug("Do some debugging because some bundle is " + + "unresolved"); + } + + // Assert if true, if false we are good to go! + assertFalse(debugit); + + ServiceReference r = bc.getServiceReference(IClusterServices.class + .getName()); + if (r != null) { + this.clusterServices = (IClusterServices) bc.getService(r); + } + assertNotNull(this.clusterServices); + + } + + @Test + public void clusterTest() throws CacheExistException, CacheConfigException, + CacheListenerAddException { + + String container1 = "Container1"; + String container2 = "Container2"; + String cache1 = "Cache1"; + String cache2 = "Cache2"; + String cache3 = "Cache3"; + + HashSet cacheModeSet = new HashSet(); + cacheModeSet.add(cacheMode.NON_TRANSACTIONAL); + ConcurrentMap cm11 = this.clusterServices.createCache(container1, + cache1, cacheModeSet); + assertNotNull(cm11); + + assertNull(this.clusterServices.getCache(container2, cache2)); + assertEquals(cm11, this.clusterServices.getCache(container1, cache1)); + + assertFalse(this.clusterServices.existCache(container2, cache2)); + assertTrue(this.clusterServices.existCache(container1, cache1)); + + ConcurrentMap cm12 = this.clusterServices.createCache(container1, + cache2, cacheModeSet); + ConcurrentMap cm23 = this.clusterServices.createCache(container2, + cache3, cacheModeSet); + + HashSet cacheList = (HashSet) this.clusterServices + .getCacheList(container1); + assertEquals(2, cacheList.size()); + assertTrue(cacheList.contains(cache1)); + assertTrue(cacheList.contains(cache2)); + assertFalse(cacheList.contains(cache3)); + + assertNotNull(this.clusterServices.getCacheProperties(container1, + cache1)); + + HashSet> listeners = (HashSet>) this.clusterServices + .getListeners(container1, cache1); + assertEquals(0, listeners.size()); + + IGetUpdates getUpdate1 = new GetUpdates(); + this.clusterServices.addListener(container1, cache1, getUpdate1); + listeners = (HashSet>) this.clusterServices + .getListeners(container1, cache1); + assertEquals(1, listeners.size()); + this.clusterServices.addListener(container1, cache1, new GetUpdates()); + listeners = (HashSet>) this.clusterServices + .getListeners(container1, cache1); + assertEquals(2, listeners.size()); + + listeners = (HashSet>) this.clusterServices + .getListeners(container2, cache3); + assertEquals(0, listeners.size()); + + this.clusterServices.removeListener(container1, cache1, getUpdate1); + listeners = (HashSet>) this.clusterServices + .getListeners(container1, cache1); + assertEquals(1, listeners.size()); + + InetAddress addr = this.clusterServices.getMyAddress(); + assertNotNull(addr); + + List addrList = this.clusterServices + .getClusteredControllers(); + + this.clusterServices.destroyCache(container1, cache1); + assertFalse(this.clusterServices.existCache(container1, cache1)); + + } + + private class GetUpdates implements IGetUpdates { + + @Override + public void entryCreated(Integer key, String containerName, + String cacheName, boolean originLocal) { + return; + } + + @Override + public void entryUpdated(Integer key, String new_value, + String containerName, String cacheName, boolean originLocal) { + return; + } + + @Override + public void entryDeleted(Integer key, String containerName, + String cacheName, boolean originLocal) { + return; + } + } +} diff --git a/opendaylight/commons/integrationtest/pom.xml b/opendaylight/commons/integrationtest/pom.xml new file mode 100644 index 0000000000..a438ad8393 --- /dev/null +++ b/opendaylight/commons/integrationtest/pom.xml @@ -0,0 +1,69 @@ + + + 4.0.0 + + org.opendaylight.controller + commons.opendaylight + 1.4.0-SNAPSHOT + ../../commons/opendaylight + + + commons.integrationtest + 0.5.0-SNAPSHOT + pom + + + + equinoxSDK381 + org.eclipse.equinox.console + 1.0.0.v20120522-1841 + + + equinoxSDK381 + org.eclipse.equinox.util + 1.0.400.v20120522-2049 + + + equinoxSDK381 + org.eclipse.osgi.services + 3.3.100.v20120522-1822 + + + equinoxSDK381 + org.eclipse.equinox.ds + 1.4.0.v20120522-1841 + + + equinoxSDK381 + org.apache.felix.gogo.command + 0.8.0.v201108120515 + + + equinoxSDK381 + org.apache.felix.gogo.runtime + 0.8.0.v201108120515 + + + equinoxSDK381 + org.apache.felix.gogo.shell + 0.8.0.v201110170705 + + + + + + + org.ops4j.pax.exam + maven-paxexam-plugin + + + generate-config + + generate-depends-file + + + + + + + diff --git a/opendaylight/commons/opendaylight/pom.xml b/opendaylight/commons/opendaylight/pom.xml index 07f23db461..9814b5f91c 100644 --- a/opendaylight/commons/opendaylight/pom.xml +++ b/opendaylight/commons/opendaylight/pom.xml @@ -279,6 +279,19 @@ ${project.parent.relativePath}/sun_coding_style.xml + + org.apache.maven.plugins + maven-failsafe-plugin + 2.14.1 + + + + integration-test + verify + + + + @@ -331,6 +344,19 @@ + + + org.ops4j.pax.exam + maven-paxexam-plugin + [1.2.4,) + + generate-depends-file + + + + + + diff --git a/opendaylight/distribution/opendaylight/pom.xml b/opendaylight/distribution/opendaylight/pom.xml index 86725e9d05..b30241daa8 100644 --- a/opendaylight/distribution/opendaylight/pom.xml +++ b/opendaylight/distribution/opendaylight/pom.xml @@ -98,6 +98,8 @@ ../../samples/loadbalancer ../../samples/northbound/loadbalancer ../../commons/concepts + ../../commons/integrationtest + diff --git a/opendaylight/forwardingrulesmanager/integrationtest/pom.xml b/opendaylight/forwardingrulesmanager/integrationtest/pom.xml index 31371da038..b626b4fdaf 100644 --- a/opendaylight/forwardingrulesmanager/integrationtest/pom.xml +++ b/opendaylight/forwardingrulesmanager/integrationtest/pom.xml @@ -5,9 +5,9 @@ 4.0.0 org.opendaylight.controller - commons.opendaylight - 1.4.0-SNAPSHOT - ../../commons/opendaylight + commons.integrationtest + 0.5.0-SNAPSHOT + ../../commons/integrationtest forwardingrulesmanager.integrationtest @@ -57,7 +57,7 @@ org.opendaylight.controller sal - 0.4.0-SNAPSHOT + 0.5.0-SNAPSHOT org.opendaylight.controller diff --git a/opendaylight/forwardingrulesmanager/integrationtest/src/test/java/org/opendaylight/controller/forwardingrulesmanager/internal/FRMIntegrationTest.java b/opendaylight/forwardingrulesmanager/integrationtest/src/test/java/org/opendaylight/controller/forwardingrulesmanager/internal/ForwardingRulesManagerIT.java similarity index 76% rename from opendaylight/forwardingrulesmanager/integrationtest/src/test/java/org/opendaylight/controller/forwardingrulesmanager/internal/FRMIntegrationTest.java rename to opendaylight/forwardingrulesmanager/integrationtest/src/test/java/org/opendaylight/controller/forwardingrulesmanager/internal/ForwardingRulesManagerIT.java index 8fa37b5471..6876144905 100644 --- a/opendaylight/forwardingrulesmanager/integrationtest/src/test/java/org/opendaylight/controller/forwardingrulesmanager/internal/FRMIntegrationTest.java +++ b/opendaylight/forwardingrulesmanager/integrationtest/src/test/java/org/opendaylight/controller/forwardingrulesmanager/internal/ForwardingRulesManagerIT.java @@ -41,8 +41,8 @@ import org.ops4j.pax.exam.Option; import org.ops4j.pax.exam.util.PathUtils; @RunWith(PaxExam.class) -public class FRMIntegrationTest { - private Logger log = LoggerFactory.getLogger(FRMIntegrationTest.class); +public class ForwardingRulesManagerIT { + private Logger log = LoggerFactory.getLogger(ForwardingRulesManagerIT.class); // get the OSGI bundle context @Inject private BundleContext bc; @@ -77,59 +77,63 @@ public class FRMIntegrationTest { mavenBundle("equinoxSDK381", "org.apache.felix.gogo.shell", "0.8.0.v201110170705"), // List logger bundles - mavenBundle("org.slf4j", "slf4j-api", "1.7.2"), - mavenBundle("org.slf4j", "log4j-over-slf4j", "1.7.2"), - mavenBundle("ch.qos.logback", "logback-core", "1.0.9"), - mavenBundle("ch.qos.logback", "logback-classic", "1.0.9"), + mavenBundle("org.slf4j", "slf4j-api").versionAsInProject(), + mavenBundle("org.slf4j", "log4j-over-slf4j") + .versionAsInProject(), + mavenBundle("ch.qos.logback", "logback-core") + .versionAsInProject(), + mavenBundle("ch.qos.logback", "logback-classic") + .versionAsInProject(), // List all the bundles on which the test case depends - mavenBundle("org.opendaylight.controller", "sal", - "0.5.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", - "sal.implementation", "0.4.0-SNAPSHOT"), + mavenBundle("org.opendaylight.controller", "sal") + .versionAsInProject(), + mavenBundle("org.opendaylight.controller", "sal.implementation") + .versionAsInProject(), mavenBundle("org.opendaylight.controller", - "protocol_plugins.stub", "0.4.0-SNAPSHOT"), - - mavenBundle("org.opendaylight.controller", "containermanager", - "0.4.0-SNAPSHOT"), + "protocol_plugins.stub").versionAsInProject(), + + mavenBundle("org.opendaylight.controller", "containermanager") + .versionAsInProject(), mavenBundle("org.opendaylight.controller", - "containermanager.implementation", "0.4.0-SNAPSHOT"), + "containermanager.implementation").versionAsInProject(), mavenBundle("org.opendaylight.controller", - "forwardingrulesmanager", "0.4.0-SNAPSHOT"), + "forwardingrulesmanager").versionAsInProject(), mavenBundle("org.opendaylight.controller", - "forwardingrulesmanager.implementation", - "0.4.0-SNAPSHOT"), + "forwardingrulesmanager.implementation") + .versionAsInProject(), mavenBundle("org.opendaylight.controller", - "clustering.services", "0.4.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "clustering.stub", - "0.4.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "switchmanager", - "0.4.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "switchmanager.implementation", - "0.4.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "configuration", - "0.4.0-SNAPSHOT"), + "clustering.services").versionAsInProject(), + mavenBundle("org.opendaylight.controller", "clustering.stub") + .versionAsInProject(), + mavenBundle("org.opendaylight.controller", "switchmanager") + .versionAsInProject(), + mavenBundle("org.opendaylight.controller", + "switchmanager.implementation").versionAsInProject(), + mavenBundle("org.opendaylight.controller", "configuration") + .versionAsInProject(), mavenBundle("org.opendaylight.controller", - "configuration.implementation", "0.4.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "hosttracker", - "0.4.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "hosttracker.implementation", - "0.4.0-SNAPSHOT"), + "configuration.implementation").versionAsInProject(), + mavenBundle("org.opendaylight.controller", "hosttracker") + .versionAsInProject(), + mavenBundle("org.opendaylight.controller", + "hosttracker.implementation").versionAsInProject(), // needed by hosttracker - mavenBundle("org.opendaylight.controller", "topologymanager", - "0.4.0-SNAPSHOT"), + mavenBundle("org.opendaylight.controller", "topologymanager") + .versionAsInProject(), mavenBundle("org.jboss.spec.javax.transaction", - "jboss-transaction-api_1.1_spec", "1.0.1.Final"), - mavenBundle("org.apache.commons", "commons-lang3", "3.1"), + "jboss-transaction-api_1.1_spec").versionAsInProject(), + mavenBundle("org.apache.commons", "commons-lang3") + .versionAsInProject(), mavenBundle("org.apache.felix", - "org.apache.felix.dependencymanager", "3.1.0"), - junitBundles()); + "org.apache.felix.dependencymanager") + .versionAsInProject(), junitBundles()); } private String stateToString(int state) { diff --git a/opendaylight/hosttracker/integrationtest/pom.xml b/opendaylight/hosttracker/integrationtest/pom.xml index dd8a3ad6bd..a4e5547059 100644 --- a/opendaylight/hosttracker/integrationtest/pom.xml +++ b/opendaylight/hosttracker/integrationtest/pom.xml @@ -4,9 +4,9 @@ 4.0.0 org.opendaylight.controller - commons.opendaylight - 1.4.0-SNAPSHOT - ../../../opendaylight/commons/opendaylight + commons.integrationtest + 0.5.0-SNAPSHOT + ../../commons/integrationtest hosttracker.integrationtest diff --git a/opendaylight/hosttracker/integrationtest/src/test/java/org/opendaylight/controller/hosttracker/internal/HostTrackerIntegrationTest.java b/opendaylight/hosttracker/integrationtest/src/test/java/org/opendaylight/controller/hosttracker/internal/HostTrackerIT.java similarity index 67% rename from opendaylight/hosttracker/integrationtest/src/test/java/org/opendaylight/controller/hosttracker/internal/HostTrackerIntegrationTest.java rename to opendaylight/hosttracker/integrationtest/src/test/java/org/opendaylight/controller/hosttracker/internal/HostTrackerIT.java index c5407794d2..1cf320b4df 100644 --- a/opendaylight/hosttracker/integrationtest/src/test/java/org/opendaylight/controller/hosttracker/internal/HostTrackerIntegrationTest.java +++ b/opendaylight/hosttracker/integrationtest/src/test/java/org/opendaylight/controller/hosttracker/internal/HostTrackerIT.java @@ -1,4 +1,3 @@ - /* * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. * @@ -9,7 +8,6 @@ package org.opendaylight.controller.hosttracker.internal; - import java.net.InetAddress; import java.net.UnknownHostException; import java.util.ArrayList; @@ -60,19 +58,19 @@ import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy; import org.ops4j.pax.exam.spi.reactors.PerClass; @RunWith(PaxExam.class) -public class HostTrackerIntegrationTest { +public class HostTrackerIT { private Logger log = LoggerFactory - .getLogger(HostTrackerIntegrationTest.class); + .getLogger(HostTrackerIT.class); // get the OSGI bundle context @Inject private BundleContext bc; - + private IfIptoHost hosttracker = null; private ISwitchManagerAware switchManagerAware = null; private IInventoryListener invtoryListener = null; private IfHostListener hostListener = null; private ITopologyManagerAware topologyManagerAware = null; - + // Configure the OSGi container @Configuration public Option[] config() { @@ -101,55 +99,58 @@ public class HostTrackerIntegrationTest { mavenBundle("equinoxSDK381", "org.apache.felix.gogo.shell", "0.8.0.v201110170705"), // List logger bundles - mavenBundle("org.slf4j", "slf4j-api", "1.7.2"), - mavenBundle("org.slf4j", "log4j-over-slf4j", "1.7.2"), - mavenBundle("ch.qos.logback", "logback-core", "1.0.9"), - mavenBundle("ch.qos.logback", "logback-classic", "1.0.9"), - + mavenBundle("org.slf4j", "slf4j-api").versionAsInProject(), + mavenBundle("org.slf4j", "log4j-over-slf4j") + .versionAsInProject(), + mavenBundle("ch.qos.logback", "logback-core") + .versionAsInProject(), + mavenBundle("ch.qos.logback", "logback-classic") + .versionAsInProject(), + // List all the bundles on which the test case depends - mavenBundle("org.opendaylight.controller", "sal", - "0.5.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "sal.implementation", - "0.4.0-SNAPSHOT"), - - // needed by statisticsmanager - mavenBundle("org.opendaylight.controller", "containermanager", - "0.4.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "containermanager.implementation", - "0.4.0-SNAPSHOT"), - - mavenBundle("org.opendaylight.controller", - "clustering.services", "0.4.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", - "clustering.stub", "0.4.0-SNAPSHOT"), + mavenBundle("org.opendaylight.controller", "sal") + .versionAsInProject(), + mavenBundle("org.opendaylight.controller", "sal.implementation") + .versionAsInProject(), + + // needed by statisticsmanager + mavenBundle("org.opendaylight.controller", "containermanager") + .versionAsInProject(), + mavenBundle("org.opendaylight.controller", + "containermanager.implementation").versionAsInProject(), + + mavenBundle("org.opendaylight.controller", + "clustering.services").versionAsInProject(), + mavenBundle("org.opendaylight.controller", "clustering.stub") + .versionAsInProject(), // needed by forwardingrulesmanager - mavenBundle("org.opendaylight.controller", "switchmanager", - "0.4.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "switchmanager.implementation", - "0.4.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "configuration", - "0.4.0-SNAPSHOT"), + mavenBundle("org.opendaylight.controller", "switchmanager") + .versionAsInProject(), + mavenBundle("org.opendaylight.controller", + "switchmanager.implementation").versionAsInProject(), + mavenBundle("org.opendaylight.controller", "configuration") + .versionAsInProject(), mavenBundle("org.opendaylight.controller", - "configuration.implementation", "0.4.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "hosttracker", - "0.4.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "hosttracker.implementation", - "0.4.0-SNAPSHOT"), + "configuration.implementation").versionAsInProject(), + mavenBundle("org.opendaylight.controller", "hosttracker") + .versionAsInProject(), + mavenBundle("org.opendaylight.controller", + "hosttracker.implementation").versionAsInProject(), // needed by hosttracker - mavenBundle("org.opendaylight.controller", "topologymanager", - "0.4.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "arphandler", - "0.4.0-SNAPSHOT"), - + mavenBundle("org.opendaylight.controller", "topologymanager") + .versionAsInProject(), + mavenBundle("org.opendaylight.controller", "arphandler") + .versionAsInProject(), mavenBundle("org.jboss.spec.javax.transaction", - "jboss-transaction-api_1.1_spec", "1.0.1.Final"), - mavenBundle("org.apache.commons", "commons-lang3", "3.1"), + "jboss-transaction-api_1.1_spec").versionAsInProject(), + mavenBundle("org.apache.commons", "commons-lang3") + .versionAsInProject(), mavenBundle("org.apache.felix", - "org.apache.felix.dependencymanager", "3.1.0"), - junitBundles()); + "org.apache.felix.dependencymanager") + .versionAsInProject(), junitBundles()); } private String stateToString(int state) { @@ -188,52 +189,54 @@ public class HostTrackerIntegrationTest { // Assert if true, if false we are good to go! assertFalse(debugit); - // Now lets create a hosttracker for testing purpose - ServiceReference s = bc - .getServiceReference(IfIptoHost.class.getName()); - if (s != null) { - this.hosttracker = (IfIptoHost)bc.getService(s); - this.switchManagerAware = (ISwitchManagerAware) this.hosttracker; - this.invtoryListener = (IInventoryListener) this.hosttracker; - this.hostListener = (IfHostListener) this.hosttracker; - this.topologyManagerAware = (ITopologyManagerAware) this.hosttracker; - } - - // If StatisticsManager is null, cannot run tests. - assertNotNull(this.hosttracker); + // Now lets create a hosttracker for testing purpose + ServiceReference s = bc.getServiceReference(IfIptoHost.class.getName()); + if (s != null) { + this.hosttracker = (IfIptoHost) bc.getService(s); + this.switchManagerAware = (ISwitchManagerAware) this.hosttracker; + this.invtoryListener = (IInventoryListener) this.hosttracker; + this.hostListener = (IfHostListener) this.hosttracker; + this.topologyManagerAware = (ITopologyManagerAware) this.hosttracker; + } + + // If StatisticsManager is null, cannot run tests. + assertNotNull(this.hosttracker); } - - + @Test public void testStaticHost() throws UnknownHostException { String ip; - + assertNotNull(this.hosttracker); - + // create one node and two node connectors Node node1 = NodeCreator.createOFNode(1L); - NodeConnector nc1_1 = NodeConnectorCreator.createOFNodeConnector((short) 1, node1); - NodeConnector nc1_2 = NodeConnectorCreator.createOFNodeConnector((short) 2, node1); - - // test addStaticHost(), store into inactive host DB - Status st = this.hosttracker.addStaticHost("192.168.0.8", "11:22:33:44:55:66", - nc1_1, "0"); + NodeConnector nc1_1 = NodeConnectorCreator.createOFNodeConnector( + (short) 1, node1); + NodeConnector nc1_2 = NodeConnectorCreator.createOFNodeConnector( + (short) 2, node1); + + // test addStaticHost(), store into inactive host DB + Status st = this.hosttracker.addStaticHost("192.168.0.8", + "11:22:33:44:55:66", nc1_1, "0"); Assert.assertTrue(st.isSuccess()); - st = this.hosttracker.addStaticHost("192.168.0.13", "11:22:33:44:55:77", - nc1_2, "0"); + st = this.hosttracker.addStaticHost("192.168.0.13", + "11:22:33:44:55:77", nc1_2, "0"); Assert.assertTrue(st.isSuccess()); - + // check inactive DB - Iterator hnci = this.hosttracker.getInactiveStaticHosts().iterator(); + Iterator hnci = this.hosttracker + .getInactiveStaticHosts().iterator(); while (hnci.hasNext()) { ip = hnci.next().getNetworkAddressAsString(); - Assert.assertTrue(ip.equals("192.168.0.8") || ip.equals("192.168.0.13")); + Assert.assertTrue(ip.equals("192.168.0.8") + || ip.equals("192.168.0.13")); } - + // check active host DB hnci = this.hosttracker.getActiveStaticHosts().iterator(); Assert.assertFalse(hnci.hasNext()); - + // test removeStaticHost() st = this.hosttracker.removeStaticHost("192.168.0.8"); Assert.assertTrue(st.isSuccess()); @@ -243,45 +246,44 @@ public class HostTrackerIntegrationTest { ip = hnci.next().getNetworkAddressAsString(); Assert.assertTrue(ip.equals("192.168.0.13")); } - } - + } - @Test public void testNotifyNodeConnector() throws UnknownHostException { String ip; - + assertNotNull(this.invtoryListener); // create one node and two node connectors Node node1 = NodeCreator.createOFNode(1L); - NodeConnector nc1_1 = NodeConnectorCreator.createOFNodeConnector((short) 1, node1); - NodeConnector nc1_2 = NodeConnectorCreator.createOFNodeConnector((short) 2, node1); - + NodeConnector nc1_1 = NodeConnectorCreator.createOFNodeConnector( + (short) 1, node1); + NodeConnector nc1_2 = NodeConnectorCreator.createOFNodeConnector( + (short) 2, node1); + // test addStaticHost(), put into inactive host DB if not verifiable - Status st = this.hosttracker.addStaticHost("192.168.0.8", "11:22:33:44:55:66", - nc1_1, "0"); - st = this.hosttracker.addStaticHost("192.168.0.13", "11:22:33:44:55:77", - nc1_2, "0"); - - this.invtoryListener.notifyNodeConnector(nc1_1, - UpdateType.ADDED, null); + Status st = this.hosttracker.addStaticHost("192.168.0.8", + "11:22:33:44:55:66", nc1_1, "0"); + st = this.hosttracker.addStaticHost("192.168.0.13", + "11:22:33:44:55:77", nc1_2, "0"); + + this.invtoryListener.notifyNodeConnector(nc1_1, UpdateType.ADDED, null); // check all host list - Iterator hnci = this.hosttracker - .getAllHosts().iterator(); + Iterator hnci = this.hosttracker.getAllHosts() + .iterator(); while (hnci.hasNext()) { ip = hnci.next().getNetworkAddressAsString(); Assert.assertTrue(ip.equals("192.168.0.8")); } - + // check active host DB hnci = this.hosttracker.getActiveStaticHosts().iterator(); while (hnci.hasNext()) { ip = hnci.next().getNetworkAddressAsString(); Assert.assertTrue(ip.equals("192.168.0.8")); } - + // check inactive host DB hnci = this.hosttracker.getInactiveStaticHosts().iterator(); while (hnci.hasNext()) { @@ -289,35 +291,34 @@ public class HostTrackerIntegrationTest { Assert.assertTrue(ip.equals("192.168.0.13")); } } - - - + @Test public void testHostFind() throws UnknownHostException { - + assertNotNull(this.invtoryListener); // create one node and two node connectors Node node1 = NodeCreator.createOFNode(1L); - NodeConnector nc1_1 = NodeConnectorCreator.createOFNodeConnector((short) 1, node1); - NodeConnector nc1_2 = NodeConnectorCreator.createOFNodeConnector((short) 2, node1); - + NodeConnector nc1_1 = NodeConnectorCreator.createOFNodeConnector( + (short) 1, node1); + NodeConnector nc1_2 = NodeConnectorCreator.createOFNodeConnector( + (short) 2, node1); + // test addStaticHost(), put into inactive host DB if not verifiable - Status st = this.hosttracker.addStaticHost( - "192.168.0.8", "11:22:33:44:55:66", nc1_1, "0"); - st = this.hosttracker.addStaticHost( - "192.168.0.13", "11:22:33:44:55:77", nc1_2, "0"); - - HostNodeConnector hnc_1 = this.hosttracker - .hostFind(InetAddress.getByName("192.168.0.8")); + Status st = this.hosttracker.addStaticHost("192.168.0.8", + "11:22:33:44:55:66", nc1_1, "0"); + st = this.hosttracker.addStaticHost("192.168.0.13", + "11:22:33:44:55:77", nc1_2, "0"); + + HostNodeConnector hnc_1 = this.hosttracker.hostFind(InetAddress + .getByName("192.168.0.8")); assertNull(hnc_1); - - this.invtoryListener.notifyNodeConnector(nc1_1, - UpdateType.ADDED, null); + + this.invtoryListener.notifyNodeConnector(nc1_1, UpdateType.ADDED, null); hnc_1 = this.hosttracker.hostFind(InetAddress.getByName("192.168.0.8")); assertNotNull(hnc_1); - + } - + } diff --git a/opendaylight/northbound/integrationtest/src/test/java/org/opendaylight/controller/northbound/integrationtest/NorthboundIntegrationTest.java b/opendaylight/northbound/integrationtest/src/test/java/org/opendaylight/controller/northbound/integrationtest/NorthboundIT.java similarity index 99% rename from opendaylight/northbound/integrationtest/src/test/java/org/opendaylight/controller/northbound/integrationtest/NorthboundIntegrationTest.java rename to opendaylight/northbound/integrationtest/src/test/java/org/opendaylight/controller/northbound/integrationtest/NorthboundIT.java index 53eb40c4a5..24eb3d7a4c 100644 --- a/opendaylight/northbound/integrationtest/src/test/java/org/opendaylight/controller/northbound/integrationtest/NorthboundIntegrationTest.java +++ b/opendaylight/northbound/integrationtest/src/test/java/org/opendaylight/controller/northbound/integrationtest/NorthboundIT.java @@ -43,9 +43,9 @@ import org.opendaylight.controller.usermanager.IUserManager; @RunWith(PaxExam.class) -public class NorthboundIntegrationTest { +public class NorthboundIT { private Logger log = LoggerFactory - .getLogger(NorthboundIntegrationTest.class); + .getLogger(NorthboundIT.class); // get the OSGI bundle context @Inject private BundleContext bc; diff --git a/opendaylight/statisticsmanager/integrationtest/pom.xml b/opendaylight/statisticsmanager/integrationtest/pom.xml index aaf8a6fdbd..8fcad060b7 100644 --- a/opendaylight/statisticsmanager/integrationtest/pom.xml +++ b/opendaylight/statisticsmanager/integrationtest/pom.xml @@ -5,9 +5,9 @@ 4.0.0 org.opendaylight.controller - commons.opendaylight - 1.4.0-SNAPSHOT - ../../commons/opendaylight + commons.integrationtest + 0.5.0-SNAPSHOT + ../../commons/integrationtest statisticsmanager.integrationtest 0.4.0-SNAPSHOT diff --git a/opendaylight/statisticsmanager/integrationtest/src/test/java/org/opendaylight/controller/statisticsmanager/internal/StatisticsManagerIntegrationTest.java b/opendaylight/statisticsmanager/integrationtest/src/test/java/org/opendaylight/controller/statisticsmanager/internal/StatisticsManagerIT.java similarity index 82% rename from opendaylight/statisticsmanager/integrationtest/src/test/java/org/opendaylight/controller/statisticsmanager/internal/StatisticsManagerIntegrationTest.java rename to opendaylight/statisticsmanager/integrationtest/src/test/java/org/opendaylight/controller/statisticsmanager/internal/StatisticsManagerIT.java index 4dafbf87dc..64d752dd31 100644 --- a/opendaylight/statisticsmanager/integrationtest/src/test/java/org/opendaylight/controller/statisticsmanager/internal/StatisticsManagerIntegrationTest.java +++ b/opendaylight/statisticsmanager/integrationtest/src/test/java/org/opendaylight/controller/statisticsmanager/internal/StatisticsManagerIT.java @@ -40,9 +40,9 @@ import org.ops4j.pax.exam.Option; import org.ops4j.pax.exam.util.PathUtils; @RunWith(PaxExam.class) -public class StatisticsManagerIntegrationTest { +public class StatisticsManagerIT { private Logger log = LoggerFactory - .getLogger(StatisticsManagerIntegrationTest.class); + .getLogger(StatisticsManagerIT.class); // get the OSGI bundle context @Inject private BundleContext bc; @@ -77,55 +77,60 @@ public class StatisticsManagerIntegrationTest { mavenBundle("equinoxSDK381", "org.apache.felix.gogo.shell", "0.8.0.v201110170705"), // List logger bundles - mavenBundle("org.slf4j", "slf4j-api", "1.7.2"), - mavenBundle("org.slf4j", "log4j-over-slf4j", "1.7.2"), - mavenBundle("ch.qos.logback", "logback-core", "1.0.9"), - mavenBundle("ch.qos.logback", "logback-classic", "1.0.9"), + mavenBundle("org.slf4j", "slf4j-api").versionAsInProject(), + mavenBundle("org.slf4j", "log4j-over-slf4j") + .versionAsInProject(), + mavenBundle("ch.qos.logback", "logback-core") + .versionAsInProject(), + mavenBundle("ch.qos.logback", "logback-classic") + .versionAsInProject(), // List all the bundles on which the test case depends - mavenBundle("org.opendaylight.controller", "sal", - "0.5.0-SNAPSHOT"), + mavenBundle("org.opendaylight.controller", "sal") + .versionAsInProject(), + mavenBundle("org.opendaylight.controller", "sal.implementation") + .versionAsInProject(), + mavenBundle("org.opendaylight.controller", "statisticsmanager") + .versionAsInProject(), mavenBundle("org.opendaylight.controller", - "sal.implementation", "0.4.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "statisticsmanager", - "0.4.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "statisticsmanager.implementation", - "0.4.0-SNAPSHOT"), + "statisticsmanager.implementation") + .versionAsInProject(), mavenBundle("org.opendaylight.controller", - "protocol_plugins.stub", "0.4.0-SNAPSHOT"), + "protocol_plugins.stub").versionAsInProject(), // needed by statisticsmanager - mavenBundle("org.opendaylight.controller", "containermanager", - "0.4.0-SNAPSHOT"), + mavenBundle("org.opendaylight.controller", "containermanager") + .versionAsInProject(), mavenBundle("org.opendaylight.controller", - "containermanager.implementation", "0.4.0-SNAPSHOT"), + "containermanager.implementation").versionAsInProject(), mavenBundle("org.opendaylight.controller", - "forwardingrulesmanager", "0.4.0-SNAPSHOT"), + "forwardingrulesmanager").versionAsInProject(), mavenBundle("org.opendaylight.controller", - "clustering.services", "0.4.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", - "clustering.stub", "0.4.0-SNAPSHOT"), + "clustering.services").versionAsInProject(), + mavenBundle("org.opendaylight.controller", "clustering.stub") + .versionAsInProject(), // needed by forwardingrulesmanager - mavenBundle("org.opendaylight.controller", "switchmanager", - "0.4.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "configuration", - "0.4.0-SNAPSHOT"), + mavenBundle("org.opendaylight.controller", "switchmanager") + .versionAsInProject(), + mavenBundle("org.opendaylight.controller", "configuration") + .versionAsInProject(), mavenBundle("org.opendaylight.controller", - "configuration.implementation", "0.4.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "hosttracker", - "0.4.0-SNAPSHOT"), + "configuration.implementation").versionAsInProject(), + mavenBundle("org.opendaylight.controller", "hosttracker") + .versionAsInProject(), // needed by hosttracker - mavenBundle("org.opendaylight.controller", "topologymanager", - "0.4.0-SNAPSHOT"), + mavenBundle("org.opendaylight.controller", "topologymanager") + .versionAsInProject(), mavenBundle("org.jboss.spec.javax.transaction", - "jboss-transaction-api_1.1_spec", "1.0.1.Final"), - mavenBundle("org.apache.commons", "commons-lang3", "3.1"), + "jboss-transaction-api_1.1_spec").versionAsInProject(), + mavenBundle("org.apache.commons", "commons-lang3") + .versionAsInProject(), mavenBundle("org.apache.felix", - "org.apache.felix.dependencymanager", "3.1.0"), - junitBundles()); + "org.apache.felix.dependencymanager") + .versionAsInProject(), junitBundles()); } private String stateToString(int state) { @@ -188,17 +193,19 @@ public class StatisticsManagerIntegrationTest { Match match = new Match(); try { - match.setField(MatchType.NW_DST, InetAddress.getByName("1.1.1.1")); + match.setField(MatchType.NW_DST, + InetAddress.getByName("1.1.1.1")); } catch (UnknownHostException e) { fail("Couldn't create match"); } Assert.assertTrue(match.equals(fn.getFlow().getMatch())); - Assert.assertTrue(fn.getFlow().getActions().get(0).equals(new Drop())); + Assert.assertTrue(fn.getFlow().getActions().get(0) + .equals(new Drop())); } catch (ConstructionException e) { // Got an unexpected exception Assert.assertTrue(false); } - + } @Test @@ -217,14 +224,14 @@ public class StatisticsManagerIntegrationTest { actions.add(action); flow.setActions(actions); - try{ + try { Node node = new Node("STUB", 0xCAFE); FlowEntry fe = new FlowEntry("g1", "f1", flow, node); List list = new ArrayList(); list.add(fe); FlowEntry fe2 = new FlowEntry("g1", "f2", flow, node); list.add(fe2); - + Map> result = this.manager .getFlowStatisticsForFlowList(null); Assert.assertTrue(result.isEmpty()); @@ -237,7 +244,7 @@ public class StatisticsManagerIntegrationTest { Assert.assertTrue(fn.getTableId() == (byte) 0x1); Assert.assertTrue(fn.getPacketCount() == 200); Assert.assertTrue(fn.getFlow().equals(flow)); - }catch(ConstructionException e){ + } catch (ConstructionException e) { Assert.assertTrue(false); } @@ -245,9 +252,9 @@ public class StatisticsManagerIntegrationTest { @Test public void testGetFlowsNumber() { - try{ + try { Node node = new Node("STUB", 0xCAFE); - Assert.assertTrue(this.manager.getFlowsNumber(node) == 21); + Assert.assertEquals(21, this.manager.getFlowsNumber(node)); }catch(ConstructionException e){ Assert.assertTrue(false); } @@ -255,7 +262,7 @@ public class StatisticsManagerIntegrationTest { @Test public void testGetNodeDescription() { - try{ + try { Node node = new Node("STUB", 0xCAFE); NodeDescription desc = this.manager.getNodeDescription(node); Assert.assertTrue(desc.getDescription().equals( @@ -264,7 +271,7 @@ public class StatisticsManagerIntegrationTest { Assert.assertTrue(desc.getSoftware().equals("stub software")); Assert.assertTrue(desc.getSerialNumber().equals("123")); Assert.assertTrue(desc.getManufacturer().equals("opendaylight")); - }catch(ConstructionException e){ + } catch (ConstructionException e) { Assert.assertTrue(false); } @@ -272,7 +279,7 @@ public class StatisticsManagerIntegrationTest { @Test public void testGetNodeConnectorStatistics() { - try{ + try { Node node = new Node("STUB", 0xCAFE); List stats = this.manager .getNodeConnectorStatistics(node); @@ -289,7 +296,7 @@ public class StatisticsManagerIntegrationTest { Assert.assertTrue(ns.getTransmitDropCount() == 50); Assert.assertTrue(ns.getTransmitErrorCount() == 10); Assert.assertTrue(ns.getTransmitPacketCount() == 500); - + NodeConnector nc = ns.getNodeConnector(); NodeConnectorStatistics ns2 = this.manager .getNodeConnectorStatistics(nc); @@ -305,10 +312,10 @@ public class StatisticsManagerIntegrationTest { Assert.assertTrue(ns2.getTransmitDropCount() == 50); Assert.assertTrue(ns2.getTransmitErrorCount() == 10); Assert.assertTrue(ns2.getTransmitPacketCount() == 500); - - }catch(ConstructionException e){ + + } catch (ConstructionException e) { Assert.assertTrue(false); } } -} +} \ No newline at end of file diff --git a/opendaylight/switchmanager/integrationtest/pom.xml b/opendaylight/switchmanager/integrationtest/pom.xml index 755d0862e8..44ad73c496 100644 --- a/opendaylight/switchmanager/integrationtest/pom.xml +++ b/opendaylight/switchmanager/integrationtest/pom.xml @@ -4,9 +4,9 @@ 4.0.0 org.opendaylight.controller - commons.opendaylight - 1.4.0-SNAPSHOT - ../../../opendaylight/commons/opendaylight + commons.integrationtest + 0.5.0-SNAPSHOT + ../../commons/integrationtest switchmanager.integrationtest diff --git a/opendaylight/switchmanager/integrationtest/src/test/java/org/opendaylight/controller/switchmanager/internal/SwitchmanagerIntegrationTest.java b/opendaylight/switchmanager/integrationtest/src/test/java/org/opendaylight/controller/switchmanager/internal/SwitchManagerIT.java similarity index 66% rename from opendaylight/switchmanager/integrationtest/src/test/java/org/opendaylight/controller/switchmanager/internal/SwitchmanagerIntegrationTest.java rename to opendaylight/switchmanager/integrationtest/src/test/java/org/opendaylight/controller/switchmanager/internal/SwitchManagerIT.java index 790f48b760..ea24ffcf88 100644 --- a/opendaylight/switchmanager/integrationtest/src/test/java/org/opendaylight/controller/switchmanager/internal/SwitchmanagerIntegrationTest.java +++ b/opendaylight/switchmanager/integrationtest/src/test/java/org/opendaylight/controller/switchmanager/internal/SwitchManagerIT.java @@ -1,4 +1,3 @@ - /* * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. * @@ -9,7 +8,6 @@ package org.opendaylight.controller.switchmanager.internal; - import java.net.InetAddress; import java.net.UnknownHostException; import java.util.ArrayList; @@ -67,9 +65,8 @@ import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy; import org.ops4j.pax.exam.spi.reactors.PerClass; @RunWith(PaxExam.class) -public class SwitchmanagerIntegrationTest { - private Logger log = LoggerFactory - .getLogger(SwitchmanagerIntegrationTest.class); +public class SwitchManagerIT { + private Logger log = LoggerFactory.getLogger(SwitchManagerIT.class); // get the OSGI bundle context @Inject private BundleContext bc; @@ -103,39 +100,43 @@ public class SwitchmanagerIntegrationTest { mavenBundle("equinoxSDK381", "org.apache.felix.gogo.shell", "0.8.0.v201110170705"), // List logger bundles - mavenBundle("org.slf4j", "slf4j-api", "1.7.2"), - mavenBundle("org.slf4j", "log4j-over-slf4j", "1.7.2"), - mavenBundle("ch.qos.logback", "logback-core", "1.0.9"), - mavenBundle("ch.qos.logback", "logback-classic", "1.0.9"), - - mavenBundle("org.opendaylight.controller", "switchmanager", - "0.4.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "switchmanager.implementation", - "0.4.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "sal", - "0.5.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "sal.implementation", - "0.4.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "containermanager", - "0.4.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "containermanager.implementation", - "0.4.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "clustering.services", - "0.4.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "clustering.stub", - "0.4.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "configuration", - "0.4.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "configuration.implementation", - "0.4.0-SNAPSHOT"), + mavenBundle("org.slf4j", "slf4j-api").versionAsInProject(), + mavenBundle("org.slf4j", "log4j-over-slf4j") + .versionAsInProject(), + mavenBundle("ch.qos.logback", "logback-core") + .versionAsInProject(), + mavenBundle("ch.qos.logback", "logback-classic") + .versionAsInProject(), + + mavenBundle("org.opendaylight.controller", "switchmanager") + .versionAsInProject(), + mavenBundle("org.opendaylight.controller", + "switchmanager.implementation").versionAsInProject(), + mavenBundle("org.opendaylight.controller", "sal") + .versionAsInProject(), + mavenBundle("org.opendaylight.controller", "sal.implementation") + .versionAsInProject(), + mavenBundle("org.opendaylight.controller", "containermanager") + .versionAsInProject(), + mavenBundle("org.opendaylight.controller", + "containermanager.implementation").versionAsInProject(), + mavenBundle("org.opendaylight.controller", + "clustering.services").versionAsInProject(), + mavenBundle("org.opendaylight.controller", "clustering.stub") + .versionAsInProject(), + mavenBundle("org.opendaylight.controller", "configuration") + .versionAsInProject(), + mavenBundle("org.opendaylight.controller", + "configuration.implementation").versionAsInProject(), mavenBundle("org.opendaylight.controller", - "protocol_plugins.stub", "0.4.0-SNAPSHOT"), + "protocol_plugins.stub").versionAsInProject(), mavenBundle("org.jboss.spec.javax.transaction", - "jboss-transaction-api_1.1_spec", "1.0.1.Final"), - mavenBundle("org.apache.commons", "commons-lang3", "3.1"), + "jboss-transaction-api_1.1_spec").versionAsInProject(), + mavenBundle("org.apache.commons", "commons-lang3") + .versionAsInProject(), mavenBundle("org.apache.felix", - "org.apache.felix.dependencymanager", "3.1.0"), - junitBundles()); + "org.apache.felix.dependencymanager") + .versionAsInProject(), junitBundles()); } private String stateToString(int state) { @@ -174,45 +175,42 @@ public class SwitchmanagerIntegrationTest { // Assert if true, if false we are good to go! assertFalse(debugit); - // Now lets create a hosttracker for testing purpose - ServiceReference s = bc - .getServiceReference(ISwitchManager.class.getName()); - if (s != null) { - this.switchManager = (ISwitchManager)bc.getService(s); - } + // Now lets create a hosttracker for testing purpose + ServiceReference s = bc.getServiceReference(ISwitchManager.class + .getName()); + if (s != null) { + this.switchManager = (ISwitchManager) bc.getService(s); + } - // If StatisticsManager is null, cannot run tests. - assertNotNull(this.switchManager); + // If StatisticsManager is null, cannot run tests. + assertNotNull(this.switchManager); } - @Test public void testNodeProp() throws UnknownHostException { assertNotNull(this.switchManager); Node node; - try{ + try { node = new Node("STUB", new Integer(0xCAFE)); - }catch(ConstructionException e){ - //test failed if node cannot be created. + } catch (ConstructionException e) { + // test failed if node cannot be created. node = null; Assert.assertTrue(false); } Map propMap = this.switchManager.getNodeProps(node); Assert.assertFalse(propMap.isEmpty()); - Assert.assertTrue(this.switchManager.getNodeProp - (node, Capabilities.CapabilitiesPropName) - .equals(new Capabilities((int)3))); - Assert.assertTrue(this.switchManager.getNodeProp - (node, Actions.ActionsPropName) - .equals(new Actions((int)2))); - Assert.assertTrue(this.switchManager.getNodeProp - (node, Buffers.BuffersPropName) - .equals(new Buffers((int)1))); - Assert.assertTrue(this.switchManager.getNodeProp - (node, TimeStamp.TimeStampPropName) - .equals(new TimeStamp(100000L, "connectedSince"))); + Assert.assertTrue(this.switchManager.getNodeProp(node, + Capabilities.CapabilitiesPropName).equals( + new Capabilities((int) 3))); + Assert.assertTrue(this.switchManager.getNodeProp(node, + Actions.ActionsPropName).equals(new Actions((int) 2))); + Assert.assertTrue(this.switchManager.getNodeProp(node, + Buffers.BuffersPropName).equals(new Buffers((int) 1))); + Assert.assertTrue(this.switchManager.getNodeProp(node, + TimeStamp.TimeStampPropName).equals( + new TimeStamp(100000L, "connectedSince"))); } @Test @@ -223,24 +221,23 @@ public class SwitchmanagerIntegrationTest { try { node = new Node("STUB", 0xCAFE); nc = new NodeConnector("STUB", 0xCAFE, node); - } - catch(ConstructionException e){ + } catch (ConstructionException e) { node = null; nc = null; Assert.assertTrue(false); } - Map propMap = this.switchManager.getNodeConnectorProps(nc); + Map propMap = this.switchManager + .getNodeConnectorProps(nc); Assert.assertFalse(propMap.isEmpty()); - Assert.assertTrue(this.switchManager.getNodeConnectorProp - (nc, Capabilities.CapabilitiesPropName) - .equals(new Capabilities - (CapabilitiesType.FLOW_STATS_CAPABILITY.getValue()))); - Assert.assertTrue(this.switchManager.getNodeConnectorProp - (nc, Bandwidth.BandwidthPropName) - .equals(new Bandwidth (Bandwidth.BW1Gbps))); - Assert.assertTrue(this.switchManager.getNodeConnectorProp - (nc, State.StatePropName) - .equals(new State (State.EDGE_UP))); + Assert.assertTrue(this.switchManager.getNodeConnectorProp(nc, + Capabilities.CapabilitiesPropName).equals( + new Capabilities(CapabilitiesType.FLOW_STATS_CAPABILITY + .getValue()))); + Assert.assertTrue(this.switchManager.getNodeConnectorProp(nc, + Bandwidth.BandwidthPropName).equals( + new Bandwidth(Bandwidth.BW1Gbps))); + Assert.assertTrue(this.switchManager.getNodeConnectorProp(nc, + State.StatePropName).equals(new State(State.EDGE_UP))); } } -- 2.36.6