mirror of
https://github.com/google/nomulus.git
synced 2025-05-19 18:59:35 +02:00
Move test resource files into src/test/resources (#143)
* Move test resource files into src/test/resources * fix a test * Remove references to javatests/ in Java files * fix import order * fix semantic merge conflict
This commit is contained in:
parent
32d5940be3
commit
cf507dad6d
991 changed files with 23 additions and 22 deletions
|
@ -24,8 +24,8 @@ import google.registry.config.CredentialModule.DefaultCredential;
|
|||
import google.registry.config.RegistryConfig.Config;
|
||||
import google.registry.request.HttpException.BadRequestException;
|
||||
import google.registry.request.Parameter;
|
||||
import google.registry.util.GoogleCredentialsBundle;
|
||||
import google.registry.util.Clock;
|
||||
import google.registry.util.GoogleCredentialsBundle;
|
||||
import java.util.Optional;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import org.joda.time.DateTimeZone;
|
||||
|
|
|
@ -96,7 +96,7 @@ public class FlowContext {
|
|||
}
|
||||
|
||||
/**
|
||||
* Helper to locate test files for this flow by looking in javatests/ for all files with the
|
||||
* Helper to locate test files for this flow by looking in src/test/java/ for all files with the
|
||||
* exact same relative filename as the flow file, but with a "*Test{,Case}.java" suffix.
|
||||
*/
|
||||
private static Set<String> getTestFilenames(String flowName) throws IOException {
|
||||
|
|
|
@ -35,10 +35,10 @@ import org.junit.runners.JUnit4;
|
|||
* condition. For example, there should always be a matching pair of lines such as the following:
|
||||
*
|
||||
* <pre>
|
||||
* java/.../flows/session/LoginFlow.java:
|
||||
* src/main/java/.../flows/session/LoginFlow.java:
|
||||
* @error {@link AlreadyLoggedInException}
|
||||
*
|
||||
* javatests/.../flows/session/LoginFlowTest.java:
|
||||
* src/test/java/.../flows/session/LoginFlowTest.java:
|
||||
* import .....flows.session.LoginFlow.AlreadyLoggedInException;
|
||||
* </pre>
|
||||
*
|
||||
|
|
|
@ -38,7 +38,7 @@ import org.bouncycastle.openpgp.PGPUtil;
|
|||
import org.bouncycastle.openpgp.bc.BcPGPPublicKeyRingCollection;
|
||||
import org.bouncycastle.openpgp.bc.BcPGPSecretKeyRingCollection;
|
||||
|
||||
/** Keyring factory that loads keys from {@code javatests/.../testing/testdata} */
|
||||
/** Keyring factory that loads keys from {@code src/test/java/.../testing} */
|
||||
@Module
|
||||
@Immutable
|
||||
public final class FakeKeyringModule {
|
||||
|
|
|
@ -79,7 +79,7 @@ public final class TestDataHelper {
|
|||
public static String loadFile(Class<?> context, String filename) {
|
||||
return fileCache.computeIfAbsent(
|
||||
FileKey.create(context, filename),
|
||||
k -> readResourceUtf8(context, "testdata/" + filename));
|
||||
k -> readResourceUtf8(context, filename));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -102,15 +102,16 @@ public final class TestDataHelper {
|
|||
public static ByteSource loadBytes(Class<?> context, String filename) {
|
||||
return byteCache.computeIfAbsent(
|
||||
FileKey.create(context, filename),
|
||||
k -> readResourceBytes(context, "testdata/" + filename));
|
||||
k -> readResourceBytes(context, filename));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the "real" location of the file loaded by the other commands, starting from javatests/.
|
||||
* Returns the "real" location of the file loaded by the other commands, starting from
|
||||
* src/test/resources/.
|
||||
*/
|
||||
public static String filePath(Class<?> context, String filename) {
|
||||
String packagePath = context.getPackage().getName().replace('.', '/');
|
||||
return String.format("javatests/%s/testdata/%s", packagePath, filename);
|
||||
return String.format("src/test/resources/%s/%s", packagePath, filename);
|
||||
}
|
||||
|
||||
/** Returns a recursive iterable of all files in the given directory. */
|
||||
|
|
|
@ -47,7 +47,7 @@ public class TmchTestDataExpirationTest {
|
|||
new TmchXmlSignature(
|
||||
new TmchCertificateAuthority(TmchCaMode.PILOT, new SystemClock())));
|
||||
|
||||
for (Path path : listFiles(TmchTestDataExpirationTest.class, "testdata/active/")) {
|
||||
for (Path path : listFiles(TmchTestDataExpirationTest.class, "active/")) {
|
||||
if (path.toString().endsWith(".smd")) {
|
||||
logger.atInfo().log("Verifying: %s", path);
|
||||
String tmchData = ResourceUtils.readResourceUtf8(path.toUri().toURL());
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue