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

Commit

Permalink
fix/fixed fake to return seconds (#231)
Browse files Browse the repository at this point in the history
  • Loading branch information
mschulte-tsi authored May 27, 2021
1 parent 9927c8c commit d9cd408
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.Optional;
import java.util.concurrent.Executors;
Expand Down Expand Up @@ -141,7 +142,7 @@ private TestResult generateReturnTestResult(Integer testResult, String fake, Lon
if (fake == null) {
return new TestResult(testResult,cs, RandomStringUtils.randomAlphanumeric(RESPONSE_PADDING_LENGTH));
}
return new TestResult(testResult, System.currentTimeMillis(),
return new TestResult(testResult, LocalDateTime.now().toEpochSecond(ZoneOffset.UTC),
RandomStringUtils.randomAlphanumeric(RESPONSE_PADDING_LENGTH));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
import app.coronawarn.verification.model.RegistrationTokenRequest;
import app.coronawarn.verification.model.Tan;
import app.coronawarn.verification.model.TestResult;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.UUID;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
Expand Down Expand Up @@ -108,7 +110,7 @@ public DeferredResult<ResponseEntity<TestResult>> getTestState(
long delay = fakeDelayService.getLongestJitter();
DeferredResult<ResponseEntity<TestResult>> deferredResult = new DeferredResult<>();
scheduledExecutor.schedule(() -> deferredResult.setResult(ResponseEntity
.ok(new TestResult(LabTestResult.POSITIVE.getTestResult(), System.currentTimeMillis(),
.ok(new TestResult(LabTestResult.POSITIVE.getTestResult(), LocalDateTime.now().toEpochSecond(ZoneOffset.UTC),
RandomStringUtils.randomAlphanumeric(TEST_RESPONSE_PADDING_LENGTH)))), delay, MILLISECONDS);
return deferredResult;
}
Expand Down

0 comments on commit d9cd408

Please sign in to comment.