src_fm_fc_ms_ff
stringlengths
43
86.8k
target
stringlengths
20
276k
TransExecutorParameters implements Cloneable { @Override public Object clone() { try { TransExecutorParameters retval = (TransExecutorParameters) super.clone(); int nrVariables = variable.length; retval.allocate( nrVariables ); System.arraycopy( variable, 0, retval.variable, 0, nrVariables ); System.arraycopy( field, 0...
@Test public void testClone() throws Exception { TransExecutorParameters meta = new TransExecutorParameters(); meta.setField( new String[] { "field1", "field2" } ); meta.setVariable( new String[] { "var1", "var2" } ); meta.setInput( new String[] { "input1", "input2" } ); TransExecutorParameters cloned = (TransExecutorP...
LoadFileInput extends BaseStep implements StepInterface { boolean openNextFile() { try { if ( meta.getIsInFields() ) { data.readrow = getRow(); if ( data.readrow == null ) { if ( isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "LoadFileInput.Log.FinishedProcessing" ) ); } return false; } if ( first ) { first...
@Test public void testOpenNextFile_noFiles() { assertFalse( stepMetaInterface.isIgnoreEmptyFile() ); assertFalse( stepLoadFileInput.openNextFile() ); } @Test public void testOpenNextFile_noFiles_ignoreEmpty() { stepMetaInterface.setIgnoreEmptyFile( true ); assertFalse( stepLoadFileInput.openNextFile() ); } @Test public...
FragmentHandler extends AbstractXulEventHandler { protected void loadDatabaseOptionsFragment( String fragmentUri ) throws XulException { XulComponent groupElement = document.getElementById( "database-options-box" ); XulComponent parentElement = groupElement.getParent(); XulDomContainer fragmentContainer; try { fragment...
@Test public void testLoadDatabaseOptionsFragment() throws Exception { XulComponent component = mock( XulComponent.class ); XulComponent parent = mock( XulComponent.class ); when( component.getParent() ).thenReturn( parent ); when( document.getElementById( "database-options-box" ) ).thenReturn( component ); XulDomConta...
LoadFileInputMeta extends BaseStepMeta implements StepMetaInterface { public String getXML() { StringBuilder retval = new StringBuilder(); retval.append( " " + XMLHandler.addTagValue( INCLUDE, includeFilename ) ); retval.append( " " + XMLHandler.addTagValue( INCLUDE_FIELD, filenameField ) ); retval.append( " " + XMLHan...
@Test public void testGetXML() throws Exception { LoadFileInputMeta testMeta = createMeta(); String xml = testMeta.getXML(); assertEquals( xmlOrig.replaceAll( "\n", "" ).replaceAll( "\r", "" ), xml.replaceAll( "\n", "" ).replaceAll( "\r", "" ) ); }
LoadFileInputMeta extends BaseStepMeta implements StepMetaInterface { public void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ) throws KettleXMLException { readData( stepnode ); } LoadFileInputMeta(); String getShortFileNameField(); void setShortFileNameField( String field ); String getPa...
@Test public void testLoadXML() throws Exception { LoadFileInputMeta origMeta = createMeta(); LoadFileInputMeta testMeta = new LoadFileInputMeta(); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); Document doc = db.parse( new InputSource( new StringReader...
SyslogMessage extends BaseStep implements StepInterface { public void dispose( StepMetaInterface smi, StepDataInterface sdi ) { meta = (SyslogMessageMeta) smi; data = (SyslogMessageData) sdi; if ( data.syslog != null ) { data.syslog.shutdown(); } super.dispose( smi, sdi ); } SyslogMessage( StepMeta stepMeta, StepDataIn...
@Test public void testDispose() throws Exception { SyslogMessageData data = new SyslogMessageData(); SyslogIF syslog = mock( SyslogIF.class ); SyslogConfigIF syslogConfigIF = mock( SyslogConfigIF.class, RETURNS_MOCKS ); when( syslog.getConfig() ).thenReturn( syslogConfigIF ); final Boolean[] initialized = new Boolean[]...
MergeJoinMeta extends BaseStepMeta implements StepMetaInterface { public void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { if ( info != null ) { for ( int i = 0; i < info.length; i+...
@Test public void testGetFieldsEmptyInput() throws Exception { RowMeta outputRowMeta = new RowMeta(); MergeJoinMeta meta = new MergeJoinMeta(); RowMeta inputRow1 = new RowMeta(); ValueMetaInteger field1_row1 = new ValueMetaInteger( "field1" ); field1_row1.setOrigin( "inputStep1" ); inputRow1.addValueMeta( field1_row1 )...
MergeJoinMeta extends BaseStepMeta implements StepMetaInterface { public Object clone() { MergeJoinMeta retval = (MergeJoinMeta) super.clone(); int nrKeys1 = keyFields1.length; int nrKeys2 = keyFields2.length; retval.allocate( nrKeys1, nrKeys2 ); System.arraycopy( keyFields1, 0, retval.keyFields1, 0, nrKeys1 ); System....
@Test public void cloneTest() throws Exception { MergeJoinMeta meta = new MergeJoinMeta(); meta.allocate( 2, 3 ); meta.setKeyFields1( new String[] { "kf1-1", "kf1-2" } ); meta.setKeyFields2( new String[] { "kf2-1", "kf2-2", "kf2-3" } ); meta.setJoinType( "INNER" ); MergeJoinMeta aClone = (MergeJoinMeta) meta.clone(); a...
DetectLastRowMeta extends BaseStepMeta implements StepMetaInterface { public StepDataInterface getStepData() { return new DetectLastRowData(); } String getResultFieldName(); void setResultFieldName( String resultfieldname ); void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); Object clon...
@Test public void testGetData() { DetectLastRowMeta meta = new DetectLastRowMeta(); assertTrue( meta.getStepData() instanceof DetectLastRowData ); }
DetectLastRowMeta extends BaseStepMeta implements StepMetaInterface { public void getFields( RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { if ( !Utils.isEmpty( resultfieldname ) ) { ValueMeta...
@Test public void testGetFields() throws KettleStepException { DetectLastRowMeta meta = new DetectLastRowMeta(); meta.setDefault(); meta.setResultFieldName( "The Result" ); RowMeta rowMeta = new RowMeta(); meta.getFields( rowMeta, "this step", null, null, new Variables(), null, null ); assertEquals( 1, rowMeta.size() )...
DetectLastRowMeta extends BaseStepMeta implements StepMetaInterface { public TransformationType[] getSupportedTransformationTypes() { return new TransformationType[] { TransformationType.Normal, }; } String getResultFieldName(); void setResultFieldName( String resultfieldname ); void loadXML( Node stepnode, List<Datab...
@Test public void testSupportedTransformationTypes() { DetectLastRowMeta meta = new DetectLastRowMeta(); assertEquals( 1, meta.getSupportedTransformationTypes().length ); assertEquals( TransformationType.Normal, meta.getSupportedTransformationTypes()[0] ); }
WebService extends BaseStep implements StepInterface { HttpPost getHttpMethod( String vURLService ) throws URISyntaxException { URIBuilder uriBuilder = new URIBuilder( vURLService ); HttpPost vHttpMethod = new HttpPost( uriBuilder.build() ); vHttpMethod.setHeader( "Content-Type", "text/xml;charset=UTF-8" ); String soap...
@Test( expected = URISyntaxException.class ) public void newHttpMethodWithInvalidUrl() throws URISyntaxException { webServiceStep.getHttpMethod( NOT_VALID_URL ); }
WebService extends BaseStep implements StepInterface { static String getLocationFrom( HttpPost method ) { Header locationHeader = method.getFirstHeader( "Location" ); return locationHeader.getValue(); } WebService( StepMeta aStepMeta, StepDataInterface aStepData, int value, TransMeta aTransMeta, Trans aTrans ); boolean...
@Test public void getLocationFrom() { HttpPost postMethod = mock( HttpPost.class ); Header locationHeader = new BasicHeader( LOCATION_HEADER, TEST_URL ); doReturn( locationHeader ).when( postMethod ).getFirstHeader( LOCATION_HEADER ); assertEquals( TEST_URL, WebService.getLocationFrom( postMethod ) ); }
WebServiceMeta extends BaseStepMeta implements StepMetaInterface { public void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ) throws KettleXMLException { setUrl( XMLHandler.getTagValue( stepnode, "wsURL" ) ); setOperationName( XMLHandler.getTagValue( stepnode, "wsOperation" ) ); setOperati...
@Test public void testLoadXml() throws Exception { Node node = getTestNode(); DatabaseMeta dbMeta = mock( DatabaseMeta.class ); IMetaStore metastore = mock( IMetaStore.class ); WebServiceMeta webServiceMeta = new WebServiceMeta( node, Collections.singletonList( dbMeta ), metastore ); assertEquals( "httpUser", webServic...
WebServiceMeta extends BaseStepMeta implements StepMetaInterface { public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ) throws KettleException { setUrl( rep.getStepAttributeString( id_step, "wsUrl" ) ); setOperationName( rep.getStepAttributeString( id_step, "wsOper...
@Test public void testReadRep() throws Exception { Repository rep = mock( Repository.class ); IMetaStore metastore = mock( IMetaStore.class ); DatabaseMeta dbMeta = mock( DatabaseMeta.class ); StringObjectId id_step = new StringObjectId( "oid" ); when( rep.getStepAttributeString( id_step, "wsOperation" ) ).thenReturn( ...
FragmentHandler extends AbstractXulEventHandler { protected String getFragment( DatabaseInterface database, String dbName, String extension, String defaultFragment ) { String fragment; String ext = ( extension == null ? "" : extension ); String databaseName = ( dbName == null ? "" : dbName ); String defaultFrag = ( def...
@Test public void testGetFragment() throws Exception { DatabaseInterface dbInterface = mock( DatabaseInterface.class ); assertEquals( "org/pentaho/ui/database/", fragmentHandler.getFragment( dbInterface, null, null, null ) ); when( dbInterface.getXulOverlayFile() ).thenReturn( "overlay.xul" ); assertEquals( "org/pentah...
WebServiceMeta extends BaseStepMeta implements StepMetaInterface { public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step ) throws KettleException { rep.saveStepAttribute( id_transformation, id_step, "wsUrl", getUrl() ); rep.saveStepAttribute( id_transformation, id_step,...
@Test public void testSaveRep() throws Exception { Node node = getTestNode(); DatabaseMeta dbMeta = mock( DatabaseMeta.class ); IMetaStore metastore = mock( IMetaStore.class ); Repository rep = mock( Repository.class ); WebServiceMeta webServiceMeta = new WebServiceMeta(); webServiceMeta.loadXML( node, Collections.sing...
WebServiceMeta extends BaseStepMeta implements StepMetaInterface { @Override public void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { if ( !isPassingInputData() ) { r.clear(); } for...
@Test public void testGetFields() throws Exception { WebServiceMeta webServiceMeta = new WebServiceMeta(); webServiceMeta.setDefault(); RowMetaInterface rmi = mock( RowMetaInterface.class ); RowMetaInterface rmi2 = mock( RowMetaInterface.class ); StepMeta nextStep = mock( StepMeta.class ); IMetaStore metastore = mock( ...
WebServiceMeta 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 ) { CheckResul...
@Test public void testCheck() throws Exception { WebServiceMeta webServiceMeta = new WebServiceMeta(); TransMeta transMeta = mock( TransMeta.class ); StepMeta stepMeta = mock( StepMeta.class ); RowMetaInterface prev = mock( RowMetaInterface.class ); RowMetaInterface info = mock( RowMetaInterface.class ); Repository rep...
WebServiceMeta extends BaseStepMeta implements StepMetaInterface { public WebServiceField getFieldOutFromWsName( String wsName, boolean ignoreWsNsPrefix ) { WebServiceField param = null; if ( Utils.isEmpty( wsName ) ) { return param; } if ( ignoreWsNsPrefix ) { String[] wsNameParsed = wsName.split( ":" ); wsName = wsNa...
@Test public void testGetFieldOut() throws Exception { DatabaseMeta dbMeta = mock( DatabaseMeta.class ); IMetaStore metastore = mock( IMetaStore.class ); WebServiceMeta webServiceMeta = new WebServiceMeta( getTestNode(), Collections.singletonList( dbMeta ), metastore ); assertNull( webServiceMeta.getFieldOutFromWsName(...
MappingInput extends BaseStep implements StepInterface { public void setConnectorSteps( StepInterface[] sourceSteps, List<MappingValueRename> valueRenames, String mappingStepname ) { if ( sourceSteps == null ) { throw new IllegalArgumentException( BaseMessages .getString( PKG, "MappingInput.Exception.IllegalArgumentSou...
@Test public void testSetConnectorSteps() throws Exception { when( stepMockHelper.transMeta.getSizeRowset() ).thenReturn( 1 ); MappingInputData mappingInputData = new MappingInputData(); MappingInput mappingInput = new MappingInput( stepMockHelper.stepMeta, mappingInputData, 0, stepMockHelper.transMeta, stepMockHelper....
SetValueConstant extends BaseStep implements StepInterface { private void updateField( Object[] r ) throws Exception { for ( int i = 0; i < data.getFieldnr(); i++ ) { ValueMetaInterface targetValueMeta = data.getOutputRowMeta().getValueMeta( data.getFieldnrs()[i] ); ValueMetaInterface sourceValueMeta = data.getConvertR...
@Test public void testUpdateField() throws Exception { SetValueConstant step = new SetValueConstant( smh.stepMeta, smh.stepDataInterface, 0, smh.transMeta, smh.trans ); ValueMetaInterface valueMeta = new ValueMetaString( "Field1" ); valueMeta.setStorageType( ValueMetaInterface.STORAGE_TYPE_BINARY_STRING ); RowMeta rowM...
DummyTrans extends BaseStep implements StepInterface { public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { Object[] r = getRow(); if ( r == null ) { setOutputDone(); return false; } putRow( getInputRowMeta(), r ); if ( checkFeedback( getLinesRead() ) ) { if ( log.isBasic()...
@Test public void testDummyTransDoesntWriteOutputWithoutInputRow() throws KettleException { DummyTrans dummy = new DummyTrans( stepMockHelper.stepMeta, stepMockHelper.stepDataInterface, 0, stepMockHelper.transMeta, stepMockHelper.trans ); dummy.init( stepMockHelper.initStepMetaInterface, stepMockHelper.initStepDataInte...
MySQLBulkLoaderMeta extends BaseStepMeta implements StepMetaInterface, ProvidesDatabaseConnectionInformation { public static String[] getFieldFormatTypeCodes() { return fieldFormatTypeCodes; } DatabaseMeta getDatabaseMeta(); void setDatabaseMeta( DatabaseMeta database ); String getTableName(); void setTableName( S...
@Test public void testRoundTrip() throws KettleException { List<String> attributes = Arrays.asList( "schema", "table", "encoding", "delimiter", "enclosure", "escape_char", "replace", "ignore", "local", "fifo_file_name", "bulk_size", "stream_name", "field_name", "field_format_ok" ); Map<String, String> getterMap = new H...
MySQLBulkLoader extends BaseStep implements StepInterface { @Override public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (MySQLBulkLoaderMeta) smi; data = (MySQLBulkLoaderData) sdi; if ( super.init( smi, sdi ) ) { if ( Utils.isEmpty( meta.getEnclosure() ) ) { data.quote = new byte[] {}; } else...
@Test public void testVariableSubstitution() throws KettleException { lder.init( lmeta, ldata ); String is = null; is = new String( ldata.quote ); Assert.assertEquals( "'", is ); is = new String( ldata.separator ); Assert.assertEquals( ",", is ); Assert.assertEquals( "UTF8", ldata.bulkTimestampMeta.getStringEncoding() ...
FragmentHandler extends AbstractXulEventHandler { protected void showMessage( String message ) { try { XulMessageBox box = (XulMessageBox) document.createElement( "messagebox" ); box.setMessage( message ); box.open(); } catch ( XulException e ) { System.out.println( "Error creating messagebox " + e.getMessage() ); } } ...
@Test public void testShowMessage() throws Exception { XulMessageBox messageBox = mock( XulMessageBox.class ); when( document.createElement( "messagebox" ) ).thenReturn( messageBox ); fragmentHandler.showMessage( null ); when( document.createElement( "messagebox" ) ).thenThrow( new XulException() ); fragmentHandler.sho...
SortRowsMeta extends BaseStepMeta implements StepMetaInterface, Serializable { int getDefaultCollationStrength() { return getDefaultCollationStrength( Locale.getDefault() ); } SortRowsMeta(); boolean[] getAscending(); void setAscending( boolean[] ascending ); String getDirectory(); void setDirectory( String directory )...
@Test public void testGetDefaultStrength() { SortRowsMeta srm = new SortRowsMeta(); int usStrength = srm.getDefaultCollationStrength( Locale.US ); assertEquals( Collator.TERTIARY, usStrength ); assertEquals( Collator.IDENTICAL, srm.getDefaultCollationStrength( null ) ); }
Validator extends BaseStep implements StepInterface { KettleValidatorException assertNumeric( ValueMetaInterface valueMeta, Object valueData, Validation field ) throws KettleValueException { if ( valueMeta.isNumeric() || containsOnlyDigits( valueMeta.getString( valueData ) ) ) { return null; } return new KettleValidato...
@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() ) ); } @Test public void assertNumeric_String() throws Exception { V...
SimpleMapping extends BaseStep implements StepInterface { public void dispose( StepMetaInterface smi, StepDataInterface sdi ) { if ( getData().wasStarted ) { if ( !getData().mappingTrans.isFinished() ) { getData().mappingTrans.waitUntilFinished(); } getTrans().removeActiveSubTransformation( getStepname() ); if ( getDat...
@Test public void testDispose() throws KettleException { when( stepMockHelper.trans.getErrors() ).thenReturn( 0 ); when( stepMockHelper.trans.isFinished() ).thenReturn( Boolean.FALSE ); simpleMpData.wasStarted = true; smp = new SimpleMapping( stepMockHelper.stepMeta, stepMockHelper.stepDataInterface, 0, stepMockHelper....
GetSubFoldersMeta extends BaseStepMeta implements StepMetaInterface { public void getFields( RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { ValueMetaInterface folderName = new ValueMetaString(...
@Test public void getFieldsTest() throws KettleStepException { GetSubFoldersMeta stepMeta = new GetSubFoldersMeta(); String stepName = UUID.randomUUID().toString(); RowMeta rowMeta = new RowMeta(); stepMeta.getFields( rowMeta, stepName, null, null, new Variables(), null, null ); assertFalse( stepMeta.includeRowNumber()...
MondrianInputMeta extends BaseStepMeta implements StepMetaInterface { public StepDataInterface getStepData() { return new MondrianData(); } MondrianInputMeta(); DatabaseMeta getDatabaseMeta(); void setDatabaseMeta( DatabaseMeta database ); boolean isVariableReplacementActive(); void setVariableReplacementActive( boolea...
@Test public void testGetData() { MondrianInputMeta meta = new MondrianInputMeta(); assertTrue( meta.getStepData() instanceof MondrianData ); }
DatabaseLookupMeta extends BaseStepMeta implements StepMetaInterface, ProvidesModelerMeta { @Override public Object clone() { DatabaseLookupMeta retval = (DatabaseLookupMeta) super.clone(); int nrkeys = streamKeyField1.length; int nrvalues = returnValueField.length; retval.allocate( nrkeys, nrvalues ); System.array...
@Test public void cloneTest() throws Exception { DatabaseLookupMeta meta = new DatabaseLookupMeta(); meta.allocate( 2, 2 ); meta.setStreamKeyField1( new String[] { "aa", "bb" } ); meta.setTableKeyField( new String[] { "cc", "dd" } ); meta.setKeyCondition( new String[] { "ee", "ff" } ); meta.setStreamKeyField2( new Stri...
ReadAllCache implements DatabaseLookupData.Cache { @Override public void storeRowInCache( DatabaseLookupMeta meta, RowMetaInterface lookupMeta, Object[] lookupRow, Object[] add ) { throw new UnsupportedOperationException( "This cache is read-only" ); } ReadAllCache( DatabaseLookupData stepData, Object[][] keys, RowMeta...
@Test( expected = UnsupportedOperationException.class ) public void storeRowInCache_ThrowsException() throws Exception { buildCache( "" ).storeRowInCache( new DatabaseLookupMeta(), keysMeta.clone(), keys[ 0 ], data[ 0 ] ); }
ReadAllCache implements DatabaseLookupData.Cache { @Override public Object[] getRowFromCache( RowMetaInterface lookupMeta, Object[] lookupRow ) throws KettleException { if ( stepData.hasDBCondition ) { return null; } SearchingContext context = new SearchingContext(); context.init( keys.length ); for ( Index index : ind...
@Test public void hasDbConditionStopsSearching() throws Exception { stepData.hasDBCondition = true; assertNull( buildCache( "" ).getRowFromCache( keysMeta.clone(), keys[ 0 ] ) ); } @Test public void lookup_Finds_Only() throws Exception { ReadAllCache cache = buildCache( "=,<,=,IS NULL" ); Object[] found = cache.getRowF...
DeserializedRow implements Row { @Override public Object[] getObjects() { return Collections.unmodifiableList( objects ).toArray(); } DeserializedRow( List<String> names, List<Class> types, List<Object> objects ); @Override List<String> getColumnNames(); @Override Object[] getObjects(); @Override boolean equals( Object...
@Test public void testRow() throws Exception { Date date = new Date(); URI uri = new URI( "http: List<Object> objects = new ArrayList<>(); objects.add( 100 ); objects.add( 100.50 ); BigDecimal bigDecimal = new BigDecimal( "10000000000000000000.50" ); objects.add( bigDecimal ); objects.add( true ); objects.add( date ); ...
GetRepositoryNames extends BaseStep implements StepInterface { @Override public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (GetRepositoryNamesMeta) smi; data = (GetRepositoryNamesData) sdi; if ( super.init( smi, sdi ) ) { try { data.list = getRepositoryObjects(); } catch ( Exception e ) { log...
@Test public void testGetRepoList_includeSubfolders() throws KettleException { init( repo, "/", true, ".*", "", All, 4 ); } @Test public void testGetRepoList_excludeSubfolders() throws KettleException { init( repo, "/", false, ".*", "", All, 0 ); } @Test public void testGetRepoList_transOnly() throws KettleException { ...
DataEventSerializer extends BaseSerializer<DataEvent> { public DataEventSerializer() { super( DataEvent.class ); SimpleModule module = new SimpleModule(); module.addSerializer( DataEvent.class, new JsonSerializer<DataEvent>() { @Override public void serialize( DataEvent dataEvent, JsonGenerator jsonGenerator, Serialize...
@Test public void testDataEventSerializer() throws Exception { Operation operation = mock( Operation.class ); when( operation.getId() ).thenReturn( "foo" ); Date date = new Date(); URI uri = new URI( "http: List<Object> objects = new ArrayList<>(); objects.add( 100 ); objects.add( 100.50 ); objects.add( new BigDecimal(...
Messages { public static ResourceBundle getBundle() { if ( RESOURCE_BUNDLE == null ) { RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME ); } return RESOURCE_BUNDLE; } private Messages(); static ResourceBundle getBundle(); static String getString( String key ); static String getString( String key, String param1 ...
@Test public void testGetBundle() throws Exception { assertNotNull( Messages.getBundle() ); }
ActingPrincipal implements Principal, Serializable { public boolean equals( Object other ) { if ( other instanceof ActingPrincipal ) { ActingPrincipal that = (ActingPrincipal) other; return ( this.isAnonymous() && that.isAnonymous() ) || ( this.getName() != null && this.getName().equals( that.getName() ) ); } else { re...
@Test public void equals() throws Exception { principal1 = new ActingPrincipal( "suzy" ); principal2 = new ActingPrincipal( "joe" ); assertFalse( principal1.equals( principal2 ) ); assertFalse( principal1.equals( ActingPrincipal.ANONYMOUS ) ); principal2 = new ActingPrincipal( "suzy" ); assertTrue( principal1.equals( p...
StringOperationsMeta extends BaseStepMeta implements StepMetaInterface { @Override public void getFields( RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { for ( int i = 0; i < fieldOutS...
@Test public void testGetFields() throws Exception { StringOperationsMeta meta = new StringOperationsMeta(); meta.allocate( 1 ); meta.setFieldInStream( new String[] { "field1" } ); RowMetaInterface rowMetaInterface = new RowMeta(); ValueMetaInterface valueMeta = new ValueMetaString( "field1" ); valueMeta.setStorageMeta...
AccessOutputData extends BaseStepData implements StepDataInterface { void createDatabase( File databaseFile ) throws IOException { db = Database.create( databaseFile ); } AccessOutputData(); public Database db; public Table table; public List<Object[]> rows; public RowMetaInterface outputRowMeta; public boolean oneFil...
@Test public void testCreateDatabase() throws IOException { assertNull( data.db ); data.createDatabase( mdbFile ); assertNotNull( data.db ); assertTrue( mdbFile.exists() ); assertNull( data.table ); data.truncateTable(); assertNull( data.table ); data.closeDatabase(); }
AccessOutputData extends BaseStepData implements StepDataInterface { void createTable( String tableName, RowMetaInterface rowMeta ) throws IOException { List<Column> columns = AccessOutputMeta.getColumns( rowMeta ); db.createTable( tableName, columns ); table = db.getTable( tableName ); } AccessOutputData(); public Da...
@Test public void testCreateTable() throws IOException { data.createDatabase( mdbFile ); data.createTable( "thisSampleTable", generateRowMeta() ); assertTrue( data.db.getTableNames().contains( "thisSampleTable" ) ); data.closeDatabase(); }
AccessOutputData extends BaseStepData implements StepDataInterface { void truncateTable() throws IOException { if ( table == null ) { return; } Cursor tableRows = Cursor.createCursor( table ); while ( tableRows.moveToNextRow() ) { tableRows.deleteCurrentRow(); } } AccessOutputData(); public Database db; public Table t...
@Test public void testTruncateTable() throws IOException { data.createDatabase( mdbFile ); data.createTable( "TruncatingThisTable", generateRowMeta() ); data.addRowsToTable( generateRowData( 10 ) ); assertEquals( 10, data.table.getRowCount() ); data.truncateTable(); assertEquals( 0, data.table.getRowCount() ); data.add...
OraBulkLoaderMeta extends BaseStepMeta implements StepMetaInterface, ProvidesDatabaseConnectionInformation { public String getXML() { StringBuilder retval = new StringBuilder( 300 ); retval .append( " " ).append( XMLHandler.addTagValue( "connection", databaseMeta == null ? "" : databaseMeta.getName() ) ); retval.appe...
@Test public void testGetXML() { OraBulkLoaderMeta oraBulkLoaderMeta = new OraBulkLoaderMeta(); oraBulkLoaderMeta.setFieldTable( new String[] { "fieldTable1", "fieldTable2" } ); oraBulkLoaderMeta.setFieldStream( new String[] { "fieldStreamValue1" } ); oraBulkLoaderMeta.setDateMask( new String[] {} ); oraBulkLoaderMeta....
OraBulkLoader extends BaseStep implements StepInterface { public String createCommandLine( OraBulkLoaderMeta meta, boolean password ) throws KettleException { StringBuilder sb = new StringBuilder( 300 ); if ( meta.getSqlldr() != null ) { try { FileObject fileObject = KettleVFS.getFileObject( environmentSubstitute( meta...
@Test public void testCreateCommandLine() throws Exception { StepMockHelper<OraBulkLoaderMeta, OraBulkLoaderData> stepMockHelper = new StepMockHelper<OraBulkLoaderMeta, OraBulkLoaderData>( "TEST_CREATE_COMMANDLINE", OraBulkLoaderMeta.class, OraBulkLoaderData.class ); when( stepMockHelper.logChannelInterfaceFactory.crea...
ReplaceStringMeta extends BaseStepMeta implements StepMetaInterface { public void getFields( RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { int nrFields = fieldInStream == null ? 0 : ...
@Test public void testGetFields() throws KettleStepException { ReplaceStringMeta meta = new ReplaceStringMeta(); meta.setFieldInStream( new String[] { FIELD_NAME } ); meta.setFieldOutStream( new String[] { FIELD_NAME } ); ValueMetaInterface inputFieldMeta = mock( ValueMetaInterface.class ); when( inputFieldMeta.getStri...
ReplaceString extends BaseStep implements StepInterface { synchronized Object[] getOneRow( RowMetaInterface rowMeta, Object[] row ) throws KettleException { Object[] rowData = RowDataUtil.resizeArray( row, data.outputRowMeta.size() ); int index = 0; Set<Integer> numFieldsAlreadyBeenTransformed = new HashSet<Integer>();...
@Test public void testGetOneRow() throws Exception { ReplaceStringData data = new ReplaceStringData(); ReplaceString replaceString = new ReplaceString( stepMockHelper.stepMeta, data, 0, stepMockHelper.transMeta, stepMockHelper.trans ); RowMetaInterface inputRowMeta = new RowMeta(); inputRowMeta.addValueMeta( 0, new Val...
ReplaceString extends BaseStep implements StepInterface { public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (ReplaceStringMeta) smi; data = (ReplaceStringData) sdi; if ( super.init( smi, sdi ) ) { return true; } return false; } ReplaceString( StepMeta stepMeta, StepDataInterface stepDataInter...
@Test public void testSynchronizeDifferentFieldsArraysLengths() throws Exception { ReplaceStringData data = new ReplaceStringData(); ReplaceString replaceString = new ReplaceString( stepMockHelper.stepMeta, data, 0, stepMockHelper.transMeta, stepMockHelper.trans ); ReplaceStringMeta meta = new ReplaceStringMeta(); repl...
ActingPrincipal implements Principal, Serializable { public boolean isAnonymous() { return anonymous; } ActingPrincipal( String name ); private ActingPrincipal(); @Override String getName(); boolean equals( Object other ); String toString(); int hashCode(); boolean isAnonymous(); static final ActingPrincipal ANONYMOUS...
@Test public void isAnonymous() throws Exception { assertTrue( ActingPrincipal.ANONYMOUS.isAnonymous() ); assertFalse( new ActingPrincipal( "harold" ).isAnonymous() ); assertFalse( new ActingPrincipal( "" ).isAnonymous() ); }
IfNullMeta extends BaseStepMeta implements StepMetaInterface { public void setDefault() { replaceAllByValue = null; replaceAllMask = null; selectFields = false; selectValuesType = false; setEmptyStringAll = false; int nrfields = 0; int nrtypes = 0; allocate( nrtypes, nrfields ); } IfNullMeta(); boolean isSetEmptyString...
@Test public void testSetDefault() throws Exception { IfNullMeta inm = new IfNullMeta(); inm.setDefault(); assertTrue( ( inm.getValueTypes() != null ) && ( inm.getValueTypes().length == 0 ) ); assertTrue( ( inm.getFields() != null ) && ( inm.getFields().length == 0 ) ); assertFalse( inm.isSelectFields() ); assertFalse(...
SSHData extends BaseStepData implements StepDataInterface { public static Connection OpenConnection( String serveur, int port, String username, String password, boolean useKey, String keyFilename, String passPhrase, int timeOut, VariableSpace space, String proxyhost, int proxyport, String proxyusername, String proxypas...
@Test public void testOpenConnection_1() throws Exception { when( connection.authenticateWithPassword( username, password ) ).thenReturn( true ); assertNotNull( SSHData.OpenConnection( server, port, username, password, false, null, null, 0, null, null, 0, null, null ) ); verify( connection ).connect(); verify( connecti...
MemoryGroupByMeta extends BaseStepMeta implements StepMetaInterface { @Override public void getFields( RowMetaInterface r, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) { boolean compatibilityMode = ValueMetaBase.convertStringToBoolean( spa...
@Test public void testGetFields() { final String stepName = "this step name"; MemoryGroupByMeta meta = new MemoryGroupByMeta(); meta.setDefault(); meta.allocate( 1, 17 ); RowMetaInterface rm = getInputRowMeta(); String[] groupFields = new String[2]; groupFields[0] = "myGroupField1"; groupFields[1] = "myGroupField2"; St...
MemoryGroupByData extends BaseStepData implements StepDataInterface { public HashEntry getHashEntry( Object[] groupData ) { return new HashEntry( groupData ); } MemoryGroupByData(); HashEntry getHashEntry( Object[] groupData ); void clear(); public HashMap<HashEntry, Aggregate> map; public RowMetaInterface aggMeta; pub...
@Test public void hashEntryTest() { HashMap<MemoryGroupByData.HashEntry, String> map = new HashMap<>(); byte[] byteValue1 = "key".getBytes(); Object[] groupData1 = new Object[1]; groupData1[0] = byteValue1; MemoryGroupByData.HashEntry hashEntry1 = data.getHashEntry( groupData1 ); map.put( hashEntry1, "value" ); byte[] ...
NamedClusterEmbedManager { public void registerUrl( String urlString ) { if ( urlString == null || addedAllClusters == true ) { return; } if ( urlString.startsWith( VARIABLE_START ) ) { addAllClusters(); } Pattern r = Pattern.compile( URL_PATTERN ); Matcher m = r.matcher( urlString ); if ( m.find() ) { String protocol ...
@Test public void testRegisterUrlNc() throws Exception { namedClusterEmbedManager.registerUrl( "hc: verify( mockMetaStoreFactory ).saveElement( mockNamedCluster1 ); } @Test public void testRegisterUrlNotNc() throws Exception { namedClusterEmbedManager.registerUrl( "hdfs: verify( mockMetaStoreFactory, never() ).saveElem...
TransformationMap { public List<SocketPortAllocation> getHostServerSocketPorts( String hostname ) { List<SocketPortAllocation> ports = hostServerSocketPortsMap.get( hostname ); return ports == null ? Collections.emptyList() : Collections.unmodifiableList( ports ); } TransformationMap(); void addTransformation( String t...
@Test public void getHostServerSocketPorts() { transformationMap.allocateServerSocketPort( 1, TEST_HOST, CLUSTERED_RUN_ID, TEST_TRANSFORMATION_NAME, TEST_SOURCE_SLAVE_NAME, TEST_SOURCE_STEP_NAME, TEST_SOURCE_STEP_COPY, TEST_TARGET_SLAVE_NAME, TEST_TARGET_STEP_NAME, TEST_TARGET_STEP_COPY ); List<SocketPortAllocation> ac...
NamedClusterEmbedManager { public void clear() { NamedClusterServiceOsgi ncso = meta.getNamedClusterServiceOsgi(); if ( ncso != null ) { addedAllClusters = false; addedAnyClusters = false; if ( embeddedMetaStoreFactory != null ) { try { List<NamedClusterOsgi> list = embeddedMetaStoreFactory.getElements(); for ( NamedCl...
@Test public void testClear() throws Exception { when( mockMetaStoreFactory.getElements() ) .thenReturn( Arrays.asList( new NamedClusterOsgi[] { mockNamedCluster1, mockNamedCluster2 } ) ); namedClusterEmbedManager.clear( ); verify( mockMetaStoreFactory ).deleteElement( CLUSTER1_NAME ); verify( mockMetaStoreFactory ).de...
NamedClusterEmbedManager { public void passEmbeddedMetastoreKey( VariableSpace nameSpace, String embeddedMetastoreProviderKey ) { if ( nameSpace != null ) { if ( embeddedMetastoreProviderKey != null ) { nameSpace.setVariable( "vfs.hc.embeddedMetastoreKey", embeddedMetastoreProviderKey ); } } } NamedClusterEmbedManager(...
@Test public void testPassEmbeddedMetastoreKey() { Variables mockVariables = mock( Variables.class ); namedClusterEmbedManager.passEmbeddedMetastoreKey( mockVariables, "key" ); verify( mockVariables ).setVariable( anyString(), anyString() ); }
NamedClusterEmbedManager { public void addClusterToMeta( String clusterName ) { NamedClusterServiceOsgi ncso = meta.getNamedClusterServiceOsgi(); if ( ncso != null ) { NamedClusterOsgi nc = ncso.getNamedClusterByName( clusterName, meta.getMetaStore() ); if ( nc == null ) { nc = namedClusterPool.get( clusterName ); } if...
@Test public void testAddingClusterToMetaData() throws MetaStoreException { namedClusterEmbedManager.addClusterToMeta( CLUSTER1_NAME ); verify( mockMetaStoreFactory ).saveElement( mockNamedCluster1 ); }
GroupBy extends BaseStep implements StepInterface { @Override public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { meta = (GroupByMeta) smi; data = (GroupByData) sdi; Object[] r = getRow(); if ( first ) { String val = getVariable( Const.KETTLE_AGGREGATION_ALL_NULLS_ARE_ZERO...
@Test public void testProcessRow() throws KettleException { GroupByMeta groupByMeta = mock( GroupByMeta.class ); GroupByData groupByData = mock( GroupByData.class ); GroupBy groupBySpy = Mockito.spy( new GroupBy( mockHelper.stepMeta, mockHelper.stepDataInterface, 0, mockHelper.transMeta, mockHelper.trans ) ); doReturn(...
GroupBy extends BaseStep implements StepInterface { @Override public void dispose( StepMetaInterface smi, StepDataInterface sdi ) { if ( data.tempFile != null ) { try { closeInput(); closeOutput(); } catch ( KettleFileException e ) { log.logError( e.getLocalizedMessage() ); } boolean tempFileDeleted = data.tempFile.del...
@Test public void testTempFileIsDeleted_AfterCallingDisposeMethod() throws Exception { GroupByData groupByData = new GroupByData(); groupByData.tempFile = File.createTempFile( "test", ".txt" ); groupByData.fosToTempFile = new FileOutputStream( groupByData.tempFile ); groupByData.fisToTmpFile = new FileInputStream( grou...
GroupBy extends BaseStep implements StepInterface { void addToBuffer( Object[] row ) throws KettleFileException { data.bufferList.add( row ); if ( data.bufferList.size() > 5000 && data.rowsOnFile == 0 ) { String pathToTmp = environmentSubstitute( getMeta().getDirectory() ); try { File ioFile = new File( pathToTmp ); if...
@Test public void testAddToBuffer() throws KettleException, FileSystemException { GroupByData groupByData = new GroupByData(); ArrayList listMock = mock( ArrayList.class ); when( listMock.size() ).thenReturn( 5001 ); groupByData.bufferList = listMock; groupByData.rowsOnFile = 0; RowMetaInterface inputRowMetaMock = mock...
ExcelInputMeta extends BaseStepMeta implements StepMetaInterface { public void normilizeAllocation() { int nrfiles = 0; int nrsheets = 0; if ( fileName != null ) { nrfiles = fileName.length; } else { fileName = new String[ 0 ]; } if ( sheetName != null ) { nrsheets = sheetName.length; } else { sheetName = new String[ 0...
@Test public void testNormilizeAllocation() throws KettleException { Assert.assertEquals( 3, meta.getFileName().length ); Assert.assertEquals( 3, meta.getFileMask().length ); Assert.assertEquals( 3, meta.getExcludeFileMask().length ); Assert.assertEquals( 3, meta.getFileRequired().length ); Assert.assertEquals( 3, meta...
ExcelInputMeta extends BaseStepMeta implements StepMetaInterface { @Override public String getXML() { StringBuilder retval = new StringBuilder( 1024 ); normilizeAllocation(); retval.append( " " ).append( XMLHandler.addTagValue( "header", startsWithHeader ) ); retval.append( " " ).append( XMLHandler.addTagValue( "noempt...
@Test public void testGetXML() throws KettleException { Assert.assertEquals( " <header>N</header>" + SystemUtils.LINE_SEPARATOR + " <noempty>N</noempty>" + SystemUtils.LINE_SEPARATOR + " <stoponempty>N</stoponempty>" + SystemUtils.LINE_SEPARATOR + " <filefield/>" + SystemUtils.LINE_SEPARATOR + " <sheetfield/>" + System...
ExcelInputMeta extends BaseStepMeta implements StepMetaInterface { @Override public Object clone() { ExcelInputMeta retval = (ExcelInputMeta) super.clone(); normilizeAllocation(); int nrfiles = fileName.length; int nrsheets = sheetName.length; int nrfields = field.length; retval.allocate( nrfiles, nrsheets, nrfields );...
@Test public void testClone() throws KettleException { ExcelInputMeta clone = (ExcelInputMeta) meta.clone(); Assert.assertEquals( meta.getXML(), clone.getXML() ); }
StaxPoiSheet implements KSheet { @Override public KCell[] getRow( int rownr ) { if ( rownr < 0 || rownr >= numRows ) { throw new ArrayIndexOutOfBoundsException( rownr ); } if ( rownr + 1 < firstRow ) { return new KCell[0]; } if ( rownr > 0 && currentRow == rownr + 1 ) { return currentRowCells; } try { if ( currentRow >...
@Test public void testNullDateCell() throws Exception { final String sheetId = "1"; final String sheetName = "Sheet 1"; XSSFReader reader = mockXSSFReader( sheetId, SHEET_DATE_NO_V, mockSharedStringsTable( "Some Date" ), mockStylesTable( Collections.singletonMap( 2, 165 ), Collections.singletonMap( 165, "M/D/YYYY" ) ) ...
StaxPoiSheet implements KSheet { @Override public KCell getCell( int colnr, int rownr ) { if ( rownr == 0 && colnr < headerRow.size() ) { return new StaxPoiCell( headerRow.get( colnr ), rownr ); } KCell[] row = getRow( rownr ); if ( row != null && rownr < row.length ) { return row[colnr]; } return null; } StaxPoiSheet(...
@Test public void testReadCells() throws Exception { KSheet sheet = getSampleSheet(); KCell cell = sheet.getCell( 1, 2 ); assertEquals( "One", cell.getValue() ); assertEquals( KCellType.LABEL, cell.getType() ); cell = sheet.getCell( 2, 2 ); assertEquals( KCellType.DATE, cell.getType() ); assertEquals( new Date( 1283817...
StepMeta extends SharedObjectBase implements Cloneable, Comparable<StepMeta>, GUIPositionInterface, SharedObjectInterface, CheckResultSourceInterface, ResourceExportInterface, ResourceHolderInterface, AttributesInterface, BaseMeta { @Override public Object clone() { StepMeta stepMeta = new StepMeta(); stepMeta....
@Test public void cloning() throws Exception { StepMeta meta = createTestMeta(); StepMeta clone = (StepMeta) meta.clone(); assertEquals( meta, clone ); }
GetPropertiesServlet extends BodyHttpServlet { @Override public String getContextPath() { return CONTEXT_PATH; } @Override String getContextPath(); static final String CONTEXT_PATH; }
@Test public void getContextPath() throws Exception { GetPropertiesServlet servlet = new GetPropertiesServlet(); servlet.setJettyMode( true ); HttpServletRequest mockHttpServletRequest = mock( HttpServletRequest.class ); HttpServletResponse mockHttpServletResponse = mock( HttpServletResponse.class ); StringWriter out =...
StepErrorMeta extends ChangedFlag implements XMLInterface, Cloneable { public RowMetaInterface getErrorRowMeta( long nrErrors, String errorDescriptions, String fieldNames, String errorCodes ) { RowMetaInterface row = new RowMeta(); String nrErr = variables.environmentSubstitute( getNrErrorsValuename() ); if ( !Utils.is...
@Test public void testGetErrorRowMeta() { VariableSpace vars = new Variables(); vars.setVariable( "VarNumberErrors", "nbrErrors" ); vars.setVariable( "VarErrorDescription", "errorDescription" ); vars.setVariable( "VarErrorFields", "errorFields" ); vars.setVariable( "VarErrorCodes", "errorCodes" ); StepErrorMeta testObj...
BaseStep implements VariableSpace, StepInterface, LoggingObjectInterface, ExtensionDataInterface { @Override public LogLevel getLogLevel() { return log != null ? log.getLogLevel() : null; } BaseStep( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ...
@Test public void testBaseStepGetLogLevelWontThrowNPEWithNullLog() { when( mockHelper.logChannelInterfaceFactory.create( any(), any( LoggingObjectInterface.class ) ) ).thenAnswer( new Answer<LogChannelInterface>() { @Override public LogChannelInterface answer( InvocationOnMock invocation ) throws Throwable { ( (BaseSte...
BaseStep implements VariableSpace, StepInterface, LoggingObjectInterface, ExtensionDataInterface { public RowMetaAndData buildLog( String sname, int copynr, long lines_read, long lines_written, long lines_updated, long lines_skipped, long errors, Date start_date, Date end_date ) { RowMetaInterface r = new RowMeta(); Ob...
@Test public void testBuildLog() throws KettleValueException { BaseStep testObject = new BaseStep( mockHelper.stepMeta, mockHelper.stepDataInterface, 0, mockHelper.transMeta, mockHelper.trans ); Date startDate = new Date( (long) 123 ); Date endDate = new Date( (long) 125 ); RowMetaAndData result = testObject.buildLog( ...
BaseStep implements VariableSpace, StepInterface, LoggingObjectInterface, ExtensionDataInterface { @Override public void cleanup() { for ( ServerSocket serverSocket : serverSockets ) { try { socketRepository.releaseSocket( serverSocket.getLocalPort() ); logDetailed( BaseMessages.getString( PKG, "BaseStep.Log.ReleasedSe...
@Test public void testCleanup() throws IOException { BaseStep baseStep = new BaseStep( mockHelper.stepMeta, mockHelper.stepDataInterface, 0, mockHelper.transMeta, mockHelper.trans ); ServerSocket serverSocketMock = mock( ServerSocket.class ); doReturn( 0 ).when( serverSocketMock ).getLocalPort(); baseStep.setServerSock...
RowProducer { public boolean putRowWait( RowMetaInterface rowMeta, Object[] rowData, long time, TimeUnit tu ) { return rowSet.putRowWait( rowMeta, rowData, time, tu ); } RowProducer( StepInterface stepInterface, RowSet rowSet ); void putRow( RowMetaInterface rowMeta, Object[] row ); boolean putRow( RowMetaInterface row...
@Test public void testPutRowWait() throws Exception { rowProducer.putRowWait( rowMeta, rowData, 1, TimeUnit.MILLISECONDS ); verify( rowSet, times( 1 ) ).putRowWait( rowMeta, rowData, 1, TimeUnit.MILLISECONDS ); }
RowProducer { public void finished() { rowSet.setDone(); } RowProducer( StepInterface stepInterface, RowSet rowSet ); void putRow( RowMetaInterface rowMeta, Object[] row ); boolean putRow( RowMetaInterface rowMeta, Object[] row, boolean block ); boolean putRowWait( RowMetaInterface rowMeta, Object[] rowData, long time,...
@Test public void testFinished() throws Exception { rowProducer.finished(); verify( rowSet, times( 1 ) ).setDone(); }
TransSupplier implements Supplier<Trans> { public Trans get() { if ( Utils.isEmpty( transMeta.getVariable( "engine" ) ) ) { log.logBasic( "Using legacy execution engine" ); return fallbackSupplier.get(); } Variables variables = new Variables(); variables.initializeVariablesFrom( null ); String version = variables.getVa...
@Test public void testFallback() throws KettleException { when( fallbackSupplier.get() ).thenReturn( trans ); transSupplier = new TransSupplier( meta, log, fallbackSupplier ); Trans transRet = transSupplier.get(); verify( fallbackSupplier ).get(); assertEquals( transRet, trans ); } @Test public void testWebsocketVersio...
DatabaseImpact { public RowMetaAndData getRow() { RowMetaAndData r = new RowMetaAndData(); r.addValue( new ValueMetaString( BaseMessages.getString( PKG, "DatabaseImpact.RowDesc.Label.Type" ) ), getTypeDesc() ); r.addValue( new ValueMetaString( BaseMessages.getString( PKG, "DatabaseImpact.RowDesc.Label.Transformation" )...
@Test public void testGetRow() throws KettleValueException { DatabaseImpact testObject = new DatabaseImpact( DatabaseImpact.TYPE_IMPACT_READ, "myTrans", "aStep", "ProdDB", "DimCustomer", "Customer_Key", "MyValue", "Calculator 2", "SELECT * FROM dimCustomer", "Some remarks" ); RowMetaAndData rmd = testObject.getRow(); a...
GetRootServlet extends BaseHttpServlet implements CartePluginInterface { public void doGet( HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException { if ( isJettyMode() && !request.getRequestURI().equals( CONTEXT_PATH ) ) { response.setStatus( HttpServletResponse.SC_NOT_FOUND ); ...
@Test public void testDoGetReturn404StatusCode() throws ServletException, IOException { GetRootServlet servlet = new GetRootServlet(); servlet.setJettyMode( true ); HttpServletRequest request = when( mock( HttpServletRequest.class ).getRequestURI() ).thenReturn( "/wrong_path" ).getMock(); HttpServletResponse response =...
Trans implements VariableSpace, NamedParams, HasLogChannelInterface, LoggingObjectInterface, ExecutorInterface, ExtensionDataInterface { public String getName() { if ( transMeta == null ) { return null; } return transMeta.getName(); } Trans(); Trans( TransMeta transMeta ); Trans( TransMeta transMeta, LoggingObjec...
@Test public void testFindDatabaseWithEncodedConnectionName() { DatabaseMeta dbMeta1 = new DatabaseMeta( "encoded_DBConnection", "Oracle", "localhost", "access", "test", "111", "test", "test" ); dbMeta1.setDisplayName( "encoded.DBConnection" ); meta.addDatabase( dbMeta1 ); DatabaseMeta dbMeta2 = new DatabaseMeta( "norm...
Trans implements VariableSpace, NamedParams, HasLogChannelInterface, LoggingObjectInterface, ExecutorInterface, ExtensionDataInterface { @Override public String getLogChannelId() { return log.getLogChannelId(); } Trans(); Trans( TransMeta transMeta ); Trans( TransMeta transMeta, LoggingObjectInterface parent ); <...
@Test public void testLoggingObjectIsNotLeakInMeta() { String expected = meta.log.getLogChannelId(); meta.clear(); String actual = meta.log.getLogChannelId(); assertEquals( "Use same logChannel for empty constructors, or assign General level for clear() calls", expected, actual ); } @Test public void testLoggingObjectI...
Trans implements VariableSpace, NamedParams, HasLogChannelInterface, LoggingObjectInterface, ExecutorInterface, ExtensionDataInterface { public void startThreads() throws KettleException { nrOfFinishedSteps = 0; nrOfActiveSteps = 0; ExtensionPointHandler.callExtensionPoint( log, KettleExtensionPoint.TransformationS...
@Test public void testTransFinishListenersConcurrentModification() throws KettleException, InterruptedException { CountDownLatch start = new CountDownLatch( 1 ); TransFinishListenerAdder add = new TransFinishListenerAdder( trans, start ); TransFinishListenerFirer firer = new TransFinishListenerFirer( trans, start ); st...
Trans implements VariableSpace, NamedParams, HasLogChannelInterface, LoggingObjectInterface, ExecutorInterface, ExtensionDataInterface { protected void fireTransFinishedListeners() throws KettleException { synchronized ( transListeners ) { if ( transListeners.size() == 0 ) { return; } List<KettleException> badGuys ...
@Test public void testFireTransFinishedListeners() throws Exception { Trans trans = new Trans(); TransListener mockListener = mock( TransListener.class ); trans.setTransListeners( Collections.singletonList( mockListener ) ); trans.fireTransFinishedListeners(); verify( mockListener ).transFinished( trans ); }
Pan { protected static void configureParameters( Trans trans, NamedParams optionParams, TransMeta transMeta ) throws UnknownParamException { trans.initializeVariablesFrom( null ); trans.getTransMeta().setInternalKettleVariables( trans ); String[] transParams = trans.listParameters(); for ( String param : transParams ) ...
@Test public void testConfigureParameters() throws Exception { TransMeta transMeta = new TransMeta(); transMeta.addParameterDefinition( TEST_PARAM_NAME, DEFAULT_PARAM_VALUE, "This tests a default parameter" ); assertEquals( "Default parameter was not set correctly on TransMeta", DEFAULT_PARAM_VALUE, transMeta.getParame...
CompressionPluginType extends BasePluginType implements PluginTypeInterface { public static CompressionPluginType getInstance() { if ( pluginType == null ) { pluginType = new CompressionPluginType(); } return pluginType; } private CompressionPluginType(); static CompressionPluginType getInstance(); @Override void hand...
@Test public void testGetInstance() { CompressionPluginType instance = CompressionPluginType.getInstance(); CompressionPluginType instance2 = CompressionPluginType.getInstance(); assertTrue( instance == instance2 ); assertNotNull( instance ); CompressionPluginType.pluginType = null; CompressionPluginType instance3 = Co...
NoneCompressionProvider implements CompressionProvider { @Override public String getName() { return "None"; } @Override CompressionInputStream createInputStream( InputStream in ); @Override boolean supportsInput(); @Override CompressionOutputStream createOutputStream( OutputStream out ); @Override boolean supportsOutp...
@Test public void testGetName() { NoneCompressionProvider provider = (NoneCompressionProvider) factory.getCompressionProviderByName( PROVIDER_NAME ); assertNotNull( provider ); assertEquals( PROVIDER_NAME, provider.getName() ); }
BaseCartePlugin extends BaseHttpServlet implements CartePluginInterface, CarteRequestHandler { @Deprecated @Override public void doGet( HttpServletRequest req, final HttpServletResponse resp ) throws IOException { service( req, resp ); } @Deprecated @Override void doGet( HttpServletRequest req, final HttpServletRespon...
@Test @SuppressWarnings( "deprecation" ) public void testDoGet() throws Exception { baseCartePlugin.doGet( req, resp ); verify( baseCartePlugin ).service( req, resp ); }
NoneCompressionProvider implements CompressionProvider { @Override public CompressionInputStream createInputStream( InputStream in ) throws IOException { return new NoneCompressionInputStream( in, this ); } @Override CompressionInputStream createInputStream( InputStream in ); @Override boolean supportsInput(); @Overri...
@Test public void testCreateInputStream() throws IOException { NoneCompressionProvider provider = (NoneCompressionProvider) factory.getCompressionProviderByName( PROVIDER_NAME ); ByteArrayInputStream in = new ByteArrayInputStream( "Test".getBytes() ); NoneCompressionInputStream inStream = new NoneCompressionInputStream...
NoneCompressionProvider implements CompressionProvider { @Override public CompressionOutputStream createOutputStream( OutputStream out ) throws IOException { return new NoneCompressionOutputStream( out, this ); } @Override CompressionInputStream createInputStream( InputStream in ); @Override boolean supportsInput(); @...
@Test public void testCreateOutputStream() throws IOException { NoneCompressionProvider provider = (NoneCompressionProvider) factory.getCompressionProviderByName( PROVIDER_NAME ); ByteArrayOutputStream out = new ByteArrayOutputStream(); NoneCompressionOutputStream outStream = new NoneCompressionOutputStream( out, provi...
CompressionOutputStream extends OutputStream { public CompressionProvider getCompressionProvider() { return compressionProvider; } CompressionOutputStream( OutputStream out, CompressionProvider provider ); private CompressionOutputStream(); CompressionProvider getCompressionProvider(); void addEntry( String filename, ...
@Test public void getCompressionProvider() { CompressionProvider provider = outStream.getCompressionProvider(); assertEquals( provider.getName(), PROVIDER_NAME ); }
CompressionOutputStream extends OutputStream { @Override public void close() throws IOException { delegate.close(); } CompressionOutputStream( OutputStream out, CompressionProvider provider ); private CompressionOutputStream(); CompressionProvider getCompressionProvider(); void addEntry( String filename, String extens...
@Test public void testClose() throws IOException { CompressionProvider provider = outStream.getCompressionProvider(); ByteArrayOutputStream out = new ByteArrayOutputStream(); outStream = new DummyCompressionOS( out, provider ); outStream.close(); }
CompressionOutputStream extends OutputStream { @Override public void write( int b ) throws IOException { delegate.write( b ); } CompressionOutputStream( OutputStream out, CompressionProvider provider ); private CompressionOutputStream(); CompressionProvider getCompressionProvider(); void addEntry( String filename, Str...
@Test public void testWrite() throws IOException { CompressionProvider provider = outStream.getCompressionProvider(); ByteArrayOutputStream out = new ByteArrayOutputStream(); outStream = new DummyCompressionOS( out, provider ); outStream.write( "Test".getBytes() ); }
CompressionOutputStream extends OutputStream { public void addEntry( String filename, String extension ) throws IOException { } CompressionOutputStream( OutputStream out, CompressionProvider provider ); private CompressionOutputStream(); CompressionProvider getCompressionProvider(); void addEntry( String filename, Str...
@Test public void testAddEntry() throws IOException { CompressionProvider provider = outStream.getCompressionProvider(); ByteArrayOutputStream out = new ByteArrayOutputStream(); outStream = new DummyCompressionOS( out, provider ); outStream.addEntry( null, null ); }
CompressionProviderFactory implements CompressionProviderFactoryInterface { public static CompressionProviderFactory getInstance() { return INSTANCE; } private CompressionProviderFactory(); static CompressionProviderFactory getInstance(); @Override CompressionProvider createCompressionProviderInstance( String name ); ...
@Test public void testGetInstance() { assertNotNull( factory ); }
CompressionProviderFactory implements CompressionProviderFactoryInterface { @Override public CompressionProvider createCompressionProviderInstance( String name ) { CompressionProvider provider = null; List<PluginInterface> providers = getPlugins(); if ( providers != null ) { for ( PluginInterface plugin : providers ) {...
@Test public void testCreateCoreProviders() { CompressionProvider provider = factory.createCompressionProviderInstance( "None" ); assertNotNull( provider ); assertTrue( provider.getClass().isAssignableFrom( NoneCompressionProvider.class ) ); assertEquals( "None", provider.getName() ); assertEquals( "No compression", pr...
CompressionProviderFactory implements CompressionProviderFactoryInterface { @Override public String[] getCompressionProviderNames() { ArrayList<String> providerNames = new ArrayList<String>(); List<PluginInterface> providers = getPlugins(); if ( providers != null ) { for ( PluginInterface plugin : providers ) { try { C...
@Test public void getCoreProviderNames() { @SuppressWarnings( "serial" ) final HashMap<String, Boolean> foundProvider = new HashMap<String, Boolean>() { { put( "None", false ); put( "Zip", false ); put( "GZip", false ); put( "Snappy", false ); put( "Hadoop-snappy", false ); } }; String[] providers = factory.getCompress...
CompressionProviderFactory implements CompressionProviderFactoryInterface { @Override public Collection<CompressionProvider> getCompressionProviders() { Collection<CompressionProvider> providerClasses = new ArrayList<CompressionProvider>(); List<PluginInterface> providers = getPlugins(); if ( providers != null ) { for ...
@Test public void getCoreProviders() { @SuppressWarnings( "serial" ) final HashMap<String, Boolean> foundProvider = new HashMap<String, Boolean>() { { put( "None", false ); put( "Zip", false ); put( "GZip", false ); put( "Snappy", false ); put( "Hadoop-snappy", false ); } }; Collection<CompressionProvider> providers = ...
BaseCartePlugin extends BaseHttpServlet implements CartePluginInterface, CarteRequestHandler { @Override protected void service( HttpServletRequest req, HttpServletResponse resp ) throws IOException { if ( isJettyMode() && !req.getContextPath().endsWith( getContextPath() ) ) { return; } if ( log.isDebug() ) { logDebug(...
@Test public void testService() throws Exception { when( req.getContextPath() ).thenReturn( "/Path" ); when( baseCartePlugin.getContextPath() ).thenReturn( "/Path" ); when( log.isDebug() ).thenReturn( true ); baseCartePlugin.service( req, resp ); verify( log ).logDebug( baseCartePlugin.getService() ); verify( baseCarte...
CompressionInputStream extends InputStream { public CompressionProvider getCompressionProvider() { return compressionProvider; } CompressionInputStream( InputStream in, CompressionProvider provider ); private CompressionInputStream(); CompressionProvider getCompressionProvider(); Object nextEntry(); @Override void clo...
@Test public void getCompressionProvider() { CompressionProvider provider = inStream.getCompressionProvider(); assertEquals( provider.getName(), PROVIDER_NAME ); }
CompressionInputStream extends InputStream { public Object nextEntry() throws IOException { return null; } CompressionInputStream( InputStream in, CompressionProvider provider ); private CompressionInputStream(); CompressionProvider getCompressionProvider(); Object nextEntry(); @Override void close(); @Override int re...
@Test public void testNextEntry() throws IOException { assertNull( inStream.nextEntry() ); }
CompressionInputStream extends InputStream { @Override public void close() throws IOException { delegate.close(); } CompressionInputStream( InputStream in, CompressionProvider provider ); private CompressionInputStream(); CompressionProvider getCompressionProvider(); Object nextEntry(); @Override void close(); @Overri...
@Test public void testClose() throws IOException { CompressionProvider provider = inStream.getCompressionProvider(); ByteArrayInputStream in = createTestInputStream(); inStream = new DummyCompressionIS( in, provider ); inStream.close(); }
CompressionInputStream extends InputStream { @Override public int read() throws IOException { return delegate.read(); } CompressionInputStream( InputStream in, CompressionProvider provider ); private CompressionInputStream(); CompressionProvider getCompressionProvider(); Object nextEntry(); @Override void close(); @Ov...
@Test public void testRead() throws IOException { CompressionProvider provider = inStream.getCompressionProvider(); ByteArrayInputStream in = createTestInputStream(); inStream = new DummyCompressionIS( in, provider ); assertEquals( inStream.available(), inStream.read( new byte[ 100 ], 0, inStream.available() ) ); }