aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/onos/apps/test
diff options
context:
space:
mode:
authorAshlee Young <ashlee@wildernessvoice.com>2015-11-03 14:08:10 -0800
committerAshlee Young <ashlee@wildernessvoice.com>2015-11-03 14:08:10 -0800
commit643ee33289bd2cb9e6afbfb09b4ed72d467ba1c2 (patch)
treec2c376a44a359544fe3d4c45eb0cc0e2ec4a7080 /framework/src/onos/apps/test
parent46eeb79b54345bdafb6055b8ee4bad4ce8b01274 (diff)
This updates ONOS src tree to commit id
03fa5e571cabbd001ddb1598847e1150b11c7333 Change-Id: I13b554026d6f902933e35887d29bd5fdb669c0bd Signed-off-by: Ashlee Young <ashlee@wildernessvoice.com>
Diffstat (limited to 'framework/src/onos/apps/test')
-rw-r--r--framework/src/onos/apps/test/distributed-primitives/src/main/java/org/onosproject/distributedprimitives/cli/SetTestAddCommand.java12
-rw-r--r--framework/src/onos/apps/test/distributed-primitives/src/main/java/org/onosproject/distributedprimitives/cli/SetTestGetCommand.java12
-rw-r--r--framework/src/onos/apps/test/distributed-primitives/src/main/java/org/onosproject/distributedprimitives/cli/SetTestRemoveCommand.java23
3 files changed, 16 insertions, 31 deletions
diff --git a/framework/src/onos/apps/test/distributed-primitives/src/main/java/org/onosproject/distributedprimitives/cli/SetTestAddCommand.java b/framework/src/onos/apps/test/distributed-primitives/src/main/java/org/onosproject/distributedprimitives/cli/SetTestAddCommand.java
index 204471c2..2d1aa0b8 100644
--- a/framework/src/onos/apps/test/distributed-primitives/src/main/java/org/onosproject/distributedprimitives/cli/SetTestAddCommand.java
+++ b/framework/src/onos/apps/test/distributed-primitives/src/main/java/org/onosproject/distributedprimitives/cli/SetTestAddCommand.java
@@ -23,7 +23,7 @@ import org.onosproject.store.serializers.KryoNamespaces;
import org.onosproject.store.service.Serializer;
import org.onosproject.store.service.StorageService;
-import java.util.HashSet;
+import java.util.Arrays;
import java.util.Set;
/**
@@ -44,7 +44,6 @@ public class SetTestAddCommand extends AbstractShellCommand {
String[] values = null;
Set<String> set;
- Set<String> toAdd = new HashSet<>();
Serializer serializer = Serializer.using(
@@ -68,13 +67,10 @@ public class SetTestAddCommand extends AbstractShellCommand {
}
} else if (values.length >= 1) {
// Add multiple elements to a set
- for (String value : values) {
- toAdd.add(value);
- }
- if (set.addAll(toAdd)) {
- print("%s was added to the set %s", toAdd, setName);
+ if (set.addAll(Arrays.asList(values))) {
+ print("%s was added to the set %s", Arrays.asList(values), setName);
} else {
- print("%s was already in set %s", toAdd, setName);
+ print("%s was already in set %s", Arrays.asList(values), setName);
}
}
}
diff --git a/framework/src/onos/apps/test/distributed-primitives/src/main/java/org/onosproject/distributedprimitives/cli/SetTestGetCommand.java b/framework/src/onos/apps/test/distributed-primitives/src/main/java/org/onosproject/distributedprimitives/cli/SetTestGetCommand.java
index fb36a06a..74c52c16 100644
--- a/framework/src/onos/apps/test/distributed-primitives/src/main/java/org/onosproject/distributedprimitives/cli/SetTestGetCommand.java
+++ b/framework/src/onos/apps/test/distributed-primitives/src/main/java/org/onosproject/distributedprimitives/cli/SetTestGetCommand.java
@@ -24,7 +24,7 @@ import org.onosproject.store.serializers.KryoNamespaces;
import org.onosproject.store.service.Serializer;
import org.onosproject.store.service.StorageService;
-import java.util.HashSet;
+import java.util.Arrays;
import java.util.Set;
/**
@@ -49,7 +49,6 @@ public class SetTestGetCommand extends AbstractShellCommand {
String[] values = null;
Set<String> set;
- Set<String> toCheck = new HashSet<>();
String output = "";
Serializer serializer = Serializer.using(
@@ -95,13 +94,10 @@ public class SetTestGetCommand extends AbstractShellCommand {
}
} else if (values.length > 1) {
//containsAll
- for (String value : values) {
- toCheck.add(value);
- }
- if (set.containsAll(toCheck)) {
- print("Set %s contains the the subset %s", setName, toCheck);
+ if (set.containsAll(Arrays.asList(values))) {
+ print("Set %s contains the the subset %s", setName, Arrays.asList(values));
} else {
- print("Set %s did not contain the the subset %s", setName, toCheck);
+ print("Set %s did not contain the the subset %s", setName, Arrays.asList(values));
}
}
}
diff --git a/framework/src/onos/apps/test/distributed-primitives/src/main/java/org/onosproject/distributedprimitives/cli/SetTestRemoveCommand.java b/framework/src/onos/apps/test/distributed-primitives/src/main/java/org/onosproject/distributedprimitives/cli/SetTestRemoveCommand.java
index d1f81e42..1fa073f3 100644
--- a/framework/src/onos/apps/test/distributed-primitives/src/main/java/org/onosproject/distributedprimitives/cli/SetTestRemoveCommand.java
+++ b/framework/src/onos/apps/test/distributed-primitives/src/main/java/org/onosproject/distributedprimitives/cli/SetTestRemoveCommand.java
@@ -24,7 +24,7 @@ import org.onosproject.store.serializers.KryoNamespaces;
import org.onosproject.store.service.Serializer;
import org.onosproject.store.service.StorageService;
-import java.util.HashSet;
+import java.util.Arrays;
import java.util.Set;
/**
@@ -54,7 +54,6 @@ public class SetTestRemoveCommand extends AbstractShellCommand {
String[] values = null;
Set<String> set;
- Set<String> givenValues = new HashSet<>();
Serializer serializer = Serializer.using(
new KryoNamespace.Builder().register(KryoNamespaces.BASIC).build());
@@ -79,13 +78,10 @@ public class SetTestRemoveCommand extends AbstractShellCommand {
}
if (retain) { // Keep only the given values
- for (String value : values) {
- givenValues.add(value);
- }
- if (set.retainAll(givenValues)) {
- print("%s was pruned to contain only elements of set %s", setName, givenValues);
+ if (set.retainAll(Arrays.asList(values))) {
+ print("%s was pruned to contain only elements of set %s", setName, Arrays.asList(values));
} else {
- print("%s was not changed by retaining only elements of the set %s", setName, givenValues);
+ print("%s was not changed by retaining only elements of the set %s", setName, Arrays.asList(values));
}
} else if (values.length == 1) {
// Remove a single element from the set
@@ -94,15 +90,12 @@ public class SetTestRemoveCommand extends AbstractShellCommand {
} else {
print("[%s] was not in set %s", values[0], setName);
}
- } else if (values.length >= 1) {
+ } else if (values.length > 1) {
// Remove multiple elements from a set
- for (String value : values) {
- givenValues.add(value);
- }
- if (set.removeAll(givenValues)) {
- print("%s was removed from the set %s", givenValues, setName);
+ if (set.removeAll(Arrays.asList(values))) {
+ print("%s was removed from the set %s", Arrays.asList(values), setName);
} else {
- print("No element of %s was in set %s", givenValues, setName);
+ print("No element of %s was in set %s", Arrays.asList(values), setName);
}
}
}