add non-IT NeutronE2ETest 96/70796/9
authorMichael Vorburger <vorburger@redhat.com>
Wed, 11 Apr 2018 18:09:46 +0000 (20:09 +0200)
committerMichael Vorburger <vorburger@redhat.com>
Thu, 19 Apr 2018 18:41:55 +0000 (20:41 +0200)
Change-Id: I9a2bcb8d6bb095993eec64714648944b25bcaaa4
Signed-off-by: Michael Vorburger <vorburger@redhat.com>
integration/test-standalone/pom.xml
integration/test-standalone/src/test/java/org/opendaylight/neutron/e2etest/NeutronE2ETest.java [new file with mode: 0644]
integration/test-standalone/src/test/java/org/opendaylight/neutron/e2etest/NeutronTestWiring.java [new file with mode: 0644]

index 44814fcba65864ce064dc1f974298418f95943bf..12e547cea3afde9def89049a0f257e6f7e4f70d9 100644 (file)
@@ -1,5 +1,7 @@
 <?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">
+<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>
       <artifactId>junit</artifactId>
       <scope>compile</scope>
     </dependency>
+
+    <dependency>
+      <groupId>javax.inject</groupId>
+      <artifactId>javax.inject</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.opendaylight.neutron</groupId>
+      <artifactId>northbound-api</artifactId>
+      <version>${project.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.neutron</groupId>
+      <artifactId>transcriber</artifactId>
+      <version>${project.version}</version>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>sal-binding-broker-impl</artifactId>
+      <version>1.8.0-SNAPSHOT</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>sal-binding-broker-impl</artifactId>
+      <version>1.8.0-SNAPSHOT</version>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.infrautils</groupId>
+      <artifactId>infrautils-testutils</artifactId>
+      <version>1.4.0-SNAPSHOT</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.infrautils</groupId>
+      <artifactId>inject.guice.testutils</artifactId>
+      <version>1.4.0-SNAPSHOT</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.aaa.web</groupId>
+      <artifactId>web-jetty-impl</artifactId>
+      <version>0.8.0-SNAPSHOT</version>
+      <scope>test</scope>
+    </dependency>
+
+    <!-- TODO This is temporary, remove this again, soon -->
+    <dependency>
+      <groupId>org.osgi</groupId>
+      <artifactId>org.osgi.core</artifactId>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 </project>
diff --git a/integration/test-standalone/src/test/java/org/opendaylight/neutron/e2etest/NeutronE2ETest.java b/integration/test-standalone/src/test/java/org/opendaylight/neutron/e2etest/NeutronE2ETest.java
new file mode 100644 (file)
index 0000000..c07effc
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2018 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
+ */
+package org.opendaylight.neutron.e2etest;
+
+import java.io.IOException;
+import javax.inject.Inject;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.opendaylight.aaa.web.WebServer;
+import org.opendaylight.infrautils.inject.guice.testutils.AnnotationsModule;
+import org.opendaylight.infrautils.inject.guice.testutils.GuiceRule;
+import org.opendaylight.infrautils.testutils.ClasspathHellDuplicatesCheckRule;
+
+/**
+ * Neutron "end to end" (component) test.
+ *
+ * <p>This is similar to the ITNeutronE2E, but does the same without OSGi and Karaf.
+ *
+ * @author Michael Vorburger.ch
+ */
+public class NeutronE2ETest {
+
+    public static @ClassRule ClasspathHellDuplicatesCheckRule jHades = new ClasspathHellDuplicatesCheckRule();
+
+    public @Rule GuiceRule guice = new GuiceRule(NeutronTestWiring.class, AnnotationsModule.class);
+
+    public @Inject WebServer webServer;
+
+    @Test
+    public void test() throws IOException, InterruptedException {
+        NeutronAllTests.testNeutron(webServer.getBaseURL() + "/controller/nb/v2/neutron");
+    }
+
+}
diff --git a/integration/test-standalone/src/test/java/org/opendaylight/neutron/e2etest/NeutronTestWiring.java b/integration/test-standalone/src/test/java/org/opendaylight/neutron/e2etest/NeutronTestWiring.java
new file mode 100644 (file)
index 0000000..2b31d55
--- /dev/null
@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) 2018 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
+ */
+package org.opendaylight.neutron.e2etest;
+
+import com.google.inject.AbstractModule;
+import org.opendaylight.aaa.web.WebContextSecurer;
+import org.opendaylight.aaa.web.WebServer;
+import org.opendaylight.aaa.web.jetty.JettyWebServer;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.test.DataBrokerTestModule;
+import org.opendaylight.neutron.northbound.api.WebInitializer;
+import org.opendaylight.neutron.spi.INeutronBgpvpnCRUD;
+import org.opendaylight.neutron.spi.INeutronFirewallCRUD;
+import org.opendaylight.neutron.spi.INeutronFirewallPolicyCRUD;
+import org.opendaylight.neutron.spi.INeutronFirewallRuleCRUD;
+import org.opendaylight.neutron.spi.INeutronFloatingIpCRUD;
+import org.opendaylight.neutron.spi.INeutronL2gatewayCRUD;
+import org.opendaylight.neutron.spi.INeutronL2gatewayConnectionCRUD;
+import org.opendaylight.neutron.spi.INeutronLoadBalancerCRUD;
+import org.opendaylight.neutron.spi.INeutronLoadBalancerHealthMonitorCRUD;
+import org.opendaylight.neutron.spi.INeutronLoadBalancerListenerCRUD;
+import org.opendaylight.neutron.spi.INeutronLoadBalancerPoolCRUD;
+import org.opendaylight.neutron.spi.INeutronMeteringLabelCRUD;
+import org.opendaylight.neutron.spi.INeutronMeteringLabelRuleCRUD;
+import org.opendaylight.neutron.spi.INeutronNetworkCRUD;
+import org.opendaylight.neutron.spi.INeutronPortCRUD;
+import org.opendaylight.neutron.spi.INeutronQosPolicyCRUD;
+import org.opendaylight.neutron.spi.INeutronRouterCRUD;
+import org.opendaylight.neutron.spi.INeutronSFCFlowClassifierCRUD;
+import org.opendaylight.neutron.spi.INeutronSFCPortChainCRUD;
+import org.opendaylight.neutron.spi.INeutronSFCPortPairCRUD;
+import org.opendaylight.neutron.spi.INeutronSFCPortPairGroupCRUD;
+import org.opendaylight.neutron.spi.INeutronSecurityGroupCRUD;
+import org.opendaylight.neutron.spi.INeutronSecurityRuleCRUD;
+import org.opendaylight.neutron.spi.INeutronSubnetCRUD;
+import org.opendaylight.neutron.spi.INeutronTapFlowCRUD;
+import org.opendaylight.neutron.spi.INeutronTapServiceCRUD;
+import org.opendaylight.neutron.spi.INeutronTrunkCRUD;
+import org.opendaylight.neutron.spi.INeutronVpnIkePolicyCRUD;
+import org.opendaylight.neutron.spi.INeutronVpnIpSecPolicyCRUD;
+import org.opendaylight.neutron.spi.INeutronVpnIpSecSiteConnectionsCRUD;
+import org.opendaylight.neutron.spi.INeutronVpnServiceCRUD;
+import org.opendaylight.neutron.transcriber.NeutronBgpvpnInterface;
+import org.opendaylight.neutron.transcriber.NeutronFirewallInterface;
+import org.opendaylight.neutron.transcriber.NeutronFirewallPolicyInterface;
+import org.opendaylight.neutron.transcriber.NeutronFirewallRuleInterface;
+import org.opendaylight.neutron.transcriber.NeutronFloatingIpInterface;
+import org.opendaylight.neutron.transcriber.NeutronL2gatewayConnectionInterface;
+import org.opendaylight.neutron.transcriber.NeutronL2gatewayInterface;
+import org.opendaylight.neutron.transcriber.NeutronLoadBalancerHealthMonitorInterface;
+import org.opendaylight.neutron.transcriber.NeutronLoadBalancerInterface;
+import org.opendaylight.neutron.transcriber.NeutronLoadBalancerListenerInterface;
+import org.opendaylight.neutron.transcriber.NeutronLoadBalancerPoolInterface;
+import org.opendaylight.neutron.transcriber.NeutronMeteringLabelInterface;
+import org.opendaylight.neutron.transcriber.NeutronMeteringLabelRuleInterface;
+import org.opendaylight.neutron.transcriber.NeutronNetworkInterface;
+import org.opendaylight.neutron.transcriber.NeutronPortInterface;
+import org.opendaylight.neutron.transcriber.NeutronQosPolicyInterface;
+import org.opendaylight.neutron.transcriber.NeutronRouterInterface;
+import org.opendaylight.neutron.transcriber.NeutronSFCFlowClassifierInterface;
+import org.opendaylight.neutron.transcriber.NeutronSFCPortChainInterface;
+import org.opendaylight.neutron.transcriber.NeutronSFCPortPairGroupInterface;
+import org.opendaylight.neutron.transcriber.NeutronSFCPortPairInterface;
+import org.opendaylight.neutron.transcriber.NeutronSecurityGroupInterface;
+import org.opendaylight.neutron.transcriber.NeutronSecurityRuleInterface;
+import org.opendaylight.neutron.transcriber.NeutronSubnetInterface;
+import org.opendaylight.neutron.transcriber.NeutronTapFlowInterface;
+import org.opendaylight.neutron.transcriber.NeutronTapServiceInterface;
+import org.opendaylight.neutron.transcriber.NeutronTrunkInterface;
+import org.opendaylight.neutron.transcriber.NeutronVpnIkePolicyInterface;
+import org.opendaylight.neutron.transcriber.NeutronVpnIpSecPolicyInterface;
+import org.opendaylight.neutron.transcriber.NeutronVpnIpSecSiteConnectionsInterface;
+import org.opendaylight.neutron.transcriber.NeutronVpnServiceInterface;
+
+/**
+ * Dependency Injection wiring for Neutron.
+ *
+ * @author Michael Vorburger.ch
+ */
+public class NeutronTestWiring extends AbstractModule {
+
+    @Override
+    protected void configure() {
+        bind(WebServer.class).toInstance(new JettyWebServer(9090));
+        bind(WebContextSecurer.class).toInstance((webContextBuilder, urlPatterns) -> { }); // NOOP
+        bind(WebInitializer.class);
+
+        DataBrokerTestModule dataBrokerTestModule = new DataBrokerTestModule(true);
+        DataBroker dataBroker = dataBrokerTestModule.getDataBroker();
+        bind(DataBroker.class).toInstance(dataBroker);
+
+        bind(INeutronNetworkCRUD.class).to(NeutronNetworkInterface.class);
+        bind(INeutronSubnetCRUD.class).to(NeutronSubnetInterface.class);
+        bind(INeutronPortCRUD.class).to(NeutronPortInterface.class);
+        bind(INeutronRouterCRUD.class).to(NeutronRouterInterface.class);
+        bind(INeutronFloatingIpCRUD.class).to(NeutronFloatingIpInterface.class);
+        bind(INeutronSecurityGroupCRUD.class).to(NeutronSecurityGroupInterface.class);
+        bind(INeutronSecurityRuleCRUD.class).to(NeutronSecurityRuleInterface.class);
+        bind(INeutronFirewallCRUD.class).to(NeutronFirewallInterface.class);
+        bind(INeutronFirewallPolicyCRUD.class).to(NeutronFirewallPolicyInterface.class);
+        bind(INeutronFirewallRuleCRUD.class).to(NeutronFirewallRuleInterface.class);
+        bind(INeutronLoadBalancerCRUD.class).to(NeutronLoadBalancerInterface.class);
+        bind(INeutronLoadBalancerListenerCRUD.class).to(NeutronLoadBalancerListenerInterface.class);
+        bind(INeutronLoadBalancerPoolCRUD.class).to(NeutronLoadBalancerPoolInterface.class);
+        bind(INeutronBgpvpnCRUD.class).to(NeutronBgpvpnInterface.class);
+        bind(INeutronL2gatewayCRUD.class).to(NeutronL2gatewayInterface.class);
+        bind(INeutronL2gatewayConnectionCRUD.class).to(NeutronL2gatewayConnectionInterface.class);
+        bind(INeutronLoadBalancerHealthMonitorCRUD.class).to(NeutronLoadBalancerHealthMonitorInterface.class);
+        bind(INeutronMeteringLabelCRUD.class).to(NeutronMeteringLabelInterface.class);
+        bind(INeutronMeteringLabelRuleCRUD.class).to(NeutronMeteringLabelRuleInterface.class);
+        bind(INeutronVpnServiceCRUD.class).to(NeutronVpnServiceInterface.class);
+        bind(INeutronVpnIkePolicyCRUD.class).to(NeutronVpnIkePolicyInterface.class);
+        bind(INeutronVpnIpSecPolicyCRUD.class).to(NeutronVpnIpSecPolicyInterface.class);
+        bind(INeutronSFCFlowClassifierCRUD.class).to(NeutronSFCFlowClassifierInterface.class);
+        bind(INeutronSFCPortChainCRUD.class).to(NeutronSFCPortChainInterface.class);
+        bind(INeutronSFCPortPairGroupCRUD.class).to(NeutronSFCPortPairGroupInterface.class);
+        bind(INeutronSFCPortPairCRUD.class).to(NeutronSFCPortPairInterface.class);
+        bind(INeutronQosPolicyCRUD.class).to(NeutronQosPolicyInterface.class);
+        bind(INeutronTrunkCRUD.class).to(NeutronTrunkInterface.class);
+        bind(INeutronTapServiceCRUD.class).to(NeutronTapServiceInterface.class);
+        bind(INeutronTapFlowCRUD.class).to(NeutronTapFlowInterface.class);
+        bind(INeutronVpnIpSecSiteConnectionsCRUD.class).to(NeutronVpnIpSecSiteConnectionsInterface.class);
+    }
+
+}