KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tctest > spring > SingletonReferencingProxiedBean_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.context.support.ClassPathXmlApplicationContext;
7
8 import com.tc.object.config.ConfigVisitor;
9 import com.tc.object.config.DSOClientConfigHelper;
10 import com.tc.object.config.DSOSpringConfigHelper;
11 import com.tc.object.config.StandardDSOSpringConfigHelper;
12 import com.tc.simulator.app.ApplicationConfig;
13 import com.tc.simulator.listener.ListenerProvider;
14 import com.tctest.spring.bean.FooService;
15
16 /**
17  * Test attempted to reproduce JIRA issue LKC-1435 where proxies "disappear" when
18  * distributed bean references a proxied non-distributed bean.
19  */

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