KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tctest > spring > integrationtests > WARBuilderTest


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tctest.spring.integrationtests;
5
6 import org.springframework.beans.factory.BeanFactory;
7
8 import com.tc.test.TestConfigObject;
9 import com.tctest.spring.bean.ISingleton;
10 import com.tctest.spring.integrationtests.framework.DeploymentBuilder;
11 import com.tctest.spring.integrationtests.framework.FileSystemPath;
12 import com.tctest.spring.integrationtests.framework.TempDirectoryUtil;
13 import com.tctest.spring.integrationtests.framework.WARBuilder;
14
15 import junit.framework.TestCase;
16
17 public class WARBuilderTest extends TestCase {
18
19
20   public void test() throws Exception JavaDoc {
21     DeploymentBuilder builder = new WARBuilder("foo.war", TempDirectoryUtil.getTempDirectory(getClass()), TestConfigObject.getInstance());
22     populateWAR(builder);
23     builder.makeDeployment();
24   }
25
26   public void testAnonymous() throws Exception JavaDoc {
27     DeploymentBuilder builder = new WARBuilder(TempDirectoryUtil.getTempDirectory(getClass()), TestConfigObject.getInstance());
28     populateWAR(builder);
29     builder.makeDeployment();
30   }
31
32   private void populateWAR(DeploymentBuilder builder) {
33     builder.addBeanDefinitionFile("classpath:/com/tctest/spring/beanfactory.xml");
34     builder.addRemoteService("Singleton", "singleton", ISingleton.class);
35     builder.addDirectoryOrJARContainingClass(getClass());
36     builder.addDirectoryContainingResource("/tc-config-files/singleton-tc-config.xml");
37   }
38
39   public void testCalculatePathToDir() {
40     FileSystemPath path = WARBuilder.calculatePathToClass(getClass());
41     assertNotNull(path);
42   }
43
44 // public void testCalculatePathToDirProvidingString() {
45
// 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";
46
// String pathString = "C:/repos/kirkham/code/base/dso-spring/lib.abc.1.2.3/spring-1.2.8.jar";
47
// 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";
48
// FileSystemPath path = WARBuilder.calculatePathToClass(org.springframework.beans.factory.BeanFactory.class, pathString);
49
// assertNotNull(path);
50
// }
51

52   public void testCalculatePathToJar() {
53     FileSystemPath path = WARBuilder.calculatePathToClass(BeanFactory.class);
54     assertNotNull(path);
55   }
56 }
57
Popular Tags