Permalink
Browse files

Fixed Metadata deserialization

Metadata fields 'dependencies', 'conflicting', 'providing', 'platforms' and 'replacing' are
simple Map<String, String>, where the value is a version constraint like '>= 0.0.0', but not
a Json array.

See https://github.com/opscode/chef/blob/master/chef/lib/chef/cookbook/metadata.rb for more
details about Metadata format.
  • Loading branch information...
1 parent f3226c6 commit f8e71972e73638c04eb3e268b6a09b9e3d419ede @nacx nacx committed Aug 24, 2011
View
@@ -0,0 +1,5 @@
+.project
+.classpath
+.settings
+target
+test-output
@@ -35,16 +35,16 @@
private String license;
private String maintainer;
private Map<String, String> suggestions = Maps.newLinkedHashMap();
- private Map<String, Set<String>> dependencies = Maps.newLinkedHashMap();
+ private Map<String, String> dependencies = Maps.newLinkedHashMap();
@SerializedName("maintainer_email")
private String maintainerEmail;
- private Map<String, Set<String>> conflicting = Maps.newLinkedHashMap();
+ private Map<String, String> conflicting = Maps.newLinkedHashMap();
private String description;
- private Map<String, Set<String>> providing = Maps.newLinkedHashMap();
- private Map<String, Set<String>> platforms = Maps.newLinkedHashMap();
+ private Map<String, String> providing = Maps.newLinkedHashMap();
+ private Map<String, String> platforms = Maps.newLinkedHashMap();
private String version;
private Map<String, String> recipes = Maps.newLinkedHashMap();
- private Map<String, Set<String>> replacing = Maps.newLinkedHashMap();
+ private Map<String, String> replacing = Maps.newLinkedHashMap();
private String name;
private Map<String, String> groupings = Maps.newLinkedHashMap();
@SerializedName("long_description")
@@ -53,9 +53,9 @@
private Map<String, String> recommendations = Maps.newLinkedHashMap();
public Metadata(String license, String maintainer, Map<String, String> suggestions,
- Map<String, Set<String>> dependencies, String maintainerEmail, Map<String, Set<String>> conflicting,
- String description, Map<String, Set<String>> providing, Map<String, Set<String>> platforms, String version,
- Map<String, String> recipes, Map<String, Set<String>> replacing, String name, Map<String, String> groupings,
+ Map<String, String> dependencies, String maintainerEmail, Map<String, String> conflicting,
+ String description, Map<String,String> providing, Map<String, String> platforms, String version,
+ Map<String, String> recipes, Map<String, String> replacing, String name, Map<String, String> groupings,
String longDescription, Map<String, Attribute> attributes, Map<String, String> recommendations) {
this.license = license;
this.maintainer = maintainer;
@@ -91,27 +91,27 @@ public String getMaintainer() {
return suggestions;
}
- public Map<String, Set<String>> getDependencies() {
+ public Map<String, String> getDependencies() {
return dependencies;
}
public String getMaintainerEmail() {
return maintainerEmail;
}
- public Map<String, Set<String>> getConflicting() {
+ public Map<String, String> getConflicting() {
return conflicting;
}
public String getDescription() {
return description;
}
- public Map<String, Set<String>> getProviding() {
+ public Map<String, String> getProviding() {
return providing;
}
- public Map<String, Set<String>> getPlatforms() {
+ public Map<String, String> getPlatforms() {
return platforms;
}
@@ -123,7 +123,7 @@ public String getVersion() {
return recipes;
}
- public Map<String, Set<String>> getReplacing() {
+ public Map<String, String> getReplacing() {
return replacing;
}
@@ -106,10 +106,10 @@ public void testApache() {
ImmutableSet.<Attribute> of(),
ImmutableSet.<Resource> of(),
new Metadata("Apache v2.0", "Your Name", ImmutableMap.<String, String> of(), ImmutableMap
- .<String, Set<String>> of(), "youremail@example.com", ImmutableMap
- .<String, Set<String>> of(), "A fabulous new cookbook", ImmutableMap
- .<String, Set<String>> of(), ImmutableMap.<String, Set<String>> of(), "0.0.0",
- ImmutableMap.<String, String> of(), ImmutableMap.<String, Set<String>> of(),
+ .<String, String> of(), "youremail@example.com", ImmutableMap
+ .<String, String> of(), "A fabulous new cookbook", ImmutableMap
+ .<String, String> of(), ImmutableMap.<String, String> of(), "0.0.0",
+ ImmutableMap.<String, String> of(), ImmutableMap.<String, String> of(),
"apache-chef-demo", ImmutableMap.<String, String> of(), "", ImmutableMap
.<String, Attribute> of(), ImmutableMap.<String, String> of()),
ImmutableSet.<Resource> of(),

0 comments on commit f8e7197

Please sign in to comment.