whitlock 2002/12/05 08:49:20
Modified: java/test/soap OutputPartsTest.java
java/test/jms JmsFaultTest.java JmsFault.wsdl
java/test/util TestUtilities.java
java/src/org/apache/wsif/util/jms WSIFJMSDestination.java
java/test/org/apache/wsif/util/jms
NativeJMSRequestListener.java JMSAsyncListener.java
java/src/org/apache/wsif/providers/jms
WSIFOperation_Jms.java
Added: java/test/util BridgeThread.java
Log:
JMS fault fixes, split out BridgeThread, better use of TestUtilities
Revision Changes Path
1.5 +4 -32 xml-axis-wsif/java/test/soap/OutputPartsTest.java
Index: OutputPartsTest.java
===================================================================
RCS file: /home/cvs/xml-axis-wsif/java/test/soap/OutputPartsTest.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- OutputPartsTest.java 24 Oct 2002 18:05:47 -0000 1.4
+++ OutputPartsTest.java 5 Dec 2002 16:49:19 -0000 1.5
@@ -353,7 +353,10 @@
System.out.println( "async operation done, correlation id=" +
id.getCorrelationId() );
op = null;
- Object jmsResponse = getJMSResponse( id.getCorrelationId() );
+ Object jmsResponse =
+ TestUtilities.getJMSAsyncResponse(
+ id.getCorrelationId(),
+ TestUtilities.getWsifProperty("wsif.async.replytoq2"));
WSIFCorrelationService cs =
WSIFCorrelationServiceLocator.getCorrelationService();
@@ -373,35 +376,4 @@
return output;
}
-
- private Message getJMSResponse(String id) throws WSIFException, JMSException {
- String initialContextFactory = "com.sun.jndi.fscontext.RefFSContextFactory";
- String jndiUrl = "file:///JNDI-Directory";
- String queueConnectionFactory = "WSIFSampleQCF";
-
- WSIFJMSFinder finder =
- new WSIFJMSFinderForJndi(
- null,
- initialContextFactory,
- jndiUrl,
- WSIFJMSFinder.STYLE_QUEUE,
- queueConnectionFactory,
- null,
- null);
-
- QueueConnectionFactory factory = finder.getFactory();
- QueueConnection connection = factory.createQueueConnection();
- connection.start();
- QueueSession session =
- connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
- Queue readQ =
- session.createQueue(
- TestUtilities.getWsifProperty("wsif.async.replytoq2"));
- QueueReceiver receiver =
- session.createReceiver(readQ, "JMSCorrelationID='" + id + "'");
-
- TextMessage tm = (TextMessage)
receiver.receive(WSIFProperties.getAsyncTimeout());
- return tm;
- }
-
}
1.4 +83 -8 xml-axis-wsif/java/test/jms/JmsFaultTest.java
Index: JmsFaultTest.java
===================================================================
RCS file: /home/cvs/xml-axis-wsif/java/test/jms/JmsFaultTest.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- JmsFaultTest.java 10 Oct 2002 14:51:43 -0000 1.3
+++ JmsFaultTest.java 5 Dec 2002 16:49:19 -0000 1.4
@@ -80,8 +80,8 @@
public class JmsFaultTest extends TestCase {
String wsdlLocation = TestUtilities.getWsdlPath("java\\test\\jms") +
"jmsfault.wsdl";
- private static final boolean ASYNC = true;
private static final boolean SYNC = true;
+ private static final boolean ASYNC = false;
public JmsFaultTest(String name) {
super(name);
@@ -102,13 +102,14 @@
}
public void testNoFaultSync() {
- doit("throwSimple", 0, false, null, null, SYNC);
+ doit("throwSimple", 0, false, false, null, null, SYNC);
}
public void testSimpleSync() {
doit(
"throwSimple",
1,
+ true,
false,
new String[] { "faultText" },
new Object[] { "A Simple Fault" }, SYNC);
@@ -118,6 +119,7 @@
doit(
"throwSimple",
2,
+ true,
false,
new String[] { "faultInt1", "faultInt2", "faultInt3" },
new Object[] { new Integer(1), new Integer(2), new Integer(3)}, SYNC);
@@ -127,6 +129,7 @@
doit(
"throwSimple",
3,
+ true,
false,
new String[] { "faultInt1", "faultInt2" },
new Object[] { new Integer(1), new Integer(2) }, SYNC);
@@ -136,6 +139,7 @@
doit(
"throwSimple",
2,
+ true,
false,
new String[] { "faultInt1", "faultInt2", "faultInt3" },
new Object[] { new Integer(1), new Integer(2), new Integer(3)}, SYNC);
@@ -145,19 +149,21 @@
doit(
"throwIndicInt",
4,
+ true,
false,
new String[] { "faultText" },
new Object[] { "A Simple Fault" }, SYNC);
}
public void testNoFaultAltSync() {
- doit("throwSimple", 5, false, null, null, SYNC);
+ doit("throwSimple", 5, false, false, null, null, SYNC);
}
public void testFaultIndicPropSync() {
doit(
"throwProperties",
6,
+ true,
false,
new String[] { "faultText", "faultIndic" },
new Object[] { "A Fault Indicator", new Byte((byte) - 1)}, SYNC);
@@ -167,6 +173,7 @@
doit(
"throwProperties",
7,
+ true,
false,
new String[] { "faultText", "faultIndic", "faultProp" },
new Object[] {
@@ -175,14 +182,43 @@
"Another JMS Property" }, SYNC);
}
+ public void testIndicOnlySync() {
+ doit(
+ "throwProperties",
+ 8,
+ true,
+ false,
+ new String[] { "faultIndic" },
+ new Object[] { new Byte((byte) - 3)},
+ SYNC);
+ }
+
+// public void testPropOnlySync() {
+// doit(
+// "throwProperties",
+// 9,
+// true,
+// false,
+// new String[] { "faultProp" },
+// new Object[] { "Another JMS Property" },
+// SYNC);
+// }
+
+ public void testNullFaultSync() {
+ doit("throwProperties", 10, true, false, null, null, SYNC);
+ }
+
+ /* ***************** ASYNC ************************** */
+
public void testNoFaultAsync() {
- doit("throwSimple", 0, false, null, null, ASYNC);
+ doit("throwSimple", 0, false, false, null, null, ASYNC);
}
public void testSimpleAsync() {
doit(
"throwSimple",
1,
+ true,
false,
new String[] { "faultText" },
new Object[] { "A Simple Fault" }, ASYNC);
@@ -192,6 +228,7 @@
doit(
"throwSimple",
2,
+ true,
false,
new String[] { "faultInt1", "faultInt2", "faultInt3" },
new Object[] { new Integer(1), new Integer(2), new Integer(3)}, ASYNC);
@@ -201,6 +238,7 @@
doit(
"throwSimple",
3,
+ true,
false,
new String[] { "faultInt1", "faultInt2" },
new Object[] { new Integer(1), new Integer(2) }, ASYNC);
@@ -210,6 +248,7 @@
doit(
"throwSimple",
2,
+ true,
false,
new String[] { "faultInt1", "faultInt2", "faultInt3" },
new Object[] { new Integer(1), new Integer(2), new Integer(3)}, ASYNC);
@@ -219,19 +258,21 @@
doit(
"throwIndicInt",
4,
+ true,
false,
new String[] { "faultText" },
new Object[] { "A Simple Fault" }, ASYNC);
}
public void testNoFaultAltAsync() {
- doit("throwSimple", 5, false, null, null, ASYNC);
+ doit("throwSimple", 5, false, false, null, null, ASYNC);
}
public void testFaultIndicPropAsync() {
doit(
"throwProperties",
6,
+ true,
false,
new String[] { "faultText", "faultIndic" },
new Object[] { "A Fault Indicator", new Byte((byte) - 1)}, ASYNC);
@@ -241,6 +282,7 @@
doit(
"throwProperties",
7,
+ true,
false,
new String[] { "faultText", "faultIndic", "faultProp" },
new Object[] {
@@ -249,9 +291,36 @@
"Another JMS Property" }, ASYNC);
}
+ public void testIndicOnlyAsync() {
+ doit(
+ "throwProperties",
+ 8,
+ true,
+ false,
+ new String[] { "faultIndic" },
+ new Object[] { new Byte((byte) - 3)},
+ ASYNC);
+ }
+
+// public void testPropOnlyAsync() {
+// doit(
+// "throwProperties",
+// 9,
+// true,
+// false,
+// new String[] { "faultProp" },
+// new Object[] { "Another JMS Property" },
+// ASYNC);
+// }
+//
+// public void testNullFaultAsync() {
+// doit("throwProperties", 10, true, false, null, null, ASYNC);
+// }
+
private void doit(
String method,
int choice,
+ boolean faultExpected,
boolean exceptionExpected,
String[] names,
Object[] parts,
@@ -287,7 +356,7 @@
faultMessage);
} else if (blocks == ASYNC) {
- WSIFMessage context = null;
+ WSIFMessage context = operation.getContext();
context.setObjectPart(
WSIFConstants.CONTEXT_JMS_PREFIX + "JMSReplyTo",
TestUtilities.getWsifProperty("wsif.async.replytoq2"));
@@ -323,8 +392,8 @@
assertTrue(
"Bad boolean success value from executeRequestReponseOperation",
- (operationSucceeded && (names == null))
- || (!operationSucceeded && (names != null)));
+ (operationSucceeded && !faultExpected)
+ || (!operationSucceeded && faultExpected));
if (!operationSucceeded) {
Iterator it = faultMessage.getPartNames();
@@ -333,6 +402,12 @@
it.next();
i++;
}
+
+ if (names == null)
+ names = new String[] {};
+ if (parts == null)
+ parts = new Object[] {};
+
assertTrue(
"Bad number of parts in the fault message expected="
+ names.length
1.4 +37 -0 xml-axis-wsif/java/test/jms/JmsFault.wsdl
Index: JmsFault.wsdl
===================================================================
RCS file: /home/cvs/xml-axis-wsif/java/test/jms/JmsFault.wsdl,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- JmsFault.wsdl 10 Oct 2002 14:51:43 -0000 1.3
+++ JmsFault.wsdl 5 Dec 2002 16:49:19 -0000 1.4
@@ -30,6 +30,14 @@
<part name="faultText" type="xsd:string"/>
</message>
+ <message name="IndicOnlyFault">
+ <part name="faultIndic" type="xsd:byte"/>
+ </message>
+
+ <message name="PropOnlyFault">
+ <part name="faultProp" type="xsd:string"/>
+ </message>
+
<!-- port type declns -->
<portType name="JmsFault">
<operation name="throwSimple">
@@ -50,6 +58,9 @@
<output message="tns:SimpleResp"/>
<fault name="IndicPropFault" message="tns:IndicPropFault"/>
<fault name="JmsPropFault" message="tns:IndicPropFault"/>
+ <fault name="IndicOnlyFault" message="tns:IndicOnlyFault"/>
+ <fault name="PropOnlyFault" message="tns:PropOnlyFault"/>
+ <fault name="NullFault" message="tns:SimpleResp"/>
</operation>
</portType>
@@ -145,6 +156,32 @@
type="xsd:string"
part="faultProp"/>
<jms:fault parts="faultText"/>
+ </fault>
+ <fault name="IndicOnlyFault">
+ <jms:faultIndicator type="property">
+ <jms:faultProperty name="faultIndicator"
+ type="xsd:byte"
+ value="-3"
+ part="faultIndic"/>
+ </jms:faultIndicator>
+ <jms:fault parts=""/>
+ </fault>
+ <fault name="PropOnlyFault">
+ <jms:faultIndicator type="property">
+ <jms:faultProperty name="faultIndicator"
+ type="xsd:byte"
+ value="-4" />
+ </jms:faultIndicator>
+ <jms:property name="anotherProperty"
+ type="xsd:string"
+ part="faultProp"/>
+ </fault>
+ <fault name="NullFault">
+ <jms:faultIndicator type="property">
+ <jms:faultProperty name="faultIndicator"
+ type="xsd:byte"
+ value="-5" />
+ </jms:faultIndicator>
</fault>
</operation>
</binding>
1.15 +6 -49 xml-axis-wsif/java/test/util/TestUtilities.java
Index: TestUtilities.java
===================================================================
RCS file: /home/cvs/xml-axis-wsif/java/test/util/TestUtilities.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- TestUtilities.java 25 Nov 2002 14:49:25 -0000 1.14
+++ TestUtilities.java 5 Dec 2002 16:49:20 -0000 1.15
@@ -83,8 +83,6 @@
import org.apache.wsif.util.WSIFCorrelationServiceLocator;
import org.apache.wsif.util.WSIFPluggableProviders;
import org.apache.wsif.util.WSIFProperties;
-import org.apache.wsif.util.jms.JMS2HTTPBridge;
-import org.apache.wsif.util.jms.JMS2HTTPBridgeDestination;
import org.apache.wsif.util.jms.JMSAsyncListener;
import org.apache.wsif.util.jms.NativeJMSRequestListener;
import org.apache.wsif.util.jms.WSIFJMSFinder;
@@ -289,18 +287,16 @@
public static Message getJMSAsyncResponse(String id, String queueName)
throws WSIFException, JMSException {
- String initialContextFactory =
- "com.sun.jndi.fscontext.RefFSContextFactory";
- String jndiUrl = "file:///JNDI-Directory";
- String queueConnectionFactory = "WSIFSampleQCF";
-
WSIFJMSFinder finder =
new WSIFJMSFinderForJndi(
null,
- initialContextFactory,
- jndiUrl,
+ TestUtilities.getWsifProperty(
+ "wsif.jms2httpbridge.initialcontextfactory"),
+ TestUtilities.getWsifProperty(
+ "wsif.jms2httpbridge.jndiproviderurl"),
WSIFJMSFinder.STYLE_QUEUE,
- queueConnectionFactory,
+ TestUtilities.getWsifProperty(
+ "wsif.jms2httpbridge.jndiconnectionfactoryname"),
null,
null);
@@ -315,42 +311,3 @@
return receiver.receive(WSIFProperties.getAsyncTimeout());
}
}
-
-class BridgeThread extends Thread {
- private String name;
-
- public BridgeThread(String name) {
- this.name = name;
- }
-
- public void run() {
- try {
- System.out.println("Starting " + name + " JMS2HTTPBridge");
- String pattern =
- TestUtilities.getWsifProperty(
- "wsif.jms2httpbridge.jndidestinationnamepattern");
- String queue =
- pattern.substring(0, pattern.indexOf('%'))
- + name
- + pattern.substring(pattern.indexOf('%') + 1);
-
- JMS2HTTPBridge j2h =
- new JMS2HTTPBridge(
- TestUtilities.getWsifProperty(
- "wsif.jms2httpbridge.initialcontextfactory"),
- TestUtilities.getWsifProperty(
- "wsif.jms2httpbridge.jndiproviderurl"),
- TestUtilities.getWsifProperty(
- "wsif.jms2httpbridge.jndiconnectionfactoryname"),
- queue,
- TestUtilities.getWsifProperty(
- "wsif.jms2httpbridge.httpurl"),
- JMS2HTTPBridgeDestination.COLDSTART,
- TestUtilities.isJmsVerbose());
- j2h.listen();
- } catch (Exception e) {
- System.out.println("Caught JMS2HTTPBridge exception " + e);
- }
- }
-}
-
1.1 xml-axis-wsif/java/test/util/BridgeThread.java
Index: BridgeThread.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "WSIF" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 2001, 2002, International
* Business Machines, Inc., http://www.apache.org. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package util;
import org.apache.wsif.util.jms.JMS2HTTPBridge;
import org.apache.wsif.util.jms.JMS2HTTPBridgeDestination;
/**
* BridgeThread is a thread used by TestUtilities.startListeners()
* that runs the JMS2HTTPBridge.
*
* @author Mark Whitlock
*/
class BridgeThread extends Thread {
private String name;
public BridgeThread(String name) {
this.name = name;
}
public void run() {
try {
System.out.println("Starting " + name + " JMS2HTTPBridge");
String pattern =
TestUtilities.getWsifProperty(
"wsif.jms2httpbridge.jndidestinationnamepattern");
String queue =
pattern.substring(0, pattern.indexOf('%'))
+ name
+ pattern.substring(pattern.indexOf('%') + 1);
JMS2HTTPBridge j2h =
new JMS2HTTPBridge(
TestUtilities.getWsifProperty(
"wsif.jms2httpbridge.initialcontextfactory"),
TestUtilities.getWsifProperty(
"wsif.jms2httpbridge.jndiproviderurl"),
TestUtilities.getWsifProperty(
"wsif.jms2httpbridge.jndiconnectionfactoryname"),
queue,
TestUtilities.getWsifProperty(
"wsif.jms2httpbridge.httpurl"),
JMS2HTTPBridgeDestination.COLDSTART,
TestUtilities.isJmsVerbose());
j2h.listen();
} catch (Exception e) {
System.out.println("Caught JMS2HTTPBridge exception " + e);
}
}
}
1.13 +15 -1
xml-axis-wsif/java/src/org/apache/wsif/util/jms/WSIFJMSDestination.java
Index: WSIFJMSDestination.java
===================================================================
RCS file:
/home/cvs/xml-axis-wsif/java/src/org/apache/wsif/util/jms/WSIFJMSDestination.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- WSIFJMSDestination.java 15 Oct 2002 09:22:57 -0000 1.12
+++ WSIFJMSDestination.java 5 Dec 2002 16:49:20 -0000 1.13
@@ -403,7 +403,7 @@
rec = session.createReceiver(readQ);
msg = rec.receive(timeout);
- lastMessage = msg;
+ setLastMessage(msg);
if (msg == null)
throw new WSIFException(
@@ -604,6 +604,20 @@
return m;
}
+ /**
+ * The last message is the most recent message that was received by this
+ * WSIFJMSDestination. The getProperty(s) methods return the properties
+ * that are on the lastMessage. The works fine for sync, but for async
+ * user code will have received the message. So the provider must inform
+ * the WSIFJMSDestination about the lastMessage explicitly so it can
+ * inquire correctly about any jms properties on it.
+ */
+ public void setLastMessage(Message msg) {
+ Trc.entry(this, msg);
+ lastMessage = msg;
+ Trc.exit();
+ }
+
public String deep() {
String buff = "";
try {
1.16 +42 -29
xml-axis-wsif/java/test/org/apache/wsif/util/jms/NativeJMSRequestListener.java
Index: NativeJMSRequestListener.java
===================================================================
RCS file:
/home/cvs/xml-axis-wsif/java/test/org/apache/wsif/util/jms/NativeJMSRequestListener.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- NativeJMSRequestListener.java 10 Oct 2002 14:51:44 -0000 1.15
+++ NativeJMSRequestListener.java 5 Dec 2002 16:49:20 -0000 1.16
@@ -89,14 +89,9 @@
public class NativeJMSRequestListener extends JMS2HTTPBridgeDestination {
int counter = 0;
static final String startType = JMS2HTTPBridgeDestination.COLDSTART;
- static final String initialContextFactory =
"com.sun.jndi.fscontext.RefFSContextFactory";
- static final String jndiUrl = "file:///JNDI-Directory";
- static final String sampleName = null;
- static final String queueConnectionFactory = "WSIFSampleQCF";
- static final String readQueue = null;
static final boolean VERBOSE = TestUtilities.isJmsVerbose();
- private Thread listener;
+ private Thread listenerThread;
static AddressBook ab = new AddressBook();
static StockQuote sq = new StockQuote();
@@ -127,20 +122,24 @@
public NativeJMSRequestListener(String msgQ) throws WSIFException {
- super( new WSIFJMSFinderForJndi(
- null,
- initialContextFactory,
- jndiUrl,
- WSIFJMSFinder.STYLE_QUEUE,
- queueConnectionFactory,
- msgQ,
- null),
+ super(
+ new WSIFJMSFinderForJndi(
null,
- WSIFJMSConstants.WAIT_FOREVER,
- startType,
- VERBOSE);
+ TestUtilities.getWsifProperty(
+ "wsif.jms2httpbridge.initialcontextfactory"),
+ TestUtilities.getWsifProperty(
+ "wsif.jms2httpbridge.jndiproviderurl"),
+ WSIFJMSFinder.STYLE_QUEUE,
+ TestUtilities.getWsifProperty(
+ "wsif.jms2httpbridge.jndiconnectionfactoryname"),
+ msgQ,
+ null),
+ null,
+ WSIFJMSConstants.WAIT_FOREVER,
+ startType,
+ VERBOSE);
- listener = new Thread() {
+ listenerThread = new Thread() {
public void run() {
try {
listen( list );
@@ -149,11 +148,11 @@
}
}
};
- listener.start();
+ listenerThread.start();
}
/**
- * Create a listener thread to listen for messages. This waits forever until it
gets
- * an InterruptedException.
+ * Create a listener thread to listen for messages. This waits forever
+ * until it gets an InterruptedException.
* @param listener is the JMS message and exception callback interface
implementation
* @param queue to listen on
*/
@@ -184,7 +183,7 @@
}
public void stop() {
- listener.interrupt();
+ listenerThread.interrupt();
}
private void processResponse(Message msg) {
@@ -194,13 +193,17 @@
String input = null;
String output = null;
String fake = null;
- try {
- operationName = msg.getStringProperty(
WSIFConstants.JMS_PROP_OPERATION_NAME );
- input = msg.getStringProperty(
WSIFConstants.JMS_PROP_INPUT_NAME );
- output = msg.getStringProperty(
WSIFConstants.JMS_PROP_OUTPUT_NAME );
- fake = msg.getStringProperty( "WSIF_FAKE" );
- } catch (javax.jms.JMSException e) {
- }
+ try {
+ operationName =
+ msg.getStringProperty(
+ WSIFConstants.JMS_PROP_OPERATION_NAME);
+ input =
+ msg.getStringProperty(WSIFConstants.JMS_PROP_INPUT_NAME);
+ output =
+ msg.getStringProperty(WSIFConstants.JMS_PROP_OUTPUT_NAME);
+ fake = msg.getStringProperty("WSIF_FAKE");
+ } catch (javax.jms.JMSException e) {
+ }
Object reply = null;
Object dummyReply = "input only, so no reply";
@@ -390,6 +393,16 @@
faultMsg.setByteProperty("faultIndicator", (byte)-2);
faultMsg.setObject((Serializable) "Another Property Fault");
faultMsg.setStringProperty("anotherProperty", "Another JMS
Property");
+ break;
+ case 8 :
+ faultMsg.setByteProperty("faultIndicator", (byte)-3);
+ break;
+ case 9 :
+ faultMsg.setByteProperty("faultIndicator", (byte)-4);
+ faultMsg.setStringProperty("anotherProperty", "Another JMS
Property");
+ break;
+ case 10 :
+ faultMsg.setByteProperty("faultIndicator", (byte)-5);
break;
default :
throw new RuntimeException("throwSimple: Bad choice");
1.8 +43 -39
xml-axis-wsif/java/test/org/apache/wsif/util/jms/JMSAsyncListener.java
Index: JMSAsyncListener.java
===================================================================
RCS file:
/home/cvs/xml-axis-wsif/java/test/org/apache/wsif/util/jms/JMSAsyncListener.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- JMSAsyncListener.java 1 Oct 2002 15:06:16 -0000 1.7
+++ JMSAsyncListener.java 5 Dec 2002 16:49:20 -0000 1.8
@@ -78,15 +78,10 @@
public class JMSAsyncListener extends JMS2HTTPBridgeDestination {
static final String startType = JMS2HTTPBridgeDestination.COLDSTART;
- static final String initialContextFactory =
"com.sun.jndi.fscontext.RefFSContextFactory";
- static final String jndiUrl = "file:///JNDI-Directory";
- static final String sampleName = null;
- static final String queueConnectionFactory = "WSIFSampleQCF";
- static final String readQueue = null;
- static final String httpUrlString =
"http://localhost:8080/soap/servlet/rpcrouter";
static final boolean VERBOSE = TestUtilities.isJmsVerbose();
- private Thread listener;
+ private Thread listenerThread;
+
private WSIFJMSListener list = new WSIFJMSListener() {
public void onException(JMSException arg1) {
Trc.entry(this, arg1);
@@ -102,20 +97,24 @@
};
public JMSAsyncListener(String msgQ) throws WSIFException {
- super( new WSIFJMSFinderForJndi(
- null,
- initialContextFactory,
- jndiUrl,
- WSIFJMSFinder.STYLE_QUEUE,
- queueConnectionFactory,
- msgQ,
- null),
+ super(
+ new WSIFJMSFinderForJndi(
null,
- WSIFJMSConstants.WAIT_FOREVER,
- startType,
- VERBOSE);
+ TestUtilities.getWsifProperty(
+ "wsif.jms2httpbridge.initialcontextfactory"),
+ TestUtilities.getWsifProperty(
+ "wsif.jms2httpbridge.jndiproviderurl"),
+ WSIFJMSFinder.STYLE_QUEUE,
+ TestUtilities.getWsifProperty(
+ "wsif.jms2httpbridge.jndiconnectionfactoryname"),
+ msgQ,
+ null),
+ null,
+ WSIFJMSConstants.WAIT_FOREVER,
+ startType,
+ VERBOSE);
- listener = new Thread() {
+ listenerThread = new Thread() {
public void run() {
try {
listen( list );
@@ -124,11 +123,11 @@
}
}
};
- listener.start();
+ listenerThread.start();
}
/**
- * Create a listener thread to listen for messages. This waits forever until it
gets
- * an InterruptedException.
+ * Create a listener thread to listen for messages. This waits forever
+ * until it gets an InterruptedException.
* @param listener is the JMS message and exception callback interface
implementation
* @param queue to listen on
*/
@@ -147,7 +146,8 @@
for (int i = 1; !Thread.interrupted(); i++) {
Thread.yield();
Thread.sleep(5000);
- if ( VERBOSE ) System.out.println("JMSAsyncListener waiting... " +
i);
+ if (VERBOSE)
+ System.out.println("JMSAsyncListener waiting... " + i);
}
} catch (JMSException je) {
throw WSIFJMSConstants.ToWsifException(je);
@@ -159,25 +159,29 @@
private void processResponse(Message msg) {
Serializable so;
- try {
- if ( VERBOSE ) System.out.println(
"WSIFJmsAsyncListener.processResponse called" );
- WSIFCorrelationService cs =
- WSIFCorrelationServiceLocator.getCorrelationService();
- WSIFCorrelationId cid = new WSIFJMSCorrelationId(
msg.getJMSCorrelationID() );
- synchronized( cs ) {
- so = cs.get( cid );
- }
- if ( so != null && so instanceof WSIFOperation ) {
- cs.remove( cid );
- ((WSIFOperation) so).fireAsyncResponse( msg );
- }
- } catch (Exception ex) {
- ex.printStackTrace();
- }
+ try {
+ if (VERBOSE)
+ System.out.println(
+ "WSIFJmsAsyncListener.processResponse called");
+
+ WSIFCorrelationService cs =
+ WSIFCorrelationServiceLocator.getCorrelationService();
+ WSIFCorrelationId cid =
+ new WSIFJMSCorrelationId(msg.getJMSCorrelationID());
+ synchronized (cs) {
+ so = cs.get(cid);
+ }
+ if (so != null && so instanceof WSIFOperation) {
+ cs.remove(cid);
+ ((WSIFOperation) so).fireAsyncResponse(msg);
+ }
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
}
public void stop() {
- listener.interrupt();
+ listenerThread.interrupt();
}
}
1.36 +6 -0
xml-axis-wsif/java/src/org/apache/wsif/providers/jms/WSIFOperation_Jms.java
Index: WSIFOperation_Jms.java
===================================================================
RCS file:
/home/cvs/xml-axis-wsif/java/src/org/apache/wsif/providers/jms/WSIFOperation_Jms.java,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- WSIFOperation_Jms.java 1 Nov 2002 17:17:40 -0000 1.35
+++ WSIFOperation_Jms.java 5 Dec 2002 16:49:20 -0000 1.36
@@ -502,6 +502,12 @@
if (!(responseObject instanceof javax.jms.Message))
throw new WSIFException("Object is not of type
javax.jms.Message");
+ // The WSIFJMSDestination probably didn't receive this message, so
+ // tell it about the message so we can inquire about its JMS properties
+ // later.
+ fieldJmsPort.getJmsDestination().setLastMessage(
+ (javax.jms.Message) responseObject);
+
WSIFResponse resp =
formatter.unformatResponse((javax.jms.Message) responseObject);