use of com.mercedesbenz.sechub.sharedkernel.execution.SecHubExecutionContext in project sechub by mercedes-benz.
the class WebConfigBuilderStrategyTest method includes_no_slash_infront_single.
@Test
public void includes_no_slash_infront_single() {
/* prepare */
List<String> includes = new LinkedList<>();
includes.add("contact.html");
String json = createIncludesJson(includes);
SecHubConfiguration configuration = SECHUB_CONFIG.fromJSON(json);
SecHubExecutionContext context = new SecHubExecutionContext(UUID.randomUUID(), configuration, "test");
WebConfigBuilderStrategy strategyToTest = new WebConfigBuilderStrategy(context);
TestAbstractWebScanAdapterConfigBuilder configBuilder = new TestAbstractWebScanAdapterConfigBuilder();
/* execute */
IllegalArgumentException exception = Assertions.assertThrows(IllegalArgumentException.class, () -> {
strategyToTest.configure(configBuilder);
});
/* test */
assertEquals("The URL does not start with a slash '/'. URL: contact.html", exception.getMessage());
}
use of com.mercedesbenz.sechub.sharedkernel.execution.SecHubExecutionContext in project sechub by mercedes-benz.
the class WebConfigBuilderStrategyTest method excludes_no_slash_infront_single.
@Test
public void excludes_no_slash_infront_single() {
/* prepare */
List<String> excludes = new LinkedList<>();
excludes.add("contact.html");
String json = createExcludesJson(excludes);
SecHubConfiguration configuration = SECHUB_CONFIG.fromJSON(json);
SecHubExecutionContext context = new SecHubExecutionContext(UUID.randomUUID(), configuration, "test");
WebConfigBuilderStrategy strategyToTest = new WebConfigBuilderStrategy(context);
TestAbstractWebScanAdapterConfigBuilder configBuilder = new TestAbstractWebScanAdapterConfigBuilder();
/* execute */
IllegalArgumentException exception = Assertions.assertThrows(IllegalArgumentException.class, () -> {
strategyToTest.configure(configBuilder);
});
/* test */
assertEquals("The URL does not start with a slash '/'. URL: contact.html", exception.getMessage());
}
use of com.mercedesbenz.sechub.sharedkernel.execution.SecHubExecutionContext in project sechub by mercedes-benz.
the class WebConfigBuilderStrategyTest method createContext.
private SecHubExecutionContext createContext(String pathToTestConfig) {
String json = ScanDomainTestFileSupport.getTestfileSupport().loadTestFile(pathToTestConfig);
SecHubConfiguration configuration = SECHUB_CONFIG.fromJSON(json);
return new SecHubExecutionContext(UUID.randomUUID(), configuration, "test");
}
use of com.mercedesbenz.sechub.sharedkernel.execution.SecHubExecutionContext in project sechub by mercedes-benz.
the class WebConfigBuilderStrategyTest method excludes_no_slash_infront_multiple.
@Test
public void excludes_no_slash_infront_multiple() {
/* prepare */
List<String> excludes = new LinkedList<>();
excludes.add("/abc");
excludes.add("contact.html");
excludes.add("/bca");
excludes.add("ccb/bca");
String json = createExcludesJson(excludes);
SecHubConfiguration configuration = SECHUB_CONFIG.fromJSON(json);
SecHubExecutionContext context = new SecHubExecutionContext(UUID.randomUUID(), configuration, "test");
WebConfigBuilderStrategy strategyToTest = new WebConfigBuilderStrategy(context);
TestAbstractWebScanAdapterConfigBuilder configBuilder = new TestAbstractWebScanAdapterConfigBuilder();
/* execute */
IllegalArgumentException exception = Assertions.assertThrows(IllegalArgumentException.class, () -> {
strategyToTest.configure(configBuilder);
});
/* test */
assertEquals("The URL does not start with a slash '/'. URL: contact.html", exception.getMessage());
}
use of com.mercedesbenz.sechub.sharedkernel.execution.SecHubExecutionContext in project sechub by mercedes-benz.
the class LicenseScanProductExecutionServiceImplTest method isExecutionNecessary_necessary.
@Test
void isExecutionNecessary_necessary() {
/* prepare */
UUIDTraceLogID traceId = UUIDTraceLogID.traceLogID(UUID.randomUUID());
SecHubExecutionContext context = mock(SecHubExecutionContext.class);
SecHubConfiguration configuration = new SecHubConfiguration();
SecHubLicenseScanConfiguration licenseScanConfig = new SecHubLicenseScanConfiguration();
configuration.setLicenseScan(licenseScanConfig);
/* execute + test */
assertTrue(licenseScanServiceToTest.isExecutionNecessary(context, traceId, configuration));
}
Aggregations