Package org.codehaus.plexus.archiver.manager

Examples of org.codehaus.plexus.archiver.manager.ArchiverManager


            protected Embedder newEmbedder() {
                return new Embedder();
            }

        };
        ArchiverManager archiveManager = mock(ArchiverManager.class);
        MavenProject project = mock(MavenProject.class);

        File coreFile = new File("core");
        Artifact coreResources = mock(Artifact.class);
        when(coreResources.getArtifactId()).thenReturn("jbehave-core");
        when(coreResources.getType()).thenReturn("zip");
        when(coreResources.getFile()).thenReturn(coreFile);
        File siteFile = new File("site");
        Artifact siteResources = mock(Artifact.class);
        when(siteResources.getArtifactId()).thenReturn("jbehave-site-resources");
        when(siteResources.getType()).thenReturn("zip");
        when(siteResources.getFile()).thenReturn(siteFile);

        Set<Artifact> allArtifacts = new HashSet<Artifact>();
        allArtifacts.add(coreResources);
        allArtifacts.add(siteResources);

        String buildDirectory = "target";
        Build build = new Build();
        build.setDirectory(buildDirectory);

        UnArchiver coreArchiver = mock(UnArchiver.class);
        UnArchiver siteArchiver = mock(UnArchiver.class);

        // When
        mojo.project = project;
        mojo.archiverManager = archiveManager;
        mojo.resourceIncludes = "ftl/*";
        mojo.resourcesExcludes = "com/*";
        when(project.getArtifacts()).thenReturn(allArtifacts);
        when(project.getBuild()).thenReturn(build);
        when(archiveManager.getUnArchiver(coreFile)).thenReturn(coreArchiver);
        when(archiveManager.getUnArchiver(siteFile)).thenReturn(siteArchiver);

        unpackTo(mojo, null); // default view directory
        unpackTo(mojo, new File(System.getProperty("java.io.tmpdir")+"/jbehave/view"));

        // Then
View Full Code Here


            protected Embedder newEmbedder() {
                return new Embedder();
            }

        };
        ArchiverManager archiveManager = mock(ArchiverManager.class);
        MavenProject project = mock(MavenProject.class);

        File resourcesFile = new File("some");
        Artifact someResources = mock(Artifact.class);
        when(someResources.getArtifactId()).thenReturn("some-resources");
View Full Code Here

            protected Embedder newEmbedder() {
                return new Embedder();
            }

        };
        ArchiverManager archiveManager = mock(ArchiverManager.class);
        MavenProject project = mock(MavenProject.class);

        File coreFile = new File("core");
        Artifact coreResources = mock(Artifact.class);
        when(coreResources.getArtifactId()).thenReturn("jbehave-core");
        when(coreResources.getType()).thenReturn("zip");
        when(coreResources.getFile()).thenReturn(coreFile);
        File siteFile = new File("site");
        Artifact siteResources = mock(Artifact.class);
        when(siteResources.getArtifactId()).thenReturn("jbehave-site-resources");
        when(siteResources.getType()).thenReturn("zip");
        when(siteResources.getFile()).thenReturn(siteFile);

        Set<Artifact> allArtifacts = new HashSet<Artifact>();
        allArtifacts.add(coreResources);
        allArtifacts.add(siteResources);

        String buildDirectory = "target";
        Build build = new Build();
        build.setDirectory(buildDirectory);

        UnArchiver coreArchiver = mock(UnArchiver.class);
        UnArchiver siteArchiver = mock(UnArchiver.class);

        // When
        mojo.project = project;
        mojo.archiverManager = archiveManager;
        when(project.getArtifacts()).thenReturn(allArtifacts);
        when(project.getBuild()).thenReturn(build);
        when(archiveManager.getUnArchiver(coreFile)).thenReturn(coreArchiver);
        when(archiveManager.getUnArchiver(siteFile)).thenReturn(siteArchiver);
        Mockito.doThrow(new ArchiverException("bum")).when(siteArchiver).extract();

        mojo.execute();

        // Then
