Package calculator

Examples of calculator.CalculatorService


       
        // launcher.launchBindingWSCalculator();
       
        Node node = launcher.startNode(new Contribution("c1", "../../learning-more/binding-ws/calculator-contribution/target/sample-binding-ws-calculator-contribution.jar"));
       
        CalculatorService calculator = node.getService(CalculatorService.class, "CalculatorServiceComponent");
              
        double result = calculator.add(3, 2);
        System.out.println("3 + 2 = " + result);
        if (result != 5.0){
            throw new SampleLauncherException();
        }
       
View Full Code Here


     * Using a Tuscany specific mechanism for getting at local service proxies
     */
    public void launchBindingWSCalculator() throws NoSuchDomainException, NoSuchServiceException{
        Node node = startNode(new Contribution("c1", "../../learning-more/binding-ws/contribution-calculator/target/sample-contribution-binding-ws-calculator.jar"));
       
        CalculatorService calculator = node.getService(CalculatorService.class, "CalculatorServiceComponent");
              
        double result = calculator.add(3, 2);
        System.out.println("3 + 2 = " + result);
        if (result != 5.0){
            throw new SampleLauncherException();
        }
       
View Full Code Here

    private void testCalcCombo(String args[]) {
        System.out.println("\n\n***************************************");
        System.out.println("Starting the Calculator Combo sample!!!");
        System.out.println("***************************************");
        CompositeContext context = CurrentCompositeContext.getContext();
        CalculatorService calculatorService =
            (CalculatorService)context.locateService(CalculatorService.class, "CalculatorServiceComponent");
        System.out.println("\nInvoking Java Implementation ... ");
        System.out.println((new StringBuilder()).append("3 + 2 = ").append(calculatorService.add(3D, 2D))
            .toString());
        System.out.println("\nInvoking Ruby Implementation ... ");
        System.out.println((new StringBuilder()).append("3 - 2 = ")
            .append(calculatorService.subtract(3D, 2D)).toString());
        System.out.println("\nInvoking over RMI Reference... ");
        System.out.println((new StringBuilder()).append("3 * 2 = ")
            .append(calculatorService.multiply(3D, 2D)).toString());
        System.out.println("\nInvoking WebService Implementation ... ");
        System.out.println((new StringBuilder()).append("3 / 2 = ").append(calculatorService.divide(3D, 2D))
            .toString());
        System.out.println("\nInvoking Scientific Calculator Composite Implementation ... ");
        SciCalculatorService sciCalculator =
            (SciCalculatorService)context.locateService(SciCalculatorService.class, "sciCalculatorService");
        double values[] = {1.0D, 2D, 3D, 4D, 5D, 6D, 7D, 8D, 9D};
View Full Code Here

                   
            // nodeA is the head node and runs some tests while all other nodes
            // simply listen for incoming messages
            if ( nodeName.equals("nodeA") ) {           
                // do some application stuff
                CalculatorService calculatorService =
                    domain.getService(CalculatorService.class, "CalculatorServiceComponent");
       
                // Calculate
                System.out.println("3 + 2=" + calculatorService.add(3, 2));
                System.out.println("3 - 2=" + calculatorService.subtract(3, 2));
                System.out.println("3 * 2=" + calculatorService.multiply(3, 2));
                System.out.println("3 / 2=" + calculatorService.divide(3, 2));
            } else {
                // start up and wait for messages
                try {
                    System.out.println("Node started (press enter to shutdown)");
                    System.in.read();
View Full Code Here

     */
    public void launchBindingSCACalculator(){
        Node node = NodeFactory.newInstance().createNode(new Contribution("c1", "../binding-jsonrpc/calculator-contribution/target/sample-binding-jsonrpc-calculator-contribution.jar"));
        node.start();
       
        CalculatorService calculator = node.getService(CalculatorService.class, "CalculatorServiceComponent");
       
        // TODO - could use JUnit assertions but don't want to have to handle JUnit dependency from Ant script
        double result = calculator.add(3, 2);
        System.out.println("3 + 2 = " + result);
        if (result != 5.0){
            throw new SampleLauncherException();
        }
       
View Full Code Here

    protected void setUp() throws Exception {
        domain = SCADomain.newInstance("myDomain", "src/test/resources/repository3/contribution.zip", null );
    }

    public void testInvoke() throws Exception {
        CalculatorService service = domain.getService(CalculatorService.class, "CalculatorServiceComponent");
        assertEquals(3.0, service.add(1, 2));
    }
View Full Code Here

           
            SCANode node = nodeFactory.createSCANode(chosenDeployableLocation, contributions);
           
            node.start();
            SCAClient client = (SCAClient)node;
            CalculatorService calculatorService =
                client.getService(CalculatorService.class, "CalculatorServiceComponentA");
           
            System.out.println("Add 2.0 + 3.0 + 3.0 = " + calculatorService.add(2.0, 3.0));

/*
            AssemblyInspector assemblyInspector = new AssemblyInspector();
            System.out.println(assemblyInspector.assemblyAsString(node));
*/
 
View Full Code Here

    protected void setUp() throws Exception {
        domain = SCADomain.newInstance("myDomain", "src/test/resources/repository2/folderWithJars", null );
    }

    public void testInvoke() throws Exception {
        CalculatorService service = domain.getService(CalculatorService.class, "CalculatorServiceComponent");
        assertEquals(3.0, service.add(1, 2));
    }
View Full Code Here

      NodeFactory factory = NodeFactory.newInstance();
        Node node = factory.createNode(new File("src/main/resources/spring/annotations/Calculator.composite").toURI().toURL().toString(),
                new Contribution("TestContribution", new File("src/main/resources/spring/annotations/").toURI().toURL().toString()));
        node.start();
             
        CalculatorService calculatorService =
            node.getService(CalculatorService.class, "CalculatorServiceComponent");
       
        System.out.println("3 + 2=" + calculatorService.add(3, 2));
        System.out.println("3 - 2=" + calculatorService.subtract(3, 2));
        System.out.println("3 * 2=" + calculatorService.multiply(3, 2));
        System.out.println("3 / 2=" + calculatorService.divide(3, 2));

        node.stop();
        System.out.println("Bye");
    }
View Full Code Here

      NodeFactory factory = NodeFactory.newInstance();
        Node node = factory.createNode(new File("src/main/resources/context/imports/ContextImports.composite").toURI().toURL().toString(),
                new Contribution("TestContribution", new File("src/main/resources/context/imports/").toURI().toURL().toString()));
        node.start();
             
        CalculatorService calculatorService =
            node.getService(CalculatorService.class, "CalculatorServiceComponent");
       
        System.out.println("3 + 2=" + calculatorService.add(3, 2));
        System.out.println("3 - 2=" + calculatorService.subtract(3, 2));
        System.out.println("3 * 2=" + calculatorService.multiply(3, 2));
        System.out.println("3 / 2=" + calculatorService.divide(3, 2));

        node.stop();
    }
View Full Code Here

TOP

Related Classes of calculator.CalculatorService

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.