This commit is contained in:
Janne Valkealahti
2015-07-04 15:34:24 +01:00
parent 6ae2f2fa43
commit 2ac515b04b
11 changed files with 8 additions and 57 deletions

View File

@@ -151,6 +151,7 @@ public class DefaultStateConfigurer<S, E>
return state(state, entryActions, exitActions);
}
@SuppressWarnings("unchecked")
@Override
public StateConfigurer<S, E> state(S state, E... deferred) {
Collection<E> d = null;

View File

@@ -97,6 +97,7 @@ public interface StateConfigurer<S, E> extends
* @param deferred the deferred events
* @return configurer for chaining
*/
@SuppressWarnings("unchecked")
StateConfigurer<S, E> state(S state, E... deferred);
/**

View File

@@ -413,7 +413,6 @@ public class SubStateMachineTests extends AbstractStateMachineTests {
@EnableStateMachine
public static class Config1 extends EnumStateMachineConfigurerAdapter<TestStates, TestEvents> {
@SuppressWarnings("unchecked")
@Override
public void configure(StateMachineStateConfigurer<TestStates, TestEvents> states) throws Exception {
states

View File

@@ -225,7 +225,6 @@ public class ConfigurationTests extends AbstractStateMachineTests {
@EnableStateMachine
public static class Config5 extends EnumStateMachineConfigurerAdapter<TestStates, TestEvents> {
@SuppressWarnings("unchecked")
@Override
public void configure(StateMachineStateConfigurer<TestStates, TestEvents> states) throws Exception {
TestEntryAction action1 = action1();

View File

@@ -175,16 +175,6 @@ public class ManualBuilderTests {
transitionLatch.countDown();
}
public void reset(int c1) {
reset(c1, 0);
}
public void reset(int c1, int c2) {
stateChangedLatch = new CountDownLatch(c1);
transitionLatch = new CountDownLatch(c2);
stateChangedCount = 0;
}
}
}

View File

@@ -85,7 +85,6 @@ public class DefaultStateConfigurerTests {
@Test
public void testActionsInitialFirst() throws Exception {
@SuppressWarnings("unchecked")
Collection<Action<TestStates, TestEvents>> exitActions = Arrays.asList(testExitAction());
DefaultStateConfigurer<TestStates, TestEvents> configurer = new DefaultStateConfigurer<TestStates, TestEvents>();
@@ -103,7 +102,6 @@ public class DefaultStateConfigurerTests {
@Test
public void testActionsJustState() throws Exception {
@SuppressWarnings("unchecked")
Collection<Action<TestStates, TestEvents>> entryActions = Arrays.asList(testEntryAction());
DefaultStateConfigurer<TestStates, TestEvents> configurer = new DefaultStateConfigurer<TestStates, TestEvents>();

View File

@@ -40,12 +40,12 @@ import org.springframework.statemachine.config.builders.StateMachineTransitionCo
/**
* Tests for state entry and exit actions.
*
*
* @author Janne Valkealahti
*
*/
public class StateActionTests extends AbstractStateMachineTests {
@Test
@SuppressWarnings("unchecked")
public void testStateEntryExit() throws Exception {
@@ -56,24 +56,22 @@ public class StateActionTests extends AbstractStateMachineTests {
TestEntryAction testEntryAction = ctx.getBean("testEntryAction", TestEntryAction.class);
assertThat(testExitAction, notNullValue());
assertThat(testEntryAction, notNullValue());
machine.start();
machine.sendEvent(TestEvents.E1);
assertThat(testExitAction.onExecuteLatch.await(2, TimeUnit.SECONDS), is(true));
assertThat(testEntryAction.onExecuteLatch.await(2, TimeUnit.SECONDS), is(true));
ctx.close();
}
@Configuration
@EnableStateMachine
public static class Config1 extends EnumStateMachineConfigurerAdapter<TestStates, TestEvents> {
@Override
public void configure(StateMachineStateConfigurer<TestStates, TestEvents> states) throws Exception {
@SuppressWarnings("unchecked")
Collection<Action<TestStates, TestEvents>> entryActions = Arrays.asList(testEntryAction());
@SuppressWarnings("unchecked")
Collection<Action<TestStates, TestEvents>> exitActions = Arrays.asList(testExitAction());
states
.withStates()
@@ -100,7 +98,7 @@ public class StateActionTests extends AbstractStateMachineTests {
public Action<TestStates, TestEvents> testExitAction() {
return new TestExitAction();
}
@Bean
public TaskExecutor taskExecutor() {
return new SyncTaskExecutor();

View File

@@ -261,9 +261,7 @@ public class TransitionTests extends AbstractStateMachineTests {
@Override
public void configure(StateMachineStateConfigurer<TestStates, TestEvents> states) throws Exception {
@SuppressWarnings("unchecked")
Collection<Action<TestStates, TestEvents>> entryActions = Arrays.asList(testEntryAction());
@SuppressWarnings("unchecked")
Collection<Action<TestStates, TestEvents>> exitActions = Arrays.asList(testExitAction());
states
.withStates()

View File

@@ -298,17 +298,6 @@ public class TasksHandlerTests {
onTasksErrorLatch.countDown();
}
public void reset(int c1, int c2, int c3, int c4, int c5, int c6, int c7) {
onTasksStartedLatch = new CountDownLatch(c1);
onTasksContinueLatch = new CountDownLatch(c2);
onTaskPreExecuteLatch = new CountDownLatch(c3);
onTaskPostExecuteLatch = new CountDownLatch(c4);
onTaskFailedLatch = new CountDownLatch(c5);
onTasksSuccessLatch = new CountDownLatch(c6);
onTasksErrorLatch = new CountDownLatch(c7);
onTasksStarted = 0;
}
}
}

View File

@@ -98,7 +98,6 @@ public class PersistTests {
volatile List<Transition<String, String>> transitions = new ArrayList<Transition<String, String>>();
List<State<String, String>> statesEntered = new ArrayList<State<String, String>>();
List<State<String, String>> statesExited = new ArrayList<State<String, String>>();
volatile int transitionCount = 0;
@Override
public void stateChanged(State<String, String> from, State<String, String> to) {
@@ -120,25 +119,9 @@ public class PersistTests {
@Override
public void transition(Transition<String, String> transition) {
transitions.add(transition);
transitionCount++;
transitionLatch.countDown();
}
public void reset(int c1, int c2, int c3) {
reset(c1, c2, c3, 0);
}
public void reset(int c1, int c2, int c3, int c4) {
stateChangedLatch = new CountDownLatch(c1);
stateEnteredLatch = new CountDownLatch(c2);
stateExitedLatch = new CountDownLatch(c3);
transitionLatch = new CountDownLatch(c4);
statesEntered.clear();
statesExited.clear();
transitionCount = 0;
transitions.clear();
}
}
}

View File

@@ -158,11 +158,6 @@ public class ZookeeperStateMachineEnsembleTests extends AbstractZookeeperTests {
eventLatch.countDown();
}
public void reset(int c1, int c2) {
joinedLatch = new CountDownLatch(c1);
eventLatch = new CountDownLatch(c2);
}
}
private class TestStateMachine implements StateMachine<String, String> {