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;
}
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);
}
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();
}
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;
}
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;
}
Aggregations