diff --git a/deprecated-sechub-adapter-nessus/src/test/java/com/mercedesbenz/sechub/adapter/nessus/NessusAdapterV1Test.java b/deprecated-sechub-adapter-nessus/src/test/java/com/mercedesbenz/sechub/adapter/nessus/NessusAdapterV1Test.java index 4691172dbd..6e25ad839c 100644 --- a/deprecated-sechub-adapter-nessus/src/test/java/com/mercedesbenz/sechub/adapter/nessus/NessusAdapterV1Test.java +++ b/deprecated-sechub-adapter-nessus/src/test/java/com/mercedesbenz/sechub/adapter/nessus/NessusAdapterV1Test.java @@ -22,7 +22,7 @@ public class NessusAdapterV1Test { @BeforeClass public static void beforeClass() { - NESSUS_7_0_2_GET_POLICIES_RESULT_JSON = NessusAdapterTestFileSupport.getTestfileSupport().loadTestFile("nessus_7.0.2.get_policies_result.json"); + NESSUS_7_0_2_GET_POLICIES_RESULT_JSON = TestNessusAdapterFileSupport.getTestfileSupport().loadTestFile("nessus_7.0.2.get_policies_result.json"); } @Rule diff --git a/deprecated-sechub-adapter-nessus/src/test/java/com/mercedesbenz/sechub/adapter/nessus/NessusAdapterTestFileSupport.java b/deprecated-sechub-adapter-nessus/src/test/java/com/mercedesbenz/sechub/adapter/nessus/TestNessusAdapterFileSupport.java similarity index 55% rename from deprecated-sechub-adapter-nessus/src/test/java/com/mercedesbenz/sechub/adapter/nessus/NessusAdapterTestFileSupport.java rename to deprecated-sechub-adapter-nessus/src/test/java/com/mercedesbenz/sechub/adapter/nessus/TestNessusAdapterFileSupport.java index c0e56faddf..9c90d1f993 100644 --- a/deprecated-sechub-adapter-nessus/src/test/java/com/mercedesbenz/sechub/adapter/nessus/NessusAdapterTestFileSupport.java +++ b/deprecated-sechub-adapter-nessus/src/test/java/com/mercedesbenz/sechub/adapter/nessus/TestNessusAdapterFileSupport.java @@ -5,14 +5,14 @@ import com.mercedesbenz.sechub.test.TestFileSupport; @SechubTestComponent -public class NessusAdapterTestFileSupport extends TestFileSupport { - private static final NessusAdapterTestFileSupport TESTFILE_SUPPORT = new NessusAdapterTestFileSupport(); +public class TestNessusAdapterFileSupport extends TestFileSupport { + private static final TestNessusAdapterFileSupport TESTFILE_SUPPORT = new TestNessusAdapterFileSupport(); - public static NessusAdapterTestFileSupport getTestfileSupport() { + public static TestNessusAdapterFileSupport getTestfileSupport() { return TESTFILE_SUPPORT; } - NessusAdapterTestFileSupport() { + TestNessusAdapterFileSupport() { super("deprecated-sechub-adapter-nessus/src/test/resources"); } diff --git a/deprecated-sechub-adapter-netsparker/src/test/java/com/mercedesbenz/sechub/adapter/netsparker/NetsparkerAdapterV1Test.java b/deprecated-sechub-adapter-netsparker/src/test/java/com/mercedesbenz/sechub/adapter/netsparker/NetsparkerAdapterV1Test.java index 8b92cfffe9..95eedb5347 100644 --- a/deprecated-sechub-adapter-netsparker/src/test/java/com/mercedesbenz/sechub/adapter/netsparker/NetsparkerAdapterV1Test.java +++ b/deprecated-sechub-adapter-netsparker/src/test/java/com/mercedesbenz/sechub/adapter/netsparker/NetsparkerAdapterV1Test.java @@ -68,7 +68,7 @@ public void build_json_for_new_scan_with_basic_auth_contains_basic_login_parts() String json = adapterToTest.buildJsonForCreateNewScan(jsonAdapterSupport, config); /* test */ - String expected = NetsparkerAdapterTestFileSupport.getTestfileSupport().loadTestFile("json/basic_weblogin_expected1.json"); + String expected = TestNetsparkerAdapterFileSupport.getTestfileSupport().loadTestFile("json/basic_weblogin_expected1.json"); assertEquals(expected, json); } @@ -83,7 +83,7 @@ public void build_json_for_new_scan_with_max_scan_duration_one_hour() throws Exc String json = adapterToTest.buildJsonForCreateNewScan(jsonAdapterSupport, config); /* test */ - String expected = NetsparkerAdapterTestFileSupport.getTestfileSupport().loadTestFile("json/max_duration_one_hour_expected.json"); + String expected = TestNetsparkerAdapterFileSupport.getTestfileSupport().loadTestFile("json/max_duration_one_hour_expected.json"); assertEquals(expected, json); } @@ -106,7 +106,7 @@ public void build_json_for_new_scan_with_max_scan_duration_5_minutes() throws Ex /* test */ // the minimum scan duration for Netsparker is 1 hour - String expected = NetsparkerAdapterTestFileSupport.getTestfileSupport().loadTestFile("json/max_duration_one_hour_expected.json"); + String expected = TestNetsparkerAdapterFileSupport.getTestfileSupport().loadTestFile("json/max_duration_one_hour_expected.json"); assertEquals(expected, json); } @@ -126,7 +126,7 @@ public void build_json_for_new_scan_with_max_scan_duration_129_minutes() throws String json = adapterToTest.buildJsonForCreateNewScan(jsonAdapterSupport, config); /* test */ - String expected = NetsparkerAdapterTestFileSupport.getTestfileSupport().loadTestFile("json/max_duration_three_hours_expected.json"); + String expected = TestNetsparkerAdapterFileSupport.getTestfileSupport().loadTestFile("json/max_duration_three_hours_expected.json"); assertEquals(expected, json); } @@ -146,7 +146,7 @@ public void build_json_for_new_scan_with_max_scan_duration_180_minutes() throws String json = adapterToTest.buildJsonForCreateNewScan(jsonAdapterSupport, config); /* test */ - String expected = NetsparkerAdapterTestFileSupport.getTestfileSupport().loadTestFile("json/max_duration_three_hours_expected.json"); + String expected = TestNetsparkerAdapterFileSupport.getTestfileSupport().loadTestFile("json/max_duration_three_hours_expected.json"); assertEquals(expected, json); } @@ -253,7 +253,7 @@ public void build_json_for_new_scan_with_form_auth_scripts() throws Exception { String json = adapterToTest.buildJsonForCreateNewScan(jsonAdapterSupport, config); /* test */ - String expected = NetsparkerAdapterTestFileSupport.getTestfileSupport().loadTestFile("json/form_scripts_weblogin.json"); + String expected = TestNetsparkerAdapterFileSupport.getTestfileSupport().loadTestFile("json/form_scripts_weblogin.json"); assertEquals(expected, json); } @@ -276,7 +276,7 @@ public void a_fetch_report__triggers_rest_tempate_with_correct_params() { @Test public void isAbleTo_extract_id_from_netsparker_v1_0_40_109_result_when_create_new_scan_triggered() throws AdapterException { /* prepare */ - String body = NetsparkerAdapterTestFileSupport.getTestfileSupport().loadTestFile("netsparker_v1.0.40.109_new_scan_output.json"); + String body = TestNetsparkerAdapterFileSupport.getTestfileSupport().loadTestFile("netsparker_v1.0.40.109_new_scan_output.json"); /* execute */ String id = adapterToTest.extractIDFromScanResult(body, context); diff --git a/deprecated-sechub-adapter-netsparker/src/test/java/com/mercedesbenz/sechub/adapter/netsparker/NetsparkerAdapterTestApplication.java b/deprecated-sechub-adapter-netsparker/src/test/java/com/mercedesbenz/sechub/adapter/netsparker/TestNetsparkerAdapterApplication.java similarity index 99% rename from deprecated-sechub-adapter-netsparker/src/test/java/com/mercedesbenz/sechub/adapter/netsparker/NetsparkerAdapterTestApplication.java rename to deprecated-sechub-adapter-netsparker/src/test/java/com/mercedesbenz/sechub/adapter/netsparker/TestNetsparkerAdapterApplication.java index 750af770e4..58f957aacf 100644 --- a/deprecated-sechub-adapter-netsparker/src/test/java/com/mercedesbenz/sechub/adapter/netsparker/NetsparkerAdapterTestApplication.java +++ b/deprecated-sechub-adapter-netsparker/src/test/java/com/mercedesbenz/sechub/adapter/netsparker/TestNetsparkerAdapterApplication.java @@ -21,7 +21,7 @@ * @author Albert Tregnaghi * */ -public class NetsparkerAdapterTestApplication { +public class TestNetsparkerAdapterApplication { public static void main(String[] args) throws Exception { SecHubTimeUnitData maxScanDuration = null; diff --git a/deprecated-sechub-adapter-netsparker/src/test/java/com/mercedesbenz/sechub/adapter/netsparker/NetsparkerAdapterTestFileSupport.java b/deprecated-sechub-adapter-netsparker/src/test/java/com/mercedesbenz/sechub/adapter/netsparker/TestNetsparkerAdapterFileSupport.java similarity index 55% rename from deprecated-sechub-adapter-netsparker/src/test/java/com/mercedesbenz/sechub/adapter/netsparker/NetsparkerAdapterTestFileSupport.java rename to deprecated-sechub-adapter-netsparker/src/test/java/com/mercedesbenz/sechub/adapter/netsparker/TestNetsparkerAdapterFileSupport.java index ce885788e1..02e50cfb63 100644 --- a/deprecated-sechub-adapter-netsparker/src/test/java/com/mercedesbenz/sechub/adapter/netsparker/NetsparkerAdapterTestFileSupport.java +++ b/deprecated-sechub-adapter-netsparker/src/test/java/com/mercedesbenz/sechub/adapter/netsparker/TestNetsparkerAdapterFileSupport.java @@ -5,14 +5,14 @@ import com.mercedesbenz.sechub.test.TestFileSupport; @SechubTestComponent -public class NetsparkerAdapterTestFileSupport extends TestFileSupport { - private static final NetsparkerAdapterTestFileSupport TESTFILE_SUPPORT = new NetsparkerAdapterTestFileSupport(); +public class TestNetsparkerAdapterFileSupport extends TestFileSupport { + private static final TestNetsparkerAdapterFileSupport TESTFILE_SUPPORT = new TestNetsparkerAdapterFileSupport(); - public static NetsparkerAdapterTestFileSupport getTestfileSupport() { + public static TestNetsparkerAdapterFileSupport getTestfileSupport() { return TESTFILE_SUPPORT; } - NetsparkerAdapterTestFileSupport() { + TestNetsparkerAdapterFileSupport() { super("deprecated-sechub-adapter-netsparker/src/test/resources"); } diff --git a/gradle/libraries.gradle b/gradle/libraries.gradle index 8e5235aac0..4b5a84163e 100644 --- a/gradle/libraries.gradle +++ b/gradle/libraries.gradle @@ -181,7 +181,7 @@ ext { wiremock: "com.github.tomakehurst:wiremock-standalone:${libraryVersion.wiremock}", s3mock: "com.adobe.testing:s3mock:${libraryVersion.s3mock}", s3mock_junit5: "com.adobe.testing:s3mock-junit5:${libraryVersion.s3mock}", - + /* * RE2 is a regular expression engine that runs in time linear in the size of the input. * It's the default RegularExpression engine of Go diff --git a/sechub-adapter-checkmarx/src/test/java/com/mercedesbenz/sechub/adapter/checkmarx/CheckmarxTestFileSupport.java b/sechub-adapter-checkmarx/src/test/java/com/mercedesbenz/sechub/adapter/checkmarx/CheckmarxTestFileSupport.java deleted file mode 100644 index b805ecf059..0000000000 --- a/sechub-adapter-checkmarx/src/test/java/com/mercedesbenz/sechub/adapter/checkmarx/CheckmarxTestFileSupport.java +++ /dev/null @@ -1,17 +0,0 @@ -// SPDX-License-Identifier: MIT -package com.mercedesbenz.sechub.adapter.checkmarx; - -import com.mercedesbenz.sechub.test.TestFileSupport; - -public class CheckmarxTestFileSupport extends TestFileSupport { - - private static final CheckmarxTestFileSupport TESTFILE_SUPPORT = new CheckmarxTestFileSupport(); - - public static CheckmarxTestFileSupport getTestfileSupport() { - return TESTFILE_SUPPORT; - } - - CheckmarxTestFileSupport() { - super("sechub-adapter-checkmarx/src/test/resources"); - } -} diff --git a/sechub-adapter-checkmarx/src/test/java/com/mercedesbenz/sechub/adapter/checkmarx/CheckmarxAdapterTestApplication.java b/sechub-adapter-checkmarx/src/test/java/com/mercedesbenz/sechub/adapter/checkmarx/TestCheckmarxAdapterApplication.java similarity index 97% rename from sechub-adapter-checkmarx/src/test/java/com/mercedesbenz/sechub/adapter/checkmarx/CheckmarxAdapterTestApplication.java rename to sechub-adapter-checkmarx/src/test/java/com/mercedesbenz/sechub/adapter/checkmarx/TestCheckmarxAdapterApplication.java index c19a975113..c19c0d90ef 100644 --- a/sechub-adapter-checkmarx/src/test/java/com/mercedesbenz/sechub/adapter/checkmarx/CheckmarxAdapterTestApplication.java +++ b/sechub-adapter-checkmarx/src/test/java/com/mercedesbenz/sechub/adapter/checkmarx/TestCheckmarxAdapterApplication.java @@ -20,7 +20,7 @@ * @author Albert Tregnaghi, Jeremias Eppler * */ -public class CheckmarxAdapterTestApplication { +public class TestCheckmarxAdapterApplication { public static void main(String[] args) throws Exception { System.setProperty("log4j.logger.org.apache.http", "ERROR"); @@ -46,7 +46,7 @@ public static void main(String[] args) throws Exception { // "zipfile_contains_only_test1.txt.zip"; // leads to FAILED in queue // "zipfile_contains_sechub_doc_java.zip"; // should work - File zipFile = CheckmarxTestFileSupport.getTestfileSupport().createFileFromRoot("sechub-other/testsourcecode/" + pathInOtherProject); + File zipFile = TestCheckmarxFileSupport.getTestfileSupport().createFileFromRoot("sechub-other/testsourcecode/" + pathInOtherProject); /* @formatter:off */ CheckmarxAdapterConfig config = CheckmarxConfig.builder(). diff --git a/sechub-adapter-checkmarx/src/test/java/com/mercedesbenz/sechub/adapter/checkmarx/TestCheckmarxFileSupport.java b/sechub-adapter-checkmarx/src/test/java/com/mercedesbenz/sechub/adapter/checkmarx/TestCheckmarxFileSupport.java new file mode 100644 index 0000000000..c438b52770 --- /dev/null +++ b/sechub-adapter-checkmarx/src/test/java/com/mercedesbenz/sechub/adapter/checkmarx/TestCheckmarxFileSupport.java @@ -0,0 +1,17 @@ +// SPDX-License-Identifier: MIT +package com.mercedesbenz.sechub.adapter.checkmarx; + +import com.mercedesbenz.sechub.test.TestFileSupport; + +public class TestCheckmarxFileSupport extends TestFileSupport { + + private static final TestCheckmarxFileSupport TESTFILE_SUPPORT = new TestCheckmarxFileSupport(); + + public static TestCheckmarxFileSupport getTestfileSupport() { + return TESTFILE_SUPPORT; + } + + TestCheckmarxFileSupport() { + super("sechub-adapter-checkmarx/src/test/resources"); + } +} diff --git a/sechub-adapter-pds/src/test/java/com/mercedesbenz/sechub/adapter/pds/PDSAdapterV1WireMockTest.java b/sechub-adapter-pds/src/test/java/com/mercedesbenz/sechub/adapter/pds/PDSAdapterV1WireMockTest.java index 69de0203d9..f61f902fb8 100644 --- a/sechub-adapter-pds/src/test/java/com/mercedesbenz/sechub/adapter/pds/PDSAdapterV1WireMockTest.java +++ b/sechub-adapter-pds/src/test/java/com/mercedesbenz/sechub/adapter/pds/PDSAdapterV1WireMockTest.java @@ -73,7 +73,7 @@ public void when_pds_config_use_sechub_store_not_set__upload_is_called() throws expectedJobParameters.put(PDSDefaultParameterKeyConstants.PARAM_KEY_PDS_SCAN_TARGET_TYPE,""); /* prepare */ - PDSWiremockTestSupport testSupport = PDSWiremockTestSupport.builder(wireMockRule). + TestPDSWiremockSupport testSupport = TestPDSWiremockSupport.builder(wireMockRule). simulateJobCanBeCreated(sechubJobUUID,productIdentifier,expectedJobParameters). simulateUploadData(SOURCECODE_ZIP, SIM_SOURCE_ZIP_SIZE). simulateMarkReadyToStart(). @@ -102,7 +102,7 @@ public void when_pds_config_use_sechub_store_set_to_false__upload_is_called() th expectedJobParameters.put(PDSDefaultParameterKeyConstants.PARAM_KEY_PDS_SCAN_TARGET_TYPE,""); expectedJobParameters.put(PDSDefaultParameterKeyConstants.PARAM_KEY_PDS_CONFIG_USE_SECHUB_STORAGE,"false"); - PDSWiremockTestSupport testSupport = PDSWiremockTestSupport.builder(wireMockRule). + TestPDSWiremockSupport testSupport = TestPDSWiremockSupport.builder(wireMockRule). simulateJobCanBeCreated(sechubJobUUID,productIdentifier,expectedJobParameters). simulateUploadData(SOURCECODE_ZIP,SIM_SOURCE_ZIP_SIZE). simulateMarkReadyToStart(). @@ -131,7 +131,7 @@ public void when_pds_config_use_sechub_store_set_to_false__upload_is_called__bin expectedJobParameters.put(PDSDefaultParameterKeyConstants.PARAM_KEY_PDS_SCAN_TARGET_TYPE,""); expectedJobParameters.put(PDSDefaultParameterKeyConstants.PARAM_KEY_PDS_CONFIG_USE_SECHUB_STORAGE,"false"); - PDSWiremockTestSupport testSupport = PDSWiremockTestSupport.builder(wireMockRule). + TestPDSWiremockSupport testSupport = TestPDSWiremockSupport.builder(wireMockRule). simulateJobCanBeCreated(sechubJobUUID,productIdentifier,expectedJobParameters). simulateUploadData(BINARIES_TAR,SIM_BINARIES_TAR_SIZE). simulateMarkReadyToStart(). @@ -161,7 +161,7 @@ public void when_pds_config_use_sechub_store_set_to_true__upload_is_NOT_called() expectedJobParameters.put(PDSDefaultParameterKeyConstants.PARAM_KEY_PDS_CONFIG_USE_SECHUB_STORAGE,"true"); - PDSWiremockTestSupport testSupport = PDSWiremockTestSupport.builder(wireMockRule). + TestPDSWiremockSupport testSupport = TestPDSWiremockSupport.builder(wireMockRule). simulateJobCanBeCreated(sechubJobUUID,productIdentifier,expectedJobParameters). //no simulate upload here! --> if an upload would be called, wiremock would fail, because no stubbing available simulateMarkReadyToStart(). @@ -195,7 +195,7 @@ public void messages_are_returned_to_adapter_result() throws Exception { messagesFromPDS.getSecHubMessages().add(new SecHubMessage(SecHubMessageType.INFO,"i am the info sent back by wiremock")); - PDSWiremockTestSupport testSupport = PDSWiremockTestSupport.builder(wireMockRule). + TestPDSWiremockSupport testSupport = TestPDSWiremockSupport.builder(wireMockRule). simulateJobCanBeCreated(sechubJobUUID,productIdentifier,expectedJobParameters). //no simulate upload here! simulateMarkReadyToStart(). @@ -218,7 +218,7 @@ public void messages_are_returned_to_adapter_result() throws Exception { } /* @formatter:off */ - private PDSAdapterConfig createCodeScanConfiguration(PDSWiremockTestSupport testSupport) { + private PDSAdapterConfig createCodeScanConfiguration(TestPDSWiremockSupport testSupport) { String baseURL = testSupport.getTestBaseUrl(); PDSCodeScanConfigBuilder builder = PDSCodeScanConfigImpl.builder(). setUser("testuser"). @@ -248,7 +248,7 @@ private PDSAdapterConfig createCodeScanConfiguration(PDSWiremockTestSupport test /* @formatter:on */ /* @formatter:off */ - private PDSAdapterConfig createCodeScanConfigurationWithBinary(PDSWiremockTestSupport testSupport) { + private PDSAdapterConfig createCodeScanConfigurationWithBinary(TestPDSWiremockSupport testSupport) { String baseURL = testSupport.getTestBaseUrl(); PDSCodeScanConfigBuilder builder = PDSCodeScanConfigImpl.builder(). setUser("testuser"). diff --git a/sechub-adapter-pds/src/test/java/com/mercedesbenz/sechub/adapter/pds/PDSTestSupport.java b/sechub-adapter-pds/src/test/java/com/mercedesbenz/sechub/adapter/pds/TestPDSSupport.java similarity index 97% rename from sechub-adapter-pds/src/test/java/com/mercedesbenz/sechub/adapter/pds/PDSTestSupport.java rename to sechub-adapter-pds/src/test/java/com/mercedesbenz/sechub/adapter/pds/TestPDSSupport.java index 1e91a9c3d8..eac65d49ab 100644 --- a/sechub-adapter-pds/src/test/java/com/mercedesbenz/sechub/adapter/pds/PDSTestSupport.java +++ b/sechub-adapter-pds/src/test/java/com/mercedesbenz/sechub/adapter/pds/TestPDSSupport.java @@ -7,7 +7,7 @@ import com.mercedesbenz.sechub.test.JSONTestUtil.DirectJSonable; -public class PDSTestSupport { +public class TestPDSSupport { public List toKeyValue(Map map) { List list = new ArrayList<>(); diff --git a/sechub-adapter-pds/src/test/java/com/mercedesbenz/sechub/adapter/pds/PDSWiremockTestSupport.java b/sechub-adapter-pds/src/test/java/com/mercedesbenz/sechub/adapter/pds/TestPDSWiremockSupport.java similarity index 95% rename from sechub-adapter-pds/src/test/java/com/mercedesbenz/sechub/adapter/pds/PDSWiremockTestSupport.java rename to sechub-adapter-pds/src/test/java/com/mercedesbenz/sechub/adapter/pds/TestPDSWiremockSupport.java index e9fa88b7e5..2897487c07 100644 --- a/sechub-adapter-pds/src/test/java/com/mercedesbenz/sechub/adapter/pds/PDSWiremockTestSupport.java +++ b/sechub-adapter-pds/src/test/java/com/mercedesbenz/sechub/adapter/pds/TestPDSWiremockSupport.java @@ -19,7 +19,7 @@ import com.mercedesbenz.sechub.test.TestVerifier; import com.mercedesbenz.sechub.test.WiremockUrlHistory; -public class PDSWiremockTestSupport { +public class TestPDSWiremockSupport { private boolean pdsJobCanBeCreated; private boolean pdsMarkReadyToStart; @@ -33,7 +33,7 @@ public class PDSWiremockTestSupport { public String pdsProductIdentifier; public Map pdsJobParameters; public SecHubMessagesList sechubMessageList; - private PDSTestSupport pdsTestSupport; + private TestPDSSupport testPDSSupport; private UUID pdsJobUUID; private List uploads = new ArrayList<>(); private List stateRequestsResults = new ArrayList<>(); @@ -41,11 +41,11 @@ public class PDSWiremockTestSupport { private TestVerifier testVerifier = new TestVerifier(); public boolean useSecHubStorage; - public PDSWiremockTestSupport(WireMockServer server) { + public TestPDSWiremockSupport(WireMockServer server) { this.server = server; this.history = new WiremockUrlHistory(); this.pdsURLBuilder = new PDSUrlBuilder(""); - this.pdsTestSupport = new PDSTestSupport(); + this.testPDSSupport = new TestPDSSupport(); } private static class UploadInfo { @@ -207,7 +207,7 @@ private void simulationJobCreation() throws Exception { map.put("sechubJobUUID", sechubJobUUID.toString()); map.put("productId", pdsProductIdentifier); - map.put("parameters", pdsTestSupport.toKeyValue(pdsJobParameters)); + map.put("parameters", testPDSSupport.toKeyValue(pdsJobParameters)); /* @formatter:off */ String requestBody = JSONTestUtil.toJSONContainingNullValues(map); @@ -226,10 +226,10 @@ private void simulationJobCreation() throws Exception { public static class PDSWiremockTestSupportBuilder { - private PDSWiremockTestSupport current; + private TestPDSWiremockSupport current; public PDSWiremockTestSupportBuilder(WireMockServer server) { - current = new PDSWiremockTestSupport(server); + current = new TestPDSWiremockSupport(server); } public PDSWiremockTestSupportBuilder simulateJobCanBeCreated(UUID sechubJobUUID, String pdsProductIdentifier, Map parameters) { @@ -287,10 +287,10 @@ public PDSWiremockTestSupportBuilder simulateFetchJobMessages(SecHubMessagesList return this; } - PDSWiremockTestSupport build() { + TestPDSWiremockSupport build() { - PDSWiremockTestSupport buildResult = current; - current = new PDSWiremockTestSupport(buildResult.server); + TestPDSWiremockSupport buildResult = current; + current = new TestPDSWiremockSupport(buildResult.server); return buildResult; } diff --git a/sechub-adapter/src/test/java/com/mercedesbenz/sechub/adapter/SecHubAdapterTestFileSupport.java b/sechub-adapter/src/test/java/com/mercedesbenz/sechub/adapter/SecHubAdapterTestFileSupport.java deleted file mode 100644 index 66d4db5fb6..0000000000 --- a/sechub-adapter/src/test/java/com/mercedesbenz/sechub/adapter/SecHubAdapterTestFileSupport.java +++ /dev/null @@ -1,13 +0,0 @@ -// SPDX-License-Identifier: MIT -package com.mercedesbenz.sechub.adapter; - -import com.mercedesbenz.sechub.test.TestFileSupport; - -public class SecHubAdapterTestFileSupport extends TestFileSupport { - - public static final SecHubAdapterTestFileSupport INSTANCE = new SecHubAdapterTestFileSupport(); - - protected SecHubAdapterTestFileSupport() { - super("sechub-adapter"); - } -} diff --git a/sechub-adapter/src/test/java/com/mercedesbenz/sechub/adapter/TestSecHubAdapterFileSupport.java b/sechub-adapter/src/test/java/com/mercedesbenz/sechub/adapter/TestSecHubAdapterFileSupport.java new file mode 100644 index 0000000000..8cb79dc02b --- /dev/null +++ b/sechub-adapter/src/test/java/com/mercedesbenz/sechub/adapter/TestSecHubAdapterFileSupport.java @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: MIT +package com.mercedesbenz.sechub.adapter; + +import com.mercedesbenz.sechub.test.TestFileSupport; + +public class TestSecHubAdapterFileSupport extends TestFileSupport { + + public static final TestSecHubAdapterFileSupport INSTANCE = new TestSecHubAdapterFileSupport(); + + protected TestSecHubAdapterFileSupport() { + super("sechub-adapter"); + } +} diff --git a/sechub-adapter/src/test/java/com/mercedesbenz/sechub/adapter/mock/MockedAdapterSetupServiceTest.java b/sechub-adapter/src/test/java/com/mercedesbenz/sechub/adapter/mock/MockedAdapterSetupServiceTest.java index 264e814b48..e14caf9b27 100644 --- a/sechub-adapter/src/test/java/com/mercedesbenz/sechub/adapter/mock/MockedAdapterSetupServiceTest.java +++ b/sechub-adapter/src/test/java/com/mercedesbenz/sechub/adapter/mock/MockedAdapterSetupServiceTest.java @@ -13,7 +13,7 @@ import com.mercedesbenz.sechub.adapter.AbstractAdapterConfig; import com.mercedesbenz.sechub.adapter.AdapterOptionKey; -import com.mercedesbenz.sechub.adapter.SecHubAdapterTestFileSupport; +import com.mercedesbenz.sechub.adapter.TestSecHubAdapterFileSupport; public class MockedAdapterSetupServiceTest { @@ -29,7 +29,7 @@ public void before() { @Test public void static_read_default_setup_possible_and_has_at_least_checkmarx_and_netsparker_data_for_ANY_OTHER_TARGET_inside() { /* prepare */ - File gradleSafeTestFile = SecHubAdapterTestFileSupport.INSTANCE.createFileFromResourcePath(MockedAdapterSetupService.DEFAULT_FILE_PATH); + File gradleSafeTestFile = TestSecHubAdapterFileSupport.INSTANCE.createFileFromResourcePath(MockedAdapterSetupService.DEFAULT_FILE_PATH); serviceToTest.filePath = gradleSafeTestFile.getAbsolutePath(); diff --git a/sechub-archunit-test/build.gradle b/sechub-archunit-test/build.gradle index 4b42b86c17..094a5955d6 100644 --- a/sechub-archunit-test/build.gradle +++ b/sechub-archunit-test/build.gradle @@ -6,15 +6,24 @@ * ============================================================================ */ -dependencies { - testImplementation library.springframework_web +// Ensure the ArchUnit module depends on all other modules +projectType.archUnitProjects.each { Project project -> + evaluationDependsOn(project.path) +} - for (project in projectType.archUnitProjects) { - testImplementation project +// Define a task dependency to ensure all tests are run before ArchUnit tests +tasks.named('test') { + projectType.archUnitProjects.each { Project project -> + dependsOn "${project.path}:test" } +} +dependencies { + testImplementation library.springframework_web testImplementation spring_boot_dependency.junit_jupiter testImplementation library.arch_unit } -// executing archunit tests: ./gradlew sechub-archunit-test:test + + +// executing archunit tests: ./gradlew sechub-archunit-test:test \ No newline at end of file diff --git a/sechub-archunit-test/src/test/java/mercedesbenz/com/sechub/archunit/ArchUnitImportOptions.java b/sechub-archunit-test/src/test/java/mercedesbenz/com/sechub/archunit/ArchUnitImportOptions.java index 7a7c37fcd2..2f365cee41 100644 --- a/sechub-archunit-test/src/test/java/mercedesbenz/com/sechub/archunit/ArchUnitImportOptions.java +++ b/sechub-archunit-test/src/test/java/mercedesbenz/com/sechub/archunit/ArchUnitImportOptions.java @@ -9,7 +9,10 @@ import com.tngtech.archunit.core.importer.ImportOption; public class ArchUnitImportOptions { - public static Path SECHUB_ROOT_PATH = resolveRoothPath(); + + public static final Path SECHUB_ROOT_PATH = resolveRoothPath(); + + private static final String SECHUB_PACKAGE_PREFIX = "com/mercedesbenz/sechub"; private static Path resolveRoothPath() { try { @@ -24,6 +27,28 @@ private static Path resolveRoothPath() { return !location.contains("/test/"); // ignore any URI to sources that contains '/test/' }; + static ImportOption ignoreAllMain = location -> { + return !location.contains("/main/"); // ignore any URI to sources that contains '/main/' + }; + + static ImportOption ignoreNonSecHubPackages = location -> { + boolean accepted = location.contains(SECHUB_PACKAGE_PREFIX); // ignore any URI to sources that does not remain in the sechub package' + + // Next follows a workaround for an existing build situation + // where we had in build folders a pseudo src folder which contained + // packages like "src.test.java.com.mercedesbenz.sechub.*" + // It is unclear why exactly this happens (maybe because of an eclipse build) + // but we exclude this here which is always correct: + accepted = accepted && !location.contains("src/test/java/" + SECHUB_PACKAGE_PREFIX); + accepted = accepted && !location.contains("src/main/java/" + SECHUB_PACKAGE_PREFIX); + + return accepted; + }; + + static ImportOption ignoreArchUnit = location -> { + return !location.contains("/archunit/"); // ignore any URI to sources that contains '/archunit/' + }; + static List ignoreFolders = new ArchUnitRuntimeSupport().createImportOptionsIgnoreFolder(); // ignore specific folders e.g. build folders static ImportOption ignoreSechubOpenAPIJava = location -> { diff --git a/sechub-archunit-test/src/test/java/mercedesbenz/com/sechub/archunit/ArchUnitRuntimeSupport.java b/sechub-archunit-test/src/test/java/mercedesbenz/com/sechub/archunit/ArchUnitRuntimeSupport.java index b10a490915..0a99f0d5b1 100644 --- a/sechub-archunit-test/src/test/java/mercedesbenz/com/sechub/archunit/ArchUnitRuntimeSupport.java +++ b/sechub-archunit-test/src/test/java/mercedesbenz/com/sechub/archunit/ArchUnitRuntimeSupport.java @@ -7,18 +7,36 @@ class ArchUnitRuntimeSupport { - public List createImportOptionsIgnoreFolder() { - List importOptions = new ArrayList<>(); + static String DEFAULT_IGNORED_FOLDERS = "bin,out"; + + static final String SECHUB_ARCHUNIT_IGNORE_FOLDERS = "sechub.archunit.ignoreFolders"; - // comma seperated list of folders to ignore e.g. build folders from different - // builds - String folderToIgnore = System.getProperty("sechub.archunit.ignoreFolders"); - if (folderToIgnore == null || folderToIgnore.isBlank()) { - return importOptions; + private static String foldersToIgnore; + + static { + String sechubArchUnitIgnoreFolders = System.getProperty(SECHUB_ARCHUNIT_IGNORE_FOLDERS); + if (sechubArchUnitIgnoreFolders == null || sechubArchUnitIgnoreFolders.isBlank()) { + System.setProperty(SECHUB_ARCHUNIT_IGNORE_FOLDERS, DEFAULT_IGNORED_FOLDERS); + sechubArchUnitIgnoreFolders = DEFAULT_IGNORED_FOLDERS; } + sechubArchUnitIgnoreFolders = sechubArchUnitIgnoreFolders.trim(); + + foldersToIgnore = sechubArchUnitIgnoreFolders; + } + + /** + * @return comma separated list of folders to ignore e.g. build folders when + * having different build systems (e.g. eclipse build and gradle build + * together) + */ + static String getFoldersToIgnore() { + return foldersToIgnore; + } + + public List createImportOptionsIgnoreFolder() { + List importOptions = new ArrayList<>(); - folderToIgnore = folderToIgnore.trim(); - String[] folders = folderToIgnore.split(","); + String[] folders = getFoldersToIgnore().split(","); for (String folder : folders) { importOptions.add(location -> !location.contains(folder)); } diff --git a/sechub-archunit-test/src/test/java/mercedesbenz/com/sechub/archunit/ArchUnitTestMessageExtension.java b/sechub-archunit-test/src/test/java/mercedesbenz/com/sechub/archunit/ArchUnitTestMessageExtension.java new file mode 100644 index 0000000000..089e8ef0f7 --- /dev/null +++ b/sechub-archunit-test/src/test/java/mercedesbenz/com/sechub/archunit/ArchUnitTestMessageExtension.java @@ -0,0 +1,99 @@ +package mercedesbenz.com.sechub.archunit; + +import static mercedesbenz.com.sechub.archunit.ArchUnitRuntimeSupport.SECHUB_ARCHUNIT_IGNORE_FOLDERS; + +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + +import org.junit.jupiter.api.extension.AfterAllCallback; +import org.junit.jupiter.api.extension.AfterEachCallback; +import org.junit.jupiter.api.extension.ExtensionContext; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class ArchUnitTestMessageExtension implements AfterEachCallback, AfterAllCallback { + + private List failedTests = new ArrayList<>(); + + private static final Logger LOG = LoggerFactory.getLogger(ArchUnitTestMessageExtension.class); + + static { + /* + * we always inform per INFO log entry, what folders are ignored at arch unit + * execution + */ + String folderToIgnore = System.getProperty(SECHUB_ARCHUNIT_IGNORE_FOLDERS); + LOG.info("Arch unit tests running with {}={}", SECHUB_ARCHUNIT_IGNORE_FOLDERS, folderToIgnore); + } + + private final String ARCHUNIT_SUPPORT_MESSAGE = """ + ################################################################################################### + ArchUnit Test '%s' + has failing tests: + %s + ################################################################################################### + + Please check if you violated the defined rules in your implementation. + If not: clean and rebuild, as archunit works on the build. + For duplicated class output files you can use the system property + '-D%s=${unwantedFolders}' to ignore specific folders. + ${unwantedFolders} can be a comma separated list or a single entry. + + If the system property is blank or not defined, the default value is '%s' + which ignores Eclipse and IntelliJ native build outputs. This setup + is always used in gradle builds so it is possible to use + IDE native builds and gradle builds together without conflicts. + + If you want to run arch unit tests on your native IDE build outputs, you have + to exclude the gradle build output via: -D%s=build + + Remark: your current setup is: -D%s=%s + + """; + + @Override + public void afterEach(ExtensionContext context) { + if (context.getExecutionException().isPresent()) { + Optional method = context.getTestMethod(); + if (method.isPresent()) { + failedTests.add(method.get().getName()); + } else { + failedTests.add("Unknown method"); + } + } + } + + @Override + public void afterAll(ExtensionContext context) { + + if (!failedTests.isEmpty()) { + + StringBuilder failedTestSb = new StringBuilder(); + for (String failedTest : failedTests) { + failedTestSb.append("- '"); + failedTestSb.append(failedTest); + failedTestSb.append("'\n"); + } + + String testClassName = context.getTestClass().orElse(Class.class).getName(); + + System.out.printf(ARCHUNIT_SUPPORT_MESSAGE, + + testClassName, + + failedTestSb.toString(), + + SECHUB_ARCHUNIT_IGNORE_FOLDERS, + + ArchUnitRuntimeSupport.DEFAULT_IGNORED_FOLDERS, + + SECHUB_ARCHUNIT_IGNORE_FOLDERS, + + SECHUB_ARCHUNIT_IGNORE_FOLDERS, + + ArchUnitRuntimeSupport.getFoldersToIgnore()); + } + } +} diff --git a/sechub-archunit-test/src/test/java/mercedesbenz/com/sechub/archunit/CodingRulesTest.java b/sechub-archunit-test/src/test/java/mercedesbenz/com/sechub/archunit/CodingRulesTest.java index 4e02386977..6d46556af4 100644 --- a/sechub-archunit-test/src/test/java/mercedesbenz/com/sechub/archunit/CodingRulesTest.java +++ b/sechub-archunit-test/src/test/java/mercedesbenz/com/sechub/archunit/CodingRulesTest.java @@ -8,6 +8,7 @@ import static mercedesbenz.com.sechub.archunit.ArchUnitImportOptions.*; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import com.tngtech.archunit.core.domain.JavaAccess; import com.tngtech.archunit.core.domain.JavaClasses; @@ -15,6 +16,7 @@ import com.tngtech.archunit.junit.AnalyzeClasses; @AnalyzeClasses +@ExtendWith(ArchUnitTestMessageExtension.class) public class CodingRulesTest { @Test @@ -47,6 +49,7 @@ void classes_should_not_use_deprecated_members() { .withImportOption(ignoreSystemTest) .withImportOption(ignoreGenApi) .withImportOption(ignoreJarFiles) + .withImportOption(ignoreNonSecHubPackages) .importPath(SECHUB_ROOT_PATH); /* execute + test */ @@ -57,7 +60,7 @@ void classes_should_not_use_deprecated_members() { // Following lines were out-commented because of JsonSerialize annotation uses deprecated default implementation // .orShould(dependOnClassesThat(annotatedWith(Deprecated.class)) // .as("depend on @Deprecated classes")) - .because("there should be a better alternative") + .because("there should be a better alternative! ") .check(importedClasses); /* @formatter:on */ } @@ -85,6 +88,7 @@ void test_classes_should_be_in_the_same_package_as_implementation() { .withImportOption(ignoreSystemTest) .withImportOption(ignoreGenApi) .withImportOption(ignoreJarFiles) + .withImportOption(ignoreNonSecHubPackages) .importPath(SECHUB_ROOT_PATH); /* execute + test */ @@ -118,6 +122,7 @@ void classes_should_not_use_standard_streams() { .withImportOption(ignoreExamples) .withImportOption(ignoreGenApi) .withImportOption(ignoreJarFiles) + .withImportOption(ignoreNonSecHubPackages) .importPath(SECHUB_ROOT_PATH); /* execute + test */ @@ -140,6 +145,7 @@ private JavaClasses ignoreTestGeneratedAndDeprecatedPackages() { .withImportOption(ignoreDevelopertools) .withImportOption(ignoreGenApi) .withImportOption(ignoreJarFiles) + .withImportOption(ignoreNonSecHubPackages) .importPath(SECHUB_ROOT_PATH); /* @formatter:on */ } diff --git a/sechub-archunit-test/src/test/java/mercedesbenz/com/sechub/archunit/DomainAccessRulesTest.java b/sechub-archunit-test/src/test/java/mercedesbenz/com/sechub/archunit/DomainAccessRulesTest.java index 291bb06f21..bb90a5490a 100644 --- a/sechub-archunit-test/src/test/java/mercedesbenz/com/sechub/archunit/DomainAccessRulesTest.java +++ b/sechub-archunit-test/src/test/java/mercedesbenz/com/sechub/archunit/DomainAccessRulesTest.java @@ -9,6 +9,7 @@ import java.util.List; import java.util.stream.Stream; +import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; @@ -20,6 +21,7 @@ import com.tngtech.archunit.junit.AnalyzeClasses; @AnalyzeClasses +@ExtendWith(ArchUnitTestMessageExtension.class) public class DomainAccessRulesTest { private static final String DOMAIN_SCAN = "com.mercedesbenz.sechub.domain.scan"; @@ -50,6 +52,7 @@ void no_class_in_one_domain_communicate_with_another_domain(String domainToTest) .withImportOptions(ignoreFolders) .withImportOption(ignoreDevelopertools) .withImportOption(ignoreJarFiles) + .withImportOption(ignoreNonSecHubPackages) .importPath(SECHUB_ROOT_PATH); /* execute + test */ diff --git a/sechub-archunit-test/src/test/java/mercedesbenz/com/sechub/archunit/NamingConventionTest.java b/sechub-archunit-test/src/test/java/mercedesbenz/com/sechub/archunit/NamingConventionTest.java index 99d254ded1..a2fb0a2f61 100644 --- a/sechub-archunit-test/src/test/java/mercedesbenz/com/sechub/archunit/NamingConventionTest.java +++ b/sechub-archunit-test/src/test/java/mercedesbenz/com/sechub/archunit/NamingConventionTest.java @@ -5,43 +5,93 @@ import static mercedesbenz.com.sechub.archunit.ArchUnitImportOptions.*; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.junit.jupiter.params.ParameterizedTest; import org.springframework.stereotype.Service; +import com.tngtech.archunit.core.domain.JavaClass; import com.tngtech.archunit.core.domain.JavaClasses; import com.tngtech.archunit.core.importer.ClassFileImporter; import com.tngtech.archunit.junit.AnalyzeClasses; +import com.tngtech.archunit.lang.ArchCondition; import com.tngtech.archunit.lang.ArchRule; +import com.tngtech.archunit.lang.ConditionEvents; +import com.tngtech.archunit.lang.SimpleConditionEvent; import com.tngtech.archunit.lang.syntax.ArchRuleDefinition; @AnalyzeClasses +@ExtendWith(ArchUnitTestMessageExtension.class) public class NamingConventionTest { @Test - void classes_in_test_packages_containing_test_or_assert_in_name() { + void classes_in_test_packages_start_with_test_or_assert_or_end_with_test() { /* prepare */ /* @formatter:off */ JavaClasses importedClasses = new ClassFileImporter() .withImportOptions(ignoreFolders) + .withImportOption(ignoreAllMain) + .withImportOption(ignoreArchUnit) + .withImportOption(ignoreDocGen) .withImportOption(ignoreSechubOpenAPIJava) .withImportOption(ignoreSechubTestframework) .withImportOption(ignoreSharedkernelTest) .withImportOption(ignoreSechubApiJava) .withImportOption(ignoreJarFiles) + .withImportOption(ignoreNonSecHubPackages) .importPath(SECHUB_ROOT_PATH); /* execute + test */ + // workaround for resideInAnyPackage not working, using ignoreFolders (ignore main) instead ArchRule rule = ArchRuleDefinition.classes() - .that() - .resideInAPackage("..test..") .should() - .haveSimpleNameContaining("Test") + .haveSimpleNameEndingWith("Test") .orShould() - .haveSimpleNameContaining("Assert") + .haveSimpleNameStartingWith("Test") .orShould() - .haveNameMatching(".*\\.Assert.*") // including inner classes + .haveSimpleNameStartingWith("Assert") .orShould() - .haveNameMatching(".*Test\\$.*") // including inner classes - .because("Tests classes should contain 'Test' or 'Assert' in their name."); + .haveNameMatching(".*\\$.*") // ignoring inner classes + .because("Tests classes should start or end with 'Test' or start with 'Assert'"); + + rule.check(importedClasses); + /* @formatter:on */ + } + + @Test + void test_classes_with_test_annotations_should_end_with_test() { + /* prepare */ + /* @formatter:off */ + JavaClasses importedClasses = new ClassFileImporter() + .withImportOptions(ignoreFolders) + .withImportOption(ignoreAllMain) + .withImportOption(ignoreArchUnit) + .withImportOption(ignoreDocGen) + .withImportOption(ignoreSechubOpenAPIJava) + .withImportOption(ignoreSechubTestframework) + .withImportOption(ignoreSharedkernelTest) + .withImportOption(ignoreSechubApiJava) + .withImportOption(ignoreJarFiles) + .withImportOption(ignoreNonSecHubPackages) + .importPath(SECHUB_ROOT_PATH); + + /* execute + test */ + // workaround for resideInAnyPackage not working, using ignoreFolders (ignore main) instead + ArchCondition testMethodsClassNameCondition = new ArchCondition("should end with 'Test' when containing test methods annotations") { + @Override + public void check(JavaClass javaClass, ConditionEvents events) { + boolean hasTestMethodAnnotation = javaClass.getMethods().stream() + .anyMatch(method -> method.isAnnotatedWith(Test.class) + || method.isAnnotatedWith(ParameterizedTest.class)); + if (hasTestMethodAnnotation) { + boolean endsWithTest = javaClass.getSimpleName().endsWith("Test"); + String message = String.format("Class %s has test methods but does not end with 'Test'", javaClass.getFullName()); + events.add(new SimpleConditionEvent(javaClass, endsWithTest, message)); + } + } + }; + + ArchRule rule = classes() + .should(testMethodsClassNameCondition); rule.check(importedClasses); /* @formatter:on */ @@ -56,6 +106,7 @@ void service_annotated_classes_contain_service_or_executor_in_name() { .withImportOption(ignoreAllTests) .withImportOption(ignoreSechubOpenAPIJava) .withImportOption(ignoreJarFiles) + .withImportOption(ignoreNonSecHubPackages) .importPath(SECHUB_ROOT_PATH); /* execute + test */ @@ -66,7 +117,7 @@ void service_annotated_classes_contain_service_or_executor_in_name() { .haveSimpleNameContaining("Service") .orShould() .haveSimpleNameContaining("Executor") - .because("Service classes should contain 'Service' or 'Executor' in their name.") + .because("Service classes should contain 'Service' or 'Executor' in their name. ") .check(importedClasses); /* @formatter:on */ } diff --git a/sechub-commons-core/build.gradle b/sechub-commons-core/build.gradle index c3a3d14c85..2f5932b58d 100644 --- a/sechub-commons-core/build.gradle +++ b/sechub-commons-core/build.gradle @@ -5,5 +5,6 @@ dependencies { testImplementation spring_boot_dependency.junit_jupiter testImplementation spring_boot_dependency.mockito_core + testImplementation spring_boot_dependency.assertj_core } diff --git a/sechub-commons-core/src/test/java/com/mercedesbenz/sechub/commons/core/resilience/ResilientActionExecutorTest.java b/sechub-commons-core/src/test/java/com/mercedesbenz/sechub/commons/core/resilience/ResilientActionExecutorTest.java index f31a33ed64..aa8caa46c2 100644 --- a/sechub-commons-core/src/test/java/com/mercedesbenz/sechub/commons/core/resilience/ResilientActionExecutorTest.java +++ b/sechub-commons-core/src/test/java/com/mercedesbenz/sechub/commons/core/resilience/ResilientActionExecutorTest.java @@ -1,7 +1,8 @@ // SPDX-License-Identifier: MIT package com.mercedesbenz.sechub.commons.core.resilience; -import static org.junit.jupiter.api.Assertions.*; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.mockito.ArgumentMatchers.*; import static org.mockito.Mockito.*; @@ -52,7 +53,7 @@ void fall_through_200_ms__inside_time_frame_same_exception_will_be_returned_afte failing = false; } catch (IllegalArgumentException e) { - assertEquals("first-to-reuse", e.getMessage()); + assertThat(e.getMessage()).isEqualTo("first-to-reuse"); } } @@ -60,11 +61,12 @@ void fall_through_200_ms__inside_time_frame_same_exception_will_be_returned_afte long timeEnd = System.currentTimeMillis(); long timeElapsed = timeEnd - timeStart; - assertTrue(counter > 5, "Must have at least 5 times called action, but was only " + counter); - assertTrue(timeElapsed >= millisToFallThrough, "Time elapsed:" + timeElapsed + " millis"); - assertNotNull(result); - assertEquals("OK", result.text); + assertThat(counter).withFailMessage("Must have at least 5 times called action, but was only %d", counter).isGreaterThan(5); + assertThat(timeElapsed).withFailMessage("Time elapsed: %d millis", timeElapsed).isGreaterThanOrEqualTo(millisToFallThrough); + + assertThat(result).isNotNull(); + assertThat(result.text).isEqualTo("OK"); } @Test @@ -73,8 +75,7 @@ void no_error_no_consultant_defined_just_runs_through_and_returns_result() throw TestResult result = executorToTest.executeResilient(action); /* test */ - assertNotNull(result); - + assertThat(result).isNotNull(); } @Test @@ -87,7 +88,7 @@ void no_error_but_consultant_defined_just_runs_through_and_returns_result_consul TestResult result = executorToTest.executeResilient(action); /* test */ - assertNotNull(result); + assertThat(result).isNotNull(); verify(resilienceConsultant, never()).consultFor(any(ResilienceContext.class)); } @@ -113,8 +114,8 @@ void retry_3_times_allowed__we_throw_errors_which_forces_a_retry_the_callback_is TestResult result = executorToTest.executeResilient(action, callback); /* test */ - assertNotNull(result); - assertEquals(4, result.timesActionHasBeenExecuted); + assertThat(result).isNotNull(); + assertThat(result.timesActionHasBeenExecuted).isEqualTo(4); verify(callback, times(3)).beforeRetry(any()); } @@ -138,8 +139,8 @@ void retry_3_times_allowed__we_got_an_error_which_forces_a_retry_the_callback_is TestResult result = executorToTest.executeResilient(action, callback); /* test */ - assertNotNull(result); - assertEquals(2, result.timesActionHasBeenExecuted); + assertThat(result).isNotNull(); + assertThat(result.timesActionHasBeenExecuted).isEqualTo(2); verify(callback, times(1)).beforeRetry(any()); } @@ -163,9 +164,9 @@ void retry_2_times_allowed__we_got_an_error_which_forces_a_retry_we_got_the_resu TestResult result = executorToTest.executeResilient(action); /* test */ - assertNotNull(result); - assertEquals(2, result.timesActionHasBeenExecuted); - assertEquals("OK", result.text); + assertThat(result).isNotNull(); + assertThat(result.timesActionHasBeenExecuted).isEqualTo(2); + assertThat(result.text).isEqualTo("OK"); /* check also that the consultant was inspected one time */ verify(resilienceConsultant, times(1)).consultFor(any(ResilienceContext.class)); @@ -192,9 +193,9 @@ void retry_2_times_allowed__we_got_two_errors_which_forces_2_retries_we_got_the_ TestResult result = executorToTest.executeResilient(action); /* test */ - assertNotNull(result); - assertEquals(3, result.timesActionHasBeenExecuted); - assertEquals("OK", result.text); + assertThat(result).isNotNull(); + assertThat(result.timesActionHasBeenExecuted).isEqualTo(3); + assertThat(result.text).isEqualTo("OK"); verify(resilienceConsultant, times(2)).consultFor(any(ResilienceContext.class)); @@ -218,15 +219,10 @@ void retry_2_times_allowed__we_got_3_errors_which_forces_2_retries_and_we_got_th executorToTest.add(resilienceConsultant); /* execute */ - try { - executorToTest.executeResilient(action); - fail("no exception!"); - } catch (IllegalArgumentException e) { - assertEquals("third", e.getMessage()); - } + assertThatThrownBy(() -> executorToTest.executeResilient(action)).isInstanceOf(IllegalArgumentException.class).hasMessage("third"); /* test */ - assertEquals(3, action.result.timesActionHasBeenExecuted); + assertThat(action.result.timesActionHasBeenExecuted).isEqualTo(3); /* * check also that the consultant was inspected 3 times - we always ask the * consultants in case of errors, make because of an exception information the @@ -242,8 +238,8 @@ void containsConsultatant_differs_correctly() { executorToTest.add(new TestConsultant()); /* test */ - assertTrue(executorToTest.containsConsultant(TestConsultant.class)); - assertFalse(executorToTest.containsConsultant(TestConsultant2.class)); + assertThat(executorToTest.containsConsultant(TestConsultant.class)).isTrue(); + assertThat(executorToTest.containsConsultant(TestConsultant2.class)).isFalse(); } private class TestAction implements ResilientAction { diff --git a/sechub-commons-core/src/test/java/com/mercedesbenz/sechub/commons/core/resilience/ResilientRunnableExecutorTest.java b/sechub-commons-core/src/test/java/com/mercedesbenz/sechub/commons/core/resilience/ResilientRunnableExecutorTest.java index 87b43fdfbc..e5eccc646d 100644 --- a/sechub-commons-core/src/test/java/com/mercedesbenz/sechub/commons/core/resilience/ResilientRunnableExecutorTest.java +++ b/sechub-commons-core/src/test/java/com/mercedesbenz/sechub/commons/core/resilience/ResilientRunnableExecutorTest.java @@ -1,7 +1,8 @@ // SPDX-License-Identifier: MIT package com.mercedesbenz.sechub.commons.core.resilience; -import static org.junit.jupiter.api.Assertions.*; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; import java.io.IOException; import java.util.concurrent.atomic.AtomicInteger; @@ -24,13 +25,13 @@ void one_retry_defined_but_no_execution_happens() throws Exception { executorToTest.add(new AlwaysRetry1TimeWith10MillisecondsTestConsultant()); final AtomicInteger integer = new AtomicInteger(); - assertEquals(0, integer.intValue()); + assertThat(integer.intValue()).isEqualTo(0); /* execute */ executorToTest.executeResilient(() -> integer.incrementAndGet()); /* test */ - assertEquals(1, integer.intValue()); // execution was done + assertThat(integer.intValue()).isEqualTo(1); // execution was done } @Test @@ -38,13 +39,13 @@ void one_retry_defined__exception_on_first_run_but_not_on_seconds_try() throws E /* prepare */ executorToTest.add(new AlwaysRetry1TimeWith10MillisecondsTestConsultant()); - FailDefinedTimes failDefinedTimes = new FailDefinedTimes(1); + TestFailDefinedTimes testFailDefinedTimes = new TestFailDefinedTimes(1); /* execute */ - executorToTest.executeResilient(failDefinedTimes); + executorToTest.executeResilient(testFailDefinedTimes); /* test */ - assertEquals(2, failDefinedTimes.runs); + assertThat(testFailDefinedTimes.runs).isEqualTo(2); } @Test @@ -52,13 +53,12 @@ void one_retry_defined__exception_on_first_and_second_run_will_fail_with_excepti /* prepare */ executorToTest.add(new AlwaysRetry1TimeWith10MillisecondsTestConsultant()); - FailDefinedTimes failDefinedTimes = new FailDefinedTimes(2); + TestFailDefinedTimes testFailDefinedTimes = new TestFailDefinedTimes(2); /* execute */ - assertThrows(IOException.class, () -> executorToTest.executeResilient(failDefinedTimes)); - + assertThatThrownBy(() -> executorToTest.executeResilient(testFailDefinedTimes)).isInstanceOf(IOException.class); /* test */ - assertEquals(2, failDefinedTimes.runs); + assertThat(testFailDefinedTimes.runs).isEqualTo(2); } private class AlwaysRetry1TimeWith10MillisecondsTestConsultant implements ResilienceConsultant { diff --git a/sechub-commons-core/src/test/java/com/mercedesbenz/sechub/commons/core/resilience/FailDefinedTimes.java b/sechub-commons-core/src/test/java/com/mercedesbenz/sechub/commons/core/resilience/TestFailDefinedTimes.java similarity index 86% rename from sechub-commons-core/src/test/java/com/mercedesbenz/sechub/commons/core/resilience/FailDefinedTimes.java rename to sechub-commons-core/src/test/java/com/mercedesbenz/sechub/commons/core/resilience/TestFailDefinedTimes.java index 67839a0cd9..e4933cfbbf 100644 --- a/sechub-commons-core/src/test/java/com/mercedesbenz/sechub/commons/core/resilience/FailDefinedTimes.java +++ b/sechub-commons-core/src/test/java/com/mercedesbenz/sechub/commons/core/resilience/TestFailDefinedTimes.java @@ -5,11 +5,11 @@ import com.mercedesbenz.sechub.commons.core.RunOrFail; -class FailDefinedTimes implements RunOrFail { +class TestFailDefinedTimes implements RunOrFail { private int wantedFailTimes; int runs; - FailDefinedTimes(int wantedFails) { + TestFailDefinedTimes(int wantedFails) { this.wantedFailTimes = wantedFails; } diff --git a/sechub-commons-model/src/test/java/com/mercedesbenz/sechub/commons/model/JSONConverterTest.java b/sechub-commons-model/src/test/java/com/mercedesbenz/sechub/commons/model/JSONConverterTest.java index deacd66e06..a03bbe5308 100644 --- a/sechub-commons-model/src/test/java/com/mercedesbenz/sechub/commons/model/JSONConverterTest.java +++ b/sechub-commons-model/src/test/java/com/mercedesbenz/sechub/commons/model/JSONConverterTest.java @@ -260,7 +260,7 @@ void toJson_local_date_in_expected_format() { @Test void toJSON_list_with_two_test_object_returns_expected_json_string() throws Exception { assertEquals("[{\"info\":\"test1\"},{\"info\":\"test2\"}]", - converterToTest.toJSON(Arrays.asList(new JSONConverterTestObject("test1"), new JSONConverterTestObject("test2")))); + converterToTest.toJSON(Arrays.asList(new TestJSONConverterObject("test1"), new TestJSONConverterObject("test2")))); } @Test @@ -269,15 +269,15 @@ void fromJSON_list_correct_json_with_array_containing_two_test_objects_results_i String json = "[{\"info\":\"test1\"},{\"info\":\"test2\"}]"; /* execute */ - List result = converterToTest.fromJSONtoListOf(JSONConverterTestObject.class, json); + List result = converterToTest.fromJSONtoListOf(TestJSONConverterObject.class, json); /* test */ assertNotNull(result); assertEquals(2, result.size()); - Iterator it = result.iterator(); - JSONConverterTestObject obj1 = it.next(); - JSONConverterTestObject obj2 = it.next(); + Iterator it = result.iterator(); + TestJSONConverterObject obj1 = it.next(); + TestJSONConverterObject obj2 = it.next(); assertEquals("test1", obj1.getInfo()); assertEquals("test2", obj2.getInfo()); @@ -285,7 +285,7 @@ void fromJSON_list_correct_json_with_array_containing_two_test_objects_results_i @Test void toJSON_test_object_returns_expected_json_string() throws Exception { - assertEquals("{\"info\":\"test1\"}", converterToTest.toJSON(new JSONConverterTestObject("test1"))); + assertEquals("{\"info\":\"test1\"}", converterToTest.toJSON(new TestJSONConverterObject("test1"))); } @Test @@ -293,7 +293,7 @@ void fromJSON_correct_json_with_double_quotes_results_in_expected_object() throw /* prepare */ String json = "{\"info\":\"test1\"}"; /* execute */ - JSONConverterTestObject result = converterToTest.fromJSON(JSONConverterTestObject.class, json); + TestJSONConverterObject result = converterToTest.fromJSON(TestJSONConverterObject.class, json); /* test */ assertEquals("test1", result.getInfo()); } @@ -303,7 +303,7 @@ void fromJSON_correct_json_with_single_quotes_results_in_expected_object() throw /* prepare */ String json = "{'info':'info1'}"; /* execute */ - JSONConverterTestObject result = converterToTest.fromJSON(JSONConverterTestObject.class, json); + TestJSONConverterObject result = converterToTest.fromJSON(TestJSONConverterObject.class, json); /* test */ assertNotNull(result); @@ -312,7 +312,7 @@ void fromJSON_correct_json_with_single_quotes_results_in_expected_object() throw @Test void fromJSON_when_string_null_throws_JSONConverterException() throws Exception { - assertThrows(JSONConverterException.class, () -> converterToTest.fromJSON(JSONConverterTestObject.class, null)); + assertThrows(JSONConverterException.class, () -> converterToTest.fromJSON(TestJSONConverterObject.class, null)); } @Test @@ -320,7 +320,7 @@ void fromJSON_comments_are_allowed() throws Exception { /* prepare */ String json = "//just a comment\\\n{\n//comments are a nice thing. \n/*not standard but used in *wildness* so we provide it*/\n'info':'info1'}"; /* execute */ - JSONConverterTestObject result = converterToTest.fromJSON(JSONConverterTestObject.class, json); + TestJSONConverterObject result = converterToTest.fromJSON(TestJSONConverterObject.class, json); /* test */ assertNotNull(result); diff --git a/sechub-commons-model/src/test/java/com/mercedesbenz/sechub/commons/model/JSONConverterTestObject.java b/sechub-commons-model/src/test/java/com/mercedesbenz/sechub/commons/model/TestJSONConverterObject.java similarity index 70% rename from sechub-commons-model/src/test/java/com/mercedesbenz/sechub/commons/model/JSONConverterTestObject.java rename to sechub-commons-model/src/test/java/com/mercedesbenz/sechub/commons/model/TestJSONConverterObject.java index 25be3ceb5d..c488b64059 100644 --- a/sechub-commons-model/src/test/java/com/mercedesbenz/sechub/commons/model/JSONConverterTestObject.java +++ b/sechub-commons-model/src/test/java/com/mercedesbenz/sechub/commons/model/TestJSONConverterObject.java @@ -1,14 +1,14 @@ // SPDX-License-Identifier: MIT package com.mercedesbenz.sechub.commons.model; -public class JSONConverterTestObject { +public class TestJSONConverterObject { String info; - JSONConverterTestObject() { + TestJSONConverterObject() { } - JSONConverterTestObject(String info) { + TestJSONConverterObject(String info) { this.info = info; } diff --git a/sechub-developertools/src/test/java/com/mercedesbenz/sechub/developertools/DeveloperToolsTestFileSupport.java b/sechub-developertools/src/test/java/com/mercedesbenz/sechub/developertools/DeveloperToolsTestFileSupport.java deleted file mode 100644 index 03c3176a6a..0000000000 --- a/sechub-developertools/src/test/java/com/mercedesbenz/sechub/developertools/DeveloperToolsTestFileSupport.java +++ /dev/null @@ -1,17 +0,0 @@ -// SPDX-License-Identifier: MIT -package com.mercedesbenz.sechub.developertools; - -import com.mercedesbenz.sechub.test.TestFileSupport; - -public class DeveloperToolsTestFileSupport extends TestFileSupport { - private static final DeveloperToolsTestFileSupport TESTFILE_SUPPORT = new DeveloperToolsTestFileSupport(); - - public static DeveloperToolsTestFileSupport getTestfileSupport() { - return TESTFILE_SUPPORT; - } - - protected DeveloperToolsTestFileSupport() { - super("sechub-developertools/src/test/resources"); - } - -} diff --git a/sechub-developertools/src/test/java/com/mercedesbenz/sechub/developertools/TestDeveloperToolsFileSupport.java b/sechub-developertools/src/test/java/com/mercedesbenz/sechub/developertools/TestDeveloperToolsFileSupport.java new file mode 100644 index 0000000000..a99765eb35 --- /dev/null +++ b/sechub-developertools/src/test/java/com/mercedesbenz/sechub/developertools/TestDeveloperToolsFileSupport.java @@ -0,0 +1,17 @@ +// SPDX-License-Identifier: MIT +package com.mercedesbenz.sechub.developertools; + +import com.mercedesbenz.sechub.test.TestFileSupport; + +public class TestDeveloperToolsFileSupport extends TestFileSupport { + private static final TestDeveloperToolsFileSupport TESTFILE_SUPPORT = new TestDeveloperToolsFileSupport(); + + public static TestDeveloperToolsFileSupport getTestfileSupport() { + return TESTFILE_SUPPORT; + } + + protected TestDeveloperToolsFileSupport() { + super("sechub-developertools/src/test/resources"); + } + +} diff --git a/sechub-developertools/src/test/java/com/mercedesbenz/sechub/developertools/admin/importer/AssignUserToProjectMassCSVImporterTest.java b/sechub-developertools/src/test/java/com/mercedesbenz/sechub/developertools/admin/importer/AssignUserToProjectMassCSVImporterTest.java index cae5f19407..3da9899dd7 100644 --- a/sechub-developertools/src/test/java/com/mercedesbenz/sechub/developertools/admin/importer/AssignUserToProjectMassCSVImporterTest.java +++ b/sechub-developertools/src/test/java/com/mercedesbenz/sechub/developertools/admin/importer/AssignUserToProjectMassCSVImporterTest.java @@ -10,7 +10,7 @@ import org.junit.Test; import org.junit.rules.ExpectedException; -import com.mercedesbenz.sechub.developertools.DeveloperToolsTestFileSupport; +import com.mercedesbenz.sechub.developertools.TestDeveloperToolsFileSupport; import com.mercedesbenz.sechub.developertools.admin.DeveloperAdministration; import com.mercedesbenz.sechub.test.junit4.ExpectedExceptionFactory; @@ -32,7 +32,7 @@ public void before() { @Test public void example_3_user2projects_can_be_imported() throws Exception { /* prepare */ - File file = DeveloperToolsTestFileSupport.getTestfileSupport() + File file = TestDeveloperToolsFileSupport.getTestfileSupport() .createFileFromResourcePath("csv/example3-developer-admin-ui_mass-import_user2projects.csv"); /* execute */ diff --git a/sechub-developertools/src/test/java/com/mercedesbenz/sechub/developertools/admin/importer/CreateProjectMassCSVImporterTest.java b/sechub-developertools/src/test/java/com/mercedesbenz/sechub/developertools/admin/importer/CreateProjectMassCSVImporterTest.java index 21572c3e52..57cb3cd786 100644 --- a/sechub-developertools/src/test/java/com/mercedesbenz/sechub/developertools/admin/importer/CreateProjectMassCSVImporterTest.java +++ b/sechub-developertools/src/test/java/com/mercedesbenz/sechub/developertools/admin/importer/CreateProjectMassCSVImporterTest.java @@ -12,7 +12,7 @@ import org.junit.Test; import org.junit.rules.ExpectedException; -import com.mercedesbenz.sechub.developertools.DeveloperToolsTestFileSupport; +import com.mercedesbenz.sechub.developertools.TestDeveloperToolsFileSupport; import com.mercedesbenz.sechub.developertools.admin.DeveloperAdministration; import com.mercedesbenz.sechub.developertools.admin.ui.OutputUI; import com.mercedesbenz.sechub.developertools.admin.ui.UIContext; @@ -40,7 +40,7 @@ public void before() { @Test public void example_1_projects_can_be_imported() throws Exception { /* prepare */ - File file = DeveloperToolsTestFileSupport.getTestfileSupport().createFileFromResourcePath("csv/example1-developer-admin-ui_mass-import_projects.csv"); + File file = TestDeveloperToolsFileSupport.getTestfileSupport().createFileFromResourcePath("csv/example1-developer-admin-ui_mass-import_projects.csv"); /* execute */ importerToTest.importProjectsAndRelationsByCSV(file); @@ -63,7 +63,7 @@ public void example_1_projects_can_be_imported() throws Exception { @Test public void example_6_projects_can_be_imported_and_releations_to_profiles_are_added() throws Exception { /* prepare */ - File file = DeveloperToolsTestFileSupport.getTestfileSupport() + File file = TestDeveloperToolsFileSupport.getTestfileSupport() .createFileFromResourcePath("csv/example6-developer-admin-ui_mass-import_projects-with-profiles.csv"); /* execute */ diff --git a/sechub-developertools/src/test/java/com/mercedesbenz/sechub/developertools/admin/importer/DeleteProjectMassCSVImporterTest.java b/sechub-developertools/src/test/java/com/mercedesbenz/sechub/developertools/admin/importer/DeleteProjectMassCSVImporterTest.java index c099481ac6..1bf0635069 100644 --- a/sechub-developertools/src/test/java/com/mercedesbenz/sechub/developertools/admin/importer/DeleteProjectMassCSVImporterTest.java +++ b/sechub-developertools/src/test/java/com/mercedesbenz/sechub/developertools/admin/importer/DeleteProjectMassCSVImporterTest.java @@ -11,7 +11,7 @@ import org.junit.Test; import org.junit.rules.ExpectedException; -import com.mercedesbenz.sechub.developertools.DeveloperToolsTestFileSupport; +import com.mercedesbenz.sechub.developertools.TestDeveloperToolsFileSupport; import com.mercedesbenz.sechub.developertools.admin.DeveloperAdministration; import com.mercedesbenz.sechub.test.junit4.ExpectedExceptionFactory; @@ -33,7 +33,7 @@ public void before() { @Test public void example_1_projects_can_be_imported() throws Exception { /* prepare */ - File file = DeveloperToolsTestFileSupport.getTestfileSupport() + File file = TestDeveloperToolsFileSupport.getTestfileSupport() .createFileFromResourcePath("csv/example2-developer-admin-ui_mass-import_delete_projects.csv"); /* execute */ diff --git a/sechub-developertools/src/test/java/com/mercedesbenz/sechub/developertools/admin/importer/SimpleCSVImporterTest.java b/sechub-developertools/src/test/java/com/mercedesbenz/sechub/developertools/admin/importer/SimpleCSVImporterTest.java index 88faa13d0c..fb34ce7c64 100644 --- a/sechub-developertools/src/test/java/com/mercedesbenz/sechub/developertools/admin/importer/SimpleCSVImporterTest.java +++ b/sechub-developertools/src/test/java/com/mercedesbenz/sechub/developertools/admin/importer/SimpleCSVImporterTest.java @@ -11,7 +11,7 @@ import org.junit.Test; import org.junit.rules.ExpectedException; -import com.mercedesbenz.sechub.developertools.DeveloperToolsTestFileSupport; +import com.mercedesbenz.sechub.developertools.TestDeveloperToolsFileSupport; import com.mercedesbenz.sechub.test.junit4.ExpectedExceptionFactory; public class SimpleCSVImporterTest { @@ -29,7 +29,7 @@ public void before() { @Test public void example1_can_be_read_with_3_columns_and_1_header_and_contains_expected_data() throws Exception { /* prepare */ - File file = DeveloperToolsTestFileSupport.getTestfileSupport().createFileFromResourcePath("csv/example1-developer-admin-ui_mass-import_projects.csv"); + File file = TestDeveloperToolsFileSupport.getTestfileSupport().createFileFromResourcePath("csv/example1-developer-admin-ui_mass-import_projects.csv"); /* execute */ List importedRows = importerToTest.importCSVFile(file, 4, 1, false); @@ -53,7 +53,7 @@ public void example1_can_not_be_read_with_4_columns_when_insisting_all_columns_s expected.expect(IllegalStateException.class); /* prepare */ - File file = DeveloperToolsTestFileSupport.getTestfileSupport().createFileFromResourcePath("csv/example1-developer-admin-ui_mass-import_projects.csv"); + File file = TestDeveloperToolsFileSupport.getTestfileSupport().createFileFromResourcePath("csv/example1-developer-admin-ui_mass-import_projects.csv"); /* execute */ importerToTest.importCSVFile(file, 4, 1, true); @@ -65,7 +65,7 @@ public void example1_can_not_be_read_with_2_columns() throws Exception { expected.expect(IllegalStateException.class); /* prepare */ - File file = DeveloperToolsTestFileSupport.getTestfileSupport().createFileFromResourcePath("csv/example1-developer-admin-ui_mass-import_projects.csv"); + File file = TestDeveloperToolsFileSupport.getTestfileSupport().createFileFromResourcePath("csv/example1-developer-admin-ui_mass-import_projects.csv"); /* execute */ importerToTest.importCSVFile(file, 2, 1, false); @@ -77,7 +77,7 @@ public void example1_can_not_be_read_with_4_columns() throws Exception { expected.expect(IllegalStateException.class); /* prepare */ - File file = DeveloperToolsTestFileSupport.getTestfileSupport().createFileFromResourcePath("csv/example1-developer-admin-ui_mass-import_projects.csv"); + File file = TestDeveloperToolsFileSupport.getTestfileSupport().createFileFromResourcePath("csv/example1-developer-admin-ui_mass-import_projects.csv"); /* execute */ importerToTest.importCSVFile(file, 2, 1); diff --git a/sechub-developertools/src/test/java/com/mercedesbenz/sechub/developertools/admin/importer/UnassignUserFromProjectMassCSVImporterTest.java b/sechub-developertools/src/test/java/com/mercedesbenz/sechub/developertools/admin/importer/UnassignUserFromProjectMassCSVImporterTest.java index 17e49120f5..b8e0b10456 100644 --- a/sechub-developertools/src/test/java/com/mercedesbenz/sechub/developertools/admin/importer/UnassignUserFromProjectMassCSVImporterTest.java +++ b/sechub-developertools/src/test/java/com/mercedesbenz/sechub/developertools/admin/importer/UnassignUserFromProjectMassCSVImporterTest.java @@ -10,7 +10,7 @@ import org.junit.Test; import org.junit.rules.ExpectedException; -import com.mercedesbenz.sechub.developertools.DeveloperToolsTestFileSupport; +import com.mercedesbenz.sechub.developertools.TestDeveloperToolsFileSupport; import com.mercedesbenz.sechub.developertools.admin.DeveloperAdministration; import com.mercedesbenz.sechub.test.junit4.ExpectedExceptionFactory; @@ -32,7 +32,7 @@ public void before() { @Test public void example_3_user2projects_can_be_imported() throws Exception { /* prepare */ - File file = DeveloperToolsTestFileSupport.getTestfileSupport() + File file = TestDeveloperToolsFileSupport.getTestfileSupport() .createFileFromResourcePath("csv/example4-developer-admin-ui_mass-import_user2projects-unassign.csv"); /* execute */ diff --git a/sechub-doc/src/test/java/com/mercedesbenz/sechub/ExampleFilesValidTest.java b/sechub-doc/src/test/java/com/mercedesbenz/sechub/ExampleFilesValidTest.java index eff696a547..5f09746419 100644 --- a/sechub-doc/src/test/java/com/mercedesbenz/sechub/ExampleFilesValidTest.java +++ b/sechub-doc/src/test/java/com/mercedesbenz/sechub/ExampleFilesValidTest.java @@ -86,8 +86,8 @@ void check_pds_config_example1_can_be_loaded_and_is_valid() throws Exception { } @ParameterizedTest - @EnumSource(SecHubConfigExampleFile.class) - void every_sechub_config_file_is_valid(SecHubConfigExampleFile file) { + @EnumSource(TestSecHubConfigExampleFile.class) + void every_sechub_config_file_is_valid(TestSecHubConfigExampleFile file) { /* prepare */ String json = TestFileReader.readTextFromFile(file.getPath()); SecHubScanConfiguration config = null; @@ -104,10 +104,10 @@ void every_sechub_config_file_is_valid(SecHubConfigExampleFile file) { } @ParameterizedTest - @EnumSource(value = SecHubConfigExampleFile.class, names = { "WEBSCAN_ANONYMOUS", "WEBSCAN_BASIC_AUTH", "WEBSCAN_FORM_BASED_SCRIPT_AUTH", + @EnumSource(value = TestSecHubConfigExampleFile.class, names = { "WEBSCAN_ANONYMOUS", "WEBSCAN_BASIC_AUTH", "WEBSCAN_FORM_BASED_SCRIPT_AUTH", "WEBSCAN_OPENAPI_WITH_DATA_REFERENCE", "WEBSCAN_HEADER_SCAN", "WEBSCAN_CLIENT_CERTIFICATE", "WEBSCAN_FORM_BASED_SCRIPT_AUTH_WITH_TOTP" }, mode = EnumSource.Mode.INCLUDE) - void every_sechub_config_webscan_file_is_valid_and_has_a_target_uri(SecHubConfigExampleFile file) { + void every_sechub_config_webscan_file_is_valid_and_has_a_target_uri(TestSecHubConfigExampleFile file) { /* prepare */ String json = TestFileReader.readTextFromFile(file.getPath()); @@ -125,7 +125,7 @@ void every_sechub_config_webscan_file_is_valid_and_has_a_target_uri(SecHubConfig @Test void webscan_anonymous_can_be_read_and_contains_expected_config() { /* prepare */ - String json = TestFileReader.readTextFromFile(SecHubConfigExampleFile.WEBSCAN_ANONYMOUS.getPath()); + String json = TestFileReader.readTextFromFile(TestSecHubConfigExampleFile.WEBSCAN_ANONYMOUS.getPath()); /* execute */ SecHubScanConfiguration config = SecHubScanConfiguration.createFromJSON(json); @@ -144,7 +144,7 @@ void webscan_anonymous_can_be_read_and_contains_expected_config() { @Test void webscan_basic_auth_can_be_read_and_contains_expected_config() { /* prepare */ - String json = TestFileReader.readTextFromFile(SecHubConfigExampleFile.WEBSCAN_BASIC_AUTH.getPath()); + String json = TestFileReader.readTextFromFile(TestSecHubConfigExampleFile.WEBSCAN_BASIC_AUTH.getPath()); /* execute */ SecHubScanConfiguration config = SecHubScanConfiguration.createFromJSON(json); @@ -167,7 +167,7 @@ void webscan_basic_auth_can_be_read_and_contains_expected_config() { @Test void webscan_form_based_script_auth_can_be_read_and_contains_expected_config() { /* prepare */ - String json = TestFileReader.readTextFromFile(SecHubConfigExampleFile.WEBSCAN_FORM_BASED_SCRIPT_AUTH.getPath()); + String json = TestFileReader.readTextFromFile(TestSecHubConfigExampleFile.WEBSCAN_FORM_BASED_SCRIPT_AUTH.getPath()); /* execute */ SecHubScanConfiguration config = SecHubScanConfiguration.createFromJSON(json); @@ -191,7 +191,7 @@ void webscan_form_based_script_auth_can_be_read_and_contains_expected_config() { @Test void webscan_openapi_with_data_reference_can_be_read_and_contains_expected_config() { /* prepare */ - String json = TestFileReader.readTextFromFile(SecHubConfigExampleFile.WEBSCAN_OPENAPI_WITH_DATA_REFERENCE.getPath()); + String json = TestFileReader.readTextFromFile(TestSecHubConfigExampleFile.WEBSCAN_OPENAPI_WITH_DATA_REFERENCE.getPath()); /* execute */ SecHubScanConfiguration config = SecHubScanConfiguration.createFromJSON(json); @@ -208,7 +208,7 @@ void webscan_openapi_with_data_reference_can_be_read_and_contains_expected_confi @Test void webscan_client_certificate_with_data_reference_can_be_read_and_contains_expected_config() { /* prepare */ - String json = TestFileReader.readTextFromFile(SecHubConfigExampleFile.WEBSCAN_CLIENT_CERTIFICATE_WITH_OPENAPI.getPath()); + String json = TestFileReader.readTextFromFile(TestSecHubConfigExampleFile.WEBSCAN_CLIENT_CERTIFICATE_WITH_OPENAPI.getPath()); /* execute */ SecHubScanConfiguration config = SecHubScanConfiguration.createFromJSON(json); @@ -228,7 +228,7 @@ void webscan_client_certificate_with_data_reference_can_be_read_and_contains_exp @Test void webscan_client_certificate_with_openapi_can_be_read_and_contains_expected_config() { /* prepare */ - String json = TestFileReader.readTextFromFile(SecHubConfigExampleFile.WEBSCAN_CLIENT_CERTIFICATE.getPath()); + String json = TestFileReader.readTextFromFile(TestSecHubConfigExampleFile.WEBSCAN_CLIENT_CERTIFICATE.getPath()); /* execute */ SecHubScanConfiguration config = SecHubScanConfiguration.createFromJSON(json); @@ -245,7 +245,7 @@ void webscan_client_certificate_with_openapi_can_be_read_and_contains_expected_c @Test void webscan_header_scan_can_be_read_and_contains_expected_config() { /* prepare */ - String json = TestFileReader.readTextFromFile(SecHubConfigExampleFile.WEBSCAN_HEADER_SCAN.getPath()); + String json = TestFileReader.readTextFromFile(TestSecHubConfigExampleFile.WEBSCAN_HEADER_SCAN.getPath()); /* execute */ SecHubScanConfiguration config = SecHubScanConfiguration.createFromJSON(json); @@ -273,7 +273,7 @@ void webscan_header_scan_can_be_read_and_contains_expected_config() { @Test void webscan_header_from_data_reference_can_be_read_and_contains_expected_config() { /* prepare */ - String json = TestFileReader.readTextFromFile(SecHubConfigExampleFile.WEBSCAN_HEADER_FROM_DATA_REFERENCE.getPath()); + String json = TestFileReader.readTextFromFile(TestSecHubConfigExampleFile.WEBSCAN_HEADER_FROM_DATA_REFERENCE.getPath()); /* execute */ SecHubScanConfiguration config = SecHubScanConfiguration.createFromJSON(json); @@ -306,7 +306,7 @@ void webscan_header_from_data_reference_can_be_read_and_contains_expected_config @Test void webscan_form_based_script_auth_with_totp_can_be_read_and_contains_expected_config() { /* prepare */ - String json = TestFileReader.readTextFromFile(SecHubConfigExampleFile.WEBSCAN_FORM_BASED_SCRIPT_AUTH_WITH_TOTP.getPath()); + String json = TestFileReader.readTextFromFile(TestSecHubConfigExampleFile.WEBSCAN_FORM_BASED_SCRIPT_AUTH_WITH_TOTP.getPath()); /* execute */ SecHubScanConfiguration config = SecHubScanConfiguration.createFromJSON(json); @@ -336,7 +336,7 @@ void webscan_form_based_script_auth_with_totp_can_be_read_and_contains_expected_ @Test void pds_param_template_metadata_array_syntax_example_is_valid() { /* prepare */ - String json = TestFileReader.readTextFromFile(PDSDataExampleFile.PDS_PARAM_TEMPLATE_META_DATA_SYNTAX.getPath()); + String json = TestFileReader.readTextFromFile(TestPDSDataExampleFile.PDS_PARAM_TEMPLATE_META_DATA_SYNTAX.getPath()); /* execute */ List result = JSONConverter.get().fromJSONtoListOf(PDSTemplateMetaData.class, json); diff --git a/sechub-doc/src/test/java/com/mercedesbenz/sechub/PDSDataExampleFile.java b/sechub-doc/src/test/java/com/mercedesbenz/sechub/TestPDSDataExampleFile.java similarity index 78% rename from sechub-doc/src/test/java/com/mercedesbenz/sechub/PDSDataExampleFile.java rename to sechub-doc/src/test/java/com/mercedesbenz/sechub/TestPDSDataExampleFile.java index b4dc4be87f..6559b4441e 100644 --- a/sechub-doc/src/test/java/com/mercedesbenz/sechub/PDSDataExampleFile.java +++ b/sechub-doc/src/test/java/com/mercedesbenz/sechub/TestPDSDataExampleFile.java @@ -1,14 +1,14 @@ // SPDX-License-Identifier: MIT package com.mercedesbenz.sechub; -public enum PDSDataExampleFile { +public enum TestPDSDataExampleFile { PDS_PARAM_TEMPLATE_META_DATA_SYNTAX("src/docs/asciidoc/documents/shared/snippet/pds-param-template-metadata-syntax.json"); ; private String path; - private PDSDataExampleFile(String path) { + private TestPDSDataExampleFile(String path) { this.path = path; } diff --git a/sechub-doc/src/test/java/com/mercedesbenz/sechub/SecHubConfigExampleFile.java b/sechub-doc/src/test/java/com/mercedesbenz/sechub/TestSecHubConfigExampleFile.java similarity index 96% rename from sechub-doc/src/test/java/com/mercedesbenz/sechub/SecHubConfigExampleFile.java rename to sechub-doc/src/test/java/com/mercedesbenz/sechub/TestSecHubConfigExampleFile.java index 95ae922289..a3dadf3d53 100644 --- a/sechub-doc/src/test/java/com/mercedesbenz/sechub/SecHubConfigExampleFile.java +++ b/sechub-doc/src/test/java/com/mercedesbenz/sechub/TestSecHubConfigExampleFile.java @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT package com.mercedesbenz.sechub; -public enum SecHubConfigExampleFile { +public enum TestSecHubConfigExampleFile { DATA_SECTION_EXAMPLE_1("src/docs/asciidoc/documents/shared/configuration/sechub_config_data_section_general_example1.json"), @@ -45,7 +45,7 @@ public enum SecHubConfigExampleFile { private String path; - private SecHubConfigExampleFile(String path) { + private TestSecHubConfigExampleFile(String path) { this.path = path; } diff --git a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/AdminShowsScanLogsForProjectRestDocTest.java b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/AdminShowsScanLogsForProjectRestDocTest.java index 756e76590f..4a47ab5ec1 100644 --- a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/AdminShowsScanLogsForProjectRestDocTest.java +++ b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/AdminShowsScanLogsForProjectRestDocTest.java @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT package com.mercedesbenz.sechub.restdoc; -import static com.mercedesbenz.sechub.restdoc.RestDocumentation.*; +import static com.mercedesbenz.sechub.restdoc.RestDocumentationTest.*; import static com.mercedesbenz.sechub.test.RestDocPathParameter.*; import static com.mercedesbenz.sechub.test.SecHubTestURLBuilder.*; import static org.mockito.ArgumentMatchers.*; @@ -92,14 +92,14 @@ public void restdoc_admin_downloads_scan_logs_for_project() throws Exception { this.mockMvc.perform( get(apiEndpoint,PROJECT1). contentType(MediaType.APPLICATION_JSON_VALUE). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isOk()). andDo(defineRestService(). with(). useCaseData(useCase). tag(RestDocFactory.extractTag(apiEndpoint)). - responseSchema(OpenApiSchema.PROJECT_SCAN_LOGS.getSchema()). + responseSchema(TestOpenApiSchema.PROJECT_SCAN_LOGS.getSchema()). and(). document( requestHeaders( diff --git a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/AnonymousCheckAliveRestDocTest.java b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/AnonymousCheckAliveRestDocTest.java index 51b2097c3d..e3499fef94 100644 --- a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/AnonymousCheckAliveRestDocTest.java +++ b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/AnonymousCheckAliveRestDocTest.java @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT package com.mercedesbenz.sechub.restdoc; -import static com.mercedesbenz.sechub.restdoc.RestDocumentation.*; +import static com.mercedesbenz.sechub.restdoc.RestDocumentationTest.*; import static com.mercedesbenz.sechub.test.SecHubTestURLBuilder.*; import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.*; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; diff --git a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/AnonymousSignupRestControllerRestDocTest.java b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/AnonymousSignupRestControllerRestDocTest.java index baa234e2e5..0228b07f1a 100644 --- a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/AnonymousSignupRestControllerRestDocTest.java +++ b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/AnonymousSignupRestControllerRestDocTest.java @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT package com.mercedesbenz.sechub.restdoc; -import static com.mercedesbenz.sechub.restdoc.RestDocumentation.*; +import static com.mercedesbenz.sechub.restdoc.RestDocumentationTest.*; import static com.mercedesbenz.sechub.test.SecHubTestURLBuilder.*; import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.*; import static org.springframework.restdocs.payload.PayloadDocumentation.*; @@ -76,7 +76,7 @@ public void calling_with_api_1_0_and_valid_userid_and_email_returns_HTTP_200() t summary(RestDocFactory.createSummary(useCase)). description(RestDocFactory.createDescription(useCase)). tag(RestDocFactory.extractTag(apiEndpoint)). - requestSchema(OpenApiSchema.USER_SIGNUP.getSchema()). + requestSchema(TestOpenApiSchema.USER_SIGNUP.getSchema()). and(). document( requestFields( diff --git a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/AnonymousUserGetAPITokenByOneTimeTokenRestControllerRestDocTest.java b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/AnonymousUserGetAPITokenByOneTimeTokenRestControllerRestDocTest.java index 7350f9c36c..1d7a57e573 100644 --- a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/AnonymousUserGetAPITokenByOneTimeTokenRestControllerRestDocTest.java +++ b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/AnonymousUserGetAPITokenByOneTimeTokenRestControllerRestDocTest.java @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT package com.mercedesbenz.sechub.restdoc; -import static com.mercedesbenz.sechub.restdoc.RestDocumentation.defineRestService; +import static com.mercedesbenz.sechub.restdoc.RestDocumentationTest.defineRestService; import static com.mercedesbenz.sechub.test.RestDocPathParameter.ONE_TIME_TOKEN; import static com.mercedesbenz.sechub.test.SecHubTestURLBuilder.https; import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.get; diff --git a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/AnonymousUserRequestsNewApiTokenRestDocTest.java b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/AnonymousUserRequestsNewApiTokenRestDocTest.java index 9b790faf86..9e52f77f93 100644 --- a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/AnonymousUserRequestsNewApiTokenRestDocTest.java +++ b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/AnonymousUserRequestsNewApiTokenRestDocTest.java @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT package com.mercedesbenz.sechub.restdoc; -import static com.mercedesbenz.sechub.restdoc.RestDocumentation.*; +import static com.mercedesbenz.sechub.restdoc.RestDocumentationTest.*; import static com.mercedesbenz.sechub.test.RestDocPathParameter.*; import static com.mercedesbenz.sechub.test.SecHubTestURLBuilder.*; import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.*; diff --git a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/AssetRestControllerRestDocTest.java b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/AssetRestControllerRestDocTest.java index 34fb89c4bc..fa6e44998d 100644 --- a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/AssetRestControllerRestDocTest.java +++ b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/AssetRestControllerRestDocTest.java @@ -2,7 +2,7 @@ package com.mercedesbenz.sechub.restdoc; import static com.mercedesbenz.sechub.commons.core.CommonConstants.*; -import static com.mercedesbenz.sechub.restdoc.RestDocumentation.*; +import static com.mercedesbenz.sechub.restdoc.RestDocumentationTest.*; import static com.mercedesbenz.sechub.test.RestDocPathParameter.*; import static com.mercedesbenz.sechub.test.SecHubTestURLBuilder.*; import static org.mockito.Mockito.*; @@ -102,14 +102,14 @@ public void restdoc_admin_deletes_one_file_from_asset() throws Exception { /* execute + test @formatter:off */ this.mockMvc.perform( delete(apiEndpoint, TEST_ASSET_ID1, TEST_FILENAME1). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isOk()). andDo(defineRestService(). with(). useCaseData(useCase). tag(RestDocFactory.extractTag(apiEndpoint)). - requestSchema(OpenApiSchema.ASSETS.getSchema()). + requestSchema(TestOpenApiSchema.ASSETS.getSchema()). and(). document( pathParameters( @@ -132,14 +132,14 @@ public void restdoc_admin_deletes_asset_completely() throws Exception { this.mockMvc.perform( delete(apiEndpoint, TEST_ASSET_ID1). contentType(MediaType.APPLICATION_JSON_VALUE). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isOk()). andDo(defineRestService(). with(). useCaseData(useCase). tag(RestDocFactory.extractTag(apiEndpoint)). - requestSchema(OpenApiSchema.ASSETS.getSchema()). + requestSchema(TestOpenApiSchema.ASSETS.getSchema()). and(). document( pathParameters( @@ -162,14 +162,14 @@ public void restdoc_admin_fetches_all_asset_ids() throws Exception { /* execute + test @formatter:off */ this.mockMvc.perform( get(apiEndpoint). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isOk()). andDo(defineRestService(). with(). useCaseData(useCase). tag(RestDocFactory.extractTag(apiEndpoint)). - requestSchema(OpenApiSchema.ASSETS.getSchema()). + requestSchema(TestOpenApiSchema.ASSETS.getSchema()). and(). document( responseFields( @@ -199,14 +199,14 @@ public void restdoc_admin_fetches_asset_details() throws Exception { this.mockMvc.perform( get(apiEndpoint, TEST_ASSET_ID1). contentType(MediaType.APPLICATION_JSON_VALUE). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isOk()). andDo(defineRestService(). with(). useCaseData(useCase). tag(RestDocFactory.extractTag(apiEndpoint)). - requestSchema(OpenApiSchema.ASSETS.getSchema()). + requestSchema(TestOpenApiSchema.ASSETS.getSchema()). and(). document( responseFields( @@ -270,14 +270,14 @@ public void restdoc_admin_downloads_assetfile() throws Exception { this.mockMvc.perform( get(apiEndpoint,TEST_ASSET_ID1, TEST_FILENAME1). contentType(MediaType.APPLICATION_JSON_VALUE). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isOk()). andDo(defineRestService(). with(). useCaseData(useCase). tag(RestDocFactory.extractTag(apiEndpoint)). - responseSchema(OpenApiSchema.ASSETS.getSchema()). + responseSchema(TestOpenApiSchema.ASSETS.getSchema()). and(). document( requestHeaders( diff --git a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/ConfigAdministrationRestControllerRestDocTest.java b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/ConfigAdministrationRestControllerRestDocTest.java index bef9b8e805..6b46d717d4 100644 --- a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/ConfigAdministrationRestControllerRestDocTest.java +++ b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/ConfigAdministrationRestControllerRestDocTest.java @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT package com.mercedesbenz.sechub.restdoc; -import static com.mercedesbenz.sechub.restdoc.RestDocumentation.*; +import static com.mercedesbenz.sechub.restdoc.RestDocumentationTest.*; import static com.mercedesbenz.sechub.test.SecHubTestURLBuilder.*; import static org.mockito.Mockito.*; import static org.springframework.restdocs.headers.HeaderDocumentation.requestHeaders; @@ -73,7 +73,7 @@ public void restdoc_admin_updates_auto_cleanup_configuration() throws Exception put(apiEndpoint). content(config.toJSON()). contentType(MediaType.APPLICATION_JSON_VALUE). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isAccepted()). andDo(defineRestService(). @@ -103,7 +103,7 @@ public void restdoc_admin_fetches_auto_cleanup_configuration() throws Exception this.mockMvc.perform( get(apiEndpoint). contentType(MediaType.APPLICATION_JSON_VALUE). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isOk()). andExpect(content().json(config.toJSON())). diff --git a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/DownloadsFullScanDataForJobRestDocTest.java b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/DownloadsFullScanDataForJobRestDocTest.java index 4f579de8b5..75df361fa4 100644 --- a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/DownloadsFullScanDataForJobRestDocTest.java +++ b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/DownloadsFullScanDataForJobRestDocTest.java @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT package com.mercedesbenz.sechub.restdoc; -import static com.mercedesbenz.sechub.restdoc.RestDocumentation.*; +import static com.mercedesbenz.sechub.restdoc.RestDocumentationTest.*; import static com.mercedesbenz.sechub.test.RestDocPathParameter.*; import static com.mercedesbenz.sechub.test.SecHubTestURLBuilder.*; import static org.mockito.Mockito.*; @@ -100,14 +100,14 @@ public void restdoc_admin_downloads_fullscan_data_for_job() throws Exception { this.mockMvc.perform( get(apiEndpoint,jobUUID). contentType(MediaType.APPLICATION_JSON_VALUE). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isOk()). andDo(defineRestService(). with(). useCaseData(useCase). tag(RestDocFactory.extractTag(apiEndpoint)). - responseSchema(OpenApiSchema.FULL_SCAN_DATA_ZIP.getSchema()). + responseSchema(TestOpenApiSchema.FULL_SCAN_DATA_ZIP.getSchema()). and(). document( requestHeaders( diff --git a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/EncryptionAdministrationRestControllerRestDocTest.java b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/EncryptionAdministrationRestControllerRestDocTest.java index 7ce2d0dd7e..5028d66182 100644 --- a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/EncryptionAdministrationRestControllerRestDocTest.java +++ b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/EncryptionAdministrationRestControllerRestDocTest.java @@ -2,7 +2,7 @@ package com.mercedesbenz.sechub.restdoc; import static com.mercedesbenz.sechub.docgen.util.RestDocFactory.*; -import static com.mercedesbenz.sechub.restdoc.RestDocumentation.*; +import static com.mercedesbenz.sechub.restdoc.RestDocumentationTest.*; import static com.mercedesbenz.sechub.test.SecHubTestURLBuilder.*; import static org.mockito.Mockito.*; import static org.springframework.restdocs.headers.HeaderDocumentation.*; @@ -98,7 +98,7 @@ public void restdoc_admin_starts_encryption_rotation() throws Exception { post(apiEndpoint). contentType(MediaType.APPLICATION_JSON_VALUE). content(data.toFormattedJSON()). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isOk()). andDo(defineRestService(). @@ -135,14 +135,14 @@ public void restdoc_admin_fetches_encryption_status() throws Exception { this.mockMvc.perform( get(apiEndpoint). contentType(MediaType.APPLICATION_JSON_VALUE). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isOk()). andDo(defineRestService(). with(). useCaseData(useCase). tag(extractTag(apiEndpoint)). - responseSchema(OpenApiSchema.ENCRYPTION_STATUS.getSchema()). + responseSchema(TestOpenApiSchema.ENCRYPTION_STATUS.getSchema()). and(). document( requestHeaders( diff --git a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/FalsePositiveRestControllerRestDocTest.java b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/FalsePositiveRestControllerRestDocTest.java index a77d3c65d9..ea5308eab8 100644 --- a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/FalsePositiveRestControllerRestDocTest.java +++ b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/FalsePositiveRestControllerRestDocTest.java @@ -6,7 +6,7 @@ import static com.mercedesbenz.sechub.domain.scan.project.FalsePositiveProjectConfiguration.*; import static com.mercedesbenz.sechub.domain.scan.project.FalsePositiveProjectData.*; import static com.mercedesbenz.sechub.domain.scan.project.WebscanFalsePositiveProjectData.*; -import static com.mercedesbenz.sechub.restdoc.RestDocumentation.*; +import static com.mercedesbenz.sechub.restdoc.RestDocumentationTest.*; import static com.mercedesbenz.sechub.test.RestDocPathParameter.*; import static com.mercedesbenz.sechub.test.SecHubTestURLBuilder.*; import static org.mockito.Mockito.*; @@ -134,7 +134,7 @@ public void restdoc_mark_false_positives() throws Exception { put(apiEndpoint, PROJECT1_ID). contentType(MediaType.APPLICATION_JSON_VALUE). content(content). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isOk()). /*andDo(print()).*/ @@ -142,7 +142,7 @@ public void restdoc_mark_false_positives() throws Exception { with(). useCaseData(useCase). tag(RestDocFactory.extractTag(apiEndpoint)). - requestSchema(OpenApiSchema.FALSE_POSITIVES.getSchema()). + requestSchema(TestOpenApiSchema.FALSE_POSITIVES.getSchema()). and(). document( requestHeaders( @@ -188,7 +188,7 @@ public void restdoc_unmark_false_positives() throws Exception { /* execute + test @formatter:off */ this.mockMvc.perform( delete(apiEndpoint,PROJECT1_ID,jobUUID,findingId). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isOk()). /*andDo(print()).*/ @@ -222,7 +222,7 @@ public void restdoc_unmark_false_positive_project_data() throws Exception { /* execute + test @formatter:off */ this.mockMvc.perform( delete(apiEndpoint,PROJECT1_ID,projectDataId). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isNoContent()). /*andDo(print()).*/ @@ -309,7 +309,7 @@ public void user_fetches_false_positive_configuration() throws Exception { this.mockMvc.perform( get(apiEndpoint,PROJECT1_ID). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isOk()). /*andDo(print()).*/ @@ -317,7 +317,7 @@ public void user_fetches_false_positive_configuration() throws Exception { with(). useCaseData(useCase). tag(RestDocFactory.extractTag(apiEndpoint)). - responseSchema(OpenApiSchema.FALSE_POSITIVES.getSchema()). + responseSchema(TestOpenApiSchema.FALSE_POSITIVES.getSchema()). and(). document( requestHeaders( diff --git a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/JobAdministrationRestControllerRestDocTest.java b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/JobAdministrationRestControllerRestDocTest.java index 79791039db..f2a4385010 100644 --- a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/JobAdministrationRestControllerRestDocTest.java +++ b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/JobAdministrationRestControllerRestDocTest.java @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT package com.mercedesbenz.sechub.restdoc; -import static com.mercedesbenz.sechub.restdoc.RestDocumentation.*; +import static com.mercedesbenz.sechub.restdoc.RestDocumentationTest.*; import static com.mercedesbenz.sechub.test.RestDocPathParameter.*; import static com.mercedesbenz.sechub.test.SecHubTestURLBuilder.*; import static org.mockito.Mockito.*; @@ -100,14 +100,14 @@ public void restdoc_list_all_running_jobs() throws Exception { this.mockMvc.perform( get(apiEndpoint). contentType(MediaType.APPLICATION_JSON_VALUE). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isOk()). andDo(defineRestService(). with(). useCaseData(useCase). tag(RestDocFactory.extractTag(apiEndpoint)). - responseSchema(OpenApiSchema.RUNNING_JOB_LIST.getSchema()). + responseSchema(TestOpenApiSchema.RUNNING_JOB_LIST.getSchema()). and(). document( requestHeaders( @@ -138,7 +138,7 @@ public void restdoc_cancel_job() throws Exception { this.mockMvc.perform( post(apiEndpoint, jobUUID). contentType(MediaType.APPLICATION_JSON_VALUE). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isOk()). andDo(defineRestService(). @@ -171,7 +171,7 @@ public void restdoc_restart_job() throws Exception { this.mockMvc.perform( post(apiEndpoint, jobUUID). contentType(MediaType.APPLICATION_JSON_VALUE). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isOk()). andDo(defineRestService(). @@ -204,7 +204,7 @@ public void restdoc_restart_job_hard() throws Exception { this.mockMvc.perform( post(apiEndpoint,jobUUID). contentType(MediaType.APPLICATION_JSON_VALUE). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isOk()). andDo(defineRestService(). diff --git a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/JobRestControllerRestDocTest.java b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/JobRestControllerRestDocTest.java index cb5d1bf982..14770d0c23 100644 --- a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/JobRestControllerRestDocTest.java +++ b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/JobRestControllerRestDocTest.java @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT package com.mercedesbenz.sechub.restdoc; -import static com.mercedesbenz.sechub.restdoc.RestDocumentation.defineRestService; +import static com.mercedesbenz.sechub.restdoc.RestDocumentationTest.defineRestService; import static com.mercedesbenz.sechub.test.RestDocPathParameter.JOB_UUID; import static com.mercedesbenz.sechub.test.SecHubTestURLBuilder.https; import static org.springframework.restdocs.headers.HeaderDocumentation.requestHeaders; @@ -70,7 +70,7 @@ public void user_role_cancel_job() throws Exception { this.mockMvc.perform( post(apiEndpoint, jobUUID). contentType(MediaType.APPLICATION_JSON_VALUE). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isNoContent()). andDo(defineRestService(). diff --git a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/MappingAdministrationRestControllerRestDocTest.java b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/MappingAdministrationRestControllerRestDocTest.java index d512589bce..513a2aa907 100644 --- a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/MappingAdministrationRestControllerRestDocTest.java +++ b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/MappingAdministrationRestControllerRestDocTest.java @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT package com.mercedesbenz.sechub.restdoc; -import static com.mercedesbenz.sechub.restdoc.RestDocumentation.*; +import static com.mercedesbenz.sechub.restdoc.RestDocumentationTest.*; import static com.mercedesbenz.sechub.test.SecHubTestURLBuilder.*; import static org.mockito.Mockito.*; import static org.springframework.restdocs.headers.HeaderDocumentation.requestHeaders; @@ -95,7 +95,7 @@ public void restdoc_admin_lists_status_information() throws Exception { this.mockMvc.perform( get(apiEndpoint). contentType(MediaType.APPLICATION_JSON_VALUE). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andDo(print()). andExpect(status().isOk()). @@ -103,7 +103,7 @@ public void restdoc_admin_lists_status_information() throws Exception { with(). useCaseData(useCase). tag(RestDocFactory.extractTag(apiEndpoint)). - responseSchema(OpenApiSchema.STATUS_INFORMATION.getSchema()). + responseSchema(TestOpenApiSchema.STATUS_INFORMATION.getSchema()). and(). document( requestHeaders( diff --git a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/ProductExecutionProfileRestControllerRestDocTest.java b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/ProductExecutionProfileRestControllerRestDocTest.java index 124a0565bc..4ce6b03110 100644 --- a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/ProductExecutionProfileRestControllerRestDocTest.java +++ b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/ProductExecutionProfileRestControllerRestDocTest.java @@ -2,7 +2,7 @@ package com.mercedesbenz.sechub.restdoc; import static com.mercedesbenz.sechub.domain.scan.product.config.ProductExecutionProfile.*; -import static com.mercedesbenz.sechub.restdoc.RestDocumentation.*; +import static com.mercedesbenz.sechub.restdoc.RestDocumentationTest.*; import static com.mercedesbenz.sechub.test.RestDocPathParameter.*; import static com.mercedesbenz.sechub.test.SecHubTestURLBuilder.*; import static org.mockito.Mockito.*; @@ -122,14 +122,14 @@ public void restdoc_admin_creates_profile() throws Exception { post(apiEndpoint, profileId). contentType(MediaType.APPLICATION_JSON_VALUE). content(JSONConverter.get().toJSON(profile)). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isCreated()). andDo(defineRestService(). with(). useCaseData(useCase). tag(RestDocFactory.extractTag(apiEndpoint)). - requestSchema(OpenApiSchema.EXECUTION_PROFILE_CREATE.getSchema()). + requestSchema(TestOpenApiSchema.EXECUTION_PROFILE_CREATE.getSchema()). and(). document( requestHeaders( @@ -174,14 +174,14 @@ public void restdoc_admin_updates_profile() throws Exception { put(apiEndpoint, profileId). contentType(MediaType.APPLICATION_JSON_VALUE). content(JSONConverter.get().toJSON(profile)). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isOk()). andDo(defineRestService(). with(). useCaseData(useCase). tag(RestDocFactory.extractTag(apiEndpoint)). - requestSchema(OpenApiSchema.EXECUTION_PROFILE_UPDATE.getSchema()). + requestSchema(TestOpenApiSchema.EXECUTION_PROFILE_UPDATE.getSchema()). and(). document( requestHeaders( @@ -219,7 +219,7 @@ public void restdoc_admin_assigns_executionprofile_to_project() throws Exception this.mockMvc.perform( post(apiEndpoint, profileId,projectId). contentType(MediaType.APPLICATION_JSON_VALUE). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isCreated()). andDo(defineRestService(). @@ -254,7 +254,7 @@ public void restdoc_admin_unassigns_executionprofile_from_project() throws Excep this.mockMvc.perform( delete(apiEndpoint, profileId,projectId). contentType(MediaType.APPLICATION_JSON_VALUE). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isOk()). andDo(defineRestService(). @@ -315,14 +315,14 @@ public void restdoc_admin_fetches_profile() throws Exception { this.mockMvc.perform( get(apiEndpoint, profileId). contentType(MediaType.APPLICATION_JSON_VALUE). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isOk()). andDo(defineRestService(). with(). useCaseData(useCase). tag(RestDocFactory.extractTag(apiEndpoint)). - responseSchema(OpenApiSchema.EXECUTION_PROFILE_FETCH.getSchema()). + responseSchema(TestOpenApiSchema.EXECUTION_PROFILE_FETCH.getSchema()). and(). document( requestHeaders( @@ -364,7 +364,7 @@ public void restDoc_admin_deletes_profile() throws Exception { this.mockMvc.perform( delete(apiEndpoint, profileId). contentType(MediaType.APPLICATION_JSON_VALUE). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isOk()). andDo(defineRestService(). @@ -411,14 +411,14 @@ public void restDoc_admin_fetches_profiles_list() throws Exception { this.mockMvc.perform( get(apiEndpoint). contentType(MediaType.APPLICATION_JSON_VALUE). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isOk()). andDo(defineRestService(). with(). useCaseData(useCase). tag(RestDocFactory.extractTag(apiEndpoint)). - responseSchema(OpenApiSchema.EXECUTION_PROFILE_LIST.getSchema()). + responseSchema(TestOpenApiSchema.EXECUTION_PROFILE_LIST.getSchema()). and(). document( requestHeaders( diff --git a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/ProductExecutorConfigRestControllerRestDocTest.java b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/ProductExecutorConfigRestControllerRestDocTest.java index b42fbd925c..b95e358197 100644 --- a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/ProductExecutorConfigRestControllerRestDocTest.java +++ b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/ProductExecutorConfigRestControllerRestDocTest.java @@ -2,7 +2,7 @@ package com.mercedesbenz.sechub.restdoc; import static com.mercedesbenz.sechub.domain.scan.product.config.ProductExecutorConfig.*; -import static com.mercedesbenz.sechub.restdoc.RestDocumentation.*; +import static com.mercedesbenz.sechub.restdoc.RestDocumentationTest.*; import static com.mercedesbenz.sechub.test.RestDocPathParameter.*; import static com.mercedesbenz.sechub.test.SecHubTestURLBuilder.*; import static org.mockito.ArgumentMatchers.*; @@ -136,7 +136,7 @@ public void restdoc_admin_creates_executor_config() throws Exception { post(apiEndpoint). contentType(MediaType.APPLICATION_JSON_VALUE). content(JSONConverter.get().toJSON(configFromUser)). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isCreated()). andExpect(content().string(randomUUID.toString())). @@ -144,8 +144,8 @@ public void restdoc_admin_creates_executor_config() throws Exception { with(). useCaseData(useCase). tag(RestDocFactory.extractTag(apiEndpoint)). - responseSchema(OpenApiSchema.EXECUTOR_CONFIGURATION_ID.getSchema()). - requestSchema(OpenApiSchema.EXECUTOR_CONFIGURATION.getSchema()). + responseSchema(TestOpenApiSchema.EXECUTOR_CONFIGURATION_ID.getSchema()). + requestSchema(TestOpenApiSchema.EXECUTOR_CONFIGURATION.getSchema()). and(). document( requestHeaders( @@ -194,14 +194,14 @@ public void restdoc_admin_updates_executor_config() throws Exception { put(apiEndpoint,randomUUID). contentType(MediaType.APPLICATION_JSON_VALUE). content(JSONConverter.get().toJSON(configFromUser)). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isOk()). andDo(defineRestService(). with(). useCaseData(useCase). tag(RestDocFactory.extractTag(apiEndpoint)). - requestSchema(OpenApiSchema.EXECUTOR_CONFIGURATION.getSchema()). + requestSchema(TestOpenApiSchema.EXECUTOR_CONFIGURATION.getSchema()). and(). document( requestHeaders( @@ -256,14 +256,14 @@ public void restdoc_admin_fetches_executor_config() throws Exception { this.mockMvc.perform( get(apiEndpoint,uuid). contentType(MediaType.APPLICATION_JSON_VALUE). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isOk()). andDo(defineRestService(). with(). useCaseData(useCase). tag(RestDocFactory.extractTag(apiEndpoint)). - responseSchema(OpenApiSchema.EXECUTOR_CONFIGURATION_WITH_UUID.getSchema()). + responseSchema(TestOpenApiSchema.EXECUTOR_CONFIGURATION_WITH_UUID.getSchema()). and(). document( requestHeaders( @@ -301,7 +301,7 @@ public void restDoc_admin_deletes_executor_config() throws Exception { this.mockMvc.perform( delete(apiEndpoint, configUUID). contentType(MediaType.APPLICATION_JSON_VALUE). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isOk()). andDo(defineRestService(). @@ -340,14 +340,14 @@ public void restDoc_admin_fetches_executor_config_list() throws Exception { this.mockMvc.perform( get(apiEndpoint). contentType(MediaType.APPLICATION_JSON_VALUE). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isOk()). andDo(defineRestService(). with(). useCaseData(useCase). tag(RestDocFactory.extractTag(apiEndpoint)). - responseSchema(OpenApiSchema.EXECUTOR_CONFIGURATION_LIST.getSchema()). + responseSchema(TestOpenApiSchema.EXECUTOR_CONFIGURATION_LIST.getSchema()). and(). document( requestHeaders( diff --git a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/ProjectAdministrationRestControllerRestDocTest.java b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/ProjectAdministrationRestControllerRestDocTest.java index bcf9ba4b80..b2d475d20a 100644 --- a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/ProjectAdministrationRestControllerRestDocTest.java +++ b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/ProjectAdministrationRestControllerRestDocTest.java @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT package com.mercedesbenz.sechub.restdoc; -import static com.mercedesbenz.sechub.restdoc.RestDocumentation.*; +import static com.mercedesbenz.sechub.restdoc.RestDocumentationTest.*; import static com.mercedesbenz.sechub.test.RestDocPathParameter.*; import static com.mercedesbenz.sechub.test.SecHubTestURLBuilder.*; import static org.mockito.ArgumentMatchers.*; @@ -146,7 +146,7 @@ public void restdoc_create_project() throws Exception { /* execute + test @formatter:off */ mockMvc.perform( post(apiEndpoint). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()). + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()). contentType(MediaType.APPLICATION_JSON_VALUE). content("{\"apiVersion\":\"1.0\", " + "\"name\":\"projectId\", " @@ -160,7 +160,7 @@ public void restdoc_create_project() throws Exception { with(). useCaseData(useCase). tag(RestDocFactory.extractTag(apiEndpoint)). - requestSchema(OpenApiSchema.PROJECT.getSchema()). + requestSchema(TestOpenApiSchema.PROJECT.getSchema()). and(). document( requestHeaders( @@ -197,14 +197,14 @@ public void restdoc_list_all_projects() throws Exception { mockMvc .perform( get(apiEndpoint). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()). + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()). contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(status().isOk()) .andDo(defineRestService(). with(). useCaseData(useCase). tag(RestDocFactory.extractTag(apiEndpoint)). - responseSchema(OpenApiSchema.PROJECT_LIST.getSchema()). + responseSchema(TestOpenApiSchema.PROJECT_LIST.getSchema()). and(). document( requestHeaders( @@ -229,7 +229,7 @@ public void restdoc_delete_project() throws Exception { mockMvc.perform( delete(apiEndpoint,"projectId1"). contentType(MediaType.APPLICATION_JSON_VALUE). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isOk()). andDo(defineRestService(). @@ -259,7 +259,7 @@ public void restdoc_change_project_owner() throws Exception { mockMvc.perform( post(apiEndpoint, "projectId1", "userId1"). contentType(MediaType.APPLICATION_JSON_VALUE). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isOk()). andDo(defineRestService(). @@ -307,7 +307,7 @@ public void restdoc_change_project_access_level() throws Exception { mockMvc.perform( post(apiEndpoint, "projectId1", ProjectAccessLevel.READ_ONLY.getId()). contentType(MediaType.APPLICATION_JSON_VALUE). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isOk()). andDo(defineRestService(). @@ -339,7 +339,7 @@ public void restdoc_assign_user2project() throws Exception { mockMvc.perform( post(apiEndpoint, "projectId1", "userId1"). contentType(MediaType.APPLICATION_JSON_VALUE). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isOk()). andDo(defineRestService(). @@ -371,7 +371,7 @@ public void restdoc_unassign_userFromProject() throws Exception { mockMvc.perform( delete(apiEndpoint,"userId1", "projectId1"). contentType(MediaType.APPLICATION_JSON_VALUE). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isOk()). andDo(defineRestService(). @@ -437,7 +437,7 @@ public void restdoc_show_project_details() throws Exception { mockMvc.perform( get(apiEndpoint,"projectId1"). contentType(MediaType.APPLICATION_JSON_VALUE). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andDo(print()). andExpect(status().isOk()). @@ -445,7 +445,7 @@ public void restdoc_show_project_details() throws Exception { with(). useCaseData(useCase). tag(RestDocFactory.extractTag(apiEndpoint)). - responseSchema(OpenApiSchema.PROJECT_DETAILS.getSchema()). + responseSchema(TestOpenApiSchema.PROJECT_DETAILS.getSchema()). and(). document( requestHeaders( @@ -512,7 +512,7 @@ public void restdoc_change_project_description() throws Exception { /* execute + test @formatter:off */ mockMvc.perform( post(apiEndpoint, "projectId1"). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()). + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()). content("{\n" + " \"description\" : \"new description\"\n" + "}"). @@ -525,7 +525,7 @@ public void restdoc_change_project_description() throws Exception { with(). useCaseData(useCase). tag(RestDocFactory.extractTag(apiEndpoint)). - responseSchema(OpenApiSchema.PROJECT_DETAILS.getSchema()). + responseSchema(TestOpenApiSchema.PROJECT_DETAILS.getSchema()). and(). document( requestHeaders( @@ -562,7 +562,7 @@ public void restdoc_assign_template2project() throws Exception { mockMvc.perform( put(apiEndpoint, "projectId1", "template1"). contentType(MediaType.APPLICATION_JSON_VALUE). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isOk()). andDo(defineRestService(). @@ -594,7 +594,7 @@ public void restdoc_unassign_templateFromproject() throws Exception { mockMvc.perform( delete(apiEndpoint, "projectId1", "template1"). contentType(MediaType.APPLICATION_JSON_VALUE). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isOk()). andDo(defineRestService(). diff --git a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/ProjectRestControllerRestDocTest.java b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/ProjectRestControllerRestDocTest.java index b03ded0b61..68921bcf6c 100644 --- a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/ProjectRestControllerRestDocTest.java +++ b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/ProjectRestControllerRestDocTest.java @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT package com.mercedesbenz.sechub.restdoc; -import static com.mercedesbenz.sechub.restdoc.RestDocumentation.defineRestService; +import static com.mercedesbenz.sechub.restdoc.RestDocumentationTest.defineRestService; import static com.mercedesbenz.sechub.test.SecHubTestURLBuilder.https; import static org.mockito.Mockito.when; import static org.springframework.restdocs.headers.HeaderDocumentation.requestHeaders; @@ -85,7 +85,7 @@ public void user_role_get_projects() throws Exception { this.mockMvc.perform( get(apiEndpoint). contentType(MediaType.APPLICATION_JSON_VALUE). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isOk()). andDo(defineRestService(). diff --git a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/ProjectUpdateAdministrationRestControllerRestDocTest.java b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/ProjectUpdateAdministrationRestControllerRestDocTest.java index 492bfb9baf..ecbaf74cf5 100644 --- a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/ProjectUpdateAdministrationRestControllerRestDocTest.java +++ b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/ProjectUpdateAdministrationRestControllerRestDocTest.java @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT package com.mercedesbenz.sechub.restdoc; -import static com.mercedesbenz.sechub.restdoc.RestDocumentation.*; +import static com.mercedesbenz.sechub.restdoc.RestDocumentationTest.*; import static com.mercedesbenz.sechub.test.RestDocPathParameter.*; import static com.mercedesbenz.sechub.test.SecHubTestURLBuilder.*; import static org.mockito.Mockito.*; @@ -86,7 +86,7 @@ public void restdoc_update_white_list_for_project() throws Exception { /* execute + test @formatter:off */ this.mockMvc.perform( post(apiEndpoint, "projectId1"). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()). + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()). contentType(MediaType.APPLICATION_JSON_VALUE). content("{\"apiVersion\":\"1.0\", \"whiteList\":{\"uris\":[\"192.168.1.1\",\"https://my.special.server.com/myapp1/\"]}}") ). @@ -95,7 +95,7 @@ public void restdoc_update_white_list_for_project() throws Exception { with(). useCaseData(useCase). tag(RestDocFactory.extractTag(apiEndpoint)). - requestSchema(OpenApiSchema.PROJECT_WHITELIST.getSchema()). + requestSchema(TestOpenApiSchema.PROJECT_WHITELIST.getSchema()). and(). document( requestHeaders( @@ -123,7 +123,7 @@ public void restdoc_update_metadata_for_project() throws Exception { /* execute + test @formatter:off */ this.mockMvc.perform( post(apiEndpoint, "projectId1"). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()). + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()). contentType(MediaType.APPLICATION_JSON_VALUE). content("{\"apiVersion\":\"1.0\", \"metaData\":{\"key1\":\"value1\"}}") ). @@ -132,7 +132,7 @@ public void restdoc_update_metadata_for_project() throws Exception { with(). useCaseData(useCase). tag(RestDocFactory.extractTag(apiEndpoint)). - requestSchema(OpenApiSchema.PROJECT_META_DATA.getSchema()). + requestSchema(TestOpenApiSchema.PROJECT_META_DATA.getSchema()). and(). document( requestHeaders( diff --git a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/RestDocumentation.java b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/RestDocumentationTest.java similarity index 92% rename from sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/RestDocumentation.java rename to sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/RestDocumentationTest.java index df99d410cf..2cb548d1bb 100644 --- a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/RestDocumentation.java +++ b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/RestDocumentationTest.java @@ -12,15 +12,15 @@ import com.epages.restdocs.apispec.Schema; import com.mercedesbenz.sechub.docgen.util.RestDocFactory; -public class RestDocumentation { +public class RestDocumentationTest { private RestDocumentationDetails details; - public static RestDocumentation defineRestService() { - return new RestDocumentation(); + public static RestDocumentationTest defineRestService() { + return new RestDocumentationTest(); } - private RestDocumentation() { + private RestDocumentationTest() { this.details = new RestDocumentationDetails(); } @@ -109,8 +109,8 @@ public RestDocumentationDetails responseSchema(Schema schema) { return this; } - public RestDocumentation and() { - return RestDocumentation.this; + public RestDocumentationTest and() { + return RestDocumentationTest.this; } } diff --git a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/ScanProjectMockDataRestControllerRestDocTest.java b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/ScanProjectMockDataRestControllerRestDocTest.java index c3272643ae..b771db262b 100644 --- a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/ScanProjectMockDataRestControllerRestDocTest.java +++ b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/ScanProjectMockDataRestControllerRestDocTest.java @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT package com.mercedesbenz.sechub.restdoc; -import static com.mercedesbenz.sechub.restdoc.RestDocumentation.*; +import static com.mercedesbenz.sechub.restdoc.RestDocumentationTest.*; import static com.mercedesbenz.sechub.test.SecHubTestURLBuilder.*; import static org.mockito.Mockito.*; import static org.springframework.restdocs.headers.HeaderDocumentation.requestHeaders; @@ -78,14 +78,14 @@ public void set_project_mock_configuration() throws Exception { accept(MediaType.APPLICATION_JSON_VALUE). contentType(MediaType.APPLICATION_JSON_VALUE). content(config.toJSON()). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isOk()). andDo(defineRestService(). with(). useCaseData(useCase). tag(RestDocFactory.extractTag(apiEndpoint)). - requestSchema(OpenApiSchema.MOCK_DATA_CONFIGURATION.getSchema()). + requestSchema(TestOpenApiSchema.MOCK_DATA_CONFIGURATION.getSchema()). and(). document( requestHeaders( @@ -116,7 +116,7 @@ public void get_project_mock_configuration() throws Exception { get(apiEndpoint, PROJECT1_ID). accept(MediaType.APPLICATION_JSON_VALUE). contentType(MediaType.APPLICATION_JSON_VALUE). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isOk()). andExpect(jsonPath("$.codeScan.result").value("RED")). @@ -127,7 +127,7 @@ public void get_project_mock_configuration() throws Exception { with(). useCaseData(useCase). tag(RestDocFactory.extractTag(apiEndpoint)). - responseSchema(OpenApiSchema.MOCK_DATA_CONFIGURATION.getSchema()). + responseSchema(TestOpenApiSchema.MOCK_DATA_CONFIGURATION.getSchema()). and(). document( requestHeaders( diff --git a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/ScanReportRestControllerRestDocTest.java b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/ScanReportRestControllerRestDocTest.java index 67913f1ca7..ab666d9958 100644 --- a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/ScanReportRestControllerRestDocTest.java +++ b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/ScanReportRestControllerRestDocTest.java @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT package com.mercedesbenz.sechub.restdoc; -import static com.mercedesbenz.sechub.restdoc.RestDocumentation.*; +import static com.mercedesbenz.sechub.restdoc.RestDocumentationTest.*; import static com.mercedesbenz.sechub.test.RestDocPathParameter.*; import static com.mercedesbenz.sechub.test.SecHubTestURLBuilder.*; import static org.hamcrest.CoreMatchers.*; @@ -101,7 +101,7 @@ public void get_report_from_existing_job_returns_information_as_json_when_type_i get(apiEndpoint,PROJECT1_ID,jobUUID). accept(MediaType.APPLICATION_JSON_VALUE). contentType(MediaType.APPLICATION_JSON_VALUE). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isOk()). andExpect(content().json("{\"jobUUID\":\""+jobUUID.toString()+"\",\"result\":{\"count\":0,\"findings\":[]},\"trafficLight\":\"YELLOW\"}")). @@ -109,7 +109,7 @@ public void get_report_from_existing_job_returns_information_as_json_when_type_i with(). useCaseData(useCase, "JSON"). tag(RestDocFactory.extractTag(apiEndpoint)). - responseSchema(OpenApiSchema.SECHUB_REPORT.getSchema()). + responseSchema(TestOpenApiSchema.SECHUB_REPORT.getSchema()). and(). document( requestHeaders( @@ -151,7 +151,7 @@ public void get_report_from_existing_job_returns_information_as_html_when_type_i get(apiEndpoint,PROJECT1_ID,jobUUID). accept(MediaType.APPLICATION_XHTML_XML). contentType(MediaType.APPLICATION_JSON_VALUE). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isOk()). andExpect(content().contentType("text/html;charset=UTF-8")). @@ -162,7 +162,7 @@ public void get_report_from_existing_job_returns_information_as_html_when_type_i with(). useCaseData(useCase, "HTML"). tag(RestDocFactory.extractTag(apiEndpoint)). - responseSchema(OpenApiSchema.SECHUB_REPORT.getSchema()). + responseSchema(TestOpenApiSchema.SECHUB_REPORT.getSchema()). and(). document( requestHeaders( @@ -200,7 +200,7 @@ public void get_report_from_existing_job_returns_information_as_spdx_json_when_t get(apiEndpoint,PROJECT1_ID,jobUUID). accept(MediaType.APPLICATION_JSON_VALUE). contentType(MediaType.APPLICATION_JSON_VALUE). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isOk()). andExpect(content().json(spdxReport)). @@ -208,7 +208,7 @@ public void get_report_from_existing_job_returns_information_as_spdx_json_when_t with(). useCaseData(useCase, "JSON"). tag(RestDocFactory.extractTag(apiEndpoint)). - responseSchema(OpenApiSchema.SECHUB_REPORT.getSchema()). + responseSchema(TestOpenApiSchema.SECHUB_REPORT.getSchema()). and(). document( requestHeaders( diff --git a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/SchedulerAdministrationRestControllerRestDocTest.java b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/SchedulerAdministrationRestControllerRestDocTest.java index f87d1588d1..d5f698e4bd 100644 --- a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/SchedulerAdministrationRestControllerRestDocTest.java +++ b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/SchedulerAdministrationRestControllerRestDocTest.java @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT package com.mercedesbenz.sechub.restdoc; -import static com.mercedesbenz.sechub.restdoc.RestDocumentation.*; +import static com.mercedesbenz.sechub.restdoc.RestDocumentationTest.*; import static com.mercedesbenz.sechub.test.SecHubTestURLBuilder.*; import static org.springframework.restdocs.headers.HeaderDocumentation.requestHeaders; import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.*; @@ -73,7 +73,7 @@ public void restdoc_admin_triggers_refresh_scheduler_status() throws Exception { this.mockMvc.perform( post(apiEndpoint). contentType(MediaType.APPLICATION_JSON_VALUE). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isAccepted()). andDo(defineRestService(). @@ -101,7 +101,7 @@ public void restdoc_admin_disables_scheduler_job_processing() throws Exception { this.mockMvc.perform( post(apiEndpoint). contentType(MediaType.APPLICATION_JSON_VALUE). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isAccepted()). andDo(defineRestService(). @@ -129,7 +129,7 @@ public void restdoc_admin_enables_scheduler_job_processing() throws Exception { this.mockMvc.perform( post(https(PORT_USED).buildAdminEnablesSchedulerJobProcessing()). contentType(MediaType.APPLICATION_JSON_VALUE). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isAccepted()). andDo(defineRestService(). diff --git a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/SchedulerRestControllerRestDocTest.java b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/SchedulerRestControllerRestDocTest.java index 3ec02f1493..18b64ac3fc 100644 --- a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/SchedulerRestControllerRestDocTest.java +++ b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/SchedulerRestControllerRestDocTest.java @@ -4,7 +4,7 @@ import static com.mercedesbenz.sechub.commons.core.CommonConstants.*; import static com.mercedesbenz.sechub.commons.model.SecHubConfigurationModel.*; import static com.mercedesbenz.sechub.commons.model.TestSecHubConfigurationBuilder.configureSecHub; -import static com.mercedesbenz.sechub.restdoc.RestDocumentation.defineRestService; +import static com.mercedesbenz.sechub.restdoc.RestDocumentationTest.defineRestService; import static com.mercedesbenz.sechub.test.RestDocPathParameter.*; import static com.mercedesbenz.sechub.test.SecHubTestURLBuilder.https; import static org.mockito.ArgumentMatchers.*; @@ -156,8 +156,8 @@ public void restDoc_userCreatesNewJob_codescan() throws Exception { with(). useCaseData(useCase, VARIANT_CODE_SCAN). tag(RestDocFactory.extractTag(apiEndpoint)). - requestSchema(OpenApiSchema.SCAN_JOB.getSchema()). - responseSchema(OpenApiSchema.JOB_ID.getSchema()). + requestSchema(TestOpenApiSchema.SCAN_JOB.getSchema()). + responseSchema(TestOpenApiSchema.JOB_ID.getSchema()). and(). document( requestHeaders( @@ -227,8 +227,8 @@ public void restDoc_userCreatesNewJob_codescan_with_data_section() throws Except with(). useCaseData(useCase, VARIANT_CODES_SCAN_WITH_FULL_DATA_SECTION). tag(RestDocFactory.extractTag(apiEndpoint)). - requestSchema(OpenApiSchema.SCAN_JOB.getSchema()). - responseSchema(OpenApiSchema.JOB_ID.getSchema()). + requestSchema(TestOpenApiSchema.SCAN_JOB.getSchema()). + responseSchema(TestOpenApiSchema.JOB_ID.getSchema()). and(). document( requestHeaders( @@ -299,8 +299,8 @@ public void restDoc_userCreatesNewJob_secretscan_with_data_section() throws Exce with(). useCaseData(useCase, VARIANT_SECRET_SCAN). tag(RestDocFactory.extractTag(apiEndpoint)). - requestSchema(OpenApiSchema.SCAN_JOB.getSchema()). - responseSchema(OpenApiSchema.JOB_ID.getSchema()). + requestSchema(TestOpenApiSchema.SCAN_JOB.getSchema()). + responseSchema(TestOpenApiSchema.JOB_ID.getSchema()). and(). document( requestHeaders( @@ -367,8 +367,8 @@ public void restDoc_userCreatesNewJob_licensescan_with_data_section() throws Exc with(). useCaseData(useCase, VARIANT_LICENSE_SCAN). tag(RestDocFactory.extractTag(apiEndpoint)). - requestSchema(OpenApiSchema.SCAN_JOB.getSchema()). - responseSchema(OpenApiSchema.JOB_ID.getSchema()). + requestSchema(TestOpenApiSchema.SCAN_JOB.getSchema()). + responseSchema(TestOpenApiSchema.JOB_ID.getSchema()). and(). document( requestHeaders( @@ -426,8 +426,8 @@ public void restDoc_userCreatesNewJob_infrascan() throws Exception { with(). useCaseData(useCase, VARIANT_INFRASTRUCTURE_SCAN). tag(RestDocFactory.extractTag(apiEndpoint)). - requestSchema(OpenApiSchema.SCAN_JOB.getSchema()). - responseSchema(OpenApiSchema.JOB_ID.getSchema()). + requestSchema(TestOpenApiSchema.SCAN_JOB.getSchema()). + responseSchema(TestOpenApiSchema.JOB_ID.getSchema()). and(). document( requestHeaders( @@ -491,8 +491,8 @@ public void restDoc_userCreatesNewJob_webscan_anonymous() throws Exception { with(). useCaseData(useCase, "Web Scan anonymous"). tag(RestDocFactory.extractTag(apiEndpoint)). - requestSchema(OpenApiSchema.SCAN_JOB.getSchema()). - responseSchema(OpenApiSchema.JOB_ID.getSchema()). + requestSchema(TestOpenApiSchema.SCAN_JOB.getSchema()). + responseSchema(TestOpenApiSchema.JOB_ID.getSchema()). and(). document( requestHeaders( @@ -555,8 +555,8 @@ public void restDoc_userCreatesNewJob_webscan_with_api_definition() throws Excep with(). useCaseData(useCase, VARIANT_WEB_SCAN_WITH_API_DEFINITION). tag(RestDocFactory.extractTag(apiEndpoint)). - requestSchema(OpenApiSchema.SCAN_JOB.getSchema()). - responseSchema(OpenApiSchema.JOB_ID.getSchema()). + requestSchema(TestOpenApiSchema.SCAN_JOB.getSchema()). + responseSchema(TestOpenApiSchema.JOB_ID.getSchema()). and(). document( requestHeaders( @@ -615,8 +615,8 @@ public void restDoc_userCreatesNewJob_webscan_with_client_certificate_definition with(). useCaseData(useCase, VARIANT_WEB_SCAN_WITH_CLIENT_CERTIFICATE_DEFINITION). tag(RestDocFactory.extractTag(apiEndpoint)). - requestSchema(OpenApiSchema.SCAN_JOB.getSchema()). - responseSchema(OpenApiSchema.JOB_ID.getSchema()). + requestSchema(TestOpenApiSchema.SCAN_JOB.getSchema()). + responseSchema(TestOpenApiSchema.JOB_ID.getSchema()). and(). document( requestHeaders( @@ -670,8 +670,8 @@ public void restDoc_userCreatesNewJob_webscan_login_basic() throws Exception { with(). useCaseData(useCase, VARIANT_WEB_SCAN_LOGIN_BASIC). tag(RestDocFactory.extractTag(apiEndpoint)). - requestSchema(OpenApiSchema.SCAN_JOB.getSchema()). - responseSchema(OpenApiSchema.JOB_ID.getSchema()). + requestSchema(TestOpenApiSchema.SCAN_JOB.getSchema()). + responseSchema(TestOpenApiSchema.JOB_ID.getSchema()). and(). document( requestHeaders( @@ -762,8 +762,8 @@ public void restDoc_userCreatesNewJob_webScan_login_form_script_and_totp_as_seco with(). useCaseData(useCase, VARIANT_WEB_SCAN_LOGIN_FORM_SCRIPTED). tag(RestDocFactory.extractTag(apiEndpoint)). - requestSchema(OpenApiSchema.SCAN_JOB.getSchema()). - responseSchema(OpenApiSchema.JOB_ID.getSchema()). + requestSchema(TestOpenApiSchema.SCAN_JOB.getSchema()). + responseSchema(TestOpenApiSchema.JOB_ID.getSchema()). and(). document( requestHeaders( @@ -840,8 +840,8 @@ public void restDoc_userCreatesNewJob_webscan_with_headers() throws Exception { with(). useCaseData(useCase, VARIANT_WEB_SCAN_HEADERS). tag(RestDocFactory.extractTag(apiEndpoint)). - requestSchema(OpenApiSchema.SCAN_JOB.getSchema()). - responseSchema(OpenApiSchema.JOB_ID.getSchema()). + requestSchema(TestOpenApiSchema.SCAN_JOB.getSchema()). + responseSchema(TestOpenApiSchema.JOB_ID.getSchema()). and(). document( pathParameters( @@ -1067,7 +1067,7 @@ public UUID getUUID() { with(). useCaseData(useCase). tag(RestDocFactory.extractTag(apiEndpoint)). - responseSchema(OpenApiSchema.JOB_STATUS.getSchema()). + responseSchema(TestOpenApiSchema.JOB_STATUS.getSchema()). and(). document( requestHeaders( @@ -1140,7 +1140,7 @@ public void restDoc_userListsJobsForProject() throws Exception { with(). useCaseData(useCase). tag(RestDocFactory.extractTag(apiEndpoint)). - responseSchema(OpenApiSchema.PROJECT_JOB_LIST.getSchema()). + responseSchema(TestOpenApiSchema.PROJECT_JOB_LIST.getSchema()). and(). document( requestHeaders( diff --git a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/ServerInfoAdministrationRestControllerRestDocTest.java b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/ServerInfoAdministrationRestControllerRestDocTest.java index 8ad177272a..6c7b148bae 100644 --- a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/ServerInfoAdministrationRestControllerRestDocTest.java +++ b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/ServerInfoAdministrationRestControllerRestDocTest.java @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT package com.mercedesbenz.sechub.restdoc; -import static com.mercedesbenz.sechub.restdoc.RestDocumentation.defineRestService; +import static com.mercedesbenz.sechub.restdoc.RestDocumentationTest.defineRestService; import static com.mercedesbenz.sechub.test.SecHubTestURLBuilder.https; import static org.mockito.Mockito.when; import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.get; @@ -73,7 +73,7 @@ public void restdoc_admin_get_server_version_as_Json() throws Exception { this.mockMvc.perform( get(apiEndpoint). contentType(MediaType.APPLICATION_JSON). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isOk()). andExpect(content().string(expectedContent)). @@ -81,7 +81,7 @@ public void restdoc_admin_get_server_version_as_Json() throws Exception { with(). useCaseData(useCase). tag(RestDocFactory.extractTag(apiEndpoint)). - responseSchema(OpenApiSchema.SERVER_RUNTIME_DATA.getSchema()). + responseSchema(TestOpenApiSchema.SERVER_RUNTIME_DATA.getSchema()). and(). document( responseFields( diff --git a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/SignupAdministrationRestControllerRestDocTest.java b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/SignupAdministrationRestControllerRestDocTest.java index db7eba9903..d606901777 100644 --- a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/SignupAdministrationRestControllerRestDocTest.java +++ b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/SignupAdministrationRestControllerRestDocTest.java @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT package com.mercedesbenz.sechub.restdoc; -import static com.mercedesbenz.sechub.restdoc.RestDocumentation.*; +import static com.mercedesbenz.sechub.restdoc.RestDocumentationTest.*; import static com.mercedesbenz.sechub.test.RestDocPathParameter.*; import static com.mercedesbenz.sechub.test.SecHubTestURLBuilder.*; import static org.mockito.Mockito.*; @@ -93,7 +93,7 @@ public void restdoc_list_user_signups() throws Exception { /* execute + test @formatter:off */ this.mockMvc.perform( get(apiEndpoint). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isOk()). andExpect(content().json("[{\"userId\":\"johnsmith\",\"emailAddress\":\"john.smith@example.com\"},{\"userId\":\"janesmith\",\"emailAddress\":\"jane.smith@example.com\"}]")). @@ -101,7 +101,7 @@ public void restdoc_list_user_signups() throws Exception { with(). useCaseData(useCase). tag(RestDocFactory.extractTag(apiEndpoint)). - responseSchema(OpenApiSchema.SIGNUP_LIST.getSchema()). + responseSchema(TestOpenApiSchema.SIGNUP_LIST.getSchema()). and(). document( requestHeaders( @@ -128,7 +128,7 @@ public void restdoc_delete_signup() throws Exception { /* execute + test @formatter:off */ this.mockMvc.perform( delete(apiEndpoint,"userId1"). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isOk()). andDo(defineRestService(). diff --git a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/StatusAdministrationRestControllerRestDocTest.java b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/StatusAdministrationRestControllerRestDocTest.java index 3c4d476e66..b9f4a826ed 100644 --- a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/StatusAdministrationRestControllerRestDocTest.java +++ b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/StatusAdministrationRestControllerRestDocTest.java @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT package com.mercedesbenz.sechub.restdoc; -import static com.mercedesbenz.sechub.restdoc.RestDocumentation.*; +import static com.mercedesbenz.sechub.restdoc.RestDocumentationTest.*; import static com.mercedesbenz.sechub.test.RestDocPathParameter.*; import static com.mercedesbenz.sechub.test.SecHubTestURLBuilder.*; import static org.mockito.Mockito.*; @@ -92,7 +92,7 @@ public void restdoc_admin_fetches_mapping_configuration() throws Exception { this.mockMvc.perform( get(apiEndpoint, MappingIdentifier.CHECKMARX_NEWPROJECT_TEAM_ID.getId()). contentType(MediaType.APPLICATION_JSON_VALUE). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) )./* */ andDo(print()). @@ -101,7 +101,7 @@ public void restdoc_admin_fetches_mapping_configuration() throws Exception { with(). useCaseData(useCase). tag(RestDocFactory.extractTag(apiEndpoint)). - responseSchema(OpenApiSchema.MAPPING_CONFIGURATION.getSchema()). + responseSchema(TestOpenApiSchema.MAPPING_CONFIGURATION.getSchema()). and(). document( requestHeaders( @@ -132,7 +132,7 @@ public void restdoc_admin_updates_mapping_configuration() throws Exception { put(apiEndpoint, MappingIdentifier.CHECKMARX_NEWPROJECT_TEAM_ID.getId()). contentType(MediaType.APPLICATION_JSON_VALUE). content(mappingDataTeam.toJSON()). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) )./* */ andDo(print()). @@ -141,7 +141,7 @@ public void restdoc_admin_updates_mapping_configuration() throws Exception { with(). useCaseData(useCase). tag(RestDocFactory.extractTag(apiEndpoint)). - requestSchema(OpenApiSchema.MAPPING_CONFIGURATION.getSchema()). + requestSchema(TestOpenApiSchema.MAPPING_CONFIGURATION.getSchema()). and(). document( requestHeaders( diff --git a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/TemplateRestControllerRestDocTest.java b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/TemplateRestControllerRestDocTest.java index f9e84c6f30..bb1fbff5f6 100644 --- a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/TemplateRestControllerRestDocTest.java +++ b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/TemplateRestControllerRestDocTest.java @@ -2,7 +2,7 @@ package com.mercedesbenz.sechub.restdoc; import static com.mercedesbenz.sechub.commons.model.template.TemplateDefinition.*; -import static com.mercedesbenz.sechub.restdoc.RestDocumentation.*; +import static com.mercedesbenz.sechub.restdoc.RestDocumentationTest.*; import static com.mercedesbenz.sechub.test.RestDocPathParameter.*; import static com.mercedesbenz.sechub.test.SecHubTestURLBuilder.*; import static org.mockito.Mockito.*; @@ -124,14 +124,14 @@ public void restdoc_admin_creates_or_updates_template() throws Exception { put(apiEndpoint, TEST_TEMPLATE_ID1). contentType(MediaType.APPLICATION_JSON_VALUE). content(content). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isOk()). andDo(defineRestService(). with(). useCaseData(useCase). tag(RestDocFactory.extractTag(apiEndpoint)). - requestSchema(OpenApiSchema.TEMPLATES.getSchema()). + requestSchema(TestOpenApiSchema.TEMPLATES.getSchema()). and(). document( requestFields( @@ -164,14 +164,14 @@ public void restdoc_admin_deletes_template() throws Exception { this.mockMvc.perform( delete(apiEndpoint, TEST_TEMPLATE_ID1). contentType(MediaType.APPLICATION_JSON_VALUE). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isOk()). andDo(defineRestService(). with(). useCaseData(useCase). tag(RestDocFactory.extractTag(apiEndpoint)). - requestSchema(OpenApiSchema.TEMPLATES.getSchema()). + requestSchema(TestOpenApiSchema.TEMPLATES.getSchema()). and(). document( pathParameters( @@ -197,14 +197,14 @@ public void restdoc_admin_fetches_template() throws Exception { this.mockMvc.perform( get(apiEndpoint, TEST_TEMPLATE_ID1). contentType(MediaType.APPLICATION_JSON_VALUE). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isOk()). andDo(defineRestService(). with(). useCaseData(useCase). tag(RestDocFactory.extractTag(apiEndpoint)). - requestSchema(OpenApiSchema.TEMPLATES.getSchema()). + requestSchema(TestOpenApiSchema.TEMPLATES.getSchema()). and(). document( responseFields( @@ -240,14 +240,14 @@ public void restdoc_admin_fetches_templatelist() throws Exception { this.mockMvc.perform( get(apiEndpoint, TEST_TEMPLATE_ID1). contentType(MediaType.APPLICATION_JSON_VALUE). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isOk()). andDo(defineRestService(). with(). useCaseData(useCase). tag(RestDocFactory.extractTag(apiEndpoint)). - requestSchema(OpenApiSchema.TEMPLATES.getSchema()). + requestSchema(TestOpenApiSchema.TEMPLATES.getSchema()). and(). document( responseFields( diff --git a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/AuthenticationHelper.java b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/TestAuthenticationHelper.java similarity index 92% rename from sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/AuthenticationHelper.java rename to sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/TestAuthenticationHelper.java index 872d2da1e3..0f4d303f1d 100644 --- a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/AuthenticationHelper.java +++ b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/TestAuthenticationHelper.java @@ -3,7 +3,7 @@ import java.util.Base64; -public class AuthenticationHelper { +public class TestAuthenticationHelper { public static final String HEADER_NAME = "Authorization"; public static final String HEADER_DESCRIPTION = "Basic authentication credentials"; private static final String USER_TOKEN = "user:secret"; diff --git a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/OpenApiSchema.java b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/TestOpenApiSchema.java similarity index 95% rename from sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/OpenApiSchema.java rename to sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/TestOpenApiSchema.java index b2ddd75914..867f6f07ad 100644 --- a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/OpenApiSchema.java +++ b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/TestOpenApiSchema.java @@ -3,7 +3,7 @@ import com.epages.restdocs.apispec.Schema; -enum OpenApiSchema { +enum TestOpenApiSchema { MAPPING_CONFIGURATION("MappingConfiguration"), JOB_STATUS("JobStatus"), @@ -72,7 +72,7 @@ enum OpenApiSchema { private final Schema schema; - private OpenApiSchema(String schemaName) { + private TestOpenApiSchema(String schemaName) { schema = new Schema(schemaName); } diff --git a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/UserAdministrationRestControllerRestDocTest.java b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/UserAdministrationRestControllerRestDocTest.java index 15f074a33d..f0d37529f8 100644 --- a/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/UserAdministrationRestControllerRestDocTest.java +++ b/sechub-doc/src/test/java/com/mercedesbenz/sechub/restdoc/UserAdministrationRestControllerRestDocTest.java @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT package com.mercedesbenz.sechub.restdoc; -import static com.mercedesbenz.sechub.restdoc.RestDocumentation.*; +import static com.mercedesbenz.sechub.restdoc.RestDocumentationTest.*; import static com.mercedesbenz.sechub.test.RestDocPathParameter.*; import static com.mercedesbenz.sechub.test.SecHubTestURLBuilder.*; import static org.mockito.Mockito.*; @@ -113,7 +113,7 @@ public void restdoc_admin_updates_user_email_address() throws Exception { /* execute + test @formatter:off */ this.mockMvc.perform( put(apiEndpoint, USER_ID, EMAIL_ADDRESS). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isOk()). andDo(defineRestService(). @@ -145,7 +145,7 @@ public void restdoc_grant_admin_rights_to_user() throws Exception { /* execute + test @formatter:off */ this.mockMvc.perform( post(apiEndpoint, RestDocPathParameter.USER_ID). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isOk()). andDo(defineRestService(). @@ -174,7 +174,7 @@ public void restdoc_revoke_admin_rights_from_user() throws Exception { /* execute + test @formatter:off */ this.mockMvc.perform( post(apiEndpoint,RestDocPathParameter.USER_ID). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isOk()). andDo(defineRestService(). @@ -204,7 +204,7 @@ public void restdoc_delete_user() throws Exception { /* execute + test @formatter:off */ this.mockMvc.perform( delete(apiEndpoint, RestDocPathParameter.USER_ID). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isOk()). andDo(defineRestService(). @@ -234,7 +234,7 @@ public void restdoc_accept_user_signup() throws Exception { /* execute + test @formatter:off */ this.mockMvc.perform( post(apiEndpoint, "user1"). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isCreated()). andDo(defineRestService(). @@ -271,14 +271,14 @@ public void restdoc_list_all_users() throws Exception { /* execute + test @formatter:off */ this.mockMvc.perform( get(apiEndpoint). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isOk()). andDo(defineRestService(). with(). useCaseData(useCase). tag(RestDocFactory.extractTag(apiEndpoint)). - responseSchema(OpenApiSchema.USER_LIST.getSchema()). + responseSchema(TestOpenApiSchema.USER_LIST.getSchema()). and(). document( responseFields( @@ -305,14 +305,14 @@ public void restdoc_list_all_admins() throws Exception { /* execute + test @formatter:off */ this.mockMvc.perform( get(apiEndpoint). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isOk()). andDo(defineRestService(). with(). useCaseData(useCase). tag(RestDocFactory.extractTag(apiEndpoint)). - responseSchema(OpenApiSchema.USER_LIST.getSchema()). + responseSchema(TestOpenApiSchema.USER_LIST.getSchema()). and(). document( requestHeaders( @@ -349,14 +349,14 @@ public void restdoc_show_user_details() throws Exception { /* execute + test @formatter:off */ this.mockMvc.perform( get(apiEndpoint, "user1"). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isOk()). andDo(defineRestService(). with(). useCaseData(useCase). tag(RestDocFactory.extractTag(apiEndpoint)). - responseSchema(OpenApiSchema.USER_DETAILS.getSchema()). + responseSchema(TestOpenApiSchema.USER_DETAILS.getSchema()). and(). document( requestHeaders( @@ -405,18 +405,18 @@ public void restdoc_show_user_details_for_email_address() throws Exception { /* execute + test @formatter:off */ this.mockMvc.perform( get(apiEndpoint, emailAddress). - header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue()) + header(TestAuthenticationHelper.HEADER_NAME, TestAuthenticationHelper.getHeaderValue()) ). andExpect(status().isOk()). andDo(defineRestService(). with(). useCaseData(useCase). tag(RestDocFactory.extractTag(apiEndpoint)). - responseSchema(OpenApiSchema.USER_DETAILS.getSchema()). + responseSchema(TestOpenApiSchema.USER_DETAILS.getSchema()). and(). document( requestHeaders( - headerWithName(AuthenticationHelper.HEADER_NAME).description(AuthenticationHelper.HEADER_DESCRIPTION) + headerWithName(TestAuthenticationHelper.HEADER_NAME).description(TestAuthenticationHelper.HEADER_DESCRIPTION) ), pathParameters( parameterWithName(EMAIL_ADDRESS.paramName()).description("The email address of user to show details for") diff --git a/sechub-integrationtest/src/test/java/com/mercedesbenz/sechub/integrationtest/SecurityTestHelperTest.java b/sechub-integrationtest/src/test/java/com/mercedesbenz/sechub/integrationtest/SecurityTestHelperTest.java index 6d5264b561..10622932d7 100644 --- a/sechub-integrationtest/src/test/java/com/mercedesbenz/sechub/integrationtest/SecurityTestHelperTest.java +++ b/sechub-integrationtest/src/test/java/com/mercedesbenz/sechub/integrationtest/SecurityTestHelperTest.java @@ -10,9 +10,9 @@ import org.junit.jupiter.params.provider.CsvSource; import com.mercedesbenz.sechub.integrationtest.SecurityTestHelper.TestTargetType; -import com.mercedesbenz.sechub.integrationtest.api.OnlyForRegularTestExecution; +import com.mercedesbenz.sechub.integrationtest.api.TestOnlyForRegularExecution; -@OnlyForRegularTestExecution +@TestOnlyForRegularExecution class SecurityTestHelperTest { private SecurityTestHelper helperToTest; diff --git a/sechub-integrationtest/src/test/java/com/mercedesbenz/sechub/integrationtest/api/AssertUserTest.java b/sechub-integrationtest/src/test/java/com/mercedesbenz/sechub/integrationtest/api/AssertUserTest.java index c7ffc71185..778da01672 100644 --- a/sechub-integrationtest/src/test/java/com/mercedesbenz/sechub/integrationtest/api/AssertUserTest.java +++ b/sechub-integrationtest/src/test/java/com/mercedesbenz/sechub/integrationtest/api/AssertUserTest.java @@ -8,7 +8,7 @@ import com.mercedesbenz.sechub.test.ExampleConstants; -@OnlyForRegularTestExecution +@TestOnlyForRegularExecution class AssertUserTest { private TestProject project; diff --git a/sechub-integrationtest/src/test/java/com/mercedesbenz/sechub/integrationtest/api/JsonErrorFieldNamesAvailableHttpStatusExceptionTestValidatorTest.java b/sechub-integrationtest/src/test/java/com/mercedesbenz/sechub/integrationtest/api/JsonErrorFieldNamesAvailableHttpStatusExceptionTestValidatorTest.java index 69f1587de1..43a308e990 100644 --- a/sechub-integrationtest/src/test/java/com/mercedesbenz/sechub/integrationtest/api/JsonErrorFieldNamesAvailableHttpStatusExceptionTestValidatorTest.java +++ b/sechub-integrationtest/src/test/java/com/mercedesbenz/sechub/integrationtest/api/JsonErrorFieldNamesAvailableHttpStatusExceptionTestValidatorTest.java @@ -8,7 +8,7 @@ import org.springframework.http.HttpStatus; import org.springframework.web.client.HttpStatusCodeException; -@OnlyForRegularTestExecution +@TestOnlyForRegularExecution class JsonErrorFieldNamesAvailableHttpStatusExceptionTestValidatorTest { @Test diff --git a/sechub-integrationtest/src/test/java/com/mercedesbenz/sechub/integrationtest/api/OnlyForRegularTestExecution.java b/sechub-integrationtest/src/test/java/com/mercedesbenz/sechub/integrationtest/api/TestOnlyForRegularExecution.java similarity index 94% rename from sechub-integrationtest/src/test/java/com/mercedesbenz/sechub/integrationtest/api/OnlyForRegularTestExecution.java rename to sechub-integrationtest/src/test/java/com/mercedesbenz/sechub/integrationtest/api/TestOnlyForRegularExecution.java index 061f977abb..95f719dc0e 100644 --- a/sechub-integrationtest/src/test/java/com/mercedesbenz/sechub/integrationtest/api/OnlyForRegularTestExecution.java +++ b/sechub-integrationtest/src/test/java/com/mercedesbenz/sechub/integrationtest/api/TestOnlyForRegularExecution.java @@ -42,7 +42,7 @@ *
  • When setting system property * {@value IntegrationTestSetup#SECHUB_INTEGRATIONTEST_ONLY_NECESSARY_TESTS_FOR_DOCUMENTATION} * to "true", the integration tests for documentation only will be executed by - * {@link IntegrationTestSetup. The marked tests will be always skipped.
  • + * {@link IntegrationTestSetup The marked tests will be always skipped. * * * @author Albert Tregnaghi @@ -50,6 +50,6 @@ */ @DisabledIfSystemProperty(named = IntegrationTestSetup.SECHUB_INTEGRATIONTEST_ONLY_NECESSARY_TESTS_FOR_DOCUMENTATION, matches = "true") @Retention(RetentionPolicy.RUNTIME) -public @interface OnlyForRegularTestExecution { +public @interface TestOnlyForRegularExecution { } diff --git a/sechub-integrationtest/src/test/java/com/mercedesbenz/sechub/integrationtest/internal/AbstractGrowingSecHubServerTestScenarioTest.java b/sechub-integrationtest/src/test/java/com/mercedesbenz/sechub/integrationtest/internal/AbstractGrowingSecHubServerTestScenarioTest.java index 9ec5d59a95..01282b390f 100644 --- a/sechub-integrationtest/src/test/java/com/mercedesbenz/sechub/integrationtest/internal/AbstractGrowingSecHubServerTestScenarioTest.java +++ b/sechub-integrationtest/src/test/java/com/mercedesbenz/sechub/integrationtest/internal/AbstractGrowingSecHubServerTestScenarioTest.java @@ -5,9 +5,9 @@ import org.junit.jupiter.api.Test; -import com.mercedesbenz.sechub.integrationtest.api.OnlyForRegularTestExecution; +import com.mercedesbenz.sechub.integrationtest.api.TestOnlyForRegularExecution; -@OnlyForRegularTestExecution +@TestOnlyForRegularExecution public class AbstractGrowingSecHubServerTestScenarioTest { @Test diff --git a/sechub-integrationtest/src/test/java/com/mercedesbenz/sechub/integrationtest/internal/MockDataTest.java b/sechub-integrationtest/src/test/java/com/mercedesbenz/sechub/integrationtest/internal/MockDataTest.java index fa8e99f806..c9bd75d93e 100644 --- a/sechub-integrationtest/src/test/java/com/mercedesbenz/sechub/integrationtest/internal/MockDataTest.java +++ b/sechub-integrationtest/src/test/java/com/mercedesbenz/sechub/integrationtest/internal/MockDataTest.java @@ -5,9 +5,9 @@ import org.junit.jupiter.api.Test; -import com.mercedesbenz.sechub.integrationtest.api.OnlyForRegularTestExecution; +import com.mercedesbenz.sechub.integrationtest.api.TestOnlyForRegularExecution; -@OnlyForRegularTestExecution +@TestOnlyForRegularExecution class MockDataTest { @Test diff --git a/sechub-integrationtest/src/test/java/com/mercedesbenz/sechub/integrationtest/internal/MockedAdapterSetupAccessTest.java b/sechub-integrationtest/src/test/java/com/mercedesbenz/sechub/integrationtest/internal/MockedAdapterSetupAccessTest.java index a425dc9ebe..78c4aa43f0 100644 --- a/sechub-integrationtest/src/test/java/com/mercedesbenz/sechub/integrationtest/internal/MockedAdapterSetupAccessTest.java +++ b/sechub-integrationtest/src/test/java/com/mercedesbenz/sechub/integrationtest/internal/MockedAdapterSetupAccessTest.java @@ -5,9 +5,9 @@ import org.junit.jupiter.api.Test; -import com.mercedesbenz.sechub.integrationtest.api.OnlyForRegularTestExecution; +import com.mercedesbenz.sechub.integrationtest.api.TestOnlyForRegularExecution; -@OnlyForRegularTestExecution +@TestOnlyForRegularExecution class MockedAdapterSetupAccessTest { @Test diff --git a/sechub-integrationtest/src/test/java/com/mercedesbenz/sechub/integrationtest/internal/PersistentScenarioTestDataProviderTest.java b/sechub-integrationtest/src/test/java/com/mercedesbenz/sechub/integrationtest/internal/PersistentScenarioTestDataProviderTest.java index e85a8f25e3..d6692a6a1a 100644 --- a/sechub-integrationtest/src/test/java/com/mercedesbenz/sechub/integrationtest/internal/PersistentScenarioTestDataProviderTest.java +++ b/sechub-integrationtest/src/test/java/com/mercedesbenz/sechub/integrationtest/internal/PersistentScenarioTestDataProviderTest.java @@ -6,10 +6,10 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import com.mercedesbenz.sechub.integrationtest.api.OnlyForRegularTestExecution; +import com.mercedesbenz.sechub.integrationtest.api.TestOnlyForRegularExecution; import com.mercedesbenz.sechub.test.TestUtil; -@OnlyForRegularTestExecution +@TestOnlyForRegularExecution class PersistentScenarioTestDataProviderTest { private PersistentScenarioTestDataProvider providerToTest; diff --git a/sechub-integrationtest/src/test/java/com/mercedesbenz/sechub/integrationtest/internal/SecHubReportFileNameFilterTest.java b/sechub-integrationtest/src/test/java/com/mercedesbenz/sechub/integrationtest/internal/SecHubReportFileNameFilterTest.java index 7e65e324be..65ce0c6b5a 100644 --- a/sechub-integrationtest/src/test/java/com/mercedesbenz/sechub/integrationtest/internal/SecHubReportFileNameFilterTest.java +++ b/sechub-integrationtest/src/test/java/com/mercedesbenz/sechub/integrationtest/internal/SecHubReportFileNameFilterTest.java @@ -8,9 +8,9 @@ import org.junit.jupiter.api.Test; -import com.mercedesbenz.sechub.integrationtest.api.OnlyForRegularTestExecution; +import com.mercedesbenz.sechub.integrationtest.api.TestOnlyForRegularExecution; -@OnlyForRegularTestExecution +@TestOnlyForRegularExecution public class SecHubReportFileNameFilterTest { @Test diff --git a/sechub-integrationtest/src/test/java/com/mercedesbenz/sechub/integrationtest/internal/SharedFunctionScriptTest.java b/sechub-integrationtest/src/test/java/com/mercedesbenz/sechub/integrationtest/internal/SharedFunctionScriptTest.java index b30527b6a3..f8ca6921a0 100644 --- a/sechub-integrationtest/src/test/java/com/mercedesbenz/sechub/integrationtest/internal/SharedFunctionScriptTest.java +++ b/sechub-integrationtest/src/test/java/com/mercedesbenz/sechub/integrationtest/internal/SharedFunctionScriptTest.java @@ -9,9 +9,9 @@ import org.junit.jupiter.api.Test; -import com.mercedesbenz.sechub.integrationtest.api.OnlyForRegularTestExecution; +import com.mercedesbenz.sechub.integrationtest.api.TestOnlyForRegularExecution; -@OnlyForRegularTestExecution +@TestOnlyForRegularExecution class SharedFunctionScriptTest { private Process process; diff --git a/sechub-integrationtest/src/test/java/com/mercedesbenz/sechub/integrationtest/security/SSLContextSanityTest.java b/sechub-integrationtest/src/test/java/com/mercedesbenz/sechub/integrationtest/security/SSLContextSanityTest.java index 6c5d42c1f4..3f0866ffa2 100644 --- a/sechub-integrationtest/src/test/java/com/mercedesbenz/sechub/integrationtest/security/SSLContextSanityTest.java +++ b/sechub-integrationtest/src/test/java/com/mercedesbenz/sechub/integrationtest/security/SSLContextSanityTest.java @@ -9,9 +9,9 @@ import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; -import com.mercedesbenz.sechub.integrationtest.api.OnlyForRegularTestExecution; +import com.mercedesbenz.sechub.integrationtest.api.TestOnlyForRegularExecution; -@OnlyForRegularTestExecution +@TestOnlyForRegularExecution class SSLContextSanityTest { @Test diff --git a/sechub-pds/src/test/java/com/mercedesbenz/sechub/pds/execution/PDSExecutionServiceTest.java b/sechub-pds/src/test/java/com/mercedesbenz/sechub/pds/execution/PDSExecutionServiceTest.java index 5ae3867ae0..0bb7870986 100644 --- a/sechub-pds/src/test/java/com/mercedesbenz/sechub/pds/execution/PDSExecutionServiceTest.java +++ b/sechub-pds/src/test/java/com/mercedesbenz/sechub/pds/execution/PDSExecutionServiceTest.java @@ -24,9 +24,9 @@ import com.mercedesbenz.sechub.pds.job.PDSCheckJobStatusService; import com.mercedesbenz.sechub.pds.job.PDSJob; import com.mercedesbenz.sechub.pds.job.PDSJobRepository; -import com.mercedesbenz.sechub.pds.job.PDSJobTestHelper; import com.mercedesbenz.sechub.pds.job.PDSJobTransactionService; import com.mercedesbenz.sechub.pds.job.PDSWorkspaceService; +import com.mercedesbenz.sechub.pds.job.TestPDSJobHelper; public class PDSExecutionServiceTest { @@ -84,15 +84,15 @@ void predestroy_sets_all_jobs_in_queue_back_to_state_ready() { serviceToTest.queueMax = 5; serviceToTest.postConstruct(); // simulate spring boot container... UUID uuid1 = UUID.randomUUID(); - PDSJob job1 = PDSJobTestHelper.createTestJobStartedNowCreated3SecondsBefore(uuid1); + PDSJob job1 = TestPDSJobHelper.createTestJobStartedNowCreated3SecondsBefore(uuid1); TestPDSExecutionCallable callable1 = createTestCallable(uuid1, 500, result1); UUID uuid2 = UUID.randomUUID(); - PDSJob job2 = PDSJobTestHelper.createTestJobStartedNowCreated3SecondsBefore(uuid2); + PDSJob job2 = TestPDSJobHelper.createTestJobStartedNowCreated3SecondsBefore(uuid2); TestPDSExecutionCallable callable2 = createTestCallable(uuid2, 500, result1); UUID uuid3 = UUID.randomUUID(); - PDSJob job3 = PDSJobTestHelper.createTestJobStartedNowCreated3SecondsBefore(uuid3); + PDSJob job3 = TestPDSJobHelper.createTestJobStartedNowCreated3SecondsBefore(uuid3); TestPDSExecutionCallable callable3 = createTestCallable(uuid3, 500, result1); when(executionCallableFactory.createCallable(uuid1)).thenReturn(callable1); @@ -162,15 +162,15 @@ void adding_jobs_to_queue_status_contains_expected_values() throws Exception { serviceToTest.queueMax = 5; serviceToTest.postConstruct(); // simulate spring boot container... UUID uuid1 = UUID.randomUUID(); - PDSJob job1 = PDSJobTestHelper.createTestJobStartedNowCreated3SecondsBefore(uuid1); + PDSJob job1 = TestPDSJobHelper.createTestJobStartedNowCreated3SecondsBefore(uuid1); TestPDSExecutionCallable callable1 = createTestCallable(uuid1, 0, result1); UUID uuid2 = UUID.randomUUID(); - PDSJob job2 = PDSJobTestHelper.createTestJobStartedNowCreated3SecondsBefore(uuid2); + PDSJob job2 = TestPDSJobHelper.createTestJobStartedNowCreated3SecondsBefore(uuid2); TestPDSExecutionCallable callable2 = createTestCallable(uuid2, 500, result1); UUID uuid3 = UUID.randomUUID(); - PDSJob job3 = PDSJobTestHelper.createTestJobStartedNowCreated3SecondsBefore(uuid3); + PDSJob job3 = TestPDSJobHelper.createTestJobStartedNowCreated3SecondsBefore(uuid3); TestPDSExecutionCallable callable3 = createTestCallable(uuid3, 500, result1); when(executionCallableFactory.createCallable(uuid1)).thenReturn(callable1); diff --git a/sechub-pds/src/test/java/com/mercedesbenz/sechub/pds/job/PDSJobTestHelper.java b/sechub-pds/src/test/java/com/mercedesbenz/sechub/pds/job/TestPDSJobHelper.java similarity index 95% rename from sechub-pds/src/test/java/com/mercedesbenz/sechub/pds/job/PDSJobTestHelper.java rename to sechub-pds/src/test/java/com/mercedesbenz/sechub/pds/job/TestPDSJobHelper.java index e843b7357c..8669c2f325 100644 --- a/sechub-pds/src/test/java/com/mercedesbenz/sechub/pds/job/PDSJobTestHelper.java +++ b/sechub-pds/src/test/java/com/mercedesbenz/sechub/pds/job/TestPDSJobHelper.java @@ -6,7 +6,7 @@ import com.mercedesbenz.sechub.commons.pds.data.PDSJobStatusState; -public class PDSJobTestHelper { +public class TestPDSJobHelper { /** * Creates a pds test job - started now, created 3 seconds before. State is diff --git a/sechub-pds/src/test/java/com/mercedesbenz/sechub/pds/monitoring/PDSAdminMonitoringRestControllerMockTest.java b/sechub-pds/src/test/java/com/mercedesbenz/sechub/pds/monitoring/PDSAdminMonitoringRestControllerMockTest.java index 977654cd02..2bca654c01 100644 --- a/sechub-pds/src/test/java/com/mercedesbenz/sechub/pds/monitoring/PDSAdminMonitoringRestControllerMockTest.java +++ b/sechub-pds/src/test/java/com/mercedesbenz/sechub/pds/monitoring/PDSAdminMonitoringRestControllerMockTest.java @@ -52,7 +52,7 @@ public class PDSAdminMonitoringRestControllerMockTest { @BeforeEach public void beforeEach() throws Exception { /* prepare */ - result = PDSMonitoringTestDataUtil.createTestMonitoringWith2ClusterMembers(); + result = TestPDSMonitoringDataUtil.createTestMonitoringWith2ClusterMembers(); } @Test diff --git a/sechub-pds/src/test/java/com/mercedesbenz/sechub/pds/monitoring/PDSMonitoringStatusServiceTest.java b/sechub-pds/src/test/java/com/mercedesbenz/sechub/pds/monitoring/PDSMonitoringStatusServiceTest.java index d55b727e8e..2d4195bae3 100644 --- a/sechub-pds/src/test/java/com/mercedesbenz/sechub/pds/monitoring/PDSMonitoringStatusServiceTest.java +++ b/sechub-pds/src/test/java/com/mercedesbenz/sechub/pds/monitoring/PDSMonitoringStatusServiceTest.java @@ -73,7 +73,7 @@ public void monitoringStatus_fallback_handling_when_deserialization_problems_wit @Test public void monitoringStatus_contains_information_about_two_members_when_two_members_defined() { /* prepare */ - PDSMonitoring testData = PDSMonitoringTestDataUtil.createTestMonitoringWith2ClusterMembers(); + PDSMonitoring testData = TestPDSMonitoringDataUtil.createTestMonitoringWith2ClusterMembers(); List heartBeatsForServerId = new ArrayList<>(); // heartbeat1 diff --git a/sechub-pds/src/test/java/com/mercedesbenz/sechub/pds/monitoring/PDSMonitoringTest.java b/sechub-pds/src/test/java/com/mercedesbenz/sechub/pds/monitoring/PDSMonitoringTest.java index 78349aa495..44619e3f77 100644 --- a/sechub-pds/src/test/java/com/mercedesbenz/sechub/pds/monitoring/PDSMonitoringTest.java +++ b/sechub-pds/src/test/java/com/mercedesbenz/sechub/pds/monitoring/PDSMonitoringTest.java @@ -13,7 +13,7 @@ public class PDSMonitoringTest { @Test public void monitoring_toJSON() throws Exception { /* prepare */ - PDSMonitoring monitoringToTest = PDSMonitoringTestDataUtil.createTestMonitoringWith2ClusterMembers(); + PDSMonitoring monitoringToTest = TestPDSMonitoringDataUtil.createTestMonitoringWith2ClusterMembers(); /* execute */ String json = monitoringToTest.toJSON(); diff --git a/sechub-pds/src/test/java/com/mercedesbenz/sechub/pds/monitoring/PDSMonitoringTestDataUtil.java b/sechub-pds/src/test/java/com/mercedesbenz/sechub/pds/monitoring/TestPDSMonitoringDataUtil.java similarity index 98% rename from sechub-pds/src/test/java/com/mercedesbenz/sechub/pds/monitoring/PDSMonitoringTestDataUtil.java rename to sechub-pds/src/test/java/com/mercedesbenz/sechub/pds/monitoring/TestPDSMonitoringDataUtil.java index 2136b65341..27da1e7b55 100644 --- a/sechub-pds/src/test/java/com/mercedesbenz/sechub/pds/monitoring/PDSMonitoringTestDataUtil.java +++ b/sechub-pds/src/test/java/com/mercedesbenz/sechub/pds/monitoring/TestPDSMonitoringDataUtil.java @@ -10,7 +10,7 @@ import com.mercedesbenz.sechub.pds.execution.PDSExecutionStatus; import com.mercedesbenz.sechub.pds.job.PDSJob; -public class PDSMonitoringTestDataUtil { +public class TestPDSMonitoringDataUtil { public static final long JOB_STATUS_DONE = 5L; public static final long JOB_STATUS_RUNNING = 4L; diff --git a/sechub-scan-product-sereco/src/test/java/com/mercedesbenz/sechub/domain/scan/product/sereco/CodeScanJobDataFalsePositiveStrategyTest.java b/sechub-scan-product-sereco/src/test/java/com/mercedesbenz/sechub/domain/scan/product/sereco/CodeScanJobDataFalsePositiveStrategyTest.java index b51c6f4b86..45dab876a7 100644 --- a/sechub-scan-product-sereco/src/test/java/com/mercedesbenz/sechub/domain/scan/product/sereco/CodeScanJobDataFalsePositiveStrategyTest.java +++ b/sechub-scan-product-sereco/src/test/java/com/mercedesbenz/sechub/domain/scan/product/sereco/CodeScanJobDataFalsePositiveStrategyTest.java @@ -160,7 +160,7 @@ public void vulnerability_having_no_relevant_part_will_use_relevant_part_resolve } private FalsePositiveMetaData fetchFirstEntryMetaDataOfExample3() { - String json = ScanProductSerecoTestFileSupport.getTestfileSupport().loadTestFile("false_positives/scan_false_positive_config_example3.json"); + String json = TestScanProductSerecoFileSupport.getTestfileSupport().loadTestFile("false_positives/scan_false_positive_config_example3.json"); FalsePositiveProjectConfiguration config = FalsePositiveProjectConfiguration.fromJSONString(json); FalsePositiveEntry entry = config.getFalsePositives().get(0); assertEquals("entry-1", entry.getJobData().getComment());// sanity check, means correct entry... diff --git a/sechub-scan-product-sereco/src/test/java/com/mercedesbenz/sechub/domain/scan/product/sereco/SecretScanJobDataFalsePositiveStrategyTest.java b/sechub-scan-product-sereco/src/test/java/com/mercedesbenz/sechub/domain/scan/product/sereco/SecretScanJobDataFalsePositiveStrategyTest.java index 258115ea8b..bb81251c6b 100644 --- a/sechub-scan-product-sereco/src/test/java/com/mercedesbenz/sechub/domain/scan/product/sereco/SecretScanJobDataFalsePositiveStrategyTest.java +++ b/sechub-scan-product-sereco/src/test/java/com/mercedesbenz/sechub/domain/scan/product/sereco/SecretScanJobDataFalsePositiveStrategyTest.java @@ -158,7 +158,7 @@ public void vulnerability_having_no_relevant_part_will_use_relevant_part_resolve } private FalsePositiveMetaData fetchFirstEntryMetaDataOfExample5() { - String json = ScanProductSerecoTestFileSupport.getTestfileSupport().loadTestFile("false_positives/scan_false_positive_config_example5.json"); + String json = TestScanProductSerecoFileSupport.getTestfileSupport().loadTestFile("false_positives/scan_false_positive_config_example5.json"); FalsePositiveProjectConfiguration config = FalsePositiveProjectConfiguration.fromJSONString(json); FalsePositiveEntry entry = config.getFalsePositives().get(0); assertEquals("entry-1", entry.getJobData().getComment());// sanity check, means correct entry... diff --git a/sechub-scan-product-sereco/src/test/java/com/mercedesbenz/sechub/domain/scan/product/sereco/SerecoJobDataFalsePositiveFinderTest.java b/sechub-scan-product-sereco/src/test/java/com/mercedesbenz/sechub/domain/scan/product/sereco/SerecoJobDataFalsePositiveFinderTest.java index b92aee0eca..51ea26611c 100644 --- a/sechub-scan-product-sereco/src/test/java/com/mercedesbenz/sechub/domain/scan/product/sereco/SerecoJobDataFalsePositiveFinderTest.java +++ b/sechub-scan-product-sereco/src/test/java/com/mercedesbenz/sechub/domain/scan/product/sereco/SerecoJobDataFalsePositiveFinderTest.java @@ -131,7 +131,7 @@ public void infrascan_triggers_not_codescanstrategy() { } private FalsePositiveMetaData fetchFirstEntryMetaDataOfExample3() { - String json = ScanProductSerecoTestFileSupport.getTestfileSupport().loadTestFile("false_positives/scan_false_positive_config_example3.json"); + String json = TestScanProductSerecoFileSupport.getTestfileSupport().loadTestFile("false_positives/scan_false_positive_config_example3.json"); FalsePositiveProjectConfiguration config = FalsePositiveProjectConfiguration.fromJSONString(json); FalsePositiveEntry entry = config.getFalsePositives().get(0); assertEquals("entry-1", entry.getJobData().getComment());// sanity check, means correct entry... diff --git a/sechub-scan-product-sereco/src/test/java/com/mercedesbenz/sechub/domain/scan/product/sereco/ScanProductSerecoTestFileSupport.java b/sechub-scan-product-sereco/src/test/java/com/mercedesbenz/sechub/domain/scan/product/sereco/TestScanProductSerecoFileSupport.java similarity index 64% rename from sechub-scan-product-sereco/src/test/java/com/mercedesbenz/sechub/domain/scan/product/sereco/ScanProductSerecoTestFileSupport.java rename to sechub-scan-product-sereco/src/test/java/com/mercedesbenz/sechub/domain/scan/product/sereco/TestScanProductSerecoFileSupport.java index ca2001fba6..6b1de0643f 100644 --- a/sechub-scan-product-sereco/src/test/java/com/mercedesbenz/sechub/domain/scan/product/sereco/ScanProductSerecoTestFileSupport.java +++ b/sechub-scan-product-sereco/src/test/java/com/mercedesbenz/sechub/domain/scan/product/sereco/TestScanProductSerecoFileSupport.java @@ -5,14 +5,14 @@ import com.mercedesbenz.sechub.test.TestFileSupport; @SechubTestComponent -public class ScanProductSerecoTestFileSupport extends TestFileSupport { - private static final ScanProductSerecoTestFileSupport TESTFILE_SUPPORT = new ScanProductSerecoTestFileSupport(); +public class TestScanProductSerecoFileSupport extends TestFileSupport { + private static final TestScanProductSerecoFileSupport TESTFILE_SUPPORT = new TestScanProductSerecoFileSupport(); public static TestFileSupport getTestfileSupport() { return TESTFILE_SUPPORT; } - ScanProductSerecoTestFileSupport() { + TestScanProductSerecoFileSupport() { super("sechub-scan-product-sereco/src/test/resources"); } diff --git a/sechub-scan/src/test/java/com/mercedesbenz/sechub/domain/scan/ScanDomainTestFileSupport.java b/sechub-scan/src/test/java/com/mercedesbenz/sechub/domain/scan/TestScanDomainFileSupport.java similarity index 64% rename from sechub-scan/src/test/java/com/mercedesbenz/sechub/domain/scan/ScanDomainTestFileSupport.java rename to sechub-scan/src/test/java/com/mercedesbenz/sechub/domain/scan/TestScanDomainFileSupport.java index f2b56387d9..143e1ac91a 100644 --- a/sechub-scan/src/test/java/com/mercedesbenz/sechub/domain/scan/ScanDomainTestFileSupport.java +++ b/sechub-scan/src/test/java/com/mercedesbenz/sechub/domain/scan/TestScanDomainFileSupport.java @@ -5,14 +5,14 @@ import com.mercedesbenz.sechub.test.TestFileSupport; @SechubTestComponent -public class ScanDomainTestFileSupport extends TestFileSupport { - private static final ScanDomainTestFileSupport TESTFILE_SUPPORT = new ScanDomainTestFileSupport(); +public class TestScanDomainFileSupport extends TestFileSupport { + private static final TestScanDomainFileSupport TESTFILE_SUPPORT = new TestScanDomainFileSupport(); public static TestFileSupport getTestfileSupport() { return TESTFILE_SUPPORT; } - ScanDomainTestFileSupport() { + TestScanDomainFileSupport() { super("sechub-scan/src/test/resources"); } diff --git a/sechub-scan/src/test/java/com/mercedesbenz/sechub/domain/scan/WebConfigBuilderStrategyTest.java b/sechub-scan/src/test/java/com/mercedesbenz/sechub/domain/scan/WebConfigBuilderStrategyTest.java index a8de54c5c0..cffc877df0 100644 --- a/sechub-scan/src/test/java/com/mercedesbenz/sechub/domain/scan/WebConfigBuilderStrategyTest.java +++ b/sechub-scan/src/test/java/com/mercedesbenz/sechub/domain/scan/WebConfigBuilderStrategyTest.java @@ -196,7 +196,7 @@ private WebConfigBuilderStrategy createStrategy(String path) { } private SecHubExecutionContext createContext(String pathToTestConfig) { - String json = ScanDomainTestFileSupport.getTestfileSupport().loadTestFile(pathToTestConfig); + String json = TestScanDomainFileSupport.getTestfileSupport().loadTestFile(pathToTestConfig); SecHubConfiguration configuration = SECHUB_CONFIG.fromJSON(json); return new SecHubExecutionContext(UUID.randomUUID(), configuration, "test", UUID.randomUUID()); diff --git a/sechub-scan/src/test/java/com/mercedesbenz/sechub/domain/scan/config/ScanMappingConfigurationServiceTest.java b/sechub-scan/src/test/java/com/mercedesbenz/sechub/domain/scan/config/ScanMappingConfigurationServiceTest.java index 6165f7cce6..5db44bf385 100644 --- a/sechub-scan/src/test/java/com/mercedesbenz/sechub/domain/scan/config/ScanMappingConfigurationServiceTest.java +++ b/sechub-scan/src/test/java/com/mercedesbenz/sechub/domain/scan/config/ScanMappingConfigurationServiceTest.java @@ -7,7 +7,7 @@ import org.junit.Test; import com.mercedesbenz.sechub.commons.mapping.NamePatternIdProvider; -import com.mercedesbenz.sechub.domain.scan.ScanDomainTestFileSupport; +import com.mercedesbenz.sechub.domain.scan.TestScanDomainFileSupport; @SuppressWarnings("deprecation") // we explicit use the deprecated method, because it is only for tests.. public class ScanMappingConfigurationServiceTest { @@ -32,7 +32,7 @@ public void not_initialized_returns_fallback_provider() { public void initialized_example1_returns_expected_provider() { /* prepare */ serviceToTest.switchConfigurationIfChanged( - ScanMappingConfiguration.createFromJSON(ScanDomainTestFileSupport.getTestfileSupport().loadTestFile("scan_config/test_scan_config1.json"))); + ScanMappingConfiguration.createFromJSON(TestScanDomainFileSupport.getTestfileSupport().loadTestFile("scan_config/test_scan_config1.json"))); /* execute */ NamePatternIdProvider provider = serviceToTest.getNamePatternIdProvider("someproduct.a.b"); @@ -56,7 +56,7 @@ public void initialized_example1_returns_expected_provider() { public void initialized_example2_contains_unknwon_fields_but_will_also_returns_expected_provider() { /* prepare */ serviceToTest.switchConfigurationIfChanged( - ScanMappingConfiguration.createFromJSON(ScanDomainTestFileSupport.getTestfileSupport().loadTestFile("scan_config/test_scan_config2.json"))); + ScanMappingConfiguration.createFromJSON(TestScanDomainFileSupport.getTestfileSupport().loadTestFile("scan_config/test_scan_config2.json"))); /* execute */ NamePatternIdProvider provider = serviceToTest.getNamePatternIdProvider("someproduct.a.b"); diff --git a/sechub-scan/src/test/java/com/mercedesbenz/sechub/domain/scan/config/ScanMappingConfigurationTest.java b/sechub-scan/src/test/java/com/mercedesbenz/sechub/domain/scan/config/ScanMappingConfigurationTest.java index 28bf0b43cc..cda403217a 100644 --- a/sechub-scan/src/test/java/com/mercedesbenz/sechub/domain/scan/config/ScanMappingConfigurationTest.java +++ b/sechub-scan/src/test/java/com/mercedesbenz/sechub/domain/scan/config/ScanMappingConfigurationTest.java @@ -8,7 +8,7 @@ import org.junit.Test; import com.mercedesbenz.sechub.commons.mapping.NamePatternToIdEntry; -import com.mercedesbenz.sechub.domain.scan.ScanDomainTestFileSupport; +import com.mercedesbenz.sechub.domain.scan.TestScanDomainFileSupport; public class ScanMappingConfigurationTest { @@ -28,7 +28,7 @@ public void emptyJson_is_accepted() { @Test public void can_create_json_example1_and_has_expected_namePatternMappings() { /* prepare */ - String json = ScanDomainTestFileSupport.getTestfileSupport().loadTestFile("scan_config/test_scan_config1.json"); + String json = TestScanDomainFileSupport.getTestfileSupport().loadTestFile("scan_config/test_scan_config1.json"); /* execute */ ScanMappingConfiguration config = ScanMappingConfiguration.createFromJSON(json); @@ -47,7 +47,7 @@ public void can_create_json_example1_and_has_expected_namePatternMappings() { @Test public void can_create_json_example1_and_providers() { /* prepare */ - String json = ScanDomainTestFileSupport.getTestfileSupport().loadTestFile("scan_config/test_scan_config1.json"); + String json = TestScanDomainFileSupport.getTestfileSupport().loadTestFile("scan_config/test_scan_config1.json"); /* execute */ ScanMappingConfiguration config = ScanMappingConfiguration.createFromJSON(json); diff --git a/sechub-scan/src/test/java/com/mercedesbenz/sechub/domain/scan/product/ProductResultRepositoryDBTest.java b/sechub-scan/src/test/java/com/mercedesbenz/sechub/domain/scan/product/ProductResultRepositoryDBTest.java index 99063a6da6..6ebf00866c 100644 --- a/sechub-scan/src/test/java/com/mercedesbenz/sechub/domain/scan/product/ProductResultRepositoryDBTest.java +++ b/sechub-scan/src/test/java/com/mercedesbenz/sechub/domain/scan/product/ProductResultRepositoryDBTest.java @@ -21,7 +21,7 @@ import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringRunner; -import com.mercedesbenz.sechub.domain.scan.ScanDomainTestFileSupport; +import com.mercedesbenz.sechub.domain.scan.TestScanDomainFileSupport; import com.mercedesbenz.sechub.domain.scan.product.config.DefaultProductExecutorConfigInfo; import com.mercedesbenz.sechub.domain.scan.product.config.ProductExecutorConfigInfo; import com.mercedesbenz.sechub.domain.scan.product.config.WithoutProductExecutorConfigInfo; @@ -309,7 +309,7 @@ public void findProduct_results_is_executable_and_returns_empty_result_for_netsp public void a_standard_netsparker_output_can_be_persisted() { /* prepare */ String path = "netsparker/netsparker_v1.0.40.109_testresult1.xml"; - String netsparkerContent = ScanDomainTestFileSupport.getTestfileSupport().loadTestFile(path); + String netsparkerContent = TestScanDomainFileSupport.getTestfileSupport().loadTestFile(path); UUID secHubJobUUID = UUID.randomUUID(); ProductResult result1 = new ProductResult(secHubJobUUID, "project1", new WithoutProductExecutorConfigInfo(ProductIdentifier.NETSPARKER), diff --git a/sechub-scan/src/test/java/com/mercedesbenz/sechub/domain/scan/product/ProductResultTestAccess.java b/sechub-scan/src/test/java/com/mercedesbenz/sechub/domain/scan/product/TestProductResultAccess.java similarity index 85% rename from sechub-scan/src/test/java/com/mercedesbenz/sechub/domain/scan/product/ProductResultTestAccess.java rename to sechub-scan/src/test/java/com/mercedesbenz/sechub/domain/scan/product/TestProductResultAccess.java index 8215c446c2..987422345e 100644 --- a/sechub-scan/src/test/java/com/mercedesbenz/sechub/domain/scan/product/ProductResultTestAccess.java +++ b/sechub-scan/src/test/java/com/mercedesbenz/sechub/domain/scan/product/TestProductResultAccess.java @@ -3,7 +3,7 @@ import java.util.UUID; -public class ProductResultTestAccess { +public class TestProductResultAccess { public static void setUUID(ProductResult productResult, UUID uuid) { productResult.uUID = uuid; diff --git a/sechub-scan/src/test/java/com/mercedesbenz/sechub/domain/scan/product/config/ProductExecutorConfigListTest.java b/sechub-scan/src/test/java/com/mercedesbenz/sechub/domain/scan/product/config/ProductExecutorConfigListTest.java index e79be6646c..4fb83d3ce3 100644 --- a/sechub-scan/src/test/java/com/mercedesbenz/sechub/domain/scan/product/config/ProductExecutorConfigListTest.java +++ b/sechub-scan/src/test/java/com/mercedesbenz/sechub/domain/scan/product/config/ProductExecutorConfigListTest.java @@ -8,14 +8,14 @@ import org.junit.Test; -import com.mercedesbenz.sechub.domain.scan.ScanDomainTestFileSupport; +import com.mercedesbenz.sechub.domain.scan.TestScanDomainFileSupport; public class ProductExecutorConfigListTest { @Test public void from_json_executor_config_example_1_can_be_read_transformed_to_json_and_contains_expected_data() { /* prepare */ - String json = ScanDomainTestFileSupport.getTestfileSupport().loadTestFile("executor/executor-configuration-list-example1.json"); + String json = TestScanDomainFileSupport.getTestfileSupport().loadTestFile("executor/executor-configuration-list-example1.json"); /* execute */ ProductExecutorConfigList result = ProductExecutorConfigList.fromJSONString(json); diff --git a/sechub-scan/src/test/java/com/mercedesbenz/sechub/domain/scan/product/config/ProductExecutorConfigSetupTest.java b/sechub-scan/src/test/java/com/mercedesbenz/sechub/domain/scan/product/config/ProductExecutorConfigSetupTest.java index 9008da0ea7..80b763b015 100644 --- a/sechub-scan/src/test/java/com/mercedesbenz/sechub/domain/scan/product/config/ProductExecutorConfigSetupTest.java +++ b/sechub-scan/src/test/java/com/mercedesbenz/sechub/domain/scan/product/config/ProductExecutorConfigSetupTest.java @@ -5,14 +5,14 @@ import org.junit.Test; -import com.mercedesbenz.sechub.domain.scan.ScanDomainTestFileSupport; +import com.mercedesbenz.sechub.domain.scan.TestScanDomainFileSupport; public class ProductExecutorConfigSetupTest { @Test public void executor_config_example_1_can_be_read_transformed_to_json_and_contains_expected_data() { /* prepare */ - String json = ScanDomainTestFileSupport.getTestfileSupport().loadTestFile("executor/executor-configuration-setup-example1.json"); + String json = TestScanDomainFileSupport.getTestfileSupport().loadTestFile("executor/executor-configuration-setup-example1.json"); /* execute */ ProductExecutorConfigSetup result = ProductExecutorConfigSetup.fromJSONString(json); diff --git a/sechub-scan/src/test/java/com/mercedesbenz/sechub/domain/scan/project/FalsePositiveDataConfigMergerTest.java b/sechub-scan/src/test/java/com/mercedesbenz/sechub/domain/scan/project/FalsePositiveDataConfigMergerTest.java index 9de95d5dcb..907a5390b1 100644 --- a/sechub-scan/src/test/java/com/mercedesbenz/sechub/domain/scan/project/FalsePositiveDataConfigMergerTest.java +++ b/sechub-scan/src/test/java/com/mercedesbenz/sechub/domain/scan/project/FalsePositiveDataConfigMergerTest.java @@ -18,7 +18,7 @@ import com.mercedesbenz.sechub.commons.model.SecHubFinding; import com.mercedesbenz.sechub.commons.model.Severity; -import com.mercedesbenz.sechub.domain.scan.ScanDomainTestFileSupport; +import com.mercedesbenz.sechub.domain.scan.TestScanDomainFileSupport; import com.mercedesbenz.sechub.domain.scan.report.ScanSecHubReport; public class FalsePositiveDataConfigMergerTest { @@ -443,7 +443,7 @@ void remove_one_job_data_entry_when_only_project_data_available_results_in_uncha } private ScanSecHubReport loadScanReport(String path) { - String reportJSON = ScanDomainTestFileSupport.getTestfileSupport().loadTestFile(path); + String reportJSON = TestScanDomainFileSupport.getTestfileSupport().loadTestFile(path); return ScanSecHubReport.fromJSONString(reportJSON); } diff --git a/sechub-scan/src/test/java/com/mercedesbenz/sechub/domain/scan/project/FalsePositiveDataListTest.java b/sechub-scan/src/test/java/com/mercedesbenz/sechub/domain/scan/project/FalsePositiveDataListTest.java index 86eb6c53d4..9403ee41bf 100644 --- a/sechub-scan/src/test/java/com/mercedesbenz/sechub/domain/scan/project/FalsePositiveDataListTest.java +++ b/sechub-scan/src/test/java/com/mercedesbenz/sechub/domain/scan/project/FalsePositiveDataListTest.java @@ -9,14 +9,14 @@ import org.junit.jupiter.api.Test; -import com.mercedesbenz.sechub.domain.scan.ScanDomainTestFileSupport; +import com.mercedesbenz.sechub.domain.scan.TestScanDomainFileSupport; public class FalsePositiveDataListTest { @Test void json_content_as_described_in_example_of_documentation() { /* prepare */ - String json = ScanDomainTestFileSupport.getTestfileSupport() + String json = TestScanDomainFileSupport.getTestfileSupport() .loadTestFileFromRoot("/sechub-doc/src/docs/asciidoc/documents/shared/false-positives/false-positives-REST-API-content-example1.json"); /* execute */ diff --git a/sechub-scan/src/test/java/com/mercedesbenz/sechub/domain/scan/project/FalsePositiveProjectConfigurationTest.java b/sechub-scan/src/test/java/com/mercedesbenz/sechub/domain/scan/project/FalsePositiveProjectConfigurationTest.java index e0197bd7df..f23bc1575e 100644 --- a/sechub-scan/src/test/java/com/mercedesbenz/sechub/domain/scan/project/FalsePositiveProjectConfigurationTest.java +++ b/sechub-scan/src/test/java/com/mercedesbenz/sechub/domain/scan/project/FalsePositiveProjectConfigurationTest.java @@ -14,7 +14,7 @@ import com.mercedesbenz.sechub.commons.model.ScanType; import com.mercedesbenz.sechub.commons.model.Severity; -import com.mercedesbenz.sechub.domain.scan.ScanDomainTestFileSupport; +import com.mercedesbenz.sechub.domain.scan.TestScanDomainFileSupport; public class FalsePositiveProjectConfigurationTest { @@ -28,7 +28,7 @@ public void before() throws Exception { @Test public void example1_unmarshalled_contains_expected_data() throws Exception { /* prepare */ - String json = ScanDomainTestFileSupport.getTestfileSupport().loadTestFile("false_positives/scan_false_positive_config_example1.json"); + String json = TestScanDomainFileSupport.getTestfileSupport().loadTestFile("false_positives/scan_false_positive_config_example1.json"); /* execute */ configToTest = FalsePositiveProjectConfiguration.fromJSONString(json); diff --git a/sechub-scan/src/test/java/com/mercedesbenz/sechub/domain/scan/report/ScanSecHubReportTest.java b/sechub-scan/src/test/java/com/mercedesbenz/sechub/domain/scan/report/ScanSecHubReportTest.java index d088c0d0b9..8a6d79ca75 100644 --- a/sechub-scan/src/test/java/com/mercedesbenz/sechub/domain/scan/report/ScanSecHubReportTest.java +++ b/sechub-scan/src/test/java/com/mercedesbenz/sechub/domain/scan/report/ScanSecHubReportTest.java @@ -20,7 +20,7 @@ import com.mercedesbenz.sechub.commons.model.SecHubStatus; import com.mercedesbenz.sechub.commons.model.Severity; import com.mercedesbenz.sechub.commons.model.TrafficLight; -import com.mercedesbenz.sechub.domain.scan.ScanDomainTestFileSupport; +import com.mercedesbenz.sechub.domain.scan.TestScanDomainFileSupport; class ScanSecHubReportTest { @@ -64,7 +64,7 @@ void a_sechub_report_without_status_messages_or_report_version_can_be_serialized private ScanSecHubReport deserializeReportFile(String fileName) { File file = new File("./src/test/resources/sechub_result/" + fileName); - ScanSecHubReport report = ScanSecHubReport.fromJSONString(ScanDomainTestFileSupport.loadTextFile(file, "\n")); + ScanSecHubReport report = ScanSecHubReport.fromJSONString(TestScanDomainFileSupport.loadTextFile(file, "\n")); return report; } diff --git a/sechub-schedule/src/test/java/com/mercedesbenz/sechub/domain/schedule/RetryContextText.java b/sechub-schedule/src/test/java/com/mercedesbenz/sechub/domain/schedule/RetryContextTest.java similarity index 99% rename from sechub-schedule/src/test/java/com/mercedesbenz/sechub/domain/schedule/RetryContextText.java rename to sechub-schedule/src/test/java/com/mercedesbenz/sechub/domain/schedule/RetryContextTest.java index a373fdd3fd..9accaaa160 100644 --- a/sechub-schedule/src/test/java/com/mercedesbenz/sechub/domain/schedule/RetryContextText.java +++ b/sechub-schedule/src/test/java/com/mercedesbenz/sechub/domain/schedule/RetryContextTest.java @@ -6,7 +6,7 @@ import org.junit.Before; import org.junit.Test; -public class RetryContextText { +public class RetryContextTest { @Before public void before() { diff --git a/sechub-schedule/src/test/java/com/mercedesbenz/sechub/domain/schedule/SchedulerRestControllerMockTest.java b/sechub-schedule/src/test/java/com/mercedesbenz/sechub/domain/schedule/SchedulerRestControllerMockTest.java index 63037fa1f7..fd7b517274 100644 --- a/sechub-schedule/src/test/java/com/mercedesbenz/sechub/domain/schedule/SchedulerRestControllerMockTest.java +++ b/sechub-schedule/src/test/java/com/mercedesbenz/sechub/domain/schedule/SchedulerRestControllerMockTest.java @@ -187,7 +187,7 @@ public UUID getUUID() { when(mockedScheduleJobStatusService.getJobStatus(PROJECT1_ID, randomUUID)).thenReturn(status); - InputStream inputStreamTo = ScheduleTestFileSupport.getTestfileSupport().getInputStreamTo("upload/zipfile_contains_only_test1.txt.zip"); + InputStream inputStreamTo = TestScheduleFileSupport.getTestfileSupport().getInputStreamTo("upload/zipfile_contains_only_test1.txt.zip"); MockMultipartFile file1 = new MockMultipartFile("file", inputStreamTo); /* execute + test @formatter:off */ diff --git a/sechub-schedule/src/test/java/com/mercedesbenz/sechub/domain/schedule/ScheduleTestFileSupport.java b/sechub-schedule/src/test/java/com/mercedesbenz/sechub/domain/schedule/TestScheduleFileSupport.java similarity index 55% rename from sechub-schedule/src/test/java/com/mercedesbenz/sechub/domain/schedule/ScheduleTestFileSupport.java rename to sechub-schedule/src/test/java/com/mercedesbenz/sechub/domain/schedule/TestScheduleFileSupport.java index 3e4534b646..6a5c7bc867 100644 --- a/sechub-schedule/src/test/java/com/mercedesbenz/sechub/domain/schedule/ScheduleTestFileSupport.java +++ b/sechub-schedule/src/test/java/com/mercedesbenz/sechub/domain/schedule/TestScheduleFileSupport.java @@ -5,14 +5,14 @@ import com.mercedesbenz.sechub.test.TestFileSupport; @SechubTestComponent -public class ScheduleTestFileSupport extends TestFileSupport { - private static final ScheduleTestFileSupport TESTFILE_SUPPORT = new ScheduleTestFileSupport(); +public class TestScheduleFileSupport extends TestFileSupport { + private static final TestScheduleFileSupport TESTFILE_SUPPORT = new TestScheduleFileSupport(); - public static ScheduleTestFileSupport getTestfileSupport() { + public static TestScheduleFileSupport getTestfileSupport() { return TESTFILE_SUPPORT; } - ScheduleTestFileSupport() { + TestScheduleFileSupport() { super("sechub-schedule/src/test/resources"); } diff --git a/sechub-schedule/src/test/java/com/mercedesbenz/sechub/domain/schedule/job/SecHubJobRepositoryDBTest.java b/sechub-schedule/src/test/java/com/mercedesbenz/sechub/domain/schedule/job/SecHubJobRepositoryDBTest.java index 5144a3fa89..984664fbea 100644 --- a/sechub-schedule/src/test/java/com/mercedesbenz/sechub/domain/schedule/job/SecHubJobRepositoryDBTest.java +++ b/sechub-schedule/src/test/java/com/mercedesbenz/sechub/domain/schedule/job/SecHubJobRepositoryDBTest.java @@ -2,7 +2,7 @@ package com.mercedesbenz.sechub.domain.schedule.job; import static com.mercedesbenz.sechub.commons.model.job.ExecutionState.*; -import static com.mercedesbenz.sechub.domain.schedule.job.JobCreator.*; +import static com.mercedesbenz.sechub.domain.schedule.job.TestJobCreator.*; import static com.mercedesbenz.sechub.test.FlakyOlderThanTestWorkaround.*; import static org.assertj.core.api.Assertions.*; import static org.junit.jupiter.api.Assertions.*; @@ -59,11 +59,11 @@ public class SecHubJobRepositoryDBTest { @Autowired private SecHubJobRepository jobRepository; - private JobCreator jobCreator; + private TestJobCreator testJobCreator; @BeforeEach void before() { - jobCreator = jobCreator(PROJECT_ID, entityManager); + testJobCreator = jobCreator(PROJECT_ID, entityManager); } @Test @@ -114,18 +114,18 @@ void collectAllUsedEncryptionPoolIdsInsideJobs_multiple_jobs_mixed_poolids() { @ValueSource(ints = { 0, 1, 2, 10 }) void countCanceledOrEndedJobsWithEncryptionPoolIdLowerThan_works_as_expected(int expectedResultCount) { /* prepare */ - jobCreator.project("p2").module(ModuleGroup.STATIC).being(ExecutionState.INITIALIZING).create(); - jobCreator.project("p1").module(ModuleGroup.STATIC).being(ExecutionState.READY_TO_START).create(); - jobCreator.project("p1").module(ModuleGroup.STATIC).being(ExecutionState.STARTED).create(); - jobCreator.project("p2").module(ModuleGroup.STATIC).being(ExecutionState.CANCEL_REQUESTED).create(); + testJobCreator.project("p2").module(ModuleGroup.STATIC).being(ExecutionState.INITIALIZING).create(); + testJobCreator.project("p1").module(ModuleGroup.STATIC).being(ExecutionState.READY_TO_START).create(); + testJobCreator.project("p1").module(ModuleGroup.STATIC).being(ExecutionState.STARTED).create(); + testJobCreator.project("p2").module(ModuleGroup.STATIC).being(ExecutionState.CANCEL_REQUESTED).create(); // generate data if (expectedResultCount > 0) { - jobCreator.project("p2").module(ModuleGroup.STATIC).being(ExecutionState.ENDED).create(); + testJobCreator.project("p2").module(ModuleGroup.STATIC).being(ExecutionState.ENDED).create(); } if (expectedResultCount > 1) { for (int i = 1; i < expectedResultCount; i++) { - jobCreator.project("p2").module(ModuleGroup.STATIC).being(ExecutionState.CANCELED).create(); + testJobCreator.project("p2").module(ModuleGroup.STATIC).being(ExecutionState.CANCELED).create(); } } @@ -140,11 +140,11 @@ void countCanceledOrEndedJobsWithEncryptionPoolIdLowerThan_works_as_expected(int @ValueSource(ints = { 1, 2, 4 }) void nextCanceledOrEndedJobsWithEncryptionPoolIdLowerThan_one_ended_only_single_entry_always_returned(int amount) { /* prepare */ - ScheduleSecHubJob newJob1 = jobCreator.project("p1").module(ModuleGroup.STATIC).being(ExecutionState.STARTED).create(); - ScheduleSecHubJob newJob2 = jobCreator.project("p1").module(ModuleGroup.STATIC).being(ExecutionState.READY_TO_START).create(); - ScheduleSecHubJob newJob3 = jobCreator.project("p2").module(ModuleGroup.STATIC).being(ExecutionState.INITIALIZING).create(); - ScheduleSecHubJob newJob4 = jobCreator.project("p2").module(ModuleGroup.STATIC).being(ExecutionState.ENDED).create(); - ScheduleSecHubJob newJob5 = jobCreator.project("p2").module(ModuleGroup.STATIC).being(ExecutionState.CANCEL_REQUESTED).create(); + ScheduleSecHubJob newJob1 = testJobCreator.project("p1").module(ModuleGroup.STATIC).being(ExecutionState.STARTED).create(); + ScheduleSecHubJob newJob2 = testJobCreator.project("p1").module(ModuleGroup.STATIC).being(ExecutionState.READY_TO_START).create(); + ScheduleSecHubJob newJob3 = testJobCreator.project("p2").module(ModuleGroup.STATIC).being(ExecutionState.INITIALIZING).create(); + ScheduleSecHubJob newJob4 = testJobCreator.project("p2").module(ModuleGroup.STATIC).being(ExecutionState.ENDED).create(); + ScheduleSecHubJob newJob5 = testJobCreator.project("p2").module(ModuleGroup.STATIC).being(ExecutionState.CANCEL_REQUESTED).create(); // check preconditions assertEquals(0, newJob1.getEncryptionCipherPoolId()); @@ -166,11 +166,11 @@ void nextCanceledOrEndedJobsWithEncryptionPoolIdLowerThan_one_ended_only_single_ @ValueSource(ints = { 1, 2, 4 }) void nextCanceledOrEndedJobsWithEncryptionPoolIdLowerThan_one_is_lower_ended_only_single_entry_always_returned(int amount) { /* prepare */ - ScheduleSecHubJob newJob1 = jobCreator.project("p1").module(ModuleGroup.STATIC).encryptionPoolId(0L).being(ExecutionState.ENDED).create(); - ScheduleSecHubJob newJob2 = jobCreator.project("p1").module(ModuleGroup.STATIC).encryptionPoolId(1L).being(ExecutionState.ENDED).create(); - ScheduleSecHubJob newJob3 = jobCreator.project("p2").module(ModuleGroup.STATIC).encryptionPoolId(1L).being(ExecutionState.ENDED).create(); - ScheduleSecHubJob newJob4 = jobCreator.project("p2").module(ModuleGroup.STATIC).encryptionPoolId(2L).being(ExecutionState.ENDED).create(); - ScheduleSecHubJob newJob5 = jobCreator.project("p2").module(ModuleGroup.STATIC).encryptionPoolId(3L).being(ExecutionState.ENDED).create(); + ScheduleSecHubJob newJob1 = testJobCreator.project("p1").module(ModuleGroup.STATIC).encryptionPoolId(0L).being(ExecutionState.ENDED).create(); + ScheduleSecHubJob newJob2 = testJobCreator.project("p1").module(ModuleGroup.STATIC).encryptionPoolId(1L).being(ExecutionState.ENDED).create(); + ScheduleSecHubJob newJob3 = testJobCreator.project("p2").module(ModuleGroup.STATIC).encryptionPoolId(1L).being(ExecutionState.ENDED).create(); + ScheduleSecHubJob newJob4 = testJobCreator.project("p2").module(ModuleGroup.STATIC).encryptionPoolId(2L).being(ExecutionState.ENDED).create(); + ScheduleSecHubJob newJob5 = testJobCreator.project("p2").module(ModuleGroup.STATIC).encryptionPoolId(3L).being(ExecutionState.ENDED).create(); // check preconditions assertEquals(0, newJob1.getEncryptionCipherPoolId()); @@ -192,12 +192,12 @@ void nextCanceledOrEndedJobsWithEncryptionPoolIdLowerThan_one_is_lower_ended_onl @ValueSource(ints = { 2, 10, 100 }) void nextCanceledOrEndedJobsWithEncryptionPoolIdLowerThan_one_ended_one_canceled_entries_always_returned(int amount) { /* prepare */ - ScheduleSecHubJob newJob1 = jobCreator.project("p1").module(ModuleGroup.STATIC).being(ExecutionState.STARTED).create(); - ScheduleSecHubJob newJob2 = jobCreator.project("p1").module(ModuleGroup.STATIC).being(ExecutionState.READY_TO_START).create(); - ScheduleSecHubJob newJob3 = jobCreator.project("p2").module(ModuleGroup.STATIC).being(ExecutionState.INITIALIZING).create(); - ScheduleSecHubJob newJob4 = jobCreator.project("p2").module(ModuleGroup.STATIC).being(ExecutionState.ENDED).create(); - ScheduleSecHubJob newJob5 = jobCreator.project("p2").module(ModuleGroup.STATIC).being(ExecutionState.CANCEL_REQUESTED).create(); - ScheduleSecHubJob newJob6 = jobCreator.project("p2").module(ModuleGroup.STATIC).being(ExecutionState.CANCELED).create(); + ScheduleSecHubJob newJob1 = testJobCreator.project("p1").module(ModuleGroup.STATIC).being(ExecutionState.STARTED).create(); + ScheduleSecHubJob newJob2 = testJobCreator.project("p1").module(ModuleGroup.STATIC).being(ExecutionState.READY_TO_START).create(); + ScheduleSecHubJob newJob3 = testJobCreator.project("p2").module(ModuleGroup.STATIC).being(ExecutionState.INITIALIZING).create(); + ScheduleSecHubJob newJob4 = testJobCreator.project("p2").module(ModuleGroup.STATIC).being(ExecutionState.ENDED).create(); + ScheduleSecHubJob newJob5 = testJobCreator.project("p2").module(ModuleGroup.STATIC).being(ExecutionState.CANCEL_REQUESTED).create(); + ScheduleSecHubJob newJob6 = testJobCreator.project("p2").module(ModuleGroup.STATIC).being(ExecutionState.CANCELED).create(); // check preconditions assertEquals(0, newJob1.getEncryptionCipherPoolId()); @@ -228,12 +228,12 @@ void nextCanceledOrEndedJobsWithEncryptionPoolIdLowerThan_one_ended_one_canceled @Test void nextCanceledOrEndedJobsWithEncryptionPoolIdLowerThan_randomization_works() { /* prepare */ - ScheduleSecHubJob newJob1 = jobCreator.project("p1").module(ModuleGroup.STATIC).being(ExecutionState.ENDED).create(); - ScheduleSecHubJob newJob2 = jobCreator.project("p1").module(ModuleGroup.STATIC).being(ExecutionState.CANCELED).create(); - ScheduleSecHubJob newJob3 = jobCreator.project("p2").module(ModuleGroup.STATIC).being(ExecutionState.ENDED).create(); - ScheduleSecHubJob newJob4 = jobCreator.project("p2").module(ModuleGroup.STATIC).being(ExecutionState.CANCELED).create(); - ScheduleSecHubJob newJob5 = jobCreator.project("p2").module(ModuleGroup.STATIC).being(ExecutionState.ENDED).create(); - ScheduleSecHubJob newJob6 = jobCreator.project("p2").module(ModuleGroup.STATIC).being(ExecutionState.CANCELED).create(); + ScheduleSecHubJob newJob1 = testJobCreator.project("p1").module(ModuleGroup.STATIC).being(ExecutionState.ENDED).create(); + ScheduleSecHubJob newJob2 = testJobCreator.project("p1").module(ModuleGroup.STATIC).being(ExecutionState.CANCELED).create(); + ScheduleSecHubJob newJob3 = testJobCreator.project("p2").module(ModuleGroup.STATIC).being(ExecutionState.ENDED).create(); + ScheduleSecHubJob newJob4 = testJobCreator.project("p2").module(ModuleGroup.STATIC).being(ExecutionState.CANCELED).create(); + ScheduleSecHubJob newJob5 = testJobCreator.project("p2").module(ModuleGroup.STATIC).being(ExecutionState.ENDED).create(); + ScheduleSecHubJob newJob6 = testJobCreator.project("p2").module(ModuleGroup.STATIC).being(ExecutionState.CANCELED).create(); // check preconditions assertEquals(0, newJob1.getEncryptionCipherPoolId()); @@ -274,10 +274,11 @@ void nextCanceledOrEndedJobsWithEncryptionPoolIdLowerThan_randomization_works() @ValueSource(longs = { 0L, 1L, 100L }) void nextCanceledOrEndedJobsWithEncryptionPoolIdLowerThan_lower_encryption_entries_are_returned(long encryptionPoolId) { /* prepare */ - jobCreator.project("p1").module(ModuleGroup.STATIC).being(ExecutionState.STARTED).encryptionPoolId(encryptionPoolId).create(); - jobCreator.project("p1").module(ModuleGroup.STATIC).being(ExecutionState.READY_TO_START).encryptionPoolId(encryptionPoolId).create(); - jobCreator.project("p2").module(ModuleGroup.STATIC).being(ExecutionState.CANCEL_REQUESTED).encryptionPoolId(encryptionPoolId).create(); - ScheduleSecHubJob newJob4 = jobCreator.project("p2").module(ModuleGroup.STATIC).being(ExecutionState.ENDED).encryptionPoolId(encryptionPoolId).create(); + testJobCreator.project("p1").module(ModuleGroup.STATIC).being(ExecutionState.STARTED).encryptionPoolId(encryptionPoolId).create(); + testJobCreator.project("p1").module(ModuleGroup.STATIC).being(ExecutionState.READY_TO_START).encryptionPoolId(encryptionPoolId).create(); + testJobCreator.project("p2").module(ModuleGroup.STATIC).being(ExecutionState.CANCEL_REQUESTED).encryptionPoolId(encryptionPoolId).create(); + ScheduleSecHubJob newJob4 = testJobCreator.project("p2").module(ModuleGroup.STATIC).being(ExecutionState.ENDED).encryptionPoolId(encryptionPoolId) + .create(); long newerEncryptionIdOnQuery = encryptionPoolId + 1; @@ -293,10 +294,10 @@ void nextCanceledOrEndedJobsWithEncryptionPoolIdLowerThan_lower_encryption_entri @ValueSource(longs = { 0L, 1L, 100L }) void nextCanceledOrEndedJobsWithEncryptionPoolIdLowerThan_no_entries_returned_when_same_encryption_id_already_set(long encryptionPoolId) { /* prepare */ - jobCreator.project("p1").module(ModuleGroup.STATIC).being(ExecutionState.STARTED).encryptionPoolId(encryptionPoolId).create(); - jobCreator.project("p1").module(ModuleGroup.STATIC).being(ExecutionState.READY_TO_START).encryptionPoolId(encryptionPoolId).create(); - jobCreator.project("p2").module(ModuleGroup.STATIC).being(ExecutionState.CANCEL_REQUESTED).encryptionPoolId(encryptionPoolId).create(); - jobCreator.project("p2").module(ModuleGroup.STATIC).being(ExecutionState.ENDED).encryptionPoolId(encryptionPoolId).create(); + testJobCreator.project("p1").module(ModuleGroup.STATIC).being(ExecutionState.STARTED).encryptionPoolId(encryptionPoolId).create(); + testJobCreator.project("p1").module(ModuleGroup.STATIC).being(ExecutionState.READY_TO_START).encryptionPoolId(encryptionPoolId).create(); + testJobCreator.project("p2").module(ModuleGroup.STATIC).being(ExecutionState.CANCEL_REQUESTED).encryptionPoolId(encryptionPoolId).create(); + testJobCreator.project("p2").module(ModuleGroup.STATIC).being(ExecutionState.ENDED).encryptionPoolId(encryptionPoolId).create(); /* execute */ List list = jobRepository.nextCanceledOrEndedJobsWithEncryptionPoolIdLowerThan(encryptionPoolId, 10); @@ -311,10 +312,10 @@ void nextCanceledOrEndedJobsWithEncryptionPoolIdLowerThan_no_entries_returned_wh /* prepare */ long newerEncryptionPoolId = encryptionPoolId + 1; - jobCreator.project("p1").module(ModuleGroup.STATIC).being(ExecutionState.STARTED).encryptionPoolId(newerEncryptionPoolId).create(); - jobCreator.project("p1").module(ModuleGroup.STATIC).being(ExecutionState.READY_TO_START).encryptionPoolId(newerEncryptionPoolId).create(); - jobCreator.project("p2").module(ModuleGroup.STATIC).being(ExecutionState.CANCEL_REQUESTED).encryptionPoolId(newerEncryptionPoolId).create(); - jobCreator.project("p2").module(ModuleGroup.STATIC).being(ExecutionState.ENDED).encryptionPoolId(newerEncryptionPoolId).create(); + testJobCreator.project("p1").module(ModuleGroup.STATIC).being(ExecutionState.STARTED).encryptionPoolId(newerEncryptionPoolId).create(); + testJobCreator.project("p1").module(ModuleGroup.STATIC).being(ExecutionState.READY_TO_START).encryptionPoolId(newerEncryptionPoolId).create(); + testJobCreator.project("p2").module(ModuleGroup.STATIC).being(ExecutionState.CANCEL_REQUESTED).encryptionPoolId(newerEncryptionPoolId).create(); + testJobCreator.project("p2").module(ModuleGroup.STATIC).being(ExecutionState.ENDED).encryptionPoolId(newerEncryptionPoolId).create(); /* execute */ List list = jobRepository.nextCanceledOrEndedJobsWithEncryptionPoolIdLowerThan(encryptionPoolId, 10); @@ -329,10 +330,10 @@ void markJobsAsSuspended() { String projectId = "p1"; // persist data - ScheduleSecHubJob job1 = jobCreator.being(ExecutionState.READY_TO_START).project(projectId).create(); + ScheduleSecHubJob job1 = testJobCreator.being(ExecutionState.READY_TO_START).project(projectId).create(); entityManager.persist(job1); - ScheduleSecHubJob job2 = jobCreator.being(ExecutionState.READY_TO_START).project(projectId).create(); + ScheduleSecHubJob job2 = testJobCreator.being(ExecutionState.READY_TO_START).project(projectId).create(); entityManager.persist(job2); entityManager.flush(); @@ -361,10 +362,10 @@ void markJobsAsSuspended_multi() { String projectId = "p1"; // persist data - ScheduleSecHubJob job1 = jobCreator.being(ExecutionState.READY_TO_START).project(projectId).create(); + ScheduleSecHubJob job1 = testJobCreator.being(ExecutionState.READY_TO_START).project(projectId).create(); entityManager.persist(job1); - ScheduleSecHubJob job2 = jobCreator.being(ExecutionState.READY_TO_START).project(projectId).create(); + ScheduleSecHubJob job2 = testJobCreator.being(ExecutionState.READY_TO_START).project(projectId).create(); entityManager.persist(job2); entityManager.flush(); @@ -395,11 +396,11 @@ void findAll_with_specifications_for_project_id_and_data_2_data_but_only_one_mat String value = "testvalue1"; // persist data - ScheduleSecHubJob job1 = jobCreator.being(ExecutionState.READY_TO_START).project(projectId).create(); + ScheduleSecHubJob job1 = testJobCreator.being(ExecutionState.READY_TO_START).project(projectId).create(); job1.addData(acceptedKey, value); entityManager.persist(job1); - ScheduleSecHubJob job2 = jobCreator.being(ExecutionState.READY_TO_START).project(projectId).create(); + ScheduleSecHubJob job2 = testJobCreator.being(ExecutionState.READY_TO_START).project(projectId).create(); job2.addData("other", value); entityManager.persist(job2); @@ -431,7 +432,7 @@ void findAll_with_specifications_for_project_id_and_data_1_data_but_project_id_d String value = "testvalue1"; // persist data - ScheduleSecHubJob job1 = jobCreator.being(ExecutionState.READY_TO_START).project(projectId).create(); + ScheduleSecHubJob job1 = testJobCreator.being(ExecutionState.READY_TO_START).project(projectId).create(); job1.addData(acceptedKey, value); entityManager.persist(job1); @@ -459,7 +460,7 @@ void findAll_with_specifications_for_project_id_and_data_1_data_value_matches_bu String sameValue = "testvalue1"; // persist data - ScheduleSecHubJob job1 = jobCreator.being(ExecutionState.READY_TO_START).project(projectId).create(); + ScheduleSecHubJob job1 = testJobCreator.being(ExecutionState.READY_TO_START).project(projectId).create(); job1.addData("testkey1", sameValue); entityManager.persist(job1); @@ -489,12 +490,12 @@ void findAll_with_specifications_for_project_id_and_data_2_data_both_matching() String value = "testvalue3"; // persist data - ScheduleSecHubJob job1 = jobCreator.being(ExecutionState.READY_TO_START).project(projectId).create(); + ScheduleSecHubJob job1 = testJobCreator.being(ExecutionState.READY_TO_START).project(projectId).create(); job1.addData("other1", value); job1.addData(searchKey, value); entityManager.persist(job1); - ScheduleSecHubJob job2 = jobCreator.being(ExecutionState.READY_TO_START).project(projectId).create(); + ScheduleSecHubJob job2 = testJobCreator.being(ExecutionState.READY_TO_START).project(projectId).create(); job2.addData("other2", value); job2.addData(searchKey, value); entityManager.persist(job2); @@ -530,7 +531,7 @@ void findAll_with_specifications_for_project_id_and_data_1_data_search_with_wron String key = "testkey-common"; // persist data - ScheduleSecHubJob job1 = jobCreator.being(ExecutionState.READY_TO_START).project(projectId).create(); + ScheduleSecHubJob job1 = testJobCreator.being(ExecutionState.READY_TO_START).project(projectId).create(); job1.addData(key, value); entityManager.persist(job1); @@ -560,11 +561,11 @@ void findAll_with_specifications_for_project_id_and_data_2_data_both_matching_in String value = "testvalue"; // persist data - ScheduleSecHubJob job1 = jobCreator.being(ExecutionState.READY_TO_START).project(projectId).create(); + ScheduleSecHubJob job1 = testJobCreator.being(ExecutionState.READY_TO_START).project(projectId).create(); job1.addData(key, "other"); entityManager.persist(job1); - ScheduleSecHubJob job2 = jobCreator.being(ExecutionState.READY_TO_START).project(projectId).create(); + ScheduleSecHubJob job2 = testJobCreator.being(ExecutionState.READY_TO_START).project(projectId).create(); job2.addData(key, value); entityManager.persist(job2); @@ -595,16 +596,16 @@ void findAll_with_specifications_for_project_id_and_data_3_data_2_search_variant String value = "testvalue"; // persist data - ScheduleSecHubJob job1 = jobCreator.being(ExecutionState.READY_TO_START).project(projectId).create(); + ScheduleSecHubJob job1 = testJobCreator.being(ExecutionState.READY_TO_START).project(projectId).create(); job1.addData("other-key1", value); entityManager.persist(job1); - ScheduleSecHubJob job2 = jobCreator.being(ExecutionState.READY_TO_START).project(projectId).create(); + ScheduleSecHubJob job2 = testJobCreator.being(ExecutionState.READY_TO_START).project(projectId).create(); job2.addData("other-key1", value); job2.addData(key, value); entityManager.persist(job2); - ScheduleSecHubJob job3 = jobCreator.being(ExecutionState.READY_TO_START).project(projectId).create(); + ScheduleSecHubJob job3 = testJobCreator.being(ExecutionState.READY_TO_START).project(projectId).create(); job3.addData("other-key2", value); job3.addData(key, value); entityManager.persist(job3); @@ -634,7 +635,7 @@ void create_with_data_stores_data() { /* prepare */ String key = "testkey1"; - ScheduleSecHubJob newJob = jobCreator.being(ExecutionState.READY_TO_START).create(); + ScheduleSecHubJob newJob = testJobCreator.being(ExecutionState.READY_TO_START).create(); UUID jobUUID = newJob.getUUID(); newJob.addData(key, "testvalue1"); @@ -666,7 +667,7 @@ void delete_job_with_data_deletes_data() { /* prepare */ String key = "testkey1"; - ScheduleSecHubJob newJob = jobCreator.being(ExecutionState.READY_TO_START).create(); + ScheduleSecHubJob newJob = testJobCreator.being(ExecutionState.READY_TO_START).create(); UUID jobUUID = newJob.getUUID(); newJob.addData(key, "testvalue1"); @@ -696,7 +697,7 @@ void delete_job_with_data_deletes_data() { void custom_query_nextJobIdToExecuteSuspended_1000_ms_duration_no_suspended_exists_but_only_one_job_in_other_state(ExecutionState state) { /* prepare */ - jobCreator.being(state).ended(LocalDateTime.now().minusSeconds(2)).create(); + testJobCreator.being(state).ended(LocalDateTime.now().minusSeconds(2)).create(); /* execute */ Optional uuid = jobRepository.nextJobIdToExecuteSuspended(FIRST_ENCRYPTION_POOL_ENTRY_ONLY, 1000L); @@ -708,7 +709,7 @@ void custom_query_nextJobIdToExecuteSuspended_1000_ms_duration_no_suspended_exis @Test void custom_query_nextJobIdToExecuteSuspended_2000_ms_duration_one_suspended_exist_but_only_1_second_so_nothing_returned() { /* prepare */ - jobCreator.being(ExecutionState.SUSPENDED).ended(LocalDateTime.now().minusSeconds(1)).create(); + testJobCreator.being(ExecutionState.SUSPENDED).ended(LocalDateTime.now().minusSeconds(1)).create(); /* execute */ Optional uuid = jobRepository.nextJobIdToExecuteSuspended(FIRST_ENCRYPTION_POOL_ENTRY_ONLY, 2000L); @@ -720,7 +721,7 @@ void custom_query_nextJobIdToExecuteSuspended_2000_ms_duration_one_suspended_exi @Test void custom_query_nextJobIdToExecuteSuspended_1000_ms_duration_one_suspended_exist_older_1_second_returned() { /* prepare */ - ScheduleSecHubJob newJob = jobCreator.being(ExecutionState.SUSPENDED).ended(LocalDateTime.now().minusSeconds(2)).create(); + ScheduleSecHubJob newJob = testJobCreator.being(ExecutionState.SUSPENDED).ended(LocalDateTime.now().minusSeconds(2)).create(); /* execute */ Optional uuid = jobRepository.nextJobIdToExecuteSuspended(FIRST_ENCRYPTION_POOL_ENTRY_ONLY, 1000L); @@ -733,10 +734,10 @@ void custom_query_nextJobIdToExecuteSuspended_1000_ms_duration_one_suspended_exi @Test void custom_query_nextJobIdToExecuteSuspended_1000_ms_duration_three_suspended_exist_both_older_1_second_older_returned() { /* prepare */ - jobCreator.created(LocalDateTime.now().minusSeconds(5)).being(ExecutionState.SUSPENDED).ended(LocalDateTime.now().minusSeconds(4)).create(); - ScheduleSecHubJob newJob2 = jobCreator.created(LocalDateTime.now().minusSeconds(14)).being(ExecutionState.SUSPENDED) + testJobCreator.created(LocalDateTime.now().minusSeconds(5)).being(ExecutionState.SUSPENDED).ended(LocalDateTime.now().minusSeconds(4)).create(); + ScheduleSecHubJob newJob2 = testJobCreator.created(LocalDateTime.now().minusSeconds(14)).being(ExecutionState.SUSPENDED) .ended(LocalDateTime.now().minusSeconds(3)).create(); - jobCreator.created(LocalDateTime.now().minusSeconds(4)).being(ExecutionState.SUSPENDED).ended(LocalDateTime.now().minusSeconds(2)).create(); + testJobCreator.created(LocalDateTime.now().minusSeconds(4)).being(ExecutionState.SUSPENDED).ended(LocalDateTime.now().minusSeconds(2)).create(); /* execute */ Optional uuid = jobRepository.nextJobIdToExecuteSuspended(FIRST_ENCRYPTION_POOL_ENTRY_ONLY, 1000L); @@ -749,10 +750,10 @@ void custom_query_nextJobIdToExecuteSuspended_1000_ms_duration_three_suspended_e @Test void custom_query_nextJobIdToExecuteSuspended_3000_ms_duration_three_suspended_exist_but_olders_only_2_second_returns_last_created_because_latest_suspended() { /* prepare */ - jobCreator.created(LocalDateTime.now().minusSeconds(15)).being(ExecutionState.SUSPENDED).ended(LocalDateTime.now().minusSeconds(2)).create(); - ScheduleSecHubJob newJob2 = jobCreator.created(LocalDateTime.now().minusSeconds(14)).being(ExecutionState.SUSPENDED) + testJobCreator.created(LocalDateTime.now().minusSeconds(15)).being(ExecutionState.SUSPENDED).ended(LocalDateTime.now().minusSeconds(2)).create(); + ScheduleSecHubJob newJob2 = testJobCreator.created(LocalDateTime.now().minusSeconds(14)).being(ExecutionState.SUSPENDED) .ended(LocalDateTime.now().minusSeconds(3)).create(); - jobCreator.created(LocalDateTime.now().minusSeconds(16)).being(ExecutionState.SUSPENDED).ended(LocalDateTime.now().minusSeconds(2)).create(); + testJobCreator.created(LocalDateTime.now().minusSeconds(16)).being(ExecutionState.SUSPENDED).ended(LocalDateTime.now().minusSeconds(2)).create(); /* execute */ Optional uuid = jobRepository.nextJobIdToExecuteSuspended(FIRST_ENCRYPTION_POOL_ENTRY_ONLY, 3000L); @@ -765,9 +766,9 @@ void custom_query_nextJobIdToExecuteSuspended_3000_ms_duration_three_suspended_e @Test void custom_query_nextJobIdToExecuteSuspended_5000_ms_duration_three_suspended_exist_both_younger_5_seconds_none_returned() { /* prepare */ - jobCreator.created(LocalDateTime.now().minusSeconds(5)).being(ExecutionState.SUSPENDED).ended(LocalDateTime.now().minusSeconds(4)).create(); - jobCreator.created(LocalDateTime.now().minusSeconds(14)).being(ExecutionState.SUSPENDED).ended(LocalDateTime.now().minusSeconds(3)).create(); - jobCreator.created(LocalDateTime.now().minusSeconds(4)).being(ExecutionState.SUSPENDED).ended(LocalDateTime.now().minusSeconds(2)).create(); + testJobCreator.created(LocalDateTime.now().minusSeconds(5)).being(ExecutionState.SUSPENDED).ended(LocalDateTime.now().minusSeconds(4)).create(); + testJobCreator.created(LocalDateTime.now().minusSeconds(14)).being(ExecutionState.SUSPENDED).ended(LocalDateTime.now().minusSeconds(3)).create(); + testJobCreator.created(LocalDateTime.now().minusSeconds(4)).being(ExecutionState.SUSPENDED).ended(LocalDateTime.now().minusSeconds(2)).create(); /* execute */ Optional uuid = jobRepository.nextJobIdToExecuteSuspended(FIRST_ENCRYPTION_POOL_ENTRY_ONLY, 5000L); @@ -784,7 +785,8 @@ void custom_query_nextJobIdToExecuteSuspended_5000_ms_duration_three_suspended_e @EnumSource(value = ExecutionState.class, names = { "READY_TO_START", "SUSPENDED" }, mode = Mode.EXCLUDE) void custom_query_getJob_returns_not_created_job_because_not_in_accepted_state(ExecutionState state) { /* prepare */ - ScheduleSecHubJob created = jobCreator.created(LocalDateTime.now().minusSeconds(5)).being(state).ended(LocalDateTime.now().minusSeconds(4)).create(); + ScheduleSecHubJob created = testJobCreator.created(LocalDateTime.now().minusSeconds(5)).being(state).ended(LocalDateTime.now().minusSeconds(4)) + .create(); /* execute */ Optional result = jobRepository.getJobAndIncrementVersionWhenExecutable(created.getUUID()); @@ -797,7 +799,8 @@ void custom_query_getJob_returns_not_created_job_because_not_in_accepted_state(E @EnumSource(value = ExecutionState.class, names = { "READY_TO_START", "SUSPENDED" }, mode = Mode.INCLUDE) void custom_query_getJob_returns_created_job_because_in_accepted_state(ExecutionState state) { /* prepare */ - ScheduleSecHubJob created = jobCreator.created(LocalDateTime.now().minusSeconds(5)).being(state).ended(LocalDateTime.now().minusSeconds(4)).create(); + ScheduleSecHubJob created = testJobCreator.created(LocalDateTime.now().minusSeconds(5)).being(state).ended(LocalDateTime.now().minusSeconds(4)) + .create(); /* execute */ Optional result = jobRepository.getJobAndIncrementVersionWhenExecutable(created.getUUID()); @@ -812,7 +815,7 @@ void custom_query_getJob_returns_created_job_because_in_accepted_state(Execution @Test void custom_query_nextJobIdToExecuteForProjectAndModuleGroupNotYetExecuted() { /* prepare */ - ScheduleSecHubJob newJob = jobCreator.being(ExecutionState.READY_TO_START).create(); + ScheduleSecHubJob newJob = testJobCreator.being(ExecutionState.READY_TO_START).create(); /* execute */ Optional uuid = jobRepository.nextJobIdToExecuteForProjectAndModuleGroupNotYetExecuted(FIRST_ENCRYPTION_POOL_ENTRY_ONLY); @@ -825,7 +828,7 @@ void custom_query_nextJobIdToExecuteForProjectAndModuleGroupNotYetExecuted() { @Test void custom_query_nextJobIdToExecuteForProjectNotYetExecuted_one_available() { /* prepare */ - ScheduleSecHubJob newJob = jobCreator.being(ExecutionState.READY_TO_START).create(); + ScheduleSecHubJob newJob = testJobCreator.being(ExecutionState.READY_TO_START).create(); /* execute */ Optional uuid = jobRepository.nextJobIdToExecuteForProjectNotYetExecuted(Set.of(0L)); @@ -838,9 +841,9 @@ void custom_query_nextJobIdToExecuteForProjectNotYetExecuted_one_available() { @Test void custom_query_nextJobIdToExecuteForProjectNotYetExecuted_2_projects_1_project_running() { /* prepare */ - ScheduleSecHubJob newJob1 = jobCreator.project("p1").module(ModuleGroup.STATIC).being(ExecutionState.STARTED).create(); - ScheduleSecHubJob newJob2 = jobCreator.project("p1").module(ModuleGroup.STATIC).being(ExecutionState.READY_TO_START).create(); - ScheduleSecHubJob newJob3 = jobCreator.project("p2").module(ModuleGroup.STATIC).being(ExecutionState.READY_TO_START).create(); + ScheduleSecHubJob newJob1 = testJobCreator.project("p1").module(ModuleGroup.STATIC).being(ExecutionState.STARTED).create(); + ScheduleSecHubJob newJob2 = testJobCreator.project("p1").module(ModuleGroup.STATIC).being(ExecutionState.READY_TO_START).create(); + ScheduleSecHubJob newJob3 = testJobCreator.project("p2").module(ModuleGroup.STATIC).being(ExecutionState.READY_TO_START).create(); /* check preconditions */ assertTrue(newJob2.created.isAfter(newJob1.created)); @@ -857,9 +860,9 @@ void custom_query_nextJobIdToExecuteForProjectNotYetExecuted_2_projects_1_projec @Test void custom_query_nextJobIdToExecuteForProjectAndModuleGroupNotYetExecuted_2_projects_1_project_running_all_same_groups() { /* prepare */ - ScheduleSecHubJob newJob1 = jobCreator.project("p1").module(ModuleGroup.STATIC).being(ExecutionState.STARTED).create(); - ScheduleSecHubJob newJob2 = jobCreator.project("p1").module(ModuleGroup.STATIC).being(ExecutionState.READY_TO_START).create(); - ScheduleSecHubJob newJob3 = jobCreator.project("p2").module(ModuleGroup.STATIC).being(ExecutionState.READY_TO_START).create(); + ScheduleSecHubJob newJob1 = testJobCreator.project("p1").module(ModuleGroup.STATIC).being(ExecutionState.STARTED).create(); + ScheduleSecHubJob newJob2 = testJobCreator.project("p1").module(ModuleGroup.STATIC).being(ExecutionState.READY_TO_START).create(); + ScheduleSecHubJob newJob3 = testJobCreator.project("p2").module(ModuleGroup.STATIC).being(ExecutionState.READY_TO_START).create(); /* check preconditions */ assertTrue(newJob2.created.isAfter(newJob1.created)); @@ -876,9 +879,9 @@ void custom_query_nextJobIdToExecuteForProjectAndModuleGroupNotYetExecuted_2_pro @Test void custom_query_nextJobIdToExecuteForProjectAndModuleGroupNotYetExecuted_2_projects_1_project_running_different_groups() { /* prepare */ - ScheduleSecHubJob newJob1 = jobCreator.project("p1").module(ModuleGroup.STATIC).being(ExecutionState.STARTED).create(); - ScheduleSecHubJob newJob2 = jobCreator.project("p1").module(ModuleGroup.DYNAMIC).being(ExecutionState.READY_TO_START).create(); - ScheduleSecHubJob newJob3 = jobCreator.project("p2").module(ModuleGroup.STATIC).being(ExecutionState.READY_TO_START).create(); + ScheduleSecHubJob newJob1 = testJobCreator.project("p1").module(ModuleGroup.STATIC).being(ExecutionState.STARTED).create(); + ScheduleSecHubJob newJob2 = testJobCreator.project("p1").module(ModuleGroup.DYNAMIC).being(ExecutionState.READY_TO_START).create(); + ScheduleSecHubJob newJob3 = testJobCreator.project("p2").module(ModuleGroup.STATIC).being(ExecutionState.READY_TO_START).create(); /* check preconditions */ assertTrue(newJob2.created.isAfter(newJob1.created)); @@ -895,10 +898,10 @@ void custom_query_nextJobIdToExecuteForProjectAndModuleGroupNotYetExecuted_2_pro @Test void custom_query_nextJobIdToExecuteForProjectAndModuleGroupNotYetExecuted_3_projects_2_project_running_different_groups() { /* prepare */ - ScheduleSecHubJob newJob1 = jobCreator.project("p1").module(ModuleGroup.STATIC).being(ExecutionState.STARTED).create(); - ScheduleSecHubJob newJob2 = jobCreator.project("p1").module(ModuleGroup.DYNAMIC).being(ExecutionState.READY_TO_START).create(); - ScheduleSecHubJob newJob3 = jobCreator.project("p2").module(ModuleGroup.STATIC).being(ExecutionState.READY_TO_START).create(); - ScheduleSecHubJob newJob4 = jobCreator.project("p3").module(ModuleGroup.STATIC).being(ExecutionState.READY_TO_START).create(); + ScheduleSecHubJob newJob1 = testJobCreator.project("p1").module(ModuleGroup.STATIC).being(ExecutionState.STARTED).create(); + ScheduleSecHubJob newJob2 = testJobCreator.project("p1").module(ModuleGroup.DYNAMIC).being(ExecutionState.READY_TO_START).create(); + ScheduleSecHubJob newJob3 = testJobCreator.project("p2").module(ModuleGroup.STATIC).being(ExecutionState.READY_TO_START).create(); + ScheduleSecHubJob newJob4 = testJobCreator.project("p3").module(ModuleGroup.STATIC).being(ExecutionState.READY_TO_START).create(); /* check preconditions */ assertTrue(newJob2.created.isAfter(newJob1.created)); @@ -916,10 +919,10 @@ void custom_query_nextJobIdToExecuteForProjectAndModuleGroupNotYetExecuted_3_pro @Test void custom_query_nextJobIdToExecuteForProjectAndModuleGroupNotYetExecuted_3_projects_2_project_running_same_groups() { /* prepare */ - ScheduleSecHubJob newJob1 = jobCreator.project("p1").module(ModuleGroup.STATIC).being(ExecutionState.STARTED).create(); - ScheduleSecHubJob newJob2 = jobCreator.project("p1").module(ModuleGroup.STATIC).being(ExecutionState.READY_TO_START).create(); - ScheduleSecHubJob newJob3 = jobCreator.project("p2").module(ModuleGroup.STATIC).being(ExecutionState.READY_TO_START).create(); - ScheduleSecHubJob newJob4 = jobCreator.project("p3").module(ModuleGroup.STATIC).being(ExecutionState.READY_TO_START).create(); + ScheduleSecHubJob newJob1 = testJobCreator.project("p1").module(ModuleGroup.STATIC).being(ExecutionState.STARTED).create(); + ScheduleSecHubJob newJob2 = testJobCreator.project("p1").module(ModuleGroup.STATIC).being(ExecutionState.READY_TO_START).create(); + ScheduleSecHubJob newJob3 = testJobCreator.project("p2").module(ModuleGroup.STATIC).being(ExecutionState.READY_TO_START).create(); + ScheduleSecHubJob newJob4 = testJobCreator.project("p3").module(ModuleGroup.STATIC).being(ExecutionState.READY_TO_START).create(); /* check preconditions */ assertTrue(newJob2.created.isAfter(newJob1.created)); @@ -937,10 +940,10 @@ void custom_query_nextJobIdToExecuteForProjectAndModuleGroupNotYetExecuted_3_pro @Test void custom_query_nextJobIdToExecuteForProjectAndModuleGroupNotYetExecuted_4_projects_no_project_started_all_ready() { /* prepare */ - ScheduleSecHubJob newJob1 = jobCreator.project("p1").module(ModuleGroup.STATIC).being(ExecutionState.READY_TO_START).create(); - ScheduleSecHubJob newJob2 = jobCreator.project("p2").module(ModuleGroup.STATIC).being(ExecutionState.READY_TO_START).create(); - ScheduleSecHubJob newJob3 = jobCreator.project("p3").module(ModuleGroup.STATIC).being(ExecutionState.READY_TO_START).create(); - ScheduleSecHubJob newJob4 = jobCreator.project("p4").module(ModuleGroup.STATIC).being(ExecutionState.READY_TO_START).create(); + ScheduleSecHubJob newJob1 = testJobCreator.project("p1").module(ModuleGroup.STATIC).being(ExecutionState.READY_TO_START).create(); + ScheduleSecHubJob newJob2 = testJobCreator.project("p2").module(ModuleGroup.STATIC).being(ExecutionState.READY_TO_START).create(); + ScheduleSecHubJob newJob3 = testJobCreator.project("p3").module(ModuleGroup.STATIC).being(ExecutionState.READY_TO_START).create(); + ScheduleSecHubJob newJob4 = testJobCreator.project("p4").module(ModuleGroup.STATIC).being(ExecutionState.READY_TO_START).create(); /* check preconditions */ assertTrue(newJob2.created.isAfter(newJob1.created)); @@ -958,12 +961,12 @@ void custom_query_nextJobIdToExecuteForProjectAndModuleGroupNotYetExecuted_4_pro @Test void custom_query_nextJobIdToExecuteForProjectAndModuleGroupNotYetExecuted_3_projects_different_states() { /* prepare */ - ScheduleSecHubJob newJob1 = jobCreator.project("p1").module(ModuleGroup.STATIC).being(ExecutionState.CANCEL_REQUESTED).create(); - ScheduleSecHubJob newJob2 = jobCreator.project("p1").module(ModuleGroup.STATIC).being(ExecutionState.INITIALIZING).create(); - ScheduleSecHubJob newJob3 = jobCreator.project("p2").module(ModuleGroup.STATIC).being(ExecutionState.CANCELED).create(); - ScheduleSecHubJob newJob4 = jobCreator.project("p3").module(ModuleGroup.STATIC).being(ExecutionState.ENDED).create(); - ScheduleSecHubJob newJob5 = jobCreator.project("p3").module(ModuleGroup.STATIC).being(ExecutionState.CANCEL_REQUESTED).create(); - ScheduleSecHubJob newJob6 = jobCreator.project("p3").module(ModuleGroup.STATIC).being(ExecutionState.READY_TO_START).create(); + ScheduleSecHubJob newJob1 = testJobCreator.project("p1").module(ModuleGroup.STATIC).being(ExecutionState.CANCEL_REQUESTED).create(); + ScheduleSecHubJob newJob2 = testJobCreator.project("p1").module(ModuleGroup.STATIC).being(ExecutionState.INITIALIZING).create(); + ScheduleSecHubJob newJob3 = testJobCreator.project("p2").module(ModuleGroup.STATIC).being(ExecutionState.CANCELED).create(); + ScheduleSecHubJob newJob4 = testJobCreator.project("p3").module(ModuleGroup.STATIC).being(ExecutionState.ENDED).create(); + ScheduleSecHubJob newJob5 = testJobCreator.project("p3").module(ModuleGroup.STATIC).being(ExecutionState.CANCEL_REQUESTED).create(); + ScheduleSecHubJob newJob6 = testJobCreator.project("p3").module(ModuleGroup.STATIC).being(ExecutionState.READY_TO_START).create(); /* check preconditions */ assertTrue(newJob2.created.isAfter(newJob1.created)); @@ -983,7 +986,7 @@ void custom_query_nextJobIdToExecuteForProjectAndModuleGroupNotYetExecuted_3_pro @Test void custom_query_nextJobIdToExecuteFirstInFirstOut() { /* prepare */ - ScheduleSecHubJob newJob = jobCreator.being(ExecutionState.READY_TO_START).create(); + ScheduleSecHubJob newJob = testJobCreator.being(ExecutionState.READY_TO_START).create(); /* execute */ Optional uuid = jobRepository.nextJobIdToExecuteFirstInFirstOut(FIRST_ENCRYPTION_POOL_ENTRY_ONLY); @@ -1181,7 +1184,7 @@ void test_data_4_jobs_oldest_90_days_deleted_1() throws Exception { @Test void findByUUID__the_job_is_returned_when_existing() { /* prepare */ - ScheduleSecHubJob newJob = jobCreator.create(); + ScheduleSecHubJob newJob = testJobCreator.create(); /* execute */ Optional job = jobRepository.findById(newJob.getUUID()); @@ -1200,7 +1203,7 @@ void findNextJobToExecute__and_no_jobs_available_at_all_null_is_returned_when_ex @Test void findNextJobToExecute__and_no_executable_job_available_at_all_null_is_returned_when_existing() { /* prepare */ - jobCreator.newJob().being(STARTED).create(); + testJobCreator.newJob().being(STARTED).create(); /* execute + test */ assertFalse(jobRepository.nextJobIdToExecuteFirstInFirstOut(FIRST_ENCRYPTION_POOL_ENTRY_ONLY).isPresent()); @@ -1211,18 +1214,18 @@ void findNextJobToExecute__and_no_executable_job_available_at_all_null_is_return void findNextJobToExecute__the_first_job_in_state_READY_TO_START_is_returned_when_existing() { /* prepare @formatter:off*/ - jobCreator.newJob().being(STARTED).createAnd(). + testJobCreator.newJob().being(STARTED).createAnd(). newJob().being(CANCEL_REQUESTED).createAnd(). newJob().being(CANCELED).createAnd(). newJob().being(ENDED).create(); ScheduleSecHubJob expectedNextJob = - jobCreator.newJob().being(READY_TO_START).create(); + testJobCreator.newJob().being(READY_TO_START).create(); TestUtil.waitMilliseconds(1); // just enough time to make the next job "older" than former one, so we got no flaky tests when checking jobUUID later - jobCreator.newJob().being(STARTED).createAnd(). + testJobCreator.newJob().being(STARTED).createAnd(). newJob().being(READY_TO_START).create(); /* execute */ @@ -1240,12 +1243,16 @@ void findNextJobToExecute__the_first_job_in_state_READY_TO_START_is_returned_whe @ArgumentsSource(NextJobIdToExecuteWithEncryptionPoolTestDataArgumentProvider.class) void nextJobIdToExecuteForProjectNotYetExecuted_2_projects_1_project_running(Set currentEncryptionPoolIds, TestResultVariant expectedVariant) { /* prepare */ - ScheduleSecHubJob newJob1 = jobCreator.project("p1").module(ModuleGroup.STATIC).being(ExecutionState.STARTED).create(); - ScheduleSecHubJob newJob2 = jobCreator.project("p1").module(ModuleGroup.STATIC).being(ExecutionState.READY_TO_START).create(); - ScheduleSecHubJob newJob3p0 = jobCreator.project("p2").encryptionPoolId(0L).module(ModuleGroup.STATIC).being(ExecutionState.READY_TO_START).create(); - ScheduleSecHubJob newJob3p1 = jobCreator.project("p2").encryptionPoolId(1L).module(ModuleGroup.STATIC).being(ExecutionState.READY_TO_START).create(); - ScheduleSecHubJob newJob3p2 = jobCreator.project("p2").encryptionPoolId(2L).module(ModuleGroup.STATIC).being(ExecutionState.READY_TO_START).create(); - ScheduleSecHubJob newJob3p3 = jobCreator.project("p2").encryptionPoolId(3L).module(ModuleGroup.STATIC).being(ExecutionState.READY_TO_START).create(); + ScheduleSecHubJob newJob1 = testJobCreator.project("p1").module(ModuleGroup.STATIC).being(ExecutionState.STARTED).create(); + ScheduleSecHubJob newJob2 = testJobCreator.project("p1").module(ModuleGroup.STATIC).being(ExecutionState.READY_TO_START).create(); + ScheduleSecHubJob newJob3p0 = testJobCreator.project("p2").encryptionPoolId(0L).module(ModuleGroup.STATIC).being(ExecutionState.READY_TO_START) + .create(); + ScheduleSecHubJob newJob3p1 = testJobCreator.project("p2").encryptionPoolId(1L).module(ModuleGroup.STATIC).being(ExecutionState.READY_TO_START) + .create(); + ScheduleSecHubJob newJob3p2 = testJobCreator.project("p2").encryptionPoolId(2L).module(ModuleGroup.STATIC).being(ExecutionState.READY_TO_START) + .create(); + ScheduleSecHubJob newJob3p3 = testJobCreator.project("p2").encryptionPoolId(3L).module(ModuleGroup.STATIC).being(ExecutionState.READY_TO_START) + .create(); /* check preconditions */ assertTrue(newJob2.created.isAfter(newJob1.created)); @@ -1288,23 +1295,23 @@ void nextJobIdToExecuteFirstInFirstOut__the_job_with_has_supported_encryption_in TestResultVariant expectedVariant) { /* prepare @formatter:off*/ - jobCreator.newJob().being(STARTED).createAnd(). + testJobCreator.newJob().being(STARTED).createAnd(). newJob().being(CANCEL_REQUESTED).createAnd(). newJob().being(CANCELED).createAnd(). newJob().being(ENDED).create(); ScheduleSecHubJob expectedNextJobWhenPoolId0Supported = - jobCreator.newJob().encryptionPoolId(0L).being(READY_TO_START).create(); + testJobCreator.newJob().encryptionPoolId(0L).being(READY_TO_START).create(); ScheduleSecHubJob expectedNextJobWhenPoolId1Supported = - jobCreator.newJob().encryptionPoolId(1L).being(READY_TO_START).create(); + testJobCreator.newJob().encryptionPoolId(1L).being(READY_TO_START).create(); ScheduleSecHubJob expectedNextJobWhenPoolId2Supported = - jobCreator.newJob().being(READY_TO_START).encryptionPoolId(2L).create(); + testJobCreator.newJob().being(READY_TO_START).encryptionPoolId(2L).create(); ScheduleSecHubJob expectedNextJobWhenPoolId3Supported = - jobCreator.newJob().being(READY_TO_START).encryptionPoolId(3L).create(); + testJobCreator.newJob().being(READY_TO_START).encryptionPoolId(3L).create(); TestUtil.waitMilliseconds(1); // just enough time to make the next job "older" than former one, so we got no flaky tests when checking jobUUID later - jobCreator.newJob().being(STARTED).createAnd(). + testJobCreator.newJob().being(STARTED).createAnd(). newJob().being(READY_TO_START).create(); /* execute */ @@ -1343,16 +1350,20 @@ void nextJobIdToExecuteFirstInFirstOut__the_job_with_has_supported_encryption_in void custom_query_nextJobIdToExecuteForProjectAndModuleGroupNotYetExecuted_3_projects_in_state_READY_TO_START_multi_poolids( Set currentEncryptionPoolIds, TestResultVariant expectedVariant) { /* prepare */ - ScheduleSecHubJob newJob1 = jobCreator.project("p1").module(ModuleGroup.STATIC).being(ExecutionState.CANCEL_REQUESTED).create(); - ScheduleSecHubJob newJob2 = jobCreator.project("p1").module(ModuleGroup.STATIC).being(ExecutionState.INITIALIZING).create(); - ScheduleSecHubJob newJob3 = jobCreator.project("p2").module(ModuleGroup.STATIC).being(ExecutionState.CANCELED).create(); - ScheduleSecHubJob newJob4 = jobCreator.project("p3").module(ModuleGroup.STATIC).being(ExecutionState.ENDED).create(); - ScheduleSecHubJob newJob5 = jobCreator.project("p3").module(ModuleGroup.STATIC).being(ExecutionState.CANCEL_REQUESTED).create(); - - ScheduleSecHubJob newJob6v0 = jobCreator.project("p3").encryptionPoolId(0L).module(ModuleGroup.STATIC).being(ExecutionState.READY_TO_START).create(); - ScheduleSecHubJob newJob6v1 = jobCreator.project("p3").encryptionPoolId(1L).module(ModuleGroup.STATIC).being(ExecutionState.READY_TO_START).create(); - ScheduleSecHubJob newJob6v2 = jobCreator.project("p3").encryptionPoolId(2L).module(ModuleGroup.STATIC).being(ExecutionState.READY_TO_START).create(); - ScheduleSecHubJob newJob6v3 = jobCreator.project("p3").encryptionPoolId(3L).module(ModuleGroup.STATIC).being(ExecutionState.READY_TO_START).create(); + ScheduleSecHubJob newJob1 = testJobCreator.project("p1").module(ModuleGroup.STATIC).being(ExecutionState.CANCEL_REQUESTED).create(); + ScheduleSecHubJob newJob2 = testJobCreator.project("p1").module(ModuleGroup.STATIC).being(ExecutionState.INITIALIZING).create(); + ScheduleSecHubJob newJob3 = testJobCreator.project("p2").module(ModuleGroup.STATIC).being(ExecutionState.CANCELED).create(); + ScheduleSecHubJob newJob4 = testJobCreator.project("p3").module(ModuleGroup.STATIC).being(ExecutionState.ENDED).create(); + ScheduleSecHubJob newJob5 = testJobCreator.project("p3").module(ModuleGroup.STATIC).being(ExecutionState.CANCEL_REQUESTED).create(); + + ScheduleSecHubJob newJob6v0 = testJobCreator.project("p3").encryptionPoolId(0L).module(ModuleGroup.STATIC).being(ExecutionState.READY_TO_START) + .create(); + ScheduleSecHubJob newJob6v1 = testJobCreator.project("p3").encryptionPoolId(1L).module(ModuleGroup.STATIC).being(ExecutionState.READY_TO_START) + .create(); + ScheduleSecHubJob newJob6v2 = testJobCreator.project("p3").encryptionPoolId(2L).module(ModuleGroup.STATIC).being(ExecutionState.READY_TO_START) + .create(); + ScheduleSecHubJob newJob6v3 = testJobCreator.project("p3").encryptionPoolId(3L).module(ModuleGroup.STATIC).being(ExecutionState.READY_TO_START) + .create(); /* check preconditions */ assertTrue(newJob2.created.isAfter(newJob1.created)); @@ -1426,7 +1437,7 @@ private ScheduleSecHubJobData findDataOrNullByJobUUID(String key, UUID jobUUID) } private void createJobUsingEncryptionPoolId(long poolId, ExecutionState state) { - jobCreator.project("p2").module(ModuleGroup.STATIC).being(state).encryptionPoolId(poolId).create(); + testJobCreator.project("p2").module(ModuleGroup.STATIC).being(state).encryptionPoolId(poolId).create(); } @@ -1485,10 +1496,10 @@ private class DeleteJobTestData { ScheduleSecHubJob job4_now_created; private void createAndCheckAvailable() { - job1_90_days_before_created = jobCreator.created(before_90_days).started(null).create(); - job2_2_days_before_created = jobCreator.created(before_3_days).started(before_1_day).being(ExecutionState.STARTED).create(); - job3_1_day_before_created = jobCreator.created(before_1_day).started(now).create(); - job4_now_created = jobCreator.created(now).create(); + job1_90_days_before_created = testJobCreator.created(before_90_days).started(null).create(); + job2_2_days_before_created = testJobCreator.created(before_3_days).started(before_1_day).being(ExecutionState.STARTED).create(); + job3_1_day_before_created = testJobCreator.created(before_1_day).started(now).create(); + job4_now_created = testJobCreator.created(now).create(); // check preconditions jobRepository.flush(); diff --git a/sechub-schedule/src/test/java/com/mercedesbenz/sechub/domain/schedule/job/JobCreator.java b/sechub-schedule/src/test/java/com/mercedesbenz/sechub/domain/schedule/job/TestJobCreator.java similarity index 81% rename from sechub-schedule/src/test/java/com/mercedesbenz/sechub/domain/schedule/job/JobCreator.java rename to sechub-schedule/src/test/java/com/mercedesbenz/sechub/domain/schedule/job/TestJobCreator.java index b96a28a62d..d591087184 100644 --- a/sechub-schedule/src/test/java/com/mercedesbenz/sechub/domain/schedule/job/JobCreator.java +++ b/sechub-schedule/src/test/java/com/mercedesbenz/sechub/domain/schedule/job/TestJobCreator.java @@ -22,7 +22,7 @@ import com.mercedesbenz.sechub.test.SechubTestComponent; @SechubTestComponent -public class JobCreator { +public class TestJobCreator { private TestEntityManager entityManager; private ScheduleSecHubJob job; @@ -32,7 +32,7 @@ public class JobCreator { private SecHubConfigurationModelSupport modelSupport; private ScheduleEncryptionService encryptionService; - private JobCreator(String projectId, TestEntityManager entityManager) { + private TestJobCreator(String projectId, TestEntityManager entityManager) { this.modelSupport = new SecHubConfigurationModelSupport(); this.entityManager = entityManager; this.projectId = projectId; @@ -57,46 +57,46 @@ private JobCreator(String projectId, TestEntityManager entityManager) { newJob(); } - public static JobCreator jobCreator(String projectId, TestEntityManager entityManager) { - return new JobCreator(projectId, entityManager); + public static TestJobCreator jobCreator(String projectId, TestEntityManager entityManager) { + return new TestJobCreator(projectId, entityManager); } - public JobCreator module(ModuleGroup moduleGroup) { + public TestJobCreator module(ModuleGroup moduleGroup) { job.moduleGroup = moduleGroup; return this; } - public JobCreator being(ExecutionState state) { + public TestJobCreator being(ExecutionState state) { job.executionState = state; return this; } - public JobCreator result(ExecutionResult result) { + public TestJobCreator result(ExecutionResult result) { job.executionResult = result; return this; } - public JobCreator started(LocalDateTime dateTime) { + public TestJobCreator started(LocalDateTime dateTime) { job.started = dateTime; return this; } - public JobCreator created(LocalDateTime dateTime) { + public TestJobCreator created(LocalDateTime dateTime) { job.created = dateTime; return this; } - public JobCreator ended(LocalDateTime dateTime) { + public TestJobCreator ended(LocalDateTime dateTime) { job.ended = dateTime; return this; } - public JobCreator project(String projectId) { + public TestJobCreator project(String projectId) { job.projectId = projectId; return this; } - public JobCreator encryptionPoolId(Long encryptionCipherPoolId) { + public TestJobCreator encryptionPoolId(Long encryptionCipherPoolId) { job.encryptionCipherPoolId = encryptionCipherPoolId; return this; } @@ -106,7 +106,7 @@ public JobCreator encryptionPoolId(Long encryptionCipherPoolId) { * * @return */ - public JobCreator createAnd() { + public TestJobCreator createAnd() { create(); return this; } @@ -132,11 +132,11 @@ public ScheduleSecHubJob create() { return result; } - public JobCreator newJob() { + public TestJobCreator newJob() { return newJob(new SecHubConfiguration()); } - public JobCreator newJob(SecHubConfiguration configuration) { + public TestJobCreator newJob(SecHubConfiguration configuration) { configuration.setProjectId(projectId); job = jobFactory.createJob(configuration); return this; diff --git a/sechub-sereco/src/test/java/com/mercedesbenz/sechub/sereco/importer/CheckmarxV1XMLImporterTest.java b/sechub-sereco/src/test/java/com/mercedesbenz/sechub/sereco/importer/CheckmarxV1XMLImporterTest.java index 891368a4fb..b7357780db 100644 --- a/sechub-sereco/src/test/java/com/mercedesbenz/sechub/sereco/importer/CheckmarxV1XMLImporterTest.java +++ b/sechub-sereco/src/test/java/com/mercedesbenz/sechub/sereco/importer/CheckmarxV1XMLImporterTest.java @@ -20,7 +20,7 @@ import com.mercedesbenz.sechub.sereco.metadata.SerecoMetaData; import com.mercedesbenz.sechub.sereco.metadata.SerecoSeverity; import com.mercedesbenz.sechub.sereco.metadata.SerecoVulnerability; -import com.mercedesbenz.sechub.sereco.test.SerecoTestFileSupport; +import com.mercedesbenz.sechub.sereco.test.TestSerecoFileSupport; public class CheckmarxV1XMLImporterTest { @@ -35,7 +35,7 @@ void beforeEach() { @CsvSource({ "Checkmarx", "PDS_CODESCAN" }) void xmlReportFromCheckmarxV8canBeImported_for_given_product_id(String productIdentifer) { /* prepare */ - String xml = SerecoTestFileSupport.INSTANCE.loadTestFile("checkmarx/sechub-continous-integration.xml"); + String xml = TestSerecoFileSupport.INSTANCE.loadTestFile("checkmarx/sechub-continous-integration.xml"); ImportParameter param = ImportParameter.builder().importData(xml).importId("id1").productId(productIdentifer).build(); @@ -77,7 +77,7 @@ void bookStoreExampleXMLcanNotBeImported() { @Test void xmlReportFromCheckmarxVhasNoDescriptionButCodeInfo() throws Exception { /* prepare */ - String xml = SerecoTestFileSupport.INSTANCE.loadTestFile("checkmarx/sechub-continous-integration-with-false-positive.xml"); + String xml = TestSerecoFileSupport.INSTANCE.loadTestFile("checkmarx/sechub-continous-integration-with-false-positive.xml"); /* execute */ SerecoMetaData result = importerToTest.importResult(xml, ScanType.CODE_SCAN); @@ -118,7 +118,7 @@ void xmlReportFromCheckmarxVhasNoDescriptionButCodeInfo() throws Exception { @Test void xmlReportFromCheckmarxV8containsDeeplink() throws Exception { /* prepare */ - String xml = SerecoTestFileSupport.INSTANCE.loadTestFile("checkmarx/sechub-continous-integration-with-false-positive.xml"); + String xml = TestSerecoFileSupport.INSTANCE.loadTestFile("checkmarx/sechub-continous-integration-with-false-positive.xml"); /* execute */ SerecoMetaData result = importerToTest.importResult(xml, ScanType.CODE_SCAN); @@ -136,7 +136,7 @@ void xmlReportFromCheckmarxV8containsDeeplink() throws Exception { @Test void xmlReportFromCheckmarxV8_with_false_positive_canBeImported_and_contains_not_false_positive() throws IOException { /* prepare */ - String xml = SerecoTestFileSupport.INSTANCE.loadTestFile("checkmarx/sechub-continous-integration-with-false-positive.xml"); + String xml = TestSerecoFileSupport.INSTANCE.loadTestFile("checkmarx/sechub-continous-integration-with-false-positive.xml"); /* execute */ SerecoMetaData data = importerToTest.importResult(xml, ScanType.CODE_SCAN); @@ -152,7 +152,7 @@ void xmlReportFromCheckmarxV8_with_false_positive_canBeImported_and_contains_not @Test void load_example1_contains_expected_data() throws IOException { /* prepare */ - String xml = SerecoTestFileSupport.INSTANCE.loadTestFileFromRoot("sechub-other/testoutput/checkmarx-example1.xml"); + String xml = TestSerecoFileSupport.INSTANCE.loadTestFileFromRoot("sechub-other/testoutput/checkmarx-example1.xml"); /* execute */ SerecoMetaData data = importerToTest.importResult(xml, ScanType.CODE_SCAN); diff --git a/sechub-sereco/src/test/java/com/mercedesbenz/sechub/sereco/importer/NessusV1XMLImporterTest.java b/sechub-sereco/src/test/java/com/mercedesbenz/sechub/sereco/importer/NessusV1XMLImporterTest.java index 3e758dc857..91d9ab848b 100644 --- a/sechub-sereco/src/test/java/com/mercedesbenz/sechub/sereco/importer/NessusV1XMLImporterTest.java +++ b/sechub-sereco/src/test/java/com/mercedesbenz/sechub/sereco/importer/NessusV1XMLImporterTest.java @@ -7,7 +7,7 @@ import org.junit.jupiter.api.Test; import com.mercedesbenz.sechub.sereco.ImportParameter; -import com.mercedesbenz.sechub.sereco.test.SerecoTestFileSupport; +import com.mercedesbenz.sechub.sereco.test.TestSerecoFileSupport; class NessusV1XMLImporterTest { @@ -21,7 +21,7 @@ void before() { @Test void xmlReportFromNessus7canBeImported() { /* prepare */ - String xml = SerecoTestFileSupport.INSTANCE.loadTestFile("nessus/nessus_7.0.2.result.xml"); + String xml = TestSerecoFileSupport.INSTANCE.loadTestFile("nessus/nessus_7.0.2.result.xml"); ImportParameter param = ImportParameter.builder().importData(xml).importId("id1").productId("Nessus").build(); diff --git a/sechub-sereco/src/test/java/com/mercedesbenz/sechub/sereco/importer/NetsparkerV1XMLImporterTest.java b/sechub-sereco/src/test/java/com/mercedesbenz/sechub/sereco/importer/NetsparkerV1XMLImporterTest.java index f1bf6feb75..7aa00e0c2d 100644 --- a/sechub-sereco/src/test/java/com/mercedesbenz/sechub/sereco/importer/NetsparkerV1XMLImporterTest.java +++ b/sechub-sereco/src/test/java/com/mercedesbenz/sechub/sereco/importer/NetsparkerV1XMLImporterTest.java @@ -14,11 +14,11 @@ import com.mercedesbenz.sechub.sereco.metadata.SerecoMetaData; import com.mercedesbenz.sechub.sereco.metadata.SerecoSeverity; import com.mercedesbenz.sechub.sereco.metadata.SerecoVulnerability; -import com.mercedesbenz.sechub.sereco.test.SerecoTestFileSupport; +import com.mercedesbenz.sechub.sereco.test.TestSerecoFileSupport; public class NetsparkerV1XMLImporterTest { - private SerecoTestFileSupport support = SerecoTestFileSupport.INSTANCE; + private TestSerecoFileSupport support = TestSerecoFileSupport.INSTANCE; private ProductResultImporter importerToTest; @BeforeEach @@ -29,7 +29,7 @@ void before() { @Test void xmlReportFromNetsparkerCanBeImported() { /* prepare */ - String xml = SerecoTestFileSupport.INSTANCE.loadTestFile("netsparker/netsparker_v1.0.40.109_scan_result_output_vulnerabilities.xml"); + String xml = TestSerecoFileSupport.INSTANCE.loadTestFile("netsparker/netsparker_v1.0.40.109_scan_result_output_vulnerabilities.xml"); ImportParameter param = ImportParameter.builder().importData(xml).importId("id1").productId("Netsparker").build(); @@ -43,7 +43,7 @@ void xmlReportFromNetsparkerCanBeImported() { @Test void testfile1_contains_4_vulnerablities_which_exists_in_imported_metadata() throws Exception { /* prepare */ - String xml = support.loadTestFile(SerecoTestFileSupport.NETSPARKER_RESULT_XML_TESTFILE1); + String xml = support.loadTestFile(TestSerecoFileSupport.NETSPARKER_RESULT_XML_TESTFILE1); /* execute */ SerecoMetaData result = importerToTest.importResult(xml, ScanType.WEB_SCAN); @@ -57,7 +57,7 @@ void testfile1_contains_4_vulnerablities_which_exists_in_imported_metadata() thr @Test void testfile1_contains_ApacheVersionDisclosure_and_ApacheOutOfDate_in_imported_metadata() throws Exception { /* prepare */ - String xml = support.loadTestFile(SerecoTestFileSupport.NETSPARKER_RESULT_XML_TESTFILE1); + String xml = support.loadTestFile(TestSerecoFileSupport.NETSPARKER_RESULT_XML_TESTFILE1); /* execute */ SerecoMetaData result = importerToTest.importResult(xml, ScanType.WEB_SCAN); @@ -105,7 +105,7 @@ void testfile1_contains_ApacheVersionDisclosure_and_ApacheOutOfDate_in_imported_ @Test void test_xml_import_netsparker_1_9_1_977_can_be_imported() throws Exception { /* prepare */ - String xml = SerecoTestFileSupport.INSTANCE.loadTestFile(SerecoTestFileSupport.NETSPARKER_V1_9_1_977_XML_TESTFILE); + String xml = TestSerecoFileSupport.INSTANCE.loadTestFile(TestSerecoFileSupport.NETSPARKER_V1_9_1_977_XML_TESTFILE); ImportParameter param = ImportParameter.builder().importData(xml).importId("id1").productId("Netsparker").build(); @@ -119,7 +119,7 @@ void test_xml_import_netsparker_1_9_1_977_can_be_imported() throws Exception { @Test void test_xml_import_netsparker_1_9_1_977_contains_4_vulnerablities() throws Exception { /* prepare */ - String xml = support.loadTestFile(SerecoTestFileSupport.NETSPARKER_V1_9_1_977_XML_TESTFILE); + String xml = support.loadTestFile(TestSerecoFileSupport.NETSPARKER_V1_9_1_977_XML_TESTFILE); /* execute */ SerecoMetaData result = importerToTest.importResult(xml, ScanType.WEB_SCAN); @@ -132,7 +132,7 @@ void test_xml_import_netsparker_1_9_1_977_contains_4_vulnerablities() throws Exc @Test void test_xml_import_netsparker_1_9_1_977_contains_specific_vulnerability() throws Exception { /* prepare */ - String xml = support.loadTestFile(SerecoTestFileSupport.NETSPARKER_V1_9_1_977_XML_TESTFILE); + String xml = support.loadTestFile(TestSerecoFileSupport.NETSPARKER_V1_9_1_977_XML_TESTFILE); /* execute */ SerecoMetaData result = importerToTest.importResult(xml, ScanType.WEB_SCAN); @@ -184,7 +184,7 @@ void test_xml_import_netsparker_1_9_1_977_contains_specific_vulnerability() thro @Test void test_xml_import_netsparker_1_9_1_977_contains_specific_vulnerability_with_table() throws Exception { /* prepare */ - String xml = support.loadTestFile(SerecoTestFileSupport.NETSPARKER_V1_9_1_977_XML_TESTFILE); + String xml = support.loadTestFile(TestSerecoFileSupport.NETSPARKER_V1_9_1_977_XML_TESTFILE); /* execute */ SerecoMetaData result = importerToTest.importResult(xml, ScanType.WEB_SCAN); diff --git a/sechub-sereco/src/test/java/com/mercedesbenz/sechub/sereco/importer/SarifV1JSONImporterTest.java b/sechub-sereco/src/test/java/com/mercedesbenz/sechub/sereco/importer/SarifV1JSONImporterTest.java index ab90d5f2e2..d380f5ab68 100644 --- a/sechub-sereco/src/test/java/com/mercedesbenz/sechub/sereco/importer/SarifV1JSONImporterTest.java +++ b/sechub-sereco/src/test/java/com/mercedesbenz/sechub/sereco/importer/SarifV1JSONImporterTest.java @@ -22,7 +22,7 @@ import com.mercedesbenz.sechub.sereco.metadata.SerecoVulnerability; import com.mercedesbenz.sechub.sereco.metadata.SerecoWebRequest; import com.mercedesbenz.sechub.sereco.metadata.SerecoWebResponse; -import com.mercedesbenz.sechub.sereco.test.SerecoTestFileSupport; +import com.mercedesbenz.sechub.sereco.test.TestSerecoFileSupport; class SarifV1JSONImporterTest { @@ -582,7 +582,7 @@ void sarif_report_threadflow_locations() throws Exception { /* + ................Helpers......................... + */ /* ++++++++++++++++++++++++++++++++++++++++++++++++++++ */ private static String loadSarifTestFile(String sarifTestFile) { - return SerecoTestFileSupport.INSTANCE.loadTestFile("sarif/" + sarifTestFile); + return TestSerecoFileSupport.INSTANCE.loadTestFile("sarif/" + sarifTestFile); } private SerecoVulnerability fetchFirstNonFalsePositive(List vulnerabilities) { diff --git a/sechub-sereco/src/test/java/com/mercedesbenz/sechub/sereco/importer/SpdxV1JSONImporterTest.java b/sechub-sereco/src/test/java/com/mercedesbenz/sechub/sereco/importer/SpdxV1JSONImporterTest.java index a450c1f4bc..ccf1e75c34 100644 --- a/sechub-sereco/src/test/java/com/mercedesbenz/sechub/sereco/importer/SpdxV1JSONImporterTest.java +++ b/sechub-sereco/src/test/java/com/mercedesbenz/sechub/sereco/importer/SpdxV1JSONImporterTest.java @@ -11,7 +11,7 @@ import com.mercedesbenz.sechub.commons.model.ScanType; import com.mercedesbenz.sechub.sereco.metadata.SerecoMetaData; -import com.mercedesbenz.sechub.sereco.test.SerecoTestFileSupport; +import com.mercedesbenz.sechub.sereco.test.TestSerecoFileSupport; public class SpdxV1JSONImporterTest { private static String spdx_2_2_scancode; @@ -105,6 +105,6 @@ void importResult__import_spdx_2_2_scancode() throws IOException { /* + ................Helpers......................... + */ /* ++++++++++++++++++++++++++++++++++++++++++++++++++++ */ private static String loadSpdxTestFile(String spdxTestFile) { - return SerecoTestFileSupport.INSTANCE.loadTestFile("spdx/" + spdxTestFile); + return TestSerecoFileSupport.INSTANCE.loadTestFile("spdx/" + spdxTestFile); } } diff --git a/sechub-sereco/src/test/java/com/mercedesbenz/sechub/sereco/metadata/SerecoLicenseSpdxTest.java b/sechub-sereco/src/test/java/com/mercedesbenz/sechub/sereco/metadata/SerecoLicenseSpdxTest.java index bed6bd054a..6131e786c2 100644 --- a/sechub-sereco/src/test/java/com/mercedesbenz/sechub/sereco/metadata/SerecoLicenseSpdxTest.java +++ b/sechub-sereco/src/test/java/com/mercedesbenz/sechub/sereco/metadata/SerecoLicenseSpdxTest.java @@ -6,7 +6,7 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import com.mercedesbenz.sechub.sereco.test.SerecoTestFileSupport; +import com.mercedesbenz.sechub.sereco.test.TestSerecoFileSupport; public class SerecoLicenseSpdxTest { private static String spdx_2_2_scancode_json; @@ -83,6 +83,6 @@ void of_spdx_rdf_can_be_created() { /* + ................Helpers......................... + */ /* ++++++++++++++++++++++++++++++++++++++++++++++++++++ */ private static String loadSpdxTestFile(String spdxTestFile) { - return SerecoTestFileSupport.INSTANCE.loadTestFile("spdx/" + spdxTestFile); + return TestSerecoFileSupport.INSTANCE.loadTestFile("spdx/" + spdxTestFile); } } diff --git a/sechub-sereco/src/test/java/com/mercedesbenz/sechub/sereco/metadata/MetaDataAccess.java b/sechub-sereco/src/test/java/com/mercedesbenz/sechub/sereco/metadata/TestMetaDataAccess.java similarity index 96% rename from sechub-sereco/src/test/java/com/mercedesbenz/sechub/sereco/metadata/MetaDataAccess.java rename to sechub-sereco/src/test/java/com/mercedesbenz/sechub/sereco/metadata/TestMetaDataAccess.java index d321c7ab87..784b6567fb 100644 --- a/sechub-sereco/src/test/java/com/mercedesbenz/sechub/sereco/metadata/MetaDataAccess.java +++ b/sechub-sereco/src/test/java/com/mercedesbenz/sechub/sereco/metadata/TestMetaDataAccess.java @@ -3,7 +3,7 @@ import java.util.List; -public class MetaDataAccess { +public class TestMetaDataAccess { public static void setClassification(SerecoVulnerability search, SerecoClassification classification) { search.classification = classification; diff --git a/sechub-sereco/src/test/java/com/mercedesbenz/sechub/sereco/test/AssertVulnerabilities.java b/sechub-sereco/src/test/java/com/mercedesbenz/sechub/sereco/test/AssertVulnerabilities.java index 6775a7f9bc..78de008993 100644 --- a/sechub-sereco/src/test/java/com/mercedesbenz/sechub/sereco/test/AssertVulnerabilities.java +++ b/sechub-sereco/src/test/java/com/mercedesbenz/sechub/sereco/test/AssertVulnerabilities.java @@ -17,7 +17,6 @@ import com.mercedesbenz.sechub.commons.core.util.SimpleStringUtils; import com.mercedesbenz.sechub.commons.model.ScanType; -import com.mercedesbenz.sechub.sereco.metadata.MetaDataAccess; import com.mercedesbenz.sechub.sereco.metadata.SerecoClassification; import com.mercedesbenz.sechub.sereco.metadata.SerecoCodeCallStackElement; import com.mercedesbenz.sechub.sereco.metadata.SerecoDetection; @@ -28,12 +27,13 @@ import com.mercedesbenz.sechub.sereco.metadata.SerecoWebBody; import com.mercedesbenz.sechub.sereco.metadata.SerecoWebRequest; import com.mercedesbenz.sechub.sereco.metadata.SerecoWebResponse; +import com.mercedesbenz.sechub.sereco.metadata.TestMetaDataAccess; public class AssertVulnerabilities { private static final Logger LOG = LoggerFactory.getLogger(AssertVulnerabilities.class); - private static VulnerabilityTestDescriptionBuilder descriptionBuilder = new VulnerabilityTestDescriptionBuilder(); + private static TestVulnerabilityDescriptionBuilder descriptionBuilder = new TestVulnerabilityDescriptionBuilder(); private List vulnerabilities = new ArrayList<>(); @@ -135,7 +135,7 @@ private VulnerabilityFinder() { String description = ""; SerecoClassification classification = null; - search = MetaDataAccess.createVulnerability(type, severity, list, description, classification); + search = TestMetaDataAccess.createVulnerability(type, severity, list, description, classification); } private List find(StringBuilder message) { @@ -379,7 +379,7 @@ public class AssertClassification { private AssertClassification() { classification = new SerecoClassification(); - MetaDataAccess.setClassification(VulnerabilityFinder.this.search, classification); + TestMetaDataAccess.setClassification(VulnerabilityFinder.this.search, classification); } public AssertClassification hipaa(String hipaa) { @@ -453,12 +453,12 @@ public WebVulnerabilityFinder withTarget(String target) { } public WebVulnerabilityFinder withWebRequest(SerecoWebRequest webRequest) { - MetaDataAccess.setWebRequest(search, webRequest); + TestMetaDataAccess.setWebRequest(search, webRequest); return this; } public WebVulnerabilityFinder withWebResponse(SerecoWebResponse webResponse) { - MetaDataAccess.setWebResponse(search, webResponse); + TestMetaDataAccess.setWebResponse(search, webResponse); return this; } diff --git a/sechub-sereco/src/test/java/com/mercedesbenz/sechub/sereco/test/AssertVulnerabilitiesParamTest.java b/sechub-sereco/src/test/java/com/mercedesbenz/sechub/sereco/test/AssertVulnerabilitiesParamTest.java index 17e58b1430..a3c212632e 100644 --- a/sechub-sereco/src/test/java/com/mercedesbenz/sechub/sereco/test/AssertVulnerabilitiesParamTest.java +++ b/sechub-sereco/src/test/java/com/mercedesbenz/sechub/sereco/test/AssertVulnerabilitiesParamTest.java @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT package com.mercedesbenz.sechub.sereco.test; -import static com.mercedesbenz.sechub.sereco.test.VulnerabilityTestDataKey.*; +import static com.mercedesbenz.sechub.sereco.test.TestVulnerabilityDataKey.*; import java.util.ArrayList; import java.util.Collection; @@ -23,7 +23,7 @@ public class AssertVulnerabilitiesParamTest { @Parameter - public VulnerabilityMutableTestData currentTestData; + public TestVulnerabilityMutableData currentTestData; @Test public void healthCheck_full_setup_is_found() { @@ -82,8 +82,8 @@ private SerecoVulnerability createVulnerabilityWithCurrentTestData() { return testVulnerability; } - public static VulnerabilityMutableTestData createTestDataElement() { - return new VulnerabilityMutableTestData(); + public static TestVulnerabilityMutableData createTestDataElement() { + return new TestVulnerabilityMutableData(); } @Parameters(name = "parameter test {index}:{0}") @@ -94,7 +94,7 @@ public static Collection createDataForParameterizedTests() { result.add(new Object[] { createTestDataElement() }); // for each key add the test data again, but touch it for the key... - for (VulnerabilityTestDataKey key : values()) { + for (TestVulnerabilityDataKey key : values()) { result.add(new Object[] { createTestDataElement().touch(key) }); } return result; diff --git a/sechub-sereco/src/test/java/com/mercedesbenz/sechub/sereco/test/SerecoTestFileSupport.java b/sechub-sereco/src/test/java/com/mercedesbenz/sechub/sereco/test/TestSerecoFileSupport.java similarity index 76% rename from sechub-sereco/src/test/java/com/mercedesbenz/sechub/sereco/test/SerecoTestFileSupport.java rename to sechub-sereco/src/test/java/com/mercedesbenz/sechub/sereco/test/TestSerecoFileSupport.java index 672cde8645..6731196019 100644 --- a/sechub-sereco/src/test/java/com/mercedesbenz/sechub/sereco/test/SerecoTestFileSupport.java +++ b/sechub-sereco/src/test/java/com/mercedesbenz/sechub/sereco/test/TestSerecoFileSupport.java @@ -3,16 +3,16 @@ import com.mercedesbenz.sechub.test.TestFileSupport; -public class SerecoTestFileSupport extends TestFileSupport { +public class TestSerecoFileSupport extends TestFileSupport { public static final String NETSPARKER_RESULT_XML_TESTFILE1 = "netsparker/netsparker_v1.0.40.109_scan_result_output_vulnerabilities.xml"; public static final String NETSPARKER_RESULT_JSON_TESTFILE1 = "netsparker/netsparker_v1.0.40.109_scan_result_output_vulnerabilities.json"; public static final String NETSPARKER_V1_9_1_977_XML_TESTFILE = "netsparker/netsparker_v1.9.1.977_scan_result_output_vulnerabilities.xml"; - public static final SerecoTestFileSupport INSTANCE = new SerecoTestFileSupport(); + public static final TestSerecoFileSupport INSTANCE = new TestSerecoFileSupport(); - protected SerecoTestFileSupport() { + protected TestSerecoFileSupport() { super("sechub-sereco/src/test/resources"); } diff --git a/sechub-sereco/src/test/java/com/mercedesbenz/sechub/sereco/test/VulnerabilityTestDataKey.java b/sechub-sereco/src/test/java/com/mercedesbenz/sechub/sereco/test/TestVulnerabilityDataKey.java similarity index 87% rename from sechub-sereco/src/test/java/com/mercedesbenz/sechub/sereco/test/VulnerabilityTestDataKey.java rename to sechub-sereco/src/test/java/com/mercedesbenz/sechub/sereco/test/TestVulnerabilityDataKey.java index c817f04167..3423bad25e 100644 --- a/sechub-sereco/src/test/java/com/mercedesbenz/sechub/sereco/test/VulnerabilityTestDataKey.java +++ b/sechub-sereco/src/test/java/com/mercedesbenz/sechub/sereco/test/TestVulnerabilityDataKey.java @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT package com.mercedesbenz.sechub.sereco.test; -enum VulnerabilityTestDataKey { +enum TestVulnerabilityDataKey { CAPEC, URL, diff --git a/sechub-sereco/src/test/java/com/mercedesbenz/sechub/sereco/test/VulnerabilityTestDescriptionBuilder.java b/sechub-sereco/src/test/java/com/mercedesbenz/sechub/sereco/test/TestVulnerabilityDescriptionBuilder.java similarity index 98% rename from sechub-sereco/src/test/java/com/mercedesbenz/sechub/sereco/test/VulnerabilityTestDescriptionBuilder.java rename to sechub-sereco/src/test/java/com/mercedesbenz/sechub/sereco/test/TestVulnerabilityDescriptionBuilder.java index 1af7b5ef54..eaced5e5f0 100644 --- a/sechub-sereco/src/test/java/com/mercedesbenz/sechub/sereco/test/VulnerabilityTestDescriptionBuilder.java +++ b/sechub-sereco/src/test/java/com/mercedesbenz/sechub/sereco/test/TestVulnerabilityDescriptionBuilder.java @@ -8,7 +8,7 @@ import com.mercedesbenz.sechub.sereco.metadata.SerecoWebRequest; import com.mercedesbenz.sechub.sereco.metadata.SerecoWebResponse; -public class VulnerabilityTestDescriptionBuilder { +public class TestVulnerabilityDescriptionBuilder { private static final String INDENTION = " "; public String describe(SerecoVulnerability vulnerability) { diff --git a/sechub-sereco/src/test/java/com/mercedesbenz/sechub/sereco/test/VulnerabilityMutableTestData.java b/sechub-sereco/src/test/java/com/mercedesbenz/sechub/sereco/test/TestVulnerabilityMutableData.java similarity index 80% rename from sechub-sereco/src/test/java/com/mercedesbenz/sechub/sereco/test/VulnerabilityMutableTestData.java rename to sechub-sereco/src/test/java/com/mercedesbenz/sechub/sereco/test/TestVulnerabilityMutableData.java index f469750d9c..87be72355d 100644 --- a/sechub-sereco/src/test/java/com/mercedesbenz/sechub/sereco/test/VulnerabilityMutableTestData.java +++ b/sechub-sereco/src/test/java/com/mercedesbenz/sechub/sereco/test/TestVulnerabilityMutableData.java @@ -18,14 +18,14 @@ * @author Albert Tregnaghi * */ -public class VulnerabilityMutableTestData { +public class TestVulnerabilityMutableData { - private List touchedFields = new ArrayList<>(); + private List touchedFields = new ArrayList<>(); private SerecoSeverity lastChangedSeverity = SerecoSeverity.HIGH; - private Map intMap = new HashMap<>(); + private Map intMap = new HashMap<>(); public SerecoSeverity getSeverity() { - if (touchedFields.contains(VulnerabilityTestDataKey.SEVERITY)) { + if (touchedFields.contains(TestVulnerabilityDataKey.SEVERITY)) { int index = lastChangedSeverity.ordinal(); index++; if (index >= SerecoSeverity.values().length) { @@ -38,14 +38,14 @@ public SerecoSeverity getSeverity() { return SerecoSeverity.HIGH; } - public String get(VulnerabilityTestDataKey field) { + public String get(TestVulnerabilityDataKey field) { if (isTouched(field)) { return field.name() + System.nanoTime(); } return field.name(); } - public int getInt(VulnerabilityTestDataKey field) { + public int getInt(TestVulnerabilityDataKey field) { AtomicInteger integer = intMap.computeIfAbsent(field, k -> new AtomicInteger()); if (isTouched(field)) { return integer.incrementAndGet(); @@ -53,7 +53,7 @@ public int getInt(VulnerabilityTestDataKey field) { return integer.get(); } - private boolean isTouched(VulnerabilityTestDataKey field) { + private boolean isTouched(TestVulnerabilityDataKey field) { return touchedFields.contains(field); } @@ -63,7 +63,7 @@ private boolean isTouched(VulnerabilityTestDataKey field) { * @param field * @return */ - public VulnerabilityMutableTestData touch(VulnerabilityTestDataKey field) { + public TestVulnerabilityMutableData touch(TestVulnerabilityDataKey field) { touchedFields.add(field); return this; } diff --git a/sechub-shared-kernel/src/test/java/com/mercedesbenz/sechub/sharedkernel/SharedKernelTestFileSupport.java b/sechub-shared-kernel/src/test/java/com/mercedesbenz/sechub/sharedkernel/TestSharedKernelFileSupport.java similarity index 54% rename from sechub-shared-kernel/src/test/java/com/mercedesbenz/sechub/sharedkernel/SharedKernelTestFileSupport.java rename to sechub-shared-kernel/src/test/java/com/mercedesbenz/sechub/sharedkernel/TestSharedKernelFileSupport.java index 740f47a8b1..8da4afe2be 100644 --- a/sechub-shared-kernel/src/test/java/com/mercedesbenz/sechub/sharedkernel/SharedKernelTestFileSupport.java +++ b/sechub-shared-kernel/src/test/java/com/mercedesbenz/sechub/sharedkernel/TestSharedKernelFileSupport.java @@ -5,14 +5,14 @@ import com.mercedesbenz.sechub.test.TestFileSupport; @SechubTestComponent -public class SharedKernelTestFileSupport extends TestFileSupport { - private static final SharedKernelTestFileSupport TESTFILE_SUPPORT = new SharedKernelTestFileSupport(); +public class TestSharedKernelFileSupport extends TestFileSupport { + private static final TestSharedKernelFileSupport TESTFILE_SUPPORT = new TestSharedKernelFileSupport(); - public static SharedKernelTestFileSupport getTestfileSupport() { + public static TestSharedKernelFileSupport getTestfileSupport() { return TESTFILE_SUPPORT; } - SharedKernelTestFileSupport() { + TestSharedKernelFileSupport() { super("sechub-shared-kernel/src/test/resources"); } diff --git a/sechub-shared-kernel/src/test/java/com/mercedesbenz/sechub/sharedkernel/configuration/SecHubConfigurationTest.java b/sechub-shared-kernel/src/test/java/com/mercedesbenz/sechub/sharedkernel/configuration/SecHubConfigurationTest.java index 0dde98be78..161c686d87 100644 --- a/sechub-shared-kernel/src/test/java/com/mercedesbenz/sechub/sharedkernel/configuration/SecHubConfigurationTest.java +++ b/sechub-shared-kernel/src/test/java/com/mercedesbenz/sechub/sharedkernel/configuration/SecHubConfigurationTest.java @@ -31,7 +31,7 @@ import com.mercedesbenz.sechub.commons.model.login.Page; import com.mercedesbenz.sechub.commons.model.login.Script; import com.mercedesbenz.sechub.commons.model.login.WebLoginConfiguration; -import com.mercedesbenz.sechub.sharedkernel.SharedKernelTestFileSupport; +import com.mercedesbenz.sechub.sharedkernel.TestSharedKernelFileSupport; import com.mercedesbenz.sechub.test.PojoTester; public class SecHubConfigurationTest { @@ -47,7 +47,7 @@ public void before() { @Test public void webscan_login_basic_json_has_webconfig_as_expected() throws Exception { /* prepare */ - String json = SharedKernelTestFileSupport.getTestfileSupport().loadTestFile("webscan/webscan_login_basic.json"); + String json = TestSharedKernelFileSupport.getTestfileSupport().loadTestFile("webscan/webscan_login_basic.json"); /* execute */ SecHubConfiguration result = SECHUB_CONFIG.fromJSON(json); @@ -77,7 +77,7 @@ public void webscan_login_basic_json_has_webconfig_as_expected() throws Exceptio @Test public void webscan_login_form_script_json_has_webconfig_as_expected() throws Exception { /* prepare */ - String json = SharedKernelTestFileSupport.getTestfileSupport().loadTestFile("webscan/webscan_login_form_script.json"); + String json = TestSharedKernelFileSupport.getTestfileSupport().loadTestFile("webscan/webscan_login_form_script.json"); /* execute */ SecHubConfiguration result = SECHUB_CONFIG.fromJSON(json); @@ -131,7 +131,7 @@ public void webscan_login_form_script_json_has_webconfig_as_expected() throws Ex @Test public void webscan_login_form_script_with_descriptions_json_has_webconfig_as_expected() throws Exception { /* prepare */ - String json = SharedKernelTestFileSupport.getTestfileSupport().loadTestFile("webscan/webscan_login_form_script_with_descriptions.json"); + String json = TestSharedKernelFileSupport.getTestfileSupport().loadTestFile("webscan/webscan_login_form_script_with_descriptions.json"); /* execute */ SecHubConfiguration result = SECHUB_CONFIG.fromJSON(json); @@ -192,7 +192,7 @@ public void webscan_login_form_script_with_descriptions_json_has_webconfig_as_ex @Test public void webscan_login_form_script_with_wait_json_has_webconfig_as_expected() throws Exception { /* prepare */ - String json = SharedKernelTestFileSupport.getTestfileSupport().loadTestFile("webscan/webscan_login_form_script_with_wait.json"); + String json = TestSharedKernelFileSupport.getTestfileSupport().loadTestFile("webscan/webscan_login_form_script_with_wait.json"); /* execute */ SecHubConfiguration result = SECHUB_CONFIG.fromJSON(json); @@ -251,7 +251,7 @@ public void webscan_login_form_script_with_wait_json_has_webconfig_as_expected() @Test public void webscan_alloptions_json_has_webconfig_with_all_examples() throws Exception { /* prepare */ - String json = SharedKernelTestFileSupport.getTestfileSupport().loadTestFile("webscan/webscan_alloptions.json"); + String json = TestSharedKernelFileSupport.getTestfileSupport().loadTestFile("webscan/webscan_alloptions.json"); /* execute */ SecHubConfiguration result = SECHUB_CONFIG.fromJSON(json); @@ -350,7 +350,7 @@ public void webscan_alloptions_json_has_webconfig_with_all_examples() throws Exc @Test public void sechub_config0_json_file_from_json_has_no_webconfig_or_infraconfig_but_api_version_1() throws Exception { /* prepare */ - String json = SharedKernelTestFileSupport.getTestfileSupport().loadTestFile("sechub_config0.json"); + String json = TestSharedKernelFileSupport.getTestfileSupport().loadTestFile("sechub_config0.json"); /* execute */ SecHubConfiguration result = SECHUB_CONFIG.fromJSON(json); @@ -364,7 +364,7 @@ public void sechub_config0_json_file_from_json_has_no_webconfig_or_infraconfig_b @Test public void sechub_config1_json_file_from_json_has_webconfig_with_url() throws Exception { /* prepare */ - String json = SharedKernelTestFileSupport.getTestfileSupport().loadTestFile("sechub_config1.json"); + String json = TestSharedKernelFileSupport.getTestfileSupport().loadTestFile("sechub_config1.json"); /* execute */ SecHubConfiguration result = SECHUB_CONFIG.fromJSON(json); @@ -377,7 +377,7 @@ public void sechub_config1_json_file_from_json_has_webconfig_with_url() throws E @Test public void sechub_config2_json_file_from_json_has_infraconfig_with_url() throws Exception { /* prepare */ - String json = SharedKernelTestFileSupport.getTestfileSupport().loadTestFile("sechub_config2.json"); + String json = TestSharedKernelFileSupport.getTestfileSupport().loadTestFile("sechub_config2.json"); /* execute */ SecHubConfiguration result = SECHUB_CONFIG.fromJSON(json); @@ -390,7 +390,7 @@ public void sechub_config2_json_file_from_json_has_infraconfig_with_url() throws @Test public void sechub_config2_json_file_from_json_has_infraconfig_with_ips() throws Exception { /* prepare */ - String json = SharedKernelTestFileSupport.getTestfileSupport().loadTestFile("sechub_config2.json"); + String json = TestSharedKernelFileSupport.getTestfileSupport().loadTestFile("sechub_config2.json"); /* execute */ SecHubConfiguration result = SECHUB_CONFIG.fromJSON(json); @@ -405,7 +405,7 @@ public void sechub_config2_json_file_from_json_has_infraconfig_with_ips() throws @Test public void sechub_config2_json_file_from_json_has_no_codescanconfig() throws Exception { /* prepare */ - String json = SharedKernelTestFileSupport.getTestfileSupport().loadTestFile("sechub_config2.json"); + String json = TestSharedKernelFileSupport.getTestfileSupport().loadTestFile("sechub_config2.json"); /* execute */ SecHubConfiguration result = SECHUB_CONFIG.fromJSON(json); @@ -418,7 +418,7 @@ public void sechub_config2_json_file_from_json_has_no_codescanconfig() throws Ex @Test public void sechub_config4_json_file_from_json_has_codescanconfig_with_folders() throws Exception { /* prepare */ - String json = SharedKernelTestFileSupport.getTestfileSupport().loadTestFile("sechub_config4.json"); + String json = TestSharedKernelFileSupport.getTestfileSupport().loadTestFile("sechub_config4.json"); /* execute */ SecHubConfiguration result = SECHUB_CONFIG.fromJSON(json); @@ -490,7 +490,7 @@ public void when_infracan_set_its_present() { @Test public void webscan_max_scan_duration_wrong_unit() { /* prepare */ - String json = SharedKernelTestFileSupport.getTestfileSupport().loadTestFile("webscan/webscan_max_scan_duration_wrong_unit.json"); + String json = TestSharedKernelFileSupport.getTestfileSupport().loadTestFile("webscan/webscan_max_scan_duration_wrong_unit.json"); /* execute + test */ assertThrows(JSONConverterException.class, () -> { @@ -501,7 +501,7 @@ public void webscan_max_scan_duration_wrong_unit() { @Test public void webscan_empty_includes_excludes() { /* prepare */ - String json = SharedKernelTestFileSupport.getTestfileSupport().loadTestFile("webscan/webscan_empty_includes_excludes.json"); + String json = TestSharedKernelFileSupport.getTestfileSupport().loadTestFile("webscan/webscan_empty_includes_excludes.json"); /* execute */ SecHubConfiguration result = SECHUB_CONFIG.fromJSON(json); @@ -530,7 +530,7 @@ public void webscan_empty_includes_excludes() { public void a_sechub_configuration_JSON_with_license_scan_can_be_read_and_license_scan_has_correct_data_configuration_reference() { /* prepare */ String expectedDataConfigName = "build-artifacts"; - String json = SharedKernelTestFileSupport.getTestfileSupport().loadTestFile("licensescan/license_scan.json"); + String json = TestSharedKernelFileSupport.getTestfileSupport().loadTestFile("licensescan/license_scan.json"); /* execute */ SecHubConfiguration result = SECHUB_CONFIG.fromJSON(json); @@ -548,7 +548,7 @@ public void a_sechub_configuration_JSON_with_license_scan_can_be_read_and_licens public void a_sechub_configuration_JSON_with_secret_scan_can_be_read_and_secret_scan_has_correct_data_configuration_reference() { /* prepare */ String expectedDataConfigName = "files"; - String json = SharedKernelTestFileSupport.getTestfileSupport().loadTestFile("secretscan/secret_scan.json"); + String json = TestSharedKernelFileSupport.getTestfileSupport().loadTestFile("secretscan/secret_scan.json"); /* execute */ SecHubConfiguration result = SECHUB_CONFIG.fromJSON(json); @@ -565,7 +565,7 @@ public void a_sechub_configuration_JSON_with_secret_scan_can_be_read_and_secret_ @Test public void a_sechub_configuration_JSON_with_data_section_containing_unknown_excludes_can_be_read() { /* prepare */ - String json = SharedKernelTestFileSupport.getTestfileSupport().loadTestFile("codescan/code_scan-with-datasections-and-unknown-excludes.json"); + String json = TestSharedKernelFileSupport.getTestfileSupport().loadTestFile("codescan/code_scan-with-datasections-and-unknown-excludes.json"); /* execute */ SecHubConfiguration result = SECHUB_CONFIG.fromJSON(json); @@ -578,7 +578,7 @@ public void a_sechub_configuration_JSON_with_data_section_containing_unknown_exc @Test public void a_sechub_configuration_JSON_with_combined_unknown_properties_can_be_read() { /* prepare */ - String json = SharedKernelTestFileSupport.getTestfileSupport().loadTestFile("combined_config_with_unknown_parts_everywhere.json"); + String json = TestSharedKernelFileSupport.getTestfileSupport().loadTestFile("combined_config_with_unknown_parts_everywhere.json"); /* execute */ SecHubConfiguration result = SECHUB_CONFIG.fromJSON(json); diff --git a/sechub-shared-kernel/src/test/java/com/mercedesbenz/sechub/sharedkernel/monitoring/PerformanceMonitorServiceManualTest.java b/sechub-shared-kernel/src/test/java/com/mercedesbenz/sechub/sharedkernel/monitoring/PerformanceMonitorServiceManualTest.java index 43e765a94a..3c16211da6 100644 --- a/sechub-shared-kernel/src/test/java/com/mercedesbenz/sechub/sharedkernel/monitoring/PerformanceMonitorServiceManualTest.java +++ b/sechub-shared-kernel/src/test/java/com/mercedesbenz/sechub/sharedkernel/monitoring/PerformanceMonitorServiceManualTest.java @@ -56,13 +56,13 @@ public void measure() { int threadNr = 0; if (mode == TestMode.CPU) { if (freezeComputerAccepted) { - new CPUConsumer().consumeCPUTime(monitor, maxThreads, 100, 500); + new TestCPUConsumer().consumeCPUTime(monitor, maxThreads, 100, 500); } else { - new SimulatedSchedulerAsManagedCPUConsumer().simulateScheduler(monitor, 100, 300); + new SimulatedSchedulerAsManagedCPUConsumerTest().simulateScheduler(monitor, 100, 300); } } if (mode == TestMode.MEMORY) { - new MemoryConsumer().consumeMemory(monitor, maxThreads, threadNr); + new TestMemoryConsumer().consumeMemory(monitor, maxThreads, threadNr); } } diff --git a/sechub-shared-kernel/src/test/java/com/mercedesbenz/sechub/sharedkernel/monitoring/SimulatedSchedulerAsManagedCPUConsumer.java b/sechub-shared-kernel/src/test/java/com/mercedesbenz/sechub/sharedkernel/monitoring/SimulatedSchedulerAsManagedCPUConsumerTest.java similarity index 94% rename from sechub-shared-kernel/src/test/java/com/mercedesbenz/sechub/sharedkernel/monitoring/SimulatedSchedulerAsManagedCPUConsumer.java rename to sechub-shared-kernel/src/test/java/com/mercedesbenz/sechub/sharedkernel/monitoring/SimulatedSchedulerAsManagedCPUConsumerTest.java index 21c6901921..8af278ce1b 100644 --- a/sechub-shared-kernel/src/test/java/com/mercedesbenz/sechub/sharedkernel/monitoring/SimulatedSchedulerAsManagedCPUConsumer.java +++ b/sechub-shared-kernel/src/test/java/com/mercedesbenz/sechub/sharedkernel/monitoring/SimulatedSchedulerAsManagedCPUConsumerTest.java @@ -6,12 +6,12 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class SimulatedSchedulerAsManagedCPUConsumer { +public class SimulatedSchedulerAsManagedCPUConsumerTest { - private static final Logger LOG = LoggerFactory.getLogger(SimulatedSchedulerAsManagedCPUConsumer.class); + private static final Logger LOG = LoggerFactory.getLogger(SimulatedSchedulerAsManagedCPUConsumerTest.class); private Random random; - SimulatedSchedulerAsManagedCPUConsumer() { + SimulatedSchedulerAsManagedCPUConsumerTest() { this.random = new Random(System.currentTimeMillis()); } diff --git a/sechub-shared-kernel/src/test/java/com/mercedesbenz/sechub/sharedkernel/monitoring/CPUConsumer.java b/sechub-shared-kernel/src/test/java/com/mercedesbenz/sechub/sharedkernel/monitoring/TestCPUConsumer.java similarity index 92% rename from sechub-shared-kernel/src/test/java/com/mercedesbenz/sechub/sharedkernel/monitoring/CPUConsumer.java rename to sechub-shared-kernel/src/test/java/com/mercedesbenz/sechub/sharedkernel/monitoring/TestCPUConsumer.java index d1d2ffd5f6..879846556d 100644 --- a/sechub-shared-kernel/src/test/java/com/mercedesbenz/sechub/sharedkernel/monitoring/CPUConsumer.java +++ b/sechub-shared-kernel/src/test/java/com/mercedesbenz/sechub/sharedkernel/monitoring/TestCPUConsumer.java @@ -6,13 +6,13 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class CPUConsumer { +public class TestCPUConsumer { - private static final Logger LOG = LoggerFactory.getLogger(CPUConsumer.class); + private static final Logger LOG = LoggerFactory.getLogger(TestCPUConsumer.class); private Random random; - CPUConsumer() { + TestCPUConsumer() { this.random = new Random(System.currentTimeMillis()); } diff --git a/sechub-shared-kernel/src/test/java/com/mercedesbenz/sechub/sharedkernel/monitoring/MemoryConsumer.java b/sechub-shared-kernel/src/test/java/com/mercedesbenz/sechub/sharedkernel/monitoring/TestMemoryConsumer.java similarity index 94% rename from sechub-shared-kernel/src/test/java/com/mercedesbenz/sechub/sharedkernel/monitoring/MemoryConsumer.java rename to sechub-shared-kernel/src/test/java/com/mercedesbenz/sechub/sharedkernel/monitoring/TestMemoryConsumer.java index 6b5aa6e29f..c6cea773e7 100644 --- a/sechub-shared-kernel/src/test/java/com/mercedesbenz/sechub/sharedkernel/monitoring/MemoryConsumer.java +++ b/sechub-shared-kernel/src/test/java/com/mercedesbenz/sechub/sharedkernel/monitoring/TestMemoryConsumer.java @@ -6,9 +6,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class MemoryConsumer { +public class TestMemoryConsumer { - private static final Logger LOG = LoggerFactory.getLogger(MemoryConsumer.class); + private static final Logger LOG = LoggerFactory.getLogger(TestMemoryConsumer.class); private Random random; public void consumeMemory(SystemMonitorService monitor, int maxThreads, int threadNr) { diff --git a/sechub-systemtest/src/test/java/com/mercedesbenz/sechub/systemtest/SystemTestFrameworkIntTest.java b/sechub-systemtest/src/test/java/com/mercedesbenz/sechub/systemtest/SystemTestFrameworkIntTest.java index 052b62642e..b9d95c3d6d 100644 --- a/sechub-systemtest/src/test/java/com/mercedesbenz/sechub/systemtest/SystemTestFrameworkIntTest.java +++ b/sechub-systemtest/src/test/java/com/mercedesbenz/sechub/systemtest/SystemTestFrameworkIntTest.java @@ -2,9 +2,9 @@ package com.mercedesbenz.sechub.systemtest; import static com.mercedesbenz.sechub.systemtest.SystemTestAPI.*; -import static com.mercedesbenz.sechub.systemtest.SystemTestExampleWriter.*; import static com.mercedesbenz.sechub.systemtest.TestConfigConstants.*; import static com.mercedesbenz.sechub.systemtest.TestConfigUtil.*; +import static com.mercedesbenz.sechub.systemtest.TestSystemExampleWriter.*; import static com.mercedesbenz.sechub.test.TestUtil.*; import static org.junit.jupiter.api.Assertions.*; diff --git a/sechub-systemtest/src/test/java/com/mercedesbenz/sechub/systemtest/SystemTestExampleWriter.java b/sechub-systemtest/src/test/java/com/mercedesbenz/sechub/systemtest/TestSystemExampleWriter.java similarity index 91% rename from sechub-systemtest/src/test/java/com/mercedesbenz/sechub/systemtest/SystemTestExampleWriter.java rename to sechub-systemtest/src/test/java/com/mercedesbenz/sechub/systemtest/TestSystemExampleWriter.java index 3e7c1f943a..2f8a0041fd 100644 --- a/sechub-systemtest/src/test/java/com/mercedesbenz/sechub/systemtest/SystemTestExampleWriter.java +++ b/sechub-systemtest/src/test/java/com/mercedesbenz/sechub/systemtest/TestSystemExampleWriter.java @@ -14,9 +14,9 @@ import com.mercedesbenz.sechub.commons.model.JsonMapperFactory; import com.mercedesbenz.sechub.systemtest.config.SystemTestConfiguration; -public class SystemTestExampleWriter { +public class TestSystemExampleWriter { - private static final Logger LOG = LoggerFactory.getLogger(SystemTestExampleWriter.class); + private static final Logger LOG = LoggerFactory.getLogger(TestSystemExampleWriter.class); public static void writeExample(SystemTestConfiguration configuration, String name) throws IOException { String configurationAsPrettyPrintedJson = createSmallPrettyPrintedJson(configuration); diff --git a/sechub-systemtest/src/test/java/com/mercedesbenz/sechub/systemtest/config/SystemTestConfigurationTest.java b/sechub-systemtest/src/test/java/com/mercedesbenz/sechub/systemtest/config/SystemTestConfigurationTest.java index 840f8246af..d1a6e1b618 100644 --- a/sechub-systemtest/src/test/java/com/mercedesbenz/sechub/systemtest/config/SystemTestConfigurationTest.java +++ b/sechub-systemtest/src/test/java/com/mercedesbenz/sechub/systemtest/config/SystemTestConfigurationTest.java @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT package com.mercedesbenz.sechub.systemtest.config; -import static com.mercedesbenz.sechub.systemtest.SystemTestExampleWriter.*; +import static com.mercedesbenz.sechub.systemtest.TestSystemExampleWriter.*; import static org.junit.jupiter.api.Assertions.*; import java.util.ArrayList; diff --git a/sechub-test/src/test/java/com/mercedesbenz/sechub/test/report/Sarif2Sereco2ScanSecHubReportLoaderTest.java b/sechub-test/src/test/java/com/mercedesbenz/sechub/test/report/Sarif2Sereco2ScanSecHubReportLoaderTest.java index 2dc14b2ec0..01c53b92a1 100644 --- a/sechub-test/src/test/java/com/mercedesbenz/sechub/test/report/Sarif2Sereco2ScanSecHubReportLoaderTest.java +++ b/sechub-test/src/test/java/com/mercedesbenz/sechub/test/report/Sarif2Sereco2ScanSecHubReportLoaderTest.java @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT package com.mercedesbenz.sechub.test.report; -import static com.mercedesbenz.sechub.test.report.ReportTestHelper.*; +import static com.mercedesbenz.sechub.test.report.TestReportHelper.*; import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; diff --git a/sechub-test/src/test/java/com/mercedesbenz/sechub/test/report/ReportTestHelper.java b/sechub-test/src/test/java/com/mercedesbenz/sechub/test/report/TestReportHelper.java similarity index 97% rename from sechub-test/src/test/java/com/mercedesbenz/sechub/test/report/ReportTestHelper.java rename to sechub-test/src/test/java/com/mercedesbenz/sechub/test/report/TestReportHelper.java index 6509cf0d25..21342b054d 100644 --- a/sechub-test/src/test/java/com/mercedesbenz/sechub/test/report/ReportTestHelper.java +++ b/sechub-test/src/test/java/com/mercedesbenz/sechub/test/report/TestReportHelper.java @@ -28,7 +28,7 @@ import com.mercedesbenz.sechub.test.TestFileReader; import com.mercedesbenz.sechub.test.TestUtil; -public class ReportTestHelper { +public class TestReportHelper { private static final String REPORT_PATH = "./src/test/resources/report/"; @@ -36,7 +36,7 @@ public class ReportTestHelper { private static final CheckmarxV1XMLImporter checkmarxImporter = new CheckmarxV1XMLImporter(); private static final SerecoProductResultTransformer serecoProductResultTransformer = new TestSerecoProductResultTransformer(); - private static final Logger LOG = LoggerFactory.getLogger(ReportTestHelper.class); + private static final Logger LOG = LoggerFactory.getLogger(TestReportHelper.class); public static String load3rdPartyReportAsString(String fullName) { return TestFileReader.readTextFromFile(new File(REPORT_PATH + "input/" + fullName)); diff --git a/sechub-test/src/test/java/com/mercedesbenz/sechub/test/report/ThymeLeafHTMLReportingTest.java b/sechub-test/src/test/java/com/mercedesbenz/sechub/test/report/ThymeLeafHTMLReportingTest.java index 82de29c04a..7a0d6e030d 100644 --- a/sechub-test/src/test/java/com/mercedesbenz/sechub/test/report/ThymeLeafHTMLReportingTest.java +++ b/sechub-test/src/test/java/com/mercedesbenz/sechub/test/report/ThymeLeafHTMLReportingTest.java @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT package com.mercedesbenz.sechub.test.report; -import static com.mercedesbenz.sechub.test.report.ReportTestHelper.*; +import static com.mercedesbenz.sechub.test.report.TestReportHelper.*; import static org.junit.jupiter.api.Assertions.*; import java.io.File; @@ -327,13 +327,13 @@ private TestReportContext(int exampleNumber, ProductIdentifier productIdentifier private void initReport() { switch (inputFormat) { case SECHUB_REPORT: - sourceReportAsString = ReportTestHelper.loadSecHubReportFileTemplate(exampleName + "_" + variant); + sourceReportAsString = TestReportHelper.loadSecHubReportFileTemplate(exampleName + "_" + variant); break; case CHECKMARX: - sourceReportAsString = ReportTestHelper.load3rdPartyReportAsString(exampleName + "_" + variant + ".xml"); + sourceReportAsString = TestReportHelper.load3rdPartyReportAsString(exampleName + "_" + variant + ".xml"); break; case SARIF: - sourceReportAsString = ReportTestHelper.loadSarifReport(exampleName + "_" + variant); + sourceReportAsString = TestReportHelper.loadSarifReport(exampleName + "_" + variant); break; default: throw new IllegalStateException("input format not supported:" + inputFormat); diff --git a/sechub-wrapper-prepare/src/test/java/com/mercedesbenz/sechub/wrapper/prepare/PrepareWrapperApplicationGitManualTest.java b/sechub-wrapper-prepare/src/test/java/com/mercedesbenz/sechub/wrapper/prepare/PrepareWrapperApplicationGitManualTest.java index 57ecdbb5d8..7bc23ac49f 100644 --- a/sechub-wrapper-prepare/src/test/java/com/mercedesbenz/sechub/wrapper/prepare/PrepareWrapperApplicationGitManualTest.java +++ b/sechub-wrapper-prepare/src/test/java/com/mercedesbenz/sechub/wrapper/prepare/PrepareWrapperApplicationGitManualTest.java @@ -17,7 +17,7 @@ class PrepareWrapperApplicationGitManualTest implements ManualTest { @BeforeAll static void beforeAll() throws Exception { - PrepareWrapperManualTestUtil.cleanup(); + TestPrepareWrapperManualUtil.cleanup(); } /** diff --git a/sechub-wrapper-prepare/src/test/java/com/mercedesbenz/sechub/wrapper/prepare/PrepareWrapperApplicationSkopeoManualTest.java b/sechub-wrapper-prepare/src/test/java/com/mercedesbenz/sechub/wrapper/prepare/PrepareWrapperApplicationSkopeoManualTest.java index d8769fd24c..b82f4669d8 100644 --- a/sechub-wrapper-prepare/src/test/java/com/mercedesbenz/sechub/wrapper/prepare/PrepareWrapperApplicationSkopeoManualTest.java +++ b/sechub-wrapper-prepare/src/test/java/com/mercedesbenz/sechub/wrapper/prepare/PrepareWrapperApplicationSkopeoManualTest.java @@ -17,7 +17,7 @@ class PrepareWrapperApplicationSkopeoManualTest implements ManualTest { @BeforeAll static void beforeAll() throws Exception { - PrepareWrapperManualTestUtil.cleanup(); + TestPrepareWrapperManualUtil.cleanup(); } @Test diff --git a/sechub-wrapper-prepare/src/test/java/com/mercedesbenz/sechub/wrapper/prepare/PrepareWrapperManualTestUtil.java b/sechub-wrapper-prepare/src/test/java/com/mercedesbenz/sechub/wrapper/prepare/TestPrepareWrapperManualUtil.java similarity index 94% rename from sechub-wrapper-prepare/src/test/java/com/mercedesbenz/sechub/wrapper/prepare/PrepareWrapperManualTestUtil.java rename to sechub-wrapper-prepare/src/test/java/com/mercedesbenz/sechub/wrapper/prepare/TestPrepareWrapperManualUtil.java index c9499bb773..27392ff584 100644 --- a/sechub-wrapper-prepare/src/test/java/com/mercedesbenz/sechub/wrapper/prepare/PrepareWrapperManualTestUtil.java +++ b/sechub-wrapper-prepare/src/test/java/com/mercedesbenz/sechub/wrapper/prepare/TestPrepareWrapperManualUtil.java @@ -6,7 +6,7 @@ import org.apache.commons.io.FileUtils; -public class PrepareWrapperManualTestUtil { +public class TestPrepareWrapperManualUtil { public static void cleanup() throws IOException { File manuelTestFolder = new File("./build/manual-test/");