Skip to content
Snippets Groups Projects
Commit ac00d7a0 authored by iwakeh's avatar iwakeh
Browse files

Implement #19373 and add one word to comment in build.xml.

parent 050a88ff
Branches
Tags
No related merge requests found
......@@ -224,7 +224,7 @@
</target>
<target name="test" depends="compile,compile-tests">
<junit fork="true" haltonfailure="true" printsummary="off">
<!-- The following jvmargs prevent test access to the network. -->
<!-- The following two jvmargs prevent test access to the network. -->
<jvmarg value="-Djava.security.policy=${testresources}/junittest.policy"/>
<jvmarg value="-Djava.security.manager"/>
<jvmarg value="-DLOGBASE=${generated}/test-logs"/>
......
......@@ -7,6 +7,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.fail;
import org.torproject.collector.conf.Key;
import org.torproject.collector.conf.ConfigurationException;
......@@ -23,6 +24,7 @@ import java.security.AccessControlException;
import java.security.Policy;
import java.util.Arrays;
import java.util.List;
import java.util.Properties;
import java.util.Random;
import org.junit.rules.TemporaryFolder;
......@@ -69,4 +71,25 @@ public class MainTest {
bw.close();
}
/* Verifies the contents of the default collector.properties file.
All properties specified have to be present but nothing else. */
@Test()
public void testPropertiesFile() throws Exception {
Properties props = new Properties();
props.load(getClass().getClassLoader().getResourceAsStream(Main.CONF_FILE));
for (Key key : Key.values()) {
assertNotNull("Property '" + key.name() + "' not specified in "
+ Main.CONF_FILE + ".",
props.getProperty(key.name()));
}
for (String propName : props.stringPropertyNames()) {
try {
Key.valueOf(propName);
} catch (IllegalArgumentException ex) {
fail("Invalid property name '" + propName + "' found in "
+ Main.CONF_FILE + ".");
}
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment