Package org.apache.tuscany.sca.node

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


* and locate and invoke a SCA component
*/
public class CalculatorClient {
    public static void main(String[] args) throws Exception {       
       
      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");
View Full Code Here


* and locate and invoke a SCA component
*/
public class CalculatorClient {
    public static void main(String[] args) throws Exception {       
       
      NodeFactory factory = NodeFactory.newInstance();
        Node node = factory.createNode(new File("src/main/resources/context/access/ContextAccess.composite").toURI().toURL().toString(),
                new Contribution("TestContribution", new File("src/main/resources/context/access/").toURI().toURL().toString()));
        node.start();
       
        // Code: To access the Spring Application Context instance
        ApplicationContext ctx = SCAApplicationContextProvider.getApplicationContext();
View Full Code Here

    @BeforeClass
    public static void setUpBeforeClass() throws Exception {
        /*        System.setProperty("org.apache.tuscany.sca.contribution.processor.ValidationSchemaExtensionPoint.enabled",
                                   "false");
        */
        NodeFactory factory = NodeFactory.getInstance();
        serviceNode = BindingSCATestCase.createServiceNode(factory).start();
    }
View Full Code Here

    /**
     * One NodeFactory and two nodes
     */
    @Test
    public void testOneFactoryTwoNodes() {
        NodeFactory factory1 = NodeFactory.getInstance();
        Node node1 = createClientNode(factory1);
        Node node2 = createServiceNode(factory1);
        node1.start();
        node2.start();
        try {
            runClient(node1);
        } finally {
            node2.stop();
            node1.stop();
            factory1.destroy();
        }
    }
View Full Code Here

    /**
     * Two node factories and two nodes
     */
    @Test
    public void testTwoFactoriesTwoNodes() throws Exception {
        NodeFactory factory1 = NodeFactory.newInstance();
        Node node1 = createClientNode(factory1);
        NodeFactory factory2 = NodeFactory.newInstance();
        Node node2 = createServiceNode(factory2);
        node1.start();
        node2.start();
        Thread.sleep(1000);
        try {
            // This call doesn't require the Local service, it should be successful
            createCustomer(node1);
            try {
                runClient(node1);
                // We cannot make local call to remote endpoints
                Assert.fail("ServiceRuntimeException should have been thrown.");
            } catch (ServiceRuntimeException e) {
                // ignore
            }
        } finally {
            node2.stop();
            node1.stop();
            factory2.destroy();
            factory1.destroy();
        }
    }
View Full Code Here

    /**
     * One node factory and one node for both composites
     */
    @Test
    public void testOneFactoryOneNode() {
        NodeFactory factory = NodeFactory.getInstance();
        NodeConfiguration config1 =
            factory.createNodeConfiguration().setDomainURI(DOMAIN_URI).setURI("node1").addContribution("c1", ROOT)
                .addDeploymentComposite("c1", CLIENT).addDeploymentComposite("c1", SERVICE);

        Node node1 = factory.createNode(config1);
        node1.start();
        try {
            runClient(node1);
        } finally {
            node1.stop();
            factory.destroy();
        }
    }
View Full Code Here

        } catch (java.lang.SecurityException e) {
            System.setProperty("java.security.auth.login.config", CalculatorClient.class.getClassLoader()
                .getResource("implementation/policies/CalculatorJass.config").toString());
        }

        NodeFactory factory = NodeFactory.newInstance();
        Node node = factory.createNode(new File("src/main/resources/implementation/policies/ImplementationPolicies.composite").toURI().toURL().toString(),
                new Contribution("TestContribution", new File("src/main/resources/implementation/policies/").toURI().toURL().toString()));
        node.start();
             
        CalculatorService calculatorService =
            node.getService(CalculatorService.class, "CalculatorServiceComponent");
View Full Code Here

        this.contributionLocation = contributionLocation;       
    }
   
    @Override
    protected void setUp() throws Exception {
      NodeFactory factory = NodeFactory.newInstance();     
      node = factory.createNode(new File("src/main/resources/" + contributionLocation + compositeName).toURI().toURL().toString(),
                new Contribution("TestContribution", new File("src/main/resources/" + contributionLocation).toURI().toURL().toString()));     
      node.start();
        service = node.getService(getServiceClass(), "ClientComponent");
    }
View Full Code Here

       
        try {
           
            System.out.println("Setting up nodes");
                 
            NodeFactory nodeFactory = NodeFactory.newInstance();
           
            nodeA = nodeFactory.createNode("nodeA/CompositeA.composite", new Contribution("contrib","target/classes"));
            nodeA.start();
           
            nodeB = nodeFactory.createNode("nodeB/CompositeB.composite", new Contribution("contrib","target/classes"));
            nodeB.start();
           
            acomponent = nodeA.getService(AComponent.class, "AComponent/AComponent");
              
        } catch (Throwable ex) {
View Full Code Here

    private boolean generateHTML = false;

    public void execute() throws MojoExecutionException, MojoFailureException {
        // getLog().info(String.valueOf(runtimeClasspathElements));
        try {
            NodeFactory factory = NodeFactory.getInstance();
            NodeConfiguration configuration = null;
            if (nodeConfiguration != null) {
                getLog().info("Loading node configuration: " + nodeConfiguration);
                configuration =
                    factory
                        .loadConfiguration(new FileInputStream(nodeConfiguration), nodeConfiguration.toURI().toURL());
            } else if (contribution != null) {
                getLog().info("Loading contribution: " + contribution);
                configuration = factory.createNodeConfiguration().addContribution(contribution.toURI().toURL());
            }

            URL[] paths = buildClasspath();
            ClassLoader classLoader = new URLClassLoader(paths, Thread.currentThread().getContextClassLoader());
            outputDirectory.mkdirs();
View Full Code Here

TOP

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

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.