Package org.springframework.beans

Examples of org.springframework.beans.ITestBean


    TestBean bean = (TestBean) this.beanFactory.getBean("customisedTestBean");
    assetTestBean(bean);
  }

  public void testProxyingDecorator() throws Exception {
    ITestBean bean = (ITestBean) this.beanFactory.getBean("debuggingTestBean");
    assetTestBean(bean);
    assertTrue(AopUtils.isAopProxy(bean));
    Advisor[] advisors = ((Advised) bean).getAdvisors();
    assertEquals("Incorrect number of advisors", 1, advisors.length);
    assertEquals("Incorrect advice class.", DebugInterceptor.class, advisors[0].getAdvice().getClass());
View Full Code Here


    int count = (new PropertiesBeanDefinitionReader(lbf)).registerBeanDefinitions(p, PREFIX);
    assertTrue("2 beans registered, not " + count, count == 2);

    TestBean kerry = (TestBean) lbf.getBean("kerry", TestBean.class);
    assertTrue("Kerry name is Kerry", "Kerry".equals(kerry.getName()));
    ITestBean spouse = kerry.getSpouse();
    assertTrue("Kerry spouse is non null", spouse != null);
    assertTrue("Kerry spouse name is Rod", "Rod".equals(spouse.getName()));
  }
View Full Code Here

    bw.setPropertyValues(pvs);
    assertTrue("spouse is non-null", tb.getSpouse() != null);
    assertTrue("spouse name is Kerry and age is 34",
        tb.getSpouse().getName().equals("Kerry") && tb.getSpouse().getAge() == 34);
    ITestBean spouse = tb.getSpouse();

    bw.setPropertyValues(pvs);
    assertSame("Should have remained same object", spouse, tb.getSpouse());
  }
View Full Code Here

    assertEquals("Incorrect number of advisors", 1, advisors.length);
    assertEquals("Incorrect advice class.", DebugInterceptor.class, advisors[0].getAdvice().getClass());
  }

  public void testChainedDecorators() throws Exception {
    ITestBean bean = (ITestBean) this.beanFactory.getBean("chainedTestBean");
    assetTestBean(bean);
    assertTrue(AopUtils.isAopProxy(bean));
    Advisor[] advisors = ((Advised) bean).getAdvisors();
    assertEquals("Incorrect number of advisors", 2, advisors.length);
    assertEquals("Incorrect advice class.", DebugInterceptor.class, advisors[0].getAdvice().getClass());
View Full Code Here

    assertTrue(drs.containsKey(DummyReferencer.class.getName() + "#1"));
    assertTrue(drs.containsKey(DummyReferencer.class.getName() + "#2"));
  }

  public void testFactoryNesting() {
    ITestBean father = (ITestBean) getBeanFactory().getBean("father");
    assertTrue("Bean from root context", father != null);

    TestBean rod = (TestBean) getBeanFactory().getBean("rod");
    assertTrue("Bean from child context", "Rod".equals(rod.getName()));
    assertTrue("Bean has external reference", rod.getSpouse() == father);
View Full Code Here

    resetInterceptor();
  }

  public void testAutoProxiedLookup() {
    OverloadLookup olup = (OverloadLookup) applicationContext.getBean("autoProxiedOverload");
    ITestBean jenny = olup.newTestBean();
    assertEquals("Jenny", jenny.getName());
    assertEquals("foo", olup.testMethod());
    assertInterceptorCount(2);
  }
View Full Code Here

    assertInterceptorCount(2);
  }

  public void testRegularlyProxiedLookup() {
    OverloadLookup olup = (OverloadLookup) applicationContext.getBean("regularlyProxiedOverload");
    ITestBean jenny = olup.newTestBean();
    assertEquals("Jenny", jenny.getName());
    assertEquals("foo", olup.testMethod());
    assertInterceptorCount(2);
  }
View Full Code Here

    factory.setServiceUrl("http://localhosta/testbean");
    factory.afterPropertiesSet();

    assertTrue("Correct singleton value", factory.isSingleton());
    assertTrue(factory.getObject() instanceof ITestBean);
    ITestBean bean = (ITestBean) factory.getObject();

    try {
      bean.setName("test");
      fail("Should have thrown RemoteAccessException");
    }
    catch (RemoteAccessException ex) {
      // expected
    }
View Full Code Here

    factory.setOverloadEnabled(true);
    factory.afterPropertiesSet();

    assertTrue("Correct singleton value", factory.isSingleton());
    assertTrue(factory.getObject() instanceof ITestBean);
    ITestBean bean = (ITestBean) factory.getObject();

    try {
      bean.setName("test");
      fail("Should have thrown RemoteAccessException");
    }
    catch (RemoteAccessException ex) {
      // expected
    }
View Full Code Here

    factory.setPassword("bean");
    factory.setOverloadEnabled(true);
    factory.afterPropertiesSet();
    assertTrue("Correct singleton value", factory.isSingleton());
    assertTrue(factory.getObject() instanceof ITestBean);
    ITestBean bean = (ITestBean) factory.getObject();

    assertEquals(proxyFactory.user, "test");
    assertEquals(proxyFactory.password, "bean");
    assertTrue(proxyFactory.overloadEnabled);

    try {
      bean.setName("test");
      fail("Should have thrown RemoteAccessException");
    }
    catch (RemoteAccessException ex) {
      // expected
    }
View Full Code Here

TOP

Related Classes of org.springframework.beans.ITestBean

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.