Java Code Examples for org.pentaho.di.core.plugins.PluginRegistry#init()

The following examples show how to use org.pentaho.di.core.plugins.PluginRegistry#init() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MappingMetaTest.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
@Before
public void setUpLoadSave() throws Exception {
  KettleEnvironment.init();
  PluginRegistry.init( false );
  List<String> attributes =
      Arrays.asList( "transName", "fileName", "directoryPath", "allowingMultipleInputs", "allowingMultipleOutputs",
          "specificationMethod", "transObjectId", "inputMappings", "outputMappings", "mappingParameters" );

  Map<String, FieldLoadSaveValidator<?>> attrValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
  attrValidatorMap.put( "specificationMethod", new ObjectLocationSpecificationMethodLoadSaveValidator() );
  attrValidatorMap.put( "transObjectId", new ObjectIdLoadSaveValidator() );
  attrValidatorMap.put( "inputMappings", new ListLoadSaveValidator<MappingIODefinition>( new MappingIODefinitionLoadSaveValidator(), 5 ) );
  attrValidatorMap.put( "outputMappings", new ListLoadSaveValidator<MappingIODefinition>( new MappingIODefinitionLoadSaveValidator(), 5 ) );
  attrValidatorMap.put( "mappingParameters", new MappingParametersLoadSaveValidator() );

  Map<String, FieldLoadSaveValidator<?>> typeValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();

  loadSaveTester =
      new LoadSaveTester( testMetaClass, attributes, new HashMap<String, String>(), new HashMap<String, String>(),
          attrValidatorMap, typeValidatorMap );
}
 
Example 2
Source File: TableCompareMetaTest.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
@Before
public void setUpLoadSave() throws Exception {
  KettleEnvironment.init();
  PluginRegistry.init( false );
  List<String> attributes =
      Arrays.asList( "referenceConnection", "referenceSchemaField", "referenceTableField", "compareConnection",
          "compareSchemaField", "compareTableField", "keyFieldsField", "excludeFieldsField", "nrErrorsField",
          "nrRecordsReferenceField", "nrRecordsCompareField", "nrErrorsLeftJoinField", "nrErrorsInnerJoinField",
          "nrErrorsRightJoinField", "keyDescriptionField", "valueReferenceField", "valueCompareField" );

  Map<String, String> getterMap = new HashMap<String, String>();
  Map<String, String> setterMap = new HashMap<String, String>();

  Map<String, FieldLoadSaveValidator<?>> attrValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
  Map<String, FieldLoadSaveValidator<?>> typeValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();

  loadSaveTester =
      new LoadSaveTester( testMetaClass, attributes, getterMap, setterMap, attrValidatorMap, typeValidatorMap );
}
 
Example 3
Source File: NormaliserMetaTest.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
@Before
public void setUpLoadSave() throws Exception {
  KettleEnvironment.init();
  PluginRegistry.init( false );
  List<String> attributes =
      Arrays.asList( "typeField", "normaliserFields" );

  Map<String, String> getterMap = new HashMap<String, String>();
  Map<String, String> setterMap = new HashMap<String, String>();

  Map<String, FieldLoadSaveValidator<?>> attrValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
  attrValidatorMap.put( "normaliserFields",
      new ArrayLoadSaveValidator<NormaliserMeta.NormaliserField>( new NormaliserFieldLoadSaveValidator(), 5 ) );

  Map<String, FieldLoadSaveValidator<?>> typeValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();

  loadSaveTester =
      new LoadSaveTester( testMetaClass, attributes, new ArrayList<String>(), new ArrayList<String>(),
          getterMap, setterMap, attrValidatorMap, typeValidatorMap, this );
}
 
