use of org.pentaho.di.core.vfs.KettleVFS in project pentaho-kettle by pentaho.
the class KettleEnvironmentIT method resetKettleEnvironmentInitializationFlag.
private void resetKettleEnvironmentInitializationFlag() throws SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException, NoSuchMethodException, InvocationTargetException, InstantiationException {
Field f = KettleEnvironment.class.getDeclaredField("initialized");
f.setAccessible(true);
f.set(null, new AtomicReference<SettableFuture<Boolean>>(null));
Constructor<KettleVFS> constructor;
constructor = KettleVFS.class.getDeclaredConstructor();
constructor.setAccessible(true);
KettleVFS KVFS = constructor.newInstance();
f = KVFS.getClass().getDeclaredField("kettleVFS");
f.setAccessible(true);
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
modifiersField.setInt(f, f.getModifiers() & ~Modifier.FINAL | Modifier.VOLATILE);
f.set(null, KVFS);
f = KVFS.getClass().getDeclaredField("defaultVariableSpace");
f.setAccessible(true);
modifiersField.setInt(f, f.getModifiers() & ~Modifier.FINAL);
Variables var = new Variables();
var.initializeVariablesFrom(null);
f.set(null, var);
}
Aggregations