- 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 <ttkacik@cisco.com>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.opendaylight.controller</groupId>
- <artifactId>commons.opendaylight</artifactId>
- <version>1.4.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <artifactId>commons.integrationtest</artifactId>
+ <version>0.5.0-SNAPSHOT</version>
+ <relativePath>../../commons/integrationtest</relativePath>
</parent>
<artifactId>clustering.services.integrationtest</artifactId>
-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<cacheMode> cacheModeSet = new HashSet<cacheMode>();
- 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<String> cacheList = (HashSet<String>) 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<IGetUpdates<?, ?>> listeners = (HashSet<IGetUpdates<?, ?>>) this.clusterServices
- .getListeners(container1, cache1);
- assertEquals(0, listeners.size());
-
- IGetUpdates<?, ?> getUpdate1 = new GetUpdates();
- this.clusterServices.addListener(container1, cache1, getUpdate1);
- listeners = (HashSet<IGetUpdates<?, ?>>) this.clusterServices
- .getListeners(container1, cache1);
- assertEquals(1, listeners.size());
- this.clusterServices.addListener(container1, cache1, new GetUpdates());
- listeners = (HashSet<IGetUpdates<?, ?>>) this.clusterServices
- .getListeners(container1, cache1);
- assertEquals(2, listeners.size());
-
- listeners = (HashSet<IGetUpdates<?, ?>>) this.clusterServices
- .getListeners(container2, cache3);
- assertEquals(0, listeners.size());
-
- this.clusterServices.removeListener(container1, cache1, getUpdate1);
- listeners = (HashSet<IGetUpdates<?, ?>>) this.clusterServices
- .getListeners(container1, cache1);
- assertEquals(1, listeners.size());
-
- InetAddress addr = this.clusterServices.getMyAddress();
- assertNotNull(addr);
-
- List<InetAddress> addrList = this.clusterServices
- .getClusteredControllers();
-
- this.clusterServices.destroyCache(container1, cache1);
- assertFalse(this.clusterServices.existCache(container1, cache1));
-
- }
-
- private class GetUpdates implements IGetUpdates<Integer, String> {
-
- @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;\r
+\r
+import static org.junit.Assert.assertEquals;\r
+import static org.junit.Assert.assertFalse;\r
+import static org.junit.Assert.assertNotNull;\r
+import static org.junit.Assert.assertNull;\r
+import static org.junit.Assert.assertTrue;\r
+import static org.ops4j.pax.exam.CoreOptions.junitBundles;\r
+import static org.ops4j.pax.exam.CoreOptions.mavenBundle;\r
+import static org.ops4j.pax.exam.CoreOptions.options;\r
+import static org.ops4j.pax.exam.CoreOptions.systemPackages;\r
+import static org.ops4j.pax.exam.CoreOptions.systemProperty;\r
+\r
+import java.net.InetAddress;\r
+import java.util.HashSet;\r
+import java.util.List;\r
+import java.util.concurrent.ConcurrentMap;\r
+\r
+import javax.inject.Inject;\r
+\r
+import org.junit.Before;\r
+import org.junit.Test;\r
+import org.junit.runner.RunWith;\r
+import org.opendaylight.controller.clustering.services.CacheConfigException;\r
+import org.opendaylight.controller.clustering.services.CacheExistException;\r
+import org.opendaylight.controller.clustering.services.CacheListenerAddException;\r
+import org.opendaylight.controller.clustering.services.IClusterServices;\r
+import org.opendaylight.controller.clustering.services.IClusterServices.cacheMode;\r
+import org.opendaylight.controller.clustering.services.IGetUpdates;\r
+import org.ops4j.pax.exam.Option;\r
+import org.ops4j.pax.exam.junit.Configuration;\r
+import org.ops4j.pax.exam.junit.PaxExam;\r
+import org.ops4j.pax.exam.util.PathUtils;\r
+import org.osgi.framework.Bundle;\r
+import org.osgi.framework.BundleContext;\r
+import org.osgi.framework.ServiceReference;\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
+\r
+@RunWith(PaxExam.class)\r
+public class ClusteringServicesIT {\r
+ private Logger log = LoggerFactory\r
+ .getLogger(ClusteringServicesIT.class);\r
+ // get the OSGI bundle context\r
+ @Inject\r
+ private BundleContext bc;\r
+\r
+ private IClusterServices clusterServices = null;\r
+\r
+ // Configure the OSGi container\r
+ @Configuration\r
+ public Option[] config() {\r
+ return options(\r
+ //\r
+ systemProperty("logback.configurationFile").value(\r
+ "file:" + PathUtils.getBaseDir()\r
+ + "/src/test/resources/logback.xml"),\r
+ // To start OSGi console for inspection remotely\r
+ systemProperty("osgi.console").value("2401"),\r
+ // Set the systemPackages (used by clustering)\r
+ systemPackages("sun.reflect", "sun.reflect.misc", "sun.misc"),\r
+ // List framework bundles\r
+ mavenBundle("equinoxSDK381", "org.eclipse.equinox.console",\r
+ "1.0.0.v20120522-1841"),\r
+ mavenBundle("equinoxSDK381", "org.eclipse.equinox.util",\r
+ "1.0.400.v20120522-2049"),\r
+ mavenBundle("equinoxSDK381", "org.eclipse.osgi.services",\r
+ "3.3.100.v20120522-1822"),\r
+ mavenBundle("equinoxSDK381", "org.eclipse.equinox.ds",\r
+ "1.4.0.v20120522-1841"),\r
+ mavenBundle("equinoxSDK381", "org.apache.felix.gogo.command",\r
+ "0.8.0.v201108120515"),\r
+ mavenBundle("equinoxSDK381", "org.apache.felix.gogo.runtime",\r
+ "0.8.0.v201108120515"),\r
+ mavenBundle("equinoxSDK381", "org.apache.felix.gogo.shell",\r
+ "0.8.0.v201110170705"),\r
+ // List logger bundles\r
+ mavenBundle("org.slf4j", "slf4j-api").versionAsInProject(),\r
+ mavenBundle("org.slf4j", "log4j-over-slf4j").versionAsInProject(),\r
+ mavenBundle("ch.qos.logback", "logback-core").versionAsInProject(),\r
+ mavenBundle("ch.qos.logback", "logback-classic").versionAsInProject(),\r
+ // List all the bundles on which the test case depends\r
+ mavenBundle("org.opendaylight.controller",\r
+ "clustering.services").versionAsInProject(),\r
+ mavenBundle("org.opendaylight.controller",\r
+ "clustering.services-implementation").versionAsInProject(),\r
+ mavenBundle("org.opendaylight.controller", "sal").versionAsInProject(),\r
+ mavenBundle("org.opendaylight.controller",\r
+ "sal.implementation").versionAsInProject(),\r
+ mavenBundle("org.jboss.spec.javax.transaction",\r
+ "jboss-transaction-api_1.1_spec").versionAsInProject(),\r
+ mavenBundle("org.apache.commons", "commons-lang3").versionAsInProject(),\r
+ mavenBundle("org.apache.felix",\r
+ "org.apache.felix.dependencymanager").versionAsInProject(),\r
+ junitBundles());\r
+ }\r
+\r
+ private String stateToString(int state) {\r
+ switch (state) {\r
+ case Bundle.ACTIVE:\r
+ return "ACTIVE";\r
+ case Bundle.INSTALLED:\r
+ return "INSTALLED";\r
+ case Bundle.RESOLVED:\r
+ return "RESOLVED";\r
+ case Bundle.UNINSTALLED:\r
+ return "UNINSTALLED";\r
+ default:\r
+ return "Not CONVERTED";\r
+ }\r
+ }\r
+\r
+ @Before\r
+ public void areWeReady() {\r
+ assertNotNull(bc);\r
+ boolean debugit = false;\r
+ Bundle b[] = bc.getBundles();\r
+ for (int i = 0; i < b.length; i++) {\r
+ int state = b[i].getState();\r
+ if (state != Bundle.ACTIVE && state != Bundle.RESOLVED) {\r
+ log.debug("Bundle:" + b[i].getSymbolicName() + " state:"\r
+ + stateToString(state));\r
+ debugit = true;\r
+ }\r
+ }\r
+ if (debugit) {\r
+ log.debug("Do some debugging because some bundle is "\r
+ + "unresolved");\r
+ }\r
+\r
+ // Assert if true, if false we are good to go!\r
+ assertFalse(debugit);\r
+\r
+ ServiceReference r = bc.getServiceReference(IClusterServices.class\r
+ .getName());\r
+ if (r != null) {\r
+ this.clusterServices = (IClusterServices) bc.getService(r);\r
+ }\r
+ assertNotNull(this.clusterServices);\r
+\r
+ }\r
+\r
+ @Test\r
+ public void clusterTest() throws CacheExistException, CacheConfigException,\r
+ CacheListenerAddException {\r
+\r
+ String container1 = "Container1";\r
+ String container2 = "Container2";\r
+ String cache1 = "Cache1";\r
+ String cache2 = "Cache2";\r
+ String cache3 = "Cache3";\r
+\r
+ HashSet<cacheMode> cacheModeSet = new HashSet<cacheMode>();\r
+ cacheModeSet.add(cacheMode.NON_TRANSACTIONAL);\r
+ ConcurrentMap cm11 = this.clusterServices.createCache(container1,\r
+ cache1, cacheModeSet);\r
+ assertNotNull(cm11);\r
+\r
+ assertNull(this.clusterServices.getCache(container2, cache2));\r
+ assertEquals(cm11, this.clusterServices.getCache(container1, cache1));\r
+\r
+ assertFalse(this.clusterServices.existCache(container2, cache2));\r
+ assertTrue(this.clusterServices.existCache(container1, cache1));\r
+\r
+ ConcurrentMap cm12 = this.clusterServices.createCache(container1,\r
+ cache2, cacheModeSet);\r
+ ConcurrentMap cm23 = this.clusterServices.createCache(container2,\r
+ cache3, cacheModeSet);\r
+\r
+ HashSet<String> cacheList = (HashSet<String>) this.clusterServices\r
+ .getCacheList(container1);\r
+ assertEquals(2, cacheList.size());\r
+ assertTrue(cacheList.contains(cache1));\r
+ assertTrue(cacheList.contains(cache2));\r
+ assertFalse(cacheList.contains(cache3));\r
+\r
+ assertNotNull(this.clusterServices.getCacheProperties(container1,\r
+ cache1));\r
+\r
+ HashSet<IGetUpdates<?, ?>> listeners = (HashSet<IGetUpdates<?, ?>>) this.clusterServices\r
+ .getListeners(container1, cache1);\r
+ assertEquals(0, listeners.size());\r
+\r
+ IGetUpdates<?, ?> getUpdate1 = new GetUpdates();\r
+ this.clusterServices.addListener(container1, cache1, getUpdate1);\r
+ listeners = (HashSet<IGetUpdates<?, ?>>) this.clusterServices\r
+ .getListeners(container1, cache1);\r
+ assertEquals(1, listeners.size());\r
+ this.clusterServices.addListener(container1, cache1, new GetUpdates());\r
+ listeners = (HashSet<IGetUpdates<?, ?>>) this.clusterServices\r
+ .getListeners(container1, cache1);\r
+ assertEquals(2, listeners.size());\r
+\r
+ listeners = (HashSet<IGetUpdates<?, ?>>) this.clusterServices\r
+ .getListeners(container2, cache3);\r
+ assertEquals(0, listeners.size());\r
+\r
+ this.clusterServices.removeListener(container1, cache1, getUpdate1);\r
+ listeners = (HashSet<IGetUpdates<?, ?>>) this.clusterServices\r
+ .getListeners(container1, cache1);\r
+ assertEquals(1, listeners.size());\r
+\r
+ InetAddress addr = this.clusterServices.getMyAddress();\r
+ assertNotNull(addr);\r
+\r
+ List<InetAddress> addrList = this.clusterServices\r
+ .getClusteredControllers();\r
+\r
+ this.clusterServices.destroyCache(container1, cache1);\r
+ assertFalse(this.clusterServices.existCache(container1, cache1));\r
+\r
+ }\r
+\r
+ private class GetUpdates implements IGetUpdates<Integer, String> {\r
+\r
+ @Override\r
+ public void entryCreated(Integer key, String containerName,\r
+ String cacheName, boolean originLocal) {\r
+ return;\r
+ }\r
+\r
+ @Override\r
+ public void entryUpdated(Integer key, String new_value,\r
+ String containerName, String cacheName, boolean originLocal) {\r
+ return;\r
+ }\r
+\r
+ @Override\r
+ public void entryDeleted(Integer key, String containerName,\r
+ String cacheName, boolean originLocal) {\r
+ return;\r
+ }\r
+ }\r
+}\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>commons.opendaylight</artifactId>
+ <version>1.4.0-SNAPSHOT</version>
+ <relativePath>../../commons/opendaylight</relativePath>
+ </parent>
+
+ <artifactId>commons.integrationtest</artifactId>
+ <version>0.5.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>equinoxSDK381</groupId>
+ <artifactId>org.eclipse.equinox.console</artifactId>
+ <version>1.0.0.v20120522-1841</version>
+ </dependency>
+ <dependency>
+ <groupId>equinoxSDK381</groupId>
+ <artifactId>org.eclipse.equinox.util</artifactId>
+ <version>1.0.400.v20120522-2049</version>
+ </dependency>
+ <dependency>
+ <groupId>equinoxSDK381</groupId>
+ <artifactId>org.eclipse.osgi.services</artifactId>
+ <version>3.3.100.v20120522-1822</version>
+ </dependency>
+ <dependency>
+ <groupId>equinoxSDK381</groupId>
+ <artifactId>org.eclipse.equinox.ds</artifactId>
+ <version>1.4.0.v20120522-1841</version>
+ </dependency>
+ <dependency>
+ <groupId>equinoxSDK381</groupId>
+ <artifactId>org.apache.felix.gogo.command</artifactId>
+ <version>0.8.0.v201108120515</version>
+ </dependency>
+ <dependency>
+ <groupId>equinoxSDK381</groupId>
+ <artifactId>org.apache.felix.gogo.runtime</artifactId>
+ <version>0.8.0.v201108120515</version>
+ </dependency>
+ <dependency>
+ <groupId>equinoxSDK381</groupId>
+ <artifactId>org.apache.felix.gogo.shell</artifactId>
+ <version>0.8.0.v201110170705</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>maven-paxexam-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>generate-config</id>
+ <goals>
+ <goal>generate-depends-file</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
<configFile>${project.parent.relativePath}/sun_coding_style.xml</configFile>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <version>2.14.1</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>integration-test</goal>
+ <goal>verify</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
<pluginManagement>
<plugins>
<ignore/>
</action>
</pluginExecution>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>maven-paxexam-plugin</artifactId>
+ <versionRange>[1.2.4,)</versionRange>
+ <goals>
+ <goal>generate-depends-file</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <ignore></ignore>
+ </action>
+ </pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
<module>../../samples/loadbalancer</module>
<module>../../samples/northbound/loadbalancer</module>
<module>../../commons/concepts</module>
+ <module>../../commons/integrationtest</module>
+
</modules>
<build>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.opendaylight.controller</groupId>
- <artifactId>commons.opendaylight</artifactId>
- <version>1.4.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <artifactId>commons.integrationtest</artifactId>
+ <version>0.5.0-SNAPSHOT</version>
+ <relativePath>../../commons/integrationtest</relativePath>
</parent>
<artifactId>forwardingrulesmanager.integrationtest</artifactId>
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>sal</artifactId>
- <version>0.4.0-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.opendaylight.controller</groupId>
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;
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) {
<modelVersion>4.0.0</modelVersion>\r
<parent>\r
<groupId>org.opendaylight.controller</groupId>\r
- <artifactId>commons.opendaylight</artifactId>\r
- <version>1.4.0-SNAPSHOT</version>\r
- <relativePath>../../../opendaylight/commons/opendaylight</relativePath>\r
+ <artifactId>commons.integrationtest</artifactId>\r
+ <version>0.5.0-SNAPSHOT</version>\r
+ <relativePath>../../commons/integrationtest</relativePath>\r
</parent>\r
\r
<artifactId>hosttracker.integrationtest</artifactId>\r
-\r
/*\r
* Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.\r
*\r
\r
package org.opendaylight.controller.hosttracker.internal;\r
\r
-\r
import java.net.InetAddress;\r
import java.net.UnknownHostException;\r
import java.util.ArrayList;\r
import org.ops4j.pax.exam.spi.reactors.PerClass;\r
\r
@RunWith(PaxExam.class)\r
-public class HostTrackerIntegrationTest {\r
+public class HostTrackerIT {\r
private Logger log = LoggerFactory\r
- .getLogger(HostTrackerIntegrationTest.class);\r
+ .getLogger(HostTrackerIT.class);\r
// get the OSGI bundle context\r
@Inject\r
private BundleContext bc;\r
- \r
+\r
private IfIptoHost hosttracker = null;\r
private ISwitchManagerAware switchManagerAware = null;\r
private IInventoryListener invtoryListener = null;\r
private IfHostListener hostListener = null;\r
private ITopologyManagerAware topologyManagerAware = null;\r
- \r
+\r
// Configure the OSGi container\r
@Configuration\r
public Option[] config() {\r
mavenBundle("equinoxSDK381", "org.apache.felix.gogo.shell",\r
"0.8.0.v201110170705"),\r
// List logger bundles\r
- mavenBundle("org.slf4j", "slf4j-api", "1.7.2"),\r
- mavenBundle("org.slf4j", "log4j-over-slf4j", "1.7.2"),\r
- mavenBundle("ch.qos.logback", "logback-core", "1.0.9"),\r
- mavenBundle("ch.qos.logback", "logback-classic", "1.0.9"),\r
- \r
+ mavenBundle("org.slf4j", "slf4j-api").versionAsInProject(),\r
+ mavenBundle("org.slf4j", "log4j-over-slf4j")\r
+ .versionAsInProject(),\r
+ mavenBundle("ch.qos.logback", "logback-core")\r
+ .versionAsInProject(),\r
+ mavenBundle("ch.qos.logback", "logback-classic")\r
+ .versionAsInProject(),\r
+\r
// List all the bundles on which the test case depends\r
- mavenBundle("org.opendaylight.controller", "sal",\r
- "0.5.0-SNAPSHOT"),\r
- mavenBundle("org.opendaylight.controller", "sal.implementation",\r
- "0.4.0-SNAPSHOT"),\r
-\r
- // needed by statisticsmanager\r
- mavenBundle("org.opendaylight.controller", "containermanager",\r
- "0.4.0-SNAPSHOT"),\r
- mavenBundle("org.opendaylight.controller", "containermanager.implementation",\r
- "0.4.0-SNAPSHOT"),\r
- \r
- mavenBundle("org.opendaylight.controller",\r
- "clustering.services", "0.4.0-SNAPSHOT"),\r
- mavenBundle("org.opendaylight.controller",\r
- "clustering.stub", "0.4.0-SNAPSHOT"),\r
+ mavenBundle("org.opendaylight.controller", "sal")\r
+ .versionAsInProject(),\r
+ mavenBundle("org.opendaylight.controller", "sal.implementation")\r
+ .versionAsInProject(),\r
+\r
+ // needed by statisticsmanager\r
+ mavenBundle("org.opendaylight.controller", "containermanager")\r
+ .versionAsInProject(),\r
+ mavenBundle("org.opendaylight.controller",\r
+ "containermanager.implementation").versionAsInProject(),\r
+\r
+ mavenBundle("org.opendaylight.controller",\r
+ "clustering.services").versionAsInProject(),\r
+ mavenBundle("org.opendaylight.controller", "clustering.stub")\r
+ .versionAsInProject(),\r
\r
// needed by forwardingrulesmanager\r
- mavenBundle("org.opendaylight.controller", "switchmanager",\r
- "0.4.0-SNAPSHOT"),\r
- mavenBundle("org.opendaylight.controller", "switchmanager.implementation",\r
- "0.4.0-SNAPSHOT"),\r
- mavenBundle("org.opendaylight.controller", "configuration",\r
- "0.4.0-SNAPSHOT"),\r
+ mavenBundle("org.opendaylight.controller", "switchmanager")\r
+ .versionAsInProject(),\r
+ mavenBundle("org.opendaylight.controller",\r
+ "switchmanager.implementation").versionAsInProject(),\r
+ mavenBundle("org.opendaylight.controller", "configuration")\r
+ .versionAsInProject(),\r
mavenBundle("org.opendaylight.controller",\r
- "configuration.implementation", "0.4.0-SNAPSHOT"),\r
- mavenBundle("org.opendaylight.controller", "hosttracker",\r
- "0.4.0-SNAPSHOT"),\r
- mavenBundle("org.opendaylight.controller", "hosttracker.implementation",\r
- "0.4.0-SNAPSHOT"),\r
+ "configuration.implementation").versionAsInProject(),\r
+ mavenBundle("org.opendaylight.controller", "hosttracker")\r
+ .versionAsInProject(),\r
+ mavenBundle("org.opendaylight.controller",\r
+ "hosttracker.implementation").versionAsInProject(),\r
\r
// needed by hosttracker\r
- mavenBundle("org.opendaylight.controller", "topologymanager",\r
- "0.4.0-SNAPSHOT"),\r
- mavenBundle("org.opendaylight.controller", "arphandler",\r
- "0.4.0-SNAPSHOT"),\r
-\r
+ mavenBundle("org.opendaylight.controller", "topologymanager")\r
+ .versionAsInProject(),\r
+ mavenBundle("org.opendaylight.controller", "arphandler")\r
+ .versionAsInProject(),\r
\r
mavenBundle("org.jboss.spec.javax.transaction",\r
- "jboss-transaction-api_1.1_spec", "1.0.1.Final"),\r
- mavenBundle("org.apache.commons", "commons-lang3", "3.1"),\r
+ "jboss-transaction-api_1.1_spec").versionAsInProject(),\r
+ mavenBundle("org.apache.commons", "commons-lang3")\r
+ .versionAsInProject(),\r
mavenBundle("org.apache.felix",\r
- "org.apache.felix.dependencymanager", "3.1.0"),\r
- junitBundles());\r
+ "org.apache.felix.dependencymanager")\r
+ .versionAsInProject(), junitBundles());\r
}\r
\r
private String stateToString(int state) {\r
// Assert if true, if false we are good to go!\r
assertFalse(debugit);\r
\r
- // Now lets create a hosttracker for testing purpose\r
- ServiceReference s = bc\r
- .getServiceReference(IfIptoHost.class.getName());\r
- if (s != null) {\r
- this.hosttracker = (IfIptoHost)bc.getService(s);\r
- this.switchManagerAware = (ISwitchManagerAware) this.hosttracker;\r
- this.invtoryListener = (IInventoryListener) this.hosttracker;\r
- this.hostListener = (IfHostListener) this.hosttracker;\r
- this.topologyManagerAware = (ITopologyManagerAware) this.hosttracker;\r
- }\r
-\r
- // If StatisticsManager is null, cannot run tests.\r
- assertNotNull(this.hosttracker);\r
+ // Now lets create a hosttracker for testing purpose\r
+ ServiceReference s = bc.getServiceReference(IfIptoHost.class.getName());\r
+ if (s != null) {\r
+ this.hosttracker = (IfIptoHost) bc.getService(s);\r
+ this.switchManagerAware = (ISwitchManagerAware) this.hosttracker;\r
+ this.invtoryListener = (IInventoryListener) this.hosttracker;\r
+ this.hostListener = (IfHostListener) this.hosttracker;\r
+ this.topologyManagerAware = (ITopologyManagerAware) this.hosttracker;\r
+ }\r
+\r
+ // If StatisticsManager is null, cannot run tests.\r
+ assertNotNull(this.hosttracker);\r
}\r
- \r
- \r
+\r
@Test\r
public void testStaticHost() throws UnknownHostException {\r
String ip;\r
- \r
+\r
assertNotNull(this.hosttracker);\r
- \r
+\r
// create one node and two node connectors\r
Node node1 = NodeCreator.createOFNode(1L);\r
- NodeConnector nc1_1 = NodeConnectorCreator.createOFNodeConnector((short) 1, node1);\r
- NodeConnector nc1_2 = NodeConnectorCreator.createOFNodeConnector((short) 2, node1);\r
- \r
- // test addStaticHost(), store into inactive host DB \r
- Status st = this.hosttracker.addStaticHost("192.168.0.8", "11:22:33:44:55:66",\r
- nc1_1, "0");\r
+ NodeConnector nc1_1 = NodeConnectorCreator.createOFNodeConnector(\r
+ (short) 1, node1);\r
+ NodeConnector nc1_2 = NodeConnectorCreator.createOFNodeConnector(\r
+ (short) 2, node1);\r
+\r
+ // test addStaticHost(), store into inactive host DB\r
+ Status st = this.hosttracker.addStaticHost("192.168.0.8",\r
+ "11:22:33:44:55:66", nc1_1, "0");\r
Assert.assertTrue(st.isSuccess());\r
- st = this.hosttracker.addStaticHost("192.168.0.13", "11:22:33:44:55:77",\r
- nc1_2, "0");\r
+ st = this.hosttracker.addStaticHost("192.168.0.13",\r
+ "11:22:33:44:55:77", nc1_2, "0");\r
Assert.assertTrue(st.isSuccess());\r
- \r
+\r
// check inactive DB\r
- Iterator<HostNodeConnector> hnci = this.hosttracker.getInactiveStaticHosts().iterator();\r
+ Iterator<HostNodeConnector> hnci = this.hosttracker\r
+ .getInactiveStaticHosts().iterator();\r
while (hnci.hasNext()) {\r
ip = hnci.next().getNetworkAddressAsString();\r
- Assert.assertTrue(ip.equals("192.168.0.8") || ip.equals("192.168.0.13"));\r
+ Assert.assertTrue(ip.equals("192.168.0.8")\r
+ || ip.equals("192.168.0.13"));\r
}\r
- \r
+\r
// check active host DB\r
hnci = this.hosttracker.getActiveStaticHosts().iterator();\r
Assert.assertFalse(hnci.hasNext());\r
- \r
+\r
// test removeStaticHost()\r
st = this.hosttracker.removeStaticHost("192.168.0.8");\r
Assert.assertTrue(st.isSuccess());\r
ip = hnci.next().getNetworkAddressAsString();\r
Assert.assertTrue(ip.equals("192.168.0.13"));\r
}\r
- } \r
- \r
+ }\r
\r
- \r
@Test\r
public void testNotifyNodeConnector() throws UnknownHostException {\r
String ip;\r
- \r
+\r
assertNotNull(this.invtoryListener);\r
\r
// create one node and two node connectors\r
Node node1 = NodeCreator.createOFNode(1L);\r
- NodeConnector nc1_1 = NodeConnectorCreator.createOFNodeConnector((short) 1, node1);\r
- NodeConnector nc1_2 = NodeConnectorCreator.createOFNodeConnector((short) 2, node1);\r
- \r
+ NodeConnector nc1_1 = NodeConnectorCreator.createOFNodeConnector(\r
+ (short) 1, node1);\r
+ NodeConnector nc1_2 = NodeConnectorCreator.createOFNodeConnector(\r
+ (short) 2, node1);\r
+\r
// test addStaticHost(), put into inactive host DB if not verifiable\r
- Status st = this.hosttracker.addStaticHost("192.168.0.8", "11:22:33:44:55:66",\r
- nc1_1, "0");\r
- st = this.hosttracker.addStaticHost("192.168.0.13", "11:22:33:44:55:77",\r
- nc1_2, "0");\r
- \r
- this.invtoryListener.notifyNodeConnector(nc1_1,\r
- UpdateType.ADDED, null);\r
+ Status st = this.hosttracker.addStaticHost("192.168.0.8",\r
+ "11:22:33:44:55:66", nc1_1, "0");\r
+ st = this.hosttracker.addStaticHost("192.168.0.13",\r
+ "11:22:33:44:55:77", nc1_2, "0");\r
+\r
+ this.invtoryListener.notifyNodeConnector(nc1_1, UpdateType.ADDED, null);\r
\r
// check all host list\r
- Iterator<HostNodeConnector> hnci = this.hosttracker\r
- .getAllHosts().iterator();\r
+ Iterator<HostNodeConnector> hnci = this.hosttracker.getAllHosts()\r
+ .iterator();\r
while (hnci.hasNext()) {\r
ip = hnci.next().getNetworkAddressAsString();\r
Assert.assertTrue(ip.equals("192.168.0.8"));\r
}\r
- \r
+\r
// check active host DB\r
hnci = this.hosttracker.getActiveStaticHosts().iterator();\r
while (hnci.hasNext()) {\r
ip = hnci.next().getNetworkAddressAsString();\r
Assert.assertTrue(ip.equals("192.168.0.8"));\r
}\r
- \r
+\r
// check inactive host DB\r
hnci = this.hosttracker.getInactiveStaticHosts().iterator();\r
while (hnci.hasNext()) {\r
Assert.assertTrue(ip.equals("192.168.0.13"));\r
}\r
}\r
- \r
- \r
- \r
+\r
@Test\r
public void testHostFind() throws UnknownHostException {\r
- \r
+\r
assertNotNull(this.invtoryListener);\r
\r
// create one node and two node connectors\r
Node node1 = NodeCreator.createOFNode(1L);\r
- NodeConnector nc1_1 = NodeConnectorCreator.createOFNodeConnector((short) 1, node1);\r
- NodeConnector nc1_2 = NodeConnectorCreator.createOFNodeConnector((short) 2, node1);\r
- \r
+ NodeConnector nc1_1 = NodeConnectorCreator.createOFNodeConnector(\r
+ (short) 1, node1);\r
+ NodeConnector nc1_2 = NodeConnectorCreator.createOFNodeConnector(\r
+ (short) 2, node1);\r
+\r
// test addStaticHost(), put into inactive host DB if not verifiable\r
- Status st = this.hosttracker.addStaticHost(\r
- "192.168.0.8", "11:22:33:44:55:66", nc1_1, "0");\r
- st = this.hosttracker.addStaticHost(\r
- "192.168.0.13", "11:22:33:44:55:77", nc1_2, "0");\r
- \r
- HostNodeConnector hnc_1 = this.hosttracker\r
- .hostFind(InetAddress.getByName("192.168.0.8"));\r
+ Status st = this.hosttracker.addStaticHost("192.168.0.8",\r
+ "11:22:33:44:55:66", nc1_1, "0");\r
+ st = this.hosttracker.addStaticHost("192.168.0.13",\r
+ "11:22:33:44:55:77", nc1_2, "0");\r
+\r
+ HostNodeConnector hnc_1 = this.hosttracker.hostFind(InetAddress\r
+ .getByName("192.168.0.8"));\r
assertNull(hnc_1);\r
- \r
- this.invtoryListener.notifyNodeConnector(nc1_1,\r
- UpdateType.ADDED, null);\r
+\r
+ this.invtoryListener.notifyNodeConnector(nc1_1, UpdateType.ADDED, null);\r
\r
hnc_1 = this.hosttracker.hostFind(InetAddress.getByName("192.168.0.8"));\r
assertNotNull(hnc_1);\r
- \r
+\r
}\r
- \r
+\r
}\r
@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;
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.opendaylight.controller</groupId>
- <artifactId>commons.opendaylight</artifactId>
- <version>1.4.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <artifactId>commons.integrationtest</artifactId>
+ <version>0.5.0-SNAPSHOT</version>
+ <relativePath>../../commons/integrationtest</relativePath>
</parent>
<artifactId>statisticsmanager.integrationtest</artifactId>
<version>0.4.0-SNAPSHOT</version>
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;
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) {
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
actions.add(action);
flow.setActions(actions);
- try{
+ try {
Node node = new Node("STUB", 0xCAFE);
FlowEntry fe = new FlowEntry("g1", "f1", flow, node);
List<FlowEntry> list = new ArrayList<FlowEntry>();
list.add(fe);
FlowEntry fe2 = new FlowEntry("g1", "f2", flow, node);
list.add(fe2);
-
+
Map<Node, List<FlowOnNode>> result = this.manager
.getFlowStatisticsForFlowList(null);
Assert.assertTrue(result.isEmpty());
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);
}
@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);
}
@Test
public void testGetNodeDescription() {
- try{
+ try {
Node node = new Node("STUB", 0xCAFE);
NodeDescription desc = this.manager.getNodeDescription(node);
Assert.assertTrue(desc.getDescription().equals(
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);
}
@Test
public void testGetNodeConnectorStatistics() {
- try{
+ try {
Node node = new Node("STUB", 0xCAFE);
List<NodeConnectorStatistics> stats = this.manager
.getNodeConnectorStatistics(node);
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);
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
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.opendaylight.controller</groupId>
- <artifactId>commons.opendaylight</artifactId>
- <version>1.4.0-SNAPSHOT</version>
- <relativePath>../../../opendaylight/commons/opendaylight</relativePath>
+ <artifactId>commons.integrationtest</artifactId>
+ <version>0.5.0-SNAPSHOT</version>
+ <relativePath>../../commons/integrationtest</relativePath>
</parent>
<artifactId>switchmanager.integrationtest</artifactId>
-
/*
* Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
*
package org.opendaylight.controller.switchmanager.internal;
-
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;
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;
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) {
// 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<String, Property> 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
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<String, Property> propMap = this.switchManager.getNodeConnectorProps(nc);
+ Map<String, Property> 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)));
}
}