Package org.apache.sandesha2

Examples of org.apache.sandesha2.SquenceOfferTest


    RMDBeanMgr rmdMgr = storageManager.getRMDBeanMgr();
    RMDBean rmdBean = rmdMgr.retrieve(sequenceId);
    String outBoundInternalSequence = rmdBean.getOutboundInternalSequence();
   
    RMSBeanMgr rmsBeanMgr = storageManager.getRMSBeanMgr();
    RMSBean findBean = new RMSBean ();
    findBean.setInternalSequenceID(outBoundInternalSequence);
    RMSBean rmsBean = rmsBeanMgr.findUnique (findBean);
   
    if (rmsBean!=null && rmsBean.getLastOutMessage()<=0) {
      //there is a RMS sequence without a LastMsg entry
     
      MessageContext msgContext = rmMsgCtx.getMessageContext();
     
      AxisOperation operation = SpecSpecificConstants.getWSRMOperation(Sandesha2Constants.MessageTypes.LAST_MESSAGE,
View Full Code Here


    rmsBean.setRMVersion(Sandesha2Constants.SPEC_VERSIONS.v1_1);
    rmsBean.setClientCompletedMessages(new RangeString());
    rmsBean.setNextMessageNumber(4);
    rmsBean.setHighestOutMessageNumber(3);
   
    SenderBean bean1 = getSenderBean(seqID, 1, 1);
    SenderBean bean2 = getSenderBean(seqID, 0, 2);
    SenderBean bean3 = getSenderBean(seqID, 1, 3);   

    // Create a transaction and insert the RMSBean
    Transaction tran = storageManager.getTransaction();
   
    rmsBeanMgr.insert(rmsBean);
View Full Code Here

   
    return outputStream.toByteArray();
  }
 
  private static SenderBean getSenderBean(String seqID, int sendCount, int messageNo) {
    SenderBean bean = new SenderBean();
    bean.setInternalSequenceID(SandeshaUtil.getInternalSequenceID(seqID, null))
    bean.setSequenceID(seqID);
    bean.setMessageID(SandeshaUtil.getUUID());   
    bean.setSentCount(sendCount);
    bean.setSend(true);
    bean.setReSend(true);
    bean.setMessageType(Sandesha2Constants.MessageTypes.APPLICATION);
    bean.setMessageNumber(messageNo);
   
    return bean;
  }
View Full Code Here

    }

    public void testDelete() throws SandeshaStorageException {
        assertNull(mgr.retrieve(""));
        try {
            mgr.insert(new SenderBean("MsgId1", "Key1", false , 1001 , "TmpSeqId1", 1001));
        } catch (Exception ex) {
            fail("should not throw an exception");
        }
        assertNotNull(mgr.retrieve("MsgId1"));
    }
View Full Code Here

        assertNotNull(mgr.retrieve("MsgId1"));
    }

    public void testFind() {
        try {
            mgr.insert(new SenderBean("MsgId2", "Key2", false , 1001 , "TmpSeqId2", 1002));
            mgr.insert(new SenderBean("MsgId3", "Key3", false , 1001 , "TmpSeqId2", 1003));

            SenderBean target = new SenderBean();
            target.setInternalSequenceID("TmpSeqId2");

            Iterator iterator = mgr.find(target).iterator();
            SenderBean tmp = (SenderBean) iterator.next();

            if (tmp.getMessageID().equals("MsgId2")) {
                tmp = (SenderBean) iterator.next();
                assertTrue(tmp.getMessageID().equals("MsgId3"));
            } else {
                tmp = (SenderBean) iterator.next();
                assertTrue(tmp.getMessageID().equals("MsgId2"));
            }


        } catch (SandeshaException e) {
            fail("should not throw an exception");
View Full Code Here

//
//        } catch (SandeshaException ex) {
//        }

        try {
            mgr.insert(new SenderBean("MsgId4","Key4", false , 1001 , "TmpSeqId4", 1004));
            SenderBean tmp = mgr.retrieve("MsgId4");
            assertTrue(tmp.getMessageContextRefKey().equals("Key4"));


        } catch (SandeshaException e) {
            fail("should not throw an exception");
        }
View Full Code Here

    }

    public void testRetrieve() throws SandeshaStorageException {
        assertNull(mgr.retrieve("MsgId5"));
        try {
            mgr.insert(new SenderBean("MsgId5", "Key5", false , 1001 , "TmpSeqId5", 1005));
        } catch (SandeshaException e) {
            fail("this should not throw an exception");
        }
        assertNotNull(mgr.retrieve("MsgId5"));
    }
View Full Code Here

        }
        assertNotNull(mgr.retrieve("MsgId5"));
    }

    public void testUpdate() throws SandeshaStorageException {
        SenderBean bean = new SenderBean("MsgId6", "Key6", false , 1001 , "TmpSeqId6", 1006);
        try {
            mgr.insert(bean);
        } catch (SandeshaException e) {
            fail("should not throw an exception");
        }
        bean.setSend(true);
        mgr.update(bean);

        SenderBean tmp = mgr.retrieve("MsgId6");
        assertTrue(tmp.isSend());
    }
View Full Code Here

    // Ensure the outbound message us secured using the correct token
    RMMsgCreator.secureOutboundMessage(getRMSBean(), msgContext);
   
    String key = SandeshaUtil.getUUID();

    SenderBean senderBean = new SenderBean();
    senderBean.setMessageType(msgType);
    senderBean.setMessageContextRefKey(key);
    senderBean.setTimeToSend(System.currentTimeMillis() + delay);
    senderBean.setMessageID(msgContext.getMessageID());
   
    // Set the internal sequence id and outgoing sequence id for the terminate message
    senderBean.setInternalSequenceID(internalSequenceID);
    if (sequenceExists)
    {
      senderBean.setSend(true);
      senderBean.setSequenceID(outSequenceID);
    }
    else
      senderBean.setSend(false);     
   
    EndpointReference to = msgContext.getTo();
    if (to!=null)
      senderBean.setToAddress(to.getAddress());

    // If this message is targetted at an anonymous address then we must not have a transport
    // ready for it, as the current message is not a reply.
    if(to == null || to.hasAnonymousAddress())
      senderBean.setTransportAvailable(false);
   
    msgContext.setProperty(Sandesha2Constants.QUALIFIED_FOR_SENDING, Sandesha2Constants.VALUE_FALSE);

    senderBean.setReSend(false);

    SenderBeanMgr retramsmitterMgr = storageManager.getSenderBeanMgr();
   
    SandeshaUtil.executeAndStore(rmMsgCtx, key);
 
View Full Code Here

     
      //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();
     
      RMSBeanMgr rmsBeanMgr = storageManager.getRMSBeanMgr();
     
      RMSBean rmsBean = new RMSBean ();
      RMSBean duplicateRMSBean = new RMSBean ();
     
      rmsBean.setCreateSeqMsgID(SandeshaUtil.getUUID());
View Full Code Here

TOP

Related Classes of org.apache.sandesha2.SquenceOfferTest

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.