Refactoring of IntentId based APIs
- getIntent
- getIntentState
- getInstallableIntents
Change-Id: I6d2073dfa165e0e5adcef46fe5908b563b481a43
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 c55c3e8..5ff9c99 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
@@ -45,6 +45,7 @@
import org.onosproject.net.intent.IntentService;
import org.onosproject.net.intent.IntentState;
import org.onosproject.net.intent.IntentTestsMocks;
+import org.onosproject.net.intent.Key;
import org.onosproject.net.resource.LinkResourceAllocations;
import org.onosproject.store.trivial.impl.SimpleIntentStore;
@@ -133,12 +134,12 @@
}
@Override
- public void addTrackedResources(IntentId intentId, Collection<NetworkResource> resources) {
+ public void addTrackedResources(Key key, Collection<NetworkResource> resources) {
//TODO
}
@Override
- public void removeTrackedResources(IntentId intentId, Collection<NetworkResource> resources) {
+ public void removeTrackedResources(Key key, Collection<NetworkResource> resources) {
//TODO
}
}
@@ -294,7 +295,7 @@
// verify that all intents are parked and the batch operation is unblocked
Set<IntentState> parked = Sets.newHashSet(INSTALLED, WITHDRAWN, FAILED);
for (Intent i : service.getIntents()) {
- IntentState state = service.getIntentState(i.id());
+ IntentState state = service.getIntentState(i.key());
assertTrue("Intent " + i.id() + " is in invalid state " + state,
parked.contains(state));
}
diff --git a/core/net/src/test/java/org/onosproject/net/intent/impl/ObjectiveTrackerTest.java b/core/net/src/test/java/org/onosproject/net/intent/impl/ObjectiveTrackerTest.java
index 02d206a..b324ae8 100644
--- a/core/net/src/test/java/org/onosproject/net/intent/impl/ObjectiveTrackerTest.java
+++ b/core/net/src/test/java/org/onosproject/net/intent/impl/ObjectiveTrackerTest.java
@@ -32,7 +32,7 @@
import org.onosproject.net.Link;
import org.onosproject.net.NetworkResource;
import org.onosproject.net.intent.Intent;
-import org.onosproject.net.intent.IntentId;
+import org.onosproject.net.intent.Key;
import org.onosproject.net.intent.MockIdGenerator;
import org.onosproject.net.link.LinkEvent;
import org.onosproject.net.resource.LinkResourceEvent;
@@ -49,6 +49,7 @@
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.is;
+import static org.onosproject.net.NetTestTools.APP_ID;
import static org.onosproject.net.NetTestTools.link;
/**
@@ -99,13 +100,13 @@
static class TestTopologyChangeDelegate implements TopologyChangeDelegate {
CountDownLatch latch = new CountDownLatch(1);
- List<IntentId> intentIdsFromEvent;
+ List<Key> intentIdsFromEvent;
boolean compileAllFailedFromEvent;
@Override
- public void triggerCompile(Iterable<IntentId> intentIds,
+ public void triggerCompile(Iterable<Key> intentKeys,
boolean compileAllFailed) {
- intentIdsFromEvent = Lists.newArrayList(intentIds);
+ intentIdsFromEvent = Lists.newArrayList(intentKeys);
compileAllFailedFromEvent = compileAllFailed;
latch.countDown();
}
@@ -199,9 +200,9 @@
topology,
reasons);
- final IntentId intentId = IntentId.valueOf(0x333L);
+ final Key key = Key.of(0x333L, APP_ID);
Collection<NetworkResource> resources = ImmutableSet.of(link);
- tracker.addTrackedResources(intentId, resources);
+ tracker.addTrackedResources(key, resources);
listener.event(event);
assertThat(