本文整理汇总了Java中org.pentaho.di.core.util.Assert.assertNotNull方法的典型用法代码示例。如果您正苦于以下问题:Java Assert.assertNotNull方法的具体用法?Java Assert.assertNotNull怎么用?Java Assert.assertNotNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.pentaho.di.core.util.Assert
的用法示例。
在下文中一共展示了Assert.assertNotNull方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: define
import org.pentaho.di.core.util.Assert; //导入方法依赖的package包/类
/**
* @param targetTableFields
* ...
* @param dataFile
* ...
* @return this
*/
public FastloadControlBuilder define(final RowMetaInterface targetTableFields, final String dataFile) {
Assert.assertNotNull(targetTableFields, "fields cannot be null");
Assert.assertNotNull(dataFile, "dataFile cannot be null");
this.builder.append("DEFINE ");
for (int i = 0; i < targetTableFields.size(); i++) {
ValueMetaInterface value = targetTableFields.getValueMeta(i);
this.builder.append(value.getName());
// all fields of type VARCHAR. converted by fastload if necessary
int length = 0;
if (value.getType() == ValueMetaInterface.TYPE_DATE) {
length = DEFAULT_DATE_FORMAT.length();
} else {
length = value.getLength();
}
this.builder.append("(" + "VARCHAR(" + length + "), nullif = '" + String.format("%1$#" + length + "s", DEFAULT_NULL_VALUE) + "'), ");
this.builder.append(SystemUtils.LINE_SEPARATOR);
}
this.builder.append(" NEWLINECHAR(VARCHAR(" + SystemUtils.LINE_SEPARATOR.length() + "))");
this.builder.append(" FILE=" + dataFile);
return this.newline();
}
示例2: GoogleAnalyticsApiFacade
import org.pentaho.di.core.util.Assert; //导入方法依赖的package包/类
public GoogleAnalyticsApiFacade( HttpTransport httpTransport, JsonFactory jsonFactory, String application,
String oathServiceEmail, File keyFile )
throws IOException, GeneralSecurityException {
Assert.assertNotNull( httpTransport, "HttpTransport cannot be null" );
Assert.assertNotNull( jsonFactory, "JsonFactory cannot be null" );
Assert.assertNotBlank( application, "Application name cannot be empty" );
Assert.assertNotBlank( oathServiceEmail, "OAuth Service Email name cannot be empty" );
Assert.assertNotNull( keyFile, "OAuth secret key file cannot be null" );
this.httpTransport = httpTransport;
Credential credential = new GoogleCredential.Builder()
.setTransport( httpTransport )
.setJsonFactory( jsonFactory )
.setServiceAccountScopes( AnalyticsScopes.all() )
.setServiceAccountId( oathServiceEmail )
.setServiceAccountPrivateKeyFromP12File( keyFile )
.build();
analytics = new Analytics.Builder( httpTransport, jsonFactory, credential )
.setApplicationName( application )
.build();
}
示例3: testRecordWriter
import org.pentaho.di.core.util.Assert; //导入方法依赖的package包/类
/**
* Write all the rows in the rowData array to an orc file
*
* @throws Exception
*/
private void testRecordWriter() throws Exception {
IPentahoOutputFormat.IPentahoRecordWriter orcRecordWriter = orcOutputFormat.createRecordWriter();
Assert.assertNotNull( orcRecordWriter, "orcRecordWriter should NOT be null!" );
Assert.assertTrue( orcRecordWriter instanceof PentahoOrcRecordWriter,
"orcRecordWriter should be instance of PentahoOrcRecordWriter" );
for ( int i = 0; i < rowData.length; i++ ) {
orcRecordWriter.write( new RowMetaAndData( rowMeta, rowData[ i ] ) );
}
try {
orcRecordWriter.close();
} catch ( Exception e ) {
e.printStackTrace();
}
}
示例4: testRecordWriter
import org.pentaho.di.core.util.Assert; //导入方法依赖的package包/类
private void testRecordWriter( List<AvroOutputField> avroOutputFields, RowMeta rowMeta, Object[] rowData,
IPentahoAvroOutputFormat.COMPRESSION compressionType, String filePath )
throws Exception {
PentahoAvroOutputFormat avroOutputFormat = new PentahoAvroOutputFormat();
avroOutputFormat.setNameSpace( "nameSpace" );
avroOutputFormat.setRecordName( "recordName" );
avroOutputFormat.setFields( avroOutputFields );
avroOutputFormat.setCompression( compressionType );
avroOutputFormat.setOutputFile( filePath );
IPentahoOutputFormat.IPentahoRecordWriter avroRecordWriter = avroOutputFormat.createRecordWriter();
Assert.assertNotNull( avroRecordWriter, "avroRecordWriter should NOT be null!" );
Assert.assertTrue( avroRecordWriter instanceof PentahoAvroRecordWriter,
"avroRecordWriter should be instance of PentahoAvroRecordWriter" );
avroRecordWriter.write( new RowMetaAndData( rowMeta, rowData ) );
try {
avroRecordWriter.close();
} catch ( Exception e ) {
e.printStackTrace();
}
}
示例5: initParquetWriteSupportWhenSchemaIsNotNull
import org.pentaho.di.core.util.Assert; //导入方法依赖的package包/类
@Test
public void initParquetWriteSupportWhenSchemaIsNotNull() {
int pentahoValueMetaTypeFirstRow = 2;
boolean allowNullFirstRow = false;
int pentahoValueMetaTypeSecondRow = 5;
boolean allowNullSecondRow = false;
String schemaFromString = ParquetUtils
.createSchema( pentahoValueMetaTypeFirstRow, allowNullFirstRow, pentahoValueMetaTypeSecondRow,
allowNullSecondRow ).marshall();
SchemaDescription schema = SchemaDescription.unmarshall( schemaFromString );
PentahoParquetWriteSupport writeSupport = new PentahoParquetWriteSupport( schema );
Configuration conf = new Configuration();
conf.set( "fs.defaultFS", "file:///" );
WriteSupport.WriteContext writeContext = writeSupport.init( conf );
Assert.assertNotNull( writeContext );
}
示例6: insert
import org.pentaho.di.core.util.Assert; //导入方法依赖的package包/类
/**
* @param targetTableFields
* ...
* @param tableFieldList
* @param tableName
* ...
* @return ...
*/
public FastloadControlBuilder insert( final RowMetaInterface targetTableFields,
StringListPluginProperty tableFieldList, final String tableName ) {
Assert.assertNotNull( targetTableFields, "targetTableFields cannot be null." );
Assert.assertNotNull( tableName, "TableName cannot be null." );
this.builder.append( "INSERT INTO " + tableName + "(" );
for ( int i = 0; i < targetTableFields.size(); i++ ) {
int tableIndex = tableFieldList.getValue().indexOf( targetTableFields.getValueMeta( i ).getName() );
if ( tableIndex >= 0 ) {
this.builder.append( ":" + targetTableFields.getValueMeta( i ).getName() );
if ( targetTableFields.getValueMeta( i ).getType() == ValueMetaInterface.TYPE_DATE ) {
this.builder.append( "(DATE, FORMAT '" );
this.builder.append( DEFAULT_DATE_FORMAT );
this.builder.append( "')" );
}
if ( i < tableFieldList.size() - 1 ) {
this.builder.append( "," );
}
}
}
this.builder.append( ")" );
return this.newline();
}
示例7: logon
import org.pentaho.di.core.util.Assert; //导入方法依赖的package包/类
/**
* Append log on.
*
* @param dbhost
* DB host, e.g localtd
* @param user
* the user.
* @param password
* the password.
* @return this
* @throws IllegalArgumentException
* if input is invalid.
*/
public FastloadControlBuilder logon(final String dbhost, final String user, final String password)
throws IllegalArgumentException {
Assert.assertNotBlank(dbhost, "DB host must not be blank");
Assert.assertNotBlank(user, "User must not be blank");
Assert.assertNotNull(password, "Password must not be null");
this.builder.append("LOGON ");
this.builder.append(dbhost);
this.builder.append('/');
this.builder.append(user);
this.builder.append(',');
this.builder.append(password);
return this.newline();
}
示例8: insert
import org.pentaho.di.core.util.Assert; //导入方法依赖的package包/类
/**
* @param targetTableFields
* ...
* @param tableName
* ...
* @return ...
*/
public FastloadControlBuilder insert(final RowMetaInterface targetTableFields, final String tableName) {
Assert.assertNotNull(targetTableFields, "targetTableFields cannot be null.");
Assert.assertNotNull(tableName, "TableName cannot be null.");
this.builder.append("INSERT INTO " + tableName + "(");
for (int i = 0; i < targetTableFields.size(); i++) {
this.builder.append(":" + targetTableFields.getValueMeta(i).getName());
if (i < targetTableFields.size() - 1) {
this.builder.append(",");
}
}
this.builder.append(")");
return this.newline();
}
示例9: SimpleFileSelection
import org.pentaho.di.core.util.Assert; //导入方法依赖的package包/类
/**
* Constructor.
*
* @param shell
* shell to set.
* @param textVar
* text variable to edit.
* @param filterExtensions
* filter extensions to set.
* @param filterNames
* filter names to set.
* @throws IllegalArgumentException
* if shell or text variable is null.
*/
public SimpleFileSelection(final Shell shell, final TextVar textVar, final String[] filterExtensions,
final String[] filterNames) throws IllegalArgumentException {
super();
Assert.assertNotNull(shell, "Shell cannot be null");
Assert.assertNotNull(textVar, "Text var cannot be null");
Assert.assertNotNull(filterNames, "Filter names cannot be null");
Assert.assertNotNull(filterExtensions, "Filter extensions cannot be null");
this.shell = shell;
this.textVar = textVar;
this.filterExtensions = new String[filterExtensions.length];
System.arraycopy(filterExtensions, 0, this.filterExtensions, 0, filterExtensions.length);
this.filterNames = new String[filterNames.length];
System.arraycopy(filterNames, 0, this.filterNames, 0, filterNames.length);
}
示例10: createRecordWriterWhenSchemaAndPathIsNotNull
import org.pentaho.di.core.util.Assert; //导入方法依赖的package包/类
@Test
public void createRecordWriterWhenSchemaAndPathIsNotNull() throws Exception {
PentahoParquetOutputFormat pentahoParquetOutputFormat = new PentahoParquetOutputFormat();
String tempFile = Files.createTempDirectory( "parquet" ).toUri().toString();
pentahoParquetOutputFormat.setOutputFile( tempFile.toString() + "test", true );
pentahoParquetOutputFormat.setSchema( ParquetUtils.createSchema() );
IPentahoOutputFormat.IPentahoRecordWriter recordWriter = pentahoParquetOutputFormat.createRecordWriter();
Assert.assertNotNull( recordWriter, "recordWriter should NOT be null!" );
Assert.assertTrue( recordWriter instanceof IPentahoOutputFormat.IPentahoRecordWriter,
"recordWriter should be instance of IPentahoInputFormat.IPentahoRecordReader" );
}
示例11: iterateOverParquetFileWithData
import org.pentaho.di.core.util.Assert; //导入方法依赖的package包/类
@Test
public void iterateOverParquetFileWithData() throws Exception {
initSample();
FileInputFormat.setInputPaths( job, getClass().getClassLoader().getResource( "sample.pqt" ).toExternalForm() );
initializeRecordReader();
PentahoParquetRecordReader recordReader = new PentahoParquetRecordReader( nativeRecordReader );
Assert.assertTrue( recordReader.iterator().hasNext() );
Assert.assertNotNull( recordReader.iterator().next() );
recordReader.close();
}
示例12: define
import org.pentaho.di.core.util.Assert; //导入方法依赖的package包/类
/**
* @param targetTableFields
* ...
* @param dataFile
* ...
* @return this
*/
public FastloadControlBuilder define( final RowMetaInterface targetTableFields,
StringListPluginProperty tableFieldList, final String dataFile ) {
Assert.assertNotNull( targetTableFields, "fields cannot be null" );
Assert.assertNotNull( dataFile, "dataFile cannot be null" );
this.builder.append( "DEFINE " );
for ( int i = 0; i < targetTableFields.size(); i++ ) {
ValueMetaInterface value = targetTableFields.getValueMeta( i );
int tableIndex = tableFieldList.getValue().indexOf( value.getName() );
if ( tableIndex >= 0 ) {
this.builder.append( value.getName() );
// all fields of type VARCHAR. converted by fastload if necessary
int length = 0;
if ( value.getType() == ValueMetaInterface.TYPE_DATE ) {
length = DEFAULT_DATE_FORMAT.length();
} else {
length = value.getLength();
}
this.builder.append( "("
+ "VARCHAR(" + length + "), nullif = '" + String.format( "%1$" + length + "s", DEFAULT_NULL_VALUE )
+ "'), " );
this.builder.append( SystemUtils.LINE_SEPARATOR );
}
}
this.builder.append( " NEWLINECHAR(VARCHAR(" + SystemUtils.LINE_SEPARATOR.length() + "))" );
this.builder.append( " FILE=" + dataFile );
return this.newline();
}
示例13: SimpleFileSelection
import org.pentaho.di.core.util.Assert; //导入方法依赖的package包/类
/**
* Constructor.
*
* @param shell
* shell to set.
* @param textVar
* text variable to edit.
* @param filterExtensions
* filter extensions to set.
* @param filterNames
* filter names to set.
* @throws IllegalArgumentException
* if shell or text variable is null.
*/
public SimpleFileSelection( final Shell shell, final TextVar textVar, final String[] filterExtensions,
final String[] filterNames ) throws IllegalArgumentException {
super();
Assert.assertNotNull( shell, "Shell cannot be null" );
Assert.assertNotNull( textVar, "Text var cannot be null" );
Assert.assertNotNull( filterNames, "Filter names cannot be null" );
Assert.assertNotNull( filterExtensions, "Filter extensions cannot be null" );
this.shell = shell;
this.textVar = textVar;
this.filterExtensions = new String[filterExtensions.length];
System.arraycopy( filterExtensions, 0, this.filterExtensions, 0, filterExtensions.length );
this.filterNames = new String[filterNames.length];
System.arraycopy( filterNames, 0, this.filterNames, 0, filterNames.length );
}
示例14: PluginWidgetFactory
import org.pentaho.di.core.util.Assert; //导入方法依赖的package包/类
/**
* Constructor.
*
* @param shell
* the shell to set.
* @param varSpace
* the variableSpace to be used. e.g. for TextVar
* @throws IllegalArgumentException
* if shell is null.
*/
public PluginWidgetFactory(final Shell shell, final VariableSpace varSpace) throws IllegalArgumentException {
Assert.assertNotNull(shell, "Shell cannot be null");
Assert.assertNotNull(varSpace, "transMeta cannot be null");
this.shell = shell;
this.varSpace = varSpace;
}
示例15: logon
import org.pentaho.di.core.util.Assert; //导入方法依赖的package包/类
/**
* Append log on.
*
* @param dbhost
* DB host, e.g localtd
* @param user
* the user.
* @param password
* the password.
* @return this
* @throws IllegalArgumentException
* if input is invalid.
*/
public FastloadControlBuilder logon( final String dbhost, final String user, final String password ) throws IllegalArgumentException {
Assert.assertNotBlank( dbhost, "DB host must not be blank" );
Assert.assertNotBlank( user, "User must not be blank" );
Assert.assertNotNull( password, "Password must not be null" );
this.builder.append( "LOGON " );
this.builder.append( dbhost );
this.builder.append( '/' );
this.builder.append( user );
this.builder.append( ',' );
this.builder.append( password );
return this.newline();
}