Package org.apache.tuscany.sca.extensibility.test

Examples of org.apache.tuscany.sca.extensibility.test.TestInterface


    public void testNewLazyInstance() throws Exception {
        Collection<ServiceDeclaration> sds =
            ServiceDiscovery.getInstance().getServiceDeclarations(TestInterface.class, true);
        ExtensionPointRegistry registry = new DefaultExtensionPointRegistry();
        Iterator<ServiceDeclaration> iterator = sds.iterator();
        TestInterface ti = ServiceHelper.newLazyInstance(registry, iterator.next(), TestInterface.class);
        Assert.assertTrue(Proxy.isProxyClass(ti.getClass()));
        Assert.assertTrue(ti instanceof LifeCycleListener);
        Assert.assertTrue(ti.toString().startsWith("Proxy"));
        Assert.assertEquals(System.identityHashCode(ti), ti.hashCode());
        ServiceHelper.start(ti);
        ServiceHelper.stop(ti);
        QName name = ti.getArtifactType();
        Assert.assertEquals(new QName("http://sample", "Test2"), name);
        String str = ti.test("ABC");
        Assert.assertEquals("Test 2: ABC", str);
        ServiceHelper.stop(ti);
    }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.extensibility.test.TestInterface

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.