コード例 #1
0
ファイル: PendingActionTest.java プロジェクト: ihr/sonarqube
  @Test
  public void verify_properties_displayed_in_json_per_installing_plugin() throws Exception {
    when(pluginDownloader.getDownloadedPlugins()).thenReturn(of(gitPluginInfo()));
    UpdateCenter updateCenter = mock(UpdateCenter.class);
    when(updateCenterMatrixFactory.getUpdateCenter(false)).thenReturn(Optional.of(updateCenter));
    when(updateCenter.findAllCompatiblePlugins())
        .thenReturn(Arrays.asList(new Plugin("scmgit").setCategory("cat_1")));

    underTest.handle(request, response);

    assertJson(response.outputAsString())
        .isSimilarTo(
            "{"
                + "  \"installing\": "
                + "  ["
                + "    {"
                + "      \"key\": \"scmgit\","
                + "      \"name\": \"Git\","
                + "      \"description\": \"Git SCM Provider.\","
                + "      \"version\": \"1.0\","
                + "      \"license\": \"GNU LGPL 3\","
                + "      \"category\":\"cat_1\","
                + "      \"organizationName\": \"SonarSource\","
                + "      \"organizationUrl\": \"http://www.sonarsource.com\","
                + "      \"homepageUrl\": \"http://redirect.sonarsource.com/plugins/scmgit.html\","
                + "      \"issueTrackerUrl\": \"http://jira.sonarsource.com/browse/SONARSCGIT\","
                + "      \"implementationBuild\": \"9ce9d330c313c296fab051317cc5ad4b26319e07\""
                + "    }"
                + "  ],"
                + "  \"removing\": []"
                + "}");
  }
コード例 #2
0
ファイル: PendingActionTest.java プロジェクト: ihr/sonarqube
  @Test
  public void installing_plugins_are_sorted_by_name_then_key_and_are_unique() throws Exception {
    when(pluginDownloader.getDownloadedPlugins())
        .thenReturn(
            of(
                newPluginInfo(0).setName("Foo"),
                newPluginInfo(3).setName("Bar"),
                newPluginInfo(2).setName("Bar")));

    underTest.handle(request, response);

    assertJson(response.outputAsString())
        .withStrictArrayOrder()
        .isSimilarTo(
            "{"
                + "  \"installing\": "
                + "  ["
                + "    {"
                + "      \"key\": \"key2\","
                + "      \"name\": \"Bar\","
                + "    },"
                + "    {"
                + "      \"key\": \"key3\","
                + "      \"name\": \"Bar\","
                + "    },"
                + "    {"
                + "      \"key\": \"key0\","
                + "      \"name\": \"Foo\","
                + "    }"
                + "  ],"
                + "  \"removing\": []"
                + "}");
  }