View Full Code Here

        UnArchiver unarchiver = (UnArchiver) unarchiverCtl.getMock();

        MockControl archiverManagerCtl = MockControl.createControl( ArchiverManager.class );
        mockManager.add( archiverManagerCtl );

        ArchiverManager archiverManager = (ArchiverManager) archiverManagerCtl.getMock();

        try
        {
            archiverManager.getUnArchiver( source );
            archiverManagerCtl.setReturnValue( unarchiver );
        }
        catch ( NoSuchArchiverException e )
        {
            fail( "Should never happen." );
View Full Code Here

        String type = artifact.getType();

        ArtifactRepository localRepo = createLocalRepository();
        MavenProjectBuilder projectBuilder = createProjectBuilder( typeList.indexOf( type ) > -1, installAsJar );
        ArchiverManager archiverManager = createArchiverManager( typeList.indexOf( type ) > -1, installAsJar );
        InputHandler inputHandler = createInputHandler();

        Log log = new SystemStreamLog();

        mm.replayAll();
View Full Code Here

    {
        MockControl control = MockControl.createControl( ArchiverManager.class );

        mm.add( control );

        ArchiverManager manager = (ArchiverManager) control.getMock();

        if ( isReachable && installAsJar == Boolean.FALSE )
        {
            try
            {
                manager.getUnArchiver( (File) null );
                control.setMatcher( MockControl.ALWAYS_MATCHER );
                ZipUnArchiver zipUnArchiver = new ZipUnArchiver();
                zipUnArchiver.enableLogging( new ConsoleLogger( org.codehaus.plexus.logging.Logger.LEVEL_INFO,
                                                                "console" ) );
                control.setReturnValue( zipUnArchiver, MockControl.ONE_OR_MORE );
View Full Code Here

        UnArchiver unarchiver = (UnArchiver) unarchiverCtl.getMock();

        MockControl archiverManagerCtl = MockControl.createControl( ArchiverManager.class );
        mockManager.add( archiverManagerCtl );

        ArchiverManager archiverManager = (ArchiverManager) archiverManagerCtl.getMock();

        try
        {
            archiverManager.getUnArchiver( source );
            archiverManagerCtl.setReturnValue( unarchiver );
        }
        catch ( NoSuchArchiverException e )
        {
            fail( "Should never happen." );
View Full Code Here

        UnArchiver unarchiver = (UnArchiver) unarchiverCtl.getMock();

        MockControl archiverManagerCtl = MockControl.createControl( ArchiverManager.class );
        mockManager.add( archiverManagerCtl );

        ArchiverManager archiverManager = (ArchiverManager) archiverManagerCtl.getMock();

        try
        {
            archiverManager.getUnArchiver( source );
            archiverManagerCtl.setReturnValue( unarchiver );
        }
        catch ( NoSuchArchiverException e )
        {
            fail( "Should never happen." );
View Full Code Here

        String type = artifact.getType();

        ArtifactRepository localRepo = createLocalRepository();
        MavenProjectBuilder projectBuilder = createProjectBuilder(typeList.contains(type), installAsJar );
        ArchiverManager archiverManager = createArchiverManager(typeList.contains(type), installAsJar );
        InputHandler inputHandler = createInputHandler();

        Log log = new SystemStreamLog();

        mm.replayAll();
View Full Code Here

    {
        MockControl control = MockControl.createControl( ArchiverManager.class );

        mm.add( control );

        ArchiverManager manager = (ArchiverManager) control.getMock();

        if ( isReachable && installAsJar == Boolean.FALSE )
        {
            try
            {
                manager.getUnArchiver( (File) null );
                control.setMatcher( MockControl.ALWAYS_MATCHER );
                ZipUnArchiver zipUnArchiver = new ZipUnArchiver();
                zipUnArchiver.enableLogging( new ConsoleLogger( org.codehaus.plexus.logging.Logger.LEVEL_INFO,
                                                                "console" ) );
                control.setReturnValue( zipUnArchiver, MockControl.ONE_OR_MORE );
View Full Code Here

TOP

Related Classes of org.codehaus.plexus.archiver.manager.ArchiverManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.