IntentInstaller: changing from Set to Collection to improve perf
Change-Id: Ia7f0f7d893645c7528ac9f51acff133f6d82383d
diff --git a/core/net/src/test/java/org/onosproject/net/intent/impl/IntentManagerTest.java b/core/net/src/test/java/org/onosproject/net/intent/impl/IntentManagerTest.java
index f55b575..642a66f 100644
--- a/core/net/src/test/java/org/onosproject/net/intent/impl/IntentManagerTest.java
+++ b/core/net/src/test/java/org/onosproject/net/intent/impl/IntentManagerTest.java
@@ -194,7 +194,7 @@
private static class TestIntentInstaller implements IntentInstaller<MockInstallableIntent> {
@Override
- public List<Set<org.onosproject.net.flow.FlowRuleOperation>> install(MockInstallableIntent intent) {
+ public List<Collection<org.onosproject.net.flow.FlowRuleOperation>> install(MockInstallableIntent intent) {
FlowRule fr = new IntentTestsMocks.MockFlowRule(intent.number().intValue());
Set<FlowRuleOperation> rules = ImmutableSet.of(
new FlowRuleOperation(fr, FlowRuleOperation.Type.ADD));
@@ -202,7 +202,7 @@
}
@Override
- public List<Set<FlowRuleOperation>> uninstall(MockInstallableIntent intent) {
+ public List<Collection<FlowRuleOperation>> uninstall(MockInstallableIntent intent) {
FlowRule fr = new IntentTestsMocks.MockFlowRule(intent.number().intValue());
Set<FlowRuleOperation> rules = ImmutableSet.of(
new FlowRuleOperation(fr, FlowRuleOperation.Type.REMOVE));
@@ -210,7 +210,8 @@
}
@Override
- public List<Set<FlowRuleOperation>> replace(MockInstallableIntent oldIntent, MockInstallableIntent newIntent) {
+ public List<Collection<FlowRuleOperation>> replace(MockInstallableIntent oldIntent,
+ MockInstallableIntent newIntent) {
FlowRule fr = new IntentTestsMocks.MockFlowRule(oldIntent.number().intValue());
FlowRule fr2 = new IntentTestsMocks.MockFlowRule(newIntent.number().intValue());
Set<FlowRuleOperation> rules = ImmutableSet.of(
@@ -222,17 +223,18 @@
private static class TestIntentErrorInstaller implements IntentInstaller<MockInstallableIntent> {
@Override
- public List<Set<FlowRuleOperation>> install(MockInstallableIntent intent) {
+ public List<Collection<FlowRuleOperation>> install(MockInstallableIntent intent) {
throw new IntentInstallationException("install() always fails");
}
@Override
- public List<Set<FlowRuleOperation>> uninstall(MockInstallableIntent intent) {
+ public List<Collection<FlowRuleOperation>> uninstall(MockInstallableIntent intent) {
throw new IntentRemovalException("uninstall() always fails");
}
@Override
- public List<Set<FlowRuleOperation>> replace(MockInstallableIntent oldIntent, MockInstallableIntent newIntent) {
+ public List<Collection<FlowRuleOperation>> replace(MockInstallableIntent oldIntent,
+ MockInstallableIntent newIntent) {
throw new IntentInstallationException("replace() always fails");
}
}
diff --git a/core/net/src/test/java/org/onosproject/net/intent/impl/PathConstraintCalculationTest.java b/core/net/src/test/java/org/onosproject/net/intent/impl/PathConstraintCalculationTest.java
index 5a5611b..8dd78c2 100644
--- a/core/net/src/test/java/org/onosproject/net/intent/impl/PathConstraintCalculationTest.java
+++ b/core/net/src/test/java/org/onosproject/net/intent/impl/PathConstraintCalculationTest.java
@@ -15,10 +15,6 @@
*/
package org.onosproject.net.intent.impl;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-
import org.junit.Test;
import org.onosproject.net.flow.FlowRuleOperation;
import org.onosproject.net.flow.TrafficSelector;
@@ -35,11 +31,12 @@
import org.onosproject.net.resource.Lambda;
import org.onosproject.net.resource.LinkResourceService;
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.List;
+
import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.containsString;
-import static org.hamcrest.Matchers.hasSize;
-import static org.hamcrest.Matchers.instanceOf;
-import static org.hamcrest.Matchers.notNullValue;
+import static org.hamcrest.Matchers.*;
import static org.junit.Assert.fail;
import static org.onosproject.net.NetTestTools.APP_ID;
import static org.onosproject.net.NetTestTools.connectPoint;
@@ -99,7 +96,7 @@
* @param resourceService service to use for resource allocation requests
* @return fow rule entries
*/
- private List<Set<FlowRuleOperation>> installIntents(List<Intent> compiledIntents,
+ private List<Collection<FlowRuleOperation>> installIntents(List<Intent> compiledIntents,
LinkResourceService resourceService) {
final PathIntent path = (PathIntent) compiledIntents.get(0);
@@ -193,7 +190,7 @@
assertThat(compiledIntents, notNullValue());
assertThat(compiledIntents, hasSize(1));
- final List<Set<FlowRuleOperation>> flowOperations =
+ final List<Collection<FlowRuleOperation>> flowOperations =
installIntents(compiledIntents, resourceService);
assertThat(flowOperations, notNullValue());
@@ -242,7 +239,7 @@
assertThat(compiledIntents, notNullValue());
assertThat(compiledIntents, hasSize(1));
- final List<Set<FlowRuleOperation>> flowOperations =
+ final List<Collection<FlowRuleOperation>> flowOperations =
installIntents(compiledIntents, resourceService);
assertThat(flowOperations, notNullValue());