target
stringlengths
20
113k
src_fm
stringlengths
11
86.3k
src_fm_fc
stringlengths
21
86.4k
src_fm_fc_co
stringlengths
30
86.4k
src_fm_fc_ms
stringlengths
42
86.8k
src_fm_fc_ms_ff
stringlengths
43
86.8k
@Test public void deleteVersionTest() throws KettleException { IUnifiedRepository mockRepo = mock( IUnifiedRepository.class ); final HashMap<String, List<VersionSummary>> versionListMap = processVersionMap( mockRepo ); UnifiedRepositoryPurgeService purgeService = new UnifiedRepositoryPurgeService( mockRepo ); String fileId = "1"; String versionId = "103"; purgeService.deleteVersion( element1, versionId ); verify( mockRepo, times( 1 ) ).deleteFileAtVersion( fileId, versionId ); verify( mockRepo, never() ).deleteFileAtVersion( eq( "2" ), anyString() ); }
@Override public void deleteVersion( RepositoryElementInterface element, String versionId ) throws KettleException { String fileId = element.getObjectId().getId(); deleteVersion( fileId, versionId ); }
UnifiedRepositoryPurgeService implements IPurgeService { @Override public void deleteVersion( RepositoryElementInterface element, String versionId ) throws KettleException { String fileId = element.getObjectId().getId(); deleteVersion( fileId, versionId ); } }
UnifiedRepositoryPurgeService implements IPurgeService { @Override public void deleteVersion( RepositoryElementInterface element, String versionId ) throws KettleException { String fileId = element.getObjectId().getId(); deleteVersion( fileId, versionId ); } UnifiedRepositoryPurgeService( IUnifiedRepository unifiedRepository ); }
UnifiedRepositoryPurgeService implements IPurgeService { @Override public void deleteVersion( RepositoryElementInterface element, String versionId ) throws KettleException { String fileId = element.getObjectId().getId(); deleteVersion( fileId, versionId ); } UnifiedRepositoryPurgeService( IUnifiedRepository unifiedRepository ); @Override void deleteVersionsBeforeDate( RepositoryElementInterface element, Date beforeDate ); @Override void deleteVersionsBeforeDate( Serializable fileId, Date beforeDate ); @Override void deleteAllVersions( RepositoryElementInterface element ); @Override void deleteAllVersions( Serializable fileId ); @Override void deleteVersion( RepositoryElementInterface element, String versionId ); @Override void deleteVersion( Serializable fileId, Serializable versionId ); @Override void keepNumberOfVersions( RepositoryElementInterface element, int versionCount ); @Override void keepNumberOfVersions( Serializable fileId, int versionCount ); void doDeleteRevisions( PurgeUtilitySpecification purgeSpecification ); static DefaultUnifiedRepositoryWebService getRepoWs(); }
UnifiedRepositoryPurgeService implements IPurgeService { @Override public void deleteVersion( RepositoryElementInterface element, String versionId ) throws KettleException { String fileId = element.getObjectId().getId(); deleteVersion( fileId, versionId ); } UnifiedRepositoryPurgeService( IUnifiedRepository unifiedRepository ); @Override void deleteVersionsBeforeDate( RepositoryElementInterface element, Date beforeDate ); @Override void deleteVersionsBeforeDate( Serializable fileId, Date beforeDate ); @Override void deleteAllVersions( RepositoryElementInterface element ); @Override void deleteAllVersions( Serializable fileId ); @Override void deleteVersion( RepositoryElementInterface element, String versionId ); @Override void deleteVersion( Serializable fileId, Serializable versionId ); @Override void keepNumberOfVersions( RepositoryElementInterface element, int versionCount ); @Override void keepNumberOfVersions( Serializable fileId, int versionCount ); void doDeleteRevisions( PurgeUtilitySpecification purgeSpecification ); static DefaultUnifiedRepositoryWebService getRepoWs(); static DefaultUnifiedRepositoryWebService repoWs; }
@Test public void keepNumberOfVersions0Test() throws KettleException { IUnifiedRepository mockRepo = mock( IUnifiedRepository.class ); final HashMap<String, List<VersionSummary>> versionListMap = processVersionMap( mockRepo ); UnifiedRepositoryPurgeService purgeService = new UnifiedRepositoryPurgeService( mockRepo ); String fileId = "1"; int versionCount = 0; purgeService.keepNumberOfVersions( element1, versionCount ); verifyVersionCountDeletion( versionListMap, mockRepo, fileId, versionCount ); verify( mockRepo, never() ).deleteFileAtVersion( eq( "2" ), anyString() ); }
@Override public void keepNumberOfVersions( RepositoryElementInterface element, int versionCount ) throws KettleException { String fileId = element.getObjectId().getId(); keepNumberOfVersions( fileId, versionCount ); }
UnifiedRepositoryPurgeService implements IPurgeService { @Override public void keepNumberOfVersions( RepositoryElementInterface element, int versionCount ) throws KettleException { String fileId = element.getObjectId().getId(); keepNumberOfVersions( fileId, versionCount ); } }
UnifiedRepositoryPurgeService implements IPurgeService { @Override public void keepNumberOfVersions( RepositoryElementInterface element, int versionCount ) throws KettleException { String fileId = element.getObjectId().getId(); keepNumberOfVersions( fileId, versionCount ); } UnifiedRepositoryPurgeService( IUnifiedRepository unifiedRepository ); }
UnifiedRepositoryPurgeService implements IPurgeService { @Override public void keepNumberOfVersions( RepositoryElementInterface element, int versionCount ) throws KettleException { String fileId = element.getObjectId().getId(); keepNumberOfVersions( fileId, versionCount ); } UnifiedRepositoryPurgeService( IUnifiedRepository unifiedRepository ); @Override void deleteVersionsBeforeDate( RepositoryElementInterface element, Date beforeDate ); @Override void deleteVersionsBeforeDate( Serializable fileId, Date beforeDate ); @Override void deleteAllVersions( RepositoryElementInterface element ); @Override void deleteAllVersions( Serializable fileId ); @Override void deleteVersion( RepositoryElementInterface element, String versionId ); @Override void deleteVersion( Serializable fileId, Serializable versionId ); @Override void keepNumberOfVersions( RepositoryElementInterface element, int versionCount ); @Override void keepNumberOfVersions( Serializable fileId, int versionCount ); void doDeleteRevisions( PurgeUtilitySpecification purgeSpecification ); static DefaultUnifiedRepositoryWebService getRepoWs(); }
UnifiedRepositoryPurgeService implements IPurgeService { @Override public void keepNumberOfVersions( RepositoryElementInterface element, int versionCount ) throws KettleException { String fileId = element.getObjectId().getId(); keepNumberOfVersions( fileId, versionCount ); } UnifiedRepositoryPurgeService( IUnifiedRepository unifiedRepository ); @Override void deleteVersionsBeforeDate( RepositoryElementInterface element, Date beforeDate ); @Override void deleteVersionsBeforeDate( Serializable fileId, Date beforeDate ); @Override void deleteAllVersions( RepositoryElementInterface element ); @Override void deleteAllVersions( Serializable fileId ); @Override void deleteVersion( RepositoryElementInterface element, String versionId ); @Override void deleteVersion( Serializable fileId, Serializable versionId ); @Override void keepNumberOfVersions( RepositoryElementInterface element, int versionCount ); @Override void keepNumberOfVersions( Serializable fileId, int versionCount ); void doDeleteRevisions( PurgeUtilitySpecification purgeSpecification ); static DefaultUnifiedRepositoryWebService getRepoWs(); static DefaultUnifiedRepositoryWebService repoWs; }
@Test public void keepNumberOfVersionsTest() throws KettleException { IUnifiedRepository mockRepo = mock( IUnifiedRepository.class ); final HashMap<String, List<VersionSummary>> versionListMap = processVersionMap( mockRepo ); UnifiedRepositoryPurgeService purgeService = new UnifiedRepositoryPurgeService( mockRepo ); String fileId = "1"; int versionCount = 2; purgeService.keepNumberOfVersions( element1, versionCount ); verifyVersionCountDeletion( versionListMap, mockRepo, fileId, versionCount ); verify( mockRepo, never() ).deleteFileAtVersion( eq( "2" ), anyString() ); }
@Override public void keepNumberOfVersions( RepositoryElementInterface element, int versionCount ) throws KettleException { String fileId = element.getObjectId().getId(); keepNumberOfVersions( fileId, versionCount ); }
UnifiedRepositoryPurgeService implements IPurgeService { @Override public void keepNumberOfVersions( RepositoryElementInterface element, int versionCount ) throws KettleException { String fileId = element.getObjectId().getId(); keepNumberOfVersions( fileId, versionCount ); } }
UnifiedRepositoryPurgeService implements IPurgeService { @Override public void keepNumberOfVersions( RepositoryElementInterface element, int versionCount ) throws KettleException { String fileId = element.getObjectId().getId(); keepNumberOfVersions( fileId, versionCount ); } UnifiedRepositoryPurgeService( IUnifiedRepository unifiedRepository ); }
UnifiedRepositoryPurgeService implements IPurgeService { @Override public void keepNumberOfVersions( RepositoryElementInterface element, int versionCount ) throws KettleException { String fileId = element.getObjectId().getId(); keepNumberOfVersions( fileId, versionCount ); } UnifiedRepositoryPurgeService( IUnifiedRepository unifiedRepository ); @Override void deleteVersionsBeforeDate( RepositoryElementInterface element, Date beforeDate ); @Override void deleteVersionsBeforeDate( Serializable fileId, Date beforeDate ); @Override void deleteAllVersions( RepositoryElementInterface element ); @Override void deleteAllVersions( Serializable fileId ); @Override void deleteVersion( RepositoryElementInterface element, String versionId ); @Override void deleteVersion( Serializable fileId, Serializable versionId ); @Override void keepNumberOfVersions( RepositoryElementInterface element, int versionCount ); @Override void keepNumberOfVersions( Serializable fileId, int versionCount ); void doDeleteRevisions( PurgeUtilitySpecification purgeSpecification ); static DefaultUnifiedRepositoryWebService getRepoWs(); }
UnifiedRepositoryPurgeService implements IPurgeService { @Override public void keepNumberOfVersions( RepositoryElementInterface element, int versionCount ) throws KettleException { String fileId = element.getObjectId().getId(); keepNumberOfVersions( fileId, versionCount ); } UnifiedRepositoryPurgeService( IUnifiedRepository unifiedRepository ); @Override void deleteVersionsBeforeDate( RepositoryElementInterface element, Date beforeDate ); @Override void deleteVersionsBeforeDate( Serializable fileId, Date beforeDate ); @Override void deleteAllVersions( RepositoryElementInterface element ); @Override void deleteAllVersions( Serializable fileId ); @Override void deleteVersion( RepositoryElementInterface element, String versionId ); @Override void deleteVersion( Serializable fileId, Serializable versionId ); @Override void keepNumberOfVersions( RepositoryElementInterface element, int versionCount ); @Override void keepNumberOfVersions( Serializable fileId, int versionCount ); void doDeleteRevisions( PurgeUtilitySpecification purgeSpecification ); static DefaultUnifiedRepositoryWebService getRepoWs(); static DefaultUnifiedRepositoryWebService repoWs; }
@Test public void deleteVersionsBeforeDate() throws KettleException { IUnifiedRepository mockRepo = mock( IUnifiedRepository.class ); final HashMap<String, List<VersionSummary>> versionListMap = processVersionMap( mockRepo ); UnifiedRepositoryPurgeService purgeService = new UnifiedRepositoryPurgeService( mockRepo ); String fileId = "1"; Date beforeDate = getDate( "01/02/2006" ); purgeService.deleteVersionsBeforeDate( element1, beforeDate ); verifyDateBeforeDeletion( versionListMap, mockRepo, fileId, beforeDate ); verify( mockRepo, never() ).deleteFileAtVersion( eq( "2" ), anyString() ); }
@Override public void deleteVersionsBeforeDate( RepositoryElementInterface element, Date beforeDate ) throws KettleException { try { Serializable fileId = element.getObjectId().getId(); deleteVersionsBeforeDate( fileId, beforeDate ); } catch ( Exception e ) { processDeleteException( e ); } }
UnifiedRepositoryPurgeService implements IPurgeService { @Override public void deleteVersionsBeforeDate( RepositoryElementInterface element, Date beforeDate ) throws KettleException { try { Serializable fileId = element.getObjectId().getId(); deleteVersionsBeforeDate( fileId, beforeDate ); } catch ( Exception e ) { processDeleteException( e ); } } }
UnifiedRepositoryPurgeService implements IPurgeService { @Override public void deleteVersionsBeforeDate( RepositoryElementInterface element, Date beforeDate ) throws KettleException { try { Serializable fileId = element.getObjectId().getId(); deleteVersionsBeforeDate( fileId, beforeDate ); } catch ( Exception e ) { processDeleteException( e ); } } UnifiedRepositoryPurgeService( IUnifiedRepository unifiedRepository ); }
UnifiedRepositoryPurgeService implements IPurgeService { @Override public void deleteVersionsBeforeDate( RepositoryElementInterface element, Date beforeDate ) throws KettleException { try { Serializable fileId = element.getObjectId().getId(); deleteVersionsBeforeDate( fileId, beforeDate ); } catch ( Exception e ) { processDeleteException( e ); } } UnifiedRepositoryPurgeService( IUnifiedRepository unifiedRepository ); @Override void deleteVersionsBeforeDate( RepositoryElementInterface element, Date beforeDate ); @Override void deleteVersionsBeforeDate( Serializable fileId, Date beforeDate ); @Override void deleteAllVersions( RepositoryElementInterface element ); @Override void deleteAllVersions( Serializable fileId ); @Override void deleteVersion( RepositoryElementInterface element, String versionId ); @Override void deleteVersion( Serializable fileId, Serializable versionId ); @Override void keepNumberOfVersions( RepositoryElementInterface element, int versionCount ); @Override void keepNumberOfVersions( Serializable fileId, int versionCount ); void doDeleteRevisions( PurgeUtilitySpecification purgeSpecification ); static DefaultUnifiedRepositoryWebService getRepoWs(); }
UnifiedRepositoryPurgeService implements IPurgeService { @Override public void deleteVersionsBeforeDate( RepositoryElementInterface element, Date beforeDate ) throws KettleException { try { Serializable fileId = element.getObjectId().getId(); deleteVersionsBeforeDate( fileId, beforeDate ); } catch ( Exception e ) { processDeleteException( e ); } } UnifiedRepositoryPurgeService( IUnifiedRepository unifiedRepository ); @Override void deleteVersionsBeforeDate( RepositoryElementInterface element, Date beforeDate ); @Override void deleteVersionsBeforeDate( Serializable fileId, Date beforeDate ); @Override void deleteAllVersions( RepositoryElementInterface element ); @Override void deleteAllVersions( Serializable fileId ); @Override void deleteVersion( RepositoryElementInterface element, String versionId ); @Override void deleteVersion( Serializable fileId, Serializable versionId ); @Override void keepNumberOfVersions( RepositoryElementInterface element, int versionCount ); @Override void keepNumberOfVersions( Serializable fileId, int versionCount ); void doDeleteRevisions( PurgeUtilitySpecification purgeSpecification ); static DefaultUnifiedRepositoryWebService getRepoWs(); static DefaultUnifiedRepositoryWebService repoWs; }
@Test public void doPurgeUtilVersionCountTest() throws PurgeDeletionException { IUnifiedRepository mockRepo = mock( IUnifiedRepository.class ); final HashMap<String, List<VersionSummary>> versionListMap = processVersionMap( mockRepo ); UnifiedRepositoryPurgeService purgeService = getPurgeService( mockRepo ); PurgeUtilitySpecification spec = new PurgeUtilitySpecification(); spec.setVersionCount( 3 ); spec.setPath( "/" ); purgeService.doDeleteRevisions( spec ); verifyVersionCountDeletion( versionListMap, mockRepo, "1", spec.getVersionCount() ); verifyVersionCountDeletion( versionListMap, mockRepo, "2", spec.getVersionCount() ); }
public void doDeleteRevisions( PurgeUtilitySpecification purgeSpecification ) throws PurgeDeletionException { if ( purgeSpecification != null ) { getLogger().setCurrentFilePath( purgeSpecification.getPath() ); logConfiguration( purgeSpecification ); if ( purgeSpecification.getPath() != null && !purgeSpecification.getPath().isEmpty() ) { processRevisionDeletion( purgeSpecification ); } if ( purgeSpecification.isSharedObjects() ) { if ( purgeSpecification.isPurgeFiles() ) { for ( String sharedObjectpath : sharedObjectFolders ) { purgeSpecification.fileFilter = "*"; purgeSpecification.setPath( sharedObjectpath ); processRevisionDeletion( purgeSpecification ); } } else { throw new PurgeDeletionException( "Must purge files before shared objects" ); } } } }
UnifiedRepositoryPurgeService implements IPurgeService { public void doDeleteRevisions( PurgeUtilitySpecification purgeSpecification ) throws PurgeDeletionException { if ( purgeSpecification != null ) { getLogger().setCurrentFilePath( purgeSpecification.getPath() ); logConfiguration( purgeSpecification ); if ( purgeSpecification.getPath() != null && !purgeSpecification.getPath().isEmpty() ) { processRevisionDeletion( purgeSpecification ); } if ( purgeSpecification.isSharedObjects() ) { if ( purgeSpecification.isPurgeFiles() ) { for ( String sharedObjectpath : sharedObjectFolders ) { purgeSpecification.fileFilter = "*"; purgeSpecification.setPath( sharedObjectpath ); processRevisionDeletion( purgeSpecification ); } } else { throw new PurgeDeletionException( "Must purge files before shared objects" ); } } } } }
UnifiedRepositoryPurgeService implements IPurgeService { public void doDeleteRevisions( PurgeUtilitySpecification purgeSpecification ) throws PurgeDeletionException { if ( purgeSpecification != null ) { getLogger().setCurrentFilePath( purgeSpecification.getPath() ); logConfiguration( purgeSpecification ); if ( purgeSpecification.getPath() != null && !purgeSpecification.getPath().isEmpty() ) { processRevisionDeletion( purgeSpecification ); } if ( purgeSpecification.isSharedObjects() ) { if ( purgeSpecification.isPurgeFiles() ) { for ( String sharedObjectpath : sharedObjectFolders ) { purgeSpecification.fileFilter = "*"; purgeSpecification.setPath( sharedObjectpath ); processRevisionDeletion( purgeSpecification ); } } else { throw new PurgeDeletionException( "Must purge files before shared objects" ); } } } } UnifiedRepositoryPurgeService( IUnifiedRepository unifiedRepository ); }
UnifiedRepositoryPurgeService implements IPurgeService { public void doDeleteRevisions( PurgeUtilitySpecification purgeSpecification ) throws PurgeDeletionException { if ( purgeSpecification != null ) { getLogger().setCurrentFilePath( purgeSpecification.getPath() ); logConfiguration( purgeSpecification ); if ( purgeSpecification.getPath() != null && !purgeSpecification.getPath().isEmpty() ) { processRevisionDeletion( purgeSpecification ); } if ( purgeSpecification.isSharedObjects() ) { if ( purgeSpecification.isPurgeFiles() ) { for ( String sharedObjectpath : sharedObjectFolders ) { purgeSpecification.fileFilter = "*"; purgeSpecification.setPath( sharedObjectpath ); processRevisionDeletion( purgeSpecification ); } } else { throw new PurgeDeletionException( "Must purge files before shared objects" ); } } } } UnifiedRepositoryPurgeService( IUnifiedRepository unifiedRepository ); @Override void deleteVersionsBeforeDate( RepositoryElementInterface element, Date beforeDate ); @Override void deleteVersionsBeforeDate( Serializable fileId, Date beforeDate ); @Override void deleteAllVersions( RepositoryElementInterface element ); @Override void deleteAllVersions( Serializable fileId ); @Override void deleteVersion( RepositoryElementInterface element, String versionId ); @Override void deleteVersion( Serializable fileId, Serializable versionId ); @Override void keepNumberOfVersions( RepositoryElementInterface element, int versionCount ); @Override void keepNumberOfVersions( Serializable fileId, int versionCount ); void doDeleteRevisions( PurgeUtilitySpecification purgeSpecification ); static DefaultUnifiedRepositoryWebService getRepoWs(); }
UnifiedRepositoryPurgeService implements IPurgeService { public void doDeleteRevisions( PurgeUtilitySpecification purgeSpecification ) throws PurgeDeletionException { if ( purgeSpecification != null ) { getLogger().setCurrentFilePath( purgeSpecification.getPath() ); logConfiguration( purgeSpecification ); if ( purgeSpecification.getPath() != null && !purgeSpecification.getPath().isEmpty() ) { processRevisionDeletion( purgeSpecification ); } if ( purgeSpecification.isSharedObjects() ) { if ( purgeSpecification.isPurgeFiles() ) { for ( String sharedObjectpath : sharedObjectFolders ) { purgeSpecification.fileFilter = "*"; purgeSpecification.setPath( sharedObjectpath ); processRevisionDeletion( purgeSpecification ); } } else { throw new PurgeDeletionException( "Must purge files before shared objects" ); } } } } UnifiedRepositoryPurgeService( IUnifiedRepository unifiedRepository ); @Override void deleteVersionsBeforeDate( RepositoryElementInterface element, Date beforeDate ); @Override void deleteVersionsBeforeDate( Serializable fileId, Date beforeDate ); @Override void deleteAllVersions( RepositoryElementInterface element ); @Override void deleteAllVersions( Serializable fileId ); @Override void deleteVersion( RepositoryElementInterface element, String versionId ); @Override void deleteVersion( Serializable fileId, Serializable versionId ); @Override void keepNumberOfVersions( RepositoryElementInterface element, int versionCount ); @Override void keepNumberOfVersions( Serializable fileId, int versionCount ); void doDeleteRevisions( PurgeUtilitySpecification purgeSpecification ); static DefaultUnifiedRepositoryWebService getRepoWs(); static DefaultUnifiedRepositoryWebService repoWs; }
@Test( expected = KettleException.class ) public void exceptionThrownWhenParsingXmlWithBigAmountOfExternalEntitiesFromInputStream() throws Exception { repoMeta.readDataFromInputStream( new ByteArrayInputStream( XXEUtils.MALICIOUS_XML.getBytes() ) ); }
public void readDataFromInputStream( InputStream is ) throws KettleException { clear(); if ( log.isBasic() ) { log.logBasic( BaseMessages.getString( PKG, "RepositoryMeta.Log.ReadingXMLFile", "FromInputStream" ) ); } try { DocumentBuilderFactory dbf = XMLParserFactoryProducer.createSecureDocBuilderFactory(); DocumentBuilder db = dbf.newDocumentBuilder(); Document doc = db.parse( is ); parseRepositoriesDoc( doc ); } catch ( Exception e ) { throw new KettleException( BaseMessages.getString( PKG, "RepositoryMeta.Error.ReadingInfo" ), e ); } }
RepositoriesMeta { public void readDataFromInputStream( InputStream is ) throws KettleException { clear(); if ( log.isBasic() ) { log.logBasic( BaseMessages.getString( PKG, "RepositoryMeta.Log.ReadingXMLFile", "FromInputStream" ) ); } try { DocumentBuilderFactory dbf = XMLParserFactoryProducer.createSecureDocBuilderFactory(); DocumentBuilder db = dbf.newDocumentBuilder(); Document doc = db.parse( is ); parseRepositoriesDoc( doc ); } catch ( Exception e ) { throw new KettleException( BaseMessages.getString( PKG, "RepositoryMeta.Error.ReadingInfo" ), e ); } } }
RepositoriesMeta { public void readDataFromInputStream( InputStream is ) throws KettleException { clear(); if ( log.isBasic() ) { log.logBasic( BaseMessages.getString( PKG, "RepositoryMeta.Log.ReadingXMLFile", "FromInputStream" ) ); } try { DocumentBuilderFactory dbf = XMLParserFactoryProducer.createSecureDocBuilderFactory(); DocumentBuilder db = dbf.newDocumentBuilder(); Document doc = db.parse( is ); parseRepositoriesDoc( doc ); } catch ( Exception e ) { throw new KettleException( BaseMessages.getString( PKG, "RepositoryMeta.Error.ReadingInfo" ), e ); } } RepositoriesMeta(); }
RepositoriesMeta { public void readDataFromInputStream( InputStream is ) throws KettleException { clear(); if ( log.isBasic() ) { log.logBasic( BaseMessages.getString( PKG, "RepositoryMeta.Log.ReadingXMLFile", "FromInputStream" ) ); } try { DocumentBuilderFactory dbf = XMLParserFactoryProducer.createSecureDocBuilderFactory(); DocumentBuilder db = dbf.newDocumentBuilder(); Document doc = db.parse( is ); parseRepositoriesDoc( doc ); } catch ( Exception e ) { throw new KettleException( BaseMessages.getString( PKG, "RepositoryMeta.Error.ReadingInfo" ), e ); } } RepositoriesMeta(); void clear(); void addDatabase( DatabaseMeta ci ); void addRepository( RepositoryMeta ri ); void addDatabase( int p, DatabaseMeta ci ); void addRepository( int p, RepositoryMeta ri ); DatabaseMeta getDatabase( int i ); RepositoryMeta getRepository( int i ); void removeDatabase( int i ); void removeRepository( int i ); int nrDatabases(); int nrRepositories(); DatabaseMeta searchDatabase( String name ); RepositoryMeta searchRepository( String name ); int indexOfDatabase( DatabaseMeta di ); int indexOfRepository( RepositoryMeta ri ); RepositoryMeta findRepository( String name ); RepositoryMeta findRepositoryById( String id ); boolean readData(); void readDataFromInputStream( InputStream is ); String getXML(); void writeData(); String toString(); RepositoriesMeta clone(); String getErrorMessage(); LogChannelInterface getLog(); }
RepositoriesMeta { public void readDataFromInputStream( InputStream is ) throws KettleException { clear(); if ( log.isBasic() ) { log.logBasic( BaseMessages.getString( PKG, "RepositoryMeta.Log.ReadingXMLFile", "FromInputStream" ) ); } try { DocumentBuilderFactory dbf = XMLParserFactoryProducer.createSecureDocBuilderFactory(); DocumentBuilder db = dbf.newDocumentBuilder(); Document doc = db.parse( is ); parseRepositoriesDoc( doc ); } catch ( Exception e ) { throw new KettleException( BaseMessages.getString( PKG, "RepositoryMeta.Error.ReadingInfo" ), e ); } } RepositoriesMeta(); void clear(); void addDatabase( DatabaseMeta ci ); void addRepository( RepositoryMeta ri ); void addDatabase( int p, DatabaseMeta ci ); void addRepository( int p, RepositoryMeta ri ); DatabaseMeta getDatabase( int i ); RepositoryMeta getRepository( int i ); void removeDatabase( int i ); void removeRepository( int i ); int nrDatabases(); int nrRepositories(); DatabaseMeta searchDatabase( String name ); RepositoryMeta searchRepository( String name ); int indexOfDatabase( DatabaseMeta di ); int indexOfRepository( RepositoryMeta ri ); RepositoryMeta findRepository( String name ); RepositoryMeta findRepositoryById( String id ); boolean readData(); void readDataFromInputStream( InputStream is ); String getXML(); void writeData(); String toString(); RepositoriesMeta clone(); String getErrorMessage(); LogChannelInterface getLog(); }
@Test public void doPurgeUtilDateBeforeTest() throws PurgeDeletionException { IUnifiedRepository mockRepo = mock( IUnifiedRepository.class ); final HashMap<String, List<VersionSummary>> versionListMap = processVersionMap( mockRepo ); UnifiedRepositoryPurgeService purgeService = getPurgeService( mockRepo ); PurgeUtilitySpecification spec = new PurgeUtilitySpecification(); spec.setBeforeDate( getDate( "01/02/2006" ) ); spec.setPath( "/" ); purgeService.doDeleteRevisions( spec ); verifyDateBeforeDeletion( versionListMap, mockRepo, "1", spec.getBeforeDate() ); verifyDateBeforeDeletion( versionListMap, mockRepo, "2", spec.getBeforeDate() ); }
public void doDeleteRevisions( PurgeUtilitySpecification purgeSpecification ) throws PurgeDeletionException { if ( purgeSpecification != null ) { getLogger().setCurrentFilePath( purgeSpecification.getPath() ); logConfiguration( purgeSpecification ); if ( purgeSpecification.getPath() != null && !purgeSpecification.getPath().isEmpty() ) { processRevisionDeletion( purgeSpecification ); } if ( purgeSpecification.isSharedObjects() ) { if ( purgeSpecification.isPurgeFiles() ) { for ( String sharedObjectpath : sharedObjectFolders ) { purgeSpecification.fileFilter = "*"; purgeSpecification.setPath( sharedObjectpath ); processRevisionDeletion( purgeSpecification ); } } else { throw new PurgeDeletionException( "Must purge files before shared objects" ); } } } }
UnifiedRepositoryPurgeService implements IPurgeService { public void doDeleteRevisions( PurgeUtilitySpecification purgeSpecification ) throws PurgeDeletionException { if ( purgeSpecification != null ) { getLogger().setCurrentFilePath( purgeSpecification.getPath() ); logConfiguration( purgeSpecification ); if ( purgeSpecification.getPath() != null && !purgeSpecification.getPath().isEmpty() ) { processRevisionDeletion( purgeSpecification ); } if ( purgeSpecification.isSharedObjects() ) { if ( purgeSpecification.isPurgeFiles() ) { for ( String sharedObjectpath : sharedObjectFolders ) { purgeSpecification.fileFilter = "*"; purgeSpecification.setPath( sharedObjectpath ); processRevisionDeletion( purgeSpecification ); } } else { throw new PurgeDeletionException( "Must purge files before shared objects" ); } } } } }
UnifiedRepositoryPurgeService implements IPurgeService { public void doDeleteRevisions( PurgeUtilitySpecification purgeSpecification ) throws PurgeDeletionException { if ( purgeSpecification != null ) { getLogger().setCurrentFilePath( purgeSpecification.getPath() ); logConfiguration( purgeSpecification ); if ( purgeSpecification.getPath() != null && !purgeSpecification.getPath().isEmpty() ) { processRevisionDeletion( purgeSpecification ); } if ( purgeSpecification.isSharedObjects() ) { if ( purgeSpecification.isPurgeFiles() ) { for ( String sharedObjectpath : sharedObjectFolders ) { purgeSpecification.fileFilter = "*"; purgeSpecification.setPath( sharedObjectpath ); processRevisionDeletion( purgeSpecification ); } } else { throw new PurgeDeletionException( "Must purge files before shared objects" ); } } } } UnifiedRepositoryPurgeService( IUnifiedRepository unifiedRepository ); }
UnifiedRepositoryPurgeService implements IPurgeService { public void doDeleteRevisions( PurgeUtilitySpecification purgeSpecification ) throws PurgeDeletionException { if ( purgeSpecification != null ) { getLogger().setCurrentFilePath( purgeSpecification.getPath() ); logConfiguration( purgeSpecification ); if ( purgeSpecification.getPath() != null && !purgeSpecification.getPath().isEmpty() ) { processRevisionDeletion( purgeSpecification ); } if ( purgeSpecification.isSharedObjects() ) { if ( purgeSpecification.isPurgeFiles() ) { for ( String sharedObjectpath : sharedObjectFolders ) { purgeSpecification.fileFilter = "*"; purgeSpecification.setPath( sharedObjectpath ); processRevisionDeletion( purgeSpecification ); } } else { throw new PurgeDeletionException( "Must purge files before shared objects" ); } } } } UnifiedRepositoryPurgeService( IUnifiedRepository unifiedRepository ); @Override void deleteVersionsBeforeDate( RepositoryElementInterface element, Date beforeDate ); @Override void deleteVersionsBeforeDate( Serializable fileId, Date beforeDate ); @Override void deleteAllVersions( RepositoryElementInterface element ); @Override void deleteAllVersions( Serializable fileId ); @Override void deleteVersion( RepositoryElementInterface element, String versionId ); @Override void deleteVersion( Serializable fileId, Serializable versionId ); @Override void keepNumberOfVersions( RepositoryElementInterface element, int versionCount ); @Override void keepNumberOfVersions( Serializable fileId, int versionCount ); void doDeleteRevisions( PurgeUtilitySpecification purgeSpecification ); static DefaultUnifiedRepositoryWebService getRepoWs(); }
UnifiedRepositoryPurgeService implements IPurgeService { public void doDeleteRevisions( PurgeUtilitySpecification purgeSpecification ) throws PurgeDeletionException { if ( purgeSpecification != null ) { getLogger().setCurrentFilePath( purgeSpecification.getPath() ); logConfiguration( purgeSpecification ); if ( purgeSpecification.getPath() != null && !purgeSpecification.getPath().isEmpty() ) { processRevisionDeletion( purgeSpecification ); } if ( purgeSpecification.isSharedObjects() ) { if ( purgeSpecification.isPurgeFiles() ) { for ( String sharedObjectpath : sharedObjectFolders ) { purgeSpecification.fileFilter = "*"; purgeSpecification.setPath( sharedObjectpath ); processRevisionDeletion( purgeSpecification ); } } else { throw new PurgeDeletionException( "Must purge files before shared objects" ); } } } } UnifiedRepositoryPurgeService( IUnifiedRepository unifiedRepository ); @Override void deleteVersionsBeforeDate( RepositoryElementInterface element, Date beforeDate ); @Override void deleteVersionsBeforeDate( Serializable fileId, Date beforeDate ); @Override void deleteAllVersions( RepositoryElementInterface element ); @Override void deleteAllVersions( Serializable fileId ); @Override void deleteVersion( RepositoryElementInterface element, String versionId ); @Override void deleteVersion( Serializable fileId, Serializable versionId ); @Override void keepNumberOfVersions( RepositoryElementInterface element, int versionCount ); @Override void keepNumberOfVersions( Serializable fileId, int versionCount ); void doDeleteRevisions( PurgeUtilitySpecification purgeSpecification ); static DefaultUnifiedRepositoryWebService getRepoWs(); static DefaultUnifiedRepositoryWebService repoWs; }
@Test public void testGetPlugins() throws Exception { String plugins = controller.getPlugins(); assertEquals( "[{\"name\":\"PLUGIN NAME\",\"description\":\"PLUGIN DESCRIPTION\",\"id\":\"ID\"}]", plugins ); }
@SuppressWarnings( "unchecked" ) public String getPlugins() { List<PluginInterface> plugins = pluginRegistry.getPlugins( RepositoryPluginType.class ); JSONArray list = new JSONArray(); for ( PluginInterface pluginInterface : plugins ) { if ( !pluginInterface.getIds()[0].equals( "PentahoEnterpriseRepository" ) ) { JSONObject repoJSON = new JSONObject(); repoJSON.put( "id", pluginInterface.getIds()[ 0 ] ); repoJSON.put( "name", pluginInterface.getName() ); repoJSON.put( "description", pluginInterface.getDescription() ); list.add( repoJSON ); } } return list.toString(); }
RepositoryConnectController { @SuppressWarnings( "unchecked" ) public String getPlugins() { List<PluginInterface> plugins = pluginRegistry.getPlugins( RepositoryPluginType.class ); JSONArray list = new JSONArray(); for ( PluginInterface pluginInterface : plugins ) { if ( !pluginInterface.getIds()[0].equals( "PentahoEnterpriseRepository" ) ) { JSONObject repoJSON = new JSONObject(); repoJSON.put( "id", pluginInterface.getIds()[ 0 ] ); repoJSON.put( "name", pluginInterface.getName() ); repoJSON.put( "description", pluginInterface.getDescription() ); list.add( repoJSON ); } } return list.toString(); } }
RepositoryConnectController { @SuppressWarnings( "unchecked" ) public String getPlugins() { List<PluginInterface> plugins = pluginRegistry.getPlugins( RepositoryPluginType.class ); JSONArray list = new JSONArray(); for ( PluginInterface pluginInterface : plugins ) { if ( !pluginInterface.getIds()[0].equals( "PentahoEnterpriseRepository" ) ) { JSONObject repoJSON = new JSONObject(); repoJSON.put( "id", pluginInterface.getIds()[ 0 ] ); repoJSON.put( "name", pluginInterface.getName() ); repoJSON.put( "description", pluginInterface.getDescription() ); list.add( repoJSON ); } } return list.toString(); } RepositoryConnectController( PluginRegistry pluginRegistry, Supplier<Spoon> spoonSupplier, RepositoriesMeta repositoriesMeta ); RepositoryConnectController(); }
RepositoryConnectController { @SuppressWarnings( "unchecked" ) public String getPlugins() { List<PluginInterface> plugins = pluginRegistry.getPlugins( RepositoryPluginType.class ); JSONArray list = new JSONArray(); for ( PluginInterface pluginInterface : plugins ) { if ( !pluginInterface.getIds()[0].equals( "PentahoEnterpriseRepository" ) ) { JSONObject repoJSON = new JSONObject(); repoJSON.put( "id", pluginInterface.getIds()[ 0 ] ); repoJSON.put( "name", pluginInterface.getName() ); repoJSON.put( "description", pluginInterface.getDescription() ); list.add( repoJSON ); } } return list.toString(); } RepositoryConnectController( PluginRegistry pluginRegistry, Supplier<Spoon> spoonSupplier, RepositoriesMeta repositoriesMeta ); RepositoryConnectController(); @SuppressWarnings( "unchecked" ) String getPlugins(); boolean createRepository( String id, Map<String, Object> items ); @SuppressWarnings( "unchecked" ) String getRepositories(); String getRepository( String name ); DatabaseMeta getDatabase( String name ); void removeDatabase( String name ); @SuppressWarnings( "unchecked" ) String getDatabases(); void connectToRepository(); void connectToRepository( String username, String password ); void connectToRepository( RepositoryMeta repositoryMeta ); void connectToRepository( RepositoryMeta repositoryMeta, String username, String password ); void reconnectToRepository( String username, String password ); boolean deleteRepository( String name ); void addDatabase( DatabaseMeta databaseMeta ); boolean setDefaultRepository( String name ); String getDefaultUrl(); String getCurrentUser(); void setCurrentRepository( RepositoryMeta repositoryMeta ); RepositoryMeta getCurrentRepository(); RepositoryMeta getConnectedRepository(); void setConnectedRepository( RepositoryMeta connectedRepository ); RepositoryMeta getDefaultRepositoryMeta(); RepositoryMeta getRepositoryMetaByName( String name ); boolean isConnected( String name ); boolean isConnected(); Repository getConnectedRepositoryInstance(); void save(); PropsUI getPropsUI(); void addListener( RepositoryContollerListener listener ); void fireListeners(); boolean isRelogin(); void setRelogin( boolean relogin ); Map<String, Object> modelToMap( RepositoryModel model ); }
RepositoryConnectController { @SuppressWarnings( "unchecked" ) public String getPlugins() { List<PluginInterface> plugins = pluginRegistry.getPlugins( RepositoryPluginType.class ); JSONArray list = new JSONArray(); for ( PluginInterface pluginInterface : plugins ) { if ( !pluginInterface.getIds()[0].equals( "PentahoEnterpriseRepository" ) ) { JSONObject repoJSON = new JSONObject(); repoJSON.put( "id", pluginInterface.getIds()[ 0 ] ); repoJSON.put( "name", pluginInterface.getName() ); repoJSON.put( "description", pluginInterface.getDescription() ); list.add( repoJSON ); } } return list.toString(); } RepositoryConnectController( PluginRegistry pluginRegistry, Supplier<Spoon> spoonSupplier, RepositoriesMeta repositoriesMeta ); RepositoryConnectController(); @SuppressWarnings( "unchecked" ) String getPlugins(); boolean createRepository( String id, Map<String, Object> items ); @SuppressWarnings( "unchecked" ) String getRepositories(); String getRepository( String name ); DatabaseMeta getDatabase( String name ); void removeDatabase( String name ); @SuppressWarnings( "unchecked" ) String getDatabases(); void connectToRepository(); void connectToRepository( String username, String password ); void connectToRepository( RepositoryMeta repositoryMeta ); void connectToRepository( RepositoryMeta repositoryMeta, String username, String password ); void reconnectToRepository( String username, String password ); boolean deleteRepository( String name ); void addDatabase( DatabaseMeta databaseMeta ); boolean setDefaultRepository( String name ); String getDefaultUrl(); String getCurrentUser(); void setCurrentRepository( RepositoryMeta repositoryMeta ); RepositoryMeta getCurrentRepository(); RepositoryMeta getConnectedRepository(); void setConnectedRepository( RepositoryMeta connectedRepository ); RepositoryMeta getDefaultRepositoryMeta(); RepositoryMeta getRepositoryMetaByName( String name ); boolean isConnected( String name ); boolean isConnected(); Repository getConnectedRepositoryInstance(); void save(); PropsUI getPropsUI(); void addListener( RepositoryContollerListener listener ); void fireListeners(); boolean isRelogin(); void setRelogin( boolean relogin ); Map<String, Object> modelToMap( RepositoryModel model ); static final String DISPLAY_NAME; static final String DESCRIPTION; static final String IS_DEFAULT; static final String URL; static final String DATABASE_CONNECTION; static final String SHOW_HIDDEN_FOLDERS; static final String LOCATION; static final String DO_NOT_MODIFY; static final String DEFAULT_URL; static final String ERROR_401; }
@Test public void testCreateRepository() throws Exception { String id = ID; Map<String, Object> items = new HashMap<>(); when( pluginRegistry.loadClass( RepositoryPluginType.class, id, RepositoryMeta.class ) ) .thenReturn( repositoryMeta ); when( pluginRegistry.loadClass( RepositoryPluginType.class, repositoryMeta.getId(), Repository.class ) ) .thenReturn( repository ); when( repository.test() ).thenReturn( true ); boolean result = controller.createRepository( id, items ); assertEquals( true, result ); when( repository.test() ).thenReturn( false ); result = controller.createRepository( id, items ); assertEquals( false, result ); when( repository.test() ).thenReturn( true ); doThrow( new KettleException() ).when( repositoriesMeta ).writeData(); result = controller.createRepository( id, items ); assertEquals( false, result ); }
public boolean createRepository( String id, Map<String, Object> items ) { try { RepositoryMeta repositoryMeta = pluginRegistry.loadClass( RepositoryPluginType.class, id, RepositoryMeta.class ); repositoryMeta.populate( items, repositoriesMeta ); if ( repositoryMeta.getName() != null ) { Repository repository = pluginRegistry.loadClass( RepositoryPluginType.class, repositoryMeta.getId(), Repository.class ); repository.init( repositoryMeta ); if ( currentRepository != null ) { if ( isCompatibleRepositoryEdit( repositoryMeta ) ) { setConnectedRepository( repositoryMeta ); } repositoriesMeta.removeRepository( repositoriesMeta.indexOfRepository( currentRepository ) ); } repositoriesMeta.addRepository( repositoryMeta ); repositoriesMeta.writeData(); currentRepository = repositoryMeta; if ( !testRepository( repository ) ) { return false; } ( (AbstractRepository) repository ).create(); } } catch ( KettleException ke ) { log.logError( "Unable to load repository type", ke ); return false; } return true; }
RepositoryConnectController { public boolean createRepository( String id, Map<String, Object> items ) { try { RepositoryMeta repositoryMeta = pluginRegistry.loadClass( RepositoryPluginType.class, id, RepositoryMeta.class ); repositoryMeta.populate( items, repositoriesMeta ); if ( repositoryMeta.getName() != null ) { Repository repository = pluginRegistry.loadClass( RepositoryPluginType.class, repositoryMeta.getId(), Repository.class ); repository.init( repositoryMeta ); if ( currentRepository != null ) { if ( isCompatibleRepositoryEdit( repositoryMeta ) ) { setConnectedRepository( repositoryMeta ); } repositoriesMeta.removeRepository( repositoriesMeta.indexOfRepository( currentRepository ) ); } repositoriesMeta.addRepository( repositoryMeta ); repositoriesMeta.writeData(); currentRepository = repositoryMeta; if ( !testRepository( repository ) ) { return false; } ( (AbstractRepository) repository ).create(); } } catch ( KettleException ke ) { log.logError( "Unable to load repository type", ke ); return false; } return true; } }
RepositoryConnectController { public boolean createRepository( String id, Map<String, Object> items ) { try { RepositoryMeta repositoryMeta = pluginRegistry.loadClass( RepositoryPluginType.class, id, RepositoryMeta.class ); repositoryMeta.populate( items, repositoriesMeta ); if ( repositoryMeta.getName() != null ) { Repository repository = pluginRegistry.loadClass( RepositoryPluginType.class, repositoryMeta.getId(), Repository.class ); repository.init( repositoryMeta ); if ( currentRepository != null ) { if ( isCompatibleRepositoryEdit( repositoryMeta ) ) { setConnectedRepository( repositoryMeta ); } repositoriesMeta.removeRepository( repositoriesMeta.indexOfRepository( currentRepository ) ); } repositoriesMeta.addRepository( repositoryMeta ); repositoriesMeta.writeData(); currentRepository = repositoryMeta; if ( !testRepository( repository ) ) { return false; } ( (AbstractRepository) repository ).create(); } } catch ( KettleException ke ) { log.logError( "Unable to load repository type", ke ); return false; } return true; } RepositoryConnectController( PluginRegistry pluginRegistry, Supplier<Spoon> spoonSupplier, RepositoriesMeta repositoriesMeta ); RepositoryConnectController(); }
RepositoryConnectController { public boolean createRepository( String id, Map<String, Object> items ) { try { RepositoryMeta repositoryMeta = pluginRegistry.loadClass( RepositoryPluginType.class, id, RepositoryMeta.class ); repositoryMeta.populate( items, repositoriesMeta ); if ( repositoryMeta.getName() != null ) { Repository repository = pluginRegistry.loadClass( RepositoryPluginType.class, repositoryMeta.getId(), Repository.class ); repository.init( repositoryMeta ); if ( currentRepository != null ) { if ( isCompatibleRepositoryEdit( repositoryMeta ) ) { setConnectedRepository( repositoryMeta ); } repositoriesMeta.removeRepository( repositoriesMeta.indexOfRepository( currentRepository ) ); } repositoriesMeta.addRepository( repositoryMeta ); repositoriesMeta.writeData(); currentRepository = repositoryMeta; if ( !testRepository( repository ) ) { return false; } ( (AbstractRepository) repository ).create(); } } catch ( KettleException ke ) { log.logError( "Unable to load repository type", ke ); return false; } return true; } RepositoryConnectController( PluginRegistry pluginRegistry, Supplier<Spoon> spoonSupplier, RepositoriesMeta repositoriesMeta ); RepositoryConnectController(); @SuppressWarnings( "unchecked" ) String getPlugins(); boolean createRepository( String id, Map<String, Object> items ); @SuppressWarnings( "unchecked" ) String getRepositories(); String getRepository( String name ); DatabaseMeta getDatabase( String name ); void removeDatabase( String name ); @SuppressWarnings( "unchecked" ) String getDatabases(); void connectToRepository(); void connectToRepository( String username, String password ); void connectToRepository( RepositoryMeta repositoryMeta ); void connectToRepository( RepositoryMeta repositoryMeta, String username, String password ); void reconnectToRepository( String username, String password ); boolean deleteRepository( String name ); void addDatabase( DatabaseMeta databaseMeta ); boolean setDefaultRepository( String name ); String getDefaultUrl(); String getCurrentUser(); void setCurrentRepository( RepositoryMeta repositoryMeta ); RepositoryMeta getCurrentRepository(); RepositoryMeta getConnectedRepository(); void setConnectedRepository( RepositoryMeta connectedRepository ); RepositoryMeta getDefaultRepositoryMeta(); RepositoryMeta getRepositoryMetaByName( String name ); boolean isConnected( String name ); boolean isConnected(); Repository getConnectedRepositoryInstance(); void save(); PropsUI getPropsUI(); void addListener( RepositoryContollerListener listener ); void fireListeners(); boolean isRelogin(); void setRelogin( boolean relogin ); Map<String, Object> modelToMap( RepositoryModel model ); }
RepositoryConnectController { public boolean createRepository( String id, Map<String, Object> items ) { try { RepositoryMeta repositoryMeta = pluginRegistry.loadClass( RepositoryPluginType.class, id, RepositoryMeta.class ); repositoryMeta.populate( items, repositoriesMeta ); if ( repositoryMeta.getName() != null ) { Repository repository = pluginRegistry.loadClass( RepositoryPluginType.class, repositoryMeta.getId(), Repository.class ); repository.init( repositoryMeta ); if ( currentRepository != null ) { if ( isCompatibleRepositoryEdit( repositoryMeta ) ) { setConnectedRepository( repositoryMeta ); } repositoriesMeta.removeRepository( repositoriesMeta.indexOfRepository( currentRepository ) ); } repositoriesMeta.addRepository( repositoryMeta ); repositoriesMeta.writeData(); currentRepository = repositoryMeta; if ( !testRepository( repository ) ) { return false; } ( (AbstractRepository) repository ).create(); } } catch ( KettleException ke ) { log.logError( "Unable to load repository type", ke ); return false; } return true; } RepositoryConnectController( PluginRegistry pluginRegistry, Supplier<Spoon> spoonSupplier, RepositoriesMeta repositoriesMeta ); RepositoryConnectController(); @SuppressWarnings( "unchecked" ) String getPlugins(); boolean createRepository( String id, Map<String, Object> items ); @SuppressWarnings( "unchecked" ) String getRepositories(); String getRepository( String name ); DatabaseMeta getDatabase( String name ); void removeDatabase( String name ); @SuppressWarnings( "unchecked" ) String getDatabases(); void connectToRepository(); void connectToRepository( String username, String password ); void connectToRepository( RepositoryMeta repositoryMeta ); void connectToRepository( RepositoryMeta repositoryMeta, String username, String password ); void reconnectToRepository( String username, String password ); boolean deleteRepository( String name ); void addDatabase( DatabaseMeta databaseMeta ); boolean setDefaultRepository( String name ); String getDefaultUrl(); String getCurrentUser(); void setCurrentRepository( RepositoryMeta repositoryMeta ); RepositoryMeta getCurrentRepository(); RepositoryMeta getConnectedRepository(); void setConnectedRepository( RepositoryMeta connectedRepository ); RepositoryMeta getDefaultRepositoryMeta(); RepositoryMeta getRepositoryMetaByName( String name ); boolean isConnected( String name ); boolean isConnected(); Repository getConnectedRepositoryInstance(); void save(); PropsUI getPropsUI(); void addListener( RepositoryContollerListener listener ); void fireListeners(); boolean isRelogin(); void setRelogin( boolean relogin ); Map<String, Object> modelToMap( RepositoryModel model ); static final String DISPLAY_NAME; static final String DESCRIPTION; static final String IS_DEFAULT; static final String URL; static final String DATABASE_CONNECTION; static final String SHOW_HIDDEN_FOLDERS; static final String LOCATION; static final String DO_NOT_MODIFY; static final String DEFAULT_URL; static final String ERROR_401; }
@Test public void testGetRepositories() { when( repositoriesMeta.nrRepositories() ).thenReturn( 1 ); when( repositoriesMeta.getRepository( 0 ) ).thenReturn( repositoryMeta ); JSONObject json = new JSONObject(); json.put( "displayName", REPOSITORY_NAME ); json.put( "isDefault", false ); json.put( "description", REPOSITORY_DESCRIPTION ); json.put( "id", REPOSITORY_ID ); when( repositoryMeta.toJSONObject() ).thenReturn( json ); String repositories = controller.getRepositories(); assertEquals( "[{\"isDefault\":false,\"displayName\":\"Repository Name\",\"description\":\"Repository Description\"," + "\"id\":\"Repository ID\"}]", repositories ); }
@SuppressWarnings( "unchecked" ) public String getRepositories() { JSONArray list = new JSONArray(); if ( repositoriesMeta != null ) { for ( int i = 0; i < repositoriesMeta.nrRepositories(); i++ ) { list.add( repositoriesMeta.getRepository( i ).toJSONObject() ); } } return list.toString(); }
RepositoryConnectController { @SuppressWarnings( "unchecked" ) public String getRepositories() { JSONArray list = new JSONArray(); if ( repositoriesMeta != null ) { for ( int i = 0; i < repositoriesMeta.nrRepositories(); i++ ) { list.add( repositoriesMeta.getRepository( i ).toJSONObject() ); } } return list.toString(); } }
RepositoryConnectController { @SuppressWarnings( "unchecked" ) public String getRepositories() { JSONArray list = new JSONArray(); if ( repositoriesMeta != null ) { for ( int i = 0; i < repositoriesMeta.nrRepositories(); i++ ) { list.add( repositoriesMeta.getRepository( i ).toJSONObject() ); } } return list.toString(); } RepositoryConnectController( PluginRegistry pluginRegistry, Supplier<Spoon> spoonSupplier, RepositoriesMeta repositoriesMeta ); RepositoryConnectController(); }
RepositoryConnectController { @SuppressWarnings( "unchecked" ) public String getRepositories() { JSONArray list = new JSONArray(); if ( repositoriesMeta != null ) { for ( int i = 0; i < repositoriesMeta.nrRepositories(); i++ ) { list.add( repositoriesMeta.getRepository( i ).toJSONObject() ); } } return list.toString(); } RepositoryConnectController( PluginRegistry pluginRegistry, Supplier<Spoon> spoonSupplier, RepositoriesMeta repositoriesMeta ); RepositoryConnectController(); @SuppressWarnings( "unchecked" ) String getPlugins(); boolean createRepository( String id, Map<String, Object> items ); @SuppressWarnings( "unchecked" ) String getRepositories(); String getRepository( String name ); DatabaseMeta getDatabase( String name ); void removeDatabase( String name ); @SuppressWarnings( "unchecked" ) String getDatabases(); void connectToRepository(); void connectToRepository( String username, String password ); void connectToRepository( RepositoryMeta repositoryMeta ); void connectToRepository( RepositoryMeta repositoryMeta, String username, String password ); void reconnectToRepository( String username, String password ); boolean deleteRepository( String name ); void addDatabase( DatabaseMeta databaseMeta ); boolean setDefaultRepository( String name ); String getDefaultUrl(); String getCurrentUser(); void setCurrentRepository( RepositoryMeta repositoryMeta ); RepositoryMeta getCurrentRepository(); RepositoryMeta getConnectedRepository(); void setConnectedRepository( RepositoryMeta connectedRepository ); RepositoryMeta getDefaultRepositoryMeta(); RepositoryMeta getRepositoryMetaByName( String name ); boolean isConnected( String name ); boolean isConnected(); Repository getConnectedRepositoryInstance(); void save(); PropsUI getPropsUI(); void addListener( RepositoryContollerListener listener ); void fireListeners(); boolean isRelogin(); void setRelogin( boolean relogin ); Map<String, Object> modelToMap( RepositoryModel model ); }
RepositoryConnectController { @SuppressWarnings( "unchecked" ) public String getRepositories() { JSONArray list = new JSONArray(); if ( repositoriesMeta != null ) { for ( int i = 0; i < repositoriesMeta.nrRepositories(); i++ ) { list.add( repositoriesMeta.getRepository( i ).toJSONObject() ); } } return list.toString(); } RepositoryConnectController( PluginRegistry pluginRegistry, Supplier<Spoon> spoonSupplier, RepositoriesMeta repositoriesMeta ); RepositoryConnectController(); @SuppressWarnings( "unchecked" ) String getPlugins(); boolean createRepository( String id, Map<String, Object> items ); @SuppressWarnings( "unchecked" ) String getRepositories(); String getRepository( String name ); DatabaseMeta getDatabase( String name ); void removeDatabase( String name ); @SuppressWarnings( "unchecked" ) String getDatabases(); void connectToRepository(); void connectToRepository( String username, String password ); void connectToRepository( RepositoryMeta repositoryMeta ); void connectToRepository( RepositoryMeta repositoryMeta, String username, String password ); void reconnectToRepository( String username, String password ); boolean deleteRepository( String name ); void addDatabase( DatabaseMeta databaseMeta ); boolean setDefaultRepository( String name ); String getDefaultUrl(); String getCurrentUser(); void setCurrentRepository( RepositoryMeta repositoryMeta ); RepositoryMeta getCurrentRepository(); RepositoryMeta getConnectedRepository(); void setConnectedRepository( RepositoryMeta connectedRepository ); RepositoryMeta getDefaultRepositoryMeta(); RepositoryMeta getRepositoryMetaByName( String name ); boolean isConnected( String name ); boolean isConnected(); Repository getConnectedRepositoryInstance(); void save(); PropsUI getPropsUI(); void addListener( RepositoryContollerListener listener ); void fireListeners(); boolean isRelogin(); void setRelogin( boolean relogin ); Map<String, Object> modelToMap( RepositoryModel model ); static final String DISPLAY_NAME; static final String DESCRIPTION; static final String IS_DEFAULT; static final String URL; static final String DATABASE_CONNECTION; static final String SHOW_HIDDEN_FOLDERS; static final String LOCATION; static final String DO_NOT_MODIFY; static final String DEFAULT_URL; static final String ERROR_401; }
@Test public void testConnectToRepository() throws Exception { when( pluginRegistry.loadClass( RepositoryPluginType.class, repositoryMeta.getId(), Repository.class ) ) .thenReturn( repository ); controller.setCurrentRepository( repositoryMeta ); controller.connectToRepository(); verify( repository ).init( repositoryMeta ); verify( repository ).connect( null, null ); }
public void connectToRepository() throws KettleException { connectToRepository( currentRepository ); }
RepositoryConnectController { public void connectToRepository() throws KettleException { connectToRepository( currentRepository ); } }
RepositoryConnectController { public void connectToRepository() throws KettleException { connectToRepository( currentRepository ); } RepositoryConnectController( PluginRegistry pluginRegistry, Supplier<Spoon> spoonSupplier, RepositoriesMeta repositoriesMeta ); RepositoryConnectController(); }
RepositoryConnectController { public void connectToRepository() throws KettleException { connectToRepository( currentRepository ); } RepositoryConnectController( PluginRegistry pluginRegistry, Supplier<Spoon> spoonSupplier, RepositoriesMeta repositoriesMeta ); RepositoryConnectController(); @SuppressWarnings( "unchecked" ) String getPlugins(); boolean createRepository( String id, Map<String, Object> items ); @SuppressWarnings( "unchecked" ) String getRepositories(); String getRepository( String name ); DatabaseMeta getDatabase( String name ); void removeDatabase( String name ); @SuppressWarnings( "unchecked" ) String getDatabases(); void connectToRepository(); void connectToRepository( String username, String password ); void connectToRepository( RepositoryMeta repositoryMeta ); void connectToRepository( RepositoryMeta repositoryMeta, String username, String password ); void reconnectToRepository( String username, String password ); boolean deleteRepository( String name ); void addDatabase( DatabaseMeta databaseMeta ); boolean setDefaultRepository( String name ); String getDefaultUrl(); String getCurrentUser(); void setCurrentRepository( RepositoryMeta repositoryMeta ); RepositoryMeta getCurrentRepository(); RepositoryMeta getConnectedRepository(); void setConnectedRepository( RepositoryMeta connectedRepository ); RepositoryMeta getDefaultRepositoryMeta(); RepositoryMeta getRepositoryMetaByName( String name ); boolean isConnected( String name ); boolean isConnected(); Repository getConnectedRepositoryInstance(); void save(); PropsUI getPropsUI(); void addListener( RepositoryContollerListener listener ); void fireListeners(); boolean isRelogin(); void setRelogin( boolean relogin ); Map<String, Object> modelToMap( RepositoryModel model ); }
RepositoryConnectController { public void connectToRepository() throws KettleException { connectToRepository( currentRepository ); } RepositoryConnectController( PluginRegistry pluginRegistry, Supplier<Spoon> spoonSupplier, RepositoriesMeta repositoriesMeta ); RepositoryConnectController(); @SuppressWarnings( "unchecked" ) String getPlugins(); boolean createRepository( String id, Map<String, Object> items ); @SuppressWarnings( "unchecked" ) String getRepositories(); String getRepository( String name ); DatabaseMeta getDatabase( String name ); void removeDatabase( String name ); @SuppressWarnings( "unchecked" ) String getDatabases(); void connectToRepository(); void connectToRepository( String username, String password ); void connectToRepository( RepositoryMeta repositoryMeta ); void connectToRepository( RepositoryMeta repositoryMeta, String username, String password ); void reconnectToRepository( String username, String password ); boolean deleteRepository( String name ); void addDatabase( DatabaseMeta databaseMeta ); boolean setDefaultRepository( String name ); String getDefaultUrl(); String getCurrentUser(); void setCurrentRepository( RepositoryMeta repositoryMeta ); RepositoryMeta getCurrentRepository(); RepositoryMeta getConnectedRepository(); void setConnectedRepository( RepositoryMeta connectedRepository ); RepositoryMeta getDefaultRepositoryMeta(); RepositoryMeta getRepositoryMetaByName( String name ); boolean isConnected( String name ); boolean isConnected(); Repository getConnectedRepositoryInstance(); void save(); PropsUI getPropsUI(); void addListener( RepositoryContollerListener listener ); void fireListeners(); boolean isRelogin(); void setRelogin( boolean relogin ); Map<String, Object> modelToMap( RepositoryModel model ); static final String DISPLAY_NAME; static final String DESCRIPTION; static final String IS_DEFAULT; static final String URL; static final String DATABASE_CONNECTION; static final String SHOW_HIDDEN_FOLDERS; static final String LOCATION; static final String DO_NOT_MODIFY; static final String DEFAULT_URL; static final String ERROR_401; }
@Test public void testGetDatabases() throws Exception { when( repositoriesMeta.nrDatabases() ).thenReturn( 1 ); when( repositoriesMeta.getDatabase( 0 ) ).thenReturn( databaseMeta ); when( databaseMeta.getName() ).thenReturn( DATABASE_NAME ); String databases = controller.getDatabases(); assertEquals( "[{\"name\":\"DATABASE NAME\"}]", databases ); }
@SuppressWarnings( "unchecked" ) public String getDatabases() { JSONArray list = new JSONArray(); for ( int i = 0; i < repositoriesMeta.nrDatabases(); i++ ) { JSONObject databaseJSON = new JSONObject(); databaseJSON.put( "name", repositoriesMeta.getDatabase( i ).getName() ); list.add( databaseJSON ); } return list.toString(); }
RepositoryConnectController { @SuppressWarnings( "unchecked" ) public String getDatabases() { JSONArray list = new JSONArray(); for ( int i = 0; i < repositoriesMeta.nrDatabases(); i++ ) { JSONObject databaseJSON = new JSONObject(); databaseJSON.put( "name", repositoriesMeta.getDatabase( i ).getName() ); list.add( databaseJSON ); } return list.toString(); } }
RepositoryConnectController { @SuppressWarnings( "unchecked" ) public String getDatabases() { JSONArray list = new JSONArray(); for ( int i = 0; i < repositoriesMeta.nrDatabases(); i++ ) { JSONObject databaseJSON = new JSONObject(); databaseJSON.put( "name", repositoriesMeta.getDatabase( i ).getName() ); list.add( databaseJSON ); } return list.toString(); } RepositoryConnectController( PluginRegistry pluginRegistry, Supplier<Spoon> spoonSupplier, RepositoriesMeta repositoriesMeta ); RepositoryConnectController(); }
RepositoryConnectController { @SuppressWarnings( "unchecked" ) public String getDatabases() { JSONArray list = new JSONArray(); for ( int i = 0; i < repositoriesMeta.nrDatabases(); i++ ) { JSONObject databaseJSON = new JSONObject(); databaseJSON.put( "name", repositoriesMeta.getDatabase( i ).getName() ); list.add( databaseJSON ); } return list.toString(); } RepositoryConnectController( PluginRegistry pluginRegistry, Supplier<Spoon> spoonSupplier, RepositoriesMeta repositoriesMeta ); RepositoryConnectController(); @SuppressWarnings( "unchecked" ) String getPlugins(); boolean createRepository( String id, Map<String, Object> items ); @SuppressWarnings( "unchecked" ) String getRepositories(); String getRepository( String name ); DatabaseMeta getDatabase( String name ); void removeDatabase( String name ); @SuppressWarnings( "unchecked" ) String getDatabases(); void connectToRepository(); void connectToRepository( String username, String password ); void connectToRepository( RepositoryMeta repositoryMeta ); void connectToRepository( RepositoryMeta repositoryMeta, String username, String password ); void reconnectToRepository( String username, String password ); boolean deleteRepository( String name ); void addDatabase( DatabaseMeta databaseMeta ); boolean setDefaultRepository( String name ); String getDefaultUrl(); String getCurrentUser(); void setCurrentRepository( RepositoryMeta repositoryMeta ); RepositoryMeta getCurrentRepository(); RepositoryMeta getConnectedRepository(); void setConnectedRepository( RepositoryMeta connectedRepository ); RepositoryMeta getDefaultRepositoryMeta(); RepositoryMeta getRepositoryMetaByName( String name ); boolean isConnected( String name ); boolean isConnected(); Repository getConnectedRepositoryInstance(); void save(); PropsUI getPropsUI(); void addListener( RepositoryContollerListener listener ); void fireListeners(); boolean isRelogin(); void setRelogin( boolean relogin ); Map<String, Object> modelToMap( RepositoryModel model ); }
RepositoryConnectController { @SuppressWarnings( "unchecked" ) public String getDatabases() { JSONArray list = new JSONArray(); for ( int i = 0; i < repositoriesMeta.nrDatabases(); i++ ) { JSONObject databaseJSON = new JSONObject(); databaseJSON.put( "name", repositoriesMeta.getDatabase( i ).getName() ); list.add( databaseJSON ); } return list.toString(); } RepositoryConnectController( PluginRegistry pluginRegistry, Supplier<Spoon> spoonSupplier, RepositoriesMeta repositoriesMeta ); RepositoryConnectController(); @SuppressWarnings( "unchecked" ) String getPlugins(); boolean createRepository( String id, Map<String, Object> items ); @SuppressWarnings( "unchecked" ) String getRepositories(); String getRepository( String name ); DatabaseMeta getDatabase( String name ); void removeDatabase( String name ); @SuppressWarnings( "unchecked" ) String getDatabases(); void connectToRepository(); void connectToRepository( String username, String password ); void connectToRepository( RepositoryMeta repositoryMeta ); void connectToRepository( RepositoryMeta repositoryMeta, String username, String password ); void reconnectToRepository( String username, String password ); boolean deleteRepository( String name ); void addDatabase( DatabaseMeta databaseMeta ); boolean setDefaultRepository( String name ); String getDefaultUrl(); String getCurrentUser(); void setCurrentRepository( RepositoryMeta repositoryMeta ); RepositoryMeta getCurrentRepository(); RepositoryMeta getConnectedRepository(); void setConnectedRepository( RepositoryMeta connectedRepository ); RepositoryMeta getDefaultRepositoryMeta(); RepositoryMeta getRepositoryMetaByName( String name ); boolean isConnected( String name ); boolean isConnected(); Repository getConnectedRepositoryInstance(); void save(); PropsUI getPropsUI(); void addListener( RepositoryContollerListener listener ); void fireListeners(); boolean isRelogin(); void setRelogin( boolean relogin ); Map<String, Object> modelToMap( RepositoryModel model ); static final String DISPLAY_NAME; static final String DESCRIPTION; static final String IS_DEFAULT; static final String URL; static final String DATABASE_CONNECTION; static final String SHOW_HIDDEN_FOLDERS; static final String LOCATION; static final String DO_NOT_MODIFY; static final String DEFAULT_URL; static final String ERROR_401; }
@Test public void testDeleteRepository() throws Exception { int index = 1; when( repositoriesMeta.findRepository( REPOSITORY_NAME ) ).thenReturn( repositoryMeta ); when( repositoriesMeta.indexOfRepository( repositoryMeta ) ).thenReturn( index ); when( repositoriesMeta.getRepository( index ) ).thenReturn( repositoryMeta ); boolean result = controller.deleteRepository( REPOSITORY_NAME ); assertEquals( true, result ); verify( repositoriesMeta ).removeRepository( index ); verify( repositoriesMeta ).writeData(); }
public boolean deleteRepository( String name ) { RepositoryMeta repositoryMeta = repositoriesMeta.findRepository( name ); int index = repositoriesMeta.indexOfRepository( repositoryMeta ); if ( index != -1 ) { Spoon spoon = spoonSupplier.get(); if ( spoon.getRepositoryName() != null && spoon.getRepositoryName().equals( repositoryMeta.getName() ) ) { spoon.closeRepository(); setConnectedRepository( null ); } repositoriesMeta.removeRepository( index ); save(); } return true; }
RepositoryConnectController { public boolean deleteRepository( String name ) { RepositoryMeta repositoryMeta = repositoriesMeta.findRepository( name ); int index = repositoriesMeta.indexOfRepository( repositoryMeta ); if ( index != -1 ) { Spoon spoon = spoonSupplier.get(); if ( spoon.getRepositoryName() != null && spoon.getRepositoryName().equals( repositoryMeta.getName() ) ) { spoon.closeRepository(); setConnectedRepository( null ); } repositoriesMeta.removeRepository( index ); save(); } return true; } }
RepositoryConnectController { public boolean deleteRepository( String name ) { RepositoryMeta repositoryMeta = repositoriesMeta.findRepository( name ); int index = repositoriesMeta.indexOfRepository( repositoryMeta ); if ( index != -1 ) { Spoon spoon = spoonSupplier.get(); if ( spoon.getRepositoryName() != null && spoon.getRepositoryName().equals( repositoryMeta.getName() ) ) { spoon.closeRepository(); setConnectedRepository( null ); } repositoriesMeta.removeRepository( index ); save(); } return true; } RepositoryConnectController( PluginRegistry pluginRegistry, Supplier<Spoon> spoonSupplier, RepositoriesMeta repositoriesMeta ); RepositoryConnectController(); }
RepositoryConnectController { public boolean deleteRepository( String name ) { RepositoryMeta repositoryMeta = repositoriesMeta.findRepository( name ); int index = repositoriesMeta.indexOfRepository( repositoryMeta ); if ( index != -1 ) { Spoon spoon = spoonSupplier.get(); if ( spoon.getRepositoryName() != null && spoon.getRepositoryName().equals( repositoryMeta.getName() ) ) { spoon.closeRepository(); setConnectedRepository( null ); } repositoriesMeta.removeRepository( index ); save(); } return true; } RepositoryConnectController( PluginRegistry pluginRegistry, Supplier<Spoon> spoonSupplier, RepositoriesMeta repositoriesMeta ); RepositoryConnectController(); @SuppressWarnings( "unchecked" ) String getPlugins(); boolean createRepository( String id, Map<String, Object> items ); @SuppressWarnings( "unchecked" ) String getRepositories(); String getRepository( String name ); DatabaseMeta getDatabase( String name ); void removeDatabase( String name ); @SuppressWarnings( "unchecked" ) String getDatabases(); void connectToRepository(); void connectToRepository( String username, String password ); void connectToRepository( RepositoryMeta repositoryMeta ); void connectToRepository( RepositoryMeta repositoryMeta, String username, String password ); void reconnectToRepository( String username, String password ); boolean deleteRepository( String name ); void addDatabase( DatabaseMeta databaseMeta ); boolean setDefaultRepository( String name ); String getDefaultUrl(); String getCurrentUser(); void setCurrentRepository( RepositoryMeta repositoryMeta ); RepositoryMeta getCurrentRepository(); RepositoryMeta getConnectedRepository(); void setConnectedRepository( RepositoryMeta connectedRepository ); RepositoryMeta getDefaultRepositoryMeta(); RepositoryMeta getRepositoryMetaByName( String name ); boolean isConnected( String name ); boolean isConnected(); Repository getConnectedRepositoryInstance(); void save(); PropsUI getPropsUI(); void addListener( RepositoryContollerListener listener ); void fireListeners(); boolean isRelogin(); void setRelogin( boolean relogin ); Map<String, Object> modelToMap( RepositoryModel model ); }
RepositoryConnectController { public boolean deleteRepository( String name ) { RepositoryMeta repositoryMeta = repositoriesMeta.findRepository( name ); int index = repositoriesMeta.indexOfRepository( repositoryMeta ); if ( index != -1 ) { Spoon spoon = spoonSupplier.get(); if ( spoon.getRepositoryName() != null && spoon.getRepositoryName().equals( repositoryMeta.getName() ) ) { spoon.closeRepository(); setConnectedRepository( null ); } repositoriesMeta.removeRepository( index ); save(); } return true; } RepositoryConnectController( PluginRegistry pluginRegistry, Supplier<Spoon> spoonSupplier, RepositoriesMeta repositoriesMeta ); RepositoryConnectController(); @SuppressWarnings( "unchecked" ) String getPlugins(); boolean createRepository( String id, Map<String, Object> items ); @SuppressWarnings( "unchecked" ) String getRepositories(); String getRepository( String name ); DatabaseMeta getDatabase( String name ); void removeDatabase( String name ); @SuppressWarnings( "unchecked" ) String getDatabases(); void connectToRepository(); void connectToRepository( String username, String password ); void connectToRepository( RepositoryMeta repositoryMeta ); void connectToRepository( RepositoryMeta repositoryMeta, String username, String password ); void reconnectToRepository( String username, String password ); boolean deleteRepository( String name ); void addDatabase( DatabaseMeta databaseMeta ); boolean setDefaultRepository( String name ); String getDefaultUrl(); String getCurrentUser(); void setCurrentRepository( RepositoryMeta repositoryMeta ); RepositoryMeta getCurrentRepository(); RepositoryMeta getConnectedRepository(); void setConnectedRepository( RepositoryMeta connectedRepository ); RepositoryMeta getDefaultRepositoryMeta(); RepositoryMeta getRepositoryMetaByName( String name ); boolean isConnected( String name ); boolean isConnected(); Repository getConnectedRepositoryInstance(); void save(); PropsUI getPropsUI(); void addListener( RepositoryContollerListener listener ); void fireListeners(); boolean isRelogin(); void setRelogin( boolean relogin ); Map<String, Object> modelToMap( RepositoryModel model ); static final String DISPLAY_NAME; static final String DESCRIPTION; static final String IS_DEFAULT; static final String URL; static final String DATABASE_CONNECTION; static final String SHOW_HIDDEN_FOLDERS; static final String LOCATION; static final String DO_NOT_MODIFY; static final String DEFAULT_URL; static final String ERROR_401; }
@Test public void testSetDefaultRepository() { int index = 1; when( repositoriesMeta.findRepository( REPOSITORY_NAME ) ).thenReturn( repositoryMeta ); when( repositoriesMeta.indexOfRepository( repositoryMeta ) ).thenReturn( index ); boolean result = controller.setDefaultRepository( REPOSITORY_NAME ); assertEquals( true, result ); }
public boolean setDefaultRepository( String name ) { RepositoryMeta repositoryMeta = repositoriesMeta.findRepository( name ); for ( int i = 0; i < repositoriesMeta.nrRepositories(); i++ ) { repositoriesMeta.getRepository( i ).setDefault( false ); } if ( repositoryMeta != null ) { repositoryMeta.setDefault( true ); } try { repositoriesMeta.writeData(); } catch ( KettleException ke ) { log.logError( "Unable to set default repository", ke ); } return true; }
RepositoryConnectController { public boolean setDefaultRepository( String name ) { RepositoryMeta repositoryMeta = repositoriesMeta.findRepository( name ); for ( int i = 0; i < repositoriesMeta.nrRepositories(); i++ ) { repositoriesMeta.getRepository( i ).setDefault( false ); } if ( repositoryMeta != null ) { repositoryMeta.setDefault( true ); } try { repositoriesMeta.writeData(); } catch ( KettleException ke ) { log.logError( "Unable to set default repository", ke ); } return true; } }
RepositoryConnectController { public boolean setDefaultRepository( String name ) { RepositoryMeta repositoryMeta = repositoriesMeta.findRepository( name ); for ( int i = 0; i < repositoriesMeta.nrRepositories(); i++ ) { repositoriesMeta.getRepository( i ).setDefault( false ); } if ( repositoryMeta != null ) { repositoryMeta.setDefault( true ); } try { repositoriesMeta.writeData(); } catch ( KettleException ke ) { log.logError( "Unable to set default repository", ke ); } return true; } RepositoryConnectController( PluginRegistry pluginRegistry, Supplier<Spoon> spoonSupplier, RepositoriesMeta repositoriesMeta ); RepositoryConnectController(); }
RepositoryConnectController { public boolean setDefaultRepository( String name ) { RepositoryMeta repositoryMeta = repositoriesMeta.findRepository( name ); for ( int i = 0; i < repositoriesMeta.nrRepositories(); i++ ) { repositoriesMeta.getRepository( i ).setDefault( false ); } if ( repositoryMeta != null ) { repositoryMeta.setDefault( true ); } try { repositoriesMeta.writeData(); } catch ( KettleException ke ) { log.logError( "Unable to set default repository", ke ); } return true; } RepositoryConnectController( PluginRegistry pluginRegistry, Supplier<Spoon> spoonSupplier, RepositoriesMeta repositoriesMeta ); RepositoryConnectController(); @SuppressWarnings( "unchecked" ) String getPlugins(); boolean createRepository( String id, Map<String, Object> items ); @SuppressWarnings( "unchecked" ) String getRepositories(); String getRepository( String name ); DatabaseMeta getDatabase( String name ); void removeDatabase( String name ); @SuppressWarnings( "unchecked" ) String getDatabases(); void connectToRepository(); void connectToRepository( String username, String password ); void connectToRepository( RepositoryMeta repositoryMeta ); void connectToRepository( RepositoryMeta repositoryMeta, String username, String password ); void reconnectToRepository( String username, String password ); boolean deleteRepository( String name ); void addDatabase( DatabaseMeta databaseMeta ); boolean setDefaultRepository( String name ); String getDefaultUrl(); String getCurrentUser(); void setCurrentRepository( RepositoryMeta repositoryMeta ); RepositoryMeta getCurrentRepository(); RepositoryMeta getConnectedRepository(); void setConnectedRepository( RepositoryMeta connectedRepository ); RepositoryMeta getDefaultRepositoryMeta(); RepositoryMeta getRepositoryMetaByName( String name ); boolean isConnected( String name ); boolean isConnected(); Repository getConnectedRepositoryInstance(); void save(); PropsUI getPropsUI(); void addListener( RepositoryContollerListener listener ); void fireListeners(); boolean isRelogin(); void setRelogin( boolean relogin ); Map<String, Object> modelToMap( RepositoryModel model ); }
RepositoryConnectController { public boolean setDefaultRepository( String name ) { RepositoryMeta repositoryMeta = repositoriesMeta.findRepository( name ); for ( int i = 0; i < repositoriesMeta.nrRepositories(); i++ ) { repositoriesMeta.getRepository( i ).setDefault( false ); } if ( repositoryMeta != null ) { repositoryMeta.setDefault( true ); } try { repositoriesMeta.writeData(); } catch ( KettleException ke ) { log.logError( "Unable to set default repository", ke ); } return true; } RepositoryConnectController( PluginRegistry pluginRegistry, Supplier<Spoon> spoonSupplier, RepositoriesMeta repositoriesMeta ); RepositoryConnectController(); @SuppressWarnings( "unchecked" ) String getPlugins(); boolean createRepository( String id, Map<String, Object> items ); @SuppressWarnings( "unchecked" ) String getRepositories(); String getRepository( String name ); DatabaseMeta getDatabase( String name ); void removeDatabase( String name ); @SuppressWarnings( "unchecked" ) String getDatabases(); void connectToRepository(); void connectToRepository( String username, String password ); void connectToRepository( RepositoryMeta repositoryMeta ); void connectToRepository( RepositoryMeta repositoryMeta, String username, String password ); void reconnectToRepository( String username, String password ); boolean deleteRepository( String name ); void addDatabase( DatabaseMeta databaseMeta ); boolean setDefaultRepository( String name ); String getDefaultUrl(); String getCurrentUser(); void setCurrentRepository( RepositoryMeta repositoryMeta ); RepositoryMeta getCurrentRepository(); RepositoryMeta getConnectedRepository(); void setConnectedRepository( RepositoryMeta connectedRepository ); RepositoryMeta getDefaultRepositoryMeta(); RepositoryMeta getRepositoryMetaByName( String name ); boolean isConnected( String name ); boolean isConnected(); Repository getConnectedRepositoryInstance(); void save(); PropsUI getPropsUI(); void addListener( RepositoryContollerListener listener ); void fireListeners(); boolean isRelogin(); void setRelogin( boolean relogin ); Map<String, Object> modelToMap( RepositoryModel model ); static final String DISPLAY_NAME; static final String DESCRIPTION; static final String IS_DEFAULT; static final String URL; static final String DATABASE_CONNECTION; static final String SHOW_HIDDEN_FOLDERS; static final String LOCATION; static final String DO_NOT_MODIFY; static final String DEFAULT_URL; static final String ERROR_401; }
@Test public void testAddDatabase() throws Exception { controller.addDatabase( databaseMeta ); verify( repositoriesMeta ).addDatabase( databaseMeta ); verify( repositoriesMeta ).writeData(); }
public void addDatabase( DatabaseMeta databaseMeta ) { if ( databaseMeta != null ) { repositoriesMeta.addDatabase( databaseMeta ); save(); } }
RepositoryConnectController { public void addDatabase( DatabaseMeta databaseMeta ) { if ( databaseMeta != null ) { repositoriesMeta.addDatabase( databaseMeta ); save(); } } }
RepositoryConnectController { public void addDatabase( DatabaseMeta databaseMeta ) { if ( databaseMeta != null ) { repositoriesMeta.addDatabase( databaseMeta ); save(); } } RepositoryConnectController( PluginRegistry pluginRegistry, Supplier<Spoon> spoonSupplier, RepositoriesMeta repositoriesMeta ); RepositoryConnectController(); }
RepositoryConnectController { public void addDatabase( DatabaseMeta databaseMeta ) { if ( databaseMeta != null ) { repositoriesMeta.addDatabase( databaseMeta ); save(); } } RepositoryConnectController( PluginRegistry pluginRegistry, Supplier<Spoon> spoonSupplier, RepositoriesMeta repositoriesMeta ); RepositoryConnectController(); @SuppressWarnings( "unchecked" ) String getPlugins(); boolean createRepository( String id, Map<String, Object> items ); @SuppressWarnings( "unchecked" ) String getRepositories(); String getRepository( String name ); DatabaseMeta getDatabase( String name ); void removeDatabase( String name ); @SuppressWarnings( "unchecked" ) String getDatabases(); void connectToRepository(); void connectToRepository( String username, String password ); void connectToRepository( RepositoryMeta repositoryMeta ); void connectToRepository( RepositoryMeta repositoryMeta, String username, String password ); void reconnectToRepository( String username, String password ); boolean deleteRepository( String name ); void addDatabase( DatabaseMeta databaseMeta ); boolean setDefaultRepository( String name ); String getDefaultUrl(); String getCurrentUser(); void setCurrentRepository( RepositoryMeta repositoryMeta ); RepositoryMeta getCurrentRepository(); RepositoryMeta getConnectedRepository(); void setConnectedRepository( RepositoryMeta connectedRepository ); RepositoryMeta getDefaultRepositoryMeta(); RepositoryMeta getRepositoryMetaByName( String name ); boolean isConnected( String name ); boolean isConnected(); Repository getConnectedRepositoryInstance(); void save(); PropsUI getPropsUI(); void addListener( RepositoryContollerListener listener ); void fireListeners(); boolean isRelogin(); void setRelogin( boolean relogin ); Map<String, Object> modelToMap( RepositoryModel model ); }
RepositoryConnectController { public void addDatabase( DatabaseMeta databaseMeta ) { if ( databaseMeta != null ) { repositoriesMeta.addDatabase( databaseMeta ); save(); } } RepositoryConnectController( PluginRegistry pluginRegistry, Supplier<Spoon> spoonSupplier, RepositoriesMeta repositoriesMeta ); RepositoryConnectController(); @SuppressWarnings( "unchecked" ) String getPlugins(); boolean createRepository( String id, Map<String, Object> items ); @SuppressWarnings( "unchecked" ) String getRepositories(); String getRepository( String name ); DatabaseMeta getDatabase( String name ); void removeDatabase( String name ); @SuppressWarnings( "unchecked" ) String getDatabases(); void connectToRepository(); void connectToRepository( String username, String password ); void connectToRepository( RepositoryMeta repositoryMeta ); void connectToRepository( RepositoryMeta repositoryMeta, String username, String password ); void reconnectToRepository( String username, String password ); boolean deleteRepository( String name ); void addDatabase( DatabaseMeta databaseMeta ); boolean setDefaultRepository( String name ); String getDefaultUrl(); String getCurrentUser(); void setCurrentRepository( RepositoryMeta repositoryMeta ); RepositoryMeta getCurrentRepository(); RepositoryMeta getConnectedRepository(); void setConnectedRepository( RepositoryMeta connectedRepository ); RepositoryMeta getDefaultRepositoryMeta(); RepositoryMeta getRepositoryMetaByName( String name ); boolean isConnected( String name ); boolean isConnected(); Repository getConnectedRepositoryInstance(); void save(); PropsUI getPropsUI(); void addListener( RepositoryContollerListener listener ); void fireListeners(); boolean isRelogin(); void setRelogin( boolean relogin ); Map<String, Object> modelToMap( RepositoryModel model ); static final String DISPLAY_NAME; static final String DESCRIPTION; static final String IS_DEFAULT; static final String URL; static final String DATABASE_CONNECTION; static final String SHOW_HIDDEN_FOLDERS; static final String LOCATION; static final String DO_NOT_MODIFY; static final String DEFAULT_URL; static final String ERROR_401; }
@Test public void testGetDefaultUrl() throws Exception { String defaultUrl = controller.getDefaultUrl(); assertNotNull( defaultUrl ); }
public String getDefaultUrl() { ResourceBundle resourceBundle = PropertyResourceBundle.getBundle( PKG.getPackage().getName() + ".plugin" ); return resourceBundle.getString( DEFAULT_URL ); }
RepositoryConnectController { public String getDefaultUrl() { ResourceBundle resourceBundle = PropertyResourceBundle.getBundle( PKG.getPackage().getName() + ".plugin" ); return resourceBundle.getString( DEFAULT_URL ); } }
RepositoryConnectController { public String getDefaultUrl() { ResourceBundle resourceBundle = PropertyResourceBundle.getBundle( PKG.getPackage().getName() + ".plugin" ); return resourceBundle.getString( DEFAULT_URL ); } RepositoryConnectController( PluginRegistry pluginRegistry, Supplier<Spoon> spoonSupplier, RepositoriesMeta repositoriesMeta ); RepositoryConnectController(); }
RepositoryConnectController { public String getDefaultUrl() { ResourceBundle resourceBundle = PropertyResourceBundle.getBundle( PKG.getPackage().getName() + ".plugin" ); return resourceBundle.getString( DEFAULT_URL ); } RepositoryConnectController( PluginRegistry pluginRegistry, Supplier<Spoon> spoonSupplier, RepositoriesMeta repositoriesMeta ); RepositoryConnectController(); @SuppressWarnings( "unchecked" ) String getPlugins(); boolean createRepository( String id, Map<String, Object> items ); @SuppressWarnings( "unchecked" ) String getRepositories(); String getRepository( String name ); DatabaseMeta getDatabase( String name ); void removeDatabase( String name ); @SuppressWarnings( "unchecked" ) String getDatabases(); void connectToRepository(); void connectToRepository( String username, String password ); void connectToRepository( RepositoryMeta repositoryMeta ); void connectToRepository( RepositoryMeta repositoryMeta, String username, String password ); void reconnectToRepository( String username, String password ); boolean deleteRepository( String name ); void addDatabase( DatabaseMeta databaseMeta ); boolean setDefaultRepository( String name ); String getDefaultUrl(); String getCurrentUser(); void setCurrentRepository( RepositoryMeta repositoryMeta ); RepositoryMeta getCurrentRepository(); RepositoryMeta getConnectedRepository(); void setConnectedRepository( RepositoryMeta connectedRepository ); RepositoryMeta getDefaultRepositoryMeta(); RepositoryMeta getRepositoryMetaByName( String name ); boolean isConnected( String name ); boolean isConnected(); Repository getConnectedRepositoryInstance(); void save(); PropsUI getPropsUI(); void addListener( RepositoryContollerListener listener ); void fireListeners(); boolean isRelogin(); void setRelogin( boolean relogin ); Map<String, Object> modelToMap( RepositoryModel model ); }
RepositoryConnectController { public String getDefaultUrl() { ResourceBundle resourceBundle = PropertyResourceBundle.getBundle( PKG.getPackage().getName() + ".plugin" ); return resourceBundle.getString( DEFAULT_URL ); } RepositoryConnectController( PluginRegistry pluginRegistry, Supplier<Spoon> spoonSupplier, RepositoriesMeta repositoriesMeta ); RepositoryConnectController(); @SuppressWarnings( "unchecked" ) String getPlugins(); boolean createRepository( String id, Map<String, Object> items ); @SuppressWarnings( "unchecked" ) String getRepositories(); String getRepository( String name ); DatabaseMeta getDatabase( String name ); void removeDatabase( String name ); @SuppressWarnings( "unchecked" ) String getDatabases(); void connectToRepository(); void connectToRepository( String username, String password ); void connectToRepository( RepositoryMeta repositoryMeta ); void connectToRepository( RepositoryMeta repositoryMeta, String username, String password ); void reconnectToRepository( String username, String password ); boolean deleteRepository( String name ); void addDatabase( DatabaseMeta databaseMeta ); boolean setDefaultRepository( String name ); String getDefaultUrl(); String getCurrentUser(); void setCurrentRepository( RepositoryMeta repositoryMeta ); RepositoryMeta getCurrentRepository(); RepositoryMeta getConnectedRepository(); void setConnectedRepository( RepositoryMeta connectedRepository ); RepositoryMeta getDefaultRepositoryMeta(); RepositoryMeta getRepositoryMetaByName( String name ); boolean isConnected( String name ); boolean isConnected(); Repository getConnectedRepositoryInstance(); void save(); PropsUI getPropsUI(); void addListener( RepositoryContollerListener listener ); void fireListeners(); boolean isRelogin(); void setRelogin( boolean relogin ); Map<String, Object> modelToMap( RepositoryModel model ); static final String DISPLAY_NAME; static final String DESCRIPTION; static final String IS_DEFAULT; static final String URL; static final String DATABASE_CONNECTION; static final String SHOW_HIDDEN_FOLDERS; static final String LOCATION; static final String DO_NOT_MODIFY; static final String DEFAULT_URL; static final String ERROR_401; }
@Test public void loadMappingMeta() throws Exception { String variablePath = "Internal.Entry.Current.Directory"; String virtualDir = "/testFolder/CDA-91"; String fileName = "testTrans.ktr"; VariableSpace variables = new Variables(); variables.setVariable( variablePath, virtualDir ); StepWithMappingMeta mappingMetaMock = mock( StepWithMappingMeta.class ); when( mappingMetaMock.getSpecificationMethod() ).thenReturn( ObjectLocationSpecificationMethod.FILENAME ); when( mappingMetaMock.getFileName() ).thenReturn( "${" + variablePath + "}/" + fileName ); Repository rep = mock( Repository.class ); Mockito.doAnswer( new Answer<TransMeta>() { @Override public TransMeta answer( final InvocationOnMock invocation ) throws Throwable { final String originalArgument = (String) ( invocation.getArguments() )[ 0 ]; assertEquals( originalArgument, virtualDir ); return null; } } ).when( rep ).findDirectory( anyString() ); Mockito.doAnswer( new Answer<TransMeta>() { @Override public TransMeta answer( final InvocationOnMock invocation ) throws Throwable { final String originalArgument = (String) ( invocation.getArguments() )[ 0 ]; assertEquals( originalArgument, fileName ); return mock( TransMeta.class ); } } ).when( rep ).loadTransformation( anyString(), any( RepositoryDirectoryInterface.class ), any( ProgressMonitorListener.class ), anyBoolean(), anyString() ); StepWithMappingMeta.loadMappingMeta( mappingMetaMock, rep, null, variables, true ); }
public static TransMeta loadMappingMeta( StepWithMappingMeta mappingMeta, Repository rep, IMetaStore metaStore, VariableSpace space ) throws KettleException { return loadMappingMeta( mappingMeta, rep, metaStore, space, true ); }
StepWithMappingMeta extends BaseStepMeta { public static TransMeta loadMappingMeta( StepWithMappingMeta mappingMeta, Repository rep, IMetaStore metaStore, VariableSpace space ) throws KettleException { return loadMappingMeta( mappingMeta, rep, metaStore, space, true ); } }
StepWithMappingMeta extends BaseStepMeta { public static TransMeta loadMappingMeta( StepWithMappingMeta mappingMeta, Repository rep, IMetaStore metaStore, VariableSpace space ) throws KettleException { return loadMappingMeta( mappingMeta, rep, metaStore, space, true ); } }
StepWithMappingMeta extends BaseStepMeta { public static TransMeta loadMappingMeta( StepWithMappingMeta mappingMeta, Repository rep, IMetaStore metaStore, VariableSpace space ) throws KettleException { return loadMappingMeta( mappingMeta, rep, metaStore, space, true ); } static TransMeta loadMappingMeta( StepWithMappingMeta mappingMeta, Repository rep, IMetaStore metaStore, VariableSpace space ); static synchronized TransMeta loadMappingMeta( StepWithMappingMeta executorMeta, Repository rep, IMetaStore metaStore, VariableSpace space, boolean share ); ObjectLocationSpecificationMethod getSpecificationMethod(); void setSpecificationMethod( ObjectLocationSpecificationMethod specificationMethod ); String getDirectoryPath(); void setDirectoryPath( String directoryPath ); String getFileName(); void setFileName( String fileName ); String getTransName(); void setTransName( String transName ); ObjectId getTransObjectId(); void setTransObjectId( ObjectId transObjectId ); }
StepWithMappingMeta extends BaseStepMeta { public static TransMeta loadMappingMeta( StepWithMappingMeta mappingMeta, Repository rep, IMetaStore metaStore, VariableSpace space ) throws KettleException { return loadMappingMeta( mappingMeta, rep, metaStore, space, true ); } static TransMeta loadMappingMeta( StepWithMappingMeta mappingMeta, Repository rep, IMetaStore metaStore, VariableSpace space ); static synchronized TransMeta loadMappingMeta( StepWithMappingMeta executorMeta, Repository rep, IMetaStore metaStore, VariableSpace space, boolean share ); ObjectLocationSpecificationMethod getSpecificationMethod(); void setSpecificationMethod( ObjectLocationSpecificationMethod specificationMethod ); String getDirectoryPath(); void setDirectoryPath( String directoryPath ); String getFileName(); void setFileName( String fileName ); String getTransName(); void setTransName( String transName ); ObjectId getTransObjectId(); void setTransObjectId( ObjectId transObjectId ); }
@Test public void testGetRepository() throws Exception { KettleFileRepositoryMeta kettleFileRepositoryMeta = new KettleFileRepositoryMeta(); kettleFileRepositoryMeta.setId( REPOSITORY_ID ); kettleFileRepositoryMeta.setDescription( REPOSITORY_DESCRIPTION ); kettleFileRepositoryMeta.setName( REPOSITORY_NAME ); when( repositoriesMeta.findRepository( REPOSITORY_NAME ) ).thenReturn( kettleFileRepositoryMeta ); String output = controller.getRepository( REPOSITORY_NAME ); assertEquals( true, output.contains( REPOSITORY_ID ) ); assertEquals( true, output.contains( REPOSITORY_DESCRIPTION ) ); assertEquals( true, output.contains( REPOSITORY_NAME ) ); }
public String getRepository( String name ) { RepositoryMeta repositoryMeta = repositoriesMeta.findRepository( name ); if ( repositoryMeta != null ) { currentRepository = repositoryMeta; return repositoryMeta.toJSONObject().toString(); } return ""; }
RepositoryConnectController { public String getRepository( String name ) { RepositoryMeta repositoryMeta = repositoriesMeta.findRepository( name ); if ( repositoryMeta != null ) { currentRepository = repositoryMeta; return repositoryMeta.toJSONObject().toString(); } return ""; } }
RepositoryConnectController { public String getRepository( String name ) { RepositoryMeta repositoryMeta = repositoriesMeta.findRepository( name ); if ( repositoryMeta != null ) { currentRepository = repositoryMeta; return repositoryMeta.toJSONObject().toString(); } return ""; } RepositoryConnectController( PluginRegistry pluginRegistry, Supplier<Spoon> spoonSupplier, RepositoriesMeta repositoriesMeta ); RepositoryConnectController(); }
RepositoryConnectController { public String getRepository( String name ) { RepositoryMeta repositoryMeta = repositoriesMeta.findRepository( name ); if ( repositoryMeta != null ) { currentRepository = repositoryMeta; return repositoryMeta.toJSONObject().toString(); } return ""; } RepositoryConnectController( PluginRegistry pluginRegistry, Supplier<Spoon> spoonSupplier, RepositoriesMeta repositoriesMeta ); RepositoryConnectController(); @SuppressWarnings( "unchecked" ) String getPlugins(); boolean createRepository( String id, Map<String, Object> items ); @SuppressWarnings( "unchecked" ) String getRepositories(); String getRepository( String name ); DatabaseMeta getDatabase( String name ); void removeDatabase( String name ); @SuppressWarnings( "unchecked" ) String getDatabases(); void connectToRepository(); void connectToRepository( String username, String password ); void connectToRepository( RepositoryMeta repositoryMeta ); void connectToRepository( RepositoryMeta repositoryMeta, String username, String password ); void reconnectToRepository( String username, String password ); boolean deleteRepository( String name ); void addDatabase( DatabaseMeta databaseMeta ); boolean setDefaultRepository( String name ); String getDefaultUrl(); String getCurrentUser(); void setCurrentRepository( RepositoryMeta repositoryMeta ); RepositoryMeta getCurrentRepository(); RepositoryMeta getConnectedRepository(); void setConnectedRepository( RepositoryMeta connectedRepository ); RepositoryMeta getDefaultRepositoryMeta(); RepositoryMeta getRepositoryMetaByName( String name ); boolean isConnected( String name ); boolean isConnected(); Repository getConnectedRepositoryInstance(); void save(); PropsUI getPropsUI(); void addListener( RepositoryContollerListener listener ); void fireListeners(); boolean isRelogin(); void setRelogin( boolean relogin ); Map<String, Object> modelToMap( RepositoryModel model ); }
RepositoryConnectController { public String getRepository( String name ) { RepositoryMeta repositoryMeta = repositoriesMeta.findRepository( name ); if ( repositoryMeta != null ) { currentRepository = repositoryMeta; return repositoryMeta.toJSONObject().toString(); } return ""; } RepositoryConnectController( PluginRegistry pluginRegistry, Supplier<Spoon> spoonSupplier, RepositoriesMeta repositoriesMeta ); RepositoryConnectController(); @SuppressWarnings( "unchecked" ) String getPlugins(); boolean createRepository( String id, Map<String, Object> items ); @SuppressWarnings( "unchecked" ) String getRepositories(); String getRepository( String name ); DatabaseMeta getDatabase( String name ); void removeDatabase( String name ); @SuppressWarnings( "unchecked" ) String getDatabases(); void connectToRepository(); void connectToRepository( String username, String password ); void connectToRepository( RepositoryMeta repositoryMeta ); void connectToRepository( RepositoryMeta repositoryMeta, String username, String password ); void reconnectToRepository( String username, String password ); boolean deleteRepository( String name ); void addDatabase( DatabaseMeta databaseMeta ); boolean setDefaultRepository( String name ); String getDefaultUrl(); String getCurrentUser(); void setCurrentRepository( RepositoryMeta repositoryMeta ); RepositoryMeta getCurrentRepository(); RepositoryMeta getConnectedRepository(); void setConnectedRepository( RepositoryMeta connectedRepository ); RepositoryMeta getDefaultRepositoryMeta(); RepositoryMeta getRepositoryMetaByName( String name ); boolean isConnected( String name ); boolean isConnected(); Repository getConnectedRepositoryInstance(); void save(); PropsUI getPropsUI(); void addListener( RepositoryContollerListener listener ); void fireListeners(); boolean isRelogin(); void setRelogin( boolean relogin ); Map<String, Object> modelToMap( RepositoryModel model ); static final String DISPLAY_NAME; static final String DESCRIPTION; static final String IS_DEFAULT; static final String URL; static final String DATABASE_CONNECTION; static final String SHOW_HIDDEN_FOLDERS; static final String LOCATION; static final String DO_NOT_MODIFY; static final String DEFAULT_URL; static final String ERROR_401; }
@Test public void testIsDatabaseWithNameExist() throws Exception { final DatabaseMeta databaseMeta1 = new DatabaseMeta(); databaseMeta1.setName( "TestDB1" ); controller.addDatabase( databaseMeta1 ); final DatabaseMeta databaseMeta2 = new DatabaseMeta(); databaseMeta2.setName( "TestDB2" ); controller.addDatabase( databaseMeta2 ); when( repositoriesMeta.nrDatabases() ).thenReturn( 2 ); when( repositoriesMeta.getDatabase( 0 ) ).thenReturn( databaseMeta1 ); when( repositoriesMeta.getDatabase( 1 ) ).thenReturn( databaseMeta2 ); assertFalse( controller.isDatabaseWithNameExist( databaseMeta1, false ) ); databaseMeta2.setName( "TestDB1" ); assertTrue( controller.isDatabaseWithNameExist( databaseMeta2, false ) ); final DatabaseMeta databaseMeta3 = new DatabaseMeta(); databaseMeta3.setName( "TestDB3" ); assertFalse( controller.isDatabaseWithNameExist( databaseMeta3, true ) ); databaseMeta3.setName( "TestDB1" ); assertTrue( controller.isDatabaseWithNameExist( databaseMeta3, true ) ); }
@VisibleForTesting boolean isDatabaseWithNameExist( DatabaseMeta databaseMeta, boolean isNew ) { for ( int i = 0; i < repositoriesMeta.nrDatabases(); i++ ) { final DatabaseMeta iterDatabase = repositoriesMeta.getDatabase( i ); if ( iterDatabase.getName().trim().equalsIgnoreCase( databaseMeta.getName().trim() ) ) { if ( isNew || databaseMeta != iterDatabase ) { return true; } } } return false; }
RepositoryConnectController { @VisibleForTesting boolean isDatabaseWithNameExist( DatabaseMeta databaseMeta, boolean isNew ) { for ( int i = 0; i < repositoriesMeta.nrDatabases(); i++ ) { final DatabaseMeta iterDatabase = repositoriesMeta.getDatabase( i ); if ( iterDatabase.getName().trim().equalsIgnoreCase( databaseMeta.getName().trim() ) ) { if ( isNew || databaseMeta != iterDatabase ) { return true; } } } return false; } }
RepositoryConnectController { @VisibleForTesting boolean isDatabaseWithNameExist( DatabaseMeta databaseMeta, boolean isNew ) { for ( int i = 0; i < repositoriesMeta.nrDatabases(); i++ ) { final DatabaseMeta iterDatabase = repositoriesMeta.getDatabase( i ); if ( iterDatabase.getName().trim().equalsIgnoreCase( databaseMeta.getName().trim() ) ) { if ( isNew || databaseMeta != iterDatabase ) { return true; } } } return false; } RepositoryConnectController( PluginRegistry pluginRegistry, Supplier<Spoon> spoonSupplier, RepositoriesMeta repositoriesMeta ); RepositoryConnectController(); }
RepositoryConnectController { @VisibleForTesting boolean isDatabaseWithNameExist( DatabaseMeta databaseMeta, boolean isNew ) { for ( int i = 0; i < repositoriesMeta.nrDatabases(); i++ ) { final DatabaseMeta iterDatabase = repositoriesMeta.getDatabase( i ); if ( iterDatabase.getName().trim().equalsIgnoreCase( databaseMeta.getName().trim() ) ) { if ( isNew || databaseMeta != iterDatabase ) { return true; } } } return false; } RepositoryConnectController( PluginRegistry pluginRegistry, Supplier<Spoon> spoonSupplier, RepositoriesMeta repositoriesMeta ); RepositoryConnectController(); @SuppressWarnings( "unchecked" ) String getPlugins(); boolean createRepository( String id, Map<String, Object> items ); @SuppressWarnings( "unchecked" ) String getRepositories(); String getRepository( String name ); DatabaseMeta getDatabase( String name ); void removeDatabase( String name ); @SuppressWarnings( "unchecked" ) String getDatabases(); void connectToRepository(); void connectToRepository( String username, String password ); void connectToRepository( RepositoryMeta repositoryMeta ); void connectToRepository( RepositoryMeta repositoryMeta, String username, String password ); void reconnectToRepository( String username, String password ); boolean deleteRepository( String name ); void addDatabase( DatabaseMeta databaseMeta ); boolean setDefaultRepository( String name ); String getDefaultUrl(); String getCurrentUser(); void setCurrentRepository( RepositoryMeta repositoryMeta ); RepositoryMeta getCurrentRepository(); RepositoryMeta getConnectedRepository(); void setConnectedRepository( RepositoryMeta connectedRepository ); RepositoryMeta getDefaultRepositoryMeta(); RepositoryMeta getRepositoryMetaByName( String name ); boolean isConnected( String name ); boolean isConnected(); Repository getConnectedRepositoryInstance(); void save(); PropsUI getPropsUI(); void addListener( RepositoryContollerListener listener ); void fireListeners(); boolean isRelogin(); void setRelogin( boolean relogin ); Map<String, Object> modelToMap( RepositoryModel model ); }
RepositoryConnectController { @VisibleForTesting boolean isDatabaseWithNameExist( DatabaseMeta databaseMeta, boolean isNew ) { for ( int i = 0; i < repositoriesMeta.nrDatabases(); i++ ) { final DatabaseMeta iterDatabase = repositoriesMeta.getDatabase( i ); if ( iterDatabase.getName().trim().equalsIgnoreCase( databaseMeta.getName().trim() ) ) { if ( isNew || databaseMeta != iterDatabase ) { return true; } } } return false; } RepositoryConnectController( PluginRegistry pluginRegistry, Supplier<Spoon> spoonSupplier, RepositoriesMeta repositoriesMeta ); RepositoryConnectController(); @SuppressWarnings( "unchecked" ) String getPlugins(); boolean createRepository( String id, Map<String, Object> items ); @SuppressWarnings( "unchecked" ) String getRepositories(); String getRepository( String name ); DatabaseMeta getDatabase( String name ); void removeDatabase( String name ); @SuppressWarnings( "unchecked" ) String getDatabases(); void connectToRepository(); void connectToRepository( String username, String password ); void connectToRepository( RepositoryMeta repositoryMeta ); void connectToRepository( RepositoryMeta repositoryMeta, String username, String password ); void reconnectToRepository( String username, String password ); boolean deleteRepository( String name ); void addDatabase( DatabaseMeta databaseMeta ); boolean setDefaultRepository( String name ); String getDefaultUrl(); String getCurrentUser(); void setCurrentRepository( RepositoryMeta repositoryMeta ); RepositoryMeta getCurrentRepository(); RepositoryMeta getConnectedRepository(); void setConnectedRepository( RepositoryMeta connectedRepository ); RepositoryMeta getDefaultRepositoryMeta(); RepositoryMeta getRepositoryMetaByName( String name ); boolean isConnected( String name ); boolean isConnected(); Repository getConnectedRepositoryInstance(); void save(); PropsUI getPropsUI(); void addListener( RepositoryContollerListener listener ); void fireListeners(); boolean isRelogin(); void setRelogin( boolean relogin ); Map<String, Object> modelToMap( RepositoryModel model ); static final String DISPLAY_NAME; static final String DESCRIPTION; static final String IS_DEFAULT; static final String URL; static final String DATABASE_CONNECTION; static final String SHOW_HIDDEN_FOLDERS; static final String LOCATION; static final String DO_NOT_MODIFY; static final String DEFAULT_URL; static final String ERROR_401; }
@Test public void connectedToRepository() { when( repository.isConnected() ).thenReturn( true ); assertTrue( timeoutHandler.connectedToRepository() ); }
boolean connectedToRepository() { return repository.isConnected(); }
RepositorySessionTimeoutHandler implements InvocationHandler { boolean connectedToRepository() { return repository.isConnected(); } }
RepositorySessionTimeoutHandler implements InvocationHandler { boolean connectedToRepository() { return repository.isConnected(); } RepositorySessionTimeoutHandler( ReconnectableRepository repository, RepositoryConnectController repositoryConnectController ); }
RepositorySessionTimeoutHandler implements InvocationHandler { boolean connectedToRepository() { return repository.isConnected(); } RepositorySessionTimeoutHandler( ReconnectableRepository repository, RepositoryConnectController repositoryConnectController ); @SuppressWarnings( "unchecked" ) @Override Object invoke( Object proxy, Method method, Object[] args ); }
RepositorySessionTimeoutHandler implements InvocationHandler { boolean connectedToRepository() { return repository.isConnected(); } RepositorySessionTimeoutHandler( ReconnectableRepository repository, RepositoryConnectController repositoryConnectController ); @SuppressWarnings( "unchecked" ) @Override Object invoke( Object proxy, Method method, Object[] args ); }
@Test public void connectedToRepositoryReturnsFalse() { when( repository.isConnected() ).thenReturn( false ); assertFalse( timeoutHandler.connectedToRepository() ); }
boolean connectedToRepository() { return repository.isConnected(); }
RepositorySessionTimeoutHandler implements InvocationHandler { boolean connectedToRepository() { return repository.isConnected(); } }
RepositorySessionTimeoutHandler implements InvocationHandler { boolean connectedToRepository() { return repository.isConnected(); } RepositorySessionTimeoutHandler( ReconnectableRepository repository, RepositoryConnectController repositoryConnectController ); }
RepositorySessionTimeoutHandler implements InvocationHandler { boolean connectedToRepository() { return repository.isConnected(); } RepositorySessionTimeoutHandler( ReconnectableRepository repository, RepositoryConnectController repositoryConnectController ); @SuppressWarnings( "unchecked" ) @Override Object invoke( Object proxy, Method method, Object[] args ); }
RepositorySessionTimeoutHandler implements InvocationHandler { boolean connectedToRepository() { return repository.isConnected(); } RepositorySessionTimeoutHandler( ReconnectableRepository repository, RepositoryConnectController repositoryConnectController ); @SuppressWarnings( "unchecked" ) @Override Object invoke( Object proxy, Method method, Object[] args ); }
@Test public void wrapMetastoreWithTimeoutHandler() throws Throwable { IMetaStore metaStore = mock( IMetaStore.class ); doThrow( KettleRepositoryLostException.class ).when( metaStore ).createNamespace( any() ); SessionTimeoutHandler sessionTimeoutHandler = mock( SessionTimeoutHandler.class ); IMetaStore wrappedMetaStore = RepositorySessionTimeoutHandler.wrapMetastoreWithTimeoutHandler( metaStore, sessionTimeoutHandler ); wrappedMetaStore.createNamespace( "TEST_NAMESPACE" ); verify( sessionTimeoutHandler ).handle( any(), any(), any(), any() ); }
static IMetaStore wrapMetastoreWithTimeoutHandler( IMetaStore metaStore, SessionTimeoutHandler sessionTimeoutHandler ) { MetaStoreSessionTimeoutHandler metaStoreSessionTimeoutHandler = new MetaStoreSessionTimeoutHandler( metaStore, sessionTimeoutHandler ); return wrapObjectWithTimeoutHandler( metaStore, metaStoreSessionTimeoutHandler ); }
RepositorySessionTimeoutHandler implements InvocationHandler { static IMetaStore wrapMetastoreWithTimeoutHandler( IMetaStore metaStore, SessionTimeoutHandler sessionTimeoutHandler ) { MetaStoreSessionTimeoutHandler metaStoreSessionTimeoutHandler = new MetaStoreSessionTimeoutHandler( metaStore, sessionTimeoutHandler ); return wrapObjectWithTimeoutHandler( metaStore, metaStoreSessionTimeoutHandler ); } }
RepositorySessionTimeoutHandler implements InvocationHandler { static IMetaStore wrapMetastoreWithTimeoutHandler( IMetaStore metaStore, SessionTimeoutHandler sessionTimeoutHandler ) { MetaStoreSessionTimeoutHandler metaStoreSessionTimeoutHandler = new MetaStoreSessionTimeoutHandler( metaStore, sessionTimeoutHandler ); return wrapObjectWithTimeoutHandler( metaStore, metaStoreSessionTimeoutHandler ); } RepositorySessionTimeoutHandler( ReconnectableRepository repository, RepositoryConnectController repositoryConnectController ); }
RepositorySessionTimeoutHandler implements InvocationHandler { static IMetaStore wrapMetastoreWithTimeoutHandler( IMetaStore metaStore, SessionTimeoutHandler sessionTimeoutHandler ) { MetaStoreSessionTimeoutHandler metaStoreSessionTimeoutHandler = new MetaStoreSessionTimeoutHandler( metaStore, sessionTimeoutHandler ); return wrapObjectWithTimeoutHandler( metaStore, metaStoreSessionTimeoutHandler ); } RepositorySessionTimeoutHandler( ReconnectableRepository repository, RepositoryConnectController repositoryConnectController ); @SuppressWarnings( "unchecked" ) @Override Object invoke( Object proxy, Method method, Object[] args ); }
RepositorySessionTimeoutHandler implements InvocationHandler { static IMetaStore wrapMetastoreWithTimeoutHandler( IMetaStore metaStore, SessionTimeoutHandler sessionTimeoutHandler ) { MetaStoreSessionTimeoutHandler metaStoreSessionTimeoutHandler = new MetaStoreSessionTimeoutHandler( metaStore, sessionTimeoutHandler ); return wrapObjectWithTimeoutHandler( metaStore, metaStoreSessionTimeoutHandler ); } RepositorySessionTimeoutHandler( ReconnectableRepository repository, RepositoryConnectController repositoryConnectController ); @SuppressWarnings( "unchecked" ) @Override Object invoke( Object proxy, Method method, Object[] args ); }
@SuppressWarnings( "unchecked" ) @Test public void testHandlerCallOnException() throws Throwable { when( repositoryService.getUsers() ).thenThrow( KettleRepositoryLostException.class ); Method method = RepositorySecurityManager.class.getMethod( "getUsers" ); metaStoresessionTimeoutHandler.invoke( mock( Proxy.class ), method, new Object[0] ); verify( sessionTimeoutHandler ).handle( any(), any(), any(), any() ); }
@Override public Object invoke( Object proxy, Method method, Object[] args ) throws Throwable { try { return method.invoke( repositoryService, args ); } catch ( InvocationTargetException ex ) { return sessionTimeoutHandler.handle( repositoryService, ex.getCause(), method, args ); } }
RepositoryServiceSessionTimeoutHandler implements InvocationHandler { @Override public Object invoke( Object proxy, Method method, Object[] args ) throws Throwable { try { return method.invoke( repositoryService, args ); } catch ( InvocationTargetException ex ) { return sessionTimeoutHandler.handle( repositoryService, ex.getCause(), method, args ); } } }
RepositoryServiceSessionTimeoutHandler implements InvocationHandler { @Override public Object invoke( Object proxy, Method method, Object[] args ) throws Throwable { try { return method.invoke( repositoryService, args ); } catch ( InvocationTargetException ex ) { return sessionTimeoutHandler.handle( repositoryService, ex.getCause(), method, args ); } } RepositoryServiceSessionTimeoutHandler( IRepositoryService repositoryService, SessionTimeoutHandler sessionTimeoutHandler ); }
RepositoryServiceSessionTimeoutHandler implements InvocationHandler { @Override public Object invoke( Object proxy, Method method, Object[] args ) throws Throwable { try { return method.invoke( repositoryService, args ); } catch ( InvocationTargetException ex ) { return sessionTimeoutHandler.handle( repositoryService, ex.getCause(), method, args ); } } RepositoryServiceSessionTimeoutHandler( IRepositoryService repositoryService, SessionTimeoutHandler sessionTimeoutHandler ); @Override Object invoke( Object proxy, Method method, Object[] args ); }
RepositoryServiceSessionTimeoutHandler implements InvocationHandler { @Override public Object invoke( Object proxy, Method method, Object[] args ) throws Throwable { try { return method.invoke( repositoryService, args ); } catch ( InvocationTargetException ex ) { return sessionTimeoutHandler.handle( repositoryService, ex.getCause(), method, args ); } } RepositoryServiceSessionTimeoutHandler( IRepositoryService repositoryService, SessionTimeoutHandler sessionTimeoutHandler ); @Override Object invoke( Object proxy, Method method, Object[] args ); }
@Test public void handle() throws Throwable { when( repository.readTransSharedObjects( any() ) ).thenReturn( mock( SharedObjects.class ) ); Method method = Repository.class.getMethod( "readTransSharedObjects", TransMeta.class ); sessionTimeoutHandler.handle( repository, mock( Exception.class ), method, new Object[] { mock( TransMeta.class ) } ); verify( sessionTimeoutHandler, never() ).showLoginScreen( any() ); }
public Object handle( Object objectToHandle, Throwable exception, Method method, Object[] args ) throws Throwable { if ( lookupForConnectTimeoutError( exception ) && !calledFromThisHandler() ) { try { return method.invoke( objectToHandle, args ); } catch ( InvocationTargetException ex2 ) { if ( !lookupForConnectTimeoutError( ex2 ) ) { throw ex2.getCause(); } } needToLogin.set( true ); synchronized ( this ) { if ( needToLogin.get() ) { boolean result = showLoginScreen( repositoryConnectController ); needToLogin.set( false ); if ( result ) { reinvoke.set( true ); return method.invoke( objectToHandle, args ); } reinvoke.set( false ); } } if ( reinvoke.get() ) { return method.invoke( objectToHandle, args ); } } throw exception; }
SessionTimeoutHandler { public Object handle( Object objectToHandle, Throwable exception, Method method, Object[] args ) throws Throwable { if ( lookupForConnectTimeoutError( exception ) && !calledFromThisHandler() ) { try { return method.invoke( objectToHandle, args ); } catch ( InvocationTargetException ex2 ) { if ( !lookupForConnectTimeoutError( ex2 ) ) { throw ex2.getCause(); } } needToLogin.set( true ); synchronized ( this ) { if ( needToLogin.get() ) { boolean result = showLoginScreen( repositoryConnectController ); needToLogin.set( false ); if ( result ) { reinvoke.set( true ); return method.invoke( objectToHandle, args ); } reinvoke.set( false ); } } if ( reinvoke.get() ) { return method.invoke( objectToHandle, args ); } } throw exception; } }
SessionTimeoutHandler { public Object handle( Object objectToHandle, Throwable exception, Method method, Object[] args ) throws Throwable { if ( lookupForConnectTimeoutError( exception ) && !calledFromThisHandler() ) { try { return method.invoke( objectToHandle, args ); } catch ( InvocationTargetException ex2 ) { if ( !lookupForConnectTimeoutError( ex2 ) ) { throw ex2.getCause(); } } needToLogin.set( true ); synchronized ( this ) { if ( needToLogin.get() ) { boolean result = showLoginScreen( repositoryConnectController ); needToLogin.set( false ); if ( result ) { reinvoke.set( true ); return method.invoke( objectToHandle, args ); } reinvoke.set( false ); } } if ( reinvoke.get() ) { return method.invoke( objectToHandle, args ); } } throw exception; } SessionTimeoutHandler( RepositoryConnectController repositoryConnectController ); }
SessionTimeoutHandler { public Object handle( Object objectToHandle, Throwable exception, Method method, Object[] args ) throws Throwable { if ( lookupForConnectTimeoutError( exception ) && !calledFromThisHandler() ) { try { return method.invoke( objectToHandle, args ); } catch ( InvocationTargetException ex2 ) { if ( !lookupForConnectTimeoutError( ex2 ) ) { throw ex2.getCause(); } } needToLogin.set( true ); synchronized ( this ) { if ( needToLogin.get() ) { boolean result = showLoginScreen( repositoryConnectController ); needToLogin.set( false ); if ( result ) { reinvoke.set( true ); return method.invoke( objectToHandle, args ); } reinvoke.set( false ); } } if ( reinvoke.get() ) { return method.invoke( objectToHandle, args ); } } throw exception; } SessionTimeoutHandler( RepositoryConnectController repositoryConnectController ); Object handle( Object objectToHandle, Throwable exception, Method method, Object[] args ); }
SessionTimeoutHandler { public Object handle( Object objectToHandle, Throwable exception, Method method, Object[] args ) throws Throwable { if ( lookupForConnectTimeoutError( exception ) && !calledFromThisHandler() ) { try { return method.invoke( objectToHandle, args ); } catch ( InvocationTargetException ex2 ) { if ( !lookupForConnectTimeoutError( ex2 ) ) { throw ex2.getCause(); } } needToLogin.set( true ); synchronized ( this ) { if ( needToLogin.get() ) { boolean result = showLoginScreen( repositoryConnectController ); needToLogin.set( false ); if ( result ) { reinvoke.set( true ); return method.invoke( objectToHandle, args ); } reinvoke.set( false ); } } if ( reinvoke.get() ) { return method.invoke( objectToHandle, args ); } } throw exception; } SessionTimeoutHandler( RepositoryConnectController repositoryConnectController ); Object handle( Object objectToHandle, Throwable exception, Method method, Object[] args ); }
@SuppressWarnings( "unchecked" ) @Test public void testHandlerCallOnException() throws Throwable { when( metaStore.getName() ).thenThrow( KettleRepositoryLostException.class ); Method method = IMetaStore.class.getMethod( "getName" ); metaStoresessionTimeoutHandler.invoke( mock( Proxy.class ), method, new Object[0] ); verify( sessionTimeoutHandler ).handle( any(), any(), any(), any() ); }
@Override public Object invoke( Object proxy, Method method, Object[] args ) throws Throwable { try { return method.invoke( metaStore, args ); } catch ( InvocationTargetException ex ) { return sessionTimeoutHandler.handle( metaStore, ex.getCause(), method, args ); } }
MetaStoreSessionTimeoutHandler implements InvocationHandler { @Override public Object invoke( Object proxy, Method method, Object[] args ) throws Throwable { try { return method.invoke( metaStore, args ); } catch ( InvocationTargetException ex ) { return sessionTimeoutHandler.handle( metaStore, ex.getCause(), method, args ); } } }
MetaStoreSessionTimeoutHandler implements InvocationHandler { @Override public Object invoke( Object proxy, Method method, Object[] args ) throws Throwable { try { return method.invoke( metaStore, args ); } catch ( InvocationTargetException ex ) { return sessionTimeoutHandler.handle( metaStore, ex.getCause(), method, args ); } } MetaStoreSessionTimeoutHandler( IMetaStore metaStore, SessionTimeoutHandler sessionTimeoutHandler ); }
MetaStoreSessionTimeoutHandler implements InvocationHandler { @Override public Object invoke( Object proxy, Method method, Object[] args ) throws Throwable { try { return method.invoke( metaStore, args ); } catch ( InvocationTargetException ex ) { return sessionTimeoutHandler.handle( metaStore, ex.getCause(), method, args ); } } MetaStoreSessionTimeoutHandler( IMetaStore metaStore, SessionTimeoutHandler sessionTimeoutHandler ); @Override Object invoke( Object proxy, Method method, Object[] args ); }
MetaStoreSessionTimeoutHandler implements InvocationHandler { @Override public Object invoke( Object proxy, Method method, Object[] args ) throws Throwable { try { return method.invoke( metaStore, args ); } catch ( InvocationTargetException ex ) { return sessionTimeoutHandler.handle( metaStore, ex.getCause(), method, args ); } } MetaStoreSessionTimeoutHandler( IMetaStore metaStore, SessionTimeoutHandler sessionTimeoutHandler ); @Override Object invoke( Object proxy, Method method, Object[] args ); }
@Test public void setPipedOutputStream() { PipedOutputStream pipedOutputStream = new PipedOutputStream(); log4jPipedAppender.setPipedOutputStream( pipedOutputStream ); assertThat( log4jPipedAppender.getPipedOutputStream(), is( pipedOutputStream ) ); }
public void setPipedOutputStream( PipedOutputStream pipedOutputStream ) { this.pipedOutputStream = pipedOutputStream; }
Log4jPipedAppender implements Appender { public void setPipedOutputStream( PipedOutputStream pipedOutputStream ) { this.pipedOutputStream = pipedOutputStream; } }
Log4jPipedAppender implements Appender { public void setPipedOutputStream( PipedOutputStream pipedOutputStream ) { this.pipedOutputStream = pipedOutputStream; } Log4jPipedAppender(); }
Log4jPipedAppender implements Appender { public void setPipedOutputStream( PipedOutputStream pipedOutputStream ) { this.pipedOutputStream = pipedOutputStream; } Log4jPipedAppender(); void addFilter( Filter filter ); Filter getFilter(); void clearFilters(); void close(); void doAppend( LoggingEvent event ); void setName( String name ); String getName(); void setErrorHandler( ErrorHandler arg0 ); ErrorHandler getErrorHandler(); void setLayout( Layout layout ); Layout getLayout(); boolean requiresLayout(); PipedOutputStream getPipedOutputStream(); void setPipedOutputStream( PipedOutputStream pipedOutputStream ); void setFilter( Filter filter ); }
Log4jPipedAppender implements Appender { public void setPipedOutputStream( PipedOutputStream pipedOutputStream ) { this.pipedOutputStream = pipedOutputStream; } Log4jPipedAppender(); void addFilter( Filter filter ); Filter getFilter(); void clearFilters(); void close(); void doAppend( LoggingEvent event ); void setName( String name ); String getName(); void setErrorHandler( ErrorHandler arg0 ); ErrorHandler getErrorHandler(); void setLayout( Layout layout ); Layout getLayout(); boolean requiresLayout(); PipedOutputStream getPipedOutputStream(); void setPipedOutputStream( PipedOutputStream pipedOutputStream ); void setFilter( Filter filter ); }
@Test public void doAppend() throws IOException { PipedOutputStream pipedOutputStream = mock( PipedOutputStream.class ); LoggingEvent loggingEvent = mock( LoggingEvent.class ); Layout testLayout = mock( Layout.class ); when( testLayout.format( loggingEvent ) ).thenReturn( "LOG_TEST_LINE" ); log4jPipedAppender.setLayout( testLayout ); log4jPipedAppender.setPipedOutputStream( pipedOutputStream ); log4jPipedAppender.doAppend( loggingEvent ); verify( pipedOutputStream ).write( ( "LOG_TEST_LINE" + Const.CR ).getBytes() ); }
public void doAppend( LoggingEvent event ) { String line = layout.format( event ) + Const.CR; try { pipedOutputStream.write( line.getBytes() ); } catch ( IOException e ) { System.out.println( "Unable to write to piped output stream : " + e.getMessage() ); } }
Log4jPipedAppender implements Appender { public void doAppend( LoggingEvent event ) { String line = layout.format( event ) + Const.CR; try { pipedOutputStream.write( line.getBytes() ); } catch ( IOException e ) { System.out.println( "Unable to write to piped output stream : " + e.getMessage() ); } } }
Log4jPipedAppender implements Appender { public void doAppend( LoggingEvent event ) { String line = layout.format( event ) + Const.CR; try { pipedOutputStream.write( line.getBytes() ); } catch ( IOException e ) { System.out.println( "Unable to write to piped output stream : " + e.getMessage() ); } } Log4jPipedAppender(); }
Log4jPipedAppender implements Appender { public void doAppend( LoggingEvent event ) { String line = layout.format( event ) + Const.CR; try { pipedOutputStream.write( line.getBytes() ); } catch ( IOException e ) { System.out.println( "Unable to write to piped output stream : " + e.getMessage() ); } } Log4jPipedAppender(); void addFilter( Filter filter ); Filter getFilter(); void clearFilters(); void close(); void doAppend( LoggingEvent event ); void setName( String name ); String getName(); void setErrorHandler( ErrorHandler arg0 ); ErrorHandler getErrorHandler(); void setLayout( Layout layout ); Layout getLayout(); boolean requiresLayout(); PipedOutputStream getPipedOutputStream(); void setPipedOutputStream( PipedOutputStream pipedOutputStream ); void setFilter( Filter filter ); }
Log4jPipedAppender implements Appender { public void doAppend( LoggingEvent event ) { String line = layout.format( event ) + Const.CR; try { pipedOutputStream.write( line.getBytes() ); } catch ( IOException e ) { System.out.println( "Unable to write to piped output stream : " + e.getMessage() ); } } Log4jPipedAppender(); void addFilter( Filter filter ); Filter getFilter(); void clearFilters(); void close(); void doAppend( LoggingEvent event ); void setName( String name ); String getName(); void setErrorHandler( ErrorHandler arg0 ); ErrorHandler getErrorHandler(); void setLayout( Layout layout ); Layout getLayout(); boolean requiresLayout(); PipedOutputStream getPipedOutputStream(); void setPipedOutputStream( PipedOutputStream pipedOutputStream ); void setFilter( Filter filter ); }
@Test public void testRunsATrans() throws Exception { TransMeta parentMeta = new TransMeta( this.getClass().getResource( "subtrans-executor-parent.ktr" ).getPath(), new Variables() ); TransMeta subMeta = new TransMeta( this.getClass().getResource( "subtrans-executor-sub.ktr" ).getPath(), new Variables() ); LoggingObjectInterface loggingObject = new LoggingObject( "anything" ); Trans parentTrans = new Trans( parentMeta, loggingObject ); SubtransExecutor subtransExecutor = new SubtransExecutor( parentTrans, subMeta, true, new TransExecutorData(), new TransExecutorParameters() ); RowMetaInterface rowMeta = parentMeta.getStepFields( "Data Grid" ); List<RowMetaAndData> rows = Arrays.asList( new RowMetaAndData( rowMeta, "Pentaho", 1L ), new RowMetaAndData( rowMeta, "Pentaho", 2L ), new RowMetaAndData( rowMeta, "Pentaho", 3L ), new RowMetaAndData( rowMeta, "Pentaho", 4L ) ); subtransExecutor.execute( rows ); verify( this.logChannel ) .logBasic( "\n" + "------------> Linenr 1------------------------------\n" + "name = Pentaho\n" + "sum = 10\n" + "\n" + "====================" ); }
public Result execute( List<RowMetaAndData> rows ) throws KettleException { if ( rows.isEmpty() ) { return null; } this.transExecutorData.groupTimeStart = System.currentTimeMillis(); Trans subtrans = this.createSubtrans(); this.transExecutorData.setExecutorTrans( subtrans ); passParametersToTrans( subtrans, rows.get( 0 ) ); Result result = new Result(); result.setRows( rows ); subtrans.setPreviousResult( result ); subtrans.prepareExecution( this.parentTrans.getArguments() ); subtrans.startThreads(); subtrans.waitUntilFinished(); return subtrans.getResult(); }
SubtransExecutor { public Result execute( List<RowMetaAndData> rows ) throws KettleException { if ( rows.isEmpty() ) { return null; } this.transExecutorData.groupTimeStart = System.currentTimeMillis(); Trans subtrans = this.createSubtrans(); this.transExecutorData.setExecutorTrans( subtrans ); passParametersToTrans( subtrans, rows.get( 0 ) ); Result result = new Result(); result.setRows( rows ); subtrans.setPreviousResult( result ); subtrans.prepareExecution( this.parentTrans.getArguments() ); subtrans.startThreads(); subtrans.waitUntilFinished(); return subtrans.getResult(); } }
SubtransExecutor { public Result execute( List<RowMetaAndData> rows ) throws KettleException { if ( rows.isEmpty() ) { return null; } this.transExecutorData.groupTimeStart = System.currentTimeMillis(); Trans subtrans = this.createSubtrans(); this.transExecutorData.setExecutorTrans( subtrans ); passParametersToTrans( subtrans, rows.get( 0 ) ); Result result = new Result(); result.setRows( rows ); subtrans.setPreviousResult( result ); subtrans.prepareExecution( this.parentTrans.getArguments() ); subtrans.startThreads(); subtrans.waitUntilFinished(); return subtrans.getResult(); } SubtransExecutor( Trans parentTrans, TransMeta subtransMeta, boolean shareVariables, TransExecutorData transExecutorData, TransExecutorParameters parameters ); }
SubtransExecutor { public Result execute( List<RowMetaAndData> rows ) throws KettleException { if ( rows.isEmpty() ) { return null; } this.transExecutorData.groupTimeStart = System.currentTimeMillis(); Trans subtrans = this.createSubtrans(); this.transExecutorData.setExecutorTrans( subtrans ); passParametersToTrans( subtrans, rows.get( 0 ) ); Result result = new Result(); result.setRows( rows ); subtrans.setPreviousResult( result ); subtrans.prepareExecution( this.parentTrans.getArguments() ); subtrans.startThreads(); subtrans.waitUntilFinished(); return subtrans.getResult(); } SubtransExecutor( Trans parentTrans, TransMeta subtransMeta, boolean shareVariables, TransExecutorData transExecutorData, TransExecutorParameters parameters ); Result execute( List<RowMetaAndData> rows ); }
SubtransExecutor { public Result execute( List<RowMetaAndData> rows ) throws KettleException { if ( rows.isEmpty() ) { return null; } this.transExecutorData.groupTimeStart = System.currentTimeMillis(); Trans subtrans = this.createSubtrans(); this.transExecutorData.setExecutorTrans( subtrans ); passParametersToTrans( subtrans, rows.get( 0 ) ); Result result = new Result(); result.setRows( rows ); subtrans.setPreviousResult( result ); subtrans.prepareExecution( this.parentTrans.getArguments() ); subtrans.startThreads(); subtrans.waitUntilFinished(); return subtrans.getResult(); } SubtransExecutor( Trans parentTrans, TransMeta subtransMeta, boolean shareVariables, TransExecutorData transExecutorData, TransExecutorParameters parameters ); Result execute( List<RowMetaAndData> rows ); }
@Test public void close() throws IOException { PipedOutputStream pipedOutputStream = mock( PipedOutputStream.class ); log4jPipedAppender.setPipedOutputStream( pipedOutputStream ); log4jPipedAppender.close(); verify( pipedOutputStream ).close(); }
public void close() { try { pipedOutputStream.close(); } catch ( IOException e ) { System.out.println( "Unable to close piped output stream: " + e.getMessage() ); } }
Log4jPipedAppender implements Appender { public void close() { try { pipedOutputStream.close(); } catch ( IOException e ) { System.out.println( "Unable to close piped output stream: " + e.getMessage() ); } } }
Log4jPipedAppender implements Appender { public void close() { try { pipedOutputStream.close(); } catch ( IOException e ) { System.out.println( "Unable to close piped output stream: " + e.getMessage() ); } } Log4jPipedAppender(); }
Log4jPipedAppender implements Appender { public void close() { try { pipedOutputStream.close(); } catch ( IOException e ) { System.out.println( "Unable to close piped output stream: " + e.getMessage() ); } } Log4jPipedAppender(); void addFilter( Filter filter ); Filter getFilter(); void clearFilters(); void close(); void doAppend( LoggingEvent event ); void setName( String name ); String getName(); void setErrorHandler( ErrorHandler arg0 ); ErrorHandler getErrorHandler(); void setLayout( Layout layout ); Layout getLayout(); boolean requiresLayout(); PipedOutputStream getPipedOutputStream(); void setPipedOutputStream( PipedOutputStream pipedOutputStream ); void setFilter( Filter filter ); }
Log4jPipedAppender implements Appender { public void close() { try { pipedOutputStream.close(); } catch ( IOException e ) { System.out.println( "Unable to close piped output stream: " + e.getMessage() ); } } Log4jPipedAppender(); void addFilter( Filter filter ); Filter getFilter(); void clearFilters(); void close(); void doAppend( LoggingEvent event ); void setName( String name ); String getName(); void setErrorHandler( ErrorHandler arg0 ); ErrorHandler getErrorHandler(); void setLayout( Layout layout ); Layout getLayout(); boolean requiresLayout(); PipedOutputStream getPipedOutputStream(); void setPipedOutputStream( PipedOutputStream pipedOutputStream ); void setFilter( Filter filter ); }
@Test public void eventAddedError() { log4jPlugin.eventAdded( new KettleLoggingEvent( "ERROR_TEST_MESSAGE", 0L, LogLevel.ERROR ) ); verify( logger ).log( Level.ERROR, "ERROR_TEST_MESSAGE" ); }
@Override public void eventAdded( KettleLoggingEvent event ) { switch ( event.getLevel() ) { case ERROR: pentahoLogger.log( Level.ERROR, event.getMessage() ); break; case DEBUG: case ROWLEVEL: pentahoLogger.log( Level.DEBUG, event.getMessage() ); break; default: pentahoLogger.log( Level.INFO, event.getMessage() ); break; } }
Log4jLogging implements LoggingPluginInterface { @Override public void eventAdded( KettleLoggingEvent event ) { switch ( event.getLevel() ) { case ERROR: pentahoLogger.log( Level.ERROR, event.getMessage() ); break; case DEBUG: case ROWLEVEL: pentahoLogger.log( Level.DEBUG, event.getMessage() ); break; default: pentahoLogger.log( Level.INFO, event.getMessage() ); break; } } }
Log4jLogging implements LoggingPluginInterface { @Override public void eventAdded( KettleLoggingEvent event ) { switch ( event.getLevel() ) { case ERROR: pentahoLogger.log( Level.ERROR, event.getMessage() ); break; case DEBUG: case ROWLEVEL: pentahoLogger.log( Level.DEBUG, event.getMessage() ); break; default: pentahoLogger.log( Level.INFO, event.getMessage() ); break; } } Log4jLogging(); }
Log4jLogging implements LoggingPluginInterface { @Override public void eventAdded( KettleLoggingEvent event ) { switch ( event.getLevel() ) { case ERROR: pentahoLogger.log( Level.ERROR, event.getMessage() ); break; case DEBUG: case ROWLEVEL: pentahoLogger.log( Level.DEBUG, event.getMessage() ); break; default: pentahoLogger.log( Level.INFO, event.getMessage() ); break; } } Log4jLogging(); @Override void eventAdded( KettleLoggingEvent event ); @Override void init(); void dispose(); }
Log4jLogging implements LoggingPluginInterface { @Override public void eventAdded( KettleLoggingEvent event ) { switch ( event.getLevel() ) { case ERROR: pentahoLogger.log( Level.ERROR, event.getMessage() ); break; case DEBUG: case ROWLEVEL: pentahoLogger.log( Level.DEBUG, event.getMessage() ); break; default: pentahoLogger.log( Level.INFO, event.getMessage() ); break; } } Log4jLogging(); @Override void eventAdded( KettleLoggingEvent event ); @Override void init(); void dispose(); static final String PLUGIN_PROPERTIES_FILE; static final String STRING_PENTAHO_DI_LOGGER_NAME; static final String STRING_PENTAHO_DI_CONSOLE_APPENDER; }
@Test public void eventAddedDebug() { log4jPlugin.eventAdded( new KettleLoggingEvent( "DEBUG_TEST_MESSAGE", 0L, LogLevel.DEBUG ) ); verify( logger ).log( Level.DEBUG, "DEBUG_TEST_MESSAGE" ); }
@Override public void eventAdded( KettleLoggingEvent event ) { switch ( event.getLevel() ) { case ERROR: pentahoLogger.log( Level.ERROR, event.getMessage() ); break; case DEBUG: case ROWLEVEL: pentahoLogger.log( Level.DEBUG, event.getMessage() ); break; default: pentahoLogger.log( Level.INFO, event.getMessage() ); break; } }
Log4jLogging implements LoggingPluginInterface { @Override public void eventAdded( KettleLoggingEvent event ) { switch ( event.getLevel() ) { case ERROR: pentahoLogger.log( Level.ERROR, event.getMessage() ); break; case DEBUG: case ROWLEVEL: pentahoLogger.log( Level.DEBUG, event.getMessage() ); break; default: pentahoLogger.log( Level.INFO, event.getMessage() ); break; } } }
Log4jLogging implements LoggingPluginInterface { @Override public void eventAdded( KettleLoggingEvent event ) { switch ( event.getLevel() ) { case ERROR: pentahoLogger.log( Level.ERROR, event.getMessage() ); break; case DEBUG: case ROWLEVEL: pentahoLogger.log( Level.DEBUG, event.getMessage() ); break; default: pentahoLogger.log( Level.INFO, event.getMessage() ); break; } } Log4jLogging(); }
Log4jLogging implements LoggingPluginInterface { @Override public void eventAdded( KettleLoggingEvent event ) { switch ( event.getLevel() ) { case ERROR: pentahoLogger.log( Level.ERROR, event.getMessage() ); break; case DEBUG: case ROWLEVEL: pentahoLogger.log( Level.DEBUG, event.getMessage() ); break; default: pentahoLogger.log( Level.INFO, event.getMessage() ); break; } } Log4jLogging(); @Override void eventAdded( KettleLoggingEvent event ); @Override void init(); void dispose(); }
Log4jLogging implements LoggingPluginInterface { @Override public void eventAdded( KettleLoggingEvent event ) { switch ( event.getLevel() ) { case ERROR: pentahoLogger.log( Level.ERROR, event.getMessage() ); break; case DEBUG: case ROWLEVEL: pentahoLogger.log( Level.DEBUG, event.getMessage() ); break; default: pentahoLogger.log( Level.INFO, event.getMessage() ); break; } } Log4jLogging(); @Override void eventAdded( KettleLoggingEvent event ); @Override void init(); void dispose(); static final String PLUGIN_PROPERTIES_FILE; static final String STRING_PENTAHO_DI_LOGGER_NAME; static final String STRING_PENTAHO_DI_CONSOLE_APPENDER; }
@Test public void eventAddedDetailed() { log4jPlugin.eventAdded( new KettleLoggingEvent( "DETAILED_TEST_MESSAGE", 0L, LogLevel.DETAILED ) ); verify( logger ).log( Level.INFO, "DETAILED_TEST_MESSAGE" ); }
@Override public void eventAdded( KettleLoggingEvent event ) { switch ( event.getLevel() ) { case ERROR: pentahoLogger.log( Level.ERROR, event.getMessage() ); break; case DEBUG: case ROWLEVEL: pentahoLogger.log( Level.DEBUG, event.getMessage() ); break; default: pentahoLogger.log( Level.INFO, event.getMessage() ); break; } }
Log4jLogging implements LoggingPluginInterface { @Override public void eventAdded( KettleLoggingEvent event ) { switch ( event.getLevel() ) { case ERROR: pentahoLogger.log( Level.ERROR, event.getMessage() ); break; case DEBUG: case ROWLEVEL: pentahoLogger.log( Level.DEBUG, event.getMessage() ); break; default: pentahoLogger.log( Level.INFO, event.getMessage() ); break; } } }
Log4jLogging implements LoggingPluginInterface { @Override public void eventAdded( KettleLoggingEvent event ) { switch ( event.getLevel() ) { case ERROR: pentahoLogger.log( Level.ERROR, event.getMessage() ); break; case DEBUG: case ROWLEVEL: pentahoLogger.log( Level.DEBUG, event.getMessage() ); break; default: pentahoLogger.log( Level.INFO, event.getMessage() ); break; } } Log4jLogging(); }
Log4jLogging implements LoggingPluginInterface { @Override public void eventAdded( KettleLoggingEvent event ) { switch ( event.getLevel() ) { case ERROR: pentahoLogger.log( Level.ERROR, event.getMessage() ); break; case DEBUG: case ROWLEVEL: pentahoLogger.log( Level.DEBUG, event.getMessage() ); break; default: pentahoLogger.log( Level.INFO, event.getMessage() ); break; } } Log4jLogging(); @Override void eventAdded( KettleLoggingEvent event ); @Override void init(); void dispose(); }
Log4jLogging implements LoggingPluginInterface { @Override public void eventAdded( KettleLoggingEvent event ) { switch ( event.getLevel() ) { case ERROR: pentahoLogger.log( Level.ERROR, event.getMessage() ); break; case DEBUG: case ROWLEVEL: pentahoLogger.log( Level.DEBUG, event.getMessage() ); break; default: pentahoLogger.log( Level.INFO, event.getMessage() ); break; } } Log4jLogging(); @Override void eventAdded( KettleLoggingEvent event ); @Override void init(); void dispose(); static final String PLUGIN_PROPERTIES_FILE; static final String STRING_PENTAHO_DI_LOGGER_NAME; static final String STRING_PENTAHO_DI_CONSOLE_APPENDER; }
@Test public void eventAddedRowLevel() { log4jPlugin.eventAdded( new KettleLoggingEvent( "ROWLEVEL_TEST_MESSAGE", 0L, LogLevel.ROWLEVEL ) ); verify( logger ).log( Level.DEBUG, "ROWLEVEL_TEST_MESSAGE" ); }
@Override public void eventAdded( KettleLoggingEvent event ) { switch ( event.getLevel() ) { case ERROR: pentahoLogger.log( Level.ERROR, event.getMessage() ); break; case DEBUG: case ROWLEVEL: pentahoLogger.log( Level.DEBUG, event.getMessage() ); break; default: pentahoLogger.log( Level.INFO, event.getMessage() ); break; } }
Log4jLogging implements LoggingPluginInterface { @Override public void eventAdded( KettleLoggingEvent event ) { switch ( event.getLevel() ) { case ERROR: pentahoLogger.log( Level.ERROR, event.getMessage() ); break; case DEBUG: case ROWLEVEL: pentahoLogger.log( Level.DEBUG, event.getMessage() ); break; default: pentahoLogger.log( Level.INFO, event.getMessage() ); break; } } }
Log4jLogging implements LoggingPluginInterface { @Override public void eventAdded( KettleLoggingEvent event ) { switch ( event.getLevel() ) { case ERROR: pentahoLogger.log( Level.ERROR, event.getMessage() ); break; case DEBUG: case ROWLEVEL: pentahoLogger.log( Level.DEBUG, event.getMessage() ); break; default: pentahoLogger.log( Level.INFO, event.getMessage() ); break; } } Log4jLogging(); }
Log4jLogging implements LoggingPluginInterface { @Override public void eventAdded( KettleLoggingEvent event ) { switch ( event.getLevel() ) { case ERROR: pentahoLogger.log( Level.ERROR, event.getMessage() ); break; case DEBUG: case ROWLEVEL: pentahoLogger.log( Level.DEBUG, event.getMessage() ); break; default: pentahoLogger.log( Level.INFO, event.getMessage() ); break; } } Log4jLogging(); @Override void eventAdded( KettleLoggingEvent event ); @Override void init(); void dispose(); }
Log4jLogging implements LoggingPluginInterface { @Override public void eventAdded( KettleLoggingEvent event ) { switch ( event.getLevel() ) { case ERROR: pentahoLogger.log( Level.ERROR, event.getMessage() ); break; case DEBUG: case ROWLEVEL: pentahoLogger.log( Level.DEBUG, event.getMessage() ); break; default: pentahoLogger.log( Level.INFO, event.getMessage() ); break; } } Log4jLogging(); @Override void eventAdded( KettleLoggingEvent event ); @Override void init(); void dispose(); static final String PLUGIN_PROPERTIES_FILE; static final String STRING_PENTAHO_DI_LOGGER_NAME; static final String STRING_PENTAHO_DI_CONSOLE_APPENDER; }
@Test public void eventAddedBasic() { log4jPlugin.eventAdded( new KettleLoggingEvent( "BASIC_TEST_MESSAGE", 0L, LogLevel.BASIC ) ); verify( logger ).log( Level.INFO, "BASIC_TEST_MESSAGE" ); }
@Override public void eventAdded( KettleLoggingEvent event ) { switch ( event.getLevel() ) { case ERROR: pentahoLogger.log( Level.ERROR, event.getMessage() ); break; case DEBUG: case ROWLEVEL: pentahoLogger.log( Level.DEBUG, event.getMessage() ); break; default: pentahoLogger.log( Level.INFO, event.getMessage() ); break; } }
Log4jLogging implements LoggingPluginInterface { @Override public void eventAdded( KettleLoggingEvent event ) { switch ( event.getLevel() ) { case ERROR: pentahoLogger.log( Level.ERROR, event.getMessage() ); break; case DEBUG: case ROWLEVEL: pentahoLogger.log( Level.DEBUG, event.getMessage() ); break; default: pentahoLogger.log( Level.INFO, event.getMessage() ); break; } } }
Log4jLogging implements LoggingPluginInterface { @Override public void eventAdded( KettleLoggingEvent event ) { switch ( event.getLevel() ) { case ERROR: pentahoLogger.log( Level.ERROR, event.getMessage() ); break; case DEBUG: case ROWLEVEL: pentahoLogger.log( Level.DEBUG, event.getMessage() ); break; default: pentahoLogger.log( Level.INFO, event.getMessage() ); break; } } Log4jLogging(); }
Log4jLogging implements LoggingPluginInterface { @Override public void eventAdded( KettleLoggingEvent event ) { switch ( event.getLevel() ) { case ERROR: pentahoLogger.log( Level.ERROR, event.getMessage() ); break; case DEBUG: case ROWLEVEL: pentahoLogger.log( Level.DEBUG, event.getMessage() ); break; default: pentahoLogger.log( Level.INFO, event.getMessage() ); break; } } Log4jLogging(); @Override void eventAdded( KettleLoggingEvent event ); @Override void init(); void dispose(); }
Log4jLogging implements LoggingPluginInterface { @Override public void eventAdded( KettleLoggingEvent event ) { switch ( event.getLevel() ) { case ERROR: pentahoLogger.log( Level.ERROR, event.getMessage() ); break; case DEBUG: case ROWLEVEL: pentahoLogger.log( Level.DEBUG, event.getMessage() ); break; default: pentahoLogger.log( Level.INFO, event.getMessage() ); break; } } Log4jLogging(); @Override void eventAdded( KettleLoggingEvent event ); @Override void init(); void dispose(); static final String PLUGIN_PROPERTIES_FILE; static final String STRING_PENTAHO_DI_LOGGER_NAME; static final String STRING_PENTAHO_DI_CONSOLE_APPENDER; }
@Test public void eventAddedMinimal() { log4jPlugin.eventAdded( new KettleLoggingEvent( "MINIMAL_TEST_MESSAGE", 0L, LogLevel.MINIMAL ) ); verify( logger ).log( Level.INFO, "MINIMAL_TEST_MESSAGE" ); }
@Override public void eventAdded( KettleLoggingEvent event ) { switch ( event.getLevel() ) { case ERROR: pentahoLogger.log( Level.ERROR, event.getMessage() ); break; case DEBUG: case ROWLEVEL: pentahoLogger.log( Level.DEBUG, event.getMessage() ); break; default: pentahoLogger.log( Level.INFO, event.getMessage() ); break; } }
Log4jLogging implements LoggingPluginInterface { @Override public void eventAdded( KettleLoggingEvent event ) { switch ( event.getLevel() ) { case ERROR: pentahoLogger.log( Level.ERROR, event.getMessage() ); break; case DEBUG: case ROWLEVEL: pentahoLogger.log( Level.DEBUG, event.getMessage() ); break; default: pentahoLogger.log( Level.INFO, event.getMessage() ); break; } } }
Log4jLogging implements LoggingPluginInterface { @Override public void eventAdded( KettleLoggingEvent event ) { switch ( event.getLevel() ) { case ERROR: pentahoLogger.log( Level.ERROR, event.getMessage() ); break; case DEBUG: case ROWLEVEL: pentahoLogger.log( Level.DEBUG, event.getMessage() ); break; default: pentahoLogger.log( Level.INFO, event.getMessage() ); break; } } Log4jLogging(); }
Log4jLogging implements LoggingPluginInterface { @Override public void eventAdded( KettleLoggingEvent event ) { switch ( event.getLevel() ) { case ERROR: pentahoLogger.log( Level.ERROR, event.getMessage() ); break; case DEBUG: case ROWLEVEL: pentahoLogger.log( Level.DEBUG, event.getMessage() ); break; default: pentahoLogger.log( Level.INFO, event.getMessage() ); break; } } Log4jLogging(); @Override void eventAdded( KettleLoggingEvent event ); @Override void init(); void dispose(); }
Log4jLogging implements LoggingPluginInterface { @Override public void eventAdded( KettleLoggingEvent event ) { switch ( event.getLevel() ) { case ERROR: pentahoLogger.log( Level.ERROR, event.getMessage() ); break; case DEBUG: case ROWLEVEL: pentahoLogger.log( Level.DEBUG, event.getMessage() ); break; default: pentahoLogger.log( Level.INFO, event.getMessage() ); break; } } Log4jLogging(); @Override void eventAdded( KettleLoggingEvent event ); @Override void init(); void dispose(); static final String PLUGIN_PROPERTIES_FILE; static final String STRING_PENTAHO_DI_LOGGER_NAME; static final String STRING_PENTAHO_DI_CONSOLE_APPENDER; }
@Test public void formatNonLogMessage_without_add_time() { Log4jKettleLayout layout = new Log4jKettleLayout( false ); String actualResult = layout.format( mock( LoggingEvent.class ) ); assertThat( actualResult, equalTo( "<null>" ) ); }
public String format( LoggingEvent event ) { StringBuffer line = new StringBuffer(); String dateTimeString = ""; if ( timeAdded ) { dateTimeString = LOCAL_SIMPLE_DATE_PARSER.get().format( new Date( event.timeStamp ) ) + " - "; } Object object = event.getMessage(); if ( object instanceof LogMessage ) { LogMessage message = (LogMessage) object; String[] parts = message.getMessage().split( Const.CR ); for ( int i = 0; i < parts.length; i++ ) { line.append( dateTimeString ); if ( message.getSubject() != null ) { line.append( message.getSubject() ); if ( message.getCopy() != null ) { line.append( "." ).append( message.getCopy() ); } line.append( " - " ); } if ( message.isError() ) { BuildVersion buildVersion = BuildVersion.getInstance(); line.append( ERROR_STRING ); line.append( " (version " ); line.append( buildVersion.getVersion() ); if ( !Utils.isEmpty( buildVersion.getRevision() ) ) { line.append( ", build " ); line.append( buildVersion.getRevision() ); } if ( !Utils.isEmpty( buildVersion.getBuildDate() ) ) { line.append( " from " ); line.append( buildVersion.getBuildDate() ); } if ( !Utils.isEmpty( buildVersion.getBuildUser() ) ) { line.append( " by " ); line.append( buildVersion.getBuildUser() ); } line.append( ") : " ); } line.append( parts[i] ); if ( i < parts.length - 1 ) { line.append( Const.CR ); } } } else { line.append( dateTimeString ); line.append( ( object != null ? object.toString() : "<null>" ) ); } return line.toString(); }
Log4jKettleLayout extends Layout implements Log4JLayoutInterface { public String format( LoggingEvent event ) { StringBuffer line = new StringBuffer(); String dateTimeString = ""; if ( timeAdded ) { dateTimeString = LOCAL_SIMPLE_DATE_PARSER.get().format( new Date( event.timeStamp ) ) + " - "; } Object object = event.getMessage(); if ( object instanceof LogMessage ) { LogMessage message = (LogMessage) object; String[] parts = message.getMessage().split( Const.CR ); for ( int i = 0; i < parts.length; i++ ) { line.append( dateTimeString ); if ( message.getSubject() != null ) { line.append( message.getSubject() ); if ( message.getCopy() != null ) { line.append( "." ).append( message.getCopy() ); } line.append( " - " ); } if ( message.isError() ) { BuildVersion buildVersion = BuildVersion.getInstance(); line.append( ERROR_STRING ); line.append( " (version " ); line.append( buildVersion.getVersion() ); if ( !Utils.isEmpty( buildVersion.getRevision() ) ) { line.append( ", build " ); line.append( buildVersion.getRevision() ); } if ( !Utils.isEmpty( buildVersion.getBuildDate() ) ) { line.append( " from " ); line.append( buildVersion.getBuildDate() ); } if ( !Utils.isEmpty( buildVersion.getBuildUser() ) ) { line.append( " by " ); line.append( buildVersion.getBuildUser() ); } line.append( ") : " ); } line.append( parts[i] ); if ( i < parts.length - 1 ) { line.append( Const.CR ); } } } else { line.append( dateTimeString ); line.append( ( object != null ? object.toString() : "<null>" ) ); } return line.toString(); } }
Log4jKettleLayout extends Layout implements Log4JLayoutInterface { public String format( LoggingEvent event ) { StringBuffer line = new StringBuffer(); String dateTimeString = ""; if ( timeAdded ) { dateTimeString = LOCAL_SIMPLE_DATE_PARSER.get().format( new Date( event.timeStamp ) ) + " - "; } Object object = event.getMessage(); if ( object instanceof LogMessage ) { LogMessage message = (LogMessage) object; String[] parts = message.getMessage().split( Const.CR ); for ( int i = 0; i < parts.length; i++ ) { line.append( dateTimeString ); if ( message.getSubject() != null ) { line.append( message.getSubject() ); if ( message.getCopy() != null ) { line.append( "." ).append( message.getCopy() ); } line.append( " - " ); } if ( message.isError() ) { BuildVersion buildVersion = BuildVersion.getInstance(); line.append( ERROR_STRING ); line.append( " (version " ); line.append( buildVersion.getVersion() ); if ( !Utils.isEmpty( buildVersion.getRevision() ) ) { line.append( ", build " ); line.append( buildVersion.getRevision() ); } if ( !Utils.isEmpty( buildVersion.getBuildDate() ) ) { line.append( " from " ); line.append( buildVersion.getBuildDate() ); } if ( !Utils.isEmpty( buildVersion.getBuildUser() ) ) { line.append( " by " ); line.append( buildVersion.getBuildUser() ); } line.append( ") : " ); } line.append( parts[i] ); if ( i < parts.length - 1 ) { line.append( Const.CR ); } } } else { line.append( dateTimeString ); line.append( ( object != null ? object.toString() : "<null>" ) ); } return line.toString(); } Log4jKettleLayout(); Log4jKettleLayout( boolean addTime ); }
Log4jKettleLayout extends Layout implements Log4JLayoutInterface { public String format( LoggingEvent event ) { StringBuffer line = new StringBuffer(); String dateTimeString = ""; if ( timeAdded ) { dateTimeString = LOCAL_SIMPLE_DATE_PARSER.get().format( new Date( event.timeStamp ) ) + " - "; } Object object = event.getMessage(); if ( object instanceof LogMessage ) { LogMessage message = (LogMessage) object; String[] parts = message.getMessage().split( Const.CR ); for ( int i = 0; i < parts.length; i++ ) { line.append( dateTimeString ); if ( message.getSubject() != null ) { line.append( message.getSubject() ); if ( message.getCopy() != null ) { line.append( "." ).append( message.getCopy() ); } line.append( " - " ); } if ( message.isError() ) { BuildVersion buildVersion = BuildVersion.getInstance(); line.append( ERROR_STRING ); line.append( " (version " ); line.append( buildVersion.getVersion() ); if ( !Utils.isEmpty( buildVersion.getRevision() ) ) { line.append( ", build " ); line.append( buildVersion.getRevision() ); } if ( !Utils.isEmpty( buildVersion.getBuildDate() ) ) { line.append( " from " ); line.append( buildVersion.getBuildDate() ); } if ( !Utils.isEmpty( buildVersion.getBuildUser() ) ) { line.append( " by " ); line.append( buildVersion.getBuildUser() ); } line.append( ") : " ); } line.append( parts[i] ); if ( i < parts.length - 1 ) { line.append( Const.CR ); } } } else { line.append( dateTimeString ); line.append( ( object != null ? object.toString() : "<null>" ) ); } return line.toString(); } Log4jKettleLayout(); Log4jKettleLayout( boolean addTime ); String format( LoggingEvent event ); boolean ignoresThrowable(); void activateOptions(); boolean isTimeAdded(); void setTimeAdded( boolean addTime ); }
Log4jKettleLayout extends Layout implements Log4JLayoutInterface { public String format( LoggingEvent event ) { StringBuffer line = new StringBuffer(); String dateTimeString = ""; if ( timeAdded ) { dateTimeString = LOCAL_SIMPLE_DATE_PARSER.get().format( new Date( event.timeStamp ) ) + " - "; } Object object = event.getMessage(); if ( object instanceof LogMessage ) { LogMessage message = (LogMessage) object; String[] parts = message.getMessage().split( Const.CR ); for ( int i = 0; i < parts.length; i++ ) { line.append( dateTimeString ); if ( message.getSubject() != null ) { line.append( message.getSubject() ); if ( message.getCopy() != null ) { line.append( "." ).append( message.getCopy() ); } line.append( " - " ); } if ( message.isError() ) { BuildVersion buildVersion = BuildVersion.getInstance(); line.append( ERROR_STRING ); line.append( " (version " ); line.append( buildVersion.getVersion() ); if ( !Utils.isEmpty( buildVersion.getRevision() ) ) { line.append( ", build " ); line.append( buildVersion.getRevision() ); } if ( !Utils.isEmpty( buildVersion.getBuildDate() ) ) { line.append( " from " ); line.append( buildVersion.getBuildDate() ); } if ( !Utils.isEmpty( buildVersion.getBuildUser() ) ) { line.append( " by " ); line.append( buildVersion.getBuildUser() ); } line.append( ") : " ); } line.append( parts[i] ); if ( i < parts.length - 1 ) { line.append( Const.CR ); } } } else { line.append( dateTimeString ); line.append( ( object != null ? object.toString() : "<null>" ) ); } return line.toString(); } Log4jKettleLayout(); Log4jKettleLayout( boolean addTime ); String format( LoggingEvent event ); boolean ignoresThrowable(); void activateOptions(); boolean isTimeAdded(); void setTimeAdded( boolean addTime ); static final String ERROR_STRING; }
@Test public void formatNonLogMessage_with_add_time() { Log4jKettleLayout layout = new Log4jKettleLayout( true ); String actualResult = layout.format( mock( LoggingEvent.class ) ); assertThat( actualResult, equalTo( "1970/01/01 00:00:00 - <null>" ) ); }
public String format( LoggingEvent event ) { StringBuffer line = new StringBuffer(); String dateTimeString = ""; if ( timeAdded ) { dateTimeString = LOCAL_SIMPLE_DATE_PARSER.get().format( new Date( event.timeStamp ) ) + " - "; } Object object = event.getMessage(); if ( object instanceof LogMessage ) { LogMessage message = (LogMessage) object; String[] parts = message.getMessage().split( Const.CR ); for ( int i = 0; i < parts.length; i++ ) { line.append( dateTimeString ); if ( message.getSubject() != null ) { line.append( message.getSubject() ); if ( message.getCopy() != null ) { line.append( "." ).append( message.getCopy() ); } line.append( " - " ); } if ( message.isError() ) { BuildVersion buildVersion = BuildVersion.getInstance(); line.append( ERROR_STRING ); line.append( " (version " ); line.append( buildVersion.getVersion() ); if ( !Utils.isEmpty( buildVersion.getRevision() ) ) { line.append( ", build " ); line.append( buildVersion.getRevision() ); } if ( !Utils.isEmpty( buildVersion.getBuildDate() ) ) { line.append( " from " ); line.append( buildVersion.getBuildDate() ); } if ( !Utils.isEmpty( buildVersion.getBuildUser() ) ) { line.append( " by " ); line.append( buildVersion.getBuildUser() ); } line.append( ") : " ); } line.append( parts[i] ); if ( i < parts.length - 1 ) { line.append( Const.CR ); } } } else { line.append( dateTimeString ); line.append( ( object != null ? object.toString() : "<null>" ) ); } return line.toString(); }
Log4jKettleLayout extends Layout implements Log4JLayoutInterface { public String format( LoggingEvent event ) { StringBuffer line = new StringBuffer(); String dateTimeString = ""; if ( timeAdded ) { dateTimeString = LOCAL_SIMPLE_DATE_PARSER.get().format( new Date( event.timeStamp ) ) + " - "; } Object object = event.getMessage(); if ( object instanceof LogMessage ) { LogMessage message = (LogMessage) object; String[] parts = message.getMessage().split( Const.CR ); for ( int i = 0; i < parts.length; i++ ) { line.append( dateTimeString ); if ( message.getSubject() != null ) { line.append( message.getSubject() ); if ( message.getCopy() != null ) { line.append( "." ).append( message.getCopy() ); } line.append( " - " ); } if ( message.isError() ) { BuildVersion buildVersion = BuildVersion.getInstance(); line.append( ERROR_STRING ); line.append( " (version " ); line.append( buildVersion.getVersion() ); if ( !Utils.isEmpty( buildVersion.getRevision() ) ) { line.append( ", build " ); line.append( buildVersion.getRevision() ); } if ( !Utils.isEmpty( buildVersion.getBuildDate() ) ) { line.append( " from " ); line.append( buildVersion.getBuildDate() ); } if ( !Utils.isEmpty( buildVersion.getBuildUser() ) ) { line.append( " by " ); line.append( buildVersion.getBuildUser() ); } line.append( ") : " ); } line.append( parts[i] ); if ( i < parts.length - 1 ) { line.append( Const.CR ); } } } else { line.append( dateTimeString ); line.append( ( object != null ? object.toString() : "<null>" ) ); } return line.toString(); } }
Log4jKettleLayout extends Layout implements Log4JLayoutInterface { public String format( LoggingEvent event ) { StringBuffer line = new StringBuffer(); String dateTimeString = ""; if ( timeAdded ) { dateTimeString = LOCAL_SIMPLE_DATE_PARSER.get().format( new Date( event.timeStamp ) ) + " - "; } Object object = event.getMessage(); if ( object instanceof LogMessage ) { LogMessage message = (LogMessage) object; String[] parts = message.getMessage().split( Const.CR ); for ( int i = 0; i < parts.length; i++ ) { line.append( dateTimeString ); if ( message.getSubject() != null ) { line.append( message.getSubject() ); if ( message.getCopy() != null ) { line.append( "." ).append( message.getCopy() ); } line.append( " - " ); } if ( message.isError() ) { BuildVersion buildVersion = BuildVersion.getInstance(); line.append( ERROR_STRING ); line.append( " (version " ); line.append( buildVersion.getVersion() ); if ( !Utils.isEmpty( buildVersion.getRevision() ) ) { line.append( ", build " ); line.append( buildVersion.getRevision() ); } if ( !Utils.isEmpty( buildVersion.getBuildDate() ) ) { line.append( " from " ); line.append( buildVersion.getBuildDate() ); } if ( !Utils.isEmpty( buildVersion.getBuildUser() ) ) { line.append( " by " ); line.append( buildVersion.getBuildUser() ); } line.append( ") : " ); } line.append( parts[i] ); if ( i < parts.length - 1 ) { line.append( Const.CR ); } } } else { line.append( dateTimeString ); line.append( ( object != null ? object.toString() : "<null>" ) ); } return line.toString(); } Log4jKettleLayout(); Log4jKettleLayout( boolean addTime ); }
Log4jKettleLayout extends Layout implements Log4JLayoutInterface { public String format( LoggingEvent event ) { StringBuffer line = new StringBuffer(); String dateTimeString = ""; if ( timeAdded ) { dateTimeString = LOCAL_SIMPLE_DATE_PARSER.get().format( new Date( event.timeStamp ) ) + " - "; } Object object = event.getMessage(); if ( object instanceof LogMessage ) { LogMessage message = (LogMessage) object; String[] parts = message.getMessage().split( Const.CR ); for ( int i = 0; i < parts.length; i++ ) { line.append( dateTimeString ); if ( message.getSubject() != null ) { line.append( message.getSubject() ); if ( message.getCopy() != null ) { line.append( "." ).append( message.getCopy() ); } line.append( " - " ); } if ( message.isError() ) { BuildVersion buildVersion = BuildVersion.getInstance(); line.append( ERROR_STRING ); line.append( " (version " ); line.append( buildVersion.getVersion() ); if ( !Utils.isEmpty( buildVersion.getRevision() ) ) { line.append( ", build " ); line.append( buildVersion.getRevision() ); } if ( !Utils.isEmpty( buildVersion.getBuildDate() ) ) { line.append( " from " ); line.append( buildVersion.getBuildDate() ); } if ( !Utils.isEmpty( buildVersion.getBuildUser() ) ) { line.append( " by " ); line.append( buildVersion.getBuildUser() ); } line.append( ") : " ); } line.append( parts[i] ); if ( i < parts.length - 1 ) { line.append( Const.CR ); } } } else { line.append( dateTimeString ); line.append( ( object != null ? object.toString() : "<null>" ) ); } return line.toString(); } Log4jKettleLayout(); Log4jKettleLayout( boolean addTime ); String format( LoggingEvent event ); boolean ignoresThrowable(); void activateOptions(); boolean isTimeAdded(); void setTimeAdded( boolean addTime ); }
Log4jKettleLayout extends Layout implements Log4JLayoutInterface { public String format( LoggingEvent event ) { StringBuffer line = new StringBuffer(); String dateTimeString = ""; if ( timeAdded ) { dateTimeString = LOCAL_SIMPLE_DATE_PARSER.get().format( new Date( event.timeStamp ) ) + " - "; } Object object = event.getMessage(); if ( object instanceof LogMessage ) { LogMessage message = (LogMessage) object; String[] parts = message.getMessage().split( Const.CR ); for ( int i = 0; i < parts.length; i++ ) { line.append( dateTimeString ); if ( message.getSubject() != null ) { line.append( message.getSubject() ); if ( message.getCopy() != null ) { line.append( "." ).append( message.getCopy() ); } line.append( " - " ); } if ( message.isError() ) { BuildVersion buildVersion = BuildVersion.getInstance(); line.append( ERROR_STRING ); line.append( " (version " ); line.append( buildVersion.getVersion() ); if ( !Utils.isEmpty( buildVersion.getRevision() ) ) { line.append( ", build " ); line.append( buildVersion.getRevision() ); } if ( !Utils.isEmpty( buildVersion.getBuildDate() ) ) { line.append( " from " ); line.append( buildVersion.getBuildDate() ); } if ( !Utils.isEmpty( buildVersion.getBuildUser() ) ) { line.append( " by " ); line.append( buildVersion.getBuildUser() ); } line.append( ") : " ); } line.append( parts[i] ); if ( i < parts.length - 1 ) { line.append( Const.CR ); } } } else { line.append( dateTimeString ); line.append( ( object != null ? object.toString() : "<null>" ) ); } return line.toString(); } Log4jKettleLayout(); Log4jKettleLayout( boolean addTime ); String format( LoggingEvent event ); boolean ignoresThrowable(); void activateOptions(); boolean isTimeAdded(); void setTimeAdded( boolean addTime ); static final String ERROR_STRING; }
@Test public void formatLogMessage_without_add_time() { Log4jKettleLayout layout = new Log4jKettleLayout( false ); LoggingEvent loggingEvent = mock( LoggingEvent.class ); LogMessage logMessage = new LogMessage( "TEST_MESSAGE", "TEST_ID", LogLevel.BASIC ); when( loggingEvent.getMessage() ).thenReturn( logMessage ); String actualResult = layout.format( loggingEvent ); assertThat( actualResult, equalTo( "TEST_MESSAGE" ) ); }
public String format( LoggingEvent event ) { StringBuffer line = new StringBuffer(); String dateTimeString = ""; if ( timeAdded ) { dateTimeString = LOCAL_SIMPLE_DATE_PARSER.get().format( new Date( event.timeStamp ) ) + " - "; } Object object = event.getMessage(); if ( object instanceof LogMessage ) { LogMessage message = (LogMessage) object; String[] parts = message.getMessage().split( Const.CR ); for ( int i = 0; i < parts.length; i++ ) { line.append( dateTimeString ); if ( message.getSubject() != null ) { line.append( message.getSubject() ); if ( message.getCopy() != null ) { line.append( "." ).append( message.getCopy() ); } line.append( " - " ); } if ( message.isError() ) { BuildVersion buildVersion = BuildVersion.getInstance(); line.append( ERROR_STRING ); line.append( " (version " ); line.append( buildVersion.getVersion() ); if ( !Utils.isEmpty( buildVersion.getRevision() ) ) { line.append( ", build " ); line.append( buildVersion.getRevision() ); } if ( !Utils.isEmpty( buildVersion.getBuildDate() ) ) { line.append( " from " ); line.append( buildVersion.getBuildDate() ); } if ( !Utils.isEmpty( buildVersion.getBuildUser() ) ) { line.append( " by " ); line.append( buildVersion.getBuildUser() ); } line.append( ") : " ); } line.append( parts[i] ); if ( i < parts.length - 1 ) { line.append( Const.CR ); } } } else { line.append( dateTimeString ); line.append( ( object != null ? object.toString() : "<null>" ) ); } return line.toString(); }
Log4jKettleLayout extends Layout implements Log4JLayoutInterface { public String format( LoggingEvent event ) { StringBuffer line = new StringBuffer(); String dateTimeString = ""; if ( timeAdded ) { dateTimeString = LOCAL_SIMPLE_DATE_PARSER.get().format( new Date( event.timeStamp ) ) + " - "; } Object object = event.getMessage(); if ( object instanceof LogMessage ) { LogMessage message = (LogMessage) object; String[] parts = message.getMessage().split( Const.CR ); for ( int i = 0; i < parts.length; i++ ) { line.append( dateTimeString ); if ( message.getSubject() != null ) { line.append( message.getSubject() ); if ( message.getCopy() != null ) { line.append( "." ).append( message.getCopy() ); } line.append( " - " ); } if ( message.isError() ) { BuildVersion buildVersion = BuildVersion.getInstance(); line.append( ERROR_STRING ); line.append( " (version " ); line.append( buildVersion.getVersion() ); if ( !Utils.isEmpty( buildVersion.getRevision() ) ) { line.append( ", build " ); line.append( buildVersion.getRevision() ); } if ( !Utils.isEmpty( buildVersion.getBuildDate() ) ) { line.append( " from " ); line.append( buildVersion.getBuildDate() ); } if ( !Utils.isEmpty( buildVersion.getBuildUser() ) ) { line.append( " by " ); line.append( buildVersion.getBuildUser() ); } line.append( ") : " ); } line.append( parts[i] ); if ( i < parts.length - 1 ) { line.append( Const.CR ); } } } else { line.append( dateTimeString ); line.append( ( object != null ? object.toString() : "<null>" ) ); } return line.toString(); } }
Log4jKettleLayout extends Layout implements Log4JLayoutInterface { public String format( LoggingEvent event ) { StringBuffer line = new StringBuffer(); String dateTimeString = ""; if ( timeAdded ) { dateTimeString = LOCAL_SIMPLE_DATE_PARSER.get().format( new Date( event.timeStamp ) ) + " - "; } Object object = event.getMessage(); if ( object instanceof LogMessage ) { LogMessage message = (LogMessage) object; String[] parts = message.getMessage().split( Const.CR ); for ( int i = 0; i < parts.length; i++ ) { line.append( dateTimeString ); if ( message.getSubject() != null ) { line.append( message.getSubject() ); if ( message.getCopy() != null ) { line.append( "." ).append( message.getCopy() ); } line.append( " - " ); } if ( message.isError() ) { BuildVersion buildVersion = BuildVersion.getInstance(); line.append( ERROR_STRING ); line.append( " (version " ); line.append( buildVersion.getVersion() ); if ( !Utils.isEmpty( buildVersion.getRevision() ) ) { line.append( ", build " ); line.append( buildVersion.getRevision() ); } if ( !Utils.isEmpty( buildVersion.getBuildDate() ) ) { line.append( " from " ); line.append( buildVersion.getBuildDate() ); } if ( !Utils.isEmpty( buildVersion.getBuildUser() ) ) { line.append( " by " ); line.append( buildVersion.getBuildUser() ); } line.append( ") : " ); } line.append( parts[i] ); if ( i < parts.length - 1 ) { line.append( Const.CR ); } } } else { line.append( dateTimeString ); line.append( ( object != null ? object.toString() : "<null>" ) ); } return line.toString(); } Log4jKettleLayout(); Log4jKettleLayout( boolean addTime ); }
Log4jKettleLayout extends Layout implements Log4JLayoutInterface { public String format( LoggingEvent event ) { StringBuffer line = new StringBuffer(); String dateTimeString = ""; if ( timeAdded ) { dateTimeString = LOCAL_SIMPLE_DATE_PARSER.get().format( new Date( event.timeStamp ) ) + " - "; } Object object = event.getMessage(); if ( object instanceof LogMessage ) { LogMessage message = (LogMessage) object; String[] parts = message.getMessage().split( Const.CR ); for ( int i = 0; i < parts.length; i++ ) { line.append( dateTimeString ); if ( message.getSubject() != null ) { line.append( message.getSubject() ); if ( message.getCopy() != null ) { line.append( "." ).append( message.getCopy() ); } line.append( " - " ); } if ( message.isError() ) { BuildVersion buildVersion = BuildVersion.getInstance(); line.append( ERROR_STRING ); line.append( " (version " ); line.append( buildVersion.getVersion() ); if ( !Utils.isEmpty( buildVersion.getRevision() ) ) { line.append( ", build " ); line.append( buildVersion.getRevision() ); } if ( !Utils.isEmpty( buildVersion.getBuildDate() ) ) { line.append( " from " ); line.append( buildVersion.getBuildDate() ); } if ( !Utils.isEmpty( buildVersion.getBuildUser() ) ) { line.append( " by " ); line.append( buildVersion.getBuildUser() ); } line.append( ") : " ); } line.append( parts[i] ); if ( i < parts.length - 1 ) { line.append( Const.CR ); } } } else { line.append( dateTimeString ); line.append( ( object != null ? object.toString() : "<null>" ) ); } return line.toString(); } Log4jKettleLayout(); Log4jKettleLayout( boolean addTime ); String format( LoggingEvent event ); boolean ignoresThrowable(); void activateOptions(); boolean isTimeAdded(); void setTimeAdded( boolean addTime ); }
Log4jKettleLayout extends Layout implements Log4JLayoutInterface { public String format( LoggingEvent event ) { StringBuffer line = new StringBuffer(); String dateTimeString = ""; if ( timeAdded ) { dateTimeString = LOCAL_SIMPLE_DATE_PARSER.get().format( new Date( event.timeStamp ) ) + " - "; } Object object = event.getMessage(); if ( object instanceof LogMessage ) { LogMessage message = (LogMessage) object; String[] parts = message.getMessage().split( Const.CR ); for ( int i = 0; i < parts.length; i++ ) { line.append( dateTimeString ); if ( message.getSubject() != null ) { line.append( message.getSubject() ); if ( message.getCopy() != null ) { line.append( "." ).append( message.getCopy() ); } line.append( " - " ); } if ( message.isError() ) { BuildVersion buildVersion = BuildVersion.getInstance(); line.append( ERROR_STRING ); line.append( " (version " ); line.append( buildVersion.getVersion() ); if ( !Utils.isEmpty( buildVersion.getRevision() ) ) { line.append( ", build " ); line.append( buildVersion.getRevision() ); } if ( !Utils.isEmpty( buildVersion.getBuildDate() ) ) { line.append( " from " ); line.append( buildVersion.getBuildDate() ); } if ( !Utils.isEmpty( buildVersion.getBuildUser() ) ) { line.append( " by " ); line.append( buildVersion.getBuildUser() ); } line.append( ") : " ); } line.append( parts[i] ); if ( i < parts.length - 1 ) { line.append( Const.CR ); } } } else { line.append( dateTimeString ); line.append( ( object != null ? object.toString() : "<null>" ) ); } return line.toString(); } Log4jKettleLayout(); Log4jKettleLayout( boolean addTime ); String format( LoggingEvent event ); boolean ignoresThrowable(); void activateOptions(); boolean isTimeAdded(); void setTimeAdded( boolean addTime ); static final String ERROR_STRING; }
@Test public void testConnectRepository() throws KettleException { TransExecutionConfiguration transExecConf = new TransExecutionConfiguration(); final RepositoriesMeta repositoriesMeta = mock( RepositoriesMeta.class ); final RepositoryMeta repositoryMeta = mock( RepositoryMeta.class ); final Repository repository = mock( Repository.class ); final String mockRepo = "mockRepo"; final boolean[] connectionSuccess = { false }; Repository initialRepo = mock( Repository.class ); transExecConf.setRepository( initialRepo ); KettleLogStore.init(); MockRepositoryPlugin mockRepositoryPlugin = mock( MockRepositoryPlugin.class ); when( mockRepositoryPlugin.getIds() ).thenReturn( new String[] { "mockRepo" } ); when( mockRepositoryPlugin.matches( "mockRepo" ) ).thenReturn( true ); when( mockRepositoryPlugin.getName() ).thenReturn( "mock-repository" ); when( mockRepositoryPlugin.getClassMap() ).thenAnswer( new Answer<Map<Class<?>, String>>() { @Override public Map<Class<?>, String> answer( InvocationOnMock invocation ) throws Throwable { Map<Class<?>, String> dbMap = new HashMap<Class<?>, String>(); dbMap.put( Repository.class, repositoryMeta.getClass().getName() ); return dbMap; } } ); List<PluginInterface> registeredPlugins = PluginRegistry.getInstance().getPlugins( RepositoryPluginType.class ); for ( PluginInterface registeredPlugin : registeredPlugins ) { PluginRegistry.getInstance().removePlugin( RepositoryPluginType.class, registeredPlugin ); } PluginRegistry.getInstance().registerPlugin( RepositoryPluginType.class, mockRepositoryPlugin ); when( repositoriesMeta.findRepository( anyString() ) ).thenAnswer( new Answer<RepositoryMeta>() { @Override public RepositoryMeta answer( InvocationOnMock invocation ) throws Throwable { return mockRepo.equals( invocation.getArguments()[0] ) ? repositoryMeta : null; } } ); when( mockRepositoryPlugin.loadClass( Repository.class ) ).thenReturn( repository ); doAnswer( new Answer() { @Override public Object answer( InvocationOnMock invocation ) throws Throwable { if ( "username".equals( invocation.getArguments()[0] ) && "password".equals( invocation.getArguments()[1] ) ) { connectionSuccess[0] = true; } else { connectionSuccess[0] = false; throw new KettleException( "Mock Repository connection failed" ); } return null; } } ).when( repository ).connect( anyString(), anyString() ); transExecConf.connectRepository( repositoriesMeta, "notFound", "username", "password" ); assertEquals( "Repository Changed", initialRepo, transExecConf.getRepository() ); transExecConf.connectRepository( repositoriesMeta, mockRepo, "username", "" ); assertEquals( "Repository Changed", initialRepo, transExecConf.getRepository() ); transExecConf.connectRepository( repositoriesMeta, mockRepo, "username", "password" ); assertEquals( "Repository didn't change", repository, transExecConf.getRepository() ); assertTrue( "Repository not connected", connectionSuccess[0] ); }
public Repository connectRepository( RepositoriesMeta repositoriesMeta, String repositoryName, String username, String password ) throws KettleException { RepositoryMeta repositoryMeta = repositoriesMeta.findRepository( repositoryName ); if ( repositoryMeta == null ) { log.logBasic( "I couldn't find the repository with name '" + repositoryName + "'" ); return null; } Repository rep = PluginRegistry.getInstance().loadClass( RepositoryPluginType.class, repositoryMeta, Repository.class ); if ( rep == null ) { log.logBasic( "Unable to load repository plugin for '" + repositoryName + "'" ); return null; } rep.init( repositoryMeta ); try { rep.connect( username, password ); setRepository( rep ); return rep; } catch ( Exception e ) { log.logBasic( "Unable to connect to the repository with name '" + repositoryName + "'" ); return null; } }
TransExecutionConfiguration implements ExecutionConfiguration { public Repository connectRepository( RepositoriesMeta repositoriesMeta, String repositoryName, String username, String password ) throws KettleException { RepositoryMeta repositoryMeta = repositoriesMeta.findRepository( repositoryName ); if ( repositoryMeta == null ) { log.logBasic( "I couldn't find the repository with name '" + repositoryName + "'" ); return null; } Repository rep = PluginRegistry.getInstance().loadClass( RepositoryPluginType.class, repositoryMeta, Repository.class ); if ( rep == null ) { log.logBasic( "Unable to load repository plugin for '" + repositoryName + "'" ); return null; } rep.init( repositoryMeta ); try { rep.connect( username, password ); setRepository( rep ); return rep; } catch ( Exception e ) { log.logBasic( "Unable to connect to the repository with name '" + repositoryName + "'" ); return null; } } }
TransExecutionConfiguration implements ExecutionConfiguration { public Repository connectRepository( RepositoriesMeta repositoriesMeta, String repositoryName, String username, String password ) throws KettleException { RepositoryMeta repositoryMeta = repositoriesMeta.findRepository( repositoryName ); if ( repositoryMeta == null ) { log.logBasic( "I couldn't find the repository with name '" + repositoryName + "'" ); return null; } Repository rep = PluginRegistry.getInstance().loadClass( RepositoryPluginType.class, repositoryMeta, Repository.class ); if ( rep == null ) { log.logBasic( "Unable to load repository plugin for '" + repositoryName + "'" ); return null; } rep.init( repositoryMeta ); try { rep.connect( username, password ); setRepository( rep ); return rep; } catch ( Exception e ) { log.logBasic( "Unable to connect to the repository with name '" + repositoryName + "'" ); return null; } } TransExecutionConfiguration(); TransExecutionConfiguration( Node trecNode ); }
TransExecutionConfiguration implements ExecutionConfiguration { public Repository connectRepository( RepositoriesMeta repositoriesMeta, String repositoryName, String username, String password ) throws KettleException { RepositoryMeta repositoryMeta = repositoriesMeta.findRepository( repositoryName ); if ( repositoryMeta == null ) { log.logBasic( "I couldn't find the repository with name '" + repositoryName + "'" ); return null; } Repository rep = PluginRegistry.getInstance().loadClass( RepositoryPluginType.class, repositoryMeta, Repository.class ); if ( rep == null ) { log.logBasic( "Unable to load repository plugin for '" + repositoryName + "'" ); return null; } rep.init( repositoryMeta ); try { rep.connect( username, password ); setRepository( rep ); return rep; } catch ( Exception e ) { log.logBasic( "Unable to connect to the repository with name '" + repositoryName + "'" ); return null; } } TransExecutionConfiguration(); TransExecutionConfiguration( Node trecNode ); Object clone(); Map<String, String> getArguments(); void setArguments( Map<String, String> arguments ); void setParams( Map<String, String> params ); Map<String, String> getParams(); void setArgumentStrings( String[] arguments ); boolean isExecutingClustered(); void setExecutingClustered( boolean clusteredExecution ); boolean isClusterStarting(); void setClusterStarting( boolean notExecuting ); boolean isClusterShowingTransformation(); void setClusterShowingTransformation( boolean showingTransformations ); Map<String, String> getVariables(); void setVariables( Map<String, String> variables ); void setVariables( VariableSpace space ); boolean isExecutingRemotely(); void setExecutingRemotely( boolean remoteExecution ); boolean isClusterPosting(); void setClusterPosting( boolean clusterPosting ); boolean isExecutingLocally(); void setExecutingLocally( boolean localExecution ); boolean isClusterPreparing(); void setClusterPreparing( boolean clusterPreparing ); SlaveServer getRemoteServer(); void setRemoteServer( SlaveServer remoteServer ); void getAllVariables( TransMeta transMeta ); void getUsedVariables( TransMeta transMeta ); void getUsedArguments( TransMeta transMeta, String[] commandLineArguments ); Date getReplayDate(); void setReplayDate( Date replayDate ); boolean isSafeModeEnabled(); void setSafeModeEnabled( boolean usingSafeMode ); LogLevel getLogLevel(); void setLogLevel( LogLevel logLevel ); String getXML(); Repository connectRepository( RepositoriesMeta repositoriesMeta, String repositoryName, String username, String password ); String[] getArgumentStrings(); TransDebugMeta getTransDebugMeta(); void setTransDebugMeta( TransDebugMeta transDebugMeta ); Result getPreviousResult(); void setPreviousResult( Result previousResult ); Repository getRepository(); void setRepository( Repository repository ); boolean isClearingLog(); void setClearingLog( boolean clearingLog ); boolean isPassingExport(); void setPassingExport( boolean passingExport ); boolean isGatheringMetrics(); void setGatheringMetrics( boolean gatheringMetrics ); boolean isShowingSubComponents(); void setShowingSubComponents( boolean showingSubComponents ); boolean isSetLogfile(); void setSetLogfile( boolean setLogfile ); boolean isSetAppendLogfile(); void setSetAppendLogfile( boolean setAppendLogfile ); String getLogFileName(); void setLogFileName( String fileName ); boolean isCreateParentFolder(); void setCreateParentFolder( boolean createParentFolder ); Long getPassedBatchId(); void setPassedBatchId( Long passedBatchId ); String getRunConfiguration(); void setRunConfiguration( String runConfiguration ); boolean isLogRemoteExecutionLocally(); void setLogRemoteExecutionLocally( boolean logRemoteExecutionLocally ); }
TransExecutionConfiguration implements ExecutionConfiguration { public Repository connectRepository( RepositoriesMeta repositoriesMeta, String repositoryName, String username, String password ) throws KettleException { RepositoryMeta repositoryMeta = repositoriesMeta.findRepository( repositoryName ); if ( repositoryMeta == null ) { log.logBasic( "I couldn't find the repository with name '" + repositoryName + "'" ); return null; } Repository rep = PluginRegistry.getInstance().loadClass( RepositoryPluginType.class, repositoryMeta, Repository.class ); if ( rep == null ) { log.logBasic( "Unable to load repository plugin for '" + repositoryName + "'" ); return null; } rep.init( repositoryMeta ); try { rep.connect( username, password ); setRepository( rep ); return rep; } catch ( Exception e ) { log.logBasic( "Unable to connect to the repository with name '" + repositoryName + "'" ); return null; } } TransExecutionConfiguration(); TransExecutionConfiguration( Node trecNode ); Object clone(); Map<String, String> getArguments(); void setArguments( Map<String, String> arguments ); void setParams( Map<String, String> params ); Map<String, String> getParams(); void setArgumentStrings( String[] arguments ); boolean isExecutingClustered(); void setExecutingClustered( boolean clusteredExecution ); boolean isClusterStarting(); void setClusterStarting( boolean notExecuting ); boolean isClusterShowingTransformation(); void setClusterShowingTransformation( boolean showingTransformations ); Map<String, String> getVariables(); void setVariables( Map<String, String> variables ); void setVariables( VariableSpace space ); boolean isExecutingRemotely(); void setExecutingRemotely( boolean remoteExecution ); boolean isClusterPosting(); void setClusterPosting( boolean clusterPosting ); boolean isExecutingLocally(); void setExecutingLocally( boolean localExecution ); boolean isClusterPreparing(); void setClusterPreparing( boolean clusterPreparing ); SlaveServer getRemoteServer(); void setRemoteServer( SlaveServer remoteServer ); void getAllVariables( TransMeta transMeta ); void getUsedVariables( TransMeta transMeta ); void getUsedArguments( TransMeta transMeta, String[] commandLineArguments ); Date getReplayDate(); void setReplayDate( Date replayDate ); boolean isSafeModeEnabled(); void setSafeModeEnabled( boolean usingSafeMode ); LogLevel getLogLevel(); void setLogLevel( LogLevel logLevel ); String getXML(); Repository connectRepository( RepositoriesMeta repositoriesMeta, String repositoryName, String username, String password ); String[] getArgumentStrings(); TransDebugMeta getTransDebugMeta(); void setTransDebugMeta( TransDebugMeta transDebugMeta ); Result getPreviousResult(); void setPreviousResult( Result previousResult ); Repository getRepository(); void setRepository( Repository repository ); boolean isClearingLog(); void setClearingLog( boolean clearingLog ); boolean isPassingExport(); void setPassingExport( boolean passingExport ); boolean isGatheringMetrics(); void setGatheringMetrics( boolean gatheringMetrics ); boolean isShowingSubComponents(); void setShowingSubComponents( boolean showingSubComponents ); boolean isSetLogfile(); void setSetLogfile( boolean setLogfile ); boolean isSetAppendLogfile(); void setSetAppendLogfile( boolean setAppendLogfile ); String getLogFileName(); void setLogFileName( String fileName ); boolean isCreateParentFolder(); void setCreateParentFolder( boolean createParentFolder ); Long getPassedBatchId(); void setPassedBatchId( Long passedBatchId ); String getRunConfiguration(); void setRunConfiguration( String runConfiguration ); boolean isLogRemoteExecutionLocally(); void setLogRemoteExecutionLocally( boolean logRemoteExecutionLocally ); static final String XML_TAG; }
@Test public void formatLogMessage_with_add_time() { Log4jKettleLayout layout = new Log4jKettleLayout( true ); LoggingEvent loggingEvent = mock( LoggingEvent.class ); LogMessage logMessage = new LogMessage( "TEST_MESSAGE", "TEST_ID", LogLevel.BASIC ); when( loggingEvent.getMessage() ).thenReturn( logMessage ); String actualResult = layout.format( loggingEvent ); assertThat( actualResult, equalTo( "1970/01/01 00:00:00 - TEST_MESSAGE" ) ); }
public String format( LoggingEvent event ) { StringBuffer line = new StringBuffer(); String dateTimeString = ""; if ( timeAdded ) { dateTimeString = LOCAL_SIMPLE_DATE_PARSER.get().format( new Date( event.timeStamp ) ) + " - "; } Object object = event.getMessage(); if ( object instanceof LogMessage ) { LogMessage message = (LogMessage) object; String[] parts = message.getMessage().split( Const.CR ); for ( int i = 0; i < parts.length; i++ ) { line.append( dateTimeString ); if ( message.getSubject() != null ) { line.append( message.getSubject() ); if ( message.getCopy() != null ) { line.append( "." ).append( message.getCopy() ); } line.append( " - " ); } if ( message.isError() ) { BuildVersion buildVersion = BuildVersion.getInstance(); line.append( ERROR_STRING ); line.append( " (version " ); line.append( buildVersion.getVersion() ); if ( !Utils.isEmpty( buildVersion.getRevision() ) ) { line.append( ", build " ); line.append( buildVersion.getRevision() ); } if ( !Utils.isEmpty( buildVersion.getBuildDate() ) ) { line.append( " from " ); line.append( buildVersion.getBuildDate() ); } if ( !Utils.isEmpty( buildVersion.getBuildUser() ) ) { line.append( " by " ); line.append( buildVersion.getBuildUser() ); } line.append( ") : " ); } line.append( parts[i] ); if ( i < parts.length - 1 ) { line.append( Const.CR ); } } } else { line.append( dateTimeString ); line.append( ( object != null ? object.toString() : "<null>" ) ); } return line.toString(); }
Log4jKettleLayout extends Layout implements Log4JLayoutInterface { public String format( LoggingEvent event ) { StringBuffer line = new StringBuffer(); String dateTimeString = ""; if ( timeAdded ) { dateTimeString = LOCAL_SIMPLE_DATE_PARSER.get().format( new Date( event.timeStamp ) ) + " - "; } Object object = event.getMessage(); if ( object instanceof LogMessage ) { LogMessage message = (LogMessage) object; String[] parts = message.getMessage().split( Const.CR ); for ( int i = 0; i < parts.length; i++ ) { line.append( dateTimeString ); if ( message.getSubject() != null ) { line.append( message.getSubject() ); if ( message.getCopy() != null ) { line.append( "." ).append( message.getCopy() ); } line.append( " - " ); } if ( message.isError() ) { BuildVersion buildVersion = BuildVersion.getInstance(); line.append( ERROR_STRING ); line.append( " (version " ); line.append( buildVersion.getVersion() ); if ( !Utils.isEmpty( buildVersion.getRevision() ) ) { line.append( ", build " ); line.append( buildVersion.getRevision() ); } if ( !Utils.isEmpty( buildVersion.getBuildDate() ) ) { line.append( " from " ); line.append( buildVersion.getBuildDate() ); } if ( !Utils.isEmpty( buildVersion.getBuildUser() ) ) { line.append( " by " ); line.append( buildVersion.getBuildUser() ); } line.append( ") : " ); } line.append( parts[i] ); if ( i < parts.length - 1 ) { line.append( Const.CR ); } } } else { line.append( dateTimeString ); line.append( ( object != null ? object.toString() : "<null>" ) ); } return line.toString(); } }
Log4jKettleLayout extends Layout implements Log4JLayoutInterface { public String format( LoggingEvent event ) { StringBuffer line = new StringBuffer(); String dateTimeString = ""; if ( timeAdded ) { dateTimeString = LOCAL_SIMPLE_DATE_PARSER.get().format( new Date( event.timeStamp ) ) + " - "; } Object object = event.getMessage(); if ( object instanceof LogMessage ) { LogMessage message = (LogMessage) object; String[] parts = message.getMessage().split( Const.CR ); for ( int i = 0; i < parts.length; i++ ) { line.append( dateTimeString ); if ( message.getSubject() != null ) { line.append( message.getSubject() ); if ( message.getCopy() != null ) { line.append( "." ).append( message.getCopy() ); } line.append( " - " ); } if ( message.isError() ) { BuildVersion buildVersion = BuildVersion.getInstance(); line.append( ERROR_STRING ); line.append( " (version " ); line.append( buildVersion.getVersion() ); if ( !Utils.isEmpty( buildVersion.getRevision() ) ) { line.append( ", build " ); line.append( buildVersion.getRevision() ); } if ( !Utils.isEmpty( buildVersion.getBuildDate() ) ) { line.append( " from " ); line.append( buildVersion.getBuildDate() ); } if ( !Utils.isEmpty( buildVersion.getBuildUser() ) ) { line.append( " by " ); line.append( buildVersion.getBuildUser() ); } line.append( ") : " ); } line.append( parts[i] ); if ( i < parts.length - 1 ) { line.append( Const.CR ); } } } else { line.append( dateTimeString ); line.append( ( object != null ? object.toString() : "<null>" ) ); } return line.toString(); } Log4jKettleLayout(); Log4jKettleLayout( boolean addTime ); }
Log4jKettleLayout extends Layout implements Log4JLayoutInterface { public String format( LoggingEvent event ) { StringBuffer line = new StringBuffer(); String dateTimeString = ""; if ( timeAdded ) { dateTimeString = LOCAL_SIMPLE_DATE_PARSER.get().format( new Date( event.timeStamp ) ) + " - "; } Object object = event.getMessage(); if ( object instanceof LogMessage ) { LogMessage message = (LogMessage) object; String[] parts = message.getMessage().split( Const.CR ); for ( int i = 0; i < parts.length; i++ ) { line.append( dateTimeString ); if ( message.getSubject() != null ) { line.append( message.getSubject() ); if ( message.getCopy() != null ) { line.append( "." ).append( message.getCopy() ); } line.append( " - " ); } if ( message.isError() ) { BuildVersion buildVersion = BuildVersion.getInstance(); line.append( ERROR_STRING ); line.append( " (version " ); line.append( buildVersion.getVersion() ); if ( !Utils.isEmpty( buildVersion.getRevision() ) ) { line.append( ", build " ); line.append( buildVersion.getRevision() ); } if ( !Utils.isEmpty( buildVersion.getBuildDate() ) ) { line.append( " from " ); line.append( buildVersion.getBuildDate() ); } if ( !Utils.isEmpty( buildVersion.getBuildUser() ) ) { line.append( " by " ); line.append( buildVersion.getBuildUser() ); } line.append( ") : " ); } line.append( parts[i] ); if ( i < parts.length - 1 ) { line.append( Const.CR ); } } } else { line.append( dateTimeString ); line.append( ( object != null ? object.toString() : "<null>" ) ); } return line.toString(); } Log4jKettleLayout(); Log4jKettleLayout( boolean addTime ); String format( LoggingEvent event ); boolean ignoresThrowable(); void activateOptions(); boolean isTimeAdded(); void setTimeAdded( boolean addTime ); }
Log4jKettleLayout extends Layout implements Log4JLayoutInterface { public String format( LoggingEvent event ) { StringBuffer line = new StringBuffer(); String dateTimeString = ""; if ( timeAdded ) { dateTimeString = LOCAL_SIMPLE_DATE_PARSER.get().format( new Date( event.timeStamp ) ) + " - "; } Object object = event.getMessage(); if ( object instanceof LogMessage ) { LogMessage message = (LogMessage) object; String[] parts = message.getMessage().split( Const.CR ); for ( int i = 0; i < parts.length; i++ ) { line.append( dateTimeString ); if ( message.getSubject() != null ) { line.append( message.getSubject() ); if ( message.getCopy() != null ) { line.append( "." ).append( message.getCopy() ); } line.append( " - " ); } if ( message.isError() ) { BuildVersion buildVersion = BuildVersion.getInstance(); line.append( ERROR_STRING ); line.append( " (version " ); line.append( buildVersion.getVersion() ); if ( !Utils.isEmpty( buildVersion.getRevision() ) ) { line.append( ", build " ); line.append( buildVersion.getRevision() ); } if ( !Utils.isEmpty( buildVersion.getBuildDate() ) ) { line.append( " from " ); line.append( buildVersion.getBuildDate() ); } if ( !Utils.isEmpty( buildVersion.getBuildUser() ) ) { line.append( " by " ); line.append( buildVersion.getBuildUser() ); } line.append( ") : " ); } line.append( parts[i] ); if ( i < parts.length - 1 ) { line.append( Const.CR ); } } } else { line.append( dateTimeString ); line.append( ( object != null ? object.toString() : "<null>" ) ); } return line.toString(); } Log4jKettleLayout(); Log4jKettleLayout( boolean addTime ); String format( LoggingEvent event ); boolean ignoresThrowable(); void activateOptions(); boolean isTimeAdded(); void setTimeAdded( boolean addTime ); static final String ERROR_STRING; }
@Test public void doAppend() throws IOException { LoggingEvent loggingEvent = mock( LoggingEvent.class ); Layout testLayout = mock( Layout.class ); when( testLayout.format( loggingEvent ) ).thenReturn( "LOG_TEST_LINE" ); log4jFileAppender.setLayout( testLayout ); log4jFileAppender.doAppend( loggingEvent ); verify( outputStream ).write( ( "LOG_TEST_LINE" + Const.CR ).getBytes() ); }
public void doAppend( LoggingEvent event ) { String line = layout.format( event ) + Const.CR; try { fileOutputStream.write( line.getBytes( Const.XML_ENCODING ) ); } catch ( IOException e ) { System.out.println( "Unable to close Logging file [" + file.getName() + "] : " + e.getMessage() ); } }
Log4jFileAppender implements Appender { public void doAppend( LoggingEvent event ) { String line = layout.format( event ) + Const.CR; try { fileOutputStream.write( line.getBytes( Const.XML_ENCODING ) ); } catch ( IOException e ) { System.out.println( "Unable to close Logging file [" + file.getName() + "] : " + e.getMessage() ); } } }
Log4jFileAppender implements Appender { public void doAppend( LoggingEvent event ) { String line = layout.format( event ) + Const.CR; try { fileOutputStream.write( line.getBytes( Const.XML_ENCODING ) ); } catch ( IOException e ) { System.out.println( "Unable to close Logging file [" + file.getName() + "] : " + e.getMessage() ); } } Log4jFileAppender( FileObject file ); Log4jFileAppender( FileObject file, boolean append ); }
Log4jFileAppender implements Appender { public void doAppend( LoggingEvent event ) { String line = layout.format( event ) + Const.CR; try { fileOutputStream.write( line.getBytes( Const.XML_ENCODING ) ); } catch ( IOException e ) { System.out.println( "Unable to close Logging file [" + file.getName() + "] : " + e.getMessage() ); } } Log4jFileAppender( FileObject file ); Log4jFileAppender( FileObject file, boolean append ); void addFilter( Filter filter ); Filter getFilter(); void clearFilters(); void close(); void doAppend( LoggingEvent event ); void setName( String name ); String getName(); void setErrorHandler( ErrorHandler arg0 ); ErrorHandler getErrorHandler(); void setLayout( Layout layout ); Layout getLayout(); boolean requiresLayout(); FileObject getFile(); void setFilename( FileObject file ); OutputStream getFileOutputStream(); void setFileOutputStream( OutputStream fileOutputStream ); void setFilter( Filter filter ); }
Log4jFileAppender implements Appender { public void doAppend( LoggingEvent event ) { String line = layout.format( event ) + Const.CR; try { fileOutputStream.write( line.getBytes( Const.XML_ENCODING ) ); } catch ( IOException e ) { System.out.println( "Unable to close Logging file [" + file.getName() + "] : " + e.getMessage() ); } } Log4jFileAppender( FileObject file ); Log4jFileAppender( FileObject file, boolean append ); void addFilter( Filter filter ); Filter getFilter(); void clearFilters(); void close(); void doAppend( LoggingEvent event ); void setName( String name ); String getName(); void setErrorHandler( ErrorHandler arg0 ); ErrorHandler getErrorHandler(); void setLayout( Layout layout ); Layout getLayout(); boolean requiresLayout(); FileObject getFile(); void setFilename( FileObject file ); OutputStream getFileOutputStream(); void setFileOutputStream( OutputStream fileOutputStream ); void setFilter( Filter filter ); }
@Test public void close() throws IOException { log4jFileAppender.close(); verify( outputStream ).close(); }
public void close() { try { fileOutputStream.close(); } catch ( IOException e ) { System.out.println( "Unable to close Logging file [" + file.getName() + "] : " + e.getMessage() ); } }
Log4jFileAppender implements Appender { public void close() { try { fileOutputStream.close(); } catch ( IOException e ) { System.out.println( "Unable to close Logging file [" + file.getName() + "] : " + e.getMessage() ); } } }
Log4jFileAppender implements Appender { public void close() { try { fileOutputStream.close(); } catch ( IOException e ) { System.out.println( "Unable to close Logging file [" + file.getName() + "] : " + e.getMessage() ); } } Log4jFileAppender( FileObject file ); Log4jFileAppender( FileObject file, boolean append ); }
Log4jFileAppender implements Appender { public void close() { try { fileOutputStream.close(); } catch ( IOException e ) { System.out.println( "Unable to close Logging file [" + file.getName() + "] : " + e.getMessage() ); } } Log4jFileAppender( FileObject file ); Log4jFileAppender( FileObject file, boolean append ); void addFilter( Filter filter ); Filter getFilter(); void clearFilters(); void close(); void doAppend( LoggingEvent event ); void setName( String name ); String getName(); void setErrorHandler( ErrorHandler arg0 ); ErrorHandler getErrorHandler(); void setLayout( Layout layout ); Layout getLayout(); boolean requiresLayout(); FileObject getFile(); void setFilename( FileObject file ); OutputStream getFileOutputStream(); void setFileOutputStream( OutputStream fileOutputStream ); void setFilter( Filter filter ); }
Log4jFileAppender implements Appender { public void close() { try { fileOutputStream.close(); } catch ( IOException e ) { System.out.println( "Unable to close Logging file [" + file.getName() + "] : " + e.getMessage() ); } } Log4jFileAppender( FileObject file ); Log4jFileAppender( FileObject file, boolean append ); void addFilter( Filter filter ); Filter getFilter(); void clearFilters(); void close(); void doAppend( LoggingEvent event ); void setName( String name ); String getName(); void setErrorHandler( ErrorHandler arg0 ); ErrorHandler getErrorHandler(); void setLayout( Layout layout ); Layout getLayout(); boolean requiresLayout(); FileObject getFile(); void setFilename( FileObject file ); OutputStream getFileOutputStream(); void setFileOutputStream( OutputStream fileOutputStream ); void setFilter( Filter filter ); }
@Test public void createReport() throws Exception { LoggingObjectInterface log = mock( LoggingObjectInterface.class ); AutoDocOptionsInterface options = mock( AutoDocOptionsInterface.class ); when( options.isIncludingImage() ).thenReturn( Boolean.TRUE ); KettleReportBuilder builder = new KettleReportBuilder( log, Collections.<ReportSubjectLocation>emptyList(), "", options ); builder.createReport(); assertNotNull( builder.getReport() ); assertNotNull( builder.getReport().getDataFactory() ); assertNotNull( builder.getReport().getReportHeader() ); assertNotNull( builder.getReport().getReportFooter() ); assertNotNull( builder.getReport().getRootGroup() ); assertNotNull( builder.getReport().getPageDefinition() ); assertTrue( builder.getReport().getExpressions().size() > 0 ); }
public void createReport() throws Exception { report = new MasterReport(); KettleFileTableModel transMetaTableModel = new KettleFileTableModel( parentObject, filenames ); TableDataFactory dataFactory = new TableDataFactory( "default", transMetaTableModel ); report.setDataFactory( dataFactory ); ReportHeader reportHeader = new ReportHeader(); report.setReportHeader( reportHeader ); ReportFooter reportFooter = new ReportFooter(); report.setReportFooter( reportFooter ); RelationalGroup group = new RelationalGroup(); group.addField( "filename" ); GroupDataBody groupData = new GroupDataBody(); ItemBand itemBand = new ItemBand(); itemBand.setVisible( true ); itemBand.setLayout( BandStyleKeys.LAYOUT_AUTO ); groupData.setItemBand( itemBand ); group.setBody( groupData ); report.setRootGroup( group ); int pagePosition = 0; reportHeader.getStyle().setStyleProperty( TextStyleKeys.BOLD, true ); pagePosition = createTextField( itemBand, "Filename: ", "filename", pagePosition ); if ( options.isIncludingName() ) { pagePosition = createTextField( itemBand, "Name: ", "name", pagePosition ); } if ( options.isIncludingDescription() ) { pagePosition = createTextField( itemBand, "Description: ", "description", pagePosition ); } if ( options.isIncludingExtendedDescription() ) { pagePosition = createTextField( itemBand, "Long description: ", "extended_description", pagePosition ); } if ( options.isIncludingLoggingConfiguration() ) { pagePosition = createTextField( itemBand, "Logging: ", "logging", pagePosition ); } if ( options.isIncludingCreated() ) { pagePosition = createTextField( itemBand, "Creation: ", "creation", pagePosition ); } if ( options.isIncludingModified() ) { pagePosition = createTextField( itemBand, "Modification: ", "modification", pagePosition ); } if ( options.isIncludingLastExecutionResult() ) { pagePosition = createTextField( itemBand, "Last execution result: : ", "last_exec_result", pagePosition ); } if ( options.isIncludingImage() ) { String bshCode = "Object getValue() { " + Const.CR + " return new " + TransJobDrawable.class.getName() + "(dataRow, " + ( options.getOutputType() == OutputType.PDF ? "true" : "false" ) + ");" + Const.CR + "}"; BSHExpression bshExpression = new BSHExpression(); bshExpression.setExpression( bshCode ); bshExpression.setName( "getImage" ); report.addExpression( bshExpression ); ContentElementFactory contentElementFactory = new ContentElementFactory(); contentElementFactory.setName( "image" ); contentElementFactory.setAbsolutePosition( new Point( 0, pagePosition ) ); contentElementFactory.setMinimumWidth( 750f ); contentElementFactory.setMaximumWidth( 750f ); contentElementFactory.setMinimumHeight( 400f ); contentElementFactory.setMaximumHeight( 750f ); contentElementFactory.setScale( true ); contentElementFactory.setDynamicHeight( true ); Element imageElement = contentElementFactory.createElement(); imageElement .setAttributeExpression( AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, bshExpression ); imageElement.setAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.IMAGE_ENCODING_QUALITY, "9" ); imageElement.setAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.IMAGE_ENCODING_TYPE, "PNG" ); ItemBand imageBand = new ItemBand(); imageBand.setLayout( BandStyleKeys.LAYOUT_ROW ); imageBand.addElement( imageElement ); itemBand.addElement( imageBand ); } Paper a4Paper = new Paper(); double paperWidth = 8.26; double paperHeight = 11.69; a4Paper.setSize( paperWidth * 72.0, paperHeight * 72.0 ); double leftMargin = 0.78; double rightMargin = 0.78; double topMargin = 0.08; double bottomMargin = 0.78; a4Paper.setImageableArea( leftMargin * 72.0, topMargin * 72.0, ( paperWidth - leftMargin - rightMargin ) * 72.0, ( paperHeight - topMargin - bottomMargin ) * 72.0 ); PageFormat pageFormat = new PageFormat(); pageFormat.setOrientation( PageFormat.LANDSCAPE ); pageFormat.setPaper( a4Paper ); SimplePageDefinition pageDefinition = new SimplePageDefinition( pageFormat ); report.setPageDefinition( pageDefinition ); }
KettleReportBuilder { public void createReport() throws Exception { report = new MasterReport(); KettleFileTableModel transMetaTableModel = new KettleFileTableModel( parentObject, filenames ); TableDataFactory dataFactory = new TableDataFactory( "default", transMetaTableModel ); report.setDataFactory( dataFactory ); ReportHeader reportHeader = new ReportHeader(); report.setReportHeader( reportHeader ); ReportFooter reportFooter = new ReportFooter(); report.setReportFooter( reportFooter ); RelationalGroup group = new RelationalGroup(); group.addField( "filename" ); GroupDataBody groupData = new GroupDataBody(); ItemBand itemBand = new ItemBand(); itemBand.setVisible( true ); itemBand.setLayout( BandStyleKeys.LAYOUT_AUTO ); groupData.setItemBand( itemBand ); group.setBody( groupData ); report.setRootGroup( group ); int pagePosition = 0; reportHeader.getStyle().setStyleProperty( TextStyleKeys.BOLD, true ); pagePosition = createTextField( itemBand, "Filename: ", "filename", pagePosition ); if ( options.isIncludingName() ) { pagePosition = createTextField( itemBand, "Name: ", "name", pagePosition ); } if ( options.isIncludingDescription() ) { pagePosition = createTextField( itemBand, "Description: ", "description", pagePosition ); } if ( options.isIncludingExtendedDescription() ) { pagePosition = createTextField( itemBand, "Long description: ", "extended_description", pagePosition ); } if ( options.isIncludingLoggingConfiguration() ) { pagePosition = createTextField( itemBand, "Logging: ", "logging", pagePosition ); } if ( options.isIncludingCreated() ) { pagePosition = createTextField( itemBand, "Creation: ", "creation", pagePosition ); } if ( options.isIncludingModified() ) { pagePosition = createTextField( itemBand, "Modification: ", "modification", pagePosition ); } if ( options.isIncludingLastExecutionResult() ) { pagePosition = createTextField( itemBand, "Last execution result: : ", "last_exec_result", pagePosition ); } if ( options.isIncludingImage() ) { String bshCode = "Object getValue() { " + Const.CR + " return new " + TransJobDrawable.class.getName() + "(dataRow, " + ( options.getOutputType() == OutputType.PDF ? "true" : "false" ) + ");" + Const.CR + "}"; BSHExpression bshExpression = new BSHExpression(); bshExpression.setExpression( bshCode ); bshExpression.setName( "getImage" ); report.addExpression( bshExpression ); ContentElementFactory contentElementFactory = new ContentElementFactory(); contentElementFactory.setName( "image" ); contentElementFactory.setAbsolutePosition( new Point( 0, pagePosition ) ); contentElementFactory.setMinimumWidth( 750f ); contentElementFactory.setMaximumWidth( 750f ); contentElementFactory.setMinimumHeight( 400f ); contentElementFactory.setMaximumHeight( 750f ); contentElementFactory.setScale( true ); contentElementFactory.setDynamicHeight( true ); Element imageElement = contentElementFactory.createElement(); imageElement .setAttributeExpression( AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, bshExpression ); imageElement.setAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.IMAGE_ENCODING_QUALITY, "9" ); imageElement.setAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.IMAGE_ENCODING_TYPE, "PNG" ); ItemBand imageBand = new ItemBand(); imageBand.setLayout( BandStyleKeys.LAYOUT_ROW ); imageBand.addElement( imageElement ); itemBand.addElement( imageBand ); } Paper a4Paper = new Paper(); double paperWidth = 8.26; double paperHeight = 11.69; a4Paper.setSize( paperWidth * 72.0, paperHeight * 72.0 ); double leftMargin = 0.78; double rightMargin = 0.78; double topMargin = 0.08; double bottomMargin = 0.78; a4Paper.setImageableArea( leftMargin * 72.0, topMargin * 72.0, ( paperWidth - leftMargin - rightMargin ) * 72.0, ( paperHeight - topMargin - bottomMargin ) * 72.0 ); PageFormat pageFormat = new PageFormat(); pageFormat.setOrientation( PageFormat.LANDSCAPE ); pageFormat.setPaper( a4Paper ); SimplePageDefinition pageDefinition = new SimplePageDefinition( pageFormat ); report.setPageDefinition( pageDefinition ); } }
KettleReportBuilder { public void createReport() throws Exception { report = new MasterReport(); KettleFileTableModel transMetaTableModel = new KettleFileTableModel( parentObject, filenames ); TableDataFactory dataFactory = new TableDataFactory( "default", transMetaTableModel ); report.setDataFactory( dataFactory ); ReportHeader reportHeader = new ReportHeader(); report.setReportHeader( reportHeader ); ReportFooter reportFooter = new ReportFooter(); report.setReportFooter( reportFooter ); RelationalGroup group = new RelationalGroup(); group.addField( "filename" ); GroupDataBody groupData = new GroupDataBody(); ItemBand itemBand = new ItemBand(); itemBand.setVisible( true ); itemBand.setLayout( BandStyleKeys.LAYOUT_AUTO ); groupData.setItemBand( itemBand ); group.setBody( groupData ); report.setRootGroup( group ); int pagePosition = 0; reportHeader.getStyle().setStyleProperty( TextStyleKeys.BOLD, true ); pagePosition = createTextField( itemBand, "Filename: ", "filename", pagePosition ); if ( options.isIncludingName() ) { pagePosition = createTextField( itemBand, "Name: ", "name", pagePosition ); } if ( options.isIncludingDescription() ) { pagePosition = createTextField( itemBand, "Description: ", "description", pagePosition ); } if ( options.isIncludingExtendedDescription() ) { pagePosition = createTextField( itemBand, "Long description: ", "extended_description", pagePosition ); } if ( options.isIncludingLoggingConfiguration() ) { pagePosition = createTextField( itemBand, "Logging: ", "logging", pagePosition ); } if ( options.isIncludingCreated() ) { pagePosition = createTextField( itemBand, "Creation: ", "creation", pagePosition ); } if ( options.isIncludingModified() ) { pagePosition = createTextField( itemBand, "Modification: ", "modification", pagePosition ); } if ( options.isIncludingLastExecutionResult() ) { pagePosition = createTextField( itemBand, "Last execution result: : ", "last_exec_result", pagePosition ); } if ( options.isIncludingImage() ) { String bshCode = "Object getValue() { " + Const.CR + " return new " + TransJobDrawable.class.getName() + "(dataRow, " + ( options.getOutputType() == OutputType.PDF ? "true" : "false" ) + ");" + Const.CR + "}"; BSHExpression bshExpression = new BSHExpression(); bshExpression.setExpression( bshCode ); bshExpression.setName( "getImage" ); report.addExpression( bshExpression ); ContentElementFactory contentElementFactory = new ContentElementFactory(); contentElementFactory.setName( "image" ); contentElementFactory.setAbsolutePosition( new Point( 0, pagePosition ) ); contentElementFactory.setMinimumWidth( 750f ); contentElementFactory.setMaximumWidth( 750f ); contentElementFactory.setMinimumHeight( 400f ); contentElementFactory.setMaximumHeight( 750f ); contentElementFactory.setScale( true ); contentElementFactory.setDynamicHeight( true ); Element imageElement = contentElementFactory.createElement(); imageElement .setAttributeExpression( AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, bshExpression ); imageElement.setAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.IMAGE_ENCODING_QUALITY, "9" ); imageElement.setAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.IMAGE_ENCODING_TYPE, "PNG" ); ItemBand imageBand = new ItemBand(); imageBand.setLayout( BandStyleKeys.LAYOUT_ROW ); imageBand.addElement( imageElement ); itemBand.addElement( imageBand ); } Paper a4Paper = new Paper(); double paperWidth = 8.26; double paperHeight = 11.69; a4Paper.setSize( paperWidth * 72.0, paperHeight * 72.0 ); double leftMargin = 0.78; double rightMargin = 0.78; double topMargin = 0.08; double bottomMargin = 0.78; a4Paper.setImageableArea( leftMargin * 72.0, topMargin * 72.0, ( paperWidth - leftMargin - rightMargin ) * 72.0, ( paperHeight - topMargin - bottomMargin ) * 72.0 ); PageFormat pageFormat = new PageFormat(); pageFormat.setOrientation( PageFormat.LANDSCAPE ); pageFormat.setPaper( a4Paper ); SimplePageDefinition pageDefinition = new SimplePageDefinition( pageFormat ); report.setPageDefinition( pageDefinition ); } KettleReportBuilder( LoggingObjectInterface parentObject, List<ReportSubjectLocation> locations, String targetFilename, AutoDocOptionsInterface options ); }
KettleReportBuilder { public void createReport() throws Exception { report = new MasterReport(); KettleFileTableModel transMetaTableModel = new KettleFileTableModel( parentObject, filenames ); TableDataFactory dataFactory = new TableDataFactory( "default", transMetaTableModel ); report.setDataFactory( dataFactory ); ReportHeader reportHeader = new ReportHeader(); report.setReportHeader( reportHeader ); ReportFooter reportFooter = new ReportFooter(); report.setReportFooter( reportFooter ); RelationalGroup group = new RelationalGroup(); group.addField( "filename" ); GroupDataBody groupData = new GroupDataBody(); ItemBand itemBand = new ItemBand(); itemBand.setVisible( true ); itemBand.setLayout( BandStyleKeys.LAYOUT_AUTO ); groupData.setItemBand( itemBand ); group.setBody( groupData ); report.setRootGroup( group ); int pagePosition = 0; reportHeader.getStyle().setStyleProperty( TextStyleKeys.BOLD, true ); pagePosition = createTextField( itemBand, "Filename: ", "filename", pagePosition ); if ( options.isIncludingName() ) { pagePosition = createTextField( itemBand, "Name: ", "name", pagePosition ); } if ( options.isIncludingDescription() ) { pagePosition = createTextField( itemBand, "Description: ", "description", pagePosition ); } if ( options.isIncludingExtendedDescription() ) { pagePosition = createTextField( itemBand, "Long description: ", "extended_description", pagePosition ); } if ( options.isIncludingLoggingConfiguration() ) { pagePosition = createTextField( itemBand, "Logging: ", "logging", pagePosition ); } if ( options.isIncludingCreated() ) { pagePosition = createTextField( itemBand, "Creation: ", "creation", pagePosition ); } if ( options.isIncludingModified() ) { pagePosition = createTextField( itemBand, "Modification: ", "modification", pagePosition ); } if ( options.isIncludingLastExecutionResult() ) { pagePosition = createTextField( itemBand, "Last execution result: : ", "last_exec_result", pagePosition ); } if ( options.isIncludingImage() ) { String bshCode = "Object getValue() { " + Const.CR + " return new " + TransJobDrawable.class.getName() + "(dataRow, " + ( options.getOutputType() == OutputType.PDF ? "true" : "false" ) + ");" + Const.CR + "}"; BSHExpression bshExpression = new BSHExpression(); bshExpression.setExpression( bshCode ); bshExpression.setName( "getImage" ); report.addExpression( bshExpression ); ContentElementFactory contentElementFactory = new ContentElementFactory(); contentElementFactory.setName( "image" ); contentElementFactory.setAbsolutePosition( new Point( 0, pagePosition ) ); contentElementFactory.setMinimumWidth( 750f ); contentElementFactory.setMaximumWidth( 750f ); contentElementFactory.setMinimumHeight( 400f ); contentElementFactory.setMaximumHeight( 750f ); contentElementFactory.setScale( true ); contentElementFactory.setDynamicHeight( true ); Element imageElement = contentElementFactory.createElement(); imageElement .setAttributeExpression( AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, bshExpression ); imageElement.setAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.IMAGE_ENCODING_QUALITY, "9" ); imageElement.setAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.IMAGE_ENCODING_TYPE, "PNG" ); ItemBand imageBand = new ItemBand(); imageBand.setLayout( BandStyleKeys.LAYOUT_ROW ); imageBand.addElement( imageElement ); itemBand.addElement( imageBand ); } Paper a4Paper = new Paper(); double paperWidth = 8.26; double paperHeight = 11.69; a4Paper.setSize( paperWidth * 72.0, paperHeight * 72.0 ); double leftMargin = 0.78; double rightMargin = 0.78; double topMargin = 0.08; double bottomMargin = 0.78; a4Paper.setImageableArea( leftMargin * 72.0, topMargin * 72.0, ( paperWidth - leftMargin - rightMargin ) * 72.0, ( paperHeight - topMargin - bottomMargin ) * 72.0 ); PageFormat pageFormat = new PageFormat(); pageFormat.setOrientation( PageFormat.LANDSCAPE ); pageFormat.setPaper( a4Paper ); SimplePageDefinition pageDefinition = new SimplePageDefinition( pageFormat ); report.setPageDefinition( pageDefinition ); } KettleReportBuilder( LoggingObjectInterface parentObject, List<ReportSubjectLocation> locations, String targetFilename, AutoDocOptionsInterface options ); void createReport(); void render(); }
KettleReportBuilder { public void createReport() throws Exception { report = new MasterReport(); KettleFileTableModel transMetaTableModel = new KettleFileTableModel( parentObject, filenames ); TableDataFactory dataFactory = new TableDataFactory( "default", transMetaTableModel ); report.setDataFactory( dataFactory ); ReportHeader reportHeader = new ReportHeader(); report.setReportHeader( reportHeader ); ReportFooter reportFooter = new ReportFooter(); report.setReportFooter( reportFooter ); RelationalGroup group = new RelationalGroup(); group.addField( "filename" ); GroupDataBody groupData = new GroupDataBody(); ItemBand itemBand = new ItemBand(); itemBand.setVisible( true ); itemBand.setLayout( BandStyleKeys.LAYOUT_AUTO ); groupData.setItemBand( itemBand ); group.setBody( groupData ); report.setRootGroup( group ); int pagePosition = 0; reportHeader.getStyle().setStyleProperty( TextStyleKeys.BOLD, true ); pagePosition = createTextField( itemBand, "Filename: ", "filename", pagePosition ); if ( options.isIncludingName() ) { pagePosition = createTextField( itemBand, "Name: ", "name", pagePosition ); } if ( options.isIncludingDescription() ) { pagePosition = createTextField( itemBand, "Description: ", "description", pagePosition ); } if ( options.isIncludingExtendedDescription() ) { pagePosition = createTextField( itemBand, "Long description: ", "extended_description", pagePosition ); } if ( options.isIncludingLoggingConfiguration() ) { pagePosition = createTextField( itemBand, "Logging: ", "logging", pagePosition ); } if ( options.isIncludingCreated() ) { pagePosition = createTextField( itemBand, "Creation: ", "creation", pagePosition ); } if ( options.isIncludingModified() ) { pagePosition = createTextField( itemBand, "Modification: ", "modification", pagePosition ); } if ( options.isIncludingLastExecutionResult() ) { pagePosition = createTextField( itemBand, "Last execution result: : ", "last_exec_result", pagePosition ); } if ( options.isIncludingImage() ) { String bshCode = "Object getValue() { " + Const.CR + " return new " + TransJobDrawable.class.getName() + "(dataRow, " + ( options.getOutputType() == OutputType.PDF ? "true" : "false" ) + ");" + Const.CR + "}"; BSHExpression bshExpression = new BSHExpression(); bshExpression.setExpression( bshCode ); bshExpression.setName( "getImage" ); report.addExpression( bshExpression ); ContentElementFactory contentElementFactory = new ContentElementFactory(); contentElementFactory.setName( "image" ); contentElementFactory.setAbsolutePosition( new Point( 0, pagePosition ) ); contentElementFactory.setMinimumWidth( 750f ); contentElementFactory.setMaximumWidth( 750f ); contentElementFactory.setMinimumHeight( 400f ); contentElementFactory.setMaximumHeight( 750f ); contentElementFactory.setScale( true ); contentElementFactory.setDynamicHeight( true ); Element imageElement = contentElementFactory.createElement(); imageElement .setAttributeExpression( AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, bshExpression ); imageElement.setAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.IMAGE_ENCODING_QUALITY, "9" ); imageElement.setAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.IMAGE_ENCODING_TYPE, "PNG" ); ItemBand imageBand = new ItemBand(); imageBand.setLayout( BandStyleKeys.LAYOUT_ROW ); imageBand.addElement( imageElement ); itemBand.addElement( imageBand ); } Paper a4Paper = new Paper(); double paperWidth = 8.26; double paperHeight = 11.69; a4Paper.setSize( paperWidth * 72.0, paperHeight * 72.0 ); double leftMargin = 0.78; double rightMargin = 0.78; double topMargin = 0.08; double bottomMargin = 0.78; a4Paper.setImageableArea( leftMargin * 72.0, topMargin * 72.0, ( paperWidth - leftMargin - rightMargin ) * 72.0, ( paperHeight - topMargin - bottomMargin ) * 72.0 ); PageFormat pageFormat = new PageFormat(); pageFormat.setOrientation( PageFormat.LANDSCAPE ); pageFormat.setPaper( a4Paper ); SimplePageDefinition pageDefinition = new SimplePageDefinition( pageFormat ); report.setPageDefinition( pageDefinition ); } KettleReportBuilder( LoggingObjectInterface parentObject, List<ReportSubjectLocation> locations, String targetFilename, AutoDocOptionsInterface options ); void createReport(); void render(); }
@Test public void testGetBatchSizeInt() { ElasticSearchBulkMeta esbm = new ElasticSearchBulkMeta(); int batchSize = esbm.getBatchSizeInt( new VariableSpaceImpl() ); assertEquals( batchSize, ElasticSearchBulkMeta.DEFAULT_BATCH_SIZE ); }
public int getBatchSizeInt( VariableSpace vars ) { return Const.toInt( vars.environmentSubstitute( this.batchSize ), DEFAULT_BATCH_SIZE ); }
ElasticSearchBulkMeta extends BaseStepMeta implements StepMetaInterface { public int getBatchSizeInt( VariableSpace vars ) { return Const.toInt( vars.environmentSubstitute( this.batchSize ), DEFAULT_BATCH_SIZE ); } }
ElasticSearchBulkMeta extends BaseStepMeta implements StepMetaInterface { public int getBatchSizeInt( VariableSpace vars ) { return Const.toInt( vars.environmentSubstitute( this.batchSize ), DEFAULT_BATCH_SIZE ); } ElasticSearchBulkMeta(); }
ElasticSearchBulkMeta extends BaseStepMeta implements StepMetaInterface { public int getBatchSizeInt( VariableSpace vars ) { return Const.toInt( vars.environmentSubstitute( this.batchSize ), DEFAULT_BATCH_SIZE ); } ElasticSearchBulkMeta(); String getJsonField(); void setJsonField( String jsonField ); String getIdOutField(); void setIdOutField( String idField ); boolean isJsonInsert(); void setJsonInsert( boolean isJsonInsert ); String getIndex(); void setIndex( String index ); String getType(); void setType( String type ); void setIdInField( String idInField ); String getIdInField(); void setOverWriteIfSameId( boolean overWriteIfSameId ); boolean isOverWriteIfSameId(); boolean isUseOutput(); void setUseOutput( boolean value ); boolean isStopOnError(); void setStopOnError( boolean stopOnError ); List<Field> getFields(); Map<String, String> getFieldsMap(); void setFieldsMap( Map<String, String> values ); void clearFields(); void addField( String inputName, String nameInJson ); List<Server> getServers(); void setServers( List<Server> values ); void clearServers(); void addServer( String addr, int port ); Map<String, String> getSettingsMap(); void setSettingsMap( Map<String, String> values ); void clearSettings(); void addSetting( String property, String value ); void setBatchSize( String value ); String getBatchSize(); int getBatchSizeInt( VariableSpace vars ); String getTimeOut(); void setTimeOut( String TimeOut ); TimeUnit getTimeoutUnit(); void setTimeoutUnit( TimeUnit timeoutUnit ); Object clone(); void setDefault(); void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ); void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); String getXML(); void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ); void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step ); void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space, Repository repository, IMetaStore metaStore ); StepInterface getStep( StepMeta stepMeta, StepDataInterface stepDataInterface, int cnr, TransMeta transMeta, Trans trans ); StepDataInterface getStepData(); boolean supportsErrorHandling(); }
ElasticSearchBulkMeta extends BaseStepMeta implements StepMetaInterface { public int getBatchSizeInt( VariableSpace vars ) { return Const.toInt( vars.environmentSubstitute( this.batchSize ), DEFAULT_BATCH_SIZE ); } ElasticSearchBulkMeta(); String getJsonField(); void setJsonField( String jsonField ); String getIdOutField(); void setIdOutField( String idField ); boolean isJsonInsert(); void setJsonInsert( boolean isJsonInsert ); String getIndex(); void setIndex( String index ); String getType(); void setType( String type ); void setIdInField( String idInField ); String getIdInField(); void setOverWriteIfSameId( boolean overWriteIfSameId ); boolean isOverWriteIfSameId(); boolean isUseOutput(); void setUseOutput( boolean value ); boolean isStopOnError(); void setStopOnError( boolean stopOnError ); List<Field> getFields(); Map<String, String> getFieldsMap(); void setFieldsMap( Map<String, String> values ); void clearFields(); void addField( String inputName, String nameInJson ); List<Server> getServers(); void setServers( List<Server> values ); void clearServers(); void addServer( String addr, int port ); Map<String, String> getSettingsMap(); void setSettingsMap( Map<String, String> values ); void clearSettings(); void addSetting( String property, String value ); void setBatchSize( String value ); String getBatchSize(); int getBatchSizeInt( VariableSpace vars ); String getTimeOut(); void setTimeOut( String TimeOut ); TimeUnit getTimeoutUnit(); void setTimeoutUnit( TimeUnit timeoutUnit ); Object clone(); void setDefault(); void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ); void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); String getXML(); void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ); void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step ); void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space, Repository repository, IMetaStore metaStore ); StepInterface getStep( StepMeta stepMeta, StepDataInterface stepDataInterface, int cnr, TransMeta transMeta, Trans trans ); StepDataInterface getStepData(); boolean supportsErrorHandling(); static final int DEFAULT_BATCH_SIZE; static final Long DEFAULT_TIMEOUT; static final TimeUnit DEFAULT_TIMEOUT_UNIT; static final int DEFAULT_PORT; }
@Test public void testClone() { ElasticSearchBulkMeta esbm = new ElasticSearchBulkMeta(); ElasticSearchBulkMeta esbmClone = (ElasticSearchBulkMeta) esbm.clone(); assertNotNull( esbmClone ); }
public Object clone() { ElasticSearchBulkMeta retval = (ElasticSearchBulkMeta) super.clone(); return retval; }
ElasticSearchBulkMeta extends BaseStepMeta implements StepMetaInterface { public Object clone() { ElasticSearchBulkMeta retval = (ElasticSearchBulkMeta) super.clone(); return retval; } }
ElasticSearchBulkMeta extends BaseStepMeta implements StepMetaInterface { public Object clone() { ElasticSearchBulkMeta retval = (ElasticSearchBulkMeta) super.clone(); return retval; } ElasticSearchBulkMeta(); }
ElasticSearchBulkMeta extends BaseStepMeta implements StepMetaInterface { public Object clone() { ElasticSearchBulkMeta retval = (ElasticSearchBulkMeta) super.clone(); return retval; } ElasticSearchBulkMeta(); String getJsonField(); void setJsonField( String jsonField ); String getIdOutField(); void setIdOutField( String idField ); boolean isJsonInsert(); void setJsonInsert( boolean isJsonInsert ); String getIndex(); void setIndex( String index ); String getType(); void setType( String type ); void setIdInField( String idInField ); String getIdInField(); void setOverWriteIfSameId( boolean overWriteIfSameId ); boolean isOverWriteIfSameId(); boolean isUseOutput(); void setUseOutput( boolean value ); boolean isStopOnError(); void setStopOnError( boolean stopOnError ); List<Field> getFields(); Map<String, String> getFieldsMap(); void setFieldsMap( Map<String, String> values ); void clearFields(); void addField( String inputName, String nameInJson ); List<Server> getServers(); void setServers( List<Server> values ); void clearServers(); void addServer( String addr, int port ); Map<String, String> getSettingsMap(); void setSettingsMap( Map<String, String> values ); void clearSettings(); void addSetting( String property, String value ); void setBatchSize( String value ); String getBatchSize(); int getBatchSizeInt( VariableSpace vars ); String getTimeOut(); void setTimeOut( String TimeOut ); TimeUnit getTimeoutUnit(); void setTimeoutUnit( TimeUnit timeoutUnit ); Object clone(); void setDefault(); void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ); void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); String getXML(); void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ); void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step ); void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space, Repository repository, IMetaStore metaStore ); StepInterface getStep( StepMeta stepMeta, StepDataInterface stepDataInterface, int cnr, TransMeta transMeta, Trans trans ); StepDataInterface getStepData(); boolean supportsErrorHandling(); }
ElasticSearchBulkMeta extends BaseStepMeta implements StepMetaInterface { public Object clone() { ElasticSearchBulkMeta retval = (ElasticSearchBulkMeta) super.clone(); return retval; } ElasticSearchBulkMeta(); String getJsonField(); void setJsonField( String jsonField ); String getIdOutField(); void setIdOutField( String idField ); boolean isJsonInsert(); void setJsonInsert( boolean isJsonInsert ); String getIndex(); void setIndex( String index ); String getType(); void setType( String type ); void setIdInField( String idInField ); String getIdInField(); void setOverWriteIfSameId( boolean overWriteIfSameId ); boolean isOverWriteIfSameId(); boolean isUseOutput(); void setUseOutput( boolean value ); boolean isStopOnError(); void setStopOnError( boolean stopOnError ); List<Field> getFields(); Map<String, String> getFieldsMap(); void setFieldsMap( Map<String, String> values ); void clearFields(); void addField( String inputName, String nameInJson ); List<Server> getServers(); void setServers( List<Server> values ); void clearServers(); void addServer( String addr, int port ); Map<String, String> getSettingsMap(); void setSettingsMap( Map<String, String> values ); void clearSettings(); void addSetting( String property, String value ); void setBatchSize( String value ); String getBatchSize(); int getBatchSizeInt( VariableSpace vars ); String getTimeOut(); void setTimeOut( String TimeOut ); TimeUnit getTimeoutUnit(); void setTimeoutUnit( TimeUnit timeoutUnit ); Object clone(); void setDefault(); void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ); void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); String getXML(); void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ); void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step ); void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space, Repository repository, IMetaStore metaStore ); StepInterface getStep( StepMeta stepMeta, StepDataInterface stepDataInterface, int cnr, TransMeta transMeta, Trans trans ); StepDataInterface getStepData(); boolean supportsErrorHandling(); static final int DEFAULT_BATCH_SIZE; static final Long DEFAULT_TIMEOUT; static final TimeUnit DEFAULT_TIMEOUT_UNIT; static final int DEFAULT_PORT; }
@Test public void testSupportsErrorHandling() { ElasticSearchBulkMeta esbm = new ElasticSearchBulkMeta(); boolean supportsError = esbm.supportsErrorHandling(); assertTrue( supportsError ); }
public boolean supportsErrorHandling() { return true; }
ElasticSearchBulkMeta extends BaseStepMeta implements StepMetaInterface { public boolean supportsErrorHandling() { return true; } }
ElasticSearchBulkMeta extends BaseStepMeta implements StepMetaInterface { public boolean supportsErrorHandling() { return true; } ElasticSearchBulkMeta(); }
ElasticSearchBulkMeta extends BaseStepMeta implements StepMetaInterface { public boolean supportsErrorHandling() { return true; } ElasticSearchBulkMeta(); String getJsonField(); void setJsonField( String jsonField ); String getIdOutField(); void setIdOutField( String idField ); boolean isJsonInsert(); void setJsonInsert( boolean isJsonInsert ); String getIndex(); void setIndex( String index ); String getType(); void setType( String type ); void setIdInField( String idInField ); String getIdInField(); void setOverWriteIfSameId( boolean overWriteIfSameId ); boolean isOverWriteIfSameId(); boolean isUseOutput(); void setUseOutput( boolean value ); boolean isStopOnError(); void setStopOnError( boolean stopOnError ); List<Field> getFields(); Map<String, String> getFieldsMap(); void setFieldsMap( Map<String, String> values ); void clearFields(); void addField( String inputName, String nameInJson ); List<Server> getServers(); void setServers( List<Server> values ); void clearServers(); void addServer( String addr, int port ); Map<String, String> getSettingsMap(); void setSettingsMap( Map<String, String> values ); void clearSettings(); void addSetting( String property, String value ); void setBatchSize( String value ); String getBatchSize(); int getBatchSizeInt( VariableSpace vars ); String getTimeOut(); void setTimeOut( String TimeOut ); TimeUnit getTimeoutUnit(); void setTimeoutUnit( TimeUnit timeoutUnit ); Object clone(); void setDefault(); void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ); void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); String getXML(); void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ); void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step ); void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space, Repository repository, IMetaStore metaStore ); StepInterface getStep( StepMeta stepMeta, StepDataInterface stepDataInterface, int cnr, TransMeta transMeta, Trans trans ); StepDataInterface getStepData(); boolean supportsErrorHandling(); }
ElasticSearchBulkMeta extends BaseStepMeta implements StepMetaInterface { public boolean supportsErrorHandling() { return true; } ElasticSearchBulkMeta(); String getJsonField(); void setJsonField( String jsonField ); String getIdOutField(); void setIdOutField( String idField ); boolean isJsonInsert(); void setJsonInsert( boolean isJsonInsert ); String getIndex(); void setIndex( String index ); String getType(); void setType( String type ); void setIdInField( String idInField ); String getIdInField(); void setOverWriteIfSameId( boolean overWriteIfSameId ); boolean isOverWriteIfSameId(); boolean isUseOutput(); void setUseOutput( boolean value ); boolean isStopOnError(); void setStopOnError( boolean stopOnError ); List<Field> getFields(); Map<String, String> getFieldsMap(); void setFieldsMap( Map<String, String> values ); void clearFields(); void addField( String inputName, String nameInJson ); List<Server> getServers(); void setServers( List<Server> values ); void clearServers(); void addServer( String addr, int port ); Map<String, String> getSettingsMap(); void setSettingsMap( Map<String, String> values ); void clearSettings(); void addSetting( String property, String value ); void setBatchSize( String value ); String getBatchSize(); int getBatchSizeInt( VariableSpace vars ); String getTimeOut(); void setTimeOut( String TimeOut ); TimeUnit getTimeoutUnit(); void setTimeoutUnit( TimeUnit timeoutUnit ); Object clone(); void setDefault(); void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ); void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); String getXML(); void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ); void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step ); void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space, Repository repository, IMetaStore metaStore ); StepInterface getStep( StepMeta stepMeta, StepDataInterface stepDataInterface, int cnr, TransMeta transMeta, Trans trans ); StepDataInterface getStepData(); boolean supportsErrorHandling(); static final int DEFAULT_BATCH_SIZE; static final Long DEFAULT_TIMEOUT; static final TimeUnit DEFAULT_TIMEOUT_UNIT; static final int DEFAULT_PORT; }
@Test public void testGetStepData() { ElasticSearchBulkMeta esbm = new ElasticSearchBulkMeta(); StepDataInterface sdi = esbm.getStepData(); assertTrue( sdi instanceof ElasticSearchBulkData ); }
public StepDataInterface getStepData() { return new ElasticSearchBulkData(); }
ElasticSearchBulkMeta extends BaseStepMeta implements StepMetaInterface { public StepDataInterface getStepData() { return new ElasticSearchBulkData(); } }
ElasticSearchBulkMeta extends BaseStepMeta implements StepMetaInterface { public StepDataInterface getStepData() { return new ElasticSearchBulkData(); } ElasticSearchBulkMeta(); }
ElasticSearchBulkMeta extends BaseStepMeta implements StepMetaInterface { public StepDataInterface getStepData() { return new ElasticSearchBulkData(); } ElasticSearchBulkMeta(); String getJsonField(); void setJsonField( String jsonField ); String getIdOutField(); void setIdOutField( String idField ); boolean isJsonInsert(); void setJsonInsert( boolean isJsonInsert ); String getIndex(); void setIndex( String index ); String getType(); void setType( String type ); void setIdInField( String idInField ); String getIdInField(); void setOverWriteIfSameId( boolean overWriteIfSameId ); boolean isOverWriteIfSameId(); boolean isUseOutput(); void setUseOutput( boolean value ); boolean isStopOnError(); void setStopOnError( boolean stopOnError ); List<Field> getFields(); Map<String, String> getFieldsMap(); void setFieldsMap( Map<String, String> values ); void clearFields(); void addField( String inputName, String nameInJson ); List<Server> getServers(); void setServers( List<Server> values ); void clearServers(); void addServer( String addr, int port ); Map<String, String> getSettingsMap(); void setSettingsMap( Map<String, String> values ); void clearSettings(); void addSetting( String property, String value ); void setBatchSize( String value ); String getBatchSize(); int getBatchSizeInt( VariableSpace vars ); String getTimeOut(); void setTimeOut( String TimeOut ); TimeUnit getTimeoutUnit(); void setTimeoutUnit( TimeUnit timeoutUnit ); Object clone(); void setDefault(); void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ); void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); String getXML(); void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ); void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step ); void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space, Repository repository, IMetaStore metaStore ); StepInterface getStep( StepMeta stepMeta, StepDataInterface stepDataInterface, int cnr, TransMeta transMeta, Trans trans ); StepDataInterface getStepData(); boolean supportsErrorHandling(); }
ElasticSearchBulkMeta extends BaseStepMeta implements StepMetaInterface { public StepDataInterface getStepData() { return new ElasticSearchBulkData(); } ElasticSearchBulkMeta(); String getJsonField(); void setJsonField( String jsonField ); String getIdOutField(); void setIdOutField( String idField ); boolean isJsonInsert(); void setJsonInsert( boolean isJsonInsert ); String getIndex(); void setIndex( String index ); String getType(); void setType( String type ); void setIdInField( String idInField ); String getIdInField(); void setOverWriteIfSameId( boolean overWriteIfSameId ); boolean isOverWriteIfSameId(); boolean isUseOutput(); void setUseOutput( boolean value ); boolean isStopOnError(); void setStopOnError( boolean stopOnError ); List<Field> getFields(); Map<String, String> getFieldsMap(); void setFieldsMap( Map<String, String> values ); void clearFields(); void addField( String inputName, String nameInJson ); List<Server> getServers(); void setServers( List<Server> values ); void clearServers(); void addServer( String addr, int port ); Map<String, String> getSettingsMap(); void setSettingsMap( Map<String, String> values ); void clearSettings(); void addSetting( String property, String value ); void setBatchSize( String value ); String getBatchSize(); int getBatchSizeInt( VariableSpace vars ); String getTimeOut(); void setTimeOut( String TimeOut ); TimeUnit getTimeoutUnit(); void setTimeoutUnit( TimeUnit timeoutUnit ); Object clone(); void setDefault(); void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ); void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); String getXML(); void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ); void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step ); void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space, Repository repository, IMetaStore metaStore ); StepInterface getStep( StepMeta stepMeta, StepDataInterface stepDataInterface, int cnr, TransMeta transMeta, Trans trans ); StepDataInterface getStepData(); boolean supportsErrorHandling(); static final int DEFAULT_BATCH_SIZE; static final Long DEFAULT_TIMEOUT; static final TimeUnit DEFAULT_TIMEOUT_UNIT; static final int DEFAULT_PORT; }
@Test public void testGetBundleNewUTF8() throws Exception { res = GlobalMessages.getBundle( Locale.JAPAN, "org/pentaho/di/i18n/messages/test_utf8_messages" ); assertEquals( "環境変数の選択", res.getString( "System.Dialog.SelectEnvironmentVar.Title" ) ); res = GlobalMessages.getBundle( Locale.CHINA, "org/pentaho/di/i18n/messages/test_utf8_messages" ); assertEquals( "选择一个环境变量", res.getString( "System.Dialog.SelectEnvironmentVar.Title" ) ); }
public static ResourceBundle getBundle( String packageName ) throws MissingResourceException { return getBundle( packageName, GlobalMessages.getInstance().getClass() ); }
GlobalMessages extends AbstractMessageHandler { public static ResourceBundle getBundle( String packageName ) throws MissingResourceException { return getBundle( packageName, GlobalMessages.getInstance().getClass() ); } }
GlobalMessages extends AbstractMessageHandler { public static ResourceBundle getBundle( String packageName ) throws MissingResourceException { return getBundle( packageName, GlobalMessages.getInstance().getClass() ); } GlobalMessages(); }
GlobalMessages extends AbstractMessageHandler { public static ResourceBundle getBundle( String packageName ) throws MissingResourceException { return getBundle( packageName, GlobalMessages.getInstance().getClass() ); } GlobalMessages(); static synchronized MessageHandler getInstance(); static synchronized Locale getLocale(); static synchronized void setLocale( Locale newLocale ); static ResourceBundle getBundle( String packageName ); static ResourceBundle getBundle( String packageName, Class<?> resourceClass ); static ResourceBundle getBundle( Locale locale, String packageName ); static ResourceBundle getBundle( Locale locale, String packageName, Class<?> resourceClass ); @Override String getString( String key ); @Override String getString( String packageName, String key ); @Override String getString( String packageName, String key, String... parameters ); @Override String getString( String packageName, String key, Class<?> resourceClass, String... parameters ); }
GlobalMessages extends AbstractMessageHandler { public static ResourceBundle getBundle( String packageName ) throws MissingResourceException { return getBundle( packageName, GlobalMessages.getInstance().getClass() ); } GlobalMessages(); static synchronized MessageHandler getInstance(); static synchronized Locale getLocale(); static synchronized void setLocale( Locale newLocale ); static ResourceBundle getBundle( String packageName ); static ResourceBundle getBundle( String packageName, Class<?> resourceClass ); static ResourceBundle getBundle( Locale locale, String packageName ); static ResourceBundle getBundle( Locale locale, String packageName, Class<?> resourceClass ); @Override String getString( String key ); @Override String getString( String packageName, String key ); @Override String getString( String packageName, String key, String... parameters ); @Override String getString( String packageName, String key, Class<?> resourceClass, String... parameters ); static final String[] localeCodes; static final String[] localeDescr; }
@Test public void testOpenLocalPentahoMetaStore() throws Exception { MetaStoreConst.disableMetaStore = false; File tempDir = Files.createTempDir(); String tempPath = tempDir.getAbsolutePath(); System.setProperty( Const.PENTAHO_METASTORE_FOLDER, tempPath ); String metaFolder = tempPath + File.separator + XmlUtil.META_FOLDER_NAME; assertNotNull( MetaStoreConst.openLocalPentahoMetaStore() ); assertTrue( ( new File( metaFolder ) ).exists() ); MetaStoreConst.disableMetaStore = true; assertNull( MetaStoreConst.openLocalPentahoMetaStore() ); MetaStoreConst.disableMetaStore = false; assertNotNull( MetaStoreConst.openLocalPentahoMetaStore( false ) ); FileUtils.deleteDirectory( new File( metaFolder ) ); assertNull( MetaStoreConst.openLocalPentahoMetaStore( false ) ); assertFalse( ( new File( metaFolder ) ).exists() ); }
public static IMetaStore openLocalPentahoMetaStore() throws MetaStoreException { return MetaStoreConst.openLocalPentahoMetaStore( true ); }
MetaStoreConst { public static IMetaStore openLocalPentahoMetaStore() throws MetaStoreException { return MetaStoreConst.openLocalPentahoMetaStore( true ); } }
MetaStoreConst { public static IMetaStore openLocalPentahoMetaStore() throws MetaStoreException { return MetaStoreConst.openLocalPentahoMetaStore( true ); } }
MetaStoreConst { public static IMetaStore openLocalPentahoMetaStore() throws MetaStoreException { return MetaStoreConst.openLocalPentahoMetaStore( true ); } static final String getDefaultPentahoMetaStoreLocation(); static IMetaStore openLocalPentahoMetaStore(); static IMetaStore openLocalPentahoMetaStore( boolean allowCreate ); }
MetaStoreConst { public static IMetaStore openLocalPentahoMetaStore() throws MetaStoreException { return MetaStoreConst.openLocalPentahoMetaStore( true ); } static final String getDefaultPentahoMetaStoreLocation(); static IMetaStore openLocalPentahoMetaStore(); static IMetaStore openLocalPentahoMetaStore( boolean allowCreate ); static final String DB_ATTR_ID_DESCRIPTION; static final String DB_ATTR_ID_PLUGIN_ID; static final String DB_ATTR_ID_ACCESS_TYPE; static final String DB_ATTR_ID_HOSTNAME; static final String DB_ATTR_ID_PORT; static final String DB_ATTR_ID_DATABASE_NAME; static final String DB_ATTR_ID_USERNAME; static final String DB_ATTR_ID_PASSWORD; static final String DB_ATTR_ID_SERVERNAME; static final String DB_ATTR_ID_DATA_TABLESPACE; static final String DB_ATTR_ID_INDEX_TABLESPACE; static boolean disableMetaStore; static final String DB_ATTR_DRIVER_CLASS; static final String DB_ATTR_JDBC_URL; static final String DB_ATTR_ID_ATTRIBUTES; }
@Test public void testDefaultPassedBatchId() { TransExecutionConfiguration tec = new TransExecutionConfiguration(); assertEquals( "default passedBatchId value must be null", null, tec.getPassedBatchId() ); }
public Long getPassedBatchId() { return passedBatchId; }
TransExecutionConfiguration implements ExecutionConfiguration { public Long getPassedBatchId() { return passedBatchId; } }
TransExecutionConfiguration implements ExecutionConfiguration { public Long getPassedBatchId() { return passedBatchId; } TransExecutionConfiguration(); TransExecutionConfiguration( Node trecNode ); }
TransExecutionConfiguration implements ExecutionConfiguration { public Long getPassedBatchId() { return passedBatchId; } TransExecutionConfiguration(); TransExecutionConfiguration( Node trecNode ); Object clone(); Map<String, String> getArguments(); void setArguments( Map<String, String> arguments ); void setParams( Map<String, String> params ); Map<String, String> getParams(); void setArgumentStrings( String[] arguments ); boolean isExecutingClustered(); void setExecutingClustered( boolean clusteredExecution ); boolean isClusterStarting(); void setClusterStarting( boolean notExecuting ); boolean isClusterShowingTransformation(); void setClusterShowingTransformation( boolean showingTransformations ); Map<String, String> getVariables(); void setVariables( Map<String, String> variables ); void setVariables( VariableSpace space ); boolean isExecutingRemotely(); void setExecutingRemotely( boolean remoteExecution ); boolean isClusterPosting(); void setClusterPosting( boolean clusterPosting ); boolean isExecutingLocally(); void setExecutingLocally( boolean localExecution ); boolean isClusterPreparing(); void setClusterPreparing( boolean clusterPreparing ); SlaveServer getRemoteServer(); void setRemoteServer( SlaveServer remoteServer ); void getAllVariables( TransMeta transMeta ); void getUsedVariables( TransMeta transMeta ); void getUsedArguments( TransMeta transMeta, String[] commandLineArguments ); Date getReplayDate(); void setReplayDate( Date replayDate ); boolean isSafeModeEnabled(); void setSafeModeEnabled( boolean usingSafeMode ); LogLevel getLogLevel(); void setLogLevel( LogLevel logLevel ); String getXML(); Repository connectRepository( RepositoriesMeta repositoriesMeta, String repositoryName, String username, String password ); String[] getArgumentStrings(); TransDebugMeta getTransDebugMeta(); void setTransDebugMeta( TransDebugMeta transDebugMeta ); Result getPreviousResult(); void setPreviousResult( Result previousResult ); Repository getRepository(); void setRepository( Repository repository ); boolean isClearingLog(); void setClearingLog( boolean clearingLog ); boolean isPassingExport(); void setPassingExport( boolean passingExport ); boolean isGatheringMetrics(); void setGatheringMetrics( boolean gatheringMetrics ); boolean isShowingSubComponents(); void setShowingSubComponents( boolean showingSubComponents ); boolean isSetLogfile(); void setSetLogfile( boolean setLogfile ); boolean isSetAppendLogfile(); void setSetAppendLogfile( boolean setAppendLogfile ); String getLogFileName(); void setLogFileName( String fileName ); boolean isCreateParentFolder(); void setCreateParentFolder( boolean createParentFolder ); Long getPassedBatchId(); void setPassedBatchId( Long passedBatchId ); String getRunConfiguration(); void setRunConfiguration( String runConfiguration ); boolean isLogRemoteExecutionLocally(); void setLogRemoteExecutionLocally( boolean logRemoteExecutionLocally ); }
TransExecutionConfiguration implements ExecutionConfiguration { public Long getPassedBatchId() { return passedBatchId; } TransExecutionConfiguration(); TransExecutionConfiguration( Node trecNode ); Object clone(); Map<String, String> getArguments(); void setArguments( Map<String, String> arguments ); void setParams( Map<String, String> params ); Map<String, String> getParams(); void setArgumentStrings( String[] arguments ); boolean isExecutingClustered(); void setExecutingClustered( boolean clusteredExecution ); boolean isClusterStarting(); void setClusterStarting( boolean notExecuting ); boolean isClusterShowingTransformation(); void setClusterShowingTransformation( boolean showingTransformations ); Map<String, String> getVariables(); void setVariables( Map<String, String> variables ); void setVariables( VariableSpace space ); boolean isExecutingRemotely(); void setExecutingRemotely( boolean remoteExecution ); boolean isClusterPosting(); void setClusterPosting( boolean clusterPosting ); boolean isExecutingLocally(); void setExecutingLocally( boolean localExecution ); boolean isClusterPreparing(); void setClusterPreparing( boolean clusterPreparing ); SlaveServer getRemoteServer(); void setRemoteServer( SlaveServer remoteServer ); void getAllVariables( TransMeta transMeta ); void getUsedVariables( TransMeta transMeta ); void getUsedArguments( TransMeta transMeta, String[] commandLineArguments ); Date getReplayDate(); void setReplayDate( Date replayDate ); boolean isSafeModeEnabled(); void setSafeModeEnabled( boolean usingSafeMode ); LogLevel getLogLevel(); void setLogLevel( LogLevel logLevel ); String getXML(); Repository connectRepository( RepositoriesMeta repositoriesMeta, String repositoryName, String username, String password ); String[] getArgumentStrings(); TransDebugMeta getTransDebugMeta(); void setTransDebugMeta( TransDebugMeta transDebugMeta ); Result getPreviousResult(); void setPreviousResult( Result previousResult ); Repository getRepository(); void setRepository( Repository repository ); boolean isClearingLog(); void setClearingLog( boolean clearingLog ); boolean isPassingExport(); void setPassingExport( boolean passingExport ); boolean isGatheringMetrics(); void setGatheringMetrics( boolean gatheringMetrics ); boolean isShowingSubComponents(); void setShowingSubComponents( boolean showingSubComponents ); boolean isSetLogfile(); void setSetLogfile( boolean setLogfile ); boolean isSetAppendLogfile(); void setSetAppendLogfile( boolean setAppendLogfile ); String getLogFileName(); void setLogFileName( String fileName ); boolean isCreateParentFolder(); void setCreateParentFolder( boolean createParentFolder ); Long getPassedBatchId(); void setPassedBatchId( Long passedBatchId ); String getRunConfiguration(); void setRunConfiguration( String runConfiguration ); boolean isLogRemoteExecutionLocally(); void setLogRemoteExecutionLocally( boolean logRemoteExecutionLocally ); static final String XML_TAG; }
@Test public void testStringObjectId() { String expectedId = UUID.randomUUID().toString(); StringObjectId obj = new StringObjectId( expectedId ); assertEquals( expectedId, obj.getId() ); assertEquals( expectedId, obj.toString() ); assertEquals( expectedId.hashCode(), obj.hashCode() ); assertFalse( obj.equals( null ) ); assertTrue( obj.equals( obj ) ); assertEquals( 0, obj.compareTo( obj ) ); StringObjectId clone = new StringObjectId( obj ); assertNotSame( obj, clone ); assertEquals( obj.getId(), clone.getId() ); }
public StringObjectId( String id ) { this.id = id; }
StringObjectId implements ObjectId, Comparable<StringObjectId> { public StringObjectId( String id ) { this.id = id; } }
StringObjectId implements ObjectId, Comparable<StringObjectId> { public StringObjectId( String id ) { this.id = id; } StringObjectId( String id ); StringObjectId( ObjectId objectId ); }
StringObjectId implements ObjectId, Comparable<StringObjectId> { public StringObjectId( String id ) { this.id = id; } StringObjectId( String id ); StringObjectId( ObjectId objectId ); @Override boolean equals( Object obj ); @Override int hashCode(); @Override int compareTo( StringObjectId o ); @Override String toString(); @Override String getId(); }
StringObjectId implements ObjectId, Comparable<StringObjectId> { public StringObjectId( String id ) { this.id = id; } StringObjectId( String id ); StringObjectId( ObjectId objectId ); @Override boolean equals( Object obj ); @Override int hashCode(); @Override int compareTo( StringObjectId o ); @Override String toString(); @Override String getId(); }
@Test public void testNegatedTrueFuncEvaluatesAsFalse() throws Exception { String left = "test_filed"; String right = "test_value"; int func = Condition.FUNC_TRUE; boolean negate = true; Condition condition = new Condition( negate, left, func, right, null ); assertFalse( condition.evaluate( new RowMeta(), new Object[]{ "test" } ) ); }
public boolean evaluate( RowMetaInterface rowMeta, Object[] r ) { boolean retval = false; try { if ( isAtomic() ) { if ( function == FUNC_TRUE ) { return !negate; } if ( left_valuename != null && left_valuename.length() > 0 ) { left_fieldnr = rowMeta.indexOfValue( left_valuename ); } if ( right_valuename != null && right_valuename.length() > 0 ) { right_fieldnr = rowMeta.indexOfValue( right_valuename ); } ValueMetaInterface fieldMeta = null; Object field = null; if ( left_fieldnr >= 0 ) { fieldMeta = rowMeta.getValueMeta( left_fieldnr ); field = r[left_fieldnr]; } else { return false; } ValueMetaInterface fieldMeta2 = right_exact != null ? right_exact.getValueMeta() : null; Object field2 = right_exact != null ? right_exact.getValueData() : null; if ( field2 == null && right_fieldnr >= 0 ) { fieldMeta2 = rowMeta.getValueMeta( right_fieldnr ); field2 = r[right_fieldnr]; } switch ( function ) { case FUNC_EQUAL: retval = ( fieldMeta.compare( field, fieldMeta2, field2 ) == 0 ); break; case FUNC_NOT_EQUAL: retval = ( fieldMeta.compare( field, fieldMeta2, field2 ) != 0 ); break; case FUNC_SMALLER: retval = ( fieldMeta.compare( field, fieldMeta2, field2 ) < 0 ); break; case FUNC_SMALLER_EQUAL: retval = ( fieldMeta.compare( field, fieldMeta2, field2 ) <= 0 ); break; case FUNC_LARGER: retval = ( fieldMeta.compare( field, fieldMeta2, field2 ) > 0 ); break; case FUNC_LARGER_EQUAL: retval = ( fieldMeta.compare( field, fieldMeta2, field2 ) >= 0 ); break; case FUNC_REGEXP: if ( fieldMeta.isNull( field ) || field2 == null ) { retval = false; } else { retval = Pattern .matches( fieldMeta2.getCompatibleString( field2 ), fieldMeta.getCompatibleString( field ) ); } break; case FUNC_NULL: retval = ( fieldMeta.isNull( field ) ); break; case FUNC_NOT_NULL: retval = ( !fieldMeta.isNull( field ) ); break; case FUNC_IN_LIST: if ( inList == null || right_fieldnr >= 0 ) { inList = Const.splitString( fieldMeta2.getString( field2 ), ';', true ); for ( int i = 0; i < inList.length; i++ ) { inList[i] = inList[i] == null ? null : inList[i].replace( "\\", "" ); } Arrays.sort( inList ); } String searchString = fieldMeta.getCompatibleString( field ); int inIndex = -1; if ( searchString != null ) { inIndex = Arrays.binarySearch( inList, searchString ); } retval = Boolean.valueOf( inIndex >= 0 ); break; case FUNC_CONTAINS: retval = fieldMeta.getCompatibleString( field ) != null ? fieldMeta.getCompatibleString( field ).indexOf( fieldMeta2.getCompatibleString( field2 ) ) >= 0 : false; break; case FUNC_STARTS_WITH: retval = fieldMeta.getCompatibleString( field ) != null ? fieldMeta .getCompatibleString( field ).startsWith( fieldMeta2.getCompatibleString( field2 ) ) : false; break; case FUNC_ENDS_WITH: String string = fieldMeta.getCompatibleString( field ); if ( !Utils.isEmpty( string ) ) { if ( right_string == null && field2 != null ) { right_string = fieldMeta2.getCompatibleString( field2 ); } if ( right_string != null ) { retval = string.endsWith( fieldMeta2.getCompatibleString( field2 ) ); } else { retval = false; } } else { retval = false; } break; case FUNC_LIKE: if ( fieldMeta.isNull( field ) || field2 == null ) { retval = false; } else { String regex = fieldMeta2.getCompatibleString( field2 ); regex = regex.replace( "%", ".*" ); regex = regex.replace( "?", "." ); retval = Pattern.matches( regex, fieldMeta.getCompatibleString( field ) ); } break; default: break; } if ( isNegated() ) { retval = !retval; } } else { Condition cb0 = list.get( 0 ); retval = cb0.evaluate( rowMeta, r ); for ( int i = 1; i < list.size(); i++ ) { Condition cb = list.get( i ); switch ( cb.getOperator() ) { case Condition.OPERATOR_OR: retval = retval || cb.evaluate( rowMeta, r ); break; case Condition.OPERATOR_AND: retval = retval && cb.evaluate( rowMeta, r ); break; case Condition.OPERATOR_OR_NOT: retval = retval || ( !cb.evaluate( rowMeta, r ) ); break; case Condition.OPERATOR_AND_NOT: retval = retval && ( !cb.evaluate( rowMeta, r ) ); break; case Condition.OPERATOR_XOR: retval = retval ^ cb.evaluate( rowMeta, r ); break; default: break; } } if ( isNegated() ) { retval = !retval; } } } catch ( Exception e ) { throw new RuntimeException( "Unexpected error evaluation condition [" + toString() + "]", e ); } return retval; }
Condition implements Cloneable, XMLInterface { public boolean evaluate( RowMetaInterface rowMeta, Object[] r ) { boolean retval = false; try { if ( isAtomic() ) { if ( function == FUNC_TRUE ) { return !negate; } if ( left_valuename != null && left_valuename.length() > 0 ) { left_fieldnr = rowMeta.indexOfValue( left_valuename ); } if ( right_valuename != null && right_valuename.length() > 0 ) { right_fieldnr = rowMeta.indexOfValue( right_valuename ); } ValueMetaInterface fieldMeta = null; Object field = null; if ( left_fieldnr >= 0 ) { fieldMeta = rowMeta.getValueMeta( left_fieldnr ); field = r[left_fieldnr]; } else { return false; } ValueMetaInterface fieldMeta2 = right_exact != null ? right_exact.getValueMeta() : null; Object field2 = right_exact != null ? right_exact.getValueData() : null; if ( field2 == null && right_fieldnr >= 0 ) { fieldMeta2 = rowMeta.getValueMeta( right_fieldnr ); field2 = r[right_fieldnr]; } switch ( function ) { case FUNC_EQUAL: retval = ( fieldMeta.compare( field, fieldMeta2, field2 ) == 0 ); break; case FUNC_NOT_EQUAL: retval = ( fieldMeta.compare( field, fieldMeta2, field2 ) != 0 ); break; case FUNC_SMALLER: retval = ( fieldMeta.compare( field, fieldMeta2, field2 ) < 0 ); break; case FUNC_SMALLER_EQUAL: retval = ( fieldMeta.compare( field, fieldMeta2, field2 ) <= 0 ); break; case FUNC_LARGER: retval = ( fieldMeta.compare( field, fieldMeta2, field2 ) > 0 ); break; case FUNC_LARGER_EQUAL: retval = ( fieldMeta.compare( field, fieldMeta2, field2 ) >= 0 ); break; case FUNC_REGEXP: if ( fieldMeta.isNull( field ) || field2 == null ) { retval = false; } else { retval = Pattern .matches( fieldMeta2.getCompatibleString( field2 ), fieldMeta.getCompatibleString( field ) ); } break; case FUNC_NULL: retval = ( fieldMeta.isNull( field ) ); break; case FUNC_NOT_NULL: retval = ( !fieldMeta.isNull( field ) ); break; case FUNC_IN_LIST: if ( inList == null || right_fieldnr >= 0 ) { inList = Const.splitString( fieldMeta2.getString( field2 ), ';', true ); for ( int i = 0; i < inList.length; i++ ) { inList[i] = inList[i] == null ? null : inList[i].replace( "\\", "" ); } Arrays.sort( inList ); } String searchString = fieldMeta.getCompatibleString( field ); int inIndex = -1; if ( searchString != null ) { inIndex = Arrays.binarySearch( inList, searchString ); } retval = Boolean.valueOf( inIndex >= 0 ); break; case FUNC_CONTAINS: retval = fieldMeta.getCompatibleString( field ) != null ? fieldMeta.getCompatibleString( field ).indexOf( fieldMeta2.getCompatibleString( field2 ) ) >= 0 : false; break; case FUNC_STARTS_WITH: retval = fieldMeta.getCompatibleString( field ) != null ? fieldMeta .getCompatibleString( field ).startsWith( fieldMeta2.getCompatibleString( field2 ) ) : false; break; case FUNC_ENDS_WITH: String string = fieldMeta.getCompatibleString( field ); if ( !Utils.isEmpty( string ) ) { if ( right_string == null && field2 != null ) { right_string = fieldMeta2.getCompatibleString( field2 ); } if ( right_string != null ) { retval = string.endsWith( fieldMeta2.getCompatibleString( field2 ) ); } else { retval = false; } } else { retval = false; } break; case FUNC_LIKE: if ( fieldMeta.isNull( field ) || field2 == null ) { retval = false; } else { String regex = fieldMeta2.getCompatibleString( field2 ); regex = regex.replace( "%", ".*" ); regex = regex.replace( "?", "." ); retval = Pattern.matches( regex, fieldMeta.getCompatibleString( field ) ); } break; default: break; } if ( isNegated() ) { retval = !retval; } } else { Condition cb0 = list.get( 0 ); retval = cb0.evaluate( rowMeta, r ); for ( int i = 1; i < list.size(); i++ ) { Condition cb = list.get( i ); switch ( cb.getOperator() ) { case Condition.OPERATOR_OR: retval = retval || cb.evaluate( rowMeta, r ); break; case Condition.OPERATOR_AND: retval = retval && cb.evaluate( rowMeta, r ); break; case Condition.OPERATOR_OR_NOT: retval = retval || ( !cb.evaluate( rowMeta, r ) ); break; case Condition.OPERATOR_AND_NOT: retval = retval && ( !cb.evaluate( rowMeta, r ) ); break; case Condition.OPERATOR_XOR: retval = retval ^ cb.evaluate( rowMeta, r ); break; default: break; } } if ( isNegated() ) { retval = !retval; } } } catch ( Exception e ) { throw new RuntimeException( "Unexpected error evaluation condition [" + toString() + "]", e ); } return retval; } }
Condition implements Cloneable, XMLInterface { public boolean evaluate( RowMetaInterface rowMeta, Object[] r ) { boolean retval = false; try { if ( isAtomic() ) { if ( function == FUNC_TRUE ) { return !negate; } if ( left_valuename != null && left_valuename.length() > 0 ) { left_fieldnr = rowMeta.indexOfValue( left_valuename ); } if ( right_valuename != null && right_valuename.length() > 0 ) { right_fieldnr = rowMeta.indexOfValue( right_valuename ); } ValueMetaInterface fieldMeta = null; Object field = null; if ( left_fieldnr >= 0 ) { fieldMeta = rowMeta.getValueMeta( left_fieldnr ); field = r[left_fieldnr]; } else { return false; } ValueMetaInterface fieldMeta2 = right_exact != null ? right_exact.getValueMeta() : null; Object field2 = right_exact != null ? right_exact.getValueData() : null; if ( field2 == null && right_fieldnr >= 0 ) { fieldMeta2 = rowMeta.getValueMeta( right_fieldnr ); field2 = r[right_fieldnr]; } switch ( function ) { case FUNC_EQUAL: retval = ( fieldMeta.compare( field, fieldMeta2, field2 ) == 0 ); break; case FUNC_NOT_EQUAL: retval = ( fieldMeta.compare( field, fieldMeta2, field2 ) != 0 ); break; case FUNC_SMALLER: retval = ( fieldMeta.compare( field, fieldMeta2, field2 ) < 0 ); break; case FUNC_SMALLER_EQUAL: retval = ( fieldMeta.compare( field, fieldMeta2, field2 ) <= 0 ); break; case FUNC_LARGER: retval = ( fieldMeta.compare( field, fieldMeta2, field2 ) > 0 ); break; case FUNC_LARGER_EQUAL: retval = ( fieldMeta.compare( field, fieldMeta2, field2 ) >= 0 ); break; case FUNC_REGEXP: if ( fieldMeta.isNull( field ) || field2 == null ) { retval = false; } else { retval = Pattern .matches( fieldMeta2.getCompatibleString( field2 ), fieldMeta.getCompatibleString( field ) ); } break; case FUNC_NULL: retval = ( fieldMeta.isNull( field ) ); break; case FUNC_NOT_NULL: retval = ( !fieldMeta.isNull( field ) ); break; case FUNC_IN_LIST: if ( inList == null || right_fieldnr >= 0 ) { inList = Const.splitString( fieldMeta2.getString( field2 ), ';', true ); for ( int i = 0; i < inList.length; i++ ) { inList[i] = inList[i] == null ? null : inList[i].replace( "\\", "" ); } Arrays.sort( inList ); } String searchString = fieldMeta.getCompatibleString( field ); int inIndex = -1; if ( searchString != null ) { inIndex = Arrays.binarySearch( inList, searchString ); } retval = Boolean.valueOf( inIndex >= 0 ); break; case FUNC_CONTAINS: retval = fieldMeta.getCompatibleString( field ) != null ? fieldMeta.getCompatibleString( field ).indexOf( fieldMeta2.getCompatibleString( field2 ) ) >= 0 : false; break; case FUNC_STARTS_WITH: retval = fieldMeta.getCompatibleString( field ) != null ? fieldMeta .getCompatibleString( field ).startsWith( fieldMeta2.getCompatibleString( field2 ) ) : false; break; case FUNC_ENDS_WITH: String string = fieldMeta.getCompatibleString( field ); if ( !Utils.isEmpty( string ) ) { if ( right_string == null && field2 != null ) { right_string = fieldMeta2.getCompatibleString( field2 ); } if ( right_string != null ) { retval = string.endsWith( fieldMeta2.getCompatibleString( field2 ) ); } else { retval = false; } } else { retval = false; } break; case FUNC_LIKE: if ( fieldMeta.isNull( field ) || field2 == null ) { retval = false; } else { String regex = fieldMeta2.getCompatibleString( field2 ); regex = regex.replace( "%", ".*" ); regex = regex.replace( "?", "." ); retval = Pattern.matches( regex, fieldMeta.getCompatibleString( field ) ); } break; default: break; } if ( isNegated() ) { retval = !retval; } } else { Condition cb0 = list.get( 0 ); retval = cb0.evaluate( rowMeta, r ); for ( int i = 1; i < list.size(); i++ ) { Condition cb = list.get( i ); switch ( cb.getOperator() ) { case Condition.OPERATOR_OR: retval = retval || cb.evaluate( rowMeta, r ); break; case Condition.OPERATOR_AND: retval = retval && cb.evaluate( rowMeta, r ); break; case Condition.OPERATOR_OR_NOT: retval = retval || ( !cb.evaluate( rowMeta, r ) ); break; case Condition.OPERATOR_AND_NOT: retval = retval && ( !cb.evaluate( rowMeta, r ) ); break; case Condition.OPERATOR_XOR: retval = retval ^ cb.evaluate( rowMeta, r ); break; default: break; } } if ( isNegated() ) { retval = !retval; } } } catch ( Exception e ) { throw new RuntimeException( "Unexpected error evaluation condition [" + toString() + "]", e ); } return retval; } Condition(); Condition( String valuename, int function, String valuename2, ValueMetaAndData exact ); Condition( int operator, String valuename, int function, String valuename2, ValueMetaAndData exact ); Condition( boolean negate, String valuename, int function, String valuename2, ValueMetaAndData exact ); Condition( String xml ); Condition( Node condnode ); }
Condition implements Cloneable, XMLInterface { public boolean evaluate( RowMetaInterface rowMeta, Object[] r ) { boolean retval = false; try { if ( isAtomic() ) { if ( function == FUNC_TRUE ) { return !negate; } if ( left_valuename != null && left_valuename.length() > 0 ) { left_fieldnr = rowMeta.indexOfValue( left_valuename ); } if ( right_valuename != null && right_valuename.length() > 0 ) { right_fieldnr = rowMeta.indexOfValue( right_valuename ); } ValueMetaInterface fieldMeta = null; Object field = null; if ( left_fieldnr >= 0 ) { fieldMeta = rowMeta.getValueMeta( left_fieldnr ); field = r[left_fieldnr]; } else { return false; } ValueMetaInterface fieldMeta2 = right_exact != null ? right_exact.getValueMeta() : null; Object field2 = right_exact != null ? right_exact.getValueData() : null; if ( field2 == null && right_fieldnr >= 0 ) { fieldMeta2 = rowMeta.getValueMeta( right_fieldnr ); field2 = r[right_fieldnr]; } switch ( function ) { case FUNC_EQUAL: retval = ( fieldMeta.compare( field, fieldMeta2, field2 ) == 0 ); break; case FUNC_NOT_EQUAL: retval = ( fieldMeta.compare( field, fieldMeta2, field2 ) != 0 ); break; case FUNC_SMALLER: retval = ( fieldMeta.compare( field, fieldMeta2, field2 ) < 0 ); break; case FUNC_SMALLER_EQUAL: retval = ( fieldMeta.compare( field, fieldMeta2, field2 ) <= 0 ); break; case FUNC_LARGER: retval = ( fieldMeta.compare( field, fieldMeta2, field2 ) > 0 ); break; case FUNC_LARGER_EQUAL: retval = ( fieldMeta.compare( field, fieldMeta2, field2 ) >= 0 ); break; case FUNC_REGEXP: if ( fieldMeta.isNull( field ) || field2 == null ) { retval = false; } else { retval = Pattern .matches( fieldMeta2.getCompatibleString( field2 ), fieldMeta.getCompatibleString( field ) ); } break; case FUNC_NULL: retval = ( fieldMeta.isNull( field ) ); break; case FUNC_NOT_NULL: retval = ( !fieldMeta.isNull( field ) ); break; case FUNC_IN_LIST: if ( inList == null || right_fieldnr >= 0 ) { inList = Const.splitString( fieldMeta2.getString( field2 ), ';', true ); for ( int i = 0; i < inList.length; i++ ) { inList[i] = inList[i] == null ? null : inList[i].replace( "\\", "" ); } Arrays.sort( inList ); } String searchString = fieldMeta.getCompatibleString( field ); int inIndex = -1; if ( searchString != null ) { inIndex = Arrays.binarySearch( inList, searchString ); } retval = Boolean.valueOf( inIndex >= 0 ); break; case FUNC_CONTAINS: retval = fieldMeta.getCompatibleString( field ) != null ? fieldMeta.getCompatibleString( field ).indexOf( fieldMeta2.getCompatibleString( field2 ) ) >= 0 : false; break; case FUNC_STARTS_WITH: retval = fieldMeta.getCompatibleString( field ) != null ? fieldMeta .getCompatibleString( field ).startsWith( fieldMeta2.getCompatibleString( field2 ) ) : false; break; case FUNC_ENDS_WITH: String string = fieldMeta.getCompatibleString( field ); if ( !Utils.isEmpty( string ) ) { if ( right_string == null && field2 != null ) { right_string = fieldMeta2.getCompatibleString( field2 ); } if ( right_string != null ) { retval = string.endsWith( fieldMeta2.getCompatibleString( field2 ) ); } else { retval = false; } } else { retval = false; } break; case FUNC_LIKE: if ( fieldMeta.isNull( field ) || field2 == null ) { retval = false; } else { String regex = fieldMeta2.getCompatibleString( field2 ); regex = regex.replace( "%", ".*" ); regex = regex.replace( "?", "." ); retval = Pattern.matches( regex, fieldMeta.getCompatibleString( field ) ); } break; default: break; } if ( isNegated() ) { retval = !retval; } } else { Condition cb0 = list.get( 0 ); retval = cb0.evaluate( rowMeta, r ); for ( int i = 1; i < list.size(); i++ ) { Condition cb = list.get( i ); switch ( cb.getOperator() ) { case Condition.OPERATOR_OR: retval = retval || cb.evaluate( rowMeta, r ); break; case Condition.OPERATOR_AND: retval = retval && cb.evaluate( rowMeta, r ); break; case Condition.OPERATOR_OR_NOT: retval = retval || ( !cb.evaluate( rowMeta, r ) ); break; case Condition.OPERATOR_AND_NOT: retval = retval && ( !cb.evaluate( rowMeta, r ) ); break; case Condition.OPERATOR_XOR: retval = retval ^ cb.evaluate( rowMeta, r ); break; default: break; } } if ( isNegated() ) { retval = !retval; } } } catch ( Exception e ) { throw new RuntimeException( "Unexpected error evaluation condition [" + toString() + "]", e ); } return retval; } Condition(); Condition( String valuename, int function, String valuename2, ValueMetaAndData exact ); Condition( int operator, String valuename, int function, String valuename2, ValueMetaAndData exact ); Condition( boolean negate, String valuename, int function, String valuename2, ValueMetaAndData exact ); Condition( String xml ); Condition( Node condnode ); ObjectId getObjectId(); void setObjectId( ObjectId id ); @Override Object clone(); void setOperator( int operator ); int getOperator(); String getOperatorDesc(); static final int getOperator( String description ); static final String[] getOperators(); static final String[] getRealOperators(); void setLeftValuename( String left_valuename ); String getLeftValuename(); int getFunction(); void setFunction( int function ); String getFunctionDesc(); static final int getFunction( String description ); void setRightValuename( String right_valuename ); String getRightValuename(); void setRightExact( ValueMetaAndData right_exact ); ValueMetaAndData getRightExact(); String getRightExactString(); ObjectId getRightExactID(); void setRightExactID( ObjectId id_right_exact ); boolean isAtomic(); boolean isComposite(); boolean isNegated(); void setNegated( boolean negate ); void negate(); boolean isEmpty(); void clearFieldPositions(); boolean evaluate( RowMetaInterface rowMeta, Object[] r ); void addCondition( Condition cb ); void addCondition( int idx, Condition cb ); void removeCondition( int nr ); boolean simplify(); int nrConditions(); Condition getCondition( int i ); void setCondition( int i, Condition subCondition ); @Override String toString(); String toString( int level, boolean show_negate, boolean show_operator ); @Override String getXML(); String getXML( int level ); String[] getUsedFields(); void getUsedFields( Hashtable<String, String> fields ); List<Condition> getChildren(); }
Condition implements Cloneable, XMLInterface { public boolean evaluate( RowMetaInterface rowMeta, Object[] r ) { boolean retval = false; try { if ( isAtomic() ) { if ( function == FUNC_TRUE ) { return !negate; } if ( left_valuename != null && left_valuename.length() > 0 ) { left_fieldnr = rowMeta.indexOfValue( left_valuename ); } if ( right_valuename != null && right_valuename.length() > 0 ) { right_fieldnr = rowMeta.indexOfValue( right_valuename ); } ValueMetaInterface fieldMeta = null; Object field = null; if ( left_fieldnr >= 0 ) { fieldMeta = rowMeta.getValueMeta( left_fieldnr ); field = r[left_fieldnr]; } else { return false; } ValueMetaInterface fieldMeta2 = right_exact != null ? right_exact.getValueMeta() : null; Object field2 = right_exact != null ? right_exact.getValueData() : null; if ( field2 == null && right_fieldnr >= 0 ) { fieldMeta2 = rowMeta.getValueMeta( right_fieldnr ); field2 = r[right_fieldnr]; } switch ( function ) { case FUNC_EQUAL: retval = ( fieldMeta.compare( field, fieldMeta2, field2 ) == 0 ); break; case FUNC_NOT_EQUAL: retval = ( fieldMeta.compare( field, fieldMeta2, field2 ) != 0 ); break; case FUNC_SMALLER: retval = ( fieldMeta.compare( field, fieldMeta2, field2 ) < 0 ); break; case FUNC_SMALLER_EQUAL: retval = ( fieldMeta.compare( field, fieldMeta2, field2 ) <= 0 ); break; case FUNC_LARGER: retval = ( fieldMeta.compare( field, fieldMeta2, field2 ) > 0 ); break; case FUNC_LARGER_EQUAL: retval = ( fieldMeta.compare( field, fieldMeta2, field2 ) >= 0 ); break; case FUNC_REGEXP: if ( fieldMeta.isNull( field ) || field2 == null ) { retval = false; } else { retval = Pattern .matches( fieldMeta2.getCompatibleString( field2 ), fieldMeta.getCompatibleString( field ) ); } break; case FUNC_NULL: retval = ( fieldMeta.isNull( field ) ); break; case FUNC_NOT_NULL: retval = ( !fieldMeta.isNull( field ) ); break; case FUNC_IN_LIST: if ( inList == null || right_fieldnr >= 0 ) { inList = Const.splitString( fieldMeta2.getString( field2 ), ';', true ); for ( int i = 0; i < inList.length; i++ ) { inList[i] = inList[i] == null ? null : inList[i].replace( "\\", "" ); } Arrays.sort( inList ); } String searchString = fieldMeta.getCompatibleString( field ); int inIndex = -1; if ( searchString != null ) { inIndex = Arrays.binarySearch( inList, searchString ); } retval = Boolean.valueOf( inIndex >= 0 ); break; case FUNC_CONTAINS: retval = fieldMeta.getCompatibleString( field ) != null ? fieldMeta.getCompatibleString( field ).indexOf( fieldMeta2.getCompatibleString( field2 ) ) >= 0 : false; break; case FUNC_STARTS_WITH: retval = fieldMeta.getCompatibleString( field ) != null ? fieldMeta .getCompatibleString( field ).startsWith( fieldMeta2.getCompatibleString( field2 ) ) : false; break; case FUNC_ENDS_WITH: String string = fieldMeta.getCompatibleString( field ); if ( !Utils.isEmpty( string ) ) { if ( right_string == null && field2 != null ) { right_string = fieldMeta2.getCompatibleString( field2 ); } if ( right_string != null ) { retval = string.endsWith( fieldMeta2.getCompatibleString( field2 ) ); } else { retval = false; } } else { retval = false; } break; case FUNC_LIKE: if ( fieldMeta.isNull( field ) || field2 == null ) { retval = false; } else { String regex = fieldMeta2.getCompatibleString( field2 ); regex = regex.replace( "%", ".*" ); regex = regex.replace( "?", "." ); retval = Pattern.matches( regex, fieldMeta.getCompatibleString( field ) ); } break; default: break; } if ( isNegated() ) { retval = !retval; } } else { Condition cb0 = list.get( 0 ); retval = cb0.evaluate( rowMeta, r ); for ( int i = 1; i < list.size(); i++ ) { Condition cb = list.get( i ); switch ( cb.getOperator() ) { case Condition.OPERATOR_OR: retval = retval || cb.evaluate( rowMeta, r ); break; case Condition.OPERATOR_AND: retval = retval && cb.evaluate( rowMeta, r ); break; case Condition.OPERATOR_OR_NOT: retval = retval || ( !cb.evaluate( rowMeta, r ) ); break; case Condition.OPERATOR_AND_NOT: retval = retval && ( !cb.evaluate( rowMeta, r ) ); break; case Condition.OPERATOR_XOR: retval = retval ^ cb.evaluate( rowMeta, r ); break; default: break; } } if ( isNegated() ) { retval = !retval; } } } catch ( Exception e ) { throw new RuntimeException( "Unexpected error evaluation condition [" + toString() + "]", e ); } return retval; } Condition(); Condition( String valuename, int function, String valuename2, ValueMetaAndData exact ); Condition( int operator, String valuename, int function, String valuename2, ValueMetaAndData exact ); Condition( boolean negate, String valuename, int function, String valuename2, ValueMetaAndData exact ); Condition( String xml ); Condition( Node condnode ); ObjectId getObjectId(); void setObjectId( ObjectId id ); @Override Object clone(); void setOperator( int operator ); int getOperator(); String getOperatorDesc(); static final int getOperator( String description ); static final String[] getOperators(); static final String[] getRealOperators(); void setLeftValuename( String left_valuename ); String getLeftValuename(); int getFunction(); void setFunction( int function ); String getFunctionDesc(); static final int getFunction( String description ); void setRightValuename( String right_valuename ); String getRightValuename(); void setRightExact( ValueMetaAndData right_exact ); ValueMetaAndData getRightExact(); String getRightExactString(); ObjectId getRightExactID(); void setRightExactID( ObjectId id_right_exact ); boolean isAtomic(); boolean isComposite(); boolean isNegated(); void setNegated( boolean negate ); void negate(); boolean isEmpty(); void clearFieldPositions(); boolean evaluate( RowMetaInterface rowMeta, Object[] r ); void addCondition( Condition cb ); void addCondition( int idx, Condition cb ); void removeCondition( int nr ); boolean simplify(); int nrConditions(); Condition getCondition( int i ); void setCondition( int i, Condition subCondition ); @Override String toString(); String toString( int level, boolean show_negate, boolean show_operator ); @Override String getXML(); String getXML( int level ); String[] getUsedFields(); void getUsedFields( Hashtable<String, String> fields ); List<Condition> getChildren(); static final String XML_TAG; static final String[] operators; static final int OPERATOR_NONE; static final int OPERATOR_OR; static final int OPERATOR_AND; static final int OPERATOR_NOT; static final int OPERATOR_OR_NOT; static final int OPERATOR_AND_NOT; static final int OPERATOR_XOR; static final String[] functions; static final int FUNC_EQUAL; static final int FUNC_NOT_EQUAL; static final int FUNC_SMALLER; static final int FUNC_SMALLER_EQUAL; static final int FUNC_LARGER; static final int FUNC_LARGER_EQUAL; static final int FUNC_REGEXP; static final int FUNC_NULL; static final int FUNC_NOT_NULL; static final int FUNC_IN_LIST; static final int FUNC_CONTAINS; static final int FUNC_STARTS_WITH; static final int FUNC_ENDS_WITH; static final int FUNC_LIKE; static final int FUNC_TRUE; }
@Test public void testPdi13227() throws Exception { RowMetaInterface rowMeta1 = new RowMeta(); rowMeta1.addValueMeta( new ValueMetaNumber( "name1" ) ); rowMeta1.addValueMeta( new ValueMetaNumber( "name2" ) ); rowMeta1.addValueMeta( new ValueMetaNumber( "name3" ) ); RowMetaInterface rowMeta2 = new RowMeta(); rowMeta2.addValueMeta( new ValueMetaNumber( "name2" ) ); rowMeta2.addValueMeta( new ValueMetaNumber( "name1" ) ); rowMeta2.addValueMeta( new ValueMetaNumber( "name3" ) ); String left = "name1"; String right = "name3"; Condition condition = new Condition( left, Condition.FUNC_EQUAL, right, null ); assertTrue( condition.evaluate( rowMeta1, new Object[] { 1.0, 2.0, 1.0} ) ); assertTrue( condition.evaluate( rowMeta2, new Object[] { 2.0, 1.0, 1.0} ) ); }
public boolean evaluate( RowMetaInterface rowMeta, Object[] r ) { boolean retval = false; try { if ( isAtomic() ) { if ( function == FUNC_TRUE ) { return !negate; } if ( left_valuename != null && left_valuename.length() > 0 ) { left_fieldnr = rowMeta.indexOfValue( left_valuename ); } if ( right_valuename != null && right_valuename.length() > 0 ) { right_fieldnr = rowMeta.indexOfValue( right_valuename ); } ValueMetaInterface fieldMeta = null; Object field = null; if ( left_fieldnr >= 0 ) { fieldMeta = rowMeta.getValueMeta( left_fieldnr ); field = r[left_fieldnr]; } else { return false; } ValueMetaInterface fieldMeta2 = right_exact != null ? right_exact.getValueMeta() : null; Object field2 = right_exact != null ? right_exact.getValueData() : null; if ( field2 == null && right_fieldnr >= 0 ) { fieldMeta2 = rowMeta.getValueMeta( right_fieldnr ); field2 = r[right_fieldnr]; } switch ( function ) { case FUNC_EQUAL: retval = ( fieldMeta.compare( field, fieldMeta2, field2 ) == 0 ); break; case FUNC_NOT_EQUAL: retval = ( fieldMeta.compare( field, fieldMeta2, field2 ) != 0 ); break; case FUNC_SMALLER: retval = ( fieldMeta.compare( field, fieldMeta2, field2 ) < 0 ); break; case FUNC_SMALLER_EQUAL: retval = ( fieldMeta.compare( field, fieldMeta2, field2 ) <= 0 ); break; case FUNC_LARGER: retval = ( fieldMeta.compare( field, fieldMeta2, field2 ) > 0 ); break; case FUNC_LARGER_EQUAL: retval = ( fieldMeta.compare( field, fieldMeta2, field2 ) >= 0 ); break; case FUNC_REGEXP: if ( fieldMeta.isNull( field ) || field2 == null ) { retval = false; } else { retval = Pattern .matches( fieldMeta2.getCompatibleString( field2 ), fieldMeta.getCompatibleString( field ) ); } break; case FUNC_NULL: retval = ( fieldMeta.isNull( field ) ); break; case FUNC_NOT_NULL: retval = ( !fieldMeta.isNull( field ) ); break; case FUNC_IN_LIST: if ( inList == null || right_fieldnr >= 0 ) { inList = Const.splitString( fieldMeta2.getString( field2 ), ';', true ); for ( int i = 0; i < inList.length; i++ ) { inList[i] = inList[i] == null ? null : inList[i].replace( "\\", "" ); } Arrays.sort( inList ); } String searchString = fieldMeta.getCompatibleString( field ); int inIndex = -1; if ( searchString != null ) { inIndex = Arrays.binarySearch( inList, searchString ); } retval = Boolean.valueOf( inIndex >= 0 ); break; case FUNC_CONTAINS: retval = fieldMeta.getCompatibleString( field ) != null ? fieldMeta.getCompatibleString( field ).indexOf( fieldMeta2.getCompatibleString( field2 ) ) >= 0 : false; break; case FUNC_STARTS_WITH: retval = fieldMeta.getCompatibleString( field ) != null ? fieldMeta .getCompatibleString( field ).startsWith( fieldMeta2.getCompatibleString( field2 ) ) : false; break; case FUNC_ENDS_WITH: String string = fieldMeta.getCompatibleString( field ); if ( !Utils.isEmpty( string ) ) { if ( right_string == null && field2 != null ) { right_string = fieldMeta2.getCompatibleString( field2 ); } if ( right_string != null ) { retval = string.endsWith( fieldMeta2.getCompatibleString( field2 ) ); } else { retval = false; } } else { retval = false; } break; case FUNC_LIKE: if ( fieldMeta.isNull( field ) || field2 == null ) { retval = false; } else { String regex = fieldMeta2.getCompatibleString( field2 ); regex = regex.replace( "%", ".*" ); regex = regex.replace( "?", "." ); retval = Pattern.matches( regex, fieldMeta.getCompatibleString( field ) ); } break; default: break; } if ( isNegated() ) { retval = !retval; } } else { Condition cb0 = list.get( 0 ); retval = cb0.evaluate( rowMeta, r ); for ( int i = 1; i < list.size(); i++ ) { Condition cb = list.get( i ); switch ( cb.getOperator() ) { case Condition.OPERATOR_OR: retval = retval || cb.evaluate( rowMeta, r ); break; case Condition.OPERATOR_AND: retval = retval && cb.evaluate( rowMeta, r ); break; case Condition.OPERATOR_OR_NOT: retval = retval || ( !cb.evaluate( rowMeta, r ) ); break; case Condition.OPERATOR_AND_NOT: retval = retval && ( !cb.evaluate( rowMeta, r ) ); break; case Condition.OPERATOR_XOR: retval = retval ^ cb.evaluate( rowMeta, r ); break; default: break; } } if ( isNegated() ) { retval = !retval; } } } catch ( Exception e ) { throw new RuntimeException( "Unexpected error evaluation condition [" + toString() + "]", e ); } return retval; }
Condition implements Cloneable, XMLInterface { public boolean evaluate( RowMetaInterface rowMeta, Object[] r ) { boolean retval = false; try { if ( isAtomic() ) { if ( function == FUNC_TRUE ) { return !negate; } if ( left_valuename != null && left_valuename.length() > 0 ) { left_fieldnr = rowMeta.indexOfValue( left_valuename ); } if ( right_valuename != null && right_valuename.length() > 0 ) { right_fieldnr = rowMeta.indexOfValue( right_valuename ); } ValueMetaInterface fieldMeta = null; Object field = null; if ( left_fieldnr >= 0 ) { fieldMeta = rowMeta.getValueMeta( left_fieldnr ); field = r[left_fieldnr]; } else { return false; } ValueMetaInterface fieldMeta2 = right_exact != null ? right_exact.getValueMeta() : null; Object field2 = right_exact != null ? right_exact.getValueData() : null; if ( field2 == null && right_fieldnr >= 0 ) { fieldMeta2 = rowMeta.getValueMeta( right_fieldnr ); field2 = r[right_fieldnr]; } switch ( function ) { case FUNC_EQUAL: retval = ( fieldMeta.compare( field, fieldMeta2, field2 ) == 0 ); break; case FUNC_NOT_EQUAL: retval = ( fieldMeta.compare( field, fieldMeta2, field2 ) != 0 ); break; case FUNC_SMALLER: retval = ( fieldMeta.compare( field, fieldMeta2, field2 ) < 0 ); break; case FUNC_SMALLER_EQUAL: retval = ( fieldMeta.compare( field, fieldMeta2, field2 ) <= 0 ); break; case FUNC_LARGER: retval = ( fieldMeta.compare( field, fieldMeta2, field2 ) > 0 ); break; case FUNC_LARGER_EQUAL: retval = ( fieldMeta.compare( field, fieldMeta2, field2 ) >= 0 ); break; case FUNC_REGEXP: if ( fieldMeta.isNull( field ) || field2 == null ) { retval = false; } else { retval = Pattern .matches( fieldMeta2.getCompatibleString( field2 ), fieldMeta.getCompatibleString( field ) ); } break; case FUNC_NULL: retval = ( fieldMeta.isNull( field ) ); break; case FUNC_NOT_NULL: retval = ( !fieldMeta.isNull( field ) ); break; case FUNC_IN_LIST: if ( inList == null || right_fieldnr >= 0 ) { inList = Const.splitString( fieldMeta2.getString( field2 ), ';', true ); for ( int i = 0; i < inList.length; i++ ) { inList[i] = inList[i] == null ? null : inList[i].replace( "\\", "" ); } Arrays.sort( inList ); } String searchString = fieldMeta.getCompatibleString( field ); int inIndex = -1; if ( searchString != null ) { inIndex = Arrays.binarySearch( inList, searchString ); } retval = Boolean.valueOf( inIndex >= 0 ); break; case FUNC_CONTAINS: retval = fieldMeta.getCompatibleString( field ) != null ? fieldMeta.getCompatibleString( field ).indexOf( fieldMeta2.getCompatibleString( field2 ) ) >= 0 : false; break; case FUNC_STARTS_WITH: retval = fieldMeta.getCompatibleString( field ) != null ? fieldMeta .getCompatibleString( field ).startsWith( fieldMeta2.getCompatibleString( field2 ) ) : false; break; case FUNC_ENDS_WITH: String string = fieldMeta.getCompatibleString( field ); if ( !Utils.isEmpty( string ) ) { if ( right_string == null && field2 != null ) { right_string = fieldMeta2.getCompatibleString( field2 ); } if ( right_string != null ) { retval = string.endsWith( fieldMeta2.getCompatibleString( field2 ) ); } else { retval = false; } } else { retval = false; } break; case FUNC_LIKE: if ( fieldMeta.isNull( field ) || field2 == null ) { retval = false; } else { String regex = fieldMeta2.getCompatibleString( field2 ); regex = regex.replace( "%", ".*" ); regex = regex.replace( "?", "." ); retval = Pattern.matches( regex, fieldMeta.getCompatibleString( field ) ); } break; default: break; } if ( isNegated() ) { retval = !retval; } } else { Condition cb0 = list.get( 0 ); retval = cb0.evaluate( rowMeta, r ); for ( int i = 1; i < list.size(); i++ ) { Condition cb = list.get( i ); switch ( cb.getOperator() ) { case Condition.OPERATOR_OR: retval = retval || cb.evaluate( rowMeta, r ); break; case Condition.OPERATOR_AND: retval = retval && cb.evaluate( rowMeta, r ); break; case Condition.OPERATOR_OR_NOT: retval = retval || ( !cb.evaluate( rowMeta, r ) ); break; case Condition.OPERATOR_AND_NOT: retval = retval && ( !cb.evaluate( rowMeta, r ) ); break; case Condition.OPERATOR_XOR: retval = retval ^ cb.evaluate( rowMeta, r ); break; default: break; } } if ( isNegated() ) { retval = !retval; } } } catch ( Exception e ) { throw new RuntimeException( "Unexpected error evaluation condition [" + toString() + "]", e ); } return retval; } }
Condition implements Cloneable, XMLInterface { public boolean evaluate( RowMetaInterface rowMeta, Object[] r ) { boolean retval = false; try { if ( isAtomic() ) { if ( function == FUNC_TRUE ) { return !negate; } if ( left_valuename != null && left_valuename.length() > 0 ) { left_fieldnr = rowMeta.indexOfValue( left_valuename ); } if ( right_valuename != null && right_valuename.length() > 0 ) { right_fieldnr = rowMeta.indexOfValue( right_valuename ); } ValueMetaInterface fieldMeta = null; Object field = null; if ( left_fieldnr >= 0 ) { fieldMeta = rowMeta.getValueMeta( left_fieldnr ); field = r[left_fieldnr]; } else { return false; } ValueMetaInterface fieldMeta2 = right_exact != null ? right_exact.getValueMeta() : null; Object field2 = right_exact != null ? right_exact.getValueData() : null; if ( field2 == null && right_fieldnr >= 0 ) { fieldMeta2 = rowMeta.getValueMeta( right_fieldnr ); field2 = r[right_fieldnr]; } switch ( function ) { case FUNC_EQUAL: retval = ( fieldMeta.compare( field, fieldMeta2, field2 ) == 0 ); break; case FUNC_NOT_EQUAL: retval = ( fieldMeta.compare( field, fieldMeta2, field2 ) != 0 ); break; case FUNC_SMALLER: retval = ( fieldMeta.compare( field, fieldMeta2, field2 ) < 0 ); break; case FUNC_SMALLER_EQUAL: retval = ( fieldMeta.compare( field, fieldMeta2, field2 ) <= 0 ); break; case FUNC_LARGER: retval = ( fieldMeta.compare( field, fieldMeta2, field2 ) > 0 ); break; case FUNC_LARGER_EQUAL: retval = ( fieldMeta.compare( field, fieldMeta2, field2 ) >= 0 ); break; case FUNC_REGEXP: if ( fieldMeta.isNull( field ) || field2 == null ) { retval = false; } else { retval = Pattern .matches( fieldMeta2.getCompatibleString( field2 ), fieldMeta.getCompatibleString( field ) ); } break; case FUNC_NULL: retval = ( fieldMeta.isNull( field ) ); break; case FUNC_NOT_NULL: retval = ( !fieldMeta.isNull( field ) ); break; case FUNC_IN_LIST: if ( inList == null || right_fieldnr >= 0 ) { inList = Const.splitString( fieldMeta2.getString( field2 ), ';', true ); for ( int i = 0; i < inList.length; i++ ) { inList[i] = inList[i] == null ? null : inList[i].replace( "\\", "" ); } Arrays.sort( inList ); } String searchString = fieldMeta.getCompatibleString( field ); int inIndex = -1; if ( searchString != null ) { inIndex = Arrays.binarySearch( inList, searchString ); } retval = Boolean.valueOf( inIndex >= 0 ); break; case FUNC_CONTAINS: retval = fieldMeta.getCompatibleString( field ) != null ? fieldMeta.getCompatibleString( field ).indexOf( fieldMeta2.getCompatibleString( field2 ) ) >= 0 : false; break; case FUNC_STARTS_WITH: retval = fieldMeta.getCompatibleString( field ) != null ? fieldMeta .getCompatibleString( field ).startsWith( fieldMeta2.getCompatibleString( field2 ) ) : false; break; case FUNC_ENDS_WITH: String string = fieldMeta.getCompatibleString( field ); if ( !Utils.isEmpty( string ) ) { if ( right_string == null && field2 != null ) { right_string = fieldMeta2.getCompatibleString( field2 ); } if ( right_string != null ) { retval = string.endsWith( fieldMeta2.getCompatibleString( field2 ) ); } else { retval = false; } } else { retval = false; } break; case FUNC_LIKE: if ( fieldMeta.isNull( field ) || field2 == null ) { retval = false; } else { String regex = fieldMeta2.getCompatibleString( field2 ); regex = regex.replace( "%", ".*" ); regex = regex.replace( "?", "." ); retval = Pattern.matches( regex, fieldMeta.getCompatibleString( field ) ); } break; default: break; } if ( isNegated() ) { retval = !retval; } } else { Condition cb0 = list.get( 0 ); retval = cb0.evaluate( rowMeta, r ); for ( int i = 1; i < list.size(); i++ ) { Condition cb = list.get( i ); switch ( cb.getOperator() ) { case Condition.OPERATOR_OR: retval = retval || cb.evaluate( rowMeta, r ); break; case Condition.OPERATOR_AND: retval = retval && cb.evaluate( rowMeta, r ); break; case Condition.OPERATOR_OR_NOT: retval = retval || ( !cb.evaluate( rowMeta, r ) ); break; case Condition.OPERATOR_AND_NOT: retval = retval && ( !cb.evaluate( rowMeta, r ) ); break; case Condition.OPERATOR_XOR: retval = retval ^ cb.evaluate( rowMeta, r ); break; default: break; } } if ( isNegated() ) { retval = !retval; } } } catch ( Exception e ) { throw new RuntimeException( "Unexpected error evaluation condition [" + toString() + "]", e ); } return retval; } Condition(); Condition( String valuename, int function, String valuename2, ValueMetaAndData exact ); Condition( int operator, String valuename, int function, String valuename2, ValueMetaAndData exact ); Condition( boolean negate, String valuename, int function, String valuename2, ValueMetaAndData exact ); Condition( String xml ); Condition( Node condnode ); }
Condition implements Cloneable, XMLInterface { public boolean evaluate( RowMetaInterface rowMeta, Object[] r ) { boolean retval = false; try { if ( isAtomic() ) { if ( function == FUNC_TRUE ) { return !negate; } if ( left_valuename != null && left_valuename.length() > 0 ) { left_fieldnr = rowMeta.indexOfValue( left_valuename ); } if ( right_valuename != null && right_valuename.length() > 0 ) { right_fieldnr = rowMeta.indexOfValue( right_valuename ); } ValueMetaInterface fieldMeta = null; Object field = null; if ( left_fieldnr >= 0 ) { fieldMeta = rowMeta.getValueMeta( left_fieldnr ); field = r[left_fieldnr]; } else { return false; } ValueMetaInterface fieldMeta2 = right_exact != null ? right_exact.getValueMeta() : null; Object field2 = right_exact != null ? right_exact.getValueData() : null; if ( field2 == null && right_fieldnr >= 0 ) { fieldMeta2 = rowMeta.getValueMeta( right_fieldnr ); field2 = r[right_fieldnr]; } switch ( function ) { case FUNC_EQUAL: retval = ( fieldMeta.compare( field, fieldMeta2, field2 ) == 0 ); break; case FUNC_NOT_EQUAL: retval = ( fieldMeta.compare( field, fieldMeta2, field2 ) != 0 ); break; case FUNC_SMALLER: retval = ( fieldMeta.compare( field, fieldMeta2, field2 ) < 0 ); break; case FUNC_SMALLER_EQUAL: retval = ( fieldMeta.compare( field, fieldMeta2, field2 ) <= 0 ); break; case FUNC_LARGER: retval = ( fieldMeta.compare( field, fieldMeta2, field2 ) > 0 ); break; case FUNC_LARGER_EQUAL: retval = ( fieldMeta.compare( field, fieldMeta2, field2 ) >= 0 ); break; case FUNC_REGEXP: if ( fieldMeta.isNull( field ) || field2 == null ) { retval = false; } else { retval = Pattern .matches( fieldMeta2.getCompatibleString( field2 ), fieldMeta.getCompatibleString( field ) ); } break; case FUNC_NULL: retval = ( fieldMeta.isNull( field ) ); break; case FUNC_NOT_NULL: retval = ( !fieldMeta.isNull( field ) ); break; case FUNC_IN_LIST: if ( inList == null || right_fieldnr >= 0 ) { inList = Const.splitString( fieldMeta2.getString( field2 ), ';', true ); for ( int i = 0; i < inList.length; i++ ) { inList[i] = inList[i] == null ? null : inList[i].replace( "\\", "" ); } Arrays.sort( inList ); } String searchString = fieldMeta.getCompatibleString( field ); int inIndex = -1; if ( searchString != null ) { inIndex = Arrays.binarySearch( inList, searchString ); } retval = Boolean.valueOf( inIndex >= 0 ); break; case FUNC_CONTAINS: retval = fieldMeta.getCompatibleString( field ) != null ? fieldMeta.getCompatibleString( field ).indexOf( fieldMeta2.getCompatibleString( field2 ) ) >= 0 : false; break; case FUNC_STARTS_WITH: retval = fieldMeta.getCompatibleString( field ) != null ? fieldMeta .getCompatibleString( field ).startsWith( fieldMeta2.getCompatibleString( field2 ) ) : false; break; case FUNC_ENDS_WITH: String string = fieldMeta.getCompatibleString( field ); if ( !Utils.isEmpty( string ) ) { if ( right_string == null && field2 != null ) { right_string = fieldMeta2.getCompatibleString( field2 ); } if ( right_string != null ) { retval = string.endsWith( fieldMeta2.getCompatibleString( field2 ) ); } else { retval = false; } } else { retval = false; } break; case FUNC_LIKE: if ( fieldMeta.isNull( field ) || field2 == null ) { retval = false; } else { String regex = fieldMeta2.getCompatibleString( field2 ); regex = regex.replace( "%", ".*" ); regex = regex.replace( "?", "." ); retval = Pattern.matches( regex, fieldMeta.getCompatibleString( field ) ); } break; default: break; } if ( isNegated() ) { retval = !retval; } } else { Condition cb0 = list.get( 0 ); retval = cb0.evaluate( rowMeta, r ); for ( int i = 1; i < list.size(); i++ ) { Condition cb = list.get( i ); switch ( cb.getOperator() ) { case Condition.OPERATOR_OR: retval = retval || cb.evaluate( rowMeta, r ); break; case Condition.OPERATOR_AND: retval = retval && cb.evaluate( rowMeta, r ); break; case Condition.OPERATOR_OR_NOT: retval = retval || ( !cb.evaluate( rowMeta, r ) ); break; case Condition.OPERATOR_AND_NOT: retval = retval && ( !cb.evaluate( rowMeta, r ) ); break; case Condition.OPERATOR_XOR: retval = retval ^ cb.evaluate( rowMeta, r ); break; default: break; } } if ( isNegated() ) { retval = !retval; } } } catch ( Exception e ) { throw new RuntimeException( "Unexpected error evaluation condition [" + toString() + "]", e ); } return retval; } Condition(); Condition( String valuename, int function, String valuename2, ValueMetaAndData exact ); Condition( int operator, String valuename, int function, String valuename2, ValueMetaAndData exact ); Condition( boolean negate, String valuename, int function, String valuename2, ValueMetaAndData exact ); Condition( String xml ); Condition( Node condnode ); ObjectId getObjectId(); void setObjectId( ObjectId id ); @Override Object clone(); void setOperator( int operator ); int getOperator(); String getOperatorDesc(); static final int getOperator( String description ); static final String[] getOperators(); static final String[] getRealOperators(); void setLeftValuename( String left_valuename ); String getLeftValuename(); int getFunction(); void setFunction( int function ); String getFunctionDesc(); static final int getFunction( String description ); void setRightValuename( String right_valuename ); String getRightValuename(); void setRightExact( ValueMetaAndData right_exact ); ValueMetaAndData getRightExact(); String getRightExactString(); ObjectId getRightExactID(); void setRightExactID( ObjectId id_right_exact ); boolean isAtomic(); boolean isComposite(); boolean isNegated(); void setNegated( boolean negate ); void negate(); boolean isEmpty(); void clearFieldPositions(); boolean evaluate( RowMetaInterface rowMeta, Object[] r ); void addCondition( Condition cb ); void addCondition( int idx, Condition cb ); void removeCondition( int nr ); boolean simplify(); int nrConditions(); Condition getCondition( int i ); void setCondition( int i, Condition subCondition ); @Override String toString(); String toString( int level, boolean show_negate, boolean show_operator ); @Override String getXML(); String getXML( int level ); String[] getUsedFields(); void getUsedFields( Hashtable<String, String> fields ); List<Condition> getChildren(); }
Condition implements Cloneable, XMLInterface { public boolean evaluate( RowMetaInterface rowMeta, Object[] r ) { boolean retval = false; try { if ( isAtomic() ) { if ( function == FUNC_TRUE ) { return !negate; } if ( left_valuename != null && left_valuename.length() > 0 ) { left_fieldnr = rowMeta.indexOfValue( left_valuename ); } if ( right_valuename != null && right_valuename.length() > 0 ) { right_fieldnr = rowMeta.indexOfValue( right_valuename ); } ValueMetaInterface fieldMeta = null; Object field = null; if ( left_fieldnr >= 0 ) { fieldMeta = rowMeta.getValueMeta( left_fieldnr ); field = r[left_fieldnr]; } else { return false; } ValueMetaInterface fieldMeta2 = right_exact != null ? right_exact.getValueMeta() : null; Object field2 = right_exact != null ? right_exact.getValueData() : null; if ( field2 == null && right_fieldnr >= 0 ) { fieldMeta2 = rowMeta.getValueMeta( right_fieldnr ); field2 = r[right_fieldnr]; } switch ( function ) { case FUNC_EQUAL: retval = ( fieldMeta.compare( field, fieldMeta2, field2 ) == 0 ); break; case FUNC_NOT_EQUAL: retval = ( fieldMeta.compare( field, fieldMeta2, field2 ) != 0 ); break; case FUNC_SMALLER: retval = ( fieldMeta.compare( field, fieldMeta2, field2 ) < 0 ); break; case FUNC_SMALLER_EQUAL: retval = ( fieldMeta.compare( field, fieldMeta2, field2 ) <= 0 ); break; case FUNC_LARGER: retval = ( fieldMeta.compare( field, fieldMeta2, field2 ) > 0 ); break; case FUNC_LARGER_EQUAL: retval = ( fieldMeta.compare( field, fieldMeta2, field2 ) >= 0 ); break; case FUNC_REGEXP: if ( fieldMeta.isNull( field ) || field2 == null ) { retval = false; } else { retval = Pattern .matches( fieldMeta2.getCompatibleString( field2 ), fieldMeta.getCompatibleString( field ) ); } break; case FUNC_NULL: retval = ( fieldMeta.isNull( field ) ); break; case FUNC_NOT_NULL: retval = ( !fieldMeta.isNull( field ) ); break; case FUNC_IN_LIST: if ( inList == null || right_fieldnr >= 0 ) { inList = Const.splitString( fieldMeta2.getString( field2 ), ';', true ); for ( int i = 0; i < inList.length; i++ ) { inList[i] = inList[i] == null ? null : inList[i].replace( "\\", "" ); } Arrays.sort( inList ); } String searchString = fieldMeta.getCompatibleString( field ); int inIndex = -1; if ( searchString != null ) { inIndex = Arrays.binarySearch( inList, searchString ); } retval = Boolean.valueOf( inIndex >= 0 ); break; case FUNC_CONTAINS: retval = fieldMeta.getCompatibleString( field ) != null ? fieldMeta.getCompatibleString( field ).indexOf( fieldMeta2.getCompatibleString( field2 ) ) >= 0 : false; break; case FUNC_STARTS_WITH: retval = fieldMeta.getCompatibleString( field ) != null ? fieldMeta .getCompatibleString( field ).startsWith( fieldMeta2.getCompatibleString( field2 ) ) : false; break; case FUNC_ENDS_WITH: String string = fieldMeta.getCompatibleString( field ); if ( !Utils.isEmpty( string ) ) { if ( right_string == null && field2 != null ) { right_string = fieldMeta2.getCompatibleString( field2 ); } if ( right_string != null ) { retval = string.endsWith( fieldMeta2.getCompatibleString( field2 ) ); } else { retval = false; } } else { retval = false; } break; case FUNC_LIKE: if ( fieldMeta.isNull( field ) || field2 == null ) { retval = false; } else { String regex = fieldMeta2.getCompatibleString( field2 ); regex = regex.replace( "%", ".*" ); regex = regex.replace( "?", "." ); retval = Pattern.matches( regex, fieldMeta.getCompatibleString( field ) ); } break; default: break; } if ( isNegated() ) { retval = !retval; } } else { Condition cb0 = list.get( 0 ); retval = cb0.evaluate( rowMeta, r ); for ( int i = 1; i < list.size(); i++ ) { Condition cb = list.get( i ); switch ( cb.getOperator() ) { case Condition.OPERATOR_OR: retval = retval || cb.evaluate( rowMeta, r ); break; case Condition.OPERATOR_AND: retval = retval && cb.evaluate( rowMeta, r ); break; case Condition.OPERATOR_OR_NOT: retval = retval || ( !cb.evaluate( rowMeta, r ) ); break; case Condition.OPERATOR_AND_NOT: retval = retval && ( !cb.evaluate( rowMeta, r ) ); break; case Condition.OPERATOR_XOR: retval = retval ^ cb.evaluate( rowMeta, r ); break; default: break; } } if ( isNegated() ) { retval = !retval; } } } catch ( Exception e ) { throw new RuntimeException( "Unexpected error evaluation condition [" + toString() + "]", e ); } return retval; } Condition(); Condition( String valuename, int function, String valuename2, ValueMetaAndData exact ); Condition( int operator, String valuename, int function, String valuename2, ValueMetaAndData exact ); Condition( boolean negate, String valuename, int function, String valuename2, ValueMetaAndData exact ); Condition( String xml ); Condition( Node condnode ); ObjectId getObjectId(); void setObjectId( ObjectId id ); @Override Object clone(); void setOperator( int operator ); int getOperator(); String getOperatorDesc(); static final int getOperator( String description ); static final String[] getOperators(); static final String[] getRealOperators(); void setLeftValuename( String left_valuename ); String getLeftValuename(); int getFunction(); void setFunction( int function ); String getFunctionDesc(); static final int getFunction( String description ); void setRightValuename( String right_valuename ); String getRightValuename(); void setRightExact( ValueMetaAndData right_exact ); ValueMetaAndData getRightExact(); String getRightExactString(); ObjectId getRightExactID(); void setRightExactID( ObjectId id_right_exact ); boolean isAtomic(); boolean isComposite(); boolean isNegated(); void setNegated( boolean negate ); void negate(); boolean isEmpty(); void clearFieldPositions(); boolean evaluate( RowMetaInterface rowMeta, Object[] r ); void addCondition( Condition cb ); void addCondition( int idx, Condition cb ); void removeCondition( int nr ); boolean simplify(); int nrConditions(); Condition getCondition( int i ); void setCondition( int i, Condition subCondition ); @Override String toString(); String toString( int level, boolean show_negate, boolean show_operator ); @Override String getXML(); String getXML( int level ); String[] getUsedFields(); void getUsedFields( Hashtable<String, String> fields ); List<Condition> getChildren(); static final String XML_TAG; static final String[] operators; static final int OPERATOR_NONE; static final int OPERATOR_OR; static final int OPERATOR_AND; static final int OPERATOR_NOT; static final int OPERATOR_OR_NOT; static final int OPERATOR_AND_NOT; static final int OPERATOR_XOR; static final String[] functions; static final int FUNC_EQUAL; static final int FUNC_NOT_EQUAL; static final int FUNC_SMALLER; static final int FUNC_SMALLER_EQUAL; static final int FUNC_LARGER; static final int FUNC_LARGER_EQUAL; static final int FUNC_REGEXP; static final int FUNC_NULL; static final int FUNC_NOT_NULL; static final int FUNC_IN_LIST; static final int FUNC_CONTAINS; static final int FUNC_STARTS_WITH; static final int FUNC_ENDS_WITH; static final int FUNC_LIKE; static final int FUNC_TRUE; }
@SuppressWarnings( "deprecation" ) @Test public void testDateCache() { DateCache cache = new DateCache(); cache.populate( "yyyy-MM-dd", 2016, 2016 ); assertEquals( 366, cache.getSize() ); assertEquals( Calendar.FEBRUARY, cache.lookupDate( "2016-02-29" ).getMonth() ); assertEquals( 29, cache.lookupDate( "2016-02-29" ).getDate() ); assertEquals( ( 2016 - 1900 ), cache.lookupDate( "2016-02-29" ).getYear() ); }
public DateCache() { cache = new HashMap<String, Date>(); }
DateCache { public DateCache() { cache = new HashMap<String, Date>(); } }
DateCache { public DateCache() { cache = new HashMap<String, Date>(); } DateCache(); }
DateCache { public DateCache() { cache = new HashMap<String, Date>(); } DateCache(); void populate( String datePattern, int fromYear, int toYear ); void addDate( String dateString, Date date ); Date lookupDate( String dateString ); int getSize(); static void main( String[] args ); }
DateCache { public DateCache() { cache = new HashMap<String, Date>(); } DateCache(); void populate( String datePattern, int fromYear, int toYear ); void addDate( String dateString, Date date ); Date lookupDate( String dateString ); int getSize(); static void main( String[] args ); }
@Test public void testObjectTypePairsToString() throws Exception { Exception cause = new NullPointerException(); Map<String, RepositoryObjectType> notFoundedReferences = new LinkedHashMap<String, RepositoryObjectType>(); String pathToTransStub = "/path/Trans.ktr"; String pathToJobStub = "/path/Job.ktr"; notFoundedReferences.put( pathToTransStub, RepositoryObjectType.TRANSFORMATION ); notFoundedReferences.put( pathToJobStub, RepositoryObjectType.JOB ); String expectedOutput = System.lineSeparator() + "\"/path/Trans.ktr\" [transformation] " + System.lineSeparator() + "\"/path/Job.ktr\" [job] "; try { throw new LookupReferencesException( cause, notFoundedReferences ); } catch ( LookupReferencesException testedException ) { String actual = testedException.objectTypePairsToString(); assertEquals( expectedOutput, actual ); assertNotNull( testedException.getCause() ); } }
public String objectTypePairsToString() { StringBuilder result = new StringBuilder(); for ( Map.Entry entry : objectTypePairs.entrySet() ) { if ( entry.getKey() != null ) { result.append( Const.CR ); result.append( "\"" ); result.append( entry.getKey() ); result.append( "\"" ); result.append( " [" ); result.append( entry.getValue() ); result.append( "] " ); } } return result.toString(); }
LookupReferencesException extends KettleException { public String objectTypePairsToString() { StringBuilder result = new StringBuilder(); for ( Map.Entry entry : objectTypePairs.entrySet() ) { if ( entry.getKey() != null ) { result.append( Const.CR ); result.append( "\"" ); result.append( entry.getKey() ); result.append( "\"" ); result.append( " [" ); result.append( entry.getValue() ); result.append( "] " ); } } return result.toString(); } }
LookupReferencesException extends KettleException { public String objectTypePairsToString() { StringBuilder result = new StringBuilder(); for ( Map.Entry entry : objectTypePairs.entrySet() ) { if ( entry.getKey() != null ) { result.append( Const.CR ); result.append( "\"" ); result.append( entry.getKey() ); result.append( "\"" ); result.append( " [" ); result.append( entry.getValue() ); result.append( "] " ); } } return result.toString(); } LookupReferencesException( Map<String, RepositoryObjectType> objectTypePairs ); LookupReferencesException( String message, Map<String, RepositoryObjectType> objectTypePairs ); LookupReferencesException( Throwable cause, Map<String, RepositoryObjectType> objectTypePairs ); LookupReferencesException( String message, Throwable cause, Map<String, RepositoryObjectType> objectTypePairs ); }
LookupReferencesException extends KettleException { public String objectTypePairsToString() { StringBuilder result = new StringBuilder(); for ( Map.Entry entry : objectTypePairs.entrySet() ) { if ( entry.getKey() != null ) { result.append( Const.CR ); result.append( "\"" ); result.append( entry.getKey() ); result.append( "\"" ); result.append( " [" ); result.append( entry.getValue() ); result.append( "] " ); } } return result.toString(); } LookupReferencesException( Map<String, RepositoryObjectType> objectTypePairs ); LookupReferencesException( String message, Map<String, RepositoryObjectType> objectTypePairs ); LookupReferencesException( Throwable cause, Map<String, RepositoryObjectType> objectTypePairs ); LookupReferencesException( String message, Throwable cause, Map<String, RepositoryObjectType> objectTypePairs ); String objectTypePairsToString(); }
LookupReferencesException extends KettleException { public String objectTypePairsToString() { StringBuilder result = new StringBuilder(); for ( Map.Entry entry : objectTypePairs.entrySet() ) { if ( entry.getKey() != null ) { result.append( Const.CR ); result.append( "\"" ); result.append( entry.getKey() ); result.append( "\"" ); result.append( " [" ); result.append( entry.getValue() ); result.append( "] " ); } } return result.toString(); } LookupReferencesException( Map<String, RepositoryObjectType> objectTypePairs ); LookupReferencesException( String message, Map<String, RepositoryObjectType> objectTypePairs ); LookupReferencesException( Throwable cause, Map<String, RepositoryObjectType> objectTypePairs ); LookupReferencesException( String message, Throwable cause, Map<String, RepositoryObjectType> objectTypePairs ); String objectTypePairsToString(); static final long serialVersionUID; }
@Test public void testGetUrlStrings() throws Exception { String sFileA = "hdfs: String sFileB = "file: FileObject fileA = mock( FileObject.class ); FileObject fileB = mock( FileObject.class ); when( fileA.getPublicURIString() ).thenReturn( sFileA ); when( fileB.getPublicURIString() ).thenReturn( sFileB ); FileInputList fileInputList = new FileInputList(); fileInputList.addFile( fileA ); fileInputList.addFile( fileB ); String[] result = fileInputList.getUrlStrings(); assertEquals( 2, result.length ); assertEquals( sFileA, result[ 0 ] ); assertEquals( sFileB, result[ 1 ] ); }
public String[] getUrlStrings() { String[] fileStrings = new String[ files.size() ]; for ( int i = 0; i < fileStrings.length; i++ ) { fileStrings[ i ] = files.get( i ).getPublicURIString(); } return fileStrings; }
FileInputList { public String[] getUrlStrings() { String[] fileStrings = new String[ files.size() ]; for ( int i = 0; i < fileStrings.length; i++ ) { fileStrings[ i ] = files.get( i ).getPublicURIString(); } return fileStrings; } }
FileInputList { public String[] getUrlStrings() { String[] fileStrings = new String[ files.size() ]; for ( int i = 0; i < fileStrings.length; i++ ) { fileStrings[ i ] = files.get( i ).getPublicURIString(); } return fileStrings; } }
FileInputList { public String[] getUrlStrings() { String[] fileStrings = new String[ files.size() ]; for ( int i = 0; i < fileStrings.length; i++ ) { fileStrings[ i ] = files.get( i ).getPublicURIString(); } return fileStrings; } static String getRequiredFilesDescription( List<FileObject> nonExistantFiles ); static String[] createFilePathList( VariableSpace space, String[] fileName, String[] fileMask, String[] excludeFileMask, String[] fileRequired ); static String[] createFilePathList( VariableSpace space, String[] fileName, String[] fileMask, String[] excludeFileMask, String[] fileRequired, boolean[] includeSubdirs ); static String[] createFilePathList( VariableSpace space, String[] fileName, String[] fileMask, String[] excludeFileMask, String[] fileRequired, boolean[] includeSubdirs, FileTypeFilter[] filters ); static FileInputList createFileList( VariableSpace space, String[] fileName, String[] fileMask, String[] excludeFileMask, String[] fileRequired ); static FileInputList createFileList( VariableSpace space, String[] fileName, String[] fileMask, String[] excludeFileMask, String[] fileRequired, boolean[] includeSubdirs ); static FileInputList createFileList( VariableSpace space, String[] fileName, String[] fileMask, String[] excludeFileMask, String[] fileRequired, boolean[] includeSubdirs, FileTypeFilter[] fileTypeFilters ); static FileInputList createFolderList( VariableSpace space, String[] folderName, String[] folderRequired ); List<FileObject> getFiles(); String[] getFileStrings(); String[] getUrlStrings(); List<FileObject> getNonAccessibleFiles(); List<FileObject> getNonExistantFiles(); void addFile( FileObject file ); void addNonAccessibleFile( FileObject file ); void addNonExistantFile( FileObject file ); void sortFiles(); FileObject getFile( int i ); int nrOfFiles(); int nrOfMissingFiles(); static FileInputList createFileList( VariableSpace space, String[] fileName, String[] fileMask, String[] fileRequired, boolean[] includeSubdirs ); static String[] createFilePathList( VariableSpace space, String[] fileName, String[] fileMask, String[] fileRequired ); }
FileInputList { public String[] getUrlStrings() { String[] fileStrings = new String[ files.size() ]; for ( int i = 0; i < fileStrings.length; i++ ) { fileStrings[ i ] = files.get( i ).getPublicURIString(); } return fileStrings; } static String getRequiredFilesDescription( List<FileObject> nonExistantFiles ); static String[] createFilePathList( VariableSpace space, String[] fileName, String[] fileMask, String[] excludeFileMask, String[] fileRequired ); static String[] createFilePathList( VariableSpace space, String[] fileName, String[] fileMask, String[] excludeFileMask, String[] fileRequired, boolean[] includeSubdirs ); static String[] createFilePathList( VariableSpace space, String[] fileName, String[] fileMask, String[] excludeFileMask, String[] fileRequired, boolean[] includeSubdirs, FileTypeFilter[] filters ); static FileInputList createFileList( VariableSpace space, String[] fileName, String[] fileMask, String[] excludeFileMask, String[] fileRequired ); static FileInputList createFileList( VariableSpace space, String[] fileName, String[] fileMask, String[] excludeFileMask, String[] fileRequired, boolean[] includeSubdirs ); static FileInputList createFileList( VariableSpace space, String[] fileName, String[] fileMask, String[] excludeFileMask, String[] fileRequired, boolean[] includeSubdirs, FileTypeFilter[] fileTypeFilters ); static FileInputList createFolderList( VariableSpace space, String[] folderName, String[] folderRequired ); List<FileObject> getFiles(); String[] getFileStrings(); String[] getUrlStrings(); List<FileObject> getNonAccessibleFiles(); List<FileObject> getNonExistantFiles(); void addFile( FileObject file ); void addNonAccessibleFile( FileObject file ); void addNonExistantFile( FileObject file ); void sortFiles(); FileObject getFile( int i ); int nrOfFiles(); int nrOfMissingFiles(); static FileInputList createFileList( VariableSpace space, String[] fileName, String[] fileMask, String[] fileRequired, boolean[] includeSubdirs ); static String[] createFilePathList( VariableSpace space, String[] fileName, String[] fileMask, String[] fileRequired ); }
@Test public void testInitCap() { assertEquals( "Sven", Const.initCap( "Sven" ) ); assertEquals( "Matt", Const.initCap( "MATT" ) ); assertEquals( "Sven Boden", Const.initCap( "sven boden" ) ); assertEquals( "Sven Boden ", Const.initCap( "sven boden " ) ); assertEquals( "Sven Boden Was Here", Const.initCap( "sven boden was here" ) ); assertEquals( "K\u00F6nnen", Const.initCap( "k\u00F6nnen" ) ); }
public static String initCap( String string ) { StringBuilder change = new StringBuilder( string ); boolean new_word; int i; char lower, upper, ch; new_word = true; for ( i = 0; i < string.length(); i++ ) { lower = change.substring( i, i + 1 ).toLowerCase().charAt( 0 ); upper = change.substring( i, i + 1 ).toUpperCase().charAt( 0 ); ch = upper; if ( new_word ) { change.setCharAt( i, upper ); } else { change.setCharAt( i, lower ); } new_word = false; if ( !Character.isLetterOrDigit( (int) ch ) && ch != '_' ) { new_word = true; } } return change.toString(); }
Const { public static String initCap( String string ) { StringBuilder change = new StringBuilder( string ); boolean new_word; int i; char lower, upper, ch; new_word = true; for ( i = 0; i < string.length(); i++ ) { lower = change.substring( i, i + 1 ).toLowerCase().charAt( 0 ); upper = change.substring( i, i + 1 ).toUpperCase().charAt( 0 ); ch = upper; if ( new_word ) { change.setCharAt( i, upper ); } else { change.setCharAt( i, lower ); } new_word = false; if ( !Character.isLetterOrDigit( (int) ch ) && ch != '_' ) { new_word = true; } } return change.toString(); } }
Const { public static String initCap( String string ) { StringBuilder change = new StringBuilder( string ); boolean new_word; int i; char lower, upper, ch; new_word = true; for ( i = 0; i < string.length(); i++ ) { lower = change.substring( i, i + 1 ).toLowerCase().charAt( 0 ); upper = change.substring( i, i + 1 ).toUpperCase().charAt( 0 ); ch = upper; if ( new_word ) { change.setCharAt( i, upper ); } else { change.setCharAt( i, lower ); } new_word = false; if ( !Character.isLetterOrDigit( (int) ch ) && ch != '_' ) { new_word = true; } } return change.toString(); } }
Const { public static String initCap( String string ) { StringBuilder change = new StringBuilder( string ); boolean new_word; int i; char lower, upper, ch; new_word = true; for ( i = 0; i < string.length(); i++ ) { lower = change.substring( i, i + 1 ).toLowerCase().charAt( 0 ); upper = change.substring( i, i + 1 ).toUpperCase().charAt( 0 ); ch = upper; if ( new_word ) { change.setCharAt( i, upper ); } else { change.setCharAt( i, lower ); } new_word = false; if ( !Character.isLetterOrDigit( (int) ch ) && ch != '_' ) { new_word = true; } } return change.toString(); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); }
Const { public static String initCap( String string ) { StringBuilder change = new StringBuilder( string ); boolean new_word; int i; char lower, upper, ch; new_word = true; for ( i = 0; i < string.length(); i++ ) { lower = change.substring( i, i + 1 ).toLowerCase().charAt( 0 ); upper = change.substring( i, i + 1 ).toUpperCase().charAt( 0 ); ch = upper; if ( new_word ) { change.setCharAt( i, upper ); } else { change.setCharAt( i, lower ); } new_word = false; if ( !Character.isLetterOrDigit( (int) ch ) && ch != '_' ) { new_word = true; } } return change.toString(); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); @Deprecated static final String VERSION; static final String COPYRIGHT_YEAR; static final int TIMEOUT_GET_MILLIS; static final int TIMEOUT_PUT_MILLIS; static final int ROWS_UPDATE; static final int ROWS_IN_ROWSET; static final int FETCH_SIZE; static final int SORT_SIZE; static final int HEARTBEAT_PERIODIC_INTERVAL_IN_SECS; static final String FILE_SEPARATOR; static final String PATH_SEPARATOR; static final String CR; static final String DOSCR; static final String EMPTY_STRING; static final String JAVA_VERSION; @Deprecated static final String USER_HOME_DIRECTORY; static String JNDI_DIRECTORY; static final String PLUGIN_BASE_FOLDERS_PROP; static final String DEFAULT_PLUGIN_BASE_FOLDERS; static final Date MIN_DATE; static final Date MAX_DATE; static final int MIN_YEAR; static final int MAX_YEAR; static final int RIGHT; static final int LENGTH; static final int MARGIN; static final int MIDDLE_PCT; static final int ARROW_WIDTH; static final int FORM_MARGIN; static final int SHADOW_SIZE; static final int SYMBOLSIZE; static final int MAX_FILE_HIST; static final Locale DEFAULT_LOCALE; static final char DEFAULT_DECIMAL_SEPARATOR; static final char DEFAULT_GROUPING_SEPARATOR; static final String DEFAULT_CURRENCY_SYMBOL; static final String DEFAULT_NUMBER_FORMAT; static final String NULL_STRING; static final String NULL_NUMBER; static final String NULL_DATE; static final String NULL_BIGNUMBER; static final String NULL_BOOLEAN; static final String NULL_INTEGER; static final String NULL_BINARY; static final String NULL_NONE; static final int ROUND_HALF_CEILING; static final String CHEF_LOG_FILE; static final String SPOON_LOG_FILE; static final String MENU_LOG_FILE; static final String GENERALIZED_DATE_TIME_FORMAT; static final String GENERALIZED_DATE_TIME_FORMAT_MILLIS; static final String XML_ENCODING; static final String[] STRING_TRANS_AND_JOB_FILTER_EXT; static final String STRING_TRANS_DEFAULT_EXT; static final String[] STRING_TRANS_FILTER_EXT; static final String STRING_JOB_DEFAULT_EXT; static final String[] STRING_JOB_FILTER_EXT; static final String KETTLE_PROPERTIES; static final String SHARED_DATA_FILE; static final String INTERNAL_VARIABLE_PREFIX; static final String INTERNAL_VARIABLE_KETTLE_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_DATE; static final String INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_FILENAME_NAME; static final String INTERNAL_VARIABLE_JOB_NAME; static final String INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_RUN_ID; static final String INTERNAL_VARIABLE_JOB_RUN_ATTEMPTNR; static final String VARIABLE_HEARTBEAT_PERIODIC_INTERVAL_SECS; static final String VARIABLE_MONITORING_SNMP_TRAPS_ENABLED; static final String INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY; static final String[] INTERNAL_TRANS_VARIABLES; static final String[] INTERNAL_JOB_VARIABLES; static final String[] DEPRECATED_VARIABLES; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_STEP_PARTITION_ID; static final String INTERNAL_VARIABLE_STEP_PARTITION_NR; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NUMBER; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NAME; static final String INTERNAL_VARIABLE_CLUSTER_SIZE; static final String INTERNAL_VARIABLE_STEP_UNIQUE_NUMBER; static final String INTERNAL_VARIABLE_CLUSTER_MASTER; static final String INTERNAL_VARIABLE_CLUSTER_RUN_ID; static final String INTERNAL_VARIABLE_STEP_UNIQUE_COUNT; static final String INTERNAL_VARIABLE_STEP_NAME; static final String INTERNAL_VARIABLE_STEP_COPYNR; static final int MAX_NR_LOG_LINES; static final int MAX_NR_HISTORY_LINES; static final int HISTORY_LINES_FETCH_SIZE; static final int MAX_LOG_LINE_TIMEOUT_MINUTES; static final int WARNING; static final int ERROR; static final int INFO; static final int NOTE_MARGIN; static final int MAX_UNDO; static final String KETTLE_VARIABLES_FILE; static final String KETTLE_LOG_SIZE_LIMIT; static final String KETTLE_TRANS_LOG_DB; static final String KETTLE_TRANS_LOG_SCHEMA; static final String KETTLE_TRANS_LOG_TABLE; static final String KETTLE_JOB_LOG_DB; static final String KETTLE_JOB_LOG_SCHEMA; static final String KETTLE_SLAVE_DETECTION_TIMER; static final String KETTLE_JOB_LOG_TABLE; static final String KETTLE_TRANS_PERFORMANCE_LOG_DB; static final String KETTLE_TRANS_PERFORMANCE_LOG_SCHEMA; static final String KETTLE_TRANS_PERFORMANCE_LOG_TABLE; static final String KETTLE_JOBENTRY_LOG_DB; static final String KETTLE_JOBENTRY_LOG_SCHEMA; static final String KETTLE_JOBENTRY_LOG_TABLE; static final String KETTLE_STEP_LOG_DB; static final String KETTLE_STEP_LOG_SCHEMA; static final String KETTLE_STEP_LOG_TABLE; static final String KETTLE_CHANNEL_LOG_DB; static final String KETTLE_CHANNEL_LOG_SCHEMA; static final String KETTLE_CHANNEL_LOG_TABLE; static final String KETTLE_METRICS_LOG_DB; static final String KETTLE_METRICS_LOG_SCHEMA; static final String KETTLE_METRICS_LOG_TABLE; static final String KETTLE_CHECKPOINT_LOG_DB; static final String KETTLE_CHECKPOINT_LOG_SCHEMA; static final String KETTLE_CHECKPOINT_LOG_TABLE; static final String KETTLE_SHARED_OBJECTS; static final String KETTLE_EMPTY_STRING_DIFFERS_FROM_NULL; static final String KETTLE_LENIENT_STRING_TO_NUMBER_CONVERSION; static final String KETTLE_COMPATIBILITY_DB_IGNORE_TIMEZONE; static final String KETTLE_COMPATIBILITY_IMPORT_PATH_ADDITION_ON_VARIABLES; static final String KETTLE_COMPATIBILITY_IGNORE_TABLE_LOGGING; static final String KETTLE_COMPATIBILITY_TEXT_FILE_OUTPUT_APPEND_NO_HEADER; static final String KETTLE_COMPATIBILITY_MERGE_ROWS_USE_REFERENCE_STREAM_WHEN_IDENTICAL; static final String KETTLE_COMPATIBILITY_MEMORY_GROUP_BY_SUM_AVERAGE_RETURN_NUMBER_TYPE; static final String KETTLE_SYSTEM_HOSTNAME; static final String KETTLE_MAX_LOG_SIZE_IN_LINES; static final String KETTLE_MAX_LOG_TIMEOUT_IN_MINUTES; static final String KETTLE_REDIRECT_STDERR; static final String KETTLE_REDIRECT_STDOUT; static final String KETTLE_CARTE_OBJECT_TIMEOUT_MINUTES; static final String KETTLE_STEP_PERFORMANCE_SNAPSHOT_LIMIT; static final String KETTLE_MAX_JOB_TRACKER_SIZE; static final String KETTLE_MAX_JOB_ENTRIES_LOGGED; static final String KETTLE_MAX_LOGGING_REGISTRY_SIZE; static final String KETTLE_LOG_TAB_REFRESH_DELAY; static final String KETTLE_LOG_TAB_REFRESH_PERIOD; static final String KETTLE_SAP_CONNECTION_FACTORY; static final String KETTLE_SAP_CONNECTION_FACTORY_DEFAULT_NAME; static final String KETTLE_PLUGIN_CLASSES; static final String KETTLE_PLUGIN_PACKAGES; static final String KETTLE_TRANS_ROWSET_SIZE; static final String VERSION_COMMENT_INITIAL_VERSION; static final String VERSION_COMMENT_EDIT_VERSION; static final String XML_FILE_KETTLE_STEPS; static final String KETTLE_CORE_STEPS_FILE; static final String XML_FILE_KETTLE_PARTITION_PLUGINS; static final String KETTLE_CORE_JOBENTRIES_FILE; static final String XML_FILE_KETTLE_SERVLETS; static final String XML_FILE_KETTLE_VALUEMETA_PLUGINS; static final String XML_FILE_KETTLE_PASSWORD_ENCODER_PLUGINS; static final String KETTLE_VALUEMETA_PLUGINS_FILE; static final String KETTLE_PASSWORD_ENCODER_PLUGIN; static final String KETTLE_PASSWORD_ENCODER_PLUGINS_FILE; static final String KETTLE_TWO_WAY_PASSWORD_ENCODER_SEED; static final String XML_FILE_KETTLE_LOGGING_PLUGINS; static final String KETTLE_LOGGING_PLUGINS_FILE; static final String KETTLE_CORE_SERVLETS_FILE; static final String KETTLE_ROWSET_GET_TIMEOUT; static final String KETTLE_ROWSET_PUT_TIMEOUT; static final String KETTLE_BATCHING_ROWSET; static final String KETTLE_DISABLE_CONSOLE_LOGGING; static final String XML_FILE_KETTLE_JOB_ENTRIES; static final String XML_FILE_KETTLE_REPOSITORIES; static final String XML_FILE_KETTLE_DATABASE_TYPES; static final String XML_FILE_KETTLE_COMPRESSION_PROVIDERS; static final String XML_FILE_KETTLE_AUTHENTICATION_PROVIDERS; static final String XML_FILE_KETTLE_EXTENSION_POINTS; static final String XML_FILE_KETTLE_REGISTRY_EXTENSIONS; static final String XML_FILE_KETTLE_LIFECYCLE_LISTENERS; static final String XML_FILE_KETTLE_ENGINES; static final String KETTLE_TRANS_PAN_JVM_EXIT_CODE; static final String KETTLE_DEFAULT_NUMBER_FORMAT; static final String KETTLE_DEFAULT_BIGNUMBER_FORMAT; static final String KETTLE_DEFAULT_INTEGER_FORMAT; static final String KETTLE_DEFAULT_DATE_FORMAT; static final String KETTLE_AGGREGATION_MIN_NULL_IS_VALUED; static final String KETTLE_AGGREGATION_ALL_NULLS_ARE_ZERO; static final String KETTLE_DEFAULT_TIMESTAMP_FORMAT; static final String KETTLE_SPLIT_FIELDS_REMOVE_ENCLOSURE; static final String KETTLE_GLOBAL_LOG_VARIABLES_CLEAR_ON_EXPORT; static final String KETTLE_COMPATIBILITY_CALCULATION_TIMEZONE_DECOMPOSITION; static final String KETTLE_COMPATIBILITY_SET_ERROR_ON_SPECIFIC_JOB_ENTRIES; static final String KETTLE_COMPATIBILITY_SEND_RESULT_XML_WITH_FULL_STATUS; static final String KETTLE_COMPATIBILITY_SELECT_VALUES_TYPE_CHANGE_USES_TYPE_DEFAULTS; static final String XML_FILE_KETTLE_IMPORT_RULES; static final ReleaseType RELEASE; static final String PENTAHO_METASTORE_FOLDER; static final String PENTAHO_METASTORE_NAME; static final String KETTLE_LOG_MARK_MAPPINGS; static final String KETTLE_CARTE_JETTY_ACCEPTORS; static final String KETTLE_CARTE_JETTY_ACCEPT_QUEUE_SIZE; static final String KETTLE_CARTE_JETTY_RES_MAX_IDLE_TIME; static final String VFS_USER_DIR_IS_ROOT; }
@Test public void testSortStrings() { String[] arr1 = { "Red", "Blue", "Black", "Black", "Green" }; String[] arr2 = { "aaa", "zzz", "yyy", "sss", "ttt", "t" }; String[] arr3 = { "A", "B", "C", "D" }; String[] results = Const.sortStrings( arr1 ); assertTrue( isArraySorted( arr1 ) ); assertTrue( isArraySorted( results ) ); results = Const.sortStrings( arr2 ); assertTrue( isArraySorted( arr2 ) ); assertTrue( isArraySorted( results ) ); results = Const.sortStrings( arr3 ); assertTrue( isArraySorted( arr3 ) ); assertTrue( isArraySorted( results ) ); }
public static String[] sortStrings( String[] input ) { Arrays.sort( input ); return input; }
Const { public static String[] sortStrings( String[] input ) { Arrays.sort( input ); return input; } }
Const { public static String[] sortStrings( String[] input ) { Arrays.sort( input ); return input; } }
Const { public static String[] sortStrings( String[] input ) { Arrays.sort( input ); return input; } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); }
Const { public static String[] sortStrings( String[] input ) { Arrays.sort( input ); return input; } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); @Deprecated static final String VERSION; static final String COPYRIGHT_YEAR; static final int TIMEOUT_GET_MILLIS; static final int TIMEOUT_PUT_MILLIS; static final int ROWS_UPDATE; static final int ROWS_IN_ROWSET; static final int FETCH_SIZE; static final int SORT_SIZE; static final int HEARTBEAT_PERIODIC_INTERVAL_IN_SECS; static final String FILE_SEPARATOR; static final String PATH_SEPARATOR; static final String CR; static final String DOSCR; static final String EMPTY_STRING; static final String JAVA_VERSION; @Deprecated static final String USER_HOME_DIRECTORY; static String JNDI_DIRECTORY; static final String PLUGIN_BASE_FOLDERS_PROP; static final String DEFAULT_PLUGIN_BASE_FOLDERS; static final Date MIN_DATE; static final Date MAX_DATE; static final int MIN_YEAR; static final int MAX_YEAR; static final int RIGHT; static final int LENGTH; static final int MARGIN; static final int MIDDLE_PCT; static final int ARROW_WIDTH; static final int FORM_MARGIN; static final int SHADOW_SIZE; static final int SYMBOLSIZE; static final int MAX_FILE_HIST; static final Locale DEFAULT_LOCALE; static final char DEFAULT_DECIMAL_SEPARATOR; static final char DEFAULT_GROUPING_SEPARATOR; static final String DEFAULT_CURRENCY_SYMBOL; static final String DEFAULT_NUMBER_FORMAT; static final String NULL_STRING; static final String NULL_NUMBER; static final String NULL_DATE; static final String NULL_BIGNUMBER; static final String NULL_BOOLEAN; static final String NULL_INTEGER; static final String NULL_BINARY; static final String NULL_NONE; static final int ROUND_HALF_CEILING; static final String CHEF_LOG_FILE; static final String SPOON_LOG_FILE; static final String MENU_LOG_FILE; static final String GENERALIZED_DATE_TIME_FORMAT; static final String GENERALIZED_DATE_TIME_FORMAT_MILLIS; static final String XML_ENCODING; static final String[] STRING_TRANS_AND_JOB_FILTER_EXT; static final String STRING_TRANS_DEFAULT_EXT; static final String[] STRING_TRANS_FILTER_EXT; static final String STRING_JOB_DEFAULT_EXT; static final String[] STRING_JOB_FILTER_EXT; static final String KETTLE_PROPERTIES; static final String SHARED_DATA_FILE; static final String INTERNAL_VARIABLE_PREFIX; static final String INTERNAL_VARIABLE_KETTLE_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_DATE; static final String INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_FILENAME_NAME; static final String INTERNAL_VARIABLE_JOB_NAME; static final String INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_RUN_ID; static final String INTERNAL_VARIABLE_JOB_RUN_ATTEMPTNR; static final String VARIABLE_HEARTBEAT_PERIODIC_INTERVAL_SECS; static final String VARIABLE_MONITORING_SNMP_TRAPS_ENABLED; static final String INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY; static final String[] INTERNAL_TRANS_VARIABLES; static final String[] INTERNAL_JOB_VARIABLES; static final String[] DEPRECATED_VARIABLES; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_STEP_PARTITION_ID; static final String INTERNAL_VARIABLE_STEP_PARTITION_NR; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NUMBER; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NAME; static final String INTERNAL_VARIABLE_CLUSTER_SIZE; static final String INTERNAL_VARIABLE_STEP_UNIQUE_NUMBER; static final String INTERNAL_VARIABLE_CLUSTER_MASTER; static final String INTERNAL_VARIABLE_CLUSTER_RUN_ID; static final String INTERNAL_VARIABLE_STEP_UNIQUE_COUNT; static final String INTERNAL_VARIABLE_STEP_NAME; static final String INTERNAL_VARIABLE_STEP_COPYNR; static final int MAX_NR_LOG_LINES; static final int MAX_NR_HISTORY_LINES; static final int HISTORY_LINES_FETCH_SIZE; static final int MAX_LOG_LINE_TIMEOUT_MINUTES; static final int WARNING; static final int ERROR; static final int INFO; static final int NOTE_MARGIN; static final int MAX_UNDO; static final String KETTLE_VARIABLES_FILE; static final String KETTLE_LOG_SIZE_LIMIT; static final String KETTLE_TRANS_LOG_DB; static final String KETTLE_TRANS_LOG_SCHEMA; static final String KETTLE_TRANS_LOG_TABLE; static final String KETTLE_JOB_LOG_DB; static final String KETTLE_JOB_LOG_SCHEMA; static final String KETTLE_SLAVE_DETECTION_TIMER; static final String KETTLE_JOB_LOG_TABLE; static final String KETTLE_TRANS_PERFORMANCE_LOG_DB; static final String KETTLE_TRANS_PERFORMANCE_LOG_SCHEMA; static final String KETTLE_TRANS_PERFORMANCE_LOG_TABLE; static final String KETTLE_JOBENTRY_LOG_DB; static final String KETTLE_JOBENTRY_LOG_SCHEMA; static final String KETTLE_JOBENTRY_LOG_TABLE; static final String KETTLE_STEP_LOG_DB; static final String KETTLE_STEP_LOG_SCHEMA; static final String KETTLE_STEP_LOG_TABLE; static final String KETTLE_CHANNEL_LOG_DB; static final String KETTLE_CHANNEL_LOG_SCHEMA; static final String KETTLE_CHANNEL_LOG_TABLE; static final String KETTLE_METRICS_LOG_DB; static final String KETTLE_METRICS_LOG_SCHEMA; static final String KETTLE_METRICS_LOG_TABLE; static final String KETTLE_CHECKPOINT_LOG_DB; static final String KETTLE_CHECKPOINT_LOG_SCHEMA; static final String KETTLE_CHECKPOINT_LOG_TABLE; static final String KETTLE_SHARED_OBJECTS; static final String KETTLE_EMPTY_STRING_DIFFERS_FROM_NULL; static final String KETTLE_LENIENT_STRING_TO_NUMBER_CONVERSION; static final String KETTLE_COMPATIBILITY_DB_IGNORE_TIMEZONE; static final String KETTLE_COMPATIBILITY_IMPORT_PATH_ADDITION_ON_VARIABLES; static final String KETTLE_COMPATIBILITY_IGNORE_TABLE_LOGGING; static final String KETTLE_COMPATIBILITY_TEXT_FILE_OUTPUT_APPEND_NO_HEADER; static final String KETTLE_COMPATIBILITY_MERGE_ROWS_USE_REFERENCE_STREAM_WHEN_IDENTICAL; static final String KETTLE_COMPATIBILITY_MEMORY_GROUP_BY_SUM_AVERAGE_RETURN_NUMBER_TYPE; static final String KETTLE_SYSTEM_HOSTNAME; static final String KETTLE_MAX_LOG_SIZE_IN_LINES; static final String KETTLE_MAX_LOG_TIMEOUT_IN_MINUTES; static final String KETTLE_REDIRECT_STDERR; static final String KETTLE_REDIRECT_STDOUT; static final String KETTLE_CARTE_OBJECT_TIMEOUT_MINUTES; static final String KETTLE_STEP_PERFORMANCE_SNAPSHOT_LIMIT; static final String KETTLE_MAX_JOB_TRACKER_SIZE; static final String KETTLE_MAX_JOB_ENTRIES_LOGGED; static final String KETTLE_MAX_LOGGING_REGISTRY_SIZE; static final String KETTLE_LOG_TAB_REFRESH_DELAY; static final String KETTLE_LOG_TAB_REFRESH_PERIOD; static final String KETTLE_SAP_CONNECTION_FACTORY; static final String KETTLE_SAP_CONNECTION_FACTORY_DEFAULT_NAME; static final String KETTLE_PLUGIN_CLASSES; static final String KETTLE_PLUGIN_PACKAGES; static final String KETTLE_TRANS_ROWSET_SIZE; static final String VERSION_COMMENT_INITIAL_VERSION; static final String VERSION_COMMENT_EDIT_VERSION; static final String XML_FILE_KETTLE_STEPS; static final String KETTLE_CORE_STEPS_FILE; static final String XML_FILE_KETTLE_PARTITION_PLUGINS; static final String KETTLE_CORE_JOBENTRIES_FILE; static final String XML_FILE_KETTLE_SERVLETS; static final String XML_FILE_KETTLE_VALUEMETA_PLUGINS; static final String XML_FILE_KETTLE_PASSWORD_ENCODER_PLUGINS; static final String KETTLE_VALUEMETA_PLUGINS_FILE; static final String KETTLE_PASSWORD_ENCODER_PLUGIN; static final String KETTLE_PASSWORD_ENCODER_PLUGINS_FILE; static final String KETTLE_TWO_WAY_PASSWORD_ENCODER_SEED; static final String XML_FILE_KETTLE_LOGGING_PLUGINS; static final String KETTLE_LOGGING_PLUGINS_FILE; static final String KETTLE_CORE_SERVLETS_FILE; static final String KETTLE_ROWSET_GET_TIMEOUT; static final String KETTLE_ROWSET_PUT_TIMEOUT; static final String KETTLE_BATCHING_ROWSET; static final String KETTLE_DISABLE_CONSOLE_LOGGING; static final String XML_FILE_KETTLE_JOB_ENTRIES; static final String XML_FILE_KETTLE_REPOSITORIES; static final String XML_FILE_KETTLE_DATABASE_TYPES; static final String XML_FILE_KETTLE_COMPRESSION_PROVIDERS; static final String XML_FILE_KETTLE_AUTHENTICATION_PROVIDERS; static final String XML_FILE_KETTLE_EXTENSION_POINTS; static final String XML_FILE_KETTLE_REGISTRY_EXTENSIONS; static final String XML_FILE_KETTLE_LIFECYCLE_LISTENERS; static final String XML_FILE_KETTLE_ENGINES; static final String KETTLE_TRANS_PAN_JVM_EXIT_CODE; static final String KETTLE_DEFAULT_NUMBER_FORMAT; static final String KETTLE_DEFAULT_BIGNUMBER_FORMAT; static final String KETTLE_DEFAULT_INTEGER_FORMAT; static final String KETTLE_DEFAULT_DATE_FORMAT; static final String KETTLE_AGGREGATION_MIN_NULL_IS_VALUED; static final String KETTLE_AGGREGATION_ALL_NULLS_ARE_ZERO; static final String KETTLE_DEFAULT_TIMESTAMP_FORMAT; static final String KETTLE_SPLIT_FIELDS_REMOVE_ENCLOSURE; static final String KETTLE_GLOBAL_LOG_VARIABLES_CLEAR_ON_EXPORT; static final String KETTLE_COMPATIBILITY_CALCULATION_TIMEZONE_DECOMPOSITION; static final String KETTLE_COMPATIBILITY_SET_ERROR_ON_SPECIFIC_JOB_ENTRIES; static final String KETTLE_COMPATIBILITY_SEND_RESULT_XML_WITH_FULL_STATUS; static final String KETTLE_COMPATIBILITY_SELECT_VALUES_TYPE_CHANGE_USES_TYPE_DEFAULTS; static final String XML_FILE_KETTLE_IMPORT_RULES; static final ReleaseType RELEASE; static final String PENTAHO_METASTORE_FOLDER; static final String PENTAHO_METASTORE_NAME; static final String KETTLE_LOG_MARK_MAPPINGS; static final String KETTLE_CARTE_JETTY_ACCEPTORS; static final String KETTLE_CARTE_JETTY_ACCEPT_QUEUE_SIZE; static final String KETTLE_CARTE_JETTY_RES_MAX_IDLE_TIME; static final String VFS_USER_DIR_IS_ROOT; }
@Test public void testIsEmpty() { assertTrue( Const.isEmpty( (String) null ) ); assertTrue( Const.isEmpty( "" ) ); assertFalse( Const.isEmpty( "test" ) ); }
@Deprecated public static boolean isEmpty( String val ) { return Utils.isEmpty( val ); }
Const { @Deprecated public static boolean isEmpty( String val ) { return Utils.isEmpty( val ); } }
Const { @Deprecated public static boolean isEmpty( String val ) { return Utils.isEmpty( val ); } }
Const { @Deprecated public static boolean isEmpty( String val ) { return Utils.isEmpty( val ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); }
Const { @Deprecated public static boolean isEmpty( String val ) { return Utils.isEmpty( val ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); @Deprecated static final String VERSION; static final String COPYRIGHT_YEAR; static final int TIMEOUT_GET_MILLIS; static final int TIMEOUT_PUT_MILLIS; static final int ROWS_UPDATE; static final int ROWS_IN_ROWSET; static final int FETCH_SIZE; static final int SORT_SIZE; static final int HEARTBEAT_PERIODIC_INTERVAL_IN_SECS; static final String FILE_SEPARATOR; static final String PATH_SEPARATOR; static final String CR; static final String DOSCR; static final String EMPTY_STRING; static final String JAVA_VERSION; @Deprecated static final String USER_HOME_DIRECTORY; static String JNDI_DIRECTORY; static final String PLUGIN_BASE_FOLDERS_PROP; static final String DEFAULT_PLUGIN_BASE_FOLDERS; static final Date MIN_DATE; static final Date MAX_DATE; static final int MIN_YEAR; static final int MAX_YEAR; static final int RIGHT; static final int LENGTH; static final int MARGIN; static final int MIDDLE_PCT; static final int ARROW_WIDTH; static final int FORM_MARGIN; static final int SHADOW_SIZE; static final int SYMBOLSIZE; static final int MAX_FILE_HIST; static final Locale DEFAULT_LOCALE; static final char DEFAULT_DECIMAL_SEPARATOR; static final char DEFAULT_GROUPING_SEPARATOR; static final String DEFAULT_CURRENCY_SYMBOL; static final String DEFAULT_NUMBER_FORMAT; static final String NULL_STRING; static final String NULL_NUMBER; static final String NULL_DATE; static final String NULL_BIGNUMBER; static final String NULL_BOOLEAN; static final String NULL_INTEGER; static final String NULL_BINARY; static final String NULL_NONE; static final int ROUND_HALF_CEILING; static final String CHEF_LOG_FILE; static final String SPOON_LOG_FILE; static final String MENU_LOG_FILE; static final String GENERALIZED_DATE_TIME_FORMAT; static final String GENERALIZED_DATE_TIME_FORMAT_MILLIS; static final String XML_ENCODING; static final String[] STRING_TRANS_AND_JOB_FILTER_EXT; static final String STRING_TRANS_DEFAULT_EXT; static final String[] STRING_TRANS_FILTER_EXT; static final String STRING_JOB_DEFAULT_EXT; static final String[] STRING_JOB_FILTER_EXT; static final String KETTLE_PROPERTIES; static final String SHARED_DATA_FILE; static final String INTERNAL_VARIABLE_PREFIX; static final String INTERNAL_VARIABLE_KETTLE_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_DATE; static final String INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_FILENAME_NAME; static final String INTERNAL_VARIABLE_JOB_NAME; static final String INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_RUN_ID; static final String INTERNAL_VARIABLE_JOB_RUN_ATTEMPTNR; static final String VARIABLE_HEARTBEAT_PERIODIC_INTERVAL_SECS; static final String VARIABLE_MONITORING_SNMP_TRAPS_ENABLED; static final String INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY; static final String[] INTERNAL_TRANS_VARIABLES; static final String[] INTERNAL_JOB_VARIABLES; static final String[] DEPRECATED_VARIABLES; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_STEP_PARTITION_ID; static final String INTERNAL_VARIABLE_STEP_PARTITION_NR; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NUMBER; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NAME; static final String INTERNAL_VARIABLE_CLUSTER_SIZE; static final String INTERNAL_VARIABLE_STEP_UNIQUE_NUMBER; static final String INTERNAL_VARIABLE_CLUSTER_MASTER; static final String INTERNAL_VARIABLE_CLUSTER_RUN_ID; static final String INTERNAL_VARIABLE_STEP_UNIQUE_COUNT; static final String INTERNAL_VARIABLE_STEP_NAME; static final String INTERNAL_VARIABLE_STEP_COPYNR; static final int MAX_NR_LOG_LINES; static final int MAX_NR_HISTORY_LINES; static final int HISTORY_LINES_FETCH_SIZE; static final int MAX_LOG_LINE_TIMEOUT_MINUTES; static final int WARNING; static final int ERROR; static final int INFO; static final int NOTE_MARGIN; static final int MAX_UNDO; static final String KETTLE_VARIABLES_FILE; static final String KETTLE_LOG_SIZE_LIMIT; static final String KETTLE_TRANS_LOG_DB; static final String KETTLE_TRANS_LOG_SCHEMA; static final String KETTLE_TRANS_LOG_TABLE; static final String KETTLE_JOB_LOG_DB; static final String KETTLE_JOB_LOG_SCHEMA; static final String KETTLE_SLAVE_DETECTION_TIMER; static final String KETTLE_JOB_LOG_TABLE; static final String KETTLE_TRANS_PERFORMANCE_LOG_DB; static final String KETTLE_TRANS_PERFORMANCE_LOG_SCHEMA; static final String KETTLE_TRANS_PERFORMANCE_LOG_TABLE; static final String KETTLE_JOBENTRY_LOG_DB; static final String KETTLE_JOBENTRY_LOG_SCHEMA; static final String KETTLE_JOBENTRY_LOG_TABLE; static final String KETTLE_STEP_LOG_DB; static final String KETTLE_STEP_LOG_SCHEMA; static final String KETTLE_STEP_LOG_TABLE; static final String KETTLE_CHANNEL_LOG_DB; static final String KETTLE_CHANNEL_LOG_SCHEMA; static final String KETTLE_CHANNEL_LOG_TABLE; static final String KETTLE_METRICS_LOG_DB; static final String KETTLE_METRICS_LOG_SCHEMA; static final String KETTLE_METRICS_LOG_TABLE; static final String KETTLE_CHECKPOINT_LOG_DB; static final String KETTLE_CHECKPOINT_LOG_SCHEMA; static final String KETTLE_CHECKPOINT_LOG_TABLE; static final String KETTLE_SHARED_OBJECTS; static final String KETTLE_EMPTY_STRING_DIFFERS_FROM_NULL; static final String KETTLE_LENIENT_STRING_TO_NUMBER_CONVERSION; static final String KETTLE_COMPATIBILITY_DB_IGNORE_TIMEZONE; static final String KETTLE_COMPATIBILITY_IMPORT_PATH_ADDITION_ON_VARIABLES; static final String KETTLE_COMPATIBILITY_IGNORE_TABLE_LOGGING; static final String KETTLE_COMPATIBILITY_TEXT_FILE_OUTPUT_APPEND_NO_HEADER; static final String KETTLE_COMPATIBILITY_MERGE_ROWS_USE_REFERENCE_STREAM_WHEN_IDENTICAL; static final String KETTLE_COMPATIBILITY_MEMORY_GROUP_BY_SUM_AVERAGE_RETURN_NUMBER_TYPE; static final String KETTLE_SYSTEM_HOSTNAME; static final String KETTLE_MAX_LOG_SIZE_IN_LINES; static final String KETTLE_MAX_LOG_TIMEOUT_IN_MINUTES; static final String KETTLE_REDIRECT_STDERR; static final String KETTLE_REDIRECT_STDOUT; static final String KETTLE_CARTE_OBJECT_TIMEOUT_MINUTES; static final String KETTLE_STEP_PERFORMANCE_SNAPSHOT_LIMIT; static final String KETTLE_MAX_JOB_TRACKER_SIZE; static final String KETTLE_MAX_JOB_ENTRIES_LOGGED; static final String KETTLE_MAX_LOGGING_REGISTRY_SIZE; static final String KETTLE_LOG_TAB_REFRESH_DELAY; static final String KETTLE_LOG_TAB_REFRESH_PERIOD; static final String KETTLE_SAP_CONNECTION_FACTORY; static final String KETTLE_SAP_CONNECTION_FACTORY_DEFAULT_NAME; static final String KETTLE_PLUGIN_CLASSES; static final String KETTLE_PLUGIN_PACKAGES; static final String KETTLE_TRANS_ROWSET_SIZE; static final String VERSION_COMMENT_INITIAL_VERSION; static final String VERSION_COMMENT_EDIT_VERSION; static final String XML_FILE_KETTLE_STEPS; static final String KETTLE_CORE_STEPS_FILE; static final String XML_FILE_KETTLE_PARTITION_PLUGINS; static final String KETTLE_CORE_JOBENTRIES_FILE; static final String XML_FILE_KETTLE_SERVLETS; static final String XML_FILE_KETTLE_VALUEMETA_PLUGINS; static final String XML_FILE_KETTLE_PASSWORD_ENCODER_PLUGINS; static final String KETTLE_VALUEMETA_PLUGINS_FILE; static final String KETTLE_PASSWORD_ENCODER_PLUGIN; static final String KETTLE_PASSWORD_ENCODER_PLUGINS_FILE; static final String KETTLE_TWO_WAY_PASSWORD_ENCODER_SEED; static final String XML_FILE_KETTLE_LOGGING_PLUGINS; static final String KETTLE_LOGGING_PLUGINS_FILE; static final String KETTLE_CORE_SERVLETS_FILE; static final String KETTLE_ROWSET_GET_TIMEOUT; static final String KETTLE_ROWSET_PUT_TIMEOUT; static final String KETTLE_BATCHING_ROWSET; static final String KETTLE_DISABLE_CONSOLE_LOGGING; static final String XML_FILE_KETTLE_JOB_ENTRIES; static final String XML_FILE_KETTLE_REPOSITORIES; static final String XML_FILE_KETTLE_DATABASE_TYPES; static final String XML_FILE_KETTLE_COMPRESSION_PROVIDERS; static final String XML_FILE_KETTLE_AUTHENTICATION_PROVIDERS; static final String XML_FILE_KETTLE_EXTENSION_POINTS; static final String XML_FILE_KETTLE_REGISTRY_EXTENSIONS; static final String XML_FILE_KETTLE_LIFECYCLE_LISTENERS; static final String XML_FILE_KETTLE_ENGINES; static final String KETTLE_TRANS_PAN_JVM_EXIT_CODE; static final String KETTLE_DEFAULT_NUMBER_FORMAT; static final String KETTLE_DEFAULT_BIGNUMBER_FORMAT; static final String KETTLE_DEFAULT_INTEGER_FORMAT; static final String KETTLE_DEFAULT_DATE_FORMAT; static final String KETTLE_AGGREGATION_MIN_NULL_IS_VALUED; static final String KETTLE_AGGREGATION_ALL_NULLS_ARE_ZERO; static final String KETTLE_DEFAULT_TIMESTAMP_FORMAT; static final String KETTLE_SPLIT_FIELDS_REMOVE_ENCLOSURE; static final String KETTLE_GLOBAL_LOG_VARIABLES_CLEAR_ON_EXPORT; static final String KETTLE_COMPATIBILITY_CALCULATION_TIMEZONE_DECOMPOSITION; static final String KETTLE_COMPATIBILITY_SET_ERROR_ON_SPECIFIC_JOB_ENTRIES; static final String KETTLE_COMPATIBILITY_SEND_RESULT_XML_WITH_FULL_STATUS; static final String KETTLE_COMPATIBILITY_SELECT_VALUES_TYPE_CHANGE_USES_TYPE_DEFAULTS; static final String XML_FILE_KETTLE_IMPORT_RULES; static final ReleaseType RELEASE; static final String PENTAHO_METASTORE_FOLDER; static final String PENTAHO_METASTORE_NAME; static final String KETTLE_LOG_MARK_MAPPINGS; static final String KETTLE_CARTE_JETTY_ACCEPTORS; static final String KETTLE_CARTE_JETTY_ACCEPT_QUEUE_SIZE; static final String KETTLE_CARTE_JETTY_RES_MAX_IDLE_TIME; static final String VFS_USER_DIR_IS_ROOT; }
@Test public void testIsEmptyStringArray() { assertTrue( Const.isEmpty( (String[]) null ) ); assertTrue( Const.isEmpty( new String[] {} ) ); assertFalse( Const.isEmpty( new String[] { "test" } ) ); }
@Deprecated public static boolean isEmpty( String val ) { return Utils.isEmpty( val ); }
Const { @Deprecated public static boolean isEmpty( String val ) { return Utils.isEmpty( val ); } }
Const { @Deprecated public static boolean isEmpty( String val ) { return Utils.isEmpty( val ); } }
Const { @Deprecated public static boolean isEmpty( String val ) { return Utils.isEmpty( val ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); }
Const { @Deprecated public static boolean isEmpty( String val ) { return Utils.isEmpty( val ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); @Deprecated static final String VERSION; static final String COPYRIGHT_YEAR; static final int TIMEOUT_GET_MILLIS; static final int TIMEOUT_PUT_MILLIS; static final int ROWS_UPDATE; static final int ROWS_IN_ROWSET; static final int FETCH_SIZE; static final int SORT_SIZE; static final int HEARTBEAT_PERIODIC_INTERVAL_IN_SECS; static final String FILE_SEPARATOR; static final String PATH_SEPARATOR; static final String CR; static final String DOSCR; static final String EMPTY_STRING; static final String JAVA_VERSION; @Deprecated static final String USER_HOME_DIRECTORY; static String JNDI_DIRECTORY; static final String PLUGIN_BASE_FOLDERS_PROP; static final String DEFAULT_PLUGIN_BASE_FOLDERS; static final Date MIN_DATE; static final Date MAX_DATE; static final int MIN_YEAR; static final int MAX_YEAR; static final int RIGHT; static final int LENGTH; static final int MARGIN; static final int MIDDLE_PCT; static final int ARROW_WIDTH; static final int FORM_MARGIN; static final int SHADOW_SIZE; static final int SYMBOLSIZE; static final int MAX_FILE_HIST; static final Locale DEFAULT_LOCALE; static final char DEFAULT_DECIMAL_SEPARATOR; static final char DEFAULT_GROUPING_SEPARATOR; static final String DEFAULT_CURRENCY_SYMBOL; static final String DEFAULT_NUMBER_FORMAT; static final String NULL_STRING; static final String NULL_NUMBER; static final String NULL_DATE; static final String NULL_BIGNUMBER; static final String NULL_BOOLEAN; static final String NULL_INTEGER; static final String NULL_BINARY; static final String NULL_NONE; static final int ROUND_HALF_CEILING; static final String CHEF_LOG_FILE; static final String SPOON_LOG_FILE; static final String MENU_LOG_FILE; static final String GENERALIZED_DATE_TIME_FORMAT; static final String GENERALIZED_DATE_TIME_FORMAT_MILLIS; static final String XML_ENCODING; static final String[] STRING_TRANS_AND_JOB_FILTER_EXT; static final String STRING_TRANS_DEFAULT_EXT; static final String[] STRING_TRANS_FILTER_EXT; static final String STRING_JOB_DEFAULT_EXT; static final String[] STRING_JOB_FILTER_EXT; static final String KETTLE_PROPERTIES; static final String SHARED_DATA_FILE; static final String INTERNAL_VARIABLE_PREFIX; static final String INTERNAL_VARIABLE_KETTLE_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_DATE; static final String INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_FILENAME_NAME; static final String INTERNAL_VARIABLE_JOB_NAME; static final String INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_RUN_ID; static final String INTERNAL_VARIABLE_JOB_RUN_ATTEMPTNR; static final String VARIABLE_HEARTBEAT_PERIODIC_INTERVAL_SECS; static final String VARIABLE_MONITORING_SNMP_TRAPS_ENABLED; static final String INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY; static final String[] INTERNAL_TRANS_VARIABLES; static final String[] INTERNAL_JOB_VARIABLES; static final String[] DEPRECATED_VARIABLES; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_STEP_PARTITION_ID; static final String INTERNAL_VARIABLE_STEP_PARTITION_NR; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NUMBER; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NAME; static final String INTERNAL_VARIABLE_CLUSTER_SIZE; static final String INTERNAL_VARIABLE_STEP_UNIQUE_NUMBER; static final String INTERNAL_VARIABLE_CLUSTER_MASTER; static final String INTERNAL_VARIABLE_CLUSTER_RUN_ID; static final String INTERNAL_VARIABLE_STEP_UNIQUE_COUNT; static final String INTERNAL_VARIABLE_STEP_NAME; static final String INTERNAL_VARIABLE_STEP_COPYNR; static final int MAX_NR_LOG_LINES; static final int MAX_NR_HISTORY_LINES; static final int HISTORY_LINES_FETCH_SIZE; static final int MAX_LOG_LINE_TIMEOUT_MINUTES; static final int WARNING; static final int ERROR; static final int INFO; static final int NOTE_MARGIN; static final int MAX_UNDO; static final String KETTLE_VARIABLES_FILE; static final String KETTLE_LOG_SIZE_LIMIT; static final String KETTLE_TRANS_LOG_DB; static final String KETTLE_TRANS_LOG_SCHEMA; static final String KETTLE_TRANS_LOG_TABLE; static final String KETTLE_JOB_LOG_DB; static final String KETTLE_JOB_LOG_SCHEMA; static final String KETTLE_SLAVE_DETECTION_TIMER; static final String KETTLE_JOB_LOG_TABLE; static final String KETTLE_TRANS_PERFORMANCE_LOG_DB; static final String KETTLE_TRANS_PERFORMANCE_LOG_SCHEMA; static final String KETTLE_TRANS_PERFORMANCE_LOG_TABLE; static final String KETTLE_JOBENTRY_LOG_DB; static final String KETTLE_JOBENTRY_LOG_SCHEMA; static final String KETTLE_JOBENTRY_LOG_TABLE; static final String KETTLE_STEP_LOG_DB; static final String KETTLE_STEP_LOG_SCHEMA; static final String KETTLE_STEP_LOG_TABLE; static final String KETTLE_CHANNEL_LOG_DB; static final String KETTLE_CHANNEL_LOG_SCHEMA; static final String KETTLE_CHANNEL_LOG_TABLE; static final String KETTLE_METRICS_LOG_DB; static final String KETTLE_METRICS_LOG_SCHEMA; static final String KETTLE_METRICS_LOG_TABLE; static final String KETTLE_CHECKPOINT_LOG_DB; static final String KETTLE_CHECKPOINT_LOG_SCHEMA; static final String KETTLE_CHECKPOINT_LOG_TABLE; static final String KETTLE_SHARED_OBJECTS; static final String KETTLE_EMPTY_STRING_DIFFERS_FROM_NULL; static final String KETTLE_LENIENT_STRING_TO_NUMBER_CONVERSION; static final String KETTLE_COMPATIBILITY_DB_IGNORE_TIMEZONE; static final String KETTLE_COMPATIBILITY_IMPORT_PATH_ADDITION_ON_VARIABLES; static final String KETTLE_COMPATIBILITY_IGNORE_TABLE_LOGGING; static final String KETTLE_COMPATIBILITY_TEXT_FILE_OUTPUT_APPEND_NO_HEADER; static final String KETTLE_COMPATIBILITY_MERGE_ROWS_USE_REFERENCE_STREAM_WHEN_IDENTICAL; static final String KETTLE_COMPATIBILITY_MEMORY_GROUP_BY_SUM_AVERAGE_RETURN_NUMBER_TYPE; static final String KETTLE_SYSTEM_HOSTNAME; static final String KETTLE_MAX_LOG_SIZE_IN_LINES; static final String KETTLE_MAX_LOG_TIMEOUT_IN_MINUTES; static final String KETTLE_REDIRECT_STDERR; static final String KETTLE_REDIRECT_STDOUT; static final String KETTLE_CARTE_OBJECT_TIMEOUT_MINUTES; static final String KETTLE_STEP_PERFORMANCE_SNAPSHOT_LIMIT; static final String KETTLE_MAX_JOB_TRACKER_SIZE; static final String KETTLE_MAX_JOB_ENTRIES_LOGGED; static final String KETTLE_MAX_LOGGING_REGISTRY_SIZE; static final String KETTLE_LOG_TAB_REFRESH_DELAY; static final String KETTLE_LOG_TAB_REFRESH_PERIOD; static final String KETTLE_SAP_CONNECTION_FACTORY; static final String KETTLE_SAP_CONNECTION_FACTORY_DEFAULT_NAME; static final String KETTLE_PLUGIN_CLASSES; static final String KETTLE_PLUGIN_PACKAGES; static final String KETTLE_TRANS_ROWSET_SIZE; static final String VERSION_COMMENT_INITIAL_VERSION; static final String VERSION_COMMENT_EDIT_VERSION; static final String XML_FILE_KETTLE_STEPS; static final String KETTLE_CORE_STEPS_FILE; static final String XML_FILE_KETTLE_PARTITION_PLUGINS; static final String KETTLE_CORE_JOBENTRIES_FILE; static final String XML_FILE_KETTLE_SERVLETS; static final String XML_FILE_KETTLE_VALUEMETA_PLUGINS; static final String XML_FILE_KETTLE_PASSWORD_ENCODER_PLUGINS; static final String KETTLE_VALUEMETA_PLUGINS_FILE; static final String KETTLE_PASSWORD_ENCODER_PLUGIN; static final String KETTLE_PASSWORD_ENCODER_PLUGINS_FILE; static final String KETTLE_TWO_WAY_PASSWORD_ENCODER_SEED; static final String XML_FILE_KETTLE_LOGGING_PLUGINS; static final String KETTLE_LOGGING_PLUGINS_FILE; static final String KETTLE_CORE_SERVLETS_FILE; static final String KETTLE_ROWSET_GET_TIMEOUT; static final String KETTLE_ROWSET_PUT_TIMEOUT; static final String KETTLE_BATCHING_ROWSET; static final String KETTLE_DISABLE_CONSOLE_LOGGING; static final String XML_FILE_KETTLE_JOB_ENTRIES; static final String XML_FILE_KETTLE_REPOSITORIES; static final String XML_FILE_KETTLE_DATABASE_TYPES; static final String XML_FILE_KETTLE_COMPRESSION_PROVIDERS; static final String XML_FILE_KETTLE_AUTHENTICATION_PROVIDERS; static final String XML_FILE_KETTLE_EXTENSION_POINTS; static final String XML_FILE_KETTLE_REGISTRY_EXTENSIONS; static final String XML_FILE_KETTLE_LIFECYCLE_LISTENERS; static final String XML_FILE_KETTLE_ENGINES; static final String KETTLE_TRANS_PAN_JVM_EXIT_CODE; static final String KETTLE_DEFAULT_NUMBER_FORMAT; static final String KETTLE_DEFAULT_BIGNUMBER_FORMAT; static final String KETTLE_DEFAULT_INTEGER_FORMAT; static final String KETTLE_DEFAULT_DATE_FORMAT; static final String KETTLE_AGGREGATION_MIN_NULL_IS_VALUED; static final String KETTLE_AGGREGATION_ALL_NULLS_ARE_ZERO; static final String KETTLE_DEFAULT_TIMESTAMP_FORMAT; static final String KETTLE_SPLIT_FIELDS_REMOVE_ENCLOSURE; static final String KETTLE_GLOBAL_LOG_VARIABLES_CLEAR_ON_EXPORT; static final String KETTLE_COMPATIBILITY_CALCULATION_TIMEZONE_DECOMPOSITION; static final String KETTLE_COMPATIBILITY_SET_ERROR_ON_SPECIFIC_JOB_ENTRIES; static final String KETTLE_COMPATIBILITY_SEND_RESULT_XML_WITH_FULL_STATUS; static final String KETTLE_COMPATIBILITY_SELECT_VALUES_TYPE_CHANGE_USES_TYPE_DEFAULTS; static final String XML_FILE_KETTLE_IMPORT_RULES; static final ReleaseType RELEASE; static final String PENTAHO_METASTORE_FOLDER; static final String PENTAHO_METASTORE_NAME; static final String KETTLE_LOG_MARK_MAPPINGS; static final String KETTLE_CARTE_JETTY_ACCEPTORS; static final String KETTLE_CARTE_JETTY_ACCEPT_QUEUE_SIZE; static final String KETTLE_CARTE_JETTY_RES_MAX_IDLE_TIME; static final String VFS_USER_DIR_IS_ROOT; }
@Test public void simpleConvert() { TransMeta meta = new TransMeta(); meta.setFilename( "fileName" ); meta.addStep( new StepMeta( "stepName", stepMetaInterface ) ); Transformation trans = TransMetaConverter.convert( meta ); assertThat( trans.getId(), is( meta.getFilename() ) ); assertThat( trans.getOperations().size(), is( 1 ) ); assertThat( trans.getOperations().get( 0 ).getId(), is( "stepName" ) ); }
public static Transformation convert( TransMeta transMeta ) { final org.pentaho.di.engine.model.Transformation transformation = new org.pentaho.di.engine.model.Transformation( createTransformationId( transMeta ) ); try { TransMeta copyTransMeta = (TransMeta) transMeta.realClone( false ); cleanupDisabledHops( copyTransMeta ); disableLazyConversion( copyTransMeta ); searchAndReplaceHadoopClusterWithFileSystemURL( copyTransMeta ); copyTransMeta.getSteps().forEach( createOperation( transformation ) ); findHops( copyTransMeta, hop -> true ).forEach( createHop( transformation ) ); transformation.setConfig( TRANS_META_CONF_KEY, copyTransMeta.getXML() ); transformation.setConfig( TRANS_META_NAME_CONF_KEY, Optional.ofNullable( transMeta.getName() ).orElse( TRANS_DEFAULT_NAME ) ); Map<String, Transformation> subTransformations = copyTransMeta.getResourceDependencies().stream() .flatMap( resourceReference -> resourceReference.getEntries().stream() ) .filter( entry -> ResourceEntry.ResourceType.ACTIONFILE.equals( entry.getResourcetype() ) ) .collect( toMap( ResourceEntry::getResource, entry -> { try { return convert( new TransMeta( entry.getResource(), copyTransMeta.getParentVariableSpace() ) ); } catch ( KettleXMLException | KettleMissingPluginsException e ) { throw new RuntimeException( e ); } } ) ); transformation.setConfig( SUB_TRANSFORMATIONS_KEY, (Serializable) subTransformations ); } catch ( KettleException e ) { Throwables.propagate( e ); } return transformation; }
TransMetaConverter { public static Transformation convert( TransMeta transMeta ) { final org.pentaho.di.engine.model.Transformation transformation = new org.pentaho.di.engine.model.Transformation( createTransformationId( transMeta ) ); try { TransMeta copyTransMeta = (TransMeta) transMeta.realClone( false ); cleanupDisabledHops( copyTransMeta ); disableLazyConversion( copyTransMeta ); searchAndReplaceHadoopClusterWithFileSystemURL( copyTransMeta ); copyTransMeta.getSteps().forEach( createOperation( transformation ) ); findHops( copyTransMeta, hop -> true ).forEach( createHop( transformation ) ); transformation.setConfig( TRANS_META_CONF_KEY, copyTransMeta.getXML() ); transformation.setConfig( TRANS_META_NAME_CONF_KEY, Optional.ofNullable( transMeta.getName() ).orElse( TRANS_DEFAULT_NAME ) ); Map<String, Transformation> subTransformations = copyTransMeta.getResourceDependencies().stream() .flatMap( resourceReference -> resourceReference.getEntries().stream() ) .filter( entry -> ResourceEntry.ResourceType.ACTIONFILE.equals( entry.getResourcetype() ) ) .collect( toMap( ResourceEntry::getResource, entry -> { try { return convert( new TransMeta( entry.getResource(), copyTransMeta.getParentVariableSpace() ) ); } catch ( KettleXMLException | KettleMissingPluginsException e ) { throw new RuntimeException( e ); } } ) ); transformation.setConfig( SUB_TRANSFORMATIONS_KEY, (Serializable) subTransformations ); } catch ( KettleException e ) { Throwables.propagate( e ); } return transformation; } }
TransMetaConverter { public static Transformation convert( TransMeta transMeta ) { final org.pentaho.di.engine.model.Transformation transformation = new org.pentaho.di.engine.model.Transformation( createTransformationId( transMeta ) ); try { TransMeta copyTransMeta = (TransMeta) transMeta.realClone( false ); cleanupDisabledHops( copyTransMeta ); disableLazyConversion( copyTransMeta ); searchAndReplaceHadoopClusterWithFileSystemURL( copyTransMeta ); copyTransMeta.getSteps().forEach( createOperation( transformation ) ); findHops( copyTransMeta, hop -> true ).forEach( createHop( transformation ) ); transformation.setConfig( TRANS_META_CONF_KEY, copyTransMeta.getXML() ); transformation.setConfig( TRANS_META_NAME_CONF_KEY, Optional.ofNullable( transMeta.getName() ).orElse( TRANS_DEFAULT_NAME ) ); Map<String, Transformation> subTransformations = copyTransMeta.getResourceDependencies().stream() .flatMap( resourceReference -> resourceReference.getEntries().stream() ) .filter( entry -> ResourceEntry.ResourceType.ACTIONFILE.equals( entry.getResourcetype() ) ) .collect( toMap( ResourceEntry::getResource, entry -> { try { return convert( new TransMeta( entry.getResource(), copyTransMeta.getParentVariableSpace() ) ); } catch ( KettleXMLException | KettleMissingPluginsException e ) { throw new RuntimeException( e ); } } ) ); transformation.setConfig( SUB_TRANSFORMATIONS_KEY, (Serializable) subTransformations ); } catch ( KettleException e ) { Throwables.propagate( e ); } return transformation; } }
TransMetaConverter { public static Transformation convert( TransMeta transMeta ) { final org.pentaho.di.engine.model.Transformation transformation = new org.pentaho.di.engine.model.Transformation( createTransformationId( transMeta ) ); try { TransMeta copyTransMeta = (TransMeta) transMeta.realClone( false ); cleanupDisabledHops( copyTransMeta ); disableLazyConversion( copyTransMeta ); searchAndReplaceHadoopClusterWithFileSystemURL( copyTransMeta ); copyTransMeta.getSteps().forEach( createOperation( transformation ) ); findHops( copyTransMeta, hop -> true ).forEach( createHop( transformation ) ); transformation.setConfig( TRANS_META_CONF_KEY, copyTransMeta.getXML() ); transformation.setConfig( TRANS_META_NAME_CONF_KEY, Optional.ofNullable( transMeta.getName() ).orElse( TRANS_DEFAULT_NAME ) ); Map<String, Transformation> subTransformations = copyTransMeta.getResourceDependencies().stream() .flatMap( resourceReference -> resourceReference.getEntries().stream() ) .filter( entry -> ResourceEntry.ResourceType.ACTIONFILE.equals( entry.getResourcetype() ) ) .collect( toMap( ResourceEntry::getResource, entry -> { try { return convert( new TransMeta( entry.getResource(), copyTransMeta.getParentVariableSpace() ) ); } catch ( KettleXMLException | KettleMissingPluginsException e ) { throw new RuntimeException( e ); } } ) ); transformation.setConfig( SUB_TRANSFORMATIONS_KEY, (Serializable) subTransformations ); } catch ( KettleException e ) { Throwables.propagate( e ); } return transformation; } static Transformation convert( TransMeta transMeta ); }
TransMetaConverter { public static Transformation convert( TransMeta transMeta ) { final org.pentaho.di.engine.model.Transformation transformation = new org.pentaho.di.engine.model.Transformation( createTransformationId( transMeta ) ); try { TransMeta copyTransMeta = (TransMeta) transMeta.realClone( false ); cleanupDisabledHops( copyTransMeta ); disableLazyConversion( copyTransMeta ); searchAndReplaceHadoopClusterWithFileSystemURL( copyTransMeta ); copyTransMeta.getSteps().forEach( createOperation( transformation ) ); findHops( copyTransMeta, hop -> true ).forEach( createHop( transformation ) ); transformation.setConfig( TRANS_META_CONF_KEY, copyTransMeta.getXML() ); transformation.setConfig( TRANS_META_NAME_CONF_KEY, Optional.ofNullable( transMeta.getName() ).orElse( TRANS_DEFAULT_NAME ) ); Map<String, Transformation> subTransformations = copyTransMeta.getResourceDependencies().stream() .flatMap( resourceReference -> resourceReference.getEntries().stream() ) .filter( entry -> ResourceEntry.ResourceType.ACTIONFILE.equals( entry.getResourcetype() ) ) .collect( toMap( ResourceEntry::getResource, entry -> { try { return convert( new TransMeta( entry.getResource(), copyTransMeta.getParentVariableSpace() ) ); } catch ( KettleXMLException | KettleMissingPluginsException e ) { throw new RuntimeException( e ); } } ) ); transformation.setConfig( SUB_TRANSFORMATIONS_KEY, (Serializable) subTransformations ); } catch ( KettleException e ) { Throwables.propagate( e ); } return transformation; } static Transformation convert( TransMeta transMeta ); static final String TRANS_META_CONF_KEY; static final String TRANS_META_NAME_CONF_KEY; static final String SUB_TRANSFORMATIONS_KEY; static final String STEP_META_CONF_KEY; static final String TRANS_DEFAULT_NAME; }
@Test public void testIsEmptyObjectArray() { assertTrue( Const.isEmpty( (Object[]) null ) ); assertTrue( Const.isEmpty( new Object[] {} ) ); assertFalse( Const.isEmpty( new Object[] { "test" } ) ); }
@Deprecated public static boolean isEmpty( String val ) { return Utils.isEmpty( val ); }
Const { @Deprecated public static boolean isEmpty( String val ) { return Utils.isEmpty( val ); } }
Const { @Deprecated public static boolean isEmpty( String val ) { return Utils.isEmpty( val ); } }
Const { @Deprecated public static boolean isEmpty( String val ) { return Utils.isEmpty( val ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); }
Const { @Deprecated public static boolean isEmpty( String val ) { return Utils.isEmpty( val ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); @Deprecated static final String VERSION; static final String COPYRIGHT_YEAR; static final int TIMEOUT_GET_MILLIS; static final int TIMEOUT_PUT_MILLIS; static final int ROWS_UPDATE; static final int ROWS_IN_ROWSET; static final int FETCH_SIZE; static final int SORT_SIZE; static final int HEARTBEAT_PERIODIC_INTERVAL_IN_SECS; static final String FILE_SEPARATOR; static final String PATH_SEPARATOR; static final String CR; static final String DOSCR; static final String EMPTY_STRING; static final String JAVA_VERSION; @Deprecated static final String USER_HOME_DIRECTORY; static String JNDI_DIRECTORY; static final String PLUGIN_BASE_FOLDERS_PROP; static final String DEFAULT_PLUGIN_BASE_FOLDERS; static final Date MIN_DATE; static final Date MAX_DATE; static final int MIN_YEAR; static final int MAX_YEAR; static final int RIGHT; static final int LENGTH; static final int MARGIN; static final int MIDDLE_PCT; static final int ARROW_WIDTH; static final int FORM_MARGIN; static final int SHADOW_SIZE; static final int SYMBOLSIZE; static final int MAX_FILE_HIST; static final Locale DEFAULT_LOCALE; static final char DEFAULT_DECIMAL_SEPARATOR; static final char DEFAULT_GROUPING_SEPARATOR; static final String DEFAULT_CURRENCY_SYMBOL; static final String DEFAULT_NUMBER_FORMAT; static final String NULL_STRING; static final String NULL_NUMBER; static final String NULL_DATE; static final String NULL_BIGNUMBER; static final String NULL_BOOLEAN; static final String NULL_INTEGER; static final String NULL_BINARY; static final String NULL_NONE; static final int ROUND_HALF_CEILING; static final String CHEF_LOG_FILE; static final String SPOON_LOG_FILE; static final String MENU_LOG_FILE; static final String GENERALIZED_DATE_TIME_FORMAT; static final String GENERALIZED_DATE_TIME_FORMAT_MILLIS; static final String XML_ENCODING; static final String[] STRING_TRANS_AND_JOB_FILTER_EXT; static final String STRING_TRANS_DEFAULT_EXT; static final String[] STRING_TRANS_FILTER_EXT; static final String STRING_JOB_DEFAULT_EXT; static final String[] STRING_JOB_FILTER_EXT; static final String KETTLE_PROPERTIES; static final String SHARED_DATA_FILE; static final String INTERNAL_VARIABLE_PREFIX; static final String INTERNAL_VARIABLE_KETTLE_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_DATE; static final String INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_FILENAME_NAME; static final String INTERNAL_VARIABLE_JOB_NAME; static final String INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_RUN_ID; static final String INTERNAL_VARIABLE_JOB_RUN_ATTEMPTNR; static final String VARIABLE_HEARTBEAT_PERIODIC_INTERVAL_SECS; static final String VARIABLE_MONITORING_SNMP_TRAPS_ENABLED; static final String INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY; static final String[] INTERNAL_TRANS_VARIABLES; static final String[] INTERNAL_JOB_VARIABLES; static final String[] DEPRECATED_VARIABLES; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_STEP_PARTITION_ID; static final String INTERNAL_VARIABLE_STEP_PARTITION_NR; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NUMBER; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NAME; static final String INTERNAL_VARIABLE_CLUSTER_SIZE; static final String INTERNAL_VARIABLE_STEP_UNIQUE_NUMBER; static final String INTERNAL_VARIABLE_CLUSTER_MASTER; static final String INTERNAL_VARIABLE_CLUSTER_RUN_ID; static final String INTERNAL_VARIABLE_STEP_UNIQUE_COUNT; static final String INTERNAL_VARIABLE_STEP_NAME; static final String INTERNAL_VARIABLE_STEP_COPYNR; static final int MAX_NR_LOG_LINES; static final int MAX_NR_HISTORY_LINES; static final int HISTORY_LINES_FETCH_SIZE; static final int MAX_LOG_LINE_TIMEOUT_MINUTES; static final int WARNING; static final int ERROR; static final int INFO; static final int NOTE_MARGIN; static final int MAX_UNDO; static final String KETTLE_VARIABLES_FILE; static final String KETTLE_LOG_SIZE_LIMIT; static final String KETTLE_TRANS_LOG_DB; static final String KETTLE_TRANS_LOG_SCHEMA; static final String KETTLE_TRANS_LOG_TABLE; static final String KETTLE_JOB_LOG_DB; static final String KETTLE_JOB_LOG_SCHEMA; static final String KETTLE_SLAVE_DETECTION_TIMER; static final String KETTLE_JOB_LOG_TABLE; static final String KETTLE_TRANS_PERFORMANCE_LOG_DB; static final String KETTLE_TRANS_PERFORMANCE_LOG_SCHEMA; static final String KETTLE_TRANS_PERFORMANCE_LOG_TABLE; static final String KETTLE_JOBENTRY_LOG_DB; static final String KETTLE_JOBENTRY_LOG_SCHEMA; static final String KETTLE_JOBENTRY_LOG_TABLE; static final String KETTLE_STEP_LOG_DB; static final String KETTLE_STEP_LOG_SCHEMA; static final String KETTLE_STEP_LOG_TABLE; static final String KETTLE_CHANNEL_LOG_DB; static final String KETTLE_CHANNEL_LOG_SCHEMA; static final String KETTLE_CHANNEL_LOG_TABLE; static final String KETTLE_METRICS_LOG_DB; static final String KETTLE_METRICS_LOG_SCHEMA; static final String KETTLE_METRICS_LOG_TABLE; static final String KETTLE_CHECKPOINT_LOG_DB; static final String KETTLE_CHECKPOINT_LOG_SCHEMA; static final String KETTLE_CHECKPOINT_LOG_TABLE; static final String KETTLE_SHARED_OBJECTS; static final String KETTLE_EMPTY_STRING_DIFFERS_FROM_NULL; static final String KETTLE_LENIENT_STRING_TO_NUMBER_CONVERSION; static final String KETTLE_COMPATIBILITY_DB_IGNORE_TIMEZONE; static final String KETTLE_COMPATIBILITY_IMPORT_PATH_ADDITION_ON_VARIABLES; static final String KETTLE_COMPATIBILITY_IGNORE_TABLE_LOGGING; static final String KETTLE_COMPATIBILITY_TEXT_FILE_OUTPUT_APPEND_NO_HEADER; static final String KETTLE_COMPATIBILITY_MERGE_ROWS_USE_REFERENCE_STREAM_WHEN_IDENTICAL; static final String KETTLE_COMPATIBILITY_MEMORY_GROUP_BY_SUM_AVERAGE_RETURN_NUMBER_TYPE; static final String KETTLE_SYSTEM_HOSTNAME; static final String KETTLE_MAX_LOG_SIZE_IN_LINES; static final String KETTLE_MAX_LOG_TIMEOUT_IN_MINUTES; static final String KETTLE_REDIRECT_STDERR; static final String KETTLE_REDIRECT_STDOUT; static final String KETTLE_CARTE_OBJECT_TIMEOUT_MINUTES; static final String KETTLE_STEP_PERFORMANCE_SNAPSHOT_LIMIT; static final String KETTLE_MAX_JOB_TRACKER_SIZE; static final String KETTLE_MAX_JOB_ENTRIES_LOGGED; static final String KETTLE_MAX_LOGGING_REGISTRY_SIZE; static final String KETTLE_LOG_TAB_REFRESH_DELAY; static final String KETTLE_LOG_TAB_REFRESH_PERIOD; static final String KETTLE_SAP_CONNECTION_FACTORY; static final String KETTLE_SAP_CONNECTION_FACTORY_DEFAULT_NAME; static final String KETTLE_PLUGIN_CLASSES; static final String KETTLE_PLUGIN_PACKAGES; static final String KETTLE_TRANS_ROWSET_SIZE; static final String VERSION_COMMENT_INITIAL_VERSION; static final String VERSION_COMMENT_EDIT_VERSION; static final String XML_FILE_KETTLE_STEPS; static final String KETTLE_CORE_STEPS_FILE; static final String XML_FILE_KETTLE_PARTITION_PLUGINS; static final String KETTLE_CORE_JOBENTRIES_FILE; static final String XML_FILE_KETTLE_SERVLETS; static final String XML_FILE_KETTLE_VALUEMETA_PLUGINS; static final String XML_FILE_KETTLE_PASSWORD_ENCODER_PLUGINS; static final String KETTLE_VALUEMETA_PLUGINS_FILE; static final String KETTLE_PASSWORD_ENCODER_PLUGIN; static final String KETTLE_PASSWORD_ENCODER_PLUGINS_FILE; static final String KETTLE_TWO_WAY_PASSWORD_ENCODER_SEED; static final String XML_FILE_KETTLE_LOGGING_PLUGINS; static final String KETTLE_LOGGING_PLUGINS_FILE; static final String KETTLE_CORE_SERVLETS_FILE; static final String KETTLE_ROWSET_GET_TIMEOUT; static final String KETTLE_ROWSET_PUT_TIMEOUT; static final String KETTLE_BATCHING_ROWSET; static final String KETTLE_DISABLE_CONSOLE_LOGGING; static final String XML_FILE_KETTLE_JOB_ENTRIES; static final String XML_FILE_KETTLE_REPOSITORIES; static final String XML_FILE_KETTLE_DATABASE_TYPES; static final String XML_FILE_KETTLE_COMPRESSION_PROVIDERS; static final String XML_FILE_KETTLE_AUTHENTICATION_PROVIDERS; static final String XML_FILE_KETTLE_EXTENSION_POINTS; static final String XML_FILE_KETTLE_REGISTRY_EXTENSIONS; static final String XML_FILE_KETTLE_LIFECYCLE_LISTENERS; static final String XML_FILE_KETTLE_ENGINES; static final String KETTLE_TRANS_PAN_JVM_EXIT_CODE; static final String KETTLE_DEFAULT_NUMBER_FORMAT; static final String KETTLE_DEFAULT_BIGNUMBER_FORMAT; static final String KETTLE_DEFAULT_INTEGER_FORMAT; static final String KETTLE_DEFAULT_DATE_FORMAT; static final String KETTLE_AGGREGATION_MIN_NULL_IS_VALUED; static final String KETTLE_AGGREGATION_ALL_NULLS_ARE_ZERO; static final String KETTLE_DEFAULT_TIMESTAMP_FORMAT; static final String KETTLE_SPLIT_FIELDS_REMOVE_ENCLOSURE; static final String KETTLE_GLOBAL_LOG_VARIABLES_CLEAR_ON_EXPORT; static final String KETTLE_COMPATIBILITY_CALCULATION_TIMEZONE_DECOMPOSITION; static final String KETTLE_COMPATIBILITY_SET_ERROR_ON_SPECIFIC_JOB_ENTRIES; static final String KETTLE_COMPATIBILITY_SEND_RESULT_XML_WITH_FULL_STATUS; static final String KETTLE_COMPATIBILITY_SELECT_VALUES_TYPE_CHANGE_USES_TYPE_DEFAULTS; static final String XML_FILE_KETTLE_IMPORT_RULES; static final ReleaseType RELEASE; static final String PENTAHO_METASTORE_FOLDER; static final String PENTAHO_METASTORE_NAME; static final String KETTLE_LOG_MARK_MAPPINGS; static final String KETTLE_CARTE_JETTY_ACCEPTORS; static final String KETTLE_CARTE_JETTY_ACCEPT_QUEUE_SIZE; static final String KETTLE_CARTE_JETTY_RES_MAX_IDLE_TIME; static final String VFS_USER_DIR_IS_ROOT; }
@Test public void testIsEmptyList() { assertTrue( Const.isEmpty( (List) null ) ); assertTrue( Const.isEmpty( new ArrayList() ) ); assertFalse( Const.isEmpty( Arrays.asList( "test", 1 ) ) ); }
@Deprecated public static boolean isEmpty( String val ) { return Utils.isEmpty( val ); }
Const { @Deprecated public static boolean isEmpty( String val ) { return Utils.isEmpty( val ); } }
Const { @Deprecated public static boolean isEmpty( String val ) { return Utils.isEmpty( val ); } }
Const { @Deprecated public static boolean isEmpty( String val ) { return Utils.isEmpty( val ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); }
Const { @Deprecated public static boolean isEmpty( String val ) { return Utils.isEmpty( val ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); @Deprecated static final String VERSION; static final String COPYRIGHT_YEAR; static final int TIMEOUT_GET_MILLIS; static final int TIMEOUT_PUT_MILLIS; static final int ROWS_UPDATE; static final int ROWS_IN_ROWSET; static final int FETCH_SIZE; static final int SORT_SIZE; static final int HEARTBEAT_PERIODIC_INTERVAL_IN_SECS; static final String FILE_SEPARATOR; static final String PATH_SEPARATOR; static final String CR; static final String DOSCR; static final String EMPTY_STRING; static final String JAVA_VERSION; @Deprecated static final String USER_HOME_DIRECTORY; static String JNDI_DIRECTORY; static final String PLUGIN_BASE_FOLDERS_PROP; static final String DEFAULT_PLUGIN_BASE_FOLDERS; static final Date MIN_DATE; static final Date MAX_DATE; static final int MIN_YEAR; static final int MAX_YEAR; static final int RIGHT; static final int LENGTH; static final int MARGIN; static final int MIDDLE_PCT; static final int ARROW_WIDTH; static final int FORM_MARGIN; static final int SHADOW_SIZE; static final int SYMBOLSIZE; static final int MAX_FILE_HIST; static final Locale DEFAULT_LOCALE; static final char DEFAULT_DECIMAL_SEPARATOR; static final char DEFAULT_GROUPING_SEPARATOR; static final String DEFAULT_CURRENCY_SYMBOL; static final String DEFAULT_NUMBER_FORMAT; static final String NULL_STRING; static final String NULL_NUMBER; static final String NULL_DATE; static final String NULL_BIGNUMBER; static final String NULL_BOOLEAN; static final String NULL_INTEGER; static final String NULL_BINARY; static final String NULL_NONE; static final int ROUND_HALF_CEILING; static final String CHEF_LOG_FILE; static final String SPOON_LOG_FILE; static final String MENU_LOG_FILE; static final String GENERALIZED_DATE_TIME_FORMAT; static final String GENERALIZED_DATE_TIME_FORMAT_MILLIS; static final String XML_ENCODING; static final String[] STRING_TRANS_AND_JOB_FILTER_EXT; static final String STRING_TRANS_DEFAULT_EXT; static final String[] STRING_TRANS_FILTER_EXT; static final String STRING_JOB_DEFAULT_EXT; static final String[] STRING_JOB_FILTER_EXT; static final String KETTLE_PROPERTIES; static final String SHARED_DATA_FILE; static final String INTERNAL_VARIABLE_PREFIX; static final String INTERNAL_VARIABLE_KETTLE_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_DATE; static final String INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_FILENAME_NAME; static final String INTERNAL_VARIABLE_JOB_NAME; static final String INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_RUN_ID; static final String INTERNAL_VARIABLE_JOB_RUN_ATTEMPTNR; static final String VARIABLE_HEARTBEAT_PERIODIC_INTERVAL_SECS; static final String VARIABLE_MONITORING_SNMP_TRAPS_ENABLED; static final String INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY; static final String[] INTERNAL_TRANS_VARIABLES; static final String[] INTERNAL_JOB_VARIABLES; static final String[] DEPRECATED_VARIABLES; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_STEP_PARTITION_ID; static final String INTERNAL_VARIABLE_STEP_PARTITION_NR; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NUMBER; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NAME; static final String INTERNAL_VARIABLE_CLUSTER_SIZE; static final String INTERNAL_VARIABLE_STEP_UNIQUE_NUMBER; static final String INTERNAL_VARIABLE_CLUSTER_MASTER; static final String INTERNAL_VARIABLE_CLUSTER_RUN_ID; static final String INTERNAL_VARIABLE_STEP_UNIQUE_COUNT; static final String INTERNAL_VARIABLE_STEP_NAME; static final String INTERNAL_VARIABLE_STEP_COPYNR; static final int MAX_NR_LOG_LINES; static final int MAX_NR_HISTORY_LINES; static final int HISTORY_LINES_FETCH_SIZE; static final int MAX_LOG_LINE_TIMEOUT_MINUTES; static final int WARNING; static final int ERROR; static final int INFO; static final int NOTE_MARGIN; static final int MAX_UNDO; static final String KETTLE_VARIABLES_FILE; static final String KETTLE_LOG_SIZE_LIMIT; static final String KETTLE_TRANS_LOG_DB; static final String KETTLE_TRANS_LOG_SCHEMA; static final String KETTLE_TRANS_LOG_TABLE; static final String KETTLE_JOB_LOG_DB; static final String KETTLE_JOB_LOG_SCHEMA; static final String KETTLE_SLAVE_DETECTION_TIMER; static final String KETTLE_JOB_LOG_TABLE; static final String KETTLE_TRANS_PERFORMANCE_LOG_DB; static final String KETTLE_TRANS_PERFORMANCE_LOG_SCHEMA; static final String KETTLE_TRANS_PERFORMANCE_LOG_TABLE; static final String KETTLE_JOBENTRY_LOG_DB; static final String KETTLE_JOBENTRY_LOG_SCHEMA; static final String KETTLE_JOBENTRY_LOG_TABLE; static final String KETTLE_STEP_LOG_DB; static final String KETTLE_STEP_LOG_SCHEMA; static final String KETTLE_STEP_LOG_TABLE; static final String KETTLE_CHANNEL_LOG_DB; static final String KETTLE_CHANNEL_LOG_SCHEMA; static final String KETTLE_CHANNEL_LOG_TABLE; static final String KETTLE_METRICS_LOG_DB; static final String KETTLE_METRICS_LOG_SCHEMA; static final String KETTLE_METRICS_LOG_TABLE; static final String KETTLE_CHECKPOINT_LOG_DB; static final String KETTLE_CHECKPOINT_LOG_SCHEMA; static final String KETTLE_CHECKPOINT_LOG_TABLE; static final String KETTLE_SHARED_OBJECTS; static final String KETTLE_EMPTY_STRING_DIFFERS_FROM_NULL; static final String KETTLE_LENIENT_STRING_TO_NUMBER_CONVERSION; static final String KETTLE_COMPATIBILITY_DB_IGNORE_TIMEZONE; static final String KETTLE_COMPATIBILITY_IMPORT_PATH_ADDITION_ON_VARIABLES; static final String KETTLE_COMPATIBILITY_IGNORE_TABLE_LOGGING; static final String KETTLE_COMPATIBILITY_TEXT_FILE_OUTPUT_APPEND_NO_HEADER; static final String KETTLE_COMPATIBILITY_MERGE_ROWS_USE_REFERENCE_STREAM_WHEN_IDENTICAL; static final String KETTLE_COMPATIBILITY_MEMORY_GROUP_BY_SUM_AVERAGE_RETURN_NUMBER_TYPE; static final String KETTLE_SYSTEM_HOSTNAME; static final String KETTLE_MAX_LOG_SIZE_IN_LINES; static final String KETTLE_MAX_LOG_TIMEOUT_IN_MINUTES; static final String KETTLE_REDIRECT_STDERR; static final String KETTLE_REDIRECT_STDOUT; static final String KETTLE_CARTE_OBJECT_TIMEOUT_MINUTES; static final String KETTLE_STEP_PERFORMANCE_SNAPSHOT_LIMIT; static final String KETTLE_MAX_JOB_TRACKER_SIZE; static final String KETTLE_MAX_JOB_ENTRIES_LOGGED; static final String KETTLE_MAX_LOGGING_REGISTRY_SIZE; static final String KETTLE_LOG_TAB_REFRESH_DELAY; static final String KETTLE_LOG_TAB_REFRESH_PERIOD; static final String KETTLE_SAP_CONNECTION_FACTORY; static final String KETTLE_SAP_CONNECTION_FACTORY_DEFAULT_NAME; static final String KETTLE_PLUGIN_CLASSES; static final String KETTLE_PLUGIN_PACKAGES; static final String KETTLE_TRANS_ROWSET_SIZE; static final String VERSION_COMMENT_INITIAL_VERSION; static final String VERSION_COMMENT_EDIT_VERSION; static final String XML_FILE_KETTLE_STEPS; static final String KETTLE_CORE_STEPS_FILE; static final String XML_FILE_KETTLE_PARTITION_PLUGINS; static final String KETTLE_CORE_JOBENTRIES_FILE; static final String XML_FILE_KETTLE_SERVLETS; static final String XML_FILE_KETTLE_VALUEMETA_PLUGINS; static final String XML_FILE_KETTLE_PASSWORD_ENCODER_PLUGINS; static final String KETTLE_VALUEMETA_PLUGINS_FILE; static final String KETTLE_PASSWORD_ENCODER_PLUGIN; static final String KETTLE_PASSWORD_ENCODER_PLUGINS_FILE; static final String KETTLE_TWO_WAY_PASSWORD_ENCODER_SEED; static final String XML_FILE_KETTLE_LOGGING_PLUGINS; static final String KETTLE_LOGGING_PLUGINS_FILE; static final String KETTLE_CORE_SERVLETS_FILE; static final String KETTLE_ROWSET_GET_TIMEOUT; static final String KETTLE_ROWSET_PUT_TIMEOUT; static final String KETTLE_BATCHING_ROWSET; static final String KETTLE_DISABLE_CONSOLE_LOGGING; static final String XML_FILE_KETTLE_JOB_ENTRIES; static final String XML_FILE_KETTLE_REPOSITORIES; static final String XML_FILE_KETTLE_DATABASE_TYPES; static final String XML_FILE_KETTLE_COMPRESSION_PROVIDERS; static final String XML_FILE_KETTLE_AUTHENTICATION_PROVIDERS; static final String XML_FILE_KETTLE_EXTENSION_POINTS; static final String XML_FILE_KETTLE_REGISTRY_EXTENSIONS; static final String XML_FILE_KETTLE_LIFECYCLE_LISTENERS; static final String XML_FILE_KETTLE_ENGINES; static final String KETTLE_TRANS_PAN_JVM_EXIT_CODE; static final String KETTLE_DEFAULT_NUMBER_FORMAT; static final String KETTLE_DEFAULT_BIGNUMBER_FORMAT; static final String KETTLE_DEFAULT_INTEGER_FORMAT; static final String KETTLE_DEFAULT_DATE_FORMAT; static final String KETTLE_AGGREGATION_MIN_NULL_IS_VALUED; static final String KETTLE_AGGREGATION_ALL_NULLS_ARE_ZERO; static final String KETTLE_DEFAULT_TIMESTAMP_FORMAT; static final String KETTLE_SPLIT_FIELDS_REMOVE_ENCLOSURE; static final String KETTLE_GLOBAL_LOG_VARIABLES_CLEAR_ON_EXPORT; static final String KETTLE_COMPATIBILITY_CALCULATION_TIMEZONE_DECOMPOSITION; static final String KETTLE_COMPATIBILITY_SET_ERROR_ON_SPECIFIC_JOB_ENTRIES; static final String KETTLE_COMPATIBILITY_SEND_RESULT_XML_WITH_FULL_STATUS; static final String KETTLE_COMPATIBILITY_SELECT_VALUES_TYPE_CHANGE_USES_TYPE_DEFAULTS; static final String XML_FILE_KETTLE_IMPORT_RULES; static final ReleaseType RELEASE; static final String PENTAHO_METASTORE_FOLDER; static final String PENTAHO_METASTORE_NAME; static final String KETTLE_LOG_MARK_MAPPINGS; static final String KETTLE_CARTE_JETTY_ACCEPTORS; static final String KETTLE_CARTE_JETTY_ACCEPT_QUEUE_SIZE; static final String KETTLE_CARTE_JETTY_RES_MAX_IDLE_TIME; static final String VFS_USER_DIR_IS_ROOT; }
@Test public void testIsEmptyStringBuffer() { assertTrue( Const.isEmpty( (StringBuffer) null ) ); assertTrue( Const.isEmpty( new StringBuffer( "" ) ) ); assertFalse( Const.isEmpty( new StringBuffer( "test" ) ) ); }
@Deprecated public static boolean isEmpty( String val ) { return Utils.isEmpty( val ); }
Const { @Deprecated public static boolean isEmpty( String val ) { return Utils.isEmpty( val ); } }
Const { @Deprecated public static boolean isEmpty( String val ) { return Utils.isEmpty( val ); } }
Const { @Deprecated public static boolean isEmpty( String val ) { return Utils.isEmpty( val ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); }
Const { @Deprecated public static boolean isEmpty( String val ) { return Utils.isEmpty( val ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); @Deprecated static final String VERSION; static final String COPYRIGHT_YEAR; static final int TIMEOUT_GET_MILLIS; static final int TIMEOUT_PUT_MILLIS; static final int ROWS_UPDATE; static final int ROWS_IN_ROWSET; static final int FETCH_SIZE; static final int SORT_SIZE; static final int HEARTBEAT_PERIODIC_INTERVAL_IN_SECS; static final String FILE_SEPARATOR; static final String PATH_SEPARATOR; static final String CR; static final String DOSCR; static final String EMPTY_STRING; static final String JAVA_VERSION; @Deprecated static final String USER_HOME_DIRECTORY; static String JNDI_DIRECTORY; static final String PLUGIN_BASE_FOLDERS_PROP; static final String DEFAULT_PLUGIN_BASE_FOLDERS; static final Date MIN_DATE; static final Date MAX_DATE; static final int MIN_YEAR; static final int MAX_YEAR; static final int RIGHT; static final int LENGTH; static final int MARGIN; static final int MIDDLE_PCT; static final int ARROW_WIDTH; static final int FORM_MARGIN; static final int SHADOW_SIZE; static final int SYMBOLSIZE; static final int MAX_FILE_HIST; static final Locale DEFAULT_LOCALE; static final char DEFAULT_DECIMAL_SEPARATOR; static final char DEFAULT_GROUPING_SEPARATOR; static final String DEFAULT_CURRENCY_SYMBOL; static final String DEFAULT_NUMBER_FORMAT; static final String NULL_STRING; static final String NULL_NUMBER; static final String NULL_DATE; static final String NULL_BIGNUMBER; static final String NULL_BOOLEAN; static final String NULL_INTEGER; static final String NULL_BINARY; static final String NULL_NONE; static final int ROUND_HALF_CEILING; static final String CHEF_LOG_FILE; static final String SPOON_LOG_FILE; static final String MENU_LOG_FILE; static final String GENERALIZED_DATE_TIME_FORMAT; static final String GENERALIZED_DATE_TIME_FORMAT_MILLIS; static final String XML_ENCODING; static final String[] STRING_TRANS_AND_JOB_FILTER_EXT; static final String STRING_TRANS_DEFAULT_EXT; static final String[] STRING_TRANS_FILTER_EXT; static final String STRING_JOB_DEFAULT_EXT; static final String[] STRING_JOB_FILTER_EXT; static final String KETTLE_PROPERTIES; static final String SHARED_DATA_FILE; static final String INTERNAL_VARIABLE_PREFIX; static final String INTERNAL_VARIABLE_KETTLE_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_DATE; static final String INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_FILENAME_NAME; static final String INTERNAL_VARIABLE_JOB_NAME; static final String INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_RUN_ID; static final String INTERNAL_VARIABLE_JOB_RUN_ATTEMPTNR; static final String VARIABLE_HEARTBEAT_PERIODIC_INTERVAL_SECS; static final String VARIABLE_MONITORING_SNMP_TRAPS_ENABLED; static final String INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY; static final String[] INTERNAL_TRANS_VARIABLES; static final String[] INTERNAL_JOB_VARIABLES; static final String[] DEPRECATED_VARIABLES; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_STEP_PARTITION_ID; static final String INTERNAL_VARIABLE_STEP_PARTITION_NR; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NUMBER; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NAME; static final String INTERNAL_VARIABLE_CLUSTER_SIZE; static final String INTERNAL_VARIABLE_STEP_UNIQUE_NUMBER; static final String INTERNAL_VARIABLE_CLUSTER_MASTER; static final String INTERNAL_VARIABLE_CLUSTER_RUN_ID; static final String INTERNAL_VARIABLE_STEP_UNIQUE_COUNT; static final String INTERNAL_VARIABLE_STEP_NAME; static final String INTERNAL_VARIABLE_STEP_COPYNR; static final int MAX_NR_LOG_LINES; static final int MAX_NR_HISTORY_LINES; static final int HISTORY_LINES_FETCH_SIZE; static final int MAX_LOG_LINE_TIMEOUT_MINUTES; static final int WARNING; static final int ERROR; static final int INFO; static final int NOTE_MARGIN; static final int MAX_UNDO; static final String KETTLE_VARIABLES_FILE; static final String KETTLE_LOG_SIZE_LIMIT; static final String KETTLE_TRANS_LOG_DB; static final String KETTLE_TRANS_LOG_SCHEMA; static final String KETTLE_TRANS_LOG_TABLE; static final String KETTLE_JOB_LOG_DB; static final String KETTLE_JOB_LOG_SCHEMA; static final String KETTLE_SLAVE_DETECTION_TIMER; static final String KETTLE_JOB_LOG_TABLE; static final String KETTLE_TRANS_PERFORMANCE_LOG_DB; static final String KETTLE_TRANS_PERFORMANCE_LOG_SCHEMA; static final String KETTLE_TRANS_PERFORMANCE_LOG_TABLE; static final String KETTLE_JOBENTRY_LOG_DB; static final String KETTLE_JOBENTRY_LOG_SCHEMA; static final String KETTLE_JOBENTRY_LOG_TABLE; static final String KETTLE_STEP_LOG_DB; static final String KETTLE_STEP_LOG_SCHEMA; static final String KETTLE_STEP_LOG_TABLE; static final String KETTLE_CHANNEL_LOG_DB; static final String KETTLE_CHANNEL_LOG_SCHEMA; static final String KETTLE_CHANNEL_LOG_TABLE; static final String KETTLE_METRICS_LOG_DB; static final String KETTLE_METRICS_LOG_SCHEMA; static final String KETTLE_METRICS_LOG_TABLE; static final String KETTLE_CHECKPOINT_LOG_DB; static final String KETTLE_CHECKPOINT_LOG_SCHEMA; static final String KETTLE_CHECKPOINT_LOG_TABLE; static final String KETTLE_SHARED_OBJECTS; static final String KETTLE_EMPTY_STRING_DIFFERS_FROM_NULL; static final String KETTLE_LENIENT_STRING_TO_NUMBER_CONVERSION; static final String KETTLE_COMPATIBILITY_DB_IGNORE_TIMEZONE; static final String KETTLE_COMPATIBILITY_IMPORT_PATH_ADDITION_ON_VARIABLES; static final String KETTLE_COMPATIBILITY_IGNORE_TABLE_LOGGING; static final String KETTLE_COMPATIBILITY_TEXT_FILE_OUTPUT_APPEND_NO_HEADER; static final String KETTLE_COMPATIBILITY_MERGE_ROWS_USE_REFERENCE_STREAM_WHEN_IDENTICAL; static final String KETTLE_COMPATIBILITY_MEMORY_GROUP_BY_SUM_AVERAGE_RETURN_NUMBER_TYPE; static final String KETTLE_SYSTEM_HOSTNAME; static final String KETTLE_MAX_LOG_SIZE_IN_LINES; static final String KETTLE_MAX_LOG_TIMEOUT_IN_MINUTES; static final String KETTLE_REDIRECT_STDERR; static final String KETTLE_REDIRECT_STDOUT; static final String KETTLE_CARTE_OBJECT_TIMEOUT_MINUTES; static final String KETTLE_STEP_PERFORMANCE_SNAPSHOT_LIMIT; static final String KETTLE_MAX_JOB_TRACKER_SIZE; static final String KETTLE_MAX_JOB_ENTRIES_LOGGED; static final String KETTLE_MAX_LOGGING_REGISTRY_SIZE; static final String KETTLE_LOG_TAB_REFRESH_DELAY; static final String KETTLE_LOG_TAB_REFRESH_PERIOD; static final String KETTLE_SAP_CONNECTION_FACTORY; static final String KETTLE_SAP_CONNECTION_FACTORY_DEFAULT_NAME; static final String KETTLE_PLUGIN_CLASSES; static final String KETTLE_PLUGIN_PACKAGES; static final String KETTLE_TRANS_ROWSET_SIZE; static final String VERSION_COMMENT_INITIAL_VERSION; static final String VERSION_COMMENT_EDIT_VERSION; static final String XML_FILE_KETTLE_STEPS; static final String KETTLE_CORE_STEPS_FILE; static final String XML_FILE_KETTLE_PARTITION_PLUGINS; static final String KETTLE_CORE_JOBENTRIES_FILE; static final String XML_FILE_KETTLE_SERVLETS; static final String XML_FILE_KETTLE_VALUEMETA_PLUGINS; static final String XML_FILE_KETTLE_PASSWORD_ENCODER_PLUGINS; static final String KETTLE_VALUEMETA_PLUGINS_FILE; static final String KETTLE_PASSWORD_ENCODER_PLUGIN; static final String KETTLE_PASSWORD_ENCODER_PLUGINS_FILE; static final String KETTLE_TWO_WAY_PASSWORD_ENCODER_SEED; static final String XML_FILE_KETTLE_LOGGING_PLUGINS; static final String KETTLE_LOGGING_PLUGINS_FILE; static final String KETTLE_CORE_SERVLETS_FILE; static final String KETTLE_ROWSET_GET_TIMEOUT; static final String KETTLE_ROWSET_PUT_TIMEOUT; static final String KETTLE_BATCHING_ROWSET; static final String KETTLE_DISABLE_CONSOLE_LOGGING; static final String XML_FILE_KETTLE_JOB_ENTRIES; static final String XML_FILE_KETTLE_REPOSITORIES; static final String XML_FILE_KETTLE_DATABASE_TYPES; static final String XML_FILE_KETTLE_COMPRESSION_PROVIDERS; static final String XML_FILE_KETTLE_AUTHENTICATION_PROVIDERS; static final String XML_FILE_KETTLE_EXTENSION_POINTS; static final String XML_FILE_KETTLE_REGISTRY_EXTENSIONS; static final String XML_FILE_KETTLE_LIFECYCLE_LISTENERS; static final String XML_FILE_KETTLE_ENGINES; static final String KETTLE_TRANS_PAN_JVM_EXIT_CODE; static final String KETTLE_DEFAULT_NUMBER_FORMAT; static final String KETTLE_DEFAULT_BIGNUMBER_FORMAT; static final String KETTLE_DEFAULT_INTEGER_FORMAT; static final String KETTLE_DEFAULT_DATE_FORMAT; static final String KETTLE_AGGREGATION_MIN_NULL_IS_VALUED; static final String KETTLE_AGGREGATION_ALL_NULLS_ARE_ZERO; static final String KETTLE_DEFAULT_TIMESTAMP_FORMAT; static final String KETTLE_SPLIT_FIELDS_REMOVE_ENCLOSURE; static final String KETTLE_GLOBAL_LOG_VARIABLES_CLEAR_ON_EXPORT; static final String KETTLE_COMPATIBILITY_CALCULATION_TIMEZONE_DECOMPOSITION; static final String KETTLE_COMPATIBILITY_SET_ERROR_ON_SPECIFIC_JOB_ENTRIES; static final String KETTLE_COMPATIBILITY_SEND_RESULT_XML_WITH_FULL_STATUS; static final String KETTLE_COMPATIBILITY_SELECT_VALUES_TYPE_CHANGE_USES_TYPE_DEFAULTS; static final String XML_FILE_KETTLE_IMPORT_RULES; static final ReleaseType RELEASE; static final String PENTAHO_METASTORE_FOLDER; static final String PENTAHO_METASTORE_NAME; static final String KETTLE_LOG_MARK_MAPPINGS; static final String KETTLE_CARTE_JETTY_ACCEPTORS; static final String KETTLE_CARTE_JETTY_ACCEPT_QUEUE_SIZE; static final String KETTLE_CARTE_JETTY_RES_MAX_IDLE_TIME; static final String VFS_USER_DIR_IS_ROOT; }
@Test public void testIsEmptyStringBuilder() { assertTrue( Const.isEmpty( (StringBuilder) null ) ); assertTrue( Const.isEmpty( new StringBuilder( "" ) ) ); assertFalse( Const.isEmpty( new StringBuilder( "test" ) ) ); }
@Deprecated public static boolean isEmpty( String val ) { return Utils.isEmpty( val ); }
Const { @Deprecated public static boolean isEmpty( String val ) { return Utils.isEmpty( val ); } }
Const { @Deprecated public static boolean isEmpty( String val ) { return Utils.isEmpty( val ); } }
Const { @Deprecated public static boolean isEmpty( String val ) { return Utils.isEmpty( val ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); }
Const { @Deprecated public static boolean isEmpty( String val ) { return Utils.isEmpty( val ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); @Deprecated static final String VERSION; static final String COPYRIGHT_YEAR; static final int TIMEOUT_GET_MILLIS; static final int TIMEOUT_PUT_MILLIS; static final int ROWS_UPDATE; static final int ROWS_IN_ROWSET; static final int FETCH_SIZE; static final int SORT_SIZE; static final int HEARTBEAT_PERIODIC_INTERVAL_IN_SECS; static final String FILE_SEPARATOR; static final String PATH_SEPARATOR; static final String CR; static final String DOSCR; static final String EMPTY_STRING; static final String JAVA_VERSION; @Deprecated static final String USER_HOME_DIRECTORY; static String JNDI_DIRECTORY; static final String PLUGIN_BASE_FOLDERS_PROP; static final String DEFAULT_PLUGIN_BASE_FOLDERS; static final Date MIN_DATE; static final Date MAX_DATE; static final int MIN_YEAR; static final int MAX_YEAR; static final int RIGHT; static final int LENGTH; static final int MARGIN; static final int MIDDLE_PCT; static final int ARROW_WIDTH; static final int FORM_MARGIN; static final int SHADOW_SIZE; static final int SYMBOLSIZE; static final int MAX_FILE_HIST; static final Locale DEFAULT_LOCALE; static final char DEFAULT_DECIMAL_SEPARATOR; static final char DEFAULT_GROUPING_SEPARATOR; static final String DEFAULT_CURRENCY_SYMBOL; static final String DEFAULT_NUMBER_FORMAT; static final String NULL_STRING; static final String NULL_NUMBER; static final String NULL_DATE; static final String NULL_BIGNUMBER; static final String NULL_BOOLEAN; static final String NULL_INTEGER; static final String NULL_BINARY; static final String NULL_NONE; static final int ROUND_HALF_CEILING; static final String CHEF_LOG_FILE; static final String SPOON_LOG_FILE; static final String MENU_LOG_FILE; static final String GENERALIZED_DATE_TIME_FORMAT; static final String GENERALIZED_DATE_TIME_FORMAT_MILLIS; static final String XML_ENCODING; static final String[] STRING_TRANS_AND_JOB_FILTER_EXT; static final String STRING_TRANS_DEFAULT_EXT; static final String[] STRING_TRANS_FILTER_EXT; static final String STRING_JOB_DEFAULT_EXT; static final String[] STRING_JOB_FILTER_EXT; static final String KETTLE_PROPERTIES; static final String SHARED_DATA_FILE; static final String INTERNAL_VARIABLE_PREFIX; static final String INTERNAL_VARIABLE_KETTLE_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_DATE; static final String INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_FILENAME_NAME; static final String INTERNAL_VARIABLE_JOB_NAME; static final String INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_RUN_ID; static final String INTERNAL_VARIABLE_JOB_RUN_ATTEMPTNR; static final String VARIABLE_HEARTBEAT_PERIODIC_INTERVAL_SECS; static final String VARIABLE_MONITORING_SNMP_TRAPS_ENABLED; static final String INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY; static final String[] INTERNAL_TRANS_VARIABLES; static final String[] INTERNAL_JOB_VARIABLES; static final String[] DEPRECATED_VARIABLES; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_STEP_PARTITION_ID; static final String INTERNAL_VARIABLE_STEP_PARTITION_NR; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NUMBER; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NAME; static final String INTERNAL_VARIABLE_CLUSTER_SIZE; static final String INTERNAL_VARIABLE_STEP_UNIQUE_NUMBER; static final String INTERNAL_VARIABLE_CLUSTER_MASTER; static final String INTERNAL_VARIABLE_CLUSTER_RUN_ID; static final String INTERNAL_VARIABLE_STEP_UNIQUE_COUNT; static final String INTERNAL_VARIABLE_STEP_NAME; static final String INTERNAL_VARIABLE_STEP_COPYNR; static final int MAX_NR_LOG_LINES; static final int MAX_NR_HISTORY_LINES; static final int HISTORY_LINES_FETCH_SIZE; static final int MAX_LOG_LINE_TIMEOUT_MINUTES; static final int WARNING; static final int ERROR; static final int INFO; static final int NOTE_MARGIN; static final int MAX_UNDO; static final String KETTLE_VARIABLES_FILE; static final String KETTLE_LOG_SIZE_LIMIT; static final String KETTLE_TRANS_LOG_DB; static final String KETTLE_TRANS_LOG_SCHEMA; static final String KETTLE_TRANS_LOG_TABLE; static final String KETTLE_JOB_LOG_DB; static final String KETTLE_JOB_LOG_SCHEMA; static final String KETTLE_SLAVE_DETECTION_TIMER; static final String KETTLE_JOB_LOG_TABLE; static final String KETTLE_TRANS_PERFORMANCE_LOG_DB; static final String KETTLE_TRANS_PERFORMANCE_LOG_SCHEMA; static final String KETTLE_TRANS_PERFORMANCE_LOG_TABLE; static final String KETTLE_JOBENTRY_LOG_DB; static final String KETTLE_JOBENTRY_LOG_SCHEMA; static final String KETTLE_JOBENTRY_LOG_TABLE; static final String KETTLE_STEP_LOG_DB; static final String KETTLE_STEP_LOG_SCHEMA; static final String KETTLE_STEP_LOG_TABLE; static final String KETTLE_CHANNEL_LOG_DB; static final String KETTLE_CHANNEL_LOG_SCHEMA; static final String KETTLE_CHANNEL_LOG_TABLE; static final String KETTLE_METRICS_LOG_DB; static final String KETTLE_METRICS_LOG_SCHEMA; static final String KETTLE_METRICS_LOG_TABLE; static final String KETTLE_CHECKPOINT_LOG_DB; static final String KETTLE_CHECKPOINT_LOG_SCHEMA; static final String KETTLE_CHECKPOINT_LOG_TABLE; static final String KETTLE_SHARED_OBJECTS; static final String KETTLE_EMPTY_STRING_DIFFERS_FROM_NULL; static final String KETTLE_LENIENT_STRING_TO_NUMBER_CONVERSION; static final String KETTLE_COMPATIBILITY_DB_IGNORE_TIMEZONE; static final String KETTLE_COMPATIBILITY_IMPORT_PATH_ADDITION_ON_VARIABLES; static final String KETTLE_COMPATIBILITY_IGNORE_TABLE_LOGGING; static final String KETTLE_COMPATIBILITY_TEXT_FILE_OUTPUT_APPEND_NO_HEADER; static final String KETTLE_COMPATIBILITY_MERGE_ROWS_USE_REFERENCE_STREAM_WHEN_IDENTICAL; static final String KETTLE_COMPATIBILITY_MEMORY_GROUP_BY_SUM_AVERAGE_RETURN_NUMBER_TYPE; static final String KETTLE_SYSTEM_HOSTNAME; static final String KETTLE_MAX_LOG_SIZE_IN_LINES; static final String KETTLE_MAX_LOG_TIMEOUT_IN_MINUTES; static final String KETTLE_REDIRECT_STDERR; static final String KETTLE_REDIRECT_STDOUT; static final String KETTLE_CARTE_OBJECT_TIMEOUT_MINUTES; static final String KETTLE_STEP_PERFORMANCE_SNAPSHOT_LIMIT; static final String KETTLE_MAX_JOB_TRACKER_SIZE; static final String KETTLE_MAX_JOB_ENTRIES_LOGGED; static final String KETTLE_MAX_LOGGING_REGISTRY_SIZE; static final String KETTLE_LOG_TAB_REFRESH_DELAY; static final String KETTLE_LOG_TAB_REFRESH_PERIOD; static final String KETTLE_SAP_CONNECTION_FACTORY; static final String KETTLE_SAP_CONNECTION_FACTORY_DEFAULT_NAME; static final String KETTLE_PLUGIN_CLASSES; static final String KETTLE_PLUGIN_PACKAGES; static final String KETTLE_TRANS_ROWSET_SIZE; static final String VERSION_COMMENT_INITIAL_VERSION; static final String VERSION_COMMENT_EDIT_VERSION; static final String XML_FILE_KETTLE_STEPS; static final String KETTLE_CORE_STEPS_FILE; static final String XML_FILE_KETTLE_PARTITION_PLUGINS; static final String KETTLE_CORE_JOBENTRIES_FILE; static final String XML_FILE_KETTLE_SERVLETS; static final String XML_FILE_KETTLE_VALUEMETA_PLUGINS; static final String XML_FILE_KETTLE_PASSWORD_ENCODER_PLUGINS; static final String KETTLE_VALUEMETA_PLUGINS_FILE; static final String KETTLE_PASSWORD_ENCODER_PLUGIN; static final String KETTLE_PASSWORD_ENCODER_PLUGINS_FILE; static final String KETTLE_TWO_WAY_PASSWORD_ENCODER_SEED; static final String XML_FILE_KETTLE_LOGGING_PLUGINS; static final String KETTLE_LOGGING_PLUGINS_FILE; static final String KETTLE_CORE_SERVLETS_FILE; static final String KETTLE_ROWSET_GET_TIMEOUT; static final String KETTLE_ROWSET_PUT_TIMEOUT; static final String KETTLE_BATCHING_ROWSET; static final String KETTLE_DISABLE_CONSOLE_LOGGING; static final String XML_FILE_KETTLE_JOB_ENTRIES; static final String XML_FILE_KETTLE_REPOSITORIES; static final String XML_FILE_KETTLE_DATABASE_TYPES; static final String XML_FILE_KETTLE_COMPRESSION_PROVIDERS; static final String XML_FILE_KETTLE_AUTHENTICATION_PROVIDERS; static final String XML_FILE_KETTLE_EXTENSION_POINTS; static final String XML_FILE_KETTLE_REGISTRY_EXTENSIONS; static final String XML_FILE_KETTLE_LIFECYCLE_LISTENERS; static final String XML_FILE_KETTLE_ENGINES; static final String KETTLE_TRANS_PAN_JVM_EXIT_CODE; static final String KETTLE_DEFAULT_NUMBER_FORMAT; static final String KETTLE_DEFAULT_BIGNUMBER_FORMAT; static final String KETTLE_DEFAULT_INTEGER_FORMAT; static final String KETTLE_DEFAULT_DATE_FORMAT; static final String KETTLE_AGGREGATION_MIN_NULL_IS_VALUED; static final String KETTLE_AGGREGATION_ALL_NULLS_ARE_ZERO; static final String KETTLE_DEFAULT_TIMESTAMP_FORMAT; static final String KETTLE_SPLIT_FIELDS_REMOVE_ENCLOSURE; static final String KETTLE_GLOBAL_LOG_VARIABLES_CLEAR_ON_EXPORT; static final String KETTLE_COMPATIBILITY_CALCULATION_TIMEZONE_DECOMPOSITION; static final String KETTLE_COMPATIBILITY_SET_ERROR_ON_SPECIFIC_JOB_ENTRIES; static final String KETTLE_COMPATIBILITY_SEND_RESULT_XML_WITH_FULL_STATUS; static final String KETTLE_COMPATIBILITY_SELECT_VALUES_TYPE_CHANGE_USES_TYPE_DEFAULTS; static final String XML_FILE_KETTLE_IMPORT_RULES; static final ReleaseType RELEASE; static final String PENTAHO_METASTORE_FOLDER; static final String PENTAHO_METASTORE_NAME; static final String KETTLE_LOG_MARK_MAPPINGS; static final String KETTLE_CARTE_JETTY_ACCEPTORS; static final String KETTLE_CARTE_JETTY_ACCEPT_QUEUE_SIZE; static final String KETTLE_CARTE_JETTY_RES_MAX_IDLE_TIME; static final String VFS_USER_DIR_IS_ROOT; }
@Test public void testNVL() { assertNull( Const.NVL( null, null ) ); assertEquals( "test", Const.NVL( "test", "test1" ) ); assertEquals( "test", Const.NVL( "test", null ) ); assertEquals( "test1", Const.NVL( null, "test1" ) ); }
public static String NVL( String source, String def ) { if ( source == null || source.length() == 0 ) { return def; } return source; }
Const { public static String NVL( String source, String def ) { if ( source == null || source.length() == 0 ) { return def; } return source; } }
Const { public static String NVL( String source, String def ) { if ( source == null || source.length() == 0 ) { return def; } return source; } }
Const { public static String NVL( String source, String def ) { if ( source == null || source.length() == 0 ) { return def; } return source; } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); }
Const { public static String NVL( String source, String def ) { if ( source == null || source.length() == 0 ) { return def; } return source; } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); @Deprecated static final String VERSION; static final String COPYRIGHT_YEAR; static final int TIMEOUT_GET_MILLIS; static final int TIMEOUT_PUT_MILLIS; static final int ROWS_UPDATE; static final int ROWS_IN_ROWSET; static final int FETCH_SIZE; static final int SORT_SIZE; static final int HEARTBEAT_PERIODIC_INTERVAL_IN_SECS; static final String FILE_SEPARATOR; static final String PATH_SEPARATOR; static final String CR; static final String DOSCR; static final String EMPTY_STRING; static final String JAVA_VERSION; @Deprecated static final String USER_HOME_DIRECTORY; static String JNDI_DIRECTORY; static final String PLUGIN_BASE_FOLDERS_PROP; static final String DEFAULT_PLUGIN_BASE_FOLDERS; static final Date MIN_DATE; static final Date MAX_DATE; static final int MIN_YEAR; static final int MAX_YEAR; static final int RIGHT; static final int LENGTH; static final int MARGIN; static final int MIDDLE_PCT; static final int ARROW_WIDTH; static final int FORM_MARGIN; static final int SHADOW_SIZE; static final int SYMBOLSIZE; static final int MAX_FILE_HIST; static final Locale DEFAULT_LOCALE; static final char DEFAULT_DECIMAL_SEPARATOR; static final char DEFAULT_GROUPING_SEPARATOR; static final String DEFAULT_CURRENCY_SYMBOL; static final String DEFAULT_NUMBER_FORMAT; static final String NULL_STRING; static final String NULL_NUMBER; static final String NULL_DATE; static final String NULL_BIGNUMBER; static final String NULL_BOOLEAN; static final String NULL_INTEGER; static final String NULL_BINARY; static final String NULL_NONE; static final int ROUND_HALF_CEILING; static final String CHEF_LOG_FILE; static final String SPOON_LOG_FILE; static final String MENU_LOG_FILE; static final String GENERALIZED_DATE_TIME_FORMAT; static final String GENERALIZED_DATE_TIME_FORMAT_MILLIS; static final String XML_ENCODING; static final String[] STRING_TRANS_AND_JOB_FILTER_EXT; static final String STRING_TRANS_DEFAULT_EXT; static final String[] STRING_TRANS_FILTER_EXT; static final String STRING_JOB_DEFAULT_EXT; static final String[] STRING_JOB_FILTER_EXT; static final String KETTLE_PROPERTIES; static final String SHARED_DATA_FILE; static final String INTERNAL_VARIABLE_PREFIX; static final String INTERNAL_VARIABLE_KETTLE_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_DATE; static final String INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_FILENAME_NAME; static final String INTERNAL_VARIABLE_JOB_NAME; static final String INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_RUN_ID; static final String INTERNAL_VARIABLE_JOB_RUN_ATTEMPTNR; static final String VARIABLE_HEARTBEAT_PERIODIC_INTERVAL_SECS; static final String VARIABLE_MONITORING_SNMP_TRAPS_ENABLED; static final String INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY; static final String[] INTERNAL_TRANS_VARIABLES; static final String[] INTERNAL_JOB_VARIABLES; static final String[] DEPRECATED_VARIABLES; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_STEP_PARTITION_ID; static final String INTERNAL_VARIABLE_STEP_PARTITION_NR; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NUMBER; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NAME; static final String INTERNAL_VARIABLE_CLUSTER_SIZE; static final String INTERNAL_VARIABLE_STEP_UNIQUE_NUMBER; static final String INTERNAL_VARIABLE_CLUSTER_MASTER; static final String INTERNAL_VARIABLE_CLUSTER_RUN_ID; static final String INTERNAL_VARIABLE_STEP_UNIQUE_COUNT; static final String INTERNAL_VARIABLE_STEP_NAME; static final String INTERNAL_VARIABLE_STEP_COPYNR; static final int MAX_NR_LOG_LINES; static final int MAX_NR_HISTORY_LINES; static final int HISTORY_LINES_FETCH_SIZE; static final int MAX_LOG_LINE_TIMEOUT_MINUTES; static final int WARNING; static final int ERROR; static final int INFO; static final int NOTE_MARGIN; static final int MAX_UNDO; static final String KETTLE_VARIABLES_FILE; static final String KETTLE_LOG_SIZE_LIMIT; static final String KETTLE_TRANS_LOG_DB; static final String KETTLE_TRANS_LOG_SCHEMA; static final String KETTLE_TRANS_LOG_TABLE; static final String KETTLE_JOB_LOG_DB; static final String KETTLE_JOB_LOG_SCHEMA; static final String KETTLE_SLAVE_DETECTION_TIMER; static final String KETTLE_JOB_LOG_TABLE; static final String KETTLE_TRANS_PERFORMANCE_LOG_DB; static final String KETTLE_TRANS_PERFORMANCE_LOG_SCHEMA; static final String KETTLE_TRANS_PERFORMANCE_LOG_TABLE; static final String KETTLE_JOBENTRY_LOG_DB; static final String KETTLE_JOBENTRY_LOG_SCHEMA; static final String KETTLE_JOBENTRY_LOG_TABLE; static final String KETTLE_STEP_LOG_DB; static final String KETTLE_STEP_LOG_SCHEMA; static final String KETTLE_STEP_LOG_TABLE; static final String KETTLE_CHANNEL_LOG_DB; static final String KETTLE_CHANNEL_LOG_SCHEMA; static final String KETTLE_CHANNEL_LOG_TABLE; static final String KETTLE_METRICS_LOG_DB; static final String KETTLE_METRICS_LOG_SCHEMA; static final String KETTLE_METRICS_LOG_TABLE; static final String KETTLE_CHECKPOINT_LOG_DB; static final String KETTLE_CHECKPOINT_LOG_SCHEMA; static final String KETTLE_CHECKPOINT_LOG_TABLE; static final String KETTLE_SHARED_OBJECTS; static final String KETTLE_EMPTY_STRING_DIFFERS_FROM_NULL; static final String KETTLE_LENIENT_STRING_TO_NUMBER_CONVERSION; static final String KETTLE_COMPATIBILITY_DB_IGNORE_TIMEZONE; static final String KETTLE_COMPATIBILITY_IMPORT_PATH_ADDITION_ON_VARIABLES; static final String KETTLE_COMPATIBILITY_IGNORE_TABLE_LOGGING; static final String KETTLE_COMPATIBILITY_TEXT_FILE_OUTPUT_APPEND_NO_HEADER; static final String KETTLE_COMPATIBILITY_MERGE_ROWS_USE_REFERENCE_STREAM_WHEN_IDENTICAL; static final String KETTLE_COMPATIBILITY_MEMORY_GROUP_BY_SUM_AVERAGE_RETURN_NUMBER_TYPE; static final String KETTLE_SYSTEM_HOSTNAME; static final String KETTLE_MAX_LOG_SIZE_IN_LINES; static final String KETTLE_MAX_LOG_TIMEOUT_IN_MINUTES; static final String KETTLE_REDIRECT_STDERR; static final String KETTLE_REDIRECT_STDOUT; static final String KETTLE_CARTE_OBJECT_TIMEOUT_MINUTES; static final String KETTLE_STEP_PERFORMANCE_SNAPSHOT_LIMIT; static final String KETTLE_MAX_JOB_TRACKER_SIZE; static final String KETTLE_MAX_JOB_ENTRIES_LOGGED; static final String KETTLE_MAX_LOGGING_REGISTRY_SIZE; static final String KETTLE_LOG_TAB_REFRESH_DELAY; static final String KETTLE_LOG_TAB_REFRESH_PERIOD; static final String KETTLE_SAP_CONNECTION_FACTORY; static final String KETTLE_SAP_CONNECTION_FACTORY_DEFAULT_NAME; static final String KETTLE_PLUGIN_CLASSES; static final String KETTLE_PLUGIN_PACKAGES; static final String KETTLE_TRANS_ROWSET_SIZE; static final String VERSION_COMMENT_INITIAL_VERSION; static final String VERSION_COMMENT_EDIT_VERSION; static final String XML_FILE_KETTLE_STEPS; static final String KETTLE_CORE_STEPS_FILE; static final String XML_FILE_KETTLE_PARTITION_PLUGINS; static final String KETTLE_CORE_JOBENTRIES_FILE; static final String XML_FILE_KETTLE_SERVLETS; static final String XML_FILE_KETTLE_VALUEMETA_PLUGINS; static final String XML_FILE_KETTLE_PASSWORD_ENCODER_PLUGINS; static final String KETTLE_VALUEMETA_PLUGINS_FILE; static final String KETTLE_PASSWORD_ENCODER_PLUGIN; static final String KETTLE_PASSWORD_ENCODER_PLUGINS_FILE; static final String KETTLE_TWO_WAY_PASSWORD_ENCODER_SEED; static final String XML_FILE_KETTLE_LOGGING_PLUGINS; static final String KETTLE_LOGGING_PLUGINS_FILE; static final String KETTLE_CORE_SERVLETS_FILE; static final String KETTLE_ROWSET_GET_TIMEOUT; static final String KETTLE_ROWSET_PUT_TIMEOUT; static final String KETTLE_BATCHING_ROWSET; static final String KETTLE_DISABLE_CONSOLE_LOGGING; static final String XML_FILE_KETTLE_JOB_ENTRIES; static final String XML_FILE_KETTLE_REPOSITORIES; static final String XML_FILE_KETTLE_DATABASE_TYPES; static final String XML_FILE_KETTLE_COMPRESSION_PROVIDERS; static final String XML_FILE_KETTLE_AUTHENTICATION_PROVIDERS; static final String XML_FILE_KETTLE_EXTENSION_POINTS; static final String XML_FILE_KETTLE_REGISTRY_EXTENSIONS; static final String XML_FILE_KETTLE_LIFECYCLE_LISTENERS; static final String XML_FILE_KETTLE_ENGINES; static final String KETTLE_TRANS_PAN_JVM_EXIT_CODE; static final String KETTLE_DEFAULT_NUMBER_FORMAT; static final String KETTLE_DEFAULT_BIGNUMBER_FORMAT; static final String KETTLE_DEFAULT_INTEGER_FORMAT; static final String KETTLE_DEFAULT_DATE_FORMAT; static final String KETTLE_AGGREGATION_MIN_NULL_IS_VALUED; static final String KETTLE_AGGREGATION_ALL_NULLS_ARE_ZERO; static final String KETTLE_DEFAULT_TIMESTAMP_FORMAT; static final String KETTLE_SPLIT_FIELDS_REMOVE_ENCLOSURE; static final String KETTLE_GLOBAL_LOG_VARIABLES_CLEAR_ON_EXPORT; static final String KETTLE_COMPATIBILITY_CALCULATION_TIMEZONE_DECOMPOSITION; static final String KETTLE_COMPATIBILITY_SET_ERROR_ON_SPECIFIC_JOB_ENTRIES; static final String KETTLE_COMPATIBILITY_SEND_RESULT_XML_WITH_FULL_STATUS; static final String KETTLE_COMPATIBILITY_SELECT_VALUES_TYPE_CHANGE_USES_TYPE_DEFAULTS; static final String XML_FILE_KETTLE_IMPORT_RULES; static final ReleaseType RELEASE; static final String PENTAHO_METASTORE_FOLDER; static final String PENTAHO_METASTORE_NAME; static final String KETTLE_LOG_MARK_MAPPINGS; static final String KETTLE_CARTE_JETTY_ACCEPTORS; static final String KETTLE_CARTE_JETTY_ACCEPT_QUEUE_SIZE; static final String KETTLE_CARTE_JETTY_RES_MAX_IDLE_TIME; static final String VFS_USER_DIR_IS_ROOT; }
@Test public void testNrSpacesBefore() { try { Const.nrSpacesBefore( null ); fail( "Expected NullPointerException" ); } catch ( NullPointerException ex ) { } assertEquals( 0, Const.nrSpacesBefore( "" ) ); assertEquals( 1, Const.nrSpacesBefore( " " ) ); assertEquals( 3, Const.nrSpacesBefore( " " ) ); assertEquals( 0, Const.nrSpacesBefore( "test" ) ); assertEquals( 0, Const.nrSpacesBefore( "test " ) ); assertEquals( 3, Const.nrSpacesBefore( " test" ) ); assertEquals( 4, Const.nrSpacesBefore( " test " ) ); }
public static int nrSpacesBefore( String field ) { int nr = 0; int len = field.length(); while ( nr < len && field.charAt( nr ) == ' ' ) { nr++; } return nr; }
Const { public static int nrSpacesBefore( String field ) { int nr = 0; int len = field.length(); while ( nr < len && field.charAt( nr ) == ' ' ) { nr++; } return nr; } }
Const { public static int nrSpacesBefore( String field ) { int nr = 0; int len = field.length(); while ( nr < len && field.charAt( nr ) == ' ' ) { nr++; } return nr; } }
Const { public static int nrSpacesBefore( String field ) { int nr = 0; int len = field.length(); while ( nr < len && field.charAt( nr ) == ' ' ) { nr++; } return nr; } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); }
Const { public static int nrSpacesBefore( String field ) { int nr = 0; int len = field.length(); while ( nr < len && field.charAt( nr ) == ' ' ) { nr++; } return nr; } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); @Deprecated static final String VERSION; static final String COPYRIGHT_YEAR; static final int TIMEOUT_GET_MILLIS; static final int TIMEOUT_PUT_MILLIS; static final int ROWS_UPDATE; static final int ROWS_IN_ROWSET; static final int FETCH_SIZE; static final int SORT_SIZE; static final int HEARTBEAT_PERIODIC_INTERVAL_IN_SECS; static final String FILE_SEPARATOR; static final String PATH_SEPARATOR; static final String CR; static final String DOSCR; static final String EMPTY_STRING; static final String JAVA_VERSION; @Deprecated static final String USER_HOME_DIRECTORY; static String JNDI_DIRECTORY; static final String PLUGIN_BASE_FOLDERS_PROP; static final String DEFAULT_PLUGIN_BASE_FOLDERS; static final Date MIN_DATE; static final Date MAX_DATE; static final int MIN_YEAR; static final int MAX_YEAR; static final int RIGHT; static final int LENGTH; static final int MARGIN; static final int MIDDLE_PCT; static final int ARROW_WIDTH; static final int FORM_MARGIN; static final int SHADOW_SIZE; static final int SYMBOLSIZE; static final int MAX_FILE_HIST; static final Locale DEFAULT_LOCALE; static final char DEFAULT_DECIMAL_SEPARATOR; static final char DEFAULT_GROUPING_SEPARATOR; static final String DEFAULT_CURRENCY_SYMBOL; static final String DEFAULT_NUMBER_FORMAT; static final String NULL_STRING; static final String NULL_NUMBER; static final String NULL_DATE; static final String NULL_BIGNUMBER; static final String NULL_BOOLEAN; static final String NULL_INTEGER; static final String NULL_BINARY; static final String NULL_NONE; static final int ROUND_HALF_CEILING; static final String CHEF_LOG_FILE; static final String SPOON_LOG_FILE; static final String MENU_LOG_FILE; static final String GENERALIZED_DATE_TIME_FORMAT; static final String GENERALIZED_DATE_TIME_FORMAT_MILLIS; static final String XML_ENCODING; static final String[] STRING_TRANS_AND_JOB_FILTER_EXT; static final String STRING_TRANS_DEFAULT_EXT; static final String[] STRING_TRANS_FILTER_EXT; static final String STRING_JOB_DEFAULT_EXT; static final String[] STRING_JOB_FILTER_EXT; static final String KETTLE_PROPERTIES; static final String SHARED_DATA_FILE; static final String INTERNAL_VARIABLE_PREFIX; static final String INTERNAL_VARIABLE_KETTLE_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_DATE; static final String INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_FILENAME_NAME; static final String INTERNAL_VARIABLE_JOB_NAME; static final String INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_RUN_ID; static final String INTERNAL_VARIABLE_JOB_RUN_ATTEMPTNR; static final String VARIABLE_HEARTBEAT_PERIODIC_INTERVAL_SECS; static final String VARIABLE_MONITORING_SNMP_TRAPS_ENABLED; static final String INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY; static final String[] INTERNAL_TRANS_VARIABLES; static final String[] INTERNAL_JOB_VARIABLES; static final String[] DEPRECATED_VARIABLES; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_STEP_PARTITION_ID; static final String INTERNAL_VARIABLE_STEP_PARTITION_NR; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NUMBER; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NAME; static final String INTERNAL_VARIABLE_CLUSTER_SIZE; static final String INTERNAL_VARIABLE_STEP_UNIQUE_NUMBER; static final String INTERNAL_VARIABLE_CLUSTER_MASTER; static final String INTERNAL_VARIABLE_CLUSTER_RUN_ID; static final String INTERNAL_VARIABLE_STEP_UNIQUE_COUNT; static final String INTERNAL_VARIABLE_STEP_NAME; static final String INTERNAL_VARIABLE_STEP_COPYNR; static final int MAX_NR_LOG_LINES; static final int MAX_NR_HISTORY_LINES; static final int HISTORY_LINES_FETCH_SIZE; static final int MAX_LOG_LINE_TIMEOUT_MINUTES; static final int WARNING; static final int ERROR; static final int INFO; static final int NOTE_MARGIN; static final int MAX_UNDO; static final String KETTLE_VARIABLES_FILE; static final String KETTLE_LOG_SIZE_LIMIT; static final String KETTLE_TRANS_LOG_DB; static final String KETTLE_TRANS_LOG_SCHEMA; static final String KETTLE_TRANS_LOG_TABLE; static final String KETTLE_JOB_LOG_DB; static final String KETTLE_JOB_LOG_SCHEMA; static final String KETTLE_SLAVE_DETECTION_TIMER; static final String KETTLE_JOB_LOG_TABLE; static final String KETTLE_TRANS_PERFORMANCE_LOG_DB; static final String KETTLE_TRANS_PERFORMANCE_LOG_SCHEMA; static final String KETTLE_TRANS_PERFORMANCE_LOG_TABLE; static final String KETTLE_JOBENTRY_LOG_DB; static final String KETTLE_JOBENTRY_LOG_SCHEMA; static final String KETTLE_JOBENTRY_LOG_TABLE; static final String KETTLE_STEP_LOG_DB; static final String KETTLE_STEP_LOG_SCHEMA; static final String KETTLE_STEP_LOG_TABLE; static final String KETTLE_CHANNEL_LOG_DB; static final String KETTLE_CHANNEL_LOG_SCHEMA; static final String KETTLE_CHANNEL_LOG_TABLE; static final String KETTLE_METRICS_LOG_DB; static final String KETTLE_METRICS_LOG_SCHEMA; static final String KETTLE_METRICS_LOG_TABLE; static final String KETTLE_CHECKPOINT_LOG_DB; static final String KETTLE_CHECKPOINT_LOG_SCHEMA; static final String KETTLE_CHECKPOINT_LOG_TABLE; static final String KETTLE_SHARED_OBJECTS; static final String KETTLE_EMPTY_STRING_DIFFERS_FROM_NULL; static final String KETTLE_LENIENT_STRING_TO_NUMBER_CONVERSION; static final String KETTLE_COMPATIBILITY_DB_IGNORE_TIMEZONE; static final String KETTLE_COMPATIBILITY_IMPORT_PATH_ADDITION_ON_VARIABLES; static final String KETTLE_COMPATIBILITY_IGNORE_TABLE_LOGGING; static final String KETTLE_COMPATIBILITY_TEXT_FILE_OUTPUT_APPEND_NO_HEADER; static final String KETTLE_COMPATIBILITY_MERGE_ROWS_USE_REFERENCE_STREAM_WHEN_IDENTICAL; static final String KETTLE_COMPATIBILITY_MEMORY_GROUP_BY_SUM_AVERAGE_RETURN_NUMBER_TYPE; static final String KETTLE_SYSTEM_HOSTNAME; static final String KETTLE_MAX_LOG_SIZE_IN_LINES; static final String KETTLE_MAX_LOG_TIMEOUT_IN_MINUTES; static final String KETTLE_REDIRECT_STDERR; static final String KETTLE_REDIRECT_STDOUT; static final String KETTLE_CARTE_OBJECT_TIMEOUT_MINUTES; static final String KETTLE_STEP_PERFORMANCE_SNAPSHOT_LIMIT; static final String KETTLE_MAX_JOB_TRACKER_SIZE; static final String KETTLE_MAX_JOB_ENTRIES_LOGGED; static final String KETTLE_MAX_LOGGING_REGISTRY_SIZE; static final String KETTLE_LOG_TAB_REFRESH_DELAY; static final String KETTLE_LOG_TAB_REFRESH_PERIOD; static final String KETTLE_SAP_CONNECTION_FACTORY; static final String KETTLE_SAP_CONNECTION_FACTORY_DEFAULT_NAME; static final String KETTLE_PLUGIN_CLASSES; static final String KETTLE_PLUGIN_PACKAGES; static final String KETTLE_TRANS_ROWSET_SIZE; static final String VERSION_COMMENT_INITIAL_VERSION; static final String VERSION_COMMENT_EDIT_VERSION; static final String XML_FILE_KETTLE_STEPS; static final String KETTLE_CORE_STEPS_FILE; static final String XML_FILE_KETTLE_PARTITION_PLUGINS; static final String KETTLE_CORE_JOBENTRIES_FILE; static final String XML_FILE_KETTLE_SERVLETS; static final String XML_FILE_KETTLE_VALUEMETA_PLUGINS; static final String XML_FILE_KETTLE_PASSWORD_ENCODER_PLUGINS; static final String KETTLE_VALUEMETA_PLUGINS_FILE; static final String KETTLE_PASSWORD_ENCODER_PLUGIN; static final String KETTLE_PASSWORD_ENCODER_PLUGINS_FILE; static final String KETTLE_TWO_WAY_PASSWORD_ENCODER_SEED; static final String XML_FILE_KETTLE_LOGGING_PLUGINS; static final String KETTLE_LOGGING_PLUGINS_FILE; static final String KETTLE_CORE_SERVLETS_FILE; static final String KETTLE_ROWSET_GET_TIMEOUT; static final String KETTLE_ROWSET_PUT_TIMEOUT; static final String KETTLE_BATCHING_ROWSET; static final String KETTLE_DISABLE_CONSOLE_LOGGING; static final String XML_FILE_KETTLE_JOB_ENTRIES; static final String XML_FILE_KETTLE_REPOSITORIES; static final String XML_FILE_KETTLE_DATABASE_TYPES; static final String XML_FILE_KETTLE_COMPRESSION_PROVIDERS; static final String XML_FILE_KETTLE_AUTHENTICATION_PROVIDERS; static final String XML_FILE_KETTLE_EXTENSION_POINTS; static final String XML_FILE_KETTLE_REGISTRY_EXTENSIONS; static final String XML_FILE_KETTLE_LIFECYCLE_LISTENERS; static final String XML_FILE_KETTLE_ENGINES; static final String KETTLE_TRANS_PAN_JVM_EXIT_CODE; static final String KETTLE_DEFAULT_NUMBER_FORMAT; static final String KETTLE_DEFAULT_BIGNUMBER_FORMAT; static final String KETTLE_DEFAULT_INTEGER_FORMAT; static final String KETTLE_DEFAULT_DATE_FORMAT; static final String KETTLE_AGGREGATION_MIN_NULL_IS_VALUED; static final String KETTLE_AGGREGATION_ALL_NULLS_ARE_ZERO; static final String KETTLE_DEFAULT_TIMESTAMP_FORMAT; static final String KETTLE_SPLIT_FIELDS_REMOVE_ENCLOSURE; static final String KETTLE_GLOBAL_LOG_VARIABLES_CLEAR_ON_EXPORT; static final String KETTLE_COMPATIBILITY_CALCULATION_TIMEZONE_DECOMPOSITION; static final String KETTLE_COMPATIBILITY_SET_ERROR_ON_SPECIFIC_JOB_ENTRIES; static final String KETTLE_COMPATIBILITY_SEND_RESULT_XML_WITH_FULL_STATUS; static final String KETTLE_COMPATIBILITY_SELECT_VALUES_TYPE_CHANGE_USES_TYPE_DEFAULTS; static final String XML_FILE_KETTLE_IMPORT_RULES; static final ReleaseType RELEASE; static final String PENTAHO_METASTORE_FOLDER; static final String PENTAHO_METASTORE_NAME; static final String KETTLE_LOG_MARK_MAPPINGS; static final String KETTLE_CARTE_JETTY_ACCEPTORS; static final String KETTLE_CARTE_JETTY_ACCEPT_QUEUE_SIZE; static final String KETTLE_CARTE_JETTY_RES_MAX_IDLE_TIME; static final String VFS_USER_DIR_IS_ROOT; }
@Test public void testNrSpacesAfter() { try { Const.nrSpacesAfter( null ); fail( "Expected NullPointerException" ); } catch ( NullPointerException ex ) { } assertEquals( 0, Const.nrSpacesAfter( "" ) ); assertEquals( 1, Const.nrSpacesAfter( " " ) ); assertEquals( 3, Const.nrSpacesAfter( " " ) ); assertEquals( 0, Const.nrSpacesAfter( "test" ) ); assertEquals( 2, Const.nrSpacesAfter( "test " ) ); assertEquals( 0, Const.nrSpacesAfter( " test" ) ); assertEquals( 2, Const.nrSpacesAfter( " test " ) ); }
public static int nrSpacesAfter( String field ) { int nr = 0; int len = field.length(); while ( nr < len && field.charAt( field.length() - 1 - nr ) == ' ' ) { nr++; } return nr; }
Const { public static int nrSpacesAfter( String field ) { int nr = 0; int len = field.length(); while ( nr < len && field.charAt( field.length() - 1 - nr ) == ' ' ) { nr++; } return nr; } }
Const { public static int nrSpacesAfter( String field ) { int nr = 0; int len = field.length(); while ( nr < len && field.charAt( field.length() - 1 - nr ) == ' ' ) { nr++; } return nr; } }
Const { public static int nrSpacesAfter( String field ) { int nr = 0; int len = field.length(); while ( nr < len && field.charAt( field.length() - 1 - nr ) == ' ' ) { nr++; } return nr; } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); }
Const { public static int nrSpacesAfter( String field ) { int nr = 0; int len = field.length(); while ( nr < len && field.charAt( field.length() - 1 - nr ) == ' ' ) { nr++; } return nr; } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); @Deprecated static final String VERSION; static final String COPYRIGHT_YEAR; static final int TIMEOUT_GET_MILLIS; static final int TIMEOUT_PUT_MILLIS; static final int ROWS_UPDATE; static final int ROWS_IN_ROWSET; static final int FETCH_SIZE; static final int SORT_SIZE; static final int HEARTBEAT_PERIODIC_INTERVAL_IN_SECS; static final String FILE_SEPARATOR; static final String PATH_SEPARATOR; static final String CR; static final String DOSCR; static final String EMPTY_STRING; static final String JAVA_VERSION; @Deprecated static final String USER_HOME_DIRECTORY; static String JNDI_DIRECTORY; static final String PLUGIN_BASE_FOLDERS_PROP; static final String DEFAULT_PLUGIN_BASE_FOLDERS; static final Date MIN_DATE; static final Date MAX_DATE; static final int MIN_YEAR; static final int MAX_YEAR; static final int RIGHT; static final int LENGTH; static final int MARGIN; static final int MIDDLE_PCT; static final int ARROW_WIDTH; static final int FORM_MARGIN; static final int SHADOW_SIZE; static final int SYMBOLSIZE; static final int MAX_FILE_HIST; static final Locale DEFAULT_LOCALE; static final char DEFAULT_DECIMAL_SEPARATOR; static final char DEFAULT_GROUPING_SEPARATOR; static final String DEFAULT_CURRENCY_SYMBOL; static final String DEFAULT_NUMBER_FORMAT; static final String NULL_STRING; static final String NULL_NUMBER; static final String NULL_DATE; static final String NULL_BIGNUMBER; static final String NULL_BOOLEAN; static final String NULL_INTEGER; static final String NULL_BINARY; static final String NULL_NONE; static final int ROUND_HALF_CEILING; static final String CHEF_LOG_FILE; static final String SPOON_LOG_FILE; static final String MENU_LOG_FILE; static final String GENERALIZED_DATE_TIME_FORMAT; static final String GENERALIZED_DATE_TIME_FORMAT_MILLIS; static final String XML_ENCODING; static final String[] STRING_TRANS_AND_JOB_FILTER_EXT; static final String STRING_TRANS_DEFAULT_EXT; static final String[] STRING_TRANS_FILTER_EXT; static final String STRING_JOB_DEFAULT_EXT; static final String[] STRING_JOB_FILTER_EXT; static final String KETTLE_PROPERTIES; static final String SHARED_DATA_FILE; static final String INTERNAL_VARIABLE_PREFIX; static final String INTERNAL_VARIABLE_KETTLE_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_DATE; static final String INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_FILENAME_NAME; static final String INTERNAL_VARIABLE_JOB_NAME; static final String INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_RUN_ID; static final String INTERNAL_VARIABLE_JOB_RUN_ATTEMPTNR; static final String VARIABLE_HEARTBEAT_PERIODIC_INTERVAL_SECS; static final String VARIABLE_MONITORING_SNMP_TRAPS_ENABLED; static final String INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY; static final String[] INTERNAL_TRANS_VARIABLES; static final String[] INTERNAL_JOB_VARIABLES; static final String[] DEPRECATED_VARIABLES; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_STEP_PARTITION_ID; static final String INTERNAL_VARIABLE_STEP_PARTITION_NR; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NUMBER; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NAME; static final String INTERNAL_VARIABLE_CLUSTER_SIZE; static final String INTERNAL_VARIABLE_STEP_UNIQUE_NUMBER; static final String INTERNAL_VARIABLE_CLUSTER_MASTER; static final String INTERNAL_VARIABLE_CLUSTER_RUN_ID; static final String INTERNAL_VARIABLE_STEP_UNIQUE_COUNT; static final String INTERNAL_VARIABLE_STEP_NAME; static final String INTERNAL_VARIABLE_STEP_COPYNR; static final int MAX_NR_LOG_LINES; static final int MAX_NR_HISTORY_LINES; static final int HISTORY_LINES_FETCH_SIZE; static final int MAX_LOG_LINE_TIMEOUT_MINUTES; static final int WARNING; static final int ERROR; static final int INFO; static final int NOTE_MARGIN; static final int MAX_UNDO; static final String KETTLE_VARIABLES_FILE; static final String KETTLE_LOG_SIZE_LIMIT; static final String KETTLE_TRANS_LOG_DB; static final String KETTLE_TRANS_LOG_SCHEMA; static final String KETTLE_TRANS_LOG_TABLE; static final String KETTLE_JOB_LOG_DB; static final String KETTLE_JOB_LOG_SCHEMA; static final String KETTLE_SLAVE_DETECTION_TIMER; static final String KETTLE_JOB_LOG_TABLE; static final String KETTLE_TRANS_PERFORMANCE_LOG_DB; static final String KETTLE_TRANS_PERFORMANCE_LOG_SCHEMA; static final String KETTLE_TRANS_PERFORMANCE_LOG_TABLE; static final String KETTLE_JOBENTRY_LOG_DB; static final String KETTLE_JOBENTRY_LOG_SCHEMA; static final String KETTLE_JOBENTRY_LOG_TABLE; static final String KETTLE_STEP_LOG_DB; static final String KETTLE_STEP_LOG_SCHEMA; static final String KETTLE_STEP_LOG_TABLE; static final String KETTLE_CHANNEL_LOG_DB; static final String KETTLE_CHANNEL_LOG_SCHEMA; static final String KETTLE_CHANNEL_LOG_TABLE; static final String KETTLE_METRICS_LOG_DB; static final String KETTLE_METRICS_LOG_SCHEMA; static final String KETTLE_METRICS_LOG_TABLE; static final String KETTLE_CHECKPOINT_LOG_DB; static final String KETTLE_CHECKPOINT_LOG_SCHEMA; static final String KETTLE_CHECKPOINT_LOG_TABLE; static final String KETTLE_SHARED_OBJECTS; static final String KETTLE_EMPTY_STRING_DIFFERS_FROM_NULL; static final String KETTLE_LENIENT_STRING_TO_NUMBER_CONVERSION; static final String KETTLE_COMPATIBILITY_DB_IGNORE_TIMEZONE; static final String KETTLE_COMPATIBILITY_IMPORT_PATH_ADDITION_ON_VARIABLES; static final String KETTLE_COMPATIBILITY_IGNORE_TABLE_LOGGING; static final String KETTLE_COMPATIBILITY_TEXT_FILE_OUTPUT_APPEND_NO_HEADER; static final String KETTLE_COMPATIBILITY_MERGE_ROWS_USE_REFERENCE_STREAM_WHEN_IDENTICAL; static final String KETTLE_COMPATIBILITY_MEMORY_GROUP_BY_SUM_AVERAGE_RETURN_NUMBER_TYPE; static final String KETTLE_SYSTEM_HOSTNAME; static final String KETTLE_MAX_LOG_SIZE_IN_LINES; static final String KETTLE_MAX_LOG_TIMEOUT_IN_MINUTES; static final String KETTLE_REDIRECT_STDERR; static final String KETTLE_REDIRECT_STDOUT; static final String KETTLE_CARTE_OBJECT_TIMEOUT_MINUTES; static final String KETTLE_STEP_PERFORMANCE_SNAPSHOT_LIMIT; static final String KETTLE_MAX_JOB_TRACKER_SIZE; static final String KETTLE_MAX_JOB_ENTRIES_LOGGED; static final String KETTLE_MAX_LOGGING_REGISTRY_SIZE; static final String KETTLE_LOG_TAB_REFRESH_DELAY; static final String KETTLE_LOG_TAB_REFRESH_PERIOD; static final String KETTLE_SAP_CONNECTION_FACTORY; static final String KETTLE_SAP_CONNECTION_FACTORY_DEFAULT_NAME; static final String KETTLE_PLUGIN_CLASSES; static final String KETTLE_PLUGIN_PACKAGES; static final String KETTLE_TRANS_ROWSET_SIZE; static final String VERSION_COMMENT_INITIAL_VERSION; static final String VERSION_COMMENT_EDIT_VERSION; static final String XML_FILE_KETTLE_STEPS; static final String KETTLE_CORE_STEPS_FILE; static final String XML_FILE_KETTLE_PARTITION_PLUGINS; static final String KETTLE_CORE_JOBENTRIES_FILE; static final String XML_FILE_KETTLE_SERVLETS; static final String XML_FILE_KETTLE_VALUEMETA_PLUGINS; static final String XML_FILE_KETTLE_PASSWORD_ENCODER_PLUGINS; static final String KETTLE_VALUEMETA_PLUGINS_FILE; static final String KETTLE_PASSWORD_ENCODER_PLUGIN; static final String KETTLE_PASSWORD_ENCODER_PLUGINS_FILE; static final String KETTLE_TWO_WAY_PASSWORD_ENCODER_SEED; static final String XML_FILE_KETTLE_LOGGING_PLUGINS; static final String KETTLE_LOGGING_PLUGINS_FILE; static final String KETTLE_CORE_SERVLETS_FILE; static final String KETTLE_ROWSET_GET_TIMEOUT; static final String KETTLE_ROWSET_PUT_TIMEOUT; static final String KETTLE_BATCHING_ROWSET; static final String KETTLE_DISABLE_CONSOLE_LOGGING; static final String XML_FILE_KETTLE_JOB_ENTRIES; static final String XML_FILE_KETTLE_REPOSITORIES; static final String XML_FILE_KETTLE_DATABASE_TYPES; static final String XML_FILE_KETTLE_COMPRESSION_PROVIDERS; static final String XML_FILE_KETTLE_AUTHENTICATION_PROVIDERS; static final String XML_FILE_KETTLE_EXTENSION_POINTS; static final String XML_FILE_KETTLE_REGISTRY_EXTENSIONS; static final String XML_FILE_KETTLE_LIFECYCLE_LISTENERS; static final String XML_FILE_KETTLE_ENGINES; static final String KETTLE_TRANS_PAN_JVM_EXIT_CODE; static final String KETTLE_DEFAULT_NUMBER_FORMAT; static final String KETTLE_DEFAULT_BIGNUMBER_FORMAT; static final String KETTLE_DEFAULT_INTEGER_FORMAT; static final String KETTLE_DEFAULT_DATE_FORMAT; static final String KETTLE_AGGREGATION_MIN_NULL_IS_VALUED; static final String KETTLE_AGGREGATION_ALL_NULLS_ARE_ZERO; static final String KETTLE_DEFAULT_TIMESTAMP_FORMAT; static final String KETTLE_SPLIT_FIELDS_REMOVE_ENCLOSURE; static final String KETTLE_GLOBAL_LOG_VARIABLES_CLEAR_ON_EXPORT; static final String KETTLE_COMPATIBILITY_CALCULATION_TIMEZONE_DECOMPOSITION; static final String KETTLE_COMPATIBILITY_SET_ERROR_ON_SPECIFIC_JOB_ENTRIES; static final String KETTLE_COMPATIBILITY_SEND_RESULT_XML_WITH_FULL_STATUS; static final String KETTLE_COMPATIBILITY_SELECT_VALUES_TYPE_CHANGE_USES_TYPE_DEFAULTS; static final String XML_FILE_KETTLE_IMPORT_RULES; static final ReleaseType RELEASE; static final String PENTAHO_METASTORE_FOLDER; static final String PENTAHO_METASTORE_NAME; static final String KETTLE_LOG_MARK_MAPPINGS; static final String KETTLE_CARTE_JETTY_ACCEPTORS; static final String KETTLE_CARTE_JETTY_ACCEPT_QUEUE_SIZE; static final String KETTLE_CARTE_JETTY_RES_MAX_IDLE_TIME; static final String VFS_USER_DIR_IS_ROOT; }
@Test public void testLtrim() { assertEquals( null, Const.ltrim( null ) ); assertEquals( "", Const.ltrim( "" ) ); assertEquals( "", Const.ltrim( " " ) ); assertEquals( "test ", Const.ltrim( "test " ) ); assertEquals( "test ", Const.ltrim( " test " ) ); }
public static String ltrim( String source ) { if ( source == null ) { return null; } int from = 0; while ( from < source.length() && isSpace( source.charAt( from ) ) ) { from++; } return source.substring( from ); }
Const { public static String ltrim( String source ) { if ( source == null ) { return null; } int from = 0; while ( from < source.length() && isSpace( source.charAt( from ) ) ) { from++; } return source.substring( from ); } }
Const { public static String ltrim( String source ) { if ( source == null ) { return null; } int from = 0; while ( from < source.length() && isSpace( source.charAt( from ) ) ) { from++; } return source.substring( from ); } }
Const { public static String ltrim( String source ) { if ( source == null ) { return null; } int from = 0; while ( from < source.length() && isSpace( source.charAt( from ) ) ) { from++; } return source.substring( from ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); }
Const { public static String ltrim( String source ) { if ( source == null ) { return null; } int from = 0; while ( from < source.length() && isSpace( source.charAt( from ) ) ) { from++; } return source.substring( from ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); @Deprecated static final String VERSION; static final String COPYRIGHT_YEAR; static final int TIMEOUT_GET_MILLIS; static final int TIMEOUT_PUT_MILLIS; static final int ROWS_UPDATE; static final int ROWS_IN_ROWSET; static final int FETCH_SIZE; static final int SORT_SIZE; static final int HEARTBEAT_PERIODIC_INTERVAL_IN_SECS; static final String FILE_SEPARATOR; static final String PATH_SEPARATOR; static final String CR; static final String DOSCR; static final String EMPTY_STRING; static final String JAVA_VERSION; @Deprecated static final String USER_HOME_DIRECTORY; static String JNDI_DIRECTORY; static final String PLUGIN_BASE_FOLDERS_PROP; static final String DEFAULT_PLUGIN_BASE_FOLDERS; static final Date MIN_DATE; static final Date MAX_DATE; static final int MIN_YEAR; static final int MAX_YEAR; static final int RIGHT; static final int LENGTH; static final int MARGIN; static final int MIDDLE_PCT; static final int ARROW_WIDTH; static final int FORM_MARGIN; static final int SHADOW_SIZE; static final int SYMBOLSIZE; static final int MAX_FILE_HIST; static final Locale DEFAULT_LOCALE; static final char DEFAULT_DECIMAL_SEPARATOR; static final char DEFAULT_GROUPING_SEPARATOR; static final String DEFAULT_CURRENCY_SYMBOL; static final String DEFAULT_NUMBER_FORMAT; static final String NULL_STRING; static final String NULL_NUMBER; static final String NULL_DATE; static final String NULL_BIGNUMBER; static final String NULL_BOOLEAN; static final String NULL_INTEGER; static final String NULL_BINARY; static final String NULL_NONE; static final int ROUND_HALF_CEILING; static final String CHEF_LOG_FILE; static final String SPOON_LOG_FILE; static final String MENU_LOG_FILE; static final String GENERALIZED_DATE_TIME_FORMAT; static final String GENERALIZED_DATE_TIME_FORMAT_MILLIS; static final String XML_ENCODING; static final String[] STRING_TRANS_AND_JOB_FILTER_EXT; static final String STRING_TRANS_DEFAULT_EXT; static final String[] STRING_TRANS_FILTER_EXT; static final String STRING_JOB_DEFAULT_EXT; static final String[] STRING_JOB_FILTER_EXT; static final String KETTLE_PROPERTIES; static final String SHARED_DATA_FILE; static final String INTERNAL_VARIABLE_PREFIX; static final String INTERNAL_VARIABLE_KETTLE_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_DATE; static final String INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_FILENAME_NAME; static final String INTERNAL_VARIABLE_JOB_NAME; static final String INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_RUN_ID; static final String INTERNAL_VARIABLE_JOB_RUN_ATTEMPTNR; static final String VARIABLE_HEARTBEAT_PERIODIC_INTERVAL_SECS; static final String VARIABLE_MONITORING_SNMP_TRAPS_ENABLED; static final String INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY; static final String[] INTERNAL_TRANS_VARIABLES; static final String[] INTERNAL_JOB_VARIABLES; static final String[] DEPRECATED_VARIABLES; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_STEP_PARTITION_ID; static final String INTERNAL_VARIABLE_STEP_PARTITION_NR; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NUMBER; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NAME; static final String INTERNAL_VARIABLE_CLUSTER_SIZE; static final String INTERNAL_VARIABLE_STEP_UNIQUE_NUMBER; static final String INTERNAL_VARIABLE_CLUSTER_MASTER; static final String INTERNAL_VARIABLE_CLUSTER_RUN_ID; static final String INTERNAL_VARIABLE_STEP_UNIQUE_COUNT; static final String INTERNAL_VARIABLE_STEP_NAME; static final String INTERNAL_VARIABLE_STEP_COPYNR; static final int MAX_NR_LOG_LINES; static final int MAX_NR_HISTORY_LINES; static final int HISTORY_LINES_FETCH_SIZE; static final int MAX_LOG_LINE_TIMEOUT_MINUTES; static final int WARNING; static final int ERROR; static final int INFO; static final int NOTE_MARGIN; static final int MAX_UNDO; static final String KETTLE_VARIABLES_FILE; static final String KETTLE_LOG_SIZE_LIMIT; static final String KETTLE_TRANS_LOG_DB; static final String KETTLE_TRANS_LOG_SCHEMA; static final String KETTLE_TRANS_LOG_TABLE; static final String KETTLE_JOB_LOG_DB; static final String KETTLE_JOB_LOG_SCHEMA; static final String KETTLE_SLAVE_DETECTION_TIMER; static final String KETTLE_JOB_LOG_TABLE; static final String KETTLE_TRANS_PERFORMANCE_LOG_DB; static final String KETTLE_TRANS_PERFORMANCE_LOG_SCHEMA; static final String KETTLE_TRANS_PERFORMANCE_LOG_TABLE; static final String KETTLE_JOBENTRY_LOG_DB; static final String KETTLE_JOBENTRY_LOG_SCHEMA; static final String KETTLE_JOBENTRY_LOG_TABLE; static final String KETTLE_STEP_LOG_DB; static final String KETTLE_STEP_LOG_SCHEMA; static final String KETTLE_STEP_LOG_TABLE; static final String KETTLE_CHANNEL_LOG_DB; static final String KETTLE_CHANNEL_LOG_SCHEMA; static final String KETTLE_CHANNEL_LOG_TABLE; static final String KETTLE_METRICS_LOG_DB; static final String KETTLE_METRICS_LOG_SCHEMA; static final String KETTLE_METRICS_LOG_TABLE; static final String KETTLE_CHECKPOINT_LOG_DB; static final String KETTLE_CHECKPOINT_LOG_SCHEMA; static final String KETTLE_CHECKPOINT_LOG_TABLE; static final String KETTLE_SHARED_OBJECTS; static final String KETTLE_EMPTY_STRING_DIFFERS_FROM_NULL; static final String KETTLE_LENIENT_STRING_TO_NUMBER_CONVERSION; static final String KETTLE_COMPATIBILITY_DB_IGNORE_TIMEZONE; static final String KETTLE_COMPATIBILITY_IMPORT_PATH_ADDITION_ON_VARIABLES; static final String KETTLE_COMPATIBILITY_IGNORE_TABLE_LOGGING; static final String KETTLE_COMPATIBILITY_TEXT_FILE_OUTPUT_APPEND_NO_HEADER; static final String KETTLE_COMPATIBILITY_MERGE_ROWS_USE_REFERENCE_STREAM_WHEN_IDENTICAL; static final String KETTLE_COMPATIBILITY_MEMORY_GROUP_BY_SUM_AVERAGE_RETURN_NUMBER_TYPE; static final String KETTLE_SYSTEM_HOSTNAME; static final String KETTLE_MAX_LOG_SIZE_IN_LINES; static final String KETTLE_MAX_LOG_TIMEOUT_IN_MINUTES; static final String KETTLE_REDIRECT_STDERR; static final String KETTLE_REDIRECT_STDOUT; static final String KETTLE_CARTE_OBJECT_TIMEOUT_MINUTES; static final String KETTLE_STEP_PERFORMANCE_SNAPSHOT_LIMIT; static final String KETTLE_MAX_JOB_TRACKER_SIZE; static final String KETTLE_MAX_JOB_ENTRIES_LOGGED; static final String KETTLE_MAX_LOGGING_REGISTRY_SIZE; static final String KETTLE_LOG_TAB_REFRESH_DELAY; static final String KETTLE_LOG_TAB_REFRESH_PERIOD; static final String KETTLE_SAP_CONNECTION_FACTORY; static final String KETTLE_SAP_CONNECTION_FACTORY_DEFAULT_NAME; static final String KETTLE_PLUGIN_CLASSES; static final String KETTLE_PLUGIN_PACKAGES; static final String KETTLE_TRANS_ROWSET_SIZE; static final String VERSION_COMMENT_INITIAL_VERSION; static final String VERSION_COMMENT_EDIT_VERSION; static final String XML_FILE_KETTLE_STEPS; static final String KETTLE_CORE_STEPS_FILE; static final String XML_FILE_KETTLE_PARTITION_PLUGINS; static final String KETTLE_CORE_JOBENTRIES_FILE; static final String XML_FILE_KETTLE_SERVLETS; static final String XML_FILE_KETTLE_VALUEMETA_PLUGINS; static final String XML_FILE_KETTLE_PASSWORD_ENCODER_PLUGINS; static final String KETTLE_VALUEMETA_PLUGINS_FILE; static final String KETTLE_PASSWORD_ENCODER_PLUGIN; static final String KETTLE_PASSWORD_ENCODER_PLUGINS_FILE; static final String KETTLE_TWO_WAY_PASSWORD_ENCODER_SEED; static final String XML_FILE_KETTLE_LOGGING_PLUGINS; static final String KETTLE_LOGGING_PLUGINS_FILE; static final String KETTLE_CORE_SERVLETS_FILE; static final String KETTLE_ROWSET_GET_TIMEOUT; static final String KETTLE_ROWSET_PUT_TIMEOUT; static final String KETTLE_BATCHING_ROWSET; static final String KETTLE_DISABLE_CONSOLE_LOGGING; static final String XML_FILE_KETTLE_JOB_ENTRIES; static final String XML_FILE_KETTLE_REPOSITORIES; static final String XML_FILE_KETTLE_DATABASE_TYPES; static final String XML_FILE_KETTLE_COMPRESSION_PROVIDERS; static final String XML_FILE_KETTLE_AUTHENTICATION_PROVIDERS; static final String XML_FILE_KETTLE_EXTENSION_POINTS; static final String XML_FILE_KETTLE_REGISTRY_EXTENSIONS; static final String XML_FILE_KETTLE_LIFECYCLE_LISTENERS; static final String XML_FILE_KETTLE_ENGINES; static final String KETTLE_TRANS_PAN_JVM_EXIT_CODE; static final String KETTLE_DEFAULT_NUMBER_FORMAT; static final String KETTLE_DEFAULT_BIGNUMBER_FORMAT; static final String KETTLE_DEFAULT_INTEGER_FORMAT; static final String KETTLE_DEFAULT_DATE_FORMAT; static final String KETTLE_AGGREGATION_MIN_NULL_IS_VALUED; static final String KETTLE_AGGREGATION_ALL_NULLS_ARE_ZERO; static final String KETTLE_DEFAULT_TIMESTAMP_FORMAT; static final String KETTLE_SPLIT_FIELDS_REMOVE_ENCLOSURE; static final String KETTLE_GLOBAL_LOG_VARIABLES_CLEAR_ON_EXPORT; static final String KETTLE_COMPATIBILITY_CALCULATION_TIMEZONE_DECOMPOSITION; static final String KETTLE_COMPATIBILITY_SET_ERROR_ON_SPECIFIC_JOB_ENTRIES; static final String KETTLE_COMPATIBILITY_SEND_RESULT_XML_WITH_FULL_STATUS; static final String KETTLE_COMPATIBILITY_SELECT_VALUES_TYPE_CHANGE_USES_TYPE_DEFAULTS; static final String XML_FILE_KETTLE_IMPORT_RULES; static final ReleaseType RELEASE; static final String PENTAHO_METASTORE_FOLDER; static final String PENTAHO_METASTORE_NAME; static final String KETTLE_LOG_MARK_MAPPINGS; static final String KETTLE_CARTE_JETTY_ACCEPTORS; static final String KETTLE_CARTE_JETTY_ACCEPT_QUEUE_SIZE; static final String KETTLE_CARTE_JETTY_RES_MAX_IDLE_TIME; static final String VFS_USER_DIR_IS_ROOT; }
@Test public void testRtrim() { assertEquals( null, Const.rtrim( null ) ); assertEquals( "", Const.rtrim( "" ) ); assertEquals( "", Const.rtrim( " " ) ); assertEquals( "test", Const.rtrim( "test " ) ); assertEquals( "test ", Const.ltrim( " test " ) ); }
public static String rtrim( String source ) { if ( source == null ) { return null; } int max = source.length(); while ( max > 0 && isSpace( source.charAt( max - 1 ) ) ) { max--; } return source.substring( 0, max ); }
Const { public static String rtrim( String source ) { if ( source == null ) { return null; } int max = source.length(); while ( max > 0 && isSpace( source.charAt( max - 1 ) ) ) { max--; } return source.substring( 0, max ); } }
Const { public static String rtrim( String source ) { if ( source == null ) { return null; } int max = source.length(); while ( max > 0 && isSpace( source.charAt( max - 1 ) ) ) { max--; } return source.substring( 0, max ); } }
Const { public static String rtrim( String source ) { if ( source == null ) { return null; } int max = source.length(); while ( max > 0 && isSpace( source.charAt( max - 1 ) ) ) { max--; } return source.substring( 0, max ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); }
Const { public static String rtrim( String source ) { if ( source == null ) { return null; } int max = source.length(); while ( max > 0 && isSpace( source.charAt( max - 1 ) ) ) { max--; } return source.substring( 0, max ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); @Deprecated static final String VERSION; static final String COPYRIGHT_YEAR; static final int TIMEOUT_GET_MILLIS; static final int TIMEOUT_PUT_MILLIS; static final int ROWS_UPDATE; static final int ROWS_IN_ROWSET; static final int FETCH_SIZE; static final int SORT_SIZE; static final int HEARTBEAT_PERIODIC_INTERVAL_IN_SECS; static final String FILE_SEPARATOR; static final String PATH_SEPARATOR; static final String CR; static final String DOSCR; static final String EMPTY_STRING; static final String JAVA_VERSION; @Deprecated static final String USER_HOME_DIRECTORY; static String JNDI_DIRECTORY; static final String PLUGIN_BASE_FOLDERS_PROP; static final String DEFAULT_PLUGIN_BASE_FOLDERS; static final Date MIN_DATE; static final Date MAX_DATE; static final int MIN_YEAR; static final int MAX_YEAR; static final int RIGHT; static final int LENGTH; static final int MARGIN; static final int MIDDLE_PCT; static final int ARROW_WIDTH; static final int FORM_MARGIN; static final int SHADOW_SIZE; static final int SYMBOLSIZE; static final int MAX_FILE_HIST; static final Locale DEFAULT_LOCALE; static final char DEFAULT_DECIMAL_SEPARATOR; static final char DEFAULT_GROUPING_SEPARATOR; static final String DEFAULT_CURRENCY_SYMBOL; static final String DEFAULT_NUMBER_FORMAT; static final String NULL_STRING; static final String NULL_NUMBER; static final String NULL_DATE; static final String NULL_BIGNUMBER; static final String NULL_BOOLEAN; static final String NULL_INTEGER; static final String NULL_BINARY; static final String NULL_NONE; static final int ROUND_HALF_CEILING; static final String CHEF_LOG_FILE; static final String SPOON_LOG_FILE; static final String MENU_LOG_FILE; static final String GENERALIZED_DATE_TIME_FORMAT; static final String GENERALIZED_DATE_TIME_FORMAT_MILLIS; static final String XML_ENCODING; static final String[] STRING_TRANS_AND_JOB_FILTER_EXT; static final String STRING_TRANS_DEFAULT_EXT; static final String[] STRING_TRANS_FILTER_EXT; static final String STRING_JOB_DEFAULT_EXT; static final String[] STRING_JOB_FILTER_EXT; static final String KETTLE_PROPERTIES; static final String SHARED_DATA_FILE; static final String INTERNAL_VARIABLE_PREFIX; static final String INTERNAL_VARIABLE_KETTLE_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_DATE; static final String INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_FILENAME_NAME; static final String INTERNAL_VARIABLE_JOB_NAME; static final String INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_RUN_ID; static final String INTERNAL_VARIABLE_JOB_RUN_ATTEMPTNR; static final String VARIABLE_HEARTBEAT_PERIODIC_INTERVAL_SECS; static final String VARIABLE_MONITORING_SNMP_TRAPS_ENABLED; static final String INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY; static final String[] INTERNAL_TRANS_VARIABLES; static final String[] INTERNAL_JOB_VARIABLES; static final String[] DEPRECATED_VARIABLES; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_STEP_PARTITION_ID; static final String INTERNAL_VARIABLE_STEP_PARTITION_NR; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NUMBER; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NAME; static final String INTERNAL_VARIABLE_CLUSTER_SIZE; static final String INTERNAL_VARIABLE_STEP_UNIQUE_NUMBER; static final String INTERNAL_VARIABLE_CLUSTER_MASTER; static final String INTERNAL_VARIABLE_CLUSTER_RUN_ID; static final String INTERNAL_VARIABLE_STEP_UNIQUE_COUNT; static final String INTERNAL_VARIABLE_STEP_NAME; static final String INTERNAL_VARIABLE_STEP_COPYNR; static final int MAX_NR_LOG_LINES; static final int MAX_NR_HISTORY_LINES; static final int HISTORY_LINES_FETCH_SIZE; static final int MAX_LOG_LINE_TIMEOUT_MINUTES; static final int WARNING; static final int ERROR; static final int INFO; static final int NOTE_MARGIN; static final int MAX_UNDO; static final String KETTLE_VARIABLES_FILE; static final String KETTLE_LOG_SIZE_LIMIT; static final String KETTLE_TRANS_LOG_DB; static final String KETTLE_TRANS_LOG_SCHEMA; static final String KETTLE_TRANS_LOG_TABLE; static final String KETTLE_JOB_LOG_DB; static final String KETTLE_JOB_LOG_SCHEMA; static final String KETTLE_SLAVE_DETECTION_TIMER; static final String KETTLE_JOB_LOG_TABLE; static final String KETTLE_TRANS_PERFORMANCE_LOG_DB; static final String KETTLE_TRANS_PERFORMANCE_LOG_SCHEMA; static final String KETTLE_TRANS_PERFORMANCE_LOG_TABLE; static final String KETTLE_JOBENTRY_LOG_DB; static final String KETTLE_JOBENTRY_LOG_SCHEMA; static final String KETTLE_JOBENTRY_LOG_TABLE; static final String KETTLE_STEP_LOG_DB; static final String KETTLE_STEP_LOG_SCHEMA; static final String KETTLE_STEP_LOG_TABLE; static final String KETTLE_CHANNEL_LOG_DB; static final String KETTLE_CHANNEL_LOG_SCHEMA; static final String KETTLE_CHANNEL_LOG_TABLE; static final String KETTLE_METRICS_LOG_DB; static final String KETTLE_METRICS_LOG_SCHEMA; static final String KETTLE_METRICS_LOG_TABLE; static final String KETTLE_CHECKPOINT_LOG_DB; static final String KETTLE_CHECKPOINT_LOG_SCHEMA; static final String KETTLE_CHECKPOINT_LOG_TABLE; static final String KETTLE_SHARED_OBJECTS; static final String KETTLE_EMPTY_STRING_DIFFERS_FROM_NULL; static final String KETTLE_LENIENT_STRING_TO_NUMBER_CONVERSION; static final String KETTLE_COMPATIBILITY_DB_IGNORE_TIMEZONE; static final String KETTLE_COMPATIBILITY_IMPORT_PATH_ADDITION_ON_VARIABLES; static final String KETTLE_COMPATIBILITY_IGNORE_TABLE_LOGGING; static final String KETTLE_COMPATIBILITY_TEXT_FILE_OUTPUT_APPEND_NO_HEADER; static final String KETTLE_COMPATIBILITY_MERGE_ROWS_USE_REFERENCE_STREAM_WHEN_IDENTICAL; static final String KETTLE_COMPATIBILITY_MEMORY_GROUP_BY_SUM_AVERAGE_RETURN_NUMBER_TYPE; static final String KETTLE_SYSTEM_HOSTNAME; static final String KETTLE_MAX_LOG_SIZE_IN_LINES; static final String KETTLE_MAX_LOG_TIMEOUT_IN_MINUTES; static final String KETTLE_REDIRECT_STDERR; static final String KETTLE_REDIRECT_STDOUT; static final String KETTLE_CARTE_OBJECT_TIMEOUT_MINUTES; static final String KETTLE_STEP_PERFORMANCE_SNAPSHOT_LIMIT; static final String KETTLE_MAX_JOB_TRACKER_SIZE; static final String KETTLE_MAX_JOB_ENTRIES_LOGGED; static final String KETTLE_MAX_LOGGING_REGISTRY_SIZE; static final String KETTLE_LOG_TAB_REFRESH_DELAY; static final String KETTLE_LOG_TAB_REFRESH_PERIOD; static final String KETTLE_SAP_CONNECTION_FACTORY; static final String KETTLE_SAP_CONNECTION_FACTORY_DEFAULT_NAME; static final String KETTLE_PLUGIN_CLASSES; static final String KETTLE_PLUGIN_PACKAGES; static final String KETTLE_TRANS_ROWSET_SIZE; static final String VERSION_COMMENT_INITIAL_VERSION; static final String VERSION_COMMENT_EDIT_VERSION; static final String XML_FILE_KETTLE_STEPS; static final String KETTLE_CORE_STEPS_FILE; static final String XML_FILE_KETTLE_PARTITION_PLUGINS; static final String KETTLE_CORE_JOBENTRIES_FILE; static final String XML_FILE_KETTLE_SERVLETS; static final String XML_FILE_KETTLE_VALUEMETA_PLUGINS; static final String XML_FILE_KETTLE_PASSWORD_ENCODER_PLUGINS; static final String KETTLE_VALUEMETA_PLUGINS_FILE; static final String KETTLE_PASSWORD_ENCODER_PLUGIN; static final String KETTLE_PASSWORD_ENCODER_PLUGINS_FILE; static final String KETTLE_TWO_WAY_PASSWORD_ENCODER_SEED; static final String XML_FILE_KETTLE_LOGGING_PLUGINS; static final String KETTLE_LOGGING_PLUGINS_FILE; static final String KETTLE_CORE_SERVLETS_FILE; static final String KETTLE_ROWSET_GET_TIMEOUT; static final String KETTLE_ROWSET_PUT_TIMEOUT; static final String KETTLE_BATCHING_ROWSET; static final String KETTLE_DISABLE_CONSOLE_LOGGING; static final String XML_FILE_KETTLE_JOB_ENTRIES; static final String XML_FILE_KETTLE_REPOSITORIES; static final String XML_FILE_KETTLE_DATABASE_TYPES; static final String XML_FILE_KETTLE_COMPRESSION_PROVIDERS; static final String XML_FILE_KETTLE_AUTHENTICATION_PROVIDERS; static final String XML_FILE_KETTLE_EXTENSION_POINTS; static final String XML_FILE_KETTLE_REGISTRY_EXTENSIONS; static final String XML_FILE_KETTLE_LIFECYCLE_LISTENERS; static final String XML_FILE_KETTLE_ENGINES; static final String KETTLE_TRANS_PAN_JVM_EXIT_CODE; static final String KETTLE_DEFAULT_NUMBER_FORMAT; static final String KETTLE_DEFAULT_BIGNUMBER_FORMAT; static final String KETTLE_DEFAULT_INTEGER_FORMAT; static final String KETTLE_DEFAULT_DATE_FORMAT; static final String KETTLE_AGGREGATION_MIN_NULL_IS_VALUED; static final String KETTLE_AGGREGATION_ALL_NULLS_ARE_ZERO; static final String KETTLE_DEFAULT_TIMESTAMP_FORMAT; static final String KETTLE_SPLIT_FIELDS_REMOVE_ENCLOSURE; static final String KETTLE_GLOBAL_LOG_VARIABLES_CLEAR_ON_EXPORT; static final String KETTLE_COMPATIBILITY_CALCULATION_TIMEZONE_DECOMPOSITION; static final String KETTLE_COMPATIBILITY_SET_ERROR_ON_SPECIFIC_JOB_ENTRIES; static final String KETTLE_COMPATIBILITY_SEND_RESULT_XML_WITH_FULL_STATUS; static final String KETTLE_COMPATIBILITY_SELECT_VALUES_TYPE_CHANGE_USES_TYPE_DEFAULTS; static final String XML_FILE_KETTLE_IMPORT_RULES; static final ReleaseType RELEASE; static final String PENTAHO_METASTORE_FOLDER; static final String PENTAHO_METASTORE_NAME; static final String KETTLE_LOG_MARK_MAPPINGS; static final String KETTLE_CARTE_JETTY_ACCEPTORS; static final String KETTLE_CARTE_JETTY_ACCEPT_QUEUE_SIZE; static final String KETTLE_CARTE_JETTY_RES_MAX_IDLE_TIME; static final String VFS_USER_DIR_IS_ROOT; }
@Test public void testTrim() { assertEquals( null, Const.trim( null ) ); assertEquals( "", Const.trim( "" ) ); assertEquals( "", Const.trim( " " ) ); assertEquals( "test", Const.trim( "test " ) ); assertEquals( "test", Const.trim( " test " ) ); }
public static String trim( String str ) { if ( str == null ) { return null; } int max = str.length() - 1; int min = 0; while ( min <= max && isSpace( str.charAt( min ) ) ) { min++; } while ( max >= 0 && isSpace( str.charAt( max ) ) ) { max--; } if ( max < min ) { return ""; } return str.substring( min, max + 1 ); }
Const { public static String trim( String str ) { if ( str == null ) { return null; } int max = str.length() - 1; int min = 0; while ( min <= max && isSpace( str.charAt( min ) ) ) { min++; } while ( max >= 0 && isSpace( str.charAt( max ) ) ) { max--; } if ( max < min ) { return ""; } return str.substring( min, max + 1 ); } }
Const { public static String trim( String str ) { if ( str == null ) { return null; } int max = str.length() - 1; int min = 0; while ( min <= max && isSpace( str.charAt( min ) ) ) { min++; } while ( max >= 0 && isSpace( str.charAt( max ) ) ) { max--; } if ( max < min ) { return ""; } return str.substring( min, max + 1 ); } }
Const { public static String trim( String str ) { if ( str == null ) { return null; } int max = str.length() - 1; int min = 0; while ( min <= max && isSpace( str.charAt( min ) ) ) { min++; } while ( max >= 0 && isSpace( str.charAt( max ) ) ) { max--; } if ( max < min ) { return ""; } return str.substring( min, max + 1 ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); }
Const { public static String trim( String str ) { if ( str == null ) { return null; } int max = str.length() - 1; int min = 0; while ( min <= max && isSpace( str.charAt( min ) ) ) { min++; } while ( max >= 0 && isSpace( str.charAt( max ) ) ) { max--; } if ( max < min ) { return ""; } return str.substring( min, max + 1 ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); @Deprecated static final String VERSION; static final String COPYRIGHT_YEAR; static final int TIMEOUT_GET_MILLIS; static final int TIMEOUT_PUT_MILLIS; static final int ROWS_UPDATE; static final int ROWS_IN_ROWSET; static final int FETCH_SIZE; static final int SORT_SIZE; static final int HEARTBEAT_PERIODIC_INTERVAL_IN_SECS; static final String FILE_SEPARATOR; static final String PATH_SEPARATOR; static final String CR; static final String DOSCR; static final String EMPTY_STRING; static final String JAVA_VERSION; @Deprecated static final String USER_HOME_DIRECTORY; static String JNDI_DIRECTORY; static final String PLUGIN_BASE_FOLDERS_PROP; static final String DEFAULT_PLUGIN_BASE_FOLDERS; static final Date MIN_DATE; static final Date MAX_DATE; static final int MIN_YEAR; static final int MAX_YEAR; static final int RIGHT; static final int LENGTH; static final int MARGIN; static final int MIDDLE_PCT; static final int ARROW_WIDTH; static final int FORM_MARGIN; static final int SHADOW_SIZE; static final int SYMBOLSIZE; static final int MAX_FILE_HIST; static final Locale DEFAULT_LOCALE; static final char DEFAULT_DECIMAL_SEPARATOR; static final char DEFAULT_GROUPING_SEPARATOR; static final String DEFAULT_CURRENCY_SYMBOL; static final String DEFAULT_NUMBER_FORMAT; static final String NULL_STRING; static final String NULL_NUMBER; static final String NULL_DATE; static final String NULL_BIGNUMBER; static final String NULL_BOOLEAN; static final String NULL_INTEGER; static final String NULL_BINARY; static final String NULL_NONE; static final int ROUND_HALF_CEILING; static final String CHEF_LOG_FILE; static final String SPOON_LOG_FILE; static final String MENU_LOG_FILE; static final String GENERALIZED_DATE_TIME_FORMAT; static final String GENERALIZED_DATE_TIME_FORMAT_MILLIS; static final String XML_ENCODING; static final String[] STRING_TRANS_AND_JOB_FILTER_EXT; static final String STRING_TRANS_DEFAULT_EXT; static final String[] STRING_TRANS_FILTER_EXT; static final String STRING_JOB_DEFAULT_EXT; static final String[] STRING_JOB_FILTER_EXT; static final String KETTLE_PROPERTIES; static final String SHARED_DATA_FILE; static final String INTERNAL_VARIABLE_PREFIX; static final String INTERNAL_VARIABLE_KETTLE_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_DATE; static final String INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_FILENAME_NAME; static final String INTERNAL_VARIABLE_JOB_NAME; static final String INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_RUN_ID; static final String INTERNAL_VARIABLE_JOB_RUN_ATTEMPTNR; static final String VARIABLE_HEARTBEAT_PERIODIC_INTERVAL_SECS; static final String VARIABLE_MONITORING_SNMP_TRAPS_ENABLED; static final String INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY; static final String[] INTERNAL_TRANS_VARIABLES; static final String[] INTERNAL_JOB_VARIABLES; static final String[] DEPRECATED_VARIABLES; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_STEP_PARTITION_ID; static final String INTERNAL_VARIABLE_STEP_PARTITION_NR; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NUMBER; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NAME; static final String INTERNAL_VARIABLE_CLUSTER_SIZE; static final String INTERNAL_VARIABLE_STEP_UNIQUE_NUMBER; static final String INTERNAL_VARIABLE_CLUSTER_MASTER; static final String INTERNAL_VARIABLE_CLUSTER_RUN_ID; static final String INTERNAL_VARIABLE_STEP_UNIQUE_COUNT; static final String INTERNAL_VARIABLE_STEP_NAME; static final String INTERNAL_VARIABLE_STEP_COPYNR; static final int MAX_NR_LOG_LINES; static final int MAX_NR_HISTORY_LINES; static final int HISTORY_LINES_FETCH_SIZE; static final int MAX_LOG_LINE_TIMEOUT_MINUTES; static final int WARNING; static final int ERROR; static final int INFO; static final int NOTE_MARGIN; static final int MAX_UNDO; static final String KETTLE_VARIABLES_FILE; static final String KETTLE_LOG_SIZE_LIMIT; static final String KETTLE_TRANS_LOG_DB; static final String KETTLE_TRANS_LOG_SCHEMA; static final String KETTLE_TRANS_LOG_TABLE; static final String KETTLE_JOB_LOG_DB; static final String KETTLE_JOB_LOG_SCHEMA; static final String KETTLE_SLAVE_DETECTION_TIMER; static final String KETTLE_JOB_LOG_TABLE; static final String KETTLE_TRANS_PERFORMANCE_LOG_DB; static final String KETTLE_TRANS_PERFORMANCE_LOG_SCHEMA; static final String KETTLE_TRANS_PERFORMANCE_LOG_TABLE; static final String KETTLE_JOBENTRY_LOG_DB; static final String KETTLE_JOBENTRY_LOG_SCHEMA; static final String KETTLE_JOBENTRY_LOG_TABLE; static final String KETTLE_STEP_LOG_DB; static final String KETTLE_STEP_LOG_SCHEMA; static final String KETTLE_STEP_LOG_TABLE; static final String KETTLE_CHANNEL_LOG_DB; static final String KETTLE_CHANNEL_LOG_SCHEMA; static final String KETTLE_CHANNEL_LOG_TABLE; static final String KETTLE_METRICS_LOG_DB; static final String KETTLE_METRICS_LOG_SCHEMA; static final String KETTLE_METRICS_LOG_TABLE; static final String KETTLE_CHECKPOINT_LOG_DB; static final String KETTLE_CHECKPOINT_LOG_SCHEMA; static final String KETTLE_CHECKPOINT_LOG_TABLE; static final String KETTLE_SHARED_OBJECTS; static final String KETTLE_EMPTY_STRING_DIFFERS_FROM_NULL; static final String KETTLE_LENIENT_STRING_TO_NUMBER_CONVERSION; static final String KETTLE_COMPATIBILITY_DB_IGNORE_TIMEZONE; static final String KETTLE_COMPATIBILITY_IMPORT_PATH_ADDITION_ON_VARIABLES; static final String KETTLE_COMPATIBILITY_IGNORE_TABLE_LOGGING; static final String KETTLE_COMPATIBILITY_TEXT_FILE_OUTPUT_APPEND_NO_HEADER; static final String KETTLE_COMPATIBILITY_MERGE_ROWS_USE_REFERENCE_STREAM_WHEN_IDENTICAL; static final String KETTLE_COMPATIBILITY_MEMORY_GROUP_BY_SUM_AVERAGE_RETURN_NUMBER_TYPE; static final String KETTLE_SYSTEM_HOSTNAME; static final String KETTLE_MAX_LOG_SIZE_IN_LINES; static final String KETTLE_MAX_LOG_TIMEOUT_IN_MINUTES; static final String KETTLE_REDIRECT_STDERR; static final String KETTLE_REDIRECT_STDOUT; static final String KETTLE_CARTE_OBJECT_TIMEOUT_MINUTES; static final String KETTLE_STEP_PERFORMANCE_SNAPSHOT_LIMIT; static final String KETTLE_MAX_JOB_TRACKER_SIZE; static final String KETTLE_MAX_JOB_ENTRIES_LOGGED; static final String KETTLE_MAX_LOGGING_REGISTRY_SIZE; static final String KETTLE_LOG_TAB_REFRESH_DELAY; static final String KETTLE_LOG_TAB_REFRESH_PERIOD; static final String KETTLE_SAP_CONNECTION_FACTORY; static final String KETTLE_SAP_CONNECTION_FACTORY_DEFAULT_NAME; static final String KETTLE_PLUGIN_CLASSES; static final String KETTLE_PLUGIN_PACKAGES; static final String KETTLE_TRANS_ROWSET_SIZE; static final String VERSION_COMMENT_INITIAL_VERSION; static final String VERSION_COMMENT_EDIT_VERSION; static final String XML_FILE_KETTLE_STEPS; static final String KETTLE_CORE_STEPS_FILE; static final String XML_FILE_KETTLE_PARTITION_PLUGINS; static final String KETTLE_CORE_JOBENTRIES_FILE; static final String XML_FILE_KETTLE_SERVLETS; static final String XML_FILE_KETTLE_VALUEMETA_PLUGINS; static final String XML_FILE_KETTLE_PASSWORD_ENCODER_PLUGINS; static final String KETTLE_VALUEMETA_PLUGINS_FILE; static final String KETTLE_PASSWORD_ENCODER_PLUGIN; static final String KETTLE_PASSWORD_ENCODER_PLUGINS_FILE; static final String KETTLE_TWO_WAY_PASSWORD_ENCODER_SEED; static final String XML_FILE_KETTLE_LOGGING_PLUGINS; static final String KETTLE_LOGGING_PLUGINS_FILE; static final String KETTLE_CORE_SERVLETS_FILE; static final String KETTLE_ROWSET_GET_TIMEOUT; static final String KETTLE_ROWSET_PUT_TIMEOUT; static final String KETTLE_BATCHING_ROWSET; static final String KETTLE_DISABLE_CONSOLE_LOGGING; static final String XML_FILE_KETTLE_JOB_ENTRIES; static final String XML_FILE_KETTLE_REPOSITORIES; static final String XML_FILE_KETTLE_DATABASE_TYPES; static final String XML_FILE_KETTLE_COMPRESSION_PROVIDERS; static final String XML_FILE_KETTLE_AUTHENTICATION_PROVIDERS; static final String XML_FILE_KETTLE_EXTENSION_POINTS; static final String XML_FILE_KETTLE_REGISTRY_EXTENSIONS; static final String XML_FILE_KETTLE_LIFECYCLE_LISTENERS; static final String XML_FILE_KETTLE_ENGINES; static final String KETTLE_TRANS_PAN_JVM_EXIT_CODE; static final String KETTLE_DEFAULT_NUMBER_FORMAT; static final String KETTLE_DEFAULT_BIGNUMBER_FORMAT; static final String KETTLE_DEFAULT_INTEGER_FORMAT; static final String KETTLE_DEFAULT_DATE_FORMAT; static final String KETTLE_AGGREGATION_MIN_NULL_IS_VALUED; static final String KETTLE_AGGREGATION_ALL_NULLS_ARE_ZERO; static final String KETTLE_DEFAULT_TIMESTAMP_FORMAT; static final String KETTLE_SPLIT_FIELDS_REMOVE_ENCLOSURE; static final String KETTLE_GLOBAL_LOG_VARIABLES_CLEAR_ON_EXPORT; static final String KETTLE_COMPATIBILITY_CALCULATION_TIMEZONE_DECOMPOSITION; static final String KETTLE_COMPATIBILITY_SET_ERROR_ON_SPECIFIC_JOB_ENTRIES; static final String KETTLE_COMPATIBILITY_SEND_RESULT_XML_WITH_FULL_STATUS; static final String KETTLE_COMPATIBILITY_SELECT_VALUES_TYPE_CHANGE_USES_TYPE_DEFAULTS; static final String XML_FILE_KETTLE_IMPORT_RULES; static final ReleaseType RELEASE; static final String PENTAHO_METASTORE_FOLDER; static final String PENTAHO_METASTORE_NAME; static final String KETTLE_LOG_MARK_MAPPINGS; static final String KETTLE_CARTE_JETTY_ACCEPTORS; static final String KETTLE_CARTE_JETTY_ACCEPT_QUEUE_SIZE; static final String KETTLE_CARTE_JETTY_RES_MAX_IDLE_TIME; static final String VFS_USER_DIR_IS_ROOT; }
@Test public void transWithHops() { TransMeta meta = new TransMeta(); meta.setFilename( "fileName" ); StepMeta from = new StepMeta( "step1", stepMetaInterface ); meta.addStep( from ); StepMeta to = new StepMeta( "step2", stepMetaInterface ); meta.addStep( to ); meta.addTransHop( new TransHopMeta( from, to ) ); Transformation trans = TransMetaConverter.convert( meta ); assertThat( trans.getId(), is( meta.getFilename() ) ); assertThat( trans.getOperations().size(), is( 2 ) ); assertThat( trans.getHops().size(), is( 1 ) ); assertThat( trans.getHops().get( 0 ).getFrom().getId(), is( from.getName() ) ); assertThat( trans.getHops().get( 0 ).getTo().getId(), is( to.getName() ) ); assertThat( trans.getHops().stream().map( Hop::getType ).collect( Collectors.toList() ), everyItem( is( Hop.TYPE_NORMAL ) ) ); }
public static Transformation convert( TransMeta transMeta ) { final org.pentaho.di.engine.model.Transformation transformation = new org.pentaho.di.engine.model.Transformation( createTransformationId( transMeta ) ); try { TransMeta copyTransMeta = (TransMeta) transMeta.realClone( false ); cleanupDisabledHops( copyTransMeta ); disableLazyConversion( copyTransMeta ); searchAndReplaceHadoopClusterWithFileSystemURL( copyTransMeta ); copyTransMeta.getSteps().forEach( createOperation( transformation ) ); findHops( copyTransMeta, hop -> true ).forEach( createHop( transformation ) ); transformation.setConfig( TRANS_META_CONF_KEY, copyTransMeta.getXML() ); transformation.setConfig( TRANS_META_NAME_CONF_KEY, Optional.ofNullable( transMeta.getName() ).orElse( TRANS_DEFAULT_NAME ) ); Map<String, Transformation> subTransformations = copyTransMeta.getResourceDependencies().stream() .flatMap( resourceReference -> resourceReference.getEntries().stream() ) .filter( entry -> ResourceEntry.ResourceType.ACTIONFILE.equals( entry.getResourcetype() ) ) .collect( toMap( ResourceEntry::getResource, entry -> { try { return convert( new TransMeta( entry.getResource(), copyTransMeta.getParentVariableSpace() ) ); } catch ( KettleXMLException | KettleMissingPluginsException e ) { throw new RuntimeException( e ); } } ) ); transformation.setConfig( SUB_TRANSFORMATIONS_KEY, (Serializable) subTransformations ); } catch ( KettleException e ) { Throwables.propagate( e ); } return transformation; }
TransMetaConverter { public static Transformation convert( TransMeta transMeta ) { final org.pentaho.di.engine.model.Transformation transformation = new org.pentaho.di.engine.model.Transformation( createTransformationId( transMeta ) ); try { TransMeta copyTransMeta = (TransMeta) transMeta.realClone( false ); cleanupDisabledHops( copyTransMeta ); disableLazyConversion( copyTransMeta ); searchAndReplaceHadoopClusterWithFileSystemURL( copyTransMeta ); copyTransMeta.getSteps().forEach( createOperation( transformation ) ); findHops( copyTransMeta, hop -> true ).forEach( createHop( transformation ) ); transformation.setConfig( TRANS_META_CONF_KEY, copyTransMeta.getXML() ); transformation.setConfig( TRANS_META_NAME_CONF_KEY, Optional.ofNullable( transMeta.getName() ).orElse( TRANS_DEFAULT_NAME ) ); Map<String, Transformation> subTransformations = copyTransMeta.getResourceDependencies().stream() .flatMap( resourceReference -> resourceReference.getEntries().stream() ) .filter( entry -> ResourceEntry.ResourceType.ACTIONFILE.equals( entry.getResourcetype() ) ) .collect( toMap( ResourceEntry::getResource, entry -> { try { return convert( new TransMeta( entry.getResource(), copyTransMeta.getParentVariableSpace() ) ); } catch ( KettleXMLException | KettleMissingPluginsException e ) { throw new RuntimeException( e ); } } ) ); transformation.setConfig( SUB_TRANSFORMATIONS_KEY, (Serializable) subTransformations ); } catch ( KettleException e ) { Throwables.propagate( e ); } return transformation; } }
TransMetaConverter { public static Transformation convert( TransMeta transMeta ) { final org.pentaho.di.engine.model.Transformation transformation = new org.pentaho.di.engine.model.Transformation( createTransformationId( transMeta ) ); try { TransMeta copyTransMeta = (TransMeta) transMeta.realClone( false ); cleanupDisabledHops( copyTransMeta ); disableLazyConversion( copyTransMeta ); searchAndReplaceHadoopClusterWithFileSystemURL( copyTransMeta ); copyTransMeta.getSteps().forEach( createOperation( transformation ) ); findHops( copyTransMeta, hop -> true ).forEach( createHop( transformation ) ); transformation.setConfig( TRANS_META_CONF_KEY, copyTransMeta.getXML() ); transformation.setConfig( TRANS_META_NAME_CONF_KEY, Optional.ofNullable( transMeta.getName() ).orElse( TRANS_DEFAULT_NAME ) ); Map<String, Transformation> subTransformations = copyTransMeta.getResourceDependencies().stream() .flatMap( resourceReference -> resourceReference.getEntries().stream() ) .filter( entry -> ResourceEntry.ResourceType.ACTIONFILE.equals( entry.getResourcetype() ) ) .collect( toMap( ResourceEntry::getResource, entry -> { try { return convert( new TransMeta( entry.getResource(), copyTransMeta.getParentVariableSpace() ) ); } catch ( KettleXMLException | KettleMissingPluginsException e ) { throw new RuntimeException( e ); } } ) ); transformation.setConfig( SUB_TRANSFORMATIONS_KEY, (Serializable) subTransformations ); } catch ( KettleException e ) { Throwables.propagate( e ); } return transformation; } }
TransMetaConverter { public static Transformation convert( TransMeta transMeta ) { final org.pentaho.di.engine.model.Transformation transformation = new org.pentaho.di.engine.model.Transformation( createTransformationId( transMeta ) ); try { TransMeta copyTransMeta = (TransMeta) transMeta.realClone( false ); cleanupDisabledHops( copyTransMeta ); disableLazyConversion( copyTransMeta ); searchAndReplaceHadoopClusterWithFileSystemURL( copyTransMeta ); copyTransMeta.getSteps().forEach( createOperation( transformation ) ); findHops( copyTransMeta, hop -> true ).forEach( createHop( transformation ) ); transformation.setConfig( TRANS_META_CONF_KEY, copyTransMeta.getXML() ); transformation.setConfig( TRANS_META_NAME_CONF_KEY, Optional.ofNullable( transMeta.getName() ).orElse( TRANS_DEFAULT_NAME ) ); Map<String, Transformation> subTransformations = copyTransMeta.getResourceDependencies().stream() .flatMap( resourceReference -> resourceReference.getEntries().stream() ) .filter( entry -> ResourceEntry.ResourceType.ACTIONFILE.equals( entry.getResourcetype() ) ) .collect( toMap( ResourceEntry::getResource, entry -> { try { return convert( new TransMeta( entry.getResource(), copyTransMeta.getParentVariableSpace() ) ); } catch ( KettleXMLException | KettleMissingPluginsException e ) { throw new RuntimeException( e ); } } ) ); transformation.setConfig( SUB_TRANSFORMATIONS_KEY, (Serializable) subTransformations ); } catch ( KettleException e ) { Throwables.propagate( e ); } return transformation; } static Transformation convert( TransMeta transMeta ); }
TransMetaConverter { public static Transformation convert( TransMeta transMeta ) { final org.pentaho.di.engine.model.Transformation transformation = new org.pentaho.di.engine.model.Transformation( createTransformationId( transMeta ) ); try { TransMeta copyTransMeta = (TransMeta) transMeta.realClone( false ); cleanupDisabledHops( copyTransMeta ); disableLazyConversion( copyTransMeta ); searchAndReplaceHadoopClusterWithFileSystemURL( copyTransMeta ); copyTransMeta.getSteps().forEach( createOperation( transformation ) ); findHops( copyTransMeta, hop -> true ).forEach( createHop( transformation ) ); transformation.setConfig( TRANS_META_CONF_KEY, copyTransMeta.getXML() ); transformation.setConfig( TRANS_META_NAME_CONF_KEY, Optional.ofNullable( transMeta.getName() ).orElse( TRANS_DEFAULT_NAME ) ); Map<String, Transformation> subTransformations = copyTransMeta.getResourceDependencies().stream() .flatMap( resourceReference -> resourceReference.getEntries().stream() ) .filter( entry -> ResourceEntry.ResourceType.ACTIONFILE.equals( entry.getResourcetype() ) ) .collect( toMap( ResourceEntry::getResource, entry -> { try { return convert( new TransMeta( entry.getResource(), copyTransMeta.getParentVariableSpace() ) ); } catch ( KettleXMLException | KettleMissingPluginsException e ) { throw new RuntimeException( e ); } } ) ); transformation.setConfig( SUB_TRANSFORMATIONS_KEY, (Serializable) subTransformations ); } catch ( KettleException e ) { Throwables.propagate( e ); } return transformation; } static Transformation convert( TransMeta transMeta ); static final String TRANS_META_CONF_KEY; static final String TRANS_META_NAME_CONF_KEY; static final String SUB_TRANSFORMATIONS_KEY; static final String STEP_META_CONF_KEY; static final String TRANS_DEFAULT_NAME; }
@Test public void testOnlySpaces() { try { Const.onlySpaces( null ); fail( "Expected NullPointerException" ); } catch ( NullPointerException ex ) { } assertEquals( true, Const.onlySpaces( "" ) ); assertEquals( true, Const.onlySpaces( " " ) ); assertEquals( false, Const.onlySpaces( " test " ) ); }
public static boolean onlySpaces( String str ) { for ( int i = 0; i < str.length(); i++ ) { if ( !isSpace( str.charAt( i ) ) ) { return false; } } return true; }
Const { public static boolean onlySpaces( String str ) { for ( int i = 0; i < str.length(); i++ ) { if ( !isSpace( str.charAt( i ) ) ) { return false; } } return true; } }
Const { public static boolean onlySpaces( String str ) { for ( int i = 0; i < str.length(); i++ ) { if ( !isSpace( str.charAt( i ) ) ) { return false; } } return true; } }
Const { public static boolean onlySpaces( String str ) { for ( int i = 0; i < str.length(); i++ ) { if ( !isSpace( str.charAt( i ) ) ) { return false; } } return true; } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); }
Const { public static boolean onlySpaces( String str ) { for ( int i = 0; i < str.length(); i++ ) { if ( !isSpace( str.charAt( i ) ) ) { return false; } } return true; } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); @Deprecated static final String VERSION; static final String COPYRIGHT_YEAR; static final int TIMEOUT_GET_MILLIS; static final int TIMEOUT_PUT_MILLIS; static final int ROWS_UPDATE; static final int ROWS_IN_ROWSET; static final int FETCH_SIZE; static final int SORT_SIZE; static final int HEARTBEAT_PERIODIC_INTERVAL_IN_SECS; static final String FILE_SEPARATOR; static final String PATH_SEPARATOR; static final String CR; static final String DOSCR; static final String EMPTY_STRING; static final String JAVA_VERSION; @Deprecated static final String USER_HOME_DIRECTORY; static String JNDI_DIRECTORY; static final String PLUGIN_BASE_FOLDERS_PROP; static final String DEFAULT_PLUGIN_BASE_FOLDERS; static final Date MIN_DATE; static final Date MAX_DATE; static final int MIN_YEAR; static final int MAX_YEAR; static final int RIGHT; static final int LENGTH; static final int MARGIN; static final int MIDDLE_PCT; static final int ARROW_WIDTH; static final int FORM_MARGIN; static final int SHADOW_SIZE; static final int SYMBOLSIZE; static final int MAX_FILE_HIST; static final Locale DEFAULT_LOCALE; static final char DEFAULT_DECIMAL_SEPARATOR; static final char DEFAULT_GROUPING_SEPARATOR; static final String DEFAULT_CURRENCY_SYMBOL; static final String DEFAULT_NUMBER_FORMAT; static final String NULL_STRING; static final String NULL_NUMBER; static final String NULL_DATE; static final String NULL_BIGNUMBER; static final String NULL_BOOLEAN; static final String NULL_INTEGER; static final String NULL_BINARY; static final String NULL_NONE; static final int ROUND_HALF_CEILING; static final String CHEF_LOG_FILE; static final String SPOON_LOG_FILE; static final String MENU_LOG_FILE; static final String GENERALIZED_DATE_TIME_FORMAT; static final String GENERALIZED_DATE_TIME_FORMAT_MILLIS; static final String XML_ENCODING; static final String[] STRING_TRANS_AND_JOB_FILTER_EXT; static final String STRING_TRANS_DEFAULT_EXT; static final String[] STRING_TRANS_FILTER_EXT; static final String STRING_JOB_DEFAULT_EXT; static final String[] STRING_JOB_FILTER_EXT; static final String KETTLE_PROPERTIES; static final String SHARED_DATA_FILE; static final String INTERNAL_VARIABLE_PREFIX; static final String INTERNAL_VARIABLE_KETTLE_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_DATE; static final String INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_FILENAME_NAME; static final String INTERNAL_VARIABLE_JOB_NAME; static final String INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_RUN_ID; static final String INTERNAL_VARIABLE_JOB_RUN_ATTEMPTNR; static final String VARIABLE_HEARTBEAT_PERIODIC_INTERVAL_SECS; static final String VARIABLE_MONITORING_SNMP_TRAPS_ENABLED; static final String INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY; static final String[] INTERNAL_TRANS_VARIABLES; static final String[] INTERNAL_JOB_VARIABLES; static final String[] DEPRECATED_VARIABLES; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_STEP_PARTITION_ID; static final String INTERNAL_VARIABLE_STEP_PARTITION_NR; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NUMBER; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NAME; static final String INTERNAL_VARIABLE_CLUSTER_SIZE; static final String INTERNAL_VARIABLE_STEP_UNIQUE_NUMBER; static final String INTERNAL_VARIABLE_CLUSTER_MASTER; static final String INTERNAL_VARIABLE_CLUSTER_RUN_ID; static final String INTERNAL_VARIABLE_STEP_UNIQUE_COUNT; static final String INTERNAL_VARIABLE_STEP_NAME; static final String INTERNAL_VARIABLE_STEP_COPYNR; static final int MAX_NR_LOG_LINES; static final int MAX_NR_HISTORY_LINES; static final int HISTORY_LINES_FETCH_SIZE; static final int MAX_LOG_LINE_TIMEOUT_MINUTES; static final int WARNING; static final int ERROR; static final int INFO; static final int NOTE_MARGIN; static final int MAX_UNDO; static final String KETTLE_VARIABLES_FILE; static final String KETTLE_LOG_SIZE_LIMIT; static final String KETTLE_TRANS_LOG_DB; static final String KETTLE_TRANS_LOG_SCHEMA; static final String KETTLE_TRANS_LOG_TABLE; static final String KETTLE_JOB_LOG_DB; static final String KETTLE_JOB_LOG_SCHEMA; static final String KETTLE_SLAVE_DETECTION_TIMER; static final String KETTLE_JOB_LOG_TABLE; static final String KETTLE_TRANS_PERFORMANCE_LOG_DB; static final String KETTLE_TRANS_PERFORMANCE_LOG_SCHEMA; static final String KETTLE_TRANS_PERFORMANCE_LOG_TABLE; static final String KETTLE_JOBENTRY_LOG_DB; static final String KETTLE_JOBENTRY_LOG_SCHEMA; static final String KETTLE_JOBENTRY_LOG_TABLE; static final String KETTLE_STEP_LOG_DB; static final String KETTLE_STEP_LOG_SCHEMA; static final String KETTLE_STEP_LOG_TABLE; static final String KETTLE_CHANNEL_LOG_DB; static final String KETTLE_CHANNEL_LOG_SCHEMA; static final String KETTLE_CHANNEL_LOG_TABLE; static final String KETTLE_METRICS_LOG_DB; static final String KETTLE_METRICS_LOG_SCHEMA; static final String KETTLE_METRICS_LOG_TABLE; static final String KETTLE_CHECKPOINT_LOG_DB; static final String KETTLE_CHECKPOINT_LOG_SCHEMA; static final String KETTLE_CHECKPOINT_LOG_TABLE; static final String KETTLE_SHARED_OBJECTS; static final String KETTLE_EMPTY_STRING_DIFFERS_FROM_NULL; static final String KETTLE_LENIENT_STRING_TO_NUMBER_CONVERSION; static final String KETTLE_COMPATIBILITY_DB_IGNORE_TIMEZONE; static final String KETTLE_COMPATIBILITY_IMPORT_PATH_ADDITION_ON_VARIABLES; static final String KETTLE_COMPATIBILITY_IGNORE_TABLE_LOGGING; static final String KETTLE_COMPATIBILITY_TEXT_FILE_OUTPUT_APPEND_NO_HEADER; static final String KETTLE_COMPATIBILITY_MERGE_ROWS_USE_REFERENCE_STREAM_WHEN_IDENTICAL; static final String KETTLE_COMPATIBILITY_MEMORY_GROUP_BY_SUM_AVERAGE_RETURN_NUMBER_TYPE; static final String KETTLE_SYSTEM_HOSTNAME; static final String KETTLE_MAX_LOG_SIZE_IN_LINES; static final String KETTLE_MAX_LOG_TIMEOUT_IN_MINUTES; static final String KETTLE_REDIRECT_STDERR; static final String KETTLE_REDIRECT_STDOUT; static final String KETTLE_CARTE_OBJECT_TIMEOUT_MINUTES; static final String KETTLE_STEP_PERFORMANCE_SNAPSHOT_LIMIT; static final String KETTLE_MAX_JOB_TRACKER_SIZE; static final String KETTLE_MAX_JOB_ENTRIES_LOGGED; static final String KETTLE_MAX_LOGGING_REGISTRY_SIZE; static final String KETTLE_LOG_TAB_REFRESH_DELAY; static final String KETTLE_LOG_TAB_REFRESH_PERIOD; static final String KETTLE_SAP_CONNECTION_FACTORY; static final String KETTLE_SAP_CONNECTION_FACTORY_DEFAULT_NAME; static final String KETTLE_PLUGIN_CLASSES; static final String KETTLE_PLUGIN_PACKAGES; static final String KETTLE_TRANS_ROWSET_SIZE; static final String VERSION_COMMENT_INITIAL_VERSION; static final String VERSION_COMMENT_EDIT_VERSION; static final String XML_FILE_KETTLE_STEPS; static final String KETTLE_CORE_STEPS_FILE; static final String XML_FILE_KETTLE_PARTITION_PLUGINS; static final String KETTLE_CORE_JOBENTRIES_FILE; static final String XML_FILE_KETTLE_SERVLETS; static final String XML_FILE_KETTLE_VALUEMETA_PLUGINS; static final String XML_FILE_KETTLE_PASSWORD_ENCODER_PLUGINS; static final String KETTLE_VALUEMETA_PLUGINS_FILE; static final String KETTLE_PASSWORD_ENCODER_PLUGIN; static final String KETTLE_PASSWORD_ENCODER_PLUGINS_FILE; static final String KETTLE_TWO_WAY_PASSWORD_ENCODER_SEED; static final String XML_FILE_KETTLE_LOGGING_PLUGINS; static final String KETTLE_LOGGING_PLUGINS_FILE; static final String KETTLE_CORE_SERVLETS_FILE; static final String KETTLE_ROWSET_GET_TIMEOUT; static final String KETTLE_ROWSET_PUT_TIMEOUT; static final String KETTLE_BATCHING_ROWSET; static final String KETTLE_DISABLE_CONSOLE_LOGGING; static final String XML_FILE_KETTLE_JOB_ENTRIES; static final String XML_FILE_KETTLE_REPOSITORIES; static final String XML_FILE_KETTLE_DATABASE_TYPES; static final String XML_FILE_KETTLE_COMPRESSION_PROVIDERS; static final String XML_FILE_KETTLE_AUTHENTICATION_PROVIDERS; static final String XML_FILE_KETTLE_EXTENSION_POINTS; static final String XML_FILE_KETTLE_REGISTRY_EXTENSIONS; static final String XML_FILE_KETTLE_LIFECYCLE_LISTENERS; static final String XML_FILE_KETTLE_ENGINES; static final String KETTLE_TRANS_PAN_JVM_EXIT_CODE; static final String KETTLE_DEFAULT_NUMBER_FORMAT; static final String KETTLE_DEFAULT_BIGNUMBER_FORMAT; static final String KETTLE_DEFAULT_INTEGER_FORMAT; static final String KETTLE_DEFAULT_DATE_FORMAT; static final String KETTLE_AGGREGATION_MIN_NULL_IS_VALUED; static final String KETTLE_AGGREGATION_ALL_NULLS_ARE_ZERO; static final String KETTLE_DEFAULT_TIMESTAMP_FORMAT; static final String KETTLE_SPLIT_FIELDS_REMOVE_ENCLOSURE; static final String KETTLE_GLOBAL_LOG_VARIABLES_CLEAR_ON_EXPORT; static final String KETTLE_COMPATIBILITY_CALCULATION_TIMEZONE_DECOMPOSITION; static final String KETTLE_COMPATIBILITY_SET_ERROR_ON_SPECIFIC_JOB_ENTRIES; static final String KETTLE_COMPATIBILITY_SEND_RESULT_XML_WITH_FULL_STATUS; static final String KETTLE_COMPATIBILITY_SELECT_VALUES_TYPE_CHANGE_USES_TYPE_DEFAULTS; static final String XML_FILE_KETTLE_IMPORT_RULES; static final ReleaseType RELEASE; static final String PENTAHO_METASTORE_FOLDER; static final String PENTAHO_METASTORE_NAME; static final String KETTLE_LOG_MARK_MAPPINGS; static final String KETTLE_CARTE_JETTY_ACCEPTORS; static final String KETTLE_CARTE_JETTY_ACCEPT_QUEUE_SIZE; static final String KETTLE_CARTE_JETTY_RES_MAX_IDLE_TIME; static final String VFS_USER_DIR_IS_ROOT; }
@Test public void testSplitString() { assertEquals( 0, Const.splitString( "", ";" ).length ); assertEquals( 0, Const.splitString( null, ";" ).length ); String[] a = Const.splitString( ";", ";" ); assertEquals( 1, a.length ); assertEquals( "", a[0] ); a = Const.splitString( "a;b;c;d", ";" ); assertEquals( 4, a.length ); assertEquals( "a", a[0] ); assertEquals( "b", a[1] ); assertEquals( "c", a[2] ); assertEquals( "d", a[3] ); a = Const.splitString( "a;b;c;d;", ";" ); assertEquals( 4, a.length ); assertEquals( "a", a[0] ); assertEquals( "b", a[1] ); assertEquals( "c", a[2] ); assertEquals( "d", a[3] ); a = Const.splitString( "AACCAADAaAADD", "AA" ); assertEquals( 4, a.length ); assertEquals( "", a[0] ); assertEquals( "CC", a[1] ); assertEquals( "DA", a[2] ); assertEquals( "ADD", a[3] ); a = Const.splitString( "CCAABBAA", "AA" ); assertEquals( 2, a.length ); assertEquals( "CC", a[0] ); assertEquals( "BB", a[1] ); }
public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); @Deprecated static final String VERSION; static final String COPYRIGHT_YEAR; static final int TIMEOUT_GET_MILLIS; static final int TIMEOUT_PUT_MILLIS; static final int ROWS_UPDATE; static final int ROWS_IN_ROWSET; static final int FETCH_SIZE; static final int SORT_SIZE; static final int HEARTBEAT_PERIODIC_INTERVAL_IN_SECS; static final String FILE_SEPARATOR; static final String PATH_SEPARATOR; static final String CR; static final String DOSCR; static final String EMPTY_STRING; static final String JAVA_VERSION; @Deprecated static final String USER_HOME_DIRECTORY; static String JNDI_DIRECTORY; static final String PLUGIN_BASE_FOLDERS_PROP; static final String DEFAULT_PLUGIN_BASE_FOLDERS; static final Date MIN_DATE; static final Date MAX_DATE; static final int MIN_YEAR; static final int MAX_YEAR; static final int RIGHT; static final int LENGTH; static final int MARGIN; static final int MIDDLE_PCT; static final int ARROW_WIDTH; static final int FORM_MARGIN; static final int SHADOW_SIZE; static final int SYMBOLSIZE; static final int MAX_FILE_HIST; static final Locale DEFAULT_LOCALE; static final char DEFAULT_DECIMAL_SEPARATOR; static final char DEFAULT_GROUPING_SEPARATOR; static final String DEFAULT_CURRENCY_SYMBOL; static final String DEFAULT_NUMBER_FORMAT; static final String NULL_STRING; static final String NULL_NUMBER; static final String NULL_DATE; static final String NULL_BIGNUMBER; static final String NULL_BOOLEAN; static final String NULL_INTEGER; static final String NULL_BINARY; static final String NULL_NONE; static final int ROUND_HALF_CEILING; static final String CHEF_LOG_FILE; static final String SPOON_LOG_FILE; static final String MENU_LOG_FILE; static final String GENERALIZED_DATE_TIME_FORMAT; static final String GENERALIZED_DATE_TIME_FORMAT_MILLIS; static final String XML_ENCODING; static final String[] STRING_TRANS_AND_JOB_FILTER_EXT; static final String STRING_TRANS_DEFAULT_EXT; static final String[] STRING_TRANS_FILTER_EXT; static final String STRING_JOB_DEFAULT_EXT; static final String[] STRING_JOB_FILTER_EXT; static final String KETTLE_PROPERTIES; static final String SHARED_DATA_FILE; static final String INTERNAL_VARIABLE_PREFIX; static final String INTERNAL_VARIABLE_KETTLE_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_DATE; static final String INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_FILENAME_NAME; static final String INTERNAL_VARIABLE_JOB_NAME; static final String INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_RUN_ID; static final String INTERNAL_VARIABLE_JOB_RUN_ATTEMPTNR; static final String VARIABLE_HEARTBEAT_PERIODIC_INTERVAL_SECS; static final String VARIABLE_MONITORING_SNMP_TRAPS_ENABLED; static final String INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY; static final String[] INTERNAL_TRANS_VARIABLES; static final String[] INTERNAL_JOB_VARIABLES; static final String[] DEPRECATED_VARIABLES; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_STEP_PARTITION_ID; static final String INTERNAL_VARIABLE_STEP_PARTITION_NR; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NUMBER; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NAME; static final String INTERNAL_VARIABLE_CLUSTER_SIZE; static final String INTERNAL_VARIABLE_STEP_UNIQUE_NUMBER; static final String INTERNAL_VARIABLE_CLUSTER_MASTER; static final String INTERNAL_VARIABLE_CLUSTER_RUN_ID; static final String INTERNAL_VARIABLE_STEP_UNIQUE_COUNT; static final String INTERNAL_VARIABLE_STEP_NAME; static final String INTERNAL_VARIABLE_STEP_COPYNR; static final int MAX_NR_LOG_LINES; static final int MAX_NR_HISTORY_LINES; static final int HISTORY_LINES_FETCH_SIZE; static final int MAX_LOG_LINE_TIMEOUT_MINUTES; static final int WARNING; static final int ERROR; static final int INFO; static final int NOTE_MARGIN; static final int MAX_UNDO; static final String KETTLE_VARIABLES_FILE; static final String KETTLE_LOG_SIZE_LIMIT; static final String KETTLE_TRANS_LOG_DB; static final String KETTLE_TRANS_LOG_SCHEMA; static final String KETTLE_TRANS_LOG_TABLE; static final String KETTLE_JOB_LOG_DB; static final String KETTLE_JOB_LOG_SCHEMA; static final String KETTLE_SLAVE_DETECTION_TIMER; static final String KETTLE_JOB_LOG_TABLE; static final String KETTLE_TRANS_PERFORMANCE_LOG_DB; static final String KETTLE_TRANS_PERFORMANCE_LOG_SCHEMA; static final String KETTLE_TRANS_PERFORMANCE_LOG_TABLE; static final String KETTLE_JOBENTRY_LOG_DB; static final String KETTLE_JOBENTRY_LOG_SCHEMA; static final String KETTLE_JOBENTRY_LOG_TABLE; static final String KETTLE_STEP_LOG_DB; static final String KETTLE_STEP_LOG_SCHEMA; static final String KETTLE_STEP_LOG_TABLE; static final String KETTLE_CHANNEL_LOG_DB; static final String KETTLE_CHANNEL_LOG_SCHEMA; static final String KETTLE_CHANNEL_LOG_TABLE; static final String KETTLE_METRICS_LOG_DB; static final String KETTLE_METRICS_LOG_SCHEMA; static final String KETTLE_METRICS_LOG_TABLE; static final String KETTLE_CHECKPOINT_LOG_DB; static final String KETTLE_CHECKPOINT_LOG_SCHEMA; static final String KETTLE_CHECKPOINT_LOG_TABLE; static final String KETTLE_SHARED_OBJECTS; static final String KETTLE_EMPTY_STRING_DIFFERS_FROM_NULL; static final String KETTLE_LENIENT_STRING_TO_NUMBER_CONVERSION; static final String KETTLE_COMPATIBILITY_DB_IGNORE_TIMEZONE; static final String KETTLE_COMPATIBILITY_IMPORT_PATH_ADDITION_ON_VARIABLES; static final String KETTLE_COMPATIBILITY_IGNORE_TABLE_LOGGING; static final String KETTLE_COMPATIBILITY_TEXT_FILE_OUTPUT_APPEND_NO_HEADER; static final String KETTLE_COMPATIBILITY_MERGE_ROWS_USE_REFERENCE_STREAM_WHEN_IDENTICAL; static final String KETTLE_COMPATIBILITY_MEMORY_GROUP_BY_SUM_AVERAGE_RETURN_NUMBER_TYPE; static final String KETTLE_SYSTEM_HOSTNAME; static final String KETTLE_MAX_LOG_SIZE_IN_LINES; static final String KETTLE_MAX_LOG_TIMEOUT_IN_MINUTES; static final String KETTLE_REDIRECT_STDERR; static final String KETTLE_REDIRECT_STDOUT; static final String KETTLE_CARTE_OBJECT_TIMEOUT_MINUTES; static final String KETTLE_STEP_PERFORMANCE_SNAPSHOT_LIMIT; static final String KETTLE_MAX_JOB_TRACKER_SIZE; static final String KETTLE_MAX_JOB_ENTRIES_LOGGED; static final String KETTLE_MAX_LOGGING_REGISTRY_SIZE; static final String KETTLE_LOG_TAB_REFRESH_DELAY; static final String KETTLE_LOG_TAB_REFRESH_PERIOD; static final String KETTLE_SAP_CONNECTION_FACTORY; static final String KETTLE_SAP_CONNECTION_FACTORY_DEFAULT_NAME; static final String KETTLE_PLUGIN_CLASSES; static final String KETTLE_PLUGIN_PACKAGES; static final String KETTLE_TRANS_ROWSET_SIZE; static final String VERSION_COMMENT_INITIAL_VERSION; static final String VERSION_COMMENT_EDIT_VERSION; static final String XML_FILE_KETTLE_STEPS; static final String KETTLE_CORE_STEPS_FILE; static final String XML_FILE_KETTLE_PARTITION_PLUGINS; static final String KETTLE_CORE_JOBENTRIES_FILE; static final String XML_FILE_KETTLE_SERVLETS; static final String XML_FILE_KETTLE_VALUEMETA_PLUGINS; static final String XML_FILE_KETTLE_PASSWORD_ENCODER_PLUGINS; static final String KETTLE_VALUEMETA_PLUGINS_FILE; static final String KETTLE_PASSWORD_ENCODER_PLUGIN; static final String KETTLE_PASSWORD_ENCODER_PLUGINS_FILE; static final String KETTLE_TWO_WAY_PASSWORD_ENCODER_SEED; static final String XML_FILE_KETTLE_LOGGING_PLUGINS; static final String KETTLE_LOGGING_PLUGINS_FILE; static final String KETTLE_CORE_SERVLETS_FILE; static final String KETTLE_ROWSET_GET_TIMEOUT; static final String KETTLE_ROWSET_PUT_TIMEOUT; static final String KETTLE_BATCHING_ROWSET; static final String KETTLE_DISABLE_CONSOLE_LOGGING; static final String XML_FILE_KETTLE_JOB_ENTRIES; static final String XML_FILE_KETTLE_REPOSITORIES; static final String XML_FILE_KETTLE_DATABASE_TYPES; static final String XML_FILE_KETTLE_COMPRESSION_PROVIDERS; static final String XML_FILE_KETTLE_AUTHENTICATION_PROVIDERS; static final String XML_FILE_KETTLE_EXTENSION_POINTS; static final String XML_FILE_KETTLE_REGISTRY_EXTENSIONS; static final String XML_FILE_KETTLE_LIFECYCLE_LISTENERS; static final String XML_FILE_KETTLE_ENGINES; static final String KETTLE_TRANS_PAN_JVM_EXIT_CODE; static final String KETTLE_DEFAULT_NUMBER_FORMAT; static final String KETTLE_DEFAULT_BIGNUMBER_FORMAT; static final String KETTLE_DEFAULT_INTEGER_FORMAT; static final String KETTLE_DEFAULT_DATE_FORMAT; static final String KETTLE_AGGREGATION_MIN_NULL_IS_VALUED; static final String KETTLE_AGGREGATION_ALL_NULLS_ARE_ZERO; static final String KETTLE_DEFAULT_TIMESTAMP_FORMAT; static final String KETTLE_SPLIT_FIELDS_REMOVE_ENCLOSURE; static final String KETTLE_GLOBAL_LOG_VARIABLES_CLEAR_ON_EXPORT; static final String KETTLE_COMPATIBILITY_CALCULATION_TIMEZONE_DECOMPOSITION; static final String KETTLE_COMPATIBILITY_SET_ERROR_ON_SPECIFIC_JOB_ENTRIES; static final String KETTLE_COMPATIBILITY_SEND_RESULT_XML_WITH_FULL_STATUS; static final String KETTLE_COMPATIBILITY_SELECT_VALUES_TYPE_CHANGE_USES_TYPE_DEFAULTS; static final String XML_FILE_KETTLE_IMPORT_RULES; static final ReleaseType RELEASE; static final String PENTAHO_METASTORE_FOLDER; static final String PENTAHO_METASTORE_NAME; static final String KETTLE_LOG_MARK_MAPPINGS; static final String KETTLE_CARTE_JETTY_ACCEPTORS; static final String KETTLE_CARTE_JETTY_ACCEPT_QUEUE_SIZE; static final String KETTLE_CARTE_JETTY_RES_MAX_IDLE_TIME; static final String VFS_USER_DIR_IS_ROOT; }
@Test public void testSplitStringChar() { assertEquals( 0, Const.splitString( "", ';' ).length ); assertEquals( 0, Const.splitString( null, ';' ).length ); String[] a = Const.splitString( ";", ';' ); assertEquals( 1, a.length ); assertEquals( "", a[0] ); a = Const.splitString( "a;b;c;d", ';' ); assertEquals( 4, a.length ); assertEquals( "a", a[0] ); assertEquals( "b", a[1] ); assertEquals( "c", a[2] ); assertEquals( "d", a[3] ); a = Const.splitString( "a;b;c;d;", ';' ); assertEquals( 4, a.length ); assertEquals( "a", a[0] ); assertEquals( "b", a[1] ); assertEquals( "c", a[2] ); assertEquals( "d", a[3] ); a = Const.splitString( ";CC;DA;ADD", ';' ); assertEquals( 4, a.length ); assertEquals( "", a[0] ); assertEquals( "CC", a[1] ); assertEquals( "DA", a[2] ); assertEquals( "ADD", a[3] ); a = Const.splitString( "CC;BB;", ';' ); assertEquals( 2, a.length ); assertEquals( "CC", a[0] ); assertEquals( "BB", a[1] ); }
public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); @Deprecated static final String VERSION; static final String COPYRIGHT_YEAR; static final int TIMEOUT_GET_MILLIS; static final int TIMEOUT_PUT_MILLIS; static final int ROWS_UPDATE; static final int ROWS_IN_ROWSET; static final int FETCH_SIZE; static final int SORT_SIZE; static final int HEARTBEAT_PERIODIC_INTERVAL_IN_SECS; static final String FILE_SEPARATOR; static final String PATH_SEPARATOR; static final String CR; static final String DOSCR; static final String EMPTY_STRING; static final String JAVA_VERSION; @Deprecated static final String USER_HOME_DIRECTORY; static String JNDI_DIRECTORY; static final String PLUGIN_BASE_FOLDERS_PROP; static final String DEFAULT_PLUGIN_BASE_FOLDERS; static final Date MIN_DATE; static final Date MAX_DATE; static final int MIN_YEAR; static final int MAX_YEAR; static final int RIGHT; static final int LENGTH; static final int MARGIN; static final int MIDDLE_PCT; static final int ARROW_WIDTH; static final int FORM_MARGIN; static final int SHADOW_SIZE; static final int SYMBOLSIZE; static final int MAX_FILE_HIST; static final Locale DEFAULT_LOCALE; static final char DEFAULT_DECIMAL_SEPARATOR; static final char DEFAULT_GROUPING_SEPARATOR; static final String DEFAULT_CURRENCY_SYMBOL; static final String DEFAULT_NUMBER_FORMAT; static final String NULL_STRING; static final String NULL_NUMBER; static final String NULL_DATE; static final String NULL_BIGNUMBER; static final String NULL_BOOLEAN; static final String NULL_INTEGER; static final String NULL_BINARY; static final String NULL_NONE; static final int ROUND_HALF_CEILING; static final String CHEF_LOG_FILE; static final String SPOON_LOG_FILE; static final String MENU_LOG_FILE; static final String GENERALIZED_DATE_TIME_FORMAT; static final String GENERALIZED_DATE_TIME_FORMAT_MILLIS; static final String XML_ENCODING; static final String[] STRING_TRANS_AND_JOB_FILTER_EXT; static final String STRING_TRANS_DEFAULT_EXT; static final String[] STRING_TRANS_FILTER_EXT; static final String STRING_JOB_DEFAULT_EXT; static final String[] STRING_JOB_FILTER_EXT; static final String KETTLE_PROPERTIES; static final String SHARED_DATA_FILE; static final String INTERNAL_VARIABLE_PREFIX; static final String INTERNAL_VARIABLE_KETTLE_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_DATE; static final String INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_FILENAME_NAME; static final String INTERNAL_VARIABLE_JOB_NAME; static final String INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_RUN_ID; static final String INTERNAL_VARIABLE_JOB_RUN_ATTEMPTNR; static final String VARIABLE_HEARTBEAT_PERIODIC_INTERVAL_SECS; static final String VARIABLE_MONITORING_SNMP_TRAPS_ENABLED; static final String INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY; static final String[] INTERNAL_TRANS_VARIABLES; static final String[] INTERNAL_JOB_VARIABLES; static final String[] DEPRECATED_VARIABLES; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_STEP_PARTITION_ID; static final String INTERNAL_VARIABLE_STEP_PARTITION_NR; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NUMBER; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NAME; static final String INTERNAL_VARIABLE_CLUSTER_SIZE; static final String INTERNAL_VARIABLE_STEP_UNIQUE_NUMBER; static final String INTERNAL_VARIABLE_CLUSTER_MASTER; static final String INTERNAL_VARIABLE_CLUSTER_RUN_ID; static final String INTERNAL_VARIABLE_STEP_UNIQUE_COUNT; static final String INTERNAL_VARIABLE_STEP_NAME; static final String INTERNAL_VARIABLE_STEP_COPYNR; static final int MAX_NR_LOG_LINES; static final int MAX_NR_HISTORY_LINES; static final int HISTORY_LINES_FETCH_SIZE; static final int MAX_LOG_LINE_TIMEOUT_MINUTES; static final int WARNING; static final int ERROR; static final int INFO; static final int NOTE_MARGIN; static final int MAX_UNDO; static final String KETTLE_VARIABLES_FILE; static final String KETTLE_LOG_SIZE_LIMIT; static final String KETTLE_TRANS_LOG_DB; static final String KETTLE_TRANS_LOG_SCHEMA; static final String KETTLE_TRANS_LOG_TABLE; static final String KETTLE_JOB_LOG_DB; static final String KETTLE_JOB_LOG_SCHEMA; static final String KETTLE_SLAVE_DETECTION_TIMER; static final String KETTLE_JOB_LOG_TABLE; static final String KETTLE_TRANS_PERFORMANCE_LOG_DB; static final String KETTLE_TRANS_PERFORMANCE_LOG_SCHEMA; static final String KETTLE_TRANS_PERFORMANCE_LOG_TABLE; static final String KETTLE_JOBENTRY_LOG_DB; static final String KETTLE_JOBENTRY_LOG_SCHEMA; static final String KETTLE_JOBENTRY_LOG_TABLE; static final String KETTLE_STEP_LOG_DB; static final String KETTLE_STEP_LOG_SCHEMA; static final String KETTLE_STEP_LOG_TABLE; static final String KETTLE_CHANNEL_LOG_DB; static final String KETTLE_CHANNEL_LOG_SCHEMA; static final String KETTLE_CHANNEL_LOG_TABLE; static final String KETTLE_METRICS_LOG_DB; static final String KETTLE_METRICS_LOG_SCHEMA; static final String KETTLE_METRICS_LOG_TABLE; static final String KETTLE_CHECKPOINT_LOG_DB; static final String KETTLE_CHECKPOINT_LOG_SCHEMA; static final String KETTLE_CHECKPOINT_LOG_TABLE; static final String KETTLE_SHARED_OBJECTS; static final String KETTLE_EMPTY_STRING_DIFFERS_FROM_NULL; static final String KETTLE_LENIENT_STRING_TO_NUMBER_CONVERSION; static final String KETTLE_COMPATIBILITY_DB_IGNORE_TIMEZONE; static final String KETTLE_COMPATIBILITY_IMPORT_PATH_ADDITION_ON_VARIABLES; static final String KETTLE_COMPATIBILITY_IGNORE_TABLE_LOGGING; static final String KETTLE_COMPATIBILITY_TEXT_FILE_OUTPUT_APPEND_NO_HEADER; static final String KETTLE_COMPATIBILITY_MERGE_ROWS_USE_REFERENCE_STREAM_WHEN_IDENTICAL; static final String KETTLE_COMPATIBILITY_MEMORY_GROUP_BY_SUM_AVERAGE_RETURN_NUMBER_TYPE; static final String KETTLE_SYSTEM_HOSTNAME; static final String KETTLE_MAX_LOG_SIZE_IN_LINES; static final String KETTLE_MAX_LOG_TIMEOUT_IN_MINUTES; static final String KETTLE_REDIRECT_STDERR; static final String KETTLE_REDIRECT_STDOUT; static final String KETTLE_CARTE_OBJECT_TIMEOUT_MINUTES; static final String KETTLE_STEP_PERFORMANCE_SNAPSHOT_LIMIT; static final String KETTLE_MAX_JOB_TRACKER_SIZE; static final String KETTLE_MAX_JOB_ENTRIES_LOGGED; static final String KETTLE_MAX_LOGGING_REGISTRY_SIZE; static final String KETTLE_LOG_TAB_REFRESH_DELAY; static final String KETTLE_LOG_TAB_REFRESH_PERIOD; static final String KETTLE_SAP_CONNECTION_FACTORY; static final String KETTLE_SAP_CONNECTION_FACTORY_DEFAULT_NAME; static final String KETTLE_PLUGIN_CLASSES; static final String KETTLE_PLUGIN_PACKAGES; static final String KETTLE_TRANS_ROWSET_SIZE; static final String VERSION_COMMENT_INITIAL_VERSION; static final String VERSION_COMMENT_EDIT_VERSION; static final String XML_FILE_KETTLE_STEPS; static final String KETTLE_CORE_STEPS_FILE; static final String XML_FILE_KETTLE_PARTITION_PLUGINS; static final String KETTLE_CORE_JOBENTRIES_FILE; static final String XML_FILE_KETTLE_SERVLETS; static final String XML_FILE_KETTLE_VALUEMETA_PLUGINS; static final String XML_FILE_KETTLE_PASSWORD_ENCODER_PLUGINS; static final String KETTLE_VALUEMETA_PLUGINS_FILE; static final String KETTLE_PASSWORD_ENCODER_PLUGIN; static final String KETTLE_PASSWORD_ENCODER_PLUGINS_FILE; static final String KETTLE_TWO_WAY_PASSWORD_ENCODER_SEED; static final String XML_FILE_KETTLE_LOGGING_PLUGINS; static final String KETTLE_LOGGING_PLUGINS_FILE; static final String KETTLE_CORE_SERVLETS_FILE; static final String KETTLE_ROWSET_GET_TIMEOUT; static final String KETTLE_ROWSET_PUT_TIMEOUT; static final String KETTLE_BATCHING_ROWSET; static final String KETTLE_DISABLE_CONSOLE_LOGGING; static final String XML_FILE_KETTLE_JOB_ENTRIES; static final String XML_FILE_KETTLE_REPOSITORIES; static final String XML_FILE_KETTLE_DATABASE_TYPES; static final String XML_FILE_KETTLE_COMPRESSION_PROVIDERS; static final String XML_FILE_KETTLE_AUTHENTICATION_PROVIDERS; static final String XML_FILE_KETTLE_EXTENSION_POINTS; static final String XML_FILE_KETTLE_REGISTRY_EXTENSIONS; static final String XML_FILE_KETTLE_LIFECYCLE_LISTENERS; static final String XML_FILE_KETTLE_ENGINES; static final String KETTLE_TRANS_PAN_JVM_EXIT_CODE; static final String KETTLE_DEFAULT_NUMBER_FORMAT; static final String KETTLE_DEFAULT_BIGNUMBER_FORMAT; static final String KETTLE_DEFAULT_INTEGER_FORMAT; static final String KETTLE_DEFAULT_DATE_FORMAT; static final String KETTLE_AGGREGATION_MIN_NULL_IS_VALUED; static final String KETTLE_AGGREGATION_ALL_NULLS_ARE_ZERO; static final String KETTLE_DEFAULT_TIMESTAMP_FORMAT; static final String KETTLE_SPLIT_FIELDS_REMOVE_ENCLOSURE; static final String KETTLE_GLOBAL_LOG_VARIABLES_CLEAR_ON_EXPORT; static final String KETTLE_COMPATIBILITY_CALCULATION_TIMEZONE_DECOMPOSITION; static final String KETTLE_COMPATIBILITY_SET_ERROR_ON_SPECIFIC_JOB_ENTRIES; static final String KETTLE_COMPATIBILITY_SEND_RESULT_XML_WITH_FULL_STATUS; static final String KETTLE_COMPATIBILITY_SELECT_VALUES_TYPE_CHANGE_USES_TYPE_DEFAULTS; static final String XML_FILE_KETTLE_IMPORT_RULES; static final ReleaseType RELEASE; static final String PENTAHO_METASTORE_FOLDER; static final String PENTAHO_METASTORE_NAME; static final String KETTLE_LOG_MARK_MAPPINGS; static final String KETTLE_CARTE_JETTY_ACCEPTORS; static final String KETTLE_CARTE_JETTY_ACCEPT_QUEUE_SIZE; static final String KETTLE_CARTE_JETTY_RES_MAX_IDLE_TIME; static final String VFS_USER_DIR_IS_ROOT; }
@Test public void testSplitStringNullWithDelimiterNullAndEnclosureNull() { String[] result = Const.splitString( null, null, null ); assertNull( result ); }
public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); @Deprecated static final String VERSION; static final String COPYRIGHT_YEAR; static final int TIMEOUT_GET_MILLIS; static final int TIMEOUT_PUT_MILLIS; static final int ROWS_UPDATE; static final int ROWS_IN_ROWSET; static final int FETCH_SIZE; static final int SORT_SIZE; static final int HEARTBEAT_PERIODIC_INTERVAL_IN_SECS; static final String FILE_SEPARATOR; static final String PATH_SEPARATOR; static final String CR; static final String DOSCR; static final String EMPTY_STRING; static final String JAVA_VERSION; @Deprecated static final String USER_HOME_DIRECTORY; static String JNDI_DIRECTORY; static final String PLUGIN_BASE_FOLDERS_PROP; static final String DEFAULT_PLUGIN_BASE_FOLDERS; static final Date MIN_DATE; static final Date MAX_DATE; static final int MIN_YEAR; static final int MAX_YEAR; static final int RIGHT; static final int LENGTH; static final int MARGIN; static final int MIDDLE_PCT; static final int ARROW_WIDTH; static final int FORM_MARGIN; static final int SHADOW_SIZE; static final int SYMBOLSIZE; static final int MAX_FILE_HIST; static final Locale DEFAULT_LOCALE; static final char DEFAULT_DECIMAL_SEPARATOR; static final char DEFAULT_GROUPING_SEPARATOR; static final String DEFAULT_CURRENCY_SYMBOL; static final String DEFAULT_NUMBER_FORMAT; static final String NULL_STRING; static final String NULL_NUMBER; static final String NULL_DATE; static final String NULL_BIGNUMBER; static final String NULL_BOOLEAN; static final String NULL_INTEGER; static final String NULL_BINARY; static final String NULL_NONE; static final int ROUND_HALF_CEILING; static final String CHEF_LOG_FILE; static final String SPOON_LOG_FILE; static final String MENU_LOG_FILE; static final String GENERALIZED_DATE_TIME_FORMAT; static final String GENERALIZED_DATE_TIME_FORMAT_MILLIS; static final String XML_ENCODING; static final String[] STRING_TRANS_AND_JOB_FILTER_EXT; static final String STRING_TRANS_DEFAULT_EXT; static final String[] STRING_TRANS_FILTER_EXT; static final String STRING_JOB_DEFAULT_EXT; static final String[] STRING_JOB_FILTER_EXT; static final String KETTLE_PROPERTIES; static final String SHARED_DATA_FILE; static final String INTERNAL_VARIABLE_PREFIX; static final String INTERNAL_VARIABLE_KETTLE_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_DATE; static final String INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_FILENAME_NAME; static final String INTERNAL_VARIABLE_JOB_NAME; static final String INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_RUN_ID; static final String INTERNAL_VARIABLE_JOB_RUN_ATTEMPTNR; static final String VARIABLE_HEARTBEAT_PERIODIC_INTERVAL_SECS; static final String VARIABLE_MONITORING_SNMP_TRAPS_ENABLED; static final String INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY; static final String[] INTERNAL_TRANS_VARIABLES; static final String[] INTERNAL_JOB_VARIABLES; static final String[] DEPRECATED_VARIABLES; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_STEP_PARTITION_ID; static final String INTERNAL_VARIABLE_STEP_PARTITION_NR; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NUMBER; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NAME; static final String INTERNAL_VARIABLE_CLUSTER_SIZE; static final String INTERNAL_VARIABLE_STEP_UNIQUE_NUMBER; static final String INTERNAL_VARIABLE_CLUSTER_MASTER; static final String INTERNAL_VARIABLE_CLUSTER_RUN_ID; static final String INTERNAL_VARIABLE_STEP_UNIQUE_COUNT; static final String INTERNAL_VARIABLE_STEP_NAME; static final String INTERNAL_VARIABLE_STEP_COPYNR; static final int MAX_NR_LOG_LINES; static final int MAX_NR_HISTORY_LINES; static final int HISTORY_LINES_FETCH_SIZE; static final int MAX_LOG_LINE_TIMEOUT_MINUTES; static final int WARNING; static final int ERROR; static final int INFO; static final int NOTE_MARGIN; static final int MAX_UNDO; static final String KETTLE_VARIABLES_FILE; static final String KETTLE_LOG_SIZE_LIMIT; static final String KETTLE_TRANS_LOG_DB; static final String KETTLE_TRANS_LOG_SCHEMA; static final String KETTLE_TRANS_LOG_TABLE; static final String KETTLE_JOB_LOG_DB; static final String KETTLE_JOB_LOG_SCHEMA; static final String KETTLE_SLAVE_DETECTION_TIMER; static final String KETTLE_JOB_LOG_TABLE; static final String KETTLE_TRANS_PERFORMANCE_LOG_DB; static final String KETTLE_TRANS_PERFORMANCE_LOG_SCHEMA; static final String KETTLE_TRANS_PERFORMANCE_LOG_TABLE; static final String KETTLE_JOBENTRY_LOG_DB; static final String KETTLE_JOBENTRY_LOG_SCHEMA; static final String KETTLE_JOBENTRY_LOG_TABLE; static final String KETTLE_STEP_LOG_DB; static final String KETTLE_STEP_LOG_SCHEMA; static final String KETTLE_STEP_LOG_TABLE; static final String KETTLE_CHANNEL_LOG_DB; static final String KETTLE_CHANNEL_LOG_SCHEMA; static final String KETTLE_CHANNEL_LOG_TABLE; static final String KETTLE_METRICS_LOG_DB; static final String KETTLE_METRICS_LOG_SCHEMA; static final String KETTLE_METRICS_LOG_TABLE; static final String KETTLE_CHECKPOINT_LOG_DB; static final String KETTLE_CHECKPOINT_LOG_SCHEMA; static final String KETTLE_CHECKPOINT_LOG_TABLE; static final String KETTLE_SHARED_OBJECTS; static final String KETTLE_EMPTY_STRING_DIFFERS_FROM_NULL; static final String KETTLE_LENIENT_STRING_TO_NUMBER_CONVERSION; static final String KETTLE_COMPATIBILITY_DB_IGNORE_TIMEZONE; static final String KETTLE_COMPATIBILITY_IMPORT_PATH_ADDITION_ON_VARIABLES; static final String KETTLE_COMPATIBILITY_IGNORE_TABLE_LOGGING; static final String KETTLE_COMPATIBILITY_TEXT_FILE_OUTPUT_APPEND_NO_HEADER; static final String KETTLE_COMPATIBILITY_MERGE_ROWS_USE_REFERENCE_STREAM_WHEN_IDENTICAL; static final String KETTLE_COMPATIBILITY_MEMORY_GROUP_BY_SUM_AVERAGE_RETURN_NUMBER_TYPE; static final String KETTLE_SYSTEM_HOSTNAME; static final String KETTLE_MAX_LOG_SIZE_IN_LINES; static final String KETTLE_MAX_LOG_TIMEOUT_IN_MINUTES; static final String KETTLE_REDIRECT_STDERR; static final String KETTLE_REDIRECT_STDOUT; static final String KETTLE_CARTE_OBJECT_TIMEOUT_MINUTES; static final String KETTLE_STEP_PERFORMANCE_SNAPSHOT_LIMIT; static final String KETTLE_MAX_JOB_TRACKER_SIZE; static final String KETTLE_MAX_JOB_ENTRIES_LOGGED; static final String KETTLE_MAX_LOGGING_REGISTRY_SIZE; static final String KETTLE_LOG_TAB_REFRESH_DELAY; static final String KETTLE_LOG_TAB_REFRESH_PERIOD; static final String KETTLE_SAP_CONNECTION_FACTORY; static final String KETTLE_SAP_CONNECTION_FACTORY_DEFAULT_NAME; static final String KETTLE_PLUGIN_CLASSES; static final String KETTLE_PLUGIN_PACKAGES; static final String KETTLE_TRANS_ROWSET_SIZE; static final String VERSION_COMMENT_INITIAL_VERSION; static final String VERSION_COMMENT_EDIT_VERSION; static final String XML_FILE_KETTLE_STEPS; static final String KETTLE_CORE_STEPS_FILE; static final String XML_FILE_KETTLE_PARTITION_PLUGINS; static final String KETTLE_CORE_JOBENTRIES_FILE; static final String XML_FILE_KETTLE_SERVLETS; static final String XML_FILE_KETTLE_VALUEMETA_PLUGINS; static final String XML_FILE_KETTLE_PASSWORD_ENCODER_PLUGINS; static final String KETTLE_VALUEMETA_PLUGINS_FILE; static final String KETTLE_PASSWORD_ENCODER_PLUGIN; static final String KETTLE_PASSWORD_ENCODER_PLUGINS_FILE; static final String KETTLE_TWO_WAY_PASSWORD_ENCODER_SEED; static final String XML_FILE_KETTLE_LOGGING_PLUGINS; static final String KETTLE_LOGGING_PLUGINS_FILE; static final String KETTLE_CORE_SERVLETS_FILE; static final String KETTLE_ROWSET_GET_TIMEOUT; static final String KETTLE_ROWSET_PUT_TIMEOUT; static final String KETTLE_BATCHING_ROWSET; static final String KETTLE_DISABLE_CONSOLE_LOGGING; static final String XML_FILE_KETTLE_JOB_ENTRIES; static final String XML_FILE_KETTLE_REPOSITORIES; static final String XML_FILE_KETTLE_DATABASE_TYPES; static final String XML_FILE_KETTLE_COMPRESSION_PROVIDERS; static final String XML_FILE_KETTLE_AUTHENTICATION_PROVIDERS; static final String XML_FILE_KETTLE_EXTENSION_POINTS; static final String XML_FILE_KETTLE_REGISTRY_EXTENSIONS; static final String XML_FILE_KETTLE_LIFECYCLE_LISTENERS; static final String XML_FILE_KETTLE_ENGINES; static final String KETTLE_TRANS_PAN_JVM_EXIT_CODE; static final String KETTLE_DEFAULT_NUMBER_FORMAT; static final String KETTLE_DEFAULT_BIGNUMBER_FORMAT; static final String KETTLE_DEFAULT_INTEGER_FORMAT; static final String KETTLE_DEFAULT_DATE_FORMAT; static final String KETTLE_AGGREGATION_MIN_NULL_IS_VALUED; static final String KETTLE_AGGREGATION_ALL_NULLS_ARE_ZERO; static final String KETTLE_DEFAULT_TIMESTAMP_FORMAT; static final String KETTLE_SPLIT_FIELDS_REMOVE_ENCLOSURE; static final String KETTLE_GLOBAL_LOG_VARIABLES_CLEAR_ON_EXPORT; static final String KETTLE_COMPATIBILITY_CALCULATION_TIMEZONE_DECOMPOSITION; static final String KETTLE_COMPATIBILITY_SET_ERROR_ON_SPECIFIC_JOB_ENTRIES; static final String KETTLE_COMPATIBILITY_SEND_RESULT_XML_WITH_FULL_STATUS; static final String KETTLE_COMPATIBILITY_SELECT_VALUES_TYPE_CHANGE_USES_TYPE_DEFAULTS; static final String XML_FILE_KETTLE_IMPORT_RULES; static final ReleaseType RELEASE; static final String PENTAHO_METASTORE_FOLDER; static final String PENTAHO_METASTORE_NAME; static final String KETTLE_LOG_MARK_MAPPINGS; static final String KETTLE_CARTE_JETTY_ACCEPTORS; static final String KETTLE_CARTE_JETTY_ACCEPT_QUEUE_SIZE; static final String KETTLE_CARTE_JETTY_RES_MAX_IDLE_TIME; static final String VFS_USER_DIR_IS_ROOT; }
@Test public void testSplitStringNullWithDelimiterNullAndEnclosureNullRemoveEnclosure() { String[] result = Const.splitString( null, null, null, true ); assertNull( result ); }
public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); @Deprecated static final String VERSION; static final String COPYRIGHT_YEAR; static final int TIMEOUT_GET_MILLIS; static final int TIMEOUT_PUT_MILLIS; static final int ROWS_UPDATE; static final int ROWS_IN_ROWSET; static final int FETCH_SIZE; static final int SORT_SIZE; static final int HEARTBEAT_PERIODIC_INTERVAL_IN_SECS; static final String FILE_SEPARATOR; static final String PATH_SEPARATOR; static final String CR; static final String DOSCR; static final String EMPTY_STRING; static final String JAVA_VERSION; @Deprecated static final String USER_HOME_DIRECTORY; static String JNDI_DIRECTORY; static final String PLUGIN_BASE_FOLDERS_PROP; static final String DEFAULT_PLUGIN_BASE_FOLDERS; static final Date MIN_DATE; static final Date MAX_DATE; static final int MIN_YEAR; static final int MAX_YEAR; static final int RIGHT; static final int LENGTH; static final int MARGIN; static final int MIDDLE_PCT; static final int ARROW_WIDTH; static final int FORM_MARGIN; static final int SHADOW_SIZE; static final int SYMBOLSIZE; static final int MAX_FILE_HIST; static final Locale DEFAULT_LOCALE; static final char DEFAULT_DECIMAL_SEPARATOR; static final char DEFAULT_GROUPING_SEPARATOR; static final String DEFAULT_CURRENCY_SYMBOL; static final String DEFAULT_NUMBER_FORMAT; static final String NULL_STRING; static final String NULL_NUMBER; static final String NULL_DATE; static final String NULL_BIGNUMBER; static final String NULL_BOOLEAN; static final String NULL_INTEGER; static final String NULL_BINARY; static final String NULL_NONE; static final int ROUND_HALF_CEILING; static final String CHEF_LOG_FILE; static final String SPOON_LOG_FILE; static final String MENU_LOG_FILE; static final String GENERALIZED_DATE_TIME_FORMAT; static final String GENERALIZED_DATE_TIME_FORMAT_MILLIS; static final String XML_ENCODING; static final String[] STRING_TRANS_AND_JOB_FILTER_EXT; static final String STRING_TRANS_DEFAULT_EXT; static final String[] STRING_TRANS_FILTER_EXT; static final String STRING_JOB_DEFAULT_EXT; static final String[] STRING_JOB_FILTER_EXT; static final String KETTLE_PROPERTIES; static final String SHARED_DATA_FILE; static final String INTERNAL_VARIABLE_PREFIX; static final String INTERNAL_VARIABLE_KETTLE_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_DATE; static final String INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_FILENAME_NAME; static final String INTERNAL_VARIABLE_JOB_NAME; static final String INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_RUN_ID; static final String INTERNAL_VARIABLE_JOB_RUN_ATTEMPTNR; static final String VARIABLE_HEARTBEAT_PERIODIC_INTERVAL_SECS; static final String VARIABLE_MONITORING_SNMP_TRAPS_ENABLED; static final String INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY; static final String[] INTERNAL_TRANS_VARIABLES; static final String[] INTERNAL_JOB_VARIABLES; static final String[] DEPRECATED_VARIABLES; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_STEP_PARTITION_ID; static final String INTERNAL_VARIABLE_STEP_PARTITION_NR; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NUMBER; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NAME; static final String INTERNAL_VARIABLE_CLUSTER_SIZE; static final String INTERNAL_VARIABLE_STEP_UNIQUE_NUMBER; static final String INTERNAL_VARIABLE_CLUSTER_MASTER; static final String INTERNAL_VARIABLE_CLUSTER_RUN_ID; static final String INTERNAL_VARIABLE_STEP_UNIQUE_COUNT; static final String INTERNAL_VARIABLE_STEP_NAME; static final String INTERNAL_VARIABLE_STEP_COPYNR; static final int MAX_NR_LOG_LINES; static final int MAX_NR_HISTORY_LINES; static final int HISTORY_LINES_FETCH_SIZE; static final int MAX_LOG_LINE_TIMEOUT_MINUTES; static final int WARNING; static final int ERROR; static final int INFO; static final int NOTE_MARGIN; static final int MAX_UNDO; static final String KETTLE_VARIABLES_FILE; static final String KETTLE_LOG_SIZE_LIMIT; static final String KETTLE_TRANS_LOG_DB; static final String KETTLE_TRANS_LOG_SCHEMA; static final String KETTLE_TRANS_LOG_TABLE; static final String KETTLE_JOB_LOG_DB; static final String KETTLE_JOB_LOG_SCHEMA; static final String KETTLE_SLAVE_DETECTION_TIMER; static final String KETTLE_JOB_LOG_TABLE; static final String KETTLE_TRANS_PERFORMANCE_LOG_DB; static final String KETTLE_TRANS_PERFORMANCE_LOG_SCHEMA; static final String KETTLE_TRANS_PERFORMANCE_LOG_TABLE; static final String KETTLE_JOBENTRY_LOG_DB; static final String KETTLE_JOBENTRY_LOG_SCHEMA; static final String KETTLE_JOBENTRY_LOG_TABLE; static final String KETTLE_STEP_LOG_DB; static final String KETTLE_STEP_LOG_SCHEMA; static final String KETTLE_STEP_LOG_TABLE; static final String KETTLE_CHANNEL_LOG_DB; static final String KETTLE_CHANNEL_LOG_SCHEMA; static final String KETTLE_CHANNEL_LOG_TABLE; static final String KETTLE_METRICS_LOG_DB; static final String KETTLE_METRICS_LOG_SCHEMA; static final String KETTLE_METRICS_LOG_TABLE; static final String KETTLE_CHECKPOINT_LOG_DB; static final String KETTLE_CHECKPOINT_LOG_SCHEMA; static final String KETTLE_CHECKPOINT_LOG_TABLE; static final String KETTLE_SHARED_OBJECTS; static final String KETTLE_EMPTY_STRING_DIFFERS_FROM_NULL; static final String KETTLE_LENIENT_STRING_TO_NUMBER_CONVERSION; static final String KETTLE_COMPATIBILITY_DB_IGNORE_TIMEZONE; static final String KETTLE_COMPATIBILITY_IMPORT_PATH_ADDITION_ON_VARIABLES; static final String KETTLE_COMPATIBILITY_IGNORE_TABLE_LOGGING; static final String KETTLE_COMPATIBILITY_TEXT_FILE_OUTPUT_APPEND_NO_HEADER; static final String KETTLE_COMPATIBILITY_MERGE_ROWS_USE_REFERENCE_STREAM_WHEN_IDENTICAL; static final String KETTLE_COMPATIBILITY_MEMORY_GROUP_BY_SUM_AVERAGE_RETURN_NUMBER_TYPE; static final String KETTLE_SYSTEM_HOSTNAME; static final String KETTLE_MAX_LOG_SIZE_IN_LINES; static final String KETTLE_MAX_LOG_TIMEOUT_IN_MINUTES; static final String KETTLE_REDIRECT_STDERR; static final String KETTLE_REDIRECT_STDOUT; static final String KETTLE_CARTE_OBJECT_TIMEOUT_MINUTES; static final String KETTLE_STEP_PERFORMANCE_SNAPSHOT_LIMIT; static final String KETTLE_MAX_JOB_TRACKER_SIZE; static final String KETTLE_MAX_JOB_ENTRIES_LOGGED; static final String KETTLE_MAX_LOGGING_REGISTRY_SIZE; static final String KETTLE_LOG_TAB_REFRESH_DELAY; static final String KETTLE_LOG_TAB_REFRESH_PERIOD; static final String KETTLE_SAP_CONNECTION_FACTORY; static final String KETTLE_SAP_CONNECTION_FACTORY_DEFAULT_NAME; static final String KETTLE_PLUGIN_CLASSES; static final String KETTLE_PLUGIN_PACKAGES; static final String KETTLE_TRANS_ROWSET_SIZE; static final String VERSION_COMMENT_INITIAL_VERSION; static final String VERSION_COMMENT_EDIT_VERSION; static final String XML_FILE_KETTLE_STEPS; static final String KETTLE_CORE_STEPS_FILE; static final String XML_FILE_KETTLE_PARTITION_PLUGINS; static final String KETTLE_CORE_JOBENTRIES_FILE; static final String XML_FILE_KETTLE_SERVLETS; static final String XML_FILE_KETTLE_VALUEMETA_PLUGINS; static final String XML_FILE_KETTLE_PASSWORD_ENCODER_PLUGINS; static final String KETTLE_VALUEMETA_PLUGINS_FILE; static final String KETTLE_PASSWORD_ENCODER_PLUGIN; static final String KETTLE_PASSWORD_ENCODER_PLUGINS_FILE; static final String KETTLE_TWO_WAY_PASSWORD_ENCODER_SEED; static final String XML_FILE_KETTLE_LOGGING_PLUGINS; static final String KETTLE_LOGGING_PLUGINS_FILE; static final String KETTLE_CORE_SERVLETS_FILE; static final String KETTLE_ROWSET_GET_TIMEOUT; static final String KETTLE_ROWSET_PUT_TIMEOUT; static final String KETTLE_BATCHING_ROWSET; static final String KETTLE_DISABLE_CONSOLE_LOGGING; static final String XML_FILE_KETTLE_JOB_ENTRIES; static final String XML_FILE_KETTLE_REPOSITORIES; static final String XML_FILE_KETTLE_DATABASE_TYPES; static final String XML_FILE_KETTLE_COMPRESSION_PROVIDERS; static final String XML_FILE_KETTLE_AUTHENTICATION_PROVIDERS; static final String XML_FILE_KETTLE_EXTENSION_POINTS; static final String XML_FILE_KETTLE_REGISTRY_EXTENSIONS; static final String XML_FILE_KETTLE_LIFECYCLE_LISTENERS; static final String XML_FILE_KETTLE_ENGINES; static final String KETTLE_TRANS_PAN_JVM_EXIT_CODE; static final String KETTLE_DEFAULT_NUMBER_FORMAT; static final String KETTLE_DEFAULT_BIGNUMBER_FORMAT; static final String KETTLE_DEFAULT_INTEGER_FORMAT; static final String KETTLE_DEFAULT_DATE_FORMAT; static final String KETTLE_AGGREGATION_MIN_NULL_IS_VALUED; static final String KETTLE_AGGREGATION_ALL_NULLS_ARE_ZERO; static final String KETTLE_DEFAULT_TIMESTAMP_FORMAT; static final String KETTLE_SPLIT_FIELDS_REMOVE_ENCLOSURE; static final String KETTLE_GLOBAL_LOG_VARIABLES_CLEAR_ON_EXPORT; static final String KETTLE_COMPATIBILITY_CALCULATION_TIMEZONE_DECOMPOSITION; static final String KETTLE_COMPATIBILITY_SET_ERROR_ON_SPECIFIC_JOB_ENTRIES; static final String KETTLE_COMPATIBILITY_SEND_RESULT_XML_WITH_FULL_STATUS; static final String KETTLE_COMPATIBILITY_SELECT_VALUES_TYPE_CHANGE_USES_TYPE_DEFAULTS; static final String XML_FILE_KETTLE_IMPORT_RULES; static final ReleaseType RELEASE; static final String PENTAHO_METASTORE_FOLDER; static final String PENTAHO_METASTORE_NAME; static final String KETTLE_LOG_MARK_MAPPINGS; static final String KETTLE_CARTE_JETTY_ACCEPTORS; static final String KETTLE_CARTE_JETTY_ACCEPT_QUEUE_SIZE; static final String KETTLE_CARTE_JETTY_RES_MAX_IDLE_TIME; static final String VFS_USER_DIR_IS_ROOT; }
@Test public void testSplitStringWithDelimiterNullAndEnclosureNull() { String stringToSplit = "Hello, world"; String[] result = Const.splitString( stringToSplit, null, null ); assertSplit( result, stringToSplit ); }
public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); @Deprecated static final String VERSION; static final String COPYRIGHT_YEAR; static final int TIMEOUT_GET_MILLIS; static final int TIMEOUT_PUT_MILLIS; static final int ROWS_UPDATE; static final int ROWS_IN_ROWSET; static final int FETCH_SIZE; static final int SORT_SIZE; static final int HEARTBEAT_PERIODIC_INTERVAL_IN_SECS; static final String FILE_SEPARATOR; static final String PATH_SEPARATOR; static final String CR; static final String DOSCR; static final String EMPTY_STRING; static final String JAVA_VERSION; @Deprecated static final String USER_HOME_DIRECTORY; static String JNDI_DIRECTORY; static final String PLUGIN_BASE_FOLDERS_PROP; static final String DEFAULT_PLUGIN_BASE_FOLDERS; static final Date MIN_DATE; static final Date MAX_DATE; static final int MIN_YEAR; static final int MAX_YEAR; static final int RIGHT; static final int LENGTH; static final int MARGIN; static final int MIDDLE_PCT; static final int ARROW_WIDTH; static final int FORM_MARGIN; static final int SHADOW_SIZE; static final int SYMBOLSIZE; static final int MAX_FILE_HIST; static final Locale DEFAULT_LOCALE; static final char DEFAULT_DECIMAL_SEPARATOR; static final char DEFAULT_GROUPING_SEPARATOR; static final String DEFAULT_CURRENCY_SYMBOL; static final String DEFAULT_NUMBER_FORMAT; static final String NULL_STRING; static final String NULL_NUMBER; static final String NULL_DATE; static final String NULL_BIGNUMBER; static final String NULL_BOOLEAN; static final String NULL_INTEGER; static final String NULL_BINARY; static final String NULL_NONE; static final int ROUND_HALF_CEILING; static final String CHEF_LOG_FILE; static final String SPOON_LOG_FILE; static final String MENU_LOG_FILE; static final String GENERALIZED_DATE_TIME_FORMAT; static final String GENERALIZED_DATE_TIME_FORMAT_MILLIS; static final String XML_ENCODING; static final String[] STRING_TRANS_AND_JOB_FILTER_EXT; static final String STRING_TRANS_DEFAULT_EXT; static final String[] STRING_TRANS_FILTER_EXT; static final String STRING_JOB_DEFAULT_EXT; static final String[] STRING_JOB_FILTER_EXT; static final String KETTLE_PROPERTIES; static final String SHARED_DATA_FILE; static final String INTERNAL_VARIABLE_PREFIX; static final String INTERNAL_VARIABLE_KETTLE_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_DATE; static final String INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_FILENAME_NAME; static final String INTERNAL_VARIABLE_JOB_NAME; static final String INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_RUN_ID; static final String INTERNAL_VARIABLE_JOB_RUN_ATTEMPTNR; static final String VARIABLE_HEARTBEAT_PERIODIC_INTERVAL_SECS; static final String VARIABLE_MONITORING_SNMP_TRAPS_ENABLED; static final String INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY; static final String[] INTERNAL_TRANS_VARIABLES; static final String[] INTERNAL_JOB_VARIABLES; static final String[] DEPRECATED_VARIABLES; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_STEP_PARTITION_ID; static final String INTERNAL_VARIABLE_STEP_PARTITION_NR; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NUMBER; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NAME; static final String INTERNAL_VARIABLE_CLUSTER_SIZE; static final String INTERNAL_VARIABLE_STEP_UNIQUE_NUMBER; static final String INTERNAL_VARIABLE_CLUSTER_MASTER; static final String INTERNAL_VARIABLE_CLUSTER_RUN_ID; static final String INTERNAL_VARIABLE_STEP_UNIQUE_COUNT; static final String INTERNAL_VARIABLE_STEP_NAME; static final String INTERNAL_VARIABLE_STEP_COPYNR; static final int MAX_NR_LOG_LINES; static final int MAX_NR_HISTORY_LINES; static final int HISTORY_LINES_FETCH_SIZE; static final int MAX_LOG_LINE_TIMEOUT_MINUTES; static final int WARNING; static final int ERROR; static final int INFO; static final int NOTE_MARGIN; static final int MAX_UNDO; static final String KETTLE_VARIABLES_FILE; static final String KETTLE_LOG_SIZE_LIMIT; static final String KETTLE_TRANS_LOG_DB; static final String KETTLE_TRANS_LOG_SCHEMA; static final String KETTLE_TRANS_LOG_TABLE; static final String KETTLE_JOB_LOG_DB; static final String KETTLE_JOB_LOG_SCHEMA; static final String KETTLE_SLAVE_DETECTION_TIMER; static final String KETTLE_JOB_LOG_TABLE; static final String KETTLE_TRANS_PERFORMANCE_LOG_DB; static final String KETTLE_TRANS_PERFORMANCE_LOG_SCHEMA; static final String KETTLE_TRANS_PERFORMANCE_LOG_TABLE; static final String KETTLE_JOBENTRY_LOG_DB; static final String KETTLE_JOBENTRY_LOG_SCHEMA; static final String KETTLE_JOBENTRY_LOG_TABLE; static final String KETTLE_STEP_LOG_DB; static final String KETTLE_STEP_LOG_SCHEMA; static final String KETTLE_STEP_LOG_TABLE; static final String KETTLE_CHANNEL_LOG_DB; static final String KETTLE_CHANNEL_LOG_SCHEMA; static final String KETTLE_CHANNEL_LOG_TABLE; static final String KETTLE_METRICS_LOG_DB; static final String KETTLE_METRICS_LOG_SCHEMA; static final String KETTLE_METRICS_LOG_TABLE; static final String KETTLE_CHECKPOINT_LOG_DB; static final String KETTLE_CHECKPOINT_LOG_SCHEMA; static final String KETTLE_CHECKPOINT_LOG_TABLE; static final String KETTLE_SHARED_OBJECTS; static final String KETTLE_EMPTY_STRING_DIFFERS_FROM_NULL; static final String KETTLE_LENIENT_STRING_TO_NUMBER_CONVERSION; static final String KETTLE_COMPATIBILITY_DB_IGNORE_TIMEZONE; static final String KETTLE_COMPATIBILITY_IMPORT_PATH_ADDITION_ON_VARIABLES; static final String KETTLE_COMPATIBILITY_IGNORE_TABLE_LOGGING; static final String KETTLE_COMPATIBILITY_TEXT_FILE_OUTPUT_APPEND_NO_HEADER; static final String KETTLE_COMPATIBILITY_MERGE_ROWS_USE_REFERENCE_STREAM_WHEN_IDENTICAL; static final String KETTLE_COMPATIBILITY_MEMORY_GROUP_BY_SUM_AVERAGE_RETURN_NUMBER_TYPE; static final String KETTLE_SYSTEM_HOSTNAME; static final String KETTLE_MAX_LOG_SIZE_IN_LINES; static final String KETTLE_MAX_LOG_TIMEOUT_IN_MINUTES; static final String KETTLE_REDIRECT_STDERR; static final String KETTLE_REDIRECT_STDOUT; static final String KETTLE_CARTE_OBJECT_TIMEOUT_MINUTES; static final String KETTLE_STEP_PERFORMANCE_SNAPSHOT_LIMIT; static final String KETTLE_MAX_JOB_TRACKER_SIZE; static final String KETTLE_MAX_JOB_ENTRIES_LOGGED; static final String KETTLE_MAX_LOGGING_REGISTRY_SIZE; static final String KETTLE_LOG_TAB_REFRESH_DELAY; static final String KETTLE_LOG_TAB_REFRESH_PERIOD; static final String KETTLE_SAP_CONNECTION_FACTORY; static final String KETTLE_SAP_CONNECTION_FACTORY_DEFAULT_NAME; static final String KETTLE_PLUGIN_CLASSES; static final String KETTLE_PLUGIN_PACKAGES; static final String KETTLE_TRANS_ROWSET_SIZE; static final String VERSION_COMMENT_INITIAL_VERSION; static final String VERSION_COMMENT_EDIT_VERSION; static final String XML_FILE_KETTLE_STEPS; static final String KETTLE_CORE_STEPS_FILE; static final String XML_FILE_KETTLE_PARTITION_PLUGINS; static final String KETTLE_CORE_JOBENTRIES_FILE; static final String XML_FILE_KETTLE_SERVLETS; static final String XML_FILE_KETTLE_VALUEMETA_PLUGINS; static final String XML_FILE_KETTLE_PASSWORD_ENCODER_PLUGINS; static final String KETTLE_VALUEMETA_PLUGINS_FILE; static final String KETTLE_PASSWORD_ENCODER_PLUGIN; static final String KETTLE_PASSWORD_ENCODER_PLUGINS_FILE; static final String KETTLE_TWO_WAY_PASSWORD_ENCODER_SEED; static final String XML_FILE_KETTLE_LOGGING_PLUGINS; static final String KETTLE_LOGGING_PLUGINS_FILE; static final String KETTLE_CORE_SERVLETS_FILE; static final String KETTLE_ROWSET_GET_TIMEOUT; static final String KETTLE_ROWSET_PUT_TIMEOUT; static final String KETTLE_BATCHING_ROWSET; static final String KETTLE_DISABLE_CONSOLE_LOGGING; static final String XML_FILE_KETTLE_JOB_ENTRIES; static final String XML_FILE_KETTLE_REPOSITORIES; static final String XML_FILE_KETTLE_DATABASE_TYPES; static final String XML_FILE_KETTLE_COMPRESSION_PROVIDERS; static final String XML_FILE_KETTLE_AUTHENTICATION_PROVIDERS; static final String XML_FILE_KETTLE_EXTENSION_POINTS; static final String XML_FILE_KETTLE_REGISTRY_EXTENSIONS; static final String XML_FILE_KETTLE_LIFECYCLE_LISTENERS; static final String XML_FILE_KETTLE_ENGINES; static final String KETTLE_TRANS_PAN_JVM_EXIT_CODE; static final String KETTLE_DEFAULT_NUMBER_FORMAT; static final String KETTLE_DEFAULT_BIGNUMBER_FORMAT; static final String KETTLE_DEFAULT_INTEGER_FORMAT; static final String KETTLE_DEFAULT_DATE_FORMAT; static final String KETTLE_AGGREGATION_MIN_NULL_IS_VALUED; static final String KETTLE_AGGREGATION_ALL_NULLS_ARE_ZERO; static final String KETTLE_DEFAULT_TIMESTAMP_FORMAT; static final String KETTLE_SPLIT_FIELDS_REMOVE_ENCLOSURE; static final String KETTLE_GLOBAL_LOG_VARIABLES_CLEAR_ON_EXPORT; static final String KETTLE_COMPATIBILITY_CALCULATION_TIMEZONE_DECOMPOSITION; static final String KETTLE_COMPATIBILITY_SET_ERROR_ON_SPECIFIC_JOB_ENTRIES; static final String KETTLE_COMPATIBILITY_SEND_RESULT_XML_WITH_FULL_STATUS; static final String KETTLE_COMPATIBILITY_SELECT_VALUES_TYPE_CHANGE_USES_TYPE_DEFAULTS; static final String XML_FILE_KETTLE_IMPORT_RULES; static final ReleaseType RELEASE; static final String PENTAHO_METASTORE_FOLDER; static final String PENTAHO_METASTORE_NAME; static final String KETTLE_LOG_MARK_MAPPINGS; static final String KETTLE_CARTE_JETTY_ACCEPTORS; static final String KETTLE_CARTE_JETTY_ACCEPT_QUEUE_SIZE; static final String KETTLE_CARTE_JETTY_RES_MAX_IDLE_TIME; static final String VFS_USER_DIR_IS_ROOT; }
@Test public void testSplitStringWithDelimiterNullAndEnclosureNullRemoveEnclosure() { String stringToSplit = "Hello, world"; String[] result = Const.splitString( stringToSplit, null, null, true ); assertSplit( result, stringToSplit ); }
public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); @Deprecated static final String VERSION; static final String COPYRIGHT_YEAR; static final int TIMEOUT_GET_MILLIS; static final int TIMEOUT_PUT_MILLIS; static final int ROWS_UPDATE; static final int ROWS_IN_ROWSET; static final int FETCH_SIZE; static final int SORT_SIZE; static final int HEARTBEAT_PERIODIC_INTERVAL_IN_SECS; static final String FILE_SEPARATOR; static final String PATH_SEPARATOR; static final String CR; static final String DOSCR; static final String EMPTY_STRING; static final String JAVA_VERSION; @Deprecated static final String USER_HOME_DIRECTORY; static String JNDI_DIRECTORY; static final String PLUGIN_BASE_FOLDERS_PROP; static final String DEFAULT_PLUGIN_BASE_FOLDERS; static final Date MIN_DATE; static final Date MAX_DATE; static final int MIN_YEAR; static final int MAX_YEAR; static final int RIGHT; static final int LENGTH; static final int MARGIN; static final int MIDDLE_PCT; static final int ARROW_WIDTH; static final int FORM_MARGIN; static final int SHADOW_SIZE; static final int SYMBOLSIZE; static final int MAX_FILE_HIST; static final Locale DEFAULT_LOCALE; static final char DEFAULT_DECIMAL_SEPARATOR; static final char DEFAULT_GROUPING_SEPARATOR; static final String DEFAULT_CURRENCY_SYMBOL; static final String DEFAULT_NUMBER_FORMAT; static final String NULL_STRING; static final String NULL_NUMBER; static final String NULL_DATE; static final String NULL_BIGNUMBER; static final String NULL_BOOLEAN; static final String NULL_INTEGER; static final String NULL_BINARY; static final String NULL_NONE; static final int ROUND_HALF_CEILING; static final String CHEF_LOG_FILE; static final String SPOON_LOG_FILE; static final String MENU_LOG_FILE; static final String GENERALIZED_DATE_TIME_FORMAT; static final String GENERALIZED_DATE_TIME_FORMAT_MILLIS; static final String XML_ENCODING; static final String[] STRING_TRANS_AND_JOB_FILTER_EXT; static final String STRING_TRANS_DEFAULT_EXT; static final String[] STRING_TRANS_FILTER_EXT; static final String STRING_JOB_DEFAULT_EXT; static final String[] STRING_JOB_FILTER_EXT; static final String KETTLE_PROPERTIES; static final String SHARED_DATA_FILE; static final String INTERNAL_VARIABLE_PREFIX; static final String INTERNAL_VARIABLE_KETTLE_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_DATE; static final String INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_FILENAME_NAME; static final String INTERNAL_VARIABLE_JOB_NAME; static final String INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_RUN_ID; static final String INTERNAL_VARIABLE_JOB_RUN_ATTEMPTNR; static final String VARIABLE_HEARTBEAT_PERIODIC_INTERVAL_SECS; static final String VARIABLE_MONITORING_SNMP_TRAPS_ENABLED; static final String INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY; static final String[] INTERNAL_TRANS_VARIABLES; static final String[] INTERNAL_JOB_VARIABLES; static final String[] DEPRECATED_VARIABLES; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_STEP_PARTITION_ID; static final String INTERNAL_VARIABLE_STEP_PARTITION_NR; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NUMBER; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NAME; static final String INTERNAL_VARIABLE_CLUSTER_SIZE; static final String INTERNAL_VARIABLE_STEP_UNIQUE_NUMBER; static final String INTERNAL_VARIABLE_CLUSTER_MASTER; static final String INTERNAL_VARIABLE_CLUSTER_RUN_ID; static final String INTERNAL_VARIABLE_STEP_UNIQUE_COUNT; static final String INTERNAL_VARIABLE_STEP_NAME; static final String INTERNAL_VARIABLE_STEP_COPYNR; static final int MAX_NR_LOG_LINES; static final int MAX_NR_HISTORY_LINES; static final int HISTORY_LINES_FETCH_SIZE; static final int MAX_LOG_LINE_TIMEOUT_MINUTES; static final int WARNING; static final int ERROR; static final int INFO; static final int NOTE_MARGIN; static final int MAX_UNDO; static final String KETTLE_VARIABLES_FILE; static final String KETTLE_LOG_SIZE_LIMIT; static final String KETTLE_TRANS_LOG_DB; static final String KETTLE_TRANS_LOG_SCHEMA; static final String KETTLE_TRANS_LOG_TABLE; static final String KETTLE_JOB_LOG_DB; static final String KETTLE_JOB_LOG_SCHEMA; static final String KETTLE_SLAVE_DETECTION_TIMER; static final String KETTLE_JOB_LOG_TABLE; static final String KETTLE_TRANS_PERFORMANCE_LOG_DB; static final String KETTLE_TRANS_PERFORMANCE_LOG_SCHEMA; static final String KETTLE_TRANS_PERFORMANCE_LOG_TABLE; static final String KETTLE_JOBENTRY_LOG_DB; static final String KETTLE_JOBENTRY_LOG_SCHEMA; static final String KETTLE_JOBENTRY_LOG_TABLE; static final String KETTLE_STEP_LOG_DB; static final String KETTLE_STEP_LOG_SCHEMA; static final String KETTLE_STEP_LOG_TABLE; static final String KETTLE_CHANNEL_LOG_DB; static final String KETTLE_CHANNEL_LOG_SCHEMA; static final String KETTLE_CHANNEL_LOG_TABLE; static final String KETTLE_METRICS_LOG_DB; static final String KETTLE_METRICS_LOG_SCHEMA; static final String KETTLE_METRICS_LOG_TABLE; static final String KETTLE_CHECKPOINT_LOG_DB; static final String KETTLE_CHECKPOINT_LOG_SCHEMA; static final String KETTLE_CHECKPOINT_LOG_TABLE; static final String KETTLE_SHARED_OBJECTS; static final String KETTLE_EMPTY_STRING_DIFFERS_FROM_NULL; static final String KETTLE_LENIENT_STRING_TO_NUMBER_CONVERSION; static final String KETTLE_COMPATIBILITY_DB_IGNORE_TIMEZONE; static final String KETTLE_COMPATIBILITY_IMPORT_PATH_ADDITION_ON_VARIABLES; static final String KETTLE_COMPATIBILITY_IGNORE_TABLE_LOGGING; static final String KETTLE_COMPATIBILITY_TEXT_FILE_OUTPUT_APPEND_NO_HEADER; static final String KETTLE_COMPATIBILITY_MERGE_ROWS_USE_REFERENCE_STREAM_WHEN_IDENTICAL; static final String KETTLE_COMPATIBILITY_MEMORY_GROUP_BY_SUM_AVERAGE_RETURN_NUMBER_TYPE; static final String KETTLE_SYSTEM_HOSTNAME; static final String KETTLE_MAX_LOG_SIZE_IN_LINES; static final String KETTLE_MAX_LOG_TIMEOUT_IN_MINUTES; static final String KETTLE_REDIRECT_STDERR; static final String KETTLE_REDIRECT_STDOUT; static final String KETTLE_CARTE_OBJECT_TIMEOUT_MINUTES; static final String KETTLE_STEP_PERFORMANCE_SNAPSHOT_LIMIT; static final String KETTLE_MAX_JOB_TRACKER_SIZE; static final String KETTLE_MAX_JOB_ENTRIES_LOGGED; static final String KETTLE_MAX_LOGGING_REGISTRY_SIZE; static final String KETTLE_LOG_TAB_REFRESH_DELAY; static final String KETTLE_LOG_TAB_REFRESH_PERIOD; static final String KETTLE_SAP_CONNECTION_FACTORY; static final String KETTLE_SAP_CONNECTION_FACTORY_DEFAULT_NAME; static final String KETTLE_PLUGIN_CLASSES; static final String KETTLE_PLUGIN_PACKAGES; static final String KETTLE_TRANS_ROWSET_SIZE; static final String VERSION_COMMENT_INITIAL_VERSION; static final String VERSION_COMMENT_EDIT_VERSION; static final String XML_FILE_KETTLE_STEPS; static final String KETTLE_CORE_STEPS_FILE; static final String XML_FILE_KETTLE_PARTITION_PLUGINS; static final String KETTLE_CORE_JOBENTRIES_FILE; static final String XML_FILE_KETTLE_SERVLETS; static final String XML_FILE_KETTLE_VALUEMETA_PLUGINS; static final String XML_FILE_KETTLE_PASSWORD_ENCODER_PLUGINS; static final String KETTLE_VALUEMETA_PLUGINS_FILE; static final String KETTLE_PASSWORD_ENCODER_PLUGIN; static final String KETTLE_PASSWORD_ENCODER_PLUGINS_FILE; static final String KETTLE_TWO_WAY_PASSWORD_ENCODER_SEED; static final String XML_FILE_KETTLE_LOGGING_PLUGINS; static final String KETTLE_LOGGING_PLUGINS_FILE; static final String KETTLE_CORE_SERVLETS_FILE; static final String KETTLE_ROWSET_GET_TIMEOUT; static final String KETTLE_ROWSET_PUT_TIMEOUT; static final String KETTLE_BATCHING_ROWSET; static final String KETTLE_DISABLE_CONSOLE_LOGGING; static final String XML_FILE_KETTLE_JOB_ENTRIES; static final String XML_FILE_KETTLE_REPOSITORIES; static final String XML_FILE_KETTLE_DATABASE_TYPES; static final String XML_FILE_KETTLE_COMPRESSION_PROVIDERS; static final String XML_FILE_KETTLE_AUTHENTICATION_PROVIDERS; static final String XML_FILE_KETTLE_EXTENSION_POINTS; static final String XML_FILE_KETTLE_REGISTRY_EXTENSIONS; static final String XML_FILE_KETTLE_LIFECYCLE_LISTENERS; static final String XML_FILE_KETTLE_ENGINES; static final String KETTLE_TRANS_PAN_JVM_EXIT_CODE; static final String KETTLE_DEFAULT_NUMBER_FORMAT; static final String KETTLE_DEFAULT_BIGNUMBER_FORMAT; static final String KETTLE_DEFAULT_INTEGER_FORMAT; static final String KETTLE_DEFAULT_DATE_FORMAT; static final String KETTLE_AGGREGATION_MIN_NULL_IS_VALUED; static final String KETTLE_AGGREGATION_ALL_NULLS_ARE_ZERO; static final String KETTLE_DEFAULT_TIMESTAMP_FORMAT; static final String KETTLE_SPLIT_FIELDS_REMOVE_ENCLOSURE; static final String KETTLE_GLOBAL_LOG_VARIABLES_CLEAR_ON_EXPORT; static final String KETTLE_COMPATIBILITY_CALCULATION_TIMEZONE_DECOMPOSITION; static final String KETTLE_COMPATIBILITY_SET_ERROR_ON_SPECIFIC_JOB_ENTRIES; static final String KETTLE_COMPATIBILITY_SEND_RESULT_XML_WITH_FULL_STATUS; static final String KETTLE_COMPATIBILITY_SELECT_VALUES_TYPE_CHANGE_USES_TYPE_DEFAULTS; static final String XML_FILE_KETTLE_IMPORT_RULES; static final ReleaseType RELEASE; static final String PENTAHO_METASTORE_FOLDER; static final String PENTAHO_METASTORE_NAME; static final String KETTLE_LOG_MARK_MAPPINGS; static final String KETTLE_CARTE_JETTY_ACCEPTORS; static final String KETTLE_CARTE_JETTY_ACCEPT_QUEUE_SIZE; static final String KETTLE_CARTE_JETTY_RES_MAX_IDLE_TIME; static final String VFS_USER_DIR_IS_ROOT; }
@Test public void testSplitStringWithDelimiterAndEnclosureNull() { String mask = "Hello%s world"; String[] chunks = {"Hello", " world"}; String stringToSplit = String.format( mask, DELIMITER1 ); String[] result = Const.splitString( stringToSplit, DELIMITER1, null ); assertSplit( result, chunks ); }
public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); @Deprecated static final String VERSION; static final String COPYRIGHT_YEAR; static final int TIMEOUT_GET_MILLIS; static final int TIMEOUT_PUT_MILLIS; static final int ROWS_UPDATE; static final int ROWS_IN_ROWSET; static final int FETCH_SIZE; static final int SORT_SIZE; static final int HEARTBEAT_PERIODIC_INTERVAL_IN_SECS; static final String FILE_SEPARATOR; static final String PATH_SEPARATOR; static final String CR; static final String DOSCR; static final String EMPTY_STRING; static final String JAVA_VERSION; @Deprecated static final String USER_HOME_DIRECTORY; static String JNDI_DIRECTORY; static final String PLUGIN_BASE_FOLDERS_PROP; static final String DEFAULT_PLUGIN_BASE_FOLDERS; static final Date MIN_DATE; static final Date MAX_DATE; static final int MIN_YEAR; static final int MAX_YEAR; static final int RIGHT; static final int LENGTH; static final int MARGIN; static final int MIDDLE_PCT; static final int ARROW_WIDTH; static final int FORM_MARGIN; static final int SHADOW_SIZE; static final int SYMBOLSIZE; static final int MAX_FILE_HIST; static final Locale DEFAULT_LOCALE; static final char DEFAULT_DECIMAL_SEPARATOR; static final char DEFAULT_GROUPING_SEPARATOR; static final String DEFAULT_CURRENCY_SYMBOL; static final String DEFAULT_NUMBER_FORMAT; static final String NULL_STRING; static final String NULL_NUMBER; static final String NULL_DATE; static final String NULL_BIGNUMBER; static final String NULL_BOOLEAN; static final String NULL_INTEGER; static final String NULL_BINARY; static final String NULL_NONE; static final int ROUND_HALF_CEILING; static final String CHEF_LOG_FILE; static final String SPOON_LOG_FILE; static final String MENU_LOG_FILE; static final String GENERALIZED_DATE_TIME_FORMAT; static final String GENERALIZED_DATE_TIME_FORMAT_MILLIS; static final String XML_ENCODING; static final String[] STRING_TRANS_AND_JOB_FILTER_EXT; static final String STRING_TRANS_DEFAULT_EXT; static final String[] STRING_TRANS_FILTER_EXT; static final String STRING_JOB_DEFAULT_EXT; static final String[] STRING_JOB_FILTER_EXT; static final String KETTLE_PROPERTIES; static final String SHARED_DATA_FILE; static final String INTERNAL_VARIABLE_PREFIX; static final String INTERNAL_VARIABLE_KETTLE_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_DATE; static final String INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_FILENAME_NAME; static final String INTERNAL_VARIABLE_JOB_NAME; static final String INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_RUN_ID; static final String INTERNAL_VARIABLE_JOB_RUN_ATTEMPTNR; static final String VARIABLE_HEARTBEAT_PERIODIC_INTERVAL_SECS; static final String VARIABLE_MONITORING_SNMP_TRAPS_ENABLED; static final String INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY; static final String[] INTERNAL_TRANS_VARIABLES; static final String[] INTERNAL_JOB_VARIABLES; static final String[] DEPRECATED_VARIABLES; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_STEP_PARTITION_ID; static final String INTERNAL_VARIABLE_STEP_PARTITION_NR; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NUMBER; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NAME; static final String INTERNAL_VARIABLE_CLUSTER_SIZE; static final String INTERNAL_VARIABLE_STEP_UNIQUE_NUMBER; static final String INTERNAL_VARIABLE_CLUSTER_MASTER; static final String INTERNAL_VARIABLE_CLUSTER_RUN_ID; static final String INTERNAL_VARIABLE_STEP_UNIQUE_COUNT; static final String INTERNAL_VARIABLE_STEP_NAME; static final String INTERNAL_VARIABLE_STEP_COPYNR; static final int MAX_NR_LOG_LINES; static final int MAX_NR_HISTORY_LINES; static final int HISTORY_LINES_FETCH_SIZE; static final int MAX_LOG_LINE_TIMEOUT_MINUTES; static final int WARNING; static final int ERROR; static final int INFO; static final int NOTE_MARGIN; static final int MAX_UNDO; static final String KETTLE_VARIABLES_FILE; static final String KETTLE_LOG_SIZE_LIMIT; static final String KETTLE_TRANS_LOG_DB; static final String KETTLE_TRANS_LOG_SCHEMA; static final String KETTLE_TRANS_LOG_TABLE; static final String KETTLE_JOB_LOG_DB; static final String KETTLE_JOB_LOG_SCHEMA; static final String KETTLE_SLAVE_DETECTION_TIMER; static final String KETTLE_JOB_LOG_TABLE; static final String KETTLE_TRANS_PERFORMANCE_LOG_DB; static final String KETTLE_TRANS_PERFORMANCE_LOG_SCHEMA; static final String KETTLE_TRANS_PERFORMANCE_LOG_TABLE; static final String KETTLE_JOBENTRY_LOG_DB; static final String KETTLE_JOBENTRY_LOG_SCHEMA; static final String KETTLE_JOBENTRY_LOG_TABLE; static final String KETTLE_STEP_LOG_DB; static final String KETTLE_STEP_LOG_SCHEMA; static final String KETTLE_STEP_LOG_TABLE; static final String KETTLE_CHANNEL_LOG_DB; static final String KETTLE_CHANNEL_LOG_SCHEMA; static final String KETTLE_CHANNEL_LOG_TABLE; static final String KETTLE_METRICS_LOG_DB; static final String KETTLE_METRICS_LOG_SCHEMA; static final String KETTLE_METRICS_LOG_TABLE; static final String KETTLE_CHECKPOINT_LOG_DB; static final String KETTLE_CHECKPOINT_LOG_SCHEMA; static final String KETTLE_CHECKPOINT_LOG_TABLE; static final String KETTLE_SHARED_OBJECTS; static final String KETTLE_EMPTY_STRING_DIFFERS_FROM_NULL; static final String KETTLE_LENIENT_STRING_TO_NUMBER_CONVERSION; static final String KETTLE_COMPATIBILITY_DB_IGNORE_TIMEZONE; static final String KETTLE_COMPATIBILITY_IMPORT_PATH_ADDITION_ON_VARIABLES; static final String KETTLE_COMPATIBILITY_IGNORE_TABLE_LOGGING; static final String KETTLE_COMPATIBILITY_TEXT_FILE_OUTPUT_APPEND_NO_HEADER; static final String KETTLE_COMPATIBILITY_MERGE_ROWS_USE_REFERENCE_STREAM_WHEN_IDENTICAL; static final String KETTLE_COMPATIBILITY_MEMORY_GROUP_BY_SUM_AVERAGE_RETURN_NUMBER_TYPE; static final String KETTLE_SYSTEM_HOSTNAME; static final String KETTLE_MAX_LOG_SIZE_IN_LINES; static final String KETTLE_MAX_LOG_TIMEOUT_IN_MINUTES; static final String KETTLE_REDIRECT_STDERR; static final String KETTLE_REDIRECT_STDOUT; static final String KETTLE_CARTE_OBJECT_TIMEOUT_MINUTES; static final String KETTLE_STEP_PERFORMANCE_SNAPSHOT_LIMIT; static final String KETTLE_MAX_JOB_TRACKER_SIZE; static final String KETTLE_MAX_JOB_ENTRIES_LOGGED; static final String KETTLE_MAX_LOGGING_REGISTRY_SIZE; static final String KETTLE_LOG_TAB_REFRESH_DELAY; static final String KETTLE_LOG_TAB_REFRESH_PERIOD; static final String KETTLE_SAP_CONNECTION_FACTORY; static final String KETTLE_SAP_CONNECTION_FACTORY_DEFAULT_NAME; static final String KETTLE_PLUGIN_CLASSES; static final String KETTLE_PLUGIN_PACKAGES; static final String KETTLE_TRANS_ROWSET_SIZE; static final String VERSION_COMMENT_INITIAL_VERSION; static final String VERSION_COMMENT_EDIT_VERSION; static final String XML_FILE_KETTLE_STEPS; static final String KETTLE_CORE_STEPS_FILE; static final String XML_FILE_KETTLE_PARTITION_PLUGINS; static final String KETTLE_CORE_JOBENTRIES_FILE; static final String XML_FILE_KETTLE_SERVLETS; static final String XML_FILE_KETTLE_VALUEMETA_PLUGINS; static final String XML_FILE_KETTLE_PASSWORD_ENCODER_PLUGINS; static final String KETTLE_VALUEMETA_PLUGINS_FILE; static final String KETTLE_PASSWORD_ENCODER_PLUGIN; static final String KETTLE_PASSWORD_ENCODER_PLUGINS_FILE; static final String KETTLE_TWO_WAY_PASSWORD_ENCODER_SEED; static final String XML_FILE_KETTLE_LOGGING_PLUGINS; static final String KETTLE_LOGGING_PLUGINS_FILE; static final String KETTLE_CORE_SERVLETS_FILE; static final String KETTLE_ROWSET_GET_TIMEOUT; static final String KETTLE_ROWSET_PUT_TIMEOUT; static final String KETTLE_BATCHING_ROWSET; static final String KETTLE_DISABLE_CONSOLE_LOGGING; static final String XML_FILE_KETTLE_JOB_ENTRIES; static final String XML_FILE_KETTLE_REPOSITORIES; static final String XML_FILE_KETTLE_DATABASE_TYPES; static final String XML_FILE_KETTLE_COMPRESSION_PROVIDERS; static final String XML_FILE_KETTLE_AUTHENTICATION_PROVIDERS; static final String XML_FILE_KETTLE_EXTENSION_POINTS; static final String XML_FILE_KETTLE_REGISTRY_EXTENSIONS; static final String XML_FILE_KETTLE_LIFECYCLE_LISTENERS; static final String XML_FILE_KETTLE_ENGINES; static final String KETTLE_TRANS_PAN_JVM_EXIT_CODE; static final String KETTLE_DEFAULT_NUMBER_FORMAT; static final String KETTLE_DEFAULT_BIGNUMBER_FORMAT; static final String KETTLE_DEFAULT_INTEGER_FORMAT; static final String KETTLE_DEFAULT_DATE_FORMAT; static final String KETTLE_AGGREGATION_MIN_NULL_IS_VALUED; static final String KETTLE_AGGREGATION_ALL_NULLS_ARE_ZERO; static final String KETTLE_DEFAULT_TIMESTAMP_FORMAT; static final String KETTLE_SPLIT_FIELDS_REMOVE_ENCLOSURE; static final String KETTLE_GLOBAL_LOG_VARIABLES_CLEAR_ON_EXPORT; static final String KETTLE_COMPATIBILITY_CALCULATION_TIMEZONE_DECOMPOSITION; static final String KETTLE_COMPATIBILITY_SET_ERROR_ON_SPECIFIC_JOB_ENTRIES; static final String KETTLE_COMPATIBILITY_SEND_RESULT_XML_WITH_FULL_STATUS; static final String KETTLE_COMPATIBILITY_SELECT_VALUES_TYPE_CHANGE_USES_TYPE_DEFAULTS; static final String XML_FILE_KETTLE_IMPORT_RULES; static final ReleaseType RELEASE; static final String PENTAHO_METASTORE_FOLDER; static final String PENTAHO_METASTORE_NAME; static final String KETTLE_LOG_MARK_MAPPINGS; static final String KETTLE_CARTE_JETTY_ACCEPTORS; static final String KETTLE_CARTE_JETTY_ACCEPT_QUEUE_SIZE; static final String KETTLE_CARTE_JETTY_RES_MAX_IDLE_TIME; static final String VFS_USER_DIR_IS_ROOT; }
@Test public void testSplitStringWithDelimiterAndEnclosureNullMultiChar() { String mask = "Hello%s world"; String[] chunks = {"Hello", " world"}; String stringToSplit = String.format( mask, DELIMITER2 ); String[] result = Const.splitString( stringToSplit, DELIMITER2, null ); assertSplit( result, chunks ); }
public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); @Deprecated static final String VERSION; static final String COPYRIGHT_YEAR; static final int TIMEOUT_GET_MILLIS; static final int TIMEOUT_PUT_MILLIS; static final int ROWS_UPDATE; static final int ROWS_IN_ROWSET; static final int FETCH_SIZE; static final int SORT_SIZE; static final int HEARTBEAT_PERIODIC_INTERVAL_IN_SECS; static final String FILE_SEPARATOR; static final String PATH_SEPARATOR; static final String CR; static final String DOSCR; static final String EMPTY_STRING; static final String JAVA_VERSION; @Deprecated static final String USER_HOME_DIRECTORY; static String JNDI_DIRECTORY; static final String PLUGIN_BASE_FOLDERS_PROP; static final String DEFAULT_PLUGIN_BASE_FOLDERS; static final Date MIN_DATE; static final Date MAX_DATE; static final int MIN_YEAR; static final int MAX_YEAR; static final int RIGHT; static final int LENGTH; static final int MARGIN; static final int MIDDLE_PCT; static final int ARROW_WIDTH; static final int FORM_MARGIN; static final int SHADOW_SIZE; static final int SYMBOLSIZE; static final int MAX_FILE_HIST; static final Locale DEFAULT_LOCALE; static final char DEFAULT_DECIMAL_SEPARATOR; static final char DEFAULT_GROUPING_SEPARATOR; static final String DEFAULT_CURRENCY_SYMBOL; static final String DEFAULT_NUMBER_FORMAT; static final String NULL_STRING; static final String NULL_NUMBER; static final String NULL_DATE; static final String NULL_BIGNUMBER; static final String NULL_BOOLEAN; static final String NULL_INTEGER; static final String NULL_BINARY; static final String NULL_NONE; static final int ROUND_HALF_CEILING; static final String CHEF_LOG_FILE; static final String SPOON_LOG_FILE; static final String MENU_LOG_FILE; static final String GENERALIZED_DATE_TIME_FORMAT; static final String GENERALIZED_DATE_TIME_FORMAT_MILLIS; static final String XML_ENCODING; static final String[] STRING_TRANS_AND_JOB_FILTER_EXT; static final String STRING_TRANS_DEFAULT_EXT; static final String[] STRING_TRANS_FILTER_EXT; static final String STRING_JOB_DEFAULT_EXT; static final String[] STRING_JOB_FILTER_EXT; static final String KETTLE_PROPERTIES; static final String SHARED_DATA_FILE; static final String INTERNAL_VARIABLE_PREFIX; static final String INTERNAL_VARIABLE_KETTLE_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_DATE; static final String INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_FILENAME_NAME; static final String INTERNAL_VARIABLE_JOB_NAME; static final String INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_RUN_ID; static final String INTERNAL_VARIABLE_JOB_RUN_ATTEMPTNR; static final String VARIABLE_HEARTBEAT_PERIODIC_INTERVAL_SECS; static final String VARIABLE_MONITORING_SNMP_TRAPS_ENABLED; static final String INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY; static final String[] INTERNAL_TRANS_VARIABLES; static final String[] INTERNAL_JOB_VARIABLES; static final String[] DEPRECATED_VARIABLES; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_STEP_PARTITION_ID; static final String INTERNAL_VARIABLE_STEP_PARTITION_NR; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NUMBER; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NAME; static final String INTERNAL_VARIABLE_CLUSTER_SIZE; static final String INTERNAL_VARIABLE_STEP_UNIQUE_NUMBER; static final String INTERNAL_VARIABLE_CLUSTER_MASTER; static final String INTERNAL_VARIABLE_CLUSTER_RUN_ID; static final String INTERNAL_VARIABLE_STEP_UNIQUE_COUNT; static final String INTERNAL_VARIABLE_STEP_NAME; static final String INTERNAL_VARIABLE_STEP_COPYNR; static final int MAX_NR_LOG_LINES; static final int MAX_NR_HISTORY_LINES; static final int HISTORY_LINES_FETCH_SIZE; static final int MAX_LOG_LINE_TIMEOUT_MINUTES; static final int WARNING; static final int ERROR; static final int INFO; static final int NOTE_MARGIN; static final int MAX_UNDO; static final String KETTLE_VARIABLES_FILE; static final String KETTLE_LOG_SIZE_LIMIT; static final String KETTLE_TRANS_LOG_DB; static final String KETTLE_TRANS_LOG_SCHEMA; static final String KETTLE_TRANS_LOG_TABLE; static final String KETTLE_JOB_LOG_DB; static final String KETTLE_JOB_LOG_SCHEMA; static final String KETTLE_SLAVE_DETECTION_TIMER; static final String KETTLE_JOB_LOG_TABLE; static final String KETTLE_TRANS_PERFORMANCE_LOG_DB; static final String KETTLE_TRANS_PERFORMANCE_LOG_SCHEMA; static final String KETTLE_TRANS_PERFORMANCE_LOG_TABLE; static final String KETTLE_JOBENTRY_LOG_DB; static final String KETTLE_JOBENTRY_LOG_SCHEMA; static final String KETTLE_JOBENTRY_LOG_TABLE; static final String KETTLE_STEP_LOG_DB; static final String KETTLE_STEP_LOG_SCHEMA; static final String KETTLE_STEP_LOG_TABLE; static final String KETTLE_CHANNEL_LOG_DB; static final String KETTLE_CHANNEL_LOG_SCHEMA; static final String KETTLE_CHANNEL_LOG_TABLE; static final String KETTLE_METRICS_LOG_DB; static final String KETTLE_METRICS_LOG_SCHEMA; static final String KETTLE_METRICS_LOG_TABLE; static final String KETTLE_CHECKPOINT_LOG_DB; static final String KETTLE_CHECKPOINT_LOG_SCHEMA; static final String KETTLE_CHECKPOINT_LOG_TABLE; static final String KETTLE_SHARED_OBJECTS; static final String KETTLE_EMPTY_STRING_DIFFERS_FROM_NULL; static final String KETTLE_LENIENT_STRING_TO_NUMBER_CONVERSION; static final String KETTLE_COMPATIBILITY_DB_IGNORE_TIMEZONE; static final String KETTLE_COMPATIBILITY_IMPORT_PATH_ADDITION_ON_VARIABLES; static final String KETTLE_COMPATIBILITY_IGNORE_TABLE_LOGGING; static final String KETTLE_COMPATIBILITY_TEXT_FILE_OUTPUT_APPEND_NO_HEADER; static final String KETTLE_COMPATIBILITY_MERGE_ROWS_USE_REFERENCE_STREAM_WHEN_IDENTICAL; static final String KETTLE_COMPATIBILITY_MEMORY_GROUP_BY_SUM_AVERAGE_RETURN_NUMBER_TYPE; static final String KETTLE_SYSTEM_HOSTNAME; static final String KETTLE_MAX_LOG_SIZE_IN_LINES; static final String KETTLE_MAX_LOG_TIMEOUT_IN_MINUTES; static final String KETTLE_REDIRECT_STDERR; static final String KETTLE_REDIRECT_STDOUT; static final String KETTLE_CARTE_OBJECT_TIMEOUT_MINUTES; static final String KETTLE_STEP_PERFORMANCE_SNAPSHOT_LIMIT; static final String KETTLE_MAX_JOB_TRACKER_SIZE; static final String KETTLE_MAX_JOB_ENTRIES_LOGGED; static final String KETTLE_MAX_LOGGING_REGISTRY_SIZE; static final String KETTLE_LOG_TAB_REFRESH_DELAY; static final String KETTLE_LOG_TAB_REFRESH_PERIOD; static final String KETTLE_SAP_CONNECTION_FACTORY; static final String KETTLE_SAP_CONNECTION_FACTORY_DEFAULT_NAME; static final String KETTLE_PLUGIN_CLASSES; static final String KETTLE_PLUGIN_PACKAGES; static final String KETTLE_TRANS_ROWSET_SIZE; static final String VERSION_COMMENT_INITIAL_VERSION; static final String VERSION_COMMENT_EDIT_VERSION; static final String XML_FILE_KETTLE_STEPS; static final String KETTLE_CORE_STEPS_FILE; static final String XML_FILE_KETTLE_PARTITION_PLUGINS; static final String KETTLE_CORE_JOBENTRIES_FILE; static final String XML_FILE_KETTLE_SERVLETS; static final String XML_FILE_KETTLE_VALUEMETA_PLUGINS; static final String XML_FILE_KETTLE_PASSWORD_ENCODER_PLUGINS; static final String KETTLE_VALUEMETA_PLUGINS_FILE; static final String KETTLE_PASSWORD_ENCODER_PLUGIN; static final String KETTLE_PASSWORD_ENCODER_PLUGINS_FILE; static final String KETTLE_TWO_WAY_PASSWORD_ENCODER_SEED; static final String XML_FILE_KETTLE_LOGGING_PLUGINS; static final String KETTLE_LOGGING_PLUGINS_FILE; static final String KETTLE_CORE_SERVLETS_FILE; static final String KETTLE_ROWSET_GET_TIMEOUT; static final String KETTLE_ROWSET_PUT_TIMEOUT; static final String KETTLE_BATCHING_ROWSET; static final String KETTLE_DISABLE_CONSOLE_LOGGING; static final String XML_FILE_KETTLE_JOB_ENTRIES; static final String XML_FILE_KETTLE_REPOSITORIES; static final String XML_FILE_KETTLE_DATABASE_TYPES; static final String XML_FILE_KETTLE_COMPRESSION_PROVIDERS; static final String XML_FILE_KETTLE_AUTHENTICATION_PROVIDERS; static final String XML_FILE_KETTLE_EXTENSION_POINTS; static final String XML_FILE_KETTLE_REGISTRY_EXTENSIONS; static final String XML_FILE_KETTLE_LIFECYCLE_LISTENERS; static final String XML_FILE_KETTLE_ENGINES; static final String KETTLE_TRANS_PAN_JVM_EXIT_CODE; static final String KETTLE_DEFAULT_NUMBER_FORMAT; static final String KETTLE_DEFAULT_BIGNUMBER_FORMAT; static final String KETTLE_DEFAULT_INTEGER_FORMAT; static final String KETTLE_DEFAULT_DATE_FORMAT; static final String KETTLE_AGGREGATION_MIN_NULL_IS_VALUED; static final String KETTLE_AGGREGATION_ALL_NULLS_ARE_ZERO; static final String KETTLE_DEFAULT_TIMESTAMP_FORMAT; static final String KETTLE_SPLIT_FIELDS_REMOVE_ENCLOSURE; static final String KETTLE_GLOBAL_LOG_VARIABLES_CLEAR_ON_EXPORT; static final String KETTLE_COMPATIBILITY_CALCULATION_TIMEZONE_DECOMPOSITION; static final String KETTLE_COMPATIBILITY_SET_ERROR_ON_SPECIFIC_JOB_ENTRIES; static final String KETTLE_COMPATIBILITY_SEND_RESULT_XML_WITH_FULL_STATUS; static final String KETTLE_COMPATIBILITY_SELECT_VALUES_TYPE_CHANGE_USES_TYPE_DEFAULTS; static final String XML_FILE_KETTLE_IMPORT_RULES; static final ReleaseType RELEASE; static final String PENTAHO_METASTORE_FOLDER; static final String PENTAHO_METASTORE_NAME; static final String KETTLE_LOG_MARK_MAPPINGS; static final String KETTLE_CARTE_JETTY_ACCEPTORS; static final String KETTLE_CARTE_JETTY_ACCEPT_QUEUE_SIZE; static final String KETTLE_CARTE_JETTY_RES_MAX_IDLE_TIME; static final String VFS_USER_DIR_IS_ROOT; }
@Test public void testSplitStringWithDelimiterAndEnclosureNullRemoveEnclosure() { String mask = "Hello%s world"; String[] chunks = {"Hello", " world"}; String stringToSplit = String.format( mask, DELIMITER1 ); String[] result = Const.splitString( stringToSplit, DELIMITER1, null, true ); assertSplit( result, chunks ); }
public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); @Deprecated static final String VERSION; static final String COPYRIGHT_YEAR; static final int TIMEOUT_GET_MILLIS; static final int TIMEOUT_PUT_MILLIS; static final int ROWS_UPDATE; static final int ROWS_IN_ROWSET; static final int FETCH_SIZE; static final int SORT_SIZE; static final int HEARTBEAT_PERIODIC_INTERVAL_IN_SECS; static final String FILE_SEPARATOR; static final String PATH_SEPARATOR; static final String CR; static final String DOSCR; static final String EMPTY_STRING; static final String JAVA_VERSION; @Deprecated static final String USER_HOME_DIRECTORY; static String JNDI_DIRECTORY; static final String PLUGIN_BASE_FOLDERS_PROP; static final String DEFAULT_PLUGIN_BASE_FOLDERS; static final Date MIN_DATE; static final Date MAX_DATE; static final int MIN_YEAR; static final int MAX_YEAR; static final int RIGHT; static final int LENGTH; static final int MARGIN; static final int MIDDLE_PCT; static final int ARROW_WIDTH; static final int FORM_MARGIN; static final int SHADOW_SIZE; static final int SYMBOLSIZE; static final int MAX_FILE_HIST; static final Locale DEFAULT_LOCALE; static final char DEFAULT_DECIMAL_SEPARATOR; static final char DEFAULT_GROUPING_SEPARATOR; static final String DEFAULT_CURRENCY_SYMBOL; static final String DEFAULT_NUMBER_FORMAT; static final String NULL_STRING; static final String NULL_NUMBER; static final String NULL_DATE; static final String NULL_BIGNUMBER; static final String NULL_BOOLEAN; static final String NULL_INTEGER; static final String NULL_BINARY; static final String NULL_NONE; static final int ROUND_HALF_CEILING; static final String CHEF_LOG_FILE; static final String SPOON_LOG_FILE; static final String MENU_LOG_FILE; static final String GENERALIZED_DATE_TIME_FORMAT; static final String GENERALIZED_DATE_TIME_FORMAT_MILLIS; static final String XML_ENCODING; static final String[] STRING_TRANS_AND_JOB_FILTER_EXT; static final String STRING_TRANS_DEFAULT_EXT; static final String[] STRING_TRANS_FILTER_EXT; static final String STRING_JOB_DEFAULT_EXT; static final String[] STRING_JOB_FILTER_EXT; static final String KETTLE_PROPERTIES; static final String SHARED_DATA_FILE; static final String INTERNAL_VARIABLE_PREFIX; static final String INTERNAL_VARIABLE_KETTLE_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_DATE; static final String INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_FILENAME_NAME; static final String INTERNAL_VARIABLE_JOB_NAME; static final String INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_RUN_ID; static final String INTERNAL_VARIABLE_JOB_RUN_ATTEMPTNR; static final String VARIABLE_HEARTBEAT_PERIODIC_INTERVAL_SECS; static final String VARIABLE_MONITORING_SNMP_TRAPS_ENABLED; static final String INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY; static final String[] INTERNAL_TRANS_VARIABLES; static final String[] INTERNAL_JOB_VARIABLES; static final String[] DEPRECATED_VARIABLES; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_STEP_PARTITION_ID; static final String INTERNAL_VARIABLE_STEP_PARTITION_NR; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NUMBER; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NAME; static final String INTERNAL_VARIABLE_CLUSTER_SIZE; static final String INTERNAL_VARIABLE_STEP_UNIQUE_NUMBER; static final String INTERNAL_VARIABLE_CLUSTER_MASTER; static final String INTERNAL_VARIABLE_CLUSTER_RUN_ID; static final String INTERNAL_VARIABLE_STEP_UNIQUE_COUNT; static final String INTERNAL_VARIABLE_STEP_NAME; static final String INTERNAL_VARIABLE_STEP_COPYNR; static final int MAX_NR_LOG_LINES; static final int MAX_NR_HISTORY_LINES; static final int HISTORY_LINES_FETCH_SIZE; static final int MAX_LOG_LINE_TIMEOUT_MINUTES; static final int WARNING; static final int ERROR; static final int INFO; static final int NOTE_MARGIN; static final int MAX_UNDO; static final String KETTLE_VARIABLES_FILE; static final String KETTLE_LOG_SIZE_LIMIT; static final String KETTLE_TRANS_LOG_DB; static final String KETTLE_TRANS_LOG_SCHEMA; static final String KETTLE_TRANS_LOG_TABLE; static final String KETTLE_JOB_LOG_DB; static final String KETTLE_JOB_LOG_SCHEMA; static final String KETTLE_SLAVE_DETECTION_TIMER; static final String KETTLE_JOB_LOG_TABLE; static final String KETTLE_TRANS_PERFORMANCE_LOG_DB; static final String KETTLE_TRANS_PERFORMANCE_LOG_SCHEMA; static final String KETTLE_TRANS_PERFORMANCE_LOG_TABLE; static final String KETTLE_JOBENTRY_LOG_DB; static final String KETTLE_JOBENTRY_LOG_SCHEMA; static final String KETTLE_JOBENTRY_LOG_TABLE; static final String KETTLE_STEP_LOG_DB; static final String KETTLE_STEP_LOG_SCHEMA; static final String KETTLE_STEP_LOG_TABLE; static final String KETTLE_CHANNEL_LOG_DB; static final String KETTLE_CHANNEL_LOG_SCHEMA; static final String KETTLE_CHANNEL_LOG_TABLE; static final String KETTLE_METRICS_LOG_DB; static final String KETTLE_METRICS_LOG_SCHEMA; static final String KETTLE_METRICS_LOG_TABLE; static final String KETTLE_CHECKPOINT_LOG_DB; static final String KETTLE_CHECKPOINT_LOG_SCHEMA; static final String KETTLE_CHECKPOINT_LOG_TABLE; static final String KETTLE_SHARED_OBJECTS; static final String KETTLE_EMPTY_STRING_DIFFERS_FROM_NULL; static final String KETTLE_LENIENT_STRING_TO_NUMBER_CONVERSION; static final String KETTLE_COMPATIBILITY_DB_IGNORE_TIMEZONE; static final String KETTLE_COMPATIBILITY_IMPORT_PATH_ADDITION_ON_VARIABLES; static final String KETTLE_COMPATIBILITY_IGNORE_TABLE_LOGGING; static final String KETTLE_COMPATIBILITY_TEXT_FILE_OUTPUT_APPEND_NO_HEADER; static final String KETTLE_COMPATIBILITY_MERGE_ROWS_USE_REFERENCE_STREAM_WHEN_IDENTICAL; static final String KETTLE_COMPATIBILITY_MEMORY_GROUP_BY_SUM_AVERAGE_RETURN_NUMBER_TYPE; static final String KETTLE_SYSTEM_HOSTNAME; static final String KETTLE_MAX_LOG_SIZE_IN_LINES; static final String KETTLE_MAX_LOG_TIMEOUT_IN_MINUTES; static final String KETTLE_REDIRECT_STDERR; static final String KETTLE_REDIRECT_STDOUT; static final String KETTLE_CARTE_OBJECT_TIMEOUT_MINUTES; static final String KETTLE_STEP_PERFORMANCE_SNAPSHOT_LIMIT; static final String KETTLE_MAX_JOB_TRACKER_SIZE; static final String KETTLE_MAX_JOB_ENTRIES_LOGGED; static final String KETTLE_MAX_LOGGING_REGISTRY_SIZE; static final String KETTLE_LOG_TAB_REFRESH_DELAY; static final String KETTLE_LOG_TAB_REFRESH_PERIOD; static final String KETTLE_SAP_CONNECTION_FACTORY; static final String KETTLE_SAP_CONNECTION_FACTORY_DEFAULT_NAME; static final String KETTLE_PLUGIN_CLASSES; static final String KETTLE_PLUGIN_PACKAGES; static final String KETTLE_TRANS_ROWSET_SIZE; static final String VERSION_COMMENT_INITIAL_VERSION; static final String VERSION_COMMENT_EDIT_VERSION; static final String XML_FILE_KETTLE_STEPS; static final String KETTLE_CORE_STEPS_FILE; static final String XML_FILE_KETTLE_PARTITION_PLUGINS; static final String KETTLE_CORE_JOBENTRIES_FILE; static final String XML_FILE_KETTLE_SERVLETS; static final String XML_FILE_KETTLE_VALUEMETA_PLUGINS; static final String XML_FILE_KETTLE_PASSWORD_ENCODER_PLUGINS; static final String KETTLE_VALUEMETA_PLUGINS_FILE; static final String KETTLE_PASSWORD_ENCODER_PLUGIN; static final String KETTLE_PASSWORD_ENCODER_PLUGINS_FILE; static final String KETTLE_TWO_WAY_PASSWORD_ENCODER_SEED; static final String XML_FILE_KETTLE_LOGGING_PLUGINS; static final String KETTLE_LOGGING_PLUGINS_FILE; static final String KETTLE_CORE_SERVLETS_FILE; static final String KETTLE_ROWSET_GET_TIMEOUT; static final String KETTLE_ROWSET_PUT_TIMEOUT; static final String KETTLE_BATCHING_ROWSET; static final String KETTLE_DISABLE_CONSOLE_LOGGING; static final String XML_FILE_KETTLE_JOB_ENTRIES; static final String XML_FILE_KETTLE_REPOSITORIES; static final String XML_FILE_KETTLE_DATABASE_TYPES; static final String XML_FILE_KETTLE_COMPRESSION_PROVIDERS; static final String XML_FILE_KETTLE_AUTHENTICATION_PROVIDERS; static final String XML_FILE_KETTLE_EXTENSION_POINTS; static final String XML_FILE_KETTLE_REGISTRY_EXTENSIONS; static final String XML_FILE_KETTLE_LIFECYCLE_LISTENERS; static final String XML_FILE_KETTLE_ENGINES; static final String KETTLE_TRANS_PAN_JVM_EXIT_CODE; static final String KETTLE_DEFAULT_NUMBER_FORMAT; static final String KETTLE_DEFAULT_BIGNUMBER_FORMAT; static final String KETTLE_DEFAULT_INTEGER_FORMAT; static final String KETTLE_DEFAULT_DATE_FORMAT; static final String KETTLE_AGGREGATION_MIN_NULL_IS_VALUED; static final String KETTLE_AGGREGATION_ALL_NULLS_ARE_ZERO; static final String KETTLE_DEFAULT_TIMESTAMP_FORMAT; static final String KETTLE_SPLIT_FIELDS_REMOVE_ENCLOSURE; static final String KETTLE_GLOBAL_LOG_VARIABLES_CLEAR_ON_EXPORT; static final String KETTLE_COMPATIBILITY_CALCULATION_TIMEZONE_DECOMPOSITION; static final String KETTLE_COMPATIBILITY_SET_ERROR_ON_SPECIFIC_JOB_ENTRIES; static final String KETTLE_COMPATIBILITY_SEND_RESULT_XML_WITH_FULL_STATUS; static final String KETTLE_COMPATIBILITY_SELECT_VALUES_TYPE_CHANGE_USES_TYPE_DEFAULTS; static final String XML_FILE_KETTLE_IMPORT_RULES; static final ReleaseType RELEASE; static final String PENTAHO_METASTORE_FOLDER; static final String PENTAHO_METASTORE_NAME; static final String KETTLE_LOG_MARK_MAPPINGS; static final String KETTLE_CARTE_JETTY_ACCEPTORS; static final String KETTLE_CARTE_JETTY_ACCEPT_QUEUE_SIZE; static final String KETTLE_CARTE_JETTY_RES_MAX_IDLE_TIME; static final String VFS_USER_DIR_IS_ROOT; }
@Test public void transIdFromRepo() throws Exception { TransMeta meta = new TransMeta(); meta.setName( "transName" ); Transformation trans = TransMetaConverter.convert( meta ); assertThat( trans.getId(), is( "/transName" ) ); }
public static Transformation convert( TransMeta transMeta ) { final org.pentaho.di.engine.model.Transformation transformation = new org.pentaho.di.engine.model.Transformation( createTransformationId( transMeta ) ); try { TransMeta copyTransMeta = (TransMeta) transMeta.realClone( false ); cleanupDisabledHops( copyTransMeta ); disableLazyConversion( copyTransMeta ); searchAndReplaceHadoopClusterWithFileSystemURL( copyTransMeta ); copyTransMeta.getSteps().forEach( createOperation( transformation ) ); findHops( copyTransMeta, hop -> true ).forEach( createHop( transformation ) ); transformation.setConfig( TRANS_META_CONF_KEY, copyTransMeta.getXML() ); transformation.setConfig( TRANS_META_NAME_CONF_KEY, Optional.ofNullable( transMeta.getName() ).orElse( TRANS_DEFAULT_NAME ) ); Map<String, Transformation> subTransformations = copyTransMeta.getResourceDependencies().stream() .flatMap( resourceReference -> resourceReference.getEntries().stream() ) .filter( entry -> ResourceEntry.ResourceType.ACTIONFILE.equals( entry.getResourcetype() ) ) .collect( toMap( ResourceEntry::getResource, entry -> { try { return convert( new TransMeta( entry.getResource(), copyTransMeta.getParentVariableSpace() ) ); } catch ( KettleXMLException | KettleMissingPluginsException e ) { throw new RuntimeException( e ); } } ) ); transformation.setConfig( SUB_TRANSFORMATIONS_KEY, (Serializable) subTransformations ); } catch ( KettleException e ) { Throwables.propagate( e ); } return transformation; }
TransMetaConverter { public static Transformation convert( TransMeta transMeta ) { final org.pentaho.di.engine.model.Transformation transformation = new org.pentaho.di.engine.model.Transformation( createTransformationId( transMeta ) ); try { TransMeta copyTransMeta = (TransMeta) transMeta.realClone( false ); cleanupDisabledHops( copyTransMeta ); disableLazyConversion( copyTransMeta ); searchAndReplaceHadoopClusterWithFileSystemURL( copyTransMeta ); copyTransMeta.getSteps().forEach( createOperation( transformation ) ); findHops( copyTransMeta, hop -> true ).forEach( createHop( transformation ) ); transformation.setConfig( TRANS_META_CONF_KEY, copyTransMeta.getXML() ); transformation.setConfig( TRANS_META_NAME_CONF_KEY, Optional.ofNullable( transMeta.getName() ).orElse( TRANS_DEFAULT_NAME ) ); Map<String, Transformation> subTransformations = copyTransMeta.getResourceDependencies().stream() .flatMap( resourceReference -> resourceReference.getEntries().stream() ) .filter( entry -> ResourceEntry.ResourceType.ACTIONFILE.equals( entry.getResourcetype() ) ) .collect( toMap( ResourceEntry::getResource, entry -> { try { return convert( new TransMeta( entry.getResource(), copyTransMeta.getParentVariableSpace() ) ); } catch ( KettleXMLException | KettleMissingPluginsException e ) { throw new RuntimeException( e ); } } ) ); transformation.setConfig( SUB_TRANSFORMATIONS_KEY, (Serializable) subTransformations ); } catch ( KettleException e ) { Throwables.propagate( e ); } return transformation; } }
TransMetaConverter { public static Transformation convert( TransMeta transMeta ) { final org.pentaho.di.engine.model.Transformation transformation = new org.pentaho.di.engine.model.Transformation( createTransformationId( transMeta ) ); try { TransMeta copyTransMeta = (TransMeta) transMeta.realClone( false ); cleanupDisabledHops( copyTransMeta ); disableLazyConversion( copyTransMeta ); searchAndReplaceHadoopClusterWithFileSystemURL( copyTransMeta ); copyTransMeta.getSteps().forEach( createOperation( transformation ) ); findHops( copyTransMeta, hop -> true ).forEach( createHop( transformation ) ); transformation.setConfig( TRANS_META_CONF_KEY, copyTransMeta.getXML() ); transformation.setConfig( TRANS_META_NAME_CONF_KEY, Optional.ofNullable( transMeta.getName() ).orElse( TRANS_DEFAULT_NAME ) ); Map<String, Transformation> subTransformations = copyTransMeta.getResourceDependencies().stream() .flatMap( resourceReference -> resourceReference.getEntries().stream() ) .filter( entry -> ResourceEntry.ResourceType.ACTIONFILE.equals( entry.getResourcetype() ) ) .collect( toMap( ResourceEntry::getResource, entry -> { try { return convert( new TransMeta( entry.getResource(), copyTransMeta.getParentVariableSpace() ) ); } catch ( KettleXMLException | KettleMissingPluginsException e ) { throw new RuntimeException( e ); } } ) ); transformation.setConfig( SUB_TRANSFORMATIONS_KEY, (Serializable) subTransformations ); } catch ( KettleException e ) { Throwables.propagate( e ); } return transformation; } }
TransMetaConverter { public static Transformation convert( TransMeta transMeta ) { final org.pentaho.di.engine.model.Transformation transformation = new org.pentaho.di.engine.model.Transformation( createTransformationId( transMeta ) ); try { TransMeta copyTransMeta = (TransMeta) transMeta.realClone( false ); cleanupDisabledHops( copyTransMeta ); disableLazyConversion( copyTransMeta ); searchAndReplaceHadoopClusterWithFileSystemURL( copyTransMeta ); copyTransMeta.getSteps().forEach( createOperation( transformation ) ); findHops( copyTransMeta, hop -> true ).forEach( createHop( transformation ) ); transformation.setConfig( TRANS_META_CONF_KEY, copyTransMeta.getXML() ); transformation.setConfig( TRANS_META_NAME_CONF_KEY, Optional.ofNullable( transMeta.getName() ).orElse( TRANS_DEFAULT_NAME ) ); Map<String, Transformation> subTransformations = copyTransMeta.getResourceDependencies().stream() .flatMap( resourceReference -> resourceReference.getEntries().stream() ) .filter( entry -> ResourceEntry.ResourceType.ACTIONFILE.equals( entry.getResourcetype() ) ) .collect( toMap( ResourceEntry::getResource, entry -> { try { return convert( new TransMeta( entry.getResource(), copyTransMeta.getParentVariableSpace() ) ); } catch ( KettleXMLException | KettleMissingPluginsException e ) { throw new RuntimeException( e ); } } ) ); transformation.setConfig( SUB_TRANSFORMATIONS_KEY, (Serializable) subTransformations ); } catch ( KettleException e ) { Throwables.propagate( e ); } return transformation; } static Transformation convert( TransMeta transMeta ); }
TransMetaConverter { public static Transformation convert( TransMeta transMeta ) { final org.pentaho.di.engine.model.Transformation transformation = new org.pentaho.di.engine.model.Transformation( createTransformationId( transMeta ) ); try { TransMeta copyTransMeta = (TransMeta) transMeta.realClone( false ); cleanupDisabledHops( copyTransMeta ); disableLazyConversion( copyTransMeta ); searchAndReplaceHadoopClusterWithFileSystemURL( copyTransMeta ); copyTransMeta.getSteps().forEach( createOperation( transformation ) ); findHops( copyTransMeta, hop -> true ).forEach( createHop( transformation ) ); transformation.setConfig( TRANS_META_CONF_KEY, copyTransMeta.getXML() ); transformation.setConfig( TRANS_META_NAME_CONF_KEY, Optional.ofNullable( transMeta.getName() ).orElse( TRANS_DEFAULT_NAME ) ); Map<String, Transformation> subTransformations = copyTransMeta.getResourceDependencies().stream() .flatMap( resourceReference -> resourceReference.getEntries().stream() ) .filter( entry -> ResourceEntry.ResourceType.ACTIONFILE.equals( entry.getResourcetype() ) ) .collect( toMap( ResourceEntry::getResource, entry -> { try { return convert( new TransMeta( entry.getResource(), copyTransMeta.getParentVariableSpace() ) ); } catch ( KettleXMLException | KettleMissingPluginsException e ) { throw new RuntimeException( e ); } } ) ); transformation.setConfig( SUB_TRANSFORMATIONS_KEY, (Serializable) subTransformations ); } catch ( KettleException e ) { Throwables.propagate( e ); } return transformation; } static Transformation convert( TransMeta transMeta ); static final String TRANS_META_CONF_KEY; static final String TRANS_META_NAME_CONF_KEY; static final String SUB_TRANSFORMATIONS_KEY; static final String STEP_META_CONF_KEY; static final String TRANS_DEFAULT_NAME; }
@Test public void testClearOptionsData() throws Exception { }
public void clearOptionsData() { getControls(); if ( optionsParameterTree != null ) { optionsParameterTree.getRootChildren().removeAll(); } }
DataHandler extends AbstractXulEventHandler { public void clearOptionsData() { getControls(); if ( optionsParameterTree != null ) { optionsParameterTree.getRootChildren().removeAll(); } } }
DataHandler extends AbstractXulEventHandler { public void clearOptionsData() { getControls(); if ( optionsParameterTree != null ) { optionsParameterTree.getRootChildren().removeAll(); } } DataHandler(); }
DataHandler extends AbstractXulEventHandler { public void clearOptionsData() { getControls(); if ( optionsParameterTree != null ) { optionsParameterTree.getRootChildren().removeAll(); } } DataHandler(); void loadConnectionData(); void loadAccessData(); void editOptions( int index ); void clearOptionsData(); void getOptionHelp(); void setDeckChildIndex(); void onPoolingCheck(); void onClusterCheck(); Object getData(); void setData( Object data ); void pushCache(); void popCache(); void onCancel(); void onOK(); void testDatabaseConnection(); void restoreDefaults(); void poolingRowChange( int idx ); void disablePortIfInstancePopulated(); void handleUseSecurityCheckbox(); }
DataHandler extends AbstractXulEventHandler { public void clearOptionsData() { getControls(); if ( optionsParameterTree != null ) { optionsParameterTree.getRootChildren().removeAll(); } } DataHandler(); void loadConnectionData(); void loadAccessData(); void editOptions( int index ); void clearOptionsData(); void getOptionHelp(); void setDeckChildIndex(); void onPoolingCheck(); void onClusterCheck(); Object getData(); void setData( Object data ); void pushCache(); void popCache(); void onCancel(); void onOK(); void testDatabaseConnection(); void restoreDefaults(); void poolingRowChange( int idx ); void disablePortIfInstancePopulated(); void handleUseSecurityCheckbox(); static final SortedMap<String, DatabaseInterface> connectionMap; static final Map<String, String> connectionNametoID; }
@Test public void testSplitStringWithDelimiterAndEnclosureNullMultiCharRemoveEnclosure() { String mask = "Hello%s world"; String[] chunks = {"Hello", " world"}; String stringToSplit = String.format( mask, DELIMITER2 ); String[] result = Const.splitString( stringToSplit, DELIMITER2, null, true ); assertSplit( result, chunks ); }
public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); @Deprecated static final String VERSION; static final String COPYRIGHT_YEAR; static final int TIMEOUT_GET_MILLIS; static final int TIMEOUT_PUT_MILLIS; static final int ROWS_UPDATE; static final int ROWS_IN_ROWSET; static final int FETCH_SIZE; static final int SORT_SIZE; static final int HEARTBEAT_PERIODIC_INTERVAL_IN_SECS; static final String FILE_SEPARATOR; static final String PATH_SEPARATOR; static final String CR; static final String DOSCR; static final String EMPTY_STRING; static final String JAVA_VERSION; @Deprecated static final String USER_HOME_DIRECTORY; static String JNDI_DIRECTORY; static final String PLUGIN_BASE_FOLDERS_PROP; static final String DEFAULT_PLUGIN_BASE_FOLDERS; static final Date MIN_DATE; static final Date MAX_DATE; static final int MIN_YEAR; static final int MAX_YEAR; static final int RIGHT; static final int LENGTH; static final int MARGIN; static final int MIDDLE_PCT; static final int ARROW_WIDTH; static final int FORM_MARGIN; static final int SHADOW_SIZE; static final int SYMBOLSIZE; static final int MAX_FILE_HIST; static final Locale DEFAULT_LOCALE; static final char DEFAULT_DECIMAL_SEPARATOR; static final char DEFAULT_GROUPING_SEPARATOR; static final String DEFAULT_CURRENCY_SYMBOL; static final String DEFAULT_NUMBER_FORMAT; static final String NULL_STRING; static final String NULL_NUMBER; static final String NULL_DATE; static final String NULL_BIGNUMBER; static final String NULL_BOOLEAN; static final String NULL_INTEGER; static final String NULL_BINARY; static final String NULL_NONE; static final int ROUND_HALF_CEILING; static final String CHEF_LOG_FILE; static final String SPOON_LOG_FILE; static final String MENU_LOG_FILE; static final String GENERALIZED_DATE_TIME_FORMAT; static final String GENERALIZED_DATE_TIME_FORMAT_MILLIS; static final String XML_ENCODING; static final String[] STRING_TRANS_AND_JOB_FILTER_EXT; static final String STRING_TRANS_DEFAULT_EXT; static final String[] STRING_TRANS_FILTER_EXT; static final String STRING_JOB_DEFAULT_EXT; static final String[] STRING_JOB_FILTER_EXT; static final String KETTLE_PROPERTIES; static final String SHARED_DATA_FILE; static final String INTERNAL_VARIABLE_PREFIX; static final String INTERNAL_VARIABLE_KETTLE_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_DATE; static final String INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_FILENAME_NAME; static final String INTERNAL_VARIABLE_JOB_NAME; static final String INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_RUN_ID; static final String INTERNAL_VARIABLE_JOB_RUN_ATTEMPTNR; static final String VARIABLE_HEARTBEAT_PERIODIC_INTERVAL_SECS; static final String VARIABLE_MONITORING_SNMP_TRAPS_ENABLED; static final String INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY; static final String[] INTERNAL_TRANS_VARIABLES; static final String[] INTERNAL_JOB_VARIABLES; static final String[] DEPRECATED_VARIABLES; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_STEP_PARTITION_ID; static final String INTERNAL_VARIABLE_STEP_PARTITION_NR; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NUMBER; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NAME; static final String INTERNAL_VARIABLE_CLUSTER_SIZE; static final String INTERNAL_VARIABLE_STEP_UNIQUE_NUMBER; static final String INTERNAL_VARIABLE_CLUSTER_MASTER; static final String INTERNAL_VARIABLE_CLUSTER_RUN_ID; static final String INTERNAL_VARIABLE_STEP_UNIQUE_COUNT; static final String INTERNAL_VARIABLE_STEP_NAME; static final String INTERNAL_VARIABLE_STEP_COPYNR; static final int MAX_NR_LOG_LINES; static final int MAX_NR_HISTORY_LINES; static final int HISTORY_LINES_FETCH_SIZE; static final int MAX_LOG_LINE_TIMEOUT_MINUTES; static final int WARNING; static final int ERROR; static final int INFO; static final int NOTE_MARGIN; static final int MAX_UNDO; static final String KETTLE_VARIABLES_FILE; static final String KETTLE_LOG_SIZE_LIMIT; static final String KETTLE_TRANS_LOG_DB; static final String KETTLE_TRANS_LOG_SCHEMA; static final String KETTLE_TRANS_LOG_TABLE; static final String KETTLE_JOB_LOG_DB; static final String KETTLE_JOB_LOG_SCHEMA; static final String KETTLE_SLAVE_DETECTION_TIMER; static final String KETTLE_JOB_LOG_TABLE; static final String KETTLE_TRANS_PERFORMANCE_LOG_DB; static final String KETTLE_TRANS_PERFORMANCE_LOG_SCHEMA; static final String KETTLE_TRANS_PERFORMANCE_LOG_TABLE; static final String KETTLE_JOBENTRY_LOG_DB; static final String KETTLE_JOBENTRY_LOG_SCHEMA; static final String KETTLE_JOBENTRY_LOG_TABLE; static final String KETTLE_STEP_LOG_DB; static final String KETTLE_STEP_LOG_SCHEMA; static final String KETTLE_STEP_LOG_TABLE; static final String KETTLE_CHANNEL_LOG_DB; static final String KETTLE_CHANNEL_LOG_SCHEMA; static final String KETTLE_CHANNEL_LOG_TABLE; static final String KETTLE_METRICS_LOG_DB; static final String KETTLE_METRICS_LOG_SCHEMA; static final String KETTLE_METRICS_LOG_TABLE; static final String KETTLE_CHECKPOINT_LOG_DB; static final String KETTLE_CHECKPOINT_LOG_SCHEMA; static final String KETTLE_CHECKPOINT_LOG_TABLE; static final String KETTLE_SHARED_OBJECTS; static final String KETTLE_EMPTY_STRING_DIFFERS_FROM_NULL; static final String KETTLE_LENIENT_STRING_TO_NUMBER_CONVERSION; static final String KETTLE_COMPATIBILITY_DB_IGNORE_TIMEZONE; static final String KETTLE_COMPATIBILITY_IMPORT_PATH_ADDITION_ON_VARIABLES; static final String KETTLE_COMPATIBILITY_IGNORE_TABLE_LOGGING; static final String KETTLE_COMPATIBILITY_TEXT_FILE_OUTPUT_APPEND_NO_HEADER; static final String KETTLE_COMPATIBILITY_MERGE_ROWS_USE_REFERENCE_STREAM_WHEN_IDENTICAL; static final String KETTLE_COMPATIBILITY_MEMORY_GROUP_BY_SUM_AVERAGE_RETURN_NUMBER_TYPE; static final String KETTLE_SYSTEM_HOSTNAME; static final String KETTLE_MAX_LOG_SIZE_IN_LINES; static final String KETTLE_MAX_LOG_TIMEOUT_IN_MINUTES; static final String KETTLE_REDIRECT_STDERR; static final String KETTLE_REDIRECT_STDOUT; static final String KETTLE_CARTE_OBJECT_TIMEOUT_MINUTES; static final String KETTLE_STEP_PERFORMANCE_SNAPSHOT_LIMIT; static final String KETTLE_MAX_JOB_TRACKER_SIZE; static final String KETTLE_MAX_JOB_ENTRIES_LOGGED; static final String KETTLE_MAX_LOGGING_REGISTRY_SIZE; static final String KETTLE_LOG_TAB_REFRESH_DELAY; static final String KETTLE_LOG_TAB_REFRESH_PERIOD; static final String KETTLE_SAP_CONNECTION_FACTORY; static final String KETTLE_SAP_CONNECTION_FACTORY_DEFAULT_NAME; static final String KETTLE_PLUGIN_CLASSES; static final String KETTLE_PLUGIN_PACKAGES; static final String KETTLE_TRANS_ROWSET_SIZE; static final String VERSION_COMMENT_INITIAL_VERSION; static final String VERSION_COMMENT_EDIT_VERSION; static final String XML_FILE_KETTLE_STEPS; static final String KETTLE_CORE_STEPS_FILE; static final String XML_FILE_KETTLE_PARTITION_PLUGINS; static final String KETTLE_CORE_JOBENTRIES_FILE; static final String XML_FILE_KETTLE_SERVLETS; static final String XML_FILE_KETTLE_VALUEMETA_PLUGINS; static final String XML_FILE_KETTLE_PASSWORD_ENCODER_PLUGINS; static final String KETTLE_VALUEMETA_PLUGINS_FILE; static final String KETTLE_PASSWORD_ENCODER_PLUGIN; static final String KETTLE_PASSWORD_ENCODER_PLUGINS_FILE; static final String KETTLE_TWO_WAY_PASSWORD_ENCODER_SEED; static final String XML_FILE_KETTLE_LOGGING_PLUGINS; static final String KETTLE_LOGGING_PLUGINS_FILE; static final String KETTLE_CORE_SERVLETS_FILE; static final String KETTLE_ROWSET_GET_TIMEOUT; static final String KETTLE_ROWSET_PUT_TIMEOUT; static final String KETTLE_BATCHING_ROWSET; static final String KETTLE_DISABLE_CONSOLE_LOGGING; static final String XML_FILE_KETTLE_JOB_ENTRIES; static final String XML_FILE_KETTLE_REPOSITORIES; static final String XML_FILE_KETTLE_DATABASE_TYPES; static final String XML_FILE_KETTLE_COMPRESSION_PROVIDERS; static final String XML_FILE_KETTLE_AUTHENTICATION_PROVIDERS; static final String XML_FILE_KETTLE_EXTENSION_POINTS; static final String XML_FILE_KETTLE_REGISTRY_EXTENSIONS; static final String XML_FILE_KETTLE_LIFECYCLE_LISTENERS; static final String XML_FILE_KETTLE_ENGINES; static final String KETTLE_TRANS_PAN_JVM_EXIT_CODE; static final String KETTLE_DEFAULT_NUMBER_FORMAT; static final String KETTLE_DEFAULT_BIGNUMBER_FORMAT; static final String KETTLE_DEFAULT_INTEGER_FORMAT; static final String KETTLE_DEFAULT_DATE_FORMAT; static final String KETTLE_AGGREGATION_MIN_NULL_IS_VALUED; static final String KETTLE_AGGREGATION_ALL_NULLS_ARE_ZERO; static final String KETTLE_DEFAULT_TIMESTAMP_FORMAT; static final String KETTLE_SPLIT_FIELDS_REMOVE_ENCLOSURE; static final String KETTLE_GLOBAL_LOG_VARIABLES_CLEAR_ON_EXPORT; static final String KETTLE_COMPATIBILITY_CALCULATION_TIMEZONE_DECOMPOSITION; static final String KETTLE_COMPATIBILITY_SET_ERROR_ON_SPECIFIC_JOB_ENTRIES; static final String KETTLE_COMPATIBILITY_SEND_RESULT_XML_WITH_FULL_STATUS; static final String KETTLE_COMPATIBILITY_SELECT_VALUES_TYPE_CHANGE_USES_TYPE_DEFAULTS; static final String XML_FILE_KETTLE_IMPORT_RULES; static final ReleaseType RELEASE; static final String PENTAHO_METASTORE_FOLDER; static final String PENTAHO_METASTORE_NAME; static final String KETTLE_LOG_MARK_MAPPINGS; static final String KETTLE_CARTE_JETTY_ACCEPTORS; static final String KETTLE_CARTE_JETTY_ACCEPT_QUEUE_SIZE; static final String KETTLE_CARTE_JETTY_RES_MAX_IDLE_TIME; static final String VFS_USER_DIR_IS_ROOT; }
@Test public void testSplitStringWithDelimiterAndEmptyEnclosure() { String mask = "Hello%s world"; String[] chunks = {"Hello", " world"}; String stringToSplit = String.format( mask, DELIMITER1 ); String[] result = Const.splitString( stringToSplit, DELIMITER1, "" ); assertSplit( result, chunks ); }
public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); @Deprecated static final String VERSION; static final String COPYRIGHT_YEAR; static final int TIMEOUT_GET_MILLIS; static final int TIMEOUT_PUT_MILLIS; static final int ROWS_UPDATE; static final int ROWS_IN_ROWSET; static final int FETCH_SIZE; static final int SORT_SIZE; static final int HEARTBEAT_PERIODIC_INTERVAL_IN_SECS; static final String FILE_SEPARATOR; static final String PATH_SEPARATOR; static final String CR; static final String DOSCR; static final String EMPTY_STRING; static final String JAVA_VERSION; @Deprecated static final String USER_HOME_DIRECTORY; static String JNDI_DIRECTORY; static final String PLUGIN_BASE_FOLDERS_PROP; static final String DEFAULT_PLUGIN_BASE_FOLDERS; static final Date MIN_DATE; static final Date MAX_DATE; static final int MIN_YEAR; static final int MAX_YEAR; static final int RIGHT; static final int LENGTH; static final int MARGIN; static final int MIDDLE_PCT; static final int ARROW_WIDTH; static final int FORM_MARGIN; static final int SHADOW_SIZE; static final int SYMBOLSIZE; static final int MAX_FILE_HIST; static final Locale DEFAULT_LOCALE; static final char DEFAULT_DECIMAL_SEPARATOR; static final char DEFAULT_GROUPING_SEPARATOR; static final String DEFAULT_CURRENCY_SYMBOL; static final String DEFAULT_NUMBER_FORMAT; static final String NULL_STRING; static final String NULL_NUMBER; static final String NULL_DATE; static final String NULL_BIGNUMBER; static final String NULL_BOOLEAN; static final String NULL_INTEGER; static final String NULL_BINARY; static final String NULL_NONE; static final int ROUND_HALF_CEILING; static final String CHEF_LOG_FILE; static final String SPOON_LOG_FILE; static final String MENU_LOG_FILE; static final String GENERALIZED_DATE_TIME_FORMAT; static final String GENERALIZED_DATE_TIME_FORMAT_MILLIS; static final String XML_ENCODING; static final String[] STRING_TRANS_AND_JOB_FILTER_EXT; static final String STRING_TRANS_DEFAULT_EXT; static final String[] STRING_TRANS_FILTER_EXT; static final String STRING_JOB_DEFAULT_EXT; static final String[] STRING_JOB_FILTER_EXT; static final String KETTLE_PROPERTIES; static final String SHARED_DATA_FILE; static final String INTERNAL_VARIABLE_PREFIX; static final String INTERNAL_VARIABLE_KETTLE_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_DATE; static final String INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_FILENAME_NAME; static final String INTERNAL_VARIABLE_JOB_NAME; static final String INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_RUN_ID; static final String INTERNAL_VARIABLE_JOB_RUN_ATTEMPTNR; static final String VARIABLE_HEARTBEAT_PERIODIC_INTERVAL_SECS; static final String VARIABLE_MONITORING_SNMP_TRAPS_ENABLED; static final String INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY; static final String[] INTERNAL_TRANS_VARIABLES; static final String[] INTERNAL_JOB_VARIABLES; static final String[] DEPRECATED_VARIABLES; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_STEP_PARTITION_ID; static final String INTERNAL_VARIABLE_STEP_PARTITION_NR; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NUMBER; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NAME; static final String INTERNAL_VARIABLE_CLUSTER_SIZE; static final String INTERNAL_VARIABLE_STEP_UNIQUE_NUMBER; static final String INTERNAL_VARIABLE_CLUSTER_MASTER; static final String INTERNAL_VARIABLE_CLUSTER_RUN_ID; static final String INTERNAL_VARIABLE_STEP_UNIQUE_COUNT; static final String INTERNAL_VARIABLE_STEP_NAME; static final String INTERNAL_VARIABLE_STEP_COPYNR; static final int MAX_NR_LOG_LINES; static final int MAX_NR_HISTORY_LINES; static final int HISTORY_LINES_FETCH_SIZE; static final int MAX_LOG_LINE_TIMEOUT_MINUTES; static final int WARNING; static final int ERROR; static final int INFO; static final int NOTE_MARGIN; static final int MAX_UNDO; static final String KETTLE_VARIABLES_FILE; static final String KETTLE_LOG_SIZE_LIMIT; static final String KETTLE_TRANS_LOG_DB; static final String KETTLE_TRANS_LOG_SCHEMA; static final String KETTLE_TRANS_LOG_TABLE; static final String KETTLE_JOB_LOG_DB; static final String KETTLE_JOB_LOG_SCHEMA; static final String KETTLE_SLAVE_DETECTION_TIMER; static final String KETTLE_JOB_LOG_TABLE; static final String KETTLE_TRANS_PERFORMANCE_LOG_DB; static final String KETTLE_TRANS_PERFORMANCE_LOG_SCHEMA; static final String KETTLE_TRANS_PERFORMANCE_LOG_TABLE; static final String KETTLE_JOBENTRY_LOG_DB; static final String KETTLE_JOBENTRY_LOG_SCHEMA; static final String KETTLE_JOBENTRY_LOG_TABLE; static final String KETTLE_STEP_LOG_DB; static final String KETTLE_STEP_LOG_SCHEMA; static final String KETTLE_STEP_LOG_TABLE; static final String KETTLE_CHANNEL_LOG_DB; static final String KETTLE_CHANNEL_LOG_SCHEMA; static final String KETTLE_CHANNEL_LOG_TABLE; static final String KETTLE_METRICS_LOG_DB; static final String KETTLE_METRICS_LOG_SCHEMA; static final String KETTLE_METRICS_LOG_TABLE; static final String KETTLE_CHECKPOINT_LOG_DB; static final String KETTLE_CHECKPOINT_LOG_SCHEMA; static final String KETTLE_CHECKPOINT_LOG_TABLE; static final String KETTLE_SHARED_OBJECTS; static final String KETTLE_EMPTY_STRING_DIFFERS_FROM_NULL; static final String KETTLE_LENIENT_STRING_TO_NUMBER_CONVERSION; static final String KETTLE_COMPATIBILITY_DB_IGNORE_TIMEZONE; static final String KETTLE_COMPATIBILITY_IMPORT_PATH_ADDITION_ON_VARIABLES; static final String KETTLE_COMPATIBILITY_IGNORE_TABLE_LOGGING; static final String KETTLE_COMPATIBILITY_TEXT_FILE_OUTPUT_APPEND_NO_HEADER; static final String KETTLE_COMPATIBILITY_MERGE_ROWS_USE_REFERENCE_STREAM_WHEN_IDENTICAL; static final String KETTLE_COMPATIBILITY_MEMORY_GROUP_BY_SUM_AVERAGE_RETURN_NUMBER_TYPE; static final String KETTLE_SYSTEM_HOSTNAME; static final String KETTLE_MAX_LOG_SIZE_IN_LINES; static final String KETTLE_MAX_LOG_TIMEOUT_IN_MINUTES; static final String KETTLE_REDIRECT_STDERR; static final String KETTLE_REDIRECT_STDOUT; static final String KETTLE_CARTE_OBJECT_TIMEOUT_MINUTES; static final String KETTLE_STEP_PERFORMANCE_SNAPSHOT_LIMIT; static final String KETTLE_MAX_JOB_TRACKER_SIZE; static final String KETTLE_MAX_JOB_ENTRIES_LOGGED; static final String KETTLE_MAX_LOGGING_REGISTRY_SIZE; static final String KETTLE_LOG_TAB_REFRESH_DELAY; static final String KETTLE_LOG_TAB_REFRESH_PERIOD; static final String KETTLE_SAP_CONNECTION_FACTORY; static final String KETTLE_SAP_CONNECTION_FACTORY_DEFAULT_NAME; static final String KETTLE_PLUGIN_CLASSES; static final String KETTLE_PLUGIN_PACKAGES; static final String KETTLE_TRANS_ROWSET_SIZE; static final String VERSION_COMMENT_INITIAL_VERSION; static final String VERSION_COMMENT_EDIT_VERSION; static final String XML_FILE_KETTLE_STEPS; static final String KETTLE_CORE_STEPS_FILE; static final String XML_FILE_KETTLE_PARTITION_PLUGINS; static final String KETTLE_CORE_JOBENTRIES_FILE; static final String XML_FILE_KETTLE_SERVLETS; static final String XML_FILE_KETTLE_VALUEMETA_PLUGINS; static final String XML_FILE_KETTLE_PASSWORD_ENCODER_PLUGINS; static final String KETTLE_VALUEMETA_PLUGINS_FILE; static final String KETTLE_PASSWORD_ENCODER_PLUGIN; static final String KETTLE_PASSWORD_ENCODER_PLUGINS_FILE; static final String KETTLE_TWO_WAY_PASSWORD_ENCODER_SEED; static final String XML_FILE_KETTLE_LOGGING_PLUGINS; static final String KETTLE_LOGGING_PLUGINS_FILE; static final String KETTLE_CORE_SERVLETS_FILE; static final String KETTLE_ROWSET_GET_TIMEOUT; static final String KETTLE_ROWSET_PUT_TIMEOUT; static final String KETTLE_BATCHING_ROWSET; static final String KETTLE_DISABLE_CONSOLE_LOGGING; static final String XML_FILE_KETTLE_JOB_ENTRIES; static final String XML_FILE_KETTLE_REPOSITORIES; static final String XML_FILE_KETTLE_DATABASE_TYPES; static final String XML_FILE_KETTLE_COMPRESSION_PROVIDERS; static final String XML_FILE_KETTLE_AUTHENTICATION_PROVIDERS; static final String XML_FILE_KETTLE_EXTENSION_POINTS; static final String XML_FILE_KETTLE_REGISTRY_EXTENSIONS; static final String XML_FILE_KETTLE_LIFECYCLE_LISTENERS; static final String XML_FILE_KETTLE_ENGINES; static final String KETTLE_TRANS_PAN_JVM_EXIT_CODE; static final String KETTLE_DEFAULT_NUMBER_FORMAT; static final String KETTLE_DEFAULT_BIGNUMBER_FORMAT; static final String KETTLE_DEFAULT_INTEGER_FORMAT; static final String KETTLE_DEFAULT_DATE_FORMAT; static final String KETTLE_AGGREGATION_MIN_NULL_IS_VALUED; static final String KETTLE_AGGREGATION_ALL_NULLS_ARE_ZERO; static final String KETTLE_DEFAULT_TIMESTAMP_FORMAT; static final String KETTLE_SPLIT_FIELDS_REMOVE_ENCLOSURE; static final String KETTLE_GLOBAL_LOG_VARIABLES_CLEAR_ON_EXPORT; static final String KETTLE_COMPATIBILITY_CALCULATION_TIMEZONE_DECOMPOSITION; static final String KETTLE_COMPATIBILITY_SET_ERROR_ON_SPECIFIC_JOB_ENTRIES; static final String KETTLE_COMPATIBILITY_SEND_RESULT_XML_WITH_FULL_STATUS; static final String KETTLE_COMPATIBILITY_SELECT_VALUES_TYPE_CHANGE_USES_TYPE_DEFAULTS; static final String XML_FILE_KETTLE_IMPORT_RULES; static final ReleaseType RELEASE; static final String PENTAHO_METASTORE_FOLDER; static final String PENTAHO_METASTORE_NAME; static final String KETTLE_LOG_MARK_MAPPINGS; static final String KETTLE_CARTE_JETTY_ACCEPTORS; static final String KETTLE_CARTE_JETTY_ACCEPT_QUEUE_SIZE; static final String KETTLE_CARTE_JETTY_RES_MAX_IDLE_TIME; static final String VFS_USER_DIR_IS_ROOT; }
@Test public void testSplitStringWithDelimiterAndEmptyEnclosureMultiChar() { String mask = "Hello%s world"; String[] chunks = {"Hello", " world"}; String stringToSplit = String.format( mask, DELIMITER2 ); String[] result = Const.splitString( stringToSplit, DELIMITER2, "" ); assertSplit( result, chunks ); }
public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); @Deprecated static final String VERSION; static final String COPYRIGHT_YEAR; static final int TIMEOUT_GET_MILLIS; static final int TIMEOUT_PUT_MILLIS; static final int ROWS_UPDATE; static final int ROWS_IN_ROWSET; static final int FETCH_SIZE; static final int SORT_SIZE; static final int HEARTBEAT_PERIODIC_INTERVAL_IN_SECS; static final String FILE_SEPARATOR; static final String PATH_SEPARATOR; static final String CR; static final String DOSCR; static final String EMPTY_STRING; static final String JAVA_VERSION; @Deprecated static final String USER_HOME_DIRECTORY; static String JNDI_DIRECTORY; static final String PLUGIN_BASE_FOLDERS_PROP; static final String DEFAULT_PLUGIN_BASE_FOLDERS; static final Date MIN_DATE; static final Date MAX_DATE; static final int MIN_YEAR; static final int MAX_YEAR; static final int RIGHT; static final int LENGTH; static final int MARGIN; static final int MIDDLE_PCT; static final int ARROW_WIDTH; static final int FORM_MARGIN; static final int SHADOW_SIZE; static final int SYMBOLSIZE; static final int MAX_FILE_HIST; static final Locale DEFAULT_LOCALE; static final char DEFAULT_DECIMAL_SEPARATOR; static final char DEFAULT_GROUPING_SEPARATOR; static final String DEFAULT_CURRENCY_SYMBOL; static final String DEFAULT_NUMBER_FORMAT; static final String NULL_STRING; static final String NULL_NUMBER; static final String NULL_DATE; static final String NULL_BIGNUMBER; static final String NULL_BOOLEAN; static final String NULL_INTEGER; static final String NULL_BINARY; static final String NULL_NONE; static final int ROUND_HALF_CEILING; static final String CHEF_LOG_FILE; static final String SPOON_LOG_FILE; static final String MENU_LOG_FILE; static final String GENERALIZED_DATE_TIME_FORMAT; static final String GENERALIZED_DATE_TIME_FORMAT_MILLIS; static final String XML_ENCODING; static final String[] STRING_TRANS_AND_JOB_FILTER_EXT; static final String STRING_TRANS_DEFAULT_EXT; static final String[] STRING_TRANS_FILTER_EXT; static final String STRING_JOB_DEFAULT_EXT; static final String[] STRING_JOB_FILTER_EXT; static final String KETTLE_PROPERTIES; static final String SHARED_DATA_FILE; static final String INTERNAL_VARIABLE_PREFIX; static final String INTERNAL_VARIABLE_KETTLE_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_DATE; static final String INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_FILENAME_NAME; static final String INTERNAL_VARIABLE_JOB_NAME; static final String INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_RUN_ID; static final String INTERNAL_VARIABLE_JOB_RUN_ATTEMPTNR; static final String VARIABLE_HEARTBEAT_PERIODIC_INTERVAL_SECS; static final String VARIABLE_MONITORING_SNMP_TRAPS_ENABLED; static final String INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY; static final String[] INTERNAL_TRANS_VARIABLES; static final String[] INTERNAL_JOB_VARIABLES; static final String[] DEPRECATED_VARIABLES; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_STEP_PARTITION_ID; static final String INTERNAL_VARIABLE_STEP_PARTITION_NR; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NUMBER; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NAME; static final String INTERNAL_VARIABLE_CLUSTER_SIZE; static final String INTERNAL_VARIABLE_STEP_UNIQUE_NUMBER; static final String INTERNAL_VARIABLE_CLUSTER_MASTER; static final String INTERNAL_VARIABLE_CLUSTER_RUN_ID; static final String INTERNAL_VARIABLE_STEP_UNIQUE_COUNT; static final String INTERNAL_VARIABLE_STEP_NAME; static final String INTERNAL_VARIABLE_STEP_COPYNR; static final int MAX_NR_LOG_LINES; static final int MAX_NR_HISTORY_LINES; static final int HISTORY_LINES_FETCH_SIZE; static final int MAX_LOG_LINE_TIMEOUT_MINUTES; static final int WARNING; static final int ERROR; static final int INFO; static final int NOTE_MARGIN; static final int MAX_UNDO; static final String KETTLE_VARIABLES_FILE; static final String KETTLE_LOG_SIZE_LIMIT; static final String KETTLE_TRANS_LOG_DB; static final String KETTLE_TRANS_LOG_SCHEMA; static final String KETTLE_TRANS_LOG_TABLE; static final String KETTLE_JOB_LOG_DB; static final String KETTLE_JOB_LOG_SCHEMA; static final String KETTLE_SLAVE_DETECTION_TIMER; static final String KETTLE_JOB_LOG_TABLE; static final String KETTLE_TRANS_PERFORMANCE_LOG_DB; static final String KETTLE_TRANS_PERFORMANCE_LOG_SCHEMA; static final String KETTLE_TRANS_PERFORMANCE_LOG_TABLE; static final String KETTLE_JOBENTRY_LOG_DB; static final String KETTLE_JOBENTRY_LOG_SCHEMA; static final String KETTLE_JOBENTRY_LOG_TABLE; static final String KETTLE_STEP_LOG_DB; static final String KETTLE_STEP_LOG_SCHEMA; static final String KETTLE_STEP_LOG_TABLE; static final String KETTLE_CHANNEL_LOG_DB; static final String KETTLE_CHANNEL_LOG_SCHEMA; static final String KETTLE_CHANNEL_LOG_TABLE; static final String KETTLE_METRICS_LOG_DB; static final String KETTLE_METRICS_LOG_SCHEMA; static final String KETTLE_METRICS_LOG_TABLE; static final String KETTLE_CHECKPOINT_LOG_DB; static final String KETTLE_CHECKPOINT_LOG_SCHEMA; static final String KETTLE_CHECKPOINT_LOG_TABLE; static final String KETTLE_SHARED_OBJECTS; static final String KETTLE_EMPTY_STRING_DIFFERS_FROM_NULL; static final String KETTLE_LENIENT_STRING_TO_NUMBER_CONVERSION; static final String KETTLE_COMPATIBILITY_DB_IGNORE_TIMEZONE; static final String KETTLE_COMPATIBILITY_IMPORT_PATH_ADDITION_ON_VARIABLES; static final String KETTLE_COMPATIBILITY_IGNORE_TABLE_LOGGING; static final String KETTLE_COMPATIBILITY_TEXT_FILE_OUTPUT_APPEND_NO_HEADER; static final String KETTLE_COMPATIBILITY_MERGE_ROWS_USE_REFERENCE_STREAM_WHEN_IDENTICAL; static final String KETTLE_COMPATIBILITY_MEMORY_GROUP_BY_SUM_AVERAGE_RETURN_NUMBER_TYPE; static final String KETTLE_SYSTEM_HOSTNAME; static final String KETTLE_MAX_LOG_SIZE_IN_LINES; static final String KETTLE_MAX_LOG_TIMEOUT_IN_MINUTES; static final String KETTLE_REDIRECT_STDERR; static final String KETTLE_REDIRECT_STDOUT; static final String KETTLE_CARTE_OBJECT_TIMEOUT_MINUTES; static final String KETTLE_STEP_PERFORMANCE_SNAPSHOT_LIMIT; static final String KETTLE_MAX_JOB_TRACKER_SIZE; static final String KETTLE_MAX_JOB_ENTRIES_LOGGED; static final String KETTLE_MAX_LOGGING_REGISTRY_SIZE; static final String KETTLE_LOG_TAB_REFRESH_DELAY; static final String KETTLE_LOG_TAB_REFRESH_PERIOD; static final String KETTLE_SAP_CONNECTION_FACTORY; static final String KETTLE_SAP_CONNECTION_FACTORY_DEFAULT_NAME; static final String KETTLE_PLUGIN_CLASSES; static final String KETTLE_PLUGIN_PACKAGES; static final String KETTLE_TRANS_ROWSET_SIZE; static final String VERSION_COMMENT_INITIAL_VERSION; static final String VERSION_COMMENT_EDIT_VERSION; static final String XML_FILE_KETTLE_STEPS; static final String KETTLE_CORE_STEPS_FILE; static final String XML_FILE_KETTLE_PARTITION_PLUGINS; static final String KETTLE_CORE_JOBENTRIES_FILE; static final String XML_FILE_KETTLE_SERVLETS; static final String XML_FILE_KETTLE_VALUEMETA_PLUGINS; static final String XML_FILE_KETTLE_PASSWORD_ENCODER_PLUGINS; static final String KETTLE_VALUEMETA_PLUGINS_FILE; static final String KETTLE_PASSWORD_ENCODER_PLUGIN; static final String KETTLE_PASSWORD_ENCODER_PLUGINS_FILE; static final String KETTLE_TWO_WAY_PASSWORD_ENCODER_SEED; static final String XML_FILE_KETTLE_LOGGING_PLUGINS; static final String KETTLE_LOGGING_PLUGINS_FILE; static final String KETTLE_CORE_SERVLETS_FILE; static final String KETTLE_ROWSET_GET_TIMEOUT; static final String KETTLE_ROWSET_PUT_TIMEOUT; static final String KETTLE_BATCHING_ROWSET; static final String KETTLE_DISABLE_CONSOLE_LOGGING; static final String XML_FILE_KETTLE_JOB_ENTRIES; static final String XML_FILE_KETTLE_REPOSITORIES; static final String XML_FILE_KETTLE_DATABASE_TYPES; static final String XML_FILE_KETTLE_COMPRESSION_PROVIDERS; static final String XML_FILE_KETTLE_AUTHENTICATION_PROVIDERS; static final String XML_FILE_KETTLE_EXTENSION_POINTS; static final String XML_FILE_KETTLE_REGISTRY_EXTENSIONS; static final String XML_FILE_KETTLE_LIFECYCLE_LISTENERS; static final String XML_FILE_KETTLE_ENGINES; static final String KETTLE_TRANS_PAN_JVM_EXIT_CODE; static final String KETTLE_DEFAULT_NUMBER_FORMAT; static final String KETTLE_DEFAULT_BIGNUMBER_FORMAT; static final String KETTLE_DEFAULT_INTEGER_FORMAT; static final String KETTLE_DEFAULT_DATE_FORMAT; static final String KETTLE_AGGREGATION_MIN_NULL_IS_VALUED; static final String KETTLE_AGGREGATION_ALL_NULLS_ARE_ZERO; static final String KETTLE_DEFAULT_TIMESTAMP_FORMAT; static final String KETTLE_SPLIT_FIELDS_REMOVE_ENCLOSURE; static final String KETTLE_GLOBAL_LOG_VARIABLES_CLEAR_ON_EXPORT; static final String KETTLE_COMPATIBILITY_CALCULATION_TIMEZONE_DECOMPOSITION; static final String KETTLE_COMPATIBILITY_SET_ERROR_ON_SPECIFIC_JOB_ENTRIES; static final String KETTLE_COMPATIBILITY_SEND_RESULT_XML_WITH_FULL_STATUS; static final String KETTLE_COMPATIBILITY_SELECT_VALUES_TYPE_CHANGE_USES_TYPE_DEFAULTS; static final String XML_FILE_KETTLE_IMPORT_RULES; static final ReleaseType RELEASE; static final String PENTAHO_METASTORE_FOLDER; static final String PENTAHO_METASTORE_NAME; static final String KETTLE_LOG_MARK_MAPPINGS; static final String KETTLE_CARTE_JETTY_ACCEPTORS; static final String KETTLE_CARTE_JETTY_ACCEPT_QUEUE_SIZE; static final String KETTLE_CARTE_JETTY_RES_MAX_IDLE_TIME; static final String VFS_USER_DIR_IS_ROOT; }
@Test public void testSplitStringWithDelimiterAndEmptyEnclosureRemoveEnclosure() { String mask = "Hello%s world"; String[] chunks = {"Hello", " world"}; String stringToSplit = String.format( mask, DELIMITER1 ); String[] result = Const.splitString( stringToSplit, DELIMITER1, "", true ); assertSplit( result, chunks ); }
public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); @Deprecated static final String VERSION; static final String COPYRIGHT_YEAR; static final int TIMEOUT_GET_MILLIS; static final int TIMEOUT_PUT_MILLIS; static final int ROWS_UPDATE; static final int ROWS_IN_ROWSET; static final int FETCH_SIZE; static final int SORT_SIZE; static final int HEARTBEAT_PERIODIC_INTERVAL_IN_SECS; static final String FILE_SEPARATOR; static final String PATH_SEPARATOR; static final String CR; static final String DOSCR; static final String EMPTY_STRING; static final String JAVA_VERSION; @Deprecated static final String USER_HOME_DIRECTORY; static String JNDI_DIRECTORY; static final String PLUGIN_BASE_FOLDERS_PROP; static final String DEFAULT_PLUGIN_BASE_FOLDERS; static final Date MIN_DATE; static final Date MAX_DATE; static final int MIN_YEAR; static final int MAX_YEAR; static final int RIGHT; static final int LENGTH; static final int MARGIN; static final int MIDDLE_PCT; static final int ARROW_WIDTH; static final int FORM_MARGIN; static final int SHADOW_SIZE; static final int SYMBOLSIZE; static final int MAX_FILE_HIST; static final Locale DEFAULT_LOCALE; static final char DEFAULT_DECIMAL_SEPARATOR; static final char DEFAULT_GROUPING_SEPARATOR; static final String DEFAULT_CURRENCY_SYMBOL; static final String DEFAULT_NUMBER_FORMAT; static final String NULL_STRING; static final String NULL_NUMBER; static final String NULL_DATE; static final String NULL_BIGNUMBER; static final String NULL_BOOLEAN; static final String NULL_INTEGER; static final String NULL_BINARY; static final String NULL_NONE; static final int ROUND_HALF_CEILING; static final String CHEF_LOG_FILE; static final String SPOON_LOG_FILE; static final String MENU_LOG_FILE; static final String GENERALIZED_DATE_TIME_FORMAT; static final String GENERALIZED_DATE_TIME_FORMAT_MILLIS; static final String XML_ENCODING; static final String[] STRING_TRANS_AND_JOB_FILTER_EXT; static final String STRING_TRANS_DEFAULT_EXT; static final String[] STRING_TRANS_FILTER_EXT; static final String STRING_JOB_DEFAULT_EXT; static final String[] STRING_JOB_FILTER_EXT; static final String KETTLE_PROPERTIES; static final String SHARED_DATA_FILE; static final String INTERNAL_VARIABLE_PREFIX; static final String INTERNAL_VARIABLE_KETTLE_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_DATE; static final String INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_FILENAME_NAME; static final String INTERNAL_VARIABLE_JOB_NAME; static final String INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_RUN_ID; static final String INTERNAL_VARIABLE_JOB_RUN_ATTEMPTNR; static final String VARIABLE_HEARTBEAT_PERIODIC_INTERVAL_SECS; static final String VARIABLE_MONITORING_SNMP_TRAPS_ENABLED; static final String INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY; static final String[] INTERNAL_TRANS_VARIABLES; static final String[] INTERNAL_JOB_VARIABLES; static final String[] DEPRECATED_VARIABLES; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_STEP_PARTITION_ID; static final String INTERNAL_VARIABLE_STEP_PARTITION_NR; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NUMBER; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NAME; static final String INTERNAL_VARIABLE_CLUSTER_SIZE; static final String INTERNAL_VARIABLE_STEP_UNIQUE_NUMBER; static final String INTERNAL_VARIABLE_CLUSTER_MASTER; static final String INTERNAL_VARIABLE_CLUSTER_RUN_ID; static final String INTERNAL_VARIABLE_STEP_UNIQUE_COUNT; static final String INTERNAL_VARIABLE_STEP_NAME; static final String INTERNAL_VARIABLE_STEP_COPYNR; static final int MAX_NR_LOG_LINES; static final int MAX_NR_HISTORY_LINES; static final int HISTORY_LINES_FETCH_SIZE; static final int MAX_LOG_LINE_TIMEOUT_MINUTES; static final int WARNING; static final int ERROR; static final int INFO; static final int NOTE_MARGIN; static final int MAX_UNDO; static final String KETTLE_VARIABLES_FILE; static final String KETTLE_LOG_SIZE_LIMIT; static final String KETTLE_TRANS_LOG_DB; static final String KETTLE_TRANS_LOG_SCHEMA; static final String KETTLE_TRANS_LOG_TABLE; static final String KETTLE_JOB_LOG_DB; static final String KETTLE_JOB_LOG_SCHEMA; static final String KETTLE_SLAVE_DETECTION_TIMER; static final String KETTLE_JOB_LOG_TABLE; static final String KETTLE_TRANS_PERFORMANCE_LOG_DB; static final String KETTLE_TRANS_PERFORMANCE_LOG_SCHEMA; static final String KETTLE_TRANS_PERFORMANCE_LOG_TABLE; static final String KETTLE_JOBENTRY_LOG_DB; static final String KETTLE_JOBENTRY_LOG_SCHEMA; static final String KETTLE_JOBENTRY_LOG_TABLE; static final String KETTLE_STEP_LOG_DB; static final String KETTLE_STEP_LOG_SCHEMA; static final String KETTLE_STEP_LOG_TABLE; static final String KETTLE_CHANNEL_LOG_DB; static final String KETTLE_CHANNEL_LOG_SCHEMA; static final String KETTLE_CHANNEL_LOG_TABLE; static final String KETTLE_METRICS_LOG_DB; static final String KETTLE_METRICS_LOG_SCHEMA; static final String KETTLE_METRICS_LOG_TABLE; static final String KETTLE_CHECKPOINT_LOG_DB; static final String KETTLE_CHECKPOINT_LOG_SCHEMA; static final String KETTLE_CHECKPOINT_LOG_TABLE; static final String KETTLE_SHARED_OBJECTS; static final String KETTLE_EMPTY_STRING_DIFFERS_FROM_NULL; static final String KETTLE_LENIENT_STRING_TO_NUMBER_CONVERSION; static final String KETTLE_COMPATIBILITY_DB_IGNORE_TIMEZONE; static final String KETTLE_COMPATIBILITY_IMPORT_PATH_ADDITION_ON_VARIABLES; static final String KETTLE_COMPATIBILITY_IGNORE_TABLE_LOGGING; static final String KETTLE_COMPATIBILITY_TEXT_FILE_OUTPUT_APPEND_NO_HEADER; static final String KETTLE_COMPATIBILITY_MERGE_ROWS_USE_REFERENCE_STREAM_WHEN_IDENTICAL; static final String KETTLE_COMPATIBILITY_MEMORY_GROUP_BY_SUM_AVERAGE_RETURN_NUMBER_TYPE; static final String KETTLE_SYSTEM_HOSTNAME; static final String KETTLE_MAX_LOG_SIZE_IN_LINES; static final String KETTLE_MAX_LOG_TIMEOUT_IN_MINUTES; static final String KETTLE_REDIRECT_STDERR; static final String KETTLE_REDIRECT_STDOUT; static final String KETTLE_CARTE_OBJECT_TIMEOUT_MINUTES; static final String KETTLE_STEP_PERFORMANCE_SNAPSHOT_LIMIT; static final String KETTLE_MAX_JOB_TRACKER_SIZE; static final String KETTLE_MAX_JOB_ENTRIES_LOGGED; static final String KETTLE_MAX_LOGGING_REGISTRY_SIZE; static final String KETTLE_LOG_TAB_REFRESH_DELAY; static final String KETTLE_LOG_TAB_REFRESH_PERIOD; static final String KETTLE_SAP_CONNECTION_FACTORY; static final String KETTLE_SAP_CONNECTION_FACTORY_DEFAULT_NAME; static final String KETTLE_PLUGIN_CLASSES; static final String KETTLE_PLUGIN_PACKAGES; static final String KETTLE_TRANS_ROWSET_SIZE; static final String VERSION_COMMENT_INITIAL_VERSION; static final String VERSION_COMMENT_EDIT_VERSION; static final String XML_FILE_KETTLE_STEPS; static final String KETTLE_CORE_STEPS_FILE; static final String XML_FILE_KETTLE_PARTITION_PLUGINS; static final String KETTLE_CORE_JOBENTRIES_FILE; static final String XML_FILE_KETTLE_SERVLETS; static final String XML_FILE_KETTLE_VALUEMETA_PLUGINS; static final String XML_FILE_KETTLE_PASSWORD_ENCODER_PLUGINS; static final String KETTLE_VALUEMETA_PLUGINS_FILE; static final String KETTLE_PASSWORD_ENCODER_PLUGIN; static final String KETTLE_PASSWORD_ENCODER_PLUGINS_FILE; static final String KETTLE_TWO_WAY_PASSWORD_ENCODER_SEED; static final String XML_FILE_KETTLE_LOGGING_PLUGINS; static final String KETTLE_LOGGING_PLUGINS_FILE; static final String KETTLE_CORE_SERVLETS_FILE; static final String KETTLE_ROWSET_GET_TIMEOUT; static final String KETTLE_ROWSET_PUT_TIMEOUT; static final String KETTLE_BATCHING_ROWSET; static final String KETTLE_DISABLE_CONSOLE_LOGGING; static final String XML_FILE_KETTLE_JOB_ENTRIES; static final String XML_FILE_KETTLE_REPOSITORIES; static final String XML_FILE_KETTLE_DATABASE_TYPES; static final String XML_FILE_KETTLE_COMPRESSION_PROVIDERS; static final String XML_FILE_KETTLE_AUTHENTICATION_PROVIDERS; static final String XML_FILE_KETTLE_EXTENSION_POINTS; static final String XML_FILE_KETTLE_REGISTRY_EXTENSIONS; static final String XML_FILE_KETTLE_LIFECYCLE_LISTENERS; static final String XML_FILE_KETTLE_ENGINES; static final String KETTLE_TRANS_PAN_JVM_EXIT_CODE; static final String KETTLE_DEFAULT_NUMBER_FORMAT; static final String KETTLE_DEFAULT_BIGNUMBER_FORMAT; static final String KETTLE_DEFAULT_INTEGER_FORMAT; static final String KETTLE_DEFAULT_DATE_FORMAT; static final String KETTLE_AGGREGATION_MIN_NULL_IS_VALUED; static final String KETTLE_AGGREGATION_ALL_NULLS_ARE_ZERO; static final String KETTLE_DEFAULT_TIMESTAMP_FORMAT; static final String KETTLE_SPLIT_FIELDS_REMOVE_ENCLOSURE; static final String KETTLE_GLOBAL_LOG_VARIABLES_CLEAR_ON_EXPORT; static final String KETTLE_COMPATIBILITY_CALCULATION_TIMEZONE_DECOMPOSITION; static final String KETTLE_COMPATIBILITY_SET_ERROR_ON_SPECIFIC_JOB_ENTRIES; static final String KETTLE_COMPATIBILITY_SEND_RESULT_XML_WITH_FULL_STATUS; static final String KETTLE_COMPATIBILITY_SELECT_VALUES_TYPE_CHANGE_USES_TYPE_DEFAULTS; static final String XML_FILE_KETTLE_IMPORT_RULES; static final ReleaseType RELEASE; static final String PENTAHO_METASTORE_FOLDER; static final String PENTAHO_METASTORE_NAME; static final String KETTLE_LOG_MARK_MAPPINGS; static final String KETTLE_CARTE_JETTY_ACCEPTORS; static final String KETTLE_CARTE_JETTY_ACCEPT_QUEUE_SIZE; static final String KETTLE_CARTE_JETTY_RES_MAX_IDLE_TIME; static final String VFS_USER_DIR_IS_ROOT; }
@Test public void testSplitStringWithDelimiterAndEmptyEnclosureMultiCharRemoveEnclosure() { String mask = "Hello%s world"; String[] chunks = {"Hello", " world"}; String stringToSplit = String.format( mask, DELIMITER2 ); String [] result = Const.splitString( stringToSplit, DELIMITER2, "", true ); assertSplit( result, chunks ); }
public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); @Deprecated static final String VERSION; static final String COPYRIGHT_YEAR; static final int TIMEOUT_GET_MILLIS; static final int TIMEOUT_PUT_MILLIS; static final int ROWS_UPDATE; static final int ROWS_IN_ROWSET; static final int FETCH_SIZE; static final int SORT_SIZE; static final int HEARTBEAT_PERIODIC_INTERVAL_IN_SECS; static final String FILE_SEPARATOR; static final String PATH_SEPARATOR; static final String CR; static final String DOSCR; static final String EMPTY_STRING; static final String JAVA_VERSION; @Deprecated static final String USER_HOME_DIRECTORY; static String JNDI_DIRECTORY; static final String PLUGIN_BASE_FOLDERS_PROP; static final String DEFAULT_PLUGIN_BASE_FOLDERS; static final Date MIN_DATE; static final Date MAX_DATE; static final int MIN_YEAR; static final int MAX_YEAR; static final int RIGHT; static final int LENGTH; static final int MARGIN; static final int MIDDLE_PCT; static final int ARROW_WIDTH; static final int FORM_MARGIN; static final int SHADOW_SIZE; static final int SYMBOLSIZE; static final int MAX_FILE_HIST; static final Locale DEFAULT_LOCALE; static final char DEFAULT_DECIMAL_SEPARATOR; static final char DEFAULT_GROUPING_SEPARATOR; static final String DEFAULT_CURRENCY_SYMBOL; static final String DEFAULT_NUMBER_FORMAT; static final String NULL_STRING; static final String NULL_NUMBER; static final String NULL_DATE; static final String NULL_BIGNUMBER; static final String NULL_BOOLEAN; static final String NULL_INTEGER; static final String NULL_BINARY; static final String NULL_NONE; static final int ROUND_HALF_CEILING; static final String CHEF_LOG_FILE; static final String SPOON_LOG_FILE; static final String MENU_LOG_FILE; static final String GENERALIZED_DATE_TIME_FORMAT; static final String GENERALIZED_DATE_TIME_FORMAT_MILLIS; static final String XML_ENCODING; static final String[] STRING_TRANS_AND_JOB_FILTER_EXT; static final String STRING_TRANS_DEFAULT_EXT; static final String[] STRING_TRANS_FILTER_EXT; static final String STRING_JOB_DEFAULT_EXT; static final String[] STRING_JOB_FILTER_EXT; static final String KETTLE_PROPERTIES; static final String SHARED_DATA_FILE; static final String INTERNAL_VARIABLE_PREFIX; static final String INTERNAL_VARIABLE_KETTLE_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_DATE; static final String INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_FILENAME_NAME; static final String INTERNAL_VARIABLE_JOB_NAME; static final String INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_RUN_ID; static final String INTERNAL_VARIABLE_JOB_RUN_ATTEMPTNR; static final String VARIABLE_HEARTBEAT_PERIODIC_INTERVAL_SECS; static final String VARIABLE_MONITORING_SNMP_TRAPS_ENABLED; static final String INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY; static final String[] INTERNAL_TRANS_VARIABLES; static final String[] INTERNAL_JOB_VARIABLES; static final String[] DEPRECATED_VARIABLES; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_STEP_PARTITION_ID; static final String INTERNAL_VARIABLE_STEP_PARTITION_NR; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NUMBER; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NAME; static final String INTERNAL_VARIABLE_CLUSTER_SIZE; static final String INTERNAL_VARIABLE_STEP_UNIQUE_NUMBER; static final String INTERNAL_VARIABLE_CLUSTER_MASTER; static final String INTERNAL_VARIABLE_CLUSTER_RUN_ID; static final String INTERNAL_VARIABLE_STEP_UNIQUE_COUNT; static final String INTERNAL_VARIABLE_STEP_NAME; static final String INTERNAL_VARIABLE_STEP_COPYNR; static final int MAX_NR_LOG_LINES; static final int MAX_NR_HISTORY_LINES; static final int HISTORY_LINES_FETCH_SIZE; static final int MAX_LOG_LINE_TIMEOUT_MINUTES; static final int WARNING; static final int ERROR; static final int INFO; static final int NOTE_MARGIN; static final int MAX_UNDO; static final String KETTLE_VARIABLES_FILE; static final String KETTLE_LOG_SIZE_LIMIT; static final String KETTLE_TRANS_LOG_DB; static final String KETTLE_TRANS_LOG_SCHEMA; static final String KETTLE_TRANS_LOG_TABLE; static final String KETTLE_JOB_LOG_DB; static final String KETTLE_JOB_LOG_SCHEMA; static final String KETTLE_SLAVE_DETECTION_TIMER; static final String KETTLE_JOB_LOG_TABLE; static final String KETTLE_TRANS_PERFORMANCE_LOG_DB; static final String KETTLE_TRANS_PERFORMANCE_LOG_SCHEMA; static final String KETTLE_TRANS_PERFORMANCE_LOG_TABLE; static final String KETTLE_JOBENTRY_LOG_DB; static final String KETTLE_JOBENTRY_LOG_SCHEMA; static final String KETTLE_JOBENTRY_LOG_TABLE; static final String KETTLE_STEP_LOG_DB; static final String KETTLE_STEP_LOG_SCHEMA; static final String KETTLE_STEP_LOG_TABLE; static final String KETTLE_CHANNEL_LOG_DB; static final String KETTLE_CHANNEL_LOG_SCHEMA; static final String KETTLE_CHANNEL_LOG_TABLE; static final String KETTLE_METRICS_LOG_DB; static final String KETTLE_METRICS_LOG_SCHEMA; static final String KETTLE_METRICS_LOG_TABLE; static final String KETTLE_CHECKPOINT_LOG_DB; static final String KETTLE_CHECKPOINT_LOG_SCHEMA; static final String KETTLE_CHECKPOINT_LOG_TABLE; static final String KETTLE_SHARED_OBJECTS; static final String KETTLE_EMPTY_STRING_DIFFERS_FROM_NULL; static final String KETTLE_LENIENT_STRING_TO_NUMBER_CONVERSION; static final String KETTLE_COMPATIBILITY_DB_IGNORE_TIMEZONE; static final String KETTLE_COMPATIBILITY_IMPORT_PATH_ADDITION_ON_VARIABLES; static final String KETTLE_COMPATIBILITY_IGNORE_TABLE_LOGGING; static final String KETTLE_COMPATIBILITY_TEXT_FILE_OUTPUT_APPEND_NO_HEADER; static final String KETTLE_COMPATIBILITY_MERGE_ROWS_USE_REFERENCE_STREAM_WHEN_IDENTICAL; static final String KETTLE_COMPATIBILITY_MEMORY_GROUP_BY_SUM_AVERAGE_RETURN_NUMBER_TYPE; static final String KETTLE_SYSTEM_HOSTNAME; static final String KETTLE_MAX_LOG_SIZE_IN_LINES; static final String KETTLE_MAX_LOG_TIMEOUT_IN_MINUTES; static final String KETTLE_REDIRECT_STDERR; static final String KETTLE_REDIRECT_STDOUT; static final String KETTLE_CARTE_OBJECT_TIMEOUT_MINUTES; static final String KETTLE_STEP_PERFORMANCE_SNAPSHOT_LIMIT; static final String KETTLE_MAX_JOB_TRACKER_SIZE; static final String KETTLE_MAX_JOB_ENTRIES_LOGGED; static final String KETTLE_MAX_LOGGING_REGISTRY_SIZE; static final String KETTLE_LOG_TAB_REFRESH_DELAY; static final String KETTLE_LOG_TAB_REFRESH_PERIOD; static final String KETTLE_SAP_CONNECTION_FACTORY; static final String KETTLE_SAP_CONNECTION_FACTORY_DEFAULT_NAME; static final String KETTLE_PLUGIN_CLASSES; static final String KETTLE_PLUGIN_PACKAGES; static final String KETTLE_TRANS_ROWSET_SIZE; static final String VERSION_COMMENT_INITIAL_VERSION; static final String VERSION_COMMENT_EDIT_VERSION; static final String XML_FILE_KETTLE_STEPS; static final String KETTLE_CORE_STEPS_FILE; static final String XML_FILE_KETTLE_PARTITION_PLUGINS; static final String KETTLE_CORE_JOBENTRIES_FILE; static final String XML_FILE_KETTLE_SERVLETS; static final String XML_FILE_KETTLE_VALUEMETA_PLUGINS; static final String XML_FILE_KETTLE_PASSWORD_ENCODER_PLUGINS; static final String KETTLE_VALUEMETA_PLUGINS_FILE; static final String KETTLE_PASSWORD_ENCODER_PLUGIN; static final String KETTLE_PASSWORD_ENCODER_PLUGINS_FILE; static final String KETTLE_TWO_WAY_PASSWORD_ENCODER_SEED; static final String XML_FILE_KETTLE_LOGGING_PLUGINS; static final String KETTLE_LOGGING_PLUGINS_FILE; static final String KETTLE_CORE_SERVLETS_FILE; static final String KETTLE_ROWSET_GET_TIMEOUT; static final String KETTLE_ROWSET_PUT_TIMEOUT; static final String KETTLE_BATCHING_ROWSET; static final String KETTLE_DISABLE_CONSOLE_LOGGING; static final String XML_FILE_KETTLE_JOB_ENTRIES; static final String XML_FILE_KETTLE_REPOSITORIES; static final String XML_FILE_KETTLE_DATABASE_TYPES; static final String XML_FILE_KETTLE_COMPRESSION_PROVIDERS; static final String XML_FILE_KETTLE_AUTHENTICATION_PROVIDERS; static final String XML_FILE_KETTLE_EXTENSION_POINTS; static final String XML_FILE_KETTLE_REGISTRY_EXTENSIONS; static final String XML_FILE_KETTLE_LIFECYCLE_LISTENERS; static final String XML_FILE_KETTLE_ENGINES; static final String KETTLE_TRANS_PAN_JVM_EXIT_CODE; static final String KETTLE_DEFAULT_NUMBER_FORMAT; static final String KETTLE_DEFAULT_BIGNUMBER_FORMAT; static final String KETTLE_DEFAULT_INTEGER_FORMAT; static final String KETTLE_DEFAULT_DATE_FORMAT; static final String KETTLE_AGGREGATION_MIN_NULL_IS_VALUED; static final String KETTLE_AGGREGATION_ALL_NULLS_ARE_ZERO; static final String KETTLE_DEFAULT_TIMESTAMP_FORMAT; static final String KETTLE_SPLIT_FIELDS_REMOVE_ENCLOSURE; static final String KETTLE_GLOBAL_LOG_VARIABLES_CLEAR_ON_EXPORT; static final String KETTLE_COMPATIBILITY_CALCULATION_TIMEZONE_DECOMPOSITION; static final String KETTLE_COMPATIBILITY_SET_ERROR_ON_SPECIFIC_JOB_ENTRIES; static final String KETTLE_COMPATIBILITY_SEND_RESULT_XML_WITH_FULL_STATUS; static final String KETTLE_COMPATIBILITY_SELECT_VALUES_TYPE_CHANGE_USES_TYPE_DEFAULTS; static final String XML_FILE_KETTLE_IMPORT_RULES; static final ReleaseType RELEASE; static final String PENTAHO_METASTORE_FOLDER; static final String PENTAHO_METASTORE_NAME; static final String KETTLE_LOG_MARK_MAPPINGS; static final String KETTLE_CARTE_JETTY_ACCEPTORS; static final String KETTLE_CARTE_JETTY_ACCEPT_QUEUE_SIZE; static final String KETTLE_CARTE_JETTY_RES_MAX_IDLE_TIME; static final String VFS_USER_DIR_IS_ROOT; }
@Test public void testSplitStringWithDelimiterAndQuoteEnclosure1() { String mask = "%sHello%s world%s"; String stringToSplit = String.format( mask, ENCLOSURE1, DELIMITER1, ENCLOSURE1 ); String[] result = Const.splitString( stringToSplit, DELIMITER1, ENCLOSURE1 ); assertSplit( result, stringToSplit ); }
public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); @Deprecated static final String VERSION; static final String COPYRIGHT_YEAR; static final int TIMEOUT_GET_MILLIS; static final int TIMEOUT_PUT_MILLIS; static final int ROWS_UPDATE; static final int ROWS_IN_ROWSET; static final int FETCH_SIZE; static final int SORT_SIZE; static final int HEARTBEAT_PERIODIC_INTERVAL_IN_SECS; static final String FILE_SEPARATOR; static final String PATH_SEPARATOR; static final String CR; static final String DOSCR; static final String EMPTY_STRING; static final String JAVA_VERSION; @Deprecated static final String USER_HOME_DIRECTORY; static String JNDI_DIRECTORY; static final String PLUGIN_BASE_FOLDERS_PROP; static final String DEFAULT_PLUGIN_BASE_FOLDERS; static final Date MIN_DATE; static final Date MAX_DATE; static final int MIN_YEAR; static final int MAX_YEAR; static final int RIGHT; static final int LENGTH; static final int MARGIN; static final int MIDDLE_PCT; static final int ARROW_WIDTH; static final int FORM_MARGIN; static final int SHADOW_SIZE; static final int SYMBOLSIZE; static final int MAX_FILE_HIST; static final Locale DEFAULT_LOCALE; static final char DEFAULT_DECIMAL_SEPARATOR; static final char DEFAULT_GROUPING_SEPARATOR; static final String DEFAULT_CURRENCY_SYMBOL; static final String DEFAULT_NUMBER_FORMAT; static final String NULL_STRING; static final String NULL_NUMBER; static final String NULL_DATE; static final String NULL_BIGNUMBER; static final String NULL_BOOLEAN; static final String NULL_INTEGER; static final String NULL_BINARY; static final String NULL_NONE; static final int ROUND_HALF_CEILING; static final String CHEF_LOG_FILE; static final String SPOON_LOG_FILE; static final String MENU_LOG_FILE; static final String GENERALIZED_DATE_TIME_FORMAT; static final String GENERALIZED_DATE_TIME_FORMAT_MILLIS; static final String XML_ENCODING; static final String[] STRING_TRANS_AND_JOB_FILTER_EXT; static final String STRING_TRANS_DEFAULT_EXT; static final String[] STRING_TRANS_FILTER_EXT; static final String STRING_JOB_DEFAULT_EXT; static final String[] STRING_JOB_FILTER_EXT; static final String KETTLE_PROPERTIES; static final String SHARED_DATA_FILE; static final String INTERNAL_VARIABLE_PREFIX; static final String INTERNAL_VARIABLE_KETTLE_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_DATE; static final String INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_FILENAME_NAME; static final String INTERNAL_VARIABLE_JOB_NAME; static final String INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_RUN_ID; static final String INTERNAL_VARIABLE_JOB_RUN_ATTEMPTNR; static final String VARIABLE_HEARTBEAT_PERIODIC_INTERVAL_SECS; static final String VARIABLE_MONITORING_SNMP_TRAPS_ENABLED; static final String INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY; static final String[] INTERNAL_TRANS_VARIABLES; static final String[] INTERNAL_JOB_VARIABLES; static final String[] DEPRECATED_VARIABLES; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_STEP_PARTITION_ID; static final String INTERNAL_VARIABLE_STEP_PARTITION_NR; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NUMBER; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NAME; static final String INTERNAL_VARIABLE_CLUSTER_SIZE; static final String INTERNAL_VARIABLE_STEP_UNIQUE_NUMBER; static final String INTERNAL_VARIABLE_CLUSTER_MASTER; static final String INTERNAL_VARIABLE_CLUSTER_RUN_ID; static final String INTERNAL_VARIABLE_STEP_UNIQUE_COUNT; static final String INTERNAL_VARIABLE_STEP_NAME; static final String INTERNAL_VARIABLE_STEP_COPYNR; static final int MAX_NR_LOG_LINES; static final int MAX_NR_HISTORY_LINES; static final int HISTORY_LINES_FETCH_SIZE; static final int MAX_LOG_LINE_TIMEOUT_MINUTES; static final int WARNING; static final int ERROR; static final int INFO; static final int NOTE_MARGIN; static final int MAX_UNDO; static final String KETTLE_VARIABLES_FILE; static final String KETTLE_LOG_SIZE_LIMIT; static final String KETTLE_TRANS_LOG_DB; static final String KETTLE_TRANS_LOG_SCHEMA; static final String KETTLE_TRANS_LOG_TABLE; static final String KETTLE_JOB_LOG_DB; static final String KETTLE_JOB_LOG_SCHEMA; static final String KETTLE_SLAVE_DETECTION_TIMER; static final String KETTLE_JOB_LOG_TABLE; static final String KETTLE_TRANS_PERFORMANCE_LOG_DB; static final String KETTLE_TRANS_PERFORMANCE_LOG_SCHEMA; static final String KETTLE_TRANS_PERFORMANCE_LOG_TABLE; static final String KETTLE_JOBENTRY_LOG_DB; static final String KETTLE_JOBENTRY_LOG_SCHEMA; static final String KETTLE_JOBENTRY_LOG_TABLE; static final String KETTLE_STEP_LOG_DB; static final String KETTLE_STEP_LOG_SCHEMA; static final String KETTLE_STEP_LOG_TABLE; static final String KETTLE_CHANNEL_LOG_DB; static final String KETTLE_CHANNEL_LOG_SCHEMA; static final String KETTLE_CHANNEL_LOG_TABLE; static final String KETTLE_METRICS_LOG_DB; static final String KETTLE_METRICS_LOG_SCHEMA; static final String KETTLE_METRICS_LOG_TABLE; static final String KETTLE_CHECKPOINT_LOG_DB; static final String KETTLE_CHECKPOINT_LOG_SCHEMA; static final String KETTLE_CHECKPOINT_LOG_TABLE; static final String KETTLE_SHARED_OBJECTS; static final String KETTLE_EMPTY_STRING_DIFFERS_FROM_NULL; static final String KETTLE_LENIENT_STRING_TO_NUMBER_CONVERSION; static final String KETTLE_COMPATIBILITY_DB_IGNORE_TIMEZONE; static final String KETTLE_COMPATIBILITY_IMPORT_PATH_ADDITION_ON_VARIABLES; static final String KETTLE_COMPATIBILITY_IGNORE_TABLE_LOGGING; static final String KETTLE_COMPATIBILITY_TEXT_FILE_OUTPUT_APPEND_NO_HEADER; static final String KETTLE_COMPATIBILITY_MERGE_ROWS_USE_REFERENCE_STREAM_WHEN_IDENTICAL; static final String KETTLE_COMPATIBILITY_MEMORY_GROUP_BY_SUM_AVERAGE_RETURN_NUMBER_TYPE; static final String KETTLE_SYSTEM_HOSTNAME; static final String KETTLE_MAX_LOG_SIZE_IN_LINES; static final String KETTLE_MAX_LOG_TIMEOUT_IN_MINUTES; static final String KETTLE_REDIRECT_STDERR; static final String KETTLE_REDIRECT_STDOUT; static final String KETTLE_CARTE_OBJECT_TIMEOUT_MINUTES; static final String KETTLE_STEP_PERFORMANCE_SNAPSHOT_LIMIT; static final String KETTLE_MAX_JOB_TRACKER_SIZE; static final String KETTLE_MAX_JOB_ENTRIES_LOGGED; static final String KETTLE_MAX_LOGGING_REGISTRY_SIZE; static final String KETTLE_LOG_TAB_REFRESH_DELAY; static final String KETTLE_LOG_TAB_REFRESH_PERIOD; static final String KETTLE_SAP_CONNECTION_FACTORY; static final String KETTLE_SAP_CONNECTION_FACTORY_DEFAULT_NAME; static final String KETTLE_PLUGIN_CLASSES; static final String KETTLE_PLUGIN_PACKAGES; static final String KETTLE_TRANS_ROWSET_SIZE; static final String VERSION_COMMENT_INITIAL_VERSION; static final String VERSION_COMMENT_EDIT_VERSION; static final String XML_FILE_KETTLE_STEPS; static final String KETTLE_CORE_STEPS_FILE; static final String XML_FILE_KETTLE_PARTITION_PLUGINS; static final String KETTLE_CORE_JOBENTRIES_FILE; static final String XML_FILE_KETTLE_SERVLETS; static final String XML_FILE_KETTLE_VALUEMETA_PLUGINS; static final String XML_FILE_KETTLE_PASSWORD_ENCODER_PLUGINS; static final String KETTLE_VALUEMETA_PLUGINS_FILE; static final String KETTLE_PASSWORD_ENCODER_PLUGIN; static final String KETTLE_PASSWORD_ENCODER_PLUGINS_FILE; static final String KETTLE_TWO_WAY_PASSWORD_ENCODER_SEED; static final String XML_FILE_KETTLE_LOGGING_PLUGINS; static final String KETTLE_LOGGING_PLUGINS_FILE; static final String KETTLE_CORE_SERVLETS_FILE; static final String KETTLE_ROWSET_GET_TIMEOUT; static final String KETTLE_ROWSET_PUT_TIMEOUT; static final String KETTLE_BATCHING_ROWSET; static final String KETTLE_DISABLE_CONSOLE_LOGGING; static final String XML_FILE_KETTLE_JOB_ENTRIES; static final String XML_FILE_KETTLE_REPOSITORIES; static final String XML_FILE_KETTLE_DATABASE_TYPES; static final String XML_FILE_KETTLE_COMPRESSION_PROVIDERS; static final String XML_FILE_KETTLE_AUTHENTICATION_PROVIDERS; static final String XML_FILE_KETTLE_EXTENSION_POINTS; static final String XML_FILE_KETTLE_REGISTRY_EXTENSIONS; static final String XML_FILE_KETTLE_LIFECYCLE_LISTENERS; static final String XML_FILE_KETTLE_ENGINES; static final String KETTLE_TRANS_PAN_JVM_EXIT_CODE; static final String KETTLE_DEFAULT_NUMBER_FORMAT; static final String KETTLE_DEFAULT_BIGNUMBER_FORMAT; static final String KETTLE_DEFAULT_INTEGER_FORMAT; static final String KETTLE_DEFAULT_DATE_FORMAT; static final String KETTLE_AGGREGATION_MIN_NULL_IS_VALUED; static final String KETTLE_AGGREGATION_ALL_NULLS_ARE_ZERO; static final String KETTLE_DEFAULT_TIMESTAMP_FORMAT; static final String KETTLE_SPLIT_FIELDS_REMOVE_ENCLOSURE; static final String KETTLE_GLOBAL_LOG_VARIABLES_CLEAR_ON_EXPORT; static final String KETTLE_COMPATIBILITY_CALCULATION_TIMEZONE_DECOMPOSITION; static final String KETTLE_COMPATIBILITY_SET_ERROR_ON_SPECIFIC_JOB_ENTRIES; static final String KETTLE_COMPATIBILITY_SEND_RESULT_XML_WITH_FULL_STATUS; static final String KETTLE_COMPATIBILITY_SELECT_VALUES_TYPE_CHANGE_USES_TYPE_DEFAULTS; static final String XML_FILE_KETTLE_IMPORT_RULES; static final ReleaseType RELEASE; static final String PENTAHO_METASTORE_FOLDER; static final String PENTAHO_METASTORE_NAME; static final String KETTLE_LOG_MARK_MAPPINGS; static final String KETTLE_CARTE_JETTY_ACCEPTORS; static final String KETTLE_CARTE_JETTY_ACCEPT_QUEUE_SIZE; static final String KETTLE_CARTE_JETTY_RES_MAX_IDLE_TIME; static final String VFS_USER_DIR_IS_ROOT; }
@Test public void testSplitStringWithDelimiterAndQuoteEnclosureMultiChar1() { String mask = "%sHello%s world%s"; String stringToSplit = String.format( mask, ENCLOSURE2, DELIMITER2, ENCLOSURE2 ); String[] result = Const.splitString( stringToSplit, DELIMITER2, ENCLOSURE2 ); assertSplit( result, stringToSplit ); }
public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); @Deprecated static final String VERSION; static final String COPYRIGHT_YEAR; static final int TIMEOUT_GET_MILLIS; static final int TIMEOUT_PUT_MILLIS; static final int ROWS_UPDATE; static final int ROWS_IN_ROWSET; static final int FETCH_SIZE; static final int SORT_SIZE; static final int HEARTBEAT_PERIODIC_INTERVAL_IN_SECS; static final String FILE_SEPARATOR; static final String PATH_SEPARATOR; static final String CR; static final String DOSCR; static final String EMPTY_STRING; static final String JAVA_VERSION; @Deprecated static final String USER_HOME_DIRECTORY; static String JNDI_DIRECTORY; static final String PLUGIN_BASE_FOLDERS_PROP; static final String DEFAULT_PLUGIN_BASE_FOLDERS; static final Date MIN_DATE; static final Date MAX_DATE; static final int MIN_YEAR; static final int MAX_YEAR; static final int RIGHT; static final int LENGTH; static final int MARGIN; static final int MIDDLE_PCT; static final int ARROW_WIDTH; static final int FORM_MARGIN; static final int SHADOW_SIZE; static final int SYMBOLSIZE; static final int MAX_FILE_HIST; static final Locale DEFAULT_LOCALE; static final char DEFAULT_DECIMAL_SEPARATOR; static final char DEFAULT_GROUPING_SEPARATOR; static final String DEFAULT_CURRENCY_SYMBOL; static final String DEFAULT_NUMBER_FORMAT; static final String NULL_STRING; static final String NULL_NUMBER; static final String NULL_DATE; static final String NULL_BIGNUMBER; static final String NULL_BOOLEAN; static final String NULL_INTEGER; static final String NULL_BINARY; static final String NULL_NONE; static final int ROUND_HALF_CEILING; static final String CHEF_LOG_FILE; static final String SPOON_LOG_FILE; static final String MENU_LOG_FILE; static final String GENERALIZED_DATE_TIME_FORMAT; static final String GENERALIZED_DATE_TIME_FORMAT_MILLIS; static final String XML_ENCODING; static final String[] STRING_TRANS_AND_JOB_FILTER_EXT; static final String STRING_TRANS_DEFAULT_EXT; static final String[] STRING_TRANS_FILTER_EXT; static final String STRING_JOB_DEFAULT_EXT; static final String[] STRING_JOB_FILTER_EXT; static final String KETTLE_PROPERTIES; static final String SHARED_DATA_FILE; static final String INTERNAL_VARIABLE_PREFIX; static final String INTERNAL_VARIABLE_KETTLE_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_DATE; static final String INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_FILENAME_NAME; static final String INTERNAL_VARIABLE_JOB_NAME; static final String INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_RUN_ID; static final String INTERNAL_VARIABLE_JOB_RUN_ATTEMPTNR; static final String VARIABLE_HEARTBEAT_PERIODIC_INTERVAL_SECS; static final String VARIABLE_MONITORING_SNMP_TRAPS_ENABLED; static final String INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY; static final String[] INTERNAL_TRANS_VARIABLES; static final String[] INTERNAL_JOB_VARIABLES; static final String[] DEPRECATED_VARIABLES; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_STEP_PARTITION_ID; static final String INTERNAL_VARIABLE_STEP_PARTITION_NR; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NUMBER; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NAME; static final String INTERNAL_VARIABLE_CLUSTER_SIZE; static final String INTERNAL_VARIABLE_STEP_UNIQUE_NUMBER; static final String INTERNAL_VARIABLE_CLUSTER_MASTER; static final String INTERNAL_VARIABLE_CLUSTER_RUN_ID; static final String INTERNAL_VARIABLE_STEP_UNIQUE_COUNT; static final String INTERNAL_VARIABLE_STEP_NAME; static final String INTERNAL_VARIABLE_STEP_COPYNR; static final int MAX_NR_LOG_LINES; static final int MAX_NR_HISTORY_LINES; static final int HISTORY_LINES_FETCH_SIZE; static final int MAX_LOG_LINE_TIMEOUT_MINUTES; static final int WARNING; static final int ERROR; static final int INFO; static final int NOTE_MARGIN; static final int MAX_UNDO; static final String KETTLE_VARIABLES_FILE; static final String KETTLE_LOG_SIZE_LIMIT; static final String KETTLE_TRANS_LOG_DB; static final String KETTLE_TRANS_LOG_SCHEMA; static final String KETTLE_TRANS_LOG_TABLE; static final String KETTLE_JOB_LOG_DB; static final String KETTLE_JOB_LOG_SCHEMA; static final String KETTLE_SLAVE_DETECTION_TIMER; static final String KETTLE_JOB_LOG_TABLE; static final String KETTLE_TRANS_PERFORMANCE_LOG_DB; static final String KETTLE_TRANS_PERFORMANCE_LOG_SCHEMA; static final String KETTLE_TRANS_PERFORMANCE_LOG_TABLE; static final String KETTLE_JOBENTRY_LOG_DB; static final String KETTLE_JOBENTRY_LOG_SCHEMA; static final String KETTLE_JOBENTRY_LOG_TABLE; static final String KETTLE_STEP_LOG_DB; static final String KETTLE_STEP_LOG_SCHEMA; static final String KETTLE_STEP_LOG_TABLE; static final String KETTLE_CHANNEL_LOG_DB; static final String KETTLE_CHANNEL_LOG_SCHEMA; static final String KETTLE_CHANNEL_LOG_TABLE; static final String KETTLE_METRICS_LOG_DB; static final String KETTLE_METRICS_LOG_SCHEMA; static final String KETTLE_METRICS_LOG_TABLE; static final String KETTLE_CHECKPOINT_LOG_DB; static final String KETTLE_CHECKPOINT_LOG_SCHEMA; static final String KETTLE_CHECKPOINT_LOG_TABLE; static final String KETTLE_SHARED_OBJECTS; static final String KETTLE_EMPTY_STRING_DIFFERS_FROM_NULL; static final String KETTLE_LENIENT_STRING_TO_NUMBER_CONVERSION; static final String KETTLE_COMPATIBILITY_DB_IGNORE_TIMEZONE; static final String KETTLE_COMPATIBILITY_IMPORT_PATH_ADDITION_ON_VARIABLES; static final String KETTLE_COMPATIBILITY_IGNORE_TABLE_LOGGING; static final String KETTLE_COMPATIBILITY_TEXT_FILE_OUTPUT_APPEND_NO_HEADER; static final String KETTLE_COMPATIBILITY_MERGE_ROWS_USE_REFERENCE_STREAM_WHEN_IDENTICAL; static final String KETTLE_COMPATIBILITY_MEMORY_GROUP_BY_SUM_AVERAGE_RETURN_NUMBER_TYPE; static final String KETTLE_SYSTEM_HOSTNAME; static final String KETTLE_MAX_LOG_SIZE_IN_LINES; static final String KETTLE_MAX_LOG_TIMEOUT_IN_MINUTES; static final String KETTLE_REDIRECT_STDERR; static final String KETTLE_REDIRECT_STDOUT; static final String KETTLE_CARTE_OBJECT_TIMEOUT_MINUTES; static final String KETTLE_STEP_PERFORMANCE_SNAPSHOT_LIMIT; static final String KETTLE_MAX_JOB_TRACKER_SIZE; static final String KETTLE_MAX_JOB_ENTRIES_LOGGED; static final String KETTLE_MAX_LOGGING_REGISTRY_SIZE; static final String KETTLE_LOG_TAB_REFRESH_DELAY; static final String KETTLE_LOG_TAB_REFRESH_PERIOD; static final String KETTLE_SAP_CONNECTION_FACTORY; static final String KETTLE_SAP_CONNECTION_FACTORY_DEFAULT_NAME; static final String KETTLE_PLUGIN_CLASSES; static final String KETTLE_PLUGIN_PACKAGES; static final String KETTLE_TRANS_ROWSET_SIZE; static final String VERSION_COMMENT_INITIAL_VERSION; static final String VERSION_COMMENT_EDIT_VERSION; static final String XML_FILE_KETTLE_STEPS; static final String KETTLE_CORE_STEPS_FILE; static final String XML_FILE_KETTLE_PARTITION_PLUGINS; static final String KETTLE_CORE_JOBENTRIES_FILE; static final String XML_FILE_KETTLE_SERVLETS; static final String XML_FILE_KETTLE_VALUEMETA_PLUGINS; static final String XML_FILE_KETTLE_PASSWORD_ENCODER_PLUGINS; static final String KETTLE_VALUEMETA_PLUGINS_FILE; static final String KETTLE_PASSWORD_ENCODER_PLUGIN; static final String KETTLE_PASSWORD_ENCODER_PLUGINS_FILE; static final String KETTLE_TWO_WAY_PASSWORD_ENCODER_SEED; static final String XML_FILE_KETTLE_LOGGING_PLUGINS; static final String KETTLE_LOGGING_PLUGINS_FILE; static final String KETTLE_CORE_SERVLETS_FILE; static final String KETTLE_ROWSET_GET_TIMEOUT; static final String KETTLE_ROWSET_PUT_TIMEOUT; static final String KETTLE_BATCHING_ROWSET; static final String KETTLE_DISABLE_CONSOLE_LOGGING; static final String XML_FILE_KETTLE_JOB_ENTRIES; static final String XML_FILE_KETTLE_REPOSITORIES; static final String XML_FILE_KETTLE_DATABASE_TYPES; static final String XML_FILE_KETTLE_COMPRESSION_PROVIDERS; static final String XML_FILE_KETTLE_AUTHENTICATION_PROVIDERS; static final String XML_FILE_KETTLE_EXTENSION_POINTS; static final String XML_FILE_KETTLE_REGISTRY_EXTENSIONS; static final String XML_FILE_KETTLE_LIFECYCLE_LISTENERS; static final String XML_FILE_KETTLE_ENGINES; static final String KETTLE_TRANS_PAN_JVM_EXIT_CODE; static final String KETTLE_DEFAULT_NUMBER_FORMAT; static final String KETTLE_DEFAULT_BIGNUMBER_FORMAT; static final String KETTLE_DEFAULT_INTEGER_FORMAT; static final String KETTLE_DEFAULT_DATE_FORMAT; static final String KETTLE_AGGREGATION_MIN_NULL_IS_VALUED; static final String KETTLE_AGGREGATION_ALL_NULLS_ARE_ZERO; static final String KETTLE_DEFAULT_TIMESTAMP_FORMAT; static final String KETTLE_SPLIT_FIELDS_REMOVE_ENCLOSURE; static final String KETTLE_GLOBAL_LOG_VARIABLES_CLEAR_ON_EXPORT; static final String KETTLE_COMPATIBILITY_CALCULATION_TIMEZONE_DECOMPOSITION; static final String KETTLE_COMPATIBILITY_SET_ERROR_ON_SPECIFIC_JOB_ENTRIES; static final String KETTLE_COMPATIBILITY_SEND_RESULT_XML_WITH_FULL_STATUS; static final String KETTLE_COMPATIBILITY_SELECT_VALUES_TYPE_CHANGE_USES_TYPE_DEFAULTS; static final String XML_FILE_KETTLE_IMPORT_RULES; static final ReleaseType RELEASE; static final String PENTAHO_METASTORE_FOLDER; static final String PENTAHO_METASTORE_NAME; static final String KETTLE_LOG_MARK_MAPPINGS; static final String KETTLE_CARTE_JETTY_ACCEPTORS; static final String KETTLE_CARTE_JETTY_ACCEPT_QUEUE_SIZE; static final String KETTLE_CARTE_JETTY_RES_MAX_IDLE_TIME; static final String VFS_USER_DIR_IS_ROOT; }
@Test public void testSplitStringWithDelimiterAndQuoteEnclosureRemoveEnclosure1() { String mask = "%sHello%s world%s"; String[] chunks1 = { "Hello" + DELIMITER1 + " world" }; String stringToSplit = String.format( mask, ENCLOSURE1, DELIMITER1, ENCLOSURE1 ); String[] result = Const.splitString( stringToSplit, DELIMITER1, ENCLOSURE1, true ); assertSplit( result, chunks1 ); }
public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); @Deprecated static final String VERSION; static final String COPYRIGHT_YEAR; static final int TIMEOUT_GET_MILLIS; static final int TIMEOUT_PUT_MILLIS; static final int ROWS_UPDATE; static final int ROWS_IN_ROWSET; static final int FETCH_SIZE; static final int SORT_SIZE; static final int HEARTBEAT_PERIODIC_INTERVAL_IN_SECS; static final String FILE_SEPARATOR; static final String PATH_SEPARATOR; static final String CR; static final String DOSCR; static final String EMPTY_STRING; static final String JAVA_VERSION; @Deprecated static final String USER_HOME_DIRECTORY; static String JNDI_DIRECTORY; static final String PLUGIN_BASE_FOLDERS_PROP; static final String DEFAULT_PLUGIN_BASE_FOLDERS; static final Date MIN_DATE; static final Date MAX_DATE; static final int MIN_YEAR; static final int MAX_YEAR; static final int RIGHT; static final int LENGTH; static final int MARGIN; static final int MIDDLE_PCT; static final int ARROW_WIDTH; static final int FORM_MARGIN; static final int SHADOW_SIZE; static final int SYMBOLSIZE; static final int MAX_FILE_HIST; static final Locale DEFAULT_LOCALE; static final char DEFAULT_DECIMAL_SEPARATOR; static final char DEFAULT_GROUPING_SEPARATOR; static final String DEFAULT_CURRENCY_SYMBOL; static final String DEFAULT_NUMBER_FORMAT; static final String NULL_STRING; static final String NULL_NUMBER; static final String NULL_DATE; static final String NULL_BIGNUMBER; static final String NULL_BOOLEAN; static final String NULL_INTEGER; static final String NULL_BINARY; static final String NULL_NONE; static final int ROUND_HALF_CEILING; static final String CHEF_LOG_FILE; static final String SPOON_LOG_FILE; static final String MENU_LOG_FILE; static final String GENERALIZED_DATE_TIME_FORMAT; static final String GENERALIZED_DATE_TIME_FORMAT_MILLIS; static final String XML_ENCODING; static final String[] STRING_TRANS_AND_JOB_FILTER_EXT; static final String STRING_TRANS_DEFAULT_EXT; static final String[] STRING_TRANS_FILTER_EXT; static final String STRING_JOB_DEFAULT_EXT; static final String[] STRING_JOB_FILTER_EXT; static final String KETTLE_PROPERTIES; static final String SHARED_DATA_FILE; static final String INTERNAL_VARIABLE_PREFIX; static final String INTERNAL_VARIABLE_KETTLE_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_DATE; static final String INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_FILENAME_NAME; static final String INTERNAL_VARIABLE_JOB_NAME; static final String INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_RUN_ID; static final String INTERNAL_VARIABLE_JOB_RUN_ATTEMPTNR; static final String VARIABLE_HEARTBEAT_PERIODIC_INTERVAL_SECS; static final String VARIABLE_MONITORING_SNMP_TRAPS_ENABLED; static final String INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY; static final String[] INTERNAL_TRANS_VARIABLES; static final String[] INTERNAL_JOB_VARIABLES; static final String[] DEPRECATED_VARIABLES; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_STEP_PARTITION_ID; static final String INTERNAL_VARIABLE_STEP_PARTITION_NR; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NUMBER; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NAME; static final String INTERNAL_VARIABLE_CLUSTER_SIZE; static final String INTERNAL_VARIABLE_STEP_UNIQUE_NUMBER; static final String INTERNAL_VARIABLE_CLUSTER_MASTER; static final String INTERNAL_VARIABLE_CLUSTER_RUN_ID; static final String INTERNAL_VARIABLE_STEP_UNIQUE_COUNT; static final String INTERNAL_VARIABLE_STEP_NAME; static final String INTERNAL_VARIABLE_STEP_COPYNR; static final int MAX_NR_LOG_LINES; static final int MAX_NR_HISTORY_LINES; static final int HISTORY_LINES_FETCH_SIZE; static final int MAX_LOG_LINE_TIMEOUT_MINUTES; static final int WARNING; static final int ERROR; static final int INFO; static final int NOTE_MARGIN; static final int MAX_UNDO; static final String KETTLE_VARIABLES_FILE; static final String KETTLE_LOG_SIZE_LIMIT; static final String KETTLE_TRANS_LOG_DB; static final String KETTLE_TRANS_LOG_SCHEMA; static final String KETTLE_TRANS_LOG_TABLE; static final String KETTLE_JOB_LOG_DB; static final String KETTLE_JOB_LOG_SCHEMA; static final String KETTLE_SLAVE_DETECTION_TIMER; static final String KETTLE_JOB_LOG_TABLE; static final String KETTLE_TRANS_PERFORMANCE_LOG_DB; static final String KETTLE_TRANS_PERFORMANCE_LOG_SCHEMA; static final String KETTLE_TRANS_PERFORMANCE_LOG_TABLE; static final String KETTLE_JOBENTRY_LOG_DB; static final String KETTLE_JOBENTRY_LOG_SCHEMA; static final String KETTLE_JOBENTRY_LOG_TABLE; static final String KETTLE_STEP_LOG_DB; static final String KETTLE_STEP_LOG_SCHEMA; static final String KETTLE_STEP_LOG_TABLE; static final String KETTLE_CHANNEL_LOG_DB; static final String KETTLE_CHANNEL_LOG_SCHEMA; static final String KETTLE_CHANNEL_LOG_TABLE; static final String KETTLE_METRICS_LOG_DB; static final String KETTLE_METRICS_LOG_SCHEMA; static final String KETTLE_METRICS_LOG_TABLE; static final String KETTLE_CHECKPOINT_LOG_DB; static final String KETTLE_CHECKPOINT_LOG_SCHEMA; static final String KETTLE_CHECKPOINT_LOG_TABLE; static final String KETTLE_SHARED_OBJECTS; static final String KETTLE_EMPTY_STRING_DIFFERS_FROM_NULL; static final String KETTLE_LENIENT_STRING_TO_NUMBER_CONVERSION; static final String KETTLE_COMPATIBILITY_DB_IGNORE_TIMEZONE; static final String KETTLE_COMPATIBILITY_IMPORT_PATH_ADDITION_ON_VARIABLES; static final String KETTLE_COMPATIBILITY_IGNORE_TABLE_LOGGING; static final String KETTLE_COMPATIBILITY_TEXT_FILE_OUTPUT_APPEND_NO_HEADER; static final String KETTLE_COMPATIBILITY_MERGE_ROWS_USE_REFERENCE_STREAM_WHEN_IDENTICAL; static final String KETTLE_COMPATIBILITY_MEMORY_GROUP_BY_SUM_AVERAGE_RETURN_NUMBER_TYPE; static final String KETTLE_SYSTEM_HOSTNAME; static final String KETTLE_MAX_LOG_SIZE_IN_LINES; static final String KETTLE_MAX_LOG_TIMEOUT_IN_MINUTES; static final String KETTLE_REDIRECT_STDERR; static final String KETTLE_REDIRECT_STDOUT; static final String KETTLE_CARTE_OBJECT_TIMEOUT_MINUTES; static final String KETTLE_STEP_PERFORMANCE_SNAPSHOT_LIMIT; static final String KETTLE_MAX_JOB_TRACKER_SIZE; static final String KETTLE_MAX_JOB_ENTRIES_LOGGED; static final String KETTLE_MAX_LOGGING_REGISTRY_SIZE; static final String KETTLE_LOG_TAB_REFRESH_DELAY; static final String KETTLE_LOG_TAB_REFRESH_PERIOD; static final String KETTLE_SAP_CONNECTION_FACTORY; static final String KETTLE_SAP_CONNECTION_FACTORY_DEFAULT_NAME; static final String KETTLE_PLUGIN_CLASSES; static final String KETTLE_PLUGIN_PACKAGES; static final String KETTLE_TRANS_ROWSET_SIZE; static final String VERSION_COMMENT_INITIAL_VERSION; static final String VERSION_COMMENT_EDIT_VERSION; static final String XML_FILE_KETTLE_STEPS; static final String KETTLE_CORE_STEPS_FILE; static final String XML_FILE_KETTLE_PARTITION_PLUGINS; static final String KETTLE_CORE_JOBENTRIES_FILE; static final String XML_FILE_KETTLE_SERVLETS; static final String XML_FILE_KETTLE_VALUEMETA_PLUGINS; static final String XML_FILE_KETTLE_PASSWORD_ENCODER_PLUGINS; static final String KETTLE_VALUEMETA_PLUGINS_FILE; static final String KETTLE_PASSWORD_ENCODER_PLUGIN; static final String KETTLE_PASSWORD_ENCODER_PLUGINS_FILE; static final String KETTLE_TWO_WAY_PASSWORD_ENCODER_SEED; static final String XML_FILE_KETTLE_LOGGING_PLUGINS; static final String KETTLE_LOGGING_PLUGINS_FILE; static final String KETTLE_CORE_SERVLETS_FILE; static final String KETTLE_ROWSET_GET_TIMEOUT; static final String KETTLE_ROWSET_PUT_TIMEOUT; static final String KETTLE_BATCHING_ROWSET; static final String KETTLE_DISABLE_CONSOLE_LOGGING; static final String XML_FILE_KETTLE_JOB_ENTRIES; static final String XML_FILE_KETTLE_REPOSITORIES; static final String XML_FILE_KETTLE_DATABASE_TYPES; static final String XML_FILE_KETTLE_COMPRESSION_PROVIDERS; static final String XML_FILE_KETTLE_AUTHENTICATION_PROVIDERS; static final String XML_FILE_KETTLE_EXTENSION_POINTS; static final String XML_FILE_KETTLE_REGISTRY_EXTENSIONS; static final String XML_FILE_KETTLE_LIFECYCLE_LISTENERS; static final String XML_FILE_KETTLE_ENGINES; static final String KETTLE_TRANS_PAN_JVM_EXIT_CODE; static final String KETTLE_DEFAULT_NUMBER_FORMAT; static final String KETTLE_DEFAULT_BIGNUMBER_FORMAT; static final String KETTLE_DEFAULT_INTEGER_FORMAT; static final String KETTLE_DEFAULT_DATE_FORMAT; static final String KETTLE_AGGREGATION_MIN_NULL_IS_VALUED; static final String KETTLE_AGGREGATION_ALL_NULLS_ARE_ZERO; static final String KETTLE_DEFAULT_TIMESTAMP_FORMAT; static final String KETTLE_SPLIT_FIELDS_REMOVE_ENCLOSURE; static final String KETTLE_GLOBAL_LOG_VARIABLES_CLEAR_ON_EXPORT; static final String KETTLE_COMPATIBILITY_CALCULATION_TIMEZONE_DECOMPOSITION; static final String KETTLE_COMPATIBILITY_SET_ERROR_ON_SPECIFIC_JOB_ENTRIES; static final String KETTLE_COMPATIBILITY_SEND_RESULT_XML_WITH_FULL_STATUS; static final String KETTLE_COMPATIBILITY_SELECT_VALUES_TYPE_CHANGE_USES_TYPE_DEFAULTS; static final String XML_FILE_KETTLE_IMPORT_RULES; static final ReleaseType RELEASE; static final String PENTAHO_METASTORE_FOLDER; static final String PENTAHO_METASTORE_NAME; static final String KETTLE_LOG_MARK_MAPPINGS; static final String KETTLE_CARTE_JETTY_ACCEPTORS; static final String KETTLE_CARTE_JETTY_ACCEPT_QUEUE_SIZE; static final String KETTLE_CARTE_JETTY_RES_MAX_IDLE_TIME; static final String VFS_USER_DIR_IS_ROOT; }
@Test public void testSplitStringWithDelimiterAndQuoteEnclosureMultiCharRemoveEnclosure1() { String mask = "%sHello%s world%s"; String[] chunks2 = { "Hello" + DELIMITER2 + " world" }; String stringToSplit = String.format( mask, ENCLOSURE2, DELIMITER2, ENCLOSURE2 ); String[] result = Const.splitString( stringToSplit, DELIMITER2, ENCLOSURE2, true ); assertSplit( result, chunks2 ); }
public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); @Deprecated static final String VERSION; static final String COPYRIGHT_YEAR; static final int TIMEOUT_GET_MILLIS; static final int TIMEOUT_PUT_MILLIS; static final int ROWS_UPDATE; static final int ROWS_IN_ROWSET; static final int FETCH_SIZE; static final int SORT_SIZE; static final int HEARTBEAT_PERIODIC_INTERVAL_IN_SECS; static final String FILE_SEPARATOR; static final String PATH_SEPARATOR; static final String CR; static final String DOSCR; static final String EMPTY_STRING; static final String JAVA_VERSION; @Deprecated static final String USER_HOME_DIRECTORY; static String JNDI_DIRECTORY; static final String PLUGIN_BASE_FOLDERS_PROP; static final String DEFAULT_PLUGIN_BASE_FOLDERS; static final Date MIN_DATE; static final Date MAX_DATE; static final int MIN_YEAR; static final int MAX_YEAR; static final int RIGHT; static final int LENGTH; static final int MARGIN; static final int MIDDLE_PCT; static final int ARROW_WIDTH; static final int FORM_MARGIN; static final int SHADOW_SIZE; static final int SYMBOLSIZE; static final int MAX_FILE_HIST; static final Locale DEFAULT_LOCALE; static final char DEFAULT_DECIMAL_SEPARATOR; static final char DEFAULT_GROUPING_SEPARATOR; static final String DEFAULT_CURRENCY_SYMBOL; static final String DEFAULT_NUMBER_FORMAT; static final String NULL_STRING; static final String NULL_NUMBER; static final String NULL_DATE; static final String NULL_BIGNUMBER; static final String NULL_BOOLEAN; static final String NULL_INTEGER; static final String NULL_BINARY; static final String NULL_NONE; static final int ROUND_HALF_CEILING; static final String CHEF_LOG_FILE; static final String SPOON_LOG_FILE; static final String MENU_LOG_FILE; static final String GENERALIZED_DATE_TIME_FORMAT; static final String GENERALIZED_DATE_TIME_FORMAT_MILLIS; static final String XML_ENCODING; static final String[] STRING_TRANS_AND_JOB_FILTER_EXT; static final String STRING_TRANS_DEFAULT_EXT; static final String[] STRING_TRANS_FILTER_EXT; static final String STRING_JOB_DEFAULT_EXT; static final String[] STRING_JOB_FILTER_EXT; static final String KETTLE_PROPERTIES; static final String SHARED_DATA_FILE; static final String INTERNAL_VARIABLE_PREFIX; static final String INTERNAL_VARIABLE_KETTLE_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_DATE; static final String INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_FILENAME_NAME; static final String INTERNAL_VARIABLE_JOB_NAME; static final String INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_RUN_ID; static final String INTERNAL_VARIABLE_JOB_RUN_ATTEMPTNR; static final String VARIABLE_HEARTBEAT_PERIODIC_INTERVAL_SECS; static final String VARIABLE_MONITORING_SNMP_TRAPS_ENABLED; static final String INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY; static final String[] INTERNAL_TRANS_VARIABLES; static final String[] INTERNAL_JOB_VARIABLES; static final String[] DEPRECATED_VARIABLES; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_STEP_PARTITION_ID; static final String INTERNAL_VARIABLE_STEP_PARTITION_NR; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NUMBER; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NAME; static final String INTERNAL_VARIABLE_CLUSTER_SIZE; static final String INTERNAL_VARIABLE_STEP_UNIQUE_NUMBER; static final String INTERNAL_VARIABLE_CLUSTER_MASTER; static final String INTERNAL_VARIABLE_CLUSTER_RUN_ID; static final String INTERNAL_VARIABLE_STEP_UNIQUE_COUNT; static final String INTERNAL_VARIABLE_STEP_NAME; static final String INTERNAL_VARIABLE_STEP_COPYNR; static final int MAX_NR_LOG_LINES; static final int MAX_NR_HISTORY_LINES; static final int HISTORY_LINES_FETCH_SIZE; static final int MAX_LOG_LINE_TIMEOUT_MINUTES; static final int WARNING; static final int ERROR; static final int INFO; static final int NOTE_MARGIN; static final int MAX_UNDO; static final String KETTLE_VARIABLES_FILE; static final String KETTLE_LOG_SIZE_LIMIT; static final String KETTLE_TRANS_LOG_DB; static final String KETTLE_TRANS_LOG_SCHEMA; static final String KETTLE_TRANS_LOG_TABLE; static final String KETTLE_JOB_LOG_DB; static final String KETTLE_JOB_LOG_SCHEMA; static final String KETTLE_SLAVE_DETECTION_TIMER; static final String KETTLE_JOB_LOG_TABLE; static final String KETTLE_TRANS_PERFORMANCE_LOG_DB; static final String KETTLE_TRANS_PERFORMANCE_LOG_SCHEMA; static final String KETTLE_TRANS_PERFORMANCE_LOG_TABLE; static final String KETTLE_JOBENTRY_LOG_DB; static final String KETTLE_JOBENTRY_LOG_SCHEMA; static final String KETTLE_JOBENTRY_LOG_TABLE; static final String KETTLE_STEP_LOG_DB; static final String KETTLE_STEP_LOG_SCHEMA; static final String KETTLE_STEP_LOG_TABLE; static final String KETTLE_CHANNEL_LOG_DB; static final String KETTLE_CHANNEL_LOG_SCHEMA; static final String KETTLE_CHANNEL_LOG_TABLE; static final String KETTLE_METRICS_LOG_DB; static final String KETTLE_METRICS_LOG_SCHEMA; static final String KETTLE_METRICS_LOG_TABLE; static final String KETTLE_CHECKPOINT_LOG_DB; static final String KETTLE_CHECKPOINT_LOG_SCHEMA; static final String KETTLE_CHECKPOINT_LOG_TABLE; static final String KETTLE_SHARED_OBJECTS; static final String KETTLE_EMPTY_STRING_DIFFERS_FROM_NULL; static final String KETTLE_LENIENT_STRING_TO_NUMBER_CONVERSION; static final String KETTLE_COMPATIBILITY_DB_IGNORE_TIMEZONE; static final String KETTLE_COMPATIBILITY_IMPORT_PATH_ADDITION_ON_VARIABLES; static final String KETTLE_COMPATIBILITY_IGNORE_TABLE_LOGGING; static final String KETTLE_COMPATIBILITY_TEXT_FILE_OUTPUT_APPEND_NO_HEADER; static final String KETTLE_COMPATIBILITY_MERGE_ROWS_USE_REFERENCE_STREAM_WHEN_IDENTICAL; static final String KETTLE_COMPATIBILITY_MEMORY_GROUP_BY_SUM_AVERAGE_RETURN_NUMBER_TYPE; static final String KETTLE_SYSTEM_HOSTNAME; static final String KETTLE_MAX_LOG_SIZE_IN_LINES; static final String KETTLE_MAX_LOG_TIMEOUT_IN_MINUTES; static final String KETTLE_REDIRECT_STDERR; static final String KETTLE_REDIRECT_STDOUT; static final String KETTLE_CARTE_OBJECT_TIMEOUT_MINUTES; static final String KETTLE_STEP_PERFORMANCE_SNAPSHOT_LIMIT; static final String KETTLE_MAX_JOB_TRACKER_SIZE; static final String KETTLE_MAX_JOB_ENTRIES_LOGGED; static final String KETTLE_MAX_LOGGING_REGISTRY_SIZE; static final String KETTLE_LOG_TAB_REFRESH_DELAY; static final String KETTLE_LOG_TAB_REFRESH_PERIOD; static final String KETTLE_SAP_CONNECTION_FACTORY; static final String KETTLE_SAP_CONNECTION_FACTORY_DEFAULT_NAME; static final String KETTLE_PLUGIN_CLASSES; static final String KETTLE_PLUGIN_PACKAGES; static final String KETTLE_TRANS_ROWSET_SIZE; static final String VERSION_COMMENT_INITIAL_VERSION; static final String VERSION_COMMENT_EDIT_VERSION; static final String XML_FILE_KETTLE_STEPS; static final String KETTLE_CORE_STEPS_FILE; static final String XML_FILE_KETTLE_PARTITION_PLUGINS; static final String KETTLE_CORE_JOBENTRIES_FILE; static final String XML_FILE_KETTLE_SERVLETS; static final String XML_FILE_KETTLE_VALUEMETA_PLUGINS; static final String XML_FILE_KETTLE_PASSWORD_ENCODER_PLUGINS; static final String KETTLE_VALUEMETA_PLUGINS_FILE; static final String KETTLE_PASSWORD_ENCODER_PLUGIN; static final String KETTLE_PASSWORD_ENCODER_PLUGINS_FILE; static final String KETTLE_TWO_WAY_PASSWORD_ENCODER_SEED; static final String XML_FILE_KETTLE_LOGGING_PLUGINS; static final String KETTLE_LOGGING_PLUGINS_FILE; static final String KETTLE_CORE_SERVLETS_FILE; static final String KETTLE_ROWSET_GET_TIMEOUT; static final String KETTLE_ROWSET_PUT_TIMEOUT; static final String KETTLE_BATCHING_ROWSET; static final String KETTLE_DISABLE_CONSOLE_LOGGING; static final String XML_FILE_KETTLE_JOB_ENTRIES; static final String XML_FILE_KETTLE_REPOSITORIES; static final String XML_FILE_KETTLE_DATABASE_TYPES; static final String XML_FILE_KETTLE_COMPRESSION_PROVIDERS; static final String XML_FILE_KETTLE_AUTHENTICATION_PROVIDERS; static final String XML_FILE_KETTLE_EXTENSION_POINTS; static final String XML_FILE_KETTLE_REGISTRY_EXTENSIONS; static final String XML_FILE_KETTLE_LIFECYCLE_LISTENERS; static final String XML_FILE_KETTLE_ENGINES; static final String KETTLE_TRANS_PAN_JVM_EXIT_CODE; static final String KETTLE_DEFAULT_NUMBER_FORMAT; static final String KETTLE_DEFAULT_BIGNUMBER_FORMAT; static final String KETTLE_DEFAULT_INTEGER_FORMAT; static final String KETTLE_DEFAULT_DATE_FORMAT; static final String KETTLE_AGGREGATION_MIN_NULL_IS_VALUED; static final String KETTLE_AGGREGATION_ALL_NULLS_ARE_ZERO; static final String KETTLE_DEFAULT_TIMESTAMP_FORMAT; static final String KETTLE_SPLIT_FIELDS_REMOVE_ENCLOSURE; static final String KETTLE_GLOBAL_LOG_VARIABLES_CLEAR_ON_EXPORT; static final String KETTLE_COMPATIBILITY_CALCULATION_TIMEZONE_DECOMPOSITION; static final String KETTLE_COMPATIBILITY_SET_ERROR_ON_SPECIFIC_JOB_ENTRIES; static final String KETTLE_COMPATIBILITY_SEND_RESULT_XML_WITH_FULL_STATUS; static final String KETTLE_COMPATIBILITY_SELECT_VALUES_TYPE_CHANGE_USES_TYPE_DEFAULTS; static final String XML_FILE_KETTLE_IMPORT_RULES; static final ReleaseType RELEASE; static final String PENTAHO_METASTORE_FOLDER; static final String PENTAHO_METASTORE_NAME; static final String KETTLE_LOG_MARK_MAPPINGS; static final String KETTLE_CARTE_JETTY_ACCEPTORS; static final String KETTLE_CARTE_JETTY_ACCEPT_QUEUE_SIZE; static final String KETTLE_CARTE_JETTY_RES_MAX_IDLE_TIME; static final String VFS_USER_DIR_IS_ROOT; }
@Test public void testSplitStringWithDifferentDelimiterAndEnclosure() { String[] result = Const.splitString( "a;'b;c;d';'e,f';'g';h", ";", "'" ); assertNotNull( result ); assertEquals( 5, result.length ); assertEquals( "a", result[0] ); assertEquals( "'b;c;d'", result[1] ); assertEquals( "'e,f'", result[2] ); assertEquals( "'g'", result[3] ); assertEquals( "h", result[4] ); result = Const.splitString( "a;b;c;", ";", null ); assertNotNull( result ); assertEquals( 3, result.length ); result = Const.splitString( "a;b;c;''", ";", "'" ); assertNotNull( result ); assertEquals( 4, result.length ); }
public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); @Deprecated static final String VERSION; static final String COPYRIGHT_YEAR; static final int TIMEOUT_GET_MILLIS; static final int TIMEOUT_PUT_MILLIS; static final int ROWS_UPDATE; static final int ROWS_IN_ROWSET; static final int FETCH_SIZE; static final int SORT_SIZE; static final int HEARTBEAT_PERIODIC_INTERVAL_IN_SECS; static final String FILE_SEPARATOR; static final String PATH_SEPARATOR; static final String CR; static final String DOSCR; static final String EMPTY_STRING; static final String JAVA_VERSION; @Deprecated static final String USER_HOME_DIRECTORY; static String JNDI_DIRECTORY; static final String PLUGIN_BASE_FOLDERS_PROP; static final String DEFAULT_PLUGIN_BASE_FOLDERS; static final Date MIN_DATE; static final Date MAX_DATE; static final int MIN_YEAR; static final int MAX_YEAR; static final int RIGHT; static final int LENGTH; static final int MARGIN; static final int MIDDLE_PCT; static final int ARROW_WIDTH; static final int FORM_MARGIN; static final int SHADOW_SIZE; static final int SYMBOLSIZE; static final int MAX_FILE_HIST; static final Locale DEFAULT_LOCALE; static final char DEFAULT_DECIMAL_SEPARATOR; static final char DEFAULT_GROUPING_SEPARATOR; static final String DEFAULT_CURRENCY_SYMBOL; static final String DEFAULT_NUMBER_FORMAT; static final String NULL_STRING; static final String NULL_NUMBER; static final String NULL_DATE; static final String NULL_BIGNUMBER; static final String NULL_BOOLEAN; static final String NULL_INTEGER; static final String NULL_BINARY; static final String NULL_NONE; static final int ROUND_HALF_CEILING; static final String CHEF_LOG_FILE; static final String SPOON_LOG_FILE; static final String MENU_LOG_FILE; static final String GENERALIZED_DATE_TIME_FORMAT; static final String GENERALIZED_DATE_TIME_FORMAT_MILLIS; static final String XML_ENCODING; static final String[] STRING_TRANS_AND_JOB_FILTER_EXT; static final String STRING_TRANS_DEFAULT_EXT; static final String[] STRING_TRANS_FILTER_EXT; static final String STRING_JOB_DEFAULT_EXT; static final String[] STRING_JOB_FILTER_EXT; static final String KETTLE_PROPERTIES; static final String SHARED_DATA_FILE; static final String INTERNAL_VARIABLE_PREFIX; static final String INTERNAL_VARIABLE_KETTLE_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_DATE; static final String INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_FILENAME_NAME; static final String INTERNAL_VARIABLE_JOB_NAME; static final String INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_RUN_ID; static final String INTERNAL_VARIABLE_JOB_RUN_ATTEMPTNR; static final String VARIABLE_HEARTBEAT_PERIODIC_INTERVAL_SECS; static final String VARIABLE_MONITORING_SNMP_TRAPS_ENABLED; static final String INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY; static final String[] INTERNAL_TRANS_VARIABLES; static final String[] INTERNAL_JOB_VARIABLES; static final String[] DEPRECATED_VARIABLES; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_STEP_PARTITION_ID; static final String INTERNAL_VARIABLE_STEP_PARTITION_NR; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NUMBER; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NAME; static final String INTERNAL_VARIABLE_CLUSTER_SIZE; static final String INTERNAL_VARIABLE_STEP_UNIQUE_NUMBER; static final String INTERNAL_VARIABLE_CLUSTER_MASTER; static final String INTERNAL_VARIABLE_CLUSTER_RUN_ID; static final String INTERNAL_VARIABLE_STEP_UNIQUE_COUNT; static final String INTERNAL_VARIABLE_STEP_NAME; static final String INTERNAL_VARIABLE_STEP_COPYNR; static final int MAX_NR_LOG_LINES; static final int MAX_NR_HISTORY_LINES; static final int HISTORY_LINES_FETCH_SIZE; static final int MAX_LOG_LINE_TIMEOUT_MINUTES; static final int WARNING; static final int ERROR; static final int INFO; static final int NOTE_MARGIN; static final int MAX_UNDO; static final String KETTLE_VARIABLES_FILE; static final String KETTLE_LOG_SIZE_LIMIT; static final String KETTLE_TRANS_LOG_DB; static final String KETTLE_TRANS_LOG_SCHEMA; static final String KETTLE_TRANS_LOG_TABLE; static final String KETTLE_JOB_LOG_DB; static final String KETTLE_JOB_LOG_SCHEMA; static final String KETTLE_SLAVE_DETECTION_TIMER; static final String KETTLE_JOB_LOG_TABLE; static final String KETTLE_TRANS_PERFORMANCE_LOG_DB; static final String KETTLE_TRANS_PERFORMANCE_LOG_SCHEMA; static final String KETTLE_TRANS_PERFORMANCE_LOG_TABLE; static final String KETTLE_JOBENTRY_LOG_DB; static final String KETTLE_JOBENTRY_LOG_SCHEMA; static final String KETTLE_JOBENTRY_LOG_TABLE; static final String KETTLE_STEP_LOG_DB; static final String KETTLE_STEP_LOG_SCHEMA; static final String KETTLE_STEP_LOG_TABLE; static final String KETTLE_CHANNEL_LOG_DB; static final String KETTLE_CHANNEL_LOG_SCHEMA; static final String KETTLE_CHANNEL_LOG_TABLE; static final String KETTLE_METRICS_LOG_DB; static final String KETTLE_METRICS_LOG_SCHEMA; static final String KETTLE_METRICS_LOG_TABLE; static final String KETTLE_CHECKPOINT_LOG_DB; static final String KETTLE_CHECKPOINT_LOG_SCHEMA; static final String KETTLE_CHECKPOINT_LOG_TABLE; static final String KETTLE_SHARED_OBJECTS; static final String KETTLE_EMPTY_STRING_DIFFERS_FROM_NULL; static final String KETTLE_LENIENT_STRING_TO_NUMBER_CONVERSION; static final String KETTLE_COMPATIBILITY_DB_IGNORE_TIMEZONE; static final String KETTLE_COMPATIBILITY_IMPORT_PATH_ADDITION_ON_VARIABLES; static final String KETTLE_COMPATIBILITY_IGNORE_TABLE_LOGGING; static final String KETTLE_COMPATIBILITY_TEXT_FILE_OUTPUT_APPEND_NO_HEADER; static final String KETTLE_COMPATIBILITY_MERGE_ROWS_USE_REFERENCE_STREAM_WHEN_IDENTICAL; static final String KETTLE_COMPATIBILITY_MEMORY_GROUP_BY_SUM_AVERAGE_RETURN_NUMBER_TYPE; static final String KETTLE_SYSTEM_HOSTNAME; static final String KETTLE_MAX_LOG_SIZE_IN_LINES; static final String KETTLE_MAX_LOG_TIMEOUT_IN_MINUTES; static final String KETTLE_REDIRECT_STDERR; static final String KETTLE_REDIRECT_STDOUT; static final String KETTLE_CARTE_OBJECT_TIMEOUT_MINUTES; static final String KETTLE_STEP_PERFORMANCE_SNAPSHOT_LIMIT; static final String KETTLE_MAX_JOB_TRACKER_SIZE; static final String KETTLE_MAX_JOB_ENTRIES_LOGGED; static final String KETTLE_MAX_LOGGING_REGISTRY_SIZE; static final String KETTLE_LOG_TAB_REFRESH_DELAY; static final String KETTLE_LOG_TAB_REFRESH_PERIOD; static final String KETTLE_SAP_CONNECTION_FACTORY; static final String KETTLE_SAP_CONNECTION_FACTORY_DEFAULT_NAME; static final String KETTLE_PLUGIN_CLASSES; static final String KETTLE_PLUGIN_PACKAGES; static final String KETTLE_TRANS_ROWSET_SIZE; static final String VERSION_COMMENT_INITIAL_VERSION; static final String VERSION_COMMENT_EDIT_VERSION; static final String XML_FILE_KETTLE_STEPS; static final String KETTLE_CORE_STEPS_FILE; static final String XML_FILE_KETTLE_PARTITION_PLUGINS; static final String KETTLE_CORE_JOBENTRIES_FILE; static final String XML_FILE_KETTLE_SERVLETS; static final String XML_FILE_KETTLE_VALUEMETA_PLUGINS; static final String XML_FILE_KETTLE_PASSWORD_ENCODER_PLUGINS; static final String KETTLE_VALUEMETA_PLUGINS_FILE; static final String KETTLE_PASSWORD_ENCODER_PLUGIN; static final String KETTLE_PASSWORD_ENCODER_PLUGINS_FILE; static final String KETTLE_TWO_WAY_PASSWORD_ENCODER_SEED; static final String XML_FILE_KETTLE_LOGGING_PLUGINS; static final String KETTLE_LOGGING_PLUGINS_FILE; static final String KETTLE_CORE_SERVLETS_FILE; static final String KETTLE_ROWSET_GET_TIMEOUT; static final String KETTLE_ROWSET_PUT_TIMEOUT; static final String KETTLE_BATCHING_ROWSET; static final String KETTLE_DISABLE_CONSOLE_LOGGING; static final String XML_FILE_KETTLE_JOB_ENTRIES; static final String XML_FILE_KETTLE_REPOSITORIES; static final String XML_FILE_KETTLE_DATABASE_TYPES; static final String XML_FILE_KETTLE_COMPRESSION_PROVIDERS; static final String XML_FILE_KETTLE_AUTHENTICATION_PROVIDERS; static final String XML_FILE_KETTLE_EXTENSION_POINTS; static final String XML_FILE_KETTLE_REGISTRY_EXTENSIONS; static final String XML_FILE_KETTLE_LIFECYCLE_LISTENERS; static final String XML_FILE_KETTLE_ENGINES; static final String KETTLE_TRANS_PAN_JVM_EXIT_CODE; static final String KETTLE_DEFAULT_NUMBER_FORMAT; static final String KETTLE_DEFAULT_BIGNUMBER_FORMAT; static final String KETTLE_DEFAULT_INTEGER_FORMAT; static final String KETTLE_DEFAULT_DATE_FORMAT; static final String KETTLE_AGGREGATION_MIN_NULL_IS_VALUED; static final String KETTLE_AGGREGATION_ALL_NULLS_ARE_ZERO; static final String KETTLE_DEFAULT_TIMESTAMP_FORMAT; static final String KETTLE_SPLIT_FIELDS_REMOVE_ENCLOSURE; static final String KETTLE_GLOBAL_LOG_VARIABLES_CLEAR_ON_EXPORT; static final String KETTLE_COMPATIBILITY_CALCULATION_TIMEZONE_DECOMPOSITION; static final String KETTLE_COMPATIBILITY_SET_ERROR_ON_SPECIFIC_JOB_ENTRIES; static final String KETTLE_COMPATIBILITY_SEND_RESULT_XML_WITH_FULL_STATUS; static final String KETTLE_COMPATIBILITY_SELECT_VALUES_TYPE_CHANGE_USES_TYPE_DEFAULTS; static final String XML_FILE_KETTLE_IMPORT_RULES; static final ReleaseType RELEASE; static final String PENTAHO_METASTORE_FOLDER; static final String PENTAHO_METASTORE_NAME; static final String KETTLE_LOG_MARK_MAPPINGS; static final String KETTLE_CARTE_JETTY_ACCEPTORS; static final String KETTLE_CARTE_JETTY_ACCEPT_QUEUE_SIZE; static final String KETTLE_CARTE_JETTY_RES_MAX_IDLE_TIME; static final String VFS_USER_DIR_IS_ROOT; }
@Test public void transConfigItems() throws Exception { TransMeta meta = new TransMeta(); meta.setName( "foo" ); Transformation trans = TransMetaConverter.convert( meta ); assertThat( trans.getConfig().get( TransMetaConverter.TRANS_META_NAME_CONF_KEY ), is( "foo" ) ); assertThat( (String) trans.getConfig().get( TransMetaConverter.TRANS_META_CONF_KEY ), startsWith( "<transformation>" ) ); }
public static Transformation convert( TransMeta transMeta ) { final org.pentaho.di.engine.model.Transformation transformation = new org.pentaho.di.engine.model.Transformation( createTransformationId( transMeta ) ); try { TransMeta copyTransMeta = (TransMeta) transMeta.realClone( false ); cleanupDisabledHops( copyTransMeta ); disableLazyConversion( copyTransMeta ); searchAndReplaceHadoopClusterWithFileSystemURL( copyTransMeta ); copyTransMeta.getSteps().forEach( createOperation( transformation ) ); findHops( copyTransMeta, hop -> true ).forEach( createHop( transformation ) ); transformation.setConfig( TRANS_META_CONF_KEY, copyTransMeta.getXML() ); transformation.setConfig( TRANS_META_NAME_CONF_KEY, Optional.ofNullable( transMeta.getName() ).orElse( TRANS_DEFAULT_NAME ) ); Map<String, Transformation> subTransformations = copyTransMeta.getResourceDependencies().stream() .flatMap( resourceReference -> resourceReference.getEntries().stream() ) .filter( entry -> ResourceEntry.ResourceType.ACTIONFILE.equals( entry.getResourcetype() ) ) .collect( toMap( ResourceEntry::getResource, entry -> { try { return convert( new TransMeta( entry.getResource(), copyTransMeta.getParentVariableSpace() ) ); } catch ( KettleXMLException | KettleMissingPluginsException e ) { throw new RuntimeException( e ); } } ) ); transformation.setConfig( SUB_TRANSFORMATIONS_KEY, (Serializable) subTransformations ); } catch ( KettleException e ) { Throwables.propagate( e ); } return transformation; }
TransMetaConverter { public static Transformation convert( TransMeta transMeta ) { final org.pentaho.di.engine.model.Transformation transformation = new org.pentaho.di.engine.model.Transformation( createTransformationId( transMeta ) ); try { TransMeta copyTransMeta = (TransMeta) transMeta.realClone( false ); cleanupDisabledHops( copyTransMeta ); disableLazyConversion( copyTransMeta ); searchAndReplaceHadoopClusterWithFileSystemURL( copyTransMeta ); copyTransMeta.getSteps().forEach( createOperation( transformation ) ); findHops( copyTransMeta, hop -> true ).forEach( createHop( transformation ) ); transformation.setConfig( TRANS_META_CONF_KEY, copyTransMeta.getXML() ); transformation.setConfig( TRANS_META_NAME_CONF_KEY, Optional.ofNullable( transMeta.getName() ).orElse( TRANS_DEFAULT_NAME ) ); Map<String, Transformation> subTransformations = copyTransMeta.getResourceDependencies().stream() .flatMap( resourceReference -> resourceReference.getEntries().stream() ) .filter( entry -> ResourceEntry.ResourceType.ACTIONFILE.equals( entry.getResourcetype() ) ) .collect( toMap( ResourceEntry::getResource, entry -> { try { return convert( new TransMeta( entry.getResource(), copyTransMeta.getParentVariableSpace() ) ); } catch ( KettleXMLException | KettleMissingPluginsException e ) { throw new RuntimeException( e ); } } ) ); transformation.setConfig( SUB_TRANSFORMATIONS_KEY, (Serializable) subTransformations ); } catch ( KettleException e ) { Throwables.propagate( e ); } return transformation; } }
TransMetaConverter { public static Transformation convert( TransMeta transMeta ) { final org.pentaho.di.engine.model.Transformation transformation = new org.pentaho.di.engine.model.Transformation( createTransformationId( transMeta ) ); try { TransMeta copyTransMeta = (TransMeta) transMeta.realClone( false ); cleanupDisabledHops( copyTransMeta ); disableLazyConversion( copyTransMeta ); searchAndReplaceHadoopClusterWithFileSystemURL( copyTransMeta ); copyTransMeta.getSteps().forEach( createOperation( transformation ) ); findHops( copyTransMeta, hop -> true ).forEach( createHop( transformation ) ); transformation.setConfig( TRANS_META_CONF_KEY, copyTransMeta.getXML() ); transformation.setConfig( TRANS_META_NAME_CONF_KEY, Optional.ofNullable( transMeta.getName() ).orElse( TRANS_DEFAULT_NAME ) ); Map<String, Transformation> subTransformations = copyTransMeta.getResourceDependencies().stream() .flatMap( resourceReference -> resourceReference.getEntries().stream() ) .filter( entry -> ResourceEntry.ResourceType.ACTIONFILE.equals( entry.getResourcetype() ) ) .collect( toMap( ResourceEntry::getResource, entry -> { try { return convert( new TransMeta( entry.getResource(), copyTransMeta.getParentVariableSpace() ) ); } catch ( KettleXMLException | KettleMissingPluginsException e ) { throw new RuntimeException( e ); } } ) ); transformation.setConfig( SUB_TRANSFORMATIONS_KEY, (Serializable) subTransformations ); } catch ( KettleException e ) { Throwables.propagate( e ); } return transformation; } }
TransMetaConverter { public static Transformation convert( TransMeta transMeta ) { final org.pentaho.di.engine.model.Transformation transformation = new org.pentaho.di.engine.model.Transformation( createTransformationId( transMeta ) ); try { TransMeta copyTransMeta = (TransMeta) transMeta.realClone( false ); cleanupDisabledHops( copyTransMeta ); disableLazyConversion( copyTransMeta ); searchAndReplaceHadoopClusterWithFileSystemURL( copyTransMeta ); copyTransMeta.getSteps().forEach( createOperation( transformation ) ); findHops( copyTransMeta, hop -> true ).forEach( createHop( transformation ) ); transformation.setConfig( TRANS_META_CONF_KEY, copyTransMeta.getXML() ); transformation.setConfig( TRANS_META_NAME_CONF_KEY, Optional.ofNullable( transMeta.getName() ).orElse( TRANS_DEFAULT_NAME ) ); Map<String, Transformation> subTransformations = copyTransMeta.getResourceDependencies().stream() .flatMap( resourceReference -> resourceReference.getEntries().stream() ) .filter( entry -> ResourceEntry.ResourceType.ACTIONFILE.equals( entry.getResourcetype() ) ) .collect( toMap( ResourceEntry::getResource, entry -> { try { return convert( new TransMeta( entry.getResource(), copyTransMeta.getParentVariableSpace() ) ); } catch ( KettleXMLException | KettleMissingPluginsException e ) { throw new RuntimeException( e ); } } ) ); transformation.setConfig( SUB_TRANSFORMATIONS_KEY, (Serializable) subTransformations ); } catch ( KettleException e ) { Throwables.propagate( e ); } return transformation; } static Transformation convert( TransMeta transMeta ); }
TransMetaConverter { public static Transformation convert( TransMeta transMeta ) { final org.pentaho.di.engine.model.Transformation transformation = new org.pentaho.di.engine.model.Transformation( createTransformationId( transMeta ) ); try { TransMeta copyTransMeta = (TransMeta) transMeta.realClone( false ); cleanupDisabledHops( copyTransMeta ); disableLazyConversion( copyTransMeta ); searchAndReplaceHadoopClusterWithFileSystemURL( copyTransMeta ); copyTransMeta.getSteps().forEach( createOperation( transformation ) ); findHops( copyTransMeta, hop -> true ).forEach( createHop( transformation ) ); transformation.setConfig( TRANS_META_CONF_KEY, copyTransMeta.getXML() ); transformation.setConfig( TRANS_META_NAME_CONF_KEY, Optional.ofNullable( transMeta.getName() ).orElse( TRANS_DEFAULT_NAME ) ); Map<String, Transformation> subTransformations = copyTransMeta.getResourceDependencies().stream() .flatMap( resourceReference -> resourceReference.getEntries().stream() ) .filter( entry -> ResourceEntry.ResourceType.ACTIONFILE.equals( entry.getResourcetype() ) ) .collect( toMap( ResourceEntry::getResource, entry -> { try { return convert( new TransMeta( entry.getResource(), copyTransMeta.getParentVariableSpace() ) ); } catch ( KettleXMLException | KettleMissingPluginsException e ) { throw new RuntimeException( e ); } } ) ); transformation.setConfig( SUB_TRANSFORMATIONS_KEY, (Serializable) subTransformations ); } catch ( KettleException e ) { Throwables.propagate( e ); } return transformation; } static Transformation convert( TransMeta transMeta ); static final String TRANS_META_CONF_KEY; static final String TRANS_META_NAME_CONF_KEY; static final String SUB_TRANSFORMATIONS_KEY; static final String STEP_META_CONF_KEY; static final String TRANS_DEFAULT_NAME; }
@Test public void testSplitStringWithMultipleCharacterDelimiterAndEnclosure() { String[] result = Const.splitString( "html this is a web page html</newpage>html and so is this html", "</newpage>", "html" ); assertNotNull( result ); assertEquals( 2, result.length ); assertEquals( "html this is a web page html", result[0] ); assertEquals( "html and so is this html", result[1] ); }
public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); @Deprecated static final String VERSION; static final String COPYRIGHT_YEAR; static final int TIMEOUT_GET_MILLIS; static final int TIMEOUT_PUT_MILLIS; static final int ROWS_UPDATE; static final int ROWS_IN_ROWSET; static final int FETCH_SIZE; static final int SORT_SIZE; static final int HEARTBEAT_PERIODIC_INTERVAL_IN_SECS; static final String FILE_SEPARATOR; static final String PATH_SEPARATOR; static final String CR; static final String DOSCR; static final String EMPTY_STRING; static final String JAVA_VERSION; @Deprecated static final String USER_HOME_DIRECTORY; static String JNDI_DIRECTORY; static final String PLUGIN_BASE_FOLDERS_PROP; static final String DEFAULT_PLUGIN_BASE_FOLDERS; static final Date MIN_DATE; static final Date MAX_DATE; static final int MIN_YEAR; static final int MAX_YEAR; static final int RIGHT; static final int LENGTH; static final int MARGIN; static final int MIDDLE_PCT; static final int ARROW_WIDTH; static final int FORM_MARGIN; static final int SHADOW_SIZE; static final int SYMBOLSIZE; static final int MAX_FILE_HIST; static final Locale DEFAULT_LOCALE; static final char DEFAULT_DECIMAL_SEPARATOR; static final char DEFAULT_GROUPING_SEPARATOR; static final String DEFAULT_CURRENCY_SYMBOL; static final String DEFAULT_NUMBER_FORMAT; static final String NULL_STRING; static final String NULL_NUMBER; static final String NULL_DATE; static final String NULL_BIGNUMBER; static final String NULL_BOOLEAN; static final String NULL_INTEGER; static final String NULL_BINARY; static final String NULL_NONE; static final int ROUND_HALF_CEILING; static final String CHEF_LOG_FILE; static final String SPOON_LOG_FILE; static final String MENU_LOG_FILE; static final String GENERALIZED_DATE_TIME_FORMAT; static final String GENERALIZED_DATE_TIME_FORMAT_MILLIS; static final String XML_ENCODING; static final String[] STRING_TRANS_AND_JOB_FILTER_EXT; static final String STRING_TRANS_DEFAULT_EXT; static final String[] STRING_TRANS_FILTER_EXT; static final String STRING_JOB_DEFAULT_EXT; static final String[] STRING_JOB_FILTER_EXT; static final String KETTLE_PROPERTIES; static final String SHARED_DATA_FILE; static final String INTERNAL_VARIABLE_PREFIX; static final String INTERNAL_VARIABLE_KETTLE_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_DATE; static final String INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_FILENAME_NAME; static final String INTERNAL_VARIABLE_JOB_NAME; static final String INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_RUN_ID; static final String INTERNAL_VARIABLE_JOB_RUN_ATTEMPTNR; static final String VARIABLE_HEARTBEAT_PERIODIC_INTERVAL_SECS; static final String VARIABLE_MONITORING_SNMP_TRAPS_ENABLED; static final String INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY; static final String[] INTERNAL_TRANS_VARIABLES; static final String[] INTERNAL_JOB_VARIABLES; static final String[] DEPRECATED_VARIABLES; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_STEP_PARTITION_ID; static final String INTERNAL_VARIABLE_STEP_PARTITION_NR; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NUMBER; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NAME; static final String INTERNAL_VARIABLE_CLUSTER_SIZE; static final String INTERNAL_VARIABLE_STEP_UNIQUE_NUMBER; static final String INTERNAL_VARIABLE_CLUSTER_MASTER; static final String INTERNAL_VARIABLE_CLUSTER_RUN_ID; static final String INTERNAL_VARIABLE_STEP_UNIQUE_COUNT; static final String INTERNAL_VARIABLE_STEP_NAME; static final String INTERNAL_VARIABLE_STEP_COPYNR; static final int MAX_NR_LOG_LINES; static final int MAX_NR_HISTORY_LINES; static final int HISTORY_LINES_FETCH_SIZE; static final int MAX_LOG_LINE_TIMEOUT_MINUTES; static final int WARNING; static final int ERROR; static final int INFO; static final int NOTE_MARGIN; static final int MAX_UNDO; static final String KETTLE_VARIABLES_FILE; static final String KETTLE_LOG_SIZE_LIMIT; static final String KETTLE_TRANS_LOG_DB; static final String KETTLE_TRANS_LOG_SCHEMA; static final String KETTLE_TRANS_LOG_TABLE; static final String KETTLE_JOB_LOG_DB; static final String KETTLE_JOB_LOG_SCHEMA; static final String KETTLE_SLAVE_DETECTION_TIMER; static final String KETTLE_JOB_LOG_TABLE; static final String KETTLE_TRANS_PERFORMANCE_LOG_DB; static final String KETTLE_TRANS_PERFORMANCE_LOG_SCHEMA; static final String KETTLE_TRANS_PERFORMANCE_LOG_TABLE; static final String KETTLE_JOBENTRY_LOG_DB; static final String KETTLE_JOBENTRY_LOG_SCHEMA; static final String KETTLE_JOBENTRY_LOG_TABLE; static final String KETTLE_STEP_LOG_DB; static final String KETTLE_STEP_LOG_SCHEMA; static final String KETTLE_STEP_LOG_TABLE; static final String KETTLE_CHANNEL_LOG_DB; static final String KETTLE_CHANNEL_LOG_SCHEMA; static final String KETTLE_CHANNEL_LOG_TABLE; static final String KETTLE_METRICS_LOG_DB; static final String KETTLE_METRICS_LOG_SCHEMA; static final String KETTLE_METRICS_LOG_TABLE; static final String KETTLE_CHECKPOINT_LOG_DB; static final String KETTLE_CHECKPOINT_LOG_SCHEMA; static final String KETTLE_CHECKPOINT_LOG_TABLE; static final String KETTLE_SHARED_OBJECTS; static final String KETTLE_EMPTY_STRING_DIFFERS_FROM_NULL; static final String KETTLE_LENIENT_STRING_TO_NUMBER_CONVERSION; static final String KETTLE_COMPATIBILITY_DB_IGNORE_TIMEZONE; static final String KETTLE_COMPATIBILITY_IMPORT_PATH_ADDITION_ON_VARIABLES; static final String KETTLE_COMPATIBILITY_IGNORE_TABLE_LOGGING; static final String KETTLE_COMPATIBILITY_TEXT_FILE_OUTPUT_APPEND_NO_HEADER; static final String KETTLE_COMPATIBILITY_MERGE_ROWS_USE_REFERENCE_STREAM_WHEN_IDENTICAL; static final String KETTLE_COMPATIBILITY_MEMORY_GROUP_BY_SUM_AVERAGE_RETURN_NUMBER_TYPE; static final String KETTLE_SYSTEM_HOSTNAME; static final String KETTLE_MAX_LOG_SIZE_IN_LINES; static final String KETTLE_MAX_LOG_TIMEOUT_IN_MINUTES; static final String KETTLE_REDIRECT_STDERR; static final String KETTLE_REDIRECT_STDOUT; static final String KETTLE_CARTE_OBJECT_TIMEOUT_MINUTES; static final String KETTLE_STEP_PERFORMANCE_SNAPSHOT_LIMIT; static final String KETTLE_MAX_JOB_TRACKER_SIZE; static final String KETTLE_MAX_JOB_ENTRIES_LOGGED; static final String KETTLE_MAX_LOGGING_REGISTRY_SIZE; static final String KETTLE_LOG_TAB_REFRESH_DELAY; static final String KETTLE_LOG_TAB_REFRESH_PERIOD; static final String KETTLE_SAP_CONNECTION_FACTORY; static final String KETTLE_SAP_CONNECTION_FACTORY_DEFAULT_NAME; static final String KETTLE_PLUGIN_CLASSES; static final String KETTLE_PLUGIN_PACKAGES; static final String KETTLE_TRANS_ROWSET_SIZE; static final String VERSION_COMMENT_INITIAL_VERSION; static final String VERSION_COMMENT_EDIT_VERSION; static final String XML_FILE_KETTLE_STEPS; static final String KETTLE_CORE_STEPS_FILE; static final String XML_FILE_KETTLE_PARTITION_PLUGINS; static final String KETTLE_CORE_JOBENTRIES_FILE; static final String XML_FILE_KETTLE_SERVLETS; static final String XML_FILE_KETTLE_VALUEMETA_PLUGINS; static final String XML_FILE_KETTLE_PASSWORD_ENCODER_PLUGINS; static final String KETTLE_VALUEMETA_PLUGINS_FILE; static final String KETTLE_PASSWORD_ENCODER_PLUGIN; static final String KETTLE_PASSWORD_ENCODER_PLUGINS_FILE; static final String KETTLE_TWO_WAY_PASSWORD_ENCODER_SEED; static final String XML_FILE_KETTLE_LOGGING_PLUGINS; static final String KETTLE_LOGGING_PLUGINS_FILE; static final String KETTLE_CORE_SERVLETS_FILE; static final String KETTLE_ROWSET_GET_TIMEOUT; static final String KETTLE_ROWSET_PUT_TIMEOUT; static final String KETTLE_BATCHING_ROWSET; static final String KETTLE_DISABLE_CONSOLE_LOGGING; static final String XML_FILE_KETTLE_JOB_ENTRIES; static final String XML_FILE_KETTLE_REPOSITORIES; static final String XML_FILE_KETTLE_DATABASE_TYPES; static final String XML_FILE_KETTLE_COMPRESSION_PROVIDERS; static final String XML_FILE_KETTLE_AUTHENTICATION_PROVIDERS; static final String XML_FILE_KETTLE_EXTENSION_POINTS; static final String XML_FILE_KETTLE_REGISTRY_EXTENSIONS; static final String XML_FILE_KETTLE_LIFECYCLE_LISTENERS; static final String XML_FILE_KETTLE_ENGINES; static final String KETTLE_TRANS_PAN_JVM_EXIT_CODE; static final String KETTLE_DEFAULT_NUMBER_FORMAT; static final String KETTLE_DEFAULT_BIGNUMBER_FORMAT; static final String KETTLE_DEFAULT_INTEGER_FORMAT; static final String KETTLE_DEFAULT_DATE_FORMAT; static final String KETTLE_AGGREGATION_MIN_NULL_IS_VALUED; static final String KETTLE_AGGREGATION_ALL_NULLS_ARE_ZERO; static final String KETTLE_DEFAULT_TIMESTAMP_FORMAT; static final String KETTLE_SPLIT_FIELDS_REMOVE_ENCLOSURE; static final String KETTLE_GLOBAL_LOG_VARIABLES_CLEAR_ON_EXPORT; static final String KETTLE_COMPATIBILITY_CALCULATION_TIMEZONE_DECOMPOSITION; static final String KETTLE_COMPATIBILITY_SET_ERROR_ON_SPECIFIC_JOB_ENTRIES; static final String KETTLE_COMPATIBILITY_SEND_RESULT_XML_WITH_FULL_STATUS; static final String KETTLE_COMPATIBILITY_SELECT_VALUES_TYPE_CHANGE_USES_TYPE_DEFAULTS; static final String XML_FILE_KETTLE_IMPORT_RULES; static final ReleaseType RELEASE; static final String PENTAHO_METASTORE_FOLDER; static final String PENTAHO_METASTORE_NAME; static final String KETTLE_LOG_MARK_MAPPINGS; static final String KETTLE_CARTE_JETTY_ACCEPTORS; static final String KETTLE_CARTE_JETTY_ACCEPT_QUEUE_SIZE; static final String KETTLE_CARTE_JETTY_RES_MAX_IDLE_TIME; static final String VFS_USER_DIR_IS_ROOT; }
@Test public void testSplitStringWithEscaping() { String[] result; result = Const.splitString( null, null, null ); assertNull( result ); result = Const.splitString( "Hello, world", null, null ); assertNotNull( result ); assertEquals( result.length, 1 ); assertEquals( result[0], "Hello, world" ); result = Const.splitString( "Hello\\, world,Hello\\, planet,Hello\\, 3rd rock", ',', true ); assertNotNull( result ); assertEquals( result.length, 3 ); assertEquals( result[0], "Hello\\, world" ); assertEquals( result[1], "Hello\\, planet" ); assertEquals( result[2], "Hello\\, 3rd rock" ); }
public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); }
Const { public static String[] splitString( String string, String separator ) { List<String> list = new ArrayList<>(); if ( string == null || string.length() == 0 ) { return new String[] {}; } int sepLen = separator.length(); int from = 0; int end = string.length() - sepLen + 1; for ( int i = from; i < end; i += sepLen ) { if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { list.add( NVL( string.substring( from, i ), "" ) ); from = i + sepLen; } } if ( from + sepLen <= string.length() ) { list.add( NVL( string.substring( from, string.length() ), "" ) ); } return list.toArray( new String[list.size()] ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); @Deprecated static final String VERSION; static final String COPYRIGHT_YEAR; static final int TIMEOUT_GET_MILLIS; static final int TIMEOUT_PUT_MILLIS; static final int ROWS_UPDATE; static final int ROWS_IN_ROWSET; static final int FETCH_SIZE; static final int SORT_SIZE; static final int HEARTBEAT_PERIODIC_INTERVAL_IN_SECS; static final String FILE_SEPARATOR; static final String PATH_SEPARATOR; static final String CR; static final String DOSCR; static final String EMPTY_STRING; static final String JAVA_VERSION; @Deprecated static final String USER_HOME_DIRECTORY; static String JNDI_DIRECTORY; static final String PLUGIN_BASE_FOLDERS_PROP; static final String DEFAULT_PLUGIN_BASE_FOLDERS; static final Date MIN_DATE; static final Date MAX_DATE; static final int MIN_YEAR; static final int MAX_YEAR; static final int RIGHT; static final int LENGTH; static final int MARGIN; static final int MIDDLE_PCT; static final int ARROW_WIDTH; static final int FORM_MARGIN; static final int SHADOW_SIZE; static final int SYMBOLSIZE; static final int MAX_FILE_HIST; static final Locale DEFAULT_LOCALE; static final char DEFAULT_DECIMAL_SEPARATOR; static final char DEFAULT_GROUPING_SEPARATOR; static final String DEFAULT_CURRENCY_SYMBOL; static final String DEFAULT_NUMBER_FORMAT; static final String NULL_STRING; static final String NULL_NUMBER; static final String NULL_DATE; static final String NULL_BIGNUMBER; static final String NULL_BOOLEAN; static final String NULL_INTEGER; static final String NULL_BINARY; static final String NULL_NONE; static final int ROUND_HALF_CEILING; static final String CHEF_LOG_FILE; static final String SPOON_LOG_FILE; static final String MENU_LOG_FILE; static final String GENERALIZED_DATE_TIME_FORMAT; static final String GENERALIZED_DATE_TIME_FORMAT_MILLIS; static final String XML_ENCODING; static final String[] STRING_TRANS_AND_JOB_FILTER_EXT; static final String STRING_TRANS_DEFAULT_EXT; static final String[] STRING_TRANS_FILTER_EXT; static final String STRING_JOB_DEFAULT_EXT; static final String[] STRING_JOB_FILTER_EXT; static final String KETTLE_PROPERTIES; static final String SHARED_DATA_FILE; static final String INTERNAL_VARIABLE_PREFIX; static final String INTERNAL_VARIABLE_KETTLE_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_DATE; static final String INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_FILENAME_NAME; static final String INTERNAL_VARIABLE_JOB_NAME; static final String INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_RUN_ID; static final String INTERNAL_VARIABLE_JOB_RUN_ATTEMPTNR; static final String VARIABLE_HEARTBEAT_PERIODIC_INTERVAL_SECS; static final String VARIABLE_MONITORING_SNMP_TRAPS_ENABLED; static final String INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY; static final String[] INTERNAL_TRANS_VARIABLES; static final String[] INTERNAL_JOB_VARIABLES; static final String[] DEPRECATED_VARIABLES; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_STEP_PARTITION_ID; static final String INTERNAL_VARIABLE_STEP_PARTITION_NR; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NUMBER; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NAME; static final String INTERNAL_VARIABLE_CLUSTER_SIZE; static final String INTERNAL_VARIABLE_STEP_UNIQUE_NUMBER; static final String INTERNAL_VARIABLE_CLUSTER_MASTER; static final String INTERNAL_VARIABLE_CLUSTER_RUN_ID; static final String INTERNAL_VARIABLE_STEP_UNIQUE_COUNT; static final String INTERNAL_VARIABLE_STEP_NAME; static final String INTERNAL_VARIABLE_STEP_COPYNR; static final int MAX_NR_LOG_LINES; static final int MAX_NR_HISTORY_LINES; static final int HISTORY_LINES_FETCH_SIZE; static final int MAX_LOG_LINE_TIMEOUT_MINUTES; static final int WARNING; static final int ERROR; static final int INFO; static final int NOTE_MARGIN; static final int MAX_UNDO; static final String KETTLE_VARIABLES_FILE; static final String KETTLE_LOG_SIZE_LIMIT; static final String KETTLE_TRANS_LOG_DB; static final String KETTLE_TRANS_LOG_SCHEMA; static final String KETTLE_TRANS_LOG_TABLE; static final String KETTLE_JOB_LOG_DB; static final String KETTLE_JOB_LOG_SCHEMA; static final String KETTLE_SLAVE_DETECTION_TIMER; static final String KETTLE_JOB_LOG_TABLE; static final String KETTLE_TRANS_PERFORMANCE_LOG_DB; static final String KETTLE_TRANS_PERFORMANCE_LOG_SCHEMA; static final String KETTLE_TRANS_PERFORMANCE_LOG_TABLE; static final String KETTLE_JOBENTRY_LOG_DB; static final String KETTLE_JOBENTRY_LOG_SCHEMA; static final String KETTLE_JOBENTRY_LOG_TABLE; static final String KETTLE_STEP_LOG_DB; static final String KETTLE_STEP_LOG_SCHEMA; static final String KETTLE_STEP_LOG_TABLE; static final String KETTLE_CHANNEL_LOG_DB; static final String KETTLE_CHANNEL_LOG_SCHEMA; static final String KETTLE_CHANNEL_LOG_TABLE; static final String KETTLE_METRICS_LOG_DB; static final String KETTLE_METRICS_LOG_SCHEMA; static final String KETTLE_METRICS_LOG_TABLE; static final String KETTLE_CHECKPOINT_LOG_DB; static final String KETTLE_CHECKPOINT_LOG_SCHEMA; static final String KETTLE_CHECKPOINT_LOG_TABLE; static final String KETTLE_SHARED_OBJECTS; static final String KETTLE_EMPTY_STRING_DIFFERS_FROM_NULL; static final String KETTLE_LENIENT_STRING_TO_NUMBER_CONVERSION; static final String KETTLE_COMPATIBILITY_DB_IGNORE_TIMEZONE; static final String KETTLE_COMPATIBILITY_IMPORT_PATH_ADDITION_ON_VARIABLES; static final String KETTLE_COMPATIBILITY_IGNORE_TABLE_LOGGING; static final String KETTLE_COMPATIBILITY_TEXT_FILE_OUTPUT_APPEND_NO_HEADER; static final String KETTLE_COMPATIBILITY_MERGE_ROWS_USE_REFERENCE_STREAM_WHEN_IDENTICAL; static final String KETTLE_COMPATIBILITY_MEMORY_GROUP_BY_SUM_AVERAGE_RETURN_NUMBER_TYPE; static final String KETTLE_SYSTEM_HOSTNAME; static final String KETTLE_MAX_LOG_SIZE_IN_LINES; static final String KETTLE_MAX_LOG_TIMEOUT_IN_MINUTES; static final String KETTLE_REDIRECT_STDERR; static final String KETTLE_REDIRECT_STDOUT; static final String KETTLE_CARTE_OBJECT_TIMEOUT_MINUTES; static final String KETTLE_STEP_PERFORMANCE_SNAPSHOT_LIMIT; static final String KETTLE_MAX_JOB_TRACKER_SIZE; static final String KETTLE_MAX_JOB_ENTRIES_LOGGED; static final String KETTLE_MAX_LOGGING_REGISTRY_SIZE; static final String KETTLE_LOG_TAB_REFRESH_DELAY; static final String KETTLE_LOG_TAB_REFRESH_PERIOD; static final String KETTLE_SAP_CONNECTION_FACTORY; static final String KETTLE_SAP_CONNECTION_FACTORY_DEFAULT_NAME; static final String KETTLE_PLUGIN_CLASSES; static final String KETTLE_PLUGIN_PACKAGES; static final String KETTLE_TRANS_ROWSET_SIZE; static final String VERSION_COMMENT_INITIAL_VERSION; static final String VERSION_COMMENT_EDIT_VERSION; static final String XML_FILE_KETTLE_STEPS; static final String KETTLE_CORE_STEPS_FILE; static final String XML_FILE_KETTLE_PARTITION_PLUGINS; static final String KETTLE_CORE_JOBENTRIES_FILE; static final String XML_FILE_KETTLE_SERVLETS; static final String XML_FILE_KETTLE_VALUEMETA_PLUGINS; static final String XML_FILE_KETTLE_PASSWORD_ENCODER_PLUGINS; static final String KETTLE_VALUEMETA_PLUGINS_FILE; static final String KETTLE_PASSWORD_ENCODER_PLUGIN; static final String KETTLE_PASSWORD_ENCODER_PLUGINS_FILE; static final String KETTLE_TWO_WAY_PASSWORD_ENCODER_SEED; static final String XML_FILE_KETTLE_LOGGING_PLUGINS; static final String KETTLE_LOGGING_PLUGINS_FILE; static final String KETTLE_CORE_SERVLETS_FILE; static final String KETTLE_ROWSET_GET_TIMEOUT; static final String KETTLE_ROWSET_PUT_TIMEOUT; static final String KETTLE_BATCHING_ROWSET; static final String KETTLE_DISABLE_CONSOLE_LOGGING; static final String XML_FILE_KETTLE_JOB_ENTRIES; static final String XML_FILE_KETTLE_REPOSITORIES; static final String XML_FILE_KETTLE_DATABASE_TYPES; static final String XML_FILE_KETTLE_COMPRESSION_PROVIDERS; static final String XML_FILE_KETTLE_AUTHENTICATION_PROVIDERS; static final String XML_FILE_KETTLE_EXTENSION_POINTS; static final String XML_FILE_KETTLE_REGISTRY_EXTENSIONS; static final String XML_FILE_KETTLE_LIFECYCLE_LISTENERS; static final String XML_FILE_KETTLE_ENGINES; static final String KETTLE_TRANS_PAN_JVM_EXIT_CODE; static final String KETTLE_DEFAULT_NUMBER_FORMAT; static final String KETTLE_DEFAULT_BIGNUMBER_FORMAT; static final String KETTLE_DEFAULT_INTEGER_FORMAT; static final String KETTLE_DEFAULT_DATE_FORMAT; static final String KETTLE_AGGREGATION_MIN_NULL_IS_VALUED; static final String KETTLE_AGGREGATION_ALL_NULLS_ARE_ZERO; static final String KETTLE_DEFAULT_TIMESTAMP_FORMAT; static final String KETTLE_SPLIT_FIELDS_REMOVE_ENCLOSURE; static final String KETTLE_GLOBAL_LOG_VARIABLES_CLEAR_ON_EXPORT; static final String KETTLE_COMPATIBILITY_CALCULATION_TIMEZONE_DECOMPOSITION; static final String KETTLE_COMPATIBILITY_SET_ERROR_ON_SPECIFIC_JOB_ENTRIES; static final String KETTLE_COMPATIBILITY_SEND_RESULT_XML_WITH_FULL_STATUS; static final String KETTLE_COMPATIBILITY_SELECT_VALUES_TYPE_CHANGE_USES_TYPE_DEFAULTS; static final String XML_FILE_KETTLE_IMPORT_RULES; static final ReleaseType RELEASE; static final String PENTAHO_METASTORE_FOLDER; static final String PENTAHO_METASTORE_NAME; static final String KETTLE_LOG_MARK_MAPPINGS; static final String KETTLE_CARTE_JETTY_ACCEPTORS; static final String KETTLE_CARTE_JETTY_ACCEPT_QUEUE_SIZE; static final String KETTLE_CARTE_JETTY_RES_MAX_IDLE_TIME; static final String VFS_USER_DIR_IS_ROOT; }
@Test public void testSplitPath() { String[] a = Const.splitPath( "", "/" ); assertEquals( 0, a.length ); a = Const.splitPath( null, "/" ); assertEquals( 0, a.length ); a = Const.splitPath( "/", "/" ); assertEquals( 0, a.length ); a = Const.splitPath( "/level1", "/" ); assertEquals( 1, a.length ); assertEquals( "level1", a[0] ); a = Const.splitPath( "level1", "/" ); assertEquals( 1, a.length ); assertEquals( "level1", a[0] ); a = Const.splitPath( "/level1/level2", "/" ); assertEquals( 2, a.length ); assertEquals( "level1", a[0] ); assertEquals( "level2", a[1] ); a = Const.splitPath( "level1/level2", "/" ); assertEquals( 2, a.length ); assertEquals( "level1", a[0] ); assertEquals( "level2", a[1] ); a = Const.splitPath( "/level1/level2/lvl3", "/" ); assertEquals( 3, a.length ); assertEquals( "level1", a[0] ); assertEquals( "level2", a[1] ); assertEquals( "lvl3", a[2] ); a = Const.splitPath( "level1/level2/lvl3", "/" ); assertEquals( 3, a.length ); assertEquals( "level1", a[0] ); assertEquals( "level2", a[1] ); assertEquals( "lvl3", a[2] ); }
public static String[] splitPath( String path, String separator ) { if ( path == null || path.length() == 0 || path.equals( separator ) ) { return new String[] {}; } while ( path.endsWith( separator ) ) { path = path.substring( 0, path.length() - 1 ); } int sepLen = separator.length(); int nr_separators = 1; int from = path.startsWith( separator ) ? sepLen : 0; for ( int i = from; i < path.length(); i += sepLen ) { if ( path.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { nr_separators++; } } String[] spath = new String[nr_separators]; int nr = 0; for ( int i = from; i < path.length(); i += sepLen ) { if ( path.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { spath[nr] = path.substring( from, i ); nr++; from = i + sepLen; } } if ( nr < spath.length ) { spath[nr] = path.substring( from ); } if ( spath.length == 0 && path.length() > 0 ) { spath = new String[] { path }; } return spath; }
Const { public static String[] splitPath( String path, String separator ) { if ( path == null || path.length() == 0 || path.equals( separator ) ) { return new String[] {}; } while ( path.endsWith( separator ) ) { path = path.substring( 0, path.length() - 1 ); } int sepLen = separator.length(); int nr_separators = 1; int from = path.startsWith( separator ) ? sepLen : 0; for ( int i = from; i < path.length(); i += sepLen ) { if ( path.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { nr_separators++; } } String[] spath = new String[nr_separators]; int nr = 0; for ( int i = from; i < path.length(); i += sepLen ) { if ( path.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { spath[nr] = path.substring( from, i ); nr++; from = i + sepLen; } } if ( nr < spath.length ) { spath[nr] = path.substring( from ); } if ( spath.length == 0 && path.length() > 0 ) { spath = new String[] { path }; } return spath; } }
Const { public static String[] splitPath( String path, String separator ) { if ( path == null || path.length() == 0 || path.equals( separator ) ) { return new String[] {}; } while ( path.endsWith( separator ) ) { path = path.substring( 0, path.length() - 1 ); } int sepLen = separator.length(); int nr_separators = 1; int from = path.startsWith( separator ) ? sepLen : 0; for ( int i = from; i < path.length(); i += sepLen ) { if ( path.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { nr_separators++; } } String[] spath = new String[nr_separators]; int nr = 0; for ( int i = from; i < path.length(); i += sepLen ) { if ( path.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { spath[nr] = path.substring( from, i ); nr++; from = i + sepLen; } } if ( nr < spath.length ) { spath[nr] = path.substring( from ); } if ( spath.length == 0 && path.length() > 0 ) { spath = new String[] { path }; } return spath; } }
Const { public static String[] splitPath( String path, String separator ) { if ( path == null || path.length() == 0 || path.equals( separator ) ) { return new String[] {}; } while ( path.endsWith( separator ) ) { path = path.substring( 0, path.length() - 1 ); } int sepLen = separator.length(); int nr_separators = 1; int from = path.startsWith( separator ) ? sepLen : 0; for ( int i = from; i < path.length(); i += sepLen ) { if ( path.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { nr_separators++; } } String[] spath = new String[nr_separators]; int nr = 0; for ( int i = from; i < path.length(); i += sepLen ) { if ( path.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { spath[nr] = path.substring( from, i ); nr++; from = i + sepLen; } } if ( nr < spath.length ) { spath[nr] = path.substring( from ); } if ( spath.length == 0 && path.length() > 0 ) { spath = new String[] { path }; } return spath; } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); }
Const { public static String[] splitPath( String path, String separator ) { if ( path == null || path.length() == 0 || path.equals( separator ) ) { return new String[] {}; } while ( path.endsWith( separator ) ) { path = path.substring( 0, path.length() - 1 ); } int sepLen = separator.length(); int nr_separators = 1; int from = path.startsWith( separator ) ? sepLen : 0; for ( int i = from; i < path.length(); i += sepLen ) { if ( path.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { nr_separators++; } } String[] spath = new String[nr_separators]; int nr = 0; for ( int i = from; i < path.length(); i += sepLen ) { if ( path.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) { spath[nr] = path.substring( from, i ); nr++; from = i + sepLen; } } if ( nr < spath.length ) { spath[nr] = path.substring( from ); } if ( spath.length == 0 && path.length() > 0 ) { spath = new String[] { path }; } return spath; } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); @Deprecated static final String VERSION; static final String COPYRIGHT_YEAR; static final int TIMEOUT_GET_MILLIS; static final int TIMEOUT_PUT_MILLIS; static final int ROWS_UPDATE; static final int ROWS_IN_ROWSET; static final int FETCH_SIZE; static final int SORT_SIZE; static final int HEARTBEAT_PERIODIC_INTERVAL_IN_SECS; static final String FILE_SEPARATOR; static final String PATH_SEPARATOR; static final String CR; static final String DOSCR; static final String EMPTY_STRING; static final String JAVA_VERSION; @Deprecated static final String USER_HOME_DIRECTORY; static String JNDI_DIRECTORY; static final String PLUGIN_BASE_FOLDERS_PROP; static final String DEFAULT_PLUGIN_BASE_FOLDERS; static final Date MIN_DATE; static final Date MAX_DATE; static final int MIN_YEAR; static final int MAX_YEAR; static final int RIGHT; static final int LENGTH; static final int MARGIN; static final int MIDDLE_PCT; static final int ARROW_WIDTH; static final int FORM_MARGIN; static final int SHADOW_SIZE; static final int SYMBOLSIZE; static final int MAX_FILE_HIST; static final Locale DEFAULT_LOCALE; static final char DEFAULT_DECIMAL_SEPARATOR; static final char DEFAULT_GROUPING_SEPARATOR; static final String DEFAULT_CURRENCY_SYMBOL; static final String DEFAULT_NUMBER_FORMAT; static final String NULL_STRING; static final String NULL_NUMBER; static final String NULL_DATE; static final String NULL_BIGNUMBER; static final String NULL_BOOLEAN; static final String NULL_INTEGER; static final String NULL_BINARY; static final String NULL_NONE; static final int ROUND_HALF_CEILING; static final String CHEF_LOG_FILE; static final String SPOON_LOG_FILE; static final String MENU_LOG_FILE; static final String GENERALIZED_DATE_TIME_FORMAT; static final String GENERALIZED_DATE_TIME_FORMAT_MILLIS; static final String XML_ENCODING; static final String[] STRING_TRANS_AND_JOB_FILTER_EXT; static final String STRING_TRANS_DEFAULT_EXT; static final String[] STRING_TRANS_FILTER_EXT; static final String STRING_JOB_DEFAULT_EXT; static final String[] STRING_JOB_FILTER_EXT; static final String KETTLE_PROPERTIES; static final String SHARED_DATA_FILE; static final String INTERNAL_VARIABLE_PREFIX; static final String INTERNAL_VARIABLE_KETTLE_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_DATE; static final String INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_FILENAME_NAME; static final String INTERNAL_VARIABLE_JOB_NAME; static final String INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_RUN_ID; static final String INTERNAL_VARIABLE_JOB_RUN_ATTEMPTNR; static final String VARIABLE_HEARTBEAT_PERIODIC_INTERVAL_SECS; static final String VARIABLE_MONITORING_SNMP_TRAPS_ENABLED; static final String INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY; static final String[] INTERNAL_TRANS_VARIABLES; static final String[] INTERNAL_JOB_VARIABLES; static final String[] DEPRECATED_VARIABLES; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_STEP_PARTITION_ID; static final String INTERNAL_VARIABLE_STEP_PARTITION_NR; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NUMBER; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NAME; static final String INTERNAL_VARIABLE_CLUSTER_SIZE; static final String INTERNAL_VARIABLE_STEP_UNIQUE_NUMBER; static final String INTERNAL_VARIABLE_CLUSTER_MASTER; static final String INTERNAL_VARIABLE_CLUSTER_RUN_ID; static final String INTERNAL_VARIABLE_STEP_UNIQUE_COUNT; static final String INTERNAL_VARIABLE_STEP_NAME; static final String INTERNAL_VARIABLE_STEP_COPYNR; static final int MAX_NR_LOG_LINES; static final int MAX_NR_HISTORY_LINES; static final int HISTORY_LINES_FETCH_SIZE; static final int MAX_LOG_LINE_TIMEOUT_MINUTES; static final int WARNING; static final int ERROR; static final int INFO; static final int NOTE_MARGIN; static final int MAX_UNDO; static final String KETTLE_VARIABLES_FILE; static final String KETTLE_LOG_SIZE_LIMIT; static final String KETTLE_TRANS_LOG_DB; static final String KETTLE_TRANS_LOG_SCHEMA; static final String KETTLE_TRANS_LOG_TABLE; static final String KETTLE_JOB_LOG_DB; static final String KETTLE_JOB_LOG_SCHEMA; static final String KETTLE_SLAVE_DETECTION_TIMER; static final String KETTLE_JOB_LOG_TABLE; static final String KETTLE_TRANS_PERFORMANCE_LOG_DB; static final String KETTLE_TRANS_PERFORMANCE_LOG_SCHEMA; static final String KETTLE_TRANS_PERFORMANCE_LOG_TABLE; static final String KETTLE_JOBENTRY_LOG_DB; static final String KETTLE_JOBENTRY_LOG_SCHEMA; static final String KETTLE_JOBENTRY_LOG_TABLE; static final String KETTLE_STEP_LOG_DB; static final String KETTLE_STEP_LOG_SCHEMA; static final String KETTLE_STEP_LOG_TABLE; static final String KETTLE_CHANNEL_LOG_DB; static final String KETTLE_CHANNEL_LOG_SCHEMA; static final String KETTLE_CHANNEL_LOG_TABLE; static final String KETTLE_METRICS_LOG_DB; static final String KETTLE_METRICS_LOG_SCHEMA; static final String KETTLE_METRICS_LOG_TABLE; static final String KETTLE_CHECKPOINT_LOG_DB; static final String KETTLE_CHECKPOINT_LOG_SCHEMA; static final String KETTLE_CHECKPOINT_LOG_TABLE; static final String KETTLE_SHARED_OBJECTS; static final String KETTLE_EMPTY_STRING_DIFFERS_FROM_NULL; static final String KETTLE_LENIENT_STRING_TO_NUMBER_CONVERSION; static final String KETTLE_COMPATIBILITY_DB_IGNORE_TIMEZONE; static final String KETTLE_COMPATIBILITY_IMPORT_PATH_ADDITION_ON_VARIABLES; static final String KETTLE_COMPATIBILITY_IGNORE_TABLE_LOGGING; static final String KETTLE_COMPATIBILITY_TEXT_FILE_OUTPUT_APPEND_NO_HEADER; static final String KETTLE_COMPATIBILITY_MERGE_ROWS_USE_REFERENCE_STREAM_WHEN_IDENTICAL; static final String KETTLE_COMPATIBILITY_MEMORY_GROUP_BY_SUM_AVERAGE_RETURN_NUMBER_TYPE; static final String KETTLE_SYSTEM_HOSTNAME; static final String KETTLE_MAX_LOG_SIZE_IN_LINES; static final String KETTLE_MAX_LOG_TIMEOUT_IN_MINUTES; static final String KETTLE_REDIRECT_STDERR; static final String KETTLE_REDIRECT_STDOUT; static final String KETTLE_CARTE_OBJECT_TIMEOUT_MINUTES; static final String KETTLE_STEP_PERFORMANCE_SNAPSHOT_LIMIT; static final String KETTLE_MAX_JOB_TRACKER_SIZE; static final String KETTLE_MAX_JOB_ENTRIES_LOGGED; static final String KETTLE_MAX_LOGGING_REGISTRY_SIZE; static final String KETTLE_LOG_TAB_REFRESH_DELAY; static final String KETTLE_LOG_TAB_REFRESH_PERIOD; static final String KETTLE_SAP_CONNECTION_FACTORY; static final String KETTLE_SAP_CONNECTION_FACTORY_DEFAULT_NAME; static final String KETTLE_PLUGIN_CLASSES; static final String KETTLE_PLUGIN_PACKAGES; static final String KETTLE_TRANS_ROWSET_SIZE; static final String VERSION_COMMENT_INITIAL_VERSION; static final String VERSION_COMMENT_EDIT_VERSION; static final String XML_FILE_KETTLE_STEPS; static final String KETTLE_CORE_STEPS_FILE; static final String XML_FILE_KETTLE_PARTITION_PLUGINS; static final String KETTLE_CORE_JOBENTRIES_FILE; static final String XML_FILE_KETTLE_SERVLETS; static final String XML_FILE_KETTLE_VALUEMETA_PLUGINS; static final String XML_FILE_KETTLE_PASSWORD_ENCODER_PLUGINS; static final String KETTLE_VALUEMETA_PLUGINS_FILE; static final String KETTLE_PASSWORD_ENCODER_PLUGIN; static final String KETTLE_PASSWORD_ENCODER_PLUGINS_FILE; static final String KETTLE_TWO_WAY_PASSWORD_ENCODER_SEED; static final String XML_FILE_KETTLE_LOGGING_PLUGINS; static final String KETTLE_LOGGING_PLUGINS_FILE; static final String KETTLE_CORE_SERVLETS_FILE; static final String KETTLE_ROWSET_GET_TIMEOUT; static final String KETTLE_ROWSET_PUT_TIMEOUT; static final String KETTLE_BATCHING_ROWSET; static final String KETTLE_DISABLE_CONSOLE_LOGGING; static final String XML_FILE_KETTLE_JOB_ENTRIES; static final String XML_FILE_KETTLE_REPOSITORIES; static final String XML_FILE_KETTLE_DATABASE_TYPES; static final String XML_FILE_KETTLE_COMPRESSION_PROVIDERS; static final String XML_FILE_KETTLE_AUTHENTICATION_PROVIDERS; static final String XML_FILE_KETTLE_EXTENSION_POINTS; static final String XML_FILE_KETTLE_REGISTRY_EXTENSIONS; static final String XML_FILE_KETTLE_LIFECYCLE_LISTENERS; static final String XML_FILE_KETTLE_ENGINES; static final String KETTLE_TRANS_PAN_JVM_EXIT_CODE; static final String KETTLE_DEFAULT_NUMBER_FORMAT; static final String KETTLE_DEFAULT_BIGNUMBER_FORMAT; static final String KETTLE_DEFAULT_INTEGER_FORMAT; static final String KETTLE_DEFAULT_DATE_FORMAT; static final String KETTLE_AGGREGATION_MIN_NULL_IS_VALUED; static final String KETTLE_AGGREGATION_ALL_NULLS_ARE_ZERO; static final String KETTLE_DEFAULT_TIMESTAMP_FORMAT; static final String KETTLE_SPLIT_FIELDS_REMOVE_ENCLOSURE; static final String KETTLE_GLOBAL_LOG_VARIABLES_CLEAR_ON_EXPORT; static final String KETTLE_COMPATIBILITY_CALCULATION_TIMEZONE_DECOMPOSITION; static final String KETTLE_COMPATIBILITY_SET_ERROR_ON_SPECIFIC_JOB_ENTRIES; static final String KETTLE_COMPATIBILITY_SEND_RESULT_XML_WITH_FULL_STATUS; static final String KETTLE_COMPATIBILITY_SELECT_VALUES_TYPE_CHANGE_USES_TYPE_DEFAULTS; static final String XML_FILE_KETTLE_IMPORT_RULES; static final ReleaseType RELEASE; static final String PENTAHO_METASTORE_FOLDER; static final String PENTAHO_METASTORE_NAME; static final String KETTLE_LOG_MARK_MAPPINGS; static final String KETTLE_CARTE_JETTY_ACCEPTORS; static final String KETTLE_CARTE_JETTY_ACCEPT_QUEUE_SIZE; static final String KETTLE_CARTE_JETTY_RES_MAX_IDLE_TIME; static final String VFS_USER_DIR_IS_ROOT; }
@Test public void testRound_BigDecimal() { assertEquals( new BigDecimal( "1.0" ), Const.round( new BigDecimal( "1.0" ), 0, BigDecimal.ROUND_UP ) ); assertEquals( new BigDecimal( "1.0" ), Const.round( new BigDecimal( "1.0" ), 0, BigDecimal.ROUND_DOWN ) ); assertEquals( new BigDecimal( "1.0" ), Const.round( new BigDecimal( "1.0" ), 0, BigDecimal.ROUND_CEILING ) ); assertEquals( new BigDecimal( "1.0" ), Const.round( new BigDecimal( "1.0" ), 0, BigDecimal.ROUND_FLOOR ) ); assertEquals( new BigDecimal( "1.0" ), Const.round( new BigDecimal( "1.0" ), 0, BigDecimal.ROUND_HALF_UP ) ); assertEquals( new BigDecimal( "1.0" ), Const.round( new BigDecimal( "1.0" ), 0, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( new BigDecimal( "1.0" ), Const.round( new BigDecimal( "1.0" ), 0, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( new BigDecimal( "1.0" ), Const.round( new BigDecimal( "1.0" ), 0, Const.ROUND_HALF_CEILING ) ); assertEquals( new BigDecimal( "2.0" ), Const.round( new BigDecimal( "1.2" ), 0, BigDecimal.ROUND_UP ) ); assertEquals( new BigDecimal( "1.0" ), Const.round( new BigDecimal( "1.2" ), 0, BigDecimal.ROUND_DOWN ) ); assertEquals( new BigDecimal( "2.0" ), Const.round( new BigDecimal( "1.2" ), 0, BigDecimal.ROUND_CEILING ) ); assertEquals( new BigDecimal( "1.0" ), Const.round( new BigDecimal( "1.2" ), 0, BigDecimal.ROUND_FLOOR ) ); assertEquals( new BigDecimal( "1.0" ), Const.round( new BigDecimal( "1.2" ), 0, BigDecimal.ROUND_HALF_UP ) ); assertEquals( new BigDecimal( "1.0" ), Const.round( new BigDecimal( "1.2" ), 0, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( new BigDecimal( "1.0" ), Const.round( new BigDecimal( "1.2" ), 0, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( new BigDecimal( "1.0" ), Const.round( new BigDecimal( "1.2" ), 0, Const.ROUND_HALF_CEILING ) ); assertEquals( new BigDecimal( "2.0" ), Const.round( new BigDecimal( "1.5" ), 0, BigDecimal.ROUND_UP ) ); assertEquals( new BigDecimal( "1.0" ), Const.round( new BigDecimal( "1.5" ), 0, BigDecimal.ROUND_DOWN ) ); assertEquals( new BigDecimal( "2.0" ), Const.round( new BigDecimal( "1.5" ), 0, BigDecimal.ROUND_CEILING ) ); assertEquals( new BigDecimal( "1.0" ), Const.round( new BigDecimal( "1.5" ), 0, BigDecimal.ROUND_FLOOR ) ); assertEquals( new BigDecimal( "2.0" ), Const.round( new BigDecimal( "1.5" ), 0, BigDecimal.ROUND_HALF_UP ) ); assertEquals( new BigDecimal( "1.0" ), Const.round( new BigDecimal( "1.5" ), 0, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( new BigDecimal( "2.0" ), Const.round( new BigDecimal( "1.5" ), 0, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( new BigDecimal( "2.0" ), Const.round( new BigDecimal( "1.5" ), 0, Const.ROUND_HALF_CEILING ) ); assertEquals( new BigDecimal( "2.0" ), Const.round( new BigDecimal( "1.7" ), 0, BigDecimal.ROUND_UP ) ); assertEquals( new BigDecimal( "1.0" ), Const.round( new BigDecimal( "1.7" ), 0, BigDecimal.ROUND_DOWN ) ); assertEquals( new BigDecimal( "2.0" ), Const.round( new BigDecimal( "1.7" ), 0, BigDecimal.ROUND_CEILING ) ); assertEquals( new BigDecimal( "1.0" ), Const.round( new BigDecimal( "1.7" ), 0, BigDecimal.ROUND_FLOOR ) ); assertEquals( new BigDecimal( "2.0" ), Const.round( new BigDecimal( "1.7" ), 0, BigDecimal.ROUND_HALF_UP ) ); assertEquals( new BigDecimal( "2.0" ), Const.round( new BigDecimal( "1.7" ), 0, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( new BigDecimal( "2.0" ), Const.round( new BigDecimal( "1.7" ), 0, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( new BigDecimal( "2.0" ), Const.round( new BigDecimal( "1.7" ), 0, Const.ROUND_HALF_CEILING ) ); assertEquals( new BigDecimal( "2.0" ), Const.round( new BigDecimal( "2.0" ), 0, BigDecimal.ROUND_UP ) ); assertEquals( new BigDecimal( "2.0" ), Const.round( new BigDecimal( "2.0" ), 0, BigDecimal.ROUND_DOWN ) ); assertEquals( new BigDecimal( "2.0" ), Const.round( new BigDecimal( "2.0" ), 0, BigDecimal.ROUND_CEILING ) ); assertEquals( new BigDecimal( "2.0" ), Const.round( new BigDecimal( "2.0" ), 0, BigDecimal.ROUND_FLOOR ) ); assertEquals( new BigDecimal( "2.0" ), Const.round( new BigDecimal( "2.0" ), 0, BigDecimal.ROUND_HALF_UP ) ); assertEquals( new BigDecimal( "2.0" ), Const.round( new BigDecimal( "2.0" ), 0, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( new BigDecimal( "2.0" ), Const.round( new BigDecimal( "2.0" ), 0, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( new BigDecimal( "2.0" ), Const.round( new BigDecimal( "2.0" ), 0, Const.ROUND_HALF_CEILING ) ); assertEquals( new BigDecimal( "3.0" ), Const.round( new BigDecimal( "2.2" ), 0, BigDecimal.ROUND_UP ) ); assertEquals( new BigDecimal( "2.0" ), Const.round( new BigDecimal( "2.2" ), 0, BigDecimal.ROUND_DOWN ) ); assertEquals( new BigDecimal( "3.0" ), Const.round( new BigDecimal( "2.2" ), 0, BigDecimal.ROUND_CEILING ) ); assertEquals( new BigDecimal( "2.0" ), Const.round( new BigDecimal( "2.2" ), 0, BigDecimal.ROUND_FLOOR ) ); assertEquals( new BigDecimal( "2.0" ), Const.round( new BigDecimal( "2.2" ), 0, BigDecimal.ROUND_HALF_UP ) ); assertEquals( new BigDecimal( "2.0" ), Const.round( new BigDecimal( "2.2" ), 0, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( new BigDecimal( "2.0" ), Const.round( new BigDecimal( "2.2" ), 0, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( new BigDecimal( "2.0" ), Const.round( new BigDecimal( "2.2" ), 0, Const.ROUND_HALF_CEILING ) ); assertEquals( new BigDecimal( "3.0" ), Const.round( new BigDecimal( "2.5" ), 0, BigDecimal.ROUND_UP ) ); assertEquals( new BigDecimal( "2.0" ), Const.round( new BigDecimal( "2.5" ), 0, BigDecimal.ROUND_DOWN ) ); assertEquals( new BigDecimal( "3.0" ), Const.round( new BigDecimal( "2.5" ), 0, BigDecimal.ROUND_CEILING ) ); assertEquals( new BigDecimal( "2.0" ), Const.round( new BigDecimal( "2.5" ), 0, BigDecimal.ROUND_FLOOR ) ); assertEquals( new BigDecimal( "3.0" ), Const.round( new BigDecimal( "2.5" ), 0, BigDecimal.ROUND_HALF_UP ) ); assertEquals( new BigDecimal( "2.0" ), Const.round( new BigDecimal( "2.5" ), 0, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( new BigDecimal( "2.0" ), Const.round( new BigDecimal( "2.5" ), 0, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( new BigDecimal( "3.0" ), Const.round( new BigDecimal( "2.5" ), 0, Const.ROUND_HALF_CEILING ) ); assertEquals( new BigDecimal( "3.0" ), Const.round( new BigDecimal( "2.7" ), 0, BigDecimal.ROUND_UP ) ); assertEquals( new BigDecimal( "2.0" ), Const.round( new BigDecimal( "2.7" ), 0, BigDecimal.ROUND_DOWN ) ); assertEquals( new BigDecimal( "3.0" ), Const.round( new BigDecimal( "2.7" ), 0, BigDecimal.ROUND_CEILING ) ); assertEquals( new BigDecimal( "2.0" ), Const.round( new BigDecimal( "2.7" ), 0, BigDecimal.ROUND_FLOOR ) ); assertEquals( new BigDecimal( "3.0" ), Const.round( new BigDecimal( "2.7" ), 0, BigDecimal.ROUND_HALF_UP ) ); assertEquals( new BigDecimal( "3.0" ), Const.round( new BigDecimal( "2.7" ), 0, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( new BigDecimal( "3.0" ), Const.round( new BigDecimal( "2.7" ), 0, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( new BigDecimal( "3.0" ), Const.round( new BigDecimal( "2.7" ), 0, Const.ROUND_HALF_CEILING ) ); assertEquals( new BigDecimal( "-1.0" ), Const.round( new BigDecimal( "-1.0" ), 0, BigDecimal.ROUND_UP ) ); assertEquals( new BigDecimal( "-1.0" ), Const.round( new BigDecimal( "-1.0" ), 0, BigDecimal.ROUND_DOWN ) ); assertEquals( new BigDecimal( "-1.0" ), Const.round( new BigDecimal( "-1.0" ), 0, BigDecimal.ROUND_CEILING ) ); assertEquals( new BigDecimal( "-1.0" ), Const.round( new BigDecimal( "-1.0" ), 0, BigDecimal.ROUND_FLOOR ) ); assertEquals( new BigDecimal( "-1.0" ), Const.round( new BigDecimal( "-1.0" ), 0, BigDecimal.ROUND_HALF_UP ) ); assertEquals( new BigDecimal( "-1.0" ), Const.round( new BigDecimal( "-1.0" ), 0, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( new BigDecimal( "-1.0" ), Const.round( new BigDecimal( "-1.0" ), 0, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( new BigDecimal( "-1.0" ), Const.round( new BigDecimal( "-1.0" ), 0, Const.ROUND_HALF_CEILING ) ); assertEquals( new BigDecimal( "-2.0" ), Const.round( new BigDecimal( "-1.2" ), 0, BigDecimal.ROUND_UP ) ); assertEquals( new BigDecimal( "-1.0" ), Const.round( new BigDecimal( "-1.2" ), 0, BigDecimal.ROUND_DOWN ) ); assertEquals( new BigDecimal( "-1.0" ), Const.round( new BigDecimal( "-1.2" ), 0, BigDecimal.ROUND_CEILING ) ); assertEquals( new BigDecimal( "-2.0" ), Const.round( new BigDecimal( "-1.2" ), 0, BigDecimal.ROUND_FLOOR ) ); assertEquals( new BigDecimal( "-1.0" ), Const.round( new BigDecimal( "-1.2" ), 0, BigDecimal.ROUND_HALF_UP ) ); assertEquals( new BigDecimal( "-1.0" ), Const.round( new BigDecimal( "-1.2" ), 0, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( new BigDecimal( "-1.0" ), Const.round( new BigDecimal( "-1.2" ), 0, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( new BigDecimal( "-1.0" ), Const.round( new BigDecimal( "-1.2" ), 0, Const.ROUND_HALF_CEILING ) ); assertEquals( new BigDecimal( "-2.0" ), Const.round( new BigDecimal( "-1.5" ), 0, BigDecimal.ROUND_UP ) ); assertEquals( new BigDecimal( "-1.0" ), Const.round( new BigDecimal( "-1.5" ), 0, BigDecimal.ROUND_DOWN ) ); assertEquals( new BigDecimal( "-1.0" ), Const.round( new BigDecimal( "-1.5" ), 0, BigDecimal.ROUND_CEILING ) ); assertEquals( new BigDecimal( "-2.0" ), Const.round( new BigDecimal( "-1.5" ), 0, BigDecimal.ROUND_FLOOR ) ); assertEquals( new BigDecimal( "-2.0" ), Const.round( new BigDecimal( "-1.5" ), 0, BigDecimal.ROUND_HALF_UP ) ); assertEquals( new BigDecimal( "-1.0" ), Const.round( new BigDecimal( "-1.5" ), 0, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( new BigDecimal( "-2.0" ), Const.round( new BigDecimal( "-1.5" ), 0, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( new BigDecimal( "-1.0" ), Const.round( new BigDecimal( "-1.5" ), 0, Const.ROUND_HALF_CEILING ) ); assertEquals( new BigDecimal( "-2.0" ), Const.round( new BigDecimal( "-1.7" ), 0, BigDecimal.ROUND_UP ) ); assertEquals( new BigDecimal( "-1.0" ), Const.round( new BigDecimal( "-1.7" ), 0, BigDecimal.ROUND_DOWN ) ); assertEquals( new BigDecimal( "-1.0" ), Const.round( new BigDecimal( "-1.7" ), 0, BigDecimal.ROUND_CEILING ) ); assertEquals( new BigDecimal( "-2.0" ), Const.round( new BigDecimal( "-1.7" ), 0, BigDecimal.ROUND_FLOOR ) ); assertEquals( new BigDecimal( "-2.0" ), Const.round( new BigDecimal( "-1.7" ), 0, BigDecimal.ROUND_HALF_UP ) ); assertEquals( new BigDecimal( "-2.0" ), Const.round( new BigDecimal( "-1.7" ), 0, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( new BigDecimal( "-2.0" ), Const.round( new BigDecimal( "-1.7" ), 0, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( new BigDecimal( "-2.0" ), Const.round( new BigDecimal( "-1.7" ), 0, Const.ROUND_HALF_CEILING ) ); assertEquals( new BigDecimal( "-2.0" ), Const.round( new BigDecimal( "-2.0" ), 0, BigDecimal.ROUND_UP ) ); assertEquals( new BigDecimal( "-2.0" ), Const.round( new BigDecimal( "-2.0" ), 0, BigDecimal.ROUND_DOWN ) ); assertEquals( new BigDecimal( "-2.0" ), Const.round( new BigDecimal( "-2.0" ), 0, BigDecimal.ROUND_CEILING ) ); assertEquals( new BigDecimal( "-2.0" ), Const.round( new BigDecimal( "-2.0" ), 0, BigDecimal.ROUND_FLOOR ) ); assertEquals( new BigDecimal( "-2.0" ), Const.round( new BigDecimal( "-2.0" ), 0, BigDecimal.ROUND_HALF_UP ) ); assertEquals( new BigDecimal( "-2.0" ), Const.round( new BigDecimal( "-2.0" ), 0, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( new BigDecimal( "-2.0" ), Const.round( new BigDecimal( "-2.0" ), 0, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( new BigDecimal( "-2.0" ), Const.round( new BigDecimal( "-2.0" ), 0, Const.ROUND_HALF_CEILING ) ); assertEquals( new BigDecimal( "-3.0" ), Const.round( new BigDecimal( "-2.2" ), 0, BigDecimal.ROUND_UP ) ); assertEquals( new BigDecimal( "-2.0" ), Const.round( new BigDecimal( "-2.2" ), 0, BigDecimal.ROUND_DOWN ) ); assertEquals( new BigDecimal( "-2.0" ), Const.round( new BigDecimal( "-2.2" ), 0, BigDecimal.ROUND_CEILING ) ); assertEquals( new BigDecimal( "-3.0" ), Const.round( new BigDecimal( "-2.2" ), 0, BigDecimal.ROUND_FLOOR ) ); assertEquals( new BigDecimal( "-2.0" ), Const.round( new BigDecimal( "-2.2" ), 0, BigDecimal.ROUND_HALF_UP ) ); assertEquals( new BigDecimal( "-2.0" ), Const.round( new BigDecimal( "-2.2" ), 0, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( new BigDecimal( "-2.0" ), Const.round( new BigDecimal( "-2.2" ), 0, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( new BigDecimal( "-2.0" ), Const.round( new BigDecimal( "-2.2" ), 0, Const.ROUND_HALF_CEILING ) ); assertEquals( new BigDecimal( "-3.0" ), Const.round( new BigDecimal( "-2.5" ), 0, BigDecimal.ROUND_UP ) ); assertEquals( new BigDecimal( "-2.0" ), Const.round( new BigDecimal( "-2.5" ), 0, BigDecimal.ROUND_DOWN ) ); assertEquals( new BigDecimal( "-2.0" ), Const.round( new BigDecimal( "-2.5" ), 0, BigDecimal.ROUND_CEILING ) ); assertEquals( new BigDecimal( "-3.0" ), Const.round( new BigDecimal( "-2.5" ), 0, BigDecimal.ROUND_FLOOR ) ); assertEquals( new BigDecimal( "-3.0" ), Const.round( new BigDecimal( "-2.5" ), 0, BigDecimal.ROUND_HALF_UP ) ); assertEquals( new BigDecimal( "-2.0" ), Const.round( new BigDecimal( "-2.5" ), 0, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( new BigDecimal( "-2.0" ), Const.round( new BigDecimal( "-2.5" ), 0, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( new BigDecimal( "-2.0" ), Const.round( new BigDecimal( "-2.5" ), 0, Const.ROUND_HALF_CEILING ) ); assertEquals( new BigDecimal( "-3.0" ), Const.round( new BigDecimal( "-2.7" ), 0, BigDecimal.ROUND_UP ) ); assertEquals( new BigDecimal( "-2.0" ), Const.round( new BigDecimal( "-2.7" ), 0, BigDecimal.ROUND_DOWN ) ); assertEquals( new BigDecimal( "-2.0" ), Const.round( new BigDecimal( "-2.7" ), 0, BigDecimal.ROUND_CEILING ) ); assertEquals( new BigDecimal( "-3.0" ), Const.round( new BigDecimal( "-2.7" ), 0, BigDecimal.ROUND_FLOOR ) ); assertEquals( new BigDecimal( "-3.0" ), Const.round( new BigDecimal( "-2.7" ), 0, BigDecimal.ROUND_HALF_UP ) ); assertEquals( new BigDecimal( "-3.0" ), Const.round( new BigDecimal( "-2.7" ), 0, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( new BigDecimal( "-3.0" ), Const.round( new BigDecimal( "-2.7" ), 0, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( new BigDecimal( "-3.0" ), Const.round( new BigDecimal( "-2.7" ), 0, Const.ROUND_HALF_CEILING ) ); assertEquals( new BigDecimal( "0.010" ), Const.round( new BigDecimal( "0.010" ), 2, BigDecimal.ROUND_UP ) ); assertEquals( new BigDecimal( "0.010" ), Const.round( new BigDecimal( "0.010" ), 2, BigDecimal.ROUND_DOWN ) ); assertEquals( new BigDecimal( "0.010" ), Const.round( new BigDecimal( "0.010" ), 2, BigDecimal.ROUND_CEILING ) ); assertEquals( new BigDecimal( "0.010" ), Const.round( new BigDecimal( "0.010" ), 2, BigDecimal.ROUND_FLOOR ) ); assertEquals( new BigDecimal( "0.010" ), Const.round( new BigDecimal( "0.010" ), 2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( new BigDecimal( "0.010" ), Const.round( new BigDecimal( "0.010" ), 2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( new BigDecimal( "0.010" ), Const.round( new BigDecimal( "0.010" ), 2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( new BigDecimal( "0.010" ), Const.round( new BigDecimal( "0.010" ), 2, Const.ROUND_HALF_CEILING ) ); assertEquals( new BigDecimal( "0.020" ), Const.round( new BigDecimal( "0.012" ), 2, BigDecimal.ROUND_UP ) ); assertEquals( new BigDecimal( "0.010" ), Const.round( new BigDecimal( "0.012" ), 2, BigDecimal.ROUND_DOWN ) ); assertEquals( new BigDecimal( "0.020" ), Const.round( new BigDecimal( "0.012" ), 2, BigDecimal.ROUND_CEILING ) ); assertEquals( new BigDecimal( "0.010" ), Const.round( new BigDecimal( "0.012" ), 2, BigDecimal.ROUND_FLOOR ) ); assertEquals( new BigDecimal( "0.010" ), Const.round( new BigDecimal( "0.012" ), 2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( new BigDecimal( "0.010" ), Const.round( new BigDecimal( "0.012" ), 2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( new BigDecimal( "0.010" ), Const.round( new BigDecimal( "0.012" ), 2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( new BigDecimal( "0.010" ), Const.round( new BigDecimal( "0.012" ), 2, Const.ROUND_HALF_CEILING ) ); assertEquals( new BigDecimal( "0.020" ), Const.round( new BigDecimal( "0.015" ), 2, BigDecimal.ROUND_UP ) ); assertEquals( new BigDecimal( "0.010" ), Const.round( new BigDecimal( "0.015" ), 2, BigDecimal.ROUND_DOWN ) ); assertEquals( new BigDecimal( "0.020" ), Const.round( new BigDecimal( "0.015" ), 2, BigDecimal.ROUND_CEILING ) ); assertEquals( new BigDecimal( "0.010" ), Const.round( new BigDecimal( "0.015" ), 2, BigDecimal.ROUND_FLOOR ) ); assertEquals( new BigDecimal( "0.020" ), Const.round( new BigDecimal( "0.015" ), 2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( new BigDecimal( "0.010" ), Const.round( new BigDecimal( "0.015" ), 2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( new BigDecimal( "0.020" ), Const.round( new BigDecimal( "0.015" ), 2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( new BigDecimal( "0.020" ), Const.round( new BigDecimal( "0.015" ), 2, Const.ROUND_HALF_CEILING ) ); assertEquals( new BigDecimal( "0.020" ), Const.round( new BigDecimal( "0.017" ), 2, BigDecimal.ROUND_UP ) ); assertEquals( new BigDecimal( "0.010" ), Const.round( new BigDecimal( "0.017" ), 2, BigDecimal.ROUND_DOWN ) ); assertEquals( new BigDecimal( "0.020" ), Const.round( new BigDecimal( "0.017" ), 2, BigDecimal.ROUND_CEILING ) ); assertEquals( new BigDecimal( "0.010" ), Const.round( new BigDecimal( "0.017" ), 2, BigDecimal.ROUND_FLOOR ) ); assertEquals( new BigDecimal( "0.020" ), Const.round( new BigDecimal( "0.017" ), 2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( new BigDecimal( "0.020" ), Const.round( new BigDecimal( "0.017" ), 2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( new BigDecimal( "0.020" ), Const.round( new BigDecimal( "0.017" ), 2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( new BigDecimal( "0.020" ), Const.round( new BigDecimal( "0.017" ), 2, Const.ROUND_HALF_CEILING ) ); assertEquals( new BigDecimal( "0.020" ), Const.round( new BigDecimal( "0.020" ), 2, BigDecimal.ROUND_UP ) ); assertEquals( new BigDecimal( "0.020" ), Const.round( new BigDecimal( "0.020" ), 2, BigDecimal.ROUND_DOWN ) ); assertEquals( new BigDecimal( "0.020" ), Const.round( new BigDecimal( "0.020" ), 2, BigDecimal.ROUND_CEILING ) ); assertEquals( new BigDecimal( "0.020" ), Const.round( new BigDecimal( "0.020" ), 2, BigDecimal.ROUND_FLOOR ) ); assertEquals( new BigDecimal( "0.020" ), Const.round( new BigDecimal( "0.020" ), 2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( new BigDecimal( "0.020" ), Const.round( new BigDecimal( "0.020" ), 2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( new BigDecimal( "0.020" ), Const.round( new BigDecimal( "0.020" ), 2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( new BigDecimal( "0.020" ), Const.round( new BigDecimal( "0.020" ), 2, Const.ROUND_HALF_CEILING ) ); assertEquals( new BigDecimal( "0.030" ), Const.round( new BigDecimal( "0.022" ), 2, BigDecimal.ROUND_UP ) ); assertEquals( new BigDecimal( "0.020" ), Const.round( new BigDecimal( "0.022" ), 2, BigDecimal.ROUND_DOWN ) ); assertEquals( new BigDecimal( "0.030" ), Const.round( new BigDecimal( "0.022" ), 2, BigDecimal.ROUND_CEILING ) ); assertEquals( new BigDecimal( "0.020" ), Const.round( new BigDecimal( "0.022" ), 2, BigDecimal.ROUND_FLOOR ) ); assertEquals( new BigDecimal( "0.020" ), Const.round( new BigDecimal( "0.022" ), 2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( new BigDecimal( "0.020" ), Const.round( new BigDecimal( "0.022" ), 2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( new BigDecimal( "0.020" ), Const.round( new BigDecimal( "0.022" ), 2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( new BigDecimal( "0.020" ), Const.round( new BigDecimal( "0.022" ), 2, Const.ROUND_HALF_CEILING ) ); assertEquals( new BigDecimal( "0.030" ), Const.round( new BigDecimal( "0.025" ), 2, BigDecimal.ROUND_UP ) ); assertEquals( new BigDecimal( "0.020" ), Const.round( new BigDecimal( "0.025" ), 2, BigDecimal.ROUND_DOWN ) ); assertEquals( new BigDecimal( "0.030" ), Const.round( new BigDecimal( "0.025" ), 2, BigDecimal.ROUND_CEILING ) ); assertEquals( new BigDecimal( "0.020" ), Const.round( new BigDecimal( "0.025" ), 2, BigDecimal.ROUND_FLOOR ) ); assertEquals( new BigDecimal( "0.030" ), Const.round( new BigDecimal( "0.025" ), 2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( new BigDecimal( "0.020" ), Const.round( new BigDecimal( "0.025" ), 2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( new BigDecimal( "0.020" ), Const.round( new BigDecimal( "0.025" ), 2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( new BigDecimal( "0.030" ), Const.round( new BigDecimal( "0.025" ), 2, Const.ROUND_HALF_CEILING ) ); assertEquals( new BigDecimal( "0.030" ), Const.round( new BigDecimal( "0.027" ), 2, BigDecimal.ROUND_UP ) ); assertEquals( new BigDecimal( "0.020" ), Const.round( new BigDecimal( "0.027" ), 2, BigDecimal.ROUND_DOWN ) ); assertEquals( new BigDecimal( "0.030" ), Const.round( new BigDecimal( "0.027" ), 2, BigDecimal.ROUND_CEILING ) ); assertEquals( new BigDecimal( "0.020" ), Const.round( new BigDecimal( "0.027" ), 2, BigDecimal.ROUND_FLOOR ) ); assertEquals( new BigDecimal( "0.030" ), Const.round( new BigDecimal( "0.027" ), 2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( new BigDecimal( "0.030" ), Const.round( new BigDecimal( "0.027" ), 2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( new BigDecimal( "0.030" ), Const.round( new BigDecimal( "0.027" ), 2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( new BigDecimal( "0.030" ), Const.round( new BigDecimal( "0.027" ), 2, Const.ROUND_HALF_CEILING ) ); assertEquals( new BigDecimal( "-0.010" ), Const.round( new BigDecimal( "-0.010" ), 2, BigDecimal.ROUND_UP ) ); assertEquals( new BigDecimal( "-0.010" ), Const.round( new BigDecimal( "-0.010" ), 2, BigDecimal.ROUND_DOWN ) ); assertEquals( new BigDecimal( "-0.010" ), Const.round( new BigDecimal( "-0.010" ), 2, BigDecimal.ROUND_CEILING ) ); assertEquals( new BigDecimal( "-0.010" ), Const.round( new BigDecimal( "-0.010" ), 2, BigDecimal.ROUND_FLOOR ) ); assertEquals( new BigDecimal( "-0.010" ), Const.round( new BigDecimal( "-0.010" ), 2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( new BigDecimal( "-0.010" ), Const.round( new BigDecimal( "-0.010" ), 2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( new BigDecimal( "-0.010" ), Const.round( new BigDecimal( "-0.010" ), 2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( new BigDecimal( "-0.010" ), Const.round( new BigDecimal( "-0.010" ), 2, Const.ROUND_HALF_CEILING ) ); assertEquals( new BigDecimal( "-0.020" ), Const.round( new BigDecimal( "-0.012" ), 2, BigDecimal.ROUND_UP ) ); assertEquals( new BigDecimal( "-0.010" ), Const.round( new BigDecimal( "-0.012" ), 2, BigDecimal.ROUND_DOWN ) ); assertEquals( new BigDecimal( "-0.010" ), Const.round( new BigDecimal( "-0.012" ), 2, BigDecimal.ROUND_CEILING ) ); assertEquals( new BigDecimal( "-0.020" ), Const.round( new BigDecimal( "-0.012" ), 2, BigDecimal.ROUND_FLOOR ) ); assertEquals( new BigDecimal( "-0.010" ), Const.round( new BigDecimal( "-0.012" ), 2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( new BigDecimal( "-0.010" ), Const.round( new BigDecimal( "-0.012" ), 2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( new BigDecimal( "-0.010" ), Const.round( new BigDecimal( "-0.012" ), 2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( new BigDecimal( "-0.010" ), Const.round( new BigDecimal( "-0.012" ), 2, Const.ROUND_HALF_CEILING ) ); assertEquals( new BigDecimal( "-0.020" ), Const.round( new BigDecimal( "-0.015" ), 2, BigDecimal.ROUND_UP ) ); assertEquals( new BigDecimal( "-0.010" ), Const.round( new BigDecimal( "-0.015" ), 2, BigDecimal.ROUND_DOWN ) ); assertEquals( new BigDecimal( "-0.010" ), Const.round( new BigDecimal( "-0.015" ), 2, BigDecimal.ROUND_CEILING ) ); assertEquals( new BigDecimal( "-0.020" ), Const.round( new BigDecimal( "-0.015" ), 2, BigDecimal.ROUND_FLOOR ) ); assertEquals( new BigDecimal( "-0.020" ), Const.round( new BigDecimal( "-0.015" ), 2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( new BigDecimal( "-0.010" ), Const.round( new BigDecimal( "-0.015" ), 2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( new BigDecimal( "-0.020" ), Const.round( new BigDecimal( "-0.015" ), 2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( new BigDecimal( "-0.010" ), Const.round( new BigDecimal( "-0.015" ), 2, Const.ROUND_HALF_CEILING ) ); assertEquals( new BigDecimal( "-0.020" ), Const.round( new BigDecimal( "-0.017" ), 2, BigDecimal.ROUND_UP ) ); assertEquals( new BigDecimal( "-0.010" ), Const.round( new BigDecimal( "-0.017" ), 2, BigDecimal.ROUND_DOWN ) ); assertEquals( new BigDecimal( "-0.010" ), Const.round( new BigDecimal( "-0.017" ), 2, BigDecimal.ROUND_CEILING ) ); assertEquals( new BigDecimal( "-0.020" ), Const.round( new BigDecimal( "-0.017" ), 2, BigDecimal.ROUND_FLOOR ) ); assertEquals( new BigDecimal( "-0.020" ), Const.round( new BigDecimal( "-0.017" ), 2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( new BigDecimal( "-0.020" ), Const.round( new BigDecimal( "-0.017" ), 2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( new BigDecimal( "-0.020" ), Const.round( new BigDecimal( "-0.017" ), 2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( new BigDecimal( "-0.020" ), Const.round( new BigDecimal( "-0.017" ), 2, Const.ROUND_HALF_CEILING ) ); assertEquals( new BigDecimal( "-0.020" ), Const.round( new BigDecimal( "-0.020" ), 2, BigDecimal.ROUND_UP ) ); assertEquals( new BigDecimal( "-0.020" ), Const.round( new BigDecimal( "-0.020" ), 2, BigDecimal.ROUND_DOWN ) ); assertEquals( new BigDecimal( "-0.020" ), Const.round( new BigDecimal( "-0.020" ), 2, BigDecimal.ROUND_CEILING ) ); assertEquals( new BigDecimal( "-0.020" ), Const.round( new BigDecimal( "-0.020" ), 2, BigDecimal.ROUND_FLOOR ) ); assertEquals( new BigDecimal( "-0.020" ), Const.round( new BigDecimal( "-0.020" ), 2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( new BigDecimal( "-0.020" ), Const.round( new BigDecimal( "-0.020" ), 2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( new BigDecimal( "-0.020" ), Const.round( new BigDecimal( "-0.020" ), 2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( new BigDecimal( "-0.020" ), Const.round( new BigDecimal( "-0.020" ), 2, Const.ROUND_HALF_CEILING ) ); assertEquals( new BigDecimal( "-0.030" ), Const.round( new BigDecimal( "-0.022" ), 2, BigDecimal.ROUND_UP ) ); assertEquals( new BigDecimal( "-0.020" ), Const.round( new BigDecimal( "-0.022" ), 2, BigDecimal.ROUND_DOWN ) ); assertEquals( new BigDecimal( "-0.020" ), Const.round( new BigDecimal( "-0.022" ), 2, BigDecimal.ROUND_CEILING ) ); assertEquals( new BigDecimal( "-0.030" ), Const.round( new BigDecimal( "-0.022" ), 2, BigDecimal.ROUND_FLOOR ) ); assertEquals( new BigDecimal( "-0.020" ), Const.round( new BigDecimal( "-0.022" ), 2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( new BigDecimal( "-0.020" ), Const.round( new BigDecimal( "-0.022" ), 2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( new BigDecimal( "-0.020" ), Const.round( new BigDecimal( "-0.022" ), 2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( new BigDecimal( "-0.020" ), Const.round( new BigDecimal( "-0.022" ), 2, Const.ROUND_HALF_CEILING ) ); assertEquals( new BigDecimal( "-0.030" ), Const.round( new BigDecimal( "-0.025" ), 2, BigDecimal.ROUND_UP ) ); assertEquals( new BigDecimal( "-0.020" ), Const.round( new BigDecimal( "-0.025" ), 2, BigDecimal.ROUND_DOWN ) ); assertEquals( new BigDecimal( "-0.020" ), Const.round( new BigDecimal( "-0.025" ), 2, BigDecimal.ROUND_CEILING ) ); assertEquals( new BigDecimal( "-0.030" ), Const.round( new BigDecimal( "-0.025" ), 2, BigDecimal.ROUND_FLOOR ) ); assertEquals( new BigDecimal( "-0.030" ), Const.round( new BigDecimal( "-0.025" ), 2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( new BigDecimal( "-0.020" ), Const.round( new BigDecimal( "-0.025" ), 2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( new BigDecimal( "-0.020" ), Const.round( new BigDecimal( "-0.025" ), 2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( new BigDecimal( "-0.020" ), Const.round( new BigDecimal( "-0.025" ), 2, Const.ROUND_HALF_CEILING ) ); assertEquals( new BigDecimal( "-0.030" ), Const.round( new BigDecimal( "-0.027" ), 2, BigDecimal.ROUND_UP ) ); assertEquals( new BigDecimal( "-0.020" ), Const.round( new BigDecimal( "-0.027" ), 2, BigDecimal.ROUND_DOWN ) ); assertEquals( new BigDecimal( "-0.020" ), Const.round( new BigDecimal( "-0.027" ), 2, BigDecimal.ROUND_CEILING ) ); assertEquals( new BigDecimal( "-0.030" ), Const.round( new BigDecimal( "-0.027" ), 2, BigDecimal.ROUND_FLOOR ) ); assertEquals( new BigDecimal( "-0.030" ), Const.round( new BigDecimal( "-0.027" ), 2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( new BigDecimal( "-0.030" ), Const.round( new BigDecimal( "-0.027" ), 2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( new BigDecimal( "-0.030" ), Const.round( new BigDecimal( "-0.027" ), 2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( new BigDecimal( "-0.030" ), Const.round( new BigDecimal( "-0.027" ), 2, Const.ROUND_HALF_CEILING ) ); assertEquals( new BigDecimal( "100.0" ), Const.round( new BigDecimal( "100.0" ), -2, BigDecimal.ROUND_UP ) ); assertEquals( new BigDecimal( "100.0" ), Const.round( new BigDecimal( "100.0" ), -2, BigDecimal.ROUND_DOWN ) ); assertEquals( new BigDecimal( "100.0" ), Const.round( new BigDecimal( "100.0" ), -2, BigDecimal.ROUND_CEILING ) ); assertEquals( new BigDecimal( "100.0" ), Const.round( new BigDecimal( "100.0" ), -2, BigDecimal.ROUND_FLOOR ) ); assertEquals( new BigDecimal( "100.0" ), Const.round( new BigDecimal( "100.0" ), -2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( new BigDecimal( "100.0" ), Const.round( new BigDecimal( "100.0" ), -2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( new BigDecimal( "100.0" ), Const.round( new BigDecimal( "100.0" ), -2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( new BigDecimal( "100.0" ), Const.round( new BigDecimal( "100.0" ), -2, Const.ROUND_HALF_CEILING ) ); assertEquals( new BigDecimal( "200.0" ), Const.round( new BigDecimal( "120.0" ), -2, BigDecimal.ROUND_UP ) ); assertEquals( new BigDecimal( "100.0" ), Const.round( new BigDecimal( "120.0" ), -2, BigDecimal.ROUND_DOWN ) ); assertEquals( new BigDecimal( "200.0" ), Const.round( new BigDecimal( "120.0" ), -2, BigDecimal.ROUND_CEILING ) ); assertEquals( new BigDecimal( "100.0" ), Const.round( new BigDecimal( "120.0" ), -2, BigDecimal.ROUND_FLOOR ) ); assertEquals( new BigDecimal( "100.0" ), Const.round( new BigDecimal( "120.0" ), -2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( new BigDecimal( "100.0" ), Const.round( new BigDecimal( "120.0" ), -2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( new BigDecimal( "100.0" ), Const.round( new BigDecimal( "120.0" ), -2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( new BigDecimal( "100.0" ), Const.round( new BigDecimal( "120.0" ), -2, Const.ROUND_HALF_CEILING ) ); assertEquals( new BigDecimal( "200.0" ), Const.round( new BigDecimal( "150.0" ), -2, BigDecimal.ROUND_UP ) ); assertEquals( new BigDecimal( "100.0" ), Const.round( new BigDecimal( "150.0" ), -2, BigDecimal.ROUND_DOWN ) ); assertEquals( new BigDecimal( "200.0" ), Const.round( new BigDecimal( "150.0" ), -2, BigDecimal.ROUND_CEILING ) ); assertEquals( new BigDecimal( "100.0" ), Const.round( new BigDecimal( "150.0" ), -2, BigDecimal.ROUND_FLOOR ) ); assertEquals( new BigDecimal( "200.0" ), Const.round( new BigDecimal( "150.0" ), -2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( new BigDecimal( "100.0" ), Const.round( new BigDecimal( "150.0" ), -2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( new BigDecimal( "200.0" ), Const.round( new BigDecimal( "150.0" ), -2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( new BigDecimal( "200.0" ), Const.round( new BigDecimal( "150.0" ), -2, Const.ROUND_HALF_CEILING ) ); assertEquals( new BigDecimal( "200.0" ), Const.round( new BigDecimal( "170.0" ), -2, BigDecimal.ROUND_UP ) ); assertEquals( new BigDecimal( "100.0" ), Const.round( new BigDecimal( "170.0" ), -2, BigDecimal.ROUND_DOWN ) ); assertEquals( new BigDecimal( "200.0" ), Const.round( new BigDecimal( "170.0" ), -2, BigDecimal.ROUND_CEILING ) ); assertEquals( new BigDecimal( "100.0" ), Const.round( new BigDecimal( "170.0" ), -2, BigDecimal.ROUND_FLOOR ) ); assertEquals( new BigDecimal( "200.0" ), Const.round( new BigDecimal( "170.0" ), -2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( new BigDecimal( "200.0" ), Const.round( new BigDecimal( "170.0" ), -2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( new BigDecimal( "200.0" ), Const.round( new BigDecimal( "170.0" ), -2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( new BigDecimal( "200.0" ), Const.round( new BigDecimal( "170.0" ), -2, Const.ROUND_HALF_CEILING ) ); assertEquals( new BigDecimal( "200.0" ), Const.round( new BigDecimal( "200.0" ), -2, BigDecimal.ROUND_UP ) ); assertEquals( new BigDecimal( "200.0" ), Const.round( new BigDecimal( "200.0" ), -2, BigDecimal.ROUND_DOWN ) ); assertEquals( new BigDecimal( "200.0" ), Const.round( new BigDecimal( "200.0" ), -2, BigDecimal.ROUND_CEILING ) ); assertEquals( new BigDecimal( "200.0" ), Const.round( new BigDecimal( "200.0" ), -2, BigDecimal.ROUND_FLOOR ) ); assertEquals( new BigDecimal( "200.0" ), Const.round( new BigDecimal( "200.0" ), -2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( new BigDecimal( "200.0" ), Const.round( new BigDecimal( "200.0" ), -2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( new BigDecimal( "200.0" ), Const.round( new BigDecimal( "200.0" ), -2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( new BigDecimal( "200.0" ), Const.round( new BigDecimal( "200.0" ), -2, Const.ROUND_HALF_CEILING ) ); assertEquals( new BigDecimal( "300.0" ), Const.round( new BigDecimal( "220.0" ), -2, BigDecimal.ROUND_UP ) ); assertEquals( new BigDecimal( "200.0" ), Const.round( new BigDecimal( "220.0" ), -2, BigDecimal.ROUND_DOWN ) ); assertEquals( new BigDecimal( "300.0" ), Const.round( new BigDecimal( "220.0" ), -2, BigDecimal.ROUND_CEILING ) ); assertEquals( new BigDecimal( "200.0" ), Const.round( new BigDecimal( "220.0" ), -2, BigDecimal.ROUND_FLOOR ) ); assertEquals( new BigDecimal( "200.0" ), Const.round( new BigDecimal( "220.0" ), -2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( new BigDecimal( "200.0" ), Const.round( new BigDecimal( "220.0" ), -2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( new BigDecimal( "200.0" ), Const.round( new BigDecimal( "220.0" ), -2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( new BigDecimal( "200.0" ), Const.round( new BigDecimal( "220.0" ), -2, Const.ROUND_HALF_CEILING ) ); assertEquals( new BigDecimal( "300.0" ), Const.round( new BigDecimal( "250.0" ), -2, BigDecimal.ROUND_UP ) ); assertEquals( new BigDecimal( "200.0" ), Const.round( new BigDecimal( "250.0" ), -2, BigDecimal.ROUND_DOWN ) ); assertEquals( new BigDecimal( "300.0" ), Const.round( new BigDecimal( "250.0" ), -2, BigDecimal.ROUND_CEILING ) ); assertEquals( new BigDecimal( "200.0" ), Const.round( new BigDecimal( "250.0" ), -2, BigDecimal.ROUND_FLOOR ) ); assertEquals( new BigDecimal( "300.0" ), Const.round( new BigDecimal( "250.0" ), -2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( new BigDecimal( "200.0" ), Const.round( new BigDecimal( "250.0" ), -2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( new BigDecimal( "200.0" ), Const.round( new BigDecimal( "250.0" ), -2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( new BigDecimal( "300.0" ), Const.round( new BigDecimal( "250.0" ), -2, Const.ROUND_HALF_CEILING ) ); assertEquals( new BigDecimal( "300.0" ), Const.round( new BigDecimal( "270.0" ), -2, BigDecimal.ROUND_UP ) ); assertEquals( new BigDecimal( "200.0" ), Const.round( new BigDecimal( "270.0" ), -2, BigDecimal.ROUND_DOWN ) ); assertEquals( new BigDecimal( "300.0" ), Const.round( new BigDecimal( "270.0" ), -2, BigDecimal.ROUND_CEILING ) ); assertEquals( new BigDecimal( "200.0" ), Const.round( new BigDecimal( "270.0" ), -2, BigDecimal.ROUND_FLOOR ) ); assertEquals( new BigDecimal( "300.0" ), Const.round( new BigDecimal( "270.0" ), -2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( new BigDecimal( "300.0" ), Const.round( new BigDecimal( "270.0" ), -2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( new BigDecimal( "300.0" ), Const.round( new BigDecimal( "270.0" ), -2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( new BigDecimal( "300.0" ), Const.round( new BigDecimal( "270.0" ), -2, Const.ROUND_HALF_CEILING ) ); assertEquals( new BigDecimal( "-100.0" ), Const.round( new BigDecimal( "-100.0" ), -2, BigDecimal.ROUND_UP ) ); assertEquals( new BigDecimal( "-100.0" ), Const.round( new BigDecimal( "-100.0" ), -2, BigDecimal.ROUND_DOWN ) ); assertEquals( new BigDecimal( "-100.0" ), Const.round( new BigDecimal( "-100.0" ), -2, BigDecimal.ROUND_CEILING ) ); assertEquals( new BigDecimal( "-100.0" ), Const.round( new BigDecimal( "-100.0" ), -2, BigDecimal.ROUND_FLOOR ) ); assertEquals( new BigDecimal( "-100.0" ), Const.round( new BigDecimal( "-100.0" ), -2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( new BigDecimal( "-100.0" ), Const.round( new BigDecimal( "-100.0" ), -2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( new BigDecimal( "-100.0" ), Const.round( new BigDecimal( "-100.0" ), -2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( new BigDecimal( "-100.0" ), Const.round( new BigDecimal( "-100.0" ), -2, Const.ROUND_HALF_CEILING ) ); assertEquals( new BigDecimal( "-200.0" ), Const.round( new BigDecimal( "-120.0" ), -2, BigDecimal.ROUND_UP ) ); assertEquals( new BigDecimal( "-100.0" ), Const.round( new BigDecimal( "-120.0" ), -2, BigDecimal.ROUND_DOWN ) ); assertEquals( new BigDecimal( "-100.0" ), Const.round( new BigDecimal( "-120.0" ), -2, BigDecimal.ROUND_CEILING ) ); assertEquals( new BigDecimal( "-200.0" ), Const.round( new BigDecimal( "-120.0" ), -2, BigDecimal.ROUND_FLOOR ) ); assertEquals( new BigDecimal( "-100.0" ), Const.round( new BigDecimal( "-120.0" ), -2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( new BigDecimal( "-100.0" ), Const.round( new BigDecimal( "-120.0" ), -2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( new BigDecimal( "-100.0" ), Const.round( new BigDecimal( "-120.0" ), -2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( new BigDecimal( "-100.0" ), Const.round( new BigDecimal( "-120.0" ), -2, Const.ROUND_HALF_CEILING ) ); assertEquals( new BigDecimal( "-200.0" ), Const.round( new BigDecimal( "-150.0" ), -2, BigDecimal.ROUND_UP ) ); assertEquals( new BigDecimal( "-100.0" ), Const.round( new BigDecimal( "-150.0" ), -2, BigDecimal.ROUND_DOWN ) ); assertEquals( new BigDecimal( "-100.0" ), Const.round( new BigDecimal( "-150.0" ), -2, BigDecimal.ROUND_CEILING ) ); assertEquals( new BigDecimal( "-200.0" ), Const.round( new BigDecimal( "-150.0" ), -2, BigDecimal.ROUND_FLOOR ) ); assertEquals( new BigDecimal( "-200.0" ), Const.round( new BigDecimal( "-150.0" ), -2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( new BigDecimal( "-100.0" ), Const.round( new BigDecimal( "-150.0" ), -2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( new BigDecimal( "-200.0" ), Const.round( new BigDecimal( "-150.0" ), -2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( new BigDecimal( "-100.0" ), Const.round( new BigDecimal( "-150.0" ), -2, Const.ROUND_HALF_CEILING ) ); assertEquals( new BigDecimal( "-200.0" ), Const.round( new BigDecimal( "-170.0" ), -2, BigDecimal.ROUND_UP ) ); assertEquals( new BigDecimal( "-100.0" ), Const.round( new BigDecimal( "-170.0" ), -2, BigDecimal.ROUND_DOWN ) ); assertEquals( new BigDecimal( "-100.0" ), Const.round( new BigDecimal( "-170.0" ), -2, BigDecimal.ROUND_CEILING ) ); assertEquals( new BigDecimal( "-200.0" ), Const.round( new BigDecimal( "-170.0" ), -2, BigDecimal.ROUND_FLOOR ) ); assertEquals( new BigDecimal( "-200.0" ), Const.round( new BigDecimal( "-170.0" ), -2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( new BigDecimal( "-200.0" ), Const.round( new BigDecimal( "-170.0" ), -2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( new BigDecimal( "-200.0" ), Const.round( new BigDecimal( "-170.0" ), -2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( new BigDecimal( "-200.0" ), Const.round( new BigDecimal( "-170.0" ), -2, Const.ROUND_HALF_CEILING ) ); assertEquals( new BigDecimal( "-200.0" ), Const.round( new BigDecimal( "-200.0" ), -2, BigDecimal.ROUND_UP ) ); assertEquals( new BigDecimal( "-200.0" ), Const.round( new BigDecimal( "-200.0" ), -2, BigDecimal.ROUND_DOWN ) ); assertEquals( new BigDecimal( "-200.0" ), Const.round( new BigDecimal( "-200.0" ), -2, BigDecimal.ROUND_CEILING ) ); assertEquals( new BigDecimal( "-200.0" ), Const.round( new BigDecimal( "-200.0" ), -2, BigDecimal.ROUND_FLOOR ) ); assertEquals( new BigDecimal( "-200.0" ), Const.round( new BigDecimal( "-200.0" ), -2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( new BigDecimal( "-200.0" ), Const.round( new BigDecimal( "-200.0" ), -2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( new BigDecimal( "-200.0" ), Const.round( new BigDecimal( "-200.0" ), -2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( new BigDecimal( "-200.0" ), Const.round( new BigDecimal( "-200.0" ), -2, Const.ROUND_HALF_CEILING ) ); assertEquals( new BigDecimal( "-300.0" ), Const.round( new BigDecimal( "-220.0" ), -2, BigDecimal.ROUND_UP ) ); assertEquals( new BigDecimal( "-200.0" ), Const.round( new BigDecimal( "-220.0" ), -2, BigDecimal.ROUND_DOWN ) ); assertEquals( new BigDecimal( "-200.0" ), Const.round( new BigDecimal( "-220.0" ), -2, BigDecimal.ROUND_CEILING ) ); assertEquals( new BigDecimal( "-300.0" ), Const.round( new BigDecimal( "-220.0" ), -2, BigDecimal.ROUND_FLOOR ) ); assertEquals( new BigDecimal( "-200.0" ), Const.round( new BigDecimal( "-220.0" ), -2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( new BigDecimal( "-200.0" ), Const.round( new BigDecimal( "-220.0" ), -2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( new BigDecimal( "-200.0" ), Const.round( new BigDecimal( "-220.0" ), -2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( new BigDecimal( "-200.0" ), Const.round( new BigDecimal( "-220.0" ), -2, Const.ROUND_HALF_CEILING ) ); assertEquals( new BigDecimal( "-300.0" ), Const.round( new BigDecimal( "-250.0" ), -2, BigDecimal.ROUND_UP ) ); assertEquals( new BigDecimal( "-200.0" ), Const.round( new BigDecimal( "-250.0" ), -2, BigDecimal.ROUND_DOWN ) ); assertEquals( new BigDecimal( "-200.0" ), Const.round( new BigDecimal( "-250.0" ), -2, BigDecimal.ROUND_CEILING ) ); assertEquals( new BigDecimal( "-300.0" ), Const.round( new BigDecimal( "-250.0" ), -2, BigDecimal.ROUND_FLOOR ) ); assertEquals( new BigDecimal( "-300.0" ), Const.round( new BigDecimal( "-250.0" ), -2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( new BigDecimal( "-200.0" ), Const.round( new BigDecimal( "-250.0" ), -2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( new BigDecimal( "-200.0" ), Const.round( new BigDecimal( "-250.0" ), -2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( new BigDecimal( "-200.0" ), Const.round( new BigDecimal( "-250.0" ), -2, Const.ROUND_HALF_CEILING ) ); assertEquals( new BigDecimal( "-300.0" ), Const.round( new BigDecimal( "-270.0" ), -2, BigDecimal.ROUND_UP ) ); assertEquals( new BigDecimal( "-200.0" ), Const.round( new BigDecimal( "-270.0" ), -2, BigDecimal.ROUND_DOWN ) ); assertEquals( new BigDecimal( "-200.0" ), Const.round( new BigDecimal( "-270.0" ), -2, BigDecimal.ROUND_CEILING ) ); assertEquals( new BigDecimal( "-300.0" ), Const.round( new BigDecimal( "-270.0" ), -2, BigDecimal.ROUND_FLOOR ) ); assertEquals( new BigDecimal( "-300.0" ), Const.round( new BigDecimal( "-270.0" ), -2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( new BigDecimal( "-300.0" ), Const.round( new BigDecimal( "-270.0" ), -2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( new BigDecimal( "-300.0" ), Const.round( new BigDecimal( "-270.0" ), -2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( new BigDecimal( "-300.0" ), Const.round( new BigDecimal( "-270.0" ), -2, Const.ROUND_HALF_CEILING ) ); }
public static double round( double f, int places ) { return round( f, places, java.math.BigDecimal.ROUND_HALF_EVEN ); }
Const { public static double round( double f, int places ) { return round( f, places, java.math.BigDecimal.ROUND_HALF_EVEN ); } }
Const { public static double round( double f, int places ) { return round( f, places, java.math.BigDecimal.ROUND_HALF_EVEN ); } }
Const { public static double round( double f, int places ) { return round( f, places, java.math.BigDecimal.ROUND_HALF_EVEN ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); }
Const { public static double round( double f, int places ) { return round( f, places, java.math.BigDecimal.ROUND_HALF_EVEN ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); @Deprecated static final String VERSION; static final String COPYRIGHT_YEAR; static final int TIMEOUT_GET_MILLIS; static final int TIMEOUT_PUT_MILLIS; static final int ROWS_UPDATE; static final int ROWS_IN_ROWSET; static final int FETCH_SIZE; static final int SORT_SIZE; static final int HEARTBEAT_PERIODIC_INTERVAL_IN_SECS; static final String FILE_SEPARATOR; static final String PATH_SEPARATOR; static final String CR; static final String DOSCR; static final String EMPTY_STRING; static final String JAVA_VERSION; @Deprecated static final String USER_HOME_DIRECTORY; static String JNDI_DIRECTORY; static final String PLUGIN_BASE_FOLDERS_PROP; static final String DEFAULT_PLUGIN_BASE_FOLDERS; static final Date MIN_DATE; static final Date MAX_DATE; static final int MIN_YEAR; static final int MAX_YEAR; static final int RIGHT; static final int LENGTH; static final int MARGIN; static final int MIDDLE_PCT; static final int ARROW_WIDTH; static final int FORM_MARGIN; static final int SHADOW_SIZE; static final int SYMBOLSIZE; static final int MAX_FILE_HIST; static final Locale DEFAULT_LOCALE; static final char DEFAULT_DECIMAL_SEPARATOR; static final char DEFAULT_GROUPING_SEPARATOR; static final String DEFAULT_CURRENCY_SYMBOL; static final String DEFAULT_NUMBER_FORMAT; static final String NULL_STRING; static final String NULL_NUMBER; static final String NULL_DATE; static final String NULL_BIGNUMBER; static final String NULL_BOOLEAN; static final String NULL_INTEGER; static final String NULL_BINARY; static final String NULL_NONE; static final int ROUND_HALF_CEILING; static final String CHEF_LOG_FILE; static final String SPOON_LOG_FILE; static final String MENU_LOG_FILE; static final String GENERALIZED_DATE_TIME_FORMAT; static final String GENERALIZED_DATE_TIME_FORMAT_MILLIS; static final String XML_ENCODING; static final String[] STRING_TRANS_AND_JOB_FILTER_EXT; static final String STRING_TRANS_DEFAULT_EXT; static final String[] STRING_TRANS_FILTER_EXT; static final String STRING_JOB_DEFAULT_EXT; static final String[] STRING_JOB_FILTER_EXT; static final String KETTLE_PROPERTIES; static final String SHARED_DATA_FILE; static final String INTERNAL_VARIABLE_PREFIX; static final String INTERNAL_VARIABLE_KETTLE_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_DATE; static final String INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_FILENAME_NAME; static final String INTERNAL_VARIABLE_JOB_NAME; static final String INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_RUN_ID; static final String INTERNAL_VARIABLE_JOB_RUN_ATTEMPTNR; static final String VARIABLE_HEARTBEAT_PERIODIC_INTERVAL_SECS; static final String VARIABLE_MONITORING_SNMP_TRAPS_ENABLED; static final String INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY; static final String[] INTERNAL_TRANS_VARIABLES; static final String[] INTERNAL_JOB_VARIABLES; static final String[] DEPRECATED_VARIABLES; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_STEP_PARTITION_ID; static final String INTERNAL_VARIABLE_STEP_PARTITION_NR; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NUMBER; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NAME; static final String INTERNAL_VARIABLE_CLUSTER_SIZE; static final String INTERNAL_VARIABLE_STEP_UNIQUE_NUMBER; static final String INTERNAL_VARIABLE_CLUSTER_MASTER; static final String INTERNAL_VARIABLE_CLUSTER_RUN_ID; static final String INTERNAL_VARIABLE_STEP_UNIQUE_COUNT; static final String INTERNAL_VARIABLE_STEP_NAME; static final String INTERNAL_VARIABLE_STEP_COPYNR; static final int MAX_NR_LOG_LINES; static final int MAX_NR_HISTORY_LINES; static final int HISTORY_LINES_FETCH_SIZE; static final int MAX_LOG_LINE_TIMEOUT_MINUTES; static final int WARNING; static final int ERROR; static final int INFO; static final int NOTE_MARGIN; static final int MAX_UNDO; static final String KETTLE_VARIABLES_FILE; static final String KETTLE_LOG_SIZE_LIMIT; static final String KETTLE_TRANS_LOG_DB; static final String KETTLE_TRANS_LOG_SCHEMA; static final String KETTLE_TRANS_LOG_TABLE; static final String KETTLE_JOB_LOG_DB; static final String KETTLE_JOB_LOG_SCHEMA; static final String KETTLE_SLAVE_DETECTION_TIMER; static final String KETTLE_JOB_LOG_TABLE; static final String KETTLE_TRANS_PERFORMANCE_LOG_DB; static final String KETTLE_TRANS_PERFORMANCE_LOG_SCHEMA; static final String KETTLE_TRANS_PERFORMANCE_LOG_TABLE; static final String KETTLE_JOBENTRY_LOG_DB; static final String KETTLE_JOBENTRY_LOG_SCHEMA; static final String KETTLE_JOBENTRY_LOG_TABLE; static final String KETTLE_STEP_LOG_DB; static final String KETTLE_STEP_LOG_SCHEMA; static final String KETTLE_STEP_LOG_TABLE; static final String KETTLE_CHANNEL_LOG_DB; static final String KETTLE_CHANNEL_LOG_SCHEMA; static final String KETTLE_CHANNEL_LOG_TABLE; static final String KETTLE_METRICS_LOG_DB; static final String KETTLE_METRICS_LOG_SCHEMA; static final String KETTLE_METRICS_LOG_TABLE; static final String KETTLE_CHECKPOINT_LOG_DB; static final String KETTLE_CHECKPOINT_LOG_SCHEMA; static final String KETTLE_CHECKPOINT_LOG_TABLE; static final String KETTLE_SHARED_OBJECTS; static final String KETTLE_EMPTY_STRING_DIFFERS_FROM_NULL; static final String KETTLE_LENIENT_STRING_TO_NUMBER_CONVERSION; static final String KETTLE_COMPATIBILITY_DB_IGNORE_TIMEZONE; static final String KETTLE_COMPATIBILITY_IMPORT_PATH_ADDITION_ON_VARIABLES; static final String KETTLE_COMPATIBILITY_IGNORE_TABLE_LOGGING; static final String KETTLE_COMPATIBILITY_TEXT_FILE_OUTPUT_APPEND_NO_HEADER; static final String KETTLE_COMPATIBILITY_MERGE_ROWS_USE_REFERENCE_STREAM_WHEN_IDENTICAL; static final String KETTLE_COMPATIBILITY_MEMORY_GROUP_BY_SUM_AVERAGE_RETURN_NUMBER_TYPE; static final String KETTLE_SYSTEM_HOSTNAME; static final String KETTLE_MAX_LOG_SIZE_IN_LINES; static final String KETTLE_MAX_LOG_TIMEOUT_IN_MINUTES; static final String KETTLE_REDIRECT_STDERR; static final String KETTLE_REDIRECT_STDOUT; static final String KETTLE_CARTE_OBJECT_TIMEOUT_MINUTES; static final String KETTLE_STEP_PERFORMANCE_SNAPSHOT_LIMIT; static final String KETTLE_MAX_JOB_TRACKER_SIZE; static final String KETTLE_MAX_JOB_ENTRIES_LOGGED; static final String KETTLE_MAX_LOGGING_REGISTRY_SIZE; static final String KETTLE_LOG_TAB_REFRESH_DELAY; static final String KETTLE_LOG_TAB_REFRESH_PERIOD; static final String KETTLE_SAP_CONNECTION_FACTORY; static final String KETTLE_SAP_CONNECTION_FACTORY_DEFAULT_NAME; static final String KETTLE_PLUGIN_CLASSES; static final String KETTLE_PLUGIN_PACKAGES; static final String KETTLE_TRANS_ROWSET_SIZE; static final String VERSION_COMMENT_INITIAL_VERSION; static final String VERSION_COMMENT_EDIT_VERSION; static final String XML_FILE_KETTLE_STEPS; static final String KETTLE_CORE_STEPS_FILE; static final String XML_FILE_KETTLE_PARTITION_PLUGINS; static final String KETTLE_CORE_JOBENTRIES_FILE; static final String XML_FILE_KETTLE_SERVLETS; static final String XML_FILE_KETTLE_VALUEMETA_PLUGINS; static final String XML_FILE_KETTLE_PASSWORD_ENCODER_PLUGINS; static final String KETTLE_VALUEMETA_PLUGINS_FILE; static final String KETTLE_PASSWORD_ENCODER_PLUGIN; static final String KETTLE_PASSWORD_ENCODER_PLUGINS_FILE; static final String KETTLE_TWO_WAY_PASSWORD_ENCODER_SEED; static final String XML_FILE_KETTLE_LOGGING_PLUGINS; static final String KETTLE_LOGGING_PLUGINS_FILE; static final String KETTLE_CORE_SERVLETS_FILE; static final String KETTLE_ROWSET_GET_TIMEOUT; static final String KETTLE_ROWSET_PUT_TIMEOUT; static final String KETTLE_BATCHING_ROWSET; static final String KETTLE_DISABLE_CONSOLE_LOGGING; static final String XML_FILE_KETTLE_JOB_ENTRIES; static final String XML_FILE_KETTLE_REPOSITORIES; static final String XML_FILE_KETTLE_DATABASE_TYPES; static final String XML_FILE_KETTLE_COMPRESSION_PROVIDERS; static final String XML_FILE_KETTLE_AUTHENTICATION_PROVIDERS; static final String XML_FILE_KETTLE_EXTENSION_POINTS; static final String XML_FILE_KETTLE_REGISTRY_EXTENSIONS; static final String XML_FILE_KETTLE_LIFECYCLE_LISTENERS; static final String XML_FILE_KETTLE_ENGINES; static final String KETTLE_TRANS_PAN_JVM_EXIT_CODE; static final String KETTLE_DEFAULT_NUMBER_FORMAT; static final String KETTLE_DEFAULT_BIGNUMBER_FORMAT; static final String KETTLE_DEFAULT_INTEGER_FORMAT; static final String KETTLE_DEFAULT_DATE_FORMAT; static final String KETTLE_AGGREGATION_MIN_NULL_IS_VALUED; static final String KETTLE_AGGREGATION_ALL_NULLS_ARE_ZERO; static final String KETTLE_DEFAULT_TIMESTAMP_FORMAT; static final String KETTLE_SPLIT_FIELDS_REMOVE_ENCLOSURE; static final String KETTLE_GLOBAL_LOG_VARIABLES_CLEAR_ON_EXPORT; static final String KETTLE_COMPATIBILITY_CALCULATION_TIMEZONE_DECOMPOSITION; static final String KETTLE_COMPATIBILITY_SET_ERROR_ON_SPECIFIC_JOB_ENTRIES; static final String KETTLE_COMPATIBILITY_SEND_RESULT_XML_WITH_FULL_STATUS; static final String KETTLE_COMPATIBILITY_SELECT_VALUES_TYPE_CHANGE_USES_TYPE_DEFAULTS; static final String XML_FILE_KETTLE_IMPORT_RULES; static final ReleaseType RELEASE; static final String PENTAHO_METASTORE_FOLDER; static final String PENTAHO_METASTORE_NAME; static final String KETTLE_LOG_MARK_MAPPINGS; static final String KETTLE_CARTE_JETTY_ACCEPTORS; static final String KETTLE_CARTE_JETTY_ACCEPT_QUEUE_SIZE; static final String KETTLE_CARTE_JETTY_RES_MAX_IDLE_TIME; static final String VFS_USER_DIR_IS_ROOT; }
@Test public void testRound() { assertEquals( 1.0, Const.round( 1.0, 0, BigDecimal.ROUND_UP ) ); assertEquals( 1.0, Const.round( 1.0, 0, BigDecimal.ROUND_DOWN ) ); assertEquals( 1.0, Const.round( 1.0, 0, BigDecimal.ROUND_CEILING ) ); assertEquals( 1.0, Const.round( 1.0, 0, BigDecimal.ROUND_FLOOR ) ); assertEquals( 1.0, Const.round( 1.0, 0, BigDecimal.ROUND_HALF_UP ) ); assertEquals( 1.0, Const.round( 1.0, 0, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( 1.0, Const.round( 1.0, 0, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( 1.0, Const.round( 1.0, 0, Const.ROUND_HALF_CEILING ) ); assertEquals( 2.0, Const.round( 1.2, 0, BigDecimal.ROUND_UP ) ); assertEquals( 1.0, Const.round( 1.2, 0, BigDecimal.ROUND_DOWN ) ); assertEquals( 2.0, Const.round( 1.2, 0, BigDecimal.ROUND_CEILING ) ); assertEquals( 1.0, Const.round( 1.2, 0, BigDecimal.ROUND_FLOOR ) ); assertEquals( 1.0, Const.round( 1.2, 0, BigDecimal.ROUND_HALF_UP ) ); assertEquals( 1.0, Const.round( 1.2, 0, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( 1.0, Const.round( 1.2, 0, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( 1.0, Const.round( 1.2, 0, Const.ROUND_HALF_CEILING ) ); assertEquals( 2.0, Const.round( 1.5, 0, BigDecimal.ROUND_UP ) ); assertEquals( 1.0, Const.round( 1.5, 0, BigDecimal.ROUND_DOWN ) ); assertEquals( 2.0, Const.round( 1.5, 0, BigDecimal.ROUND_CEILING ) ); assertEquals( 1.0, Const.round( 1.5, 0, BigDecimal.ROUND_FLOOR ) ); assertEquals( 2.0, Const.round( 1.5, 0, BigDecimal.ROUND_HALF_UP ) ); assertEquals( 1.0, Const.round( 1.5, 0, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( 2.0, Const.round( 1.5, 0, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( 2.0, Const.round( 1.5, 0, Const.ROUND_HALF_CEILING ) ); assertEquals( 2.0, Const.round( 1.7, 0, BigDecimal.ROUND_UP ) ); assertEquals( 1.0, Const.round( 1.7, 0, BigDecimal.ROUND_DOWN ) ); assertEquals( 2.0, Const.round( 1.7, 0, BigDecimal.ROUND_CEILING ) ); assertEquals( 1.0, Const.round( 1.7, 0, BigDecimal.ROUND_FLOOR ) ); assertEquals( 2.0, Const.round( 1.7, 0, BigDecimal.ROUND_HALF_UP ) ); assertEquals( 2.0, Const.round( 1.7, 0, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( 2.0, Const.round( 1.7, 0, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( 2.0, Const.round( 1.7, 0, Const.ROUND_HALF_CEILING ) ); assertEquals( 2.0, Const.round( 2.0, 0, BigDecimal.ROUND_UP ) ); assertEquals( 2.0, Const.round( 2.0, 0, BigDecimal.ROUND_DOWN ) ); assertEquals( 2.0, Const.round( 2.0, 0, BigDecimal.ROUND_CEILING ) ); assertEquals( 2.0, Const.round( 2.0, 0, BigDecimal.ROUND_FLOOR ) ); assertEquals( 2.0, Const.round( 2.0, 0, BigDecimal.ROUND_HALF_UP ) ); assertEquals( 2.0, Const.round( 2.0, 0, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( 2.0, Const.round( 2.0, 0, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( 2.0, Const.round( 2.0, 0, Const.ROUND_HALF_CEILING ) ); assertEquals( 3.0, Const.round( 2.2, 0, BigDecimal.ROUND_UP ) ); assertEquals( 2.0, Const.round( 2.2, 0, BigDecimal.ROUND_DOWN ) ); assertEquals( 3.0, Const.round( 2.2, 0, BigDecimal.ROUND_CEILING ) ); assertEquals( 2.0, Const.round( 2.2, 0, BigDecimal.ROUND_FLOOR ) ); assertEquals( 2.0, Const.round( 2.2, 0, BigDecimal.ROUND_HALF_UP ) ); assertEquals( 2.0, Const.round( 2.2, 0, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( 2.0, Const.round( 2.2, 0, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( 2.0, Const.round( 2.2, 0, Const.ROUND_HALF_CEILING ) ); assertEquals( 3.0, Const.round( 2.5, 0, BigDecimal.ROUND_UP ) ); assertEquals( 2.0, Const.round( 2.5, 0, BigDecimal.ROUND_DOWN ) ); assertEquals( 3.0, Const.round( 2.5, 0, BigDecimal.ROUND_CEILING ) ); assertEquals( 2.0, Const.round( 2.5, 0, BigDecimal.ROUND_FLOOR ) ); assertEquals( 3.0, Const.round( 2.5, 0, BigDecimal.ROUND_HALF_UP ) ); assertEquals( 2.0, Const.round( 2.5, 0, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( 2.0, Const.round( 2.5, 0, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( 3.0, Const.round( 2.5, 0, Const.ROUND_HALF_CEILING ) ); assertEquals( 3.0, Const.round( 2.7, 0, BigDecimal.ROUND_UP ) ); assertEquals( 2.0, Const.round( 2.7, 0, BigDecimal.ROUND_DOWN ) ); assertEquals( 3.0, Const.round( 2.7, 0, BigDecimal.ROUND_CEILING ) ); assertEquals( 2.0, Const.round( 2.7, 0, BigDecimal.ROUND_FLOOR ) ); assertEquals( 3.0, Const.round( 2.7, 0, BigDecimal.ROUND_HALF_UP ) ); assertEquals( 3.0, Const.round( 2.7, 0, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( 3.0, Const.round( 2.7, 0, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( 3.0, Const.round( 2.7, 0, Const.ROUND_HALF_CEILING ) ); assertEquals( -1.0, Const.round( -1.0, 0, BigDecimal.ROUND_UP ) ); assertEquals( -1.0, Const.round( -1.0, 0, BigDecimal.ROUND_DOWN ) ); assertEquals( -1.0, Const.round( -1.0, 0, BigDecimal.ROUND_CEILING ) ); assertEquals( -1.0, Const.round( -1.0, 0, BigDecimal.ROUND_FLOOR ) ); assertEquals( -1.0, Const.round( -1.0, 0, BigDecimal.ROUND_HALF_UP ) ); assertEquals( -1.0, Const.round( -1.0, 0, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( -1.0, Const.round( -1.0, 0, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( -1.0, Const.round( -1.0, 0, Const.ROUND_HALF_CEILING ) ); assertEquals( -2.0, Const.round( -1.2, 0, BigDecimal.ROUND_UP ) ); assertEquals( -1.0, Const.round( -1.2, 0, BigDecimal.ROUND_DOWN ) ); assertEquals( -1.0, Const.round( -1.2, 0, BigDecimal.ROUND_CEILING ) ); assertEquals( -2.0, Const.round( -1.2, 0, BigDecimal.ROUND_FLOOR ) ); assertEquals( -1.0, Const.round( -1.2, 0, BigDecimal.ROUND_HALF_UP ) ); assertEquals( -1.0, Const.round( -1.2, 0, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( -1.0, Const.round( -1.2, 0, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( -1.0, Const.round( -1.2, 0, Const.ROUND_HALF_CEILING ) ); assertEquals( -2.0, Const.round( -1.5, 0, BigDecimal.ROUND_UP ) ); assertEquals( -1.0, Const.round( -1.5, 0, BigDecimal.ROUND_DOWN ) ); assertEquals( -1.0, Const.round( -1.5, 0, BigDecimal.ROUND_CEILING ) ); assertEquals( -2.0, Const.round( -1.5, 0, BigDecimal.ROUND_FLOOR ) ); assertEquals( -2.0, Const.round( -1.5, 0, BigDecimal.ROUND_HALF_UP ) ); assertEquals( -1.0, Const.round( -1.5, 0, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( -2.0, Const.round( -1.5, 0, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( -1.0, Const.round( -1.5, 0, Const.ROUND_HALF_CEILING ) ); assertEquals( -2.0, Const.round( -1.7, 0, BigDecimal.ROUND_UP ) ); assertEquals( -1.0, Const.round( -1.7, 0, BigDecimal.ROUND_DOWN ) ); assertEquals( -1.0, Const.round( -1.7, 0, BigDecimal.ROUND_CEILING ) ); assertEquals( -2.0, Const.round( -1.7, 0, BigDecimal.ROUND_FLOOR ) ); assertEquals( -2.0, Const.round( -1.7, 0, BigDecimal.ROUND_HALF_UP ) ); assertEquals( -2.0, Const.round( -1.7, 0, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( -2.0, Const.round( -1.7, 0, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( -2.0, Const.round( -1.7, 0, Const.ROUND_HALF_CEILING ) ); assertEquals( -2.0, Const.round( -2.0, 0, BigDecimal.ROUND_UP ) ); assertEquals( -2.0, Const.round( -2.0, 0, BigDecimal.ROUND_DOWN ) ); assertEquals( -2.0, Const.round( -2.0, 0, BigDecimal.ROUND_CEILING ) ); assertEquals( -2.0, Const.round( -2.0, 0, BigDecimal.ROUND_FLOOR ) ); assertEquals( -2.0, Const.round( -2.0, 0, BigDecimal.ROUND_HALF_UP ) ); assertEquals( -2.0, Const.round( -2.0, 0, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( -2.0, Const.round( -2.0, 0, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( -2.0, Const.round( -2.0, 0, Const.ROUND_HALF_CEILING ) ); assertEquals( -3.0, Const.round( -2.2, 0, BigDecimal.ROUND_UP ) ); assertEquals( -2.0, Const.round( -2.2, 0, BigDecimal.ROUND_DOWN ) ); assertEquals( -2.0, Const.round( -2.2, 0, BigDecimal.ROUND_CEILING ) ); assertEquals( -3.0, Const.round( -2.2, 0, BigDecimal.ROUND_FLOOR ) ); assertEquals( -2.0, Const.round( -2.2, 0, BigDecimal.ROUND_HALF_UP ) ); assertEquals( -2.0, Const.round( -2.2, 0, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( -2.0, Const.round( -2.2, 0, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( -2.0, Const.round( -2.2, 0, Const.ROUND_HALF_CEILING ) ); assertEquals( -3.0, Const.round( -2.5, 0, BigDecimal.ROUND_UP ) ); assertEquals( -2.0, Const.round( -2.5, 0, BigDecimal.ROUND_DOWN ) ); assertEquals( -2.0, Const.round( -2.5, 0, BigDecimal.ROUND_CEILING ) ); assertEquals( -3.0, Const.round( -2.5, 0, BigDecimal.ROUND_FLOOR ) ); assertEquals( -3.0, Const.round( -2.5, 0, BigDecimal.ROUND_HALF_UP ) ); assertEquals( -2.0, Const.round( -2.5, 0, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( -2.0, Const.round( -2.5, 0, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( -2.0, Const.round( -2.5, 0, Const.ROUND_HALF_CEILING ) ); assertEquals( -3.0, Const.round( -2.7, 0, BigDecimal.ROUND_UP ) ); assertEquals( -2.0, Const.round( -2.7, 0, BigDecimal.ROUND_DOWN ) ); assertEquals( -2.0, Const.round( -2.7, 0, BigDecimal.ROUND_CEILING ) ); assertEquals( -3.0, Const.round( -2.7, 0, BigDecimal.ROUND_FLOOR ) ); assertEquals( -3.0, Const.round( -2.7, 0, BigDecimal.ROUND_HALF_UP ) ); assertEquals( -3.0, Const.round( -2.7, 0, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( -3.0, Const.round( -2.7, 0, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( -3.0, Const.round( -2.7, 0, Const.ROUND_HALF_CEILING ) ); assertEquals( 0.010, Const.round( 0.010, 2, BigDecimal.ROUND_UP ) ); assertEquals( 0.010, Const.round( 0.010, 2, BigDecimal.ROUND_DOWN ) ); assertEquals( 0.010, Const.round( 0.010, 2, BigDecimal.ROUND_CEILING ) ); assertEquals( 0.010, Const.round( 0.010, 2, BigDecimal.ROUND_FLOOR ) ); assertEquals( 0.010, Const.round( 0.010, 2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( 0.010, Const.round( 0.010, 2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( 0.010, Const.round( 0.010, 2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( 0.010, Const.round( 0.010, 2, Const.ROUND_HALF_CEILING ) ); assertEquals( 0.020, Const.round( 0.012, 2, BigDecimal.ROUND_UP ) ); assertEquals( 0.010, Const.round( 0.012, 2, BigDecimal.ROUND_DOWN ) ); assertEquals( 0.020, Const.round( 0.012, 2, BigDecimal.ROUND_CEILING ) ); assertEquals( 0.010, Const.round( 0.012, 2, BigDecimal.ROUND_FLOOR ) ); assertEquals( 0.010, Const.round( 0.012, 2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( 0.010, Const.round( 0.012, 2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( 0.010, Const.round( 0.012, 2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( 0.010, Const.round( 0.012, 2, Const.ROUND_HALF_CEILING ) ); assertEquals( 0.020, Const.round( 0.015, 2, BigDecimal.ROUND_UP ) ); assertEquals( 0.010, Const.round( 0.015, 2, BigDecimal.ROUND_DOWN ) ); assertEquals( 0.020, Const.round( 0.015, 2, BigDecimal.ROUND_CEILING ) ); assertEquals( 0.010, Const.round( 0.015, 2, BigDecimal.ROUND_FLOOR ) ); assertEquals( 0.020, Const.round( 0.015, 2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( 0.010, Const.round( 0.015, 2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( 0.020, Const.round( 0.015, 2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( 0.020, Const.round( 0.015, 2, Const.ROUND_HALF_CEILING ) ); assertEquals( 0.020, Const.round( 0.017, 2, BigDecimal.ROUND_UP ) ); assertEquals( 0.010, Const.round( 0.017, 2, BigDecimal.ROUND_DOWN ) ); assertEquals( 0.020, Const.round( 0.017, 2, BigDecimal.ROUND_CEILING ) ); assertEquals( 0.010, Const.round( 0.017, 2, BigDecimal.ROUND_FLOOR ) ); assertEquals( 0.020, Const.round( 0.017, 2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( 0.020, Const.round( 0.017, 2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( 0.020, Const.round( 0.017, 2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( 0.020, Const.round( 0.017, 2, Const.ROUND_HALF_CEILING ) ); assertEquals( 0.020, Const.round( 0.020, 2, BigDecimal.ROUND_UP ) ); assertEquals( 0.020, Const.round( 0.020, 2, BigDecimal.ROUND_DOWN ) ); assertEquals( 0.020, Const.round( 0.020, 2, BigDecimal.ROUND_CEILING ) ); assertEquals( 0.020, Const.round( 0.020, 2, BigDecimal.ROUND_FLOOR ) ); assertEquals( 0.020, Const.round( 0.020, 2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( 0.020, Const.round( 0.020, 2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( 0.020, Const.round( 0.020, 2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( 0.020, Const.round( 0.020, 2, Const.ROUND_HALF_CEILING ) ); assertEquals( 0.030, Const.round( 0.022, 2, BigDecimal.ROUND_UP ) ); assertEquals( 0.020, Const.round( 0.022, 2, BigDecimal.ROUND_DOWN ) ); assertEquals( 0.030, Const.round( 0.022, 2, BigDecimal.ROUND_CEILING ) ); assertEquals( 0.020, Const.round( 0.022, 2, BigDecimal.ROUND_FLOOR ) ); assertEquals( 0.020, Const.round( 0.022, 2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( 0.020, Const.round( 0.022, 2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( 0.020, Const.round( 0.022, 2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( 0.020, Const.round( 0.022, 2, Const.ROUND_HALF_CEILING ) ); assertEquals( 0.030, Const.round( 0.025, 2, BigDecimal.ROUND_UP ) ); assertEquals( 0.020, Const.round( 0.025, 2, BigDecimal.ROUND_DOWN ) ); assertEquals( 0.030, Const.round( 0.025, 2, BigDecimal.ROUND_CEILING ) ); assertEquals( 0.020, Const.round( 0.025, 2, BigDecimal.ROUND_FLOOR ) ); assertEquals( 0.030, Const.round( 0.025, 2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( 0.020, Const.round( 0.025, 2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( 0.020, Const.round( 0.025, 2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( 0.030, Const.round( 0.025, 2, Const.ROUND_HALF_CEILING ) ); assertEquals( 0.030, Const.round( 0.027, 2, BigDecimal.ROUND_UP ) ); assertEquals( 0.020, Const.round( 0.027, 2, BigDecimal.ROUND_DOWN ) ); assertEquals( 0.030, Const.round( 0.027, 2, BigDecimal.ROUND_CEILING ) ); assertEquals( 0.020, Const.round( 0.027, 2, BigDecimal.ROUND_FLOOR ) ); assertEquals( 0.030, Const.round( 0.027, 2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( 0.030, Const.round( 0.027, 2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( 0.030, Const.round( 0.027, 2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( 0.030, Const.round( 0.027, 2, Const.ROUND_HALF_CEILING ) ); assertEquals( -0.010, Const.round( -0.010, 2, BigDecimal.ROUND_UP ) ); assertEquals( -0.010, Const.round( -0.010, 2, BigDecimal.ROUND_DOWN ) ); assertEquals( -0.010, Const.round( -0.010, 2, BigDecimal.ROUND_CEILING ) ); assertEquals( -0.010, Const.round( -0.010, 2, BigDecimal.ROUND_FLOOR ) ); assertEquals( -0.010, Const.round( -0.010, 2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( -0.010, Const.round( -0.010, 2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( -0.010, Const.round( -0.010, 2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( -0.010, Const.round( -0.010, 2, Const.ROUND_HALF_CEILING ) ); assertEquals( -0.020, Const.round( -0.012, 2, BigDecimal.ROUND_UP ) ); assertEquals( -0.010, Const.round( -0.012, 2, BigDecimal.ROUND_DOWN ) ); assertEquals( -0.010, Const.round( -0.012, 2, BigDecimal.ROUND_CEILING ) ); assertEquals( -0.020, Const.round( -0.012, 2, BigDecimal.ROUND_FLOOR ) ); assertEquals( -0.010, Const.round( -0.012, 2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( -0.010, Const.round( -0.012, 2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( -0.010, Const.round( -0.012, 2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( -0.010, Const.round( -0.012, 2, Const.ROUND_HALF_CEILING ) ); assertEquals( -0.020, Const.round( -0.015, 2, BigDecimal.ROUND_UP ) ); assertEquals( -0.010, Const.round( -0.015, 2, BigDecimal.ROUND_DOWN ) ); assertEquals( -0.010, Const.round( -0.015, 2, BigDecimal.ROUND_CEILING ) ); assertEquals( -0.020, Const.round( -0.015, 2, BigDecimal.ROUND_FLOOR ) ); assertEquals( -0.020, Const.round( -0.015, 2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( -0.010, Const.round( -0.015, 2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( -0.020, Const.round( -0.015, 2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( -0.010, Const.round( -0.015, 2, Const.ROUND_HALF_CEILING ) ); assertEquals( -0.020, Const.round( -0.017, 2, BigDecimal.ROUND_UP ) ); assertEquals( -0.010, Const.round( -0.017, 2, BigDecimal.ROUND_DOWN ) ); assertEquals( -0.010, Const.round( -0.017, 2, BigDecimal.ROUND_CEILING ) ); assertEquals( -0.020, Const.round( -0.017, 2, BigDecimal.ROUND_FLOOR ) ); assertEquals( -0.020, Const.round( -0.017, 2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( -0.020, Const.round( -0.017, 2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( -0.020, Const.round( -0.017, 2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( -0.020, Const.round( -0.017, 2, Const.ROUND_HALF_CEILING ) ); assertEquals( -0.020, Const.round( -0.020, 2, BigDecimal.ROUND_UP ) ); assertEquals( -0.020, Const.round( -0.020, 2, BigDecimal.ROUND_DOWN ) ); assertEquals( -0.020, Const.round( -0.020, 2, BigDecimal.ROUND_CEILING ) ); assertEquals( -0.020, Const.round( -0.020, 2, BigDecimal.ROUND_FLOOR ) ); assertEquals( -0.020, Const.round( -0.020, 2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( -0.020, Const.round( -0.020, 2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( -0.020, Const.round( -0.020, 2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( -0.020, Const.round( -0.020, 2, Const.ROUND_HALF_CEILING ) ); assertEquals( -0.030, Const.round( -0.022, 2, BigDecimal.ROUND_UP ) ); assertEquals( -0.020, Const.round( -0.022, 2, BigDecimal.ROUND_DOWN ) ); assertEquals( -0.020, Const.round( -0.022, 2, BigDecimal.ROUND_CEILING ) ); assertEquals( -0.030, Const.round( -0.022, 2, BigDecimal.ROUND_FLOOR ) ); assertEquals( -0.020, Const.round( -0.022, 2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( -0.020, Const.round( -0.022, 2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( -0.020, Const.round( -0.022, 2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( -0.020, Const.round( -0.022, 2, Const.ROUND_HALF_CEILING ) ); assertEquals( -0.030, Const.round( -0.025, 2, BigDecimal.ROUND_UP ) ); assertEquals( -0.020, Const.round( -0.025, 2, BigDecimal.ROUND_DOWN ) ); assertEquals( -0.020, Const.round( -0.025, 2, BigDecimal.ROUND_CEILING ) ); assertEquals( -0.030, Const.round( -0.025, 2, BigDecimal.ROUND_FLOOR ) ); assertEquals( -0.030, Const.round( -0.025, 2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( -0.020, Const.round( -0.025, 2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( -0.020, Const.round( -0.025, 2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( -0.020, Const.round( -0.025, 2, Const.ROUND_HALF_CEILING ) ); assertEquals( -0.030, Const.round( -0.027, 2, BigDecimal.ROUND_UP ) ); assertEquals( -0.020, Const.round( -0.027, 2, BigDecimal.ROUND_DOWN ) ); assertEquals( -0.020, Const.round( -0.027, 2, BigDecimal.ROUND_CEILING ) ); assertEquals( -0.030, Const.round( -0.027, 2, BigDecimal.ROUND_FLOOR ) ); assertEquals( -0.030, Const.round( -0.027, 2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( -0.030, Const.round( -0.027, 2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( -0.030, Const.round( -0.027, 2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( -0.030, Const.round( -0.027, 2, Const.ROUND_HALF_CEILING ) ); assertEquals( 100.0, Const.round( 100.0, -2, BigDecimal.ROUND_UP ) ); assertEquals( 100.0, Const.round( 100.0, -2, BigDecimal.ROUND_DOWN ) ); assertEquals( 100.0, Const.round( 100.0, -2, BigDecimal.ROUND_CEILING ) ); assertEquals( 100.0, Const.round( 100.0, -2, BigDecimal.ROUND_FLOOR ) ); assertEquals( 100.0, Const.round( 100.0, -2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( 100.0, Const.round( 100.0, -2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( 100.0, Const.round( 100.0, -2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( 100.0, Const.round( 100.0, -2, Const.ROUND_HALF_CEILING ) ); assertEquals( 200.0, Const.round( 120.0, -2, BigDecimal.ROUND_UP ) ); assertEquals( 100.0, Const.round( 120.0, -2, BigDecimal.ROUND_DOWN ) ); assertEquals( 200.0, Const.round( 120.0, -2, BigDecimal.ROUND_CEILING ) ); assertEquals( 100.0, Const.round( 120.0, -2, BigDecimal.ROUND_FLOOR ) ); assertEquals( 100.0, Const.round( 120.0, -2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( 100.0, Const.round( 120.0, -2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( 100.0, Const.round( 120.0, -2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( 100.0, Const.round( 120.0, -2, Const.ROUND_HALF_CEILING ) ); assertEquals( 200.0, Const.round( 150.0, -2, BigDecimal.ROUND_UP ) ); assertEquals( 100.0, Const.round( 150.0, -2, BigDecimal.ROUND_DOWN ) ); assertEquals( 200.0, Const.round( 150.0, -2, BigDecimal.ROUND_CEILING ) ); assertEquals( 100.0, Const.round( 150.0, -2, BigDecimal.ROUND_FLOOR ) ); assertEquals( 200.0, Const.round( 150.0, -2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( 100.0, Const.round( 150.0, -2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( 200.0, Const.round( 150.0, -2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( 200.0, Const.round( 150.0, -2, Const.ROUND_HALF_CEILING ) ); assertEquals( 200.0, Const.round( 170.0, -2, BigDecimal.ROUND_UP ) ); assertEquals( 100.0, Const.round( 170.0, -2, BigDecimal.ROUND_DOWN ) ); assertEquals( 200.0, Const.round( 170.0, -2, BigDecimal.ROUND_CEILING ) ); assertEquals( 100.0, Const.round( 170.0, -2, BigDecimal.ROUND_FLOOR ) ); assertEquals( 200.0, Const.round( 170.0, -2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( 200.0, Const.round( 170.0, -2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( 200.0, Const.round( 170.0, -2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( 200.0, Const.round( 170.0, -2, Const.ROUND_HALF_CEILING ) ); assertEquals( 200.0, Const.round( 200.0, -2, BigDecimal.ROUND_UP ) ); assertEquals( 200.0, Const.round( 200.0, -2, BigDecimal.ROUND_DOWN ) ); assertEquals( 200.0, Const.round( 200.0, -2, BigDecimal.ROUND_CEILING ) ); assertEquals( 200.0, Const.round( 200.0, -2, BigDecimal.ROUND_FLOOR ) ); assertEquals( 200.0, Const.round( 200.0, -2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( 200.0, Const.round( 200.0, -2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( 200.0, Const.round( 200.0, -2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( 200.0, Const.round( 200.0, -2, Const.ROUND_HALF_CEILING ) ); assertEquals( 300.0, Const.round( 220.0, -2, BigDecimal.ROUND_UP ) ); assertEquals( 200.0, Const.round( 220.0, -2, BigDecimal.ROUND_DOWN ) ); assertEquals( 300.0, Const.round( 220.0, -2, BigDecimal.ROUND_CEILING ) ); assertEquals( 200.0, Const.round( 220.0, -2, BigDecimal.ROUND_FLOOR ) ); assertEquals( 200.0, Const.round( 220.0, -2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( 200.0, Const.round( 220.0, -2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( 200.0, Const.round( 220.0, -2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( 200.0, Const.round( 220.0, -2, Const.ROUND_HALF_CEILING ) ); assertEquals( 300.0, Const.round( 250.0, -2, BigDecimal.ROUND_UP ) ); assertEquals( 200.0, Const.round( 250.0, -2, BigDecimal.ROUND_DOWN ) ); assertEquals( 300.0, Const.round( 250.0, -2, BigDecimal.ROUND_CEILING ) ); assertEquals( 200.0, Const.round( 250.0, -2, BigDecimal.ROUND_FLOOR ) ); assertEquals( 300.0, Const.round( 250.0, -2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( 200.0, Const.round( 250.0, -2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( 200.0, Const.round( 250.0, -2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( 300.0, Const.round( 250.0, -2, Const.ROUND_HALF_CEILING ) ); assertEquals( 300.0, Const.round( 270.0, -2, BigDecimal.ROUND_UP ) ); assertEquals( 200.0, Const.round( 270.0, -2, BigDecimal.ROUND_DOWN ) ); assertEquals( 300.0, Const.round( 270.0, -2, BigDecimal.ROUND_CEILING ) ); assertEquals( 200.0, Const.round( 270.0, -2, BigDecimal.ROUND_FLOOR ) ); assertEquals( 300.0, Const.round( 270.0, -2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( 300.0, Const.round( 270.0, -2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( 300.0, Const.round( 270.0, -2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( 300.0, Const.round( 270.0, -2, Const.ROUND_HALF_CEILING ) ); assertEquals( -100.0, Const.round( -100.0, -2, BigDecimal.ROUND_UP ) ); assertEquals( -100.0, Const.round( -100.0, -2, BigDecimal.ROUND_DOWN ) ); assertEquals( -100.0, Const.round( -100.0, -2, BigDecimal.ROUND_CEILING ) ); assertEquals( -100.0, Const.round( -100.0, -2, BigDecimal.ROUND_FLOOR ) ); assertEquals( -100.0, Const.round( -100.0, -2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( -100.0, Const.round( -100.0, -2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( -100.0, Const.round( -100.0, -2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( -100.0, Const.round( -100.0, -2, Const.ROUND_HALF_CEILING ) ); assertEquals( -200.0, Const.round( -120.0, -2, BigDecimal.ROUND_UP ) ); assertEquals( -100.0, Const.round( -120.0, -2, BigDecimal.ROUND_DOWN ) ); assertEquals( -100.0, Const.round( -120.0, -2, BigDecimal.ROUND_CEILING ) ); assertEquals( -200.0, Const.round( -120.0, -2, BigDecimal.ROUND_FLOOR ) ); assertEquals( -100.0, Const.round( -120.0, -2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( -100.0, Const.round( -120.0, -2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( -100.0, Const.round( -120.0, -2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( -100.0, Const.round( -120.0, -2, Const.ROUND_HALF_CEILING ) ); assertEquals( -200.0, Const.round( -150.0, -2, BigDecimal.ROUND_UP ) ); assertEquals( -100.0, Const.round( -150.0, -2, BigDecimal.ROUND_DOWN ) ); assertEquals( -100.0, Const.round( -150.0, -2, BigDecimal.ROUND_CEILING ) ); assertEquals( -200.0, Const.round( -150.0, -2, BigDecimal.ROUND_FLOOR ) ); assertEquals( -200.0, Const.round( -150.0, -2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( -100.0, Const.round( -150.0, -2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( -200.0, Const.round( -150.0, -2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( -100.0, Const.round( -150.0, -2, Const.ROUND_HALF_CEILING ) ); assertEquals( -200.0, Const.round( -170.0, -2, BigDecimal.ROUND_UP ) ); assertEquals( -100.0, Const.round( -170.0, -2, BigDecimal.ROUND_DOWN ) ); assertEquals( -100.0, Const.round( -170.0, -2, BigDecimal.ROUND_CEILING ) ); assertEquals( -200.0, Const.round( -170.0, -2, BigDecimal.ROUND_FLOOR ) ); assertEquals( -200.0, Const.round( -170.0, -2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( -200.0, Const.round( -170.0, -2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( -200.0, Const.round( -170.0, -2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( -200.0, Const.round( -170.0, -2, Const.ROUND_HALF_CEILING ) ); assertEquals( -200.0, Const.round( -200.0, -2, BigDecimal.ROUND_UP ) ); assertEquals( -200.0, Const.round( -200.0, -2, BigDecimal.ROUND_DOWN ) ); assertEquals( -200.0, Const.round( -200.0, -2, BigDecimal.ROUND_CEILING ) ); assertEquals( -200.0, Const.round( -200.0, -2, BigDecimal.ROUND_FLOOR ) ); assertEquals( -200.0, Const.round( -200.0, -2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( -200.0, Const.round( -200.0, -2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( -200.0, Const.round( -200.0, -2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( -200.0, Const.round( -200.0, -2, Const.ROUND_HALF_CEILING ) ); assertEquals( -300.0, Const.round( -220.0, -2, BigDecimal.ROUND_UP ) ); assertEquals( -200.0, Const.round( -220.0, -2, BigDecimal.ROUND_DOWN ) ); assertEquals( -200.0, Const.round( -220.0, -2, BigDecimal.ROUND_CEILING ) ); assertEquals( -300.0, Const.round( -220.0, -2, BigDecimal.ROUND_FLOOR ) ); assertEquals( -200.0, Const.round( -220.0, -2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( -200.0, Const.round( -220.0, -2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( -200.0, Const.round( -220.0, -2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( -200.0, Const.round( -220.0, -2, Const.ROUND_HALF_CEILING ) ); assertEquals( -300.0, Const.round( -250.0, -2, BigDecimal.ROUND_UP ) ); assertEquals( -200.0, Const.round( -250.0, -2, BigDecimal.ROUND_DOWN ) ); assertEquals( -200.0, Const.round( -250.0, -2, BigDecimal.ROUND_CEILING ) ); assertEquals( -300.0, Const.round( -250.0, -2, BigDecimal.ROUND_FLOOR ) ); assertEquals( -300.0, Const.round( -250.0, -2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( -200.0, Const.round( -250.0, -2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( -200.0, Const.round( -250.0, -2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( -200.0, Const.round( -250.0, -2, Const.ROUND_HALF_CEILING ) ); assertEquals( -300.0, Const.round( -270.0, -2, BigDecimal.ROUND_UP ) ); assertEquals( -200.0, Const.round( -270.0, -2, BigDecimal.ROUND_DOWN ) ); assertEquals( -200.0, Const.round( -270.0, -2, BigDecimal.ROUND_CEILING ) ); assertEquals( -300.0, Const.round( -270.0, -2, BigDecimal.ROUND_FLOOR ) ); assertEquals( -300.0, Const.round( -270.0, -2, BigDecimal.ROUND_HALF_UP ) ); assertEquals( -300.0, Const.round( -270.0, -2, BigDecimal.ROUND_HALF_DOWN ) ); assertEquals( -300.0, Const.round( -270.0, -2, BigDecimal.ROUND_HALF_EVEN ) ); assertEquals( -300.0, Const.round( -270.0, -2, Const.ROUND_HALF_CEILING ) ); assertEquals( Double.NaN, Const.round( Double.NaN, 0, BigDecimal.ROUND_UP ) ); assertEquals( Double.NEGATIVE_INFINITY, Const.round( Double.NEGATIVE_INFINITY, 0, BigDecimal.ROUND_UP ) ); assertEquals( Double.POSITIVE_INFINITY, Const.round( Double.POSITIVE_INFINITY, 0, BigDecimal.ROUND_UP ) ); }
public static double round( double f, int places ) { return round( f, places, java.math.BigDecimal.ROUND_HALF_EVEN ); }
Const { public static double round( double f, int places ) { return round( f, places, java.math.BigDecimal.ROUND_HALF_EVEN ); } }
Const { public static double round( double f, int places ) { return round( f, places, java.math.BigDecimal.ROUND_HALF_EVEN ); } }
Const { public static double round( double f, int places ) { return round( f, places, java.math.BigDecimal.ROUND_HALF_EVEN ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); }
Const { public static double round( double f, int places ) { return round( f, places, java.math.BigDecimal.ROUND_HALF_EVEN ); } static double round( double f, int places ); static double round( double f, int places, int roundingMode ); static BigDecimal round( BigDecimal f, int places, int roundingMode ); static long round( long f, int places, int roundingMode ); static int toInt( String str, int def ); static long toLong( String str, long def ); static double toDouble( String str, double def ); static Date toDate( String str, Date def ); static boolean isSpace( char c ); static String ltrim( String source ); static String rtrim( String source ); static String trim( String str ); static String rightPad( String ret, int limit ); static String rightPad( StringBuffer ret, int limit ); static String rightPad( StringBuilder ret, int limit ); static String replace( String string, String repl, String with ); static void repl( StringBuffer str, String code, String repl ); static void repl( StringBuilder str, String code, String repl ); static int nrSpacesBefore( String field ); static int nrSpacesAfter( String field ); static boolean onlySpaces( String str ); static String getOS(); static String getQuoteCharByOS(); static String optionallyQuoteStringByOS( String string ); static boolean isWindows(); static boolean isLinux(); static boolean isOSX(); static boolean isKDE(); static String getHostname(); static String getHostnameReal(); static String getIPAddress(); static String getIPAddress( String networkInterfaceName ); static String getMACAddress(); static String getUserHomeDirectory(); static String getKettleDirectory(); static String getUserBaseDir(); static String getDIHomeDirectory(); static String getSharedObjectsFile(); static String getKettleLocalRepositoriesFile(); static String getKettleUserRepositoriesFile(); static String getKettleLocalCartePasswordFile(); static String getKettleCartePasswordFile(); static String getBaseDocUrl(); static String getDocUrl( final String uri ); static String getEnvironmentVariable( String variable, String deflt ); @Deprecated static String replEnv( String string ); @Deprecated static String[] replEnv( String[] string ); static String NVL( String source, String def ); static String nullToEmpty( String source ); static int indexOfString( String lookup, String[] array ); static int[] indexsOfStrings( String[] lookup, String[] array ); static int[] indexsOfFoundStrings( String[] lookup, String[] array ); static int indexOfString( String lookup, List<String> list ); static String[] sortStrings( String[] input ); static String[] splitString( String string, String separator ); static String[] splitString( String string, char separator ); static String[] splitString( String string, char separator, boolean escape ); static String[] splitPath( String path, String separator ); static String[] splitString( String stringToSplit, String delimiter, String enclosure ); static String[] splitString( String stringToSplit, String delimiter, String enclosure, boolean removeEnclosure ); static String[] getDistinctStrings( String[] strings ); static String getStackTracker( Throwable e ); static String getClassicStackTrace( Throwable e ); static String getCustomStackTrace( Throwable aThrowable ); @Deprecated static boolean isEmpty( String val ); @Deprecated static boolean isEmpty( StringBuffer val ); @Deprecated static boolean isEmpty( String[] vals ); @Deprecated static boolean isEmpty( CharSequence val ); @Deprecated static boolean isEmpty( CharSequence[] vals ); @Deprecated static boolean isEmpty( Object[] array ); @Deprecated static boolean isEmpty( List<?> list ); static ClassLoader createNewClassLoader(); static byte[] createByteArray( int size ); static String initCap( String string ); static String createFilename( String name ); static String createFilename( String directory, String name, String extension ); static String createName( String filename ); static String filenameOnly( String sFullPath ); static String[] getDateFormats(); static String[] getNumberFormats(); static String[] getConversionFormats(); static String[] getTransformationAndJobFilterNames(); static String[] getTransformationFilterNames(); static String[] getJobFilterNames(); static long nanoTime(); static String trimToType( String string, int trimType ); static String safeAppendDirectory( String dir, String file ); static String[] getEmptyPaddedStrings(); static int getPercentageFreeMemory(); static String removeDigits( String input ); static String getDigitsOnly( String input ); static Date removeTimeFromDate( Date input ); static String escapeXML( String content ); static String escapeHtml( String content ); static String unEscapeHtml( String content ); static String unEscapeXml( String content ); static String escapeSQL( String content ); static String removeCRLF( String in ); static String removeChar( String in, char badChar ); static String removeCR( String in ); static String removeLF( String in ); static String removeTAB( String in ); static Date addTimeToDate( Date input, String time, String DateFormat ); static int decodeTime( String s, String DateFormat ); static int getOccurenceString( String string, String searchFor ); static String[] GetAvailableFontNames(); static String getKettlePropertiesFileHeader(); static String protectXMLCDATA( String content ); static int getOcuranceString( String string, String searchFor ); static String escapeXml( String content ); static String Lpad( String valueToPad, String filler, int size ); static String Rpad( String valueToPad, String filler, int size ); static boolean classIsOrExtends( Class<?> clazz, Class<?> superClass ); static String getDeprecatedPrefix(); @Deprecated static final String VERSION; static final String COPYRIGHT_YEAR; static final int TIMEOUT_GET_MILLIS; static final int TIMEOUT_PUT_MILLIS; static final int ROWS_UPDATE; static final int ROWS_IN_ROWSET; static final int FETCH_SIZE; static final int SORT_SIZE; static final int HEARTBEAT_PERIODIC_INTERVAL_IN_SECS; static final String FILE_SEPARATOR; static final String PATH_SEPARATOR; static final String CR; static final String DOSCR; static final String EMPTY_STRING; static final String JAVA_VERSION; @Deprecated static final String USER_HOME_DIRECTORY; static String JNDI_DIRECTORY; static final String PLUGIN_BASE_FOLDERS_PROP; static final String DEFAULT_PLUGIN_BASE_FOLDERS; static final Date MIN_DATE; static final Date MAX_DATE; static final int MIN_YEAR; static final int MAX_YEAR; static final int RIGHT; static final int LENGTH; static final int MARGIN; static final int MIDDLE_PCT; static final int ARROW_WIDTH; static final int FORM_MARGIN; static final int SHADOW_SIZE; static final int SYMBOLSIZE; static final int MAX_FILE_HIST; static final Locale DEFAULT_LOCALE; static final char DEFAULT_DECIMAL_SEPARATOR; static final char DEFAULT_GROUPING_SEPARATOR; static final String DEFAULT_CURRENCY_SYMBOL; static final String DEFAULT_NUMBER_FORMAT; static final String NULL_STRING; static final String NULL_NUMBER; static final String NULL_DATE; static final String NULL_BIGNUMBER; static final String NULL_BOOLEAN; static final String NULL_INTEGER; static final String NULL_BINARY; static final String NULL_NONE; static final int ROUND_HALF_CEILING; static final String CHEF_LOG_FILE; static final String SPOON_LOG_FILE; static final String MENU_LOG_FILE; static final String GENERALIZED_DATE_TIME_FORMAT; static final String GENERALIZED_DATE_TIME_FORMAT_MILLIS; static final String XML_ENCODING; static final String[] STRING_TRANS_AND_JOB_FILTER_EXT; static final String STRING_TRANS_DEFAULT_EXT; static final String[] STRING_TRANS_FILTER_EXT; static final String STRING_JOB_DEFAULT_EXT; static final String[] STRING_JOB_FILTER_EXT; static final String KETTLE_PROPERTIES; static final String SHARED_DATA_FILE; static final String INTERNAL_VARIABLE_PREFIX; static final String INTERNAL_VARIABLE_KETTLE_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_VERSION; static final String INTERNAL_VARIABLE_KETTLE_BUILD_DATE; static final String INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_FILENAME_NAME; static final String INTERNAL_VARIABLE_JOB_NAME; static final String INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_JOB_RUN_ID; static final String INTERNAL_VARIABLE_JOB_RUN_ATTEMPTNR; static final String VARIABLE_HEARTBEAT_PERIODIC_INTERVAL_SECS; static final String VARIABLE_MONITORING_SNMP_TRAPS_ENABLED; static final String INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY; static final String[] INTERNAL_TRANS_VARIABLES; static final String[] INTERNAL_JOB_VARIABLES; static final String[] DEPRECATED_VARIABLES; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY; static final String INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_NAME; static final String INTERNAL_VARIABLE_TRANSFORMATION_REPOSITORY_DIRECTORY; static final String INTERNAL_VARIABLE_STEP_PARTITION_ID; static final String INTERNAL_VARIABLE_STEP_PARTITION_NR; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NUMBER; static final String INTERNAL_VARIABLE_SLAVE_SERVER_NAME; static final String INTERNAL_VARIABLE_CLUSTER_SIZE; static final String INTERNAL_VARIABLE_STEP_UNIQUE_NUMBER; static final String INTERNAL_VARIABLE_CLUSTER_MASTER; static final String INTERNAL_VARIABLE_CLUSTER_RUN_ID; static final String INTERNAL_VARIABLE_STEP_UNIQUE_COUNT; static final String INTERNAL_VARIABLE_STEP_NAME; static final String INTERNAL_VARIABLE_STEP_COPYNR; static final int MAX_NR_LOG_LINES; static final int MAX_NR_HISTORY_LINES; static final int HISTORY_LINES_FETCH_SIZE; static final int MAX_LOG_LINE_TIMEOUT_MINUTES; static final int WARNING; static final int ERROR; static final int INFO; static final int NOTE_MARGIN; static final int MAX_UNDO; static final String KETTLE_VARIABLES_FILE; static final String KETTLE_LOG_SIZE_LIMIT; static final String KETTLE_TRANS_LOG_DB; static final String KETTLE_TRANS_LOG_SCHEMA; static final String KETTLE_TRANS_LOG_TABLE; static final String KETTLE_JOB_LOG_DB; static final String KETTLE_JOB_LOG_SCHEMA; static final String KETTLE_SLAVE_DETECTION_TIMER; static final String KETTLE_JOB_LOG_TABLE; static final String KETTLE_TRANS_PERFORMANCE_LOG_DB; static final String KETTLE_TRANS_PERFORMANCE_LOG_SCHEMA; static final String KETTLE_TRANS_PERFORMANCE_LOG_TABLE; static final String KETTLE_JOBENTRY_LOG_DB; static final String KETTLE_JOBENTRY_LOG_SCHEMA; static final String KETTLE_JOBENTRY_LOG_TABLE; static final String KETTLE_STEP_LOG_DB; static final String KETTLE_STEP_LOG_SCHEMA; static final String KETTLE_STEP_LOG_TABLE; static final String KETTLE_CHANNEL_LOG_DB; static final String KETTLE_CHANNEL_LOG_SCHEMA; static final String KETTLE_CHANNEL_LOG_TABLE; static final String KETTLE_METRICS_LOG_DB; static final String KETTLE_METRICS_LOG_SCHEMA; static final String KETTLE_METRICS_LOG_TABLE; static final String KETTLE_CHECKPOINT_LOG_DB; static final String KETTLE_CHECKPOINT_LOG_SCHEMA; static final String KETTLE_CHECKPOINT_LOG_TABLE; static final String KETTLE_SHARED_OBJECTS; static final String KETTLE_EMPTY_STRING_DIFFERS_FROM_NULL; static final String KETTLE_LENIENT_STRING_TO_NUMBER_CONVERSION; static final String KETTLE_COMPATIBILITY_DB_IGNORE_TIMEZONE; static final String KETTLE_COMPATIBILITY_IMPORT_PATH_ADDITION_ON_VARIABLES; static final String KETTLE_COMPATIBILITY_IGNORE_TABLE_LOGGING; static final String KETTLE_COMPATIBILITY_TEXT_FILE_OUTPUT_APPEND_NO_HEADER; static final String KETTLE_COMPATIBILITY_MERGE_ROWS_USE_REFERENCE_STREAM_WHEN_IDENTICAL; static final String KETTLE_COMPATIBILITY_MEMORY_GROUP_BY_SUM_AVERAGE_RETURN_NUMBER_TYPE; static final String KETTLE_SYSTEM_HOSTNAME; static final String KETTLE_MAX_LOG_SIZE_IN_LINES; static final String KETTLE_MAX_LOG_TIMEOUT_IN_MINUTES; static final String KETTLE_REDIRECT_STDERR; static final String KETTLE_REDIRECT_STDOUT; static final String KETTLE_CARTE_OBJECT_TIMEOUT_MINUTES; static final String KETTLE_STEP_PERFORMANCE_SNAPSHOT_LIMIT; static final String KETTLE_MAX_JOB_TRACKER_SIZE; static final String KETTLE_MAX_JOB_ENTRIES_LOGGED; static final String KETTLE_MAX_LOGGING_REGISTRY_SIZE; static final String KETTLE_LOG_TAB_REFRESH_DELAY; static final String KETTLE_LOG_TAB_REFRESH_PERIOD; static final String KETTLE_SAP_CONNECTION_FACTORY; static final String KETTLE_SAP_CONNECTION_FACTORY_DEFAULT_NAME; static final String KETTLE_PLUGIN_CLASSES; static final String KETTLE_PLUGIN_PACKAGES; static final String KETTLE_TRANS_ROWSET_SIZE; static final String VERSION_COMMENT_INITIAL_VERSION; static final String VERSION_COMMENT_EDIT_VERSION; static final String XML_FILE_KETTLE_STEPS; static final String KETTLE_CORE_STEPS_FILE; static final String XML_FILE_KETTLE_PARTITION_PLUGINS; static final String KETTLE_CORE_JOBENTRIES_FILE; static final String XML_FILE_KETTLE_SERVLETS; static final String XML_FILE_KETTLE_VALUEMETA_PLUGINS; static final String XML_FILE_KETTLE_PASSWORD_ENCODER_PLUGINS; static final String KETTLE_VALUEMETA_PLUGINS_FILE; static final String KETTLE_PASSWORD_ENCODER_PLUGIN; static final String KETTLE_PASSWORD_ENCODER_PLUGINS_FILE; static final String KETTLE_TWO_WAY_PASSWORD_ENCODER_SEED; static final String XML_FILE_KETTLE_LOGGING_PLUGINS; static final String KETTLE_LOGGING_PLUGINS_FILE; static final String KETTLE_CORE_SERVLETS_FILE; static final String KETTLE_ROWSET_GET_TIMEOUT; static final String KETTLE_ROWSET_PUT_TIMEOUT; static final String KETTLE_BATCHING_ROWSET; static final String KETTLE_DISABLE_CONSOLE_LOGGING; static final String XML_FILE_KETTLE_JOB_ENTRIES; static final String XML_FILE_KETTLE_REPOSITORIES; static final String XML_FILE_KETTLE_DATABASE_TYPES; static final String XML_FILE_KETTLE_COMPRESSION_PROVIDERS; static final String XML_FILE_KETTLE_AUTHENTICATION_PROVIDERS; static final String XML_FILE_KETTLE_EXTENSION_POINTS; static final String XML_FILE_KETTLE_REGISTRY_EXTENSIONS; static final String XML_FILE_KETTLE_LIFECYCLE_LISTENERS; static final String XML_FILE_KETTLE_ENGINES; static final String KETTLE_TRANS_PAN_JVM_EXIT_CODE; static final String KETTLE_DEFAULT_NUMBER_FORMAT; static final String KETTLE_DEFAULT_BIGNUMBER_FORMAT; static final String KETTLE_DEFAULT_INTEGER_FORMAT; static final String KETTLE_DEFAULT_DATE_FORMAT; static final String KETTLE_AGGREGATION_MIN_NULL_IS_VALUED; static final String KETTLE_AGGREGATION_ALL_NULLS_ARE_ZERO; static final String KETTLE_DEFAULT_TIMESTAMP_FORMAT; static final String KETTLE_SPLIT_FIELDS_REMOVE_ENCLOSURE; static final String KETTLE_GLOBAL_LOG_VARIABLES_CLEAR_ON_EXPORT; static final String KETTLE_COMPATIBILITY_CALCULATION_TIMEZONE_DECOMPOSITION; static final String KETTLE_COMPATIBILITY_SET_ERROR_ON_SPECIFIC_JOB_ENTRIES; static final String KETTLE_COMPATIBILITY_SEND_RESULT_XML_WITH_FULL_STATUS; static final String KETTLE_COMPATIBILITY_SELECT_VALUES_TYPE_CHANGE_USES_TYPE_DEFAULTS; static final String XML_FILE_KETTLE_IMPORT_RULES; static final ReleaseType RELEASE; static final String PENTAHO_METASTORE_FOLDER; static final String PENTAHO_METASTORE_NAME; static final String KETTLE_LOG_MARK_MAPPINGS; static final String KETTLE_CARTE_JETTY_ACCEPTORS; static final String KETTLE_CARTE_JETTY_ACCEPT_QUEUE_SIZE; static final String KETTLE_CARTE_JETTY_RES_MAX_IDLE_TIME; static final String VFS_USER_DIR_IS_ROOT; }