Package org.apache.sandesha2.storage.beanmanagers

Examples of org.apache.sandesha2.storage.beanmanagers.NextMsgBeanMgr


    public void tearDown() throws Exception {
      transaction.commit();
    }

    public void testDelete() throws SandeshaStorageException{
        mgr.insert(new RMDBean("SeqId1", 1001));
        mgr.delete("SeqId1");
        assertNull(mgr.retrieve("SeqId1"));
    }
View Full Code Here


        mgr.delete("SeqId1");
        assertNull(mgr.retrieve("SeqId1"));
    }

    public void testFind() throws SandeshaStorageException {
        mgr.insert(new RMDBean("SeqId2", 1002));
        mgr.insert(new RMDBean("SeqId3", 1002));

        RMDBean target = new RMDBean();
        target.setNextMsgNoToProcess(1002);

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

        if (tmp.getSequenceID().equals("SeqId2")) {
            tmp = (RMDBean) iterator.next();
            tmp.getSequenceID().equals("SeqId3");
        } else {
            tmp = (RMDBean) iterator.next();
            tmp.getSequenceID().equals("SeqId2");
        }

    }
View Full Code Here

        }

    }

    public void testInsert() throws SandeshaStorageException {
        RMDBean bean = new RMDBean("SeqId4", 1004);
        mgr.insert(bean);
        RMDBean tmp = mgr.retrieve("SeqId4");
        assertTrue(tmp.getNextMsgNoToProcess() == 1004);
    }
View Full Code Here

        assertTrue(tmp.getNextMsgNoToProcess() == 1004);
    }

    public void testRetrieve() throws SandeshaStorageException {
        assertNull(mgr.retrieve("SeqId5"));
        mgr.insert(new RMDBean("SeqId5", 1005));

        RMDBean tmp = mgr.retrieve("SeqId5");
        assertTrue(tmp.getNextMsgNoToProcess() == 1005);
    }
View Full Code Here

        RMDBean tmp = mgr.retrieve("SeqId5");
        assertTrue(tmp.getNextMsgNoToProcess() == 1005);
    }

    public void testUpdate() throws SandeshaStorageException {
        RMDBean bean = new RMDBean("SeqId6", 1006);
        mgr.insert(bean);
        bean.setNextMsgNoToProcess(1007);
        mgr.update(bean);
        RMDBean tmp = mgr.retrieve("SeqId6");
        assertTrue(tmp.getNextMsgNoToProcess() ==1007);
    }
View Full Code Here

    String sequenceId = closeSequence.getIdentifier().getIdentifier();
   
    StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(configCtx, configCtx
        .getAxisConfiguration());

    RMDBean rmdBean = SandeshaUtil.getRMDBeanFromSequenceId(storageManager, sequenceId);

    // Check that the sender of this CloseSequence holds the correct token
    if(rmdBean != null && rmdBean.getSecurityTokenData() != null) {
      SecurityManager secManager = SandeshaUtil.getSecurityManager(msgCtx.getConfigurationContext());
      OMElement body = msgCtx.getEnvelope().getBody();
      SecurityToken token = secManager.recoverSecurityToken(rmdBean.getSecurityTokenData());
      secManager.checkProofOfPossession(token, body, msgCtx);
    }

    if (FaultManager.checkForUnknownSequence(rmMsgCtx, sequenceId, storageManager, false)) {
      if (log.isDebugEnabled())
        log.debug("Exit: CloseSequenceProcessor::processInMessage, Unknown sequence " + sequenceId);
      return false;
    }
   
    // throwing a fault if the sequence is terminated
    if (FaultManager.checkForSequenceTerminated(rmMsgCtx, sequenceId, rmdBean, false)) {
      if (log.isDebugEnabled())
        log.debug("Exit: CloseSequenceProcessor::processInMessage, Sequence terminated");
      return false;
    }

    rmdBean.setClosed(true);
    storageManager.getRMDBeanMgr().update(rmdBean);

    RMMsgContext ackRMMsgCtx = AcknowledgementManager.generateAckMessage(rmMsgCtx, rmdBean, sequenceId, storageManager, true);
    // adding the ack part(s) to the envelope.
    Iterator sequenceAckIter = ackRMMsgCtx
