Update IT pom.xml for Integration Tests 31/32431/14
authorRashmi Pujar <rpujar@inocybe.com>
Tue, 12 Jan 2016 16:03:17 +0000 (11:03 -0500)
committerRashmi Pujar <rpujar@inocybe.com>
Mon, 25 Jan 2016 15:00:02 +0000 (10:00 -0500)
Change-Id: Ia88ee4360908ce8e3a363a678259a2f722ef5703
Signed-off-by: Rashmi Pujar <rpujar@inocybe.com>
it/pom.xml
it/src/test/java/org/opendaylight/unimgr/it/UnimgrIT.java [new file with mode: 0644]
karaf/pom.xml
pom.xml

index 3b1cba78075f2fe95a8539f19602d452f69abdcf..f910c5e6298e563bffcdd0f62b656a728c217c81 100644 (file)
@@ -10,8 +10,8 @@ and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL
 
   <parent>
     <groupId>org.opendaylight.controller</groupId>
-    <artifactId>config-parent</artifactId>
-    <version>0.5.0-SNAPSHOT</version>
+    <artifactId>mdsal-it-parent</artifactId>
+    <version>1.4.0-SNAPSHOT</version>
     <relativePath/>
   </parent>
 
@@ -19,47 +19,22 @@ and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL
   <groupId>org.opendaylight.unimgr</groupId>
   <artifactId>unimgr-it</artifactId>
   <version>0.1.0-SNAPSHOT</version>
-  <packaging>jar</packaging>
-  <dependencyManagement>
-    <dependencies>
-      <dependency>
-        <groupId>${project.groupId}</groupId>
-        <artifactId>unimgr-artifacts</artifactId>
-        <version>${project.version}</version>
-        <type>pom</type>
-        <scope>import</scope>
-      </dependency>
-      <dependency>
-        <groupId>org.opendaylight.controller</groupId>
-        <artifactId>config-artifacts</artifactId>
-        <version>0.5.0-SNAPSHOT</version>
-        <type>pom</type>
-        <scope>import</scope>
-      </dependency>
-      <dependency>
-        <groupId>org.opendaylight.controller</groupId>
-        <artifactId>mdsal-artifacts</artifactId>
-        <version>${mdsal.version}</version>
-        <type>pom</type>
-        <scope>import</scope>
-      </dependency>
-    </dependencies>
-  </dependencyManagement>
+  <packaging>bundle</packaging>
+
+  <properties>
+    <skipITs>false</skipITs>
+    <karaf.distro.groupId>org.opendaylight.unimgr</karaf.distro.groupId>
+    <karaf.distro.artifactId>unimgr-karaf</karaf.distro.artifactId>
+    <karaf.distro.version>${project.version}</karaf.distro.version>
+    <karaf.distro.type>zip</karaf.distro.type>
+  </properties>
+
   <dependencies>
-    <dependency>
-      <groupId>org.opendaylight.controller</groupId>
-      <artifactId>sal-binding-api</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.opendaylight.controller</groupId>
-      <artifactId>sal-common-api</artifactId>
-    </dependency>
     <dependency>
       <groupId>${project.groupId}</groupId>
       <artifactId>unimgr-features</artifactId>
-      <classifier>features</classifier>
-      <type>xml</type>
+      <version>${project.version}</version>
     </dependency>
   </dependencies>
 
