Fixes for ObjectiveTrackerTest and IntentServiceTest
Change-Id: I10acda2220c2012e0aa07493c2dc91b1a6a81109
diff --git a/core/api/src/test/java/org/onosproject/net/intent/FakeIntentManager.java b/core/api/src/test/java/org/onosproject/net/intent/FakeIntentManager.java
index c1b7886..b3c30b5 100644
--- a/core/api/src/test/java/org/onosproject/net/intent/FakeIntentManager.java
+++ b/core/api/src/test/java/org/onosproject/net/intent/FakeIntentManager.java
@@ -31,9 +31,9 @@
*/
public class FakeIntentManager implements TestableIntentService {
- private final Map<IntentId, Intent> intents = new HashMap<>();
- private final Map<IntentId, IntentState> intentStates = new HashMap<>();
- private final Map<IntentId, List<Intent>> installables = new HashMap<>();
+ private final Map<Key, Intent> intents = new HashMap<>();
+ private final Map<Key, IntentState> intentStates = new HashMap<>();
+ private final Map<Key, List<Intent>> installables = new HashMap<>();
private final Set<IntentListener> listeners = new HashSet<>();
private final Map<Class<? extends Intent>, IntentCompiler<? extends Intent>> compilers = new HashMap<>();
@@ -69,7 +69,7 @@
@Override
public void run() {
try {
- List<Intent> installable = getInstallable(intent.id());
+ List<Intent> installable = getInstallable(intent.key());
executeWithdrawingPhase(intent, installable);
} catch (IntentException e) {
exceptions.add(e);
@@ -123,7 +123,7 @@
getInstaller(ii).install(ii);
}
setState(intent, IntentState.INSTALLED);
- putInstallable(intent.id(), installable);
+ putInstallable(intent.key(), installable);
dispatch(new IntentEvent(IntentEvent.Type.INSTALLED, intent));
} catch (IntentException e) {
@@ -139,7 +139,7 @@
for (Intent ii : installable) {
getInstaller(ii).uninstall(ii);
}
- removeInstallable(intent.id());
+ removeInstallable(intent.key());
setState(intent, IntentState.WITHDRAWN);
dispatch(new IntentEvent(IntentEvent.Type.WITHDRAWN, intent));
} catch (IntentException e) {
@@ -151,19 +151,19 @@
// Sets the internal state for the given intent and dispatches an event
private void setState(Intent intent, IntentState state) {
- intentStates.put(intent.id(), state);
+ intentStates.put(intent.key(), state);
}
- private void putInstallable(IntentId id, List<Intent> installable) {
- installables.put(id, installable);
+ private void putInstallable(Key key, List<Intent> installable) {
+ installables.put(key, installable);
}
- private void removeInstallable(IntentId id) {
- installables.remove(id);
+ private void removeInstallable(Key key) {
+ installables.remove(key);
}
- private List<Intent> getInstallable(IntentId id) {
- List<Intent> installable = installables.get(id);
+ private List<Intent> getInstallable(Key key) {
+ List<Intent> installable = installables.get(key);
if (installable != null) {
return installable;
} else {
@@ -173,7 +173,7 @@
@Override
public void submit(Intent intent) {
- intents.put(intent.id(), intent);
+ intents.put(intent.key(), intent);
setState(intent, IntentState.INSTALL_REQ);
dispatch(new IntentEvent(IntentEvent.Type.INSTALL_REQ, intent));
executeSubmit(intent);
@@ -181,7 +181,7 @@
@Override
public void withdraw(Intent intent) {
- intents.remove(intent.id());
+ intents.remove(intent.key());
executeWithdraw(intent);
}
diff --git a/core/api/src/test/java/org/onosproject/net/intent/IntentServiceTest.java b/core/api/src/test/java/org/onosproject/net/intent/IntentServiceTest.java
index 908b582..7ae00aa 100644
--- a/core/api/src/test/java/org/onosproject/net/intent/IntentServiceTest.java
+++ b/core/api/src/test/java/org/onosproject/net/intent/IntentServiceTest.java
@@ -33,7 +33,6 @@
import org.junit.After;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import org.onosproject.core.IdGenerator;
import org.onosproject.net.flow.FlowRuleBatchOperation;
@@ -42,7 +41,6 @@
/**
* Suite of tests for the intent service contract.
*/
-@Ignore
public class IntentServiceTest {
public static final int IID = 123;
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 6352bff..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
@@ -24,7 +24,6 @@
import org.junit.After;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import org.onlab.junit.TestUtils;
import org.onlab.junit.TestUtils.TestUtilsException;