mcconnell    2003/11/24 06:57:27

  Modified:    kernel   maven.xml
               kernel/impl project.xml
               kernel/impl/src/java/org/apache/avalon/merlin/kernel/impl
                        DefaultCriteria.java DefaultFactory.java
  Added:       kernel/test .cvsignore maven.xml project.xml
               kernel/test/src/test/org/apache/avalon/merlin
                        MerlinEmbeddedTest.java SimpleEmbeddingTest.java
  Removed:     kernel   project.properties
  Log:
  More reshuffling of testcase in prep for full-blown embeddor validation.
  
  Revision  Changes    Path
  1.4       +6 -392    avalon-sandbox/kernel/maven.xml
  
  Index: maven.xml
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/kernel/maven.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- maven.xml 13 Nov 2003 17:05:34 -0000      1.3
  +++ maven.xml 24 Nov 2003 14:57:27 -0000      1.4
  @@ -2,412 +2,26 @@
   
     <maven:snapshot project="${pom}"/>
   
  -  <ant:property name="merlin.bootstrap.jar" value="merlin-bootstrap-1.0.jar"/>
  -  <ant:property name="merlin.plugin.jar" value="merlin-plugin-1.1-SNAPSHOT.jar"/>
  -  <ant:property name="meta.plugin.jar" value="avalon-meta-plugin-1.2-SNAPSHOT.jar"/>
  -
  -  <ant:property file="project.properties"/>
  -  <ant:property name="maven.docs.src" value="${basedir}/platform/xdocs"/>
  -  <ant:property name="merlin.build.inst" value="merlin"/>
  -  <ant:property name="merlin.build.inst.dir" 
  -    value="${maven.build.dir}/${merlin.build.inst}"/>
  -  <ant:property name="maven.jar.manifest.extensions.add" value="true"/>
  -  <ant:property name="maven.checkstyle.format" value="avalon"/>
     <ant:property name="pom.organization.identifier" value="ASF"/>
     <ant:property name="pom.specificationVersion" value="1.0"/>
  -  <ant:property name="maven.license.licenseFile" value="${basedir}/LICENSE.txt"/>
  -  <ant:property name="maven.javadoc.stylesheet" 
  -    value="${basedir}/platform/src/etc/stylesheet.css"/>
  -
  -  <!--
  -  Get the MERLIN_HOME environment variable.  If its not declared then
  -  default to ${user.home}/.merlin as the install directory.
  -  -->
  -
  -  <ant:property environment="env"/>
  -  <ant:property name="merlinEnvironment" value="${env.MERLIN_HOME}"/>
  -  <j:if test="${merlinEnvironment != ''}">
  -    <ant:property name="merlin.home" value="${merlinEnvironment}"/>
  -  </j:if>
  -  <ant:property name="merlin.home" value="${user.home}/.merlin"/>
  -
  -  <goal name="merlin:update">
  -    <attainGoal name="merlin:install"/>
  -    <attainGoal name="merlin:tutorials"/>
  -    <attainGoal name="merlin:site"/>
  -    <attainGoal name="merlin:package"/>
  -    <attainGoal name="merlin:replicate"/>
  -  </goal>
  -
  -  <goal name="merlin:replicate">
  -    <mkdir dir="${merlin.home}"/>
  -    <copy toDir="${merlin.home}">
  -      <fileset dir="${merlin.build.inst.dir}"/>
  -    </copy>
  -  </goal>
  -
  -  <goal name="merlin:validate" description="Validate that the tutorial targets are 
buildable." >
  -    <maven:reactor
  -      basedir="${basedir}"
  -      includes="platform/tutorials/**/project.xml"
  -      excludes="platform/tutorials/project.xml,**/target/**"
  -      goals=""
  -      banner="Validate:"
  -      ignoreFailures="false" />
  -  </goal>
  -
  -  <goal name="merlin:demo" description="Execute the demo targets." >
  -    <maven:reactor
  -      basedir="${basedir}"
  -      includes="platform/tutorials/**/project.xml"
  -      excludes="**/target/**"
  -      goals="demo"
  -      banner="Demo:"
  -      ignoreFailures="false" />
  -  </goal>
   
  -
  -  <goal name="merlin:build" description="Build Merlin.">
  +  <goal name="avalon:build" description="Build all projects.">
       <maven:reactor basedir="${basedir}"
         includes="**/project.xml"
  -      
excludes="**/target/**,platform/**,kernel/plugin/**,project.xml,merlin-extensions/**"
  -      goals="jar:install"
  -      banner="Installing:"
  +      excludes="**/target/**,platform/**,project.xml"
  +      goals=""
  +      banner="Building:"
         ignoreFailures="false" />
  -    <attainGoal name="merlin:plugin"/>
     </goal>
   
  -  <goal name="merlin:install" 
  -    description="Build the Merlin distribution." prereqs="merlin:build,xinstall"/>
  -
  -  <goal name="xinstall">
  -    <!-- prepare structure -->
  -    <ant:mkdir dir="${merlin.build.inst.dir}"/>
  -    <ant:mkdir dir="${merlin.build.inst.dir}/ext"/>
  -    <ant:mkdir dir="${merlin.build.inst.dir}/bin/lib"/>
  -    <ant:mkdir dir="${merlin.build.inst.dir}/repository"/>
  -
  -    <!-- import bootstrap jar -->
  -    <ant:copy 
  -       file="${basedir}/kernel/bootstrap/target/${merlin.bootstrap.jar}" 
  -       toDir="${merlin.build.inst.dir}/bin/lib"/>
  -
  -    <!-- import subproject jar files -->
  -    <maven:reactor
  -      basedir="${basedir}"
  -      includes="platform.xml"
  -      goals="ximport"
  -      banner="Resolving dependencies:"
  -      ignoreFailures="false"/>
  -
  -    <!-- create a directory containing the plugins -->
  -    <ant:copy 
  -       file="${merlin.build.inst.dir}/system/avalon-meta/jars/${meta.plugin.jar}" 
  -       toDir="${maven.build.dir}/plugins"/>
  -    <delete 
file="${merlin.build.inst.dir}/system/avalon-meta/jars/${meta.plugin.jar}"/>
  -    <ant:mkdir dir="${maven.build.dir}/plugins"/>
  -    <ant:copy toDir="${maven.build.dir}/plugins">
  -      <fileset dir="${basedir}/kernel/plugin/target">
  -        <include name="${merlin.plugin.jar}"/>
  -      </fileset>
  -    </ant:copy>
  -
  -    <!-- copy the xml api jar file to the merlin/ext directory -->
  -    <ant:copy 
  -       file="${merlin.build.inst.dir}/system/xml-apis/jars/xml-apis-2.0.2.jar" 
  -       toDir="${merlin.build.inst.dir}/ext"/>
  -    <ant:copy 
  -       file="${merlin.build.inst.dir}/system/xml-apis/jars/xmlParserAPIs-2.0.2.jar" 
  -       toDir="${merlin.build.inst.dir}/ext"/>
  -    <ant:copy 
  -       file="${merlin.build.inst.dir}/system/xerces/jars/xerces-2.4.0.jar" 
  -       toDir="${merlin.build.inst.dir}/ext"/>
  -    <delete dir="${merlin.build.inst.dir}/system/xml-apis"/>
  -    <delete dir="${merlin.build.inst.dir}/system/xerces"/>
  -
  -    <!-- add supporting resources -->
  -    <ant:copy toDir="${merlin.build.inst.dir}">
  -      <fileset dir="${basedir}/platform/src">
  -        <include name="bin/**/*"/>
  -        <include name="config/**/*"/>
  -        <include name="system/**/*"/>
  -      </fileset>
  -      <fileset dir="${basedir}">
  -        <include name="LICENSE.txt"/>
  -        <include name="README.TXT"/>
  -      </fileset>
  -    </ant:copy>
  -
  -    <ant:copy toDir="${maven.build.dir}">
  -      <fileset dir="${basedir}">
  -        <include name="INSTALLATION.TXT"/>
  -      </fileset>
  -    </ant:copy>
  -
  -    <ant:chmod file="${merlin.build.inst.dir}/bin/merlin.sh" perm="u=rwx,go=rx"/>
  -    <ant:chmod file="${merlin.build.inst.dir}/bin/merlinx.sh" perm="u=rwx,go=rx"/>
  -    <ant:chmod file="${merlin.build.inst.dir}/bin/merlin-server.sh" 