Example 4
Source File: SetValueConstantMetaTest.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Before
public void setUpLoadSave() throws Exception {
  KettleEnvironment.init();
  PluginRegistry.init( false );
  List<String> attributes =
      Arrays.asList( "fields", "usevar" );

  Map<String, String> getterMap = new HashMap<String, String>() {
    {
      put( "fields", "getFields" );
      put( "usevar", "isUseVars" );
    }
  };
  Map<String, String> setterMap = new HashMap<String, String>() {
    {
      put( "fields", "setFields" );
      put( "usevar", "setUseVars" );
    }
  };

  Map<String, FieldLoadSaveValidator<?>> attrValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
  attrValidatorMap.put( "fields", new ListLoadSaveValidator<>( new SetValueConstantMetaFieldLoadSaveValidator(), 5 )  );
  Map<String, FieldLoadSaveValidator<?>> typeValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();

  loadSaveTester =
      new LoadSaveTester( testMetaClass, attributes, new ArrayList<String>(), new ArrayList<String>(),
          getterMap, setterMap, attrValidatorMap, typeValidatorMap, this );
}
 
Example 5
Source File: MQTTConsumerMetaTest.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void setUpBeforeClass() throws KettleException {
  PluginRegistry.addPluginType( TwoWayPasswordEncoderPluginType.getInstance() );
  PluginRegistry.init( true );
  String passwordEncoderPluginID =
    Const.NVL( EnvUtil.getSystemProperty( Const.KETTLE_PASSWORD_ENCODER_PLUGIN ), "Kettle" );
  Encr.init( passwordEncoderPluginID );
}
 
Example 6
Source File: SalesforceConnectionIT.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void setUpClass() throws KettleException {
  PluginRegistry.addPluginType( TwoWayPasswordEncoderPluginType.getInstance() );
  PluginRegistry.init();
  String passwordEncoderPluginID =
      Const.NVL( EnvUtil.getSystemProperty( Const.KETTLE_PASSWORD_ENCODER_PLUGIN ), "Kettle" );
  Encr.init( passwordEncoderPluginID );
}
 
Example 7
Source File: SalesforceUpsertTest.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void setUpBeforeClass() throws KettleException {
  PluginRegistry.addPluginType( TwoWayPasswordEncoderPluginType.getInstance() );
  PluginRegistry.init();
  String passwordEncoderPluginID =
      Const.NVL( EnvUtil.getSystemProperty( Const.KETTLE_PASSWORD_ENCODER_PLUGIN ), "Kettle" );
  Encr.init( passwordEncoderPluginID );
}
 
Example 8
Source File: TransMetaConverterTest.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void init() throws Exception {
  KettleClientEnvironment.init();
  PluginRegistry.addPluginType( StepPluginType.getInstance() );
  PluginRegistry.init();
  if ( !Props.isInitialized() ) {
    Props.init( 0 );
  }
}
 
Example 9
Source File: StringOperationsMetaTest.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Before
public void setUpLoadSave() throws Exception {
  KettleEnvironment.init();
  PluginRegistry.init( false );
  List<String> attributes =
      Arrays.asList( "padLen", "padChar", "fieldInStream", "fieldOutStream", "trimType", "lowerUpper", "initCap", "maskXML", "digits", "removeSpecialCharacters", "paddingType" );

  FieldLoadSaveValidator<String[]> stringArrayLoadSaveValidator =
      new ArrayLoadSaveValidator<String>( new StringLoadSaveValidator(), 5 );

  Map<String, FieldLoadSaveValidator<?>> attrValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
  attrValidatorMap.put( "padLen", stringArrayLoadSaveValidator );
  attrValidatorMap.put( "padChar", stringArrayLoadSaveValidator );
  attrValidatorMap.put( "fieldInStream", stringArrayLoadSaveValidator );
  attrValidatorMap.put( "fieldOutStream", stringArrayLoadSaveValidator );
  attrValidatorMap.put( "trimType",
    new ArrayLoadSaveValidator<String>( new StringLoadSaveValidator(), 5 ) );
  attrValidatorMap.put( "lowerUpper",
    new ArrayLoadSaveValidator<String>( new StringLoadSaveValidator(), 5 ) );
  attrValidatorMap.put( "initCap",
    new ArrayLoadSaveValidator<String>( new StringLoadSaveValidator(), 5 ) );
  attrValidatorMap.put( "maskXML",
    new ArrayLoadSaveValidator<String>( new StringLoadSaveValidator(), 5 ) );
  attrValidatorMap.put( "digits",
    new ArrayLoadSaveValidator<String>( new StringLoadSaveValidator(), 5 ) );
  attrValidatorMap.put( "removeSpecialCharacters",
    new ArrayLoadSaveValidator<String>( new StringLoadSaveValidator(), 5 ) );
  attrValidatorMap.put( "paddingType",
    new ArrayLoadSaveValidator<String>( new StringLoadSaveValidator(), 5 ) );

  Map<String, FieldLoadSaveValidator<?>> typeValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();

  loadSaveTester =
      new LoadSaveTester( testMetaClass, attributes, new ArrayList<String>(), new ArrayList<String>(),
          new HashMap<String, String>(), new HashMap<String, String>(), attrValidatorMap, typeValidatorMap, this );
}
 
