org.pentaho.di.core.KettleClientEnvironment Java Examples

The following examples show how to use org.pentaho.di.core.KettleClientEnvironment. 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: RepositoryCleanupUtil.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
/**
 * Use REST API to authenticate provided credentials
 * 
 * @throws Exception
 */
@VisibleForTesting
void authenticateLoginCredentials() throws Exception {
  KettleClientEnvironment.init();

  if ( client == null ) {
    ClientConfig clientConfig = new DefaultClientConfig();
    clientConfig.getFeatures().put( JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE );
    client = Client.create( clientConfig );
    client.addFilter( new HTTPBasicAuthFilter( username, Encr.decryptPasswordOptionallyEncrypted( password ) ) );
  }

  WebResource resource = client.resource( url + AUTHENTICATION + AdministerSecurityAction.NAME );
  String response = resource.get( String.class );

  if ( !response.equals( "true" ) ) {
    throw new Exception( Messages.getInstance().getString( "REPOSITORY_CLEANUP_UTIL.ERROR_0012.ACCESS_DENIED" ) );
  }
}
 
Example #2
Source File: JobEntryEvalTableContentTest.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
@BeforeClass
public static void setUpBeforeClass() throws Exception {
  KettleClientEnvironment.init();
  dbMap.put( DatabaseInterface.class, DBMockIface.class.getName() );
  dbMap.put( InfobrightDatabaseMeta.class, InfobrightDatabaseMeta.class.getName() );

  PluginRegistry preg = PluginRegistry.getInstance();

  PluginInterface mockDbPlugin = mock( PluginInterface.class );
  when( mockDbPlugin.matches( anyString() ) ).thenReturn( true );
  when( mockDbPlugin.isNativePlugin() ).thenReturn( true );
  when( mockDbPlugin.getMainType() ).thenAnswer( (Answer<Class<?>>) invocation -> DatabaseInterface.class );

  when( mockDbPlugin.getPluginType() ).thenAnswer(
    (Answer<Class<? extends PluginTypeInterface>>) invocation -> DatabasePluginType.class );

  when( mockDbPlugin.getIds() ).thenReturn( new String[] { "Oracle", "mock-db-id" } );
  when( mockDbPlugin.getName() ).thenReturn( "mock-db-name" );
  when( mockDbPlugin.getClassMap() ).thenReturn( dbMap );

  preg.registerPlugin( DatabasePluginType.class, mockDbPlugin );
}
 
Example #3
Source File: CapabilityManagerDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public static void main( String[] args ) {

    Display display = new Display(  );
    try {
      KettleEnvironment.init();

      PropsUI.init( display, Props.TYPE_PROPERTIES_SPOON );

      KettleLogStore
          .init( PropsUI.getInstance().getMaxNrLinesInLog(), PropsUI.getInstance().getMaxLogLineTimeoutMinutes() );

    } catch ( KettleException e ) {
      e.printStackTrace();
    }

    KettleClientEnvironment.getInstance().setClient( KettleClientEnvironment.ClientType.SPOON );
    Shell shell = new Shell( display, SWT.DIALOG_TRIM );
    shell.open();
    CapabilityManagerDialog capabilityManagerDialog = new CapabilityManagerDialog( shell );
    capabilityManagerDialog.open();
    while ( !shell.isDisposed() ) {
      if ( !display.readAndDispatch() ) {
        display.sleep();
      }
    }
  }
 
Example #4
Source File: RestorePDIEnvironment.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
void defaultInit() throws Throwable {
  // make sure static class initializers are correctly initialized
  // re-init
  cleanUp();
  KettleClientEnvironment.init();

  // initialize some classes, this will fail if some tests init this classes before any PDI init()
  // the best thing to do is to invoke this ClassRule in every test
  Class.forName( Database.class.getName() );
  Class.forName( Timestamp.class.getName() );
  Class.forName( ValueMetaBase.class.getName() );
  Class.forName( SimpleTimestampFormat.class.getName() );
  Class.forName( SimpleDateFormat.class.getName() );
  Class.forName( XMLHandler.class.getName() );
  Class.forName( LogChannel.class.getName() );
  DatabaseMeta.init();
  ExtensionPointMap.getInstance().reInitialize();
  KettleVFS.getInstance().reset(); // reinit
}
 