perm="u=rwx,go=rx"/>
  -    <ant:fixcrlf eol="crlf" srcdir="${merlin.build.inst.dir}/bin">
  -       <include name="README.TXT"/>
  -    </ant:fixcrlf>
  -    <ant:fixcrlf eol="crlf" srcdir="${merlin.build.dir}">
  -       <include name="INSTALLATION.TXT"/>
  -    </ant:fixcrlf>
  -    <ant:fixcrlf eol="crlf" srcdir="${merlin.build.inst.dir}/bin">
  -      <include name="merlin.bat"/>
  -      <include name="merlinx.bat"/>
  -      <include name="README.TXT"/>
  -      <include name="LICENSE.TXT"/>
  -    </ant:fixcrlf>
  -    <ant:fixcrlf eol="crlf" srcdir="${merlin.build.inst.dir}/bin/nt">
  -      <include name="InstallService-NT.bat"/>
  -      <include name="UninstallService-NT.bat"/>
  -      <include name="TANUKISOFTWARE_LICENSE.txt"/>
  -      <include name="wrapper.conf"/>
  -    </ant:fixcrlf>
  -    <ant:fixcrlf eol="lf" srcdir="${merlin.build.inst.dir}/bin">
  -      <include name="merlin.sh"/>
  -      <include name="merlinx.sh"/>
  -      <include name="merlin-server.sh"/>
  -    </ant:fixcrlf>
  -
  -  </goal>
  -
  -  <goal name="merlin:plugin">
  -    <maven:reactor
  -      basedir="${basedir}"
  -      includes="kernel/plugin/project.xml"
  -      goals="plugin:install"
  -      banner="Installing plugin:"
  -      ignoreFailures="false"/>
  -  </goal>
  -
  -  <goal name="merlin:package">
  -
  -    <!--
  -    <j:set var="package.name" value="${maven.final.name}-dist"/>
  -    -->
  -    <maven:snapshot project="${pom}"/>
  -    <j:set var="timestamp" value="${snapshotSignature.substring(7,15)}"/>
  -    <j:set var="package.name" value="${maven.final.name}-dist-${timestamp}"/>
  -
  -    <ant:echo>Building distribution: ${package.name}</ant:echo>
  -    <ant:zip zipfile="${maven.build.dir}/${package.name}.zip">
  -      <zipfileset dir="${merlin.build.inst.dir}" prefix="merlin"/>
  -      <zipfileset dir="${maven.build.dir}/plugins" prefix="plugins"/>
  -      <fileset dir="${basedir}">
  -        <include name="INSTALLATION.TXT"/>
  -      </fileset>
  -    </ant:zip>
  -    <checksum file="${maven.build.dir}/${package.name}.zip"/>
  -
  -    <ant:tar tarfile="${maven.build.dir}/${package.name}.tar">
  -      <tarfileset dir="${merlin.build.inst.dir}" prefix="merlin"/>
  -      <tarfileset dir="${maven.build.dir}/plugins" prefix="plugins"/>
  -      <fileset dir="${basedir}">
  -        <include name="INSTALLATION.TXT"/>
  -      </fileset>
  -    </ant:tar>
  -    <ant:gzip 
  -      zipfile="${maven.build.dir}/${package.name}.tar.gz"
  -      src="${maven.build.dir}/${package.name}.tar"/>
  -    <ant:delete file="${maven.build.dir}/${package.name}.tar"/>
  -    <checksum file="${maven.build.dir}/${package.name}.tar.gz"/>
  -
  -    <j:set var="docs.name" value="${maven.final.name}-docs-${timestamp}"/>
  -    <!-- <j:set var="docs.name" value="${package.name}-docs"/>-->
  -
  -    <ant:echo>Building doc kit: ${docs.name}</ant:echo>
  -    <ant:zip zipfile="${maven.build.dir}/${docs.name}.zip">
  -      <zipfileset dir="${maven.build.dir}/docs" prefix="docs"/>
  -    </ant:zip>
  -    <checksum file="${maven.build.dir}/${docs.name}.zip"/>
  -    <ant:tar tarfile="${maven.build.dir}/${docs.name}.tar">
  -      <tarfileset dir="${maven.build.dir}/docs" prefix="docs"/>
  -    </ant:tar>
  -    <ant:gzip 
  -      zipfile="${maven.build.dir}/${docs.name}.tar.gz"
  -      src="${maven.build.dir}/${docs.name}.tar"/>
  -    <ant:delete file="${maven.build.dir}/${docs.name}.tar"/>
  -    <checksum file="${maven.build.dir}/${docs.name}.tar.gz"/>
  -
  -    <j:set var="tutorial.name" value="${maven.final.name}-tutorial-${timestamp}"/>
  -    <!--<j:set var="tutorial.name" value="${maven.final.name}-tutorial"/>-->
  -
  -    <ant:echo>Building tutorial kit: ${tutorial.name}</ant:echo>
  -    <ant:zip zipfile="${maven.build.dir}/${tutorial.name}.zip">
  -      <zipfileset dir="${basedir}/target/tutorials" prefix="tutorial"/>
  -    </ant:zip>
  -    <checksum file="${maven.build.dir}/${tutorial.name}.zip"/>
  -    <ant:tar tarfile="${maven.build.dir}/${tutorial.name}.tar">
  -      <tarfileset dir="${basedir}/target/tutorials" prefix="tutorial"/>
  -    </ant:tar>
  -    <ant:gzip 
  -      zipfile="${maven.build.dir}/${tutorial.name}.tar.gz"
  -      src="${maven.build.dir}/${tutorial.name}.tar"/>
  -    <ant:delete file="${maven.build.dir}/${tutorial.name}.tar"/>
  -    <checksum file="${maven.build.dir}/${tutorial.name}.tar.gz"/>
  -
  -  </goal>
  -
  -  <!--
  -  Import the jar files declared as dependecies from platform.xml.  This
  -  includes all of the external jar files needed to run merlin.  Dependent 
  -  jar files are copied from the user's local repository to the merlin 
  -  install repository.
  -  -->
  -  <goal name="ximport">
  -    <j:forEach var="dep" items="${pom.dependencies}">
  -      <j:if test="${dep.getId() != 'junit:junit'}">
  -        <mkdir 
