Examples of AbstractApplicationContext


Examples of org.springframework.context.support.AbstractApplicationContext

          + "\n    For more information please visit:                   "
          + "\n    http://www.springsource.org/spring-integration       "
          + "\n                                                         "
          + "\n=========================================================" );

    final AbstractApplicationContext context =
        new ClassPathXmlApplicationContext("classpath:META-INF/spring/integration/expression-advice-context.xml");

    context.registerShutdownHook();

    @SuppressWarnings("unchecked")
    SessionFactory<FTPFile> sessionFactory = context.getBean(SessionFactory.class);
    SourcePollingChannelAdapter fileInbound = context.getBean(SourcePollingChannelAdapter.class);

    @SuppressWarnings("unchecked")
    Session<FTPFile> session = mock(Session.class);
    when(sessionFactory.getSession()).thenReturn(session);
    fileInbound.start();

    LOGGER.info("\n========================================================="
          + "\n                                                          "
          + "\n    This is the Expression Advice Sample -                "
          + "\n                                                          "
          + "\n    Press 'Enter' to terminate.                           "
          + "\n                                                          "
          + "\n    Place a file in ${java.io.tmpdir}/adviceDemo ending   "
          + "\n    with .txt                                             "
          + "\n    The demo simulates a file transfer followed by the    "
          + "\n    Advice deleting the file; the result of the deletion  "
          + "\n    is logged.                                            "
          + "\n                                                          "
          + "\n=========================================================" );

    System.in.read();
    context.close();
    System.exit(0);
  }
View Full Code Here

Examples of org.springframework.context.support.AbstractApplicationContext

    // initially, no process engine is registered:
    Assert.assertNull(BpmPlatform.getDefaultProcessEngine());
    Assert.assertEquals(0, BpmPlatform.getProcessEngineService().getProcessEngines().size());
   
    // start spring application context
    AbstractApplicationContext applicationContext = new ClassPathXmlApplicationContext("org/camunda/bpm/engine/spring/test/container/ManagedProcessEngineFactoryBean-context.xml");
    applicationContext.start();
   
    // assert that now the process engine is registered:
    Assert.assertNotNull(BpmPlatform.getDefaultProcessEngine());     
   
    // close the spring application context
    applicationContext.close();
   
    // after closing the application context, the process engine is gone
    Assert.assertNull(BpmPlatform.getDefaultProcessEngine());
    Assert.assertEquals(0, BpmPlatform.getProcessEngineService().getProcessEngines().size());
   
View Full Code Here

Examples of org.springframework.context.support.AbstractApplicationContext

    // initially no applications are deployed:
    Assert.assertEquals(0, BpmPlatform.getProcessApplicationService().getProcessApplicationNames().size());

    // start a spring application context
    AbstractApplicationContext applicationContext = new ClassPathXmlApplicationContext("org/camunda/bpm/engine/spring/test/application/SpringProcessApplicationDeploymentTest-context.xml");
    applicationContext.start();

    // assert that there is a process application deployed with the name of the process application bean
    Assert.assertNotNull(BpmPlatform.getProcessApplicationService()
      .getProcessApplicationInfo("myProcessApplication"));

    // close the spring application context
    applicationContext.close();

    // after closing the application context, the process application is undeployed.
    Assert.assertNull(BpmPlatform.getProcessApplicationService()
      .getProcessApplicationInfo("myProcessApplication"));
View Full Code Here

Examples of org.springframework.context.support.AbstractApplicationContext

  @Test
  public void testDeployProcessArchive() {

    // start a spring application context
    AbstractApplicationContext applicationContext = new ClassPathXmlApplicationContext("org/camunda/bpm/engine/spring/test/application/SpringProcessArchiveDeploymentTest-context.xml");
    applicationContext.start();

    // assert the process archive is deployed:
    ProcessEngine processEngine = BpmPlatform.getDefaultProcessEngine();
    Assert.assertNotNull(processEngine.getRepositoryService().createDeploymentQuery().deploymentName("pa").singleResult());

    applicationContext.close();

    // assert the process is undeployed
    Assert.assertNull(processEngine.getRepositoryService().createDeploymentQuery().deploymentName("pa").singleResult());

  }
View Full Code Here

