Examples of containsBean()


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

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

  @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

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

  @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

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

  @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

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

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

Examples of org.springframework.context.support.ClassPathXmlApplicationContext.containsBean()

  }

  public void testClassPathXmlApplicationContext() throws IOException {
    ApplicationContext context = new ClassPathXmlApplicationContext(
        "/org/springframework/web/context/WEB-INF/applicationContext.xml");
    assertTrue("Has father", context.containsBean("father"));
    assertTrue("Has rod", context.containsBean("rod"));
    assertFalse("Hasn't kerry", context.containsBean("kerry"));
    assertTrue("Doesn't have spouse", ((TestBean) context.getBean("rod")).getSpouse() == null);
    assertTrue("myinit not evaluated", "Roderick".equals(((TestBean) context.getBean("rod")).getName()));
View Full Code Here

Examples of org.springframework.context.support.FileSystemXmlApplicationContext.containsBean()

        } else if (args.length == 2) {
            LOG.info("Using xml configuration file " + args[1] + "...");
            FileSystemXmlApplicationContext ctx = new FileSystemXmlApplicationContext(
                    args[1]);

            if (ctx.containsBean("server")) {
                server = (FtpServer) ctx.getBean("server");
            } else {
                String[] beanNames = ctx.getBeanNamesForType(FtpServer.class);
                if (beanNames.length == 1) {
                    server = (FtpServer) ctx.getBean(beanNames[0]);
View Full Code Here

Examples of org.springframework.context.support.GenericApplicationContext.containsBean()

    postProcessor.setBeanFactory(context.getBeanFactory());
    postProcessor.afterPropertiesSet();
    TestBean testBean = new TestBean();
    postProcessor.postProcessAfterInitialization(testBean, "testBean");
    context.refresh();
    assertTrue(context.containsBean("testBean.test.onContainerStart"));
    Object endpoint = context.getBean("testBean.test.onContainerStart");
    assertTrue(endpoint instanceof ContainerHandler);
    context.stop();
  }
View Full Code Here

Examples of org.springframework.context.support.GenericXmlApplicationContext.containsBean()

    ctx.refresh();

    assertHasEnvironment(ctx, prodEnv);
    assertEnvironmentBeanRegistered(ctx);
    assertEnvironmentAwareInvoked(ctx, prodEnv);
    assertThat(ctx.containsBean(DEV_BEAN_NAME), is(false));
    assertThat(ctx.containsBean(PROD_BEAN_NAME), is(true));
  }

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

Examples of org.springframework.osgi.context.ConfigurableOsgiBundleApplicationContext.containsBean()

      synchronized (lock) {
        extenderConfiguration = context;
      }

      warScanner = context.containsBean(WAR_SCANNER_NAME) ? (WarScanner) context.getBean(WAR_SCANNER_NAME,
        WarScanner.class) : createDefaultWarScanner();

      warDeployer = context.containsBean(WAR_DEPLOYER_NAME) ? (WarDeployer) context.getBean(WAR_DEPLOYER_NAME,
        WarDeployer.class) : createDefaultWarDeployer(bundleContext);
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.