writeMetadata(jsonWriter, pluginMetadata);
- writeArtifact(jsonWriter, pluginMetadata);
-
jsonWriter.endObject();
}
jsonWriter.prop(PROPERTY_IMPLEMENTATION_BUILD, pluginMetadata.getImplementationBuild());
}
- public void writeArtifact(JsonWriter jsonWriter, PluginMetadata pluginMetadata) {
- if (pluginMetadata.getFile() == null) {
- return;
- }
-
- jsonWriter.name(OBJECT_ARTIFACT).beginObject();
-
- jsonWriter.prop(PROPERTY_NAME, pluginMetadata.getFile().getName());
-
- jsonWriter.endObject();
- }
-
public void writePluginUpdate(JsonWriter jsonWriter, PluginUpdate pluginUpdate) {
jsonWriter.beginObject();
Plugin plugin = pluginUpdate.getPlugin();
"organizationUrl": "http://www.sonarsource.com",
"homepage": "http://redirect.sonarsource.com/plugins/scmgit.html",
"issueTrackerUrl": "http://jira.codehaus.org/browse/SONARSCGIT",
- "implementationBuild": "9ce9d330c313c296fab051317cc5ad4b26319e07",
- "artifact": {
- "name": "sonar-scm-git-plugin-1.0.jar"
- }
+ "implementationBuild": "9ce9d330c313c296fab051317cc5ad4b26319e07"
},
{
"key": "java",
"organizationUrl": "http://www.sonarsource.com",
"homepage": "http://redirect.sonarsource.com/plugins/java.html",
"issueTrackerUrl": "http://jira.codehaus.org/browse/SONARJAVA",
- "implementationBuild": "65396a609ddface8b311a6a665aca92a7da694f1",
- "artifact": {
- "name": "sonar-java-plugin-3.0.jar"
- }
+ "implementationBuild": "65396a609ddface8b311a6a665aca92a7da694f1"
},
{
"key": "scmsvn",
"organizationUrl": "http://www.sonarsource.com",
"homepage": "http://redirect.sonarsource.com/plugins/scmsvn.html",
"issueTrackerUrl": "http://jira.codehaus.org/browse/SONARSCSVN",
- "implementationBuild": "213fc8a8b582ff530b12dd4a59a6512be1071234",
- "artifact": {
- "name": "sonar-scm-svn-plugin-1.0.jar"
- }
+ "implementationBuild": "213fc8a8b582ff530b12dd4a59a6512be1071234"
}
]
}
\ No newline at end of file
{
- "installing":
- [
+ "installing": [
{
"key": "scmgit",
"name": "Git",
"organizationUrl": "http://www.sonarsource.com",
"homepage": "http://redirect.sonarsource.com/plugins/scmgit.html",
"issueTrackerUrl": "http://jira.codehaus.org/browse/SONARSCGIT",
- "implementationBuild": "9ce9d330c313c296fab051317cc5ad4b26319e07",
- "artifact": {
- "name": "sonar-scm-git-plugin-1.0.jar"
- }
+ "implementationBuild": "9ce9d330c313c296fab051317cc5ad4b26319e07"
},
{
"key": "java",
"organizationUrl": "http://www.sonarsource.com",
"homepage": "http://redirect.sonarsource.com/plugins/java.html",
"issueTrackerUrl": "http://jira.codehaus.org/browse/SONARJAVA",
- "implementationBuild": "65396a609ddface8b311a6a665aca92a7da694f1",
- "artifact": {
- "name": "sonar-java-plugin-3.0.jar"
- }
+ "implementationBuild": "65396a609ddface8b311a6a665aca92a7da694f1"
}
],
- "removing":
- [
+ "removing": [
{
"key": "scmsvn",
"name": "SVN",
"organizationUrl": "http://www.sonarsource.com",
"homepage": "http://redirect.sonarsource.com/plugins/scmsvn.html",
"issueTrackerUrl": "http://jira.codehaus.org/browse/SONARSCSVN",
- "implementationBuild": "213fc8a8b582ff530b12dd4a59a6512be1071234",
- "artifact": {
- "name": "sonar-scm-svn-plugin-1.0.jar"
- }
+ "implementationBuild": "213fc8a8b582ff530b12dd4a59a6512be1071234"
}
]
}
" \"organizationUrl\": \"org_url\"," +
" \"homepage\": \"homepage_url\"," +
" \"issueTrackerUrl\": \"issueTracker_url\"," +
- " \"implementationBuild\": \"sou_rev_sha1\"," +
- " \"artifact\":" +
- " {" +
- " \"name\": \"some.jar\"" +
- " }" +
+ " \"implementationBuild\": \"sou_rev_sha1\"" +
" }" +
" ]" +
"}"
" \"organizationUrl\": \"http://www.sonarsource.com\"," +
" \"homepage\": \"http://redirect.sonarsource.com/plugins/scmgit.html\"," +
" \"issueTrackerUrl\": \"http://jira.codehaus.org/browse/SONARSCGIT\"," +
- " \"implementationBuild\": \"9ce9d330c313c296fab051317cc5ad4b26319e07\"," +
- " \"artifact\": {" +
- " \"name\": \"sonar-scm-git-plugin-1.0.jar\"" +
- " }" +
+ " \"implementationBuild\": \"9ce9d330c313c296fab051317cc5ad4b26319e07\"" +
" }" +
" ]," +
" \"removing\": []" +
" \"organizationUrl\": \"http://www.sonarsource.com\"," +
" \"homepage\": \"http://redirect.sonarsource.com/plugins/scmgit.html\"," +
" \"issueTrackerUrl\": \"http://jira.codehaus.org/browse/SONARSCGIT\"," +
- " \"implementationBuild\": \"9ce9d330c313c296fab051317cc5ad4b26319e07\"," +
- " \"artifact\": {" +
- " \"name\": \"sonar-scm-git-plugin-1.0.jar\"" +
- " }" +
+ " \"implementationBuild\": \"9ce9d330c313c296fab051317cc5ad4b26319e07\"" +
" }" +
" ]" +
"}"
" \"organizationName\": \"SonarSource\"," +
" \"organizationUrl\": \"http://www.sonarsource.com\"," +
" \"homepage\": \"http://redirect.sonarsource.com/plugins/scmgit.html\"," +
- " \"issueTrackerUrl\": \"http://jira.codehaus.org/browse/SONARSCGIT\"," +
- " \"artifact\": {" +
- " \"name\": \"sonar-scm-git-plugin-1.0.jar\"" +
- " }" +
+ " \"issueTrackerUrl\": \"http://jira.codehaus.org/browse/SONARSCGIT\"" +
"}");
}
"}");
}
- @Test
- public void writeArtifact_from_pluginMetadata_supports_null_file() {
- jsonWriter.beginObject();
- underTest.writeArtifact(jsonWriter, DefaultPluginMetadata.create("key"));
- jsonWriter.endObject();
-
- jsonWriter.close();
- assertJson(response.outputAsString()).setStrictArrayOrder(true).isSimilarTo("{}");
- }
-
- @Test
- public void writeArtifact_from_pluginMetadata_writes_artifact_object_and_file_name() {
- jsonWriter.beginObject();
- underTest.writeArtifact(jsonWriter, GIT_PLUGIN_METADATA);
- jsonWriter.endObject();
-
- jsonWriter.close();
- assertJson(response.outputAsString()).setStrictArrayOrder(true).isSimilarTo("{" +
- " \"artifact\": {" +
- " \"name\": \"sonar-scm-git-plugin-1.0.jar\"" +
- " }" +
- "}");
- }
-
@Test
public void verify_properties_written_by_writePluginUpdate() {
underTest.writePluginUpdate(jsonWriter, PluginUpdate.createForPluginRelease(RELEASE, version("1.0")));