Example #5
Source File: RestorePDIEnvironment.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
void cleanUp() {
    KettleClientEnvironment.reset();
    PluginRegistry.getInstance().reset();
    MetricsRegistry.getInstance().reset();
    ExtensionPointMap.getInstance().reset();
    if ( KettleLogStore.isInitialized() ) {
      KettleLogStore.getInstance().reset();
    }
    KettleLogStore.setLogChannelInterfaceFactory( new LogChannelFactory() );
    if ( Props.isInitialized() ) {
      Props.getInstance().reset();
    }
    KettleVFS.getInstance().reset();
    XMLHandlerCache.getInstance().clear();
    ValueMetaFactory.pluginRegistry = PluginRegistry.getInstance();
    // under no circumstance reset the LoggingRegistry
//    LoggingRegistry.getInstance().reset();
  }
 
Example #6
Source File: BaseDatabaseMetaTest.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Before
public void setupOnce() throws Exception {
  nativeMeta = new ConcreteBaseDatabaseMeta();
  nativeMeta.setAccessType( DatabaseMeta.TYPE_ACCESS_NATIVE );
  odbcMeta = new ConcreteBaseDatabaseMeta();
  nativeMeta.setAccessType( DatabaseMeta.TYPE_ACCESS_ODBC );
  jndiMeta = new ConcreteBaseDatabaseMeta();
  KettleClientEnvironment.init();
}
 
Example #7
Source File: LdapSslProtocolIT.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Test
public void testResolvingPasswordVariables() throws KettleException {
  String hostConcrete = "host_concrete";
  String portConcrete = "12345";
  String trustStorePath = "/home/test_path";
  String trustStorePassword = "${PASSWORD_VARIABLE}";
  String trustStorePasswordResolved = "TEST_PASSWORD_VALUE";

  when( mockLdapMeta.getHost() ).thenReturn( hostConcrete );
  when( mockLdapMeta.getPort() ).thenReturn( portConcrete );
  when( mockLdapMeta.getDerefAliases() ).thenReturn( "always" );
  when( mockLdapMeta.getReferrals() ).thenReturn( "follow" );
  when( mockLdapMeta.isUseCertificate() ).thenReturn( true );
  when( mockLdapMeta.isTrustAllCertificates() ).thenReturn( true );
  when( mockLdapMeta.getTrustStorePath() ).thenReturn( trustStorePath );
  when( mockLdapMeta.getTrustStorePassword() ).thenReturn( trustStorePassword );

  when( mockVariableSpace.environmentSubstitute( eq( hostConcrete ) ) ).thenReturn( hostConcrete );
  when( mockVariableSpace.environmentSubstitute( eq( portConcrete ) ) ).thenReturn( portConcrete );
  when( mockVariableSpace.environmentSubstitute( eq( trustStorePath ) ) ).thenReturn( trustStorePath );
  when( mockVariableSpace.environmentSubstitute( eq( trustStorePassword ) ) ).thenReturn( trustStorePasswordResolved );

  KettleClientEnvironment.init();
  TestableLdapProtocol testableLdapProtocol =
          new TestableLdapProtocol( mockLogChannelInterface, mockVariableSpace, mockLdapMeta, null );
  testableLdapProtocol.connect( null, null );
  assertEquals( trustStorePasswordResolved, testableLdapProtocol.trustStorePassword );
}
 
Example #8
Source File: Carte.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
/**
 * Checks that Carte is running and if so, shuts down the Carte server
 *
 * @param hostname
 * @param port
 * @param username
 * @param password
 * @throws ParseException
 * @throws CarteCommandException
 */
