Package org.apache.yoko.bindings.corba

Examples of org.apache.yoko.bindings.corba.CorbaMessage


   
   
    public void testgetDataWriter() throws Exception {
        CorbaOutInterceptor outInterceptor = new CorbaOutInterceptor();       
        CorbaMessage message = control.createMock(CorbaMessage.class);
        Exchange exchange = control.createMock(Exchange.class);
        Service service = control.createMock(Service.class);
        DataBinding databinding = control.createMock(DataBinding.class);       
       
        EasyMock.expect(message.getExchange()).andReturn(exchange);
        EasyMock.expect(ServiceModelUtil.getService(exchange)).andReturn(service);
        EasyMock.expect(service.getDataBinding()).andReturn(databinding);
       
        control.replay();
        outInterceptor.getDataWriter(message);
View Full Code Here


        orb = mOrb;
    }

    public void handleMessage(Message msg) {
        try {
            CorbaMessage message = (CorbaMessage) msg;
              
            CorbaDestination destination = null;
            if (message.getDestination() != null) {
                destination = (CorbaDestination)message.getDestination();
            } else {
                destination = (CorbaDestination)message.getExchange().getDestination();
            }
       
            typeMaps = new ArrayList<CorbaTypeMap>();               
            service = destination.getBindingInfo().getService();
            List<TypeMappingType> corbaTypes = service.getDescription().getExtensors(TypeMappingType.class);
View Full Code Here

       
        if (opType != null) {
            paramTypes = opType.getParam();    
            argType = opType.getReturn();
        }
        CorbaMessage outMessage = (CorbaMessage)exchange.getOutMessage();
       
        opType = bopInfo.getExtensor(OperationType.class);

        OperationInfo opInfo = processWrappedOperation(bopInfo, true);
View Full Code Here

        corbaStaxObject = new CorbaStaxObject();
    }

    public void handleMessage(Message msg) {
        try {
            CorbaMessage message = (CorbaMessage)msg;
            EventDataWriter writer = (EventDataWriter)ContextUtils.getDataWriter(message);

            CorbaDestination destination = null;
            if (message.getDestination() != null) {
                destination = (CorbaDestination)message.getDestination();
            } else {
                destination = (CorbaDestination)message.getExchange().getDestination();
            }

            org.omg.CORBA.ORB orb = (org.omg.CORBA.ORB) message.get(CorbaConstants.ORB);
            if (orb == null) {
                orb = (org.omg.CORBA.ORB) message.getExchange().get(org.omg.CORBA.ORB.class);
            }
            corbaStaxObject.setOrb(orb);

            List<CorbaTypeMap> typeMaps = new ArrayList<CorbaTypeMap>();               
            ServiceInfo service = destination.getBindingInfo().getService();       
            List<TypeMappingType> corbaTypes = service.getDescription().getExtensors(TypeMappingType.class);
            if (corbaTypes != null) {
                CorbaUtils.createCorbaTypeMap(typeMaps, corbaTypes);
                corbaStaxObject.setTypeMaps(typeMaps);
                corbaStaxObject.setServiceInfo(service);
            }

            Throwable ex = message.getContent(Exception.class);
            ex = ex.getCause();
            if (ex instanceof InvocationTargetException) {
                ex = ex.getCause();
            }

            // Get information about the operation being invoked from the WSDL
            // definition.
            // We need this to marshal data correctly

            BindingInfo bInfo = destination.getBindingInfo();
            InterfaceInfo info = bInfo.getInterface();       
       
            String opName = message.getExchange().get(String.class);
               
            Iterator iter = bInfo.getOperations().iterator();

            BindingOperationInfo bopInfo = null;
            OperationType opType = null;          
View Full Code Here

        setPhase(Phase.MARSHAL);
    }

    public void handleMessage(Message msg) {
        try {
            CorbaMessage message = (CorbaMessage) msg;
            orb = (org.omg.CORBA.ORB) message.get(CorbaConstants.ORB);
            corbaStaxObject = new CorbaStaxObject(orb);
            Exchange exchange = message.getExchange();
            typeMaps = new ArrayList<CorbaTypeMap>();

            service = exchange.get(ServiceInfo.class);
            List<TypeMappingType> corbaTypes = service.getDescription().getExtensors(TypeMappingType.class);
            if (corbaTypes != null) {
View Full Code Here

        addAfter(ClientFaultConverter.class.getName());
        corbaStaxObject = new CorbaStaxObject();     
    }   

    public void handleMessage(Message msg) {
        CorbaMessage message = (CorbaMessage)msg;
        try {
            CorbaStreamable exStreamable = message.getStreamableException();
            if (exStreamable != null) {
                EventDataReader reader = (EventDataReader) ContextUtils.getDataReader(message);

                BindingOperationInfo bopInfo = message.getExchange().get(BindingOperationInfo.class);
                OperationType opType = bopInfo.getExtensor(OperationType.class);
                OperationInfo opInfo = bopInfo.getOperationInfo();
               
                List<CorbaTypeMap> typeMaps = new ArrayList<CorbaTypeMap>();

                ServiceInfo service = message.getExchange().get(ServiceInfo.class);
                List<TypeMappingType> corbaTypes =
                    service.getDescription().getExtensors(TypeMappingType.class);
                if (corbaTypes != null) {
                    corbaStaxObject.setTypeMaps(typeMaps);
                    corbaStaxObject.setServiceInfo(service);
                }

                org.omg.CORBA.ORB orb = (org.omg.CORBA.ORB) message.get(CorbaConstants.ORB);
                if (orb == null) {
                    orb = (org.omg.CORBA.ORB) message.getExchange().get(org.omg.CORBA.ORB.class);
                }
                corbaStaxObject.setOrb(orb);
                QName elName = new QName("", exStreamable.getName());

                XMLInputFactory inputFactory = getXMLInputFactory();
                XMLOutputFactory outputFactory = getXMLOutputFactory();
               
                ByteArrayOutputStream outStream = new ByteArrayOutputStream();
                XMLEventWriter evtWriter = outputFactory.createXMLEventWriter(outStream);
                corbaStaxObject.writeObjectToStax(exStreamable.getObject(),
                                                  evtWriter,
                                                  XMLEventFactory.newInstance());
                evtWriter.flush();
                ByteArrayInputStream inStream = new ByteArrayInputStream(outStream.toByteArray());
                XMLEventReader evtReader = inputFactory.createXMLEventReader(inStream);
                FaultInfo fault = getFaultInfo(opInfo, elName);
                Object e = reader.read(fault.getMessageParts().get(0), evtReader);
                if (!(e instanceof Exception)) {
                    Class exClass = fault.getProperty(Class.class.getName(), Class.class);
                    Class beanClass = e.getClass();
                    Constructor constructor =
                        exClass.getConstructor(new Class[]{String.class, beanClass});
                    e = constructor.newInstance(new Object[]{"", e});
                }
                message.setContent(Exception.class, (Exception) e);
            }
        } catch (java.lang.Exception ex) {
            LOG.log(Level.SEVERE, "CORBA unmarshalFault exception", ex);
            throw new CorbaBindingException("CORBA unmarshalFault exception", ex);
        }
View Full Code Here

    public void testHandleMessage() throws Exception {       
        Method m = CorbaInInterceptor.class.getDeclaredMethod("handleNotRequestMessage",
                new Class[] {CorbaMessage.class, CorbaDestination.class});                                                      
        CorbaInInterceptor inInterceptor = EasyMock.createMock(CorbaInInterceptor.class, new Method[] {m});      
                                                   
        CorbaMessage msg = control.createMock(CorbaMessage.class);
        CorbaDestination destination = control.createMock(CorbaDestination.class);
        BindingInfo bInfo = control.createMock(BindingInfo.class);
        ServiceInfo sInfo = control.createMock(ServiceInfo.class);
        DescriptionInfo dInfo = control.createMock(DescriptionInfo.class)
        EasyMock.expect(msg.getDestination()).andReturn(destination).times(2);       
        EasyMock.expect(destination.getBindingInfo()).andReturn(bInfo);
        EasyMock.expect(bInfo.getService()).andReturn(sInfo);
        EasyMock.expect(dInfo.getExtensors(TypeMappingType.class)).andReturn(null);
        EasyMock.expect(sInfo.getDescription()).andReturn(dInfo);
       
View Full Code Here

    public void testHandleMessage1() throws Exception {       
        Method m = CorbaInInterceptor.class.getDeclaredMethod("handleRequestMessage",
                new Class[] {CorbaMessage.class, CorbaDestination.class});                                                      
        CorbaInInterceptor inInterceptor = EasyMock.createMock(CorbaInInterceptor.class, new Method[] {m});      
                                                   
        CorbaMessage msg = control.createMock(CorbaMessage.class);
        CorbaDestination destination = control.createMock(CorbaDestination.class);
        BindingInfo bInfo = control.createMock(BindingInfo.class);
        ServiceInfo sInfo = control.createMock(ServiceInfo.class);
        DescriptionInfo dInfo = control.createMock(DescriptionInfo.class);  
        EasyMock.expect(msg.getDestination()).andReturn(destination).times(2);       
        EasyMock.expect(destination.getBindingInfo()).andReturn(bInfo);
        EasyMock.expect(bInfo.getService()).andReturn(sInfo);
        EasyMock.expect(dInfo.getExtensors(TypeMappingType.class)).andReturn(null);
        EasyMock.expect(sInfo.getDescription()).andReturn(dInfo);
        EasyMock.expect(msg.containsKey(Message.REQUESTOR_ROLE)).andReturn(true);
       
        inInterceptor.handleRequestMessage(msg, destination);
        EasyMock.expectLastCall();
       
        control.replay();
View Full Code Here

    public void testHandleMessage2() throws Exception {       
        Method m = CorbaInInterceptor.class.getDeclaredMethod("handleRequestMessage",
                new Class[] {CorbaMessage.class, CorbaDestination.class});                                                      
         CorbaInInterceptor inInterceptor = EasyMock.createMock(CorbaInInterceptor.class, new Method[] {m});      
                                                   
        CorbaMessage msg = control.createMock(CorbaMessage.class);
        CorbaDestination destination = control.createMock(CorbaDestination.class);
        BindingInfo bInfo = control.createMock(BindingInfo.class);
        ServiceInfo sInfo = control.createMock(ServiceInfo.class);
        DescriptionInfo dInfo = control.createMock(DescriptionInfo.class)
        EasyMock.expect(msg.getDestination()).andReturn(null);
        Exchange exchange = control.createMock(Exchange.class);
        EasyMock.expect(msg.getExchange()).andReturn(exchange);
        EasyMock.expect(exchange.getDestination()).andReturn(destination);       
        EasyMock.expect(destination.getBindingInfo()).andReturn(bInfo);
        EasyMock.expect(bInfo.getService()).andReturn(sInfo);
        EasyMock.expect(dInfo.getExtensors(TypeMappingType.class)).andReturn(null);
        EasyMock.expect(sInfo.getDescription()).andReturn(dInfo);
        EasyMock.expect(msg.containsKey(Message.REQUESTOR_ROLE)).andReturn(true);
       
        inInterceptor.handleRequestMessage(msg, destination);
        EasyMock.expectLastCall();
       
        control.replay();
View Full Code Here

        EasyMock.expect(destination.getBindingInfo()).andReturn(bInfo);
        EasyMock.expect(destination.getEndPointInfo()).andReturn(endpointInfo);               
        QName qname = new QName("" , "Test", "");
        EasyMock.expect(bInfo.getOperation(qname)).andReturn(bopInfo);
        EasyMock.expect(bopInfo.getOperationInfo()).andReturn(opInfo);                       
        CorbaMessage message = control.createMock(CorbaMessage.class);
        Exchange exchange = control.createMock(Exchange.class);
        EndpointReferenceType etype = control.createMock(EndpointReferenceType.class);
        MessageInfo mInfo = control.createMock(MessageInfo.class);
        EasyMock.expect(message.getExchange()).andReturn(exchange);     
        EasyMock.expect(destination.getAddress()).andReturn(etype);
        EasyMock.expect(opInfo.getInput()).andReturn(mInfo);
        exchange.setInMessage(message);
        EasyMock.expectLastCall();       
        OperationType opType = control.createMock(OperationType.class);
View Full Code Here

TOP

Related Classes of org.apache.yoko.bindings.corba.CorbaMessage

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.