Package org.springframework.context.support

Examples of org.springframework.context.support.FileSystemXmlApplicationContext


  private static int timeout = 20;

  @Test
  public void testAsyncGateway() throws Exception{
    ConfigurableApplicationContext ac =
        new FileSystemXmlApplicationContext("src/main/resources/META-INF/spring/integration/*.xml");
    MathServiceGateway mathService = ac.getBean("mathService", MathServiceGateway.class);
    Map<Integer, Future<Integer>> results = new HashMap<Integer, Future<Integer>>();
    Random random = new Random();
    for (int i = 0; i < 100; i++) {
      int number = random.nextInt(200);
      Future<Integer> result = mathService.multiplyByTwo(number);
      results.put(number, result);
    }
    for (final Map.Entry<Integer, Future<Integer>> resultEntry : results.entrySet()) {
      executor.execute(() -> {
        int[] result = processFuture(resultEntry);

        if (result[1] == -1){
          logger.info("Multiplying " + result[0] + " should be easy. You should be able to multiply any number < 100 by 2 in your head");
        } else if (result[1] == -2){
          logger.info("Multiplication of " + result[0] + " by 2 is can not be accomplished in " + timeout + " seconds");
        } else {
          logger.info("Result of multiplication of " + result[0] + " by 2 is " + result[1]);
        }
      });
    }
    executor.shutdown();
    executor.awaitTermination(60, TimeUnit.SECONDS);
    logger.info("Finished");
    ac.close();
  }
View Full Code Here


                fileTarget=target;

        if(fileTarget==null)
            throw new FileNotFoundException();

        ApplicationContext ctx=new FileSystemXmlApplicationContext(
            fileTarget
        );

        basekbNowFlow=ctx.getBean("basekbNowFlow",Flow.class);
    }
View Full Code Here

        // file based
        if (getFileApplicationContextUri() != null) {
            String[] args = getFileApplicationContextUri().split(";");

            if (parentContext != null) {
                return new FileSystemXmlApplicationContext(args, parentContext);
            } else {
                return new FileSystemXmlApplicationContext(args);
            }
        }

        // default to classpath based
        String[] args = getApplicationContextUri().split(";");
View Full Code Here

        if (getFileApplicationContextUri() != null) {
            String[] args = getFileApplicationContextUri().split(";");

            ApplicationContext parentContext = getParentApplicationContext();
            if (parentContext != null) {
                return new FileSystemXmlApplicationContext(args, parentContext);
            } else {
                return new FileSystemXmlApplicationContext(args);
            }
        }
       
        // default to classpath based
        String[] args = getApplicationContextUri().split(";");
View Full Code Here

        if (getFileApplicationContextUri() != null) {
            String[] args = getFileApplicationContextUri().split(";");

            ApplicationContext parentContext = getParentApplicationContext();
            if (parentContext != null) {
                return new FileSystemXmlApplicationContext(args, parentContext);
            } else {
                return new FileSystemXmlApplicationContext(args);
            }
        }

        // default to classpath based
        String[] args = getApplicationContextUri().split(";");
View Full Code Here

    }

    @Override
    protected void setUp() throws Exception {
        super.setUp();
        applicationContext = new FileSystemXmlApplicationContext("src/main/webapp/WEB-INF/applicationContext.xml");
        applicationContext.start();
        camelContext = (CamelContext) applicationContext.getBean("camelContext", CamelContext.class);
        assertNotNull("camelContext", camelContext);
    }
View Full Code Here

            if (!"".equals(nrOfCallsString)) {
                nrOfCalls = Integer.parseInt(nrOfCallsString);
            }

            ListableBeanFactory beanFactory = new FileSystemXmlApplicationContext("clientContext.xml");
            ClientApplication client = new ClientApplication(beanFactory);

            client.invokeContactManager(new UsernamePasswordAuthenticationToken(username, password), nrOfCalls);
            System.exit(0);
        }
View Full Code Here

 
  public boolean start() {
    if (ctx != null)
      IocInterceptor.ctx = ctx;
    else if (configurations != null)
      IocInterceptor.ctx = new FileSystemXmlApplicationContext(configurations);
    else
      IocInterceptor.ctx = new FileSystemXmlApplicationContext(PathKit.getWebRootPath() + "/WEB-INF/applicationContext.xml");
    return true;
  }
View Full Code Here

        if (getFileApplicationContextUri() != null) {
            String[] args = getFileApplicationContextUri().split(";");

            ApplicationContext parentContext = getParentApplicationContext();
            if (parentContext != null) {
                return new FileSystemXmlApplicationContext(args, parentContext);
            } else {
                return new FileSystemXmlApplicationContext(args);
            }
        }

        // default to classpath based
        String[] args = getApplicationContextUri().split(";");
View Full Code Here

public class TestBatchingAuditTrail {
 
 

  public static void main(String[] args) throws Exception {
    final ApplicationContext ctx = new FileSystemXmlApplicationContext("src/test/resources/persistent-engine-application-context.xml");
    AuditTrail auditTrail = ctx.getBean(AuditTrail.class);
    for (int i=0; i<100; i++) {
      auditTrail.asynchLog(2, new Date(), "conv12345678901234567890123456789012", "ctx", "proc12345678901234567890123456789012", "corr12345678901234567890123456789012", null, "TEXT", "testMessage");
    }
    Thread.sleep(2000);
   
View Full Code Here

TOP

Related Classes of org.springframework.context.support.FileSystemXmlApplicationContext

Copyright © 2018 www.massapicom. 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.