@VisibleForTesting
static void callStopCarteRestService( String hostname, String port, String username, String password )
  throws ParseException, CarteCommandException {
  // get information about the remote connection
  try {
    KettleClientEnvironment.init();

    ClientConfig clientConfig = new DefaultClientConfig();
    clientConfig.getFeatures().put( JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE );
    Client client = Client.create( clientConfig );

    client.addFilter( new HTTPBasicAuthFilter( username, Encr.decryptPasswordOptionallyEncrypted( password ) ) );

    // check if the user can access the carte server. Don't really need this call but may want to check it's output at
    // some point
    String contextURL = "http://" + hostname + ":" + port + "/kettle";
    WebResource resource = client.resource( contextURL + "/status/?xml=Y" );
    String response = resource.get( String.class );
    if ( response == null || !response.contains( "<serverstatus>" ) ) {
      throw new Carte.CarteCommandException( BaseMessages.getString( PKG, "Carte.Error.NoServerFound", hostname, ""
          + port ) );
    }

    // This is the call that matters
    resource = client.resource( contextURL + "/stopCarte" );
    response = resource.get( String.class );
    if ( response == null || !response.contains( "Shutting Down" ) ) {
      throw new Carte.CarteCommandException( BaseMessages.getString( PKG, "Carte.Error.NoShutdown", hostname, ""
          + port ) );
    }
  } catch ( Exception e ) {
    throw new Carte.CarteCommandException( BaseMessages.getString( PKG, "Carte.Error.NoServerFound", hostname, ""
        + port ), e );
  }
}
 
Example #9
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 #10
Source File: LdapSslProtocolIT.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Test
public void testResolvingPasswordAndDecryptVariables() throws KettleException {
  String hostConcrete = "host_concrete";
  String portConcrete = "12345";
  String trustStorePath = "/home/test_path";
  String trustStorePassword = "${PASSWORD_VARIABLE}";
  String trustStorePasswordResolved = "Encrypted 2be98afc86aa7f2e4cb79ff228dc6fa8c"; //original value 123456


  when( mockLdapMeta.getHost() ).thenReturn( hostConcrete );
  when( mockLdapMeta.getPort() ).thenReturn( portConcrete );
  when( mockLdapMeta.getDerefAliases() ).thenReturn( "always" );
  when( mockLdapMeta.getReferrals() ).thenReturn( "follow" );
  when( mockLdapMeta.isUseCertificate() ).thenReturn( true );
  when( mockLdapMeta.isTrustAllCertificates() ).thenReturn( true );
  when( mockLdapMeta.getTrustStorePath() ).thenReturn( trustStorePath );
  when( mockLdapMeta.getTrustStorePassword() ).thenReturn( trustStorePassword );

  when( mockVariableSpace.environmentSubstitute( eq( hostConcrete ) ) ).thenReturn( hostConcrete );
  when( mockVariableSpace.environmentSubstitute( eq( portConcrete ) ) ).thenReturn( portConcrete );
  when( mockVariableSpace.environmentSubstitute( eq( trustStorePath ) ) ).thenReturn( trustStorePath );
  when( mockVariableSpace.environmentSubstitute( eq( trustStorePassword ) ) ).thenReturn( trustStorePasswordResolved );

  KettleClientEnvironment.init();
  TestableLdapProtocol testableLdapProtocol =
          new TestableLdapProtocol( mockLogChannelInterface, mockVariableSpace, mockLdapMeta, null );
  testableLdapProtocol.connect( null, null );
  assertEquals( "123456", testableLdapProtocol.trustStorePassword );
}
 
Example #11
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 #12
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 #13
Source File: SubtransExecutorTest.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 #14
Source File: LoadFileInputTest.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void setupBeforeClass() throws KettleException {
  if ( Const.isWindows() ) {
    wasEncoding = System.getProperty( "file.encoding" );
    fiddleWithDefaultCharset( "utf8" );
  }
  KettleClientEnvironment.init();
}
 
Example #15
Source File: Translator2.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public static void main( String[] args ) throws Exception {

    if ( args.length != 2 ) {
      System.err.println( "Usage: Translator <translator.xml> <path-to-source>" );
      System.err.println( "Example:" );
      System.err.println( "sh translator.sh translator.xml ." );
      System.exit( 1 );
    }

    KettleClientEnvironment.init();

    String configFile = args[0];
    String sourceFolder = args[1];

    Display display = new Display();
    LogChannelInterface log = new LogChannel( APP_NAME );
    PropsUI.init( display, Props.TYPE_PROPERTIES_SPOON );

    Translator2 translator = new Translator2( display );
    translator.loadConfiguration( configFile, sourceFolder );
    translator.open();

    try {
      while ( !display.isDisposed() ) {
        if ( !display.readAndDispatch() ) {
          display.sleep();
        }
      }
    } catch ( Throwable e ) {
      log.logError( BaseMessages.getString( PKG, "i18n.UnexpectedError", e.getMessage() ) );
      log.logError( Const.getStackTracker( e ) );
    }
  }
 