dir="${maven.build.dir}/${merlin.build.inst}/system/${dep.artifactDirectory}/${dep.type}s"/>
  -        <copy 
  -          
todir="${maven.build.dir}/${merlin.build.inst}/system/${dep.artifactDirectory}/${dep.type}s/"
  -          
file="${maven.repo.local}/${dep.artifactDirectory}/${dep.type}s/${dep.artifact}"/>
  -      </j:if>
  -    </j:forEach>
  -  </goal>
  -
  -  <!--
  -  Generation of the documentation for the entire Merlin project including the 
  -  related subprojects.
  -  NOTE: merlin site generation is broken due a bug in Maven RC1
  -  Workaround is to download docs from 
  -  http://www.apache.org/dist/avalon/merlin/binaries/
  -  -->
  -  <goal name="merlin:site"
  -      description="Build the Merlin site" prereqs="license">
  -    <maven:reactor basedir="${basedir}"
  -      includes="platform.xml"
  -      goals="xjavadoc,site"
  -      banner="Building site:"
  -      ignoreFailures="false"/>
  -  </goal>
  -
  -  <!--
  -  Build the tuturials distribution.
  -  -->
  -  <goal name="merlin:tutorials"
  -    description="Build tutorials.">
  -    <maven:reactor
  -      basedir="${basedir}"
  -      includes="platform.xml"
  -      goals="xtutorials"
  -      banner="Building tutorials:"
  -      ignoreFailures="false"/>
  -  </goal>
  -
  -  <goal name="xtutorials">
  -    <ant:mkdir dir="${basedir}/target/tutorials"/>
  -    <ant:copy todir="${basedir}/target/tutorials">
  -      <fileset dir="${basedir}/platform/tutorials">
  -        <include name="README.TXT"/>
  -        <include name="project.xml"/>
  -        <include name="maven.xml"/>
  -        <include name="hello/**"/>
  -        <include name="configuration/**"/>
  -        <include name="context/**"/>
  -        <include name="composition/**"/>
  -        <include name="dependencies/**"/>
  -        <include name="lifecycle/**"/>
  -        <include name="meta/**"/>
  -        <include name="profiles/**"/>
  -        <include name="selection/**"/>
  -        <exclude name="**/target/**"/>
  -        <exclude name="**/*.log"/>
  -      </fileset>
  -    </ant:copy>
  -  </goal>
  -
  -  <goal name="xjavadoc">
  -    <ant:mkdir dir="${maven.build.dir}/docs/api" />
  -    <ant:property name="copyright"
  -      value="Copyright &amp;copy; ${year} ${pom.organization.name}. All Rights 
