Package org.springframework.context.annotation

Examples of org.springframework.context.annotation.AnnotationConfigApplicationContext.containsBean()


public class ListenerTests extends AbstractStateMachineTests {

  @Test
  public void testStateEvents() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(Config.class);
    assertTrue(ctx.containsBean(StateMachineSystemConstants.DEFAULT_ID_STATEMACHINE));
    @SuppressWarnings("unchecked")
    EnumStateMachine<TestStates,TestEvents> machine =
        ctx.getBean(StateMachineSystemConstants.DEFAULT_ID_STATEMACHINE, EnumStateMachine.class);

    TestStateMachineListener listener = new TestStateMachineListener();
View Full Code Here


  @SuppressWarnings({ "unchecked" })
  @Test
  public void testStates() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(Config1.class);
    assertTrue(ctx.containsBean(StateMachineSystemConstants.DEFAULT_ID_STATEMACHINE));
    EnumStateMachine<TestStates,TestEvents> machine =
        ctx.getBean(StateMachineSystemConstants.DEFAULT_ID_STATEMACHINE, EnumStateMachine.class);
    assertThat(machine, notNullValue());
    TestAction testAction = ctx.getBean("testAction", TestAction.class);
    assertThat(testAction, notNullValue());
View Full Code Here

  @SuppressWarnings({ "unchecked" })
  @Test
  public void testTriggerlessTransition() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(Config1.class);
    assertTrue(ctx.containsBean(StateMachineSystemConstants.DEFAULT_ID_STATEMACHINE));
    EnumStateMachine<TestStates,TestEvents> machine =
        ctx.getBean(StateMachineSystemConstants.DEFAULT_ID_STATEMACHINE, EnumStateMachine.class);
    assertThat(machine.getState().getId(), is(TestStates.S1));
    machine.sendEvent(MessageBuilder.withPayload(TestEvents.E1).build());
    assertThat(machine.getState().getId(), is(TestStates.S3));
View Full Code Here

  @SuppressWarnings({ "unchecked" })
  @Test
  public void testTransitionActions() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(Config1.class);
    assertTrue(ctx.containsBean(StateMachineSystemConstants.DEFAULT_ID_STATEMACHINE));
    EnumStateMachine<TestStates,TestEvents> machine =
        ctx.getBean(StateMachineSystemConstants.DEFAULT_ID_STATEMACHINE, EnumStateMachine.class);
    TestCountAction testAction1 = ctx.getBean("testAction1", TestCountAction.class);
    TestCountAction testAction2 = ctx.getBean("testAction2", TestCountAction.class);
    TestCountAction testAction3 = ctx.getBean("testAction3", TestCountAction.class);
View Full Code Here

public class StateMachineTests extends AbstractStateMachineTests {

  @Test
  public void test1() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(Config.class);
    assertTrue(ctx.containsBean(StateMachineSystemConstants.DEFAULT_ID_STATEMACHINE));
    @SuppressWarnings("unchecked")
    EnumStateMachine<TestStates,TestEvents> machine =
        ctx.getBean(StateMachineSystemConstants.DEFAULT_ID_STATEMACHINE, EnumStateMachine.class);
    assertThat(machine, notNullValue());
    machine.sendEvent(MessageBuilder.withPayload(TestEvents.E1).setHeader("foo", "jee1").build());
View Full Code Here

    ctx.setEnvironment(prodEnv);

    ctx.register(ProdConfig.class);
    ctx.refresh();

    assertThat("should have prod bean", ctx.containsBean(PROD_BEAN_NAME), is(true));
  }

  @Test
  public void annotationConfigApplicationContext_withProdEnvAndDevConfigClass() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
View Full Code Here

    ctx.setEnvironment(prodEnv);

    ctx.register(DevConfig.class);
    ctx.refresh();

    assertThat("should not have dev bean", ctx.containsBean(DEV_BEAN_NAME), is(false));
    assertThat("should not have transitive bean", ctx.containsBean(TRANSITIVE_BEAN_NAME), is(false));
  }

  @Test
  public void annotationConfigApplicationContext_withDevEnvAndDevConfigClass() {
View Full Code Here

    ctx.register(DevConfig.class);
    ctx.refresh();

    assertThat("should not have dev bean", ctx.containsBean(DEV_BEAN_NAME), is(false));
    assertThat("should not have transitive bean", ctx.containsBean(TRANSITIVE_BEAN_NAME), is(false));
  }

  @Test
  public void annotationConfigApplicationContext_withDevEnvAndDevConfigClass() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
View Full Code Here

    ctx.setEnvironment(devEnv);

    ctx.register(DevConfig.class);
    ctx.refresh();

    assertThat("should have dev bean", ctx.containsBean(DEV_BEAN_NAME), is(true));
    assertThat("should have transitive bean", ctx.containsBean(TRANSITIVE_BEAN_NAME), is(true));
  }

  @Test
  public void annotationConfigApplicationContext_withImportedConfigClasses() {
View Full Code Here

    ctx.register(DevConfig.class);
    ctx.refresh();

    assertThat("should have dev bean", ctx.containsBean(DEV_BEAN_NAME), is(true));
    assertThat("should have transitive bean", ctx.containsBean(TRANSITIVE_BEAN_NAME), is(true));
  }

  @Test
  public void annotationConfigApplicationContext_withImportedConfigClasses() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.