Skip to content

Commit

Permalink
[TEST] - replace a stream from Ant with array-based (caused by eb2906…
Browse files Browse the repository at this point in the history
…1f34263816cf35781cf2d689be6c0bd5ad (Mondrian))
  • Loading branch information
Andrey Khayrutdinov committed Jul 22, 2015
1 parent 34dcb79 commit 016ff8f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions engine/test-src/org/pentaho/di/trans/TransTest.java
Expand Up @@ -28,7 +28,9 @@
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;


import java.io.ByteArrayInputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.util.HashMap; import java.util.HashMap;
Expand All @@ -38,7 +40,6 @@


import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.commons.vfs.FileObject; import org.apache.commons.vfs.FileObject;
import org.apache.tools.ant.filters.StringInputStream;
import org.junit.Before; import org.junit.Before;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;
Expand Down Expand Up @@ -182,9 +183,12 @@ public void testPDI12424ParametersFromMetaAreCopiedToTrans() throws KettleExcept
when( mockTransMeta.getParameterValue( testParam ) ).thenReturn( testParamValue ); when( mockTransMeta.getParameterValue( testParam ) ).thenReturn( testParamValue );
FileObject ktr = KettleVFS.createTempFile( "parameters", ".ktr", "ram://" ); FileObject ktr = KettleVFS.createTempFile( "parameters", ".ktr", "ram://" );
OutputStream outputStream = ktr.getContent().getOutputStream( true ); OutputStream outputStream = ktr.getContent().getOutputStream( true );
StringInputStream stringInputStream = new StringInputStream( "<transformation></transformation>" ); try {
IOUtils.copy( stringInputStream, outputStream ); InputStream inputStream = new ByteArrayInputStream( "<transformation></transformation>".getBytes() );
outputStream.close(); IOUtils.copy( inputStream, outputStream );
} finally {
outputStream.close();
}
Trans trans = new Trans( mockTransMeta, null, null, null, ktr.getURL().toURI().toString() ); Trans trans = new Trans( mockTransMeta, null, null, null, ktr.getURL().toURI().toString() );
assertEquals( testParamValue, trans.getParameterValue( testParam ) ); assertEquals( testParamValue, trans.getParameterValue( testParam ) );
} }
Expand Down

0 comments on commit 016ff8f

Please sign in to comment.