4243444546474849
assertEquals(calculator.add(3, 2), 5.0, 0); assertEquals(calculator.subtract(3, 2), 1.0, 0); assertEquals(calculator.multiply(3, 2), 6.0, 0); assertEquals(calculator.divide(3, 2), 1.5, 0); node.stop(); } }
6162636465666768697071
Properties props = new Properties(); props.setProperty(RuntimeProperties.QUIET_LOGGING, "true"); NodeFactory nf = NodeFactory.newInstance(props); Node node = nf.createNode(); node.start(); node.stop(); // This doesn't actually check the logging yet, need to figure out a // way to get the log output so for now has to be run manually Assert.assertEquals(0 , logRecords.size());
219220221222223224225226227228229
public void testAutoDestroy() throws Exception { NodeFactory nf = NodeFactory.newInstance(); Node node = nf.createNode(); node.start(); Assert.assertTrue(((NodeFactoryImpl)nf).inited); node.stop(); Assert.assertFalse(((NodeFactoryImpl)nf).inited); nf = NodeFactory.newInstance(); nf.setAutoDestroy(false); node = nf.createNode();
227228229230231232233234235236
nf = NodeFactory.newInstance(); nf.setAutoDestroy(false); node = nf.createNode(); node.start(); Assert.assertTrue(((NodeFactoryImpl)nf).inited); node.stop(); Assert.assertTrue(((NodeFactoryImpl)nf).inited); } }
274275276277278279280281282283284
} public static void stop(ServletContext servletContext) { Node node = (Node)servletContext.getAttribute(SCA_NODE_ATTRIBUTE); if (node != null) { node.stop(); servletContext.setAttribute(SCA_NODE_ATTRIBUTE, null); } } public static NodeFactory getNodeFactory() {
3637383940414243
Node node = NodeFactory.newInstance().createNode("org/apache/tuscany/sca/binding/atom/Consumer.composite",new Contribution("c1", contribution)); CustomerClient testService = node.getService(CustomerClient.class, "CustomerClient"); testService.testCustomerCollection(); node.stop(); } }
525354555657585960
if (result != 5.0){ throw new SampleLauncherException(); } node1.stop(); node2.stop(); } }
515253545556575859
System.out.println("3 + 2 = " + result); if (result != 5.0){ throw new SampleLauncherException(); } node.stop(); } }
383940414243444546
public void launchImplementationJavaCalculator(){ Node node = NodeFactory.newInstance().createNode(new Contribution("c1", "../../learning-more/implementation-java/calculator-contribution/target/sample-implementation-java-calculator-contribution.jar")); node.start(); node.stop(); } }