<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://www.eclipse.org/jetty/configure_9_3.dtd">

<!-- =============================================================== -->
<!-- Configure the test-jndi webapp                                  -->
<!-- =============================================================== -->
<Configure id='wac' class="org.eclipse.jetty.webapp.WebAppContext">

  <New id="tx" class="org.eclipse.jetty.plus.jndi.Transaction">
    <Arg>
      <New class="com.acme.MockUserTransaction"/>
    </Arg>
  </New>

  <!-- =============================================================== -->
  <!-- Configure the webapp                                            -->
  <!-- =============================================================== -->
 <!-- Only uncomment if you are not using etc/jetty-plus.xml from start.ini

  <Set name="configurationClasses">
    <Call class="org.eclipse.jetty.webapp.Configuration$ClassList" name="serverDefault">
      <Arg><Ref refid="Server" /></Arg>
      <Call name="addAfter">
        <Arg name="afterClass">org.eclipse.jetty.webapp.FragmentConfiguration</Arg>
        <Arg>
          <Array type="String">
            <Item>org.eclipse.jetty.plus.webapp.EnvConfiguration</Item>
            <Item>org.eclipse.jetty.plus.webapp.PlusConfiguration</Item>
            <Item>org.eclipse.jetty.annotations.AnnotationConfiguration</Item>
          </Array>
        </Arg>
      </Call>
    </Call>
  </Set>
 -->

  <Set name="contextPath">/test-jndi</Set>
  <Set name="war"><Property name="jetty.webapps" default="."/>/test-jndi.war</Set>
  <Set name="extractWAR">true</Set>
  <Set name="copyWebDir">false</Set>
  <Set name="configurationDiscovered">true</Set>


  <!-- Define an env entry with Server scope for java:comp/env                   -->
  <New id="woggle"  class="org.eclipse.jetty.plus.jndi.EnvEntry">
    <Arg><Property name='server'/></Arg>
    <Arg>woggle</Arg>
    <Arg type="java.lang.Integer">4000</Arg>
    <Arg type="boolean">false</Arg>
  </New>

  <!-- Define an env entry with webapp scope for java:comp/env                   -->
  <New id="wiggle"  class="org.eclipse.jetty.plus.jndi.EnvEntry">
    <Arg><Ref refid='wac'/></Arg>
    <Arg>wiggle</Arg>
    <Arg type="java.lang.Double">100</Arg>
    <Arg type="boolean">true</Arg>
  </New>

 <!-- Mail Session setup                                          -->
 <New id="xxxmail" class="org.eclipse.jetty.plus.jndi.Resource">
    <Arg><Ref refid='wac'/></Arg>
     <Arg>mail/Session</Arg>
     <Arg>
       <New class="org.eclipse.jetty.jndi.factories.MailSessionReference">
         <Set name="user">CHANGE-ME</Set>
         <Set name="password">CHANGE-ME</Set>
         <Set name="properties">
           <New class="java.util.Properties">
             <Put name="mail.smtp.auth">false</Put> <!-- change to true if you want to authenticate -->
             <Put name="mail.smtp.host">CHANGE-ME</Put>
             <Put name="mail.from">CHANGE-ME</Put>
             <Put name="mail.debug">false</Put>
           </New>
          </Set>
       </New>
     </Arg>
 </New>

  <!-- A mock DataSource                                           -->
  <New id="mydatasource" class="org.eclipse.jetty.plus.jndi.Resource">
    <Arg><Ref refid='wac'/></Arg>
    <Arg>jdbc/mydatasource</Arg>
    <Arg>
      <New class="com.acme.MockDataSource"/>
    </Arg>
  </New>

</Configure>