Example 10
Source File: TransWebSocketEngineAdapterTest.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void init() throws Exception {
  KettleClientEnvironment.init();
  PluginRegistry.addPluginType( StepPluginType.getInstance() );
  PluginRegistry.init();
  if ( !Props.isInitialized() ) {
    Props.init( 0 );
  }
}
 
Example 11
Source File: DenormalizerMetaTest.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Before
public void setUpLoadSave() throws Exception {
  KettleEnvironment.init();
  PluginRegistry.init( false );
  List<String> attributes =
      Arrays.asList( "groupField", "keyField", "denormaliserTargetField" );

  Map<String, String> getterMap = new HashMap<String, String>() {
    //CHECKSTYLE IGNORE EmptyBlock FOR NEXT 3 LINES
    {
      // put( "fieldName", "getFieldName" );
    }
  };
  Map<String, String> setterMap = new HashMap<String, String>() {
    //CHECKSTYLE IGNORE EmptyBlock FOR NEXT 3 LINES
    {
      // put( "fieldName", "setFieldName" );
    }
  };
  FieldLoadSaveValidator<String[]> stringArrayLoadSaveValidator =
      new ArrayLoadSaveValidator<String>( new StringLoadSaveValidator(), 5 );

  Map<String, FieldLoadSaveValidator<?>> attrValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
  attrValidatorMap.put( "groupField", stringArrayLoadSaveValidator );
  attrValidatorMap.put( "denormaliserTargetField",
      new ArrayLoadSaveValidator<DenormaliserTargetField>( new DenormaliserTargetFieldLoadSaveValidator(), 5 ) );

  Map<String, FieldLoadSaveValidator<?>> typeValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();

  loadSaveTester =
      new LoadSaveTester( testMetaClass, attributes, new ArrayList<String>(), new ArrayList<String>(),
          getterMap, setterMap, attrValidatorMap, typeValidatorMap, this );
}
 
Example 12
Source File: PropertyOutputIT.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws Exception {
  KettleClientEnvironment.init();
  PluginRegistry.addPluginType( StepPluginType.getInstance() );
  PluginRegistry.init();
  if ( !Props.isInitialized() ) {
    Props.init( 0 );
  }
}
 
Example 13
Source File: DataHandlerTest.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void setUpBeforeClass() throws Exception {
  PluginRegistry.addPluginType( DatabasePluginType.getInstance() );
  PluginRegistry.init();
  KettleLogStore.init();
}
 
Example 14
Source File: MonetDBBulkLoaderMetaTest.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void setUpBeforeClass() throws Exception {
  PluginRegistry.addPluginType( ValueMetaPluginType.getInstance() );
  PluginRegistry.init( false );
}
 