Reserved." />
  -    <ant:property name="title" value="${pom.name} ${pom.currentVersion} API"/>
  -    <ant:javadoc destdir="${maven.build.dir}/docs/api" 
  -     doctitle="&lt;h1&gt;Merlin Service Management API&lt;/h1&gt;" 
  -      noindex="false" author="true" use="true"
  -     windowtitle="${title}" 
  -      bottom="${copyright}"
  -      additionalparam="-breakiterator -J-Xmx128m "
  -      packagenames="*,org.*">
  -        <j:forEach var="packageGroup" items="${pom.packageGroups}">
  -          <group title="${packageGroup.title}" packages="${packageGroup.packages}"/>
  -        </j:forEach>
  -        <sourcepath path="${basedir}/util/env/src/java"/>
  -        <sourcepath path="${basedir}/util/defaults/src/java"/>
  -        <sourcepath path="${basedir}/repository/spi/src/java"/>
  -        <sourcepath path="${basedir}/repository/impl/src/java"/>
  -        <sourcepath path="${basedir}/extension/spi/src/java"/>
  -        <sourcepath path="${basedir}/extension/impl/src/java"/>
  -        <sourcepath path="${basedir}/composition/api/src/java"/>
  -        <sourcepath path="${basedir}/composition/spi/src/java"/>
  -        <sourcepath path="${basedir}/composition/impl/src/java"/>
  -        <sourcepath path="${basedir}/activation/api/src/java"/>
  -        <sourcepath path="${basedir}/activation/spi/src/java"/>
  -        <sourcepath path="${basedir}/activation/impl/src/java"/>
  -        <sourcepath path="${basedir}/kernel/spi/src/java"/>
  -        <sourcepath path="${basedir}/kernel/impl/src/java"/>
  -        <sourcepath path="${basedir}/kernel/unit/src/java"/>
  -        <classpath>
  -          <path refid="maven.dependency.classpath"/>
  -       </classpath>
  -       <link href="${sun.j2se.link}" />
  -       <link href="${sun.j2ee.link}" />
  -       <link href="${avalon.framework.link}" />
  -       <link href="${avalon.meta.link}" />
  -       <link href="${avalon.logkit.link}" />
  -       <link href="${avalon.lifecycle.link}" />
  -       <link href="${excalibur.configuration.link}" />
  -        <!-- comment out the following until the respective project docs are in 
place -->
  -       <!--<link href="${excalibur.pool.link}" />-->
  -       <!--<link href="${excalibur.thread.link}" />-->
  -       <!--<link href="${excalibur.event.link}" />-->
  -    </ant:javadoc>
  -  </goal>
  -
  -  <!--
  -  ==============================================================================
  -  utilities
  -  ==============================================================================
  -  -->
  -
     <goal name="merlin:clean" prereqs="clean">
       <maven:reactor
         basedir="${basedir}"
         includes="**/project.xml"
  -      excludes="project.xml,kernel/plugin/**/*,merlin-extensions/**"
  +      excludes="project.xml"
         goals="clean:clean"
         banner="Cleaning subproject:"
  -      ignoreFailures="false"/>
  +      ignoreFailures="true"/>
     </goal>
  -
  -  <goal name="merlin-clean" prereqs="merlin:clean"/>
  -  <goal name="merlin-dist" prereqs="merlin:install"/>
  -  <goal name="merlin-site" prereqs="merlin:site"/>
  -  <goal name="merlin-libs" prereqs="merlin:update"/>
  -
  -  <!--
  -  Write a build signature for each package.
  -  -->
  -
  -  <preGoal name="java:compile">
  -
  -    <attainGoal name="avalon:artifact"/>
  -
  -    <ant:echo message="Build: ${snapshotSignature}"/>
  -
  -    <ant:echo file="${maven.build.dir}/classes/jar.properties">
  -#
  -# Artifact build descriptor.
  -# 
  -
  -build.group = ${pom.groupId}
  -build.name = ${pom.artifactId}
  -build.version = ${pom.currentVersion}
  -build.signature = ${snapshotSignature}
  -build.repos = ${maven.repo.remote}
  -
  -</ant:echo>
  -  </preGoal>
   
   </project>
  
  
  
  1.5       +2 -2      avalon-sandbox/kernel/impl/project.xml
  
  Index: project.xml
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/kernel/impl/project.xml,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- project.xml       23 Nov 2003 00:47:06 -0000      1.4
  +++ project.xml       24 Nov 2003 14:57:27 -0000      1.5
  @@ -5,8 +5,8 @@
     <extend>${basedir}/../project.xml</extend>
   
     <groupId>merlin</groupId>
  -  <id>merlin-kernel-impl</id>
  -  <name>Merlin Kernel Implementation</name>
  +  <id>merlin-kernel-test</id>
  +  <name>Merlin Kernel TestCase</name>
     <package>org.apache.avalon.merlin</package>
   
     <currentVersion>3.2.2-dev</currentVersion>
  
  
  
  1.3       +1 -2      