Example #16
Source File: ExtensionPointIntegrationTest.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void setupBeforeClass() throws Exception {
  pool = ClassPool.getDefault();
  pool.insertClassPath( new ClassClassPath( ExtensionPointIntegrationTest.class ) );
  for ( KettleExtensionPoint ep : KettleExtensionPoint.values() ) {
    ExtensionPointPluginType.getInstance().registerCustom( createClassRuntime( ep ),
        "custom", "id" + ep.id, ep.id, "no description", null );
  }

  KettleClientEnvironment.init();
}
 
Example #17
Source File: ConnectionControllerITest.java    From pentaho-aggdesigner with GNU General Public License v2.0 5 votes vote down vote up
public ConnectionControllerITest() throws InitializationError {
  super(ConnectionControllerITest.class);
  try {
  	KettleClientEnvironment.init();
  } catch (Exception e) {
  	e.printStackTrace();
  }
}
 
Example #18
Source File: DatabaseMetaTest.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void setUpOnce() throws KettlePluginException, KettleException {
  // Register Natives to create a default DatabaseMeta
  DatabasePluginType.getInstance().searchPlugins();
  ValueMetaPluginType.getInstance().searchPlugins();
  KettleClientEnvironment.init();
}
 
Example #19
Source File: AS400DatabaseMetaTest.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Before
public void setupOnce() throws Exception {
  nativeMeta = new AS400DatabaseMeta();
  nativeMeta.setAccessType( DatabaseMeta.TYPE_ACCESS_NATIVE );
  odbcMeta = new AS400DatabaseMeta();
  odbcMeta.setAccessType( DatabaseMeta.TYPE_ACCESS_ODBC );
  KettleClientEnvironment.init();
}
 
Example #20
Source File: OracleDatabaseMetaTest.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Before
public void setupOnce() throws Exception {
  nativeMeta = new OracleDatabaseMeta();
  odbcMeta = new OracleDatabaseMeta();
  ociMeta = new OracleDatabaseMeta();
  nativeMeta.setAccessType( DatabaseMeta.TYPE_ACCESS_NATIVE );
  odbcMeta.setAccessType( DatabaseMeta.TYPE_ACCESS_ODBC );
  ociMeta.setAccessType( DatabaseMeta.TYPE_ACCESS_OCI );
  //nativeMeta.setSupportsTimestampDataType( true );
  KettleClientEnvironment.init();
}
 
Example #21
Source File: OracleRDBDatabaseMetaTest.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Before
public void setupOnce() throws Exception {
  nativeMeta = new OracleRDBDatabaseMeta();
  odbcMeta = new OracleRDBDatabaseMeta();
  jndiMeta = new OracleRDBDatabaseMeta();
  nativeMeta.setAccessType( DatabaseMeta.TYPE_ACCESS_NATIVE );
  odbcMeta.setAccessType( DatabaseMeta.TYPE_ACCESS_ODBC );
  jndiMeta.setAccessType( DatabaseMeta.TYPE_ACCESS_JNDI );
  KettleClientEnvironment.init();
}
 
Example #22
Source File: XMLOutputMetaTest.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void setUp() throws Exception {
  if ( !KettleClientEnvironment.isInitialized() ) {
    KettleClientEnvironment.init();
  }

}
 
