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.tctest.spring.bean.SingletonWithTransientField;
15:
16: /**
17: * Test for JIRA issue LKC-1490 Unfortunately, it does not fail.
18: */
19:
20: public class SingletonWithTransientBooleanField_Test extends
21: SimpleTransparentTestBase {
22:
23: public SingletonWithTransientBooleanField_Test() {
24: //
25: }
26:
27: protected int getNodeCount() {
28: return 1;
29: }
30:
31: protected Class getApplicationClass() {
32: return SingletonApp.class;
33: }
34:
35: public static class SingletonApp extends
36: AbstractSimpleTransparentApp {
37: public SingletonApp(String appId, ApplicationConfig cfg,
38: ListenerProvider listenerProvider) {
39: super (appId, cfg, listenerProvider);
40: }
41:
42: protected void doIt() {
43: ClassPathXmlApplicationContext ctx1 = new ClassPathXmlApplicationContext(
44: "com/tctest/spring/beanfactory-transientField.xml");
45:
46: SingletonWithTransientField singleton1 = (SingletonWithTransientField) ctx1
47: .getBean("service");
48: assertTrue(singleton1.isTransientValue());
49: assertDistributed(ctx1, "service", singleton1);
50:
51: moveToStageAndWait(1);
52: singleton1.setTransientValue(false);
53: moveToStageAndWait(2);
54:
55: assertFalse(singleton1.isTransientValue());
56:
57: }
58:
59: public static void visitL1DSOConfig(ConfigVisitor visitor,
60: DSOClientConfigHelper config) {
61: DSOSpringConfigHelper springConfig = new StandardDSOSpringConfigHelper();
62: springConfig
63: .addApplicationNamePattern(SpringTestConstants.APPLICATION_NAME); // app name used by testing framework
64: springConfig
65: .addConfigPattern("*/beanfactory-transientField.xml");
66: springConfig.addBean("service");
67: springConfig.excludeField("service", "transientValue");
68: config.addDSOSpringConfig(springConfig);
69:
70: config.addIncludePattern(
71: "com.tctest.spring.bean.SimpleListener", true,
72: true, false);
73: config
74: .addIncludePattern(
75: "com.tctest.spring.bean.SingletonWithTransientField",
76: true, false, false);
77: config
78: .addIncludePattern(
79: "com.tctest.spring.bean.BaseSingletonWithTransientField",
80: true, false, false);
81:
82: }
83:
84: }
85: }
|