Speed up SouthboundIT through multi-threading test cases
[ovsdb.git] / northbound / src / main / java / org / opendaylight / ovsdb / northbound / NodeResource.java
index a4fc913c0f011167cab3a2c5aa653cbdf5388c2e..5ccdf4f41f3cda1f641c2e7077416ef95713f5d1 100644 (file)
@@ -1,7 +1,16 @@
+/*
+ * Copyright (c) 2014, 2015 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.ovsdb.northbound;
 
 import com.fasterxml.jackson.databind.SerializationFeature;
 import java.io.InputStream;
+import java.util.Collections;
 import java.util.List;
 
 import javax.ws.rs.Consumes;
@@ -93,12 +102,15 @@ public class NodeResource {
     public Response getNodes() throws JsonProcessingException {
         OvsdbConnectionService connectionService = (OvsdbConnectionService)ServiceHelper.getGlobalInstance(OvsdbConnectionService.class, this);
         List<Node> nodes = connectionService.getNodes();
-        if (nodes == null) return Response.noContent().build();
+        if (nodes == null) {
+            return Response.noContent().build();
+        }
 
         List<String> nodeIds = Lists.newArrayList();
         for (Node node : nodes) {
             nodeIds.add(node.getId().getValue());
         }
+        Collections.sort(nodeIds);
 
         String response = objectMapper.writeValueAsString(nodeIds);
         return Response.status(Response.Status.OK)