Search in sources :

Example 21 with TestExecutorConfig

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

the class IntegrationTestDefaultExecutorConfigurations method defineNessusConfig.

private static TestExecutorConfig defineNessusConfig() {
    TestExecutorConfig config = createTestExecutorConfig();
    config.enabled = true;
    config.executorVersion = 1;
    config.productIdentifier = TestExecutorProductIdentifier.NESSUS.name();
    config.name = INTTEST_NAME_PREFIX + "Nessus V1";
    config.setup.baseURL = "\"https://nessus-intranet.mock.example.org:6000";
    config.setup.credentials.user = "nessus-user-id";
    config.setup.credentials.password = "nessus-password";
    // not initialized - is done at creation time by scenario initializer!
    config.uuid = null;
    List<TestExecutorSetupJobParam> jobParameters = config.setup.jobParameters;
    jobParameters.add(new TestExecutorSetupJobParam("nessus.default.policy.id", "nessus-default-policiy-id"));
    return config;
}
Also used : TestExecutorConfig(com.mercedesbenz.sechub.test.executorconfig.TestExecutorConfig) TestExecutorSetupJobParam(com.mercedesbenz.sechub.test.executorconfig.TestExecutorSetupJobParam)

Example 22 with TestExecutorConfig

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

the class ScenarioInitializer method ensureDefaultExecutionProfile.

private ScenarioInitializer ensureDefaultExecutionProfile(DefaultTestExecutionProfile profile) {
    if (TestAPI.canReloadExecutionProfileData(profile)) {
        return this;
    }
    Set<TestExecutorConfig> realConfigurations = new LinkedHashSet<>();
    /*
         * we iterate over initial list, where all defaults are inside - but UUID is
         * null...
         */
    for (TestExecutorConfig config : profile.initialConfigurationsWithoutUUID) {
        UUID uuid = TestAPI.as(SUPER_ADMIN).createProductExecutorConfig(config);
        // set UUID from service to this so available
        config.uuid = uuid;
        realConfigurations.add(config);
    }
    /* define profile */
    TestAPI.as(TestAPI.SUPER_ADMIN).createProductExecutionProfile(profile.id, profile);
    TestExecutionProfile realProfile = TestAPI.as(TestAPI.SUPER_ADMIN).fetchProductExecutionProfile(profile.id);
    /* now we create real configurations having correct uuids etc. */
    realProfile.configurations.addAll(realConfigurations);
    TestAPI.as(TestAPI.SUPER_ADMIN).updateProductExecutionProfile(profile.id, realProfile);
    return this;
}
Also used : LinkedHashSet(java.util.LinkedHashSet) TestExecutionProfile(com.mercedesbenz.sechub.test.executionprofile.TestExecutionProfile) TestExecutorConfig(com.mercedesbenz.sechub.test.executorconfig.TestExecutorConfig) UUID(java.util.UUID)

Example 23 with TestExecutorConfig

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

the class ExecutionProfileScenario1IntTest method sanity_check_for_default_profile1.

@Test
public void sanity_check_for_default_profile1() {
    /* execute */
    TestExecutionProfile profile = as(SUPER_ADMIN).fetchProductExecutionProfile(ExecutionConstants.DEFAULT_EXECUTION_PROFILE_ID);
    /* dump */
    String json = JSONConverter.get().toJSON(profile);
    LOG.info("default profile 1 as json:{}", json);
    /* test */
    assertEquals("default profile1 MUST have exactly 3 configurations active!", 3, profile.configurations.size());
    for (TestExecutorConfig config : profile.configurations) {
        assertTrue("config:" + config.name + " must be enabled but isn't!", config.enabled);
    }
    assertTrue("default profile1 must be enabled!!! Maybe a test has accidently change the profile? default profiles MAY NOT be altered!", profile.enabled);
}
Also used : TestExecutionProfile(com.mercedesbenz.sechub.test.executionprofile.TestExecutionProfile) TestExecutorConfig(com.mercedesbenz.sechub.test.executorconfig.TestExecutorConfig) Test(org.junit.Test)

Example 24 with TestExecutorConfig

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

the class AsUser method addConfigurationToProfile.

public AsUser addConfigurationToProfile(String profileId, UUID... uuids) {
    String url = getUrlBuilder().buildAdminFetchesProductExecutionProfile(profileId);
    String json = getRestHelper().getJSON(url);
    TestExecutionProfile profile = JSONConverter.get().fromJSON(TestExecutionProfile.class, json);
    for (UUID uuid : uuids) {
        TestExecutorConfig config = new TestExecutorConfig(uuid);
        // we do not need to load, because update service does only need uuids, other
        // parts are ignored*/
        profile.configurations.add(config);
    }
    return updateProductExecutionProfile(profileId, profile);
}
Also used : TestExecutionProfile(com.mercedesbenz.sechub.test.executionprofile.TestExecutionProfile) TestExecutorConfig(com.mercedesbenz.sechub.test.executorconfig.TestExecutorConfig) UUID(java.util.UUID)

Example 25 with TestExecutorConfig

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

the class AsUser method fetchProductExecutorConfig.

public TestExecutorConfig fetchProductExecutorConfig(UUID uuid) {
    String json = fetchProductExecutorConfigAsJSON(uuid);
    TestExecutorConfig result = JSONConverter.get().fromJSON(TestExecutorConfig.class, json);
    return result;
}
Also used : TestExecutorConfig(com.mercedesbenz.sechub.test.executorconfig.TestExecutorConfig)

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