Search in sources :

Example 16 with TestExecutorConfig

use of com.mercedesbenz.sechub.test.executorconfig.TestExecutorConfig in project sechub by mercedes-benz.

the class ExecutorConfigDialogUI method createExampleConfig.

public static TestExecutorConfig createExampleConfig() {
    TestExecutorConfig config = new TestExecutorConfig();
    config.setup.baseURL = "https://newproduct.example.com";
    config.setup.jobParameters.add(new TestExecutorSetupJobParam("example.key1", "value1"));
    config.setup.jobParameters.add(new TestExecutorSetupJobParam("example.key2", "value2"));
    config.setup.credentials.user = "env:EXAMPLE_USER_VARIABLE";
    config.setup.credentials.password = "env:EXAMPLE_PASSWORD_VARIABLE";
    config.enabled = false;
    config.executorVersion = 1;
    config.productIdentifier = ProductIdentifier.PDS_CODESCAN.name();
    return config;
}
Also used : TestExecutorConfig(com.mercedesbenz.sechub.test.executorconfig.TestExecutorConfig) TestExecutorSetupJobParam(com.mercedesbenz.sechub.test.executorconfig.TestExecutorSetupJobParam)

Example 17 with TestExecutorConfig

use of com.mercedesbenz.sechub.test.executorconfig.TestExecutorConfig in project sechub by mercedes-benz.

the class DeveloperBatchCreateCheckmarxTestSetupAction method execute.

@Override
public void execute(ActionEvent e) {
    Optional<String> projectId = getUserInput("Please enter project ID/name", InputCacheIdentifier.PROJECT_ID);
    if (!projectId.isPresent()) {
        return;
    }
    Optional<String> owner = getUserInput("Please enter owner user id (must exist)", InputCacheIdentifier.USERNAME);
    if (!owner.isPresent()) {
        return;
    }
    Map<String, String> metaData = new HashMap<>();
    List<String> whiteListURLs = new ArrayList<>();
    /* -------------- */
    /* CREATE PROJECT */
    /* -------------- */
    String projecIdentifier = asSecHubId(projectId.get());
    String userId = owner.get().toLowerCase().trim();
    String postResult = getContext().getAdministration().createProject(projecIdentifier, "created for just for development purposes", userId, whiteListURLs, metaData);
    outputAsBeautifiedJSONOnSuccess(postResult);
    outputAsTextOnSuccess("project created:" + projecIdentifier);
    /* ------------------- */
    /* ASSIGN User2Project */
    /* ------------------- */
    getContext().getAdministration().assignUserToProject(userId, projecIdentifier);
    /* ------------------------------ */
    /* CREATE PRODUCT EXECUTOR CONFIG */
    /* ------------------------------ */
    long timeStamp = System.currentTimeMillis();
    TestExecutorConfig config = new TestExecutorConfig();
    config.productIdentifier = TestExecutorProductIdentifier.CHECKMARX.name();
    config.executorVersion = 1;
    config.name = "tmp-chkmx-cfg-" + timeStamp;
    config.enabled = true;
    config.setup.baseURL = "htttps://checkmarx.example.com";
    config.setup.credentials.user = "fake-user";
    config.setup.credentials.password = "fake-password";
    UUID executorConfigUUID = getContext().getAdministration().createExecutorConfig(config);
    /* -------------- */
    /* CREATE PROFILE */
    /* -------------- */
    TestExecutionProfile profile = new TestExecutionProfile();
    config = getContext().getAdministration().fetchExecutorConfiguration(executorConfigUUID);
    profile.id = "tmp-profile-" + timeStamp;
    profile.configurations.add(config);
    profile.projectIds.add(projecIdentifier);
    profile.enabled = true;
    getContext().getAdministration().createExecutionProfile(profile);
    /* ----------------------------- */
    /* Show overview of created data */
    /* ----------------------------- */
    String info = DataCollectorUtils.fetchProfileInformationAboutProject(projecIdentifier, getContext());
    outputAsTextOnSuccess(info);
}
Also used : TestExecutionProfile(com.mercedesbenz.sechub.test.executionprofile.TestExecutionProfile) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) TestExecutorConfig(com.mercedesbenz.sechub.test.executorconfig.TestExecutorConfig) UUID(java.util.UUID)

Example 18 with TestExecutorConfig

use of com.mercedesbenz.sechub.test.executorconfig.TestExecutorConfig 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 19 with TestExecutorConfig

use of com.mercedesbenz.sechub.test.executorconfig.TestExecutorConfig in project sechub by mercedes-benz.

the class IntegrationTestDefaultExecutorConfigurations method createTestExecutorConfig.

private static TestExecutorConfig createTestExecutorConfig() {
    TestExecutorConfig testExecutorConfig = new TestExecutorConfig();
    registeredConfigurations.add(testExecutorConfig);
    testExecutorConfig.setup.jobParameters.add(new TestExecutorSetupJobParam(PDSDefaultParameterKeyConstants.PARAM_KEY_PDS_MOCKING_DISABLED, "true"));
    return testExecutorConfig;
}
Also used : TestExecutorConfig(com.mercedesbenz.sechub.test.executorconfig.TestExecutorConfig) TestExecutorSetupJobParam(com.mercedesbenz.sechub.test.executorconfig.TestExecutorSetupJobParam)

Example 20 with TestExecutorConfig

use of com.mercedesbenz.sechub.test.executorconfig.TestExecutorConfig in project sechub by mercedes-benz.

the class IntegrationTestDefaultExecutorConfigurations method definePDSScan.

