Package org.apache.sandesha2

Examples of org.apache.sandesha2.SandeshaTestCase$TestCallback


    // Setting the ack depending on AcksTo.
    EndpointReference acksTo = new EndpointReference(rmdBean.getAcksToEPR());
    String acksToStr = acksTo.getAddress();

    if (acksToStr == null)
      throw new SandeshaException(SandeshaMessageHelper.getMessage(SandeshaMessageKeys.acksToStrNotSet));

    //Getting the operation for ack messages.
    AxisOperation ackOperation = SpecSpecificConstants.getWSRMOperation(
        Sandesha2Constants.MessageTypes.ACK,
        rmdBean.getRMVersion(),
        msgContext.getAxisService());
   
    MessageContext ackMsgCtx = SandeshaUtil.createNewRelatedMessageContext(rmMsgCtx, ackOperation);
   
    //setting up the RMMsgContext
    RMMsgContext ackRMMsgCtx = MsgInitializer.initializeMessage(ackMsgCtx);
    ackRMMsgCtx.setRMNamespaceValue(rmMsgCtx.getRMNamespaceValue());
       
    ackMsgCtx.setTo(acksTo);
       
    ackRMMsgCtx.setRMNamespaceValue(rmMsgCtx.getRMNamespaceValue());
   
    if (ackMsgCtx.getMessageID()==null)
      ackMsgCtx.setMessageID(SandeshaUtil.getUUID());
   
    //adding the SOAP Envelope
    SOAPFactory factory = SOAPAbstractFactory.getSOAPFactory(SandeshaUtil.getSOAPVersion(msgContext.getEnvelope()));
    SOAPEnvelope envelope = factory.getDefaultEnvelope();
    try {
      ackMsgCtx.setEnvelope(envelope);
    } catch (AxisFault e3) {
      throw new SandeshaException(e3.getMessage());
    }

    ackMsgCtx.setReplyTo(msgContext.getTo());
    RMMsgCreator.addAckMessage(ackRMMsgCtx, sequenceId, rmdBean);
   
    //this is not a client generated message. So set serverSide to true.
    ackMsgCtx.setServerSide(true);

    if (acksTo.hasAnonymousAddress()) {
      //If acksTo is anonymous we will be sending the ack here it self. Transport will use what ever mechanism to send the
      //message. (for e.g. HTTP will use the back channel)

      // setting "response written" since acksto is anonymous
     
      //adding an OperationContext if one is not available. (for e.g. If we are in the SandeshaGlobalInHandler)
      if (rmMsgCtx.getMessageContext().getOperationContext() == null) {
        // operation context will be null when doing in a GLOBAL
        // handler.
       
        ServiceContext serviceCtx = msgContext.getServiceContext();
        OperationContext opCtx =  OperationContextFactory.createOperationContext(ackOperation.getAxisSpecificMEPConstant(), ackOperation, serviceCtx);

        rmMsgCtx.getMessageContext().setOperationContext(opCtx);
      }
     
      try {
        AxisEngine.send(ackMsgCtx);
        TransportUtils.setResponseWritten(ackMsgCtx, true);
      } catch (AxisFault e1) {
        throw new SandeshaException(e1.getMessage());
      }

    } else {
      //If AcksTo is non-anonymous we will be adding a senderBean entry here. The sender is responsible
      //for sending it out.
View Full Code Here


    while (iterator.hasNext()) {
      ackRequested = (AckRequested) iterator.next();
    }
   
    if (iterator.hasNext()) {
      throw new SandeshaException (SandeshaMessageHelper.getMessage(SandeshaMessageKeys.ackRequestMultipleParts));
    }
   
    if (ackRequested==null) {
      throw new SandeshaException (SandeshaMessageHelper.getMessage(SandeshaMessageKeys.noAckRequestPartFound));
    }
   
    ackRequestRMMsg.setWSAAction(SpecSpecificConstants.getAckRequestAction (getRMVersion()));
    ackRequestRMMsg.setSOAPAction(SpecSpecificConstants.getAckRequestSOAPAction (getRMVersion()));
View Full Code Here

    while(System.currentTimeMillis() < limit) {
      Thread.sleep(tickTime); // Try the assertions each tick interval, until they pass or we time out
     
      try {
            //assertions for the out sequence.
        SequenceReport sequenceReport = SandeshaClient.getOutgoingSequenceReport(serviceClient);
        assertEquals(sequenceReport.getSequenceStatus(),SequenceReport.SEQUENCE_STATUS_TERMINATED);
        assertEquals(sequenceReport.getSequenceDirection(),SequenceReport.SEQUENCE_DIRECTION_OUT);
       
        assertTrue(callback1.isErrorReported());
        assertEquals(callback1.getResult(),null);
       
        lastError = null;
View Full Code Here

    EndpointReference toEPR = new EndpointReference (toAddress);
    serviceClient.setTargetEPR(toEPR);
   
    serviceClient.setOptions(clientOptions);

    Callback callback1 = new TestCallback ("Callback 1");
    serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo1",sequenceKey),callback1);
   
    Callback callback2 = new TestCallback ("Callback 2");
    serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo2",sequenceKey),callback2);
   
    Callback callback3 = new TestCallback ("Callback 3");
    serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo3",sequenceKey),callback3);
   
        while (!callback3.isComplete()) {
            Thread.sleep(1000);
        }
       
    Thread.sleep(3000);
   
View Full Code Here

    // Create an RMSBean so the create sequence message can be created
    messageContext.setWSAAction(pingAction);

    // Set the AxisOperation to be InOut
    AxisOperation operation = messageContext.getAxisService().getOperation(Sandesha2Constants.RM_IN_OUT_OPERATION);
    operation.setMessageReceiver(new RMMessageReceiver());
    messageContext.setAxisOperation(operation);

    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
   
    // Serialize the application message
View Full Code Here

            if (wsRMPolicyKey != null) {
                Object property = synapseOutMessageContext.getEntry(wsRMPolicyKey);
                if (property instanceof OMElement) {
                    OMElement policyOMElement = (OMElement) property;
                    RMAssertionBuilder builder = new RMAssertionBuilder();
                    SandeshaPolicyBean sandeshaPolicyBean = (SandeshaPolicyBean) builder.build(policyOMElement, null);
                    Parameter policyParam = new Parameter(Sandesha2Constants.SANDESHA_PROPERTY_BEAN, sandeshaPolicyBean);
                    anoymousService.addParameter(policyParam);
                }
            }
        }
View Full Code Here

            if (wsRMPolicyKey != null) {
                Object property = synapseOutMessageContext.getEntry(wsRMPolicyKey);
                if (property instanceof OMElement) {
                    OMElement policyOMElement = (OMElement) property;
                    RMAssertionBuilder builder = new RMAssertionBuilder();
                    SandeshaPolicyBean sandeshaPolicyBean = (SandeshaPolicyBean) builder.build(policyOMElement, null);
                    Parameter policyParam = new Parameter(Sandesha2Constants.SANDESHA_PROPERTY_BEAN, sandeshaPolicyBean);
                    anoymousService.addParameter(policyParam);
                }
            }
        }
View Full Code Here

        super(name);
    }

    public void setUp() throws Exception {
        AxisConfiguration axisConfig = new AxisConfiguration();
        SandeshaPolicyBean propertyBean = new SandeshaPolicyBean ();
        Parameter parameter = new Parameter ();
        parameter.setName(Sandesha2Constants.SANDESHA_PROPERTY_BEAN);
        parameter.setValue(propertyBean);
        axisConfig.addParameter(parameter);
       
View Full Code Here

        super("SenderBeanMgrTest");
    }

    public void setUp() throws Exception {
        AxisConfiguration axisConfig = new AxisConfiguration();
        SandeshaPolicyBean propertyBean = new SandeshaPolicyBean ();
        Parameter parameter = new Parameter ();
        parameter.setName(Sandesha2Constants.SANDESHA_PROPERTY_BEAN);
        parameter.setValue(propertyBean);
        axisConfig.addParameter(parameter);
       
View Full Code Here

    try {
      AxisConfiguration axisConfiguration = new AxisConfiguration ();
      ConfigurationContext configurationContext = new ConfigurationContext (axisConfiguration);
     
      //setting a dummy property been to stop Sandesha2 from throwing exceptions.
      SandeshaPolicyBean policyBean = new SandeshaPolicyBean ();
      axisConfiguration.addParameter(new Parameter (Sandesha2Constants.SANDESHA_PROPERTY_BEAN,policyBean));
     
      InMemoryStorageManager storageManager = new InMemoryStorageManager (configurationContext);
     
      Transaction transaction = storageManager.getTransaction();
View Full Code Here

TOP

Related Classes of org.apache.sandesha2.SandeshaTestCase$TestCallback

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.