zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mic...@apache.org
Subject svn commit: r1593624 - in /zookeeper/trunk: ./ src/java/systest/org/apache/zookeeper/test/system/ src/java/test/org/apache/zookeeper/server/quorum/
Date Fri, 09 May 2014 21:37:39 GMT
Author: michim
Date: Fri May  9 21:37:39 2014
New Revision: 1593624

URL: http://svn.apache.org/r1593624
Log:
ZOOKEEPER-1926. Unit tests should only use build/test/data for data (Enis Soztutar via michim)

Modified:
    zookeeper/trunk/CHANGES.txt
    zookeeper/trunk/src/java/systest/org/apache/zookeeper/test/system/BaseSysTest.java
    zookeeper/trunk/src/java/systest/org/apache/zookeeper/test/system/QuorumPeerInstance.java
    zookeeper/trunk/src/java/test/org/apache/zookeeper/server/quorum/LearnerTest.java
    zookeeper/trunk/src/java/test/org/apache/zookeeper/server/quorum/Zab1_0Test.java

Modified: zookeeper/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/zookeeper/trunk/CHANGES.txt?rev=1593624&r1=1593623&r2=1593624&view=diff
==============================================================================
--- zookeeper/trunk/CHANGES.txt (original)
+++ zookeeper/trunk/CHANGES.txt Fri May  9 21:37:39 2014
@@ -636,6 +636,9 @@ BUGFIXES:
 
   ZOOKEEPER-1923. A typo in zookeeperStarted document (Chengwei Yang via michim)
 
+  ZOOKEEPER-1926. Unit tests should only use build/test/data for data (Enis
+  Soztutar via michim)
+
 IMPROVEMENTS:
 
   ZOOKEEPER-1170. Fix compiler (eclipse) warnings: unused imports,

