Package org.oasisopen.sca.client

Examples of org.oasisopen.sca.client.SCAClientFactory


    @Test
    public void testMultipleBindingsSingleService() throws Exception {
        node = NodeFactory.getInstance().createNode(URI.create("myFooDomain"), new String[] {"target/classes"});
        node.start();

        SCAClientFactory clientFactory = SCAClientFactory.newInstance(URI.create("myFooDomain"));
        RemoteHelloworldService service = clientFactory.getService(RemoteHelloworldService.class, "MultipleBindingsSingleServiceComponent");
        assertEquals("Remote hi petra", service.sayHelloRemote("petra"));
    }
View Full Code Here


public class SCAClientImpl implements Client {
    private Local local;
    private Remote remote;

    public SCAClientImpl(String domainURI) throws Exception {
        SCAClientFactory factory = SCAClientFactory.newInstance(URI.create(domainURI));
        local = factory.getService(Local.class, "LocalComponent/Local");
        remote = factory.getService(Remote.class, "RemoteComponent/Remote");
    }
View Full Code Here

            node = tuscanyRuntime.createNode();
            node.installContribution("AsyncSample", "target/classes", null, null);
            node.startComposite("AsyncSample", "Calculator.composite");
            node.startComposite("AsyncSample", "CalculatorClient.composite");
           
            SCAClientFactory scaClientFactory = SCAClientFactory.newInstance(URI.create("default"));
            CalculatorClient calculatorClient = scaClientFactory.getService(CalculatorClient.class, "CalculatorClient");
           
            calculatorClient.calculate();
        }catch (Exception e){
            e.printStackTrace();     
        } finally {
View Full Code Here

    final String factoryImplClassName =
      discoverProviderFactoryImplClass(properties, classLoader);
    final Class<? extends SCAClientFactory> factoryImplClass
      = loadProviderFactoryClass(factoryImplClassName,
                             classLoader);
    final SCAClientFactory factory =
      instantiateSCAClientFactoryClass(factoryImplClass,
                   domainURI, properties );
    return factory;
  }
View Full Code Here

        throws NoSuchDomainException, ServiceRuntimeException {
       
        try {
            Constructor<? extends SCAClientFactory> URIConstructor =
              factoryImplClass.getConstructor(URI.class, Properties.class);
            SCAClientFactory provider =
               URIConstructor.newInstance( domainURI, properties );
            return provider;
        } catch (Throwable ex) {
            throw new ServiceRuntimeException(
               "Failed to instantiate SCAClientFactory implementation class "
View Full Code Here

*/
public class SCAClientTestCase extends TestCase {

    @Test
    public void testDefault() throws Exception {
        SCAClientFactory clientFactory = SCAClientFactory.newInstance(URI.create("uri:default?wka=127.0.0.1:9876"));
        HelloworldService service = clientFactory.getService(HelloworldService.class, "HelloworldComponent");
        assertEquals("Hello petra", service.sayHello("petra"));
    }
View Full Code Here

        // force default binding on node2 to use a different port from node 1(which will default to 8080
        ((NodeImpl)node2).getConfiguration().addBinding(WebServiceBinding.TYPE, "http://localhost:8081/");
        ((NodeImpl)node2).getConfiguration().addBinding(SCABinding.TYPE, "http://localhost:8081/");
        node2.start();
       
        SCAClientFactory clientFactory = SCAClientFactory.newInstance(URI.create("default"));
        ClientComponent local  = clientFactory.getService(ClientComponent.class, "LocalClientClientComponent");

        ParameterObject po = new ParameterObject();
       
        try {
            String response = local.foo1(po);
View Full Code Here

        Node node3 = NodeFactory.newInstance().createNode(URI.create("uri:default"),
                "org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchDistributedClientClient.composite",
                contributions);
        node3.start();
       
        SCAClientFactory clientFactory = SCAClientFactory.newInstance(URI.create("default"));
        ClientComponent clientClient  = clientFactory.getService(ClientComponent.class, "DistributedClientClientComponent");

        ParameterObject po = new ParameterObject();
       
        try {
            String response = clientClient.foo1(po);
            Assert.assertEquals("AComponent", response);
        } catch (ServiceRuntimeException ex){
            Assert.fail("Unexpected exception with foo " + ex.toString());
        }
       
        // Make an SCAClient point across VMs to a component that has callback services
        ClientComponent client  = clientFactory.getService(ClientComponent.class, "DistributedClientComponent");
       
        try {
            String response = client.foo1(po);
            Assert.assertEquals("AComponent", response);
        } catch (ServiceRuntimeException ex){
View Full Code Here

                classLoader = SCAClientFactoryFinder.class.getClassLoader();
            }
        }
        final String factoryImplClassName = discoverProviderFactoryImplClass(properties, classLoader);
        final Class<? extends SCAClientFactory> factoryImplClass = loadProviderFactoryClass(factoryImplClassName, classLoader);
        final SCAClientFactory factory = instantiateSCAClientFactoryClass(factoryImplClass);
        return factory;
    }
View Full Code Here

     *                 SCAClientFactory implementation class
     */
    private static SCAClientFactory instantiateSCAClientFactoryClass(Class<? extends SCAClientFactory> factoryImplClass) throws SCARuntimeException {

        try {
            final SCAClientFactory provider = factoryImplClass.newInstance();
            return provider;
        } catch (Throwable ex) {
            throw new SCARuntimeException("Failed to instantiate SCAClientFactory implementation class " + factoryImplClass, ex);
        }
    }
View Full Code Here

TOP

Related Classes of org.oasisopen.sca.client.SCAClientFactory

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.