1 17 package org.apache.servicemix.beanflow.util; 18 19 import org.apache.commons.logging.Log; 20 import org.apache.commons.logging.LogFactory; 21 import org.apache.servicemix.beanflow.annotations.Parallel; 22 23 27 public class ParallelTest extends ParallelTestCase { 29 private static final Log log = LogFactory.getLog(ParallelBeanWithSyncs.class); 30 31 private boolean methodOneSync1, methodOneSync2, methodTwoSync1, methodTwoSync2; 32 33 @Override 34 public void testParallelMethods() throws Exception { 35 super.testParallelMethods(); 36 37 assertTrue("Did not reach sync1 for methodOne", methodOneSync1); 38 assertTrue("Did not reach sync2 for methodOne", methodOneSync2); 39 assertTrue("Did not reach sync1 for methodTwo", methodTwoSync1); 40 assertTrue("Did not reach sync2 for methodTwo", methodTwoSync2); 41 } 42 43 @Parallel 44 public void methodOne() { 45 log.info("Called method one"); 46 sync(); 47 methodOneSync1 = true; 48 log.info("methodOne: after sync1"); 49 50 sleep(1000); 52 53 sync(); 54 methodOneSync2 = true; 55 log.info("methodOne: after sync2"); 56 } 57 58 @Parallel 59 public void methodTwo() { 60 log.info("Called method two"); 61 62 sleep(1000); 64 65 sync(); 66 methodTwoSync1 = true; 67 log.info("methodTwo: after sync1"); 68 69 sync(); 70 methodTwoSync2 = true; 71 log.info("methodTwo: after sync2"); 72 } 73 74 } 75 | Popular Tags |