예제 #1
0
  @Test
  public void test() {
    final TestSvc test = (TestSvc) context.getBean("testSvc");

    // *AssignCache assignments are not very dynamic by their very nature.
    // Take care to invalidate the caches before each of the *AssignCache tests
    test.invalidateL2AssignIndia(System.currentTimeMillis());

    // Set the first cached datum
    final String orig = test.getL2AssignGolf(999L, RandomStringUtils.randomAlphabetic(4) + "-");

    // Make sure the value is definitely in there
    for (int ix = 0; ix < 3; ix++) {
      assertEquals(
          orig,
          test.getL2AssignGolf(1000L + ix, RandomStringUtils.randomAlphanumeric(4 + ix) + "-"));
    }

    // Force the update to happen.
    final String renew =
        test.getL2AssignHotel(
            System.currentTimeMillis(), RandomStringUtils.randomAlphanumeric(8) + "-");
    assertFalse(orig.equals(renew));

    // Make sure the NEW value is definitely in there
    for (int ix = 0; ix < 3; ix++) {
      assertEquals(
          renew,
          test.getL2AssignGolf(1000L + ix, RandomStringUtils.randomAlphanumeric(8 + ix) + "-"));
    }
  }
예제 #2
0
파일: TheBeanFactory.java 프로젝트: cer/pia
 public static ApplicationContext getApplicationContext(String selector, String factoryKey) {
   if (selector == null) selector = "configurations/default-spring-context.xml";
   if (factoryKey == null) factoryKey = "spring-context.xml";
   BeanFactoryReference reference =
       ContextSingletonBeanFactoryLocator.getInstance(
               System.getProperty("spring.configuration", selector))
           .useBeanFactory(factoryKey);
   BeanFactory beanFactory = reference.getFactory();
   return (ApplicationContext) beanFactory;
 }
예제 #3
0
파일: TheBeanFactory.java 프로젝트: cer/pia
 public static Object getBean(String selector, String factoryKey, String name, Class type) {
   if (selector == null) selector = "configurations/default-spring-context.xml";
   if (factoryKey == null) factoryKey = "spring-context.xml";
   BeanFactoryReference reference =
       ContextSingletonBeanFactoryLocator.getInstance(
               System.getProperty("spring.configuration", selector))
           .useBeanFactory(factoryKey);
   BeanFactory beanFactory = reference.getFactory();
   return beanFactory.getBean(name, type);
 }