avalon-sandbox/kernel/impl/src/java/org/apache/avalon/merlin/kernel/impl/DefaultCriteria.java
  
  Index: DefaultCriteria.java
  ===================================================================
  RCS file: 
/home/cvs/avalon-sandbox/kernel/impl/src/java/org/apache/avalon/merlin/kernel/impl/DefaultCriteria.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DefaultCriteria.java      24 Nov 2003 08:10:36 -0000      1.2
  +++ DefaultCriteria.java      24 Nov 2003 14:57:27 -0000      1.3
  @@ -52,7 +52,6 @@
   
   import org.apache.avalon.merlin.kernel.KernelCriteria;
   import org.apache.avalon.repository.criteria.Criteria;
  -import org.apache.avalon.repository.criteria.Template;
   import org.apache.avalon.repository.criteria.ValidationException;
   import org.apache.avalon.repository.criteria.Parameter;
   
  
  
  
  1.4       +0 -1      
avalon-sandbox/kernel/impl/src/java/org/apache/avalon/merlin/kernel/impl/DefaultFactory.java
  
  Index: DefaultFactory.java
  ===================================================================
  RCS file: 
/home/cvs/avalon-sandbox/kernel/impl/src/java/org/apache/avalon/merlin/kernel/impl/DefaultFactory.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DefaultFactory.java       24 Nov 2003 08:10:36 -0000      1.3
  +++ DefaultFactory.java       24 Nov 2003 14:57:27 -0000      1.4
  @@ -10,7 +10,6 @@
   import org.apache.avalon.excalibur.i18n.Resources;
   import org.apache.avalon.repository.criteria.Parameter;
   import org.apache.avalon.repository.criteria.Criteria;
  -import org.apache.avalon.repository.criteria.Template;
   import org.apache.avalon.repository.criteria.ValidationException;
   import org.apache.avalon.repository.criteria.Factory;
   
  
  
  
  1.1                  avalon-sandbox/kernel/test/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  maven.log
  velocity.log
  build.properties
  target
  .classpath
  .project
  
  
  1.1                  avalon-sandbox/kernel/test/maven.xml
  
  Index: maven.xml
  ===================================================================
  <project default="test:test" xmlns:maven="jelly:maven" xmlns:j="jelly:core" 
