Refactored SAAJ implementation from two separate class hierarchies (SAAJ 1.2 and SAAJ 1.3) into one single hierarchy, using bridge pattern (SaajImplementation).

This commit is contained in:
Arjen Poutsma
2006-12-31 20:42:41 +00:00
parent 7828c120d1
commit 0b030468ae
15 changed files with 42 additions and 221 deletions

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.ws.soap.saaj.saaj12;
package org.springframework.ws.soap.saaj;
import javax.xml.soap.MessageFactory;
import javax.xml.soap.SOAPConstants;
@@ -23,11 +23,11 @@ import javax.xml.soap.SOAPMessage;
import org.springframework.ws.soap.AbstractAttachmentTestCase;
import org.springframework.ws.soap.SoapMessage;
public class Saaj12AttachmentTest extends AbstractAttachmentTestCase {
public class SaajAttachmentTest extends AbstractAttachmentTestCase {
protected SoapMessage createMessage() throws Exception {
MessageFactory messageFactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);
SOAPMessage saajMessage = messageFactory.createMessage();
return new Saaj12SoapMessage(saajMessage);
return new SaajSoapMessage(saajMessage);
}
}

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.ws.soap.saaj.saaj13;
package org.springframework.ws.soap.saaj;
import javax.xml.soap.MessageFactory;
import javax.xml.soap.SOAPConstants;
@@ -23,12 +23,12 @@ import javax.xml.soap.SOAPMessage;
import org.springframework.ws.soap.SoapBody;
import org.springframework.ws.soap.soap11.AbstractSoap11BodyTestCase;
public class Saaj13Soap11BodyTest extends AbstractSoap11BodyTestCase {
public class SaajSoap11BodyTest extends AbstractSoap11BodyTestCase {
protected SoapBody createSoapBody() throws Exception {
MessageFactory messageFactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);
SOAPMessage saajMessage = messageFactory.createMessage();
return new Saaj13Soap11Body(saajMessage.getSOAPBody());
return new SaajSoap11Body(saajMessage.getSOAPBody());
}
}

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.ws.soap.saaj.saaj13;
package org.springframework.ws.soap.saaj;
import javax.xml.soap.MessageFactory;
import javax.xml.soap.SOAPConstants;
@@ -23,11 +23,11 @@ import javax.xml.soap.SOAPMessage;
import org.springframework.ws.soap.SoapEnvelope;
import org.springframework.ws.soap.soap11.AbstractSoap11EnvelopeTestCase;
public class Saaj13Soap11EnvelopeTest extends AbstractSoap11EnvelopeTestCase {
public class SaajSoap11EnvelopeTest extends AbstractSoap11EnvelopeTestCase {
protected SoapEnvelope createSoapEnvelope() throws Exception {
MessageFactory messageFactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);
SOAPMessage saajMessage = messageFactory.createMessage();
return new Saaj13SoapEnvelope(saajMessage.getSOAPPart().getEnvelope());
return new SaajSoapEnvelope(saajMessage.getSOAPPart().getEnvelope());
}
}

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.ws.soap.saaj.saaj12;
package org.springframework.ws.soap.saaj;
import javax.xml.soap.MessageFactory;
import javax.xml.soap.SOAPConstants;
@@ -23,11 +23,11 @@ import javax.xml.soap.SOAPMessage;
import org.springframework.ws.soap.SoapHeader;
import org.springframework.ws.soap.soap11.AbstractSoap11HeaderTestCase;
public class Saaj12Soap11HeaderTest extends AbstractSoap11HeaderTestCase {
public class SaajSoap11HeaderTest extends AbstractSoap11HeaderTestCase {
protected SoapHeader createSoapHeader() throws Exception {
MessageFactory messageFactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);
SOAPMessage saajMessage = messageFactory.createMessage();
return new Saaj12SoapHeader(saajMessage.getSOAPHeader());
return new SaajSoapHeader(saajMessage.getSOAPHeader());
}
}

View File

