org.apache.commons.lang.reflect.FieldUtils#writeStaticField ( )源码实例Demo

下面列出了org.apache.commons.lang.reflect.FieldUtils#writeStaticField ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: hop   文件: SFTPPutDialogTest.java
@BeforeClass
public static void hackPropsUi() throws Exception {
  Field props = getPropsField();
  if ( props == null ) {
    throw new IllegalStateException( "Cannot find 'props' field in " + Props.class.getName() );
  }

  Object value = FieldUtils.readStaticField( props, true );
  if ( value == null ) {
    PropsUI mock = mock( PropsUI.class );
    FieldUtils.writeStaticField( props, mock, true );
    changedPropsUi = true;
  } else {
    changedPropsUi = false;
  }
}
 
源代码2 项目: hop   文件: TextFileInputDialogTest.java
@BeforeClass
public static void hackPropsUi() throws Exception {
  Field props = getPropsField();
  if ( props == null ) {
    throw new IllegalStateException( "Cannot find 'props' field in " + Props.class.getName() );
  }

  Object value = FieldUtils.readStaticField( props, true );
  if ( value == null ) {
    PropsUI mock = mock( PropsUI.class );
    FieldUtils.writeStaticField( props, mock, true );
    changedPropsUi = true;
  } else {
    changedPropsUi = false;
  }
}
 
源代码3 项目: pentaho-kettle   文件: SFTPPutDialogTest.java
@BeforeClass
public static void hackPropsUi() throws Exception {
  Field props = getPropsField();
  if ( props == null ) {
    throw new IllegalStateException( "Cannot find 'props' field in " + Props.class.getName() );
  }

  Object value = FieldUtils.readStaticField( props, true );
  if ( value == null ) {
    PropsUI mock = mock( PropsUI.class );
    FieldUtils.writeStaticField( props, mock, true );
    changedPropsUi = true;
  } else {
    changedPropsUi = false;
  }
}
 
源代码4 项目: pentaho-kettle   文件: TextFileInputDialogTest.java
@BeforeClass
public static void hackPropsUi() throws Exception {
  Field props = getPropsField();
  if ( props == null ) {
    throw new IllegalStateException( "Cannot find 'props' field in " + Props.class.getName() );
  }

  Object value = FieldUtils.readStaticField( props, true );
  if ( value == null ) {
    PropsUI mock = mock( PropsUI.class );
    FieldUtils.writeStaticField( props, mock, true );
    changedPropsUi = true;
  } else {
    changedPropsUi = false;
  }
}
 
源代码5 项目: hop   文件: SFTPPutDialogTest.java
@AfterClass
public static void restoreNullInPropsUi() throws Exception {
  if ( changedPropsUi ) {
    Field props = getPropsField();
    FieldUtils.writeStaticField( props, null, true );
  }
}
 
源代码6 项目: hop   文件: TextFileInputDialogTest.java
@AfterClass
public static void restoreNullInPropsUi() throws Exception {
  if ( changedPropsUi ) {
    Field props = getPropsField();
    FieldUtils.writeStaticField( props, null, true );
  }
}
 
源代码7 项目: chassis   文件: TestUtils.java
public static void resetArchaius() throws Exception {
    //super hacky and brittle, but archaius provides no way to reset its configuration
    FieldUtils.writeStaticField(ConfigurationManager.class, "customConfigurationInstalled", false, true);
    FieldUtils.writeStaticField(DynamicPropertyFactory.class, "initializedWithDefaultConfig", false, true);
    FieldUtils.writeStaticField(ConfigurationManager.class, "instance", null, true);
    FieldUtils.writeStaticField(DynamicPropertyFactory.class, "config", null, true);
}
 
源代码8 项目: pentaho-kettle   文件: SFTPPutDialogTest.java
@AfterClass
public static void restoreNullInPropsUi() throws Exception {
  if ( changedPropsUi ) {
    Field props = getPropsField();
    FieldUtils.writeStaticField( props, null, true );
  }
}
 
源代码9 项目: pentaho-kettle   文件: TextFileInputDialogTest.java
@AfterClass
public static void restoreNullInPropsUi() throws Exception {
  if ( changedPropsUi ) {
    Field props = getPropsField();
    FieldUtils.writeStaticField( props, null, true );
  }
}
 
源代码10 项目: pentaho-kettle   文件: SalesforceInputDialogTest.java
@BeforeClass
public static void hackPropsUi() throws Exception {
  Field props = getPropsField();
  if ( props == null ) {
    throw new IllegalStateException( "Cannot find 'props' field in " + Props.class.getName() );
  }
  Object value = FieldUtils.readStaticField( props, true );
  if ( value == null ) {
    PropsUI mock = mock( PropsUI.class );
    FieldUtils.writeStaticField( props, mock, true );
    changedPropsUi = true;
  } else {
    changedPropsUi = false;
  }
}
 
源代码11 项目: pentaho-kettle   文件: SalesforceInputDialogTest.java
@AfterClass
public static void restoreNullInPropsUi() throws Exception {
  if ( changedPropsUi ) {
    Field props = getPropsField();
    FieldUtils.writeStaticField( props, null, true );
  }
}