Changeset 2475

Show
Ignore:
Timestamp:
09/23/08 19:31:02 (3 months ago)
Author:
jimse
Message:

build file refactor. Now wars only build when needed, and junit tests will run after a clean in the eclipse ide

Location:
trunk/otis
Files:
2 added
11 modified
7 moved

Legend:

Unmodified
Added
Removed
  • trunk/otis/.project

    r1491 r2475  
    1111                        </arguments> 
    1212                </buildCommand> 
     13                <buildCommand> 
     14                        <name>org.eclipse.ui.externaltools.ExternalToolBuilder</name> 
     15                        <arguments> 
     16                                <dictionary> 
     17                                        <key>LaunchConfigHandle</key> 
     18                                        <value>&lt;project&gt;/.externalToolBuilders/ant build.launch</value> 
     19                                </dictionary> 
     20                        </arguments> 
     21                </buildCommand> 
    1322        </buildSpec> 
    1423        <natures> 
  • trunk/otis/build.xml

    r2473 r2475  
    2929        <property name="testtar.file" value="${test.name.prefix}-${project.version}.tar"/> 
    3030        <property name="srctar.file" value="otis-src-${project.version}.tar"/> 
     31        <property name="outconfigrootdir" value="${builddir}/config" /> 
     32        <property name="warconfigdir" value="${outconfigrootdir}/war"/> 
     33        <property name="sdkconfigdir" value="${outconfigrootdir}/sdk"/> 
    3134         
    3235        <import file="otis.war.targets.xml"/> 
     
    4447        <mkdir dir="${builddir}"/> 
    4548        <mkdir dir="${builddir}/classes"/> 
    46         <mkdir dir="${builddir}/config"/> 
     49        <mkdir dir="${outconfigrootdir}"/> 
     50        <mkdir dir="${warconfigdir}"/> 
     51        <mkdir dir="${sdkconfigdir}"/> 
    4752        <mkdir dir="${builddir}/lib"/> 
    4853        <mkdir dir="${builddir}/doc"/> 
     
    7883        </target> 
    7984 
    80         <target name="test" depends="testwar,compile"> 
     85        <target name="testprep" depends="testwar"> 
     86                <copy file="${builddir}/${testwar.file}" tofile="${builddir}/${test.name.prefix}.war" /> 
     87 
     88                <concat destfile="${outconfigrootdir}/filter.properties"> 
     89                        OTIS.ENDPOINT=http://127.0.0.1:9997/otis-test/ 
     90                        REST.CP.TEMPLATE.DIR=build/config/sdk 
     91                        LDAP.SERVER.ADDR=ldap://localhost:50389 
     92                </concat> 
     93                <antcall target="-copy.sdkconfigs" /> 
     94                <copy file="${configdir}/otis.ks" todir="${sdkconfigdir}" preservelastmodified="true"/> 
     95                <copy file="${configdir}/TreeData.xml" todir="${outconfigrootdir}" /> 
     96        </target> 
     97         
     98        <target name="test" depends="testprep"> 
    8199        <mkdir dir="${junit.output.dir}"/> 
    82                 <copy file="${builddir}/${testwar.file}" tofile="${builddir}/${test.name.prefix}.war" /> 
    83100        <junit fork="yes" printsummary="withOutAndErr"> 
    84101            <formatter type="xml"/> 
     
    106123    </target> 
    107124         
    108         <target name="null" /> 
    109  
    110125        <target name="jar" depends="compile"> 
    111126                <jar 
     
    113128                        basedir="${builddir}/classes" 
    114129                        filesonly="false" 
    115                         excludes="org/bandit/otis/server org/bandit/otis/server/*.class **/*.jar,**/*.tar,**/*.zip"> 
     130                        excludes="org/bandit/otis/server,org/bandit/otis/server/*.class,**/*.jar,**/*.tar,**/*.zip"> 
    116131                </jar> 
    117132        </target> 
    118133         
    119         <target name="-copy.configs"> 
    120                 <copy file="${configdir}/web.xml" todir="${builddir}/config" overwrite="true" /> 
    121                 <copy file="${configdir}/otis-config.client.local.xml" todir="${builddir}/config" overwrite="true" /> 
    122                 <copy file="${configdir}/otis-config.client.remote.xml" todir="${builddir}/config" overwrite="true" /> 
    123                 <copy file="${configdir}/otis-config.server.xml" todir="${builddir}/config" overwrite="true" /> 
     134        <fileset id="sdkconfigfiles" dir="${configdir}" 
     135                includes="      otis-config.client.local.xml, 
     136                                        otis-config.client.remote.xml, 
     137                                        otis-config.client.am.xml, 
     138                                        otis-config.client.rolemanager.xml, 
     139                                        otis-config.client.idm.xml, 
     140                                        keysign.xml, 
     141                                        PUT_ContextChangesRequest.fmt, 
     142                                        assertion.xml  
     143        "/>                      
     144        <target name="-copy.sdkconfigs" depends="-init"> 
     145                <condition property="sdk.filter.properties.match"> 
     146                        <filesmatch  
     147                                file1="${outconfigrootdir}/filter.properties" 
     148                                file2="${sdkconfigdir}/filter.properties" /> 
     149                </condition> 
     150                <antcall target="-update.sdkconfigs" /> 
     151                <copy todir="${sdkconfigdir}"> 
     152                        <fileset refid="sdkconfigfiles" /> 
     153                        <filterset> 
     154                                <filtersfile file="${sdkconfigdir}/filter.properties"/> 
     155                        </filterset> 
     156                </copy> 
     157        </target> 
     158        <target name="-update.sdkconfigs" unless="sdk.filter.properties.match" > 
     159                <delete > 
     160                        <fileset dir="${sdkconfigdir}" includes="**/*"/> 
     161                </delete> 
     162                <copy file="${outconfigrootdir}/filter.properties" todir="${sdkconfigdir}" />  
     163        </target> 
     164 
     165        <fileset id="warconfigfiles" dir="${configdir}" 
     166                includes="      web.xml, 
     167                                        otis-config.client.local.xml, 
     168                                        otis-config.server.xml, 
     169                                        AuthenticatedSessionResponse.fmt, 
     170                                        GET_AttributeResponse.fmt, 
     171                                        GET_AuthEntityResponse.fmt, 
     172                                        GET_EntityResponse.fmt, 
     173                                        GET_PropertiesResponse.fmt, 
     174                                        GET_RoleResponse.fmt  
     175        "/>                      
     176        <target name="-copy.warconfigs" depends="-init"> 
     177                <condition property="war.filter.properties.match"> 
     178                        <filesmatch  
     179                                file1="${outconfigrootdir}/filter.properties" 
     180                                file2="${warconfigdir}/filter.properties" /> 
     181                </condition> 
     182                <antcall target="-update.warconfigs" /> 
     183                <copy todir="${warconfigdir}"> 
     184                        <fileset refid="warconfigfiles" /> 
     185                        <filterset> 
     186                                <filtersfile file="${warconfigdir}/filter.properties"/> 
     187                        </filterset> 
     188                </copy> 
     189        </target> 
     190        <target name="-update.warconfigs" unless="war.filter.properties.match" > 
     191                <delete > 
     192                        <fileset dir="${warconfigdir}" includes="**/*"/> 
     193                </delete> 
     194                <copy file="${outconfigrootdir}/filter.properties" todir="${warconfigdir}" />  
    124195        </target> 
    125196 
     
    127198                <war 
    128199                        destfile="${builddir}/${project.war.file}" 
    129                         webxml="${builddir}/config/web.xml" 
    130                         duplicate="preserve"> 
    131  
    132                         <fileset dir="${configdir}" excludes="web.xml otis-config.client.local.xml otis-config.client.remote.xml otis-config.server.xml log4j.properties"/> 
    133                         <fileset dir="${builddir}/config" excludes="web.xml" /> 
     200                        webxml="${builddir}/config/war/web.xml" 
     201                        duplicate="preserve" 
     202                        update="true"> 
     203 
     204                        <fileset dir="${builddir}/config/war" excludes="web.xml,filter.properties" /> 
    134205 
    135206                        <!-- Classes --> 
  • trunk/otis/config/AuthenticatedSessionResponse.fmt

  • trunk/otis/config/GET_AttributeResponse.fmt

  • trunk/otis/config/GET_AuthEntityResponse.fmt

  • trunk/otis/config/GET_EntityResponse.fmt

  • trunk/otis/config/GET_PropertiesResponse.fmt

  • trunk/otis/config/GET_RoleResponse.fmt

  • trunk/otis/config/PUT_ContextChangesRequest.fmt

  • trunk/otis/config/otis-config.client.local.xml

    r2441 r2475  
    163163                                                        <Setting Name="ConnectionType" Type="xsd:string">LDAP</Setting> 
    164164                                                        <Setting Name="AddressList" Type="htf:list"> 
    165                                                                 <Setting Name="Address" Type="xsd:string">@{ldap.server.addr}</Setting> 
     165                                                                <Setting Name="Address" Type="xsd:string">@LDAP.SERVER.ADDR@</Setting> 
    166166                                                        </Setting> 
    167167                                                        <Setting Name="jndiProvider" Type="xsd:string">com.sun.jndi.ldap.LdapCtxFactory</Setting> 
  • trunk/otis/config/otis-config.client.remote.xml

    r2441 r2475  
    2929 
    3030                <Setting Name="otisEndpoint" Type="htf:remoteEndPointHandler"> 
    31                         @{otis.endpoint} 
     31                        @OTIS.ENDPOINT@ 
    3232                </Setting> 
    3333 
     
    7777                                                        <Setting Name="DefaultContextUri" Type="xsd:anyURI">urn:RESTfulContext</Setting> 
    7878                                                </Setting> 
    79                                                 <Setting Name="templateDir" Type="xsd:string">@{rest.cp.template.dir}</Setting> 
     79                                                <Setting Name="templateDir" Type="xsd:string">@REST.CP.TEMPLATE.DIR@</Setting> 
    8080                                                <!-- Uncomment this setting to get audit logging for this context provider 
    8181                                                <Setting Name="AuditRecordClass" Type="xsd:string">org.bandit.otis.impl.OtisAuditRecord</Setting> 
  • trunk/otis/config/otis-config.server.xml

    r2462 r2475  
    3131                <!-- Allow communications over an insecure channel (like HTTP) --> 
    3232         
    33                 <Setting Name="AllowInsecureChannel" Type="xsd:boolean">@{allow.insecure.channel}</Setting> 
     33                <Setting Name="AllowInsecureChannel" Type="xsd:boolean">@ALLOW.INSECURE.CHANNEL@</Setting> 
    3434                 
    3535                <!-- Sanitize strings to prevent cross-site scripting? If this is false, portions of strings will 
     
    547547                                        <Setting Name="Noun8" Type="xsd:string">Properties/*</Setting> 
    548548                                </Setting> 
    549                                 <Setting Name="POST_TemplateFile" Type="xsd:string">AuthenticatedSessionResponse.xml</Setting> 
    550                                 <Setting Name="PUT_TemplateFile" Type="xsd:string">AuthenticatedSessionResponse.xml</Setting> 
    551                                 <Setting Name="GET_TemplateFile" Type="xsd:string">GET_AuthEntityResponse.xml</Setting> 
    552                                 <Setting Name="GET_PropertiesTemplateFile" Type="xsd:string">GET_PropertiesResponse.xml</Setting> 
    553                                 <Setting Name="SessionSecretBitSize" Type="xsd:int">@{session.secret.bitsize}</Setting> 
     549                                <Setting Name="POST_TemplateFile" Type="xsd:string">AuthenticatedSessionResponse.fmt</Setting> 
     550                                <Setting Name="PUT_TemplateFile" Type="xsd:string">AuthenticatedSessionResponse.fmt</Setting> 
     551                                <Setting Name="GET_TemplateFile" Type="xsd:string">GET_AuthEntityResponse.fmt</Setting> 
     552                                <Setting Name="GET_PropertiesTemplateFile" Type="xsd:string">GET_PropertiesResponse.fmt</Setting> 
     553                                <Setting Name="SessionSecretBitSize" Type="xsd:int">@SESSION.SECRET.BITSIZE@</Setting> 
    554554                        </Setting> 
    555555                         
     
    568568                                        <Setting Name="Noun10" Type="xsd:string">DeprovisionRole/*</Setting> 
    569569                                </Setting> 
    570                                 <Setting Name="GET_TemplateFile" Type="xsd:string">GET_RoleResponse.xml</Setting> 
     570                                <Setting Name="GET_TemplateFile" Type="xsd:string">GET_RoleResponse.fmt</Setting> 
    571571                        </Setting> 
    572572 
     
    583583                                        <Setting Name="Noun8" Type="xsd:string">Entity/*/Attribute/*</Setting> 
    584584                                </Setting> 
    585                                 <Setting Name="POST_TemplateFile" Type="xsd:string">POST_EntityResponse.xml</Setting> 
    586                                 <Setting Name="GET_EntityTemplateFile" Type="xsd:string">GET_EntityResponse.xml</Setting> 
    587                                 <Setting Name="GET_AttributeTemplateFile" Type="xsd:string">GET_AttributeResponse.xml</Setting> 
     585                                <Setting Name="POST_TemplateFile" Type="xsd:string">POST_EntityResponse.fmt</Setting> 
     586                                <Setting Name="GET_EntityTemplateFile" Type="xsd:string">GET_EntityResponse.fmt</Setting> 
     587                                <Setting Name="GET_AttributeTemplateFile" Type="xsd:string">GET_AttributeResponse.fmt</Setting> 
    588588                                <Setting Name="EntityIDPolicy" Type="htf:jscriptexec"> <![CDATA[ 
    589589                                        entityIDOk = ""; 
  • trunk/otis/config/web.xml

    r2441 r2475  
    2020        <context-param> 
    2121                <param-name>org.bandit.otis.server.conf.dir</param-name> 
    22                 <param-value>@{server.conf.dir}</param-value> 
     22                <param-value>@SERVER.CONF.DIR@</param-value> 
    2323                <description> 
    2424                        The OTIS configuration directory 
  • trunk/otis/otis.war.targets.xml

    r2474 r2475  
    1717        <import file="build.xml"/> 
    1818 
    19         <target name="war" depends="-copy.configs"> 
     19        <target name="war"> 
     20                <concat destfile="${outconfigrootdir}/filter.properties"> 
     21                        SERVER.CONF.DIR=otis 
     22                        LDAP.SERVER.ADDR=ldap://example.org:389 
     23                        SESSION.SECRET.BITSIZE=1024 
     24                        ALLOW.INSECURE.CHANNEL=false 
     25                </concat> 
    2026                <property name="project.war.file" value="otis-${project.version}.war" /> 
    21                 <replace file="${builddir}/config/web.xml" token="@{server.conf.dir}" value="otis/"/> 
    22                 <replace file="${builddir}/config/otis-config.client.local.xml" token="@{ldap.server.addr}" value="ldap://example.org:389"/> 
    23                 <replace file="${builddir}/config/otis-config.client.remote.xml" token="@{otis.endpoint}" value="https://example.org/otis"/> 
    24                 <replace file="${builddir}/config/otis-config.client.remote.xml" token="@{rest.cp.template.dir}" value="./config/"/> 
    25                 <replace file="${builddir}/config/otis-config.server.xml" token="@{session.secret.bitsize}" value="1024"/> 
    26                 <replace file="${builddir}/config/otis-config.server.xml" token="@{allow.insecure.channel}" value="false"/> 
    27  
     27                <antcall target="-copy.warconfigs" /> 
    2828                <antcall target="-warbuilder" /> 
    2929        </target> 
    3030 
    31         <target name="wagwar" depends="-copy.configs"> 
     31        <target name="wagwar"> 
     32                <concat destfile="${outconfigrootdir}/filter.properties"> 
     33                        SERVER.CONF.DIR=/usr/share/java/otis-config 
     34                        LDAP.SERVER.ADDR=ldap://wag.bandit-project.org:389 
     35                        SESSION.SECRET.BITSIZE=1024 
     36                        ALLOW.INSECURE.CHANNEL=false 
     37                </concat> 
    3238                <property name="project.war.file" value="otis.war" /> 
    33                 <replace file="${builddir}/config/web.xml" token="@{server.conf.dir}" value="/usr/share/java/otis-config"/> 
    34                 <replace file="${builddir}/config/otis-config.client.local.xml" token="@{ldap.server.addr}" value="ldap://wag.bandit-project.org:389"/> 
    35                 <replace file="${builddir}/config/otis-config.client.remote.xml" token="@{otis.endpoint}" value="https://wag.bandit-project.org/otis"/> 
    36                 <replace file="${builddir}/config/otis-config.client.remote.xml" token="@{rest.cp.template.dir}" value="./config/"/> 
    37                 <replace file="${builddir}/config/otis-config.server.xml" token="@{session.secret.bitsize}" value="1024"/> 
    38                 <replace file="${builddir}/config/otis-config.server.xml" token="@{allow.insecure.channel}" value="false"/> 
    39  
     39                <antcall target="-copy.warconfigs" /> 
    4040                <antcall target="-warbuilder" /> 
    4141        </target> 
    4242 
    43         <target name="testwar" depends="-copy.configs"> 
     43        <target name="testwar"> 
     44                <concat destfile="${outconfigrootdir}/filter.properties"> 
     45                        SERVER.CONF.DIR=otis-test 
     46                        LDAP.SERVER.ADDR=ldap://localhost:50389 
     47                        SESSION.SECRET.BITSIZE=0 
     48                        ALLOW.INSECURE.CHANNEL=true 
     49                </concat> 
    4450                <property name="project.war.file" value="otis-test-${project.version}.war" /> 
    45                 <replace file="${builddir}/config/web.xml" token="@{server.conf.dir}" value="otis-test/"/> 
    46                 <replace file="${builddir}/config/otis-config.client.local.xml" token="@{ldap.server.addr}" value="ldap://localhost:50389"/> 
    47                 <replace file="${builddir}/config/otis-config.client.remote.xml" token="@{otis.endpoint}" value="http://localhost:9997/otis-test"/> 
    48                 <replace file="${builddir}/config/otis-config.client.remote.xml" token="@{rest.cp.template.dir}" value="otis-test/"/> 
    49                 <replace file="${builddir}/config/otis-config.server.xml" token="@{session.secret.bitsize}" value="0"/> 
    50                 <replace file="${builddir}/config/otis-config.server.xml" token="@{allow.insecure.channel}" value="true"/> 
    51                  
     51                <antcall target="-copy.warconfigs" /> 
    5252                <antcall target="-warbuilder" /> 
    5353        </target> 
  • trunk/otis/src/org/bandit/otis/test/TestUtil.java

    r2470 r2475  
    1616                        ConfigurationHandler handler = new ConfigurationHandler(); 
    1717 
    18                         handler.setConfigurationBase("otis-test/"); 
     18                        handler.setConfigurationBase("build/config/sdk/"); 
    1919                        handler.setFileName(configFile); 
    2020                        handler.configure(null); 
     
    2222                        Map<String, Object> rVal = handler.getSettings(); 
    2323                        if (rVal == null) { 
    24                                 System.out.println("failed to get config of: otis-test/" + configFile); 
     24                                System.out.println("failed to get config of: build/config/sdk/" + configFile); 
    2525                        } 
    2626 
  • trunk/otis/src/org/bandit/otis/test/junit/AuthSessionBaseTest.java

    r2470 r2475  
    6464                 
    6565                String[] args = 
    66                 {"-outputFile=otis-test/TreeData.xml", "-nogui"}; 
     66                {"-outputFile=build/config/TreeData.xml", "-nogui"}; 
    6767                ldapSrv = new RawLdap(); 
    6868                ldapSrv.startMain(ldapSrv, args); 
  • trunk/otis/src/org/bandit/otis/test/junit/AuthSessionTest.java

    r2470 r2475  
    140140                        DocumentBuilder db; 
    141141                        DocumentBuilderFactory dbf; 
    142                         File file = new File("otis-test/assertion.xml"); 
     142                        File file = new File("build/config/sdk/assertion.xml"); 
    143143 
    144144                        dbf = javax.xml.parsers.DocumentBuilderFactory.newInstance();