/**
  * make sure post properties override pre properties
  *
  * @throws Exception
  */
 public void testInitialize_PrePostProperties() throws Exception {
   Properties preProps = createPreProperties();
   preProps.setProperty(FIRST_PROP, PRE);
   preProps.setProperty(SECOND_PROP, PRE);
   Properties postProps = createPostProperties();
   postProps.setProperty(SECOND_PROP, POST);
   PySystemState.initialize(preProps, postProps);
   Properties registry = PySystemState.registry;
   String first = registry.getProperty(FIRST_PROP, ANY);
   String second = registry.getProperty(SECOND_PROP, ANY);
   assertEquals(PRE, first);
   assertEquals(POST, second);
 }
 /**
  * make sure a property from the user registry overrides the same property from the installed
  * registry
  *
  * @throws Exception
  */
 public void testInitialize_Registry_User() throws Exception {
   // prepare both registry files
   String installedContent = FIRST_PROP.concat("=").concat(INSTALLED);
   appendToInstalledRegistry(installedContent);
   String userContent = FIRST_PROP.concat("=").concat(USER);
   addUserRegistry(userContent);
   // test with empty pre an post properties
   Properties preProps = createPreProperties();
   Properties postProps = createPostProperties();
   PySystemState.initialize(preProps, postProps);
   Properties registry = PySystemState.registry;
   String first = registry.getProperty(FIRST_PROP, ANY);
   assertEquals(USER, first);
 }
 /**
  * make sure a pre property overrides any registry properties with the same name
  *
  * @throws Exception
  */
 public void testInitialize_Pre_Registries() throws Exception {
   // prepare both registry files
   String contentToAppend = FIRST_PROP.concat("=").concat(INSTALLED);
   appendToInstalledRegistry(contentToAppend);
   String userContent = FIRST_PROP.concat("=").concat(USER);
   addUserRegistry(userContent);
   // set same property on pre properties
   Properties preProps = createPreProperties();
   preProps.setProperty(FIRST_PROP, PRE);
   Properties postProps = createPostProperties();
   PySystemState.initialize(preProps, postProps);
   Properties registry = PySystemState.registry;
   String first = registry.getProperty(FIRST_PROP, ANY);
   assertEquals(PRE, first);
 }
 /**
  * Initializes the jython runtime. This should only be called once, and should be called before
  * any other python objects are created (including a PythonInterpreter).
  *
  * @param preProperties A set of properties. Typically System.getProperties() is used.
  * @param postProperties An other set of properties. Values like python.home, python.path and all
  *     other values from the registry files can be added to this property set. PostProperties will
  *     override system properties and registry properties.
  * @param argv Command line argument. These values will assigned to sys.argv.
  */
 public static void initialize(
     Properties preProperties, Properties postProperties, String[] argv) {
   PySystemState.initialize(preProperties, postProperties, argv);
 }