View Full Code Here

      StorageManager storageManager =
        SandeshaUtil.getSandeshaStorageManager(configContext, configContext.getAxisConfiguration());
     
      Transaction tran = storageManager.getTransaction();
     
      RMSBean finderBean = new RMSBean();
      List rmsBeans = storageManager.getRMSBeanMgr().find(finderBean);
     
      tran.commit();
     
      lastError = null;
View Full Code Here

    messageContext.setEnvelope(dummyEnvelope);
   
    RMMsgContext applicationRMMsg = new RMMsgContext(messageContext);
   
    // Create an RMSBean so the create sequence message can be created
    RMSBean rmsBean = new RMSBean();
    rmsBean.setRMVersion(Sandesha2Constants.SPEC_VERSIONS.v1_1);
    rmsBean.setToEPR(to);
    rmsBean.setAcksToEPR(AddressingConstants.Final.WSA_NONE_URI);
       
    // Create a Create Sequence message
    // generating a new create sequeuce message.
    RMMsgContext createSeqRMMessage = RMMsgCreator.createCreateSeqMsg(rmsBean, applicationRMMsg);
    messageContext = createSeqRMMessage.getMessageContext();
    messageContext.setWSAAction(SpecSpecificConstants.getCreateSequenceAction(Sandesha2Constants.SPEC_VERSIONS.v1_1));

    CreateSequence createSeqResPart = (CreateSequence) createSeqRMMessage
    .getMessagePart(Sandesha2Constants.MessageParts.CREATE_SEQ);

    createSeqResPart.setAcksTo(
        new AcksTo(new EndpointReference(AddressingConstants.Final.WSA_NONE_URI),
                   SpecSpecificConstants.getRMNamespaceValue(rmsBean.getRMVersion()),
                   AddressingConstants.Final.WSA_NAMESPACE));
   
    // Update the SOAP Envelope of the message
    createSeqRMMessage.addSOAPEnvelope();
View Full Code Here

    SenderBeanMgr senderMgr = storageManager.getSenderBeanMgr();
   
    String seqID = SandeshaUtil.getUUID();
   
    // Mockup an RMSBean
    RMSBean rmsBean = new RMSBean();
    rmsBean.setCreateSeqMsgID(SandeshaUtil.getUUID());
    rmsBean.setSequenceID(seqID);
    rmsBean.setInternalSequenceID(SandeshaUtil.getInternalSequenceID(seqID, null));
    rmsBean.setToEPR(AddressingConstants.Final.WSA_ANONYMOUS_URL);
    rmsBean.setAcksToEPR(AddressingConstants.Final.WSA_ANONYMOUS_URL);
    rmsBean.setReplyToEPR(AddressingConstants.Final.WSA_ANONYMOUS_URL);
    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);   
View Full Code Here

     
      Transaction transaction = storageManager.getTransaction();
     
      RMSBeanMgr rmsBeanMgr = storageManager.getRMSBeanMgr();
     
      RMSBean rmsBean = new RMSBean ();
      RMSBean duplicateRMSBean = new RMSBean ();
     
      rmsBean.setCreateSeqMsgID(SandeshaUtil.getUUID());
      duplicateRMSBean.setCreateSeqMsgID(SandeshaUtil.getUUID());
     
      String sequenceId = SandeshaUtil.getUUID();
     
      //we duplicate this sequenceID in both RMSBeans.
      rmsBean.setSequenceID(sequenceId);
      duplicateRMSBean.setSequenceID(sequenceId);
     
      rmsBeanMgr.insert(rmsBean);
     
      boolean exceptionThrown = false;
      try {
View Full Code Here

TOP

Related Classes of org.apache.sandesha2.storage.beanmanagers.NextMsgBeanMgr

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.