Adding Pax-Exam infra with a basic IT for plugin 73/7773/2
authorMadhu Venugopal <mavenugo@gmail.com>
Fri, 6 Jun 2014 10:09:55 +0000 (03:09 -0700)
committerMadhu Venugopal <mavenugo@gmail.com>
Fri, 6 Jun 2014 12:56:09 +0000 (05:56 -0700)
Change-Id: I4bdfdda16e81d539c002f683066238ada2355f27
Signed-off-by: Madhu Venugopal <mavenugo@gmail.com>
commons/parent/pom.xml
paxexam/common.integrationtest/pom.xml [new file with mode: 0644]
paxexam/plugin.integrationtest/.gitignore [new file with mode: 0644]
paxexam/plugin.integrationtest/pom.xml [new file with mode: 0644]
paxexam/plugin.integrationtest/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbPluginIT.java [new file with mode: 0644]
paxexam/plugin.integrationtest/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestBase.java [new file with mode: 0644]
paxexam/plugin.integrationtest/src/test/resources/logback.xml [new file with mode: 0644]

index 14c1980a7e7a312c270a3035dbed48883f9b69c6..25a6b4d16126cb053236c54081a5c714071fc348 100755 (executable)
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
   </properties>
 
+  <dependencyManagement>
+    <dependencies>
+      <dependency>
+        <groupId>org.opendaylight.ovsdb</groupId>
+        <artifactId>ovsdb</artifactId>
+        <version>0.5.1-SNAPSHOT</version>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+
   <build>
     <pluginManagement>
       <plugins>
