All Downloads are FREE. Search and download functionalities are using the official Maven repository.

testutil.WsaW3CSOAPMessages 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 com.sun.xml.ws.api.addressing.AddressingVersion;

import javax.xml.namespace.QName;

/**
 * @author Arun Gupta
 */
public class WsaW3CSOAPMessages {
    private AddressingVersion av;

    public WsaW3CSOAPMessages(AddressingVersion av) {
        this.av = av;
    }

    public static final QName USER_FAULT_CODE = new QName("http://example.org/echo", "EmptyEchoString");

    private String getAnonymousReplyToHeader() {
        return " \n" +
                "  " + av.anonymousUri + " \n" +
                " \n";
    }

    private final String getAnonymousFaultToHeader() {
        return " \n" +
                "  " + av.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" +
                "  " + av.noneUri + " \n" +
                "  \n" +
                "  %s \n" +
                "\n" +
                getNotifyBody() +
                "";
    }

    public final String getNoneFaultToMessage() {
        return "\n" +
                "\n" +
                "  %s \n" +
                "  " + WsaUtils.UUID + " \n" +
                " \n" +
                "  " + av.noneUri + " \n" +
                "  \n" +
                "  %s \n" +
                "\n" +
                getNotifyBody() +
                "";
    }

    public final String getNoneReplyToFaultToMessage() {
        return "\n" +
                "\n" +
                "  %s \n" +
                "  " + WsaUtils.UUID + " \n" +
                " \n" +
                "  " + av.noneUri + " \n" +
                "  \n" +
                " \n" +
                "  " + av.noneUri + " \n" +
                "  \n" +
                "  %s \n" +
                "\n" +
                getNotifyBody() +
                "";
    }

    private final String getReplyToRefpsAnonymous() {
        return " \n" +
                "  " + av.anonymousUri + " \n" +
                "  \n" +
                "    Key#123456789 \n" +
                "  " +
                "  \n";
    }

    private final String getFaultToRefpsAnonymous() {
        return " \n" +
                "  " + av.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 (av.nsUri == AddressingVersion.W3C.nsUri)
            return "  " +
                    //WsaUtils.fileToXMLString(System.getProperty("basedir") + File.separatorChar + "config" + File.separatorChar + "wsaTestService.wsdl") +
                    " \n";
        else
            return "";
    }

    public final String getReplyToMetadataMessage() {
        return "\n" +
                "\n" +
                "  %s \n" +
                "  " + WsaUtils.UUID + " \n" +
                " \n" +
                "  " + av.noneUri + " \n" +
                getMetadata() +
                "  \n" +
                "  %s \n" +
                "\n" +
                getNotifyBody() +
                "";
    }


    // use metadata only for W3C
    private final String getMetadataExtensions() {
        if (av.nsUri == AddressingVersion.W3C.nsUri)
            return "  " +
                    "  \n" +
                    "    This should be ignored \n" +
                    "  ";
        else
            return "";
    }

    public final String getReplyToExtensionsMessage() {
        return "\n" +
                "\n" +
                "  %s \n" +
                "  " + WsaUtils.UUID + " \n" +
                " \n" +
                "  " + av.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" +
                "http://example.org/action/echoIn\n" +
                "uuid:c9251591-7b7e-4234-b193-2d242074466e\n" +
                "%s\n" +
                "\n" +
                getEchoBody() +
                "";
    }

    public final String getDuplicateReplyToMessage() {
        return "\n" +
                "\n" +
                "%s\n" +
              getAnonymousReplyToHeader() +
              getAnonymousReplyToHeader() +
                "http://example.org/action/echoIn\n" +
                "uuid:c9251591-7b7e-4234-b193-2d242074466e\n" +
                "\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" +
                "%s\n" +
                "http://example.org/action/echoIn\n" +
              " " + WsaUtils.UUID + "\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" +
                "  " + av.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" +
                "  " + av.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" +
                "  " + av.anonymousUri + " \n" +
                "  \n" +
                "\n" +
                getEchoBody() +
                "";
    }

    public final String getNoMessageIdEchoMessage() {
        return "\n" +
                "\n" +
                "  %s \n" +
                "  %s \n" +
                " \n" +
                "  " + av.anonymousUri + " \n" +
                "  \n" +
                "\n" +
                getEchoBody() +
                "";
    }

    public final String getFromMustUnderstandEchoMessage() {
        return "\n" +
                "\n" +
                "  %s \n" +
                "  " + WsaUtils.UUID + " \n" +
                " \n" +
                "  " + av.anonymousUri + " \n" +
                "  \n" +
                " \n" +
                "  " + av.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