// Path: appassembler-maven-plugin/src/test/java/org/codehaus/mojo/appassembler/daemon/AbstractDaemonGeneratorTest.java
// public abstract class AbstractDaemonGeneratorTest
//     extends PlexusTestCase
// {
//     private static String appassemblerVersion;
// 
//     public void runTest( String generatorId, String pom, String descriptor, String outputPath )
//         throws Exception
//     {
//         File outputDir = getTestFile( outputPath );
// 
//         DaemonGenerator generator = (DaemonGenerator) lookup( DaemonGenerator.ROLE, generatorId );
// 
//         // -----------------------------------------------------------------------
//         // Build the MavenProject instance
//         // -----------------------------------------------------------------------
// 
//         MavenProjectBuilder projectBuilder = (MavenProjectBuilder) lookup( MavenProjectBuilder.ROLE );
// 
//         MavenSettingsBuilder settingsBuilder = (MavenSettingsBuilder) lookup( MavenSettingsBuilder.ROLE );
//         Settings settings = settingsBuilder.buildSettings();
// 
//         ArtifactRepositoryFactory artifactRepositoryFactory =
//             (ArtifactRepositoryFactory) lookup( ArtifactRepositoryFactory.ROLE );
// 
//         String localRepoUrl = new File( settings.getLocalRepository() ).toURL().toExternalForm();
// 
//         ArtifactRepository localRepository =
//             artifactRepositoryFactory.createDeploymentArtifactRepository( "local", localRepoUrl,
//                                                                           new DefaultRepositoryLayout(), false );
// 
//         ProfileManager profileManager = new DefaultProfileManager( getContainer() );
// 
//         File tempPom = createFilteredFile( pom );
// 
//         MavenProject project = projectBuilder.buildWithDependencies( tempPom, localRepository, profileManager );
// 
//         // -----------------------------------------------------------------------
//         // Clean the output directory
//         // -----------------------------------------------------------------------
// 
//         FileUtils.deleteDirectory( outputDir );
//         FileUtils.forceMkdir( outputDir );
// 
//         // -----------------------------------------------------------------------
//         //
//         // -----------------------------------------------------------------------
// 
//         DaemonGeneratorService daemonGeneratorService = (DaemonGeneratorService) lookup( DaemonGeneratorService.ROLE );
// 
//         Daemon model = daemonGeneratorService.loadModel( getTestFile( descriptor ) );
// 
//         generator.generate( new DaemonGenerationRequest( model, project, localRepository, outputDir, "bin" ) );
//     }
// 
//     protected File createFilteredFile( String file )
//         throws IOException, FileNotFoundException, DaemonGeneratorException, XmlPullParserException
//     {
//         String version = getAppAssemblerBooterVersion();
//         Properties context = new Properties();
//         context.setProperty( "appassembler.version", version );
// 
//         File tempPom = File.createTempFile( "appassembler", "tmp" );
//         tempPom.deleteOnExit();
// 
//         InterpolationFilterReader reader =
//             new InterpolationFilterReader( new FileReader( getTestFile( file ) ), context, "@", "@" );
//         FileWriter out = null;
// 
//         try
//         {
//             out = new FileWriter( tempPom );
// 
//             IOUtil.copy( reader, out );
//         }
//         catch ( IOException e )
//         {
//             throw new DaemonGeneratorException( "Error writing output file: " + tempPom.getAbsolutePath(), e );
//         }
//         finally
//         {
//             IOUtil.close( reader );
//             IOUtil.close( out );
//         }
//         return tempPom;
//     }
// 
//     private static String getAppAssemblerBooterVersion()
//         throws IOException, XmlPullParserException
//     {
//         if ( appassemblerVersion == null )
//         {
//             MavenXpp3Reader reader = new MavenXpp3Reader();
//             FileReader fileReader = new FileReader( getTestFile( "pom.xml" ) );
//             try
//             {
//                 appassemblerVersion = reader.read( fileReader ).getParent().getVersion();
//             }
//             finally
//             {
//                 IOUtil.close( fileReader );
//             }
//         }
//         return appassemblerVersion;
//     }
// 
//     protected static String normalizeLineTerminators( String input )
//     {
//         return ( input != null ) ? input.replaceAll( "(\r\n)|(\r)", "\n" ) : null;
//     }
// }
// 
// Path: appassembler-maven-plugin/src/main/java/org/codehaus/mojo/appassembler/daemon/DaemonGeneratorException.java
// public class DaemonGeneratorException
//     extends Exception
// {
//     /**
//      *
//      */
//     private static final long serialVersionUID = 6989317744526360832L;
// 
//     /**
//      * Exception with message.
//      *
//      * @param message The message for the execption.
//      */
//     public DaemonGeneratorException( String message )
//     {
//         super( message );
//     }
// 
//     /**
//      * The exception with an appropriate message and the cause of the failure.
//      *
//      * @param message The message to show.
//      * @param cause The root cause.
//      */
//     public DaemonGeneratorException( String message, Throwable cause )
//     {
//         super( message, cause );
//     }
// }


