1 4 package com.tctest.spring.integrationtests.tests; 5 6 import com.tctest.spring.bean.FooService; 7 import com.tctest.spring.integrationtests.framework.AbstractTwoServerDeploymentTest; 8 import com.tctest.spring.integrationtests.framework.DeploymentBuilder; 9 10 import junit.extensions.TestSetup; 11 import junit.framework.Test; 12 13 20 23 public class SingletonReferencingProxiedBeanTest extends AbstractTwoServerDeploymentTest { 24 25 private static final String FOO_SERVICE_NAME = "FooService"; 26 private static final String BAR_SERVICE_NAME = "BarService"; 27 private static final String BEAN_DEFINITION_FILE_FOR_TEST = "classpath:/com/tctest/spring/beanfactory-proxiedbean.xml"; 28 private static final String CONFIG_FILE_FOR_TEST = "/tc-config-files/proxiedbean-tc-config.xml"; 29 30 private static FooService bar1; 31 private static FooService bar2; 32 33 public void testProxiedBean() throws Exception { 34 logger.debug("testing proxied bean"); 35 assertEquals("0-barAndinterceptorInvoked-rawValue-0", bar1.serviceMethod()); 36 assertEquals("1-barAndinterceptorInvoked-rawValue-0", bar2.serviceMethod()); 37 } 38 39 private static class InnerTestSetup extends TwoSvrSetup { 40 41 private InnerTestSetup() { 42 super(SingletonReferencingProxiedBeanTest.class, CONFIG_FILE_FOR_TEST, "test-proxiedbean"); 43 } 44 45 protected void setUp() throws Exception { 46 super.setUp(); 47 bar1 = (FooService) server1.getProxy(FooService.class, BAR_SERVICE_NAME); 48 bar2 = (FooService) server2.getProxy(FooService.class, BAR_SERVICE_NAME); 49 } 50 51 protected void configureWar(DeploymentBuilder builder) { 52 builder.addBeanDefinitionFile(BEAN_DEFINITION_FILE_FOR_TEST); 53 builder.addRemoteService(BAR_SERVICE_NAME, "service", FooService.class); 54 builder.addRemoteService(FOO_SERVICE_NAME, "innerService", FooService.class); 55 } 56 } 57 58 61 public static Test suite() { 62 TestSetup setup = new InnerTestSetup(); 63 return setup; 64 } 65 66 } 67 | Popular Tags |