Enforce checkstyle for unit test codes
- First time contributer is likely to start with unit-test code,
so it is probably better to enforce the ONOS code style for
unit test codes also.
Change-Id: Id665e55b0f0bee7232dfb18ce6a7f9ea8cc3b164
diff --git a/src/test/java/net/onrc/onos/core/intent/runtime/IntentTestMocks.java b/src/test/java/net/onrc/onos/core/intent/runtime/IntentTestMocks.java
index 3d3cdcb..1a2e1c5 100644
--- a/src/test/java/net/onrc/onos/core/intent/runtime/IntentTestMocks.java
+++ b/src/test/java/net/onrc/onos/core/intent/runtime/IntentTestMocks.java
@@ -66,7 +66,7 @@
moduleContext = createMock(FloodlightModuleContext.class);
final IEventChannel<Long, IntentOperationList> intentOperationChannel =
createMock(IEventChannel.class);
- final IEventChannel<Long, IntentStateList>intentStateChannel =
+ final IEventChannel<Long, IntentStateList> intentStateChannel =
createMock(IEventChannel.class);
persistIntent = PowerMock.createMock(PersistIntent.class);
restApi = createMock(IRestApiService.class);
diff --git a/src/test/java/net/onrc/onos/core/intent/runtime/PathCalcRuntimeModuleTest.java b/src/test/java/net/onrc/onos/core/intent/runtime/PathCalcRuntimeModuleTest.java
index f341628..262042f 100644
--- a/src/test/java/net/onrc/onos/core/intent/runtime/PathCalcRuntimeModuleTest.java
+++ b/src/test/java/net/onrc/onos/core/intent/runtime/PathCalcRuntimeModuleTest.java
@@ -170,6 +170,8 @@
mocks.tearDownIntentMocks();
}
+ private static final String BAD_SWITCH_INTENT_NAME = "No Such Switch Intent";
+
/**
* Test the result of executing a path calculation on an
* Intent Operation List which contains a path that references a
@@ -182,7 +184,6 @@
*/
@Test
public void testInvalidSwitchName() {
- final String BAD_SWITCH_INTENT_NAME = "No Such Switch Intent";
// create shortest path intents
final IntentOperationList opList = new IntentOperationList();
@@ -327,6 +328,7 @@
hasIntentWithIdAndState("3", IntentState.INST_REQ));
}
+ // CHECKSTYLE:OFF method too long
/**
* Test the result of executing a path calculation on an
* Intent Operation List and then forcing a reroute.
@@ -450,7 +452,6 @@
assertThat(processedPathIntents,
hasIntentWithIdAndState("3___0", IntentState.INST_ACK));
-
// Remove one of the links and check results
final List<SwitchEvent> emptySwitchEvents = new LinkedList<>();
final List<PortEvent> emptyPortEvents = new LinkedList<>();
@@ -465,15 +466,10 @@
LinkEvent linkEvent2 = new LinkEvent(2L, 21L, 1L, 12L);
removedLinkEvents.add(linkEvent1);
removedLinkEvents.add(linkEvent2);
- runtime.topologyEvents(
- emptySwitchEvents,
- emptySwitchEvents,
- emptyPortEvents,
- emptyPortEvents,
- addedLinkEvents,
- removedLinkEvents,
- emptyDeviceEvents,
- emptyDeviceEvents);
+ runtime.topologyEvents(emptySwitchEvents, emptySwitchEvents,
+ emptyPortEvents, emptyPortEvents,
+ addedLinkEvents, removedLinkEvents,
+ emptyDeviceEvents, emptyDeviceEvents);
// Check the high level intents.
final IntentMap highLevelIntentsAfterReroute = runtime.getHighLevelIntents();
@@ -818,4 +814,6 @@
assertThat(reroutedPathIntents,
hasIntentWithIdAndState("3___0", IntentState.INST_ACK));
}
+ // CHECKSTYLE:ON method too long
+
}
diff --git a/src/test/java/net/onrc/onos/core/intent/runtime/UseCaseTest.java b/src/test/java/net/onrc/onos/core/intent/runtime/UseCaseTest.java
index bd42884..cdae6d8 100644
--- a/src/test/java/net/onrc/onos/core/intent/runtime/UseCaseTest.java
+++ b/src/test/java/net/onrc/onos/core/intent/runtime/UseCaseTest.java
@@ -167,11 +167,16 @@
public void createConstrainedShortestPaths() throws FloodlightModuleException {
// create constrained shortest path intents
IntentOperationList opList = new IntentOperationList();
- opList.add(Operator.ADD, new ConstrainedShortestPathIntent("1", 1L, 12L, LOCAL_PORT, 2L, 21L, LOCAL_PORT, 400.0));
- opList.add(Operator.ADD, new ConstrainedShortestPathIntent("2", 1L, 14L, LOCAL_PORT, 4L, 41L, LOCAL_PORT, 400.0));
- opList.add(Operator.ADD, new ConstrainedShortestPathIntent("3", 2L, 24L, LOCAL_PORT, 4L, 42L, LOCAL_PORT, 400.0));
- opList.add(Operator.ADD, new ConstrainedShortestPathIntent("4", 2L, 23L, LOCAL_PORT, 3L, 32L, LOCAL_PORT, 400.0));
- opList.add(Operator.ADD, new ConstrainedShortestPathIntent("5", 3L, 34L, LOCAL_PORT, 4L, 43L, LOCAL_PORT, 400.0));
+ opList.add(Operator.ADD, new ConstrainedShortestPathIntent("1", 1L, 12L,
+ LOCAL_PORT, 2L, 21L, LOCAL_PORT, 400.0));
+ opList.add(Operator.ADD, new ConstrainedShortestPathIntent("2", 1L, 14L,
+ LOCAL_PORT, 4L, 41L, LOCAL_PORT, 400.0));
+ opList.add(Operator.ADD, new ConstrainedShortestPathIntent("3", 2L, 24L,
+ LOCAL_PORT, 4L, 42L, LOCAL_PORT, 400.0));
+ opList.add(Operator.ADD, new ConstrainedShortestPathIntent("4", 2L, 23L,
+ LOCAL_PORT, 3L, 32L, LOCAL_PORT, 400.0));
+ opList.add(Operator.ADD, new ConstrainedShortestPathIntent("5", 3L, 34L,
+ LOCAL_PORT, 4L, 43L, LOCAL_PORT, 400.0));
// compile high-level intent operations into low-level intent operations (calculate paths)
PathCalcRuntimeModule runtime1 = new PathCalcRuntimeModule();
@@ -192,11 +197,16 @@
public void createMixedShortestPaths() throws FloodlightModuleException {
// create constrained & best effort shortest path intents
IntentOperationList opList = new IntentOperationList();
- opList.add(Operator.ADD, new ConstrainedShortestPathIntent("1", 1L, 12L, LOCAL_PORT, 2L, 21L, LOCAL_PORT, 400.0));
- opList.add(Operator.ADD, new ConstrainedShortestPathIntent("2", 1L, 14L, LOCAL_PORT, 4L, 41L, LOCAL_PORT, 400.0));
- opList.add(Operator.ADD, new ShortestPathIntent("3", 2L, 24L, LOCAL_PORT, 4L, 42L, LOCAL_PORT));
- opList.add(Operator.ADD, new ShortestPathIntent("4", 2L, 23L, LOCAL_PORT, 3L, 32L, LOCAL_PORT));
- opList.add(Operator.ADD, new ConstrainedShortestPathIntent("5", 3L, 34L, LOCAL_PORT, 4L, 43L, LOCAL_PORT, 400.0));
+ opList.add(Operator.ADD, new ConstrainedShortestPathIntent("1", 1L, 12L,
+ LOCAL_PORT, 2L, 21L, LOCAL_PORT, 400.0));
+ opList.add(Operator.ADD, new ConstrainedShortestPathIntent("2", 1L, 14L,
+ LOCAL_PORT, 4L, 41L, LOCAL_PORT, 400.0));
+ opList.add(Operator.ADD, new ShortestPathIntent("3", 2L, 24L, LOCAL_PORT, 4L,
+ 42L, LOCAL_PORT));
+ opList.add(Operator.ADD, new ShortestPathIntent("4", 2L, 23L, LOCAL_PORT, 3L,
+ 32L, LOCAL_PORT));
+ opList.add(Operator.ADD, new ConstrainedShortestPathIntent("5", 3L, 34L,
+ LOCAL_PORT, 4L, 43L, LOCAL_PORT, 400.0));
// compile high-level intent operations into low-level intent operations (calculate paths)
PathCalcRuntimeModule runtime1 = new PathCalcRuntimeModule();