Fixed IT breakage. 09/27809/2
authorShigeru Yasuda <s-yasuda@da.jp.nec.com>
Fri, 2 Oct 2015 11:47:43 +0000 (20:47 +0900)
committerShigeru Yasuda <s-yasuda@da.jp.nec.com>
Fri, 2 Oct 2015 14:15:48 +0000 (23:15 +0900)
  * Extend OSGi bundle load timeout to 10 minutes.
  * Added missing capabilities.
  * Don't use AD-SAL northbound bundlescanner.
    * AD-SAL bundlescanner is no longer available because of asm-all
      version up.
  * Extend heap size for test VM.
  * Kill test VM after 20 minutes.

Change-Id: I95851181ad05f2e57c60714464877bba40977ba6
Signed-off-by: Shigeru Yasuda <s-yasuda@da.jp.nec.com>
manager/common/pom.xml
manager/it/common/pom.xml
manager/it/northbound/pom.xml
manager/it/option/src/main/java/org/opendaylight/vtn/manager/it/option/TestOption.java
manager/it/option/src/main/resources/controller.xml
manager/it/util/src/main/java/org/opendaylight/vtn/manager/it/util/TestBase.java
manager/northbound/pom.xml
manager/northbound/src/main/java/org/opendaylight/vtn/manager/northbound/JsonExceptionMapper.java [new file with mode: 0644]
manager/northbound/src/main/java/org/opendaylight/vtn/manager/northbound/VTNNorthboundApplication.java [new file with mode: 0644]
manager/northbound/src/main/resources/WEB-INF/web.xml

index c408a48ba140391eaa1ef7731b2f7b11b12aae4e..e36180c30f2bf1c0194c5a6e553b033b802001da 100644 (file)
@@ -64,7 +64,7 @@
     <!-- Use checkstyle 6.5. -->
     <checkstyle.engine.version>6.5</checkstyle.engine.version>
 
-    <testvm.argLine>-Xmx1024m -XX:MaxPermSize=256m</testvm.argLine>
+    <testvm.argLine>-Xmx2048m -XX:MaxPermSize=1024m</testvm.argLine>
 
     <!-- Karaf properties -->
     <karaf.empty.version>1.6.0-SNAPSHOT</karaf.empty.version>
         <artifactId>bundlescanner</artifactId>
         <version>0.6.0-SNAPSHOT</version>
       </dependency>
-      <dependency>
-        <groupId>org.opendaylight.controller</groupId>
-        <artifactId>bundlescanner.implementation</artifactId>
-        <version>0.6.0-SNAPSHOT</version>
-      </dependency>
 
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
index 9467638e890688be6ee44c0882678296be790fc3..a5b43eac16b85f64f9f5a9deff75f09ddd568345 100644 (file)
@@ -38,6 +38,9 @@
         in /tmp.
     -->
     <vtn.it.tmpdir>${project.build.directory}/it-tmp</vtn.it.tmpdir>
+
+    <!-- Kill test VM after 20 minutes. -->
+    <failsafe.timeout>1200</failsafe.timeout>
   </properties>
 
   <dependencies>
index 7afdb216a9465603ae269826f0348963f55d9453..ae0687b6309b7b2367c68a4e6331f2559ed2771c 100644 (file)
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>bundlescanner</artifactId>
     </dependency>
-    <dependency>
-      <groupId>org.opendaylight.controller</groupId>
-      <artifactId>bundlescanner.implementation</artifactId>
-    </dependency>
 
     <dependency>
       <groupId>commons-io</groupId>
       <artifactId>javax.servlet.jsp.jstl.impl</artifactId>
     </dependency>
 
-    <dependency>
-      <groupId>org.ow2.asm</groupId>
-      <artifactId>asm-all</artifactId>
-    </dependency>
-
     <dependency>
       <groupId>org.springframework</groupId>
       <artifactId>org.springframework.asm</artifactId>