import java.io.File;
import java.io.IOException;
import org.codehaus.mojo.appassembler.daemon.AbstractDaemonGeneratorTest;
import org.codehaus.mojo.appassembler.daemon.DaemonGeneratorException;
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.StringUtils;
    }

    public void testGenerationWithGoodExternalDeltaPack()
        throws Exception
    {
        runTest( "jsw", "src/test/resources/project-10/pom.xml", "src/test/resources/project-10/descriptor.xml",
                 "target/output-10-jsw" );

        File jswDir = getTestFile( "target/output-10-jsw/app" );

        // just enough to prove we see the external files
        assertFileExists( jswDir, "lib/wrapper.jar" );
        assertFileExists( jswDir, "lib/libwrapper-aix-ppc-32.a" );
        assertFileExists( jswDir, "lib/libwrapper-aix-ppc-64.a" );

        // just enough to prove we see the external files
        assertFileExists( jswDir, "bin/wrapper-aix-ppc-32" );
        assertFileExists( jswDir, "bin/wrapper-aix-ppc-64" );
    }

    public void testGenerationWithBadExternalDeltaPack()
        throws Exception
    {
        try
        {
            runTest( "jsw", "src/test/resources/project-10/pom.xml", "src/test/resources/project-11/descriptor.xml",
                     "target/output-11-jsw" );

            fail( "Invalid external delta pack passed thru!!." );
        }
// Path: appassembler-maven-plugin/src/test/java/org/codehaus/mojo/appassembler/daemon/AbstractDaemonGeneratorTest.java
// public abstract class AbstractDaemonGeneratorTest
//     extends PlexusTestCase
// {
//     private static String appassemblerVersion;
// 
//     public void runTest( String generatorId, String pom, String descriptor, String outputPath )
//         throws Exception
//     {
//         File outputDir = getTestFile( outputPath );
// 
//         DaemonGenerator generator = (DaemonGenerator) lookup( DaemonGenerator.ROLE, generatorId );
// 
//         // -----------------------------------------------------------------------
//         // Build the MavenProject instance
//         // -----------------------------------------------------------------------
// 
//         MavenProjectBuilder projectBuilder = (MavenProjectBuilder) lookup( MavenProjectBuilder.ROLE );
// 
//         MavenSettingsBuilder settingsBuilder = (MavenSettingsBuilder) lookup( MavenSettingsBuilder.ROLE );
//         Settings settings = settingsBuilder.buildSettings();
// 
//         ArtifactRepositoryFactory artifactRepositoryFactory =
//             (ArtifactRepositoryFactory) lookup( ArtifactRepositoryFactory.ROLE );
// 
//         String localRepoUrl = new File( settings.getLocalRepository() ).toURL().toExternalForm();
// 
//         ArtifactRepository localRepository =
//             artifactRepositoryFactory.createDeploymentArtifactRepository( "local", localRepoUrl,
//                                                                           new DefaultRepositoryLayout(), false );
// 
//         ProfileManager profileManager = new DefaultProfileManager( getContainer() );
// 
//         File tempPom = createFilteredFile( pom );
// 
//         MavenProject project = projectBuilder.buildWithDependencies( tempPom, localRepository, profileManager );
// 
//         // -----------------------------------------------------------------------
//         // Clean the output directory
//         // -----------------------------------------------------------------------
// 
//         FileUtils.deleteDirectory( outputDir );
//         FileUtils.forceMkdir( outputDir );
// 
//         // -----------------------------------------------------------------------
//         //
//         // -----------------------------------------------------------------------
// 
//         DaemonGeneratorService daemonGeneratorService = (DaemonGeneratorService) lookup( DaemonGeneratorService.ROLE );
// 
//         Daemon model = daemonGeneratorService.loadModel( getTestFile( descriptor ) );
// 
//         generator.generate( new DaemonGenerationRequest( model, project, localRepository, outputDir, "bin" ) );
//     }
// 
//     protected File createFilteredFile( String file )
//         throws IOException, FileNotFoundException, DaemonGeneratorException, XmlPullParserException
//     {
//         String version = getAppAssemblerBooterVersion();
//         Properties context = new Properties();
//         context.setProperty( "appassembler.version", version );
// 
//         File tempPom = File.createTempFile( "appassembler", "tmp" );
//         tempPom.deleteOnExit();
// 
//         InterpolationFilterReader reader =
//             new InterpolationFilterReader( new FileReader( getTestFile( file ) ), context, "@", "@" );
//         FileWriter out = null;
// 
//         try
//         {
//             out = new FileWriter( tempPom );
// 
//             IOUtil.copy( reader, out );
//         }
//         catch ( IOException e )
//         {
//             throw new DaemonGeneratorException( "Error writing output file: " + tempPom.getAbsolutePath(), e );
//         }
//         finally
//         {
//             IOUtil.close( reader );
//             IOUtil.close( out );
//         }
//         return tempPom;
//     }
// 
//     private static String getAppAssemblerBooterVersion()
//         throws IOException, XmlPullParserException
//     {
//         if ( appassemblerVersion == null )
//         {
//             MavenXpp3Reader reader = new MavenXpp3Reader();
//             FileReader fileReader = new FileReader( getTestFile( "pom.xml" ) );
//             try
//             {
//                 appassemblerVersion = reader.read( fileReader ).getParent().getVersion();
//             }
//             finally
//             {
//                 IOUtil.close( fileReader );
//             }
//         }
//         return appassemblerVersion;
//     }
// 
//     protected static String normalizeLineTerminators( String input )
//     {
//         return ( input != null ) ? input.replaceAll( "(\r\n)|(\r)", "\n" ) : null;
//     }
// }
// 
// Path: appassembler-maven-plugin/src/main/java/org/codehaus/mojo/appassembler/daemon/DaemonGeneratorException.java
// public class DaemonGeneratorException
//     extends Exception
// {
//     /**
//      *
//      */
//     private static final long serialVersionUID = 6989317744526360832L;
// 
//     /**
//      * Exception with message.
//      *
//      * @param message The message for the execption.
//      */
//     public DaemonGeneratorException( String message )
//     {
//         super( message );
//     }
// 
//     /**
//      * The exception with an appropriate message and the cause of the failure.
//      *
//      * @param message The message to show.
//      * @param cause The root cause.
//      */
//     public DaemonGeneratorException( String message, Throwable cause )
//     {
//         super( message, cause );
//     }
// }


// Path: appassembler-maven-plugin/src/test/java/org/codehaus/mojo/appassembler/daemon/jsw/JavaServiceWrapperDaemonGeneratorTest.java
import java.io.File;
import java.io.IOException;
import org.codehaus.mojo.appassembler.daemon.AbstractDaemonGeneratorTest;
import org.codehaus.mojo.appassembler.daemon.DaemonGeneratorException;
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.StringUtils;

    }

    public void testGenerationWithGoodExternalDeltaPack()
        throws Exception
    {
        runTest( "jsw", "src/test/resources/project-10/pom.xml", "src/test/resources/project-10/descriptor.xml",
                 "target/output-10-jsw" );

        File jswDir = getTestFile( "target/output-10-jsw/app" );

        // just enough to prove we see the external files
        assertFileExists( jswDir, "lib/wrapper.jar" );
        assertFileExists( jswDir, "lib/libwrapper-aix-ppc-32.a" );
        assertFileExists( jswDir, "lib/libwrapper-aix-ppc-64.a" );

        // just enough to prove we see the external files
        assertFileExists( jswDir, "bin/wrapper-aix-ppc-32" );
        assertFileExists( jswDir, "bin/wrapper-aix-ppc-64" );
    }

    public void testGenerationWithBadExternalDeltaPack()
        throws Exception
    {
        try
        {
            runTest( "jsw", "src/test/resources/project-10/pom.xml", "src/test/resources/project-11/descriptor.xml",
                     "target/output-11-jsw" );

            fail( "Invalid external delta pack passed thru!!." );
        }
        catch ( DaemonGeneratorException e )