Commit c95586a9 authored by Cypres TAC's avatar Cypres TAC
Browse files

conflict correction for LocationRegion

parent c9669188
Pipeline #231627 passed with stage
in 1 minute and 40 seconds
......@@ -2,6 +2,8 @@ package fr.inria.clea.lsp;
import java.time.Instant;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
......@@ -20,18 +22,19 @@ import lombok.ToString;
public class LocationContact {
public static final String PHONE_VALIDATION_MESSAGE = "Location phone is mandatory";
public static final String REGION_VALIDATION_MESSAGE = "Location phone is mandatory";
public static final String PIN_VALIDATION_MESSAGE = "Secret digit PIN must contain exactly 6 characters";
public static final String PERIOD_START_TIME_VALIDATION_MESSAGE = "Period start time must not be null";
/* Phone number of the location contact person, one digit = one character */
@NotBlank(message= PHONE_VALIDATION_MESSAGE)
String locationPhone;
/* Coarse grain geographical information for the location */
@Max(value = 255)
/* Coarse grain geographical information for the location */
@Min(value = 0, message = REGION_VALIDATION_MESSAGE)
@Max(value = 255, message = REGION_VALIDATION_MESSAGE)
int locationRegion;
/* Secret 6 digit PIN, one digit = one character */
// TODO: set max to 6 when CSV files used for tests are updated
@Size(min = 6, max = 8,
@Size(min = 6, max = 6,
message = PIN_VALIDATION_MESSAGE)
String locationPin;
/* Starting time of the period in seconds */
......
......@@ -84,7 +84,7 @@ class LocationSpecificPartTest {
@Test
public void testEncodinsAndDecodingOfALocationMessage() throws CleaCryptoException {
Instant periodStartTime = Instant.now().truncatedTo(ChronoUnit.HOURS);
LocationContact locationContact = new LocationContact("33800130000", "012345", periodStartTime);
LocationContact locationContact = new LocationContact("33800130000", 12, "012345", periodStartTime);
Location location = Location.builder().contact(locationContact)
.manualContactTracingAuthorityPublicKey(manualContactTracingAuthorityKeyPair[1])
.permanentLocationSecretKey(permanentLocationSecretKey).build();
......@@ -99,7 +99,7 @@ class LocationSpecificPartTest {
@Test
public void testEncodingAndDecodingOfALocationSpecificPart() throws CleaCryptoException {
Instant periodStartTime = Instant.now().truncatedTo(ChronoUnit.HOURS);
LocationContact locationContact = new LocationContact("33800130000", "01234567", periodStartTime);
LocationContact locationContact = new LocationContact("33800130000", 12, "012345", periodStartTime);
/* Encode a LSP with location */
LocationSpecificPart lsp = LocationSpecificPart.builder().staff(true).countryCode(33)
.qrCodeRenewalIntervalExponentCompact(2).venueType(4).venueCategory1(0).venueCategory2(0)
......
......@@ -32,7 +32,7 @@ public class LocationTest {
serverAuthorityKeyPair = cleaEciesEncoder.genKeysPair(true);
manualContactTracingAuthorityKeyPair = cleaEciesEncoder.genKeysPair(true);
periodStartTime = Instant.now().truncatedTo(ChronoUnit.HOURS);
locationContact = new LocationContact("33800130000", "012345", periodStartTime);
locationContact = new LocationContact("33800130000", 10, "012345", periodStartTime);
}
@Test
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment