[tor-commits] [metrics-db/master] Move unit tests to a separate source tree.
karsten at torproject.org
karsten at torproject.org
Mon Jan 16 13:33:20 UTC 2012
commit b7cc7e3f6192b7aaaeac7422db28026c512ccd7d
Author: Karsten Loesing <karsten.loesing at gmx.net>
Date: Mon Jan 16 14:31:32 2012 +0100
Move unit tests to a separate source tree.
---
build.xml | 12 ++++++
.../torproject/ernie/test/ArchiveReaderTest.java | 33 -----------------
.../torproject/ernie/test/ArchiveWriterTest.java | 30 ---------------
.../ernie/test/BridgeSnapshotReaderTest.java | 33 -----------------
.../test/CachedRelayDescriptorReaderTest.java | 32 ----------------
.../ernie/test/SanitizedBridgesWriterTest.java | 39 --------------------
.../org/torproject/ernie/db/ArchiveReaderTest.java | 33 +++++++++++++++++
.../org/torproject/ernie/db/ArchiveWriterTest.java | 30 +++++++++++++++
.../ernie/db/BridgeSnapshotReaderTest.java | 33 +++++++++++++++++
.../ernie/db/CachedRelayDescriptorReaderTest.java | 32 ++++++++++++++++
.../ernie/db/SanitizedBridgesWriterTest.java | 39 ++++++++++++++++++++
11 files changed, 179 insertions(+), 167 deletions(-)
diff --git a/build.xml b/build.xml
index 678a088..3f187be 100644
--- a/build.xml
+++ b/build.xml
@@ -1,6 +1,7 @@
<project default="run" name="ERNIE" basedir=".">
<property name="sources" value="src/"/>
<property name="classes" value="bin/"/>
+ <property name="tests" value="test"/>
<property name="docs" value="javadoc/"/>
<property name="name" value="ERNIE"/>
<path id="classpath">
@@ -38,6 +39,17 @@
</javadoc>
</target>
<target name="test" depends="compile">
+ <javac destdir="${classes}"
+ srcdir="${tests}"
+ source="1.5"
+ target="1.5"
+ debug="true"
+ deprecation="true"
+ optimize="false"
+ failonerror="true"
+ includeantruntime="false">
+ <classpath refid="classpath"/>
+ </javac>
<junit haltonfailure="true" printsummary="off">
<classpath refid="classpath"/>
<formatter type="plain" usefile="false"/>
diff --git a/src/org/torproject/ernie/test/ArchiveReaderTest.java b/src/org/torproject/ernie/test/ArchiveReaderTest.java
deleted file mode 100644
index 4099ee3..0000000
--- a/src/org/torproject/ernie/test/ArchiveReaderTest.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright 2011 The Tor Project
- * See LICENSE for licensing information */
-package org.torproject.ernie.test;
-
-import org.torproject.ernie.db.*;
-
-import java.io.*;
-
-import org.junit.*;
-import org.junit.rules.*;
-import static org.junit.Assert.*;
-
-public class ArchiveReaderTest {
-
- private File tempArchivesDirectory;
- private File tempStatsDirectory;
-
- @Rule
- public TemporaryFolder folder = new TemporaryFolder();
-
- @Before
- public void createTempDirectories() {
- this.tempArchivesDirectory = folder.newFolder("sanitized-bridges");
- this.tempStatsDirectory = folder.newFolder("stats");
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testRelayDescriptorParserNull() {
- new ArchiveReader(null, this.tempArchivesDirectory,
- this.tempStatsDirectory, false);
- }
-}
-
diff --git a/src/org/torproject/ernie/test/ArchiveWriterTest.java b/src/org/torproject/ernie/test/ArchiveWriterTest.java
deleted file mode 100644
index fb34f65..0000000
--- a/src/org/torproject/ernie/test/ArchiveWriterTest.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright 2011 The Tor Project
- * See LICENSE for licensing information */
-package org.torproject.ernie.test;
-
-import org.torproject.ernie.db.*;
-
-import java.io.*;
-
-import org.junit.*;
-import org.junit.rules.*;
-import static org.junit.Assert.*;
-
-public class ArchiveWriterTest {
-
- private File tempArchivesDirectory;
-
- @Rule
- public TemporaryFolder folder = new TemporaryFolder();
-
- @Before
- public void createTempDirectories() {
- this.tempArchivesDirectory = folder.newFolder("archives");
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testArchivesDirectoryNull() {
- new ArchiveWriter(null);
- }
-}
-
diff --git a/src/org/torproject/ernie/test/BridgeSnapshotReaderTest.java b/src/org/torproject/ernie/test/BridgeSnapshotReaderTest.java
deleted file mode 100644
index 93d1642..0000000
--- a/src/org/torproject/ernie/test/BridgeSnapshotReaderTest.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright 2011 The Tor Project
- * See LICENSE for licensing information */
-package org.torproject.ernie.test;
-
-import org.torproject.ernie.db.*;
-
-import java.io.*;
-
-import org.junit.*;
-import org.junit.rules.*;
-import static org.junit.Assert.*;
-
-public class BridgeSnapshotReaderTest {
-
- private File tempBridgeDirectoriesDirectory;
- private File tempStatsDirectory;
-
- @Rule
- public TemporaryFolder folder = new TemporaryFolder();
-
- @Before
- public void createTempDirectories() {
- this.tempBridgeDirectoriesDirectory = folder.newFolder("bridges");
- this.tempStatsDirectory = folder.newFolder("stats");
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testBridgeDescriptorParserNull() {
- new BridgeSnapshotReader(null, this.tempBridgeDirectoriesDirectory,
- this.tempStatsDirectory);
- }
-}
-
diff --git a/src/org/torproject/ernie/test/CachedRelayDescriptorReaderTest.java b/src/org/torproject/ernie/test/CachedRelayDescriptorReaderTest.java
deleted file mode 100644
index 22b2018..0000000
--- a/src/org/torproject/ernie/test/CachedRelayDescriptorReaderTest.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Copyright 2011 The Tor Project
- * See LICENSE for licensing information */
-package org.torproject.ernie.test;
-
-import org.torproject.ernie.db.*;
-
-import java.io.*;
-import java.util.*;
-
-import org.junit.*;
-import org.junit.rules.*;
-import static org.junit.Assert.*;
-
-public class CachedRelayDescriptorReaderTest {
-
- private File tempStatsDirectory;
-
- @Rule
- public TemporaryFolder folder = new TemporaryFolder();
-
- @Before
- public void createTempDirectories() {
- this.tempStatsDirectory = folder.newFolder("stats");
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testRelayDescriptorParserNull() {
- new CachedRelayDescriptorReader(null, new ArrayList<String>(),
- this.tempStatsDirectory);
- }
-}
-
diff --git a/src/org/torproject/ernie/test/SanitizedBridgesWriterTest.java b/src/org/torproject/ernie/test/SanitizedBridgesWriterTest.java
deleted file mode 100644
index f5b3b64..0000000
--- a/src/org/torproject/ernie/test/SanitizedBridgesWriterTest.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Copyright 2011 The Tor Project
- * See LICENSE for licensing information */
-package org.torproject.ernie.test;
-
-import org.torproject.ernie.db.*;
-
-import java.io.*;
-
-import org.junit.*;
-import org.junit.rules.*;
-import static org.junit.Assert.*;
-
-public class SanitizedBridgesWriterTest {
-
- private File tempSanitizedBridgesDirectory;
- private File tempStatsDirectory;
-
- @Rule
- public TemporaryFolder folder = new TemporaryFolder();
-
- @Before
- public void createTempDirectories() {
- this.tempSanitizedBridgesDirectory =
- folder.newFolder("sanitized-bridges");
- this.tempStatsDirectory = folder.newFolder("stats");
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testSanitizedBridgesDirectoryNull() {
- new SanitizedBridgesWriter(null, this.tempStatsDirectory, false, -1L);
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testStatsDirectoryNull() {
- new SanitizedBridgesWriter(this.tempSanitizedBridgesDirectory, null,
- false, -1L);
- }
-}
-
diff --git a/test/org/torproject/ernie/db/ArchiveReaderTest.java b/test/org/torproject/ernie/db/ArchiveReaderTest.java
new file mode 100644
index 0000000..5779865
--- /dev/null
+++ b/test/org/torproject/ernie/db/ArchiveReaderTest.java
@@ -0,0 +1,33 @@
+/* Copyright 2011 The Tor Project
+ * See LICENSE for licensing information */
+package org.torproject.ernie.db;
+
+import org.torproject.ernie.db.*;
+
+import java.io.*;
+
+import org.junit.*;
+import org.junit.rules.*;
+import static org.junit.Assert.*;
+
+public class ArchiveReaderTest {
+
+ private File tempArchivesDirectory;
+ private File tempStatsDirectory;
+
+ @Rule
+ public TemporaryFolder folder = new TemporaryFolder();
+
+ @Before
+ public void createTempDirectories() {
+ this.tempArchivesDirectory = folder.newFolder("sanitized-bridges");
+ this.tempStatsDirectory = folder.newFolder("stats");
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testRelayDescriptorParserNull() {
+ new ArchiveReader(null, this.tempArchivesDirectory,
+ this.tempStatsDirectory, false);
+ }
+}
+
diff --git a/test/org/torproject/ernie/db/ArchiveWriterTest.java b/test/org/torproject/ernie/db/ArchiveWriterTest.java
new file mode 100644
index 0000000..3ae9abc
--- /dev/null
+++ b/test/org/torproject/ernie/db/ArchiveWriterTest.java
@@ -0,0 +1,30 @@
+/* Copyright 2011 The Tor Project
+ * See LICENSE for licensing information */
+package org.torproject.ernie.db;
+
+import org.torproject.ernie.db.*;
+
+import java.io.*;
+
+import org.junit.*;
+import org.junit.rules.*;
+import static org.junit.Assert.*;
+
+public class ArchiveWriterTest {
+
+ private File tempArchivesDirectory;
+
+ @Rule
+ public TemporaryFolder folder = new TemporaryFolder();
+
+ @Before
+ public void createTempDirectories() {
+ this.tempArchivesDirectory = folder.newFolder("archives");
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testArchivesDirectoryNull() {
+ new ArchiveWriter(null);
+ }
+}
+
diff --git a/test/org/torproject/ernie/db/BridgeSnapshotReaderTest.java b/test/org/torproject/ernie/db/BridgeSnapshotReaderTest.java
new file mode 100644
index 0000000..93d1642
--- /dev/null
+++ b/test/org/torproject/ernie/db/BridgeSnapshotReaderTest.java
@@ -0,0 +1,33 @@
+/* Copyright 2011 The Tor Project
+ * See LICENSE for licensing information */
+package org.torproject.ernie.test;
+
+import org.torproject.ernie.db.*;
+
+import java.io.*;
+
+import org.junit.*;
+import org.junit.rules.*;
+import static org.junit.Assert.*;
+
+public class BridgeSnapshotReaderTest {
+
+ private File tempBridgeDirectoriesDirectory;
+ private File tempStatsDirectory;
+
+ @Rule
+ public TemporaryFolder folder = new TemporaryFolder();
+
+ @Before
+ public void createTempDirectories() {
+ this.tempBridgeDirectoriesDirectory = folder.newFolder("bridges");
+ this.tempStatsDirectory = folder.newFolder("stats");
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testBridgeDescriptorParserNull() {
+ new BridgeSnapshotReader(null, this.tempBridgeDirectoriesDirectory,
+ this.tempStatsDirectory);
+ }
+}
+
diff --git a/test/org/torproject/ernie/db/CachedRelayDescriptorReaderTest.java b/test/org/torproject/ernie/db/CachedRelayDescriptorReaderTest.java
new file mode 100644
index 0000000..b856fb0
--- /dev/null
+++ b/test/org/torproject/ernie/db/CachedRelayDescriptorReaderTest.java
@@ -0,0 +1,32 @@
+/* Copyright 2011 The Tor Project
+ * See LICENSE for licensing information */
+package org.torproject.ernie.db;
+
+import org.torproject.ernie.db.*;
+
+import java.io.*;
+import java.util.*;
+
+import org.junit.*;
+import org.junit.rules.*;
+import static org.junit.Assert.*;
+
+public class CachedRelayDescriptorReaderTest {
+
+ private File tempStatsDirectory;
+
+ @Rule
+ public TemporaryFolder folder = new TemporaryFolder();
+
+ @Before
+ public void createTempDirectories() {
+ this.tempStatsDirectory = folder.newFolder("stats");
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testRelayDescriptorParserNull() {
+ new CachedRelayDescriptorReader(null, new ArrayList<String>(),
+ this.tempStatsDirectory);
+ }
+}
+
diff --git a/test/org/torproject/ernie/db/SanitizedBridgesWriterTest.java b/test/org/torproject/ernie/db/SanitizedBridgesWriterTest.java
new file mode 100644
index 0000000..dd05870
--- /dev/null
+++ b/test/org/torproject/ernie/db/SanitizedBridgesWriterTest.java
@@ -0,0 +1,39 @@
+/* Copyright 2011 The Tor Project
+ * See LICENSE for licensing information */
+package org.torproject.ernie.db;
+
+import org.torproject.ernie.db.*;
+
+import java.io.*;
+
+import org.junit.*;
+import org.junit.rules.*;
+import static org.junit.Assert.*;
+
+public class SanitizedBridgesWriterTest {
+
+ private File tempSanitizedBridgesDirectory;
+ private File tempStatsDirectory;
+
+ @Rule
+ public TemporaryFolder folder = new TemporaryFolder();
+
+ @Before
+ public void createTempDirectories() {
+ this.tempSanitizedBridgesDirectory =
+ folder.newFolder("sanitized-bridges");
+ this.tempStatsDirectory = folder.newFolder("stats");
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testSanitizedBridgesDirectoryNull() {
+ new SanitizedBridgesWriter(null, this.tempStatsDirectory, false, -1L);
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testStatsDirectoryNull() {
+ new SanitizedBridgesWriter(this.tempSanitizedBridgesDirectory, null,
+ false, -1L);
+ }
+}
+
More information about the tor-commits
mailing list