Package calculator

Examples of calculator.CalculatorService


        SCANodeFactory factory = SCANodeFactory.newInstance();
        SCANode node = factory.createSCANode(new File("src/main/resources/spring/annotations/Calculator.composite").toURL().toString(),
                new SCAContribution("TestContribution", new File("src/main/resources/spring/annotations/").toURL().toString()));
        node.start();       
             
        CalculatorService calculatorService =
            ((SCAClient)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));
       
        /*calculatorService =
            ((SCAClient)node).getService(CalculatorService.class, "AnotherCalculatorServiceComponent");

        System.out.println("3 + 2=" + calculatorService.add(3, 2));
View Full Code Here


        SCANodeFactory factory = SCANodeFactory.newInstance();
        SCANode node = factory.createSCANode(new File("src/main/resources/context/imports/Calculator.composite").toURL().toString(),
                new SCAContribution("TestContribution", new File("src/main/resources/context/imports/").toURL().toString()));
        node.start();       
             
        CalculatorService calculatorService =
            ((SCAClient)node).getService(CalculatorService.class, "CalculatorServiceComponent/CalculatorServiceBean");
       
        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

                                        
            // 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 =
                    node.getDomain().getService(CalculatorService.class, "CalculatorServiceComponentA");
               
                // 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));
               
                // a little hidden loop test to put some load on the nodes
                if (args.length > 2){
                    for (int i=0; i < 1000; i++){
                        // 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 {
View Full Code Here

     * Using a Tuscany specific mechanism for getting at local service proxies
     */
    public void launchBindingWSCalculator(){
        Node node = startNode(new Contribution("c1", "../contribution-binding-ws-calculator/target/classes"));
       
        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

     */
    public void launchBindingRMICalculator(){
        Node node1 = startNode(new Contribution("c1", "../binding-rmi/contribution-calculator-service/target/classes"));
        Node node2 = startNode(new Contribution("c1", "../binding-rmi/contribution-calculator-reference/target/classes"));
       
        CalculatorService calculator = node2.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

     * Using a Tuscany specific mechanism for getting at local service proxies
     */
    public void launchBindingWSCalculator() throws NoSuchDomainException, NoSuchServiceException{
        Node node = startNode(new Contribution("c1", "../contribution-binding-ws-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

                                                                  "src/test/resources/repository/contribution.zip"));
        node.start();
    }

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

        node = NodeFactory.newInstance().createNode(new Contribution("foo", "src/test/resources/repository"));
        node.start();
    }

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

       
        System.out.println("using domain uri: " + domainURI);
        System.out.println("using name: " + name);

        SCAClientFactory factory = SCAClientFactory.newInstance(URI.create(domainURI));
        CalculatorService calculator = factory.getService(CalculatorService.class, "CalculatorServiceComponent");
       
        System.out.println("Calling CalculatorService.add(2, 3)");
        System.out.println(calculator.add(3, 2));
    }
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.