Search in sources :

Example 6 with DeveloperAdministration

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());
}
Also used : DeveloperAdministration(com.mercedesbenz.sechub.developertools.admin.DeveloperAdministration)

Example 7 with DeveloperAdministration

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();
}
Also used : TestExecutionProfileListEntry(com.mercedesbenz.sechub.test.executionprofile.TestExecutionProfileListEntry) TestExecutionProfileList(com.mercedesbenz.sechub.test.executionprofile.TestExecutionProfileList) TestExecutionProfile(com.mercedesbenz.sechub.test.executionprofile.TestExecutionProfile) DeveloperAdministration(com.mercedesbenz.sechub.developertools.admin.DeveloperAdministration) TestExecutorConfig(com.mercedesbenz.sechub.test.executorconfig.TestExecutorConfig)

Example 8 with DeveloperAdministration

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));
    }
}
Also used : TestExecutionProfile(com.mercedesbenz.sechub.test.executionprofile.TestExecutionProfile) DeveloperAdministration(com.mercedesbenz.sechub.developertools.admin.DeveloperAdministration)

Aggregations

DeveloperAdministration (com.mercedesbenz.sechub.developertools.admin.DeveloperAdministration)8 TestExecutionProfile (com.mercedesbenz.sechub.test.executionprofile.TestExecutionProfile)2 MappingData (com.mercedesbenz.sechub.sharedkernel.mapping.MappingData)1 ProjectAccessLevel (com.mercedesbenz.sechub.sharedkernel.project.ProjectAccessLevel)1 TestExecutionProfileList (com.mercedesbenz.sechub.test.executionprofile.TestExecutionProfileList)1 TestExecutionProfileListEntry (com.mercedesbenz.sechub.test.executionprofile.TestExecutionProfileListEntry)1 TestExecutorConfig (com.mercedesbenz.sechub.test.executorconfig.TestExecutorConfig)1 BorderLayout (java.awt.BorderLayout)1 Container (java.awt.Container)1 Image (java.awt.Image)1 ImageIcon (javax.swing.ImageIcon)1 JFrame (javax.swing.JFrame)1 JPanel (javax.swing.JPanel)1