private static TestExecutorConfig definePDSScan(String variant, boolean credentialsAsEnvEntries, String productIdentifierId, StorageType storageType, TestExecutorProductIdentifier sechubProductIdentifier) {
    TestExecutorConfig config = createTestExecutorConfig();
    String middleConfigName = sechubProductIdentifier.name().toLowerCase() + "_";
    config.enabled = true;
    config.executorVersion = 1;
    config.productIdentifier = sechubProductIdentifier.name();
    config.name = INTTEST_NAME_PREFIX + middleConfigName + variant;
    config.setup.baseURL = TestURLBuilder.https(TestPortProvider.DEFAULT_INSTANCE.getIntegrationTestPDSPort()).pds().buildBaseUrl();
    // not initialized - is done at creation time by scenario initializer!
    config.uuid = null;
    if (credentialsAsEnvEntries) {
        config.setup.credentials.user = "env:" + PDS_ENV_VARIABLENAME_TECHUSER_ID;
        config.setup.credentials.password = "env:" + PDS_ENV_VARIABLENAME_TECHUSER_APITOKEN;
    } else {
        config.setup.credentials.user = TestAPI.PDS_TECH_USER.getUserId();
        config.setup.credentials.password = TestAPI.PDS_TECH_USER.getApiToken();
    }
    boolean useSecHubStorage = storageType == StorageType.REUSE_SECHUB_DATA;
    List<TestExecutorSetupJobParam> jobParameters = config.setup.jobParameters;
    jobParameters.add(new TestExecutorSetupJobParam(PARAM_KEY_PDS_CONFIG_PRODUCTIDENTIFIER, productIdentifierId));
    jobParameters.add(new TestExecutorSetupJobParam(PARAM_KEY_PDS_CONFIG_USE_SECHUB_STORAGE, Boolean.valueOf(useSecHubStorage).toString()));
    // accept self signed certificates for
    jobParameters.add(new TestExecutorSetupJobParam(TRUST_ALL_CERTIFICATES, "true"));
    // testing
    // speed up tests...
    jobParameters.add(new TestExecutorSetupJobParam(TIME_TO_WAIT_NEXT_CHECK_MILLIS, "500"));
    // mandatory from PDS integration test server
    jobParameters.add(new TestExecutorSetupJobParam("product1.qualititycheck.enabled", "true"));
    if (TestExecutorProductIdentifier.PDS_CODESCAN.equals(sechubProductIdentifier)) {
        // mandatory from PDS integration test server
        jobParameters.add(new TestExecutorSetupJobParam("product1.level", VALUE_PRODUCT_LEVEL));
    } else if (TestExecutorProductIdentifier.PDS_WEBSCAN.equals(sechubProductIdentifier)) {
        // mandatory from PDS integration test server
        jobParameters.add(new TestExecutorSetupJobParam("product2.level", "4711"));
    }
    jobParameters.add(new TestExecutorSetupJobParam(JOBPARAM_PDS_KEY_FOR_VARIANTNAME, variant));
    return config;
}
Also used : TestExecutorConfig(com.mercedesbenz.sechub.test.executorconfig.TestExecutorConfig) TestExecutorSetupJobParam(com.mercedesbenz.sechub.test.executorconfig.TestExecutorSetupJobParam)

Aggregations

TestExecutorConfig (com.mercedesbenz.sechub.test.executorconfig.TestExecutorConfig)37 UUID (java.util.UUID)26 Test (org.junit.Test)17 TestExecutionProfile (com.mercedesbenz.sechub.test.executionprofile.TestExecutionProfile)14 TestExecutorSetupJobParam (com.mercedesbenz.sechub.test.executorconfig.TestExecutorSetupJobParam)13 UseCaseRestDoc (com.mercedesbenz.sechub.sharedkernel.usecases.UseCaseRestDoc)5 WebMvcTest (org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest)5 DeveloperAdministration (com.mercedesbenz.sechub.developertools.admin.DeveloperAdministration)1 TableRendersupport (com.mercedesbenz.sechub.developertools.admin.ui.TableRendersupport)1 ExecutorConfigDialogUI (com.mercedesbenz.sechub.developertools.admin.ui.action.config.ExecutorConfigDialogUI)1 ProductExecutionProfile (com.mercedesbenz.sechub.domain.scan.product.config.ProductExecutionProfile)1 ProductExecutorConfig (com.mercedesbenz.sechub.domain.scan.product.config.ProductExecutorConfig)1 TestProject (com.mercedesbenz.sechub.integrationtest.api.TestProject)1 MappingData (com.mercedesbenz.sechub.sharedkernel.mapping.MappingData)1 UseCaseAdminCreatesExecutorConfiguration (com.mercedesbenz.sechub.sharedkernel.usecases.admin.config.UseCaseAdminCreatesExecutorConfiguration)1 UseCaseAdminFetchesExecutionProfile (com.mercedesbenz.sechub.sharedkernel.usecases.admin.config.UseCaseAdminFetchesExecutionProfile)1 UseCaseAdminFetchesExecutorConfiguration (com.mercedesbenz.sechub.sharedkernel.usecases.admin.config.UseCaseAdminFetchesExecutorConfiguration)1 UseCaseAdminUpdatesExecutionProfile (com.mercedesbenz.sechub.sharedkernel.usecases.admin.config.UseCaseAdminUpdatesExecutionProfile)1 UseCaseAdminUpdatesExecutorConfig (com.mercedesbenz.sechub.sharedkernel.usecases.admin.config.UseCaseAdminUpdatesExecutorConfig)1 TestExecutionProfileList (com.mercedesbenz.sechub.test.executionprofile.TestExecutionProfileList)1