Skip to content

Commit

Permalink
Review changes + documentation updates #2092
Browse files Browse the repository at this point in the history
  • Loading branch information
de-jcup committed Aug 11, 2023
1 parent d7a1769 commit c13cee8
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 26 deletions.
Expand Up @@ -26,9 +26,9 @@ therefore it is usually not necessary to explicitly define much to have a runnin
Try to only define the necessary minimum and let the system test framework do the rest.
It is also possible to use an already running local servers. For example when you are
developing a PDS solution you can start a local SecHub server in your IDE and run
your tests only with start definitions for your {pds} solution! This will increase
It is also possible to use already running local servers ({sechub} and/or {pds}).
For example: When you are developing a PDS solution you can start a local SecHub server in your IDE
and run your tests only with start definitions for your {pds} solution! This will increase
speed, because the test will not spawn (and also not shutdown) the {sechub} server instance!
====

Expand Down Expand Up @@ -418,7 +418,7 @@ include::../../gen/gen_example_systemtest_full_blown_config.json[]
As a first step, download the latest release of `pds-tools` from https://github.com/mercedes-benz/sechub/releases.

Execute:
`java -jar sechub-pds-tools-cli-<version>.jar --systemTest=${pathToJson}`
`java -jar sechub-pds-tools-cli-<version>.jar systemTest --file ${pathToTestConfigurationJson} --pds-solutions-rootfolder ${pathToPDSSolutions}`

==== JUnit tests
Just execute the Junit test from your IDE.
Expand Down Expand Up @@ -497,7 +497,7 @@ etc. must all be configured before the test is run.

====== Projects
The defined projects will be created automatically. If a project exists with the defined name (e.g.
when a system test is restarted locally) the existing projected will be deleted!
when a system test is restarted locally) the existing project will be deleted!

====== Executor configurations
Every system test start will just create new executor configurations.
Expand Down
21 changes: 13 additions & 8 deletions sechub-doc/src/docs/asciidoc/documents/techdoc/05_build.adoc
Expand Up @@ -55,16 +55,21 @@ if wanted.
Because the API related gradle projects are not initialized per default, the IDE import mechanism
will not automatically import gradle subprojects like `sechub-systemtest`.

For eclipse task there is a special treatment added inside `sechub-developertools/build.gradle` - importing
at commandline by `./gradlew eclipse` or by `EGradle` plugin will automatically import those
projects automatically.
For the gradle eclipse task there is a special treatment added inside `sechub-developertools/build.gradle`:

For the Eclipse standard Gradle integration (Eclipse Buildship) you must enter the following
command at root folder:
`./gradlew eclipse -Dsechub.build.stage=all`
As next step import the additionally created projects manually into Eclipse.
===== Eclipse
When you execute `./gradlew eclipse` at command line the eclipse files for those projects will be generated.
As next step import the additionally created projects manually into Eclipse ("Import -> existing projects").

For IntelliJ similar:
If you are using the Eclipse standard Gradle integration (Eclipse Buildship), the manual import step
is probably necessary as well.

Another option is to use the https://marketplace.eclipse.org/content/egradle-ide[`EGradle`] plugin - it uses also
`./gradlew eclipse` and does the import automatically.


===== IntelliJ
For IntelliJ - similar to the steps for Eclipse - you can use the gradle idea task
`./gradlew idea -Dsechub.build.stage=all`