Example #23
Source File: SlaveDelegateTest.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Before
public void setup() throws KettleException {
  KettleClientEnvironment.init();
  mockPurRepository = mock( PurRepository.class );
  slaveDelegate = new SlaveDelegate( mockPurRepository );

  mockSlaveServer = mock( SlaveServer.class );
  when( mockSlaveServer.getHostname() ).thenReturn( PROP_HOST_NAME_VALUE );
  when( mockSlaveServer.getUsername() ).thenReturn( PROP_USERNAME_VALUE );
  when( mockSlaveServer.getPassword() ).thenReturn( PROP_PASSWORD_VALUE );
  when( mockSlaveServer.getPort() ).thenReturn( PROP_PORT_VALUE );
  when( mockSlaveServer.getProxyHostname() ).thenReturn( PROP_PROXY_HOST_NAME_VALUE );
  when( mockSlaveServer.getProxyPort() ).thenReturn( PROP_PROXY_PORT_VALUE );
  when( mockSlaveServer.getWebAppName() ).thenReturn( PROP_WEBAPP_NAME_VALUE );
  when( mockSlaveServer.getNonProxyHosts() ).thenReturn( PROP_NON_PROXY_HOSTS_VALUE );
  when( mockSlaveServer.isMaster() ).thenReturn( PROP_MASTER_VALUE );
  when( mockSlaveServer.isSslMode() ).thenReturn( PROP_USE_HTTPS_PROTOCOL_VALUE );

  mockDataNode = mock( DataNode.class, RETURNS_DEEP_STUBS );
  when( mockDataNode.hasProperty( SlaveDelegate.PROP_HOST_NAME ) ).thenReturn( true );
  when( mockDataNode.getProperty( SlaveDelegate.PROP_HOST_NAME ).getString() ).thenReturn( PROP_HOST_NAME_VALUE );
  when( mockDataNode.hasProperty( SlaveDelegate.PROP_USERNAME ) ).thenReturn( true );
  when( mockDataNode.getProperty( SlaveDelegate.PROP_USERNAME ).getString() ).thenReturn( PROP_USERNAME_VALUE );
  when( mockDataNode.hasProperty( SlaveDelegate.PROP_PASSWORD ) ).thenReturn( true );
  when( mockDataNode.getProperty( SlaveDelegate.PROP_PASSWORD ).getString() ).thenReturn( PROP_PASSWORD_VALUE );
  when( mockDataNode.hasProperty( SlaveDelegate.PROP_PORT ) ).thenReturn( true );
  when( mockDataNode.getProperty( SlaveDelegate.PROP_PORT ).getString() ).thenReturn( PROP_PORT_VALUE );
  when( mockDataNode.hasProperty( SlaveDelegate.PROP_PROXY_HOST_NAME ) ).thenReturn( true );
  when( mockDataNode.getProperty( SlaveDelegate.PROP_PROXY_HOST_NAME ).getString() ).thenReturn( PROP_PROXY_HOST_NAME_VALUE );
  when( mockDataNode.hasProperty( SlaveDelegate.PROP_PROXY_PORT ) ).thenReturn( true );
  when( mockDataNode.getProperty( SlaveDelegate.PROP_PROXY_PORT ).getString() ).thenReturn( PROP_PROXY_PORT_VALUE );
  when( mockDataNode.hasProperty( SlaveDelegate.PROP_WEBAPP_NAME ) ).thenReturn( true );
  when( mockDataNode.getProperty( SlaveDelegate.PROP_WEBAPP_NAME ).getString() ).thenReturn( PROP_WEBAPP_NAME_VALUE );
  when( mockDataNode.hasProperty( SlaveDelegate.PROP_NON_PROXY_HOSTS ) ).thenReturn( true );
  when( mockDataNode.getProperty( SlaveDelegate.PROP_NON_PROXY_HOSTS ).getString() ).thenReturn( PROP_NON_PROXY_HOSTS_VALUE );
  when( mockDataNode.hasProperty( SlaveDelegate.PROP_MASTER ) ).thenReturn( true );
  when( mockDataNode.getProperty( SlaveDelegate.PROP_MASTER ).getBoolean() ).thenReturn( PROP_MASTER_VALUE );
  when( mockDataNode.hasProperty( SlaveDelegate.PROP_USE_HTTPS_PROTOCOL ) ).thenReturn( true );
  when( mockDataNode.getProperty( SlaveDelegate.PROP_USE_HTTPS_PROTOCOL ).getBoolean() ).thenReturn( PROP_USE_HTTPS_PROTOCOL_VALUE );
}
 
Example #24
Source File: JmsConsumerMetaTest.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 );
  }
  StepPluginType.getInstance().handlePluginAnnotation(
    JmsConsumerMeta.class,
    JmsConsumerMeta.class.getAnnotation( org.pentaho.di.core.annotations.Step.class ),
    Collections.emptyList(), false, null );
}
 
