Java Code Examples for org.pentaho.di.core.row.value.ValueMetaString#setStorageMetadata()

The following examples show how to use org.pentaho.di.core.row.value.ValueMetaString#setStorageMetadata() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StreamLookupTest.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
private RowSet mockDataRowSet( boolean binary ) {
  final int storageType = binary ? ValueMetaInterface.STORAGE_TYPE_BINARY_STRING : ValueMetaInterface.STORAGE_TYPE_NORMAL;
  Object[][] data = { { "Name1", "1" }, { "Name2", "2" } };

  if ( binary ) {
    convertDataToBinary( data );
  }

  RowSet dataRowSet = smh.getMockInputRowSet( data );

  RowMeta dataRowMeta = new RowMeta();
  ValueMetaString valueMeta = new ValueMetaString( "Name" );
  valueMeta.setStorageType( storageType );
  valueMeta.setStorageMetadata( new ValueMetaString() );
  dataRowMeta.addValueMeta( valueMeta );
  ValueMetaString idMeta = new ValueMetaString( "Id" );
  idMeta.setStorageType( storageType );
  idMeta.setStorageMetadata( new ValueMetaString() );
  dataRowMeta.addValueMeta( idMeta );

  doReturn( dataRowMeta ).when( dataRowSet ).getRowMeta();

  return dataRowSet;
}
 
Example 2
Source File: StringOperationsTest.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
private RowSet mockInputRowSet() {
  ValueMetaString valueMeta = new ValueMetaString( "Value" );
  valueMeta.setStorageType( ValueMetaInterface.STORAGE_TYPE_BINARY_STRING );
  valueMeta.setStorageMetadata( new ValueMetaString( "Value" ) );

  RowMeta inputRowMeta = new RowMeta();
  inputRowMeta.addValueMeta( valueMeta );

  RowSet inputRowSet = smh.getMockInputRowSet( new Object[][] { { " Value ".getBytes() } } );
  doReturn( inputRowMeta ).when( inputRowSet ).getRowMeta();

  return inputRowSet;
}
 
Example 3
Source File: PDI5436Test.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
private RowMeta mockInputRowMeta() {
  RowMeta inputRowMeta = new RowMeta();
  ValueMetaString nameMeta = new ValueMetaString( "name" );
  nameMeta.setStorageType( ValueMetaInterface.STORAGE_TYPE_BINARY_STRING );
  nameMeta.setStorageMetadata( new ValueMetaString( "name" ) );
  inputRowMeta.addValueMeta( nameMeta );
  ValueMetaString idMeta = new ValueMetaString( "id" );
  idMeta.setStorageType( ValueMetaInterface.STORAGE_TYPE_BINARY_STRING );
  idMeta.setStorageMetadata( new ValueMetaString( "id" ) );
  inputRowMeta.addValueMeta( idMeta );

  return inputRowMeta;
}
 
Example 4
Source File: StreamLookupTest.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
private RowSet mockLookupRowSet( boolean binary ) {
  final int storageType = binary ? ValueMetaInterface.STORAGE_TYPE_BINARY_STRING : ValueMetaInterface.STORAGE_TYPE_NORMAL;
  Object[][] data = { { "Value1", "1" }, { "Value2", "2" } };

  if ( binary ) {
    convertDataToBinary( data );
  }

  RowSet lookupRowSet =
    smh.getMockInputRowSet( data );
  doReturn( "Lookup" ).when( lookupRowSet ).getOriginStepName();
  doReturn( "StreamLookup" ).when( lookupRowSet ).getDestinationStepName();

  RowMeta lookupRowMeta = new RowMeta();
  ValueMetaString valueMeta = new ValueMetaString( "Value" );
  valueMeta.setStorageType( storageType );
  valueMeta.setStorageMetadata( new ValueMetaString() );
  lookupRowMeta.addValueMeta( valueMeta );
  ValueMetaString idMeta = new ValueMetaString( "Id" );
  idMeta.setStorageType( storageType );
  idMeta.setStorageMetadata( new ValueMetaString() );
  lookupRowMeta.addValueMeta( idMeta );

  doReturn( lookupRowMeta ).when( lookupRowSet ).getRowMeta();

  return lookupRowSet;
}