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.AbstractTwoServerDeploymentTest;
07: import com.tc.test.server.appserver.deployment.DeploymentBuilder;
08: import com.tctest.spring.bean.FooService;
09: import com.tctest.spring.integrationtests.SpringTwoServerTestSetup;
10:
11: import junit.framework.Test;
12:
13: /**
14: * Verify that an interceptor is applied via a postprocessor to a distributed bean
15: */
16: public class InterceptorAppliedViaPostprocessorTest extends
17: AbstractTwoServerDeploymentTest {
18:
19: private static final String REMOTE_SERVICE_NAME = "FooService";
20: private static final String BEAN_DEFINITION_FILE_FOR_TEST = "classpath:/com/tctest/spring/interceptor-via-postprocessor.xml";
21: private static final String CONFIG_FILE_FOR_TEST = "/tc-config-files/interceptor-via-postprocessor-tc-config.xml";
22:
23: private FooService singleton1;
24: private FooService singleton2;
25:
26: protected void setUp() throws Exception {
27: super .setUp();
28:
29: singleton1 = (FooService) server0.getProxy(FooService.class,
30: REMOTE_SERVICE_NAME);
31: singleton2 = (FooService) server1.getProxy(FooService.class,
32: REMOTE_SERVICE_NAME);
33: }
34:
35: public void testInterceptor() throws Exception {
36: assertEquals("interceptorInvoked-rawValue-0", singleton1
37: .serviceMethod());
38: assertEquals("interceptorInvoked-rawValue-1", singleton2
39: .serviceMethod());
40: }
41:
42: private static class TS extends SpringTwoServerTestSetup {
43: private TS() {
44: super (InterceptorAppliedViaPostprocessorTest.class,
45: CONFIG_FILE_FOR_TEST, "test-interceptor");
46: }
47:
48: protected void configureWar(DeploymentBuilder builder) {
49: builder
50: .addBeanDefinitionFile(BEAN_DEFINITION_FILE_FOR_TEST);
51: builder.addRemoteService(REMOTE_SERVICE_NAME, "service",
52: FooService.class);
53: }
54:
55: }
56:
57: public static Test suite() {
58: return new TS();
59: }
60:
61: }
|