Merge "Remove redundant expression true:false"
authorMadhu Venugopal <mavenugo@gmail.com>
Thu, 9 Jan 2014 08:12:14 +0000 (08:12 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Thu, 9 Jan 2014 08:12:14 +0000 (08:12 +0000)
1  2 
opendaylight/northbound/integrationtest/src/test/java/org/opendaylight/controller/northbound/integrationtest/NorthboundIT.java

index 1e7e93f8aa27e165d79dfcbaa82b91b841ffc80f,322f1401ba6548852b756adbc7719ca8125b5ff6..cabfb0ee5a1e98e27194cb244f445ca8ba3ca40d
@@@ -15,6 -15,7 +15,6 @@@ import java.util.HashSet
  import java.util.List;
  import java.util.Map;
  import java.util.Set;
 -
  import javax.inject.Inject;
  
  import org.apache.commons.codec.binary.Base64;
@@@ -43,8 -44,8 +43,8 @@@ import org.opendaylight.controller.sal.
  import org.opendaylight.controller.sal.topology.TopoEdgeUpdate;
  import org.opendaylight.controller.switchmanager.IInventoryListener;
  import org.opendaylight.controller.usermanager.IUserManager;
 -import org.ops4j.pax.exam.Option;
  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;
@@@ -62,7 -63,7 +62,7 @@@ public class NorthboundIT 
      private IUserManager userManager = null;
      private IInventoryListener invtoryListener = null;
      private IListenTopoUpdates topoUpdates = null;
 -
 +    private static final String baseUrlPrefix = "http://127.0.0.1:8080/controller/nb/v2/";
      private final Boolean debugMsg = false;
  
      private String stateToString(int state) {
                  System.out.println("HTTP response code: " + response.getStatus());
                  System.out.println("HTTP response message: " + response.getEntity());
              }
 -
              return response.getEntity();
          } catch (Exception e) {
              if (debugMsg) {
      @Test
      public void testSubnetsNorthbound() throws JSONException, ConstructionException {
          System.out.println("Starting Subnets JAXB client.");
 -        String baseURL = "http://127.0.0.1:8080/controller/nb/v2/subnetservice/";
 +        String baseURL = baseUrlPrefix + "subnetservice/";
  
          String name1 = "testSubnet1";
          String subnet1 = "1.1.1.1/24";
      @Test
      public void testStaticRoutingNorthbound() throws JSONException {
          System.out.println("Starting StaticRouting JAXB client.");
 -        String baseURL = "http://127.0.0.1:8080/controller/nb/v2/staticroute/";
 +        String baseURL = baseUrlPrefix + "staticroute/";
  
          String name1 = "testRoute1";
          String prefix1 = "192.168.1.1/24";
      @Test
      public void testSwitchManager() throws JSONException {
          System.out.println("Starting SwitchManager JAXB client.");
 -        String baseURL = "http://127.0.0.1:8080/controller/nb/v2/switchmanager/default/";
 +        String baseURL = baseUrlPrefix + "switchmanager/default/";
  
          // define Node/NodeConnector attributes for test
          int nodeId_1 = 51966;
                  "SET_NW_SRC", "SET_NW_DST", "SET_NW_TOS", "SET_TP_SRC", "SET_TP_DST" };
          System.out.println("Starting Statistics JAXB client.");
  
 -        String baseURL = "http://127.0.0.1:8080/controller/nb/v2/statistics/default/";
 +        String baseURL = baseUrlPrefix + "statistics/default/";
  
          String result = getJsonResult(baseURL + "flow");
          JSONTokener jt = new JSONTokener(result);
      @Test
      public void testFlowProgrammer() throws JSONException {
          System.out.println("Starting FlowProgrammer JAXB client.");
 -        String baseURL = "http://127.0.0.1:8080/controller/nb/v2/flowprogrammer/default/";
 +        String baseURL = baseUrlPrefix + "flowprogrammer/default/";
          // Attempt to get a flow that doesn't exit. Should return 404
          // status.
          String result = getJsonResult(baseURL + "node/STUB/51966/staticFlow/test1", "GET");
          // code
          fc = "{\"name\":\"test1\", \"node\":{\"id\":\"51966\",\"type\":\"STUB\"}, \"actions\":[\"LOOPBACK\"]}";
          result = getJsonResult(baseURL + "node/STUB/51966/staticFlow/test1", "PUT", fc);
 -        Assert.assertTrue(result.equals("Success"));
 +        Assert.assertTrue(result.contains("Success"));
  
          fc = "{\"name\":\"test2\", \"node\":{\"id\":\"51966\",\"type\":\"STUB\"}, \"actions\":[\"DROP\"]}";
          result = getJsonResult(baseURL + "node/STUB/51966/staticFlow/test2", "PUT", fc);
          Integer nodeConnectorId_2 = 34;
          String vlan_2 = "123";
  
 -        String baseURL = "http://127.0.0.1:8080/controller/nb/v2/hosttracker/default";
 +        String baseURL = baseUrlPrefix + "hosttracker/default";
  
          // test PUT method: addHost()
          JSONObject fc_json = new JSONObject();
          } else {
              JSONObject ja = json.getJSONObject("hostConfig");
              String na = ja.getString("networkAddress");
-             return (na.equalsIgnoreCase(hostIp)) ? true : false;
+             return na.equalsIgnoreCase(hostIp);
          }
      }
  
      @Test
      public void testTopology() throws JSONException, ConstructionException {
          System.out.println("Starting Topology JAXB client.");
 -        String baseURL = "http://127.0.0.1:8080/controller/nb/v2/topology/default";
 +        String baseURL = baseUrlPrefix + "topology/default";
  
          // === test GET method for getTopology()
          short state_1 = State.EDGE_UP, state_2 = State.EDGE_DOWN;
                  mavenBundle("org.opendaylight.controller", "flowprogrammer.northbound").versionAsInProject(),
                  mavenBundle("org.opendaylight.controller", "subnets.northbound").versionAsInProject(),
  
 -                mavenBundle("org.codehaus.jackson", "jackson-mapper-asl").versionAsInProject(),
 -                mavenBundle("org.codehaus.jackson", "jackson-core-asl").versionAsInProject(),
 -                mavenBundle("org.codehaus.jackson", "jackson-jaxrs").versionAsInProject(),
 -                mavenBundle("org.codehaus.jackson", "jackson-xc").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("com.fasterxml.jackson.jaxrs", "jackson-jaxrs-json-provider").versionAsInProject(),
 +                mavenBundle("com.fasterxml.jackson.jaxrs", "jackson-jaxrs-base").versionAsInProject(),
 +                mavenBundle("com.fasterxml.jackson.module", "jackson-module-jaxb-annotations").versionAsInProject(),
 +
                  mavenBundle("org.codehaus.jettison", "jettison").versionAsInProject(),
  
                  mavenBundle("commons-io", "commons-io").versionAsInProject(),
                  mavenBundle("com.sun.jersey", "jersey-client").versionAsInProject(),
                  mavenBundle("com.sun.jersey", "jersey-server").versionAsInProject().startLevel(2),
                  mavenBundle("com.sun.jersey", "jersey-core").versionAsInProject().startLevel(2),
 -                mavenBundle("com.sun.jersey", "jersey-json").versionAsInProject().startLevel(2), junitBundles());
 +                junitBundles());
      }
  
  }