Package org.apache.tuscany.sca.node

Examples of org.apache.tuscany.sca.node.SCANode


     */
    @Test
    public void atInitMethodWithArgs() throws Exception {
        SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
        try {
            SCANode node = nodeFactory.createSCANode(new File("src/main/resources/err4/HelloWorldErr4.composite").toURL().toString(),
                    new SCAContribution("TestContribution",
                                        new File("src/main/resources/err4").toURL().toString()));
            Assert.fail();
            node.stop();
        } catch(ServiceRuntimeException e) {
            //expected
            Assert.assertNotSame(-1, e.getMessage().indexOf("Initializer must not have argments"));
        }
    }
View Full Code Here


        SCAContribution[] contributions = new SCAContribution[contributionNames.length];
        int index = 0;
        for (String name : contributionNames) {
            contributions[index++] = locate(name);
        }
        SCANode node = SCANodeFactory.newInstance().createSCANode(composite, contributions);
        return node;
    }
View Full Code Here

        jmsBroker.start();

        SCAContribution currencyJMSContribution = locate("currency-jms");
        SCAContribution currencyContribution = locate("currency");

        SCANode node =
            SCANodeFactory.newInstance().createSCANode("currency-converter-jms.composite",
                                                       currencyContribution,
                                                       currencyJMSContribution);
        node.start();

        System.out.println("Node started - Press enter to shutdown.");
        System.in.read();

        node.stop();
        jmsBroker.stop();
    }
View Full Code Here

import org.apache.tuscany.sca.node.SCANode;
import org.apache.tuscany.sca.node.SCANodeFactory;

public class DatabindingLauncher {
    public static void main(String[] args) throws Exception {
        SCANode node1 = SCANodeFactory.newInstance().createSCANode(null,
                                                                   locate("payment-java"),
                                                                   locate("databinding-client"));

        SCANode node2 = SCANodeFactory.newInstance().createSCANode(null, locate("creditcard-payment-sdo"));

        node1.start();
        node2.start();

        Runnable runner = ((SCAClient)node1).getService(Runnable.class, "TestClient/Runnable");
        runner.run();

        node1.stop();
        node2.stop();
    }
View Full Code Here

    public static void main(String[] args) throws Exception {
        SCAContribution gvtContribution = new SCAContribution("introducing-trips",
            "../../contributions/introducing-trips/target/classes");

        SCANode node = SCANodeFactory.newInstance().createSCANode("trips.composite", gvtContribution);

        node.start();

        Trips tripProvider = ((SCAClient)node).getService(Trips.class, "TripProvider/Trips");

        System.out.println("Trip boooking code = " + tripProvider.checkAvailability("FS1APR4", 1));

        node.stop();
    }
View Full Code Here

public class CurrencyConverterLauncher {

    public static void main(String[] args) throws Exception {
        SCAContribution currencyContribution = locate("currency");

        SCANode node = SCANodeFactory.newInstance().createSCANode("currency-converter.composite", currencyContribution);
        node.start();

        System.out.println("Quick currency converter test");
        CurrencyConverter converter = ((SCAClient)node).getService(CurrencyConverter.class, "CurrencyConverter");
        System.out.println("USD -> GBP = " + converter.getExchangeRate("USD", "GBP"));
        System.out.println("100 USD = " + converter.convert("USD", "GBP", 100) + "GBP");

        System.out.println("Node started - Press enter to shutdown.");
        System.in.read();
        node.stop();
    }
View Full Code Here

    public static void main(String[] args) throws Exception {
        SCAContribution currencyRMIContribution = locate("currency-rmi");
        SCAContribution currencyContribution = locate("currency");

        SCANode node =
            SCANodeFactory.newInstance().createSCANode("currency-converter-rmi.composite",
                                                       currencyContribution,
                                                       currencyRMIContribution);
        node.start();

        System.out.println("Quick currency converter test");
        CurrencyConverter converter = ((SCAClient)node).getService(CurrencyConverter.class, "CurrencyConverter");
        System.out.println("USD -> GBP = " + converter.getExchangeRate("USD", "GBP"));
        System.out.println("100 USD = " + converter.convert("USD", "GBP", 100) + "GBP");

        System.out.println("Node started - Press enter to shutdown.");
        System.in.read();
        node.stop();

        // The following line is a workaround for TUSCANY-3277 when running
        // on Tuscany SCA 1.6 (the JVM hangs when exiting).
        System.exit(0);
    }
View Full Code Here

import com.tuscanyscatours.payment.Payment;

public class PaymentLauncher {

