src_fm_fc_ms_ff stringlengths 43 86.8k | target stringlengths 20 276k |
|---|---|
TransMeta extends AbstractMeta implements XMLInterface, Comparator<TransMeta>, Comparable<TransMeta>, Cloneable, ResourceExportInterface,
RepositoryElementInterface, LoggingObjectInterface { public Object realClone( boolean doClear ) { try { TransMeta transMeta = (TransMeta) super.clone(); if ( doClear ) { transMet... | @Test public void testCloneWithParam() throws Exception { TransMeta transMeta = new TransMeta( "transFile", "myTrans" ); transMeta.addParameterDefinition( "key", "defValue", "description" ); Object clone = transMeta.realClone( true ); assertNotNull( clone ); } |
TransMeta extends AbstractMeta implements XMLInterface, Comparator<TransMeta>, Comparable<TransMeta>, Cloneable, ResourceExportInterface,
RepositoryElementInterface, LoggingObjectInterface { public void loadXML( Node transnode, Repository rep, boolean setInternalVariables ) throws KettleXMLException, KettleMissingP... | @Test public void testLoadXml() throws KettleException { String directory = "/home/admin"; Node jobNode = Mockito.mock( Node.class ); NodeList nodeList = new NodeList() { ArrayList<Node> nodes = new ArrayList<>( ); { Node nodeInfo = Mockito.mock( Node.class ); Mockito.when( nodeInfo.getNodeName() ).thenReturn( TransMet... |
TransMeta extends AbstractMeta implements XMLInterface, Comparator<TransMeta>, Comparable<TransMeta>, Cloneable, ResourceExportInterface,
RepositoryElementInterface, LoggingObjectInterface { public List<StepMeta> getUsedSteps() { List<StepMeta> list = new ArrayList<>(); for ( StepMeta stepMeta : steps ) { if ( isSt... | @Test public void testTransWithOneStepIsConsideredUsed() throws Exception { TransMeta transMeta = new TransMeta( getClass().getResource( "one-step-trans.ktr" ).getPath() ); assertEquals( 1, transMeta.getUsedSteps().size() ); } |
ZipFileMeta extends BaseStepMeta implements StepMetaInterface { public void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ) throws KettleXMLException { readData( stepnode ); } ZipFileMeta(); String getDynamicSourceFileNameField(); void setDynamicSourceFileNameField( String sourcefilenamefie... | @Test public void testLoadAndGetXml() throws Exception { ZipFileMeta zipFileMeta = new ZipFileMeta(); Node stepnode = getTestNode(); DatabaseMeta dbMeta = mock( DatabaseMeta.class ); IMetaStore metaStore = mock( IMetaStore.class ); StepMeta mockParentStepMeta = mock( StepMeta.class ); zipFileMeta.setParentStepMeta( moc... |
ZipFileMeta extends BaseStepMeta implements StepMetaInterface { public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ) throws KettleException { try { sourcefilenamefield = rep.getStepAttributeString( id_step, "sourcefilenamefield" ); targetfilenamefield = rep.getStep... | @Test public void testReadRep() throws Exception { ZipFileMeta zipFileMeta = new ZipFileMeta(); Repository rep = mock( Repository.class ); IMetaStore metastore = mock( IMetaStore.class ); DatabaseMeta dbMeta = mock( DatabaseMeta.class ); StringObjectId oid = new StringObjectId( "oid" ); when( rep.getStepAttributeString... |
ZipFileMeta extends BaseStepMeta implements StepMetaInterface { public void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space, Repository repository, IMetaStore metaStore ) { CheckResult c... | @Test public void testCheck() { ZipFileMeta zipFileMeta = new ZipFileMeta(); zipFileMeta.setDefault(); TransMeta transMeta = mock( TransMeta.class ); StepMeta stepInfo = mock( StepMeta.class ); RowMetaInterface prev = mock( RowMetaInterface.class ); Repository repos = mock( Repository.class ); IMetaStore metastore = mo... |
DataHandler extends AbstractXulEventHandler { public void onPoolingCheck() { if ( poolingCheck != null ) { boolean dis = !poolingCheck.isChecked(); if ( poolSizeBox != null ) { poolSizeBox.setDisabled( dis ); } if ( maxPoolSizeBox != null ) { maxPoolSizeBox.setDisabled( dis ); } if ( poolSizeLabel != null ) { poolSizeL... | @Test public void testOnPoolingCheck() throws Exception { } |
ZipFileMeta extends BaseStepMeta implements StepMetaInterface { public StepInterface getStep( StepMeta stepMeta, StepDataInterface stepDataInterface, int cnr, TransMeta transMeta, Trans trans ) { return new ZipFile( stepMeta, stepDataInterface, cnr, transMeta, trans ); } ZipFileMeta(); String getDynamicSourceFileNameFi... | @Test public void testGetStep() throws Exception { StepMeta stepInfo = mock( StepMeta.class ); when( stepInfo.getName() ).thenReturn( "Zip Step Name" ); StepDataInterface stepData = mock( StepDataInterface.class ); TransMeta transMeta = mock( TransMeta.class ); when( transMeta.findStep( "Zip Step Name" ) ).thenReturn( ... |
TextFileOutput extends BaseStep implements StepInterface { protected boolean closeFile() { boolean retval = false; try { if ( data.writer != null ) { data.writer.flush(); if ( data.cmdProc != null ) { if ( log.isDebug() ) { logDebug( "Closing output stream" ); } data.writer.close(); if ( log.isDebug() ) { logDebug( "Cl... | @Test public void testCloseFileDataOutIsNullCase() { textFileOutput = new TextFileOutput( stepMockHelper.stepMeta, stepMockHelper.stepDataInterface, 0, stepMockHelper.transMeta, stepMockHelper.trans ); textFileOutput.data = Mockito.mock( TextFileOutputData.class ); Assert.assertNull( textFileOutput.data.out ); textFile... |
TextFileOutput extends BaseStep implements StepInterface { public void writeRowToFile( RowMetaInterface rowMeta, Object[] r ) throws KettleStepException { try { if ( meta.getOutputFields() == null || meta.getOutputFields().length == 0 ) { for ( int i = 0; i < rowMeta.size(); i++ ) { if ( i > 0 && data.binarySeparator.l... | @Test public void testFastDumpDisableStreamEncodeTest() throws Exception { textFileOutput = new TextFileOutputTestHandler( stepMockHelper.stepMeta, stepMockHelper.stepDataInterface, 0, stepMockHelper.transMeta, stepMockHelper.trans ); textFileOutput.meta = stepMockHelper.processRowsStepMetaInterface; String testString ... |
Rest extends BaseStep implements StepInterface { MultivaluedMapImpl createMultivalueMap( String paramName, String paramValue ) { MultivaluedMapImpl queryParams = new MultivaluedMapImpl(); queryParams.add( paramName, UriComponent.encode( paramValue, UriComponent.Type.QUERY_PARAM ) ); return queryParams; } Rest( StepMeta... | @Test public void testCreateMultivalueMap() { StepMeta stepMeta = new StepMeta(); stepMeta.setName( "TestRest" ); TransMeta transMeta = new TransMeta(); transMeta.setName( "TestRest" ); transMeta.addStep( stepMeta ); Rest rest = new Rest( stepMeta, Mockito.mock( StepDataInterface.class ), 1, transMeta, Mockito.mock( Tr... |
JoinRows extends BaseStep implements StepInterface { public void dispose( StepMetaInterface smi, StepDataInterface sdi ) { meta = (JoinRowsMeta) smi; data = (JoinRowsData) sdi; if ( data.file != null ) { for ( int i = 1; i < data.file.length; i++ ) { if ( data.file[i] != null ) { data.file[i].delete(); } } } super.disp... | @Test public void checkThatMethodPerformedWithoutError() throws Exception { getJoinRows().dispose( meta, data ); }
@Test public void disposeDataFiles() throws Exception { File mockFile1 = mock( File.class ); File mockFile2 = mock( File.class ); data.file = new File[] {null, mockFile1, mockFile2}; getJoinRows().dispose(... |
JoinRows extends BaseStep implements StepInterface { public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { meta = (JoinRowsMeta) smi; data = (JoinRowsData) sdi; if ( first ) { first = false; initialize(); } if ( data.caching ) { if ( !cacheInputRow() ) { return false; } } el... | @Test public void testJoinRowsStep() throws Exception { JoinRowsMeta joinRowsMeta = new JoinRowsMeta(); joinRowsMeta.setMainStepname( "main step name" ); joinRowsMeta.setPrefix( "out" ); joinRowsMeta.setCacheSize( 3 ); JoinRowsData joinRowsData = new JoinRowsData(); JoinRows joinRows = getJoinRows(); joinRows.getTrans(... |
DimensionLookup extends BaseStep implements StepInterface { public Long dimInsert( RowMetaInterface inputRowMeta, Object[] row, Long technicalKey, boolean newEntry, Long versionNr, Date dateFrom, Date dateTo ) throws KettleException { DatabaseMeta databaseMeta = meta.getDatabaseMeta(); if ( data.prepStatementInsert == ... | @Test public void testDimInsert() throws Exception { RowMetaInterface rowMetaInterface = mock( RowMetaInterface.class ); Object[] objects = mock( List.class ).toArray(); Date date = mock( Date.class ); dimensionLookupSpy.dimInsert( rowMetaInterface, objects, new Long( "132323" ), true, null, date, date ); verify( datab... |
DimensionLookupMeta extends BaseStepMeta implements StepMetaInterface, ProvidesModelerMeta { @Override public void getFields( RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { for ( ValueMetaInte... | @Test public void testGetFields() throws Exception { RowMeta extraFields = new RowMeta(); extraFields.addValueMeta( new ValueMetaString( "field1" ) ); DatabaseMeta dbMeta = mock( DatabaseMeta.class ); DimensionLookupMeta meta = spy( new DimensionLookupMeta() ); meta.setUpdate( false ); meta.setKeyField( null ); meta.se... |
DataHandler extends AbstractXulEventHandler { public void onClusterCheck() { if ( clusteringCheck != null ) { boolean dis = !clusteringCheck.isChecked(); if ( clusterParameterTree != null ) { clusterParameterTree.setDisabled( dis ); } if ( clusterParameterDescriptionLabel != null ) { clusterParameterDescriptionLabel.se... | @Test public void testOnClusterCheck() throws Exception { } |
SelectValuesMeta extends BaseStepMeta implements StepMetaInterface { public void setSelectName( String[] selectName ) { resizeSelectFields( selectName.length ); for ( int i = 0; i < selectFields.length; i++ ) { selectFields[i].setName( selectName[i] ); } } SelectValuesMeta(); String[] getDeleteName(); void setDeleteNam... | @Test public void setSelectName() { selectValuesMeta.setSelectName( new String[] { FIRST_FIELD, SECOND_FIELD } ); assertArrayEquals( new String[] { FIRST_FIELD, SECOND_FIELD }, selectValuesMeta.getSelectName() ); } |
SelectValuesMeta extends BaseStepMeta implements StepMetaInterface { public String[] getSelectName() { String[] selectName = new String[selectFields.length]; for ( int i = 0; i < selectName.length; i++ ) { selectName[i] = selectFields[i].getName(); } return selectName; } SelectValuesMeta(); String[] getDeleteName(); vo... | @Test public void getSelectName() { assertArrayEquals( new String[0], selectValuesMeta.getSelectName() ); } |
SelectValuesMeta extends BaseStepMeta implements StepMetaInterface { public void setSelectRename( String[] selectRename ) { if ( selectRename.length > selectFields.length ) { resizeSelectFields( selectRename.length ); } for ( int i = 0; i < selectFields.length; i++ ) { if ( i < selectRename.length ) { selectFields[i].s... | @Test public void setSelectRename() { selectValuesMeta.setSelectRename( new String[] { FIRST_FIELD, SECOND_FIELD } ); assertArrayEquals( new String[] { FIRST_FIELD, SECOND_FIELD }, selectValuesMeta.getSelectRename() ); } |
SelectValuesMeta extends BaseStepMeta implements StepMetaInterface { public String[] getSelectRename() { String[] selectRename = new String[selectFields.length]; for ( int i = 0; i < selectRename.length; i++ ) { selectRename[i] = selectFields[i].getRename(); } return selectRename; } SelectValuesMeta(); String[] getDele... | @Test public void getSelectRename() { assertArrayEquals( new String[0], selectValuesMeta.getSelectRename() ); } |
SelectValuesMeta extends BaseStepMeta implements StepMetaInterface { public void setSelectLength( int[] selectLength ) { if ( selectLength.length > selectFields.length ) { resizeSelectFields( selectLength.length ); } for ( int i = 0; i < selectFields.length; i++ ) { if ( i < selectLength.length ) { selectFields[i].setL... | @Test public void setSelectLength() { selectValuesMeta.setSelectLength( new int[] { 1, 2 } ); assertArrayEquals( new int[] { 1, 2 }, selectValuesMeta.getSelectLength() ); } |
SelectValuesMeta extends BaseStepMeta implements StepMetaInterface { public int[] getSelectLength() { int[] selectLength = new int[selectFields.length]; for ( int i = 0; i < selectLength.length; i++ ) { selectLength[i] = selectFields[i].getLength(); } return selectLength; } SelectValuesMeta(); String[] getDeleteName();... | @Test public void getSelectLength() { assertArrayEquals( new int[0], selectValuesMeta.getSelectLength() ); } |
SelectValuesMeta extends BaseStepMeta implements StepMetaInterface { public void setSelectPrecision( int[] selectPrecision ) { if ( selectPrecision.length > selectFields.length ) { resizeSelectFields( selectPrecision.length ); } for ( int i = 0; i < selectFields.length; i++ ) { if ( i < selectPrecision.length ) { selec... | @Test public void setSelectPrecision() { selectValuesMeta.setSelectPrecision( new int[] { 1, 2 } ); assertArrayEquals( new int[] { 1, 2 }, selectValuesMeta.getSelectPrecision() ); } |
SelectValuesMeta extends BaseStepMeta implements StepMetaInterface { public int[] getSelectPrecision() { int[] selectPrecision = new int[selectFields.length]; for ( int i = 0; i < selectPrecision.length; i++ ) { selectPrecision[i] = selectFields[i].getPrecision(); } return selectPrecision; } SelectValuesMeta(); String[... | @Test public void getSelectPrecision() { assertArrayEquals( new int[0], selectValuesMeta.getSelectPrecision() ); } |
SelectValues extends BaseStep implements StepInterface { public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { meta = (SelectValuesMeta) smi; data = (SelectValuesData) sdi; Object[] rowData = getRow(); if ( rowData == null ) { setOutputDone(); return false; } Object[] rowCop... | @Test public void testPDI16368() throws Exception { StepMockHelper<SelectValuesMeta, StepDataInterface> helper = StepMockUtil.getStepMockHelper( SelectValuesMeta.class, "SelectValuesTest2" ); SelectValuesHandler step2 = null; Object[] inputRow2 = null; RowMeta inputRowMeta = null; SelectValuesMeta stepMeta = null; Sele... |
ScriptValuesMod extends BaseStep implements StepInterface { public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (ScriptValuesMetaMod) smi; data = (ScriptValuesModData) sdi; if ( super.init( smi, sdi ) ) { jsScripts = meta.getJSScripts(); for ( int j = 0; j < jsScripts.length; j++ ) { switch ( j... | @Test public void bigNumberAreNotTrimmedToInt() throws Exception { ScriptValuesMod step = StepMockUtil.getStep( ScriptValuesMod.class, ScriptValuesMetaMod.class, "test" ); RowMeta input = new RowMeta(); input.addValueMeta( new ValueMetaBigNumber( "value_int" ) ); input.addValueMeta( new ValueMetaBigNumber( "value_doubl... |
DataHandler extends AbstractXulEventHandler { public void onCancel() { close(); } DataHandler(); void loadConnectionData(); void loadAccessData(); void editOptions( int index ); void clearOptionsData(); void getOptionHelp(); void setDeckChildIndex(); void onPoolingCheck(); void onClusterCheck(); Object getData(); void ... | @Test public void testOnCancel() throws Exception { } |
SFTPPut extends BaseStep implements StepInterface { @VisibleForTesting void checkRemoteFilenameField( String remoteFilenameFieldName, SFTPPutData data ) throws KettleStepException { remoteFilenameFieldName = environmentSubstitute( remoteFilenameFieldName ); if ( !Utils.isEmpty( remoteFilenameFieldName ) ) { data.indexO... | @Test public void checkRemoteFilenameField_FieldNameIsBlank() throws Exception { SFTPPutData data = new SFTPPutData(); step.checkRemoteFilenameField( "", data ); assertEquals( -1, data.indexOfSourceFileFieldName ); }
@Test( expected = KettleStepException.class ) public void checkRemoteFilenameField_FieldNameIsSet_NotFo... |
SFTPPut extends BaseStep implements StepInterface { @VisibleForTesting void checkSourceFileField( String sourceFilenameFieldName, SFTPPutData data ) throws KettleStepException { sourceFilenameFieldName = environmentSubstitute( sourceFilenameFieldName ); if ( Utils.isEmpty( sourceFilenameFieldName ) ) { throw new Kettle... | @Test( expected = KettleStepException.class ) public void checkSourceFileField_NameIsBlank() throws Exception { SFTPPutData data = new SFTPPutData(); step.checkSourceFileField( "", data ); }
@Test( expected = KettleStepException.class ) public void checkSourceFileField_NameIsSet_NotFound() throws Exception { step.setIn... |
SFTPPut extends BaseStep implements StepInterface { @VisibleForTesting void checkRemoteFoldernameField( String remoteFoldernameFieldName, SFTPPutData data ) throws KettleStepException { remoteFoldernameFieldName = environmentSubstitute( remoteFoldernameFieldName ); if ( Utils.isEmpty( remoteFoldernameFieldName ) ) { th... | @Test( expected = KettleStepException.class ) public void checkRemoteFoldernameField_NameIsBlank() throws Exception { SFTPPutData data = new SFTPPutData(); step.checkRemoteFoldernameField( "", data ); }
@Test( expected = KettleStepException.class ) public void checkRemoteFoldernameField_NameIsSet_NotFound() throws Exce... |
DataHandler extends AbstractXulEventHandler { public void onOK() { DatabaseMeta database = new DatabaseMeta(); this.getInfo( database ); boolean passed = checkPoolingParameters(); if ( !passed ) { return; } String[] remarks = database.checkParameters(); String message = ""; if ( remarks.length != 0 ) { for ( int i = 0;... | @Test public void testOnOK() throws Exception { } |
SFTPPut extends BaseStep implements StepInterface { @VisibleForTesting void checkDestinationFolderField( String realDestinationFoldernameFieldName, SFTPPutData data ) throws KettleStepException { realDestinationFoldernameFieldName = environmentSubstitute( realDestinationFoldernameFieldName ); if ( Utils.isEmpty( realDe... | @Test( expected = KettleStepException.class ) public void checkDestinationFolderField_NameIsBlank() throws Exception { SFTPPutData data = new SFTPPutData(); step.checkDestinationFolderField( "", data ); }
@Test( expected = KettleStepException.class ) public void checkDestinationFolderField_NameIsSet_NotFound() throws E... |
SFTPPut extends BaseStep implements StepInterface { public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { meta = (SFTPPutMeta) smi; data = (SFTPPutData) sdi; boolean sendToErrorRow = false; String errorMessage = null; Object[] r = getRow(); if ( r == null ) { setOutputDone()... | @Test public void remoteFilenameFieldIsMandatoryWhenStreamingFromInputField() throws Exception { RowMeta rowMeta = rowOfStringsMeta( "sourceFilenameFieldName", "remoteDirectoryFieldName" ); step.setInputRowMeta( rowMeta ); doReturn( new Object[] { "qwerty", "asdfg" } ).when( step ).getRow(); SFTPPutMeta meta = new SFTP... |
SystemDataMeta extends BaseStepMeta implements StepMetaInterface { @Override public void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ) throws KettleXMLException { readData( stepnode ); } SystemDataMeta(); String[] getFieldName(); void setFieldName( String[] fieldName ); SystemDataTypes[] ... | @Test public void testLoadXML() throws Exception { SystemDataMeta systemDataMeta = new SystemDataMeta(); DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); Document document = documentBuilder.parse( new Inp... |
SystemDataMeta extends BaseStepMeta implements StepMetaInterface { @Override public String getXML() { StringBuilder retval = new StringBuilder(); retval.append( " <fields>" + Const.CR ); for ( int i = 0; i < fieldName.length; i++ ) { retval.append( " <field>" + Const.CR ); retval.append( " " + XMLHandler.addTagValue( "... | @Test public void testGetXML() throws Exception { String generatedXML = expectedSystemDataMeta.getXML(); assertEquals( expectedXML.replaceAll( "\n", "" ).replaceAll( "\r", "" ), generatedXML.replaceAll( "\n", "" ) .replaceAll( "\r", "" ) ); } |
SystemData extends BaseStep implements StepInterface { public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { Object[] row; if ( data.readsRows ) { row = getRow(); if ( row == null ) { setOutputDone(); return false; } if ( first ) { first = false; data.outputRowMeta = getInpu... | @Test public void testProcessRow() throws Exception { SystemDataData systemDataData = new SystemDataData(); SystemDataMeta systemDataMeta = new SystemDataMeta(); systemDataMeta.allocate( 2 ); String[] names = systemDataMeta.getFieldName(); SystemDataTypes[] types = systemDataMeta.getFieldType(); names[0] = "hostname"; ... |
MailInput extends BaseStep implements StepInterface { public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (MailInputMeta) smi; data = (MailInputData) sdi; if ( !super.init( smi, sdi ) ) { return false; } if ( !meta.isDynamicFolder() ) { try { data.outputRowMeta = new RowMeta(); meta.getFields( ... | @Test public void testInitSetGetFirstForIMAP() { MailInput step = new MailInput( mockHelper.stepMeta, mockHelper.stepDataInterface, 0, mockHelper.transMeta, mockHelper.trans ); MailInputData data = new MailInputData(); MailInputMeta meta = mock( MailInputMeta.class ); when( meta.isDynamicFolder() ).thenReturn( false );... |
DataHandler extends AbstractXulEventHandler { protected void getInfo( DatabaseMeta meta ) { getControls(); if ( this.databaseMeta != null && this.databaseMeta != meta ) { meta.initializeVariablesFrom( this.databaseMeta ); } meta.setName( connectionNameBox.getValue() ); meta.setDisplayName( connectionNameBox.getValue() ... | @Test public void testGetInfo() throws Exception { } |
AccessInputMeta extends BaseStepMeta implements StepMetaInterface { @Override public Object clone() { AccessInputMeta retval = (AccessInputMeta) super.clone(); int nrFiles = fileName.length; int nrFields = inputFields.length; retval.allocate( nrFiles, nrFields ); System.arraycopy( fileName, 0, retval.fileName, 0, nrFil... | @Test public void testClone() throws KettleException { AccessInputMeta meta = new AccessInputMeta(); meta.allocate( 3, 2 ); meta.setFileName( new String[] { "file1", "file2", "file3" } ); meta.setFileMask( new String[] { "mask1", "mask2", "mask3" } ); meta.setExcludeFileMask( new String[] { "exmask1", "exmask2", "exmas... |
MissingTransStep extends DummyTrans { public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { if ( super.init( smi, sdi ) ) { logError( BaseMessages.getString( PKG, "MissingTransStep.Log.CannotRunTrans" ) ); } return false; } MissingTransStep( StepMeta stepMeta, StepDataInterface stepDataInterface, int co... | @Test public void testInit() { StepMetaInterface stepMetaInterface = new AbstractStepMeta() { @Override public void setDefault() { } @Override public StepInterface getStep( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ) { return null; } }; StepMeta stepMeta = new ... |
TextFileInput extends BaseStep implements StepInterface { public static final String getLine( LogChannelInterface log, InputStreamReader reader, int formatNr, StringBuilder line ) throws KettleFileException { EncodingType type = EncodingType.guessEncodingType( reader.getEncoding() ); return getLine( log, reader, type, ... | @Test public void testGetLineDOS() throws KettleFileException, UnsupportedEncodingException { String input = "col1\tcol2\tcol3\r\ndata1\tdata2\tdata3\r\n"; String expected = "col1\tcol2\tcol3"; String output = TextFileInput.getLine( null, getInputStreamReader( input ), TextFileInputMeta.FILE_FORMAT_DOS, new StringBuild... |
TextFileInput extends BaseStep implements StepInterface { private int addValueMeta( RowMetaInterface rowMeta, String fieldName ) { ValueMetaInterface valueMeta = new ValueMetaString( fieldName ); valueMeta.setOrigin( getStepname() ); int index = -1; if ( !rowMeta.exists( valueMeta ) ) { index = rowMeta.size(); rowMeta.... | @Test public void readWrappedInputWithoutHeaders() throws Exception { final String content = new StringBuilder() .append( "r1c1" ).append( '\n' ).append( ";r1c2\n" ) .append( "r2c1" ).append( '\n' ).append( ";r2c2" ) .toString(); final String virtualFile = createVirtualFile( "pdi-2607.txt", content ); TextFileInputMeta... |
DataHandler extends AbstractXulEventHandler { public void restoreDefaults() { if ( poolParameterTree != null ) { for ( int i = 0; i < poolParameterTree.getRootChildren().getItemCount(); i++ ) { XulTreeItem item = poolParameterTree.getRootChildren().getItem( i ); String parameterName = item.getRow().getCell( 1 ).getLabe... | @Test public void testRestoreDefaults() throws Exception { } |
TextFileInput extends BaseStep implements StepInterface { @Deprecated public static final Object[] convertLineToRow( LogChannelInterface log, TextFileLine textFileLine, InputFileMetaInterface info, RowMetaInterface outputRowMeta, RowMetaInterface convertRowMeta, String fname, long rowNr, String delimiter, FileErrorHand... | @Test public void convertLineToRowTest() throws Exception { LogChannelInterface log = Mockito.mock( LogChannelInterface.class ); TextFileLine textFileLine = Mockito.mock( TextFileLine.class ); textFileLine.line = "testData1;testData2;testData3"; InputFileMetaInterface info = Mockito.mock( InputFileMetaInterface.class )... |
CalculatorMetaFunction implements Cloneable { @Override public boolean equals( Object obj ) { if ( obj != null && ( obj.getClass().equals( this.getClass() ) ) ) { CalculatorMetaFunction mf = (CalculatorMetaFunction) obj; return ( getXML().equals( mf.getXML() ) ); } return false; } CalculatorMetaFunction( String fieldNa... | @Test public void testEquals() { CalculatorMetaFunction meta1 = new CalculatorMetaFunction(); CalculatorMetaFunction meta2 = (CalculatorMetaFunction) meta1.clone(); assertNotSame( meta1, meta2 ); assertFalse( meta1.equals( null ) ); assertFalse( meta1.equals( new Object() ) ); assertTrue( meta1.equals( meta2 ) ); meta2... |
CalculatorMetaFunction implements Cloneable { public static String getCalcFunctionLongDesc( int type ) { if ( type < 0 || type >= calcLongDesc.length ) { return null; } return calcLongDesc[ type ]; } CalculatorMetaFunction( String fieldName, int calcType, String fieldA, String fieldB, String fieldC,
... | @Test public void testGetCalcFunctionLongDesc() { assertNull( CalculatorMetaFunction.getCalcFunctionLongDesc( Integer.MIN_VALUE ) ); assertNull( CalculatorMetaFunction.getCalcFunctionLongDesc( Integer.MAX_VALUE ) ); assertNull( CalculatorMetaFunction.getCalcFunctionLongDesc( CalculatorMetaFunction.calcLongDesc.length )... |
CalculatorMetaFunction implements Cloneable { public static int getCalcFunctionDefaultResultType( int type ) { if ( type < 0 || type >= calcDefaultResultType.length ) { return ValueMetaInterface.TYPE_NONE; } return calcDefaultResultType[ type ]; } CalculatorMetaFunction( String fieldName, int calcType, String fieldA, S... | @Test public void testGetCalcFunctionDefaultResultType() { assertEquals( ValueMetaInterface.TYPE_NONE, CalculatorMetaFunction.getCalcFunctionDefaultResultType( Integer.MIN_VALUE ) ); assertEquals( ValueMetaInterface.TYPE_NONE, CalculatorMetaFunction.getCalcFunctionDefaultResultType( Integer.MAX_VALUE ) ); assertEquals(... |
CalculatorData extends BaseStepData implements StepDataInterface { public ValueMetaInterface getValueMetaFor( int resultType, String name ) throws KettlePluginException { ValueMetaInterface meta = resultMetaMapping.get( resultType ); if ( meta == null ) { meta = ValueMetaFactory.createValueMeta( name, resultType ); res... | @Test public void dataReturnsCachedValues() throws Exception { KettleEnvironment.init( false ); CalculatorData data = new CalculatorData(); ValueMetaInterface valueMeta = data.getValueMetaFor( ValueMetaInterface.TYPE_INTEGER, null ); ValueMetaInterface shouldBeTheSame = data.getValueMetaFor( ValueMetaInterface.TYPE_INT... |
CalculatorMeta extends BaseStepMeta implements StepMetaInterface { @Override public StepDataInterface getStepData() { return new CalculatorData(); } CalculatorMetaFunction[] getCalculation(); void setCalculation( CalculatorMetaFunction[] calcTypes ); void allocate( int nrCalcs ); @Override void loadXML( Node stepnode,... | @Test public void testGetStepData() { CalculatorMeta meta = new CalculatorMeta(); assertTrue( meta.getStepData() instanceof CalculatorData ); } |
CalculatorMeta extends BaseStepMeta implements StepMetaInterface { @Override public void setDefault() { calculation = new CalculatorMetaFunction[0]; } CalculatorMetaFunction[] getCalculation(); void setCalculation( CalculatorMetaFunction[] calcTypes ); void allocate( int nrCalcs ); @Override void loadXML( Node stepnod... | @Test public void testSetDefault() { CalculatorMeta meta = new CalculatorMeta(); meta.setDefault(); assertNotNull( meta.getCalculation() ); assertEquals( 0, meta.getCalculation().length ); } |
StepDefinition implements Cloneable { public Object clone() throws CloneNotSupportedException { StepDefinition retval; retval = (StepDefinition) super.clone(); if ( stepMeta != null ) { retval.stepMeta = (StepMeta) stepMeta.clone(); } return retval; } StepDefinition(); StepDefinition( String tag, String stepName, Step... | @Test public void testClone() throws Exception { try { StepDefinition stepDefinition = new StepDefinition( "tag", "stepName", null, "" ); stepDefinition.clone(); } catch ( NullPointerException npe ) { fail( "Null value is not handled" ); } } |
PrioritizeStreams extends BaseStep implements StepInterface { public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { meta = (PrioritizeStreamsMeta) smi; data = (PrioritizeStreamsData) sdi; if ( first ) { if ( meta.getStepName() != null || meta.getStepName().length > 0 ) { dat... | @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 { ... |
DataHandler extends AbstractXulEventHandler { public void poolingRowChange( int idx ) { if ( idx != -1 ) { if ( idx >= BaseDatabaseMeta.poolingParameters.length ) { idx = BaseDatabaseMeta.poolingParameters.length - 1; } if ( idx < 0 ) { idx = 0; } poolingDescription.setValue( BaseDatabaseMeta.poolingParameters[idx].get... | @Test public void testPoolingRowChange() throws Exception { } |
FuzzyMatch extends BaseStep implements StepInterface { public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { meta = (FuzzyMatchMeta) smi; data = (FuzzyMatchData) sdi; if ( data.readLookupValues ) { data.readLookupValues = false; if ( !readLookupValues() ) { logError( BaseMes... | @SuppressWarnings( "unchecked" ) @Test public void testProcessRow() throws Exception { fuzzyMatch = new FuzzyMatchHandler( mockHelper.stepMeta, mockHelper.stepDataInterface, 0, mockHelper.transMeta, mockHelper.trans ); fuzzyMatch.init( mockHelper.initStepMetaInterface, mockHelper.initStepDataInterface ); fuzzyMatch.get... |
FuzzyMatch extends BaseStep implements StepInterface { private boolean readLookupValues() throws KettleException { data.infoStream = meta.getStepIOMeta().getInfoStreams().get( 0 ); if ( data.infoStream.getStepMeta() == null ) { logError( BaseMessages.getString( PKG, "FuzzyMatch.Log.NoLookupStepSpecified" ) ); return fa... | @Test public void testReadLookupValues() throws Exception { FuzzyMatchData data = spy( new FuzzyMatchData() ); data.indexOfCachedFields = new int[2]; data.minimalDistance = 0; data.maximalDistance = 5; FuzzyMatchMeta meta = spy( new FuzzyMatchMeta() ); meta.setOutputMatchField( "I don't want NPE here!" ); data.readLook... |
Script extends BaseStep implements StepInterface { public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (ScriptMeta) smi; data = (ScriptData) sdi; if ( super.init( smi, sdi ) ) { jsScripts = meta.getJSScripts(); for ( int j = 0; j < jsScripts.length; j++ ) { switch ( jsScripts[ j ].getScriptType... | @Test public void testOutputDoneIfInputEmpty() throws Exception { Script step = new Script( helper.stepMeta, helper.stepDataInterface, 1, helper.transMeta, helper.trans ); step.init( helper.initStepMetaInterface, helper.initStepDataInterface ); RowSet rs = helper.getMockInputRowSet( new Object[ 0 ][ 0 ] ); List<RowSet>... |
SwitchCase extends BaseStep implements StepInterface { public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { meta = (SwitchCaseMeta) smi; data = (SwitchCaseData) sdi; Object[] r = getRow(); if ( r == null ) { setOutputDone(); return false; } if ( first ) { first = false; cre... | @Test public void testProcessRow() throws KettleException { SwitchCaseCustom krasavez = new SwitchCaseCustom( mockHelper ); krasavez.first = false; RowSet rowSetOne = new QueueRowSet(); RowSet rowSetTwo = new QueueRowSet(); krasavez.data.outputMap.put( 3, rowSetOne ); krasavez.data.outputMap.put( 3, rowSetTwo ); RowSet... |
SwitchCase extends BaseStep implements StepInterface { void createOutputValueMapping() throws KettleException { data.outputRowMeta = getInputRowMeta().clone(); meta.getFields( getInputRowMeta(), getStepname(), null, null, this, repository, metaStore ); data.fieldIndex = getInputRowMeta().indexOfValue( meta.getFieldname... | @Test public void testCreateOutputValueMapping() throws KettleException, URISyntaxException, ParserConfigurationException, SAXException, IOException { SwitchCaseCustom krasavez = new SwitchCaseCustom( mockHelper ); List<DatabaseMeta> emptyList = new ArrayList<DatabaseMeta>(); krasavez.meta.loadXML( loadStepXmlMetadata(... |
TableInputMeta extends BaseStepMeta implements StepMetaInterface { public void getFields( RowMetaInterface row, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { if ( databaseMeta == null ) { return; } boolean param... | @Test public void testGetFields() throws Exception { TableInputMetaHandler meta = new TableInputMetaHandler(); meta.setLazyConversionActive( true ); DatabaseMeta dbMeta = mock( DatabaseMeta.class ); meta.setDatabaseMeta( dbMeta ); Database mockDB = meta.getDatabase(); when( mockDB.getQueryFields( anyString(), anyBoolea... |
FilterRowsMeta extends BaseStepMeta implements StepMetaInterface { public Object clone() { FilterRowsMeta retval = (FilterRowsMeta) super.clone(); retval.setTrueStepname( getTrueStepname() ); retval.setFalseStepname( getFalseStepname() ); if ( condition != null ) { retval.condition = (Condition) condition.clone(); } el... | @Test public void testClone() { FilterRowsMeta filterRowsMeta = new FilterRowsMeta(); filterRowsMeta.setCondition( new Condition() ); filterRowsMeta.setTrueStepname( "true" ); filterRowsMeta.setFalseStepname( "false" ); FilterRowsMeta clone = (FilterRowsMeta) filterRowsMeta.clone(); assertNotNull( clone.getCondition() ... |
CombinationLookup extends BaseStep implements StepInterface { public Long combiInsert( RowMetaInterface rowMeta, Object[] row, Long val_key, Long val_crc ) throws KettleDatabaseException { String debug = "Combination insert"; DatabaseMeta databaseMeta = meta.getDatabaseMeta(); try { if ( data.prepStatementInsert == nul... | @Test public void testCombiInsert() throws Exception { combinationLookupSpy.combiInsert( any( RowMetaInterface.class ), any( Object[].class ), anyLong(), anyLong() ); verify( databaseMeta, times( 2 ) ).supportsAutoGeneratedKeys(); } |
TableOutputMeta extends BaseStepMeta implements StepMetaInterface, ProvidesModelerMeta { public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ) throws KettleException { try { databaseMeta = rep.loadDatabaseMetaFromStepAttribute( id_step, "id_connection", databases );... | @Test public void testReadRep() throws KettleException { String commitSize = "${test}"; Repository rep = new MemoryRepository(); rep.saveStepAttribute( null, null, "commit", commitSize ); TableOutputMeta tableOutputMeta = new TableOutputMeta(); tableOutputMeta.readRep( rep, metaStore, null, databases ); assertEquals( c... |
DataHandler extends AbstractXulEventHandler { protected void getControls() { dialogDeck = (XulDeck) document.getElementById( "dialog-panel-deck" ); deckOptionsBox = (XulListbox) document.getElementById( "deck-options-list" ); connectionBox = (XulListbox) document.getElementById( "connection-type-list" ); accessBox = (X... | @Test public void testGetControls() throws Exception { dataHandler.getControls(); assertNotNull( dataHandler.hostNameBox ); assertNotNull( dataHandler.portNumberBox ); assertNotNull( dataHandler.userNameBox ); assertNotNull( dataHandler.passwordBox ); } |
DatabaseConnectionDialog { public XulDomContainer getSwtInstance( Shell shell ) throws XulException { SwtXulLoader loader = new SwtXulLoader(); return getSwtInstance( loader, shell ); } DatabaseConnectionDialog(); void registerClass( String key, String className ); XulDomContainer getSwtInstance( Shell shell ); XulDomC... | @Test public void testGetSwtInstance() throws Exception { } |
TableOutputMeta extends BaseStepMeta implements StepMetaInterface, ProvidesModelerMeta { public boolean isReturningGeneratedKeys() { if ( getDatabaseMeta() != null ) { return getDatabaseMeta().supportsAutoGeneratedKeys() && returningGeneratedKeys; } return false; } TableOutputMeta(); String getGeneratedKeyField(); void... | @Test public void testIsReturningGeneratedKeys() throws Exception { TableOutputMeta tableOutputMeta = new TableOutputMeta(), tableOutputMetaSpy = spy( tableOutputMeta ); DatabaseMeta databaseMeta = mock( DatabaseMeta.class ); doReturn( true ).when( databaseMeta ).supportsAutoGeneratedKeys(); doReturn( databaseMeta ).wh... |
TableOutputMeta extends BaseStepMeta implements StepMetaInterface, ProvidesModelerMeta { public void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ) throws KettleXMLException { readData( stepnode, databases ); } TableOutputMeta(); String getGeneratedKeyField(); void setGeneratedKeyField( St... | @Test public void testLoadXml() throws Exception { TableOutputMeta tableOutputMeta = new TableOutputMeta(); tableOutputMeta.loadXML( getTestNode(), databases, metaStore ); assertEquals( "1000", tableOutputMeta.getCommitSize() ); assertEquals( null, tableOutputMeta.getGeneratedKeyField() ); assertEquals( "public", table... |
TableOutputMeta extends BaseStepMeta implements StepMetaInterface, ProvidesModelerMeta { public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step ) throws KettleException { try { rep.saveDatabaseMetaStepAttribute( id_transformation, id_step, "id_connection", databaseMeta )... | @Test public void testSaveRep() throws Exception { TableOutputMeta tableOutputMeta = new TableOutputMeta(); tableOutputMeta.loadXML( getTestNode(), databases, metaStore ); StringObjectId id_step = new StringObjectId( "stepid" ); StringObjectId id_transformation = new StringObjectId( "transid" ); Repository rep = mock( ... |
TableOutputMeta extends BaseStepMeta implements StepMetaInterface, ProvidesModelerMeta { public Object clone() { Preconditions.checkState( fieldStream.length == fieldDatabase.length, "Table fields and stream fields are not of equal length." ); TableOutputMeta retval = (TableOutputMeta) super.clone(); int nrRows = field... | @Test public void testClone() throws Exception { TableOutputMeta tableOutputMeta = new TableOutputMeta(); tableOutputMeta.setDefault(); tableOutputMeta.setFieldStream( new String[] {"1", "2", "3"} ); tableOutputMeta.setFieldDatabase( new String[] {"d1", "d2", "d3"} ); TableOutputMeta clone = (TableOutputMeta) tableOutp... |
TableOutputMeta extends BaseStepMeta implements StepMetaInterface, ProvidesModelerMeta { public boolean supportsErrorHandling() { if ( databaseMeta != null ) { return databaseMeta.getDatabaseInterface().supportsErrorHandling(); } else { return true; } } TableOutputMeta(); String getGeneratedKeyField(); void setGenerate... | @Test public void testSupportsErrorHandling() throws Exception { TableOutputMeta tableOutputMeta = new TableOutputMeta(); DatabaseMeta dbMeta = mock( DatabaseMeta.class ); tableOutputMeta.setDatabaseMeta( dbMeta ); DatabaseInterface databaseInterface = mock( DatabaseInterface.class ); when( dbMeta.getDatabaseInterface(... |
TableOutput extends BaseStep implements StepInterface { protected Object[] writeToTable( RowMetaInterface rowMeta, Object[] r ) throws KettleException { if ( r == null ) { if ( log.isDetailed() ) { logDetailed( "Last line inserted: stop" ); } return null; } PreparedStatement insertStatement = null; Object[] insertRowDa... | @Test public void testWriteToTable() throws Exception { tableOutputSpy.writeToTable( mock( RowMetaInterface.class ), new Object[]{} ); } |
TableOutput extends BaseStep implements StepInterface { void truncateTable() throws KettleDatabaseException { if ( !meta.isPartitioningEnabled() && !meta.isTableNameInField() ) { if ( meta.truncateTable() && ( ( getCopy() == 0 && getUniqueStepNrAcrossSlaves() == 0 ) || !Utils.isEmpty( getPartitionID() ) ) ) { data.db.t... | @Test public void testTruncateTable_off() throws Exception { tableOutputSpy.truncateTable(); verify( db, never() ).truncateTable( anyString(), anyString() ); }
@Test public void testTruncateTable_on() throws Exception { when( tableOutputMeta.truncateTable() ).thenReturn( true ); when( tableOutputSpy.getCopy() ).thenRet... |
SplitFieldToRows extends BaseStep implements StepInterface { public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (SplitFieldToRowsMeta) smi; data = (SplitFieldToRowsData) sdi; if ( super.init( smi, sdi ) ) { data.rownr = 1L; try { String delimiter = Const.nullToEmpty( meta.getDelimiter() ); if ... | @Test public void interpretsNullDelimiterAsEmpty() throws Exception { SplitFieldToRows step = StepMockUtil.getStep( SplitFieldToRows.class, SplitFieldToRowsMeta.class, "handlesNullDelimiter" ); SplitFieldToRowsMeta meta = new SplitFieldToRowsMeta(); meta.setDelimiter( null ); meta.setDelimiterRegex( false ); SplitField... |
DataHandler extends AbstractXulEventHandler { public void disablePortIfInstancePopulated() { String serverInstance = serverInstanceBox.getValue(); if ( serverInstance != null && serverInstance.length() > 0 ) { portNumberBox.setDisabled( true ); } else { portNumberBox.setDisabled( false ); } } DataHandler(); void loadCo... | @Test public void testDisablePortIfInstancePopulated() throws Exception { dataHandler.getControls(); dataHandler.disablePortIfInstancePopulated(); when( serverInstanceBox.getValue() ).thenReturn( null ); dataHandler.disablePortIfInstancePopulated(); assertFalse( dataHandler.portNumberBox.isDisabled() ); } |
MonetDbVersion implements Comparable<MonetDbVersion> { @Override public int compareTo( MonetDbVersion mDbVersion ) { int result = majorVersion.compareTo( mDbVersion.majorVersion ); if ( result != 0 ) { return result; } result = minorVersion.compareTo( mDbVersion.minorVersion ); if ( result != 0 ) { return result; } res... | @Test public void testCompareVersions_DiffInPatch() throws Exception { String dbVersionBigger = "785.2.3"; String dbVersion = "785.2.2"; assertEquals( 1, new MonetDbVersion( dbVersionBigger ).compareTo( new MonetDbVersion( dbVersion ) ) ); }
@Test public void testCompareVersions_DiffInMinor() throws Exception { String ... |
BlockUntilStepsFinishMeta extends BaseStepMeta implements StepMetaInterface { public Object clone() { BlockUntilStepsFinishMeta retval = (BlockUntilStepsFinishMeta) super.clone(); int nrfields = stepName.length; retval.allocate( nrfields ); System.arraycopy( stepName, 0, retval.stepName, 0, nrfields ); System.arraycopy... | @Test public void cloneTest() throws Exception { BlockUntilStepsFinishMeta meta = new BlockUntilStepsFinishMeta(); meta.allocate( 2 ); meta.setStepName( new String[] { "step1", "step2" } ); meta.setStepCopyNr( new String[] { "copy1", "copy2" } ); BlockUntilStepsFinishMeta aClone = (BlockUntilStepsFinishMeta) meta.clone... |
MultiMergeJoinMeta extends BaseStepMeta implements StepMetaInterface { @Override public String getXML() { StringBuilder retval = new StringBuilder(); String[] inputStepsNames = inputSteps != null ? inputSteps : ArrayUtils.EMPTY_STRING_ARRAY; retval.append( " " ).append( XMLHandler.addTagValue( "join_type", getJoinType(... | @Test public void testGetXml() { String[] inputSteps = new String[] { "Step1", "Step2" }; multiMergeMeta.setInputSteps( inputSteps ); multiMergeMeta.setKeyFields( new String[] {"Key1", "Key2"} ); String xml = multiMergeMeta.getXML(); Assert.assertTrue( xml.contains( "step0" ) ); Assert.assertTrue( xml.contains( "step1"... |
MultiMergeJoinMeta extends BaseStepMeta implements StepMetaInterface { @Override public Object clone() { MultiMergeJoinMeta retval = (MultiMergeJoinMeta) super.clone(); int nrKeys = keyFields == null ? 0 : keyFields.length; int nrSteps = inputSteps == null ? 0 : inputSteps.length; retval.allocateKeys( nrKeys ); retval.... | @Test public void cloneTest() throws Exception { MultiMergeJoinMeta meta = new MultiMergeJoinMeta(); meta.allocateKeys( 2 ); meta.allocateInputSteps( 3 ); meta.setKeyFields( new String[] { "key1", "key2" } ); meta.setInputSteps( new String[] { "step1", "step2", "step3" } ); meta.setJoinType( "INNER" ); MultiMergeJoinMe... |
ConcatFields extends TextFileOutput implements StepInterface { Object[] prepareOutputRow( Object[] r ) { Object[] outputRowData = null; if ( !meta.isRemoveSelectedFields() ) { outputRowData = RowDataUtil.resizeArray( r, data.outputRowMeta.size() ); } else { outputRowData = new Object[data.outputRowMeta.size() + RowData... | @Test public void testPrepareOutputRow() throws Exception { ConcatFieldsHandler concatFields = new ConcatFieldsHandler( stepMockHelper.stepMeta, stepMockHelper.stepDataInterface, 0, stepMockHelper.transMeta, stepMockHelper.trans ); Object[] row = new Object[] { "one", "two" }; String[] fieldNames = new String[] { "one"... |
DataHandler extends AbstractXulEventHandler { protected void showMessage( String message, boolean scroll ) { try { XulMessageBox box = (XulMessageBox) document.createElement( "messagebox" ); box.setMessage( message ); box.setModalParent( ( (XulRoot) document.getElementById( "general-datasource-window" ) ).getRootObject... | @Test public void testShowMessage() throws Exception { dataHandler.showMessage( "MyMessage", false ); dataHandler.showMessage( "MyMessage", true ); when( document.createElement( "messagebox" ) ).thenThrow( new XulException() ); dataHandler.showMessage( "MyMessage", false ); } |
ExcelWriterStep extends BaseStep implements StepInterface { protected void protectSheet( Sheet sheet, String password ) { if ( sheet instanceof HSSFSheet ) { sheet.protectSheet( password ); } } ExcelWriterStep( StepMeta s, StepDataInterface stepDataInterface, int c, TransMeta t, Trans dis ); @Override boolean processRo... | @Test public void testProtectSheet() throws Exception { step.protectSheet( wb.getSheet( SHEET_NAME ), "aa" ); assertTrue( wb.getSheet( SHEET_NAME ).getProtect() ); } |
StreamLookupMeta extends BaseStepMeta implements StepMetaInterface { @Override public String getXML() { StringBuilder retval = new StringBuilder(); StreamInterface infoStream = getStepIOMeta().getInfoStreams().get( 0 ); retval.append( " " ).append( XMLHandler.addTagValue( "from", infoStream.getStepname() ) ); retval.ap... | @Test public void testGetXML() { StreamLookupMeta streamLookupMeta = new StreamLookupMeta(); streamLookupMeta.setKeystream( new String[] { "testKeyStreamValue" } ); streamLookupMeta.setKeylookup( new String[] { "testKeyLookupValue" } ); streamLookupMeta.setValue( new String[] { "testValue" } ); streamLookupMeta.setValu... |
LdapProtocolFactory { public LdapProtocol createLdapProtocol( VariableSpace variableSpace, LdapMeta meta, Collection<String> binaryAttributes ) throws KettleException { String connectionType = variableSpace.environmentSubstitute( meta.getProtocol() ); synchronized ( protocols ) { for ( Class<? extends LdapProtocol> pro... | @Test public void createLdapProtocol() throws Exception { String ldapVariable = "${ldap_protocol_variable}"; String ldap = "LDAP"; String host = "localhost"; LdapProtocolFactory ldapProtocolFactory = new LdapProtocolFactory( Mockito.mock( LogChannelInterface.class ) ); VariableSpace variableSpace = Mockito.mock( Variab... |
LDAPInput extends BaseStep implements StepInterface { public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (LDAPInputMeta) smi; data = (LDAPInputData) sdi; if ( super.init( smi, sdi ) ) { data.rownr = 1L; data.multi_valuedFieldSeparator = environmentSubstitute( meta.getMultiValuedSeparator() ); ... | @Test public void testRowProcessing() throws Exception { LDAPInput ldapInput = new LDAPInput( stepMockHelper.stepMeta, stepMockHelper.stepDataInterface, 0, stepMockHelper.transMeta, stepMockHelper.trans ); LDAPInputData data = new LDAPInputData(); LDAPInputMeta meta = mockMeta(); LDAPInputField[] fields = new LDAPInput... |
CsvInputData extends BaseStepData implements StepDataInterface { byte[] removeEscapedEnclosures( byte[] field, int nrEnclosuresFound ) { byte[] result = new byte[field.length - nrEnclosuresFound]; int resultIndex = 0; for ( int i = 0; i < field.length; i++ ) { result[resultIndex++] = field[i]; if ( field[i] == enclosur... | @Test public void testRemoveEscapedEnclosuresWithOneEscapedInMiddle() { CsvInputData csvInputData = new CsvInputData(); csvInputData.enclosure = "\"".getBytes(); String result = new String( csvInputData.removeEscapedEnclosures( "abcd \"\" defg".getBytes(), 1 ) ); assertEquals( "abcd \" defg", result ); }
@Test public v... |
NamedFieldsMapping implements FieldsMapping { @Override public int fieldMetaIndex( int index ) { if ( index >= size() || index < 0 ) { return FIELD_DOES_NOT_EXIST; } return actualToMetaFieldMapping[index]; } NamedFieldsMapping( int[] actualToMetaFieldMapping ); @Override int fieldMetaIndex( int index ); @Override int s... | @Test public void fieldMetaIndex() { assertEquals( 3, fieldsMapping.fieldMetaIndex( 0 ) ); }
@Test public void fieldMetaIndexWithUnexistingField() { assertEquals( FieldsMapping.FIELD_DOES_NOT_EXIST, fieldsMapping.fieldMetaIndex( 4 ) ); } |
DataHandler extends AbstractXulEventHandler { public void handleUseSecurityCheckbox() { if ( useIntegratedSecurityCheck != null ) { if ( useIntegratedSecurityCheck.isChecked() ) { userNameBox.setDisabled( true ); passwordBox.setDisabled( true ); } else { userNameBox.setDisabled( false ); passwordBox.setDisabled( false ... | @Test public void testHandleUseSecurityCheckbox() throws Exception { dataHandler.handleUseSecurityCheckbox(); XulCheckbox useIntegratedSecurityCheck = mock( XulCheckbox.class ); when( useIntegratedSecurityCheck.isChecked() ).thenReturn( false ); when( document.getElementById( "use-integrated-security-check" ) ).thenRet... |
NamedFieldsMapping implements FieldsMapping { @Override public int size() { return actualToMetaFieldMapping.length; } NamedFieldsMapping( int[] actualToMetaFieldMapping ); @Override int fieldMetaIndex( int index ); @Override int size(); static NamedFieldsMapping mapping( String[] actualFieldNames, String[] metaFieldNam... | @Test public void size() { assertEquals( 2, fieldsMapping.size() ); } |
NamedFieldsMapping implements FieldsMapping { public static NamedFieldsMapping mapping( String[] actualFieldNames, String[] metaFieldNames ) { LinkedHashMap<String, List<Integer>> metaNameToIndex = new LinkedHashMap<>(); List<Integer> unmatchedMetaFields = new ArrayList<>(); int[] actualToMetaFieldMapping = new int[act... | @Test public void mapping() { NamedFieldsMapping mapping = NamedFieldsMapping.mapping( new String[] { "FIRST", "SECOND", "THIRD" }, new String[] { "SECOND", "THIRD" } ); assertEquals( 0, mapping.fieldMetaIndex( 1 ) ); } |
UnnamedFieldsMapping implements FieldsMapping { @Override public int fieldMetaIndex( int index ) { return ( index >= fieldsCount || index < 0 ) ? FieldsMapping.FIELD_DOES_NOT_EXIST : index; } UnnamedFieldsMapping( int fieldsCount ); @Override int fieldMetaIndex( int index ); @Override int size(); static UnnamedFieldsMa... | @Test public void fieldMetaIndex() { assertEquals( 1, fieldsMapping.fieldMetaIndex( 1 ) ); }
@Test public void fieldMetaIndexWithUnexistingField() { assertEquals( FieldsMapping.FIELD_DOES_NOT_EXIST, fieldsMapping.fieldMetaIndex( 2 ) ); } |
UnnamedFieldsMapping implements FieldsMapping { @Override public int size() { return fieldsCount; } UnnamedFieldsMapping( int fieldsCount ); @Override int fieldMetaIndex( int index ); @Override int size(); static UnnamedFieldsMapping mapping( int fieldsCount ); } | @Test public void size() { assertEquals( 2, fieldsMapping.size() ); } |
UnnamedFieldsMapping implements FieldsMapping { public static UnnamedFieldsMapping mapping( int fieldsCount ) { return new UnnamedFieldsMapping( fieldsCount ); } UnnamedFieldsMapping( int fieldsCount ); @Override int fieldMetaIndex( int index ); @Override int size(); static UnnamedFieldsMapping mapping( int fieldsCount... | @Test public void mapping() { UnnamedFieldsMapping mapping = UnnamedFieldsMapping.mapping( 2 ); assertEquals( 1, mapping.fieldMetaIndex( 1 ) ); } |
CreditCardVerifier { public static boolean isNumber( String n ) { try { Double.valueOf( n ).doubleValue(); return true; } catch ( NumberFormatException e ) { return false; } } static String getCardName( int id ); static String getNotValidCardNames( int id ); static ReturnIndicator CheckCC( String CardNumber ); static ... | @Test public void testIsNumber() { assertFalse( CreditCardVerifier.isNumber( "" ) ); assertFalse( CreditCardVerifier.isNumber( "a" ) ); assertTrue( CreditCardVerifier.isNumber( "1" ) ); assertTrue( CreditCardVerifier.isNumber( "1.01" ) ); } |
CreditCardValidatorMeta extends BaseStepMeta implements StepMetaInterface { public boolean supportsErrorHandling() { return true; } CreditCardValidatorMeta(); String getDynamicField(); void setDynamicField( String fieldname ); String getResultFieldName(); void setOnlyDigits( boolean onlydigits ); boolean isOnlyDigits()... | @Test public void testSupportsErrorHandling() { assertTrue( new CreditCardValidatorMeta().supportsErrorHandling() ); } |
CreditCardValidatorMeta extends BaseStepMeta implements StepMetaInterface { public void getFields( RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { String realresultfieldname = space.en... | @Test public void testGetFields() throws KettleStepException { CreditCardValidatorMeta meta = new CreditCardValidatorMeta(); meta.setDefault(); meta.setResultFieldName( "The Result Field" ); meta.setCardType( "The Card Type Field" ); meta.setNotValidMsg( "Is Card Valid" ); RowMeta rowMeta = new RowMeta(); meta.getField... |
FragmentHandler extends AbstractXulEventHandler { public void refreshOptions() { connectionBox = (XulListbox) document.getElementById( "connection-type-list" ); accessBox = (XulListbox) document.getElementById( "access-type-list" ); Object connectionKey = DataHandler.connectionNametoID.get( connectionBox.getSelectedIte... | @Test public void testRefreshOptions() throws Exception { XulListbox connectionBox = mock( XulListbox.class ); when( document.getElementById( "connection-type-list" ) ).thenReturn( connectionBox ); when( connectionBox.getSelectedItem() ).thenReturn( "myDb" ); XulListbox accessBox = mock( XulListbox.class ); when( docum... |
TransExecutorMeta extends StepWithMappingMeta implements StepMetaInterface, HasRepositoryInterface { void prepareExecutionResultsFields( RowMetaInterface row, StepMeta nextStep ) throws KettleStepException { if ( nextStep != null && executionResultTargetStepMeta != null ) { addFieldToRow( row, executionTimeField, Value... | @Test public void testPrepareExecutionResultsFields() throws Exception { TransExecutorMeta meta = new TransExecutorMeta(); meta = spy( meta ); RowMetaInterface row = mock( RowMetaInterface.class ); StepMeta nextStep = mock( StepMeta.class ); meta.setExecutionResultTargetStepMeta( nextStep ); meta.setExecutionTimeField(... |
TransExecutorMeta extends StepWithMappingMeta implements StepMetaInterface, HasRepositoryInterface { void prepareExecutionResultsFileFields( RowMetaInterface row, StepMeta nextStep ) throws KettleStepException { if ( nextStep != null && resultFilesTargetStepMeta != null && nextStep.equals( resultFilesTargetStepMeta ) )... | @Test public void testPrepareExecutionResultsFileFields() throws Exception { TransExecutorMeta meta = new TransExecutorMeta(); meta = spy( meta ); RowMetaInterface row = mock( RowMetaInterface.class ); StepMeta nextStep = mock( StepMeta.class ); meta.setResultFilesTargetStepMeta( nextStep ); meta.setResultFilesFileName... |
TransExecutorMeta extends StepWithMappingMeta implements StepMetaInterface, HasRepositoryInterface { void prepareResultsRowsFields( RowMetaInterface row ) throws KettleStepException { for ( int i = 0; i < outputRowsField.length; i++ ) { addFieldToRow( row, outputRowsField[i], outputRowsType[i], outputRowsLength[i], out... | @Test public void testPrepareResultsRowsFields() throws Exception { TransExecutorMeta meta = new TransExecutorMeta(); String[] outputFieldNames = new String[]{ "one", "two" }; int[] outputFieldTypes = new int[]{ 0, 1 }; int[] outputFieldLength = new int[]{ 4, 8 }; int[] outputFieldPrecision = new int[]{ 2, 4 }; meta.se... |
TransExecutorMeta extends StepWithMappingMeta implements StepMetaInterface, HasRepositoryInterface { @Override public void getFields( RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { if... | @Test public void testGetFields() throws Exception { TransExecutorMeta meta = new TransExecutorMeta(); meta = spy( meta ); StepMeta nextStep = mock( StepMeta.class ); meta.getFields( null, null, null, nextStep, null, null, null ); verify( meta, never() ).addFieldToRow( any( RowMetaInterface.class ), anyString(), anyInt... |
TransExecutorMeta extends StepWithMappingMeta implements StepMetaInterface, HasRepositoryInterface { public Object clone() { TransExecutorMeta retval = (TransExecutorMeta) super.clone(); int nrFields = outputRowsField.length; retval.allocate( nrFields ); System.arraycopy( outputRowsField, 0, retval.outputRowsField, 0, ... | @Test public void testClone() throws Exception { TransExecutorMeta meta = new TransExecutorMeta(); meta.setOutputRowsField( new String[] { "field1", "field2" } ); meta.setOutputRowsLength( new int[] { 5, 5 } ); meta.setOutputRowsPrecision( new int[] { 5, 5 } ); meta.setOutputRowsType( new int[] { 0, 0 } ); TransExecuto... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.