Refactoring intent API.
diff --git a/core/net/src/test/java/org/onlab/onos/net/intent/TestHostToHostIntent.java b/core/net/src/test/java/org/onlab/onos/net/intent/TestHostToHostIntent.java
index f5e2551..9ec37e1 100644
--- a/core/net/src/test/java/org/onlab/onos/net/intent/TestHostToHostIntent.java
+++ b/core/net/src/test/java/org/onlab/onos/net/intent/TestHostToHostIntent.java
@@ -1,6 +1,8 @@
package org.onlab.onos.net.intent;
import org.junit.Test;
+import org.onlab.onos.ApplicationId;
+import org.onlab.onos.TestApplicationId;
import org.onlab.onos.net.HostId;
import org.onlab.onos.net.flow.TrafficSelector;
import org.onlab.onos.net.flow.TrafficTreatment;
@@ -16,15 +18,13 @@
*/
public class TestHostToHostIntent {
+ private static final ApplicationId APPID = new TestApplicationId("foo");
+
private TrafficSelector selector = new IntentTestsMocks.MockSelector();
private TrafficTreatment treatment = new IntentTestsMocks.MockTreatment();
- private HostToHostIntent makeHostToHost(long id, HostId one, HostId two) {
- return new HostToHostIntent(new IntentId(id),
- one,
- two,
- selector,
- treatment);
+ private HostToHostIntent makeHostToHost(HostId one, HostId two) {
+ return new HostToHostIntent(APPID, one, two, selector, treatment);
}
/**
@@ -36,8 +36,8 @@
HostId one = hid("00:00:00:00:00:01/-1");
HostId two = hid("00:00:00:00:00:02/-1");
- HostToHostIntent i1 = makeHostToHost(12, one, two);
- HostToHostIntent i2 = makeHostToHost(12, one, two);
+ HostToHostIntent i1 = makeHostToHost(one, two);
+ HostToHostIntent i2 = makeHostToHost(one, two);
assertThat(i1, is(equalTo(i2)));
}
@@ -51,23 +51,8 @@
HostId one = hid("00:00:00:00:00:01/-1");
HostId two = hid("00:00:00:00:00:02/-1");
- HostToHostIntent i1 = makeHostToHost(12, one, two);
- HostToHostIntent i2 = makeHostToHost(12, two, one);
-
- assertThat(i1, is(not(equalTo(i2))));
- }
-
- /**
- * Tests the equals() method where two HostToHostIntents have different
- * ids. These should compare not equal.
- */
-
- @Test
- public void testBaseDifferentEquals() {
- HostId one = hid("00:00:00:00:00:01/-1");
- HostId two = hid("00:00:00:00:00:02/-1");
- HostToHostIntent i1 = makeHostToHost(12, one, two);
- HostToHostIntent i2 = makeHostToHost(11, one, two);
+ HostToHostIntent i1 = makeHostToHost(one, two);
+ HostToHostIntent i2 = makeHostToHost(two, one);
assertThat(i1, is(not(equalTo(i2))));
}
@@ -76,13 +61,12 @@
* Tests that the hashCode() values for two equivalent HostToHostIntent
* objects are the same.
*/
-
@Test
public void testHashCodeEquals() {
HostId one = hid("00:00:00:00:00:01/-1");
HostId two = hid("00:00:00:00:00:02/-1");
- HostToHostIntent i1 = makeHostToHost(12, one, two);
- HostToHostIntent i2 = makeHostToHost(12, one, two);
+ HostToHostIntent i1 = makeHostToHost(one, two);
+ HostToHostIntent i2 = makeHostToHost(one, two);
assertThat(i1.hashCode(), is(equalTo(i2.hashCode())));
}
@@ -91,13 +75,12 @@
* Tests that the hashCode() values for two distinct LinkCollectionIntent
* objects are different.
*/
-
@Test
public void testHashCodeDifferent() {
HostId one = hid("00:00:00:00:00:01/-1");
HostId two = hid("00:00:00:00:00:02/-1");
- HostToHostIntent i1 = makeHostToHost(12, one, two);
- HostToHostIntent i2 = makeHostToHost(112, one, two);
+ HostToHostIntent i1 = makeHostToHost(one, two);
+ HostToHostIntent i2 = makeHostToHost(two, one);
assertThat(i1.hashCode(), is(not(equalTo(i2.hashCode()))));
}
diff --git a/core/net/src/test/java/org/onlab/onos/net/intent/TestLinkCollectionIntent.java b/core/net/src/test/java/org/onlab/onos/net/intent/TestLinkCollectionIntent.java
index a7082b4..65aa71f 100644
--- a/core/net/src/test/java/org/onlab/onos/net/intent/TestLinkCollectionIntent.java
+++ b/core/net/src/test/java/org/onlab/onos/net/intent/TestLinkCollectionIntent.java
@@ -11,6 +11,8 @@
import org.junit.Before;
import org.junit.Test;
+import org.onlab.onos.ApplicationId;
+import org.onlab.onos.TestApplicationId;
import org.onlab.onos.net.ConnectPoint;
import org.onlab.onos.net.DeviceId;
import org.onlab.onos.net.Link;
@@ -23,6 +25,8 @@
*/
public class TestLinkCollectionIntent {
+ private static final ApplicationId APPID = new TestApplicationId("foo");
+
private Link link1 = link("dev1", 1, "dev2", 2);
private Link link2 = link("dev1", 1, "dev3", 2);
private Link link3 = link("dev2", 1, "dev3", 2);
@@ -38,10 +42,9 @@
private TrafficSelector selector = new IntentTestsMocks.MockSelector();
private TrafficTreatment treatment = new IntentTestsMocks.MockTreatment();
- private LinkCollectionIntent makeLinkCollection(long id, Set<Link> links,
+ private LinkCollectionIntent makeLinkCollection(Set<Link> links,
ConnectPoint egress) {
- return new LinkCollectionIntent(new IntentId(id),
- selector, treatment, links, egress);
+ return new LinkCollectionIntent(APPID, selector, treatment, links, egress);
}
@Before
@@ -64,8 +67,8 @@
links2.add(link2);
links2.add(link1);
- LinkCollectionIntent i1 = makeLinkCollection(12, links1, egress1);
- LinkCollectionIntent i2 = makeLinkCollection(12, links2, egress1);
+ LinkCollectionIntent i1 = makeLinkCollection(links1, egress1);
+ LinkCollectionIntent i2 = makeLinkCollection(links2, egress1);
assertThat(i1, is(equalTo(i2)));
}
@@ -82,8 +85,8 @@
links2.add(link3);
links2.add(link1);
- LinkCollectionIntent i1 = makeLinkCollection(12, links1, egress1);
- LinkCollectionIntent i2 = makeLinkCollection(12, links2, egress1);
+ LinkCollectionIntent i1 = makeLinkCollection(links1, egress1);
+ LinkCollectionIntent i2 = makeLinkCollection(links2, egress1);
assertThat(i1, is(not(equalTo(i2))));
}
@@ -102,26 +105,8 @@
links2.add(link2);
links2.add(link1);
- LinkCollectionIntent i1 = makeLinkCollection(12, links1, egress1);
- LinkCollectionIntent i2 = makeLinkCollection(12, links2, egress2);
-
- assertThat(i1, is(not(equalTo(i2))));
- }
-
- /**
- * Tests the equals() method where two LinkCollectionIntents have different
- * ids. These should compare not equal.
- */
- @Test
- public void testBaseDifferentEquals() {
- links1.add(link1);
- links1.add(link2);
-
- links2.add(link2);
- links2.add(link1);
-
- LinkCollectionIntent i1 = makeLinkCollection(1, links1, egress1);
- LinkCollectionIntent i2 = makeLinkCollection(2, links2, egress1);
+ LinkCollectionIntent i1 = makeLinkCollection(links1, egress1);
+ LinkCollectionIntent i2 = makeLinkCollection(links2, egress2);
assertThat(i1, is(not(equalTo(i2))));
}
@@ -140,8 +125,8 @@
links2.add(link2);
links2.add(link1);
- LinkCollectionIntent i1 = makeLinkCollection(1, links1, egress1);
- LinkCollectionIntent i2 = makeLinkCollection(1, links2, egress1);
+ LinkCollectionIntent i1 = makeLinkCollection(links1, egress1);
+ LinkCollectionIntent i2 = makeLinkCollection(links2, egress1);
assertThat(i1.hashCode(), is(equalTo(i2.hashCode())));
}
@@ -158,8 +143,8 @@
links2.add(link1);
links2.add(link3);
- LinkCollectionIntent i1 = makeLinkCollection(1, links1, egress1);
- LinkCollectionIntent i2 = makeLinkCollection(1, links2, egress2);
+ LinkCollectionIntent i1 = makeLinkCollection(links1, egress1);
+ LinkCollectionIntent i2 = makeLinkCollection(links2, egress2);
assertThat(i1.hashCode(), is(not(equalTo(i2.hashCode()))));
}
diff --git a/core/net/src/test/java/org/onlab/onos/net/intent/TestMultiPointToSinglePointIntent.java b/core/net/src/test/java/org/onlab/onos/net/intent/TestMultiPointToSinglePointIntent.java
index e921907..09dfcb2 100644
--- a/core/net/src/test/java/org/onlab/onos/net/intent/TestMultiPointToSinglePointIntent.java
+++ b/core/net/src/test/java/org/onlab/onos/net/intent/TestMultiPointToSinglePointIntent.java
@@ -1,14 +1,16 @@
package org.onlab.onos.net.intent;
-import java.util.HashSet;
-import java.util.Set;
-
import org.junit.Before;
import org.junit.Test;
+import org.onlab.onos.ApplicationId;
+import org.onlab.onos.TestApplicationId;
import org.onlab.onos.net.ConnectPoint;
import org.onlab.onos.net.flow.TrafficSelector;
import org.onlab.onos.net.flow.TrafficTreatment;
+import java.util.HashSet;
+import java.util.Set;
+
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
@@ -20,6 +22,8 @@
*/
public class TestMultiPointToSinglePointIntent {
+ private static final ApplicationId APPID = new TestApplicationId("foo");
+
private ConnectPoint point1 = connectPoint("dev1", 1);
private ConnectPoint point2 = connectPoint("dev2", 1);
private ConnectPoint point3 = connectPoint("dev3", 1);
@@ -33,19 +37,14 @@
/**
* Creates a MultiPointToSinglePointIntent object.
*
- * @param id identifier to use for the new intent
* @param ingress set of ingress points
- * @param egress egress point
+ * @param egress egress point
* @return MultiPointToSinglePoint intent
*/
- private MultiPointToSinglePointIntent makeIntent(long id,
- Set<ConnectPoint> ingress,
- ConnectPoint egress) {
- return new MultiPointToSinglePointIntent(new IntentId(id),
- selector,
- treatment,
- ingress,
- egress);
+ private MultiPointToSinglePointIntent makeIntent(Set<ConnectPoint> ingress,
+ ConnectPoint egress) {
+ return new MultiPointToSinglePointIntent(APPID, selector, treatment,
+ ingress, egress);
}
/**
@@ -72,8 +71,8 @@
ingress2.add(point3);
ingress2.add(point2);
- Intent i1 = makeIntent(12, ingress1, point1);
- Intent i2 = makeIntent(12, ingress2, point1);
+ Intent i1 = makeIntent(ingress1, point1);
+ Intent i2 = makeIntent(ingress2, point1);
assertThat(i1, is(equalTo(i2)));
}
@@ -89,23 +88,8 @@
ingress2.add(point3);
ingress2.add(point2);
- Intent i1 = makeIntent(12, ingress1, point1);
- Intent i2 = makeIntent(12, ingress2, point1);
-
- assertThat(i1, is(not(equalTo(i2))));
- }
-
- /**
- * Tests the equals() method where two MultiPointToSinglePoint have different
- * ids. These should compare not equal.
- */
- @Test
- public void testBaseDifferentEquals() {
- ingress1.add(point3);
- ingress2.add(point3);
-
- Intent i1 = makeIntent(12, ingress1, point1);
- Intent i2 = makeIntent(11, ingress2, point1);
+ Intent i1 = makeIntent(ingress1, point1);
+ Intent i2 = makeIntent(ingress2, point1);
assertThat(i1, is(not(equalTo(i2))));
}
@@ -122,8 +106,8 @@
ingress2.add(point3);
ingress2.add(point2);
- Intent i1 = makeIntent(12, ingress1, point1);
- Intent i2 = makeIntent(12, ingress2, point1);
+ Intent i1 = makeIntent(ingress1, point1);
+ Intent i2 = makeIntent(ingress2, point1);
assertThat(i1.hashCode(), is(equalTo(i2.hashCode())));
}
@@ -139,8 +123,8 @@
ingress2.add(point3);
ingress2.add(point2);
- Intent i1 = makeIntent(12, ingress1, point1);
- Intent i2 = makeIntent(12, ingress2, point1);
+ Intent i1 = makeIntent(ingress1, point1);
+ Intent i2 = makeIntent(ingress2, point1);
assertThat(i1.hashCode(), is(not(equalTo(i2.hashCode()))));
diff --git a/core/net/src/test/java/org/onlab/onos/net/intent/TestPointToPointIntent.java b/core/net/src/test/java/org/onlab/onos/net/intent/TestPointToPointIntent.java
index 41769c6..e34d7ce 100644
--- a/core/net/src/test/java/org/onlab/onos/net/intent/TestPointToPointIntent.java
+++ b/core/net/src/test/java/org/onlab/onos/net/intent/TestPointToPointIntent.java
@@ -1,14 +1,14 @@
package org.onlab.onos.net.intent;
import org.junit.Test;
+import org.onlab.onos.ApplicationId;
+import org.onlab.onos.TestApplicationId;
import org.onlab.onos.net.ConnectPoint;
import org.onlab.onos.net.flow.TrafficSelector;
import org.onlab.onos.net.flow.TrafficTreatment;
import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.equalTo;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.not;
+import static org.hamcrest.Matchers.*;
import static org.onlab.onos.net.NetTestTools.connectPoint;
/**
@@ -16,20 +16,17 @@
*/
public class TestPointToPointIntent {
+ private static final ApplicationId APPID = new TestApplicationId("foo");
+
private TrafficSelector selector = new IntentTestsMocks.MockSelector();
private TrafficTreatment treatment = new IntentTestsMocks.MockTreatment();
private ConnectPoint point1 = connectPoint("dev1", 1);
private ConnectPoint point2 = connectPoint("dev2", 1);
- private PointToPointIntent makePointToPoint(long id,
- ConnectPoint ingress,
+ private PointToPointIntent makePointToPoint(ConnectPoint ingress,
ConnectPoint egress) {
- return new PointToPointIntent(new IntentId(id),
- selector,
- treatment,
- ingress,
- egress);
+ return new PointToPointIntent(APPID, selector, treatment, ingress, egress);
}
/**
@@ -38,8 +35,8 @@
*/
@Test
public void testSameEquals() {
- PointToPointIntent i1 = makePointToPoint(12, point1, point2);
- PointToPointIntent i2 = makePointToPoint(12, point1, point2);
+ PointToPointIntent i1 = makePointToPoint(point1, point2);
+ PointToPointIntent i2 = makePointToPoint(point1, point2);
assertThat(i1, is(equalTo(i2)));
}
@@ -50,22 +47,8 @@
*/
@Test
public void testLinksDifferentEquals() {
-
- PointToPointIntent i1 = makePointToPoint(12, point1, point2);
- PointToPointIntent i2 = makePointToPoint(12, point2, point1);
-
- assertThat(i1, is(not(equalTo(i2))));
- }
-
- /**
- * Tests the equals() method where two HostToHostIntents have different
- * ids. These should compare not equal.
- */
- @Test
- public void testBaseDifferentEquals() {
- PointToPointIntent i1 = makePointToPoint(12, point1, point2);
- PointToPointIntent i2 = makePointToPoint(11, point1, point2);
-
+ PointToPointIntent i1 = makePointToPoint(point1, point2);
+ PointToPointIntent i2 = makePointToPoint(point2, point1);
assertThat(i1, is(not(equalTo(i2))));
}
@@ -76,8 +59,8 @@
*/
@Test
public void testHashCodeEquals() {
- PointToPointIntent i1 = makePointToPoint(12, point1, point2);
- PointToPointIntent i2 = makePointToPoint(12, point1, point2);
+ PointToPointIntent i1 = makePointToPoint(point1, point2);
+ PointToPointIntent i2 = makePointToPoint(point1, point2);
assertThat(i1.hashCode(), is(equalTo(i2.hashCode())));
}
@@ -88,8 +71,8 @@
*/
@Test
public void testHashCodeDifferent() {
- PointToPointIntent i1 = makePointToPoint(12, point1, point2);
- PointToPointIntent i2 = makePointToPoint(22, point1, point2);
+ PointToPointIntent i1 = makePointToPoint(point1, point2);
+ PointToPointIntent i2 = makePointToPoint(point2, point1);
assertThat(i1.hashCode(), is(not(equalTo(i2.hashCode()))));
}
diff --git a/core/net/src/test/java/org/onlab/onos/net/intent/impl/TestHostToHostIntentCompiler.java b/core/net/src/test/java/org/onlab/onos/net/intent/impl/TestHostToHostIntentCompiler.java
index bd61b7a..e853a29 100644
--- a/core/net/src/test/java/org/onlab/onos/net/intent/impl/TestHostToHostIntentCompiler.java
+++ b/core/net/src/test/java/org/onlab/onos/net/intent/impl/TestHostToHostIntentCompiler.java
@@ -1,10 +1,10 @@
package org.onlab.onos.net.intent.impl;
-import java.util.List;
-
import org.hamcrest.Matchers;
import org.junit.Before;
import org.junit.Test;
+import org.onlab.onos.ApplicationId;
+import org.onlab.onos.TestApplicationId;
import org.onlab.onos.net.Host;
import org.onlab.onos.net.HostId;
import org.onlab.onos.net.flow.TrafficSelector;
@@ -12,16 +12,14 @@
import org.onlab.onos.net.host.HostService;
import org.onlab.onos.net.intent.HostToHostIntent;
import org.onlab.onos.net.intent.Intent;
-import org.onlab.onos.net.intent.IntentId;
import org.onlab.onos.net.intent.IntentTestsMocks;
import org.onlab.onos.net.intent.PathIntent;
import org.onlab.packet.MacAddress;
import org.onlab.packet.VlanId;
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.eq;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
+import java.util.List;
+
+import static org.easymock.EasyMock.*;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.hasSize;
@@ -40,6 +38,8 @@
private static final String HOST_ONE = HOST_ONE_MAC + "/" + HOST_ONE_VLAN;
private static final String HOST_TWO = HOST_TWO_MAC + "/" + HOST_TWO_VLAN;
+ private static final ApplicationId APPID = new TestApplicationId("foo");
+
private TrafficSelector selector = new IntentTestsMocks.MockSelector();
private TrafficTreatment treatment = new IntentTestsMocks.MockTreatment();
@@ -73,11 +73,8 @@
* @return HostToHostIntent for the two hosts
*/
private HostToHostIntent makeIntent(String oneIdString, String twoIdString) {
- return new HostToHostIntent(new IntentId(12),
- hid(oneIdString),
- hid(twoIdString),
- selector,
- treatment);
+ return new HostToHostIntent(APPID, hid(oneIdString), hid(twoIdString),
+ selector, treatment);
}
/**
@@ -91,9 +88,6 @@
new HostToHostIntentCompiler();
compiler.pathService = new IntentTestsMocks.MockPathService(hops);
compiler.hostService = mockHostService;
- IdBlockAllocator idBlockAllocator = new DummyIdBlockAllocator();
- compiler.intentIdGenerator =
- new IdBlockAllocatorBasedIntentIdGenerator(idBlockAllocator);
return compiler;
}
diff --git a/core/net/src/test/java/org/onlab/onos/net/intent/impl/TestMultiPointToSinglePointIntentCompiler.java b/core/net/src/test/java/org/onlab/onos/net/intent/impl/TestMultiPointToSinglePointIntentCompiler.java
index 8d286cf..1c78e26 100644
--- a/core/net/src/test/java/org/onlab/onos/net/intent/impl/TestMultiPointToSinglePointIntentCompiler.java
+++ b/core/net/src/test/java/org/onlab/onos/net/intent/impl/TestMultiPointToSinglePointIntentCompiler.java
@@ -1,24 +1,25 @@
package org.onlab.onos.net.intent.impl;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
import org.hamcrest.Matchers;
import org.junit.Test;
+import org.onlab.onos.ApplicationId;
+import org.onlab.onos.TestApplicationId;
import org.onlab.onos.net.ConnectPoint;
import org.onlab.onos.net.ElementId;
import org.onlab.onos.net.Path;
import org.onlab.onos.net.flow.TrafficSelector;
import org.onlab.onos.net.flow.TrafficTreatment;
import org.onlab.onos.net.intent.Intent;
-import org.onlab.onos.net.intent.IntentId;
import org.onlab.onos.net.intent.IntentTestsMocks;
import org.onlab.onos.net.intent.LinkCollectionIntent;
import org.onlab.onos.net.intent.MultiPointToSinglePointIntent;
import org.onlab.onos.net.topology.LinkWeight;
import org.onlab.onos.net.topology.PathService;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.hasSize;
@@ -32,6 +33,8 @@
*/
public class TestMultiPointToSinglePointIntentCompiler {
+ private static final ApplicationId APPID = new TestApplicationId("foo");
+
private TrafficSelector selector = new IntentTestsMocks.MockSelector();
private TrafficTreatment treatment = new IntentTestsMocks.MockTreatment();
@@ -74,7 +77,7 @@
* and an egress point.
*
* @param ingressIds array of ingress device ids
- * @param egressId device id of the egress point
+ * @param egressId device id of the egress point
* @return MultiPointToSinglePoint intent
*/
private MultiPointToSinglePointIntent makeIntent(String[] ingressIds, String egressId) {
@@ -82,15 +85,11 @@
ConnectPoint egressPoint = connectPoint(egressId, 1);
for (String ingressId : ingressIds) {
- ingressPoints.add(connectPoint(ingressId, 1));
+ ingressPoints.add(connectPoint(ingressId, 1));
}
- return new MultiPointToSinglePointIntent(
- new IntentId(12),
- selector,
- treatment,
- ingressPoints,
- egressPoint);
+ return new MultiPointToSinglePointIntent(APPID, selector, treatment,
+ ingressPoints, egressPoint);
}
/**
@@ -103,9 +102,6 @@
MultiPointToSinglePointIntentCompiler compiler =
new MultiPointToSinglePointIntentCompiler();
compiler.pathService = new MockPathService(hops);
- IdBlockAllocator idBlockAllocator = new DummyIdBlockAllocator();
- compiler.intentIdGenerator =
- new IdBlockAllocatorBasedIntentIdGenerator(idBlockAllocator);
return compiler;
}
@@ -122,7 +118,7 @@
assertThat(intent, is(notNullValue()));
String[] hops = {"h1", "h2", "h3", "h4", "h5", "h6", "h7", "h8",
- egress};
+ egress};
MultiPointToSinglePointIntentCompiler compiler = makeCompiler(hops);
assertThat(compiler, is(notNullValue()));
@@ -184,7 +180,7 @@
@Test
public void testMultiIngressCompilation() {
String[] ingress = {"i1", "i2", "i3", "i4", "i5",
- "i6", "i7", "i8", "i9", "i10"};
+ "i6", "i7", "i8", "i9", "i10"};
String egress = "e";
MultiPointToSinglePointIntent intent = makeIntent(ingress, egress);
diff --git a/core/net/src/test/java/org/onlab/onos/net/intent/impl/TestPointToPointIntentCompiler.java b/core/net/src/test/java/org/onlab/onos/net/intent/impl/TestPointToPointIntentCompiler.java
index e282347..5b50a22 100644
--- a/core/net/src/test/java/org/onlab/onos/net/intent/impl/TestPointToPointIntentCompiler.java
+++ b/core/net/src/test/java/org/onlab/onos/net/intent/impl/TestPointToPointIntentCompiler.java
@@ -1,17 +1,18 @@
package org.onlab.onos.net.intent.impl;
-import java.util.List;
-
import org.hamcrest.Matchers;
import org.junit.Test;
+import org.onlab.onos.ApplicationId;
+import org.onlab.onos.TestApplicationId;
import org.onlab.onos.net.flow.TrafficSelector;
import org.onlab.onos.net.flow.TrafficTreatment;
import org.onlab.onos.net.intent.Intent;
-import org.onlab.onos.net.intent.IntentId;
import org.onlab.onos.net.intent.IntentTestsMocks;
import org.onlab.onos.net.intent.PathIntent;
import org.onlab.onos.net.intent.PointToPointIntent;
+import java.util.List;
+
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.hasSize;
@@ -24,6 +25,8 @@
*/
public class TestPointToPointIntentCompiler {
+ private static final ApplicationId APPID = new TestApplicationId("foo");
+
private TrafficSelector selector = new IntentTestsMocks.MockSelector();
private TrafficTreatment treatment = new IntentTestsMocks.MockTreatment();
@@ -31,14 +34,12 @@
* Creates a PointToPoint intent based on ingress and egress device Ids.
*
* @param ingressIdString string for id of ingress device
- * @param egressIdString string for id of egress device
+ * @param egressIdString string for id of egress device
* @return PointToPointIntent for the two devices
*/
private PointToPointIntent makeIntent(String ingressIdString,
String egressIdString) {
- return new PointToPointIntent(new IntentId(12),
- selector,
- treatment,
+ return new PointToPointIntent(APPID, selector, treatment,
connectPoint(ingressIdString, 1),
connectPoint(egressIdString, 1));
}
@@ -53,9 +54,6 @@
PointToPointIntentCompiler compiler =
new PointToPointIntentCompiler();
compiler.pathService = new IntentTestsMocks.MockPathService(hops);
- IdBlockAllocator idBlockAllocator = new DummyIdBlockAllocator();
- compiler.intentIdGenerator =
- new IdBlockAllocatorBasedIntentIdGenerator(idBlockAllocator);
return compiler;
}