use of com.mercedesbenz.sechub.test.executionprofile.TestExecutionProfileList in project sechub by mercedes-benz.
the class ProductExecutionProfileRestControllerRestDocTest method restDoc_admin_fetches_profiles_list.
@Test
@UseCaseRestDoc(useCase = UseCaseAdminFetchesExecutionProfileList.class)
public void restDoc_admin_fetches_profiles_list() throws Exception {
/* prepare */
String apiEndpoint = https(PORT_USED).buildAdminFetchesListOfProductExecutionProfiles();
Class<? extends Annotation> useCase = UseCaseAdminFetchesExecutionProfileList.class;
TestExecutionProfileList profileList = new TestExecutionProfileList();
TestExecutionProfileListEntry entry1 = new TestExecutionProfileListEntry();
entry1.description = "A short decription for profile1";
entry1.id = "profile1";
TestExecutionProfileListEntry entry2 = new TestExecutionProfileListEntry();
entry2.description = "A short decription for profile2";
entry2.id = "profile2";
profileList.executionProfiles.add(entry1);
profileList.executionProfiles.add(entry2);
ProductExecutionProfilesList list = JSONConverter.get().fromJSON(ProductExecutionProfilesList.class, JSONConverter.get().toJSON(profileList));
when(fetchListService.fetchProductExecutionProfileList()).thenReturn(list);
/* execute + test @formatter:off */
this.mockMvc.perform(get(apiEndpoint).contentType(MediaType.APPLICATION_JSON_VALUE)).andExpect(status().isOk()).andDo(defineRestService().with().useCaseData(useCase).tag(RestDocFactory.extractTag(apiEndpoint)).responseSchema(OpenApiSchema.EXECUTION_PROFILE_LIST.getSchema()).and().document(responseFields(fieldWithPath("type").description("Always `executorProfileList` as an identifier for the list"), fieldWithPath("executionProfiles[]." + PROPERTY_ID).description("The profile id"), fieldWithPath("executionProfiles[]." + PROPERTY_DESCRIPTION).description("A profile description"), fieldWithPath("executionProfiles[]." + PROPERTY_ENABLED).description("Enabled state of profile"))));
/* @formatter:on */
}
use of com.mercedesbenz.sechub.test.executionprofile.TestExecutionProfileList in project sechub by mercedes-benz.
the class ExecutionProfileScenario1IntTest method administrator_can_fetch_execution_profile_list_and_list_contains_default_profile_1.
@Test
public void administrator_can_fetch_execution_profile_list_and_list_contains_default_profile_1() {
/* execute */
TestExecutionProfileList profiles = as(SUPER_ADMIN).fetchProductExecutionProfiles();
/* test */
for (TestExecutionProfileListEntry profileEntry : profiles.executionProfiles) {
if (profileEntry.id.equals(ExecutionConstants.DEFAULT_EXECUTION_PROFILE_ID)) {
return;
}
}
fail("Default profile not found! Found only profiles:" + JSONConverter.get().toJSON(profiles));
}
use of com.mercedesbenz.sechub.test.executionprofile.TestExecutionProfileList in project sechub by mercedes-benz.
the class DataCollectorUtils method fetchProfileInformationAboutProject.
public static String fetchProfileInformationAboutProject(String profileId, UIContext uiContext) {
StringBuilder sb = new StringBuilder();
sb.append("Profiles:\n");
DeveloperAdministration administration = uiContext.getAdministration();
TestExecutionProfileList list = administration.fetchExecutionProfileList();
for (TestExecutionProfileListEntry entry : list.executionProfiles) {
TestExecutionProfile profile = administration.fetchExecutionProfile(entry.id);
if (profile.projectIds.contains(profileId)) {
sb.append("- ");
sb.append(profile.id);
if (profile.enabled) {
sb.append("(enabled)");
} else {
sb.append("(disabled)");
}
sb.append("\n with executor configurations:");
/* @formatter:off */
for (TestExecutorConfig config : profile.configurations) {
sb.append("\n *").append(config.name).append(", executor:").append(config.productIdentifier).append(" V").append(config.executorVersion).append(", enabled:").append(config.enabled).append(", uuid=").append(config.uuid);
}
/* @formatter:on */
sb.append("\n");
}
}
return sb.toString();
}
Aggregations