diff --git a/paxexam/common.integrationtest/pom.xml b/paxexam/common.integrationtest/pom.xml
new file mode 100644 (file)
index 0000000..0546587
--- /dev/null
@@ -0,0 +1,145 @@
+<?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.ovsdb</groupId>
+    <artifactId>commons.ovsdb</artifactId>
+    <version>1.0.1-SNAPSHOT</version>
+    <relativePath>../../commons/parent</relativePath>
+  </parent>
+
+  <artifactId>common.integrationtest</artifactId>
+  <version>1.0.1-SNAPSHOT</version>
+  <packaging>pom</packaging>
+
+  <dependencies>
+    <dependency>
+      <groupId>ch.qos.logback</groupId>
+      <artifactId>logback-classic</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>ch.qos.logback</groupId>
+      <artifactId>logback-core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>equinoxSDK381</groupId>
+      <artifactId>org.apache.felix.gogo.command</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>equinoxSDK381</groupId>
+      <artifactId>org.apache.felix.gogo.runtime</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>equinoxSDK381</groupId>
+      <artifactId>org.apache.felix.gogo.shell</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>equinoxSDK381</groupId>
+      <artifactId>org.eclipse.equinox.console</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>equinoxSDK381</groupId>
+      <artifactId>org.eclipse.equinox.ds</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>equinoxSDK381</groupId>
+      <artifactId>org.eclipse.equinox.util</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>equinoxSDK381</groupId>
+      <artifactId>org.eclipse.osgi.services</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>log4j-over-slf4j</artifactId>
+    </dependency>
+    <!-- Add Pax Exam -->
+    <dependency>
+      <groupId>org.ops4j.pax.exam</groupId>
+      <artifactId>pax-exam-junit4</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.ops4j.pax.exam</groupId>
+      <artifactId>pax-exam-link-mvn</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.ops4j.pax.url</groupId>
+      <artifactId>pax-url-aether</artifactId>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-checkstyle-plugin</artifactId>
+        <version>${checkstyle.version}</version>
+        <configuration>
+          <failsOnError>true</failsOnError>
+          <configLocation>controller/checkstyle.xml</configLocation>
+        </configuration>
+        <dependencies>
+          <dependency>
+            <groupId>org.opendaylight.controller</groupId>
+            <artifactId>checkstyle</artifactId>
+            <version>0.0.3-SNAPSHOT</version>
+          </dependency>
+        </dependencies>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <version>${surefire.version}</version>
+        <configuration>
+          <skipTests>true</skipTests>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>properties-maven-plugin</artifactId>
+        <version>${propertymavenplugin.version}</version>
+        <executions>
+          <execution>
+            <goals>
+              <goal>set-system-properties</goal>
+            </goals>
+            <configuration>
+              <properties>
+                <property>
+                  <name>logback.configurationFile</name>
+                  <value>${project.parent.parent.basedir}/logback.xml</value>
+                </property>
+              </properties>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.ops4j.pax.exam</groupId>
+        <artifactId>maven-paxexam-plugin</artifactId>
+        <version>1.2.4</version>
+        <executions>
+          <execution>
+            <id>generate-config</id>
+            <goals>
+              <goal>generate-depends-file</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+  <scm>
+    <connection>scm:git:ssh://git.opendaylight.org:29418/ovsdb.git</connection>
+    <developerConnection>scm:git:ssh://git.opendaylight.org:29418/ovsdb.git</developerConnection>
+    <tag>HEAD</tag>
+    <url>https://wiki.opendaylight.org/view/OVSDB_Integration:Main</url>
+  </scm>
+</project>
diff --git a/paxexam/plugin.integrationtest/.gitignore b/paxexam/plugin.integrationtest/.gitignore
new file mode 100644 (file)
index 0000000..a48e45b
--- /dev/null
@@ -0,0 +1 @@
+/target-ide
diff --git a/paxexam/plugin.integrationtest/pom.xml b/paxexam/plugin.integrationtest/pom.xml
new file mode 100644 (file)
index 0000000..a2bdd04
--- /dev/null
@@ -0,0 +1,234 @@
+<?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.ovsdb</groupId>
+    <artifactId>common.integrationtest</artifactId>
+    <version>1.0.1-SNAPSHOT</version>
+    <relativePath>../common.integrationtest</relativePath>
+  </parent>
+
+  <artifactId>ovsdb.plugin.integrationtest</artifactId>
+  <version>0.4.2-SNAPSHOT</version>
+  <properties>
+    <sonar.jacoco.itReportPath>../implementation/target/jacoco-it.exec</sonar.jacoco.itReportPath>
+    <!-- Sonar jacoco plugin to get integration test coverage info -->
+    <sonar.jacoco.reportPath>../implementation/target/jacoco.exec</sonar.jacoco.reportPath>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>ch.qos.logback</groupId>
+      <artifactId>logback-classic</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>ch.qos.logback</groupId>
+      <artifactId>logback-core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-annotations</artifactId>
+      <version>${jackson.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-core</artifactId>
+      <version>${jackson.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-databind</artifactId>
+      <version>${jackson.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>com.google.code.gson</groupId>
+      <artifactId>gson</artifactId>
+      <version>2.1</version>
+      <scope>compile</scope>
+    </dependency>
+    <dependency>
+      <groupId>com.google.guava</groupId>
+      <artifactId>guava</artifactId>
+      <version>${guava.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>commons-codec</groupId>
+      <artifactId>commons-codec</artifactId>
+      <optional>true</optional>
+    </dependency>
+    <dependency>
+      <groupId>commons-codec</groupId>
+      <artifactId>commons-codec</artifactId>
+      <version>1.4</version>
+    </dependency>
+    <dependency>
+      <groupId>commons-collections</groupId>
+      <artifactId>commons-collections</artifactId>
+      <version>1.0</version>
+    </dependency>
+    <dependency>
+      <groupId>commons-lang</groupId>
+      <artifactId>commons-lang</artifactId>
+      <version>2.3</version>
+    </dependency>
+    <dependency>
+      <groupId>eclipselink</groupId>
+      <artifactId>javax.resource</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>equinoxSDK381</groupId>
+      <artifactId>javax.servlet</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>equinoxSDK381</groupId>
+      <artifactId>org.eclipse.osgi</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>io.netty</groupId>
+      <artifactId>netty-buffer</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>io.netty</groupId>
+      <artifactId>netty-codec</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>io.netty</groupId>
+      <artifactId>netty-common</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>io.netty</groupId>
+      <artifactId>netty-handler</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>io.netty</groupId>
+      <artifactId>netty-transport</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>javax.portlet</groupId>
+      <artifactId>portlet-api</artifactId>
+      <version>2.0</version>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.felix</groupId>
+      <artifactId>org.apache.felix.dependencymanager.shell</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.httpcomponents</groupId>
+      <artifactId>httpcore-nio</artifactId>
+      <version>4.2.1</version>
+      <optional>true</optional>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>clustering.services</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>clustering.services-implementation</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>containermanager</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>containermanager.it.implementation</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>sal</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>sal.connection</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>sal.connection.implementation</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>sal.implementation</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>sal.networkconfiguration</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>sal.networkconfiguration.implementation</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.ovsdb</groupId>
+      <artifactId>ovsdb</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>log4j-over-slf4j</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.ops4j.pax.exam</groupId>
+      <artifactId>pax-exam-container-native</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.ops4j.pax.exam</groupId>
+      <artifactId>pax-exam-junit4</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.ops4j.pax.exam</groupId>
+      <artifactId>pax-exam-link-mvn</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.ops4j.pax.url</groupId>
+      <artifactId>pax-url-aether</artifactId>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.jacoco</groupId>
+        <artifactId>jacoco-maven-plugin</artifactId>
+        <configuration>
+          <destFile>../implementation/target/jacoco-it.exec</destFile>
+          <includes>
+            <include>org.opendaylight.controller.*</include>
+            <include>org.opendaylight.ovsdb.*</include>
+          </includes>
+        </configuration>
+        <executions>
+          <execution>
+            <id>pre-test</id>
+            <goals>
+              <goal>prepare-agent</goal>
+            </goals>
+          </execution>
+          <execution>
+            <id>post-test</id>
+            <configuration>
+              <skip>true</skip>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+  <scm>
+    <connection>scm:git:ssh://git.opendaylight.org:29418/ovsdb.git</connection>
+    <developerConnection>scm:git:ssh://git.opendaylight.org:29418/ovsdb.git</developerConnection>
+    <tag>HEAD</tag>
+    <url>https://wiki.opendaylight.org/view/OVSDB_Integration:Main</url>
+  </scm>
+</project>
diff --git a/paxexam/plugin.integrationtest/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbPluginIT.java b/paxexam/plugin.integrationtest/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbPluginIT.java
new file mode 100644 (file)
index 0000000..e97181d
--- /dev/null
@@ -0,0 +1,176 @@
+/*
+ * Copyright (c) 2014 Red Hat, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal
+ */
+package org.opendaylight.ovsdb.plugin;\r
+\r
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+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.io.IOException;
+import java.util.List;
+
+import javax.inject.Inject;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.opendaylight.controller.sal.core.Node;
+import org.opendaylight.controller.sal.utils.ServiceHelper;
+import org.ops4j.pax.exam.Configuration;
+import org.ops4j.pax.exam.Option;
+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.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+\r
+@RunWith(PaxExam.class)\r
+public class OvsdbPluginIT extends OvsdbTestBase {\r
+    private Logger log = LoggerFactory.getLogger(OvsdbPluginIT.class);\r
+    @Inject\r
+    private BundleContext bc;\r
+    private OVSDBConfigService ovsdbConfigService = null;
+    private Node node = 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",\r
+                        "org.eclipse.equinox.console").versionAsInProject(),\r
+            mavenBundle("equinoxSDK381",\r
+                        "org.eclipse.equinox.util").versionAsInProject(),\r
+            mavenBundle("equinoxSDK381",\r
+                        "org.eclipse.osgi.services").versionAsInProject(),\r
+            mavenBundle("equinoxSDK381",\r
+                        "org.eclipse.equinox.ds").versionAsInProject(),\r
+            mavenBundle("equinoxSDK381",\r
+                        "org.apache.felix.gogo.command").versionAsInProject(),\r
+            mavenBundle("equinoxSDK381",\r
+                        "org.apache.felix.gogo.runtime").versionAsInProject(),\r
+            mavenBundle("equinoxSDK381",\r
+                        "org.apache.felix.gogo.shell").versionAsInProject(),
+            mavenBundle("equinoxSDK381", "javax.servlet").versionAsInProject(),
+
+            mavenBundle("com.google.guava",
+                        "guava").versionAsInProject(),
+\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
+            mavenBundle("org.opendaylight.ovsdb", "ovsdb").versionAsInProject(),\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(),
+            mavenBundle("org.opendaylight.controller", "sal.connection").versionAsInProject(),
+            mavenBundle("org.opendaylight.controller",
+                        "sal.connection.implementation").versionAsInProject(),
+            mavenBundle("org.opendaylight.controller",
+                        "sal.networkconfiguration").versionAsInProject(),
+            mavenBundle("org.opendaylight.controller",
+                        "sal.networkconfiguration.implementation").versionAsInProject(),\r
+            mavenBundle("org.opendaylight.controller", "configuration").versionAsInProject(),\r
+            mavenBundle("org.opendaylight.controller", "containermanager").versionAsInProject(),\r
+            mavenBundle("org.opendaylight.controller",\r
+                        "containermanager.it.implementation").versionAsInProject(),
+            mavenBundle("com.fasterxml.jackson.core", "jackson-annotations").versionAsInProject(),
+            mavenBundle("com.fasterxml.jackson.core", "jackson-core").versionAsInProject(),
+            mavenBundle("com.fasterxml.jackson.core", "jackson-databind").versionAsInProject(),
+            mavenBundle("io.netty", "netty-buffer").versionAsInProject(),
+            mavenBundle("io.netty", "netty-common").versionAsInProject(),
+            mavenBundle("io.netty", "netty-codec").versionAsInProject(),
+            mavenBundle("io.netty", "netty-transport").versionAsInProject(),
+            mavenBundle("io.netty", "netty-handler").versionAsInProject(),
+
+            mavenBundle("org.apache.httpcomponents", "httpcore-nio").versionAsInProject(),
+            mavenBundle("com.google.code.gson", "gson").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
+            mavenBundle("org.apache.felix",\r
+                        "org.apache.felix.dependencymanager.shell").versionAsInProject(),\r
+            mavenBundle("eclipselink", "javax.resource").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() throws InterruptedException {\r
+        assertNotNull(bc);\r
+        boolean debugit = false;\r
+        Bundle b[] = bc.getBundles();\r
+        for (Bundle element : b) {\r
+            int state = element.getState();\r
+            if (state != Bundle.ACTIVE && state != Bundle.RESOLVED) {\r
+                log.info("Bundle:" + element.getSymbolicName() + " state:"\r
+                          + stateToString(state));\r
+                debugit = true;\r
+            }\r
+        }\r
+        if (debugit) {\r
+            log.debug("Do some debugging because some bundle is unresolved");
+        }\r
+\r
+        // Assert if true, if false we are good to go!\r
+        assertFalse(debugit);
+        try {
+            node = getTestConnection();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        this.ovsdbConfigService = (OVSDBConfigService)ServiceHelper.getGlobalInstance(OVSDBConfigService.class, this);\r
+    }\r
+\r
+    @Test\r
+    public void tableTest() throws Exception {
+        assertNotNull("Invalid Node. Check connection params", node);
+        Thread.sleep(3000); // Wait for a few seconds to get the Schema exchange done
+        List<String> tables = ovsdbConfigService.getTables(node);
+        System.out.println("Tables = "+tables);\r
+        assertNotNull(tables);
+    }\r
+}\r
diff --git a/paxexam/plugin.integrationtest/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestBase.java b/paxexam/plugin.integrationtest/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestBase.java
new file mode 100644 (file)
index 0000000..d510a3c
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2014 Red Hat, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal
+ */
+package org.opendaylight.ovsdb.plugin;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import org.opendaylight.controller.sal.connection.ConnectionConstants;
+import org.opendaylight.controller.sal.core.Node;
+import org.opendaylight.controller.sal.utils.ServiceHelper;
+
+public abstract class OvsdbTestBase {
+    private final static String identifier = "TEST";
+
+    public Node getTestConnection() throws IOException {
+        IConnectionServiceInternal connectionService = (IConnectionServiceInternal)ServiceHelper.getGlobalInstance(IConnectionServiceInternal.class,
+                this);
+        Map<ConnectionConstants, String> params = new HashMap<ConnectionConstants, String>();
+        Properties props = System.getProperties();
+        params.put(ConnectionConstants.ADDRESS,
+                props.getProperty("ovsdbserver.ipaddress"));
+        params.put(ConnectionConstants.PORT,
+                props.getProperty("ovsdbserver.port", "6640"));
+
+        Node node = connectionService.connect(identifier, params);
+        if (node == null) {
+            throw new IOException("Failed to connect to the ovsdb server");
+        }
+        return node;
+    }
+}
diff --git a/paxexam/plugin.integrationtest/src/test/resources/logback.xml b/paxexam/plugin.integrationtest/src/test/resources/logback.xml
new file mode 100644 (file)
index 0000000..6d9dfda
--- /dev/null
@@ -0,0 +1,12 @@
+<configuration scan="true">
+  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+    <encoder>
+      <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+      </pattern>
+    </encoder>
+  </appender>
+
+  <root level="error">
+    <appender-ref ref="STDOUT" />
+  </root>
+</configuration>