• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java SingleRowRowSet类的典型用法和代码示例

java 2次浏览

本文整理汇总了Java中org.pentaho.di.core.SingleRowRowSet的典型用法代码示例。如果您正苦于以下问题:Java SingleRowRowSet类的具体用法?Java SingleRowRowSet怎么用?Java SingleRowRowSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

SingleRowRowSet类属于org.pentaho.di.core包,在下文中一共展示了SingleRowRowSet类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: testProcessRow

点赞 3

import org.pentaho.di.core.SingleRowRowSet; //导入依赖的package包/类
/**
 * [PDI-9088] Prioritize streams step causing null pointer exception downstream 
 * @throws KettleException
 */
@Test
public void testProcessRow() throws KettleException {
  PrioritizeStreamsMeta meta = new PrioritizeStreamsMeta();
  meta.setStepName( new String[] { "high", "medium", "low" } );
  PrioritizeStreamsData data = new PrioritizeStreamsData();

  PrioritizeStreamsInner step = new PrioritizeStreamsInner( stepMockHelper );
  try {
    step.processRow( meta, data );
  } catch ( NullPointerException e ) {
    fail( "NullPointerException detecded, seems that RowMetaInterface was not set for RowSet you are attempting"
        + "to read from." );
  }

  Assert.assertTrue( "First waiting for row set is 'high'", data.currentRowSet.getClass().equals(
      SingleRowRowSet.class ) );
}
 

开发者ID:pentaho,
项目名称:pentaho-kettle,
代码行数:22,
代码来源:PrioritizeStreamsTest.java

示例2: testSplitFieldsDup

点赞 2

import org.pentaho.di.core.SingleRowRowSet; //导入依赖的package包/类
@Test
public void testSplitFieldsDup() throws Exception {
  FieldSplitterMeta meta = new FieldSplitterMeta();
  meta.allocate( 2 );
  meta.setDelimiter( " " );
  meta.setEnclosure( "" );
  meta.setSplitField( "split" );
  meta.setFieldName( new String[] { "key", "val" } );
  meta.setFieldType( new int[] { ValueMetaInterface.TYPE_STRING, ValueMetaInterface.TYPE_STRING } );

  FieldSplitter step = new FieldSplitter( smh.stepMeta, smh.stepDataInterface, 0, smh.transMeta, smh.trans );
  step.init( meta, smh.stepDataInterface );

  RowMetaInterface rowMeta = new RowMeta();
  rowMeta.addValueMeta( new ValueMetaString( "key" ) );
  rowMeta.addValueMeta( new ValueMetaString( "val" ) );
  rowMeta.addValueMeta( new ValueMetaString( "split" ) );

  step.setInputRowMeta( rowMeta );
  step.getInputRowSets().add( smh.getMockInputRowSet( new Object[] { "key", "string", "part1 part2" } ) );
  step.getOutputRowSets().add( new SingleRowRowSet() );

  assertTrue( step.processRow( meta, smh.stepDataInterface ) );

  RowSet rs = step.getOutputRowSets().get( 0 );
  Object[] row = rs.getRow();
  RowMetaInterface rm = rs.getRowMeta();

  assertArrayEquals(
      new Object[] { "key", "string", "part1", "part2" },
      Arrays.copyOf( row, 4 ) );

  assertArrayEquals(
      new Object[] { "key", "val", "key_1", "val_1" },
      rm.getFieldNames() );
}
 

开发者ID:pentaho,
项目名称:pentaho-kettle,
代码行数:37,
代码来源:FieldSplitterTest.java

示例3: findInputRowSet

点赞 2

import org.pentaho.di.core.SingleRowRowSet; //导入依赖的package包/类
@Override
public RowSet findInputRowSet( String sourceStep ) throws KettleStepException {
  if ( sourceStep.equals( "high" ) ) {
    return new SingleRowRowSet();
  }
  return new QueueRowSet();
}
 

开发者ID:pentaho,
项目名称:pentaho-kettle,
代码行数:8,
代码来源:PrioritizeStreamsTest.java

示例4: outputRowMetasAreNotSharedAmongSeveralStreams

点赞 2