-</project>
+</project>
\ No newline at end of file
diff --git a/it/src/test/java/org/opendaylight/unimgr/it/UnimgrIT.java b/it/src/test/java/org/opendaylight/unimgr/it/UnimgrIT.java
new file mode 100644 (file)
index 0000000..f99147e
--- /dev/null
@@ -0,0 +1,159 @@
+/*
+ * Copyright © 2016 Inocybe Technologies 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
+ */
+package org.opendaylight.unimgr.it;
+
+import static org.ops4j.pax.exam.CoreOptions.composite;
+import static org.ops4j.pax.exam.CoreOptions.maven;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfigurationFilePut;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
+import org.opendaylight.controller.mdsal.it.base.AbstractMdsalTestBase;
+import org.opendaylight.unimgr.impl.UnimgrConstants;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Uri;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.karaf.options.LogLevelOption.LogLevel;
+import org.ops4j.pax.exam.options.MavenUrlReference;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerClass;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.base.Optional;
+import com.google.common.util.concurrent.CheckedFuture;
+
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerClass.class)
+public class UnimgrIT extends AbstractMdsalTestBase {
+    private static final Logger LOG = LoggerFactory.getLogger(UnimgrIT.class);
+    private DataBroker dataBroker;
+
+    @Override
+    public void setup() throws Exception {
+        super.setup();
+        Thread.sleep(3000);
+        dataBroker =  getSession().getSALService(DataBroker.class);
+        Assert.assertNotNull("db should not be null", dataBroker);
+    }
+
+    @Override
+    public String getModuleName() {
+        return "unimgr";
+    }
+
+    @Override
+    public String getInstanceName() {
+        return "unimgr-default";
+    }
+
+    @Override
+    public MavenUrlReference getFeatureRepo() {
+        return maven()
+                .groupId("org.opendaylight.unimgr")
+                .artifactId("unimgr-features")
+                .classifier("features")
+                .type("xml")
+                .versionAsInProject();
+    }
+
+    @Override
+    public String getFeatureName() {
+        return "odl-unimgr";
+    }
+
+    @Override
+    public Option getLoggingOption() {
+        Option option = editConfigurationFilePut(ORG_OPS4J_PAX_LOGGING_CFG,
+                logConfiguration(UnimgrIT.class),
+                LogLevel.INFO.name());
+        option = composite(option, super.getLoggingOption());
+        return option;
+    }
+
+    @Test
+    public void testUnimgrFeatureLoad() {
+        Assert.assertTrue(true);
+    }
+
+    @Test
+    public void testUnimgr() {
+
+        LOG.info(UnimgrConstants.DEFAULT_BRIDGE_NAME);
+
+        InstanceIdentifier<Topology> uniTopoPath = InstanceIdentifier
+                .create(NetworkTopology.class)
+                .child(Topology.class,
+                        new TopologyKey(new TopologyId(new Uri("unimgr:uni"))));
+        InstanceIdentifier<Topology> evcTopoPath = InstanceIdentifier
+                .create(NetworkTopology.class)
+                .child(Topology.class,
+                        new TopologyKey(new TopologyId(new Uri("unimgr:evc"))));
+
+        // Read from md-sal and check if it is initialized with Uni and Evc augmentations
+        Topology topology = read(LogicalDatastoreType.CONFIGURATION, uniTopoPath);
+        Assert.assertNotNull("Topology could not be found in " + LogicalDatastoreType.CONFIGURATION,
+                topology);
+        topology = read(LogicalDatastoreType.OPERATIONAL, uniTopoPath);
+        Assert.assertNotNull("Topology could not be found in " + LogicalDatastoreType.OPERATIONAL,
+                topology);
+        topology = read(LogicalDatastoreType.CONFIGURATION, evcTopoPath);
+        Assert.assertNotNull("Topology could not be found in " + LogicalDatastoreType.CONFIGURATION,
+                topology);
+        topology = read(LogicalDatastoreType.OPERATIONAL, evcTopoPath);
+        Assert.assertNotNull("Topology could not be found in " + LogicalDatastoreType.OPERATIONAL,
+                topology);
+    }
+
+    private void testCreateUni() {
+        LOG.info("Test for create Uni");
+    }
+
+    private void testDeleteUni() {
+        LOG.info("Test for delete Uni");
+    }
+
+    private void testCreateEvc() {
+        LOG.info("Test for create Evc");
+    }
+
+    private void testDeleteEvc() {
+        LOG.info("Test for delete Evc");
+    }
+
+    private <D extends org.opendaylight.yangtools.yang.binding.DataObject> D read(
+            final LogicalDatastoreType store, final InstanceIdentifier<D> path)  {
+        D result = null;
+        final ReadOnlyTransaction transaction = dataBroker.newReadOnlyTransaction();
+        Optional<D> optionalDataObject;
+        CheckedFuture<Optional<D>, ReadFailedException> future = transaction.read(store, path);
+        try {
+            optionalDataObject = future.checkedGet();
+            if (optionalDataObject.isPresent()) {
+                result = optionalDataObject.get();
+            } else {
+                LOG.debug("{}: Failed to read {}",
+                        Thread.currentThread().getStackTrace()[1], path);
+            }
+        } catch (ReadFailedException e) {
+            LOG.warn("Failed to read {} ", path, e);
+        }
+        transaction.close();
+        return result;
+    }
+}
index b4ec2b981b62a6277ff5ec840cc81e138bbc3261..eaea43a838b52acc1f2f1a396de330e335cdb1c2 100644 (file)
@@ -62,13 +62,6 @@ and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL
           <skip>true</skip>
         </configuration>
       </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-install-plugin</artifactId>
-        <configuration>
-          <skip>true</skip>
-        </configuration>
-      </plugin>
     </plugins>
   </build>
 </project>
diff --git a/pom.xml b/pom.xml
index 244a23a90a35c76719821001d6a63fac6d2f57be..ce292db33b5f5fae6360446579c73187544dca33 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -28,10 +28,10 @@ and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL
     <module>api</module>
     <module>impl</module>
     <module>cli</module>
-    <module>it</module>
     <module>karaf</module>
     <module>features</module>
     <module>artifacts</module>
+    <module>it</module>
   </modules>
   <!-- DO NOT install or deploy the repo root pom as it's only needed to initiate a build -->
   <build>