testutil.WsaSOAPMessages Maven / Gradle / Ivy
The newest version!
/*
* Copyright (c) 2006, 2019 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
package testutil;
import javax.xml.namespace.QName;
import java.io.File;
/**
* @author Arun Gupta
*/
public class WsaSOAPMessages {
private String nsUri;
private String anonymousUri;
private String noneUri;
public WsaSOAPMessages(String wsaNsuri) {
if ("http://schemas.xmlsoap.org/ws/2004/08/addressing".equals(wsaNsuri)) {
nsUri = MemberSubmissionAddressingConstants.WSA_NAMESPACE_NAME;
anonymousUri = MemberSubmissionAddressingConstants.WSA_ANONYMOUS_ADDRESS;
noneUri = MemberSubmissionAddressingConstants.WSA_NONE_ADDRESS;
} else {
nsUri = W3CAddressingConstants.WSA_NAMESPACE_NAME;
anonymousUri = W3CAddressingConstants.WSA_ANONYMOUS_ADDRESS;
noneUri = W3CAddressingConstants.WSA_NONE_ADDRESS;
}
}
public static final QName USER_FAULT_CODE = new QName("http://example.org/echo", "EmptyEchoString");
private String getAnonymousReplyToHeader() {
return " \n" +
" " + anonymousUri + " \n" +
" \n";
}
private final String getAnonymousFaultToHeader() {
return " \n" +
" " + anonymousUri + " \n" +
" \n";
}
private final String getNotifyBody() {
return
"\n" +
" %s \n" +
" \n";
}
public final String getNoneReplyToMessage() {
return "\n" +
"\n" +
" %s \n" +
" " + WsaUtils.UUID + " \n" +
" \n" +
" " + noneUri + " \n" +
" \n" +
" %s \n" +
" \n" +
getNotifyBody() +
" ";
}
public final String getNoneFaultToMessage() {
return "\n" +
"\n" +
" %s \n" +
" " + WsaUtils.UUID + " \n" +
" \n" +
" " + noneUri + " \n" +
" \n" +
" %s \n" +
" \n" +
getNotifyBody() +
" ";
}
public final String getNoneReplyToFaultToMessage() {
return "\n" +
"\n" +
" %s \n" +
" " + WsaUtils.UUID + " \n" +
" \n" +
" " + noneUri + " \n" +
" \n" +
" \n" +
" " + noneUri + " \n" +
" \n" +
" %s \n" +
" \n" +
getNotifyBody() +
" ";
}
private final String getReplyToRefpsAnonymous() {
return " \n" +
" " + anonymousUri + " \n" +
" \n" +
" Key#123456789 \n" +
" " +
" \n";
}
private final String getFaultToRefpsAnonymous() {
return " \n" +
" " + anonymousUri + " \n" +
" \n" +
" Fault#123456789 \n" +
" " +
" \n";
}
private final String getReplyToRefpsHeader() {
return "\n" +
" %s \n" +
" " + WsaUtils.UUID + " \n" +
getReplyToRefpsAnonymous() +
" %s \n" +
" \n";
}
public final String getReplyToRefpsNotifyMessage() {
return "\n" +
getReplyToRefpsHeader() +
getNotifyBody() +
" ";
}
private final String getEchoBody() {
return "\n" +
" %s \n" +
" \n";
}
public final String getReplyToRefpsEchoMessage() {
return "\n" +
getReplyToRefpsHeader() +
getEchoBody() +
" ";
}
// use metadata only for W3C
private final String getMetadata() {
if (nsUri == W3CAddressingConstants.WSA_NAMESPACE_NAME)
return " " +
WsaUtils.fileToXMLString(System.getProperty("basedir") + File.separatorChar + "config" + File.separatorChar + "wsaTestService.wsdl") +
WsaUtils.fileToXMLString(System.getProperty("basedir") + File.separatorChar + "config" + File.separatorChar + "wsdl20.wsdl") +
" \n";
else
return "";
}
public final String getReplyToMetadataMessage() {
return "\n" +
"\n" +
" %s \n" +
" " + WsaUtils.UUID + " \n" +
" \n" +
" " + noneUri + " \n" +
getMetadata() +
" \n" +
" %s \n" +
" \n" +
getNotifyBody() +
" ";
}
// use metadata only for W3C
private final String getMetadataExtensions() {
if (nsUri == W3CAddressingConstants.WSA_NAMESPACE_NAME)
return " " +
" \n" +
" This should be ignored \n" +
" ";
else
return "";
}
public final String getReplyToExtensionsMessage() {
return "\n" +
"\n" +
" %s \n" +
" " + WsaUtils.UUID + " \n" +
" \n" +
" " + noneUri + " \n" +
" \n" +
" Key#123456789 \n" +
" " +
getMetadataExtensions() +
" \n" +
" %s \n" +
" \n" +
getNotifyBody() +
" ";
}
public final String getReplyToFaultToRefpsHeader() {
return "\n" +
" %s \n" +
" " + WsaUtils.UUID + " \n" +
getReplyToRefpsAnonymous() +
getFaultToRefpsAnonymous() +
" %s \n" +
" \n";
}
public final String getReplyToFaultToRefpsEchoMessage() {
return "\n" +
getReplyToFaultToRefpsHeader() +
getEchoBody() +
" ";
}
public final String getDuplicateToMessage() {
return "\n" +
"\n" +
"%s \n" +
" \n" +
getEchoBody() +
" ";
}
public final String getDuplicateReplyToMessage() {
return "\n" +
"\n" +
getAnonymousReplyToHeader() +
" \n" +
getEchoBody() +
" ";
}
public final String getDuplicateFaultToMessage() {
return "\n" +
"\n" +
getAnonymousFaultToHeader() +
getAnonymousFaultToHeader() +
" \n" +
getEchoBody() +
" ";
}
public final String getDuplicateActionMessage() {
return "\n" +
"\n" +
"%s \n" +
"%s \n" +
"uuid:c9251591-7b7e-4234-b193-2d242074466e \n"+
"%s \n" +
" \n" +
getEchoBody() +
" ";
}
public final String getDuplicateMessageIDMessage() {
return "\n" +
"\n" +
" " + WsaUtils.UUID + " \n" +
" \n" +
getEchoBody() +
" ";
}
public final String getNonAnonymousReplyToAnonymousFaultToMessage() {
return "\n" +
"\n" +
" %s \n" +
" " + WsaUtils.UUID + " \n" +
" \n" +
" %s \n" +
" \n" +
getAnonymousFaultToHeader() +
" %s \n" +
" \n" +
getEchoBody() +
" ";
}
public final String getNonAnonymousReplyToMessage() {
return "\n" +
"\n" +
" %s \n" +
" " + WsaUtils.UUID + " \n" +
" \n" +
" %s \n" +
" \n" +
" %s \n" +
" \n" +
getEchoBody() +
" ";
}
public final String getNoneTargetedNonAnonymousReplyToMessage() {
return "\n" +
"\n" +
" %s \n" +
" " + WsaUtils.UUID + " \n" +
" \n" +
" %s \n" +
" \n" +
" \n" +
" %s \n" +
" \n" +
" %s \n" +
" \n" +
getEchoBody() +
" ";
}
private final String getNoneFaultToHeader() {
return " \n" +
" " + noneUri + " \n" +
" \n";
}
public final String getNonAnonymousReplyToNoneFaultToMessage() {
return "\n" +
"\n" +
" %s \n" +
" " + WsaUtils.UUID + " \n" +
" \n" +
" %s \n" +
" \n" +
getNoneFaultToHeader() +
" %s \n" +
" \n" +
getEchoBody() +
" ";
}
private final String getNoneReplyTo() {
return " \n" +
" " + noneUri + " \n" +
" \n";
}
public final String getNoneReplyToEchoMessage() {
return "\n" +
"\n" +
" %s \n" +
" " + WsaUtils.UUID + " \n" +
getNoneReplyTo() +
" %s \n" +
" \n" +
getEchoBody() +
" ";
}
public final String getNoActionEchoMessage() {
return "\n" +
"\n" +
" %s \n" +
" " + WsaUtils.UUID + " \n" +
" \n" +
" " + anonymousUri + " \n" +
" \n" +
" \n" +
getEchoBody() +
" ";
}
public final String getFromMustUnderstandEchoMessage() {
return "\n" +
"\n" +
" %s \n" +
" " + WsaUtils.UUID + " \n" +
" \n" +
" " + anonymousUri + " \n" +
" \n" +
" \n" +
" " + anonymousUri + " \n" +
" \n" +
" %s \n" +
" \n" +
getEchoBody() +
" ";
}
public final String getDuplicateToNoneReplyToMessage() {
return "\n" +
"\n" +
"%s \n" +
"%s \n" +
getNoneReplyTo() +
" " + WsaUtils.UUID + " \n" +
" %s \n" +
" \n" +
getEchoBody() +
" ";
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy