From 6c5c3371e6fc942ca61b5603e0a5dc911542ddad Mon Sep 17 00:00:00 2001 From: Ivan Vilata-i-Balaguer Date: Wed, 27 Apr 2016 13:38:09 +0200 Subject: [PATCH] Rename "temporary" to "test data" directory in network stress test --- .../p2p/network/NetworkStressTest.java | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/network/src/test/java/io/bitsquare/p2p/network/NetworkStressTest.java b/network/src/test/java/io/bitsquare/p2p/network/NetworkStressTest.java index 1e4d729982..12402802ed 100644 --- a/network/src/test/java/io/bitsquare/p2p/network/NetworkStressTest.java +++ b/network/src/test/java/io/bitsquare/p2p/network/NetworkStressTest.java @@ -45,8 +45,8 @@ public class NetworkStressTest { // Instance fields - /** A directory to temporarily hold seed and normal nodes' configuration and state files. */ - private Path tempDir; + /** A directory to (temporarily) hold seed and normal nodes' configuration and state files. */ + private Path testDataDir; /** A single seed node that other nodes will contact to request initial data. */ private SeedNode seedNode; /** A list of peer nodes represented as P2P services. */ @@ -67,11 +67,11 @@ public class NetworkStressTest { // Set a security provider to allow key generation. Security.addProvider(new BouncyCastleProvider()); - // Create the temporary directory. - tempDir = createTempDirectory(); + // Create the test data directory. + testDataDir = createTestDataDirectory(); // Create and start the seed node. - seedNode = new SeedNode(tempDir.toString()); + seedNode = new SeedNode(testDataDir.toString()); final NodeAddress seedNodeAddress = getSeedNodeAddress(); final boolean useLocalhost = seedNodeAddress.hostName.equals("localhost"); final Set seedNodes = new HashSet<>(1); @@ -89,7 +89,7 @@ public class NetworkStressTest { } for (int p = 0; p < NPEERS; p++) { final int peerPort = Utils.findFreeSystemPort(); - final File peerDir = new File(tempDir.toFile(), String.format("peer-%06d", p)); + final File peerDir = new File(testDataDir.toFile(), String.format("peer-%06d", p)); final File peerTorDir = new File(peerDir, "tor"); final File peerStorageDir = new File(peerDir, "db"); final File peerKeysDir = new File(peerDir, "keys"); @@ -140,9 +140,9 @@ public class NetworkStressTest { // Wait for concurrent tasks to finish. shutdownLatch.await(); - // Cleanup temporary directory. - if (tempDir != null) { - deleteTempDirectory(); + // Cleanup test data directory. + if (testDataDir != null) { + deleteTestDataDirectory(); } } @@ -156,7 +156,7 @@ public class NetworkStressTest { bootstrapLatch.await(30, TimeUnit.SECONDS)); } - private Path createTempDirectory() throws IOException { + private Path createTestDataDirectory() throws IOException { Path stressTestDirPath; String stressTestDir = System.getenv(TEST_DIR_ENVVAR); @@ -173,11 +173,11 @@ public class NetworkStressTest { return stressTestDirPath; } - private void deleteTempDirectory() throws IOException { + private void deleteTestDataDirectory() throws IOException { // Based on by Tomasz Dzięcielewski. if (System.getenv(TEST_DIR_ENVVAR) != null) return; // do not remove if given explicitly - Files.walkFileTree(tempDir, new SimpleFileVisitor() { + Files.walkFileTree(testDataDir, new SimpleFileVisitor() { @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { Files.delete(file);