xmlns:util="jelly:util" xmlns:ant="jelly:ant">
  
    <preGoal name="test:test">
      <ant:mkdir dir="${maven.build.dir}/repository"/>
      <copy todir="${maven.build.dir}/repository" preserverlastmodified="true">
        <fileset dir="${maven.repo.local}">
          <include name="avalon-repository/**"/>
          <include name="avalon-util/**"/>
          <include name="merlin/**"/>
        </fileset>
      </copy>
    </preGoal>
  
  </project>
  
  
  
  1.1                  avalon-sandbox/kernel/test/project.xml
  
  Index: project.xml
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  
  <project>
  
    <extend>${basedir}/../project.xml</extend>
  
    <groupId>avalon-repository</groupId>
    <id>avalon-repository-test</id>
    <name>Avalon Repository Test</name>
    <currentVersion>1.2-dev</currentVersion>
  
    <package>org.apache.avalon.repository</package>
  
    <inceptionYear>2002</inceptionYear>
    <shortDescription>Avalon Repository Test</shortDescription>
    
    <dependencies>
      <dependency>
        <groupId>avalon-repository</groupId>
        <artifactId>avalon-repository-main</artifactId>
        <version>1.2-dev</version>
      </dependency>
    </dependencies>
  
    <build>
  
      <sourceDirectory>${basedir}/src/java/</sourceDirectory>
      <unitTestSourceDirectory>${basedir}/src/test/</unitTestSourceDirectory>
  
      <unitTest>
        <includes>
          <include>**/*Test.*</include>
          <include>**/*TestCase.*</include>
        </includes>
        <excludes>
          <exclude>**/Abstract*.*</exclude>
        </excludes>
        <resources>
          <resource>
            <directory>${basedir}/src/test</directory>
            <includes>
              <include>**/*.x*</include>
            </includes>
          </resource>
        </resources>
      </unitTest>
  
      <resources>
        <resource>
          <directory>${basedir}/src/java</directory>
          <includes> 
            <include>**/*.properties</include>
          </includes>
        </resource>
        <resource>
          <directory>${basedir}/target/</directory>
          <includes>
            <include>**/*.app</include>
            <include>*.meta</include>
          </includes>
        </resource>
      </resources>
  
      <jars></jars>
  
    </build>
  </project>
  
  
  
  1.1                  
avalon-sandbox/kernel/test/src/test/org/apache/avalon/merlin/MerlinEmbeddedTest.java
  
  Index: MerlinEmbeddedTest.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
      "Apache Software Foundation"  must not be used to endorse or promote
      products derived  from this  software without  prior written
      permission. For written permission, please contact [EMAIL PROTECTED]
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation. For more  information on the
   Apache Software Foundation, please see <http://www.apache.org/>.
  
  */
  
  package org.apache.avalon.merlin ;
  
  import java.io.File;
  import java.net.URL;
  import javax.naming.directory.Attributes;
  import javax.naming.directory.Attribute;
  
  import junit.framework.TestCase ;
  
  import org.apache.avalon.repository.Artifact ;
  import org.apache.avalon.repository.ClassicArtifact ;
  import org.apache.avalon.repository.Repository ;
  import org.apache.avalon.repository.RepositoryException ;
  import org.apache.avalon.repository.criteria.Criteria ;
  import org.apache.avalon.repository.criteria.Factory ;
  import org.apache.avalon.repository.meta.ApplicationDescriptor ;
  import org.apache.avalon.repository.main.InitialRepositoryFactory ;
  
  /**
   * 
   * 
   * @author <a href="mailto:[EMAIL PROTECTED]">Alex Karasulu</a>
   * @author $Author: mcconnell $
   * @version $Revision: 1.1 $
   */
  public class MerlinEmbeddedTest extends TestCase
  {
      private Repository m_repository;
  
      /**
       * Constructor for InitialRepositoryFactoryTest.
       * @param name the name of the testcase
       */
      public MerlinEmbeddedTest( String name )
      {
          super( name );
      }
  
      protected void setUp() throws Exception
      {
          String[] bootstrap = getBootstrapRepositorySet();
          Factory factory = new InitialRepositoryFactory( bootstrap );
          Criteria criteria = factory.createDefaultCriteria();
          String[] repositories = getWorkingRepositorySet();
          criteria.setValue( "avalon.repository.remote.url", repositories );
          m_repository = (Repository) factory.create( criteria.getMap() ) ;
      }
  
      //----------------------------------------------------------------------
      // tests
      //----------------------------------------------------------------------
  
      public void testEmbeddingScenario() throws Exception
      {
          Artifact spec = ClassicArtifact.createClassicArtifact( "merlin", 
"merlin-kernel-impl" );
          Attributes attributes = m_repository.getArtifactAttributes( spec );
          ApplicationDescriptor target = new ApplicationDescriptor( attributes );
          Artifact implementation = target.getImplementation();
          String classname = target.getFactoryClassname();
  
          //
          // create a classloader using the artifact referenced by the target
          // using the context classloader as the parent
          //
  
          ClassLoader parent = Thread.currentThread().getContextClassLoader();
          ClassLoader loader = m_repository.getClassLoader( parent, implementation );
          Class c = loader.loadClass( target.getFactoryClassname() );
          Factory factory = (Factory) c.newInstance();
          Criteria criteria = factory.createDefaultCriteria();
          assertNotNull( "criteria", criteria );
  
          //
          // populate the criteria with stuff
          //
  
          criteria.setValue( 
            "urn:merlin:base.dir", 
            new File( getBaseDirectory(), "home" ) );
  
          criteria.setValue( 
            "urn:merlin:policy.info", 
            new Boolean( true ) );
  
          criteria.setValue( 
            "urn:merlin:policy.debug", 
            new Boolean( true ) );
  
          criteria.setValue( 
            "urn:merlin:policy.server", 
            new Boolean( false ) );
  
          //
          // instantiate the application
          //
  
          Object app = factory.create( criteria );
          System.out.println( "APP: " + app );
      }
  
      //----------------------------------------------------------------------
      // utilities
      //----------------------------------------------------------------------
  
      private static String[] getBootstrapRepositorySet()
      {
          return new String[]{ 
            "file:///" + System.getProperty( "basedir" ) + "/target/repository",
          };
      }
  
      private static String[] getWorkingRepositorySet()
      {
          return new String[]{ 
            "file:///" + System.getProperty( "basedir" ) + "/target/repository",
            "http://dpml.net/";,
            "http://www.ibiblio.org/maven/";
          };
      }
  
      private File getBaseDirectory()
      {
          String work = System.getProperty( "user.dir" );
          String base = System.getProperty( "basedir", work );
          return new File( base );
      }
  }
  
  
  
  1.1                  
