Working on JAXP 1.4 support.

This commit is contained in:
Arjen Poutsma
2007-12-21 11:46:56 +00:00
parent b684e404d0
commit a55719a226
7 changed files with 17 additions and 148 deletions

View File

@@ -1,4 +1,5 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<artifactId>spring-ws-parent</artifactId>
<groupId>org.springframework.ws</groupId>
@@ -97,22 +98,6 @@
<groupId>org.springframework</groupId>
<artifactId>spring-jms</artifactId>
</dependency>
<!-- XML handling dependencies -->
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>xalan</groupId>
<artifactId>xalan</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<scope>provided</scope>
</dependency>
<!-- Java EE dependencies -->
<dependency>
<groupId>javax.xml.soap</groupId>

View File

@@ -43,8 +43,8 @@ public abstract class AbstractMonitoringStrategy implements MonitoringStrategy {
private boolean deleteMessages = true;
/**
* Sets whether messages should be marked as {@link Flags.Flag#DELETED DELETED} after they have been read. Default
* is <code>true</code>.
* Sets whether messages should be marked as {@link javax.mail.Flags.Flag#DELETED DELETED} after they have been
* read. Default is <code>true</code>.
*/
public void setDeleteMessages(boolean deleteMessages) {
this.deleteMessages = deleteMessages;
@@ -92,9 +92,9 @@ public abstract class AbstractMonitoringStrategy implements MonitoringStrategy {
/**
* Retrieves new messages from the given folder. This implementation creates a {@link SearchTerm} that searches for
* all messages in the folder that are {@link Flags.Flag#RECENT RECENT}, not {@link Flags.Flag#ANSWERED ANSWERED},
* and not {@link Flags.Flag#DELETED DELETED}. The search term is used to {@link Folder#search(SearchTerm) search}
* for new messages.
* all messages in the folder that are {@link javax.mail.Flags.Flag#RECENT RECENT}, not {@link
* javax.mail.Flags.Flag#ANSWERED ANSWERED}, and not {@link javax.mail.Flags.Flag#DELETED DELETED}. The search term
* is used to {@link Folder#search(SearchTerm) search} for new messages.
*
* @param folder the folder to retrieve new messages from
* @return the new messages
@@ -134,7 +134,7 @@ public abstract class AbstractMonitoringStrategy implements MonitoringStrategy {
/**
* Fetches the specified messages from the specified folder. Default implementation {@link Folder#fetch(Message[],
* FetchProfile) fetches} every {@link FetchProfile.Item}.
* FetchProfile) fetches} every {@link javax.mail.FetchProfile.Item}.
*
* @param folder the folder to fetch messages from
* @param messages the messages to fetch

View File

@@ -31,9 +31,7 @@ import javax.mail.MessagingException;
*/
public class PollingMonitoringStrategy extends AbstractMonitoringStrategy {
/**
* Defines the default polling frequency. Set to 1000 * 60 milliseconds (i.e. 1 minute).
*/
/** Defines the default polling frequency. Set to 1000 * 60 milliseconds (i.e. 1 minute). */
public static final long DEFAULT_POLLING_FREQUENCY = 1000 * 60;
private long pollingInterval = DEFAULT_POLLING_FREQUENCY;
@@ -53,7 +51,7 @@ public class PollingMonitoringStrategy extends AbstractMonitoringStrategy {
/**
* Invoked after the {@link Thread#sleep(long)} method has been invoked. This implementation calls {@link
* Folder#getMessageCount(), to force new messages to be seen.
* Folder#getMessageCount()}, to force new messages to be seen.
*
* @param folder the folder to check for new messages
* @throws MessagingException in case of JavaMail errors

View File

@@ -18,15 +18,15 @@ package org.springframework.ws.transport;
import javax.xml.transform.Transformer;
import org.springframework.util.Assert;
import org.springframework.ws.context.MessageContext;
import org.springframework.xml.transform.TransformerObjectSupport;
import org.springframework.util.Assert;
public class SimpleTestingMessageReceiver extends TransformerObjectSupport implements WebServiceMessageReceiver {
public void receive(MessageContext messageContext) throws Exception {
Assert.notNull(messageContext, "MessageContext is null");
logger.info("Received message");
logger.info("Received " + messageContext.getRequest());
Transformer transformer = createTransformer();
transformer.transform(messageContext.getRequest().getPayloadSource(),
messageContext.getResponse().getPayloadResult());

View File

@@ -65,13 +65,14 @@ public class JmsMessageSenderIntegrationTest extends AbstractDependencyInjection
public void testSendAndReceiveQueueBytesMessage() throws Exception {
WebServiceConnection connection = null;
try {
URI uri = new URI("jms:RequestQueue?deliveryMode=NON_PERSISTENT");
URI uri = new URI("jms:SenderRequestQueue?deliveryMode=NON_PERSISTENT");
connection = messageSender.createConnection(uri);
SoapMessage soapRequest = new SaajSoapMessage(messageFactory.createMessage());
soapRequest.setSoapAction(SOAP_ACTION);
connection.send(soapRequest);
BytesMessage request = (BytesMessage) jmsTemplate.receive();
assertNotNull("No message received", request);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
messageFactory.createMessage().writeTo(bos);
final byte[] buf = bos.toByteArray();
@@ -101,13 +102,14 @@ public class JmsMessageSenderIntegrationTest extends AbstractDependencyInjection
public void testSendAndReceiveQueueTextMessage() throws Exception {
WebServiceConnection connection = null;
try {
URI uri = new URI("jms:RequestQueue?deliveryMode=NON_PERSISTENT&messageType=TEXT_MESSAGE");
URI uri = new URI("jms:SenderRequestQueue?deliveryMode=NON_PERSISTENT&messageType=TEXT_MESSAGE");
connection = messageSender.createConnection(uri);
SoapMessage soapRequest = new SaajSoapMessage(messageFactory.createMessage());
soapRequest.setSoapAction(SOAP_ACTION);
connection.send(soapRequest);
TextMessage request = (TextMessage) jmsTemplate.receive();
assertNotNull("No message received", request);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
messageFactory.createMessage().writeTo(bos);
final String text = new String(bos.toByteArray(), "UTF-8");

View File

@@ -1,116 +0,0 @@
/*
*/
/*
* Copyright 2006 the original author or authors.
*
* 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.springframework.ws.transport.jms;
import javax.jms.BytesMessage;
import javax.jms.Destination;
import javax.jms.MessageProducer;
import javax.jms.Session;
import javax.jms.StreamMessage;
import junit.framework.TestCase;
import org.codehaus.activemq.message.ActiveMQBytesMessage;
import org.codehaus.activemq.message.ActiveMQTopic;
import org.easymock.MockControl;
import org.springframework.ws.MockWebServiceMessageFactory;
import org.springframework.ws.context.MessageContext;
import org.springframework.ws.server.endpoint.MessageEndpoint;
public class MessageEndpointMessageListenerTest extends TestCase {
private static final String REQUEST = " <SOAP-ENV:Envelope\n" +
" xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\"\n" +
" SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">\n" + " <SOAP-ENV:Body>\n" +
" <m:GetLastTradePrice xmlns:m=\"Some-URI\">\n" + " <symbol>DIS</symbol>\n" +
" </m:GetLastTradePrice>\n" + " </SOAP-ENV:Body>\n" + "</SOAP-ENV:Envelope>";
private WebServiceMessageListener messageListener;
private BytesMessage request;
private MockControl sessionControl;
private Session sessionMock;
protected void setUp() throws Exception {
messageListener = new WebServiceMessageListener();
request = new ActiveMQBytesMessage();
request.writeBytes(REQUEST.getBytes("UTF-8"));
messageListener.setMessageFactory(new MockWebServiceMessageFactory());
sessionControl = MockControl.createControl(Session.class);
sessionMock = (Session) sessionControl.getMock();
}
public void testOnMessageInvalidMessage() throws Exception {
MockControl mockControl = MockControl.createControl(StreamMessage.class);
StreamMessage message = (StreamMessage) mockControl.getMock();
try {
messageListener.onMessage(message, sessionMock);
fail("Expected IllegalArgumentException");
}
catch (IllegalArgumentException ex) {
// expected
}
}
public void testOnMessageNoResponse() throws Exception {
MessageEndpoint endpoint = new MessageEndpoint() {
public void invoke(MessageContext messageContext) throws Exception {
}
};
messageListener.setMessageReceiver(endpoint);
request.reset();
messageListener.onMessage(request, sessionMock);
}
public void testOnMessageResponse() throws Exception {
MockControl producerControl = MockControl.createControl(MessageProducer.class);
MessageProducer producerMock = (MessageProducer) producerControl.getMock();
BytesMessage response = new ActiveMQBytesMessage();
String correlationId = "correlationId";
Destination replyTo = new ActiveMQTopic();
request.setJMSCorrelationID(correlationId);
request.setJMSReplyTo(replyTo);
request.reset();
sessionControl.expectAndReturn(sessionMock.createBytesMessage(), response);
sessionControl.expectAndReturn(sessionMock.createProducer(replyTo), producerMock);
producerMock.marshalSendAndReceive(response);
sessionControl.replay();
producerControl.replay();
MessageEndpoint endpoint = new MessageEndpoint() {
public void invoke(MessageContext messageContext) throws Exception {
messageContext.getResponse();
}
};
messageListener.setMessageReceiver(endpoint);
messageListener.onMessage(request, sessionMock);
sessionControl.verify();
producerControl.verify();
assertEquals("Invalid correlationId", correlationId, response.getJMSCorrelationID());
}
}*/

View File

@@ -7,7 +7,7 @@
</bean>
<bean id="requestQueue" class="org.apache.activemq.command.ActiveMQQueue">
<property name="physicalName" value="RequestQueue"/>
<property name="physicalName" value="SenderRequestQueue"/>
</bean>
<bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">