Examples of org.springframework.context.support.AbstractApplicationContext

  @Test
  public void testPostDeployRegistrationPa() {
    // this test verifies that a process application is able to register a deployment from the @PostDeploy callback:

    AbstractApplicationContext applicationContext = new ClassPathXmlApplicationContext("org/camunda/bpm/engine/spring/test/application/PostDeployRegistrationPaTest-context.xml");
    applicationContext.start();

    ProcessEngine processEngine = BpmPlatform.getDefaultProcessEngine();

    // create a manual deployment:
    Deployment deployment = processEngine.getRepositoryService()
      .createDeployment()
      .addClasspathResource("org/camunda/bpm/engine/spring/test/application/process.bpmn20.xml")
      .deploy();

    // lookup the process application spring bean:
    PostDeployRegistrationPa processApplication = applicationContext.getBean("customProcessApplicaiton", PostDeployRegistrationPa.class);

    Assert.assertFalse(processApplication.isPostDeployInvoked());
    processApplication.deploy();
    Assert.assertTrue(processApplication.isPostDeployInvoked());

    // the process application was not invoked
    Assert.assertFalse(processApplication.isInvoked());

    // start process instance:
    processEngine.getRuntimeService()
      .startProcessInstanceByKey("startToEnd");

    // now the process application was invoked:
    Assert.assertTrue(processApplication.isInvoked());

    // undeploy PA
    Assert.assertFalse(processApplication.isPreUndeployInvoked());
    processApplication.undeploy();
    Assert.assertTrue(processApplication.isPreUndeployInvoked());

    // manually undeploy the process
    processEngine.getRepositoryService()
      .deleteDeployment(deployment.getId(), true);

    applicationContext.close();

  }
View Full Code Here

Examples of org.springframework.context.support.AbstractApplicationContext

  @Test
  public void testSecurityConfigWithReadFromKerberizedHdfs() throws Exception {
    // This test is guarded by test group to be run manually
    // until we have a proper way to use secured miniclusters.
    Assume.group(TestGroup.KERBEROS);
    AbstractApplicationContext context = new ClassPathXmlApplicationContext(
        "ConfigurationSecureHdfsTest-context.xml",
        ConfigurationSecureHdfsTest.class);
    Assert.notNull(context.getBean("secureHdfsConfig"));
    Configuration configuration = context.getBean("secureHdfsConfig", Configuration.class);
    Object factory = context.getBean("&secureHdfsConfig");
    String userKeytab = TestUtils.readField("userKeytab", factory);
    assertThat(userKeytab, containsString("keytab"));
    String namenodePrincipal = TestUtils.readField("namenodePrincipal", factory);
    assertThat(namenodePrincipal, containsString("hdfs"));
    String rmPrincipal = TestUtils.readField("rmManagerPrincipal", factory);
    assertThat(rmPrincipal, containsString("yarn"));
    FileSystem fs = FileSystem.get(configuration);
    FileStatus[] listStatus = fs.listStatus(new Path("/"));
    for (FileStatus fileStatus : listStatus) {
      log.info("fileStatus: " + fileStatus);
    }
    context.close();
  }
View Full Code Here

Examples of org.springframework.context.support.AbstractApplicationContext

 
  public static void main(String[] args)
  {
    PropertyConfigurator.configure(System
        .getProperty("log4j.configuration"));
    AbstractApplicationContext ctx = new AnnotationConfigApplicationContext(ZombieSpringConfig.class);
    // For the destroy method to work.
    ctx.registerShutdownHook();
   
    // Start the main game server
    ServerManager serverManager = ctx.getBean(ServerManager.class);
    //serverManager.startServers(18090,843,8081);
    try
    {
      serverManager.startServers();
    }
View Full Code Here

Examples of org.springframework.context.support.AbstractApplicationContext

  private static final Logger LOG = LoggerFactory.getLogger(SpringNettyServer.class);
  public static void main(String[] args)
  {
    PropertyConfigurator.configure(System
        .getProperty("log4j.configuration"));
    AbstractApplicationContext context = new AnnotationConfigApplicationContext(JetServerSpringConfig.class);
   
    // For the destroy method to work.
    context.registerShutdownHook();
   
    // Start tcp and flash servers
    ServerManager manager = (ServerManager)context.getBean("serverManager");
    try
    {
      manager.startServers(8090,843,8081);
    }
    catch (Exception e)
View Full Code Here

Examples of org.springframework.context.support.AbstractApplicationContext

ApplicationContextProvider {

private static ApplicationContext context;

public ApplicationContext createContext() {
AbstractApplicationContext context = new ClassPathXmlApplicationContext(
    getContextLocations());
context.registerShutdownHook();
return context;
}
View Full Code Here

Examples of org.springframework.context.support.AbstractApplicationContext

    }
   
    void configure(Object beanInstance) {
        // check the ApplicationContext states first , and call the refresh if necessary
        if (applicationContext instanceof AbstractApplicationContext) {
            AbstractApplicationContext context = (AbstractApplicationContext) applicationContext;
            if (!context.isActive()) {
                context.refresh();
            }
        }
        configurer.configureBean(beanId, beanInstance);
    }
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.