Examples of StringOutputStream


Examples of org.codehaus.plexus.util.StringOutputStream

        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

Examples of org.codehaus.plexus.util.StringOutputStream

        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

Examples of org.codehaus.plexus.util.StringOutputStream

        server.start();

        wagon.connect(
            new Repository( "id", getProtocol() + "://localhost:" + server.getConnectors()[0].getLocalPort() ) );

        wagon.getToStream( "resource", new StringOutputStream() );

        wagon.disconnect();

        server.stop();
View Full Code Here

Examples of org.codehaus.plexus.util.StringOutputStream

        server.start();

        wagon.connect(
            new Repository( "id", getProtocol() + "://localhost:" + server.getConnectors()[0].getLocalPort() ) );

        wagon.getToStream( "resource", new StringOutputStream() );

        wagon.disconnect();

        server.stop();
View Full Code Here

Examples of org.codehaus.plexus.util.StringOutputStream

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

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

Examples of org.codehaus.plexus.util.StringOutputStream

            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

Examples of org.codehaus.plexus.util.StringOutputStream

            File sourceFile = new File( localRepositoryPath, "test-secured-resource" );
            FileUtils.fileWrite( sourceFile.getAbsolutePath(), "top secret" );

            wagon.connect( testRepository, authInfo );

            StringOutputStream out = new StringOutputStream();
            try
            {
                wagon.getToStream( "test-secured-resource", out );
            }
            finally
            {
                wagon.disconnect();
            }

            assertEquals( "top secret", out.toString() );
        }
        finally
        {
            server.stop();
        }
View Full Code Here

Examples of org.codehaus.plexus.util.StringOutputStream

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

Examples of org.codehaus.plexus.util.StringOutputStream

        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

Examples of org.codehaus.plexus.util.StringOutputStream

        server.start();

        wagon.connect(
            new Repository( "id", getProtocol() + "://localhost:" + server.getConnectors()[0].getLocalPort() ) );

        wagon.getToStream( "resource", new StringOutputStream() );

        wagon.disconnect();

        server.stop();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.