예제 #1
0
 private void writeUpdates(JsonWriter jsonWriter, Collection<PluginUpdate> pluginUpdates) {
   jsonWriter.name(ARRAY_UPDATES).beginArray();
   for (PluginUpdate pluginUpdate :
       ImmutableSortedSet.copyOf(PLUGIN_UPDATE_BY_VERSION_ORDERING, pluginUpdates)) {
     jsonWriter.beginObject();
     pluginWSCommons.writeRelease(jsonWriter, pluginUpdate.getRelease());
     pluginWSCommons.writeUpdateProperties(jsonWriter, pluginUpdate);
     jsonWriter.endObject();
   }
   jsonWriter.endArray();
 }
예제 #2
0
  @Test
  public void if_plugin_has_an_update_download_is_triggered_with_latest_version_from_updatecenter()
      throws Exception {
    Version version = Version.create("1.0");
    when(updateCenter.findPluginUpdates())
        .thenReturn(
            ImmutableList.of(
                PluginUpdate.createWithStatus(
                    new Release(new Plugin(PLUGIN_KEY), version), Status.COMPATIBLE)));

    underTest.handle(validRequest, response);

    verify(pluginDownloader).download(PLUGIN_KEY, version);
    assertThat(response.outputAsString()).isEmpty();
  }
 private static PluginUpdate createPluginUpdate(Plugin plugin) {
   return PluginUpdate.createWithStatus(new Release(plugin, SOME_VERSION), SOME_STATUS);
 }