@@ -27,18 +27,16 @@ import org.springframework.ws.soap.soap11.AbstractSoap11MessageTestCase;
import org.springframework.xml.transform.StringResult;
import org.springframework.xml.transform.StringSource;
public abstract class SaajSoap11MessageTestCase extends AbstractSoap11MessageTestCase {
public class SaajSoap11MessageTest extends AbstractSoap11MessageTestCase {
private SOAPMessage saajMessage;
protected final SoapMessage createSoapMessage() throws Exception {
MessageFactory messageFactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);
saajMessage = messageFactory.createMessage();
return createSaajSoapMessage(saajMessage);
return new SaajSoapMessage(saajMessage);
}
protected abstract SaajSoapMessage createSaajSoapMessage(SOAPMessage saajMessage);
public void testGetPayloadSource() throws Exception {
saajMessage.getSOAPBody().addChildElement("child");
Source source = soapMessage.getPayloadSource();

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.ws.soap.saaj.saaj13;
package org.springframework.ws.soap.saaj;
import javax.xml.soap.MessageFactory;
import javax.xml.soap.SOAPConstants;
@@ -23,12 +23,12 @@ import javax.xml.soap.SOAPMessage;
import org.springframework.ws.soap.SoapBody;
import org.springframework.ws.soap.soap12.AbstractSoap12BodyTestCase;
public class Saaj13Soap12BodyTest extends AbstractSoap12BodyTestCase {
public class SaajSoap12BodyTest extends AbstractSoap12BodyTestCase {
protected SoapBody createSoapBody() throws Exception {
MessageFactory messageFactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
SOAPMessage saajMessage = messageFactory.createMessage();
return new Saaj13Soap12Body(saajMessage.getSOAPBody());
return new SaajSoap12Body(saajMessage.getSOAPBody());
}
}

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.ws.soap.saaj.saaj13;
package org.springframework.ws.soap.saaj;
import javax.xml.soap.MessageFactory;
import javax.xml.soap.SOAPConstants;
@@ -23,11 +23,11 @@ import javax.xml.soap.SOAPMessage;
import org.springframework.ws.soap.SoapEnvelope;
import org.springframework.ws.soap.soap12.AbstractSoap12EnvelopeTestCase;
public class Saaj13Soap12EnvelopeTest extends AbstractSoap12EnvelopeTestCase {
public class SaajSoap12EnvelopeTest extends AbstractSoap12EnvelopeTestCase {
protected SoapEnvelope createSoapEnvelope() throws Exception {
MessageFactory messageFactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
SOAPMessage saajMessage = messageFactory.createMessage();
return new Saaj13SoapEnvelope(saajMessage.getSOAPPart().getEnvelope());
return new SaajSoapEnvelope(saajMessage.getSOAPPart().getEnvelope());
}
}

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.ws.soap.saaj.saaj13;
package org.springframework.ws.soap.saaj;
import javax.xml.soap.MessageFactory;
import javax.xml.soap.SOAPConstants;
@@ -23,11 +23,11 @@ import javax.xml.soap.SOAPMessage;
import org.springframework.ws.soap.SoapHeader;
import org.springframework.ws.soap.soap12.AbstractSoap12HeaderTestCase;
public class Saaj13Soap12HeaderTest extends AbstractSoap12HeaderTestCase {
public class SaajSoap12HeaderTest extends AbstractSoap12HeaderTestCase {
protected SoapHeader createSoapHeader() throws Exception {
MessageFactory messageFactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
SOAPMessage saajMessage = messageFactory.createMessage();
return new Saaj13Soap12Header(saajMessage.getSOAPHeader());
return new SaajSoap12Header(saajMessage.getSOAPHeader());
}
}

View File

@@ -1,4 +1,20 @@
package org.springframework.ws.soap.saaj.saaj13;
/*
* 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.soap.saaj;
import javax.xml.soap.MessageFactory;
import javax.xml.soap.SOAPConstants;
@@ -11,14 +27,14 @@ import org.springframework.ws.soap.soap12.AbstractSoap12MessageTestCase;
import org.springframework.xml.transform.StringResult;
import org.springframework.xml.transform.StringSource;
public class Saaj13Soap12MessageTest extends AbstractSoap12MessageTestCase {
public class SaajSoap12MessageTest extends AbstractSoap12MessageTestCase {
private SOAPMessage saajMessage;
protected SoapMessage createSoapMessage() throws Exception {
MessageFactory messageFactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
saajMessage = messageFactory.createMessage();
return new Saaj13SoapMessage(saajMessage);
return new SaajSoapMessage(saajMessage);
}
public void testGetPayloadSource() throws Exception {

View File

@@ -1,34 +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.soap.saaj.saaj12;
import javax.xml.soap.MessageFactory;
import javax.xml.soap.SOAPConstants;
import javax.xml.soap.SOAPMessage;
import org.springframework.ws.soap.SoapBody;
import org.springframework.ws.soap.soap11.AbstractSoap11BodyTestCase;
public class Saaj12Soap11BodyTest extends AbstractSoap11BodyTestCase {
protected SoapBody createSoapBody() throws Exception {
MessageFactory messageFactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);
SOAPMessage saajMessage = messageFactory.createMessage();
return new Saaj12Soap11Body(saajMessage.getSOAPBody());
}
}

View File

@@ -1,33 +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.soap.saaj.saaj12;
import javax.xml.soap.MessageFactory;
import javax.xml.soap.SOAPConstants;
import javax.xml.soap.SOAPMessage;
import org.springframework.ws.soap.SoapEnvelope;
import org.springframework.ws.soap.soap11.AbstractSoap11EnvelopeTestCase;
public class Saaj12Soap11EnvelopeTest extends AbstractSoap11EnvelopeTestCase {
protected SoapEnvelope createSoapEnvelope() throws Exception {
MessageFactory messageFactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);
SOAPMessage saajMessage = messageFactory.createMessage();
return new Saaj12SoapEnvelope(saajMessage.getSOAPPart().getEnvelope());
}
}

View File

@@ -1,30 +0,0 @@
/*
* Copyright 2005 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.soap.saaj.saaj12;
import javax.xml.soap.SOAPMessage;
import org.springframework.ws.soap.saaj.SaajSoap11MessageTestCase;
import org.springframework.ws.soap.saaj.SaajSoapMessage;
public class Saaj12Soap11MessageTest extends SaajSoap11MessageTestCase {
protected SaajSoapMessage createSaajSoapMessage(SOAPMessage saajMessage) {
return new Saaj12SoapMessage(saajMessage);
}
}

View File

@@ -1,33 +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.soap.saaj.saaj13;
import javax.xml.soap.MessageFactory;
import javax.xml.soap.SOAPConstants;
import javax.xml.soap.SOAPMessage;
import org.springframework.ws.soap.AbstractAttachmentTestCase;
import org.springframework.ws.soap.SoapMessage;
public class Saaj13AttachmentTest extends AbstractAttachmentTestCase {
protected SoapMessage createMessage() throws Exception {
MessageFactory messageFactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);
SOAPMessage saajMessage = messageFactory.createMessage();
return new Saaj13SoapMessage(saajMessage);
}
}

View File

@@ -1,33 +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.soap.saaj.saaj13;
import javax.xml.soap.MessageFactory;
import javax.xml.soap.SOAPConstants;
import javax.xml.soap.SOAPMessage;
import org.springframework.ws.soap.SoapHeader;
import org.springframework.ws.soap.soap11.AbstractSoap11HeaderTestCase;
public class Saaj13Soap11HeaderTest extends AbstractSoap11HeaderTestCase {
protected SoapHeader createSoapHeader() throws Exception {
MessageFactory messageFactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);
SOAPMessage saajMessage = messageFactory.createMessage();
return new Saaj13SoapHeader(saajMessage.getSOAPHeader());
}
}

View File

@@ -1,30 +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.soap.saaj.saaj13;
import javax.xml.soap.SOAPMessage;
import org.springframework.ws.soap.saaj.SaajSoap11MessageTestCase;
import org.springframework.ws.soap.saaj.SaajSoapMessage;
public class Saaj13Soap11MessageTest extends SaajSoap11MessageTestCase {
protected SaajSoapMessage createSaajSoapMessage(SOAPMessage saajMessage) {
return new Saaj13SoapMessage(saajMessage);
}
}