01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tctest.spring;
05:
06: import org.springframework.context.support.ClassPathXmlApplicationContext;
07:
08: import com.tc.object.config.ConfigVisitor;
09: 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.tc.util.runtime.Vm;
15: import com.tctest.spring.bean.FooService;
16:
17: import java.util.Date;
18:
19: /**
20: * Test attempted to reproduce JIRA issue LKC-1435 where proxies "disappear" when
21: * distributed bean references a proxied non-distributed bean.
22: */
23: public class SingletonReferencingProxiedBean_Test extends
24: SimpleTransparentTestBase {
25:
26: public SingletonReferencingProxiedBean_Test() {
27: if (Vm.isIBM()) {
28: disableAllUntil(new Date(Long.MAX_VALUE));
29: }
30: }
31:
32: protected int getNodeCount() {
33: return 3;
34: }
35:
36: protected Class getApplicationClass() {
37: return SingletonApp.class;
38: }
39:
40: public static class SingletonApp extends
41: AbstractSimpleTransparentApp {
42:
43: public SingletonApp(String appId, ApplicationConfig cfg,
44: ListenerProvider listenerProvider) {
45: super (appId, cfg, listenerProvider);
46: }
47:
48: protected void doIt() {
49: ClassPathXmlApplicationContext ctx1 = new ClassPathXmlApplicationContext(
50: "com/tctest/spring/beanfactory-interceptor2.xml");
51:
52: FooService singleton1 = (FooService) ctx1
53: .getBean("service");
54:
55: assertDistributed(ctx1, "service", singleton1);
56:
57: assertEquals("barAndinterceptorInvoked", singleton1
58: .serviceMethod());
59: }
60:
61: public static void visitL1DSOConfig(ConfigVisitor visitor,
62: DSOClientConfigHelper config) {
63: DSOSpringConfigHelper springConfig = new StandardDSOSpringConfigHelper();
64: springConfig
65: .addApplicationNamePattern(SpringTestConstants.APPLICATION_NAME); // app name used by testing framework
66: springConfig
67: .addConfigPattern("*/beanfactory-interceptor2.xml");
68: springConfig.addBean("service");
69: springConfig.excludeField("service", "serviceHelper");
70:
71: config.addDSOSpringConfig(springConfig);
72:
73: config.addIncludePattern(
74: "com.tctest.spring.bean.SimpleListener", true,
75: true, false);
76: config.addIncludePattern(
77: "com.tctest.spring.bean.BarServiceImpl", true,
78: true, false);
79: }
80:
81: }
82: }
|