Skip to content
This repository has been archived by the owner on May 16, 2023. It is now read-only.

Commit

Permalink
Merge branch 'rel/0.5.9' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
christian-kirschnick committed Jun 4, 2020
2 parents 85c5d35 + e94400b commit 624d2ff
Show file tree
Hide file tree
Showing 13 changed files with 54 additions and 49 deletions.
2 changes: 1 addition & 1 deletion .mvn/maven.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-Drevision=0.5.8
-Drevision=0.5.9
-Dlicense.projectName=Corona-Warn-App
-Dlicense.inceptionYear=2020
-Dlicense.licenseName=apache_v2
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ private ParameterSpec() {
/**
* The allowed maximum value for a risk score.
*/
public static final int RISK_SCORE_MAX = 4096;
public static final int RISK_SCORE_MAX = 72;

/**
* The allowed minimum value for an attenuation threshold.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ private void validateUrl(String url) {

private void validateValueRangeCoverage() {
int partitionSum = riskScoreClassification.getRiskClassesList().stream()
.mapToInt(riskScoreClass -> (riskScoreClass.getMax() - riskScoreClass.getMin() + 1))
.mapToInt(riskScoreClass -> (riskScoreClass.getMax() - riskScoreClass.getMin()))
.sum();

if (partitionSum != ParameterSpec.RISK_SCORE_MAX + 1) {
if (partitionSum != ParameterSpec.RISK_SCORE_MAX) {
errors.add(new GeneralValidationError("covered value range", partitionSum, INVALID_PARTITIONING));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ public boolean equals(Object o) {
return Objects.equals(errors, that.errors);
}

public boolean hasError(ValidationError error) {
return this.errors.contains(error);
}

@Override
public int hashCode() {
return Objects.hash(errors);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#
# Change this file with caution!

min-risk-score: 90
min-risk-score: 11
attenuation-duration: !include attenuation-duration.yaml
risk-score-classes: !include risk-score-classification.yaml
exposure-config: !include exposure-config.yaml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
# Change this file with caution!

thresholds:
lower: 50
upper: 70
lower: 44
upper: 48
weights:
low: 1.0
mid: 0.5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,30 +29,30 @@ transmission:

duration:
eq_0_min: 0
gt_0_le_5_min: 1
gt_5_le_10_min: 2
gt_10_le_15_min: 4
gt_15_le_20_min: 5
gt_20_le_25_min: 7
gt_25_le_30_min: 8
gt_30_min: 8
gt_0_le_5_min: 0
gt_5_le_10_min: 0
gt_10_le_15_min: 1
gt_15_le_20_min: 1
gt_20_le_25_min: 1
gt_25_le_30_min: 1
gt_30_min: 1

days_since_last_exposure:
ge_14_days: 1
ge_12_lt_14_days: 1
ge_10_lt_12_days: 1
ge_8_lt_10_days: 1
ge_6_lt_8_days: 2
ge_4_lt_6_days: 6
ge_2_lt_4_days: 8
ge_0_lt_2_days: 6
ge_14_days: 5
ge_12_lt_14_days: 5
ge_10_lt_12_days: 5
ge_8_lt_10_days: 4
ge_6_lt_8_days: 4
ge_4_lt_6_days: 4
ge_2_lt_4_days: 4
ge_0_lt_2_days: 4

attenuation:
gt_73_dbm: 0
gt_63_le_73_dbm: 0
gt_51_le_63_dbm: 1
gt_33_le_51_dbm: 2
gt_27_le_33_dbm: 5
gt_15_le_27_dbm: 7
gt_10_le_15_dbm: 8
lt_10_dbm: 8
gt_51_le_63_dbm: 0
gt_33_le_51_dbm: 1
gt_27_le_33_dbm: 1
gt_15_le_27_dbm: 1
gt_10_le_15_dbm: 1
lt_10_dbm: 1
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ risk-classes:
-
label: LOW
min: 0
max: 2749
max: 15
url: "https://www.coronawarn.app"
-
label: HIGH
min: 2750
max: 4096
url: "https://www.coronawarn.app"
min: 15
max: 72
url: "https://www.coronawarn.app"
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

package app.coronawarn.server.services.distribution.assembly.appconfig.validation;

import static app.coronawarn.server.services.distribution.assembly.appconfig.validation.ParameterSpec.RISK_SCORE_MAX;
import static app.coronawarn.server.services.distribution.assembly.appconfig.validation.ParameterSpec.RISK_SCORE_MIN;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;

Expand Down Expand Up @@ -82,11 +84,11 @@ public static TestWithExpectedResult AllOk() {

public static TestWithExpectedResult MinRiskThresholdOutOfBoundsNegative() {
return testBuilder.build("app-config_mrs_negative.yaml")
.with(new MinimumRiskLevelValidationError(-1));
.with(new MinimumRiskLevelValidationError(RISK_SCORE_MIN - 1));
}

public static TestWithExpectedResult MinRiskThresholdOutOfBoundsPositive() {
return testBuilder.build("app-config_mrs_oob.yaml")
.with(new MinimumRiskLevelValidationError(4097));
.with(new MinimumRiskLevelValidationError(RISK_SCORE_MAX + 1));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,18 +96,17 @@ void failsIfMinGreaterThanMax() {
// Note: additional classes have to be added in order to reach the expected value range size
var validator = buildValidator(buildRiskClass(VALID_LABEL, min, max, VALID_URL),
buildRiskClass(VALID_LABEL, 0, MAX_SCORE, VALID_URL));
var expectedResult = buildExpectedResult(
buildError("minRiskLevel, maxRiskLevel", (min + ", " + max), MIN_GREATER_THAN_MAX));
var expectedResult = buildError("minRiskLevel, maxRiskLevel", (min + ", " + max), MIN_GREATER_THAN_MAX);

assertThat(validator.validate()).isEqualTo(expectedResult);
assertThat(validator.validate().hasError(expectedResult)).isTrue();
}

@ParameterizedTest
@MethodSource("createInvalidPartitionings")
void failsIfPartitioningInvalid(RiskScoreClassification invalidClassification) {
var validator = new RiskScoreClassificationValidator(invalidClassification);
int coveredRange = invalidClassification.getRiskClassesList().stream()
.mapToInt(riskScoreClass -> (riskScoreClass.getMax() - riskScoreClass.getMin() + 1))
.mapToInt(riskScoreClass -> (riskScoreClass.getMax() - riskScoreClass.getMin()))
.sum();
var expectedResult = buildExpectedResult(
buildError("covered value range", coveredRange, INVALID_PARTITIONING));
Expand All @@ -120,7 +119,7 @@ private static Stream<Arguments> createInvalidPartitionings() {
buildClassification(buildRiskClass(VALID_LABEL, 0, 0, VALID_URL)),
buildClassification(
buildRiskClass(VALID_LABEL, 0, MAX_SCORE / 2, VALID_URL),
buildRiskClass(VALID_LABEL, MAX_SCORE / 2 + 1, MAX_SCORE, VALID_URL),
buildRiskClass(VALID_LABEL, MAX_SCORE / 2, MAX_SCORE, VALID_URL),
buildRiskClass(VALID_LABEL, 0, MAX_SCORE, VALID_URL)),
buildClassification(
buildRiskClass(VALID_LABEL, 0, MAX_SCORE, VALID_URL),
Expand All @@ -141,12 +140,12 @@ private static Stream<Arguments> createValidClassifications() {
// [0:MAX_SCORE/2][MAX_SCORE/2:MAX_SCORE]
buildClassification(
buildRiskClass(VALID_LABEL, 0, MAX_SCORE / 2, VALID_URL),
buildRiskClass(VALID_LABEL, MAX_SCORE / 2 + 1, MAX_SCORE, VALID_URL)),
buildRiskClass(VALID_LABEL, MAX_SCORE / 2, MAX_SCORE, VALID_URL)),
// [0:MAX_SCORE-10][MAX_SCORE-9][MAX_SCORE-8:MAX_SCORE]
buildClassification(
buildRiskClass(VALID_LABEL, 0, MAX_SCORE - 10, VALID_URL),
buildRiskClass(VALID_LABEL, MAX_SCORE - 9, MAX_SCORE - 9, VALID_URL),
buildRiskClass(VALID_LABEL, MAX_SCORE - 8, MAX_SCORE, VALID_URL))
buildRiskClass(VALID_LABEL, MAX_SCORE - 10, MAX_SCORE - 10, VALID_URL),
buildRiskClass(VALID_LABEL, MAX_SCORE - 10, MAX_SCORE, VALID_URL))
).map(Arguments::of);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
min-risk-score: 4097
min-risk-score: 73
risk-score-classes: !include risk-score-class_ok.yaml
exposure-config: !include exposure-config_ok.yaml
exposure-config: !include exposure-config_ok.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
min-risk-score: 100
min-risk-score: 72
attenuation-duration: !include attenuation-duration.yaml
risk-score-classes: !include risk-score-class_ok.yaml
exposure-config: !include exposure-config_ok.yaml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ risk-classes:
-
label: LOW
min: 0
max: 2749
max: 15
url: "https://www.coronawarn.app"
-
label: HIGH
min: 2750
max: 4096
url: "https://www.coronawarn.app"
min: 15
max: 72
url: "https://www.coronawarn.app"

0 comments on commit 624d2ff

Please sign in to comment.