1 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 { 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 { 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 52 public void testCalculatePathToJar() { 53 FileSystemPath path = WARBuilder.calculatePathToClass(BeanFactory.class); 54 assertNotNull(path); 55 } 56 } 57 | Popular Tags |