Modified: zookeeper/trunk/src/java/systest/org/apache/zookeeper/test/system/BaseSysTest.java
URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/java/systest/org/apache/zookeeper/test/system/BaseSysTest.java?rev=1593624&r1=1593623&r2=1593624&view=diff
==============================================================================
--- zookeeper/trunk/src/java/systest/org/apache/zookeeper/test/system/BaseSysTest.java (original)
+++ zookeeper/trunk/src/java/systest/org/apache/zookeeper/test/system/BaseSysTest.java Fri
May  9 21:37:39 2014
@@ -37,6 +37,8 @@ import org.junit.runner.JUnitCore;
 
 @Ignore("No tests in this class.")
 public class BaseSysTest extends TestCase {
+    private static final File testData = new File(
+            System.getProperty("test.data.dir", "build/test/data"));
     private static int fakeBasePort = 33222;
     private static String zkHostPort;
     protected String prefix = "/sysTest";
@@ -148,7 +150,7 @@ public class BaseSysTest extends TestCas
         }
         StringBuilder sb = new StringBuilder();
         for(int i = 0; i < count; i++) {
-            qpsDirs[i] = File.createTempFile("sysTest", ".tmp");
+            qpsDirs[i] = File.createTempFile("sysTest", ".tmp", testData);
             qpsDirs[i].delete();
             qpsDirs[i].mkdir();
             int port = fakeBasePort+10+i;

Modified: zookeeper/trunk/src/java/systest/org/apache/zookeeper/test/system/QuorumPeerInstance.java
URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/java/systest/org/apache/zookeeper/test/system/QuorumPeerInstance.java?rev=1593624&r1=1593623&r2=1593624&view=diff
==============================================================================
--- zookeeper/trunk/src/java/systest/org/apache/zookeeper/test/system/QuorumPeerInstance.java
(original)
+++ zookeeper/trunk/src/java/systest/org/apache/zookeeper/test/system/QuorumPeerInstance.java
Fri May  9 21:37:39 2014
@@ -36,6 +36,9 @@ import org.apache.zookeeper.server.quoru
 
 class QuorumPeerInstance implements Instance {
     final private static Logger LOG = LoggerFactory.getLogger(QuorumPeerInstance.class);
+    private static final File testData = new File(
+        System.getProperty("test.data.dir", "build/test/data"));
+
     private static final int syncLimit = 3;
     private static final int initLimit = 3;
     private static final int tickTime = 2000;
@@ -55,7 +58,7 @@ class QuorumPeerInstance implements Inst
 
     public QuorumPeerInstance() {
         try {
-            File tmpFile = File.createTempFile("test", ".dir");
+            File tmpFile = File.createTempFile("test", ".dir", testData);
             File tmpDir = tmpFile.getParentFile();
             tmpFile.delete();
             File zkDirs = new File(tmpDir, "zktmp.cfg");

Modified: zookeeper/trunk/src/java/test/org/apache/zookeeper/server/quorum/LearnerTest.java
URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/java/test/org/apache/zookeeper/server/quorum/LearnerTest.java?rev=1593624&r1=1593623&r2=1593624&view=diff
==============================================================================
--- zookeeper/trunk/src/java/test/org/apache/zookeeper/server/quorum/LearnerTest.java (original)
+++ zookeeper/trunk/src/java/test/org/apache/zookeeper/server/quorum/LearnerTest.java Fri
May  9 21:37:39 2014
@@ -40,6 +40,9 @@ import org.junit.Assert;
 import org.junit.Test;
 
 public class LearnerTest extends ZKTestCase {
+    private static final File testData = new File(
+        System.getProperty("test.data.dir", "build/test/data"));
+
     static class SimpleLearnerZooKeeperServer extends LearnerZooKeeperServer {
 
         Learner learner;
@@ -76,7 +79,7 @@ public class LearnerTest extends ZKTestC
 
     @Test
     public void syncTest() throws Exception {
-        File tmpFile = File.createTempFile("test", ".dir");
+        File tmpFile = File.createTempFile("test", ".dir", testData);
         tmpFile.delete();
         try {
             FileTxnSnapLog ftsl = new FileTxnSnapLog(tmpFile, tmpFile);

Modified: zookeeper/trunk/src/java/test/org/apache/zookeeper/server/quorum/Zab1_0Test.java
URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/java/test/org/apache/zookeeper/server/quorum/Zab1_0Test.java?rev=1593624&r1=1593623&r2=1593624&view=diff
==============================================================================
--- zookeeper/trunk/src/java/test/org/apache/zookeeper/server/quorum/Zab1_0Test.java (original)
+++ zookeeper/trunk/src/java/test/org/apache/zookeeper/server/quorum/Zab1_0Test.java Fri May
 9 21:37:39 2014
@@ -73,6 +73,9 @@ public class Zab1_0Test {
 
     private static final Logger LOG = LoggerFactory.getLogger(Zab1_0Test.class);
 
+    private static final File testData = new File(
+            System.getProperty("test.data.dir", "build/test/data"));
+
     private static final class LeadThread extends Thread {
         private final Leader leader;
 
@@ -143,7 +146,7 @@ public class Zab1_0Test {
     }
     @Test
     public void testLeaderInConnectingFollowers() throws Exception {    
-        File tmpDir = File.createTempFile("test", "dir");
+        File tmpDir = File.createTempFile("test", "dir", testData);
         tmpDir.delete();
         tmpDir.mkdir();
         Leader leader = null;
@@ -197,7 +200,7 @@ public class Zab1_0Test {
     
     @Test
     public void testLastAcceptedEpoch() throws Exception {    
-        File tmpDir = File.createTempFile("test", "dir");
+        File tmpDir = File.createTempFile("test", "dir", testData);
         tmpDir.delete();
         tmpDir.mkdir();
         Leader leader = null;
@@ -236,7 +239,7 @@ public class Zab1_0Test {
     
     @Test
     public void testLeaderInElectingFollowers() throws Exception {    
-        File tmpDir = File.createTempFile("test", "dir");
+        File tmpDir = File.createTempFile("test", "dir", testData);
         tmpDir.delete();
         tmpDir.mkdir();
         Leader leader = null;
@@ -345,7 +348,7 @@ public class Zab1_0Test {
         Socket pair[] = getSocketPair();
         Socket leaderSocket = pair[0];
         Socket followerSocket = pair[1];
-        File tmpDir = File.createTempFile("test", "dir");
+        File tmpDir = File.createTempFile("test", "dir", testData);
         tmpDir.delete();
         tmpDir.mkdir();
         LeadThread leadThread = null;
@@ -387,7 +390,7 @@ public class Zab1_0Test {
         Socket pair[] = getSocketPair();
         Socket leaderSocket = pair[0];
         Socket followerSocket = pair[1];
-        File tmpDir = File.createTempFile("test", "dir");
+        File tmpDir = File.createTempFile("test", "dir", testData);
         tmpDir.delete();
         tmpDir.mkdir();
         LeadThread leadThread = null;
@@ -454,7 +457,7 @@ public class Zab1_0Test {
     
     
     public void testFollowerConversation(FollowerConversation conversation) throws Exception
{
-        File tmpDir = File.createTempFile("test", "dir");
+        File tmpDir = File.createTempFile("test", "dir", testData);
         tmpDir.delete();
         tmpDir.mkdir();
         Thread followerThread = null;
@@ -506,7 +509,7 @@ public class Zab1_0Test {
     }
 
     public void testObserverConversation(ObserverConversation conversation) throws Exception
{
-        File tmpDir = File.createTempFile("test", "dir");
+        File tmpDir = File.createTempFile("test", "dir", testData);
         tmpDir.delete();
         tmpDir.mkdir();
         Thread observerThread = null;
@@ -625,7 +628,7 @@ public class Zab1_0Test {
             @Override
             public void converseWithFollower(InputArchive ia, OutputArchive oa,
                     Follower f) throws Exception {
-                File tmpDir = File.createTempFile("test", "dir");
+                File tmpDir = File.createTempFile("test", "dir", testData);
                 tmpDir.delete();
                 tmpDir.mkdir();
                 File logDir = f.fzk.getTxnLogFactory().getDataDir().getParentFile();
@@ -753,7 +756,7 @@ public class Zab1_0Test {
             @Override
             public void converseWithFollower(InputArchive ia, OutputArchive oa,
                     Follower f) throws Exception {
-                File tmpDir = File.createTempFile("test", "dir");
+                File tmpDir = File.createTempFile("test", "dir", testData);
                 tmpDir.delete();
                 tmpDir.mkdir();
                 File logDir = f.fzk.getTxnLogFactory().getDataDir().getParentFile();
@@ -979,7 +982,7 @@ public class Zab1_0Test {
             @Override
             public void converseWithObserver(InputArchive ia, OutputArchive oa,
                     Observer o) throws Exception {
-                File tmpDir = File.createTempFile("test", "dir");
+                File tmpDir = File.createTempFile("test", "dir", testData);
                 tmpDir.delete();
                 tmpDir.mkdir();
                 File logDir = o.zk.getTxnLogFactory().getDataDir().getParentFile();
@@ -1325,7 +1328,7 @@ public class Zab1_0Test {
 
     @Test
     public void testInitialAcceptedCurrent() throws Exception {
-        File tmpDir = File.createTempFile("test", ".dir");
+        File tmpDir = File.createTempFile("test", ".dir", testData);
         tmpDir.delete();
         tmpDir.mkdir();
         try {



Mime
View raw message