Cleaning up intent tests setup/teardown to avoid cascading failures
with respect to binding ID generator.
Change-Id: Ia4778f16ff5a3ecb26062e7d7b2c36493081140d
diff --git a/apps/optical-model/src/test/java/org/onosproject/net/optical/intent/impl/compiler/OpticalCircuitIntentCompilerTest.java b/apps/optical-model/src/test/java/org/onosproject/net/optical/intent/impl/compiler/OpticalCircuitIntentCompilerTest.java
index 1ce3e6c..4d0fb65 100644
--- a/apps/optical-model/src/test/java/org/onosproject/net/optical/intent/impl/compiler/OpticalCircuitIntentCompilerTest.java
+++ b/apps/optical-model/src/test/java/org/onosproject/net/optical/intent/impl/compiler/OpticalCircuitIntentCompilerTest.java
@@ -15,8 +15,11 @@
*/
package org.onosproject.net.optical.intent.impl.compiler;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Sets;
import org.easymock.EasyMock;
-import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -25,13 +28,12 @@
import org.onosproject.cfg.ComponentConfigService;
import org.onosproject.core.ApplicationId;
import org.onosproject.core.CoreService;
-import org.onosproject.core.IdGenerator;
import org.onosproject.net.AbstractProjectableModel;
import org.onosproject.net.Annotations;
import org.onosproject.net.ChannelSpacing;
-import org.onosproject.net.DefaultAnnotations;
import org.onosproject.net.CltSignalType;
import org.onosproject.net.ConnectPoint;
+import org.onosproject.net.DefaultAnnotations;
import org.onosproject.net.DefaultDevice;
import org.onosproject.net.DefaultPort;
import org.onosproject.net.Device;
@@ -43,28 +45,6 @@
import org.onosproject.net.Port;
import org.onosproject.net.PortNumber;
import org.onosproject.net.TributarySlot;
-import org.onosproject.net.flow.DefaultTrafficSelector;
-import org.onosproject.net.flow.DefaultTrafficTreatment;
-import org.onosproject.net.flow.FlowRule;
-import org.onosproject.net.flow.TrafficSelector;
-import org.onosproject.net.flow.TrafficTreatment;
-import org.onosproject.net.flow.criteria.Criteria;
-import org.onosproject.net.flow.instructions.Instructions;
-import org.onosproject.net.intent.FlowRuleIntent;
-import org.onosproject.net.intent.Intent;
-import org.onosproject.net.intent.IntentExtensionService;
-import org.onosproject.net.intent.IntentId;
-import org.onosproject.net.intent.IntentServiceAdapter;
-import org.onosproject.net.intent.Key;
-import org.onosproject.net.intent.MockIdGenerator;
-import org.onosproject.net.intent.OpticalCircuitIntent;
-import org.onosproject.net.optical.OchPort;
-import org.onosproject.net.optical.OduCltPort;
-import org.onosproject.net.optical.impl.DefaultOchPort;
-import org.onosproject.net.optical.impl.DefaultOduCltPort;
-import org.onosproject.net.provider.ProviderId;
-import org.onosproject.net.resource.MockResourceService;
-import org.onosproject.net.intent.IntentSetMultimap;
import org.onosproject.net.behaviour.TributarySlotQuery;
import org.onosproject.net.device.DeviceServiceAdapter;
import org.onosproject.net.driver.Behaviour;
@@ -75,11 +55,28 @@
import org.onosproject.net.driver.DriverServiceAdapter;
import org.onosproject.net.driver.TestBehaviourImpl;
import org.onosproject.net.driver.TestBehaviourTwoImpl;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Sets;
+import org.onosproject.net.flow.DefaultTrafficSelector;
+import org.onosproject.net.flow.DefaultTrafficTreatment;
+import org.onosproject.net.flow.FlowRule;
+import org.onosproject.net.flow.TrafficSelector;
+import org.onosproject.net.flow.TrafficTreatment;
+import org.onosproject.net.flow.criteria.Criteria;
+import org.onosproject.net.flow.instructions.Instructions;
+import org.onosproject.net.intent.AbstractIntentTest;
+import org.onosproject.net.intent.FlowRuleIntent;
+import org.onosproject.net.intent.Intent;
+import org.onosproject.net.intent.IntentExtensionService;
+import org.onosproject.net.intent.IntentId;
+import org.onosproject.net.intent.IntentServiceAdapter;
+import org.onosproject.net.intent.IntentSetMultimap;
+import org.onosproject.net.intent.Key;
+import org.onosproject.net.intent.OpticalCircuitIntent;
+import org.onosproject.net.optical.OchPort;
+import org.onosproject.net.optical.OduCltPort;
+import org.onosproject.net.optical.impl.DefaultOchPort;
+import org.onosproject.net.optical.impl.DefaultOduCltPort;
+import org.onosproject.net.provider.ProviderId;
+import org.onosproject.net.resource.MockResourceService;
import java.util.ArrayList;
import java.util.Collection;
@@ -89,23 +86,17 @@
import java.util.Set;
import java.util.stream.Collectors;
-import static org.easymock.EasyMock.anyObject;
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.expectLastCall;
-import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.*;
import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.everyItem;
-import static org.hamcrest.Matchers.hasSize;
-import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.*;
import static org.junit.Assert.assertEquals;
-import static org.onosproject.net.AnnotationKeys.STATIC_PORT;
import static org.onosproject.net.AnnotationKeys.PORT_NAME;
+import static org.onosproject.net.AnnotationKeys.STATIC_PORT;
import static org.onosproject.net.Device.Type.ROADM;
import static org.onosproject.net.DeviceId.deviceId;
import static org.onosproject.net.NetTestTools.APP_ID;
-public class OpticalCircuitIntentCompilerTest {
+public class OpticalCircuitIntentCompilerTest extends AbstractIntentTest {
private static final String DEV1 = "of:1";
private static final String DEV2 = "of:2";
@@ -117,7 +108,6 @@
private CoreService coreService;
private IntentExtensionService intentExtensionService;
- private final IdGenerator idGenerator = new MockIdGenerator();
private OpticalCircuitIntentCompiler sut;
private final ApplicationId appId = new TestApplicationId("test");
@@ -377,8 +367,7 @@
sut.intentService = new TestIntentService();
sut.intentSetMultimap = new MockIntentSetMultimap();
- Intent.unbindIdGenerator(idGenerator);
- Intent.bindIdGenerator(idGenerator);
+ super.setUp();
intentExtensionService = createMock(IntentExtensionService.class);
intentExtensionService.registerCompiler(OpticalCircuitIntent.class, sut);
@@ -400,11 +389,6 @@
}
- @After
- public void tearDown() {
- Intent.unbindIdGenerator(idGenerator);
- }
-
/**
* Tests compile of OpticalCircuitIntent with allocation of TributarySlots.
* Compile two ODUCLT ports (with CLT_1GBE), over OCH ports (with ODU2):