merge 2.0.0 / rename installPending to executePending

This commit is contained in:
Eduard Heimbuch
2019-09-17 10:36:52 +02:00
28 changed files with 1183 additions and 136 deletions

View File

@@ -123,7 +123,7 @@ class PendingPluginResourceTest {
assertThat(response.getStatus()).isEqualTo(HttpServletResponse.SC_OK);
assertThat(response.getContentAsString()).contains("\"new\":[{\"name\":\"pending-available-plugin\"");
assertThat(response.getContentAsString()).contains("\"install\":{\"href\":\"/v2/plugins/pending/install\"}");
assertThat(response.getContentAsString()).contains("\"execute\":{\"href\":\"/v2/plugins/pending/execute\"}");
}
@Test
@@ -139,7 +139,7 @@ class PendingPluginResourceTest {
assertThat(response.getStatus()).isEqualTo(HttpServletResponse.SC_OK);
assertThat(response.getContentAsString()).contains("\"update\":[{\"name\":\"available-plugin\"");
assertThat(response.getContentAsString()).contains("\"install\":{\"href\":\"/v2/plugins/pending/install\"}");
assertThat(response.getContentAsString()).contains("\"execute\":{\"href\":\"/v2/plugins/pending/execute\"}");
}
@Test
@@ -154,17 +154,17 @@ class PendingPluginResourceTest {
assertThat(response.getStatus()).isEqualTo(HttpServletResponse.SC_OK);
assertThat(response.getContentAsString()).contains("\"uninstall\":[{\"name\":\"uninstalled-plugin\"");
assertThat(response.getContentAsString()).contains("\"install\":{\"href\":\"/v2/plugins/pending/install\"}");
assertThat(response.getContentAsString()).contains("\"execute\":{\"href\":\"/v2/plugins/pending/execute\"}");
}
@Test
void shouldInstallPendingPlugins() throws URISyntaxException {
MockHttpRequest request = MockHttpRequest.post("/v2/plugins/pending/install");
void shouldExecutePendingPlugins() throws URISyntaxException {
MockHttpRequest request = MockHttpRequest.post("/v2/plugins/pending/execute");
dispatcher.invoke(request, response);
assertThat(response.getStatus()).isEqualTo(HttpServletResponse.SC_OK);
verify(pluginManager).installPendingAndRestart();
verify(pluginManager).executePendingAndRestart();
}
}
@@ -189,17 +189,17 @@ class PendingPluginResourceTest {
dispatcher.invoke(request, response);
assertThat(response.getStatus()).isEqualTo(HttpServletResponse.SC_UNAUTHORIZED);
verify(pluginManager, never()).installPendingAndRestart();
verify(pluginManager, never()).executePendingAndRestart();
}
@Test
void shouldNotInstallPendingPlugins() throws URISyntaxException {
MockHttpRequest request = MockHttpRequest.post("/v2/plugins/pending/install");
void shouldNotExecutePendingPlugins() throws URISyntaxException {
MockHttpRequest request = MockHttpRequest.post("/v2/plugins/pending/execute");
dispatcher.invoke(request, response);
assertThat(response.getStatus()).isEqualTo(HttpServletResponse.SC_UNAUTHORIZED);
verify(pluginManager, never()).installPendingAndRestart();
verify(pluginManager, never()).executePendingAndRestart();
}
}

View File

@@ -283,14 +283,14 @@ class DefaultPluginManagerTest {
when(center.getAvailable()).thenReturn(ImmutableSet.of(review));
manager.install("scm-review-plugin", false);
manager.installPendingAndRestart();
manager.executePendingAndRestart();
verify(eventBus).post(any(RestartEvent.class));
}
@Test
void shouldNotSendRestartEventWithoutPendingPlugins() {
manager.installPendingAndRestart();
manager.executePendingAndRestart();
verify(eventBus, never()).post(any());
}
@@ -466,8 +466,8 @@ class DefaultPluginManagerTest {
}
@Test
void shouldThrowAuthorizationExceptionsForInstallPendingAndRestart() {
assertThrows(AuthorizationException.class, () -> manager.installPendingAndRestart());
void shouldThrowAuthorizationExceptionsForExecutePendingAndRestart() {
assertThrows(AuthorizationException.class, () -> manager.executePendingAndRestart());
}
}