1 4 package com.tctest.spring.integrationtests.tests; 5 6 import com.tctest.spring.bean.ISingleton; 7 import com.tctest.spring.integrationtests.framework.Server; 8 9 import junit.framework.Assert; 10 11 public class SingletonStateUtil { 12 13 public static void assertSingletonShared(Server server1, Server server2, String remoteServiceName) throws Exception { 14 ISingleton singleton1 = (ISingleton) server1.getProxy(ISingleton.class, remoteServiceName); 15 ISingleton singleton2 = (ISingleton) server2.getProxy(ISingleton.class, remoteServiceName); 16 Assert.assertEquals(singleton1.getCounter(), singleton2.getCounter()); 17 singleton1.incrementCounter(); 18 Assert.assertEquals("Should be shared", singleton1.getCounter(), singleton2.getCounter()); 19 singleton2.incrementCounter(); 20 Assert.assertEquals("Should be shared", singleton2.getCounter(), singleton1.getCounter()); 21 } 22 23 } 24 | Popular Tags |