public ValueMapperData() { super(); hashtable = null; stringMeta = new ValueMetaString( "string" ); }
/** * Creates a rowMeta for output field names */ RowMetaInterface getRowMeta() { RowMeta rowMeta = new RowMeta(); rowMeta.addValueMeta( new ValueMetaString( messageField ) ); rowMeta.addValueMeta( new ValueMetaString( destinationField ) ); return rowMeta; } }
public RowMetaAndData fillTableRow( IUser userInfo ) { RowMetaAndData r = new RowMetaAndData(); r.addValue( new ValueMetaInteger( "ID_USER" ), userInfo.getObjectId() ); r.addValue( new ValueMetaString( "LOGIN" ), userInfo.getLogin() ); r.addValue( new ValueMetaString( "PASSWORD" ), Encr.encryptPassword( userInfo .getPassword() ) ); r.addValue( new ValueMetaString( "NAME" ), userInfo.getUsername() ); r.addValue( new ValueMetaString( "DESCRIPTION" ), userInfo.getDescription() ); r.addValue( new ValueMetaBoolean( "ENABLED" ), Boolean.valueOf( userInfo.isEnabled() ) ); return r; }
@Override public void getFields( RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { // Output fields (String) if ( !Utils.isEmpty( resultfieldname ) ) { ValueMetaInterface v = new ValueMetaString( space.environmentSubstitute( resultfieldname ) ); v.setOrigin( name ); inputRowMeta.addValueMeta( v ); } }
@Test public void loadFileContentInBinary() throws Exception { String path = getClass().getResource( "txt-sample.txt" ).getPath(); byte[] content = ValueDataUtil.loadFileContentInBinary( new ValueMetaString(), path, true ); assertTrue( Arrays.equals( "test".getBytes(), content ) ); }
@Test public void checksumWithoutFailIfNoFileTest() throws Exception { String path = getClass().getResource( "txt-sample.txt" ).getPath(); String checksum = ValueDataUtil.createChecksum( new ValueMetaString(), path, "MD5", false ); assertEquals( "098f6bcd4621d373cade4e832627b4f6", checksum ); }
@Test public void checksumCRC32Test() { String path = getClass().getResource( "txt-sample.txt" ).getPath(); long checksum = ValueDataUtil.ChecksumCRC32( new ValueMetaString(), path ); assertEquals( 3632233996l, checksum ); }
@Test public void xmlFileWellFormedTest() { String xmlFilePath = getClass().getResource( "xml-sample.xml" ).getPath(); boolean wellFormed = ValueDataUtil.isXMLFileWellFormed( new ValueMetaString(), xmlFilePath ); assertTrue( wellFormed ); }
@Test public void checksumAdlerWithFailIfNoFileTest() throws Exception { String path = getClass().getResource( "txt-sample.txt" ).getPath(); long checksum = ValueDataUtil.checksumAdler32( new ValueMetaString(), path, true ); assertEquals( 73204161L, checksum ); }
@Test public void getFileEncodingWithoutFailIfNoFileTest() throws Exception { String path = getClass().getResource( "txt-sample.txt" ).getPath(); String encoding = ValueDataUtil.getFileEncoding( new ValueMetaString(), path, false ); assertEquals( "US-ASCII", encoding ); }
public RowMetaInterface getRowWithoutValues() { RowMetaInterface f = new RowMeta(); f.addValueMeta( new ValueMetaInteger( "#" ) ); for ( int i = 0; i < columns.length; i++ ) { f.addValueMeta( new ValueMetaString( columns[i].getName() ) ); } return f; }
private RowMetaAndData constructRowMetaAndData( Object... data ) { RowMeta meta = new RowMeta(); meta.addValueMeta( new ValueMetaString( "filePath" ) ); meta.addValueMeta( new ValueMetaString( "wildcard" ) ); return new RowMetaAndData( meta, data ); }
@Test public void xmlFileWellFormedNullPathFailTest() throws KettleFileNotFoundException { boolean wellFormed = ValueDataUtil.isXMLFileWellFormed( new ValueMetaString(), null, true ); assertFalse( wellFormed ); }
@Test public void loadFileContentInBinaryNoFailIfNoFileTest() throws Exception { String nonExistingPath = "nonExistingPath"; assertNull( ValueDataUtil.loadFileContentInBinary( new ValueMetaString(), nonExistingPath, false ) ); }
@Test public void checksumNullPathTest() { String nonExistingFile = "nonExistingFile"; String checksum = ValueDataUtil.createChecksum( new ValueMetaString(), nonExistingFile, "MD5" ); assertNull( checksum ); }
@Test public void checksumCRC32NullPathFailTest() throws KettleFileNotFoundException { long checksum = ValueDataUtil.checksumCRC32( new ValueMetaString(), null, true ); assertEquals( 0, checksum ); }
@Test public void checksumAdlerMissingFileTest() { String nonExistingFile = "nonExistingFile"; long checksum = ValueDataUtil.ChecksumAdler32( new ValueMetaString(), nonExistingFile ); assertEquals( 0, checksum ); }
@Test public void getFileEncodingNullPathFailTest() throws KettleFileNotFoundException, KettleValueException { String encoding = ValueDataUtil.getFileEncoding( new ValueMetaString(), null, true ); assertNull( encoding ); }
protected RowMetaInterface generateRowMeta10MixedTypes() { RowMeta output = new RowMeta(); for ( int i = 0; i < 10; i++ ) { if ( i < 5 ) { output.addValueMeta( new ValueMetaString( "row_" + ( i + 1 ) ) ); } else { output.addValueMeta( new ValueMetaInteger( "row_" + ( i + 1 ) ) ); } } return output; }
@Test public void assertNumeric_StringWithDigits() throws Exception { ValueMetaString metaString = new ValueMetaString( "string-with-digits" ); assertNull( "Strings with digits are allowed", validator.assertNumeric( metaString, "123", new Validation() ) ); }