KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tctest > spring > InvalidBeanDefinition_Test


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tctest.spring;
5
6 import org.springframework.beans.factory.BeanCreationException;
7 import org.springframework.context.support.ClassPathXmlApplicationContext;
8
9 import com.tc.object.config.ConfigVisitor;
10 import com.tc.object.config.DSOClientConfigHelper;
11 import com.tc.object.config.DSOSpringConfigHelper;
12 import com.tc.object.config.StandardDSOSpringConfigHelper;
13 import com.tc.simulator.app.ApplicationConfig;
14 import com.tc.simulator.listener.ListenerProvider;
15
16 /**
17  * Spring singleton test
18  */

19 public class InvalidBeanDefinition_Test extends SimpleTransparentTestBase {
20
21   public InvalidBeanDefinition_Test() {
22     disableAllUntil("2008-01-01");
23   }
24
25   protected int getNodeCount() {
26     return 1;
27   }
28
29   protected Class JavaDoc getApplicationClass() {
30     return SingletonApp.class;
31   }
32
33   public static class SingletonApp extends AbstractSimpleTransparentApp {
34     public SingletonApp(String JavaDoc appId, ApplicationConfig cfg, ListenerProvider listenerProvider) {
35       super(appId, cfg, listenerProvider);
36     }
37
38     protected void doIt() {
39
40       try {
41         ClassPathXmlApplicationContext ctx1 = new ClassPathXmlApplicationContext(
42             "com/tctest/spring/beanfactory-interceptor-with-error.xml");
43         assertDistributed(ctx1, "service", ctx1.getBean("service"));
44         fail("expected BeanCreationException");
45       } catch (BeanCreationException e) {
46         // expected
47
}
48     }
49
50     public static void visitL1DSOConfig(ConfigVisitor visitor, DSOClientConfigHelper config) {
51       DSOSpringConfigHelper springConfig = new StandardDSOSpringConfigHelper();
52       springConfig.addApplicationNamePattern(SpringTestConstants.APPLICATION_NAME); // app name used by testing framework
53
springConfig.addConfigPattern("*/beanfactory-interceptor-with-error.xml");
54       springConfig.addBean("service");
55
56       config.addDSOSpringConfig(springConfig);
57
58       config.addIncludePattern("com.tctest.spring.bean.SimpleListener", true, true, false);
59       config.addIncludePattern("com.tctest.spring.bean.BarServiceImpl", true, true, false);
60       config.addIncludePattern("com.tctest.spring.bean.FooServiceImpl", true, true, false);
61
62     }
63
64   }
65 }
66
Popular Tags