def metadata(self): """ Returns the meta-data. :return: the meta-data dictionary :rtype: dict """ return javabridge.get_dictionary_wrapper( javabridge.call(self.jobject, "getPackageMetaData", "()Ljava/util/Map;"))
def test_01_09_jdictionary_to_string_dictionary(self): properties = javabridge.static_call("java/lang/System", "getProperties", "()Ljava/util/Properties;") d = javabridge.get_dictionary_wrapper(properties) pyd = javabridge.jdictionary_to_string_dictionary(properties) keys = javabridge.jenumeration_to_string_list(d.keys()) for key in keys: value = javabridge.to_string(d.get(key)) self.assertEqual(pyd[key], value)
def test_01_08_jenumeration_to_string_list(self): properties = javabridge.static_call("java/lang/System", "getProperties", "()Ljava/util/Properties;") d = javabridge.get_dictionary_wrapper(properties) keys = javabridge.jenumeration_to_string_list(d.keys()) enum = javabridge.get_enumeration_wrapper(d.keys()) for i in range(d.size()): key = javabridge.to_string(enum.nextElement()) self.assertEqual(key, keys[i])
def get_metadata(self): """ Returns the meta-data. :return: the meta-data dictionary :rtype: dict """ return javabridge.get_dictionary_wrapper( javabridge.call(self.jobject, "getPackageMetaData", "()Ljava/util/Map;"))
def test_01_07_get_dictionary_wrapper(self): properties = javabridge.static_call("java/lang/System", "getProperties", "()Ljava/util/Properties;") d = javabridge.get_dictionary_wrapper(properties) self.assertTrue(d.size() > 10) self.assertFalse(d.isEmpty()) keys = javabridge.get_enumeration_wrapper(d.keys()) values = javabridge.get_enumeration_wrapper(d.elements()) n_elems = d.size() for i in range(n_elems): self.assertTrue(keys.hasMoreElements()) key = javabridge.to_string(keys.nextElement()) self.assertTrue(values.hasMoreElements()) value = javabridge.to_string(values.nextElement()) self.assertEqual(javabridge.to_string(d.get(key)), value) self.assertFalse(keys.hasMoreElements()) self.assertFalse(values.hasMoreElements())