Package org.codehaus.plexus.util

Examples of org.codehaus.plexus.util.StringOutputStream


        };

        wagon.connect( repository );
        try
        {
            StringOutputStream out = new StringOutputStream();
            wagon.getToStream( "resource", out );
            assertEquals( content, out.toString() );
        }
        finally
        {
            wagon.disconnect();
        }
View Full Code Here


        };

        wagon.connect( repository );
        try
        {
            return wagon.getIfNewerToStream( "resource", new StringOutputStream(), comparisonTime );
        }
        finally
        {
            wagon.disconnect();
        }
View Full Code Here

    public void testPutFromStream()
        throws Exception
    {
        final String content = "the content to return";

        final StringOutputStream out = new StringOutputStream();
        StreamingWagon wagon = new TestWagon()
        {
            public void fillOutputData( OutputData outputData )
            {
                assertEquals( "resource", outputData.getResource().getName() );
                assertEquals( -1, outputData.getResource().getContentLength() );
                assertEquals( 0, outputData.getResource().getLastModified() );
                outputData.setOutputStream( out );
            }
        };

        wagon.connect( repository );
        try
        {
            wagon.putFromStream( new StringInputStream( content ), "resource" );
            assertEquals( content, out.toString() );
        }
        finally
        {
            wagon.disconnect();
        }
View Full Code Here

        throws Exception
    {
        final String content = "the content to return";
        final long lastModified = System.currentTimeMillis();

        final StringOutputStream out = new StringOutputStream();
        StreamingWagon wagon = new TestWagon()
        {
            public void fillOutputData( OutputData outputData )
            {
                assertEquals( "resource", outputData.getResource().getName() );
                assertEquals( content.length(), outputData.getResource().getContentLength() );
                assertEquals( lastModified, outputData.getResource().getLastModified() );
                outputData.setOutputStream( out );
            }
        };

        wagon.connect( repository );
        try
        {
            wagon.putFromStream( new StringInputStream( content ), "resource", content.length(), lastModified );
            assertEquals( content, out.toString() );
        }
        finally
        {
            wagon.disconnect();
        }
View Full Code Here

        final File tempFile = File.createTempFile( "wagon", "tmp" );
        FileUtils.fileWrite( tempFile.getAbsolutePath(), content );
        tempFile.deleteOnExit();

        final StringOutputStream out = new StringOutputStream();
        Wagon wagon = new TestWagon()
        {
            public void fillOutputData( OutputData outputData )
            {
                assertEquals( "resource", outputData.getResource().getName() );
                assertEquals( content.length(), outputData.getResource().getContentLength() );
                assertEquals( tempFile.lastModified(), outputData.getResource().getLastModified() );
                outputData.setOutputStream( out );
            }
        };

        wagon.connect( repository );
        try
        {
            wagon.put( tempFile, "resource" );
            assertEquals( content, out.toString() );
        }
        finally
        {
            wagon.disconnect();
            tempFile.delete();
View Full Code Here

    public StreamKnownHostsProvider( InputStream stream )
        throws IOException
    {
        try
        {
            StringOutputStream stringOutputStream = new StringOutputStream();
            IOUtil.copy( stream, stringOutputStream );
            this.contents = stringOutputStream.toString();
           
            this.knownHosts = this.loadKnownHosts( this.contents );
        }
        finally
        {
View Full Code Here

        ClassWorld classWorld = new ClassWorld();

        PrintStream oldErr = System.err;
        PrintStream oldOut = System.out;

        OutputStream errOS = new StringOutputStream();
        PrintStream err = new PrintStream( errOS );
        System.setErr( err );
        OutputStream outOS = new StringOutputStream();
        PrintStream out = new PrintStream( outOS );
        System.setOut( out );

        try
        {
View Full Code Here

    }

    public void fillOutputData( OutputData outputData )
        throws TransferFailedException
    {
        outputData.setOutputStream( new StringOutputStream() );
    }
View Full Code Here

        wagon.connect( new Repository( "id", getRepositoryUrl( server ) ) );

        try
        {
            wagon.getToStream( "resource", new StringOutputStream() );
            fail();
        }
        finally
        {
            wagon.disconnect();
View Full Code Here

            File sourceFile = new File( localRepositoryPath, "test-proxied-resource" );
            FileUtils.fileWrite( sourceFile.getAbsolutePath(), "content" );

            wagon.connect( testRepository, proxyInfo );

            StringOutputStream out = new StringOutputStream();
            try
            {
                wagon.getToStream( "test-proxied-resource", out );

                assertTrue( handler.headers.containsKey( "Proxy-Connection" ) );
View Full Code Here

TOP

Related Classes of org.codehaus.plexus.util.StringOutputStream

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.