Package org.oasisopen.sca.client

Examples of org.oasisopen.sca.client.SCAClientFactory


    @Test
    public void testHelloworld() throws NoSuchDomainException, NoSuchServiceException {
// TODO: need to fix the config URI so it works properly
//        SCAClientFactory factory = SCAClientFactory.newInstance(URI.create("uri:default?remote=127.0.0.1:54321"));
        SCAClientFactory factory = SCAClientFactory.newInstance(URI.create("tuscany:default?remotes=192.168.1.64"));
        Helloworld helloworld = factory.getService(Helloworld.class, "HelloworldComponent");
        assertEquals("Hello World", helloworld.sayHello("World"));
    }
View Full Code Here


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

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

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

        SCAClientFactory factory = SCAClientFactory.newInstance(URI.create(domainURI));
        Helloworld service = factory.getService(Helloworld.class, "HelloworldComponent");
       
        System.out.println("Calling HelloworldComponent.sayHello(\"" + name + "\")");
        System.out.println(service.sayHello(name));
    }
View Full Code Here

    public void testDefault() throws Exception {

        node = NodeFactory.getInstance().createNode((String)null, new String[] {"target/classes"});
        node.start();

        SCAClientFactory clientFactory = SCAClientFactory.newInstance(URI.create("default"));
        HelloworldService service = clientFactory.getService(HelloworldService.class, "HelloworldComponent/HelloworldService");
        assertEquals("Hello petra", service.sayHello("petra"));
       
        RemoteHelloworldService remoteService = clientFactory.getService(RemoteHelloworldService.class, "HelloworldComponent/RemoteHelloworldService");
        assertEquals("Hello petra", remoteService.sayHelloRemote("petra"));

    }
View Full Code Here

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

        SCAClientFactory clientFactory = SCAClientFactory.newInstance(URI.create("myFooDomain"));
        HelloworldService service = clientFactory.getService(HelloworldService.class, "HelloworldComponent/HelloworldService");
        assertEquals("Hello petra", service.sayHello("petra"));
       
        RemoteHelloworldService remoteService = clientFactory.getService(RemoteHelloworldService.class, "HelloworldComponent/RemoteHelloworldService");
        assertEquals("Hello petra", remoteService.sayHelloRemote("petra"));
        assertEquals("Hello petra", service.sayHello("petra"));
    }
View Full Code Here

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

        SCAClientFactory clientFactory = SCAClientFactory.newInstance(URI.create("myFooDomain"));
        try {
           clientFactory.getService(HelloworldService.class, "HelloworldComponent/foo");
           fail();
        } catch (NoSuchServiceException e) {
            // expected
        }
    }
View Full Code Here

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

        SCAClientFactory clientFactory = SCAClientFactory.newInstance(URI.create("someBadDomainName"));
        try {
            HelloworldService service = clientFactory.getService(HelloworldService.class, "HelloworldComponent/foo");
            service.sayHello("petra");
            fail();
        } catch (Exception e) {
            if (!(e.getCause() instanceof NoSuchDomainException)) {
                throw e;
View Full Code Here

public class SCAClient {

    public void testSCAClient() throws Exception {
        // The configuration required when running with sca-client-rmi and endpoint-hazelcast-rmi
        SCAClientFactory factory = SCAClientFactory.newInstance(URI.create("tuscanyclient:default?remotes=127.0.0.1:14820"));
       
        // The configuration required when running with sca-client-impl and endpoint-hazelcast
        //SCAClientFactory factory = SCAClientFactory.newInstance(URI.create("tuscany:default"));
       
        // Sleep 3 seconds so that the endpoint is populated into the EndpointRegistry
        //Thread.sleep(3000);
       
        Helloworld service = factory.getService(Helloworld.class, "HelloworldService");
       
        String response = service.sayHello("test");
        if (response == null || !response.equals("Hello test")){
            throw new Exception("Test failed - expecting 'Hello test' got " + response);
        } else {
View Full Code Here

    public void testDefault() throws Exception {

        node = NodeFactory.getInstance().createNode((String)null, new String[] {"target/classes"});
        node.start();

        SCAClientFactory clientFactory = SCAClientFactory.newInstance(URI.create("default"));
        HelloworldService service = clientFactory.getService(HelloworldService.class, "HelloworldComponent/HelloworldService");
        assertEquals("Hello petra", service.sayHello("petra"));
       
        RemoteHelloworldService remoteService = clientFactory.getService(RemoteHelloworldService.class, "HelloworldComponent/RemoteHelloworldService");
        assertEquals("Hello petra", remoteService.sayHelloRemote("petra"));

    }
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.