public void testThreadSafety() throws Exception { MessageContext mc = TestUtils.getTestContext("<randomNo/>", null); Random rand = new Random(); String randomno = Integer.toString(rand.nextInt(200)); mc.getEnvelope().getBody().getFirstElement().setText(randomno); ScriptMediator mediator = new ScriptMediator("js", threadsafetyscript); mediator.mediate(mc); assertEquals( Integer.parseInt(mc.getEnvelope().getBody().getFirstElement().getText()), Integer.parseInt(randomno) * 2); }
public void testInlineMediator() throws Exception { MessageContext mc = TestUtils.getTestContext("<foo/>", null); ScriptMediator mediator = new ScriptMediator("js", inlinescript); assertTrue(mediator.mediate(mc)); }