this.billingValidations = billingValidations;
}
- private static Consumer<QualityProfile> writeToJson(JsonWriter json) {
- return profile -> json.beginObject()
- .prop("key", profile.getQpKey())
- .prop("name", profile.getQpName())
- .prop("language", profile.getLanguageKey())
- .endObject();
- }
-
- private static Function<MeasureDto, Stream<QualityProfile>> toQualityProfiles() {
- return dbMeasure -> QPMeasureData.fromJson(dbMeasure.getData()).getProfiles().stream();
- }
-
- private static void writePage(JsonWriter json, Page page) {
- json.beginObject()
- .prop("key", page.getKey())
- .prop("name", page.getName())
- .endObject();
- }
-
@Override
public void define(NewController context) {
NewAction projectNavigation = context.createAction("component")
}
}
+ private static Consumer<QualityProfile> writeToJson(JsonWriter json) {
+ return profile -> json.beginObject()
+ .prop("key", profile.getQpKey())
+ .prop("name", profile.getQpName())
+ .prop("language", profile.getLanguageKey())
+ .endObject();
+ }
+
+ private static Function<MeasureDto, Stream<QualityProfile>> toQualityProfiles() {
+ return dbMeasure -> QPMeasureData.fromJson(dbMeasure.getData()).getProfiles().stream();
+ }
+
+ private static void writePage(JsonWriter json, Page page) {
+ json.beginObject()
+ .prop("key", page.getKey())
+ .prop("name", page.getName())
+ .endObject();
+ }
+
private void writeComponent(JsonWriter json, DbSession session, ComponentDto component, OrganizationDto organizationDto, @Nullable SnapshotDto analysis) {
json.prop("key", component.key())
.prop("organization", organizationDto.getKey())
.addPage(Page.builder("my_plugin/K2").setName("K2").setScope(COMPONENT).setComponentQualifiers(Qualifier.PROJECT).build())
.addPage(Page.builder("my_plugin/K3").setName("K3").setScope(COMPONENT).setComponentQualifiers(Qualifier.MODULE).build())
.addPage(Page.builder("my_plugin/K4").setName("K4").setScope(GLOBAL).build())
- .addPage(Page.builder("my_plugin/K5").setName("K5").setScope(COMPONENT).setComponentQualifiers(Qualifier.VIEW).build());
+ .addPage(Page.builder("my_plugin/K5").setName("K5").setScope(COMPONENT).setComponentQualifiers(Qualifier.VIEW).build())
+ .addPage(Page.builder("my_plugin/K6").setName("K6").setScope(COMPONENT).setComponentQualifiers(Qualifier.APP).build());
underTest = new PageRepository(pluginRepository, new PageDefinition[] {plugin});
underTest.start();
executeAndVerify(project.key(), "return_extensions.json");
}
+ @Test
+ public void return_extensions_for_application() throws Exception {
+ Page page = Page.builder("my_plugin/app_page")
+ .setName("App Page")
+ .setScope(COMPONENT)
+ .setComponentQualifiers(Qualifier.VIEW, Qualifier.APP)
+ .build();
+
+ init(page);
+ ComponentDto application = componentDbTester.insertApplication(dbTester.getDefaultOrganization());
+ userSession.registerComponents(application);
+
+ String result = ws.newRequest()
+ .setParam(PARAM_COMPONENT, application.key())
+ .execute().getInput();
+
+ assertThat(result).contains("my_plugin/app_page");
+ }
+
@Test
public void return_extensions_for_admin() throws Exception {
init(createPages());