Skip to content
This repository has been archived by the owner on Feb 4, 2019. It is now read-only.

Commit

Permalink
Fixed Metadata deserialization
Browse files Browse the repository at this point in the history
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
Ignasi Barrera committed Aug 24, 2011
1 parent f3226c6 commit f8e7197
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 17 deletions.
5 changes: 5 additions & 0 deletions .gitignore
@@ -0,0 +1,5 @@
.project
.classpath
.settings
target
test-output
26 changes: 13 additions & 13 deletions core/src/main/java/org/jclouds/chef/domain/Metadata.java
Expand Up @@ -35,16 +35,16 @@ public class Metadata {
private String license; private String license;
private String maintainer; private String maintainer;
private Map<String, String> suggestions = Maps.newLinkedHashMap(); 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") @SerializedName("maintainer_email")
private String maintainerEmail; private String maintainerEmail;
private Map<String, Set<String>> conflicting = Maps.newLinkedHashMap(); private Map<String, String> conflicting = Maps.newLinkedHashMap();
private String description; private String description;
private Map<String, Set<String>> providing = Maps.newLinkedHashMap(); private Map<String, String> providing = Maps.newLinkedHashMap();
private Map<String, Set<String>> platforms = Maps.newLinkedHashMap(); private Map<String, String> platforms = Maps.newLinkedHashMap();
private String version; private String version;
private Map<String, String> recipes = Maps.newLinkedHashMap(); 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 String name;
private Map<String, String> groupings = Maps.newLinkedHashMap(); private Map<String, String> groupings = Maps.newLinkedHashMap();
@SerializedName("long_description") @SerializedName("long_description")
Expand All @@ -53,9 +53,9 @@ public class Metadata {
private Map<String, String> recommendations = Maps.newLinkedHashMap(); private Map<String, String> recommendations = Maps.newLinkedHashMap();


public Metadata(String license, String maintainer, Map<String, String> suggestions, public Metadata(String license, String maintainer, Map<String, String> suggestions,
Map<String, Set<String>> dependencies, String maintainerEmail, Map<String, Set<String>> conflicting, Map<String, String> dependencies, String maintainerEmail, Map<String, String> conflicting,
String description, Map<String, Set<String>> providing, Map<String, Set<String>> platforms, String version, String description, Map<String,String> providing, Map<String, String> platforms, String version,
Map<String, String> recipes, Map<String, Set<String>> replacing, String name, Map<String, String> groupings, Map<String, String> recipes, Map<String, String> replacing, String name, Map<String, String> groupings,
String longDescription, Map<String, Attribute> attributes, Map<String, String> recommendations) { String longDescription, Map<String, Attribute> attributes, Map<String, String> recommendations) {
this.license = license; this.license = license;
this.maintainer = maintainer; this.maintainer = maintainer;
Expand Down Expand Up @@ -91,27 +91,27 @@ public Map<String, String> getSuggestions() {
return suggestions; return suggestions;
} }


public Map<String, Set<String>> getDependencies() { public Map<String, String> getDependencies() {
return dependencies; return dependencies;
} }


public String getMaintainerEmail() { public String getMaintainerEmail() {
return maintainerEmail; return maintainerEmail;
} }


public Map<String, Set<String>> getConflicting() { public Map<String, String> getConflicting() {
return conflicting; return conflicting;
} }


public String getDescription() { public String getDescription() {
return description; return description;
} }


public Map<String, Set<String>> getProviding() { public Map<String, String> getProviding() {
return providing; return providing;
} }


public Map<String, Set<String>> getPlatforms() { public Map<String, String> getPlatforms() {
return platforms; return platforms;
} }


Expand All @@ -123,7 +123,7 @@ public Map<String, String> getRecipes() {
return recipes; return recipes;
} }


public Map<String, Set<String>> getReplacing() { public Map<String, String> getReplacing() {
return replacing; return replacing;
} }


Expand Down
Expand Up @@ -106,10 +106,10 @@ ImmutableSet.<Resource> of(),
ImmutableSet.<Attribute> of(), ImmutableSet.<Attribute> of(),
ImmutableSet.<Resource> of(), ImmutableSet.<Resource> of(),
new Metadata("Apache v2.0", "Your Name", ImmutableMap.<String, String> of(), ImmutableMap new Metadata("Apache v2.0", "Your Name", ImmutableMap.<String, String> of(), ImmutableMap
.<String, Set<String>> of(), "youremail@example.com", ImmutableMap .<String, String> of(), "youremail@example.com", ImmutableMap
.<String, Set<String>> of(), "A fabulous new cookbook", ImmutableMap .<String, String> of(), "A fabulous new cookbook", ImmutableMap
.<String, Set<String>> of(), ImmutableMap.<String, Set<String>> of(), "0.0.0", .<String, String> of(), ImmutableMap.<String, String> of(), "0.0.0",
ImmutableMap.<String, String> of(), ImmutableMap.<String, Set<String>> of(), ImmutableMap.<String, String> of(), ImmutableMap.<String, String> of(),
"apache-chef-demo", ImmutableMap.<String, String> of(), "", ImmutableMap "apache-chef-demo", ImmutableMap.<String, String> of(), "", ImmutableMap
.<String, Attribute> of(), ImmutableMap.<String, String> of()), .<String, Attribute> of(), ImmutableMap.<String, String> of()),
ImmutableSet.<Resource> of(), ImmutableSet.<Resource> of(),
Expand Down

0 comments on commit f8e7197

Please sign in to comment.