public static void environmentInit() throws KettleException {
    // Workaround for a Mac OS/X Leopard issue where getContextClassLoader() is returning
    // null when run from the eclipse IDE
    // http://lists.apple.com/archives/java-dev/2007/Nov/msg00385.html - DM
    // Moving this hack to the first place where the NPE is triggered so all entrypoints can be debugged in Mac Eclipse
    if ( Thread.currentThread().getContextClassLoader() == null ) {
      Thread.currentThread().setContextClassLoader( ClassLoader.getSystemClassLoader() );
    }

    Map<Object, Object> kettleProperties = EnvUtil.readProperties( Const.KETTLE_PROPERTIES );
    insertDefaultValues( kettleProperties );
    applyKettleProperties( kettleProperties );

    // Also put some default values for obscure environment variables in there...
    // Place-holders if you will.
    //
    System.getProperties().put( Const.INTERNAL_VARIABLE_CLUSTER_SIZE, "1" );
    System.getProperties().put( Const.INTERNAL_VARIABLE_SLAVE_SERVER_NUMBER, "0" );
    System.getProperties().put( Const.INTERNAL_VARIABLE_SLAVE_SERVER_NAME, "slave-trans-name" );

    System.getProperties().put( Const.INTERNAL_VARIABLE_STEP_COPYNR, "0" );
    System.getProperties().put( Const.INTERNAL_VARIABLE_STEP_NAME, "step-name" );
    System.getProperties().put( Const.INTERNAL_VARIABLE_STEP_PARTITION_ID, "partition-id" );
    System.getProperties().put( Const.INTERNAL_VARIABLE_STEP_PARTITION_NR, "0" );
    System.getProperties().put( Const.INTERNAL_VARIABLE_STEP_UNIQUE_COUNT, "1" );
    System.getProperties().put( Const.INTERNAL_VARIABLE_STEP_UNIQUE_NUMBER, "0" );
  }
@Test
  public void vfsUserDirIsRoot_IsPublishedOnInitialisation() throws Exception {
    EnvUtil.environmentInit();
    //See PDI-14522, PDI-14821
    // don't check the exact value, because the initialisation depends on local settings
    // instead, simply check the value exists
    assertNotNull( Variables.getADefaultVariableSpace().getVariable( Const.VFS_USER_DIR_IS_ROOT ) );
    assertNotNull( System.getProperty( Const.VFS_USER_DIR_IS_ROOT ) );
  }