<?xml version="1.0" encoding="UTF-8"?>
<!--
/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you 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.
 */
-->
<!DOCTYPE struts PUBLIC
        "-//Apache Software Foundation//DTD Struts Configuration 6.0//EN"
        "https://struts.apache.org/dtds/struts-6.0.dtd">
<struts>
    <include file="xwork-test-default.xml"/>
    <package name="default" extends="xwork-test-default">

        <global-results>
            <result name="login"> <!-- should be chain type since it is the default -->
                <param name="actionName">login</param>
            </result>
        </global-results>

        <global-allowed-methods>execute,input,back,cancel,browse</global-allowed-methods>

        <action name="Foo" class="org.apache.struts2.SimpleAction">
            <param name="foo">17</param>
            <param name="bar">23</param>
            <result name="success" type="chain">
                <param name="actionName">Bar</param>
            </result>
            <interceptor-ref name="debugStack"/>
            <interceptor-ref name="defaultStack"/>
        </action>

        <action name="ExceptionFoo" class="org.apache.struts2.SimpleAction" method="exceptionMethod">
            <result name="exceptionHandled" type="void"/>
            <interceptor-ref name="debugStack"/>
            <interceptor-ref name="defaultStack"/>
        </action>

        <action name="NullFoo" class="org.apache.struts2.SimpleAction" method="nullMethod">
            <interceptor-ref name="debugStack"/>
            <interceptor-ref name="defaultStack"/>
        </action>

        <action name="LazyFoo" class="org.apache.struts2.SimpleAction">
            <result name="error" type="void"/>
            <interceptor-ref name="params"/>
            <interceptor-ref name="lazy">
                <param name="foo">${blah}</param>
            </interceptor-ref>
        </action>

        <action name="LazyFooWithStackParams" class="org.apache.struts2.SimpleAction">
            <result name="error" type="void"/>
            <interceptor-ref name="params"/>
            <interceptor-ref name="lazy">
                <param name="foo">${blah}</param>
                <param name="bar">static value</param>
            </interceptor-ref>
        </action>

        <action name="WildCard" class="org.apache.struts2.SimpleAction">
            <param name="foo">17</param>
            <param name="bar">23</param>
            <result name="success" type="void"/>
            <result name="*" type="mock"/>
            <interceptor-ref name="defaultStack"/>
        </action>

        <action name="WildCardInput" class="org.apache.struts2.SimpleAction" method="input">
            <param name="foo">17</param>
            <param name="bar">23</param>
            <result name="success" type="void"/>
            <result name="*" type="mock"/>
            <interceptor-ref name="defaultStack"/>
        </action>

        <action name="WildCardError" class="org.apache.struts2.SimpleAction">
            <result name="success" type="void"/>
            <result name="*" type="mock"/>
            <interceptor-ref name="defaultStack"/>
        </action>

        <action name="WildCard/*/*" class="org.apache.struts2.{1}Action"
                method="{2}">
            <param name="foo">{1}</param>
            <param name="bar">{2}</param>
            <result name="success" type="void"/>
            <interceptor-ref name="defaultStack"/>
        </action>

        <action name="aliasTest" class="org.apache.struts2.SimpleAction">
            <param name="aliases">#{ "aliasSource" : "aliasDest", "bar":"baz", "notExisting":"blah" }</param>
            <interceptor-ref name="params"/>
            <interceptor-ref name="alias"/>
            <result name="success" type="mock"/>
        </action>

        <action name="dynamicAliasTest" class="org.apache.struts2.SimpleAction">
            <param name="aliases">#{ #parameters['name'] : #parameters['value'] }</param>
            <interceptor-ref name="params"/>
            <interceptor-ref name="alias"/>
            <result name="success" type="mock"/>
        </action>

        <action name="packagelessAction" class="PackagelessAction">
        </action>

        <action name="Bar" class="org.apache.struts2.SimpleAction">
            <param name="foo">17</param>
            <param name="bar">23</param>
            <result name="error" type="mock"/>
        </action>

        <action name="MyBean" class="org.apache.struts2.util.MyBeanAction">
            <interceptor-ref name="debugStack"/>
            <interceptor-ref name="defaultStack"/>
            <result name="success" type="mock"/>
        </action>

        <action name="TestInterceptorParam" class="org.apache.struts2.SimpleAction">
            <interceptor-ref name="test">
                <param name="expectedFoo">expectedFoo</param>
            </interceptor-ref>
            <result name="error" type="mock"/>
        </action>

        <action name="TestInterceptorParamOverride" class="org.apache.struts2.SimpleAction">
            <interceptor-ref name="test">
                <param name="foo">foo123</param>
                <param name="expectedFoo">foo123</param>
            </interceptor-ref>
            <result name="error" type="mock"/>
        </action>

        <action name="TestModelDrivenValidation" class="org.apache.struts2.ModelDrivenAction">
            <interceptor-ref name="defaultStack"/>
            <interceptor-ref name="validation"/>
            <result name="success" type="mock"/>
        </action>

        <!-- chain resursion detection -->
        <action name="InfiniteRecursionChain" class="org.apache.struts2.ActionSupport">
            <result name="success" type="chain">InfiniteRecursionChain</result>
        </action>
        <action name="chain_with_namespace" class="org.apache.struts2.SimpleAction">
            <result name="error" type="chain">
                <param name="actionName">chain_without_namespace</param>
                <param name="namespace">%{blah}</param>
            </result>
            <interceptor-ref name="debugStack"/>
            <interceptor-ref name="defaultStack"/>
        </action>
        <action name="chain_without_namespace" class="org.apache.struts2.SimpleAction">
            <result name="error" type="chain">
                <param name="actionName">Foo</param>
            </result>
            <interceptor-ref name="debugStack"/>
            <interceptor-ref name="defaultStack"/>
        </action>

    </package>

    <package name="bar" extends="default" namespace="/foo/bar">
        <interceptors>
            <interceptor-stack name="barDefaultStack">
                <interceptor-ref name="debugStack"/>
                <interceptor-ref name="defaultStack"/>
            </interceptor-stack>
        </interceptors>

        <global-exception-mappings>
            <exception-mapping name="foo" exception="com.opensymphony.TestException" result="foo"/>
        </global-exception-mappings>

        <action name="Bar" class="org.apache.struts2.SimpleAction">
            <interceptor-ref name="barDefaultStack"/>
            <result name="error" type="mock"/>
        </action>

        <action name="TestInterceptorParamInheritance" class="org.apache.struts2.SimpleAction">
            <interceptor-ref name="test">
                <param name="expectedFoo">expectedFoo</param>
            </interceptor-ref>
            <result name="error" type="mock"/>
        </action>

        <action name="TestInterceptorParamInehritanceOverride" class="org.apache.struts2.SimpleAction">
            <interceptor-ref name="test">
                <param name="foo">foo123</param>
                <param name="expectedFoo">foo123</param>
            </interceptor-ref>
            <result name="error" type="mock"/>
        </action>
    </package>

    <package name="abstractPackage" namespace="/abstract" abstract="true">
        <action name="test" class="org.apache.struts2.SimpleAction"/>
    </package>

    <package name="nonAbstractPackage" extends="abstractPackage" namespace="/nonAbstract"/>

    <package name="baz" extends="default" namespace="baz">
        <action name="commandTest" class="org.apache.struts2.SimpleAction">
            <param name="foo">123</param>
            <result name="error" type="chain">
                <param name="actionName">bar</param>
            </result>
            <result name="success" type="mock"/>
            <interceptor-ref name="staticParams"/>
        </action>
        <action name="myCommand" class="org.apache.struts2.SimpleAction" method="commandMethod">
            <param name="bar">456</param>
            <result name="success" type="chain">
                <param name="actionName">foo</param>
            </result>
            <result name="org.apache.struts2.SimpleAction.CommandInvoked" type="mock"/>
            <interceptor-ref name="logger"/>
        </action>
        <action name="doMethodTest" class="org.apache.struts2.SimpleAction" method="input">
            <result name="input" type="mock"/>
        </action>
        <action name="unknownMethodTest" class="org.apache.struts2.SimpleAction">
            <result name="found" type="mock"/>
        </action>
        <action name="resultAction" class="org.apache.struts2.SimpleAction" method="resultAction">
            <param name="bar">456</param>
            <result name="success" type="chain">
                <param name="actionName">foo</param>
            </result>
            <interceptor-ref name="logger"/>
        </action>
    </package>

    <package name="wildcardNamespaces" extends="default" namespace="/animals/*">
        <action name="commandTest" class="org.apache.struts2.SimpleAction">
            <result name="success" type="mock"/>
            <interceptor-ref name="staticParams"/>
        </action>
    </package>

    <package name="multipleInheritance" extends="default,abstractPackage,bar" namespace="multipleInheritance">
        <action name="testMultipleInheritance" class="org.apache.struts2.SimpleAction">
            <result name="success" type="chain">
                <param name="actionName">foo</param>
            </result>
            <interceptor-ref name="barDefaultStack"/>
        </action>
    </package>


    <package name="Abstract-crud" extends="default">
        <!--  edit is often used as the create/view -->
        <default-class-ref class="org.apache.struts2.SimpleAction"/>
        <action name="edit">
            <result name="input" type="mock">edit.vm</result>
            <result name="success" type="mock">edit.vm</result>
            <result name="error" type="mock">edit.vm</result>
        </action>
        <action name="save">
            <result name="input" type="mock">edit.vm</result>
            <result name="success" type="chain">list</result>
            <result name="error" type="mock">edit.vm</result>
            <result name="cancel" type="mock">list.action</result>
        </action>
        <action name="list">
            <result name="success" type="mock">list</result>
        </action>
        <action name="delete">
            <result name="success" type="mock">list</result>
        </action>

    </package>

    <package name="Example" extends="Abstract-crud" namespace="/example">
        <default-class-ref class="org.apache.struts2.ModelDrivenAction"/>
    </package>

    <package name="Example2" extends="Abstract-crud" namespace="/example2">
        <default-class-ref class="org.apache.struts2.ModelDrivenAction"/>
        <action name="override">
            <result name="success" type="mock">somethingelse.vm</result>
        </action>
    </package>

    <package name="SubItem" extends="Abstract-crud" namespace="/example2/subItem">
        <default-class-ref class="org.apache.struts2.ModelDrivenAction"/>
    </package>

    <package name="Example3" extends="Abstract-crud" namespace="/example3">
        <!--  default-class-ref is expected to be inherited -->
    </package>

    <package name="wildcardDefault" extends="default" namespace="/wildcard-default">
        <default-action-ref name="movie-input"/>
        <action name="movie-*" class="org.apache.struts2.SimpleAction" method="{1}">
            <result name="success" type="mock"/>
        </action>
    </package>

    <package name="exactDefault" extends="default" namespace="/exact-default">
        <default-action-ref name="home"/>
        <action name="home" class="org.apache.struts2.SimpleAction" method="execute">
            <result name="success" type="mock"/>
        </action>
    </package>

    <package name="wildcardDefaultNoMatch" extends="default" namespace="/wildcard-default-nomatch">
        <default-action-ref name="no-match-anywhere"/>
        <action name="movie-*" class="org.apache.struts2.SimpleAction" method="{1}">
            <result name="success" type="mock"/>
        </action>
    </package>

    <include file="includeTest.xml"/>
</struts>
