@Test public void testApplyingDefaultOptions() throws Exception { HashMap<String, String> existingOptions = new HashMap<String, String>(); existingOptions.put("type1.extra", "extraValue"); existingOptions.put("type1.existing", "existingValue"); existingOptions.put("type2.extra", "extraValue2"); HashMap<String, String> newOptions = new HashMap<String, String>(); newOptions.put("type1.new", "newValue"); newOptions.put("type1.existing", "existingDefault"); // Register Natives to create a default DatabaseMeta DatabasePluginType.getInstance().searchPlugins(); DatabaseMeta meta = new DatabaseMeta(); DatabaseInterface type = mock(DatabaseInterface.class); meta.setDatabaseInterface(type); when(type.getExtraOptions()).thenReturn(existingOptions); when(type.getDefaultOptions()).thenReturn(newOptions); meta.applyDefaultOptions(type); verify(type).addExtraOption("type1", "new", "newValue"); verify(type, never()).addExtraOption("type1", "existing", "existingDefault"); }
public static synchronized void init() 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()); } // Load value meta data plugins // PluginRegistry.addPluginType(LoggingPluginType.getInstance()); PluginRegistry.addPluginType(ValueMetaPluginType.getInstance()); PluginRegistry.addPluginType(DatabasePluginType.getInstance()); PluginRegistry.addPluginType(ExtensionPointPluginType.getInstance()); PluginRegistry.init(true); initialized = new Boolean(true); }
@BeforeClass public static void setUpOnce() throws KettlePluginException { // Register Natives to create a default DatabaseMeta DatabasePluginType.getInstance().searchPlugins(); }