avalon-sandbox/kernel/test/src/test/org/apache/avalon/merlin/SimpleEmbeddingTest.java
  
  Index: SimpleEmbeddingTest.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
      "Apache Software Foundation"  must not be used to endorse or promote
      products derived  from this  software without  prior written
      permission. For written permission, please contact [EMAIL PROTECTED]
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation. For more  information on the
   Apache Software Foundation, please see <http://www.apache.org/>.
  
  */
  
  package org.apache.avalon.merlin ;
  
  import java.io.File;
  import java.net.URL;
  import javax.naming.directory.Attributes;
  import javax.naming.directory.Attribute;
  
  import junit.framework.TestCase ;
  
  import org.apache.avalon.repository.Artifact ;
  import org.apache.avalon.repository.ClassicArtifact ;
  import org.apache.avalon.repository.Repository ;
  import org.apache.avalon.repository.RepositoryException ;
  import org.apache.avalon.repository.criteria.Criteria ;
  import org.apache.avalon.repository.criteria.Factory ;
  import org.apache.avalon.repository.meta.ApplicationDescriptor ;
  import org.apache.avalon.repository.main.InitialRepositoryFactory ;
  
  /**
   * 
   * 
   * @author <a href="mailto:[EMAIL PROTECTED]">Alex Karasulu</a>
   * @author $Author: mcconnell $
   * @version $Revision: 1.1 $
   */
  public class SimpleEmbeddingTest extends TestCase
  {
      private Repository m_repository;
  
      /**
       * Constructor for InitialRepositoryFactoryTest.
       * @param name the test name
       */
      public SimpleEmbeddingTest( String name )
      {
          super( name );
      }
  
      protected void setUp() throws Exception
      {
          String[] bootstrap = getBootstrapRepositorySet();
          Factory factory = new InitialRepositoryFactory( bootstrap );
          Criteria criteria = factory.createDefaultCriteria();
          String[] repositories = getWorkingRepositorySet();
          criteria.setValue( "avalon.repository.remote.url", repositories );
          m_repository = (Repository) factory.create( criteria ) ;
      }
  
      public void testEmbeddedObjectCreation() throws Exception
      {
          Artifact spec = ClassicArtifact.createClassicArtifact( "merlin", 
"merlin-kernel-impl" );
          Attributes attributes = m_repository.getArtifactAttributes( spec );
          ApplicationDescriptor app = new ApplicationDescriptor( attributes );
          Artifact implementation = app.getImplementation();
          String classname = app.getFactoryClassname(); 
  
          //
          // create a classloader based on the artifact
          //
  
          ClassLoader loader = m_repository.getClassLoader( implementation );
  
          //
          // grab a class from the classloader just to show that 
          // everything is working nicely
          //
  
          Class clazz = 
            loader.loadClass( classname );
          assertNotNull( clazz );
      }
  
      private static String[] getBootstrapRepositorySet()
      {
          return new String[]{ 
            "file:///" + System.getProperty( "basedir" ) + "/target/repository",
          };
      }
  
      private static String[] getWorkingRepositorySet()
      {
          return new String[]{ 
            "file:///" + System.getProperty( "basedir" ) + "/target/repository",
            "http://dpml.net/";,
            "http://www.ibiblio.org/maven/";
          };
      }
  }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to