=== Gradle build commands overview
Expand Down
Expand Up @@ -95,36 +95,36 @@ private void assertRunSecHubJobCorrect(SystemTestRuntimeContext context, TestDef
private void assertReferenceIds(SystemTestRuntimeContext context, RunSecHubJobDefinition runSecHubJob) {
Set<String> existingReferenceIds = collectReferenceIdsAndFailIfMissing(context, runSecHubJob);

asertReferencesCorrectForCodeScan(context, runSecHubJob, existingReferenceIds);
asertReferencesCorrectForWebScan(context, runSecHubJob, existingReferenceIds);
asertReferencesCorrectForLicenseScan(context, runSecHubJob, existingReferenceIds);
asertReferencesCorrectForSecretcan(context, runSecHubJob, existingReferenceIds);
assertReferencesCorrectForCodeScan(context, runSecHubJob, existingReferenceIds);
assertReferencesCorrectForWebScan(context, runSecHubJob, existingReferenceIds);
assertReferencesCorrectForLicenseScan(context, runSecHubJob, existingReferenceIds);
assertReferencesCorrectForSecretcan(context, runSecHubJob, existingReferenceIds);

/* Because infrastructure scans do not have references we do not handled them */
}

private void asertReferencesCorrectForCodeScan(SystemTestRuntimeContext context, RunSecHubJobDefinition runSecHubJob, Set<String> existingReferenceIds) {
private void assertReferencesCorrectForCodeScan(SystemTestRuntimeContext context, RunSecHubJobDefinition runSecHubJob, Set<String> existingReferenceIds) {
Optional<SecHubCodeScanConfiguration> codeConfigOpt = runSecHubJob.getCodeScan();
if (codeConfigOpt.isPresent()) {
assertReferenceIdsCorrect("code scan", context, existingReferenceIds, codeConfigOpt.get().getNamesOfUsedDataConfigurationObjects());
}
}

private void asertReferencesCorrectForSecretcan(SystemTestRuntimeContext context, RunSecHubJobDefinition runSecHubJob, Set<String> existingReferenceIds) {
private void assertReferencesCorrectForSecretcan(SystemTestRuntimeContext context, RunSecHubJobDefinition runSecHubJob, Set<String> existingReferenceIds) {
Optional<SecHubSecretScanConfiguration> secretConfigOpt = runSecHubJob.getSecretScan();
if (secretConfigOpt.isPresent()) {
assertReferenceIdsCorrect("secret scan", context, existingReferenceIds, secretConfigOpt.get().getNamesOfUsedDataConfigurationObjects());
}
}

private void asertReferencesCorrectForLicenseScan(SystemTestRuntimeContext context, RunSecHubJobDefinition runSecHubJob, Set<String> existingReferenceIds) {
private void assertReferencesCorrectForLicenseScan(SystemTestRuntimeContext context, RunSecHubJobDefinition runSecHubJob, Set<String> existingReferenceIds) {
Optional<SecHubLicenseScanConfiguration> licenseConfigOpt = runSecHubJob.getLicenseScan();
if (licenseConfigOpt.isPresent()) {
assertReferenceIdsCorrect("license scan", context, existingReferenceIds, licenseConfigOpt.get().getNamesOfUsedDataConfigurationObjects());
}
}

private void asertReferencesCorrectForWebScan(SystemTestRuntimeContext context, RunSecHubJobDefinition runSecHubJob, Set<String> existingReferenceIds) {
private void assertReferencesCorrectForWebScan(SystemTestRuntimeContext context, RunSecHubJobDefinition runSecHubJob, Set<String> existingReferenceIds) {
Optional<SecHubWebScanConfiguration> webConfigOpt = runSecHubJob.getWebScan();
if (webConfigOpt.isPresent()) {
Optional<SecHubWebScanApiConfiguration> apiOpt = webConfigOpt.get().getApi();
Expand Down Expand Up @@ -237,19 +237,19 @@ private void verifySecHubLocal(SystemTestRuntimeContext context) {
throw new WrongConfigurationException("SecHub local admin user name not configured but necessary for local run!", context);
}

asssertSteps(secHub.getStart(), SystemTestExecutionScope.SECHUB.name(), SystemTestExecutionState.START, context);
asssertSteps(secHub.getStop(), SystemTestExecutionScope.SECHUB.name(), SystemTestExecutionState.STOP, context);
assertSteps(secHub.getStart(), SystemTestExecutionScope.SECHUB.name(), SystemTestExecutionState.START, context);
assertSteps(secHub.getStop(), SystemTestExecutionScope.SECHUB.name(), SystemTestExecutionState.STOP, context);

for (PDSSolutionDefinition pdsSolution : localSetup.getPdsSolutions()) {
asssertSteps(pdsSolution.getStart(), SystemTestExecutionScope.PDS_SOLUTION.name() + ":" + pdsSolution.getName(), SystemTestExecutionState.START,
assertSteps(pdsSolution.getStart(), SystemTestExecutionScope.PDS_SOLUTION.name() + ":" + pdsSolution.getName(), SystemTestExecutionState.START,
context);
asssertSteps(pdsSolution.getStop(), SystemTestExecutionScope.PDS_SOLUTION.name() + ":" + pdsSolution.getName(), SystemTestExecutionState.STOP,
assertSteps(pdsSolution.getStop(), SystemTestExecutionScope.PDS_SOLUTION.name() + ":" + pdsSolution.getName(), SystemTestExecutionState.STOP,
context);
}

}

private void asssertSteps(List<ExecutionStepDefinition> startSteps, String scope, SystemTestExecutionState state, SystemTestRuntimeContext context) {
private void assertSteps(List<ExecutionStepDefinition> startSteps, String scope, SystemTestExecutionState state, SystemTestRuntimeContext context) {
if (startSteps.isEmpty()) {
return;
}
Expand Down

0 comments on commit c13cee8

Please sign in to comment.