1 22 package org.jboss.ejb3.test.jca.inflow; 23 24 import javax.resource.spi.endpoint.MessageEndpoint ; 25 import javax.resource.spi.work.Work ; 26 import javax.resource.spi.work.WorkManager ; 27 28 34 public class TestResourceAdapterWorkManager 35 { 36 TestResourceAdapter adapter; 37 public TestResourceAdapterWorkManager(TestResourceAdapter adapter) 38 { 39 this.adapter = adapter; 40 } 41 42 public TestResourceAdapterWorkManagerResults run() throws Exception 43 { 44 TestResourceAdapterWorkManagerResults results = new TestResourceAdapterWorkManagerResults(); 45 try 46 { 47 basicTest(); 48 results.basicTest.pass(); 49 } 50 catch (Throwable t) 51 { 52 results.basicTest.fail(t); 53 } 54 55 return results; 56 } 57 58 public void basicTest() throws Exception 59 { 60 WorkManager wm = adapter.ctx.getWorkManager(); 61 TestWork work = new TestWork(); 62 wm.doWork(work); 63 if (work.complete == false) 64 throw new Exception ("Work was not done"); 65 } 66 67 public class TestWork implements Work 68 { 69 public boolean complete = false; 70 71 public void run() 72 { 73 complete = true; 74 } 75 76 public void release() 77 { 78 } 79 } 80 } 81 | Popular Tags |