1 7 package org.jboss.remoting.callback.pull.memory.nullstore; 8 9 import junit.framework.Test; 10 import junit.framework.TestSuite; 11 import junit.textui.TestRunner; 12 import org.jboss.dtf.DistributedTestCase; 13 import org.jgroups.Address; 14 15 import java.io.IOException ; 16 import java.util.ArrayList ; 17 import java.util.Iterator ; 18 import java.util.List ; 19 20 28 public class NullStoreCallbackTestCase extends DistributedTestCase 29 { 30 private List results = new ArrayList (); 31 32 public NullStoreCallbackTestCase(String name) 33 { 34 super(name); 35 } 36 37 protected void setUp() throws Exception 38 { 39 new Thread () 40 { 41 42 public void run() 43 { 44 String clientcmd = "java -cp " + System.getProperty("java.class.path") + 45 " " + CallbackTestClient.class.getName() + " 3"; 47 System.out.println("clientcmd: " + clientcmd); 48 String svrcmd = "java -cp " + System.getProperty("java.class.path") + 49 " " + CallbackTestServer.class.getName() + " 3"; 51 System.out.println("svrcmd: " + svrcmd); 52 53 try 54 { 55 final Process local = Runtime.getRuntime().exec(clientcmd); 56 final Process remote = Runtime.getRuntime().exec(svrcmd); 57 } 58 catch(IOException e) 59 { 60 e.printStackTrace(); 61 } 62 } 63 }.start(); 64 } 65 66 protected void tearDown() throws Exception 67 { 68 } 70 71 public void testInvokers() 72 { 73 try 74 { 75 startup(3); 76 System.out.println("startup() called"); 77 shutdown(); 78 System.out.println("shutdown() called"); 79 } 80 catch(Exception e) 81 { 82 e.printStackTrace(); 83 assertTrue("Problem starting or stopping client/server processes.", false); 84 } 85 finally 86 { 87 try 89 { 90 Thread.currentThread().sleep(5000); 91 } 92 catch(InterruptedException e) 93 { 94 e.printStackTrace(); 95 } 96 System.out.println("results.size() = " + results.size()); 97 if(results.size() > 0) 98 { 99 Iterator itr = results.iterator(); 100 while(itr.hasNext()) 101 { 102 String message = (String ) itr.next(); 103 assertTrue(message, false); 104 } 105 } 106 else 107 { 108 assertTrue("No test failures or errors.", true); 109 } 110 111 } 112 } 113 114 119 public void receiveAssert(Address source, String message) 120 { 121 super.receiveAssert(source, message); 122 results.add("Assert source: " + source + "\tmessage: " + message); 123 } 124 125 public static Test suite() 126 { 127 return new TestSuite(NullStoreCallbackTestCase.class); 128 } 129 130 public static void main(String [] args) 131 { 132 TestRunner.run(suite()); 133 System.exit(0); 134 } 135 136 137 } | Popular Tags |