@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(); } }
@Test public void testFallback() throws KettleException { when( fallbackSupplier.get() ).thenReturn( trans ); transSupplier = new TransSupplier( meta, log, fallbackSupplier ); Trans transRet = transSupplier.get(); verify( fallbackSupplier ).get(); assertEquals( transRet, trans ); }
@Test public void testWebsocketVersion() throws KettleException { props.setProperty( "KETTLE_AEL_PDI_DAEMON_VERSION", "2.0" ); when( meta.getVariable( "engine" ) ).thenReturn( "spark" ); when( meta.getVariable( "engine.host" ) ).thenReturn( "hostname" ); when( meta.getVariable( "engine.port" ) ).thenReturn( "8080" ); when( meta.nrTransHops() ).thenReturn( 0 ); when( meta.getTransHop( 0 ) ).thenReturn( transHopMeta ); when( meta.realClone( false ) ).thenReturn( meta ); when( transHopMeta.isEnabled() ).thenReturn( false ); transSupplier = new TransSupplier( meta, log, fallbackSupplier ); Trans transRet = transSupplier.get(); assertTrue( transRet instanceof TransWebSocketEngineAdapter ); }
trans = new TransSupplier( transMeta, log, this::createLegacyTrans ).get();
trans = new TransSupplier( transMeta, log, () -> new Trans( meta ) ).get(); trans.setParent( this );