Use text blocks where possible

This commit is contained in:
Jon Chambers 2021-11-18 15:59:13 -05:00 committed by Jon Chambers
parent 282daeb0dc
commit 0bbd34d060
7 changed files with 268 additions and 233 deletions

View File

@ -23,32 +23,34 @@ import org.whispersystems.textsecuregcm.util.Util;
@Path("/v1/voice/") @Path("/v1/voice/")
public class VoiceVerificationController { public class VoiceVerificationController {
private static final String PLAY_TWIML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + private static final String PLAY_TWIML = """
"<Response>\n" + <?xml version="1.0" encoding="UTF-8"?>
" <Play>%s</Play>\n" + <Response>
" <Play>%s</Play>\n" + <Play>%s</Play>
" <Play>%s</Play>\n" + <Play>%s</Play>
" <Play>%s</Play>\n" + <Play>%s</Play>
" <Play>%s</Play>\n" + <Play>%s</Play>
" <Play>%s</Play>\n" + <Play>%s</Play>
" <Play>%s</Play>\n" + <Play>%s</Play>
" <Pause length=\"1\"/>\n" + <Play>%s</Play>
" <Play>%s</Play>\n" + <Pause length="1"/>
" <Play>%s</Play>\n" + <Play>%s</Play>
" <Play>%s</Play>\n" + <Play>%s</Play>
" <Play>%s</Play>\n" + <Play>%s</Play>
" <Play>%s</Play>\n" + <Play>%s</Play>
" <Play>%s</Play>\n" + <Play>%s</Play>
" <Play>%s</Play>\n" + <Play>%s</Play>
" <Pause length=\"1\"/>\n" + <Play>%s</Play>
" <Play>%s</Play>\n" + <Pause length="1"/>
" <Play>%s</Play>\n" + <Play>%s</Play>
" <Play>%s</Play>\n" + <Play>%s</Play>
" <Play>%s</Play>\n" + <Play>%s</Play>
" <Play>%s</Play>\n" + <Play>%s</Play>
" <Play>%s</Play>\n" + <Play>%s</Play>
" <Play>%s</Play>\n" + <Play>%s</Play>
"</Response>"; <Play>%s</Play>
</Response>
""";
private static final String DEFAULT_LOCALE = "en-US"; private static final String DEFAULT_LOCALE = "en-US";

View File

@ -38,18 +38,19 @@ class DynamicConfigurationTest {
} }
{ {
final String experimentConfigYaml = final String experimentConfigYaml = """
"experiments:\n" + experiments:
" percentageOnly:\n" + percentageOnly:
" enrollmentPercentage: 12\n" + enrollmentPercentage: 12
" uuidsAndPercentage:\n" + uuidsAndPercentage:
" enrolledUuids:\n" + enrolledUuids:
" - 717b1c09-ed0b-4120-bb0e-f4697534b8e1\n" + - 717b1c09-ed0b-4120-bb0e-f4697534b8e1
" - 279f264c-56d7-4bbf-b9da-de718ff90903\n" + - 279f264c-56d7-4bbf-b9da-de718ff90903
" enrollmentPercentage: 77\n" + enrollmentPercentage: 77
" uuidsOnly:\n" + uuidsOnly:
" enrolledUuids:\n" + enrolledUuids:
" - 71618739-114c-4b1f-bb0d-6478a44eb600"; - 71618739-114c-4b1f-bb0d-6478a44eb600
""";
final DynamicConfiguration config = final DynamicConfiguration config =
DynamicConfigurationManager.parseConfiguration(experimentConfigYaml, DynamicConfiguration.class).orElseThrow(); DynamicConfigurationManager.parseConfiguration(experimentConfigYaml, DynamicConfiguration.class).orElseThrow();
@ -86,27 +87,28 @@ class DynamicConfigurationTest {
} }
{ {
final String experimentConfigYaml = final String experimentConfigYaml = """
"preRegistrationExperiments:\n" + preRegistrationExperiments:
" percentageOnly:\n" + percentageOnly:
" enrollmentPercentage: 17\n" + enrollmentPercentage: 17
" e164sCountryCodesAndPercentage:\n" + e164sCountryCodesAndPercentage:
" enrolledE164s:\n" + enrolledE164s:
" - +120255551212\n" + - +120255551212
" - +3655323174\n" + - +3655323174
" excludedE164s:\n" + excludedE164s:
" - +120255551213\n" + - +120255551213
" - +3655323175\n" + - +3655323175
" enrollmentPercentage: 46\n" + enrollmentPercentage: 46
" excludedCountryCodes:\n" + excludedCountryCodes:
" - 47\n" + - 47
" includedCountryCodes:\n" + includedCountryCodes:
" - 56\n" + - 56
" e164sAndExcludedCodes:\n" + e164sAndExcludedCodes:
" enrolledE164s:\n" + enrolledE164s:
" - +120255551212\n" + - +120255551212
" excludedCountryCodes:\n" + excludedCountryCodes:
" - 47"; - 47
""";
final DynamicConfiguration config = final DynamicConfiguration config =
DynamicConfigurationManager.parseConfiguration(experimentConfigYaml, DynamicConfiguration.class).orElseThrow(); DynamicConfigurationManager.parseConfiguration(experimentConfigYaml, DynamicConfiguration.class).orElseThrow();
@ -167,18 +169,17 @@ class DynamicConfigurationTest {
} }
{ {
final String remoteDeprecationConfig = final String remoteDeprecationConfig = """
"remoteDeprecation:\n" + remoteDeprecation:
" minimumVersions:\n" + minimumVersions:
" IOS: 1.2.3\n" + IOS: 1.2.3
" ANDROID: 4.5.6\n" + ANDROID: 4.5.6
versionsPendingDeprecation:
" versionsPendingDeprecation:\n" + DESKTOP: 7.8.9
" DESKTOP: 7.8.9\n" + blockedVersions:
DESKTOP:
" blockedVersions:\n" + - 1.4.0-beta.2
" DESKTOP:\n" + """;
" - 1.4.0-beta.2";
final DynamicConfiguration config = final DynamicConfiguration config =
DynamicConfigurationManager.parseConfiguration(remoteDeprecationConfig, DynamicConfiguration.class).orElseThrow(); DynamicConfigurationManager.parseConfiguration(remoteDeprecationConfig, DynamicConfiguration.class).orElseThrow();
@ -207,9 +208,10 @@ class DynamicConfigurationTest {
} }
{ {
final String messageRateConfigYaml = final String messageRateConfigYaml = """
"messageRate:\n" + messageRate:
" enforceUnsealedSenderRateLimit: true"; enforceUnsealedSenderRateLimit: true
""";
final DynamicConfiguration emptyConfig = final DynamicConfiguration emptyConfig =
DynamicConfigurationManager.parseConfiguration(messageRateConfigYaml, DynamicConfiguration.class).orElseThrow(); DynamicConfigurationManager.parseConfiguration(messageRateConfigYaml, DynamicConfiguration.class).orElseThrow();
@ -229,9 +231,10 @@ class DynamicConfigurationTest {
} }
{ {
final String featureFlagYaml = final String featureFlagYaml = """
"featureFlags:\n" featureFlags:
+ " - testFlag"; - testFlag
""";
final DynamicConfiguration emptyConfig = final DynamicConfiguration emptyConfig =
DynamicConfigurationManager.parseConfiguration(featureFlagYaml, DynamicConfiguration.class).orElseThrow(); DynamicConfigurationManager.parseConfiguration(featureFlagYaml, DynamicConfiguration.class).orElseThrow();
@ -251,11 +254,12 @@ class DynamicConfigurationTest {
} }
{ {
final String twilioConfigYaml = final String twilioConfigYaml = """
"twilio:\n" twilio:
+ " numbers:\n" numbers:
+ " - 2135551212\n" - 2135551212
+ " - 2135551313"; - 2135551313
""";
final DynamicTwilioConfiguration config = final DynamicTwilioConfiguration config =
DynamicConfigurationManager.parseConfiguration(twilioConfigYaml, DynamicConfiguration.class).orElseThrow() DynamicConfigurationManager.parseConfiguration(twilioConfigYaml, DynamicConfiguration.class).orElseThrow()
@ -276,10 +280,11 @@ class DynamicConfigurationTest {
} }
{ {
final String paymentsConfigYaml = final String paymentsConfigYaml = """
"payments:\n" payments:
+ " disallowedPrefixes:\n" disallowedPrefixes:
+ " - +44"; - +44
""";
final DynamicPaymentsConfiguration config = final DynamicPaymentsConfiguration config =
DynamicConfigurationManager.parseConfiguration(paymentsConfigYaml, DynamicConfiguration.class).orElseThrow() DynamicConfigurationManager.parseConfiguration(paymentsConfigYaml, DynamicConfiguration.class).orElseThrow()
@ -300,10 +305,11 @@ class DynamicConfigurationTest {
} }
{ {
final String signupCaptchaConfig = final String signupCaptchaConfig = """
"signupCaptcha:\n" signupCaptcha:
+ " countryCodes:\n" countryCodes:
+ " - 1"; - 1
""";
final DynamicSignupCaptchaConfiguration config = final DynamicSignupCaptchaConfiguration config =
DynamicConfigurationManager.parseConfiguration(signupCaptchaConfig, DynamicConfiguration.class).orElseThrow() DynamicConfigurationManager.parseConfiguration(signupCaptchaConfig, DynamicConfiguration.class).orElseThrow()
@ -325,11 +331,12 @@ class DynamicConfigurationTest {
} }
{ {
final String limitsConfig = final String limitsConfig = """
"limits:\n" limits:
+ " unsealedSenderNumber:\n" unsealedSenderNumber:
+ " maxCardinality: 99\n" maxCardinality: 99
+ " ttl: PT23H"; ttl: PT23H
""";
final CardinalityRateLimitConfiguration unsealedSenderNumber = final CardinalityRateLimitConfiguration unsealedSenderNumber =
DynamicConfigurationManager.parseConfiguration(limitsConfig, DynamicConfiguration.class).orElseThrow() DynamicConfigurationManager.parseConfiguration(limitsConfig, DynamicConfiguration.class).orElseThrow()
@ -353,13 +360,14 @@ class DynamicConfigurationTest {
} }
{ {
final String rateLimitChallengeConfig = final String rateLimitChallengeConfig = """
"rateLimitChallenge:\n" rateLimitChallenge:
+ " preKeyLimitEnforced: true\n" preKeyLimitEnforced: true
+ " clientSupportedVersions:\n" clientSupportedVersions:
+ " IOS: 5.1.0\n" IOS: 5.1.0
+ " ANDROID: 5.2.0\n" ANDROID: 5.2.0
+ " DESKTOP: 5.0.0"; DESKTOP: 5.0.0
""";
DynamicRateLimitChallengeConfiguration rateLimitChallengeConfiguration = DynamicRateLimitChallengeConfiguration rateLimitChallengeConfiguration =
DynamicConfigurationManager.parseConfiguration(rateLimitChallengeConfig, DynamicConfiguration.class).orElseThrow() DynamicConfigurationManager.parseConfiguration(rateLimitChallengeConfig, DynamicConfiguration.class).orElseThrow()
@ -386,9 +394,10 @@ class DynamicConfigurationTest {
} }
{ {
final String directoryReconcilerConfig = final String directoryReconcilerConfig = """
"directoryReconciler:\n" directoryReconciler:
+ " enabled: false"; enabled: false
""";
DynamicDirectoryReconcilerConfiguration directoryReconcilerConfiguration = DynamicDirectoryReconcilerConfiguration directoryReconcilerConfiguration =
DynamicConfigurationManager.parseConfiguration(directoryReconcilerConfig, DynamicConfiguration.class).orElseThrow() DynamicConfigurationManager.parseConfiguration(directoryReconcilerConfig, DynamicConfiguration.class).orElseThrow()

View File

@ -56,10 +56,12 @@ class ChallengeControllerTest {
@Test @Test
void testHandlePushChallenge() throws RateLimitExceededException { void testHandlePushChallenge() throws RateLimitExceededException {
final String pushChallengeJson = "{\n" final String pushChallengeJson = """
+ " \"type\": \"rateLimitPushChallenge\",\n" {
+ " \"challenge\": \"Hello I am a push challenge token\"\n" "type": "rateLimitPushChallenge",
+ "}"; "challenge": "Hello I am a push challenge token"
}
""";
final Response response = EXTENSION.target("/v1/challenge") final Response response = EXTENSION.target("/v1/challenge")
.request() .request()
@ -72,10 +74,12 @@ class ChallengeControllerTest {
@Test @Test
void testHandlePushChallengeRateLimited() throws RateLimitExceededException { void testHandlePushChallengeRateLimited() throws RateLimitExceededException {
final String pushChallengeJson = "{\n" final String pushChallengeJson = """
+ " \"type\": \"rateLimitPushChallenge\",\n" {
+ " \"challenge\": \"Hello I am a push challenge token\"\n" "type": "rateLimitPushChallenge",
+ "}"; "challenge": "Hello I am a push challenge token"
}
""";
final Duration retryAfter = Duration.ofMinutes(17); final Duration retryAfter = Duration.ofMinutes(17);
doThrow(new RateLimitExceededException(retryAfter)).when(rateLimitChallengeManager).answerPushChallenge(any(), any()); doThrow(new RateLimitExceededException(retryAfter)).when(rateLimitChallengeManager).answerPushChallenge(any(), any());
@ -91,11 +95,13 @@ class ChallengeControllerTest {
@Test @Test
void testHandleRecaptcha() throws RateLimitExceededException { void testHandleRecaptcha() throws RateLimitExceededException {
final String recaptchaChallengeJson = "{\n" final String recaptchaChallengeJson = """
+ " \"type\": \"recaptcha\",\n" {
+ " \"token\": \"A server-generated token\",\n" "type": "recaptcha",
+ " \"captcha\": \"The value of the solved captcha token\"\n" "token": "A server-generated token",
+ "}"; "captcha": "The value of the solved captcha token"
}
""";
final Response response = EXTENSION.target("/v1/challenge") final Response response = EXTENSION.target("/v1/challenge")
.request() .request()
@ -109,11 +115,13 @@ class ChallengeControllerTest {
@Test @Test
void testHandleRecaptchaRateLimited() throws RateLimitExceededException { void testHandleRecaptchaRateLimited() throws RateLimitExceededException {
final String recaptchaChallengeJson = "{\n" final String recaptchaChallengeJson = """
+ " \"type\": \"recaptcha\",\n" {
+ " \"token\": \"A server-generated token\",\n" "type": "recaptcha",
+ " \"captcha\": \"The value of the solved captcha token\"\n" "token": "A server-generated token",
+ "}"; "captcha": "The value of the solved captcha token"
}
""";
final Duration retryAfter = Duration.ofMinutes(17); final Duration retryAfter = Duration.ofMinutes(17);
doThrow(new RateLimitExceededException(retryAfter)).when(rateLimitChallengeManager).answerRecaptchaChallenge(any(), any(), any()); doThrow(new RateLimitExceededException(retryAfter)).when(rateLimitChallengeManager).answerRecaptchaChallenge(any(), any(), any());
@ -130,11 +138,13 @@ class ChallengeControllerTest {
@Test @Test
void testHandleRecaptchaNoForwardedFor() { void testHandleRecaptchaNoForwardedFor() {
final String recaptchaChallengeJson = "{\n" final String recaptchaChallengeJson = """
+ " \"type\": \"recaptcha\",\n" {
+ " \"token\": \"A server-generated token\",\n" "type": "recaptcha",
+ " \"captcha\": \"The value of the solved captcha token\"\n" "token": "A server-generated token",
+ "}"; "captcha": "The value of the solved captcha token"
}
""";
final Response response = EXTENSION.target("/v1/challenge") final Response response = EXTENSION.target("/v1/challenge")
.request() .request()
@ -147,9 +157,11 @@ class ChallengeControllerTest {
@Test @Test
void testHandleUnrecognizedAnswer() { void testHandleUnrecognizedAnswer() {
final String unrecognizedJson = "{\n" final String unrecognizedJson = """
+ " \"type\": \"unrecognized\"\n" {
+ "}"; "type": "unrecognized"
}
""";
final Response response = EXTENSION.target("/v1/challenge") final Response response = EXTENSION.target("/v1/challenge")
.request() .request()
@ -187,9 +199,11 @@ class ChallengeControllerTest {
@Test @Test
void testValidationError() { void testValidationError() {
final String unrecognizedJson = "{\n" final String unrecognizedJson = """
+ " \"type\": \"rateLimitPushChallenge\"\n" {
+ "}"; "type": "rateLimitPushChallenge"
}
""";
final Response response = EXTENSION.target("/v1/challenge") final Response response = EXTENSION.target("/v1/challenge")
.request() .request()

View File

@ -17,10 +17,12 @@ class AnswerChallengeRequestTest {
@Test @Test
void parse() throws JsonProcessingException { void parse() throws JsonProcessingException {
{ {
final String pushChallengeJson = "{\n" final String pushChallengeJson = """
+ " \"type\": \"rateLimitPushChallenge\",\n" {
+ " \"challenge\": \"Hello I am a push challenge token\"\n" "type": "rateLimitPushChallenge",
+ "}"; "challenge": "Hello I am a push challenge token"
}
""";
final AnswerChallengeRequest answerChallengeRequest = final AnswerChallengeRequest answerChallengeRequest =
SystemMapper.getMapper().readValue(pushChallengeJson, AnswerChallengeRequest.class); SystemMapper.getMapper().readValue(pushChallengeJson, AnswerChallengeRequest.class);
@ -31,11 +33,13 @@ class AnswerChallengeRequestTest {
} }
{ {
final String recaptchaChallengeJson = "{\n" final String recaptchaChallengeJson = """
+ " \"type\": \"recaptcha\",\n" {
+ " \"token\": \"A server-generated token\",\n" "type": "recaptcha",
+ " \"captcha\": \"The value of the solved captcha token\"\n" "token": "A server-generated token",
+ "}"; "captcha": "The value of the solved captcha token"
}
""";
final AnswerChallengeRequest answerChallengeRequest = final AnswerChallengeRequest answerChallengeRequest =
SystemMapper.getMapper().readValue(recaptchaChallengeJson, AnswerChallengeRequest.class); SystemMapper.getMapper().readValue(recaptchaChallengeJson, AnswerChallengeRequest.class);
@ -50,11 +54,13 @@ class AnswerChallengeRequestTest {
} }
{ {
final String unrecognizedTypeJson = "{\n" final String unrecognizedTypeJson = """
+ " \"type\": \"unrecognized\",\n" {
+ " \"token\": \"A server-generated token\",\n" "type": "unrecognized",
+ " \"captcha\": \"The value of the solved captcha token\"\n" "token": "A server-generated token",
+ "}"; "captcha": "The value of the solved captcha token"
}
""";
assertThrows(InvalidTypeIdException.class, assertThrows(InvalidTypeIdException.class,
() -> SystemMapper.getMapper().readValue(unrecognizedTypeJson, AnswerChallengeRequest.class)); () -> SystemMapper.getMapper().readValue(unrecognizedTypeJson, AnswerChallengeRequest.class));

View File

@ -18,59 +18,61 @@ import static org.junit.Assert.*;
public class OperatingSystemMemoryGaugeTest { public class OperatingSystemMemoryGaugeTest {
private static final String MEMINFO = private static final String MEMINFO =
"MemTotal: 16052208 kB\n" + """
"MemFree: 4568468 kB\n" + MemTotal: 16052208 kB
"MemAvailable: 7702848 kB\n" + MemFree: 4568468 kB
"Buffers: 636372 kB\n" + MemAvailable: 7702848 kB
"Cached: 5019116 kB\n" + Buffers: 636372 kB
"SwapCached: 6692 kB\n" + Cached: 5019116 kB
"Active: 7746436 kB\n" + SwapCached: 6692 kB
"Inactive: 2729876 kB\n" + Active: 7746436 kB
"Active(anon): 5580980 kB\n" + Inactive: 2729876 kB
"Inactive(anon): 1648108 kB\n" + Active(anon): 5580980 kB
"Active(file): 2165456 kB\n" + Inactive(anon): 1648108 kB
"Inactive(file): 1081768 kB\n" + Active(file): 2165456 kB
"Unevictable: 443948 kB\n" + Inactive(file): 1081768 kB
"Mlocked: 4924 kB\n" + Unevictable: 443948 kB
"SwapTotal: 1003516 kB\n" + Mlocked: 4924 kB
"SwapFree: 935932 kB\n" + SwapTotal: 1003516 kB
"Dirty: 28308 kB\n" + SwapFree: 935932 kB
"Writeback: 0 kB\n" + Dirty: 28308 kB
"AnonPages: 5258396 kB\n" + Writeback: 0 kB
"Mapped: 1530740 kB\n" + AnonPages: 5258396 kB
"Shmem: 2419340 kB\n" + Mapped: 1530740 kB
"KReclaimable: 229392 kB\n" + Shmem: 2419340 kB
"Slab: 408156 kB\n" + KReclaimable: 229392 kB
"SReclaimable: 229392 kB\n" + Slab: 408156 kB
"SUnreclaim: 178764 kB\n" + SReclaimable: 229392 kB
"KernelStack: 17360 kB\n" + SUnreclaim: 178764 kB
"PageTables: 50436 kB\n" + KernelStack: 17360 kB
"NFS_Unstable: 0 kB\n" + PageTables: 50436 kB
"Bounce: 0 kB\n" + NFS_Unstable: 0 kB
"WritebackTmp: 0 kB\n" + Bounce: 0 kB
"CommitLimit: 9029620 kB\n" + WritebackTmp: 0 kB
"Committed_AS: 16681884 kB\n" + CommitLimit: 9029620 kB
"VmallocTotal: 34359738367 kB\n" + Committed_AS: 16681884 kB
"VmallocUsed: 41944 kB\n" + VmallocTotal: 34359738367 kB
"VmallocChunk: 0 kB\n" + VmallocUsed: 41944 kB
"Percpu: 4240 kB\n" + VmallocChunk: 0 kB
"HardwareCorrupted: 0 kB\n" + Percpu: 4240 kB
"AnonHugePages: 0 kB\n" + HardwareCorrupted: 0 kB
"ShmemHugePages: 0 kB\n" + AnonHugePages: 0 kB
"ShmemPmdMapped: 0 kB\n" + ShmemHugePages: 0 kB
"FileHugePages: 0 kB\n" + ShmemPmdMapped: 0 kB
"FilePmdMapped: 0 kB\n" + FileHugePages: 0 kB
"CmaTotal: 0 kB\n" + FilePmdMapped: 0 kB
"CmaFree: 0 kB\n" + CmaTotal: 0 kB
"HugePages_Total: 0\n" + CmaFree: 0 kB
"HugePages_Free: 7\n" + HugePages_Total: 0
"HugePages_Rsvd: 0\n" + HugePages_Free: 7
"HugePages_Surp: 0\n" + HugePages_Rsvd: 0
"Hugepagesize: 2048 kB\n" + HugePages_Surp: 0
"Hugetlb: 0 kB\n" + Hugepagesize: 2048 kB
"DirectMap4k: 481804 kB\n" + Hugetlb: 0 kB
"DirectMap2M: 14901248 kB\n" + DirectMap4k: 481804 kB
"DirectMap1G: 2097152 kB\n"; DirectMap2M: 14901248 kB
DirectMap1G: 2097152 kB
""";
@Test @Test
@Parameters(method = "argumentsForTestGetValue") @Parameters(method = "argumentsForTestGetValue")

View File

@ -55,22 +55,23 @@ public class SecureBackupClientTest {
config.setUri("http://localhost:" + wireMockRule.port()); config.setUri("http://localhost:" + wireMockRule.port());
// This is a randomly-generated, throwaway certificate that's not actually connected to anything // This is a randomly-generated, throwaway certificate that's not actually connected to anything
config.setBackupCaCertificate( config.setBackupCaCertificate("""
"-----BEGIN CERTIFICATE-----\n" + -----BEGIN CERTIFICATE-----
"MIICZDCCAc2gAwIBAgIBADANBgkqhkiG9w0BAQ0FADBPMQswCQYDVQQGEwJ1czEL\n" + MIICZDCCAc2gAwIBAgIBADANBgkqhkiG9w0BAQ0FADBPMQswCQYDVQQGEwJ1czEL
"MAkGA1UECAwCVVMxHjAcBgNVBAoMFVNpZ25hbCBNZXNzZW5nZXIsIExMQzETMBEG\n" + MAkGA1UECAwCVVMxHjAcBgNVBAoMFVNpZ25hbCBNZXNzZW5nZXIsIExMQzETMBEG
"A1UEAwwKc2lnbmFsLm9yZzAeFw0yMDEyMjMyMjQ3NTlaFw0zMDEyMjEyMjQ3NTla\n" + A1UEAwwKc2lnbmFsLm9yZzAeFw0yMDEyMjMyMjQ3NTlaFw0zMDEyMjEyMjQ3NT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UouRsb9UwknVWZa
"y7MTM4NoBV1k0zb5LAk89SIDPr/maW5AsLtEomzjnEiomjoMBUdNe3YCgQReoLnr\n" + y7MTM4NoBV1k0zb5LAk89SIDPr/maW5AsLtEomzjnEiomjoMBUdNe3YCgQReoLnr
"R/QaUNbrCjTGYfBsjGbIzmkWPUyTec2ZdRyJ8JiVl386+6CZkxnndQ==\n" + R/QaUNbrCjTGYfBsjGbIzmkWPUyTec2ZdRyJ8JiVl386+6CZkxnndQ==
"-----END CERTIFICATE-----"); -----END CERTIFICATE-----
""");
secureStorageClient = new SecureBackupClient(credentialGenerator, httpExecutor, config); secureStorageClient = new SecureBackupClient(credentialGenerator, httpExecutor, config);
} }

View File

@ -55,22 +55,23 @@ public class SecureStorageClientTest {
config.setUri("http://localhost:" + wireMockRule.port()); config.setUri("http://localhost:" + wireMockRule.port());
// This is a randomly-generated, throwaway certificate that's not actually connected to anything // This is a randomly-generated, throwaway certificate that's not actually connected to anything
config.setStorageCaCertificate( config.setStorageCaCertificate("""
"-----BEGIN CERTIFICATE-----\n" + -----BEGIN CERTIFICATE-----
"MIICZDCCAc2gAwIBAgIBADANBgkqhkiG9w0BAQ0FADBPMQswCQYDVQQGEwJ1czEL\n" + MIICZDCCAc2gAwIBAgIBADANBgkqhkiG9w0BAQ0FADBPMQswCQYDVQQGEwJ1czEL
"MAkGA1UECAwCVVMxHjAcBgNVBAoMFVNpZ25hbCBNZXNzZW5nZXIsIExMQzETMBEG\n" + MAkGA1UECAwCVVMxHjAcBgNVBAoMFVNpZ25hbCBNZXNzZW5nZXIsIExMQzETMBEG
"A1UEAwwKc2lnbmFsLm9yZzAeFw0yMDEyMjMyMjQ3NTlaFw0zMDEyMjEyMjQ3NTla\n" + A1UEAwwKc2lnbmFsLm9yZzAeFw0yMDEyMjMyMjQ3NTlaFw0zMDEyMjEyMjQ3NTla
"ME8xCzAJBgNVBAYTAnVzMQswCQYDVQQIDAJVUzEeMBwGA1UECgwVU2lnbmFsIE1l\n" + ME8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nr\n" + y7MTM4NoBV1k0zb5LAk89SIDPr/maW5AsLtEomzjnEiomjoMBUdNe3YCgQReoLnr
"R/QaUNbrCjTGYfBsjGbIzmkWPUyTec2ZdRyJ8JiVl386+6CZkxnndQ==\n" + R/QaUNbrCjTGYfBsjGbIzmkWPUyTec2ZdRyJ8JiVl386+6CZkxnndQ==
"-----END CERTIFICATE-----"); -----END CERTIFICATE-----
""");
secureStorageClient = new SecureStorageClient(credentialGenerator, httpExecutor, config); secureStorageClient = new SecureStorageClient(credentialGenerator, httpExecutor, config);
} }