Implement Intent Manager Runtime
- Implement both IntentService and IntentExtensionService
This resolves ONOS-1888
Limitation:
- Only consider single level pass intent compilation to make SDN-IP workable.
Should implement compilation traversing tree structure later.
- execute() is not implemented. It throws UnsupportedOperationException.
- destroy() is only for testing. It is a workaround for Hazelcast unit testing
issue that we can't shutdown Hazelcast.
Change-Id: I7ce950339e0aa87d38c458f921b935884a8b77d2
diff --git a/src/test/java/net/onrc/onos/api/newintent/TestableIntentService.java b/src/test/java/net/onrc/onos/api/newintent/TestableIntentService.java
index 27921de..ea1b187 100644
--- a/src/test/java/net/onrc/onos/api/newintent/TestableIntentService.java
+++ b/src/test/java/net/onrc/onos/api/newintent/TestableIntentService.java
@@ -1,11 +1,13 @@
package net.onrc.onos.api.newintent;
+import net.onrc.onos.core.newintent.IntentManager;
+
import java.util.List;
/**
* Abstraction of an extensible intent service enabled for unit tests.
*/
-public interface TestableIntentService extends IntentService, IntentExtensionService {
+public interface TestableIntentService extends IntentManager {
List<IntentException> getExceptions();
diff --git a/src/test/java/net/onrc/onos/core/newintent/IntentManagerRuntimeTest.java b/src/test/java/net/onrc/onos/core/newintent/IntentManagerRuntimeTest.java
new file mode 100644
index 0000000..dfc0fd1
--- /dev/null
+++ b/src/test/java/net/onrc/onos/core/newintent/IntentManagerRuntimeTest.java
@@ -0,0 +1,43 @@
+package net.onrc.onos.core.newintent;
+
+import net.onrc.onos.api.newintent.IntentException;
+import net.onrc.onos.api.newintent.IntentServiceTest;
+import net.onrc.onos.api.newintent.TestableIntentService;
+import net.onrc.onos.core.datagrid.ISharedCollectionsService;
+import net.onrc.onos.core.datastore.hazelcast.DummySharedCollectionsService;
+import org.junit.After;
+
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * Suites of test of {@link IntentManagerRuntime} inheriting from {@link IntentServiceTest}.
+ */
+public class IntentManagerRuntimeTest extends IntentServiceTest {
+
+ private TestableIntentManagerRuntime sut;
+
+ @Override
+ protected TestableIntentService createIntentService() {
+ DummySharedCollectionsService collectionsService = new DummySharedCollectionsService();
+ sut = new TestableIntentManagerRuntime(collectionsService);
+ return sut;
+ }
+
+ @After
+ public void tearDown() {
+ sut.destroy();
+ }
+
+ private static class TestableIntentManagerRuntime
+ extends IntentManagerRuntime implements TestableIntentService {
+ public TestableIntentManagerRuntime(ISharedCollectionsService service) {
+ super(service);
+ }
+
+ @Override
+ public List<IntentException> getExceptions() {
+ return Collections.emptyList();
+ }
+ }
+}