@Test( expected = RuntimeException.class ) public void testInvalidEngine() throws KettleException { props.setProperty( "KETTLE_AEL_PDI_DAEMON_VERSION", "1.0" ); when( meta.getVariable( "engine" ) ).thenReturn( "invalidEngine" ); transSupplier = new TransSupplier( meta, log, fallbackSupplier ); transSupplier.get(); }
public Trans get() { if ( Utils.isEmpty( transMeta.getVariable( "engine" ) ) ) { log.logBasic( "Using legacy execution engine" ); return fallbackSupplier.get(); } Variables variables = new Variables(); variables.initializeVariablesFrom( null ); String version = variables.getVariable( "KETTLE_AEL_PDI_DAEMON_VERSION", "2.0" ); if ( Const.toDouble( version, 1 ) >= 2 ) { String protocol = transMeta.getVariable( "engine.protocol" ); String host = transMeta.getVariable( "engine.host" ); String port = transMeta.getVariable( "engine.port" ); boolean ssl = "https".equalsIgnoreCase( protocol ) || "wss".equalsIgnoreCase( protocol ); return new TransWebSocketEngineAdapter( transMeta, host, port, ssl ); } else { try { return PluginRegistry.getInstance().getPlugins( EnginePluginType.class ).stream() .filter( useThisEngine() ) .findFirst() .map( plugin -> (Engine) loadPlugin( plugin ) ) .map( engine -> { log.logBasic( "Using execution engine " + engine.getClass().getCanonicalName() ); return (Trans) new TransEngineAdapter( engine, transMeta ); } ) .orElseThrow( () -> new KettleException( "Unable to find engine [" + transMeta.getVariable( "engine" ) + "]" ) ); } catch ( KettleException e ) { log.logError( "Failed to load engine", e ); throw new RuntimeException( e ); } } }
TransSupplier implements Supplier<Trans> { public Trans get() { if ( Utils.isEmpty( transMeta.getVariable( "engine" ) ) ) { log.logBasic( "Using legacy execution engine" ); return fallbackSupplier.get(); } Variables variables = new Variables(); variables.initializeVariablesFrom( null ); String version = variables.getVariable( "KETTLE_AEL_PDI_DAEMON_VERSION", "2.0" ); if ( Const.toDouble( version, 1 ) >= 2 ) { String protocol = transMeta.getVariable( "engine.protocol" ); String host = transMeta.getVariable( "engine.host" ); String port = transMeta.getVariable( "engine.port" ); boolean ssl = "https".equalsIgnoreCase( protocol ) || "wss".equalsIgnoreCase( protocol ); return new TransWebSocketEngineAdapter( transMeta, host, port, ssl ); } else { try { return PluginRegistry.getInstance().getPlugins( EnginePluginType.class ).stream() .filter( useThisEngine() ) .findFirst() .map( plugin -> (Engine) loadPlugin( plugin ) ) .map( engine -> { log.logBasic( "Using execution engine " + engine.getClass().getCanonicalName() ); return (Trans) new TransEngineAdapter( engine, transMeta ); } ) .orElseThrow( () -> new KettleException( "Unable to find engine [" + transMeta.getVariable( "engine" ) + "]" ) ); } catch ( KettleException e ) { log.logError( "Failed to load engine", e ); throw new RuntimeException( e ); } } } }
TransSupplier implements Supplier<Trans> { public Trans get() { if ( Utils.isEmpty( transMeta.getVariable( "engine" ) ) ) { log.logBasic( "Using legacy execution engine" ); return fallbackSupplier.get(); } Variables variables = new Variables(); variables.initializeVariablesFrom( null ); String version = variables.getVariable( "KETTLE_AEL_PDI_DAEMON_VERSION", "2.0" ); if ( Const.toDouble( version, 1 ) >= 2 ) { String protocol = transMeta.getVariable( "engine.protocol" ); String host = transMeta.getVariable( "engine.host" ); String port = transMeta.getVariable( "engine.port" ); boolean ssl = "https".equalsIgnoreCase( protocol ) || "wss".equalsIgnoreCase( protocol ); return new TransWebSocketEngineAdapter( transMeta, host, port, ssl ); } else { try { return PluginRegistry.getInstance().getPlugins( EnginePluginType.class ).stream() .filter( useThisEngine() ) .findFirst() .map( plugin -> (Engine) loadPlugin( plugin ) ) .map( engine -> { log.logBasic( "Using execution engine " + engine.getClass().getCanonicalName() ); return (Trans) new TransEngineAdapter( engine, transMeta ); } ) .orElseThrow( () -> new KettleException( "Unable to find engine [" + transMeta.getVariable( "engine" ) + "]" ) ); } catch ( KettleException e ) { log.logError( "Failed to load engine", e ); throw new RuntimeException( e ); } } } TransSupplier( TransMeta transMeta, LogChannelInterface log, Supplier<Trans> fallbackSupplier ); }
TransSupplier implements Supplier<Trans> { public Trans get() { if ( Utils.isEmpty( transMeta.getVariable( "engine" ) ) ) { log.logBasic( "Using legacy execution engine" ); return fallbackSupplier.get(); } Variables variables = new Variables(); variables.initializeVariablesFrom( null ); String version = variables.getVariable( "KETTLE_AEL_PDI_DAEMON_VERSION", "2.0" ); if ( Const.toDouble( version, 1 ) >= 2 ) { String protocol = transMeta.getVariable( "engine.protocol" ); String host = transMeta.getVariable( "engine.host" ); String port = transMeta.getVariable( "engine.port" ); boolean ssl = "https".equalsIgnoreCase( protocol ) || "wss".equalsIgnoreCase( protocol ); return new TransWebSocketEngineAdapter( transMeta, host, port, ssl ); } else { try { return PluginRegistry.getInstance().getPlugins( EnginePluginType.class ).stream() .filter( useThisEngine() ) .findFirst() .map( plugin -> (Engine) loadPlugin( plugin ) ) .map( engine -> { log.logBasic( "Using execution engine " + engine.getClass().getCanonicalName() ); return (Trans) new TransEngineAdapter( engine, transMeta ); } ) .orElseThrow( () -> new KettleException( "Unable to find engine [" + transMeta.getVariable( "engine" ) + "]" ) ); } catch ( KettleException e ) { log.logError( "Failed to load engine", e ); throw new RuntimeException( e ); } } } TransSupplier( TransMeta transMeta, LogChannelInterface log, Supplier<Trans> fallbackSupplier ); Trans get(); }
TransSupplier implements Supplier<Trans> { public Trans get() { if ( Utils.isEmpty( transMeta.getVariable( "engine" ) ) ) { log.logBasic( "Using legacy execution engine" ); return fallbackSupplier.get(); } Variables variables = new Variables(); variables.initializeVariablesFrom( null ); String version = variables.getVariable( "KETTLE_AEL_PDI_DAEMON_VERSION", "2.0" ); if ( Const.toDouble( version, 1 ) >= 2 ) { String protocol = transMeta.getVariable( "engine.protocol" ); String host = transMeta.getVariable( "engine.host" ); String port = transMeta.getVariable( "engine.port" ); boolean ssl = "https".equalsIgnoreCase( protocol ) || "wss".equalsIgnoreCase( protocol ); return new TransWebSocketEngineAdapter( transMeta, host, port, ssl ); } else { try { return PluginRegistry.getInstance().getPlugins( EnginePluginType.class ).stream() .filter( useThisEngine() ) .findFirst() .map( plugin -> (Engine) loadPlugin( plugin ) ) .map( engine -> { log.logBasic( "Using execution engine " + engine.getClass().getCanonicalName() ); return (Trans) new TransEngineAdapter( engine, transMeta ); } ) .orElseThrow( () -> new KettleException( "Unable to find engine [" + transMeta.getVariable( "engine" ) + "]" ) ); } catch ( KettleException e ) { log.logError( "Failed to load engine", e ); throw new RuntimeException( e ); } } } TransSupplier( TransMeta transMeta, LogChannelInterface log, Supplier<Trans> fallbackSupplier ); Trans get();  }