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 16 public class InterceptorAppliedViaPostprocessorTest extends AbstractTwoServerDeploymentTest { 17 18 private static final String REMOTE_SERVICE_NAME = "FooService"; 19 private static final String BEAN_DEFINITION_FILE_FOR_TEST = "classpath:/com/tctest/spring/interceptor-via-postprocessor.xml"; 20 private static final String CONFIG_FILE_FOR_TEST = "/tc-config-files/interceptor-via-postprocessor-tc-config.xml"; 21 22 private static FooService singleton1; 23 private static FooService singleton2; 24 25 public void testInterceptor() throws Exception { 26 27 assertEquals("interceptorInvoked-rawValue-0", singleton1.serviceMethod()); 28 assertEquals("interceptorInvoked-rawValue-1", singleton2.serviceMethod()); 29 30 } 31 32 private static class TS extends TwoSvrSetup { 33 private TS() { 34 super(InterceptorAppliedViaPostprocessorTest.class, CONFIG_FILE_FOR_TEST, "test-interceptor"); 35 } 36 37 protected void setUp() throws Exception { 38 super.setUp(); 39 40 singleton1 = (FooService) server1.getProxy(FooService.class, REMOTE_SERVICE_NAME); 41 singleton2 = (FooService) server2.getProxy(FooService.class, REMOTE_SERVICE_NAME); 42 } 43 44 protected void configureWar(DeploymentBuilder builder) { 45 builder.addBeanDefinitionFile(BEAN_DEFINITION_FILE_FOR_TEST); 46 builder.addRemoteService(REMOTE_SERVICE_NAME, "service", FooService.class); 47 } 48 49 } 50 51 54 public static Test suite() { 55 TestSetup setup = new TS(); 56 return setup; 57 } 58 59 } 60 | Popular Tags |