Package org.apache.tuscany.sca.binding.corba.impl.service

Examples of org.apache.tuscany.sca.binding.corba.impl.service.ComponentInvocationProxy


    public void test_arraysPassing() {
        try {
            ArraysUnionsTuscanyServant arraysUnions = new ArraysUnionsTuscanyServant();
            TestRuntimeComponentService service = new TestRuntimeComponentService(arraysUnions);
            Class<?> javaClass = ((JavaInterface)service.getInterfaceContract().getInterface()).getJavaClass();
            InvocationProxy proxy = new ComponentInvocationProxy(service, service.getRuntimeWire(null), 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");
View Full Code Here


     * @see org.apache.tuscany.sca.provider.ServiceBindingProvider#start()
     */
    public void start() {
        try {
            Class<?> javaClass = ((JavaInterface)service.getInterfaceContract().getInterface()).getJavaClass();
            InvocationProxy proxy = new ComponentInvocationProxy(service, service.getRuntimeWire(binding), javaClass);
            servant = new DynaCorbaServant(proxy, Utils.getTypeId(javaClass));
            servant.setIds(new String[] {binding.getId()});
            host.registerServant(binding.getCorbaname(), servant);
        } catch (Exception e) {
            throw new ServiceRuntimeException(e);
View Full Code Here

    public void test_primitivesSetter() {
        try {
            PrimitivesSetter primitivesSetter = new PrimitivesSetterServant();
            TestRuntimeComponentService service = new TestRuntimeComponentService(primitivesSetter);
            Class<?> javaClass = ((JavaInterface)service.getInterfaceContract().getInterface()).getJavaClass();
            InvocationProxy proxy = new ComponentInvocationProxy(service, service.getRuntimeWire(null), 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");
View Full Code Here

    public void test_arraysSetter() {
        try {
            ArraysSetter arraysSetter = new ArraysSetterServant();
            TestRuntimeComponentService service = new TestRuntimeComponentService(arraysSetter);
            Class<?> javaClass = ((JavaInterface)service.getInterfaceContract().getInterface()).getJavaClass();
            InvocationProxy proxy = new ComponentInvocationProxy(service, service.getRuntimeWire(null), javaClass);
            DynaCorbaServant servant = new DynaCorbaServant(proxy, Utils.getTypeId(javaClass));
            String[] ids = new String[] {"IDL:org/apache/tuscany/sca/binding/corba/testing/generated/ArraysSetter:1.0"};
            servant.setIds(ids);
            java.lang.Object result = null;
            bindServant(servant, "ArraysSetter");
View Full Code Here

    public void test_TestObject_setStruct() {
        try {
            TestObject to = new TestObjectServant();
            TestRuntimeComponentService service = new TestRuntimeComponentService(to);
            Class<?> javaClass = ((JavaInterface)service.getInterfaceContract().getInterface()).getJavaClass();
            InvocationProxy proxy = new ComponentInvocationProxy(service, service.getRuntimeWire(null), 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");
            TestObject testObject = TestObjectHelper.narrow(bindReference("TestObject"));
View Full Code Here

    public void test_systemException_BAD_OPERATION() {
        try {
            TestObjectServant tos = new TestObjectServant();
            TestRuntimeComponentService service = new TestRuntimeComponentService(tos);
            Class<?> javaClass = ((JavaInterface)service.getInterfaceContract().getInterface()).getJavaClass();
            InvocationProxy proxy = new ComponentInvocationProxy(service, service.getRuntimeWire(null), 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(service, service.getRuntimeWire(null), 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"));
View Full Code Here

    public void test_userExceptions() {
        try {
            CalcServant calc = new CalcServant();
            TestRuntimeComponentService service = new TestRuntimeComponentService(calc);
            Class<?> javaClass = ((JavaInterface)service.getInterfaceContract().getInterface()).getJavaClass();
            InvocationProxy proxy = new ComponentInvocationProxy(service, service.getRuntimeWire(null), 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(service, service.getRuntimeWire(null), 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"));
View Full Code Here

    public void test_enums() {
        try {
            EnumManagerServant ems = new EnumManagerServant();
            TestRuntimeComponentService service = new TestRuntimeComponentService(ems);
            Class<?> javaClass = ((JavaInterface)service.getInterfaceContract().getInterface()).getJavaClass();
            InvocationProxy proxy = new ComponentInvocationProxy(service, service.getRuntimeWire(null), 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"));
View Full Code Here

    public void test_nonCorbaServants() {
        try {
            NonCorbaServant ncs = new NonCorbaServant();
            TestRuntimeComponentService service = new TestRuntimeComponentService(ncs);
            Class<?> javaClass = ((JavaInterface)service.getInterfaceContract().getInterface()).getJavaClass();
            InvocationProxy proxy = new ComponentInvocationProxy(service, service.getRuntimeWire(null), 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(service, service.getRuntimeWire(null), 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);
View Full Code Here

    public void test_systemException_BAD_PARAM() {
        try {
            CalcServant calc = new CalcServant();
            TestRuntimeComponentService service = new TestRuntimeComponentService(calc);
            Class<?> javaClass = ((JavaInterface)service.getInterfaceContract().getInterface()).getJavaClass();
            InvocationProxy proxy = new ComponentInvocationProxy(service, service.getRuntimeWire(null), 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");
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.binding.corba.impl.service.ComponentInvocationProxy

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.