Search in sources :

Example 1 with SecHubTimeUnit

use of com.mercedesbenz.sechub.commons.model.SecHubTimeUnit in project sechub by mercedes-benz.

the class NetsparkerLoginScriptGenerator method getWaitTimeInMilliseconds.

private Long getWaitTimeInMilliseconds(LoginScriptAction step) {
    Long wait = null;
    if (step.isWait()) {
        long waitValue = Long.valueOf(step.getValue());
        SecHubTimeUnit unit = step.getUnit();
        wait = waitValue * unit.getMultiplicatorMilliseconds();
    }
    return wait;
}
Also used : SecHubTimeUnit(com.mercedesbenz.sechub.commons.model.SecHubTimeUnit)

Example 2 with SecHubTimeUnit

use of com.mercedesbenz.sechub.commons.model.SecHubTimeUnit in project sechub by mercedes-benz.

the class SecHubTimeUnitTest method from_json_minute.

@ParameterizedTest
@ValueSource(strings = { "\"MINUTE\"", "\"minute\"", "\"minutes\"", "\"MINUTES\"" })
public void from_json_minute(String json) throws JsonMappingException, JsonProcessingException {
    /* prepare */
    ObjectMapper objectMapper = new ObjectMapper();
    /* execute */
    SecHubTimeUnit unit = objectMapper.readValue(json, SecHubTimeUnit.class);
    /* test */
    assertEquals(SecHubTimeUnit.MINUTE, unit);
}
Also used : ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) SecHubTimeUnit(com.mercedesbenz.sechub.commons.model.SecHubTimeUnit) ValueSource(org.junit.jupiter.params.provider.ValueSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 3 with SecHubTimeUnit

use of com.mercedesbenz.sechub.commons.model.SecHubTimeUnit in project sechub by mercedes-benz.

the class SecHubTimeUnitTest method from_json_hours.

@ParameterizedTest
@ValueSource(strings = { "\"HOUR\"", "\"hour\"", "\"hours\"", "\"HOURS\"" })
public void from_json_hours(String json) throws JsonMappingException, JsonProcessingException {
    /* prepare */
    ObjectMapper objectMapper = new ObjectMapper();
    /* execute */
    SecHubTimeUnit unit = objectMapper.readValue(json, SecHubTimeUnit.class);
    /* test */
    assertEquals(SecHubTimeUnit.HOUR, unit);
}
Also used : ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) SecHubTimeUnit(com.mercedesbenz.sechub.commons.model.SecHubTimeUnit) ValueSource(org.junit.jupiter.params.provider.ValueSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 4 with SecHubTimeUnit

use of com.mercedesbenz.sechub.commons.model.SecHubTimeUnit in project sechub by mercedes-benz.

the class SecHubTimeUnitTest method from_json_millisecond.

@ParameterizedTest
@ValueSource(strings = { "\"MILLISECOND\"", "\"millisecond\"", "\"milliseconds\"", "\"MILLISECONDS\"" })
public void from_json_millisecond(String json) throws JsonMappingException, JsonProcessingException {
    /* prepare */
    ObjectMapper objectMapper = new ObjectMapper();
    /* execute */
    SecHubTimeUnit unit = objectMapper.readValue(json, SecHubTimeUnit.class);
    /* test */
    assertEquals(SecHubTimeUnit.MILLISECOND, unit);
}
Also used : ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) SecHubTimeUnit(com.mercedesbenz.sechub.commons.model.SecHubTimeUnit) ValueSource(org.junit.jupiter.params.provider.ValueSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 5 with SecHubTimeUnit

use of com.mercedesbenz.sechub.commons.model.SecHubTimeUnit in project sechub by mercedes-benz.

the class SecHubTimeUnitTest method from_json_days.

@ParameterizedTest
@ValueSource(strings = { "\"DAY\"", "\"day\"", "\"days\"", "\"DAYS\"" })
public void from_json_days(String json) throws JsonMappingException, JsonProcessingException {
    /* prepare */
    ObjectMapper objectMapper = new ObjectMapper();
    /* execute */
    SecHubTimeUnit unit = objectMapper.readValue(json, SecHubTimeUnit.class);
    /* test */
    assertEquals(SecHubTimeUnit.DAY, unit);
}
Also used : ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) SecHubTimeUnit(com.mercedesbenz.sechub.commons.model.SecHubTimeUnit) ValueSource(org.junit.jupiter.params.provider.ValueSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

SecHubTimeUnit (com.mercedesbenz.sechub.commons.model.SecHubTimeUnit)11 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)7 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)5 ValueSource (org.junit.jupiter.params.provider.ValueSource)5 SecHubTimeUnitData (com.mercedesbenz.sechub.adapter.SecHubTimeUnitData)2 Test (org.junit.jupiter.api.Test)2 AdapterMetaData (com.mercedesbenz.sechub.adapter.AdapterMetaData)1 AdapterMetaDataCallback (com.mercedesbenz.sechub.adapter.AdapterMetaDataCallback)1 NetsparkerConfigBuilder (com.mercedesbenz.sechub.adapter.netsparker.NetsparkerConfig.NetsparkerConfigBuilder)1 WebScanDurationConfiguration (com.mercedesbenz.sechub.commons.model.WebScanDurationConfiguration)1 URI (java.net.URI)1