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.integrationtests.tests;
05:
06: import com.tc.test.server.appserver.deployment.Server;
07: import com.tctest.spring.bean.ISingleton;
08:
09: import junit.framework.Assert;
10:
11: public class SingletonStateUtil {
12:
13: public static void assertSingletonShared(Server server1,
14: Server server2, String remoteServiceName) throws Exception {
15: ISingleton singleton1 = (ISingleton) server1.getProxy(
16: ISingleton.class, remoteServiceName);
17: ISingleton singleton2 = (ISingleton) server2.getProxy(
18: ISingleton.class, remoteServiceName);
19: Assert.assertEquals(singleton1.getCounter(), singleton2
20: .getCounter());
21: singleton1.incrementCounter();
22: Assert.assertEquals("Should be shared",
23: singleton1.getCounter(), singleton2.getCounter());
24: singleton2.incrementCounter();
25: Assert.assertEquals("Should be shared",
26: singleton2.getCounter(), singleton1.getCounter());
27: }
28:
29: }
|