Example #25
Source File: MQTTConsumerTest.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void setupClass() throws Exception {
  KettleClientEnvironment.init();
  PluginRegistry.addPluginType( StepPluginType.getInstance() );
  PluginRegistry.init();
  if ( !Props.isInitialized() ) {
    Props.init( 0 );
  }
  StepPluginType.getInstance().handlePluginAnnotation(
    MQTTConsumerMeta.class,
    MQTTConsumerMeta.class.getAnnotation( org.pentaho.di.core.annotations.Step.class ),
    Collections.emptyList(), false, null );
}
 
Example #26
Source File: UIMain.java    From pentaho-aggdesigner with GNU General Public License v2.0 5 votes vote down vote up
/**
 * The main startup of the Aggregation Designer
 * @param args
 */
public static void main(String[] args) {
  try {
  	KettleClientEnvironment.init();
  	ApplicationContext context = new ClassPathXmlApplicationContext(
      new String[] {"applicationContext.xml", "plugins.xml"}); //$NON-NLS-1$ //$NON-NLS-2$

    UIMain uiMain = (UIMain) context.getBean("uiMain"); //$NON-NLS-1$
    uiMain.start(context);
  } catch (Throwable t) {
    logger.error("uncaught exception in main", t);
    System.exit(1);
  }
}
 
Example #27
Source File: ConnectionModelTest.java    From pentaho-aggdesigner with GNU General Public License v2.0 5 votes vote down vote up
public ConnectionModelTest() {
  try {
  	KettleClientEnvironment.init();
  } catch (Exception e) {
  	e.printStackTrace();
  }
}
 
Example #28
Source File: MainControllerTest.java    From pentaho-aggdesigner with GNU General Public License v2.0 5 votes vote down vote up
public void setUp() {
  try {
  	KettleClientEnvironment.init();
  } catch (Exception e) {
  	e.printStackTrace();
  }
  XulMessageBoxStub.openedMessageBoxes.clear();
  XulMessageBoxStub.returnCode = 0;
  XulFileDialogStub.returnFile = null;
}
 
Example #29
Source File: MondrianFileSchemaProviderTest.java    From pentaho-aggdesigner with GNU General Public License v2.0 5 votes vote down vote up
public MondrianFileSchemaProviderTest() throws InitializationError {
  super(MondrianFileSchemaProviderTest.class);
  try {
  	KettleClientEnvironment.init();
  } catch (Exception e) {
  	e.printStackTrace();
  }
}
 
Example #30
Source File: TransUnitTestTest.java    From pentaho-pdi-dataset with Apache License 2.0 5 votes vote down vote up
@Override
protected void setUp() throws Exception {
  KettleClientEnvironment.init();
  metaStore = new MemoryMetaStore();

  inputs = new ArrayList<TransUnitTestSetLocation>();
  inputs.add( new TransUnitTestSetLocation( "input-step1", "data-set-name1",
    Arrays.asList(
      new TransUnitTestFieldMapping( "fieldA", "setFieldA" ),
      new TransUnitTestFieldMapping( "fieldB", "setFieldB" ),
      new TransUnitTestFieldMapping( "fieldC", "setFieldC" )
    ), Arrays.asList( "order1", "order2", "order3" ) ) );
  inputs.add( new TransUnitTestSetLocation( "input-step2", "data-set-name2",
    Arrays.asList(
      new TransUnitTestFieldMapping( "fieldX", "setFieldX" ),
      new TransUnitTestFieldMapping( "fieldY", "setFieldY" ),
      new TransUnitTestFieldMapping( "fieldW", "setFieldW" ),
      new TransUnitTestFieldMapping( "fieldZ", "setFieldZ" )
    ), Arrays.asList( "order1", "order2", "order3", "order4" ) ) );

  goldens = new ArrayList<TransUnitTestSetLocation>();

  List<TransUnitTestTweak> tweaks = new ArrayList<TransUnitTestTweak>();
  tweaks.add( new TransUnitTestTweak( TransTweak.NONE, "step1" ) );
  tweaks.add( new TransUnitTestTweak( TransTweak.BYPASS_STEP, "step2" ) );
  tweaks.add( new TransUnitTestTweak( TransTweak.REMOVE_STEP, "step3" ) );

  test = new TransUnitTest( NAME, DESCRIPTION,
    null, null, "sometrans.ktr",
    inputs,
    goldens,
    tweaks,
    TestType.UNIT_TEST,
    null, new ArrayList<TransUnitTestDatabaseReplacement>(),
    false
  );
}