ManifestHeaderProcessor { public static Map<String, Map<String, String>> parseImportString(String s){ NameValueMap retval = new NameValueMap(); genericImportExportProcess(retval, s); return retval; }  static List<String> split(String value, String delimiter); static List<NameValuePair> parseExportString(String s); static List<NameValuePair> parseExportList(List<String> list); static Map<String, Map<String, String>> parseImportString(String s); static List<GenericMetadata> parseCapabilityString(String s); static List<GenericMetadata> parseRequirementString(String s); static NameValuePair parseBundleSymbolicName(String s); static VersionRange parseVersionRange(String s); static VersionRange parseVersionRange(String s, boolean exactVersion); static String generateFilter(Map<String, String> attribs); static String generateFilter(String type, String name,
      Map<String, String> attribs); static Map<String,String> parseFilter(String filter); static final String NESTED_FILTER_ATTRIBUTE; }
@Test public void testParseImportString() { String importPackage = "com.acme.foo,come.acm.e.bar;version=\"[1.23,1.24.5]\";resolution:=mandatory;company=\"ACME\",a.b.c;version=1.2.3;company=com"; Map<String, Map<String, String>> importPackageReturn = ManifestHeaderProcessor.parseImportString(importPackage); assertTrue("The package is not set.", importPackageReturn.containsKey("com.acme.foo")); assertTrue("The package is not set.", importPackageReturn.containsKey("come.acm.e.bar")); assertTrue("The package is not set.", importPackageReturn.containsKey("come.acm.e.bar")); assertTrue("The package is not set.", importPackageReturn.containsKey("a.b.c")); assertTrue("The package should not contain any attributes.", importPackageReturn.get("com.acme.foo").isEmpty()); assertEquals("The directive is not set correctly.", "[1.23,1.24.5]", importPackageReturn.get("come.acm.e.bar").get("version")); assertEquals("The directive is not set correctly.", "mandatory", importPackageReturn.get("come.acm.e.bar").get("resolution:")); assertEquals("The directive is not set correctly.", "ACME", importPackageReturn.get("come.acm.e.bar").get("company")); assertEquals("The directive is not set correctly.", "1.2.3", importPackageReturn.get("a.b.c").get("version")); assertEquals("The directive is not set correctly.", "com", importPackageReturn.get("a.b.c").get("company")); importPackage="com.acme.foo"; assertTrue("The package is not set.", importPackageReturn.containsKey("com.acme.foo")); assertTrue("The package should not contain any attributes.", importPackageReturn.get("com.acme.foo").isEmpty()); importPackage="com.acme.foo;com.acme.bar;version=2"; Map<String, Map<String, String>> importPackageReturn2 = ManifestHeaderProcessor.parseImportString(importPackage); assertTrue("The package is not set.", importPackageReturn2.containsKey("com.acme.foo")); assertTrue("The package is not set.", importPackageReturn2.containsKey("com.acme.bar")); assertEquals("The directive is not set correctly.", "2", importPackageReturn2.get("com.acme.foo").get("version")); assertEquals("The directive is not set correctly.", "2", importPackageReturn2.get("com.acme.bar").get("version")); }