index dc344013b0b5f2da4682540e855190280052f3fe..5d3055268bd653db3063f70ca59b07ba2e038e7f 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.vtn.manager.it.option;
 import static org.ops4j.pax.exam.CoreOptions.frameworkProperty;
 import static org.ops4j.pax.exam.CoreOptions.systemPackages;
 import static org.ops4j.pax.exam.CoreOptions.systemProperty;
+import static org.ops4j.pax.exam.CoreOptions.systemTimeout;
 import static org.ops4j.pax.exam.CoreOptions.workingDirectory;
 
 import java.io.Closeable;
@@ -40,6 +41,11 @@ import org.opendaylight.controller.sal.utils.GlobalConstants;
  * </p>
  */
 public final class TestOption {
+    /**
+     * The number of milliseconds to wait for the framework to start.
+     */
+    private static final int  SYSTEM_TIMEOUT = 600000;
+
     /**
      * The size of internal buffer used by
      * {@link #copyFile(InputStream, File)}.
@@ -322,6 +328,9 @@ public final class TestOption {
             // Set fail if unresolved bundle present.
             systemProperty("pax.exam.osgi.unresolved.fail").value("true"),
 
+            // Set system timeout.
+            systemTimeout(SYSTEM_TIMEOUT),
+
             // Use own working directory in order to prevent from creating
             // temporary files in /tmp.
             workingDirectory(tmpPath),
@@ -471,7 +480,6 @@ public final class TestOption {
             mavenBundle(SPRING_FRAMEWORK_SECURITY, "spring-security-taglibs"),
 
             // Miscellaneous.
-            mavenBundle("org.ow2.asm", "asm-all"),
             mavenBundle("org.ow2.chameleon.management", "chameleon-mbeans"),
             mavenBundle("org.aopalliance", "com.springsource.org.aopalliance"),
             mavenBundle("commons-io", "commons-io"),
@@ -487,7 +495,6 @@ public final class TestOption {
             mavenBundle(TestHelper.CONTROLLER, "usermanager.implementation"),
             mavenBundle(TestHelper.CONTROLLER, "security").noStart(),
             mavenBundle(TestHelper.CONTROLLER, "bundlescanner"),
-            mavenBundle(TestHelper.CONTROLLER, "bundlescanner.implementation"),
             mavenBundle(TestHelper.CONTROLLER, "commons.northbound"),
 
             mavenBundle(CONTROLLER_THIRD_PARTY,
index 34fed16ad6cebc76f5ee0da1139fe80fb2d403c3..8ede1d9c6076f51b51ef7d10cc343d2952c9ea81 100644 (file)
         <capability>urn:opendaylight:params:xml:ns:yang:controller:md:sal:core:spi:config-dom-store?module=opendaylight-config-dom-datastore&amp;revision=2014-06-17</capability>
         <capability>urn:opendaylight:params:xml:ns:yang:controller:md:sal:core:spi:operational-dom-store?module=opendaylight-operational-dom-datastore&amp;revision=2014-06-17</capability>
         <capability>urn:opendaylight:params:xml:ns:yang:controller:inmemory-datastore-provider?module=opendaylight-inmemory-datastore-provider&amp;revision=2014-06-17</capability>
+        <capability>urn:ietf:params:xml:ns:yang:rpc-context?module=rpc-context&amp;revision=2013-06-17</capability>
+        <capability>urn:opendaylight:params:xml:ns:yang:controller:config?module=config&amp;revision=2013-04-05</capability>
+        <capability>urn:opendaylight:params:xml:ns:yang:controller:logback:config?module=config-logging&amp;revision=2013-07-16</capability>
 
-        <!-- Required YANG models: yangtools -->
+        <!-- Required YANG models: MD-SAL -->
         <capability>urn:TBD:params:xml:ns:yang:network-topology?module=network-topology&amp;revision=2013-10-21</capability>
 
         <!-- Required YANG models: controller -->
index e515d5307ea2b20d36867482de6a87467d7b9110..ef2b8b125071b04e0e15b1ac2f9d96f0b5280fc0 100644 (file)
@@ -45,7 +45,7 @@ public abstract class TestBase extends Assert {
     /**
      * The number of milliseconds to wait for OSGi service.
      */
-    public static final long  OSGI_TIMEOUT = 120000L;
+    public static final long  OSGI_TIMEOUT = 600000L;
 
     /**
      * The number of milliseconds to sleep for short delay.
index 2556b5cb80786c8e751a09cc3b21fbb05bcb4f6f..7c82480720ac5ffb84bd325f95699c6ccad6f6d5 100644 (file)
@@ -93,6 +93,7 @@
             <Import-Package>
               org.opendaylight.controller.northbound.commons,
               org.opendaylight.controller.northbound.commons.exception,
+              org.opendaylight.controller.northbound.commons.query,
               org.opendaylight.controller.northbound.commons.utils,
               org.opendaylight.controller.sal.authorization,
               org.opendaylight.controller.sal.core,
               org.opendaylight.controller.sal.utils,
               org.opendaylight.vtn.manager*,
               org.opendaylight.yang.gen.v1.*,
+              com.fasterxml.jackson.core,
+              com.fasterxml.jackson.databind,
               com.fasterxml.jackson.databind.annotation,
+              com.fasterxml.jackson.jaxrs.json,
               com.sun.jersey.spi.container.servlet,
+              com.google.common.collect,
               javax.ws.rs,
               javax.ws.rs.core,
+              javax.ws.rs.ext,
+              javax.xml.bind,
               javax.xml.bind.annotation,
               org.apache.catalina.filters,
               !org.codehaus.enunciate.jaxrs
             </Import-Package>
             <Web-ContextPath>/controller/nb/v2/vtn</Web-ContextPath>
-            <Jaxrs-Resources>
-              ,${classes;ANNOTATION;javax.ws.rs.Path}
-            </Jaxrs-Resources>
           </instructions>
         </configuration>
       </plugin>
       <artifactId>jackson-databind</artifactId>
     </dependency>
 
+    <dependency>
+      <groupId>com.fasterxml.jackson.jaxrs</groupId>
+      <artifactId>jackson-jaxrs-base</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>com.fasterxml.jackson.jaxrs</groupId>
+      <artifactId>jackson-jaxrs-json-provider</artifactId>
+    </dependency>
+
     <!-- Jackson JAXB support is used in unit tests. -->
     <dependency>
       <groupId>com.fasterxml.jackson.module</groupId>
diff --git a/manager/northbound/src/main/java/org/opendaylight/vtn/manager/northbound/JsonExceptionMapper.java b/manager/northbound/src/main/java/org/opendaylight/vtn/manager/northbound/JsonExceptionMapper.java
new file mode 100644 (file)
index 0000000..030336d
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2015 NEC Corporation. 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.vtn.manager.northbound;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.core.GenericEntity;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.ext.ExceptionMapper;
+import javax.ws.rs.ext.Provider;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+
+/**
+ * Exception mapper for handling Jackson exception.
+ */
+@Provider
+@Consumes(MediaType.APPLICATION_JSON)
+public final class JsonExceptionMapper
+    implements ExceptionMapper<JsonProcessingException> {
+    /**
+     * Convert the given Jackson exception to a REST response.
+     *
+     * @param e  A {@link JsonProcessingException} exception.
+     * @return  A {@link Response} instance.
+     */
+    @Override
+    public Response toResponse(JsonProcessingException e) {
+        String msg = e.getMessage();
+        GenericEntity<String> entity = new GenericEntity<String>(msg) {};
+        return Response.status(Response.Status.BAD_REQUEST).
+            entity(entity).build();
+    }
+}
diff --git a/manager/northbound/src/main/java/org/opendaylight/vtn/manager/northbound/VTNNorthboundApplication.java b/manager/northbound/src/main/java/org/opendaylight/vtn/manager/northbound/VTNNorthboundApplication.java
new file mode 100644 (file)
index 0000000..e58ca07
--- /dev/null
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2015 NEC Corporation. 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.vtn.manager.northbound;
+
+import static com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES;
+
+import java.util.Set;
+
+import javax.ws.rs.core.Application;
+
+import com.google.common.collect.ImmutableSet;
+
+import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider;
+
+import org.opendaylight.controller.northbound.commons.exception.GenericExceptionMapper;
+import org.opendaylight.controller.northbound.commons.query.QueryContextProvider;
+
+/**
+ * Describes JAX-RS application for VTN Manager.
+ */
+public final class VTNNorthboundApplication extends Application {
+    /**
+     * A set of root resource and provider instances.
+     */
+    private final Set<Object>  providerInstances;
+
+    /**
+     * A set of provider classes.
+     */
+    private final Set<Class<?>>  providerClasses;
+
+    /**
+     * Construct a new instance.
+     */
+    public VTNNorthboundApplication() {
+        JacksonJaxbJsonProvider jsonProvider = new JacksonJaxbJsonProvider();
+        jsonProvider.configure(FAIL_ON_UNKNOWN_PROPERTIES, false);
+        providerInstances = ImmutableSet.<Object>builder().
+            add(jsonProvider).
+            add(new JsonExceptionMapper()).
+            add(new QueryContextProvider()).
+            add(new GenericExceptionMapper()).
+            build();
+
+        providerClasses = ImmutableSet.<Class<?>>builder().
+            add(ContainerPathMapNorthbound.class).
+            add(FlowConditionNorthbound.class).
+            add(FlowNorthbound.class).
+            add(GlobalNorthbound.class).
+            add(MacMapNorthbound.class).
+            add(PathPolicyNorthbound.class).
+            add(VBridgeFlowFilterNorthbound.class).
+            add(VBridgeIfFlowFilterNorthbound.class).
+            add(VBridgeInterfaceNorthbound.class).
+            add(VBridgeNorthbound.class).
+            add(VTenantFlowFilterNorthbound.class).
+            add(VTenantNorthbound.class).
+            add(VTenantPathMapNorthbound.class).
+            add(VTerminalIfFlowFilterNorthbound.class).
+            add(VTerminalInterfaceNorthbound.class).
+            add(VTerminalNorthbound.class).
+            build();
+    }
+
+    /**
+     * Return a set of root resource and provider instances.
+     *
+     * @return  A set of root resource and provider instances.
+     */
+    @Override
+    public Set<Object> getSingletons() {
+        return providerInstances;
+    }
+
+    /**
+     * Return a set of root resource and provider classes.
+     *
+     * @return  A set of root resource and provider classes.
+     */
+    @Override
+    public Set<Class<?>> getClasses() {
+        return providerClasses;
+    }
+}
index 430aa0b5228df7200ef06b45ec0d788a41395c1a..4c6fab302a37e9feaa844e66cb9ad5d3253b1df2 100644 (file)
@@ -2,12 +2,11 @@
 
 <!--
 #
-# Copyright (c) 2013 NEC Corporation
-# All rights reserved.
+# Copyright (c) 2013, 2015 NEC Corporation. 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
+# terms of the Eclipse Public License v1.0 which accompanies this distribution,
+# and is available at http://www.eclipse.org/legal/epl-v10.html
 #
 -->
 
@@ -21,7 +20,7 @@
     <init-param>
       <param-name>javax.ws.rs.Application</param-name>
       <param-value>
-        org.opendaylight.controller.northbound.commons.NorthboundApplication
+        org.opendaylight.vtn.manager.northbound.VTNNorthboundApplication
       </param-value>
     </init-param>
     <load-on-startup>1</load-on-startup>