import org.pentaho.di.core.SingleRowRowSet; //导入依赖的package包/类
@Test
public void outputRowMetasAreNotSharedAmongSeveralStreams() throws Exception {
  RowSet rs1 = new SingleRowRowSet();
  RowSet rs2 = new SingleRowRowSet();

  when( mockHelper.trans.isRunning() ).thenReturn( true );
  BaseStep baseStep =
    new BaseStep( mockHelper.stepMeta, mockHelper.stepDataInterface, 0, mockHelper.transMeta, mockHelper.trans );
  baseStep.setStopped( false );
  baseStep.setRepartitioning( StepPartitioningMeta.PARTITIONING_METHOD_NONE );
  baseStep.setOutputRowSets( Arrays.asList( rs1, rs2 ) );

  for ( RowSet rowSet : baseStep.getOutputRowSets() ) {
    assertNull( "RowMeta should be null, since no calls were done", rowSet.getRowMeta() );
  }

  RowMetaInterface rowMeta = new RowMeta();
  rowMeta.addValueMeta( new ValueMetaString( "string" ) );
  rowMeta.addValueMeta( new ValueMetaInteger( "integer" ) );

  baseStep.putRow( rowMeta, new Object[] { "a", 1 } );

  RowMetaInterface meta1 = rs1.getRowMeta();
  RowMetaInterface meta2 = rs2.getRowMeta();
  assertNotNull( meta1 );
  assertNotNull( meta2 );
  // content is same
  for ( ValueMetaInterface meta : meta1.getValueMetaList() ) {
    assertTrue( meta.getName(), meta2.exists( meta ) );
  }
  // whereas instances differ
  assertFalse( meta1 == meta2 );
}
 

开发者ID:pentaho,
项目名称:pentaho-kettle,
代码行数:34,
代码来源:BaseStepTest.java

示例5: testCorrectFileSelected

点赞 2

import org.pentaho.di.core.SingleRowRowSet; //导入依赖的package包/类
private void testCorrectFileSelected( String filenameParam, int xmlTagsStartPosition ) throws KettleException {
  xmlInputStreamMeta.sourceFromInput = false;
  xmlInputStreamMeta.setFilename( filenameParam );
  xmlInputStreamData.outputRowMeta = new RowMeta();

  RowMeta rm = new RowMeta();
  String pathValue = getFile( "default.xml" );
  ValueMetaString ms = new ValueMetaString( "filename" );
  RowSet rs = new SingleRowRowSet();
  rs.putRow( rm, new Object[] { pathValue } );
  rs.setDone();

  when( stepMockHelper.transMeta.findNrPrevSteps( stepMockHelper.stepMeta ) ).thenReturn( 1 );

  XMLInputStream xmlInputStream =
          new XMLInputStream( stepMockHelper.stepMeta, stepMockHelper.stepDataInterface, 0, stepMockHelper.transMeta,
                  stepMockHelper.trans );
  xmlInputStream.setInputRowMeta( rm );
  xmlInputStream.getInputRowMeta().addValueMeta( ms );
  xmlInputStream.getInputRowSets().add( rs );
  xmlInputStream.setOutputRowSets( new ArrayList<>() );

  xmlInputStream.init( xmlInputStreamMeta, xmlInputStreamData );
  xmlInputStream.addRowListener( rl );
  boolean haveRowsToRead;
  do {
    haveRowsToRead = !xmlInputStream.processRow( xmlInputStreamMeta, xmlInputStreamData );
  } while ( !haveRowsToRead );
  assertEquals( INCORRECT_XML_DATA_TYPE_DESCRIPTION_MESSAGE, "START_ELEMENT", rl.getWritten().get(
      1 )[xmlTagsStartPosition] );
}
 

开发者ID:pentaho,
项目名称:pentaho-kettle,
代码行数:32,
代码来源:XMLInputStreamTest.java

示例6: getEmptyResponse

点赞 2

import org.pentaho.di.core.SingleRowRowSet; //导入依赖的package包/类
private RowSet getEmptyResponse() {
  RowSet nullInputResponse = new SingleRowRowSet();
  nullInputResponse.putRow( null, new Object[ fields.length ] );
  nullInputResponse.setDone();
  return nullInputResponse;
}
 

