use of com.mercedesbenz.sechub.developertools.admin.DeveloperAdministration in project sechub by mercedes-benz.
the class SetProjectMockDataConfigurationAction method execute.
@Override
protected void execute(ActionEvent e) throws Exception {
Optional<String> projectId = getUserInput("Please enter projectId to setup mock configuration", InputCacheIdentifier.PROJECT_ID);
if (!projectId.isPresent()) {
return;
}
Optional<String> projectMockConfig = getUserInputFromTextArea("Please enter mock configuration for project:" + projectId.get(), InputCacheIdentifier.PROJECT_MOCK_CONFIG_JSON);
if (!projectMockConfig.isPresent()) {
return;
}
if (!confirm("Do you really want to change the mock configuration?")) {
return;
}
DeveloperAdministration administration = getContext().getAdministration();
String url = administration.getUrlBuilder().buildSetProjectMockConfiguration(asSecHubId(projectId.get()));
administration.getRestHelper().putJSON(url, projectMockConfig.get());
}
use of com.mercedesbenz.sechub.developertools.admin.DeveloperAdministration 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();
}
use of com.mercedesbenz.sechub.developertools.admin.DeveloperAdministration in project sechub by mercedes-benz.
the class EditExecutionProfileAction method execute.
@Override
public void execute(ActionEvent e) {
while (true) {
ListExecutionProfilesDialogUI listProfilesDialog = new ListExecutionProfilesDialogUI(getContext(), "Select the profile you want to edit");
listProfilesDialog.setOkButtonText("Edit profile");
listProfilesDialog.showDialog();
if (!listProfilesDialog.isOkPressed()) {
return;
}
String profileId = listProfilesDialog.getSelectedValue();
if (profileId == null) {
/* ok pressed, but no selection */
getContext().getOutputUI().output("No profile selected, so canceled");
return;
}
/* --------------------- */
/* Edit selected profile: */
/* --------------------- */
DeveloperAdministration administration = getContext().getAdministration();
TestExecutionProfile profile = administration.fetchExecutionProfile(profileId);
/* dump to output */
outputAsTextOnSuccess("Profile:" + profileId + " ass JSON:\n" + JSONConverter.get().toJSON(profile, true));
ExecutionProfileDialogUI dialogUI = new ExecutionProfileDialogUI(getContext(), "Edit execution profile", false, profile);
dialogUI.setTextForOKButton("Update profile");
dialogUI.showDialog();
if (!dialogUI.isOkPressed()) {
continue;
}
/* ------------------------ */
/* Update as wished by user: */
/* ------------------------ */
TestExecutionProfile updatedProfile = dialogUI.getUpdatedProfile();
administration.updateExecutionProfile(updatedProfile);
outputAsBeautifiedJSONOnSuccess("Updated execution profile:\n" + JSONConverter.get().toJSON(updatedProfile, true));
}
}
Aggregations