    public static void main(String[] args) throws Exception {
        SCANode node = SCANodeFactory.newInstance().createSCANode(null,
                                                              locate("payment-java-callback"));
        node.start();
       
        SCAClient client = (SCAClient)node;
        Payment payment1 = client.getService(Payment.class, "Payment1");
        Payment payment2 = client.getService(Payment.class, "Payment2");
        Payment paymentConfirm = client.getService(Payment.class, "PaymentConfirm");
        Payment paymentCallbackID = client.getService(Payment.class, "PaymentCallbackID");
        Payment paymentCallbackRedirect = client.getService(Payment.class, "PaymentCallbackRedirect");
       
        System.out.println("===================================================");
        System.out.println("\n\nPayment1 under limit - Status = \n\n" + payment1.makePaymentMember("c-0", 100.00f));
        System.out.println("===================================================");
        System.out.println("\n\nPayment2 under limit - Status = \n\n" + payment2.makePaymentMember("c-0", 100.00f));       
        System.out.println("===================================================");
        System.out.println("\n\nPayment1 over limit - Status = \n\n" + payment1.makePaymentMember("c-0", 1500.00f));
        System.out.println("===================================================");
        System.out.println("\n\nPayment2 over limit - Status = \n\n" + payment2.makePaymentMember("c-0", 1500.00f));
        System.out.println("===================================================");
        System.out.println("\n\nPayment2 using request context - Status = \n\n" + payment2.makePaymentMember("c-0", 20000.00f));
        System.out.println("===================================================");
        System.out.println("\n\nPaymentConfirm  - Status = \n\n" + paymentConfirm.makePaymentMember("c-0", 20000.00f));
        System.out.println("===================================================");

        // wait for longer that the asynch payment processing waits.
        try {
            Thread.sleep(2000);
        } catch (Exception ex) {
            // do nothing
        }
       
        System.out.println("===================================================");       
        System.out.println("\n\nPaymentCallbackID  - Status = \n\n" + paymentCallbackID.makePaymentMember("c-0", 20000.00f));
        System.out.println("===================================================");
        System.out.println("\n\nPaymentCallbackRedirect  - Status = \n\n" + paymentCallbackRedirect.makePaymentMember("c-0", 20000.00f));
        System.out.println("===================================================");
       
        node.stop();
    }
View Full Code Here

public class FeedLoggerLauncher {

    public static void main(String[] args) throws Exception {
        SCAContribution feedContribution = locate("feed-logger");

        SCANode node = SCANodeFactory.newInstance().createSCANode("feed-logger.composite", feedContribution);
        node.start();

        FeedLogger logger = ((SCAClient)node).getService(FeedLogger.class, "FeedLogger");
        logger.logFeeds(5);

        node.stop();
    }
View Full Code Here

    public static void main(String[] args) throws Exception {
        SCAContribution currencyCORBAContribution = locate("currency-corba");
        SCAContribution currencyContribution = locate("currency");

        SCANode node =
            SCANodeFactory.newInstance().createSCANode("currency-converter-corba.composite",
                                                       currencyContribution,
                                                       currencyCORBAContribution);
        node.start();

        System.out.println("Quick currency converter test");
        CurrencyConverter converter = ((SCAClient)node).getService(CurrencyConverter.class, "CurrencyConverter");
        System.out.println("USD -> GBP = " + converter.getExchangeRate("USD", "GBP"));
        System.out.println("100 USD = " + converter.convert("USD", "GBP", 100) + "GBP");

        System.out.println("Node started - Press enter to shutdown.");
        System.in.read();
        node.stop();
    }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.node.SCANode

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.