Convert RDE tests (and some test rules) from JUnit 4 to JUnit 5 (#677)

* Add JUnit Params and start using it

* Convert rest of RDE tests

* Don't check headers for generated tests

* Expand visibility to fix build breakage

* Bump JUnit versions to 5.6.2
This commit is contained in:
Ben McIlwain 2020-07-10 21:32:36 -04:00 committed by GitHub
parent a52d99ca47
commit 10b23e590e
63 changed files with 715 additions and 829 deletions

View file

@ -61,12 +61,12 @@ org.checkerframework:checker-compat-qual:2.5.5
org.checkerframework:checker-qual:2.11.1
org.hamcrest:hamcrest-core:1.3
org.json:json:20160212
org.junit.jupiter:junit-jupiter-api:5.6.1
org.junit.jupiter:junit-jupiter-engine:5.6.1
org.junit.platform:junit-platform-commons:1.6.1
org.junit.platform:junit-platform-engine:1.6.1
org.junit.vintage:junit-vintage-engine:5.6.1
org.junit:junit-bom:5.6.1
org.junit.jupiter:junit-jupiter-api:5.6.2
org.junit.jupiter:junit-jupiter-engine:5.6.2
org.junit.platform:junit-platform-commons:1.6.2
org.junit.platform:junit-platform-engine:1.6.2
org.junit.vintage:junit-vintage-engine:5.6.2
org.junit:junit-bom:5.6.2
org.mockito:mockito-core:3.3.3
org.objenesis:objenesis:2.6
org.opentest4j:opentest4j:1.2.0

View file

@ -61,12 +61,12 @@ org.checkerframework:checker-compat-qual:2.5.5
org.checkerframework:checker-qual:2.11.1
org.hamcrest:hamcrest-core:1.3
org.json:json:20160212
org.junit.jupiter:junit-jupiter-api:5.6.1
org.junit.jupiter:junit-jupiter-engine:5.6.1
org.junit.platform:junit-platform-commons:1.6.1
org.junit.platform:junit-platform-engine:1.6.1
org.junit.vintage:junit-vintage-engine:5.6.1
org.junit:junit-bom:5.6.1
org.junit.jupiter:junit-jupiter-api:5.6.2
org.junit.jupiter:junit-jupiter-engine:5.6.2
org.junit.platform:junit-platform-commons:1.6.2
org.junit.platform:junit-platform-engine:1.6.2
org.junit.vintage:junit-vintage-engine:5.6.2
org.junit:junit-bom:5.6.2
org.mockito:mockito-core:3.3.3
org.objenesis:objenesis:2.6
org.opentest4j:opentest4j:1.2.0

View file

@ -61,12 +61,12 @@ org.checkerframework:checker-compat-qual:2.5.5
org.checkerframework:checker-qual:2.11.1
org.hamcrest:hamcrest-core:1.3
org.json:json:20160212
org.junit.jupiter:junit-jupiter-api:5.6.1
org.junit.jupiter:junit-jupiter-engine:5.6.1
org.junit.platform:junit-platform-commons:1.6.1
org.junit.platform:junit-platform-engine:1.6.1
org.junit.vintage:junit-vintage-engine:5.6.1
org.junit:junit-bom:5.6.1
org.junit.jupiter:junit-jupiter-api:5.6.2
org.junit.jupiter:junit-jupiter-engine:5.6.2
org.junit.platform:junit-platform-commons:1.6.2
org.junit.platform:junit-platform-engine:1.6.2
org.junit.vintage:junit-vintage-engine:5.6.2
org.junit:junit-bom:5.6.2
org.mockito:mockito-core:3.3.3
org.objenesis:objenesis:2.6
org.opentest4j:opentest4j:1.2.0

View file

@ -61,12 +61,12 @@ org.checkerframework:checker-compat-qual:2.5.5
org.checkerframework:checker-qual:2.11.1
org.hamcrest:hamcrest-core:1.3
org.json:json:20160212
org.junit.jupiter:junit-jupiter-api:5.6.1
org.junit.jupiter:junit-jupiter-engine:5.6.1
org.junit.platform:junit-platform-commons:1.6.1
org.junit.platform:junit-platform-engine:1.6.1
org.junit.vintage:junit-vintage-engine:5.6.1
org.junit:junit-bom:5.6.1
org.junit.jupiter:junit-jupiter-api:5.6.2
org.junit.jupiter:junit-jupiter-engine:5.6.2
org.junit.platform:junit-platform-commons:1.6.2
org.junit.platform:junit-platform-engine:1.6.2
org.junit.vintage:junit-vintage-engine:5.6.2
org.junit:junit-bom:5.6.2
org.mockito:mockito-core:3.3.3
org.objenesis:objenesis:2.6
org.opentest4j:opentest4j:1.2.0

View file

@ -20,10 +20,10 @@ org.checkerframework:checker-compat-qual:2.5.5
org.checkerframework:checker-qual:2.11.1
org.eclipse.jgit:org.eclipse.jgit:4.4.1.201607150455-r
org.hamcrest:hamcrest-core:1.3
org.junit.jupiter:junit-jupiter-api:5.6.1
org.junit.jupiter:junit-jupiter-engine:5.6.1
org.junit.platform:junit-platform-commons:1.6.1
org.junit.platform:junit-platform-engine:1.6.1
org.junit.vintage:junit-vintage-engine:5.6.1
org.junit:junit-bom:5.6.1
org.junit.jupiter:junit-jupiter-api:5.6.2
org.junit.jupiter:junit-jupiter-engine:5.6.2
org.junit.platform:junit-platform-commons:1.6.2
org.junit.platform:junit-platform-engine:1.6.2
org.junit.vintage:junit-vintage-engine:5.6.2
org.junit:junit-bom:5.6.2
org.opentest4j:opentest4j:1.2.0

View file

@ -20,10 +20,10 @@ org.checkerframework:checker-compat-qual:2.5.5
org.checkerframework:checker-qual:2.11.1
org.eclipse.jgit:org.eclipse.jgit:4.4.1.201607150455-r
org.hamcrest:hamcrest-core:1.3
org.junit.jupiter:junit-jupiter-api:5.6.1
org.junit.jupiter:junit-jupiter-engine:5.6.1
org.junit.platform:junit-platform-commons:1.6.1
org.junit.platform:junit-platform-engine:1.6.1
org.junit.vintage:junit-vintage-engine:5.6.1
org.junit:junit-bom:5.6.1
org.junit.jupiter:junit-jupiter-api:5.6.2
org.junit.jupiter:junit-jupiter-engine:5.6.2
org.junit.platform:junit-platform-commons:1.6.2
org.junit.platform:junit-platform-engine:1.6.2
org.junit.vintage:junit-vintage-engine:5.6.2
org.junit:junit-bom:5.6.2
org.opentest4j:opentest4j:1.2.0

View file

@ -21,10 +21,10 @@ org.checkerframework:checker-compat-qual:2.5.5
org.checkerframework:checker-qual:2.11.1
org.eclipse.jgit:org.eclipse.jgit:4.4.1.201607150455-r
org.hamcrest:hamcrest-core:1.3
org.junit.jupiter:junit-jupiter-api:5.6.1
org.junit.jupiter:junit-jupiter-engine:5.6.1
org.junit.platform:junit-platform-commons:1.6.1
org.junit.platform:junit-platform-engine:1.6.1
org.junit.vintage:junit-vintage-engine:5.6.1
org.junit:junit-bom:5.6.1
org.junit.jupiter:junit-jupiter-api:5.6.2
org.junit.jupiter:junit-jupiter-engine:5.6.2
org.junit.platform:junit-platform-commons:1.6.2
org.junit.platform:junit-platform-engine:1.6.2
org.junit.vintage:junit-vintage-engine:5.6.2
org.junit:junit-bom:5.6.2
org.opentest4j:opentest4j:1.2.0

View file

@ -21,10 +21,10 @@ org.checkerframework:checker-compat-qual:2.5.5
org.checkerframework:checker-qual:2.11.1
org.eclipse.jgit:org.eclipse.jgit:4.4.1.201607150455-r
org.hamcrest:hamcrest-core:1.3
org.junit.jupiter:junit-jupiter-api:5.6.1
org.junit.jupiter:junit-jupiter-engine:5.6.1
org.junit.platform:junit-platform-commons:1.6.1
org.junit.platform:junit-platform-engine:1.6.1
org.junit.vintage:junit-vintage-engine:5.6.1
org.junit:junit-bom:5.6.1
org.junit.jupiter:junit-jupiter-api:5.6.2
org.junit.jupiter:junit-jupiter-engine:5.6.2
org.junit.platform:junit-platform-commons:1.6.2
org.junit.platform:junit-platform-engine:1.6.2
org.junit.vintage:junit-vintage-engine:5.6.2
org.junit:junit-bom:5.6.2
org.opentest4j:opentest4j:1.2.0

View file

@ -77,9 +77,9 @@ PRESUBMITS = {
PresubmitCheck(
r".*Copyright 20\d{2} The Nomulus Authors\. All Rights Reserved\.",
("java", "js", "soy", "sql", "py", "sh", "gradle"), {
".git", "/build/", "/generated/", "node_modules/",
"JUnitBackports.java", "registrar_bin.", "registrar_dbg.",
"google-java-format-diff.py",
".git", "/build/", "/generated/", "/generated_tests/",
"node_modules/", "JUnitBackports.java", "registrar_bin.",
"registrar_dbg.", "google-java-format-diff.py",
"nomulus.golden.sql", "soyutils_usegoog.js"
}, REQUIRED):
"File did not include the license header.",

View file

@ -312,6 +312,7 @@ dependencies {
testCompile deps['org.junit.jupiter:junit-jupiter-api']
testCompile deps['org.junit.jupiter:junit-jupiter-engine']
testCompile deps['org.junit.jupiter:junit-jupiter-migrationsupport']
testCompile deps['org.junit.jupiter:junit-jupiter-params']
testCompile deps['org.junit.platform:junit-platform-runner']
testCompile deps['org.junit.platform:junit-platform-suite-api']
testCompile deps['org.junit.vintage:junit-vintage-engine']

View file

@ -246,6 +246,7 @@ org.json:json:20160810
org.junit.jupiter:junit-jupiter-api:5.6.2
org.junit.jupiter:junit-jupiter-engine:5.6.2
org.junit.jupiter:junit-jupiter-migrationsupport:5.6.2
org.junit.jupiter:junit-jupiter-params:5.6.2
org.junit.platform:junit-platform-commons:1.6.2
org.junit.platform:junit-platform-engine:1.6.2
org.junit.platform:junit-platform-launcher:1.6.2

View file

@ -244,6 +244,7 @@ org.json:json:20160810
org.junit.jupiter:junit-jupiter-api:5.6.2
org.junit.jupiter:junit-jupiter-engine:5.6.2
org.junit.jupiter:junit-jupiter-migrationsupport:5.6.2
org.junit.jupiter:junit-jupiter-params:5.6.2
org.junit.platform:junit-platform-commons:1.6.2
org.junit.platform:junit-platform-engine:1.6.2
org.junit.platform:junit-platform-launcher:1.6.2

View file

@ -249,6 +249,7 @@ org.json:json:20160810
org.junit.jupiter:junit-jupiter-api:5.6.2
org.junit.jupiter:junit-jupiter-engine:5.6.2
org.junit.jupiter:junit-jupiter-migrationsupport:5.6.2
org.junit.jupiter:junit-jupiter-params:5.6.2
org.junit.platform:junit-platform-commons:1.6.2
org.junit.platform:junit-platform-engine:1.6.2
org.junit.platform:junit-platform-launcher:1.6.2

View file

@ -249,6 +249,7 @@ org.json:json:20160810
org.junit.jupiter:junit-jupiter-api:5.6.2
org.junit.jupiter:junit-jupiter-engine:5.6.2
org.junit.jupiter:junit-jupiter-migrationsupport:5.6.2
org.junit.jupiter:junit-jupiter-params:5.6.2
org.junit.platform:junit-platform-commons:1.6.2
org.junit.platform:junit-platform-engine:1.6.2
org.junit.platform:junit-platform-launcher:1.6.2

View file

@ -29,17 +29,13 @@ import org.bouncycastle.openpgp.PGPUtil;
import org.bouncycastle.openpgp.bc.BcPGPSecretKeyRing;
import org.bouncycastle.openpgp.operator.bc.BcPBESecretKeyDecryptorBuilder;
import org.bouncycastle.openpgp.operator.bc.BcPGPDigestCalculatorProvider;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
/** Unit tests for {@link KeySerializer}. */
@RunWith(JUnit4.class)
public class KeySerializerTest {
class KeySerializerTest {
@Rule
public final BouncyCastleProviderRule bouncy = new BouncyCastleProviderRule();
@RegisterExtension final BouncyCastleProviderRule bouncy = new BouncyCastleProviderRule();
/**
* An Armored representation of a pgp secret key.
@ -139,20 +135,22 @@ public class KeySerializerTest {
}
}
@Test public void serializeString() {
@Test
void serializeString() {
String result = KeySerializer.deserializeString(KeySerializer.serializeString("value\n"));
assertThat(result).isEqualTo("value\n");
}
@Test public void serializePublicKey() throws Exception {
@Test
void serializePublicKey() throws Exception {
PGPPublicKey publicKeyResult =
KeySerializer.deserializePublicKey(
KeySerializer.serializePublicKey(PUBLIC_KEY));
KeySerializer.deserializePublicKey(KeySerializer.serializePublicKey(PUBLIC_KEY));
assertThat(publicKeyResult.getEncoded()).isEqualTo(PUBLIC_KEY.getEncoded());
}
@Test public void serializeKeyPair() throws Exception {
@Test
void serializeKeyPair() throws Exception {
PGPKeyPair keyPairResult =
KeySerializer.deserializeKeyPair(
KeySerializer.serializeKeyPair(new PGPKeyPair(PUBLIC_KEY, PRIVATE_KEY)));

View file

@ -26,67 +26,57 @@ import google.registry.testing.BouncyCastleProviderRule;
import org.bouncycastle.openpgp.PGPKeyPair;
import org.bouncycastle.openpgp.PGPPrivateKey;
import org.bouncycastle.openpgp.PGPPublicKey;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
@RunWith(JUnit4.class)
public class KmsKeyringTest {
/** Unit tests for {@link KmsKeyring}. */
class KmsKeyringTest {
@Rule public final BouncyCastleProviderRule bouncy = new BouncyCastleProviderRule();
@RegisterExtension final BouncyCastleProviderRule bouncy = new BouncyCastleProviderRule();
@Rule
public final AppEngineRule appEngine = AppEngineRule.builder().withDatastoreAndCloudSql().build();
@RegisterExtension
final AppEngineRule appEngine = AppEngineRule.builder().withDatastoreAndCloudSql().build();
private KmsKeyring keyring;
@Before
public void setUp() {
@BeforeEach
void beforeEach() {
keyring = new KmsKeyring(new FakeKmsConnection());
}
@Test
public void test_getCloudSqlPassword() throws Exception {
void test_getCloudSqlPassword() {
saveCleartextSecret("cloud-sql-password-string");
String cloudSqlPassword = keyring.getCloudSqlPassword();
assertThat(cloudSqlPassword).isEqualTo("cloud-sql-password-stringmoo");
}
@Test
public void test_getToolsCloudSqlPassword() throws Exception {
void test_getToolsCloudSqlPassword() {
saveCleartextSecret("tools-cloud-sql-password-string");
String toolsCloudSqlPassword = keyring.getToolsCloudSqlPassword();
assertThat(toolsCloudSqlPassword).isEqualTo("tools-cloud-sql-password-stringmoo");
}
@Test
public void test_getRdeSigningKey() throws Exception {
void test_getRdeSigningKey() throws Exception {
saveKeyPairSecret("rde-signing-public", "rde-signing-private");
PGPKeyPair rdeSigningKey = keyring.getRdeSigningKey();
assertThat(KeySerializer.serializeKeyPair(rdeSigningKey))
.isEqualTo(KeySerializer.serializeKeyPair(KmsTestHelper.getKeyPair()));
}
@Test
public void test_getRdeStagingEncryptionKey() throws Exception {
void test_getRdeStagingEncryptionKey() throws Exception {
savePublicKeySecret("rde-staging-public");
PGPPublicKey rdeStagingEncryptionKey = keyring.getRdeStagingEncryptionKey();
assertThat(rdeStagingEncryptionKey.getFingerprint())
.isEqualTo(KmsTestHelper.getPublicKey().getFingerprint());
}
@Test
public void test_getRdeStagingDecryptionKey() throws Exception {
void test_getRdeStagingDecryptionKey() throws Exception {
savePrivateKeySecret("rde-staging-private");
savePublicKeySecret("rde-staging-public");
@ -99,96 +89,75 @@ public class KmsKeyringTest {
}
@Test
public void test_getRdeReceiverKey() throws Exception {
void test_getRdeReceiverKey() throws Exception {
savePublicKeySecret("rde-receiver-public");
PGPPublicKey rdeReceiverKey = keyring.getRdeReceiverKey();
assertThat(rdeReceiverKey.getFingerprint())
.isEqualTo(KmsTestHelper.getPublicKey().getFingerprint());
}
@Test
public void test_getBrdaSigningKey() throws Exception {
void test_getBrdaSigningKey() throws Exception {
saveKeyPairSecret("brda-signing-public", "brda-signing-private");
PGPKeyPair brdaSigningKey = keyring.getBrdaSigningKey();
assertThat(KeySerializer.serializeKeyPair(brdaSigningKey))
.isEqualTo(KeySerializer.serializeKeyPair(KmsTestHelper.getKeyPair()));
}
@Test
public void test_getBrdaReceiverKey() throws Exception {
void test_getBrdaReceiverKey() throws Exception {
savePublicKeySecret("brda-receiver-public");
PGPPublicKey brdaReceiverKey = keyring.getBrdaReceiverKey();
assertThat(brdaReceiverKey.getFingerprint())
.isEqualTo(KmsTestHelper.getPublicKey().getFingerprint());
}
@Test
public void test_getRdeSshClientPublicKey() {
void test_getRdeSshClientPublicKey() {
saveCleartextSecret("rde-ssh-client-public-string");
String rdeSshClientPublicKey = keyring.getRdeSshClientPublicKey();
assertThat(rdeSshClientPublicKey).isEqualTo("rde-ssh-client-public-stringmoo");
}
@Test
public void test_getRdeSshClientPrivateKey() {
void test_getRdeSshClientPrivateKey() {
saveCleartextSecret("rde-ssh-client-private-string");
String rdeSshClientPrivateKey = keyring.getRdeSshClientPrivateKey();
assertThat(rdeSshClientPrivateKey).isEqualTo("rde-ssh-client-private-stringmoo");
}
@Test
public void test_getIcannReportingPassword() {
void test_getIcannReportingPassword() {
saveCleartextSecret("icann-reporting-password-string");
String icannReportingPassword = keyring.getIcannReportingPassword();
assertThat(icannReportingPassword).isEqualTo("icann-reporting-password-stringmoo");
}
@Test
public void test_getMarksdbDnlLoginAndPassword() {
void test_getMarksdbDnlLoginAndPassword() {
saveCleartextSecret("marksdb-dnl-login-string");
String marksdbDnlLoginAndPassword = keyring.getMarksdbDnlLoginAndPassword();
assertThat(marksdbDnlLoginAndPassword).isEqualTo("marksdb-dnl-login-stringmoo");
}
@Test
public void test_getMarksdbLordnPassword() {
void test_getMarksdbLordnPassword() {
saveCleartextSecret("marksdb-lordn-password-string");
String marksdbLordnPassword = keyring.getMarksdbLordnPassword();
assertThat(marksdbLordnPassword).isEqualTo("marksdb-lordn-password-stringmoo");
}
@Test
public void test_getMarksdbSmdrlLoginAndPassword() {
void test_getMarksdbSmdrlLoginAndPassword() {
saveCleartextSecret("marksdb-smdrl-login-string");
String marksdbSmdrlLoginAndPassword = keyring.getMarksdbSmdrlLoginAndPassword();
assertThat(marksdbSmdrlLoginAndPassword).isEqualTo("marksdb-smdrl-login-stringmoo");
}
@Test
public void test_getJsonCredential() {
void test_getJsonCredential() {
saveCleartextSecret("json-credential-string");
String jsonCredential = keyring.getJsonCredential();
assertThat(jsonCredential).isEqualTo("json-credential-stringmoo");
}

View file

@ -27,29 +27,27 @@ import google.registry.testing.BouncyCastleProviderRule;
import java.io.IOException;
import org.bouncycastle.openpgp.PGPKeyPair;
import org.bouncycastle.openpgp.PGPPublicKey;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
@RunWith(JUnit4.class)
/** Unit tests for {@link KmsUpdater} */
public class KmsUpdaterTest {
@Rule
@RegisterExtension
public final AppEngineRule appEngine = AppEngineRule.builder().withDatastoreAndCloudSql().build();
@Rule public final BouncyCastleProviderRule bouncy = new BouncyCastleProviderRule();
@RegisterExtension public final BouncyCastleProviderRule bouncy = new BouncyCastleProviderRule();
private KmsUpdater updater;
@Before
public void setUp() {
@BeforeEach
void beforeEach() {
updater = new KmsUpdater(new FakeKmsConnection());
}
@Test
public void test_setMultipleSecrets() {
void test_setMultipleSecrets() {
updater
.setMarksdbDnlLoginAndPassword("value1")
.setIcannReportingPassword("value2")
@ -69,7 +67,7 @@ public class KmsUpdaterTest {
}
@Test
public void test_setBrdaReceiverKey() throws Exception {
void test_setBrdaReceiverKey() throws Exception {
updater.setBrdaReceiverPublicKey(KmsTestHelper.getPublicKey()).update();
verifySecretAndSecretRevisionWritten(
@ -79,7 +77,7 @@ public class KmsUpdaterTest {
}
@Test
public void test_setBrdaSigningKey() throws Exception {
void test_setBrdaSigningKey() throws Exception {
updater.setBrdaSigningKey(KmsTestHelper.getKeyPair()).update();
verifySecretAndSecretRevisionWritten(
@ -93,7 +91,7 @@ public class KmsUpdaterTest {
}
@Test
public void test_setCloudSqlPassword() {
void test_setCloudSqlPassword() {
updater.setCloudSqlPassword("value1").update();
verifySecretAndSecretRevisionWritten(
@ -101,7 +99,7 @@ public class KmsUpdaterTest {
}
@Test
public void test_setToolsCloudSqlPassword() {
void test_setToolsCloudSqlPassword() {
updater.setToolsCloudSqlPassword("value1").update();
verifySecretAndSecretRevisionWritten(
@ -111,7 +109,7 @@ public class KmsUpdaterTest {
}
@Test
public void test_setIcannReportingPassword() {
void test_setIcannReportingPassword() {
updater.setIcannReportingPassword("value1").update();
verifySecretAndSecretRevisionWritten(
@ -121,7 +119,7 @@ public class KmsUpdaterTest {
}
@Test
public void test_setJsonCredential() {
void test_setJsonCredential() {
updater.setJsonCredential("value1").update();
verifySecretAndSecretRevisionWritten(
@ -129,7 +127,7 @@ public class KmsUpdaterTest {
}
@Test
public void test_setMarksdbDnlLoginAndPassword() {
void test_setMarksdbDnlLoginAndPassword() {
updater.setMarksdbDnlLoginAndPassword("value1").update();
verifySecretAndSecretRevisionWritten(
@ -137,7 +135,7 @@ public class KmsUpdaterTest {
}
@Test
public void test_setMarksdbLordnPassword() {
void test_setMarksdbLordnPassword() {
updater.setMarksdbLordnPassword("value1").update();
verifySecretAndSecretRevisionWritten(
@ -147,7 +145,7 @@ public class KmsUpdaterTest {
}
@Test
public void test_setMarksdbSmdrlLoginAndPassword() {
void test_setMarksdbSmdrlLoginAndPassword() {
updater.setMarksdbSmdrlLoginAndPassword("value1").update();
verifySecretAndSecretRevisionWritten(
@ -155,7 +153,7 @@ public class KmsUpdaterTest {
}
@Test
public void test_setRdeReceiverKey() throws Exception {
void test_setRdeReceiverKey() throws Exception {
updater.setRdeReceiverPublicKey(KmsTestHelper.getPublicKey()).update();
verifySecretAndSecretRevisionWritten(
@ -166,7 +164,7 @@ public class KmsUpdaterTest {
}
@Test
public void test_setRdeSigningKey() throws Exception {
void test_setRdeSigningKey() throws Exception {
updater.setRdeSigningKey(KmsTestHelper.getKeyPair()).update();
verifySecretAndSecretRevisionWritten(
@ -180,7 +178,7 @@ public class KmsUpdaterTest {
}
@Test
public void test_setRdeSshClientPrivateKey() {
void test_setRdeSshClientPrivateKey() {
updater.setRdeSshClientPrivateKey("value1").update();
verifySecretAndSecretRevisionWritten(
@ -190,7 +188,7 @@ public class KmsUpdaterTest {
}
@Test
public void test_setRdeSshClientPublicKey() {
void test_setRdeSshClientPublicKey() {
updater.setRdeSshClientPublicKey("value1").update();
verifySecretAndSecretRevisionWritten(
@ -200,7 +198,7 @@ public class KmsUpdaterTest {
}
@Test
public void test_setRdeStagingKey() throws Exception {
void test_setRdeStagingKey() throws Exception {
updater.setRdeStagingKey(KmsTestHelper.getKeyPair()).update();
verifySecretAndSecretRevisionWritten(

View file

@ -65,10 +65,8 @@ import org.bouncycastle.openpgp.operator.bc.BcPGPDigestCalculatorProvider;
import org.bouncycastle.openpgp.operator.bc.BcPublicKeyDataDecryptorFactory;
import org.bouncycastle.openpgp.operator.bc.BcPublicKeyKeyEncryptionMethodGenerator;
import org.bouncycastle.util.encoders.Base64;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
/**
* Bouncy Castle – How does it work?!
@ -96,8 +94,6 @@ import org.junit.runners.JUnit4;
* using 1.46 so thankfully we're not far enough behind that the Bouncy Castle authors have decided
* to remove these functions. But a migration effort will be necessary in the future.
*/
@RunWith(JUnit4.class)
@SuppressWarnings("resource")
public class BouncyCastleTest {
private static final String FALL_OF_HYPERION_A_DREAM = ""
@ -122,11 +118,10 @@ public class BouncyCastleTest {
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
@Rule
public final BouncyCastleProviderRule bouncy = new BouncyCastleProviderRule();
@RegisterExtension public final BouncyCastleProviderRule bouncy = new BouncyCastleProviderRule();
@Test
public void testCompressDecompress() throws Exception {
void testCompressDecompress() throws Exception {
// Compress the data and write out a compressed data OpenPGP message.
byte[] data;
try (ByteArrayOutputStream output = new ByteArrayOutputStream()) {
@ -150,7 +145,7 @@ public class BouncyCastleTest {
}
@Test
public void testSignVerify_Detached() throws Exception {
void testSignVerify_Detached() throws Exception {
// Load the keys.
PGPPublicKeyRing publicKeyRing = new BcPGPPublicKeyRing(PUBLIC_KEY);
PGPSecretKeyRing privateKeyRing = new BcPGPSecretKeyRing(PRIVATE_KEY);
@ -190,7 +185,7 @@ public class BouncyCastleTest {
}
@Test
public void testSignVerify_OnePass() throws Exception {
void testSignVerify_OnePass() throws Exception {
// Load the keys.
PGPPublicKeyRing publicKeyRing = new BcPGPPublicKeyRing(PUBLIC_KEY);
PGPSecretKeyRing privateKeyRing = new BcPGPSecretKeyRing(PRIVATE_KEY);
@ -234,7 +229,7 @@ public class BouncyCastleTest {
}
@Test
public void testEncryptDecrypt_ExplicitStyle() throws Exception {
void testEncryptDecrypt_ExplicitStyle() throws Exception {
int bufferSize = 64 * 1024;
// Alice loads Bob's "publicKey" into memory.
@ -275,7 +270,7 @@ public class BouncyCastleTest {
}
@Test
public void testEncryptDecrypt_KeyRingStyle() throws Exception {
void testEncryptDecrypt_KeyRingStyle() throws Exception {
int bufferSize = 64 * 1024;
// Alice loads Bob's "publicKey" into memory from her public key ring.
@ -320,7 +315,7 @@ public class BouncyCastleTest {
}
@Test
public void testCompressEncryptDecryptDecompress_KeyRingStyle() throws Exception {
void testCompressEncryptDecryptDecompress_KeyRingStyle() throws Exception {
int bufsz = 64 * 1024;
// Alice loads Bob's "publicKey" into memory from her public key ring.

View file

@ -42,15 +42,12 @@ import org.bouncycastle.openpgp.PGPKeyPair;
import org.bouncycastle.openpgp.PGPPrivateKey;
import org.bouncycastle.openpgp.PGPPublicKey;
import org.joda.time.DateTime;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
/** Unit tests for {@link BrdaCopyAction}. */
@RunWith(JUnit4.class)
public class BrdaCopyActionTest {
private static final ByteSource DEPOSIT_XML = RdeTestData.loadBytes("deposit_full.xml");
@ -64,14 +61,14 @@ public class BrdaCopyActionTest {
private static final GcsFilename SIG_FILE =
new GcsFilename("tub", "lol_2010-10-17_thin_S1_R0.sig");
@Rule
public final BouncyCastleProviderRule bouncy = new BouncyCastleProviderRule();
@RegisterExtension public final BouncyCastleProviderRule bouncy = new BouncyCastleProviderRule();
@Rule
@RegisterExtension
public final AppEngineRule appEngine = AppEngineRule.builder().withDatastoreAndCloudSql().build();
@Rule
public final GpgSystemCommandRule gpg = new GpgSystemCommandRule(
@RegisterExtension
public final GpgSystemCommandRule gpg =
new GpgSystemCommandRule(
RdeTestData.loadBytes("pgp-public-keyring.asc"),
RdeTestData.loadBytes("pgp-private-keyring-escrow.asc"));
@ -80,8 +77,8 @@ public class BrdaCopyActionTest {
private static PGPPublicKey receiverKey;
private static PGPKeyPair signingKey;
@BeforeClass
public static void beforeClass() {
@BeforeAll
static void beforeAll() {
try (Keyring keyring = new FakeKeyringModule().get()) {
encryptKey = keyring.getRdeStagingEncryptionKey();
decryptKey = keyring.getRdeStagingDecryptionKey();
@ -94,8 +91,8 @@ public class BrdaCopyActionTest {
private final GcsUtils gcsUtils = new GcsUtils(gcsService, 1024);
private final BrdaCopyAction action = new BrdaCopyAction();
@Before
public void before() throws Exception {
@BeforeEach
void beforeEach() throws Exception {
action.gcsUtils = gcsUtils;
action.tld = "lol";
action.watermark = DateTime.parse("2010-10-17TZ");
@ -112,7 +109,7 @@ public class BrdaCopyActionTest {
}
@Test
public void testRun() {
void testRun() {
action.run();
assertThat(gcsUtils.existsAndNotEmpty(STAGE_FILE)).isTrue();
assertThat(gcsUtils.existsAndNotEmpty(RYDE_FILE)).isTrue();
@ -120,7 +117,7 @@ public class BrdaCopyActionTest {
}
@Test
public void testRun_rydeFormat() throws Exception {
void testRun_rydeFormat() throws Exception {
assumeTrue(hasCommand("gpg --version"));
action.run();
@ -167,7 +164,7 @@ public class BrdaCopyActionTest {
}
@Test
public void testRun_rydeSignature() throws Exception {
void testRun_rydeSignature() throws Exception {
assumeTrue(hasCommand("gpg --version"));
action.run();

View file

@ -47,11 +47,9 @@ import google.registry.xjc.rdecontact.XjcRdeContact;
import google.registry.xjc.rdecontact.XjcRdeContactElement;
import java.io.ByteArrayOutputStream;
import org.joda.time.DateTime;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
/**
* Unit tests for {@link ContactResourceToXjcConverter}.
@ -59,19 +57,18 @@ import org.junit.runners.JUnit4;
* <p>This tests the mapping between {@link ContactResource} and {@link XjcRdeContact} as well as
* some exceptional conditions.
*/
@RunWith(JUnit4.class)
public class ContactResourceToXjcConverterTest {
@Rule
@RegisterExtension
public final AppEngineRule appEngine = AppEngineRule.builder().withDatastoreAndCloudSql().build();
@Before
public void before() {
@BeforeEach
void beforeEach() {
createTld("xn--q9jyb4c");
}
@Test
public void testConvertContact() {
void testConvertContact() {
ContactResource contact = makeContactResource();
XjcRdeContact bean = ContactResourceToXjcConverter.convertContact(contact);
@ -232,7 +229,7 @@ public class ContactResourceToXjcConverterTest {
}
@Test
public void testConvertContact_absentVoiceAndFaxNumbers() {
void testConvertContact_absentVoiceAndFaxNumbers() {
XjcRdeContact bean = ContactResourceToXjcConverter.convertContact(
makeContactResource().asBuilder()
.setVoiceNumber(null)
@ -243,7 +240,7 @@ public class ContactResourceToXjcConverterTest {
}
@Test
public void testConvertContact_absentDisclose() {
void testConvertContact_absentDisclose() {
XjcRdeContact bean = ContactResourceToXjcConverter.convertContact(
makeContactResource().asBuilder()
.setDisclose(null)
@ -252,7 +249,7 @@ public class ContactResourceToXjcConverterTest {
}
@Test
public void testConvertContact_absentTransferData() {
void testConvertContact_absentTransferData() {
XjcRdeContact bean = ContactResourceToXjcConverter.convertContact(
makeContactResource().asBuilder()
.setLastTransferTime(null)
@ -263,7 +260,7 @@ public class ContactResourceToXjcConverterTest {
}
@Test
public void testMarshal() throws Exception {
void testMarshal() throws Exception {
XjcRdeContact bean = ContactResourceToXjcConverter.convertContact(makeContactResource());
wrapDeposit(bean).marshal(new ByteArrayOutputStream(), UTF_8);
}

View file

@ -71,11 +71,9 @@ import google.registry.xjc.secdns.XjcSecdnsDsDataType;
import java.io.ByteArrayOutputStream;
import org.joda.money.Money;
import org.joda.time.DateTime;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
/**
* Unit tests for {@link DomainBaseToXjcConverter}.
@ -83,22 +81,21 @@ import org.junit.runners.JUnit4;
* <p>This tests the mapping between {@link DomainBase} and {@link XjcRdeDomain} as well as some
* exceptional conditions.
*/
@RunWith(JUnit4.class)
public class DomainBaseToXjcConverterTest {
@Rule
@RegisterExtension
public final AppEngineRule appEngine = AppEngineRule.builder().withDatastoreAndCloudSql().build();
private final DateTime now = DateTime.parse("2014-01-01T00:00:00Z");
private final FakeClock clock = new FakeClock(now);
@Before
public void before() {
@BeforeEach
void beforeEach() {
createTld("xn--q9jyb4c");
}
@Test
public void testConvertThick() {
void testConvertThick() {
XjcRdeDomain bean = DomainBaseToXjcConverter.convertDomain(makeDomainBase(clock), RdeMode.FULL);
assertThat(bean.getClID()).isEqualTo("GetTheeBack");
@ -179,7 +176,7 @@ public class DomainBaseToXjcConverterTest {
}
@Test
public void testConvertThin() {
void testConvertThin() {
XjcRdeDomain bean = DomainBaseToXjcConverter.convertDomain(makeDomainBase(clock), RdeMode.THIN);
assertThat(bean.getRegistrant()).isNull();
assertThat(bean.getContacts()).isEmpty();
@ -187,18 +184,18 @@ public class DomainBaseToXjcConverterTest {
}
@Test
public void testMarshalThick() throws Exception {
void testMarshalThick() throws Exception {
XjcRdeDomain bean = DomainBaseToXjcConverter.convertDomain(makeDomainBase(clock), RdeMode.FULL);
wrapDeposit(bean).marshal(new ByteArrayOutputStream(), UTF_8);
}
@Test
public void testMarshalThin() throws Exception {
void testMarshalThin() throws Exception {
XjcRdeDomain bean = DomainBaseToXjcConverter.convertDomain(makeDomainBase(clock), RdeMode.THIN);
wrapDeposit(bean).marshal(new ByteArrayOutputStream(), UTF_8);
}
public XjcRdeDeposit wrapDeposit(XjcRdeDomain domain) {
XjcRdeDeposit wrapDeposit(XjcRdeDomain domain) {
XjcRdeDeposit deposit = new XjcRdeDeposit();
deposit.setId("984302");
deposit.setType(XjcRdeDepositTypeType.FULL);

View file

@ -35,18 +35,15 @@ import google.registry.testing.FakeClock;
import google.registry.testing.FakeLockHandler;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
/** Unit tests for {@link EscrowTaskRunner}. */
@RunWith(JUnit4.class)
public class EscrowTaskRunnerTest {
@Rule
@RegisterExtension
public final AppEngineRule appEngine =
AppEngineRule.builder().withDatastoreAndCloudSql().withTaskQueue().build();
@ -57,8 +54,8 @@ public class EscrowTaskRunnerTest {
private EscrowTaskRunner runner;
private Registry registry;
@Before
public void before() {
@BeforeEach
void beforeEach() {
createTld("lol");
registry = Registry.get("lol");
runner = new EscrowTaskRunner();
@ -68,13 +65,13 @@ public class EscrowTaskRunnerTest {
DateTimeZone.setDefault(DateTimeZone.forID("America/New_York")); // Make sure UTC stuff works.
}
@After
public void after() {
@AfterEach
void afterEach() {
DateTimeZone.setDefault(previousDateTimeZone);
}
@Test
public void testRun_cursorIsToday_advancesCursorToTomorrow() throws Exception {
void testRun_cursorIsToday_advancesCursorToTomorrow() throws Exception {
clock.setTo(DateTime.parse("2006-06-06T00:30:00Z"));
persistResource(
Cursor.create(CursorType.RDE_STAGING, DateTime.parse("2006-06-06TZ"), registry));
@ -87,7 +84,7 @@ public class EscrowTaskRunnerTest {
}
@Test
public void testRun_cursorMissing_assumesTodayAndAdvancesCursorToTomorrow() throws Exception {
void testRun_cursorMissing_assumesTodayAndAdvancesCursorToTomorrow() throws Exception {
clock.setTo(DateTime.parse("2006-06-06T00:30:00Z"));
runner.lockRunAndRollForward(
task, registry, standardSeconds(30), CursorType.RDE_STAGING, standardDays(1));
@ -98,7 +95,7 @@ public class EscrowTaskRunnerTest {
}
@Test
public void testRun_cursorInTheFuture_doesNothing() {
void testRun_cursorInTheFuture_doesNothing() {
clock.setTo(DateTime.parse("2006-06-06T00:30:00Z"));
persistResource(
Cursor.create(CursorType.RDE_STAGING, DateTime.parse("2006-06-07TZ"), registry));
@ -112,7 +109,7 @@ public class EscrowTaskRunnerTest {
}
@Test
public void testRun_lockIsntAvailable_throws503() {
void testRun_lockIsntAvailable_throws503() {
String lockName = "EscrowTaskRunner " + task.getClass().getSimpleName();
clock.setTo(DateTime.parse("2006-06-06T00:30:00Z"));
persistResource(

View file

@ -14,13 +14,14 @@
package google.registry.rde;
import static com.google.common.base.Strings.repeat;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth.assertWithMessage;
import static google.registry.testing.SystemInfo.hasCommand;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assume.assumeTrue;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableList;
import com.google.common.io.CharStreams;
import google.registry.keyring.api.Keyring;
import google.registry.testing.BouncyCastleProviderRule;
@ -32,55 +33,57 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.util.stream.Stream;
import org.bouncycastle.openpgp.PGPPublicKey;
import org.junit.Rule;
import org.junit.experimental.theories.DataPoints;
import org.junit.experimental.theories.Theories;
import org.junit.experimental.theories.Theory;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
/** GnuPG integration tests for {@link Ghostryde}. */
@RunWith(Theories.class)
@SuppressWarnings("resource")
public class GhostrydeGpgIntegrationTest {
class GhostrydeGpgIntegrationTest {
@Rule
public final BouncyCastleProviderRule bouncy = new BouncyCastleProviderRule();
@RegisterExtension public final BouncyCastleProviderRule bouncy = new BouncyCastleProviderRule();
@Rule
@RegisterExtension
public final GpgSystemCommandRule gpg =
new GpgSystemCommandRule(
RdeTestData.loadBytes("pgp-public-keyring.asc"),
RdeTestData.loadBytes("pgp-private-keyring-registry.asc"));
@DataPoints
public static GpgCommand[] commands = new GpgCommand[] {
new GpgCommand("gpg"),
new GpgCommand("gpg2"),
};
private static final ImmutableList<String> COMMANDS = ImmutableList.of("gpg", "gpg2");
private static final ImmutableList<String> CONTENTS =
ImmutableList.of(
"(◕‿◕)",
Strings.repeat("Fanatics have their dreams, wherewith they weave\n", 1000),
"\0yolo",
"");
@DataPoints
public static Content[] contents = new Content[] {
new Content("(◕‿◕)"),
new Content(repeat("Fanatics have their dreams, wherewith they weave\n", 1000)),
new Content("\0yolo"),
new Content(""),
};
static Stream<Arguments> provideTestCombinations() {
Stream.Builder<Arguments> stream = Stream.builder();
for (String command : COMMANDS) {
for (String content : CONTENTS) {
stream.add(Arguments.of(command, content));
}
}
return stream.build();
}
@Theory
public void test(GpgCommand cmd, Content content) throws Exception {
assumeTrue(hasCommand(cmd.get() + " --version"));
@ParameterizedTest
@MethodSource("provideTestCombinations")
void test(String command, String content) throws Exception {
assumeTrue(hasCommand(command + " --version"));
Keyring keyring = new FakeKeyringModule().get();
PGPPublicKey publicKey = keyring.getRdeStagingEncryptionKey();
File file = new File(gpg.getCwd(), "love.gpg");
byte[] data = content.get().getBytes(UTF_8);
byte[] data = content.getBytes(UTF_8);
try (OutputStream output = new FileOutputStream(file);
OutputStream ghostrydeEncoder = Ghostryde.encoder(output, publicKey)) {
ghostrydeEncoder.write(data);
}
Process pid = gpg.exec(cmd.get(), "--list-packets", "--keyid-format", "long", file.getPath());
Process pid = gpg.exec(command, "--list-packets", "--keyid-format", "long", file.getPath());
String stdout = CharStreams.toString(new InputStreamReader(pid.getInputStream(), UTF_8));
String stderr = CharStreams.toString(new InputStreamReader(pid.getErrorStream(), UTF_8));
assertWithMessage(stderr).that(pid.waitFor()).isEqualTo(0);
@ -90,39 +93,15 @@ public class GhostrydeGpgIntegrationTest {
assertThat(stdout).contains("name=\"" + Ghostryde.INNER_FILENAME + "\"");
assertThat(stderr).contains("encrypted with 2048-bit RSA key, ID A59C132F3589A1D5");
pid = gpg.exec(cmd.get(), "--use-embedded-filename", file.getPath());
pid = gpg.exec(command, "--use-embedded-filename", file.getPath());
stderr = CharStreams.toString(new InputStreamReader(pid.getErrorStream(), UTF_8));
assertWithMessage(stderr).that(pid.waitFor()).isEqualTo(0);
File dataFile = new File(gpg.getCwd(), Ghostryde.INNER_FILENAME);
assertThat(dataFile.exists()).isTrue();
assertThat(slurp(dataFile)).isEqualTo(content.get());
assertThat(slurp(dataFile)).isEqualTo(content);
}
private String slurp(File file) throws IOException {
return CharStreams.toString(new InputStreamReader(new FileInputStream(file), UTF_8));
}
private static class GpgCommand {
private final String value;
GpgCommand(String value) {
this.value = value;
}
String get() {
return value;
}
}
private static class Content {
private final String value;
Content(String value) {
this.value = value;
}
String get() {
return value;
}
}
}

View file

@ -14,7 +14,6 @@
package google.registry.rde;
import static com.google.common.base.Strings.repeat;
import static com.google.common.truth.Truth.assertThat;
import static google.registry.keyring.api.PgpHelper.KeyRequirement.ENCRYPT;
import static java.nio.charset.StandardCharsets.UTF_8;
@ -24,6 +23,8 @@ import static org.hamcrest.Matchers.lessThan;
import static org.junit.Assert.assertThrows;
import static org.junit.Assume.assumeThat;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableList;
import com.google.common.io.ByteStreams;
import google.registry.keyring.api.Keyring;
import google.registry.testing.BouncyCastleProviderRule;
@ -33,52 +34,55 @@ import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Base64;
import java.util.stream.Stream;
import org.bouncycastle.openpgp.PGPException;
import org.bouncycastle.openpgp.PGPKeyPair;
import org.bouncycastle.openpgp.PGPPrivateKey;
import org.bouncycastle.openpgp.PGPPublicKey;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.theories.DataPoints;
import org.junit.experimental.theories.Theories;
import org.junit.experimental.theories.Theory;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
/** Unit tests for {@link Ghostryde}. */
@RunWith(Theories.class)
@SuppressWarnings("resource")
public class GhostrydeTest {
@Rule
public final BouncyCastleProviderRule bouncy = new BouncyCastleProviderRule();
@RegisterExtension public final BouncyCastleProviderRule bouncy = new BouncyCastleProviderRule();
@DataPoints
public static Content[] contents = new Content[] {
new Content("hi"),
new Content("(◕‿◕)"),
new Content(repeat("Fanatics have their dreams, wherewith they weave.\n", 1000)),
new Content("\0yolo"),
new Content(""),
};
private static final ImmutableList<String> CONTENTS =
ImmutableList.of(
"hi",
"(◕‿◕)",
Strings.repeat("Fanatics have their dreams, wherewith they weave\n", 1000),
"\0yolo",
"");
@Theory
public void testSimpleApi(Content content) throws Exception {
static Stream<Arguments> provideTestCombinations() {
return CONTENTS.stream().map(Arguments::of);
}
@ParameterizedTest
@MethodSource("provideTestCombinations")
void testSimpleApi(String content) throws Exception {
Keyring keyring = new FakeKeyringModule().get();
byte[] data = content.get().getBytes(UTF_8);
byte[] data = content.getBytes(UTF_8);
PGPPublicKey publicKey = keyring.getRdeStagingEncryptionKey();
PGPPrivateKey privateKey = keyring.getRdeStagingDecryptionKey();
byte[] blob = Ghostryde.encode(data, publicKey);
byte[] result = Ghostryde.decode(blob, privateKey);
assertThat(new String(result, UTF_8)).isEqualTo(content.get());
assertThat(new String(result, UTF_8)).isEqualTo(content);
}
@Theory
public void testStreamingApi(Content content) throws Exception {
@ParameterizedTest
@MethodSource("provideTestCombinations")
void testStreamingApi(String content) throws Exception {
Keyring keyring = new FakeKeyringModule().get();
byte[] data = content.get().getBytes(UTF_8);
byte[] data = content.getBytes(UTF_8);
PGPPublicKey publicKey = keyring.getRdeStagingEncryptionKey();
PGPPrivateKey privateKey = keyring.getRdeStagingDecryptionKey();
@ -94,13 +98,14 @@ public class GhostrydeTest {
}
assertThat(bsOut.size()).isEqualTo(data.length);
assertThat(new String(bsOut.toByteArray(), UTF_8)).isEqualTo(content.get());
assertThat(new String(bsOut.toByteArray(), UTF_8)).isEqualTo(content);
}
@Theory
public void testStreamingApi_withSize(Content content) throws Exception {
@ParameterizedTest
@MethodSource("provideTestCombinations")
void testStreamingApi_withSize(String content) throws Exception {
Keyring keyring = new FakeKeyringModule().get();
byte[] data = content.get().getBytes(UTF_8);
byte[] data = content.getBytes(UTF_8);
PGPPublicKey publicKey = keyring.getRdeStagingEncryptionKey();
ByteArrayOutputStream bsOut = new ByteArrayOutputStream();
@ -114,14 +119,15 @@ public class GhostrydeTest {
assertThat(Long.parseLong(new String(lenOut.toByteArray(), UTF_8))).isEqualTo(data.length);
}
@Theory
public void testFailure_tampering(Content content) throws Exception {
assumeThat(content.get().length(), is(greaterThan(100)));
@ParameterizedTest
@MethodSource("provideTestCombinations")
void testFailure_tampering(String content) throws Exception {
assumeThat(content.length(), is(greaterThan(100)));
Keyring keyring = new FakeKeyringModule().get();
PGPPublicKey publicKey = keyring.getRdeStagingEncryptionKey();
PGPPrivateKey privateKey = keyring.getRdeStagingDecryptionKey();
byte[] data = content.get().getBytes(UTF_8);
byte[] data = content.getBytes(UTF_8);
ByteArrayOutputStream bsOut = new ByteArrayOutputStream();
try (OutputStream encoder = Ghostryde.encoder(bsOut, publicKey)) {
@ -143,14 +149,15 @@ public class GhostrydeTest {
assertThat(thrown).hasMessageThat().contains("tampering");
}
@Theory
public void testFailure_corruption(Content content) throws Exception {
assumeThat(content.get().length(), is(lessThan(100)));
@ParameterizedTest
@MethodSource("provideTestCombinations")
void testFailure_corruption(String content) throws Exception {
assumeThat(content.length(), is(lessThan(100)));
Keyring keyring = new FakeKeyringModule().get();
PGPPublicKey publicKey = keyring.getRdeStagingEncryptionKey();
PGPPrivateKey privateKey = keyring.getRdeStagingDecryptionKey();
byte[] data = content.get().getBytes(UTF_8);
byte[] data = content.getBytes(UTF_8);
ByteArrayOutputStream bsOut = new ByteArrayOutputStream();
try (OutputStream encoder = Ghostryde.encoder(bsOut, publicKey)) {
@ -173,7 +180,7 @@ public class GhostrydeTest {
}
@Test
public void testFullEncryption() throws Exception {
void testFullEncryption() throws Exception {
// Check that the full encryption hasn't changed. All the other tests check that encrypting and
// decrypting results in the original data, but not whether the encryption method has changed.
FakeKeyringModule keyringModule = new FakeKeyringModule();
@ -207,7 +214,7 @@ public class GhostrydeTest {
}
@Test
public void testFailure_keyMismatch() throws Exception {
void testFailure_keyMismatch() throws Exception {
FakeKeyringModule keyringModule = new FakeKeyringModule();
byte[] data = "Fanatics have their dreams, wherewith they weave.".getBytes(UTF_8);
PGPKeyPair dsa1 = keyringModule.get("rde-unittest@registry.test", ENCRYPT);
@ -238,8 +245,8 @@ public class GhostrydeTest {
}
@Test
@Ignore("Intentionally corrupting a PGP key is easier said than done >_>")
public void testFailure_keyCorruption() throws Exception {
@Disabled("Intentionally corrupting a PGP key is easier said than done >_>")
void testFailure_keyCorruption() throws Exception {
FakeKeyringModule keyringModule = new FakeKeyringModule();
byte[] data = "Fanatics have their dreams, wherewith they weave.".getBytes(UTF_8);
PGPKeyPair rsa = keyringModule.get("rde-unittest@registry.test", ENCRYPT);
@ -271,16 +278,4 @@ public class GhostrydeTest {
bytes[position] = 23;
}
}
private static class Content {
private final String value;
Content(String value) {
this.value = value;
}
String get() {
return value;
}
}
}

View file

@ -33,11 +33,9 @@ import google.registry.xjc.rdehost.XjcRdeHost;
import google.registry.xjc.rdehost.XjcRdeHostElement;
import java.io.ByteArrayOutputStream;
import org.joda.time.DateTime;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
/**
* Unit tests for {@link HostResourceToXjcConverter}.
@ -45,19 +43,18 @@ import org.junit.runners.JUnit4;
* <p>This tests the mapping between {@link HostResource} and {@link XjcRdeHost} as well as some
* exceptional conditions.
*/
@RunWith(JUnit4.class)
public class HostResourceToXjcConverterTest {
@Rule
@RegisterExtension
public final AppEngineRule appEngine = AppEngineRule.builder().withDatastoreAndCloudSql().build();
@Before
public void init() {
@BeforeEach
void beforeEach() {
createTld("foobar");
}
@Test
public void testConvertSubordinateHost() {
void testConvertSubordinateHost() {
DomainBase domain =
newDomainBase("love.foobar")
.asBuilder()
@ -120,7 +117,7 @@ public class HostResourceToXjcConverterTest {
}
@Test
public void testConvertExternalHost() {
void testConvertExternalHost() {
XjcRdeHost bean =
HostResourceToXjcConverter.convertExternalHost(
new HostResource.Builder()
@ -169,7 +166,7 @@ public class HostResourceToXjcConverterTest {
}
@Test
public void testConvertExternalHost_ipv6() {
void testConvertExternalHost_ipv6() {
XjcRdeHost bean =
HostResourceToXjcConverter.convertExternalHost(
new HostResource.Builder()
@ -190,7 +187,7 @@ public class HostResourceToXjcConverterTest {
}
@Test
public void testHostStatusValueIsInvalid() {
void testHostStatusValueIsInvalid() {
assertThrows(
IllegalArgumentException.class,
() ->
@ -210,7 +207,7 @@ public class HostResourceToXjcConverterTest {
}
@Test
public void testMarshal() throws Exception {
void testMarshal() throws Exception {
// Bean! Bean! Bean!
XjcRdeHostElement bean =
HostResourceToXjcConverter.convertExternal(

View file

@ -35,27 +35,23 @@ import google.registry.testing.AppEngineRule;
import google.registry.testing.FakeClock;
import google.registry.testing.InjectRule;
import org.joda.time.DateTime;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
/** Unit tests for {@link PendingDepositChecker}. */
@RunWith(JUnit4.class)
public class PendingDepositCheckerTest {
@Rule
public final InjectRule inject = new InjectRule();
@RegisterExtension public final InjectRule inject = new InjectRule();
@Rule
@RegisterExtension
public final AppEngineRule appEngine = AppEngineRule.builder().withDatastoreAndCloudSql().build();
private final FakeClock clock = new FakeClock();
private final PendingDepositChecker checker = new PendingDepositChecker();
@Before
public void before() {
@BeforeEach
void beforeEach() {
inject.setStaticField(Ofy.class, "clock", clock);
checker.brdaDayOfWeek = TUESDAY;
checker.brdaInterval = standardDays(7);
@ -64,14 +60,14 @@ public class PendingDepositCheckerTest {
}
@Test
public void testMethod_noTldsWithEscrowEnabled_returnsEmpty() {
void testMethod_noTldsWithEscrowEnabled_returnsEmpty() {
createTld("pal");
createTld("fun");
assertThat(checker.getTldsAndWatermarksPendingDepositForRdeAndBrda()).isEmpty();
}
@Test
public void testMethod_firstDeposit_depositsRdeTodayAtMidnight() {
void testMethod_firstDeposit_depositsRdeTodayAtMidnight() {
clock.setTo(DateTime.parse("2000-01-01T08:00Z")); // Saturday
createTldWithEscrowEnabled("lol");
clock.advanceOneMilli();
@ -82,7 +78,7 @@ public class PendingDepositCheckerTest {
}
@Test
public void testMethod_firstDepositOnBrdaDay_depositsBothRdeAndBrda() {
void testMethod_firstDepositOnBrdaDay_depositsBothRdeAndBrda() {
clock.setTo(DateTime.parse("2000-01-04T08:00Z")); // Tuesday
createTldWithEscrowEnabled("lol");
clock.advanceOneMilli();
@ -95,7 +91,7 @@ public class PendingDepositCheckerTest {
}
@Test
public void testMethod_firstRdeDeposit_initializesCursorToMidnightToday() {
void testMethod_firstRdeDeposit_initializesCursorToMidnightToday() {
clock.setTo(DateTime.parse("2000-01-01TZ")); // Saturday
createTldWithEscrowEnabled("lol");
clock.advanceOneMilli();
@ -107,7 +103,7 @@ public class PendingDepositCheckerTest {
}
@Test
public void testMethod_subsequentRdeDeposit_doesntMutateCursor() {
void testMethod_subsequentRdeDeposit_doesntMutateCursor() {
clock.setTo(DateTime.parse("2000-01-01TZ")); // Saturday
createTldWithEscrowEnabled("lol");
clock.advanceOneMilli();
@ -120,7 +116,7 @@ public class PendingDepositCheckerTest {
}
@Test
public void testMethod_firstBrdaDepositButNotOnBrdaDay_doesntInitializeCursor() {
void testMethod_firstBrdaDepositButNotOnBrdaDay_doesntInitializeCursor() {
clock.setTo(DateTime.parse("2000-01-01TZ")); // Saturday
createTldWithEscrowEnabled("lol");
Registry registry = Registry.get("lol");
@ -133,7 +129,7 @@ public class PendingDepositCheckerTest {
}
@Test
public void testMethod_backloggedTwoDays_onlyWantsLeastRecentDay() {
void testMethod_backloggedTwoDays_onlyWantsLeastRecentDay() {
clock.setTo(DateTime.parse("2000-01-01TZ"));
createTldWithEscrowEnabled("lol");
clock.advanceOneMilli();
@ -146,7 +142,7 @@ public class PendingDepositCheckerTest {
}
@Test
public void testMethod_multipleTldsWithEscrowEnabled_depositsBoth() {
void testMethod_multipleTldsWithEscrowEnabled_depositsBoth() {
clock.setTo(DateTime.parse("2000-01-01TZ")); // Saturday
createTldWithEscrowEnabled("pal");
clock.advanceOneMilli();

View file

@ -20,23 +20,20 @@ import static google.registry.xml.ValidationMode.STRICT;
import google.registry.testing.AppEngineRule;
import google.registry.xml.XmlTestUtils;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
/** Unit tests for {@link RdeMarshaller}. */
@RunWith(JUnit4.class)
public class RdeMarshallerTest {
private static final String DECLARATION =
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n";
@Rule
@RegisterExtension
public final AppEngineRule appEngine = AppEngineRule.builder().withDatastoreAndCloudSql().build();
@Test
public void testMarshalRegistrar_validData_producesXmlFragment() throws Exception {
void testMarshalRegistrar_validData_producesXmlFragment() throws Exception {
DepositFragment fragment =
new RdeMarshaller(STRICT).marshalRegistrar(loadRegistrar("TheRegistrar"));
assertThat(fragment.type()).isEqualTo(RdeResourceType.REGISTRAR);
@ -80,7 +77,7 @@ public class RdeMarshallerTest {
}
@Test
public void testMarshalRegistrar_unicodeCharacters_dontGetMangled() {
void testMarshalRegistrar_unicodeCharacters_dontGetMangled() {
DepositFragment fragment =
new RdeMarshaller(STRICT).marshalRegistrar(loadRegistrar("TheRegistrar"));
assertThat(fragment.xml()).contains("123 Example Bőulevard");

View file

@ -64,24 +64,21 @@ import java.net.SocketTimeoutException;
import java.util.Map;
import org.bouncycastle.openpgp.PGPPublicKey;
import org.joda.time.DateTime;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.mockito.ArgumentCaptor;
/** Unit tests for {@link RdeReportAction}. */
@RunWith(JUnit4.class)
public class RdeReportActionTest {
private static final ByteSource REPORT_XML = RdeTestData.loadBytes("report.xml");
private static final ByteSource IIRDEA_BAD_XML = RdeTestData.loadBytes("iirdea_bad.xml");
private static final ByteSource IIRDEA_GOOD_XML = RdeTestData.loadBytes("iirdea_good.xml");
@Rule
public final BouncyCastleProviderRule bouncy = new BouncyCastleProviderRule();
@Rule
@RegisterExtension public final BouncyCastleProviderRule bouncy = new BouncyCastleProviderRule();
@RegisterExtension
public final AppEngineRule appEngine = AppEngineRule.builder().withDatastoreAndCloudSql().build();
private final FakeResponse response = new FakeResponse();
@ -113,8 +110,8 @@ public class RdeReportActionTest {
return action;
}
@Before
public void before() throws Exception {
@BeforeEach
void beforeEach() throws Exception {
PGPPublicKey encryptKey = new FakeKeyringModule().get().getRdeStagingEncryptionKey();
createTld("test");
persistResource(
@ -125,7 +122,7 @@ public class RdeReportActionTest {
}
@Test
public void testRun() {
void testRun() {
createTld("lol");
RdeReportAction action = createAction();
action.tld = "lol";
@ -136,7 +133,7 @@ public class RdeReportActionTest {
}
@Test
public void testRunWithLock() throws Exception {
void testRunWithLock() throws Exception {
when(httpResponse.getResponseCode()).thenReturn(SC_OK);
when(httpResponse.getContent()).thenReturn(IIRDEA_GOOD_XML.read());
when(urlFetchService.fetch(request.capture())).thenReturn(httpResponse);
@ -162,7 +159,7 @@ public class RdeReportActionTest {
}
@Test
public void testRunWithLock_uploadNotFinished_throws204() {
void testRunWithLock_uploadNotFinished_throws204() {
persistResource(
Cursor.create(RDE_UPLOAD, DateTime.parse("2006-06-06TZ"), Registry.get("test")));
NoContentException thrown =
@ -176,7 +173,7 @@ public class RdeReportActionTest {
}
@Test
public void testRunWithLock_badRequest_throws500WithErrorInfo() throws Exception {
void testRunWithLock_badRequest_throws500WithErrorInfo() throws Exception {
when(httpResponse.getResponseCode()).thenReturn(SC_BAD_REQUEST);
when(httpResponse.getContent()).thenReturn(IIRDEA_BAD_XML.read());
when(urlFetchService.fetch(request.capture())).thenReturn(httpResponse);
@ -188,7 +185,7 @@ public class RdeReportActionTest {
}
@Test
public void testRunWithLock_fetchFailed_throwsRuntimeException() throws Exception {
void testRunWithLock_fetchFailed_throwsRuntimeException() throws Exception {
class ExpectedThrownException extends RuntimeException {}
when(urlFetchService.fetch(any(HTTPRequest.class))).thenThrow(new ExpectedThrownException());
assertThrows(
@ -196,7 +193,7 @@ public class RdeReportActionTest {
}
@Test
public void testRunWithLock_socketTimeout_doesRetry() throws Exception {
void testRunWithLock_socketTimeout_doesRetry() throws Exception {
when(httpResponse.getResponseCode()).thenReturn(SC_OK);
when(httpResponse.getContent()).thenReturn(IIRDEA_GOOD_XML.read());
when(urlFetchService.fetch(request.capture()))

View file

@ -90,15 +90,12 @@ import org.bouncycastle.openpgp.PGPPublicKey;
import org.joda.time.DateTime;
import org.joda.time.DateTimeConstants;
import org.joda.time.Duration;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
/** Unit tests for {@link RdeStagingAction}. */
@RunWith(JUnit4.class)
public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
private static final GcsFilename XML_FILE =
@ -106,8 +103,7 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
private static final GcsFilename LENGTH_FILE =
new GcsFilename("rde-bucket", "lol_2000-01-01_full_S1_R0.xml.length");
@Rule
public final InjectRule inject = new InjectRule();
@RegisterExtension public final InjectRule inject = new InjectRule();
private final FakeClock clock = new FakeClock();
private final FakeResponse response = new FakeResponse();
@ -117,16 +113,16 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
private static PGPPublicKey encryptKey;
private static PGPPrivateKey decryptKey;
@BeforeClass
public static void beforeClass() {
@BeforeAll
static void beforeAll() {
try (Keyring keyring = new FakeKeyringModule().get()) {
encryptKey = keyring.getRdeStagingEncryptionKey();
decryptKey = keyring.getRdeStagingDecryptionKey();
}
}
@Before
public void setup() {
@BeforeEach
void beforeEach() {
inject.setStaticField(Ofy.class, "clock", clock);
action = new RdeStagingAction();
action.clock = clock;
@ -154,7 +150,7 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
}
@Test
public void testRun_modeInNonManualMode_throwsException() {
void testRun_modeInNonManualMode_throwsException() {
createTldWithEscrowEnabled("lol");
clock.setTo(DateTime.parse("2000-01-01TZ"));
action.modeStrings = ImmutableSet.of("full");
@ -162,7 +158,7 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
}
@Test
public void testRun_tldInNonManualMode_throwsException() {
void testRun_tldInNonManualMode_throwsException() {
createTldWithEscrowEnabled("lol");
clock.setTo(DateTime.parse("2000-01-01TZ"));
action.tlds = ImmutableSet.of("tld");
@ -170,7 +166,7 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
}
@Test
public void testRun_watermarkInNonManualMode_throwsException() {
void testRun_watermarkInNonManualMode_throwsException() {
createTldWithEscrowEnabled("lol");
clock.setTo(DateTime.parse("2000-01-01TZ"));
action.watermarks = ImmutableSet.of(clock.nowUtc());
@ -178,7 +174,7 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
}
@Test
public void testRun_revisionInNonManualMode_throwsException() {
void testRun_revisionInNonManualMode_throwsException() {
createTldWithEscrowEnabled("lol");
clock.setTo(DateTime.parse("2000-01-01TZ"));
action.revision = Optional.of(42);
@ -186,14 +182,14 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
}
@Test
public void testRun_noTlds_returns204() {
void testRun_noTlds_returns204() {
action.run();
assertThat(response.getStatus()).isEqualTo(204);
assertNoTasksEnqueued("mapreduce");
}
@Test
public void testRun_tldWithoutEscrowEnabled_returns204() {
void testRun_tldWithoutEscrowEnabled_returns204() {
createTld("lol");
persistResource(Registry.get("lol").asBuilder().setEscrowEnabled(false).build());
clock.setTo(DateTime.parse("2000-01-01TZ"));
@ -203,7 +199,7 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
}
@Test
public void testRun_tldWithEscrowEnabled_runsMapReduce() {
void testRun_tldWithEscrowEnabled_runsMapReduce() {
createTldWithEscrowEnabled("lol");
clock.setTo(DateTime.parse("2000-01-01TZ"));
action.run();
@ -213,7 +209,7 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
}
@Test
public void testRun_withinTransactionCooldown_getsExcludedAndReturns204() {
void testRun_withinTransactionCooldown_getsExcludedAndReturns204() {
createTldWithEscrowEnabled("lol");
clock.setTo(DateTime.parse("2000-01-01T00:04:59Z"));
action.transactionCooldown = Duration.standardMinutes(5);
@ -223,7 +219,7 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
}
@Test
public void testRun_afterTransactionCooldown_runsMapReduce() {
void testRun_afterTransactionCooldown_runsMapReduce() {
createTldWithEscrowEnabled("lol");
clock.setTo(DateTime.parse("2000-01-01T00:05:00Z"));
action.transactionCooldown = Duration.standardMinutes(5);
@ -232,7 +228,7 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
}
@Test
public void testManualRun_emptyMode_throwsException() {
void testManualRun_emptyMode_throwsException() {
createTldWithEscrowEnabled("lol");
clock.setTo(DateTime.parse("2000-01-01TZ"));
action.manual = true;
@ -244,7 +240,7 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
}
@Test
public void testManualRun_invalidMode_throwsException() {
void testManualRun_invalidMode_throwsException() {
createTldWithEscrowEnabled("lol");
clock.setTo(DateTime.parse("2000-01-01TZ"));
action.manual = true;
@ -256,7 +252,7 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
}
@Test
public void testManualRun_emptyTld_throwsException() {
void testManualRun_emptyTld_throwsException() {
createTldWithEscrowEnabled("lol");
clock.setTo(DateTime.parse("2000-01-01TZ"));
action.manual = true;
@ -268,7 +264,7 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
}
@Test
public void testManualRun_emptyWatermark_throwsException() {
void testManualRun_emptyWatermark_throwsException() {
createTldWithEscrowEnabled("lol");
clock.setTo(DateTime.parse("2000-01-01TZ"));
action.manual = true;
@ -280,7 +276,7 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
}
@Test
public void testManualRun_nonDayStartWatermark_throwsException() {
void testManualRun_nonDayStartWatermark_throwsException() {
createTldWithEscrowEnabled("lol");
clock.setTo(DateTime.parse("2000-01-01TZ"));
action.manual = true;
@ -292,7 +288,7 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
}
@Test
public void testManualRun_invalidRevision_throwsException() {
void testManualRun_invalidRevision_throwsException() {
createTldWithEscrowEnabled("lol");
clock.setTo(DateTime.parse("2000-01-01TZ"));
action.manual = true;
@ -305,7 +301,7 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
}
@Test
public void testManualRun_validParameters_runsMapReduce() {
void testManualRun_validParameters_runsMapReduce() {
createTldWithEscrowEnabled("lol");
clock.setTo(DateTime.parse("2000-01-01TZ"));
action.manual = true;
@ -320,7 +316,7 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
}
@Test
public void testMapReduce_bunchOfResources_headerHasCorrectCounts() throws Exception {
void testMapReduce_bunchOfResources_headerHasCorrectCounts() throws Exception {
clock.setTo(DateTime.parse("1999-12-31TZ"));
createTldWithEscrowEnabled("lol");
makeDomainBase(clock, "lol");
@ -350,7 +346,7 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
}
@Test
public void testMapReduce_validHostResources_getPutInDeposit() throws Exception {
void testMapReduce_validHostResources_getPutInDeposit() throws Exception {
clock.setTo(DateTime.parse("1999-12-31TZ"));
createTldWithEscrowEnabled("lol");
makeHostResource(clock, "ns1.cat.lol", "feed::a:bee");
@ -393,7 +389,7 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
}
@Test
public void testMapReduce_defaultTestFixtureRegistrars_getPutInDeposit() throws Exception {
void testMapReduce_defaultTestFixtureRegistrars_getPutInDeposit() throws Exception {
clock.setTo(DateTime.parse("1999-12-31TZ"));
createTldWithEscrowEnabled("lol");
makeHostResource(clock, "ns1.cat.lol", "feed::a:bee");
@ -415,7 +411,7 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
}
@Test
public void testMapReduce_sameDayRdeDeposit_advancesCursorToTomorrow() throws Exception {
void testMapReduce_sameDayRdeDeposit_advancesCursorToTomorrow() throws Exception {
clock.setTo(DateTime.parse("1999-12-31TZ"));
createTldWithEscrowEnabled("lol");
makeDomainBase(clock, "lol");
@ -436,7 +432,7 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
}
@Test
public void testMapReduce_onBrdaDay_advancesBothCursors() throws Exception {
void testMapReduce_onBrdaDay_advancesBothCursors() throws Exception {
clock.setTo(DateTime.parse("1999-12-31TZ"));
createTldWithEscrowEnabled("lol");
makeDomainBase(clock, "lol");
@ -457,7 +453,7 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
}
@Test
public void testMapReduce_onBrdaDay_enqueuesBothTasks() throws Exception {
void testMapReduce_onBrdaDay_enqueuesBothTasks() throws Exception {
clock.setTo(DateTime.parse("1999-12-31TZ"));
createTldWithEscrowEnabled("lol");
makeDomainBase(clock, "lol");
@ -478,7 +474,7 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
}
@Test
public void testMapReduce_noEppResourcesAndWayInPast_depositsRegistrarsOnly() throws Exception {
void testMapReduce_noEppResourcesAndWayInPast_depositsRegistrarsOnly() throws Exception {
clock.setTo(DateTime.parse("1999-12-31TZ"));
createTldWithEscrowEnabled("fop");
setCursor(Registry.get("fop"), RDE_STAGING, DateTime.parse("1971-01-01TZ"));
@ -513,7 +509,7 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
}
@Test
public void testMapReduce_idnTables_goInDeposit() throws Exception {
void testMapReduce_idnTables_goInDeposit() throws Exception {
clock.setTo(DateTime.parse("1999-12-31TZ"));
createTldWithEscrowEnabled("fop");
makeDomainBase(clock, "fop");
@ -539,7 +535,7 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
}
@Test
public void testMapReduce_withDomain_producesExpectedXml() throws Exception {
void testMapReduce_withDomain_producesExpectedXml() throws Exception {
clock.setTo(DateTime.parse("1999-12-31TZ"));
createTldWithEscrowEnabled("lol");
makeDomainBase(clock, "lol");
@ -556,7 +552,7 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
}
@Test
public void testMapReduce_withDomain_producesCorrectLengthFile() throws Exception {
void testMapReduce_withDomain_producesCorrectLengthFile() throws Exception {
clock.setTo(DateTime.parse("1999-12-31TZ"));
createTldWithEscrowEnabled("lol");
makeDomainBase(clock, "lol");
@ -571,7 +567,7 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
}
@Test
public void testMapReduce_withDomain_producesReportXml() throws Exception {
void testMapReduce_withDomain_producesReportXml() throws Exception {
clock.setTo(DateTime.parse("1999-12-31TZ"));
createTldWithEscrowEnabled("lol");
makeDomainBase(clock, "lol");
@ -588,7 +584,7 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
}
@Test
public void testMapReduce_twoDomainsDifferentTlds_isolatesDomains() throws Exception {
void testMapReduce_twoDomainsDifferentTlds_isolatesDomains() throws Exception {
clock.setTo(DateTime.parse("1999-12-31TZ"));
createTldWithEscrowEnabled("boggle");
makeDomainBase(clock, "boggle");
@ -609,7 +605,7 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
}
@Test
public void testMapReduce_twoHostsDifferentTlds_includedInBothTldDeposits() throws Exception {
void testMapReduce_twoHostsDifferentTlds_includedInBothTldDeposits() throws Exception {
clock.setTo(DateTime.parse("1999-12-31TZ"));
createTldWithEscrowEnabled("fop");
makeHostResource(clock, "ns1.dein.fop", "a:fed::cafe");
@ -630,7 +626,7 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
}
@Test
public void testMapReduce_rewindCursor_resendsDepositAtHigherRevision() throws Exception {
void testMapReduce_rewindCursor_resendsDepositAtHigherRevision() throws Exception {
clock.setTo(DateTime.parse("1999-12-31TZ"));
createTldWithEscrowEnabled("fop");
makeHostResource(clock, "ns1.dein.fop", "a:fed::cafe");
@ -654,7 +650,7 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
}
@Test
public void testMapReduce_brdaDeposit_doesntIncludeHostsOrContacts() throws Exception {
void testMapReduce_brdaDeposit_doesntIncludeHostsOrContacts() throws Exception {
clock.setTo(DateTime.parse("1999-12-31TZ"));
createTldWithEscrowEnabled("xn--q9jyb4c");
makeHostResource(clock, "ns1.bofh.みんな", "dead:fed::cafe");
@ -676,7 +672,7 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
}
@Test
public void testMapReduce_catchUpCursor_doesPointInTime() throws Exception {
void testMapReduce_catchUpCursor_doesPointInTime() throws Exception {
// Do nothing on the first day.
clock.setTo(DateTime.parse("1984-12-17T12:00Z"));
createTldWithEscrowEnabled("lol");
@ -794,8 +790,7 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
}
@Test
public void testMapReduce_manualMode_generatesCorrectDepositsWithoutAdvancingCursors()
throws Exception {
void testMapReduce_manualMode_generatesCorrectDepositsWithoutAdvancingCursors() throws Exception {
doManualModeMapReduceTest(0, ImmutableSet.of("lol"));
XmlTestUtils.assertXmlEquals(
loadFile(getClass(), "testMapReduce_withDomain_producesExpectedXml.xml"),
@ -810,8 +805,7 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
}
@Test
public void testMapReduce_manualMode_nonZeroRevisionAndMultipleTlds()
throws Exception {
void testMapReduce_manualMode_nonZeroRevisionAndMultipleTlds() throws Exception {
doManualModeMapReduceTest(42, ImmutableSet.of("lol", "slug"));
}

View file

@ -41,7 +41,7 @@ import org.mockito.junit.jupiter.MockitoExtension;
/** Unit tests for {@link RdeStagingMapper}. */
@ExtendWith(MockitoExtension.class)
public class RdeStagingMapperTest {
class RdeStagingMapperTest {
private static final Pattern REGISTRAR_NAME_PATTERN =
Pattern.compile("<rdeRegistrar:name>(.*)</rdeRegistrar:name>");
@ -50,7 +50,7 @@ public class RdeStagingMapperTest {
@Mock MapperContext<PendingDeposit, DepositFragment> context;
ArgumentCaptor<DepositFragment> depositFragmentCaptor =
private ArgumentCaptor<DepositFragment> depositFragmentCaptor =
ArgumentCaptor.forClass(DepositFragment.class);
@RegisterExtension

View file

@ -14,13 +14,15 @@
package google.registry.rde;
import org.junit.platform.runner.JUnitPlatform;
import org.junit.platform.suite.api.SelectClasses;
import org.junit.platform.suite.api.SuiteDisplayName;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
/** Convenience class to run all RDE tests inside IDE with one keystroke. */
@RunWith(Suite.class)
@SuiteClasses({
@RunWith(JUnitPlatform.class)
@SuiteDisplayName("RDE tests suite")
@SelectClasses({
DomainBaseToXjcConverterTest.class,
GhostrydeGpgIntegrationTest.class,
GhostrydeTest.class,

View file

@ -83,16 +83,13 @@ import java.net.Socket;
import java.net.URI;
import org.bouncycastle.openpgp.PGPPublicKey;
import org.joda.time.DateTime;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.junit.jupiter.api.io.TempDir;
import org.mockito.stubbing.OngoingStubbing;
/** Unit tests for {@link RdeUploadAction}. */
@RunWith(JUnit4.class)
public class RdeUploadActionTest {
private static final int BUFFER_SIZE = 64 * 1024;
@ -113,21 +110,21 @@ public class RdeUploadActionTest {
private static final GcsFilename REPORT_R1_FILE =
new GcsFilename("bucket", "tld_2010-10-17_full_S1_R1-report.xml.ghostryde");
@Rule
public final SftpServerRule sftpd = new SftpServerRule();
@RegisterExtension final SftpServerRule sftpd = new SftpServerRule();
@Rule
public final TemporaryFolder folder = new TemporaryFolder();
@SuppressWarnings("WeakerAccess")
@TempDir
File folder;
@Rule
public final BouncyCastleProviderRule bouncy = new BouncyCastleProviderRule();
@RegisterExtension public final BouncyCastleProviderRule bouncy = new BouncyCastleProviderRule();
@Rule
public final GpgSystemCommandRule gpg = new GpgSystemCommandRule(
@RegisterExtension
public final GpgSystemCommandRule gpg =
new GpgSystemCommandRule(
RdeTestData.loadBytes("pgp-public-keyring.asc"),
RdeTestData.loadBytes("pgp-private-keyring-escrow.asc"));
@Rule
@RegisterExtension
public final AppEngineRule appEngine =
AppEngineRule.builder().withDatastoreAndCloudSql().withTaskQueue().build();
@ -178,8 +175,8 @@ public class RdeUploadActionTest {
private GcsService gcsService;
@Before
public void before() throws Exception {
@BeforeEach
void beforeEach() throws Exception {
// Force "development" mode so we don't try to really connect to GCS.
SystemProperty.environment.set(SystemProperty.Environment.Value.Development);
gcsService = GcsServiceFactory.createGcsService();
@ -201,15 +198,15 @@ public class RdeUploadActionTest {
}
@Test
public void testSocketConnection() throws Exception {
int port = sftpd.serve("user", "password", folder.getRoot());
void testSocketConnection() throws Exception {
int port = sftpd.serve("user", "password", folder);
try (Socket socket = new Socket("localhost", port)) {
assertThat(socket.isConnected()).isTrue();
}
}
@Test
public void testRun() {
void testRun() {
createTld("lol");
RdeUploadAction action = createAction(null);
action.tld = "lol";
@ -223,8 +220,8 @@ public class RdeUploadActionTest {
}
@Test
public void testRunWithLock_succeedsOnThirdTry() throws Exception {
int port = sftpd.serve("user", "password", folder.getRoot());
void testRunWithLock_succeedsOnThirdTry() throws Exception {
int port = sftpd.serve("user", "password", folder);
URI uploadUrl = URI.create(String.format("sftp://user:password@localhost:%d/", port));
DateTime stagingCursor = DateTime.parse("2010-10-18TZ");
DateTime uploadCursor = DateTime.parse("2010-10-17TZ");
@ -236,15 +233,14 @@ public class RdeUploadActionTest {
assertThat(response.getContentType()).isEqualTo(PLAIN_TEXT_UTF_8);
assertThat(response.getPayload()).isEqualTo("OK tld 2010-10-17T00:00:00.000Z\n");
assertNoTasksEnqueued("rde-upload");
assertThat(folder.getRoot().list()).asList()
.containsExactly(
"tld_2010-10-17_full_S1_R0.ryde",
"tld_2010-10-17_full_S1_R0.sig");
assertThat(folder.list())
.asList()
.containsExactly("tld_2010-10-17_full_S1_R0.ryde", "tld_2010-10-17_full_S1_R0.sig");
}
@Test
public void testRunWithLock_failsAfterThreeAttempts() throws Exception {
int port = sftpd.serve("user", "password", folder.getRoot());
void testRunWithLock_failsAfterThreeAttempts() throws Exception {
int port = sftpd.serve("user", "password", folder);
URI uploadUrl = URI.create(String.format("sftp://user:password@localhost:%d/", port));
DateTime stagingCursor = DateTime.parse("2010-10-18TZ");
DateTime uploadCursor = DateTime.parse("2010-10-17TZ");
@ -257,8 +253,8 @@ public class RdeUploadActionTest {
}
@Test
public void testRunWithLock_copiesOnGcs() throws Exception {
int port = sftpd.serve("user", "password", folder.getRoot());
void testRunWithLock_copiesOnGcs() throws Exception {
int port = sftpd.serve("user", "password", folder);
URI uploadUrl = URI.create(String.format("sftp://user:password@localhost:%d/", port));
DateTime stagingCursor = DateTime.parse("2010-10-18TZ");
DateTime uploadCursor = DateTime.parse("2010-10-17TZ");
@ -271,17 +267,17 @@ public class RdeUploadActionTest {
// Assert that both files are written to SFTP and GCS, and that the contents are identical.
String rydeFilename = "tld_2010-10-17_full_S1_R0.ryde";
String sigFilename = "tld_2010-10-17_full_S1_R0.sig";
assertThat(folder.getRoot().list()).asList().containsExactly(rydeFilename, sigFilename);
assertThat(folder.list()).asList().containsExactly(rydeFilename, sigFilename);
assertThat(readGcsFile(gcsService, new GcsFilename("bucket", rydeFilename)))
.isEqualTo(Files.toByteArray(new File(folder.getRoot(), rydeFilename)));
.isEqualTo(Files.toByteArray(new File(folder, rydeFilename)));
assertThat(readGcsFile(gcsService, new GcsFilename("bucket", sigFilename)))
.isEqualTo(Files.toByteArray(new File(folder.getRoot(), sigFilename)));
.isEqualTo(Files.toByteArray(new File(folder, sigFilename)));
}
@Test
public void testRunWithLock_resend() throws Exception {
void testRunWithLock_resend() throws Exception {
tm().transact(() -> RdeRevision.saveRevision("tld", DateTime.parse("2010-10-17TZ"), FULL, 1));
int port = sftpd.serve("user", "password", folder.getRoot());
int port = sftpd.serve("user", "password", folder);
URI uploadUrl = URI.create(String.format("sftp://user:password@localhost:%d/", port));
DateTime stagingCursor = DateTime.parse("2010-10-18TZ");
DateTime uploadCursor = DateTime.parse("2010-10-17TZ");
@ -291,16 +287,15 @@ public class RdeUploadActionTest {
assertThat(response.getContentType()).isEqualTo(PLAIN_TEXT_UTF_8);
assertThat(response.getPayload()).isEqualTo("OK tld 2010-10-17T00:00:00.000Z\n");
assertNoTasksEnqueued("rde-upload");
assertThat(folder.getRoot().list()).asList()
.containsExactly(
"tld_2010-10-17_full_S1_R1.ryde",
"tld_2010-10-17_full_S1_R1.sig");
assertThat(folder.list())
.asList()
.containsExactly("tld_2010-10-17_full_S1_R1.ryde", "tld_2010-10-17_full_S1_R1.sig");
}
@Test
public void testRunWithLock_producesValidSignature() throws Exception {
void testRunWithLock_producesValidSignature() throws Exception {
assumeTrue(hasCommand("gpg --version"));
int port = sftpd.serve("user", "password", folder.getRoot());
int port = sftpd.serve("user", "password", folder);
URI uploadUrl = URI.create(String.format("sftp://user:password@localhost:%d/", port));
DateTime stagingCursor = DateTime.parse("2010-10-18TZ");
DateTime uploadCursor = DateTime.parse("2010-10-17TZ");
@ -308,9 +303,12 @@ public class RdeUploadActionTest {
createAction(uploadUrl).runWithLock(uploadCursor);
// Only verify signature for SFTP versions, since we check elsewhere that the GCS files are
// identical to the ones sent over SFTP.
Process pid = gpg.exec("gpg", "--verify",
new File(folder.getRoot(), "tld_2010-10-17_full_S1_R0.sig").toString(),
new File(folder.getRoot(), "tld_2010-10-17_full_S1_R0.ryde").toString());
Process pid =
gpg.exec(
"gpg",
"--verify",
new File(folder, "tld_2010-10-17_full_S1_R0.sig").toString(),
new File(folder, "tld_2010-10-17_full_S1_R0.ryde").toString());
String stderr = slurp(pid.getErrorStream());
assertWithMessage(stderr).that(pid.waitFor()).isEqualTo(0);
assertThat(stderr).contains("Good signature");
@ -318,7 +316,7 @@ public class RdeUploadActionTest {
}
@Test
public void testRunWithLock_stagingNotFinished_throws204() {
void testRunWithLock_stagingNotFinished_throws204() {
URI url = URI.create("sftp://user:password@localhost:32323/");
DateTime stagingCursor = DateTime.parse("2010-10-17TZ");
DateTime uploadCursor = DateTime.parse("2010-10-17TZ");
@ -333,7 +331,7 @@ public class RdeUploadActionTest {
}
@Test
public void testRunWithLock_sftpCooldownNotPassed_throws204() {
void testRunWithLock_sftpCooldownNotPassed_throws204() {
RdeUploadAction action = createAction(URI.create("sftp://user:password@localhost:32323/"));
action.sftpCooldown = standardHours(2);
DateTime stagingCursor = DateTime.parse("2010-10-18TZ");

View file

@ -35,11 +35,9 @@ import google.registry.xjc.rderegistrar.XjcRdeRegistrarPostalInfoType;
import google.registry.xjc.rderegistrar.XjcRdeRegistrarStatusType;
import java.io.ByteArrayOutputStream;
import org.joda.time.DateTime;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
/**
* Unit tests for {@link RegistrarToXjcConverter}.
@ -47,19 +45,17 @@ import org.junit.runners.JUnit4;
* <p>This tests the mapping between {@link Registrar} and {@link XjcRdeRegistrar} as well as some
* exceptional conditions.
*/
@RunWith(JUnit4.class)
public class RegistrarToXjcConverterTest {
@Rule
@RegisterExtension
public final AppEngineRule appEngine = AppEngineRule.builder().withDatastoreAndCloudSql().build();
@Rule
public final InjectRule inject = new InjectRule();
@RegisterExtension public final InjectRule inject = new InjectRule();
Registrar registrar;
private Registrar registrar;
@Before
public void init() {
@BeforeEach
void beforeEach() {
registrar = new Registrar.Builder()
.setClientId("GoblinMarket")
.setRegistrarName("Maids heard the goblins cry: Come buy, come buy:")
@ -94,7 +90,7 @@ public class RegistrarToXjcConverterTest {
}
@Test
public void test_convertRegistrar() {
void test_convertRegistrar() {
XjcRdeRegistrar bean = convertRegistrar(registrar);
assertThat(bean.getId()).isEqualTo("GoblinMarket");
@ -140,13 +136,13 @@ public class RegistrarToXjcConverterTest {
}
@Test
public void test_convertRegistrar_disabledStateMeansTerminated() {
void test_convertRegistrar_disabledStateMeansTerminated() {
XjcRdeRegistrar bean = convertRegistrar(registrar.asBuilder().setState(State.DISABLED).build());
assertThat(bean.getStatus()).isEqualTo(XjcRdeRegistrarStatusType.TERMINATED);
}
@Test
public void test_convertRegistrar_handlesAllRegistrarStates() {
void test_convertRegistrar_handlesAllRegistrarStates() {
for (State state : Registrar.State.values()) {
// This will throw an exception if it can't handle the chosen state.
convertRegistrar(registrar.asBuilder().setState(state).build());
@ -154,7 +150,7 @@ public class RegistrarToXjcConverterTest {
}
@Test
public void testMarshal() throws Exception {
void testMarshal() throws Exception {
marshalStrict(RegistrarToXjcConverter.convert(registrar), new ByteArrayOutputStream(), UTF_8);
}
}

View file

@ -22,15 +22,13 @@ import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.junit.jupiter.api.Test;
@RunWith(JUnit4.class)
public final class RydeCompressionTest {
/** Unit tests for {@link RydeCompression} */
final class RydeCompressionTest {
@Test
public void testCompression_decompression() throws Exception {
void testCompression_decompression() throws Exception {
byte[] expected = "Testing 1, 2, 3".getBytes(UTF_8);
ByteArrayOutputStream output = new ByteArrayOutputStream();

View file

@ -30,18 +30,16 @@ import java.io.OutputStream;
import java.util.Base64;
import org.bouncycastle.openpgp.PGPException;
import org.bouncycastle.openpgp.PGPKeyPair;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
@RunWith(JUnit4.class)
/** Unit tests for {@link RydeEncryption} */
public final class RydeEncryptionTest {
@Rule public final BouncyCastleProviderRule bouncy = new BouncyCastleProviderRule();
@RegisterExtension public final BouncyCastleProviderRule bouncy = new BouncyCastleProviderRule();
@Test
public void testSuccess_oneReceiver_decryptWithCorrectKey() throws Exception {
void testSuccess_oneReceiver_decryptWithCorrectKey() throws Exception {
FakeKeyringModule keyringModule = new FakeKeyringModule();
PGPKeyPair key = keyringModule.get("rde-unittest@registry.test", ENCRYPT);
byte[] expected = "Testing 1, 2, 3".getBytes(UTF_8);
@ -60,7 +58,7 @@ public final class RydeEncryptionTest {
}
@Test
public void testFail_oneReceiver_decryptWithWrongKey() throws Exception {
void testFail_oneReceiver_decryptWithWrongKey() throws Exception {
FakeKeyringModule keyringModule = new FakeKeyringModule();
PGPKeyPair key = keyringModule.get("rde-unittest@registry.test", ENCRYPT);
PGPKeyPair wrongKey = keyringModule.get("rde-unittest-dsa@registry.test", ENCRYPT);
@ -86,7 +84,7 @@ public final class RydeEncryptionTest {
}
@Test
public void testSuccess_twoReceivers() throws Exception {
void testSuccess_twoReceivers() throws Exception {
FakeKeyringModule keyringModule = new FakeKeyringModule();
PGPKeyPair key1 = keyringModule.get("rde-unittest@registry.test", ENCRYPT);
PGPKeyPair key2 = keyringModule.get("rde-unittest-dsa@registry.test", ENCRYPT);
@ -113,7 +111,7 @@ public final class RydeEncryptionTest {
}
@Test
public void testSuccess_decryptHasntChanged() throws Exception {
void testSuccess_decryptHasntChanged() throws Exception {
FakeKeyringModule keyringModule = new FakeKeyringModule();
PGPKeyPair key = keyringModule.get("rde-unittest@registry.test", ENCRYPT);
byte[] expected = "Testing 1, 2, 3".getBytes(UTF_8);
@ -134,7 +132,7 @@ public final class RydeEncryptionTest {
}
@Test
public void testSuccess_oneReceiver_withIntegrityPacket() throws Exception {
void testSuccess_oneReceiver_withIntegrityPacket() throws Exception {
FakeKeyringModule keyringModule = new FakeKeyringModule();
PGPKeyPair key = keyringModule.get("rde-unittest@registry.test", ENCRYPT);
byte[] expected = "Testing 1, 2, 3".getBytes(UTF_8);

View file

@ -22,15 +22,13 @@ import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.OutputStream;
import org.joda.time.DateTime;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.junit.jupiter.api.Test;
@RunWith(JUnit4.class)
public final class RydeFileEncodingTest {
/** Unit tests for {@link RydeFileEncoding}. */
final class RydeFileEncodingTest {
@Test
public void testEncodeDecode() throws Exception {
void testEncodeDecode() throws Exception {
byte[] expectedContent = "Testing 1, 2, 3".getBytes(UTF_8);
String expectedFilename = "myFile.txt";
DateTime expectedModified = DateTime.parse("2015-12-25T06:30:00.000Z");

View file

@ -14,13 +14,14 @@
package google.registry.rde;
import static com.google.common.base.Strings.repeat;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth.assertWithMessage;
import static google.registry.testing.SystemInfo.hasCommand;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assume.assumeTrue;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableList;
import com.google.common.flogger.FluentLogger;
import com.google.common.io.CharStreams;
import google.registry.keyring.api.Keyring;
@ -34,74 +35,73 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.util.stream.Stream;
import org.bouncycastle.openpgp.PGPKeyPair;
import org.bouncycastle.openpgp.PGPPublicKey;
import org.joda.time.DateTime;
import org.junit.Rule;
import org.junit.experimental.theories.DataPoints;
import org.junit.experimental.theories.Theories;
import org.junit.experimental.theories.Theory;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
/** GPG combinatorial integration tests for the Ryde classes. */
@RunWith(Theories.class)
@SuppressWarnings("resource")
public class RydeGpgIntegrationTest {
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
@Rule
public final BouncyCastleProviderRule bouncy = new BouncyCastleProviderRule();
@RegisterExtension public final BouncyCastleProviderRule bouncy = new BouncyCastleProviderRule();
@Rule
public final GpgSystemCommandRule gpg = new GpgSystemCommandRule(
@RegisterExtension
public final GpgSystemCommandRule gpg =
new GpgSystemCommandRule(
RdeTestData.loadBytes("pgp-public-keyring.asc"),
RdeTestData.loadBytes("pgp-private-keyring-escrow.asc"));
private final FakeKeyringModule keyringFactory = new FakeKeyringModule();
@DataPoints
public static GpgCommand[] commands = new GpgCommand[] {
new GpgCommand("gpg"),
new GpgCommand("gpg2"),
};
private static final ImmutableList<String> COMMANDS = ImmutableList.of("gpg", "gpg2");
private static final ImmutableList<String> CONTENTS =
ImmutableList.of(
"(◕‿◕)",
Strings.repeat("Fanatics have their dreams, wherewith they weave\n", 1000),
"\0yolo",
"");
@DataPoints
public static Filename[] filenames = new Filename[] {
new Filename("sloth"),
};
static Stream<Arguments> provideTestCombinations() {
Stream.Builder<Arguments> stream = Stream.builder();
for (String command : COMMANDS) {
for (String content : CONTENTS) {
stream.add(Arguments.of(command, content));
}
}
return stream.build();
}
@DataPoints
public static Content[] contents = new Content[] {
new Content("(◕‿◕)"),
new Content(repeat("Fanatics have their dreams, wherewith they weave.\n", 1000)),
new Content("\0yolo"),
new Content(""),
};
@Theory
public void test(GpgCommand cmd, Filename name, Content content)
throws Exception {
@ParameterizedTest
@MethodSource("provideTestCombinations")
void test(String command, String content) throws Exception {
final String filename = "sloth";
assumeTrue(hasCommand("tar"));
assumeTrue(hasCommand(cmd.get() + " --version"));
assumeTrue(hasCommand(command + " --version"));
Keyring keyring = keyringFactory.get();
PGPKeyPair signingKey = keyring.getRdeSigningKey();
PGPPublicKey receiverKey = keyring.getRdeReceiverKey();
DateTime modified = DateTime.parse("1984-01-01T00:00:00Z");
File home = gpg.getCwd();
File rydeFile = new File(home, name.get() + ".ryde");
File sigFile = new File(home, name.get() + ".sig");
File tarFile = new File(home, name.get() + ".tar");
File xmlFile = new File(home, name.get() + ".xml");
byte[] data = content.get().getBytes(UTF_8);
File rydeFile = new File(home, filename + ".ryde");
File sigFile = new File(home, filename + ".sig");
File tarFile = new File(home, filename + ".tar");
File xmlFile = new File(home, filename + ".xml");
byte[] data = content.getBytes(UTF_8);
try (OutputStream rydeOut = new FileOutputStream(rydeFile);
OutputStream sigOut = new FileOutputStream(sigFile);
RydeEncoder rydeEncoder = new RydeEncoder.Builder()
RydeEncoder rydeEncoder =
new RydeEncoder.Builder()
.setRydeOutput(rydeOut, receiverKey)
.setSignatureOutput(sigOut, signingKey)
.setFileMetadata(name.get(), data.length, modified)
.setFileMetadata(filename, data.length, modified)
.build()) {
rydeEncoder.write(data);
}
@ -123,7 +123,7 @@ public class RydeGpgIntegrationTest {
{
Process pid =
gpg.exec(
cmd.get(),
command,
"--list-packets",
"--ignore-mdc-error",
"--keyid-format",
@ -149,7 +149,7 @@ public class RydeGpgIntegrationTest {
.contains(":literal data packet:");
assertWithMessage("Literal data packet does not contain correct filename")
.that(stdout)
.contains("name=\"" + name.get() + ".tar\"");
.contains("name=\"" + filename + ".tar\"");
assertWithMessage("Literal data packet should be in BINARY mode")
.that(stdout)
.contains("mode b ");
@ -168,7 +168,7 @@ public class RydeGpgIntegrationTest {
// gpg: Good signature from <rde-unittest@registry.test>
logger.atInfo().log("Running GPG to verify signature...");
{
Process pid = gpg.exec(cmd.get(), "--verify", sigFile.toString(), rydeFile.toString());
Process pid = gpg.exec(command, "--verify", sigFile.toString(), rydeFile.toString());
String stderr = slurp(pid.getErrorStream());
assertWithMessage(stderr).that(pid.waitFor()).isEqualTo(0);
assertThat(stderr).contains("Good signature");
@ -187,7 +187,7 @@ public class RydeGpgIntegrationTest {
logger.atInfo().log("Running GPG to extract tar...");
{
Process pid =
gpg.exec(cmd.get(), "--use-embedded-filename", "--ignore-mdc-error", rydeFile.toString());
gpg.exec(command, "--use-embedded-filename", "--ignore-mdc-error", rydeFile.toString());
String stderr = slurp(pid.getErrorStream());
assertWithMessage(stderr).that(pid.waitFor()).isEqualTo(0);
}
@ -203,7 +203,7 @@ public class RydeGpgIntegrationTest {
assertWithMessage(stderr).that(pid.waitFor()).isEqualTo(0);
}
assertWithMessage("tar did not produce expected xml file").that(xmlFile.exists()).isTrue();
assertThat(slurp(xmlFile)).isEqualTo(content.get());
assertThat(slurp(xmlFile)).isEqualTo(content);
}
private String slurp(File file) throws IOException {
@ -213,40 +213,4 @@ public class RydeGpgIntegrationTest {
private String slurp(InputStream is) throws IOException {
return CharStreams.toString(new InputStreamReader(is, UTF_8));
}
private static class GpgCommand {
private final String value;
GpgCommand(String value) {
this.value = value;
}
String get() {
return value;
}
}
private static class Filename {
private final String value;
Filename(String value) {
this.value = value;
}
String get() {
return value;
}
}
private static class Content {
private final String value;
Content(String value) {
this.value = value;
}
String get() {
return value;
}
}
}

View file

@ -22,15 +22,13 @@ import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.OutputStream;
import org.joda.time.DateTime;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.junit.jupiter.api.Test;
@RunWith(JUnit4.class)
public final class RydeTarTest {
/** Unit tests for {@link RydeTar}. */
final class RydeTarTest {
@Test
public void testWriteRead() throws Exception {
void testWriteRead() throws Exception {
byte[] expectedContent = "Testing 1, 2, 3".getBytes(UTF_8);
String expectedFilename = "myFile.xml";
DateTime expectedModified = DateTime.parse("2015-12-25T06:30:00.000Z");

View file

@ -16,6 +16,9 @@ package google.registry.testing;
import java.security.Security;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.junit.jupiter.api.extension.AfterEachCallback;
import org.junit.jupiter.api.extension.BeforeEachCallback;
import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.rules.ExternalResource;
/**
@ -28,7 +31,18 @@ import org.junit.rules.ExternalResource;
* @see org.junit.rules.ExternalResource
* @see java.security.Security#addProvider(java.security.Provider)
*/
public class BouncyCastleProviderRule extends ExternalResource {
public class BouncyCastleProviderRule extends ExternalResource
implements BeforeEachCallback, AfterEachCallback {
@Override
public void beforeEach(ExtensionContext context) {
before();
}
@Override
public void afterEach(ExtensionContext context) {
after();
}
@Override
protected void before() {

View file

@ -30,7 +30,9 @@ import java.io.InputStreamReader;
import java.nio.file.Files;
import java.nio.file.attribute.PosixFilePermissions;
import java.util.Objects;
import org.junit.rules.ExternalResource;
import org.junit.jupiter.api.extension.AfterEachCallback;
import org.junit.jupiter.api.extension.BeforeEachCallback;
import org.junit.jupiter.api.extension.ExtensionContext;
/**
* GnuPG system command JUnit rule.
@ -38,10 +40,8 @@ import org.junit.rules.ExternalResource;
* <p>This rule creates a isolated environment for running the {@code gpg} command inside system
* integration tests. It reduces a lot of the boilerplate of setting up the shell environment and
* importing your keyrings into a temporary config folder.
*
* @see ExternalResource
*/
public final class GpgSystemCommandRule extends ExternalResource {
public final class GpgSystemCommandRule implements BeforeEachCallback, AfterEachCallback {
private static final File DEV_NULL = new File("/dev/null");
private static final String TEMP_FILE_PREFIX = "gpgtest";
@ -83,7 +83,7 @@ public final class GpgSystemCommandRule extends ExternalResource {
}
@Override
protected void before() throws IOException, InterruptedException {
public void beforeEach(ExtensionContext context) throws IOException, InterruptedException {
checkState(Objects.equals(cwd, DEV_NULL));
String tmpRootDirString = System.getenv("TMPDIR");
// Create the working directory for the forked process on Temp file system. Create under the
@ -123,7 +123,7 @@ public final class GpgSystemCommandRule extends ExternalResource {
}
@Override
protected void after() {
public void afterEach(ExtensionContext context) {
// TODO(weiminyu): we should delete the cwd tree.
cwd = DEV_NULL;
conf = DEV_NULL;

View file

@ -52,9 +52,16 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.junit.Before;
import org.junit.Rule;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnit;
import org.mockito.junit.MockitoRule;
import org.mockito.junit.jupiter.MockitoExtension;
import org.mockito.junit.jupiter.MockitoSettings;
import org.mockito.quality.Strictness;
/**
* Base test class for mapreduces.
@ -67,6 +74,8 @@ import org.mockito.junit.MockitoRule;
*
* @param <T> The type of the Action class that implements the mapreduce.
*/
@ExtendWith(MockitoExtension.class)
@MockitoSettings(strictness = Strictness.LENIENT)
public abstract class MapreduceTestCase<T> {
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
@ -77,24 +86,25 @@ public abstract class MapreduceTestCase<T> {
private final PipelineServlet pipelineServlet = new PipelineServlet();
private LocalTaskQueue taskQueue;
@Rule
@RegisterExtension @Rule
public final AppEngineRule appEngine =
AppEngineRule.builder().withDatastoreAndCloudSql().withLocalModules().withTaskQueue().build();
@Rule public final MockitoRule mocks = MockitoJUnit.rule();
AppEngineServiceUtils appEngineServiceUtils;
private AppEngineServiceUtils appEngineServiceUtils;
@Mock ModulesService modulesService;
@Before
@BeforeEach
public void setUp() {
taskQueue = LocalTaskQueueTestConfig.getLocalTaskQueue();
ApiProxyLocal proxy = (ApiProxyLocal) ApiProxy.getDelegate();
// Creating files is not allowed in some test execution environments, so don't.
proxy.setProperty(LocalBlobstoreService.NO_STORAGE_PROPERTY, "true");
appEngineServiceUtils = new AppEngineServiceUtilsImpl(modulesService);
when(modulesService.getVersionHostname("backend", null))
Mockito.when(modulesService.getVersionHostname("backend", null))
.thenReturn("version.backend.projectid.appspot.com");
}
@ -107,7 +117,7 @@ public abstract class MapreduceTestCase<T> {
return taskQueue.getQueueStateInfo().get(queueName).getTaskInfo();
}
protected void executeTask(String queueName, QueueStateInfo.TaskStateInfo taskStateInfo)
private void executeTask(String queueName, QueueStateInfo.TaskStateInfo taskStateInfo)
throws Exception {
logger.atFine().log(
"Executing task %s with URL %s", taskStateInfo.getTaskName(), taskStateInfo.getUrl());
@ -141,9 +151,9 @@ public abstract class MapreduceTestCase<T> {
when(request.getIntHeader(TaskHandler.TASK_RETRY_COUNT_HEADER)).thenReturn(-1);
for (HeaderWrapper header : taskStateInfo.getHeaders()) {
int value = parseAsQuotedInt(header.getValue());
when(request.getIntHeader(header.getKey())).thenReturn(value);
Mockito.when(request.getIntHeader(header.getKey())).thenReturn(value);
logger.atFine().log("header: %s=%s", header.getKey(), header.getValue());
when(request.getHeader(header.getKey())).thenReturn(header.getValue());
Mockito.when(request.getHeader(header.getKey())).thenReturn(header.getValue());
}
Map<String, String> parameters = decodeParameters(taskStateInfo.getBody());
@ -201,8 +211,8 @@ public abstract class MapreduceTestCase<T> {
* <p>The maxTasks parameter determines how many tasks (at most) will be run. If maxTasks is
* absent(), all tasks are run until the queue is empty. If maxTasks is zero, no tasks are run.
*/
protected void executeTasks(
String queueName, @Nullable FakeClock clock, Optional<Integer> maxTasks) throws Exception {
private void executeTasks(String queueName, @Nullable FakeClock clock, Optional<Integer> maxTasks)
throws Exception {
for (int numTasksDeleted = 0;
!maxTasks.isPresent() || (numTasksDeleted < maxTasks.get());
numTasksDeleted++) {

View file

@ -21,14 +21,15 @@ import java.io.File;
import javax.annotation.Nullable;
import org.apache.ftpserver.FtpServer;
import org.apache.ftpserver.ftplet.FtpException;
import org.junit.rules.ExternalResource;
import org.junit.jupiter.api.extension.AfterEachCallback;
import org.junit.jupiter.api.extension.ExtensionContext;
/**
* JUnit Rule for creating an in-process {@link TestSftpServer SFTP Server}.
*
* @see TestSftpServer
*/
public final class SftpServerRule extends ExternalResource {
public final class SftpServerRule implements AfterEachCallback {
@Nullable
private FtpServer server;
@ -46,7 +47,7 @@ public final class SftpServerRule extends ExternalResource {
}
@Override
protected void after() {
public void afterEach(ExtensionContext context) {
if (server != null) {
server.stop();
server = null;

View file

@ -23,12 +23,12 @@ org.checkerframework:checker-qual:2.11.1
org.flywaydb:flyway-core:5.2.4
org.hamcrest:hamcrest-core:1.3
org.jetbrains:annotations:19.0.0
org.junit.jupiter:junit-jupiter-api:5.6.1
org.junit.jupiter:junit-jupiter-engine:5.6.1
org.junit.platform:junit-platform-commons:1.6.1
org.junit.platform:junit-platform-engine:1.6.1
org.junit.vintage:junit-vintage-engine:5.6.1
org.junit:junit-bom:5.6.1
org.junit.jupiter:junit-jupiter-api:5.6.2
org.junit.jupiter:junit-jupiter-engine:5.6.2
org.junit.platform:junit-platform-commons:1.6.2
org.junit.platform:junit-platform-engine:1.6.2
org.junit.vintage:junit-vintage-engine:5.6.2
org.junit:junit-bom:5.6.2
org.opentest4j:opentest4j:1.2.0
org.rnorth.duct-tape:duct-tape:1.0.8
org.rnorth.visible-assertions:visible-assertions:2.1.2

View file

@ -23,12 +23,12 @@ org.checkerframework:checker-qual:2.11.1
org.flywaydb:flyway-core:5.2.4
org.hamcrest:hamcrest-core:1.3
org.jetbrains:annotations:19.0.0
org.junit.jupiter:junit-jupiter-api:5.6.1
org.junit.jupiter:junit-jupiter-engine:5.6.1
org.junit.platform:junit-platform-commons:1.6.1
org.junit.platform:junit-platform-engine:1.6.1
org.junit.vintage:junit-vintage-engine:5.6.1
org.junit:junit-bom:5.6.1
org.junit.jupiter:junit-jupiter-api:5.6.2
org.junit.jupiter:junit-jupiter-engine:5.6.2
org.junit.platform:junit-platform-commons:1.6.2
org.junit.platform:junit-platform-engine:1.6.2
org.junit.vintage:junit-vintage-engine:5.6.2
org.junit:junit-bom:5.6.2
org.opentest4j:opentest4j:1.2.0
org.rnorth.duct-tape:duct-tape:1.0.8
org.rnorth.visible-assertions:visible-assertions:2.1.2

View file

@ -26,12 +26,12 @@ org.eclipse.jgit:org.eclipse.jgit:4.4.1.201607150455-r
org.flywaydb:flyway-core:5.2.4
org.hamcrest:hamcrest-core:1.3
org.jetbrains:annotations:19.0.0
org.junit.jupiter:junit-jupiter-api:5.6.1
org.junit.jupiter:junit-jupiter-engine:5.6.1
org.junit.platform:junit-platform-commons:1.6.1
org.junit.platform:junit-platform-engine:1.6.1
org.junit.vintage:junit-vintage-engine:5.6.1
org.junit:junit-bom:5.6.1
org.junit.jupiter:junit-jupiter-api:5.6.2
org.junit.jupiter:junit-jupiter-engine:5.6.2
org.junit.platform:junit-platform-commons:1.6.2
org.junit.platform:junit-platform-engine:1.6.2
org.junit.vintage:junit-vintage-engine:5.6.2
org.junit:junit-bom:5.6.2
org.opentest4j:opentest4j:1.2.0
org.rnorth.duct-tape:duct-tape:1.0.8
org.rnorth.visible-assertions:visible-assertions:2.1.2

View file

@ -51,12 +51,12 @@ org.eclipse.jgit:org.eclipse.jgit:4.4.1.201607150455-r
org.flywaydb:flyway-core:5.2.4
org.hamcrest:hamcrest-core:1.3
org.jetbrains:annotations:19.0.0
org.junit.jupiter:junit-jupiter-api:5.6.1
org.junit.jupiter:junit-jupiter-engine:5.6.1
org.junit.platform:junit-platform-commons:1.6.1
org.junit.platform:junit-platform-engine:1.6.1
org.junit.vintage:junit-vintage-engine:5.6.1
org.junit:junit-bom:5.6.1
org.junit.jupiter:junit-jupiter-api:5.6.2
org.junit.jupiter:junit-jupiter-engine:5.6.2
org.junit.platform:junit-platform-commons:1.6.2
org.junit.platform:junit-platform-engine:1.6.2
org.junit.vintage:junit-vintage-engine:5.6.2
org.junit:junit-bom:5.6.2
org.opentest4j:opentest4j:1.2.0
org.ow2.asm:asm-analysis:8.0.1
org.ow2.asm:asm-commons:7.1

View file

@ -104,12 +104,13 @@ ext {
'jline:jline:1.0',
'joda-time:joda-time:2.9.2',
'junit:junit:4.13',
'org.junit.jupiter:junit-jupiter-api:5.6.1',
'org.junit.jupiter:junit-jupiter-engine:5.6.1',
'org.junit.jupiter:junit-jupiter-migrationsupport:5.6.1',
'org.junit.platform:junit-platform-runner:1.6.1',
'org.junit.platform:junit-platform-suite-api:1.6.1',
'org.junit.vintage:junit-vintage-engine:5.6.1',
'org.junit.jupiter:junit-jupiter-api:5.6.2',
'org.junit.jupiter:junit-jupiter-engine:5.6.2',
'org.junit.jupiter:junit-jupiter-migrationsupport:5.6.2',
'org.junit.jupiter:junit-jupiter-params:5.6.2',
'org.junit.platform:junit-platform-runner:1.6.2',
'org.junit.platform:junit-platform-suite-api:1.6.2',
'org.junit.vintage:junit-vintage-engine:5.6.2',
'org.apache.avro:avro:1.8.2',
'org.apache.beam:beam-runners-direct-java:2.16.0',
'org.apache.beam:beam-runners-google-cloud-dataflow-java:2.16.0',

View file

@ -51,11 +51,11 @@ org.bouncycastle:bcprov-jdk15on:1.61
org.checkerframework:checker-compat-qual:2.5.5
org.checkerframework:checker-qual:2.11.1
org.hamcrest:hamcrest-core:1.3
org.junit.jupiter:junit-jupiter-api:5.6.1
org.junit.jupiter:junit-jupiter-engine:5.6.1
org.junit.platform:junit-platform-commons:1.6.1
org.junit.platform:junit-platform-engine:1.6.1
org.junit.vintage:junit-vintage-engine:5.6.1
org.junit:junit-bom:5.6.1
org.junit.jupiter:junit-jupiter-api:5.6.2
org.junit.jupiter:junit-jupiter-engine:5.6.2
org.junit.platform:junit-platform-commons:1.6.2
org.junit.platform:junit-platform-engine:1.6.2
org.junit.vintage:junit-vintage-engine:5.6.2
org.junit:junit-bom:5.6.2
org.opentest4j:opentest4j:1.2.0
org.yaml:snakeyaml:1.17

View file

@ -51,11 +51,11 @@ org.bouncycastle:bcprov-jdk15on:1.61
org.checkerframework:checker-compat-qual:2.5.5
org.checkerframework:checker-qual:2.11.1
org.hamcrest:hamcrest-core:1.3
org.junit.jupiter:junit-jupiter-api:5.6.1
org.junit.jupiter:junit-jupiter-engine:5.6.1
org.junit.platform:junit-platform-commons:1.6.1
org.junit.platform:junit-platform-engine:1.6.1
org.junit.vintage:junit-vintage-engine:5.6.1
org.junit:junit-bom:5.6.1
org.junit.jupiter:junit-jupiter-api:5.6.2
org.junit.jupiter:junit-jupiter-engine:5.6.2
org.junit.platform:junit-platform-commons:1.6.2
org.junit.platform:junit-platform-engine:1.6.2
org.junit.vintage:junit-vintage-engine:5.6.2
org.junit:junit-bom:5.6.2
org.opentest4j:opentest4j:1.2.0
org.yaml:snakeyaml:1.17

View file

@ -53,11 +53,11 @@ org.bouncycastle:bcprov-jdk15on:1.61
org.checkerframework:checker-compat-qual:2.5.5
org.checkerframework:checker-qual:2.11.1
org.hamcrest:hamcrest-core:1.3
org.junit.jupiter:junit-jupiter-api:5.6.1
org.junit.jupiter:junit-jupiter-engine:5.6.1
org.junit.platform:junit-platform-commons:1.6.1
org.junit.platform:junit-platform-engine:1.6.1
org.junit.vintage:junit-vintage-engine:5.6.1
org.junit:junit-bom:5.6.1
org.junit.jupiter:junit-jupiter-api:5.6.2
org.junit.jupiter:junit-jupiter-engine:5.6.2
org.junit.platform:junit-platform-commons:1.6.2
org.junit.platform:junit-platform-engine:1.6.2
org.junit.vintage:junit-vintage-engine:5.6.2
org.junit:junit-bom:5.6.2
org.opentest4j:opentest4j:1.2.0
org.yaml:snakeyaml:1.17

View file

@ -53,11 +53,11 @@ org.bouncycastle:bcprov-jdk15on:1.61
org.checkerframework:checker-compat-qual:2.5.5
org.checkerframework:checker-qual:2.11.1
org.hamcrest:hamcrest-core:1.3
org.junit.jupiter:junit-jupiter-api:5.6.1
org.junit.jupiter:junit-jupiter-engine:5.6.1
org.junit.platform:junit-platform-commons:1.6.1
org.junit.platform:junit-platform-engine:1.6.1
org.junit.vintage:junit-vintage-engine:5.6.1
org.junit:junit-bom:5.6.1
org.junit.jupiter:junit-jupiter-api:5.6.2
org.junit.jupiter:junit-jupiter-engine:5.6.2
org.junit.platform:junit-platform-commons:1.6.2
org.junit.platform:junit-platform-engine:1.6.2
org.junit.vintage:junit-vintage-engine:5.6.2
org.junit:junit-bom:5.6.2
org.opentest4j:opentest4j:1.2.0
org.yaml:snakeyaml:1.17

View file

@ -58,12 +58,12 @@ org.bouncycastle:bcprov-jdk15on:1.61
org.checkerframework:checker-compat-qual:2.5.5
org.checkerframework:checker-qual:2.11.1
org.hamcrest:hamcrest-core:1.3
org.junit.jupiter:junit-jupiter-api:5.6.1
org.junit.jupiter:junit-jupiter-engine:5.6.1
org.junit.platform:junit-platform-commons:1.6.1
org.junit.platform:junit-platform-engine:1.6.1
org.junit.vintage:junit-vintage-engine:5.6.1
org.junit:junit-bom:5.6.1
org.junit.jupiter:junit-jupiter-api:5.6.2
org.junit.jupiter:junit-jupiter-engine:5.6.2
org.junit.platform:junit-platform-commons:1.6.2
org.junit.platform:junit-platform-engine:1.6.2
org.junit.vintage:junit-vintage-engine:5.6.2
org.junit:junit-bom:5.6.2
org.mockito:mockito-core:3.3.3
org.objenesis:objenesis:2.6
org.opentest4j:opentest4j:1.2.0

View file

@ -58,12 +58,12 @@ org.bouncycastle:bcprov-jdk15on:1.61
org.checkerframework:checker-compat-qual:2.5.5
org.checkerframework:checker-qual:2.11.1
org.hamcrest:hamcrest-core:1.3
org.junit.jupiter:junit-jupiter-api:5.6.1
org.junit.jupiter:junit-jupiter-engine:5.6.1
org.junit.platform:junit-platform-commons:1.6.1
org.junit.platform:junit-platform-engine:1.6.1
org.junit.vintage:junit-vintage-engine:5.6.1
org.junit:junit-bom:5.6.1
org.junit.jupiter:junit-jupiter-api:5.6.2
org.junit.jupiter:junit-jupiter-engine:5.6.2
org.junit.platform:junit-platform-commons:1.6.2
org.junit.platform:junit-platform-engine:1.6.2
org.junit.vintage:junit-vintage-engine:5.6.2
org.junit:junit-bom:5.6.2
org.mockito:mockito-core:3.3.3
org.objenesis:objenesis:2.6
org.opentest4j:opentest4j:1.2.0

View file

@ -58,12 +58,12 @@ org.bouncycastle:bcprov-jdk15on:1.61
org.checkerframework:checker-compat-qual:2.5.5
org.checkerframework:checker-qual:2.11.1
org.hamcrest:hamcrest-core:1.3
org.junit.jupiter:junit-jupiter-api:5.6.1
org.junit.jupiter:junit-jupiter-engine:5.6.1
org.junit.platform:junit-platform-commons:1.6.1
org.junit.platform:junit-platform-engine:1.6.1
org.junit.vintage:junit-vintage-engine:5.6.1
org.junit:junit-bom:5.6.1
org.junit.jupiter:junit-jupiter-api:5.6.2
org.junit.jupiter:junit-jupiter-engine:5.6.2
org.junit.platform:junit-platform-commons:1.6.2
org.junit.platform:junit-platform-engine:1.6.2
org.junit.vintage:junit-vintage-engine:5.6.2
org.junit:junit-bom:5.6.2
org.mockito:mockito-core:3.3.3
org.objenesis:objenesis:2.6
org.opentest4j:opentest4j:1.2.0

View file

@ -58,12 +58,12 @@ org.bouncycastle:bcprov-jdk15on:1.61
org.checkerframework:checker-compat-qual:2.5.5
org.checkerframework:checker-qual:2.11.1
org.hamcrest:hamcrest-core:1.3
org.junit.jupiter:junit-jupiter-api:5.6.1
org.junit.jupiter:junit-jupiter-engine:5.6.1
org.junit.platform:junit-platform-commons:1.6.1
org.junit.platform:junit-platform-engine:1.6.1
org.junit.vintage:junit-vintage-engine:5.6.1
org.junit:junit-bom:5.6.1
org.junit.jupiter:junit-jupiter-api:5.6.2
org.junit.jupiter:junit-jupiter-engine:5.6.2
org.junit.platform:junit-platform-commons:1.6.2
org.junit.platform:junit-platform-engine:1.6.2
org.junit.vintage:junit-vintage-engine:5.6.2
org.junit:junit-bom:5.6.2
org.mockito:mockito-core:3.3.3
org.objenesis:objenesis:2.6
org.opentest4j:opentest4j:1.2.0

View file

@ -63,12 +63,12 @@ org.bouncycastle:bcprov-jdk15on:1.61
org.checkerframework:checker-compat-qual:2.5.5
org.checkerframework:checker-qual:2.11.1
org.hamcrest:hamcrest-core:1.3
org.junit.jupiter:junit-jupiter-api:5.6.1
org.junit.jupiter:junit-jupiter-engine:5.6.1
org.junit.platform:junit-platform-commons:1.6.1
org.junit.platform:junit-platform-engine:1.6.1
org.junit.vintage:junit-vintage-engine:5.6.1
org.junit:junit-bom:5.6.1
org.junit.jupiter:junit-jupiter-api:5.6.2
org.junit.jupiter:junit-jupiter-engine:5.6.2
org.junit.platform:junit-platform-commons:1.6.2
org.junit.platform:junit-platform-engine:1.6.2
org.junit.vintage:junit-vintage-engine:5.6.2
org.junit:junit-bom:5.6.2
org.mockito:mockito-core:3.3.3
org.objenesis:objenesis:2.6
org.opentest4j:opentest4j:1.2.0

View file

@ -63,12 +63,12 @@ org.bouncycastle:bcprov-jdk15on:1.61
org.checkerframework:checker-compat-qual:2.5.5
org.checkerframework:checker-qual:2.11.1
org.hamcrest:hamcrest-core:1.3
org.junit.jupiter:junit-jupiter-api:5.6.1
org.junit.jupiter:junit-jupiter-engine:5.6.1
org.junit.platform:junit-platform-commons:1.6.1
org.junit.platform:junit-platform-engine:1.6.1
org.junit.vintage:junit-vintage-engine:5.6.1
org.junit:junit-bom:5.6.1
org.junit.jupiter:junit-jupiter-api:5.6.2
org.junit.jupiter:junit-jupiter-engine:5.6.2
org.junit.platform:junit-platform-commons:1.6.2
org.junit.platform:junit-platform-engine:1.6.2
org.junit.vintage:junit-vintage-engine:5.6.2
org.junit:junit-bom:5.6.2
org.mockito:mockito-core:3.3.3
org.objenesis:objenesis:2.6
org.opentest4j:opentest4j:1.2.0

View file

@ -63,12 +63,12 @@ org.bouncycastle:bcprov-jdk15on:1.61
org.checkerframework:checker-compat-qual:2.5.5
org.checkerframework:checker-qual:2.11.1
org.hamcrest:hamcrest-core:1.3
org.junit.jupiter:junit-jupiter-api:5.6.1
org.junit.jupiter:junit-jupiter-engine:5.6.1
org.junit.platform:junit-platform-commons:1.6.1
org.junit.platform:junit-platform-engine:1.6.1
org.junit.vintage:junit-vintage-engine:5.6.1
org.junit:junit-bom:5.6.1
org.junit.jupiter:junit-jupiter-api:5.6.2
org.junit.jupiter:junit-jupiter-engine:5.6.2
org.junit.platform:junit-platform-commons:1.6.2
org.junit.platform:junit-platform-engine:1.6.2
org.junit.vintage:junit-vintage-engine:5.6.2
org.junit:junit-bom:5.6.2
org.mockito:mockito-core:3.3.3
org.objenesis:objenesis:2.6
org.opentest4j:opentest4j:1.2.0

View file

@ -63,12 +63,12 @@ org.bouncycastle:bcprov-jdk15on:1.61
org.checkerframework:checker-compat-qual:2.5.5
org.checkerframework:checker-qual:2.11.1
org.hamcrest:hamcrest-core:1.3
org.junit.jupiter:junit-jupiter-api:5.6.1
org.junit.jupiter:junit-jupiter-engine:5.6.1
org.junit.platform:junit-platform-commons:1.6.1
org.junit.platform:junit-platform-engine:1.6.1
org.junit.vintage:junit-vintage-engine:5.6.1
org.junit:junit-bom:5.6.1
org.junit.jupiter:junit-jupiter-api:5.6.2
org.junit.jupiter:junit-jupiter-engine:5.6.2
org.junit.platform:junit-platform-commons:1.6.2
org.junit.platform:junit-platform-engine:1.6.2
org.junit.vintage:junit-vintage-engine:5.6.2
org.junit:junit-bom:5.6.2
org.mockito:mockito-core:3.3.3
org.objenesis:objenesis:2.6
org.opentest4j:opentest4j:1.2.0

View file

@ -46,12 +46,12 @@ org.checkerframework:checker-compat-qual:2.5.5
org.checkerframework:checker-qual:2.11.1
org.hamcrest:hamcrest-all:1.3
org.hamcrest:hamcrest-core:1.3
org.junit.jupiter:junit-jupiter-api:5.6.1
org.junit.jupiter:junit-jupiter-engine:5.6.1
org.junit.platform:junit-platform-commons:1.6.1
org.junit.platform:junit-platform-engine:1.6.1
org.junit.vintage:junit-vintage-engine:5.6.1
org.junit:junit-bom:5.6.1
org.junit.jupiter:junit-jupiter-api:5.6.2
org.junit.jupiter:junit-jupiter-engine:5.6.2
org.junit.platform:junit-platform-commons:1.6.2
org.junit.platform:junit-platform-engine:1.6.2
org.junit.vintage:junit-vintage-engine:5.6.2
org.junit:junit-bom:5.6.2
org.mockito:mockito-core:3.3.3
org.objenesis:objenesis:2.6
org.opentest4j:opentest4j:1.2.0

View file

@ -46,12 +46,12 @@ org.checkerframework:checker-compat-qual:2.5.5
org.checkerframework:checker-qual:2.11.1
org.hamcrest:hamcrest-all:1.3
org.hamcrest:hamcrest-core:1.3
org.junit.jupiter:junit-jupiter-api:5.6.1
org.junit.jupiter:junit-jupiter-engine:5.6.1
org.junit.platform:junit-platform-commons:1.6.1
org.junit.platform:junit-platform-engine:1.6.1
org.junit.vintage:junit-vintage-engine:5.6.1
org.junit:junit-bom:5.6.1
org.junit.jupiter:junit-jupiter-api:5.6.2
org.junit.jupiter:junit-jupiter-engine:5.6.2
org.junit.platform:junit-platform-commons:1.6.2
org.junit.platform:junit-platform-engine:1.6.2
org.junit.vintage:junit-vintage-engine:5.6.2
org.junit:junit-bom:5.6.2
org.mockito:mockito-core:3.3.3
org.objenesis:objenesis:2.6
org.opentest4j:opentest4j:1.2.0

View file

@ -48,12 +48,12 @@ org.checkerframework:checker-compat-qual:2.5.5
org.checkerframework:checker-qual:2.11.1
org.hamcrest:hamcrest-all:1.3
org.hamcrest:hamcrest-core:1.3
org.junit.jupiter:junit-jupiter-api:5.6.1
org.junit.jupiter:junit-jupiter-engine:5.6.1
org.junit.platform:junit-platform-commons:1.6.1
org.junit.platform:junit-platform-engine:1.6.1
org.junit.vintage:junit-vintage-engine:5.6.1
org.junit:junit-bom:5.6.1
org.junit.jupiter:junit-jupiter-api:5.6.2
org.junit.jupiter:junit-jupiter-engine:5.6.2
org.junit.platform:junit-platform-commons:1.6.2
org.junit.platform:junit-platform-engine:1.6.2
org.junit.vintage:junit-vintage-engine:5.6.2
org.junit:junit-bom:5.6.2
org.mockito:mockito-core:3.3.3
org.objenesis:objenesis:2.6
org.opentest4j:opentest4j:1.2.0

View file

@ -48,12 +48,12 @@ org.checkerframework:checker-compat-qual:2.5.5
org.checkerframework:checker-qual:2.11.1
org.hamcrest:hamcrest-all:1.3
org.hamcrest:hamcrest-core:1.3
org.junit.jupiter:junit-jupiter-api:5.6.1
org.junit.jupiter:junit-jupiter-engine:5.6.1
org.junit.platform:junit-platform-commons:1.6.1
org.junit.platform:junit-platform-engine:1.6.1
org.junit.vintage:junit-vintage-engine:5.6.1
org.junit:junit-bom:5.6.1
org.junit.jupiter:junit-jupiter-api:5.6.2
org.junit.jupiter:junit-jupiter-engine:5.6.2
org.junit.platform:junit-platform-commons:1.6.2
org.junit.platform:junit-platform-engine:1.6.2
org.junit.vintage:junit-vintage-engine:5.6.2
org.junit:junit-bom:5.6.2
org.mockito:mockito-core:3.3.3
org.objenesis:objenesis:2.6
org.opentest4j:opentest4j:1.2.0