Examples of ExpectedLookupTemplate


Examples of org.springframework.mock.jndi.ExpectedLookupTemplate

  }

  public void testLookupWithDefaultObjectAndExpectedTypeNoMatch() throws Exception {
    JndiObjectFactoryBean jof = new JndiObjectFactoryBean();
    String s = "";
    jof.setJndiTemplate(new ExpectedLookupTemplate("foo", s));
    jof.setJndiName("myFoo");
    jof.setExpectedType(String.class);
    jof.setDefaultObject(Boolean.TRUE);
    try {
      jof.afterPropertiesSet();
View Full Code Here

Examples of org.springframework.mock.jndi.ExpectedLookupTemplate

  }

  public void testLookupWithProxyInterface() throws Exception {
    JndiObjectFactoryBean jof = new JndiObjectFactoryBean();
    TestBean tb = new TestBean();
    jof.setJndiTemplate(new ExpectedLookupTemplate("foo", tb));
    jof.setJndiName("foo");
    jof.setProxyInterface(ITestBean.class);
    jof.afterPropertiesSet();
    assertTrue(jof.getObject() instanceof ITestBean);
    ITestBean proxy = (ITestBean) jof.getObject();
View Full Code Here

Examples of org.springframework.mock.jndi.ExpectedLookupTemplate

  }

  public void testLookupWithProxyInterfaceAndDefaultObject() throws Exception {
    JndiObjectFactoryBean jof = new JndiObjectFactoryBean();
    TestBean tb = new TestBean();
    jof.setJndiTemplate(new ExpectedLookupTemplate("foo", tb));
    jof.setJndiName("myFoo");
    jof.setProxyInterface(ITestBean.class);
    jof.setDefaultObject(Boolean.TRUE);
    try {
      jof.afterPropertiesSet();
View Full Code Here

Examples of org.springframework.mock.jndi.ExpectedLookupTemplate

  }

  public void testLookupWithProxyInterfaceAndExpectedTypeAndMatch() throws Exception {
    JndiObjectFactoryBean jof = new JndiObjectFactoryBean();
    TestBean tb = new TestBean();
    jof.setJndiTemplate(new ExpectedLookupTemplate("foo", tb));
    jof.setJndiName("foo");
    jof.setExpectedType(TestBean.class);
    jof.setProxyInterface(ITestBean.class);
    jof.afterPropertiesSet();
    assertTrue(jof.getObject() instanceof ITestBean);
View Full Code Here

Examples of org.springframework.mock.jndi.ExpectedLookupTemplate

  }

  public void testLookupWithProxyInterfaceAndExpectedTypeAndNoMatch() throws Exception {
    JndiObjectFactoryBean jof = new JndiObjectFactoryBean();
    TestBean tb = new TestBean();
    jof.setJndiTemplate(new ExpectedLookupTemplate("foo", tb));
    jof.setJndiName("foo");
    jof.setExpectedType(DerivedTestBean.class);
    jof.setProxyInterface(ITestBean.class);
    try {
      jof.afterPropertiesSet();
View Full Code Here

Examples of org.springframework.mock.jndi.ExpectedLookupTemplate

*/
public class WebSphereUowTransactionManagerTests extends TestCase {

  public void testUowManagerFoundInJndi() {
    MockUOWManager manager = new MockUOWManager();
    ExpectedLookupTemplate jndiTemplate =
        new ExpectedLookupTemplate(WebSphereUowTransactionManager.DEFAULT_UOW_MANAGER_NAME, manager);
    WebSphereUowTransactionManager ptm = new WebSphereUowTransactionManager();
    ptm.setJndiTemplate(jndiTemplate);
    ptm.afterPropertiesSet();

    DefaultTransactionDefinition definition = new DefaultTransactionDefinition();
View Full Code Here

Examples of org.springframework.mock.jndi.ExpectedLookupTemplate

    ut.commit();
    utControl.setVoidCallable(1);
    utControl.replay();

    MockUOWManager manager = new MockUOWManager();
    ExpectedLookupTemplate jndiTemplate = new ExpectedLookupTemplate();
    jndiTemplate.addObject(WebSphereUowTransactionManager.DEFAULT_USER_TRANSACTION_NAME, ut);
    jndiTemplate.addObject(WebSphereUowTransactionManager.DEFAULT_UOW_MANAGER_NAME, manager);
    WebSphereUowTransactionManager ptm = new WebSphereUowTransactionManager();
    ptm.setJndiTemplate(jndiTemplate);
    ptm.afterPropertiesSet();

    DefaultTransactionDefinition definition = new DefaultTransactionDefinition();
View Full Code Here

Examples of org.springframework.mock.jndi.ExpectedLookupTemplate

  public void testResourceInjectionFromJndi() {
    DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
    CommonAnnotationBeanPostProcessor bpp = new CommonAnnotationBeanPostProcessor();
    SimpleJndiBeanFactory resourceFactory = new SimpleJndiBeanFactory();
    ExpectedLookupTemplate jndiTemplate = new ExpectedLookupTemplate();
    TestBean tb = new TestBean();
    jndiTemplate.addObject("java:comp/env/testBean", tb);
    TestBean tb2 = new TestBean();
    jndiTemplate.addObject("java:comp/env/testBean2", tb2);
    resourceFactory.setJndiTemplate(jndiTemplate);
    bpp.setResourceFactory(resourceFactory);
    bf.addBeanPostProcessor(bpp);
    bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(ResourceInjectionBean.class));
View Full Code Here

Examples of org.springframework.tests.mock.jndi.ExpectedLookupTemplate

  @Test
  public void testLookupWithFullNameAndResourceRefTrue() throws Exception {
    JndiObjectFactoryBean jof = new JndiObjectFactoryBean();
    Object o = new Object();
    jof.setJndiTemplate(new ExpectedLookupTemplate("java:comp/env/foo", o));
    jof.setJndiName("java:comp/env/foo");
    jof.setResourceRef(true);
    jof.afterPropertiesSet();
    assertTrue(jof.getObject() == o);
  }
View Full Code Here

Examples of org.springframework.tests.mock.jndi.ExpectedLookupTemplate

  @Test
  public void testLookupWithFullNameAndResourceRefFalse() throws Exception {
    JndiObjectFactoryBean jof = new JndiObjectFactoryBean();
    Object o = new Object();
    jof.setJndiTemplate(new ExpectedLookupTemplate("java:comp/env/foo", o));
    jof.setJndiName("java:comp/env/foo");
    jof.setResourceRef(false);
    jof.afterPropertiesSet();
    assertTrue(jof.getObject() == o);
  }
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.