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;
05:
06: import org.springframework.beans.factory.BeanFactory;
07:
08: import com.tc.test.TestConfigObject;
09: import com.tc.test.server.appserver.deployment.DeploymentBuilder;
10: import com.tc.test.server.appserver.deployment.FileSystemPath;
11: import com.tc.test.server.appserver.deployment.TempDirectoryUtil;
12: import com.tc.test.server.appserver.deployment.WARBuilder;
13: import com.tctest.spring.bean.ISingleton;
14:
15: import junit.framework.TestCase;
16:
17: public class WARBuilderTest extends TestCase {
18:
19: public void test() throws Exception {
20: DeploymentBuilder builder = new WARBuilder("foo.war",
21: TempDirectoryUtil.getTempDirectory(getClass()),
22: TestConfigObject.getInstance());
23: populateWAR(builder);
24: builder.makeDeployment();
25: }
26:
27: public void testAnonymous() throws Exception {
28: DeploymentBuilder builder = new WARBuilder(TempDirectoryUtil
29: .getTempDirectory(getClass()), TestConfigObject
30: .getInstance());
31: populateWAR(builder);
32: builder.makeDeployment();
33: }
34:
35: private void populateWAR(DeploymentBuilder builder) {
36: builder
37: .addBeanDefinitionFile("classpath:/com/tctest/spring/beanfactory.xml");
38: builder.addRemoteService("Singleton", "singleton",
39: ISingleton.class);
40: builder.addDirectoryOrJARContainingClass(getClass());
41: builder
42: .addDirectoryContainingResource("/tc-config-files/singleton-tc-config.xml");
43: }
44:
45: public void testCalculatePathToDir() {
46: FileSystemPath path = WARBuilder
47: .calculatePathToClass(getClass());
48: assertNotNull(path);
49: }
50:
51: // public void testCalculatePathToDirProvidingString() {
52: // String pathString = "C:\\repos\\kirkham\\code\\base\\dso-spring-tests\\build.eclipse\\tests.base.classes;C:\\workspace\\tc-main\\test;C:\\repos\\kirkham\\code\\base\\aspectwerkz\\lib\\ant.jar;C:\\repos\\kirkham\\code\\base\\dso-spring\\lib\\spring-1.2.8.jar";
53: // String pathString = "C:/repos/kirkham/code/base/dso-spring/lib.abc.1.2.3/spring-1.2.8.jar";
54: // String pathString = "C:/repos/kirkham/code/base/dso-spring-tests/build.eclipse/tests.base.classes;C:/workspace/tc-main/test;C:/repos/kirkham/code/base/aspectwerkz/lib/ant.jar;C:/repos/kirkham/code/base/dso-spring/lib/spring-1.2.8.jar";
55: // FileSystemPath path = WARBuilder.calculatePathToClass(org.springframework.beans.factory.BeanFactory.class, pathString);
56: // assertNotNull(path);
57: // }
58:
59: public void testCalculatePathToJar() {
60: FileSystemPath path = WARBuilder
61: .calculatePathToClass(BeanFactory.class);
62: assertNotNull(path);
63: }
64: }
|