Author: mlovett
Date: Wed Nov 29 02:29:32 2006
New Revision: 480511
URL: http://svn.apache.org/viewvc?view=rev&rev=480511
Log:
Tom's patch for SANDESHA2-53, to ensure that we do not assign new messages to
closed sequences
Modified:
webservices/sandesha/trunk/java/src/org/apache/sandesha2/Sandesha2Constants.java
webservices/sandesha/trunk/java/src/org/apache/sandesha2/client/SandeshaClient.java
webservices/sandesha/trunk/java/src/org/apache/sandesha2/client/SandeshaClientConstants.java
webservices/sandesha/trunk/java/src/org/apache/sandesha2/i18n/SandeshaMessageKeys.java
webservices/sandesha/trunk/java/src/org/apache/sandesha2/i18n/resource.properties
webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java
webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/CloseSequenceProcessor.java
webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/Range.java
webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/RangeString.java
webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/SandeshaUtil.java
webservices/sandesha/trunk/java/test/src/org/apache/sandesha2/SandeshaClientTest.java
webservices/sandesha/trunk/java/test/src/org/apache/sandesha2/SandeshaUtilTest.java
Modified:
webservices/sandesha/trunk/java/src/org/apache/sandesha2/Sandesha2Constants.java
URL:
http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/Sandesha2Constants.java?view=diff&rev=480511&r1=480510&r2=480511
==============================================================================
---
webservices/sandesha/trunk/java/src/org/apache/sandesha2/Sandesha2Constants.java
(original)
+++
webservices/sandesha/trunk/java/src/org/apache/sandesha2/Sandesha2Constants.java
Wed Nov 29 02:29:32 2006
@@ -299,6 +299,8 @@
String SEQUENCE_CLOSED = "SequenceClosed";
+ String SEQUENCE_CLOSED_CLIENT = "SequenceClosedClient";
//indicates the client has sent a close sequence
+
String SEQUENCE_TERMINATED = "SequenceTerminated";
String SEQUENCE_TIMED_OUT = "SequenceTimedOut";
Modified:
webservices/sandesha/trunk/java/src/org/apache/sandesha2/client/SandeshaClient.java
URL:
http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/client/SandeshaClient.java?view=diff&rev=480511&r1=480510&r2=480511
==============================================================================
---
webservices/sandesha/trunk/java/src/org/apache/sandesha2/client/SandeshaClient.java
(original)
+++
webservices/sandesha/trunk/java/src/org/apache/sandesha2/client/SandeshaClient.java
Wed Nov 29 02:29:32 2006
@@ -784,10 +784,16 @@
throw new
SandeshaException(SandeshaMessageHelper.getMessage(
SandeshaMessageKeys.toEPRNotValid,
null));
- String to = epr.getAddress();
- String sequenceKey = (String)
options.getProperty(SandeshaClientConstants.SEQUENCE_KEY);
-
- String internalSequenceID =
SandeshaUtil.getInternalSequenceID(to, sequenceKey);
+ //first see if the cliet has told us which sequence to close
+ String internalSequenceID =
+
(String)options.getProperty(SandeshaClientConstants.INTERNAL_SEQUENCE_ID);
+
+ if(internalSequenceID==null){
+ //lookup the internal seq id based on to EPR and
sequenceKey
+ String to = epr.getAddress();
+ String sequenceKey = (String)
options.getProperty(SandeshaClientConstants.SEQUENCE_KEY);
+ internalSequenceID =
SandeshaUtil.getInternalSequenceID(to, sequenceKey);
+ }
SequenceReport sequenceReport =
SandeshaClient.getOutgoingSequenceReport(internalSequenceID,
configurationContext);
@@ -1085,9 +1091,17 @@
throw new
SandeshaException(SandeshaMessageHelper.getMessage(
SandeshaMessageKeys.toEPRNotValid,
null));
- String to = epr.getAddress();
- String sequenceKey = (String)
options.getProperty(SandeshaClientConstants.SEQUENCE_KEY);
- String internalSequenceID =
SandeshaUtil.getInternalSequenceID(to, sequenceKey);
+ //first see if the cliet has told us which sequence to terminate
+ String internalSequenceID =
+
(String)options.getProperty(SandeshaClientConstants.INTERNAL_SEQUENCE_ID);
+
+ if(internalSequenceID==null){
+ //lookup the internal seq id based on to EPR and
sequenceKey
+ String to = epr.getAddress();
+ String sequenceKey = (String)
options.getProperty(SandeshaClientConstants.SEQUENCE_KEY);
+ internalSequenceID =
SandeshaUtil.getInternalSequenceID(to, sequenceKey);
+ }
+
SequenceReport sequenceReport =
SandeshaClient.getOutgoingSequenceReport(internalSequenceID,
configurationContext);
if (sequenceReport == null)
Modified:
webservices/sandesha/trunk/java/src/org/apache/sandesha2/client/SandeshaClientConstants.java
URL:
http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/client/SandeshaClientConstants.java?view=diff&rev=480511&r1=480510&r2=480511
==============================================================================
---
webservices/sandesha/trunk/java/src/org/apache/sandesha2/client/SandeshaClientConstants.java
(original)
+++
webservices/sandesha/trunk/java/src/org/apache/sandesha2/client/SandeshaClientConstants.java
Wed Nov 29 02:29:32 2006
@@ -23,6 +23,7 @@
public static String AcksTo = "Sandesha2AcksTo";
public static String LAST_MESSAGE = "Sandesha2LastMessage";
public static String OFFERED_SEQUENCE_ID = "Sandesha2OfferedSequenceId";
+ public static String INTERNAL_SEQUENCE_ID =
"Sandesha2InternalSequenceId";
public static String SANDESHA_DEBUG_MODE = "Sandesha2DebugMode";
public static String SEQUENCE_KEY = "Sandesha2SequenceKey";
public static String MESSAGE_NUMBER = "Sandesha2MessageNumber";
Modified:
webservices/sandesha/trunk/java/src/org/apache/sandesha2/i18n/SandeshaMessageKeys.java
URL:
http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/i18n/SandeshaMessageKeys.java?view=diff&rev=480511&r1=480510&r2=480511
==============================================================================
---
webservices/sandesha/trunk/java/src/org/apache/sandesha2/i18n/SandeshaMessageKeys.java
(original)
+++
webservices/sandesha/trunk/java/src/org/apache/sandesha2/i18n/SandeshaMessageKeys.java
Wed Nov 29 02:29:32 2006
@@ -20,6 +20,7 @@
public static final String invokeMsgError="invokeMsgError";
public static final String msgError="msgError";
public static final String sendMsgError="sendMsgError";
+ public static final String
cannotSendMsgAsSequenceClosed="cannotSendMsgAsSequenceClosed";
public static final String noValidSyncResponse="noValidSyncResponse";
public static final String generalError="generalError";
public static final String classLoaderNotFound="classLoaderNotFound";
Modified:
webservices/sandesha/trunk/java/src/org/apache/sandesha2/i18n/resource.properties
URL:
http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/i18n/resource.properties?view=diff&rev=480511&r1=480510&r2=480511
==============================================================================
---
webservices/sandesha/trunk/java/src/org/apache/sandesha2/i18n/resource.properties
(original)
+++
webservices/sandesha/trunk/java/src/org/apache/sandesha2/i18n/resource.properties
Wed Nov 29 02:29:32 2006
@@ -37,6 +37,7 @@
invokeMsgError=Sandesha2 got an exception when invoking message: {0}
msgError=Sandesha2 got an exception when processing a message: {0}
sendMsgError=Sandesha2 got an exception when sending a message: {0}
+cannotSendMsgAsSequenceClosed=Sandesha2 could not send the message on sequence
{0} as the sequence has been closed.
noValidSyncResponse=Sandesha2 sender thread has not received a valid
synchronous response...
generalError=Sandesha2 Internal Error: sandesha2 encountered the following
exception {0}
classLoaderNotFound=Module class loader not found.
Modified:
webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java
URL:
http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java?view=diff&rev=480511&r1=480510&r2=480511
==============================================================================
---
webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java
(original)
+++
webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java
Wed Nov 29 02:29:32 2006
@@ -220,6 +220,12 @@
if (dummyMessageString != null &&
Sandesha2Constants.VALUE_TRUE.equals(dummyMessageString))
dummyMessage = true;
+ //see if the sequence is closed
+ SequencePropertyBean sequenceClosed =
seqPropMgr.retrieve(sequencePropertyKey,
Sandesha2Constants.SequenceProperties.SEQUENCE_CLOSED_CLIENT);
+ if(sequenceClosed!=null){
+ throw new
SandeshaException(SandeshaMessageHelper.getMessage(SandeshaMessageKeys.cannotSendMsgAsSequenceClosed,
internalSequenceId));
+ }
+
// saving the used message number
if (!dummyMessage)
setNextMsgNo(configContext, sequencePropertyKey,
messageNumber, storageManager);
Modified:
webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/CloseSequenceProcessor.java
URL:
http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/CloseSequenceProcessor.java?view=diff&rev=480511&r1=480510&r2=480511
==============================================================================
---
webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/CloseSequenceProcessor.java
(original)
+++
webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/CloseSequenceProcessor.java
Wed Nov 29 02:29:32 2006
@@ -97,12 +97,11 @@
if (fault != null) {
throw fault;
}
-
+
SequencePropertyBean sequenceClosedBean = new
SequencePropertyBean();
sequenceClosedBean.setSequencePropertyKey(sequencePropertyKey);
sequenceClosedBean.setName(Sandesha2Constants.SequenceProperties.SEQUENCE_CLOSED);
sequenceClosedBean.setValue(Sandesha2Constants.VALUE_TRUE);
-
sequencePropMgr.insert(sequenceClosedBean);
RMMsgContext ackRMMsgCtx =
AcknowledgementManager.generateAckMessage(rmMsgCtx, sequencePropertyKey,
sequenceId, storageManager);
@@ -162,6 +161,8 @@
sequenceId, e.toString());
throw new SandeshaException(message, e);
}
+
+
if (log.isDebugEnabled())
log.debug("Exit:
CloseSequenceProcessor::processInMessage " + Boolean.FALSE);
@@ -190,6 +191,12 @@
throw new
SandeshaException(SandeshaMessageHelper.getMessage(
SandeshaMessageKeys.couldNotSendCloseSeqNotFound, internalSeqenceID));
+ //write into the sequence proeprties that the client is now
closed
+ SequencePropertyBean sequenceClosedBean = new
SequencePropertyBean();
+ sequenceClosedBean.setSequencePropertyKey(internalSeqenceID);
+
sequenceClosedBean.setName(Sandesha2Constants.SequenceProperties.SEQUENCE_CLOSED_CLIENT);
+ sequenceClosedBean.setValue(Sandesha2Constants.VALUE_TRUE);
+
storageManager.getSequencePropertyBeanMgr().insert(sequenceClosedBean);
AxisOperation closeOperation =
SpecSpecificConstants.getWSRMOperation(
Sandesha2Constants.MessageTypes.CLOSE_SEQUENCE,
Modified:
webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/Range.java
URL:
http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/Range.java?view=diff&rev=480511&r1=480510&r2=480511
==============================================================================
--- webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/Range.java
(original)
+++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/Range.java
Wed Nov 29 02:29:32 2006
@@ -1,3 +1,20 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
package org.apache.sandesha2.util;
import org.apache.commons.logging.Log;
Modified:
webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/RangeString.java
URL:
http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/RangeString.java?view=diff&rev=480511&r1=480510&r2=480511
==============================================================================
---
webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/RangeString.java
(original)
+++
webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/RangeString.java
Wed Nov 29 02:29:32 2006
@@ -1,3 +1,20 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
package org.apache.sandesha2.util;
import java.util.Collections;
Modified:
webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/SandeshaUtil.java
URL:
http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/SandeshaUtil.java?view=diff&rev=480511&r1=480510&r2=480511
==============================================================================
---
webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/SandeshaUtil.java
(original)
+++
webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/SandeshaUtil.java
Wed Nov 29 02:29:32 2006
@@ -930,6 +930,28 @@
return sequenceID;
}
+
+ public static String getSequenceKeyFromInternalSequenceID(String
internalSequenceID, String to){
+ if(to==null){
+ //sequenceKey is just the internalSequenceID
+ return internalSequenceID;
+ }
+ else{
+ //remove the prefix
+ int postPrefixStringIndex =
internalSequenceID.indexOf(Sandesha2Constants.INTERNAL_SEQUENCE_PREFIX);
+ if(postPrefixStringIndex>=0){
+ String postPrefixString =
internalSequenceID.substring(postPrefixStringIndex +
Sandesha2Constants.INTERNAL_SEQUENCE_PREFIX.length());
+ //strip of the to epr and trailing and trailing
":"
+ String toEPRString = ":" + to + ":";
+ int indexOfToEPR =
postPrefixString.indexOf(toEPRString);
+ if(indexOfToEPR>=0){
+ return
postPrefixString.substring(indexOfToEPR + toEPRString.length());
+ }
+ }
+ }
+ return null; //could not find the sequenceKey
+ }
+
public static SecurityManager getSecurityManager(ConfigurationContext
context) throws SandeshaException {
SecurityManager util = (SecurityManager)
context.getProperty(Sandesha2Constants.SECURITY_MANAGER);
Modified:
webservices/sandesha/trunk/java/test/src/org/apache/sandesha2/SandeshaClientTest.java
URL:
http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/test/src/org/apache/sandesha2/SandeshaClientTest.java?view=diff&rev=480511&r1=480510&r2=480511
==============================================================================
---
webservices/sandesha/trunk/java/test/src/org/apache/sandesha2/SandeshaClientTest.java
(original)
+++
webservices/sandesha/trunk/java/test/src/org/apache/sandesha2/SandeshaClientTest.java
Wed Nov 29 02:29:32 2006
@@ -32,6 +32,7 @@
import org.apache.axis2.client.ServiceClient;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.context.MessageContextConstants;
import org.apache.axis2.transport.http.SimpleHTTPServer;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -102,8 +103,6 @@
public void testCreateSequenceWithOffer () throws
AxisFault,InterruptedException {
- startServer();
-
String to = "http://127.0.0.1:" + serverPort +
"/axis2/services/RMSampleService";
String transportTo = "http://127.0.0.1:" + serverPort +
"/axis2/services/RMSampleService";
@@ -111,9 +110,8 @@
String axis2_xml = "target" + File.separator + "repos" +
File.separator + "client" + File.separator + "client_axis2.xml";
ConfigurationContext configContext =
ConfigurationContextFactory.createConfigurationContextFromFileSystem(repoPath,axis2_xml);
-
Options clientOptions = new Options ();
-
+
clientOptions.setTo(new EndpointReference (to));
clientOptions.setProperty(Configuration.TRANSPORT_URL,transportTo);
@@ -122,34 +120,111 @@
ServiceClient serviceClient = new ServiceClient
(configContext,null);
- String acksTo =
serviceClient.getMyEPR(Constants.TRANSPORT_HTTP).getAddress();
-
clientOptions.setProperty(SandeshaClientConstants.AcksTo,acksTo);
- clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
-
- String offeredSequenceID = SandeshaUtil.getUUID();
-
clientOptions.setProperty(SandeshaClientConstants.OFFERED_SEQUENCE_ID,offeredSequenceID);
-
- serviceClient.setOptions(clientOptions);
- //serviceClient.
-
- clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
- clientOptions.setUseSeparateListener(true);
-
- serviceClient.setOptions(clientOptions);
-
- String sequenceKey =
SandeshaClient.createSequence(serviceClient,true);
- clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY,
sequenceKey);
-
- Thread.sleep(10000);
-
- SequenceReport sequenceReport =
SandeshaClient.getOutgoingSequenceReport(serviceClient);
-
- assertNotNull(sequenceReport.getSequenceID());
- assertFalse(sequenceReport.isSecureSequence());
-
- configContext.getListenerManager().stop();
- serviceClient.cleanup();
+ startServer();
+ try
+ {
+ String acksTo =
serviceClient.getMyEPR(Constants.TRANSPORT_HTTP).getAddress();
+
clientOptions.setProperty(SandeshaClientConstants.AcksTo,acksTo);
+
clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
+
+ String offeredSequenceID = SandeshaUtil.getUUID();
+
clientOptions.setProperty(SandeshaClientConstants.OFFERED_SEQUENCE_ID,offeredSequenceID);
+
+ serviceClient.setOptions(clientOptions);
+ //serviceClient.
+
+
clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
+ clientOptions.setUseSeparateListener(true);
+
+ serviceClient.setOptions(clientOptions);
+
+ String sequenceKey =
SandeshaClient.createSequence(serviceClient,true);
+
clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY, sequenceKey);
+
+ Thread.sleep(10000);
+
+ SequenceReport sequenceReport =
SandeshaClient.getOutgoingSequenceReport(serviceClient);
+
+ assertNotNull(sequenceReport.getSequenceID());
+ assertFalse(sequenceReport.isSecureSequence());
+ }
+ finally
+ {
+ configContext.getListenerManager().stop();
+ serviceClient.cleanup();
+ }
+
}
+
+ public void testSequenceCloseTerminate()throws Exception{
+ startServer();
+ String to = "http://127.0.0.1:" + serverPort +
"/axis2/services/RMSampleService";
+ String transportTo = "http://127.0.0.1:" + serverPort +
"/axis2/services/RMSampleService";
+
+ String repoPath = "target" + File.separator + "repos" +
File.separator + "client";
+ String axis2_xml = "target" + File.separator + "repos"
+ File.separator + "client" + File.separator + "client_axis2.xml";
+
+ ConfigurationContext configContext =
ConfigurationContextFactory.createConfigurationContextFromFileSystem(repoPath,axis2_xml);
+
+ Options clientOptions = new Options ();
+
clientOptions.setSoapVersionURI(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+
clientOptions.setProperty(SandeshaClientConstants.RM_SPEC_VERSION,
+ Sandesha2Constants.SPEC_VERSIONS.v1_1);
+ clientOptions.setTo(new EndpointReference (to));
+
clientOptions.setProperty(MessageContextConstants.TRANSPORT_URL,transportTo);
+
+ String sequenceKey = "some_sequence_key";
+
clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY,sequenceKey);
+
+ ServiceClient serviceClient = new ServiceClient
(configContext,null);
+
+ String acksTo =
serviceClient.getMyEPR(Constants.TRANSPORT_HTTP).getAddress();
+
clientOptions.setProperty(SandeshaClientConstants.AcksTo,acksTo);
+
clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
+ //serviceClient.
+ serviceClient.setOptions(clientOptions);
+
+ try{
+
+
serviceClient.fireAndForget(getPingOMBlock("ping1"));
+
+ Thread.sleep(10000);
+
+ SequenceReport sequenceReport =
SandeshaClient.getOutgoingSequenceReport(serviceClient);
+ assertNotNull(sequenceReport.getSequenceID());
+
+ //now close the sequence
+ SandeshaClient.closeSequence(serviceClient);
+
+ //try and send another msg - this should fail
+ try{
+
serviceClient.fireAndForget(getPingOMBlock("ping2"));
+ fail(); //this should have failed
+ }
+ catch(Exception e){
+ //good
+ }
+
+ //finally terminate the sequence
+ terminateAndCheck(serviceClient);
+ }
+ finally{
+ configContext.getListenerManager().stop();
+ serviceClient.cleanup();
+ }
+
+ }
+
+ private void terminateAndCheck(ServiceClient srvcClient)throws
Exception{
+ SandeshaClient.terminateSequence(srvcClient);
+ //wait
+ Thread.sleep(1000);
+ //now check the sequence is terminated
+ SequenceReport report =
SandeshaClient.getOutgoingSequenceReport(srvcClient);
+ assertNotNull(report);
+ assertEquals(report.getSequenceStatus(),
SequenceReport.SEQUENCE_STATUS_TERMINATED);
+
+ }
// public void testCreateSequenceWithoutOffer () {
//// SandeshaClient.createSequence(serviceClient,true);
Modified:
webservices/sandesha/trunk/java/test/src/org/apache/sandesha2/SandeshaUtilTest.java
URL:
http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/test/src/org/apache/sandesha2/SandeshaUtilTest.java?view=diff&rev=480511&r1=480510&r2=480511
==============================================================================
---
webservices/sandesha/trunk/java/test/src/org/apache/sandesha2/SandeshaUtilTest.java
(original)
+++
webservices/sandesha/trunk/java/test/src/org/apache/sandesha2/SandeshaUtilTest.java
Wed Nov 29 02:29:32 2006
@@ -41,6 +41,26 @@
assertTrue(UUID2.startsWith("urn:uuid:"));
}
+ public void testInternalSequenceIDToSequenceKeyConversion()throws
SandeshaException{
+ String toEPR = "http://127.0.0.1:1111/some_random_uri";
+ String sequenceKey = "1234abcd";
+
+ String internalSequenceID =
SandeshaUtil.getInternalSequenceID(toEPR, sequenceKey);
+
+ //check that we can parse out the sequence key
+ assertEquals(sequenceKey,
SandeshaUtil.getSequenceKeyFromInternalSequenceID(internalSequenceID, toEPR));
+
+ //try an internal sequenceID without a sequenceKey - should get
null
+ internalSequenceID =
SandeshaUtil.getSequenceKeyFromInternalSequenceID(toEPR, null);
+
assertNull(SandeshaUtil.getSequenceKeyFromInternalSequenceID(internalSequenceID,
toEPR));
+
+ //for badly formed sequences, or for server-side response
sequences, check
+ //we just get null
+ String outgoingSequenceID =
SandeshaUtil.getOutgoingSideInternalSequenceID(SandeshaUtil.getUUID());
+
assertNull(SandeshaUtil.getSequenceKeyFromInternalSequenceID(outgoingSequenceID,
toEPR));
+
+ }
+
public void testGetAckRangeArrayList () throws SandeshaException {
SOAPFactory factory =
SOAPAbstractFactory.getSOAPFactory(Sandesha2Constants.SOAPVersion.v1_1);
String msgNumberStr = "3,6,1,5,8,2";
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]