Example 15
Source File: IngresVectorwiseLoaderMetaTest.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
@Before
public void setUpLoadSave() throws Exception {
  KettleEnvironment.init();
  PluginRegistry.init( false );
  List<String> attributes =
      Arrays.asList( "tableName", "fifoFileName", "errorFileName", "continueOnError", "sqlPath",
          "useStandardConversion", "useAuthentication", "encoding", "delimiter", "useSSV",
          "useDynamicVNode", "escapingSpecialCharacters", "bufferSize", "usingVwload",
          "maxNrErrors", "truncatingTable", "fieldStream", "fieldDatabase", "databaseMeta" );

  // Note - "rejectErrors" is not in the above list because although there is a getter/setter for it
  // in the meta class, it's not persisted or loaded. So it's not testable, and like others, there's no
  // UI for it either.
  // MB - 5/2016

  // Note - "fieldFormat" is not in the above list because although there is a getter/setter for it
  // in the meta class, it's not persisted or loaded. So it's not testable, and like others, there's no
  // UI for it either.
  // MB - 5/2016

  Map<String, String> getterMap = new HashMap<String, String>();
  Map<String, String> setterMap = new HashMap<String, String>() {
    {
      put( "tableName", "setTablename" );
    }
  };
  FieldLoadSaveValidator<String[]> stringArrayLoadSaveValidator =
      new ArrayLoadSaveValidator<String>( new StringLoadSaveValidator(), 5 );


  Map<String, FieldLoadSaveValidator<?>> attrValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
  attrValidatorMap.put( "fieldStream", stringArrayLoadSaveValidator );
  attrValidatorMap.put( "fieldDatabase", stringArrayLoadSaveValidator );
  attrValidatorMap.put( "databaseMeta", new DatabaseMetaLoadSaveValidator() );

  Map<String, FieldLoadSaveValidator<?>> typeValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();

  loadSaveTester =
      new LoadSaveTester( testMetaClass, attributes, new ArrayList<String>(), new ArrayList<String>(),
          getterMap, setterMap, attrValidatorMap, typeValidatorMap, this );
}
 
Example 16
Source File: TextFileInputIT.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void setUpBeforeClass() throws Exception {
  PluginRegistry.addPluginType( CompressionPluginType.getInstance() );
  PluginRegistry.init( true );
}
 
Example 17
Source File: MongoDbOutputTest.java    From pentaho-mongodb-plugin with Apache License 2.0 4 votes vote down vote up
@BeforeClass public static void beforeClass() throws Exception {
  PluginRegistry.addPluginType( ValueMetaPluginType.getInstance() );
  PluginRegistry.init();
}
 
Example 18
Source File: ZIPCompressionProviderTest.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void setUpBeforeClass() throws Exception {
  PluginRegistry.addPluginType( CompressionPluginType.getInstance() );
  PluginRegistry.init( false );
}
 
Example 19
Source File: CompressionInputStreamTest.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void setUpBeforeClass() throws Exception {
  PluginRegistry.addPluginType( CompressionPluginType.getInstance() );
  PluginRegistry.init( false );
}
 
Example 20
Source File: KettleClientEnvironment.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
public static synchronized void init( List<PluginTypeInterface> pluginsToLoad ) throws KettleException {
  if ( initialized != null ) {
    return;
  }

  if ( KettleClientEnvironment.instance == null ) {
    KettleClientEnvironment.instance = new KettleClientEnvironment();
  }

  createKettleHome();

  // Read the kettle.properties file before anything else
  //
  EnvUtil.environmentInit();

  // Initialize the logging back-end.
  //
  KettleLogStore.init();

  // Add console output so that folks see what's going on...
  // TODO: make this configurable...
  //
  if ( !"Y".equalsIgnoreCase( System.getProperty( Const.KETTLE_DISABLE_CONSOLE_LOGGING, "N" ) ) ) {
    KettleLogStore.getAppender().addLoggingEventListener( new ConsoleLoggingEventListener() );
  }
  KettleLogStore.getAppender().addLoggingEventListener( new Slf4jLoggingEventListener() );

  // Load plugins
  //
  pluginsToLoad.forEach( PluginRegistry::addPluginType );
  PluginRegistry.init();

  List<PluginInterface> logginPlugins = PluginRegistry.getInstance().getPlugins( LoggingPluginType.class );
  initLogginPlugins( logginPlugins );

  String passwordEncoderPluginID = Const.NVL( EnvUtil.getSystemProperty( Const.KETTLE_PASSWORD_ENCODER_PLUGIN ), "Kettle" );

  Encr.init( passwordEncoderPluginID );

  initialized = new Boolean( true );
}