开发者ID:pentaho,
项目名称:pentaho-kettle,
代码行数:7,
代码来源:FastJsonReader.java

示例7: testFromPreviousStep

点赞 2

import org.pentaho.di.core.SingleRowRowSet; //导入依赖的package包/类
@Test
public void testFromPreviousStep() throws Exception {
  xmlInputStreamMeta.sourceFromInput = true;
  xmlInputStreamMeta.sourceFieldName = "inf";
  xmlInputStreamData.outputRowMeta = new RowMeta();

  RowMeta rm = new RowMeta();
  String xml = "<ProductGroup attribute1=\"v1\"/>";
  ValueMetaString ms = new ValueMetaString( "inf" );
  RowSet rs = new SingleRowRowSet();
  rs.putRow( rm, new Object[] { xml } );
  rs.setDone();

  XMLInputStream xmlInputStream =
      new XMLInputStream( stepMockHelper.stepMeta, stepMockHelper.stepDataInterface, 0, stepMockHelper.transMeta,
          stepMockHelper.trans );
  xmlInputStream.setInputRowMeta( rm );
  xmlInputStream.getInputRowMeta().addValueMeta( ms );
  xmlInputStream.getInputRowSets().add( rs );
  xmlInputStream.setOutputRowSets( new ArrayList<>() );

  xmlInputStream.init( xmlInputStreamMeta, xmlInputStreamData );
  xmlInputStream.addRowListener( rl );
  boolean haveRowsToRead;
  do {
    haveRowsToRead = !xmlInputStream.processRow( xmlInputStreamMeta, xmlInputStreamData );
  } while ( !haveRowsToRead );

  int expectedRowNum = 1;

  assertEquals( INCORRECT_XML_DATA_TYPE_DESCRIPTION_MESSAGE, "<ProductGroup attribute1=\"v1\"/>",
      rl.getWritten().get( expectedRowNum )[typeDescriptionPos] );

  assertEquals( INCORRECT_XML_DATA_TYPE_DESCRIPTION_MESSAGE, "START_ELEMENT", rl.getWritten().get(
      expectedRowNum )[typeDescriptionPos + 1] );
  assertEquals( INCORRECT_XML_PATH_MESSAGE, "/ProductGroup", rl.getWritten().get( expectedRowNum )[pathPos + 1] );
  assertEquals( INCORRECT_XML_DATA_NAME_MESSAGE, "ProductGroup", rl.getWritten().get( expectedRowNum )[dataNamePos + 1] );

  // attributes
  // ATTRIBUTE_1
  expectedRowNum++;
  assertEquals( INCORRECT_XML_DATA_TYPE_DESCRIPTION_MESSAGE, "ATTRIBUTE", rl.getWritten().get(
      expectedRowNum )[typeDescriptionPos + 1] );
  assertEquals( INCORRECT_XML_PATH_MESSAGE, "/ProductGroup", rl.getWritten().get( expectedRowNum )[pathPos + 1] );
  assertEquals( INCORRECT_XML_DATA_NAME_MESSAGE, "attribute1", rl.getWritten().get( expectedRowNum )[dataNamePos + 1] );
  assertEquals( INCORRECT_XML_DATA_VALUE_MESSAGE, "v1", rl.getWritten().get( expectedRowNum )[dataValue + 1] );

  // check EndElement for the ProductGroup element
  expectedRowNum++;
  assertEquals( INCORRECT_XML_DATA_TYPE_DESCRIPTION_MESSAGE, "END_ELEMENT", rl.getWritten().get(
      expectedRowNum )[typeDescriptionPos + 1] );
  assertEquals( INCORRECT_XML_PATH_MESSAGE, "/ProductGroup", rl.getWritten().get( expectedRowNum )[pathPos + 1] );
  assertEquals( INCORRECT_XML_DATA_NAME_MESSAGE, "ProductGroup", rl.getWritten().get( expectedRowNum )[dataNamePos +1] );
}
 

开发者ID:pentaho,
项目名称:pentaho-kettle,
代码行数:55,
代码来源:XMLInputStreamTest.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)