Examples of DynaCorbaServant


Examples of org.apache.tuscany.sca.binding.corba.provider.service.DynaCorbaServant

        try {
            TestObjectServant tos = new TestObjectServant();
            TestRuntimeComponentService service = new TestRuntimeComponentService(tos);
            Class<?> javaClass = ((JavaInterface)service.getInterfaceContract().getInterface()).getJavaClass();
            InvocationProxy proxy = new ComponentInvocationProxy((RuntimeEndpoint) service.getEndpoints().get(0), javaClass);
            DynaCorbaServant servant = new DynaCorbaServant(proxy, Utils.getTypeId(javaClass));
            String[] ids = new String[] {"IDL:org/apache/tuscany/sca/binding/corba/testing/generated/TestObject:1.0"};
            servant.setIds(ids);
            bindServant(servant, "TestObject");
            DynaCorbaRequest request =
                new DynaCorbaRequest(bindReference("TestObject"), "methodThatSurelyDoesNotExist");
            request.invoke();
            fail();
        } catch (Exception e) {
            if (e instanceof CorbaException) {
                assertTrue(true);
            } else {
                e.printStackTrace();
            }
        }

        try {
            InvalidTestObjectServant tos = new InvalidTestObjectServant();
            TestRuntimeComponentService service = new TestRuntimeComponentService(tos);
            Class<?> javaClass = ((JavaInterface)service.getInterfaceContract().getInterface()).getJavaClass();
            InvocationProxy proxy = new ComponentInvocationProxy((RuntimeEndpoint) service.getEndpoints().get(0), javaClass);
            DynaCorbaServant servant = new DynaCorbaServant(proxy, Utils.getTypeId(javaClass));
            String[] ids = new String[] {"IDL:org/apache/tuscany/sca/binding/corba/testing/generated/TestObject:1.0"};
            servant.setIds(ids);
            bindServant(servant, "InvalidTestObject");
            TestObject to = TestObjectHelper.narrow(bindReference("InvalidTestObject"));
            SomeStruct str = new SomeStruct();
            str.innerStruct = new SimpleStruct();
            str.innerStruct.field1 = "Whatever";
View Full Code Here

Examples of org.apache.tuscany.sca.binding.corba.provider.service.DynaCorbaServant

        try {
            CalcServant calc = new CalcServant();
            TestRuntimeComponentService service = new TestRuntimeComponentService(calc);
            Class<?> javaClass = ((JavaInterface)service.getInterfaceContract().getInterface()).getJavaClass();
            InvocationProxy proxy = new ComponentInvocationProxy((RuntimeEndpoint) service.getEndpoints().get(0), javaClass);
            DynaCorbaServant servant = new DynaCorbaServant(proxy, Utils.getTypeId(javaClass));
            String[] ids = {"IDL:org/apache/tuscany/sca/binding/corba/testing/exceptions/Calc:1.0"};
            servant.setIds(ids);
            bindServant(servant, "Calc");
            Calc calcClient = CalcHelper.narrow(bindReference("Calc"));
            calcClient.div(1, 0);
            fail();
        } catch (Exception e) {
            if (e instanceof DivByZero) {
                assertTrue(true);
            } else {
                e.printStackTrace();
                fail();
            }
        }

        try {
            CalcServant calc = new CalcServant();
            TestRuntimeComponentService service = new TestRuntimeComponentService(calc);
            Class<?> javaClass = ((JavaInterface)service.getInterfaceContract().getInterface()).getJavaClass();
            InvocationProxy proxy = new ComponentInvocationProxy((RuntimeEndpoint) service.getEndpoints().get(0), javaClass);
            DynaCorbaServant servant = new DynaCorbaServant(proxy, Utils.getTypeId(javaClass));
            String[] ids = {"IDL:org/apache/tuscany/sca/binding/corba/testing/exceptions/Calc:1.0"};
            servant.setIds(ids);
            bindServant(servant, "Calc");
            Calc calcClient = CalcHelper.narrow(bindReference("Calc"));
            calcClient.divForSmallArgs(255, 255);
            fail();
        } catch (Exception e) {
View Full Code Here

Examples of org.apache.tuscany.sca.binding.corba.provider.service.DynaCorbaServant

        try {
            EnumManagerServant ems = new EnumManagerServant();
            TestRuntimeComponentService service = new TestRuntimeComponentService(ems);
            Class<?> javaClass = ((JavaInterface)service.getInterfaceContract().getInterface()).getJavaClass();
            InvocationProxy proxy = new ComponentInvocationProxy((RuntimeEndpoint) service.getEndpoints().get(0), javaClass);
            DynaCorbaServant servant = new DynaCorbaServant(proxy, Utils.getTypeId(javaClass));
            String[] ids = {"IDL:org/apache/tuscany/sca/binding/corba/testing/enums/EnumManager:1.0"};
            servant.setIds(ids);
            bindServant(servant, "Enum");
            EnumManager em = EnumManagerHelper.narrow(bindReference("Enum"));
            Color color = Color.red;
            assertTrue(em.getColor(color).value() == color.value());
        } catch (Exception e) {
View Full Code Here

Examples of org.apache.tuscany.sca.binding.corba.provider.service.DynaCorbaServant

        try {
            NonCorbaServant ncs = new NonCorbaServant();
            TestRuntimeComponentService service = new TestRuntimeComponentService(ncs);
            Class<?> javaClass = ((JavaInterface)service.getInterfaceContract().getInterface()).getJavaClass();
            InvocationProxy proxy = new ComponentInvocationProxy((RuntimeEndpoint) service.getEndpoints().get(0), javaClass);
            DynaCorbaServant servant = new DynaCorbaServant(proxy, Utils.getTypeId(javaClass));
            bindServant(servant, "NonCorbaServant");
            // it's non corba servant so we don't have stubs to test them
            DynaCorbaRequest request = new DynaCorbaRequest(bindReference("NonCorbaServant"), "setString");
            request.addArgument(TestConstants.STR_1);
            request.setOutputType(String.class);
            DynaCorbaResponse response = request.invoke();
            assertTrue(response.getContent().equals(TestConstants.STR_1));
        } catch (Exception e) {
            e.printStackTrace();
            fail();
        }

        try {
            NonCorbaServant ncs = new NonCorbaServant();
            TestRuntimeComponentService service = new TestRuntimeComponentService(ncs);
            Class<?> javaClass = ((JavaInterface)service.getInterfaceContract().getInterface()).getJavaClass();
            InvocationProxy proxy = new ComponentInvocationProxy((RuntimeEndpoint) service.getEndpoints().get(0), javaClass);
            DynaCorbaServant servant = new DynaCorbaServant(proxy, Utils.getTypeId(javaClass));
            bindServant(servant, "NonCorbaServant");
            // it's non corba servant so we don't have stubs to test them
            DynaCorbaRequest request = new DynaCorbaRequest(bindReference("NonCorbaServant"), "throwException");
            request.addExceptionType(NonCorbaException.class);
            request.invoke();
View Full Code Here

Examples of org.apache.tuscany.sca.binding.corba.provider.service.DynaCorbaServant

        try {
            CalcServant calc = new CalcServant();
            TestRuntimeComponentService service = new TestRuntimeComponentService(calc);
            Class<?> javaClass = ((JavaInterface)service.getInterfaceContract().getInterface()).getJavaClass();
            InvocationProxy proxy = new ComponentInvocationProxy((RuntimeEndpoint) service.getEndpoints().get(0), javaClass);
            DynaCorbaServant servant = new DynaCorbaServant(proxy, Utils.getTypeId(javaClass));
            String[] ids = new String[] {"IDL:org/apache/tuscany/sca/binding/corba/testing/generated/TestObject:1.0"};
            servant.setIds(ids);
            bindServant(servant, "Calc");
            DynaCorbaRequest request = new DynaCorbaRequest(bindReference("Calc"), "div");
            request.addArgument(2d);
            request.setOutputType(double.class);
            request.invoke();
View Full Code Here

Examples of org.apache.tuscany.sca.binding.corba.provider.service.DynaCorbaServant

            InvalidTypesServant its = new InvalidTypesServant();
            TestRuntimeComponentService service = new TestRuntimeComponentService(its);
            //expecting exception...
            Class<?> javaClass = ((JavaInterface)service.getInterfaceContract().getInterface()).getJavaClass();
            InvocationProxy proxy = new ComponentInvocationProxy((RuntimeEndpoint) service.getEndpoints().get(0), javaClass);
            new DynaCorbaServant(proxy, Utils.getTypeId(javaClass));
            fail();
        } catch (Exception e) {
            if (e instanceof RequestConfigurationException) {
                assertTrue(true);
            } else {
View Full Code Here

Examples of org.apache.tuscany.sca.binding.corba.provider.service.DynaCorbaServant

        try {
            ArraysUnionsTuscanyServant arraysUnions = new ArraysUnionsTuscanyServant();
            TestRuntimeComponentService service = new TestRuntimeComponentService(arraysUnions);
            Class<?> javaClass = ((JavaInterface)service.getInterfaceContract().getInterface()).getJavaClass();
            InvocationProxy proxy = new ComponentInvocationProxy((RuntimeEndpoint) service.getEndpoints().get(0), javaClass);
            DynaCorbaServant servant = new DynaCorbaServant(proxy, Utils.getTypeId(javaClass));
            String[] ids = new String[] {"IDL:org/apache/tuscany/sca/binding/corba/testing/arrays_unions/ArraysUnionsTests:1.0"};
            servant.setIds(ids);
            bindServant(servant, "ArraysUnions");
            Object reference = bindReference("ArraysUnions");
            ArraysUnionsTests objRef = ArraysUnionsTestsHelper.narrow(reference);
            String[][] stringArray = {{"Hello", "World"}, {"Hi", "Again"}};
            String[][] result = objRef.passStringArray(stringArray);
View Full Code Here

Examples of org.apache.tuscany.sca.binding.corba.provider.service.DynaCorbaServant

        int testPort = 5070;
        try {
            String testUri1 = "corbaname::localhost:" + testPort + "#Test1";
            String testUri2 = "corbaname::localhost:" + testPort + "#Test2";
            String testUri3 = "corbaname::localhost:" + testPort + "#Test3";
            DynaCorbaServant servant = new DynaCorbaServant(null, "IDL:org/apache/tuscany:1.0");
            host.registerServant(testUri1, servant);
            host.registerServant(testUri2, servant);
            host.registerServant(testUri3, servant);
            Thread.sleep(1000);
            // make test connection to name server
View Full Code Here

Examples of org.apache.tuscany.sca.binding.corba.provider.service.DynaCorbaServant

     */
    public void start() {
        try {
            Class<?> javaClass = ((JavaInterface)endpoint.getComponentTypeServiceInterfaceContract().getInterface()).getJavaClass();
            InvocationProxy proxy = new ComponentInvocationProxy(endpoint, javaClass);
            servant = new DynaCorbaServant(proxy, Utils.getTypeId(javaClass));
            servant.setIds(new String[] {binding.getId()});
            host.registerServant(binding.getCorbaname(), servant);
            endpoint.setDeployedURI(binding.getCorbaname());
        } catch (Exception e) {
            throw new ServiceRuntimeException(e);
View Full Code Here

Examples of org.apache.tuscany.sca.binding.corba.provider.service.DynaCorbaServant

        try {
            PrimitivesSetter primitivesSetter = new PrimitivesSetterServant();
            TestRuntimeComponentService service = new TestRuntimeComponentService(primitivesSetter);
            Class<?> javaClass = ((JavaInterface)service.getInterfaceContract().getInterface()).getJavaClass();
            InvocationProxy proxy = new ComponentInvocationProxy((RuntimeEndpoint) service.getEndpoints().get(0), javaClass);
            DynaCorbaServant servant = new DynaCorbaServant(proxy, Utils.getTypeId(javaClass));
            String[] ids =
                new String[] {"IDL:org/apache/tuscany/sca/binding/corba/testing/generated/PrimitivesSetter:1.0"};
            servant.setIds(ids);
            bindServant(servant, "PrimitivesSetter");
            PrimitivesSetter psClient = PrimitivesSetterHelper.narrow(bindReference("PrimitivesSetter"));
            assertTrue(psClient.setBoolean(true) == true);
            assertTrue(psClient.setChar('A') == 'A');
            assertTrue(psClient.setString("SomeTest").equals("SomeTest"));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.