Package org.apache.tuscany.sca.host.embedded

Examples of org.apache.tuscany.sca.host.embedded.SCADomain


              + ": "
              + e.getMessage()
              + ". Valid and working Erlang/OTP distribution is required.");
      throw new IgnoreTest();
    }
    SCADomain scaDomain = SCADomain
        .newInstance("helloworlderlangservice.composite");
    HelloWorldService helloWorldService = scaDomain.getService(
        HelloWorldService.class,
        "HelloWorldServiceComponent/HelloWorldService");
    assertNotNull(helloWorldService);
    assertEquals("Hello Smith", helloWorldService.getGreetings("Smith"));
    scaDomain.close();
    epmdProcess.destroy();
  }
View Full Code Here


                + e.getMessage()
                + ". Valid and working Erlang/OTP distribution is required.");
      }
      if (process != null) {
        System.out.println("EPMD server started");
        SCADomain scaDomain = SCADomain
            .newInstance("helloworlderlangservice.composite");
        System.out
            .println("HelloWorld server started (press enter to shutdown)");
        System.in.read();
        process.destroy();
        scaDomain.close();
        System.out.println("EPMD server stopped");
        System.out.println("HelloWorld server stopped");
      }
    } catch (IOException e) {
      e.printStackTrace();
View Full Code Here

        OSGiRuntime.stop();
    }
   
    public void testOSGiComponent() throws Exception {
       
        SCADomain scaDomain = SCADomain.newInstance(compositeName);
        OSGiTestInterface testService = scaDomain.getService(OSGiTestInterface.class, "OSGiTestServiceComponent");
        assert(testService != null);
       
        assert(testService instanceof Proxy);
       
        String str = testService.testService();
       
        assertEquals(className, str);

        scaDomain.close();
             
    }
View Full Code Here

              + ": "
              + e.getMessage()
              + ". Valid and working Erlang/OTP distribution is required.");
      throw new IgnoreTest();
    }
    SCADomain scaServiceDomain = SCADomain
        .newInstance("helloworlderlangservice.composite");
    SCADomain scaClientDomain = SCADomain
        .newInstance("helloworlderlangreference.composite");
    HelloWorldService helloWorldService = scaClientDomain.getService(
        HelloWorldService.class, "HelloWorldServiceComponent");
    String msg = helloWorldService.getGreetings("Smith");
    Assert.assertEquals("Hello Smith", msg);
    scaClientDomain.close();
    scaServiceDomain.close();
    epmdProcess.destroy();

  }
View Full Code Here

    /**
     * Initializes the SCADomian associated with a webapp context. If a SCADomain
     * doesn't exist already then one is create based on the webapp config.
     */
    static SCADomain initSCADomain(ServletContext servletContext) {
        SCADomain scaDomain = (SCADomain)servletContext.getAttribute(SCA_DOMAIN_ATTRIBUTE);
       
        String domainURI = "http://localhost/" + servletContext.getServletContextName().replace(' ', '.');
        String contributionRoot = null;
       
        try {
View Full Code Here

            throw new JspException("Exception initializing Tuscany webapp: " + e, e);
        }
        ServletContext servletContext = pageContext.getServletContext();
        ComponentContext componentContext = (ComponentContext)servletContext.getAttribute("org.osoa.sca.ComponentContext");
        SCADomain scaDomain = null;
        if (componentContext == null) {
            scaDomain = (SCADomain)servletContext.getAttribute(WebAppServletHost.SCA_DOMAIN_ATTRIBUTE);
            if (scaDomain == null) {
                throw new JspException("SCADomain is null. Check Tuscany configuration in web.xml");
            }
        }

        Class<?> typeClass;
        try {
            typeClass = Class.forName(type, true, Thread.currentThread().getContextClassLoader());
        } catch (ClassNotFoundException e) {
            throw new JspException("Reference '" + name + "' type class not found: " + type);
        }

        Object o;
        try {
            if (componentContext != null) {
                o = componentContext.getService(typeClass, name);
            } else {
                o = scaDomain.getService(typeClass, name);
            }
        } catch (Exception e) {
            throw new JspException("Exception getting service for reference'" + name + "': " + e, e);
        }
        if (o == null) {
View Full Code Here

        }
    }

    public void contextDestroyed(ServletContextEvent event) {
        ServletContext servletContext = event.getServletContext();
        SCADomain scaDomain = (SCADomain) servletContext.getAttribute(WebAppServletHost.SCA_DOMAIN_ATTRIBUTE);
        if (scaDomain != null) {
            scaDomain.close();
        }
    }
View Full Code Here

  @BeforeClass
  public static void init() throws IOException {
    try {
      epmdProcess = Runtime.getRuntime().exec(EPMD_COMMAND);
      SCADomain domain = SCADomain
          .newInstance("ErlangReference.composite");
      SCADomain.newInstance("ErlangService.composite");
      ReferenceTestComponentImpl component = domain.getService(
          ReferenceTestComponentImpl.class, "ReferenceTest");

      mboxReference = component.getMboxReference();
      timeoutMboxReference = component.getTimeoutMboxReference();
      moduleReference = component.getModuleReference();
View Full Code Here

    public void init() {
    }

    @Test
    public void testSayHello() throws Exception {
        SCADomain scaDomain = SCADomain.newInstance("http://localhost", "/", "test.composite");

        Helloworld service = scaDomain.getService(Helloworld.class, "TestJEE/HelloworldServiceBean_HelloworldService");

        //assertEquals("hello beate", service.getGreetings("beate"));

        scaDomain.close();
    }
View Full Code Here

     * <p>
     * OSOA specification doesn't have such requirement.
     */
    @Test
    public void ASM60001_p() throws Exception {
        SCADomain domain = SCADomain.newInstance(LOCAL_DOMAIN_URI, "/", "compositeb.composite", "compositec.composite");
        BService bService = domain.getService(BService.class, "BComponent");
        Assert.assertEquals("some b component value", bService.getSomeProperty());
        CService cService = domain.getService(CService.class, "CComponent");
        Assert.assertEquals("Some State", cService.getState());
        domain.close();
        domain = null;
    }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.host.embedded.SCADomain

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.