1 17 package org.alfresco.util.exec; 18 19 import java.io.File ; 20 21 import junit.framework.TestCase; 22 23 import org.springframework.context.ApplicationContext; 24 import org.springframework.context.event.ContextClosedEvent; 25 import org.springframework.context.support.ClassPathXmlApplicationContext; 26 27 32 public class RuntimeExecBeansTest extends TestCase 33 { 34 private static final String APP_CONTEXT_XML = 35 "classpath:org/alfresco/util/exec/RuntimeExecBeansTest-context.xml"; 36 private static final String DIR = "dir_RuntimeExecBootstrapBeanTest"; 37 38 public void testBootstrapAndShutdown() throws Exception 39 { 40 File dir = new File (DIR); 41 dir.mkdir(); 42 assertTrue("Directory not created", dir.exists()); 43 44 ApplicationContext ctx = new ClassPathXmlApplicationContext(APP_CONTEXT_XML); 46 47 assertFalse("Folder was not deleted by bootstrap", dir.exists()); 49 50 dir.mkdir(); 52 assertTrue("Directory not created", dir.exists()); 53 54 ctx.publishEvent(new ContextClosedEvent(ctx)); 56 57 assertFalse("Folder was not deleted by shutdown", dir.exists()); 59 } 60 } 61 | Popular Tags |