public void empty_call() throws Exception {
init();
- executeAndVerify("empty.json");
+ assertJson(call()).isSimilarTo("{" +
+ " \"globalPages\": []," +
+ " \"settings\": {}," +
+ " \"qualifiers\": []" +
+ "}");
}
@Test
.build()
});
- executeAndVerify("qualifiers.json");
+ assertJson(call()).isSimilarTo("{" +
+ " \"qualifiers\": [\"POL\", \"PAL\"]" +
+ "}");
}
@Test
settings.setProperty("sonar.lf.enableGravatar", true);
settings.setProperty("sonar.sonarcloud.enabled", true);
settings.setProperty("sonar.updatecenter.activate", false);
+ settings.setProperty("sonar.editions.jsonUrl", "https://foo.bar/editions.json");
settings.setProperty("sonar.technicalDebt.ratingGrid", "0.05,0.1,0.2,0.5");
// This setting should be ignored as it's not needed
settings.setProperty("sonar.defaultGroup", "sonar-users");
- executeAndVerify("settings.json");
+ assertJson(call()).isSimilarTo("{" +
+ " \"settings\": {" +
+ " \"sonar.lf.logoUrl\": \"http://example.com/my-custom-logo.png\"," +
+ " \"sonar.lf.logoWidthPx\": \"135\"," +
+ " \"sonar.lf.gravatarServerUrl\": \"https://secure.gravatar.com/avatar/{EMAIL_MD5}.jpg?s={SIZE}&d=identicon\"," +
+ " \"sonar.lf.enableGravatar\": \"true\"," +
+ " \"sonar.sonarcloud.enabled\": \"true\"," +
+ " \"sonar.editions.jsonUrl\": \"https://foo.bar/editions.json\"," +
+ " \"sonar.updatecenter.activate\": \"false\"," +
+ " \"sonar.technicalDebt.ratingGrid\": \"0.05,0.1,0.2,0.5\"" +
+ " }" +
+ "}");
}
@Test
settings.setProperty("sonar.lf.logoUrl", "http://example.com/my-custom-logo.png");
settings.setProperty("sonar.lf.logoWidthPx", 135);
- executeAndVerify("deprecated_logo_settings.json");
+ assertJson(call()).isSimilarTo("{" +
+ " \"settings\": {" +
+ " \"sonar.lf.logoUrl\": \"http://example.com/my-custom-logo.png\"," +
+ " \"sonar.lf.logoWidthPx\": \"135\"" +
+ " }," +
+ " \"logoUrl\": \"http://example.com/my-custom-logo.png\"," +
+ " \"logoWidth\": \"135\"" +
+ "}");
}
@Test
public void the_returned_global_pages_do_not_include_administration_pages() throws Exception {
init(createPages(), new ResourceTypeTree[] {});
- executeAndVerify("global_pages.json");
+ assertJson(call()).isSimilarTo("{" +
+ " \"globalPages\": [" +
+ " {" +
+ " \"key\": \"another_plugin/page\"," +
+ " \"name\": \"My Another Page\"" +
+ " }," +
+ " {" +
+ " \"key\": \"my_plugin/page\"," +
+ " \"name\": \"My Plugin Page\"" +
+ " }" +
+ " ]" +
+ "}");
}
@Test
init();
when(server.getVersion()).thenReturn("6.2");
- executeAndVerify("version.json");
+ assertJson(call()).isSimilarTo("{" +
+ " \"version\": \"6.2\"" +
+ "}");
}
@Test
init();
when(dbClient.getDatabase().getDialect()).thenReturn(new MySql());
- executeAndVerify("production_database.json");
+ assertJson(call()).isSimilarTo("{" +
+ " \"productionDatabase\": true" +
+ "}");
}
@Test
init();
organizationFlags.setEnabled(true);
- executeAndVerify("organization_support.json");
+ assertJson(call()).isSimilarTo("{" +
+ " \"organizationsEnabled\": true," +
+ " \"defaultOrganization\": \"key_foo\"" +
+ "}");
}
@Test
dbClient, organizationFlags, defaultOrganizationProvider, branchFeature, userSession));
}
- private void executeAndVerify(String json) {
- assertJson(call()).isSimilarTo(getClass().getResource(GlobalActionTest.class.getSimpleName() + "/" + json));
- }
-
private String call() {
return ws.newRequest().execute().getInput();
}