#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
#
# Copyright (c) 2005-2017 Oracle and/or its affiliates. All rights reserved.
#
# The contents of this file are subject to the terms of either the GNU
# General Public License Version 2 only ("GPL") or the Common Development
# and Distribution License("CDDL") (collectively, the "License").  You
# may not use this file except in compliance with the License.  You can
# obtain a copy of the License at
# https://oss.oracle.com/licenses/CDDL+GPL-1.1
# or LICENSE.txt.  See the License for the specific
# language governing permissions and limitations under the License.
#
# When distributing the software, include this License Header Notice in each
# file and include the License file at LICENSE.txt.
#
# GPL Classpath Exception:
# Oracle designates this particular file as subject to the "Classpath"
# exception as provided by Oracle in the GPL Version 2 section of the License
# file that accompanied this code.
#
# Modifications:
# If applicable, add the following below the License Header, with the fields
# enclosed by brackets [] replaced by your own identifying information:
# "Portions Copyright [year] [name of copyright owner]"
#
# Contributor(s):
# If you wish your version of this file to be governed by only the CDDL or
# only the GPL Version 2, indicate your decision by adding "[Contributor]
# elects to include this software in this distribution under the [CDDL or GPL
# Version 2] license."  If you don't indicate a single choice of license, a
# recipient has the option to distribute your version of this file under
# either the CDDL, the GPL Version 2 or to extend the choice of license to
# its licensees as provided above.  However, if you add GPL Version 2 code
# and therefore, elected the GPL Version 2 license, then the option applies
# only if the new code is made subject to such option by the copyright
# holder.
#

# test descriptor
#   Holds information necessary for the test harness to run one specific test.
#
# Simple example descriptor file:
#
# <descriptor>
#    <description>this is a very useful test that tests stuff</description>
#    <client href="foo.bsh" since="2.0"/>
#    <service basedir=".">
#        <wsdl href="test.wsdl"/>
#    </service>
# </despcriptor>
#
#
start = element descriptor {

    # 'verstionAttributes' element specifies which versions of the
    #   code-under-test a particular test case is to be run against.
    #
    # See also 'client' element's 'versionAttributes' description.
    # See also 'versionAttributes' pattern definition below.
    #
    versionAttributes &

    # optional transport declaration, in case a test requires a certain
    # kind of transport. If specified, tests will only run with the declared
    # transport and skipped otherwise.
    attribute transport {"http"|"local"}? &

    # 'description' is to be used for a human-readable
    #   description of the this particular test case
    #
    element description {text} &

    # 'client' element holds the information necessary for a given
    #   test client to run. In particular it points to the beanshell
    #   source code for a given test client.
    #
    # There can be zero or more 'client' elements for a test.
    #
    element client {
        (
            # 'href' is the name or name-pattern for the client beanshell
            #   scripts. if 'href' is a relative path, it will be relative
            #   to the test instance directory.
            #   this attribute supports wildcard, such as "*.bsh"
            #
            attribute href {text} |

            # alternatively, a beanshell script can be specified inline.
            #   this is particularly useful for short scripts, as you
            #   don't have to manage million short files.
            text
        ),


        # The client's 'versionAttributes' specifies which versions of the
        #   code-under-test that this particular test-client code should be
        #   run against.
        #
        # This allows for different test-clients to run against different versions
        #   of the code-under-test (e.g. JAX-WS 2.0 vs. 2.0.1). This helps to test
        #   features which exist in multiple versions of the code-under-test
        #   but which have version-specific behavior.
        #
        versionAttributes

    }* &

    # 'service' element holds information for a particular 
    #
    # There must be at least one 'service' element per test.
    #   It is expected that most test cases will only have one
    #   service.  However, some technologies like WS-Trust require
    #   supporting services, such as an STS for Trust.
    #
    element service {

        # basedir defaults to ".", so that a single service test case can be written more quickly
        attribute basedir {text}?,

        # 'wsdl' is optional and points to the location of a WSDL, if any.
        #
        element wsdl {

            # 'href' points the WSDL document
            #
            attribute href {text}

        }?
        }+&
    # 'sts' element holds information for a  special handling of
    # sts services
    # In this case the harness should recognize the STS to be a special form
    # of service and not generate client artifacts
    #
    #
    element sts {

        # basedir defaults to ".", so that a single service test case can be written more quickly
        attribute basedir {text}?,

        # 'wsdl' is optional and points to the location of STS WSDL, if any.
        #
        element wsdl {

            # 'href' points the STS WSDL document
            #
            attribute href {text}

        }?
    
    }?
}

# 'versionAttributes' pattern is set of attributes that control
#   applicability of a test
#
versionAttributes =
    attribute since {version}? ,
    attribute until {version}? ,
    attribute excludeFrom {text}?

# version number
#   in the future consider enumeration
#
version = xsd:token
