[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [metrics-lib/release] Make tests and benchmark compile; tests fail currently.
commit 5148de226742ac2d451db01dfc4f0233850ce303
Author: iwakeh <iwakeh@xxxxxxxxxxxxxx>
Date: Fri Jun 23 08:37:47 2017 +0000
Make tests and benchmark compile; tests fail currently.
Part of task-22154.
---
.../descriptor/DescriptorSourceFactoryTest.java | 15 +-
.../descriptor/benchmark/MeasurePerformance.java | 160 ++++++++++-----------
.../descriptor/impl/BridgeNetworkStatusTest.java | 25 ++--
.../descriptor/impl/ConsensusBuilder.java | 71 +++++----
.../descriptor/impl/DescriptorImplTest.java | 4 +-
.../descriptor/impl/DescriptorParserImplTest.java | 4 +-
.../descriptor/impl/DescriptorReaderImplTest.java | 38 ++---
.../descriptor/impl/ExitListImplTest.java | 22 +--
.../impl/ExtraInfoDescriptorImplTest.java | 70 +++++----
.../descriptor/impl/MicrodescriptorImplTest.java | 10 +-
.../impl/RelayNetworkStatusConsensusImplTest.java | 52 ++++---
.../impl/RelayNetworkStatusVoteImplTest.java | 97 +++++++------
.../descriptor/impl/ServerDescriptorImplTest.java | 83 ++++++-----
.../torproject/descriptor/impl/TestDescriptor.java | 5 +-
.../descriptor/impl/TestServerDescriptor.java | 8 +-
.../descriptor/impl/TorperfResultImplTest.java | 10 +-
16 files changed, 309 insertions(+), 365 deletions(-)
diff --git a/src/test/java/org/torproject/descriptor/DescriptorSourceFactoryTest.java b/src/test/java/org/torproject/descriptor/DescriptorSourceFactoryTest.java
index 69d4193..3a9d502 100644
--- a/src/test/java/org/torproject/descriptor/DescriptorSourceFactoryTest.java
+++ b/src/test/java/org/torproject/descriptor/DescriptorSourceFactoryTest.java
@@ -8,14 +8,11 @@ import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.torproject.descriptor.DescriptorSourceFactory.COLLECTOR_DEFAULT;
import static org.torproject.descriptor.DescriptorSourceFactory.COLLECTOR_PROPERTY;
-import static org.torproject.descriptor.DescriptorSourceFactory.DOWNLOADER_DEFAULT;
-import static org.torproject.descriptor.DescriptorSourceFactory.DOWNLOADER_PROPERTY;
import static org.torproject.descriptor.DescriptorSourceFactory.PARSER_DEFAULT;
import static org.torproject.descriptor.DescriptorSourceFactory.PARSER_PROPERTY;
import static org.torproject.descriptor.DescriptorSourceFactory.READER_DEFAULT;
import static org.torproject.descriptor.DescriptorSourceFactory.READER_PROPERTY;
-import org.torproject.descriptor.impl.DescriptorDownloaderImpl;
import org.torproject.descriptor.impl.DescriptorParserImpl;
import org.torproject.descriptor.impl.DescriptorReaderImpl;
import org.torproject.descriptor.index.DescriptorIndexCollector;
@@ -28,10 +25,10 @@ import java.lang.reflect.Method;
public class DescriptorSourceFactoryTest {
private static final String[] properties = new String[] { COLLECTOR_PROPERTY,
- DOWNLOADER_PROPERTY, PARSER_PROPERTY, READER_PROPERTY };
+ PARSER_PROPERTY, READER_PROPERTY };
private static final String[] defaults = new String[] { COLLECTOR_DEFAULT,
- DOWNLOADER_DEFAULT, PARSER_DEFAULT, READER_DEFAULT };
+ PARSER_DEFAULT, READER_DEFAULT };
@Test
public void testDefaults() {
@@ -39,9 +36,6 @@ public class DescriptorSourceFactoryTest {
DescriptorCollector dc =
DescriptorSourceFactory.createDescriptorCollector();
assertTrue(dc instanceof DescriptorIndexCollector);
- DescriptorDownloader dd =
- DescriptorSourceFactory.createDescriptorDownloader();
- assertTrue(dd instanceof DescriptorDownloaderImpl);
DescriptorParser dp = DescriptorSourceFactory.createDescriptorParser();
assertTrue(dp instanceof DescriptorParserImpl);
DescriptorReader dr = DescriptorSourceFactory.createDescriptorReader();
@@ -85,17 +79,12 @@ public class DescriptorSourceFactoryTest {
public void testProperties() {
setProperties(new String[] {
"org.torproject.descriptor.DummyCollectorImplementation",
- "org.torproject.descriptor.DummyDownloaderImplementation",
"org.torproject.descriptor.DummyParserImplementation",
"org.torproject.descriptor.DummyReaderImplementation" });
DescriptorCollector dc =
DescriptorSourceFactory.createDescriptorCollector();
assertTrue(dc instanceof DummyCollectorImplementation);
assertEquals(1, DummyCollectorImplementation.count);
- DescriptorDownloader dd =
- DescriptorSourceFactory.createDescriptorDownloader();
- assertTrue(dd instanceof DummyDownloaderImplementation);
- assertEquals(1, DummyDownloaderImplementation.count);
DescriptorParser dp = DescriptorSourceFactory.createDescriptorParser();
assertTrue(dp instanceof DummyParserImplementation);
assertEquals(1, DummyParserImplementation.count);
diff --git a/src/test/java/org/torproject/descriptor/benchmark/MeasurePerformance.java b/src/test/java/org/torproject/descriptor/benchmark/MeasurePerformance.java
index a0c923c..83faf05 100644
--- a/src/test/java/org/torproject/descriptor/benchmark/MeasurePerformance.java
+++ b/src/test/java/org/torproject/descriptor/benchmark/MeasurePerformance.java
@@ -4,7 +4,7 @@
package org.torproject.descriptor.benchmark;
import org.torproject.descriptor.Descriptor;
-import org.torproject.descriptor.DescriptorFile;
+import org.torproject.descriptor.DescriptorParseException;
import org.torproject.descriptor.DescriptorReader;
import org.torproject.descriptor.DescriptorSourceFactory;
import org.torproject.descriptor.ExtraInfoDescriptor;
@@ -94,23 +94,19 @@ public class MeasurePerformance {
long countedServerDescriptors = 0;
DescriptorReader descriptorReader =
DescriptorSourceFactory.createDescriptorReader();
- descriptorReader.addTarball(tarballFileOrDirectory);
- descriptorReader.addDirectory(tarballFileOrDirectory);
- Iterator<DescriptorFile> descriptorFiles =
- descriptorReader.readDescriptors();
- while (descriptorFiles.hasNext()) {
- DescriptorFile descriptorFile = descriptorFiles.next();
- for (Descriptor descriptor : descriptorFile.getDescriptors()) {
- if (!(descriptor instanceof ServerDescriptor)) {
- continue;
- }
- ServerDescriptor serverDescriptor = (ServerDescriptor) descriptor;
- sumAdvertisedBandwidth += (long) Math.min(Math.min(
- serverDescriptor.getBandwidthRate(),
- serverDescriptor.getBandwidthBurst()),
- serverDescriptor.getBandwidthObserved());
- countedServerDescriptors++;
+ Iterator<Descriptor> descriptors =
+ descriptorReader.readDescriptors(tarballFileOrDirectory).iterator();
+ while (descriptors.hasNext()) {
+ Descriptor descriptor = descriptors.next();
+ if (!(descriptor instanceof ServerDescriptor)) {
+ continue;
}
+ ServerDescriptor serverDescriptor = (ServerDescriptor) descriptor;
+ sumAdvertisedBandwidth += (long) Math.min(Math.min(
+ serverDescriptor.getBandwidthRate(),
+ serverDescriptor.getBandwidthBurst()),
+ serverDescriptor.getBandwidthObserved());
+ countedServerDescriptors++;
}
long endedMillis = System.currentTimeMillis();
System.out.println("Ending measureAverageAdvertisedBandwidth");
@@ -132,24 +128,21 @@ public class MeasurePerformance {
long countedExtraInfoDescriptors = 0;
DescriptorReader descriptorReader =
DescriptorSourceFactory.createDescriptorReader();
- descriptorReader.addTarball(tarballFile);
- Iterator<DescriptorFile> descriptorFiles =
- descriptorReader.readDescriptors();
- while (descriptorFiles.hasNext()) {
- DescriptorFile descriptorFile = descriptorFiles.next();
- for (Descriptor descriptor : descriptorFile.getDescriptors()) {
- if (!(descriptor instanceof ExtraInfoDescriptor)) {
- continue;
- }
- ExtraInfoDescriptor extraInfoDescriptor =
- (ExtraInfoDescriptor) descriptor;
- SortedMap<String, Integer> dirreqV3Reqs =
- extraInfoDescriptor.getDirreqV3Reqs();
- if (dirreqV3Reqs != null) {
- countries.addAll(dirreqV3Reqs.keySet());
- }
- countedExtraInfoDescriptors++;
+ Iterator<Descriptor> descriptors =
+ descriptorReader.readDescriptors(tarballFile).iterator();
+ while (descriptors.hasNext()) {
+ Descriptor descriptor = descriptors.next();
+ if (!(descriptor instanceof ExtraInfoDescriptor)) {
+ continue;
}
+ ExtraInfoDescriptor extraInfoDescriptor =
+ (ExtraInfoDescriptor) descriptor;
+ SortedMap<String, Integer> dirreqV3Reqs =
+ extraInfoDescriptor.getDirreqV3Reqs();
+ if (dirreqV3Reqs != null) {
+ countries.addAll(dirreqV3Reqs.keySet());
+ }
+ countedExtraInfoDescriptors++;
}
long endedMillis = System.currentTimeMillis();
System.out.println("Ending measureCountriesV3Requests");
@@ -173,27 +166,23 @@ public class MeasurePerformance {
long countedConsensuses = 0L;
DescriptorReader descriptorReader =
DescriptorSourceFactory.createDescriptorReader();
- descriptorReader.addTarball(tarballFileOrDirectory);
- descriptorReader.addDirectory(tarballFileOrDirectory);
- Iterator<DescriptorFile> descriptorFiles =
- descriptorReader.readDescriptors();
- while (descriptorFiles.hasNext()) {
- DescriptorFile descriptorFile = descriptorFiles.next();
- for (Descriptor descriptor : descriptorFile.getDescriptors()) {
- if (!(descriptor instanceof RelayNetworkStatusConsensus)) {
- continue;
- }
- RelayNetworkStatusConsensus consensus =
- (RelayNetworkStatusConsensus) descriptor;
- for (NetworkStatusEntry entry :
- consensus.getStatusEntries().values()) {
- if (entry.getFlags().contains("Exit")) {
- totalRelaysWithExitFlag++;
- }
- totalRelays++;
+ Iterator<Descriptor> descriptors =
+ descriptorReader.readDescriptors(tarballFileOrDirectory).iterator();
+ while (descriptors.hasNext()) {
+ Descriptor descriptor = descriptors.next();
+ if (!(descriptor instanceof RelayNetworkStatusConsensus)) {
+ continue;
+ }
+ RelayNetworkStatusConsensus consensus =
+ (RelayNetworkStatusConsensus) descriptor;
+ for (NetworkStatusEntry entry :
+ consensus.getStatusEntries().values()) {
+ if (entry.getFlags().contains("Exit")) {
+ totalRelaysWithExitFlag++;
}
- countedConsensuses++;
+ totalRelays++;
}
+ countedConsensuses++;
}
long endedMillis = System.currentTimeMillis();
System.out.println("Ending measureAverageRelaysExit");
@@ -220,45 +209,42 @@ public class MeasurePerformance {
long countedMicrodescriptors = 0L;
DescriptorReader descriptorReader =
DescriptorSourceFactory.createDescriptorReader();
- descriptorReader.addTarball(tarballFile);
- Iterator<DescriptorFile> descriptorFiles =
- descriptorReader.readDescriptors();
- while (descriptorFiles.hasNext()) {
- DescriptorFile descriptorFile = descriptorFiles.next();
- for (Descriptor descriptor : descriptorFile.getDescriptors()) {
- if (!(descriptor instanceof Microdescriptor)) {
- continue;
- }
- countedMicrodescriptors++;
- Microdescriptor microdescriptor =
- (Microdescriptor) descriptor;
- String defaultPolicy = microdescriptor.getDefaultPolicy();
- if (defaultPolicy == null) {
- continue;
- }
- boolean accept = "accept".equals(
- microdescriptor.getDefaultPolicy());
- for (String ports : microdescriptor.getPortList().split(",")) {
- if (ports.contains("-")) {
- String[] parts = ports.split("-");
- int from = Integer.parseInt(parts[0]);
- int to = Integer.parseInt(parts[1]);
- if (from <= 80 && to >= 80) {
- if (accept) {
- totalRelaysWithExitFlag++;
- }
- } else if (to > 80) {
- if (!accept) {
- totalRelaysWithExitFlag++;
- }
- break;
- }
- } else if ("80".equals(ports)) {
+ Iterator<Descriptor> descriptors =
+ descriptorReader.readDescriptors(tarballFile).iterator();
+ while (descriptors.hasNext()) {
+ Descriptor descriptor = descriptors.next();
+ if (!(descriptor instanceof Microdescriptor)) {
+ continue;
+ }
+ countedMicrodescriptors++;
+ Microdescriptor microdescriptor =
+ (Microdescriptor) descriptor;
+ String defaultPolicy = microdescriptor.getDefaultPolicy();
+ if (defaultPolicy == null) {
+ continue;
+ }
+ boolean accept = "accept".equals(
+ microdescriptor.getDefaultPolicy());
+ for (String ports : microdescriptor.getPortList().split(",")) {
+ if (ports.contains("-")) {
+ String[] parts = ports.split("-");
+ int from = Integer.parseInt(parts[0]);
+ int to = Integer.parseInt(parts[1]);
+ if (from <= 80 && to >= 80) {
if (accept) {
totalRelaysWithExitFlag++;
}
+ } else if (to > 80) {
+ if (!accept) {
+ totalRelaysWithExitFlag++;
+ }
break;
}
+ } else if ("80".equals(ports)) {
+ if (accept) {
+ totalRelaysWithExitFlag++;
+ }
+ break;
}
}
}
diff --git a/src/test/java/org/torproject/descriptor/impl/BridgeNetworkStatusTest.java b/src/test/java/org/torproject/descriptor/impl/BridgeNetworkStatusTest.java
index c44de6d..22d24fd 100644
--- a/src/test/java/org/torproject/descriptor/impl/BridgeNetworkStatusTest.java
+++ b/src/test/java/org/torproject/descriptor/impl/BridgeNetworkStatusTest.java
@@ -30,7 +30,7 @@ public class BridgeNetworkStatusTest {
throws DescriptorParseException {
StatusBuilder sb = new StatusBuilder();
sb.fileName = fileName;
- return sb.buildStatus(true);
+ return sb.buildStatus();
}
private String publishedLine = "published 2015-11-21 17:39:36";
@@ -40,7 +40,7 @@ public class BridgeNetworkStatusTest {
throws DescriptorParseException {
StatusBuilder sb = new StatusBuilder();
sb.publishedLine = line;
- return sb.buildStatus(true);
+ return sb.buildStatus();
}
private String flagThresholdsLine = "flag-thresholds "
@@ -54,7 +54,7 @@ public class BridgeNetworkStatusTest {
throws DescriptorParseException {
StatusBuilder sb = new StatusBuilder();
sb.flagThresholdsLine = line;
- return sb.buildStatus(true);
+ return sb.buildStatus();
}
private List<String> statusEntries = new ArrayList<>();
@@ -62,23 +62,21 @@ public class BridgeNetworkStatusTest {
private String unrecognizedHeaderLine = null;
protected static BridgeNetworkStatus
- createWithUnrecognizedHeaderLine(String line,
- boolean failUnrecognizedDescriptorLines)
+ createWithUnrecognizedHeaderLine(String line)
throws DescriptorParseException {
StatusBuilder sb = new StatusBuilder();
sb.unrecognizedHeaderLine = line;
- return sb.buildStatus(failUnrecognizedDescriptorLines);
+ return sb.buildStatus();
}
private String unrecognizedStatusEntryLine = null;
protected static BridgeNetworkStatus
- createWithUnrecognizedStatusEntryLine(String line,
- boolean failUnrecognizedDescriptorLines)
+ createWithUnrecognizedStatusEntryLine(String line)
throws DescriptorParseException {
StatusBuilder sb = new StatusBuilder();
sb.unrecognizedStatusEntryLine = line;
- return sb.buildStatus(failUnrecognizedDescriptorLines);
+ return sb.buildStatus();
}
private StatusBuilder() {
@@ -95,13 +93,10 @@ public class BridgeNetworkStatusTest {
return sb.toString().getBytes();
}
- private BridgeNetworkStatus buildStatus(
- boolean failUnrecognizedDescriptorLines)
- throws DescriptorParseException {
+ private BridgeNetworkStatus buildStatus() throws DescriptorParseException {
byte[] statusBytes = this.buildStatusBytes();
return new BridgeNetworkStatusImpl(statusBytes,
- new int[] { 0, statusBytes.length }, null, this.fileName,
- failUnrecognizedDescriptorLines);
+ new int[] { 0, statusBytes.length }, null, this.fileName);
}
private void appendHeader(StringBuilder sb) {
@@ -129,7 +124,7 @@ public class BridgeNetworkStatusTest {
@Test
public void testSampleStatus() throws DescriptorParseException {
StatusBuilder sb = new StatusBuilder();
- BridgeNetworkStatus status = sb.buildStatus(true);
+ BridgeNetworkStatus status = sb.buildStatus();
assertEquals(1448127576000L, status.getPublishedMillis());
assertEquals(3105080L, status.getStableUptime());
assertEquals(2450615L, status.getStableMtbf());
diff --git a/src/test/java/org/torproject/descriptor/impl/ConsensusBuilder.java b/src/test/java/org/torproject/descriptor/impl/ConsensusBuilder.java
index 71bcd94..cb8d0aa 100644
--- a/src/test/java/org/torproject/descriptor/impl/ConsensusBuilder.java
+++ b/src/test/java/org/torproject/descriptor/impl/ConsensusBuilder.java
@@ -20,7 +20,7 @@ public class ConsensusBuilder {
throws DescriptorParseException {
ConsensusBuilder cb = new ConsensusBuilder();
cb.networkStatusVersionLine = line;
- return cb.buildConsensus(true);
+ return cb.buildConsensus();
}
private String voteStatusLine = "vote-status consensus";
@@ -30,7 +30,7 @@ public class ConsensusBuilder {
throws DescriptorParseException {
ConsensusBuilder cb = new ConsensusBuilder();
cb.voteStatusLine = line;
- return cb.buildConsensus(true);
+ return cb.buildConsensus();
}
private String consensusMethodLine = "consensus-method 11";
@@ -40,7 +40,7 @@ public class ConsensusBuilder {
throws DescriptorParseException {
ConsensusBuilder cb = new ConsensusBuilder();
cb.consensusMethodLine = line;
- return cb.buildConsensus(true);
+ return cb.buildConsensus();
}
private String validAfterLine = "valid-after 2011-11-30 09:00:00";
@@ -50,7 +50,7 @@ public class ConsensusBuilder {
throws DescriptorParseException {
ConsensusBuilder cb = new ConsensusBuilder();
cb.validAfterLine = line;
- return cb.buildConsensus(true);
+ return cb.buildConsensus();
}
private String freshUntilLine = "fresh-until 2011-11-30 10:00:00";
@@ -60,7 +60,7 @@ public class ConsensusBuilder {
throws DescriptorParseException {
ConsensusBuilder cb = new ConsensusBuilder();
cb.freshUntilLine = line;
- return cb.buildConsensus(true);
+ return cb.buildConsensus();
}
private String validUntilLine = "valid-until 2011-11-30 12:00:00";
@@ -70,7 +70,7 @@ public class ConsensusBuilder {
throws DescriptorParseException {
ConsensusBuilder cb = new ConsensusBuilder();
cb.validUntilLine = line;
- return cb.buildConsensus(true);
+ return cb.buildConsensus();
}
private String votingDelayLine = "voting-delay 300 300";
@@ -80,7 +80,7 @@ public class ConsensusBuilder {
throws DescriptorParseException {
ConsensusBuilder cb = new ConsensusBuilder();
cb.votingDelayLine = line;
- return cb.buildConsensus(true);
+ return cb.buildConsensus();
}
String clientVersionsLine = "client-versions 0.2.1.31,"
@@ -91,7 +91,7 @@ public class ConsensusBuilder {
throws DescriptorParseException {
ConsensusBuilder cb = new ConsensusBuilder();
cb.clientVersionsLine = line;
- return cb.buildConsensus(true);
+ return cb.buildConsensus();
}
String serverVersionsLine = "server-versions 0.2.1.31,"
@@ -102,7 +102,7 @@ public class ConsensusBuilder {
throws DescriptorParseException {
ConsensusBuilder cb = new ConsensusBuilder();
cb.serverVersionsLine = line;
- return cb.buildConsensus(true);
+ return cb.buildConsensus();
}
private String packageLines = null;
@@ -112,7 +112,7 @@ public class ConsensusBuilder {
throws DescriptorParseException {
ConsensusBuilder cb = new ConsensusBuilder();
cb.packageLines = lines;
- return cb.buildConsensus(true);
+ return cb.buildConsensus();
}
private String knownFlagsLine = "known-flags Authority BadExit Exit "
@@ -123,7 +123,7 @@ public class ConsensusBuilder {
throws DescriptorParseException {
ConsensusBuilder cb = new ConsensusBuilder();
cb.knownFlagsLine = line;
- return cb.buildConsensus(true);
+ return cb.buildConsensus();
}
private String recommendedClientProtocolsLine =
@@ -135,7 +135,7 @@ public class ConsensusBuilder {
throws DescriptorParseException {
ConsensusBuilder cb = new ConsensusBuilder();
cb.recommendedClientProtocolsLine = line;
- return cb.buildConsensus(true);
+ return cb.buildConsensus();
}
private String recommendedRelayProtocolsLine =
@@ -147,7 +147,7 @@ public class ConsensusBuilder {
throws DescriptorParseException {
ConsensusBuilder cb = new ConsensusBuilder();
cb.recommendedRelayProtocolsLine = line;
- return cb.buildConsensus(true);
+ return cb.buildConsensus();
}
private String requiredClientProtocolsLine =
@@ -159,7 +159,7 @@ public class ConsensusBuilder {
throws DescriptorParseException {
ConsensusBuilder cb = new ConsensusBuilder();
cb.requiredClientProtocolsLine = line;
- return cb.buildConsensus(true);
+ return cb.buildConsensus();
}
private String requiredRelayProtocolsLine =
@@ -171,7 +171,7 @@ public class ConsensusBuilder {
throws DescriptorParseException {
ConsensusBuilder cb = new ConsensusBuilder();
cb.requiredRelayProtocolsLine = line;
- return cb.buildConsensus(true);
+ return cb.buildConsensus();
}
private String paramsLine = "params "
@@ -185,7 +185,7 @@ public class ConsensusBuilder {
throws DescriptorParseException {
ConsensusBuilder cb = new ConsensusBuilder();
cb.paramsLine = line;
- return cb.buildConsensus(true);
+ return cb.buildConsensus();
}
private String sharedRandPreviousValueLine =
@@ -197,7 +197,7 @@ public class ConsensusBuilder {
throws DescriptorParseException {
ConsensusBuilder cb = new ConsensusBuilder();
cb.sharedRandPreviousValueLine = line;
- return cb.buildConsensus(true);
+ return cb.buildConsensus();
}
private String sharedRandCurrentValueLine =
@@ -209,7 +209,7 @@ public class ConsensusBuilder {
throws DescriptorParseException {
ConsensusBuilder cb = new ConsensusBuilder();
cb.sharedRandCurrentValueLine = line;
- return cb.buildConsensus(true);
+ return cb.buildConsensus();
}
List<String> dirSources = new ArrayList<>();
@@ -227,7 +227,7 @@ public class ConsensusBuilder {
throws DescriptorParseException {
ConsensusBuilder cb = new ConsensusBuilder();
cb.directoryFooterLine = line;
- return cb.buildConsensus(true);
+ return cb.buildConsensus();
}
private String bandwidthWeightsLine = "bandwidth-weights Wbd=285 "
@@ -244,7 +244,7 @@ public class ConsensusBuilder {
throws DescriptorParseException {
ConsensusBuilder cb = new ConsensusBuilder();
cb.bandwidthWeightsLine = line;
- return cb.buildConsensus(true);
+ return cb.buildConsensus();
}
private List<String> directorySignatures = new ArrayList<>();
@@ -256,56 +256,51 @@ public class ConsensusBuilder {
private String unrecognizedHeaderLine = null;
protected static RelayNetworkStatusConsensus
- createWithUnrecognizedHeaderLine(String line,
- boolean failUnrecognizedDescriptorLines)
+ createWithUnrecognizedHeaderLine(String line)
throws DescriptorParseException {
ConsensusBuilder cb = new ConsensusBuilder();
cb.unrecognizedHeaderLine = line;
- return cb.buildConsensus(failUnrecognizedDescriptorLines);
+ return cb.buildConsensus();
}
private String unrecognizedDirSourceLine = null;
protected static RelayNetworkStatusConsensus
- createWithUnrecognizedDirSourceLine(String line,
- boolean failUnrecognizedDescriptorLines)
+ createWithUnrecognizedDirSourceLine(String line)
throws DescriptorParseException {
ConsensusBuilder cb = new ConsensusBuilder();
cb.unrecognizedDirSourceLine = line;
- return cb.buildConsensus(failUnrecognizedDescriptorLines);
+ return cb.buildConsensus();
}
private String unrecognizedStatusEntryLine = null;
protected static RelayNetworkStatusConsensus
- createWithUnrecognizedStatusEntryLine(String line,
- boolean failUnrecognizedDescriptorLines)
+ createWithUnrecognizedStatusEntryLine(String line)
throws DescriptorParseException {
ConsensusBuilder cb = new ConsensusBuilder();
cb.unrecognizedStatusEntryLine = line;
- return cb.buildConsensus(failUnrecognizedDescriptorLines);
+ return cb.buildConsensus();
}
private String unrecognizedFooterLine = null;
protected static RelayNetworkStatusConsensus
- createWithUnrecognizedFooterLine(String line,
- boolean failUnrecognizedDescriptorLines)
+ createWithUnrecognizedFooterLine(String line)
throws DescriptorParseException {
ConsensusBuilder cb = new ConsensusBuilder();
cb.unrecognizedFooterLine = line;
- return cb.buildConsensus(failUnrecognizedDescriptorLines);
+ return cb.buildConsensus();
}
private String unrecognizedDirectorySignatureLine = null;
protected static RelayNetworkStatusConsensus
- createWithUnrecognizedDirectorySignatureLine(String line,
- boolean failUnrecognizedDescriptorLines)
+ createWithUnrecognizedDirectorySignatureLine(String line)
throws DescriptorParseException {
ConsensusBuilder cb = new ConsensusBuilder();
cb.unrecognizedDirectorySignatureLine = line;
- return cb.buildConsensus(failUnrecognizedDescriptorLines);
+ return cb.buildConsensus();
}
protected ConsensusBuilder() {
@@ -355,13 +350,11 @@ public class ConsensusBuilder {
return sb.toString().getBytes();
}
- protected RelayNetworkStatusConsensus buildConsensus(
- boolean failUnrecognizedDescriptorLines)
+ protected RelayNetworkStatusConsensus buildConsensus()
throws DescriptorParseException {
byte[] consensusBytes = this.buildConsensusBytes();
return new RelayNetworkStatusConsensusImpl(consensusBytes,
- new int[] { 0, consensusBytes.length }, null,
- failUnrecognizedDescriptorLines);
+ new int[] { 0, consensusBytes.length }, null);
}
private void appendHeader(StringBuilder sb) {
diff --git a/src/test/java/org/torproject/descriptor/impl/DescriptorImplTest.java b/src/test/java/org/torproject/descriptor/impl/DescriptorImplTest.java
index 543254d..cc97d1d 100644
--- a/src/test/java/org/torproject/descriptor/impl/DescriptorImplTest.java
+++ b/src/test/java/org/torproject/descriptor/impl/DescriptorImplTest.java
@@ -3,6 +3,8 @@
package org.torproject.descriptor.impl;
+import org.torproject.descriptor.DescriptorParseException;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
@@ -49,7 +51,7 @@ public class DescriptorImplTest {
}
private TestDescriptor makeTestDesc(byte[] bytes) throws Exception {
- return new TestDescriptor(bytes, new int[]{0, bytes.length}, false, false);
+ return new TestDescriptor(bytes, new int[]{0, bytes.length}, false);
}
@Test
diff --git a/src/test/java/org/torproject/descriptor/impl/DescriptorParserImplTest.java b/src/test/java/org/torproject/descriptor/impl/DescriptorParserImplTest.java
index 558a395..a2a3d9e 100644
--- a/src/test/java/org/torproject/descriptor/impl/DescriptorParserImplTest.java
+++ b/src/test/java/org/torproject/descriptor/impl/DescriptorParserImplTest.java
@@ -20,7 +20,7 @@ public class DescriptorParserImplTest {
public ExpectedException thrown = ExpectedException.none();
private TestDescriptor makeTestDesc(byte[] bytes) throws Exception {
- return new TestDescriptor(bytes, new int[]{0, bytes.length}, false, false);
+ return new TestDescriptor(bytes, new int[]{0, bytes.length}, false);
}
private static final String MICRO =
@@ -57,7 +57,7 @@ public class DescriptorParserImplTest {
+ "176x.158.53.63 44583 0 0' is not a valid IPv4 address.");
DescriptorParserImpl dpi = new DescriptorParserImpl();
dpi.parseDescriptor(DEFECT.getBytes(),
- new int[]{0, DEFECT.getBytes().length}, null, constructor, false);
+ new int[]{0, DEFECT.getBytes().length}, null, constructor);
}
private static final String DEFECT =
diff --git a/src/test/java/org/torproject/descriptor/impl/DescriptorReaderImplTest.java b/src/test/java/org/torproject/descriptor/impl/DescriptorReaderImplTest.java
index 0d3bdcf..fa791a2 100644
--- a/src/test/java/org/torproject/descriptor/impl/DescriptorReaderImplTest.java
+++ b/src/test/java/org/torproject/descriptor/impl/DescriptorReaderImplTest.java
@@ -5,7 +5,7 @@ package org.torproject.descriptor.impl;
import static org.junit.Assert.assertEquals;
-import org.torproject.descriptor.DescriptorFile;
+import org.torproject.descriptor.Descriptor;
import org.torproject.descriptor.DescriptorReader;
import org.junit.Before;
@@ -63,13 +63,13 @@ public class DescriptorReaderImplTest {
parseHistoryContents.getBytes(StandardCharsets.UTF_8));
}
- private int readAllDescriptors() {
- Iterator<DescriptorFile> descriptorFiles =
- this.descriptorReader.readDescriptors();
+ private int readAllDescriptors(File dir) {
+ Iterator<Descriptor> descriptors = this.descriptorReader
+ .readDescriptors(dir).iterator();
int count = 0;
- while (descriptorFiles.hasNext()) {
+ while (descriptors.hasNext()) {
count++;
- descriptorFiles.next();
+ descriptors.next();
}
return count;
}
@@ -88,14 +88,13 @@ public class DescriptorReaderImplTest {
@Test
public void testDescriptors() throws IOException {
- this.descriptorReader.addDirectory(this.inputDirectory);
- this.readAllDescriptors();
+ this.readAllDescriptors(this.inputDirectory);
this.assertExcludedFilesParsedFilesAndHistoryFileLines(0, 2, 1);
}
@Test
public void testNoDescriptors() throws IOException {
- this.readAllDescriptors();
+ this.readAllDescriptors(null);
this.assertExcludedFilesParsedFilesAndHistoryFileLines(0, 0, 1);
}
@@ -103,19 +102,15 @@ public class DescriptorReaderImplTest {
@SuppressWarnings("deprecation")
public void testSetExcludeFilesDescriptors() throws InterruptedException,
IOException {
- this.descriptorReader.setExcludeFiles(this.historyFile);
- this.descriptorReader.addDirectory(this.inputDirectory);
- this.readAllDescriptors();
+ this.readAllDescriptors(this.inputDirectory);
Thread.sleep(100L); /* It may take a moment to write the history file. */
this.assertExcludedFilesParsedFilesAndHistoryFileLines(1, 1, 2);
}
@Test
- @SuppressWarnings("deprecation")
public void testSetExcludeFilesNoDescriptors() throws InterruptedException,
IOException {
- this.descriptorReader.setExcludeFiles(this.historyFile);
- this.readAllDescriptors();
+ this.readAllDescriptors(this.inputDirectory);
Thread.sleep(100L); /* It may take a moment to write the history file. */
this.assertExcludedFilesParsedFilesAndHistoryFileLines(0, 0, 0);
}
@@ -123,8 +118,7 @@ public class DescriptorReaderImplTest {
@Test
public void testSetHistoryFileDescriptors() throws IOException {
this.descriptorReader.setHistoryFile(this.historyFile);
- this.descriptorReader.addDirectory(this.inputDirectory);
- this.readAllDescriptors();
+ this.readAllDescriptors(this.inputDirectory);
descriptorReader.saveHistoryFile(this.historyFile);
this.assertExcludedFilesParsedFilesAndHistoryFileLines(1, 1, 2);
}
@@ -132,7 +126,7 @@ public class DescriptorReaderImplTest {
@Test
public void testSetHistoryFileNoDescriptors() throws IOException {
this.descriptorReader.setHistoryFile(this.historyFile);
- this.readAllDescriptors();
+ this.readAllDescriptors(this.inputDirectory);
this.descriptorReader.saveHistoryFile(this.historyFile);
this.assertExcludedFilesParsedFilesAndHistoryFileLines(0, 0, 0);
}
@@ -140,15 +134,14 @@ public class DescriptorReaderImplTest {
@Test
public void testSetExcludedFilesDescriptors() throws IOException {
this.descriptorReader.setExcludedFiles(this.historyMap);
- this.descriptorReader.addDirectory(this.inputDirectory);
- this.readAllDescriptors();
+ this.readAllDescriptors(this.inputDirectory);
this.assertExcludedFilesParsedFilesAndHistoryFileLines(1, 1, 1);
}
@Test
public void testSetExcludedFilesNoDescriptors() throws IOException {
this.descriptorReader.setExcludedFiles(this.historyMap);
- this.readAllDescriptors();
+ this.readAllDescriptors(this.inputDirectory);
this.assertExcludedFilesParsedFilesAndHistoryFileLines(0, 0, 1);
}
@@ -157,8 +150,7 @@ public class DescriptorReaderImplTest {
File corruptHistoryFile = this.temporaryFolder.newFile("corruptHistory");
Files.write(corruptHistoryFile.toPath(),"1293145200000 \n ".getBytes());
this.descriptorReader.setHistoryFile(corruptHistoryFile);
- this.descriptorReader.addDirectory(this.inputDirectory);
- int count = this.readAllDescriptors();
+ int count = this.readAllDescriptors(this.inputDirectory);
assertEquals("Two files should have been parsed.", 2, count);
descriptorReader.saveHistoryFile(this.historyFile);
this.assertExcludedFilesParsedFilesAndHistoryFileLines(0, 2, 2);
diff --git a/src/test/java/org/torproject/descriptor/impl/ExitListImplTest.java b/src/test/java/org/torproject/descriptor/impl/ExitListImplTest.java
index 5f31341..dabea1e 100644
--- a/src/test/java/org/torproject/descriptor/impl/ExitListImplTest.java
+++ b/src/test/java/org/torproject/descriptor/impl/ExitListImplTest.java
@@ -7,7 +7,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import org.torproject.descriptor.DescriptorParseException;
-import org.torproject.descriptor.ExitListEntry;
+import org.torproject.descriptor.ExitList;
import org.junit.Rule;
import org.junit.Test;
@@ -24,7 +24,7 @@ public class ExitListImplTest {
@Test
public void testAnnotatedInput() throws Exception {
ExitListImpl result = new ExitListImpl((tordnselAnnotation + input)
- .getBytes("US-ASCII"), null, fileName, false);
+ .getBytes("US-ASCII"), null, fileName);
assertEquals("Expected one annotation.", 1,
result.getAnnotations().size());
assertEquals(tordnselAnnotation.substring(0, 18),
@@ -32,8 +32,8 @@ public class ExitListImplTest {
assertEquals(1441065722000L, result.getDownloadedMillis());
assertTrue("Unrecognized lines: " + result.getUnrecognizedLines(),
result.getUnrecognizedLines().isEmpty());
- assertEquals("Found: " + result.getExitListEntries(), 7,
- result.getExitListEntries().size());
+ assertEquals("Found: " + result.getEntries(), 7,
+ result.getEntries().size());
assertEquals("Found: " + result.getEntries(), 5,
result.getEntries().size());
}
@@ -42,16 +42,16 @@ public class ExitListImplTest {
public void testMultipleOldExitAddresses() throws Exception {
ExitListImpl result = new ExitListImpl(
(tordnselAnnotation + multiExitAddressInput)
- .getBytes("US-ASCII"), null, fileName, false);
+ .getBytes("US-ASCII"), null, fileName);
assertTrue("Unrecognized lines: " + result.getUnrecognizedLines(),
result.getUnrecognizedLines().isEmpty());
- assertEquals("Found: " + result.getExitListEntries(),
- 3, result.getExitListEntries().size());
+ assertEquals("Found: " + result.getEntries(),
+ 3, result.getEntries().size());
Map<String, Long> testMap = new HashMap();
testMap.put("81.7.17.171", 1441044592000L);
testMap.put("81.7.17.172", 1441044652000L);
testMap.put("81.7.17.173", 1441044712000L);
- for (ExitListEntry ele : result.getExitListEntries()) {
+ for (ExitList.Entry ele : result.getEntries()) {
Map<String, Long> map = ele.getExitAddresses();
assertEquals("Found: " + map, 1, map.size());
Map.Entry<String, Long> ea = map.entrySet().iterator().next();
@@ -68,7 +68,7 @@ public class ExitListImplTest {
public void testMultipleExitAddresses() throws Exception {
ExitListImpl result = new ExitListImpl(
(tordnselAnnotation + multiExitAddressInput)
- .getBytes("US-ASCII"), null, fileName, false);
+ .getBytes("US-ASCII"), null, fileName);
assertTrue("Unrecognized lines: " + result.getUnrecognizedLines(),
result.getUnrecognizedLines().isEmpty());
Map<String, Long> map = result.getEntries()
@@ -84,7 +84,7 @@ public class ExitListImplTest {
this.thrown.expect(DescriptorParseException.class);
this.thrown.expectMessage("Missing 'ExitAddress' line in exit list entry.");
new ExitListImpl((tordnselAnnotation + insufficientInput[0])
- .getBytes("US-ASCII"), null, fileName, false);
+ .getBytes("US-ASCII"), null, fileName);
}
@Test
@@ -92,7 +92,7 @@ public class ExitListImplTest {
this.thrown.expect(DescriptorParseException.class);
this.thrown.expectMessage("Missing 'Published' line in exit list entry.");
new ExitListImpl((tordnselAnnotation + insufficientInput[1])
- .getBytes("US-ASCII"), null, fileName, false);
+ .getBytes("US-ASCII"), null, fileName);
}
private static final String tordnselAnnotation = "@type tordnsel 1.0\n";
diff --git a/src/test/java/org/torproject/descriptor/impl/ExtraInfoDescriptorImplTest.java b/src/test/java/org/torproject/descriptor/impl/ExtraInfoDescriptorImplTest.java
index 82dd365..901aca8 100644
--- a/src/test/java/org/torproject/descriptor/impl/ExtraInfoDescriptorImplTest.java
+++ b/src/test/java/org/torproject/descriptor/impl/ExtraInfoDescriptorImplTest.java
@@ -43,7 +43,7 @@ public class ExtraInfoDescriptorImplTest {
String line) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.extraInfoLine = line;
- return db.buildDescriptor(true);
+ return db.buildDescriptor();
}
private String publishedLine = "published 2012-02-11 09:08:36";
@@ -52,7 +52,7 @@ public class ExtraInfoDescriptorImplTest {
String line) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.publishedLine = line;
- return db.buildDescriptor(true);
+ return db.buildDescriptor();
}
private String writeHistoryLine = "write-history 2012-02-11 09:03:39 "
@@ -62,7 +62,7 @@ public class ExtraInfoDescriptorImplTest {
String line) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.writeHistoryLine = line;
- return db.buildDescriptor(true);
+ return db.buildDescriptor();
}
private String readHistoryLine = "read-history 2012-02-11 09:03:39 "
@@ -72,7 +72,7 @@ public class ExtraInfoDescriptorImplTest {
String line) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.readHistoryLine = line;
- return db.buildDescriptor(true);
+ return db.buildDescriptor();
}
private String dirreqWriteHistoryLine = "dirreq-write-history "
@@ -83,7 +83,7 @@ public class ExtraInfoDescriptorImplTest {
String line) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.dirreqWriteHistoryLine = line;
- return db.buildDescriptor(true);
+ return db.buildDescriptor();
}
private String dirreqReadHistoryLine = "dirreq-read-history "
@@ -94,7 +94,7 @@ public class ExtraInfoDescriptorImplTest {
String line) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.dirreqReadHistoryLine = line;
- return db.buildDescriptor(true);
+ return db.buildDescriptor();
}
private String geoipDbDigestLine = null;
@@ -103,7 +103,7 @@ public class ExtraInfoDescriptorImplTest {
String line) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.geoipDbDigestLine = line;
- return db.buildDescriptor(true);
+ return db.buildDescriptor();
}
private String geoip6DbDigestLine = null;
@@ -112,7 +112,7 @@ public class ExtraInfoDescriptorImplTest {
String line) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.geoip6DbDigestLine = line;
- return db.buildDescriptor(true);
+ return db.buildDescriptor();
}
private String geoipStatsLines = null;
@@ -121,7 +121,7 @@ public class ExtraInfoDescriptorImplTest {
String lines) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.geoipStatsLines = lines;
- return db.buildDescriptor(true);
+ return db.buildDescriptor();
}
private String dirreqStatsLines = null;
@@ -130,7 +130,7 @@ public class ExtraInfoDescriptorImplTest {
String lines) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.dirreqStatsLines = lines;
- return db.buildDescriptor(true);
+ return db.buildDescriptor();
}
private String entryStatsLines = null;
@@ -139,7 +139,7 @@ public class ExtraInfoDescriptorImplTest {
String lines) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.entryStatsLines = lines;
- return db.buildDescriptor(true);
+ return db.buildDescriptor();
}
private String cellStatsLines = null;
@@ -148,7 +148,7 @@ public class ExtraInfoDescriptorImplTest {
String lines) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.cellStatsLines = lines;
- return db.buildDescriptor(true);
+ return db.buildDescriptor();
}
private String connBiDirectLine = null;
@@ -157,7 +157,7 @@ public class ExtraInfoDescriptorImplTest {
String line) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.connBiDirectLine = line;
- return db.buildDescriptor(true);
+ return db.buildDescriptor();
}
private String exitStatsLines = null;
@@ -166,7 +166,7 @@ public class ExtraInfoDescriptorImplTest {
String lines) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.exitStatsLines = lines;
- return db.buildDescriptor(true);
+ return db.buildDescriptor();
}
private String bridgeStatsLines = null;
@@ -175,7 +175,7 @@ public class ExtraInfoDescriptorImplTest {
String lines) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.bridgeStatsLines = lines;
- return db.buildDescriptor(true);
+ return db.buildDescriptor();
}
private String hidservStatsLines = null;
@@ -184,7 +184,7 @@ public class ExtraInfoDescriptorImplTest {
String lines) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.hidservStatsLines = lines;
- return db.buildDescriptor(true);
+ return db.buildDescriptor();
}
private String paddingCountsLine = null;
@@ -193,27 +193,27 @@ public class ExtraInfoDescriptorImplTest {
String line) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.paddingCountsLine = line;
- return db.buildDescriptor(true);
+ return db.buildDescriptor();
}
private String unrecognizedLine = null;
private static ExtraInfoDescriptor createWithUnrecognizedLine(
- String line, boolean failUnrecognizedDescriptorLines)
+ String line)
throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.unrecognizedLine = line;
- return db.buildDescriptor(failUnrecognizedDescriptorLines);
+ return db.buildDescriptor();
}
private byte[] nonAsciiLineBytes = null;
private static ExtraInfoDescriptor createWithNonAsciiLineBytes(
- byte[] lineBytes, boolean failUnrecognizedDescriptorLines)
+ byte[] lineBytes)
throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.nonAsciiLineBytes = lineBytes;
- return db.buildDescriptor(failUnrecognizedDescriptorLines);
+ return db.buildDescriptor();
}
private String routerSignatureLines = "router-signature\n"
@@ -227,7 +227,7 @@ public class ExtraInfoDescriptorImplTest {
String line) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.routerSignatureLines = line;
- return db.buildDescriptor(true);
+ return db.buildDescriptor();
}
private String identityEd25519Lines = null;
@@ -243,7 +243,7 @@ public class ExtraInfoDescriptorImplTest {
db.identityEd25519Lines = identityEd25519Lines;
db.masterKeyEd25519Line = masterKeyEd25519Line;
db.routerSigEd25519Line = routerSigEd25519Line;
- return db.buildDescriptor(true);
+ return db.buildDescriptor();
}
private byte[] buildDescriptorBytes() {
@@ -331,13 +331,11 @@ public class ExtraInfoDescriptorImplTest {
return sb.toString().getBytes();
}
- private ExtraInfoDescriptor buildDescriptor(
- boolean failUnrecognizedDescriptorLines)
+ private ExtraInfoDescriptor buildDescriptor()
throws DescriptorParseException {
byte[] descriptorBytes = this.buildDescriptorBytes();
return new RelayExtraInfoDescriptorImpl(descriptorBytes,
- new int[] { 0, descriptorBytes.length}, null,
- failUnrecognizedDescriptorLines);
+ new int[] { 0, descriptorBytes.length}, null);
}
}
@@ -954,7 +952,7 @@ public class ExtraInfoDescriptorImplTest {
@Test
public void testSampleDescriptor() throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
- ExtraInfoDescriptor descriptor = db.buildDescriptor(true);
+ ExtraInfoDescriptor descriptor = db.buildDescriptor();
assertEquals("chaoscomputerclub5", descriptor.getNickname());
assertEquals("A9C039A5FD02FCA06303DCFAABE25C5912C63B26",
descriptor.getFingerprint());
@@ -1229,7 +1227,7 @@ public class ExtraInfoDescriptorImplTest {
+ "yblgrXtEgF3glaKv5ZvHhRREUI1t1c37SxparXSmYR4Q1yiK5zg4HE8eT9ILPRW9"
+ "3I5W/pZGQxL8Bu42dGjnAQ");
assertEquals("916A3CA8B7DF61473D5AE5B21711F35F301CE9E8",
- descriptor.getGeoipDbDigest());
+ descriptor.getGeoipDbDigestSha1Hex());
}
@Test
@@ -1249,7 +1247,7 @@ public class ExtraInfoDescriptorImplTest {
+ "yblgrXtEgF3glaKv5ZvHhRREUI1t1c37SxparXSmYR4Q1yiK5zg4HE8eT9ILPRW9"
+ "3I5W/pZGQxL8Bu42dGjnAQ");
assertEquals("916A3CA8B7DF61473D5AE5B21711F35F301CE9E8",
- descriptor.getGeoip6DbDigest());
+ descriptor.getGeoip6DbDigestSha1Hex());
}
@Test
@@ -1886,7 +1884,7 @@ public class ExtraInfoDescriptorImplTest {
DescriptorBuilder.createWithNonAsciiLineBytes(new byte[] {
0x14, (byte) 0xfe, 0x18, // non-ascii chars
0x62, 0x72, 0x69, 0x64, 0x67, 0x65, 0x2d, // "bridge-"
- 0x69, 0x70, 0x73 }, false); // "ips" (no newline)
+ 0x69, 0x70, 0x73 }); // "ips" (no newline)
}
@Test
@@ -2167,7 +2165,7 @@ public class ExtraInfoDescriptorImplTest {
this.thrown.expectMessage("Unrecognized line 'unrecognized-line 1' in "
+ "extra-info descriptor.");
String unrecognizedLine = "unrecognized-line 1";
- DescriptorBuilder.createWithUnrecognizedLine(unrecognizedLine, true);
+ DescriptorBuilder.createWithUnrecognizedLine(unrecognizedLine);
}
@Test
@@ -2175,7 +2173,7 @@ public class ExtraInfoDescriptorImplTest {
throws DescriptorParseException {
String unrecognizedLine = "unrecognized-line 1";
ExtraInfoDescriptor descriptor = DescriptorBuilder
- .createWithUnrecognizedLine(unrecognizedLine, false);
+ .createWithUnrecognizedLine(unrecognizedLine);
List<String> unrecognizedLines = new ArrayList<>();
unrecognizedLines.add(unrecognizedLine);
assertEquals(unrecognizedLines, descriptor.getUnrecognizedLines());
@@ -2332,7 +2330,7 @@ public class ExtraInfoDescriptorImplTest {
+ "").getBytes();
RelayExtraInfoDescriptor descriptor =
new RelayExtraInfoDescriptorImpl(descriptorBytes,
- new int[] { 0, descriptorBytes.length }, null, true);
+ new int[] { 0, descriptorBytes.length }, null);
assertEquals("Pt1BtzfRwhYqGCDo8jjchS8nJP3ovrDyHGn+dqPbMgw",
descriptor.getDigestSha256Base64());
}
@@ -2357,7 +2355,7 @@ public class ExtraInfoDescriptorImplTest {
.getBytes();
BridgeExtraInfoDescriptor descriptor =
new BridgeExtraInfoDescriptorImpl(descriptorBytes,
- new int[] { 0, descriptorBytes.length }, null, true);
+ new int[] { 0, descriptorBytes.length }, null);
assertEquals("TvrqpjI7OmCtwGwair/NHUxg5ROVVQYz6/EDyXsDHR4",
descriptor.getDigestSha256Base64());
}
@@ -2379,7 +2377,7 @@ public class ExtraInfoDescriptorImplTest {
.getBytes();
BridgeExtraInfoDescriptor descriptor =
new BridgeExtraInfoDescriptorImpl(descriptorBytes,
- new int[] { 0, descriptorBytes.length }, null, true);
+ new int[] { 0, descriptorBytes.length }, null);
assertNull(descriptor.getDigestSha1Hex());
assertNull(descriptor.getDigestSha256Base64());
}
diff --git a/src/test/java/org/torproject/descriptor/impl/MicrodescriptorImplTest.java b/src/test/java/org/torproject/descriptor/impl/MicrodescriptorImplTest.java
index f5c9131..a99895f 100644
--- a/src/test/java/org/torproject/descriptor/impl/MicrodescriptorImplTest.java
+++ b/src/test/java/org/torproject/descriptor/impl/MicrodescriptorImplTest.java
@@ -32,7 +32,7 @@ public class MicrodescriptorImplTest {
private static Microdescriptor createWithDefaultLines()
throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
- return db.buildDescriptor(true);
+ return db.buildDescriptor();
}
private String ntorOnionKeyLine =
@@ -44,7 +44,7 @@ public class MicrodescriptorImplTest {
throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.idLine = line;
- return db.buildDescriptor(true);
+ return db.buildDescriptor();
}
private byte[] buildDescriptorBytes() {
@@ -61,13 +61,11 @@ public class MicrodescriptorImplTest {
return sb.toString().getBytes();
}
- private Microdescriptor buildDescriptor(
- boolean failUnrecognizedDescriptorLines)
+ private Microdescriptor buildDescriptor()
throws DescriptorParseException {
byte[] descriptorBytes = this.buildDescriptorBytes();
return new MicrodescriptorImpl(descriptorBytes,
- new int[] { 0, descriptorBytes.length }, null,
- failUnrecognizedDescriptorLines);
+ new int[] { 0, descriptorBytes.length }, null);
}
}
diff --git a/src/test/java/org/torproject/descriptor/impl/RelayNetworkStatusConsensusImplTest.java b/src/test/java/org/torproject/descriptor/impl/RelayNetworkStatusConsensusImplTest.java
index 4793e76..02b89e1 100644
--- a/src/test/java/org/torproject/descriptor/impl/RelayNetworkStatusConsensusImplTest.java
+++ b/src/test/java/org/torproject/descriptor/impl/RelayNetworkStatusConsensusImplTest.java
@@ -43,7 +43,7 @@ public class RelayNetworkStatusConsensusImplTest {
throws DescriptorParseException {
ConsensusBuilder cb = new ConsensusBuilder();
cb.dirSources.add(dirSourceString);
- return cb.buildConsensus(true);
+ return cb.buildConsensus();
}
private String nickname = "gabelmoo";
@@ -156,7 +156,7 @@ public class RelayNetworkStatusConsensusImplTest {
throws DescriptorParseException {
ConsensusBuilder cb = new ConsensusBuilder();
cb.statusEntries.add(statusEntryString);
- return cb.buildConsensus(true);
+ return cb.buildConsensus();
}
private String nickname = "right2privassy3";
@@ -314,7 +314,7 @@ public class RelayNetworkStatusConsensusImplTest {
throws DescriptorParseException {
ConsensusBuilder cb = new ConsensusBuilder();
cb.addDirectorySignature(directorySignatureString);
- return cb.buildConsensus(true);
+ return cb.buildConsensus();
}
private String identity = "ED03BB616EB2F60BEC80151114BB25CEF515B226";
@@ -355,7 +355,7 @@ public class RelayNetworkStatusConsensusImplTest {
@Test
public void testSampleConsensus() throws DescriptorParseException {
ConsensusBuilder cb = new ConsensusBuilder();
- RelayNetworkStatusConsensus consensus = cb.buildConsensus(true);
+ RelayNetworkStatusConsensus consensus = cb.buildConsensus();
assertEquals(3, consensus.getNetworkStatusVersion());
assertEquals(11, consensus.getConsensusMethod());
assertEquals(1322643600000L, consensus.getValidAfterMillis());
@@ -742,7 +742,7 @@ public class RelayNetworkStatusConsensusImplTest {
ConsensusBuilder cb = new ConsensusBuilder();
cb.clientVersionsLine = null;
cb.serverVersionsLine = null;
- RelayNetworkStatusConsensus consensus = cb.buildConsensus(true);
+ RelayNetworkStatusConsensus consensus = cb.buildConsensus();
assertNull(consensus.getRecommendedClientVersions());
assertNull(consensus.getRecommendedServerVersions());
}
@@ -1362,7 +1362,7 @@ public class RelayNetworkStatusConsensusImplTest {
sb.sLine = sb.sLine + "\n" + sb.sLine;
ConsensusBuilder cb = new ConsensusBuilder();
cb.statusEntries.add(sb.buildStatusEntry());
- cb.buildConsensus(true);
+ cb.buildConsensus();
}
@Test
@@ -1373,7 +1373,7 @@ public class RelayNetworkStatusConsensusImplTest {
sb.prLine = sb.prLine + "\n" + sb.prLine;
ConsensusBuilder cb = new ConsensusBuilder();
cb.statusEntries.add(sb.buildStatusEntry());
- cb.buildConsensus(true);
+ cb.buildConsensus();
}
@Test
@@ -1403,7 +1403,7 @@ public class RelayNetworkStatusConsensusImplTest {
sb.wLine = sb.wLine + "\n" + sb.wLine;
ConsensusBuilder cb = new ConsensusBuilder();
cb.statusEntries.add(sb.buildStatusEntry());
- cb.buildConsensus(true);
+ cb.buildConsensus();
}
@Test
@@ -1412,7 +1412,7 @@ public class RelayNetworkStatusConsensusImplTest {
sb.wLine = "w Bandwidth=42424242 Unmeasured=1";
ConsensusBuilder cb = new ConsensusBuilder();
cb.statusEntries.add(sb.buildStatusEntry());
- RelayNetworkStatusConsensus consensus = cb.buildConsensus(true);
+ RelayNetworkStatusConsensus consensus = cb.buildConsensus();
for (NetworkStatusEntry s : consensus.getStatusEntries().values()) {
if (s.getBandwidth() == 42424242L) {
assertTrue(s.getUnmeasured());
@@ -1465,14 +1465,14 @@ public class RelayNetworkStatusConsensusImplTest {
sb.pLine = sb.pLine + "\n" + sb.pLine;
ConsensusBuilder cb = new ConsensusBuilder();
cb.statusEntries.add(sb.buildStatusEntry());
- cb.buildConsensus(true);
+ cb.buildConsensus();
}
@Test
public void testNoStatusEntries() throws DescriptorParseException {
ConsensusBuilder cb = new ConsensusBuilder();
cb.statusEntries.clear();
- RelayNetworkStatusConsensus consensus = cb.buildConsensus(true);
+ RelayNetworkStatusConsensus consensus = cb.buildConsensus();
assertFalse(consensus.containsStatusEntry(
"00795A6E8D91C270FC23B30F388A495553E01894"));
}
@@ -1498,7 +1498,7 @@ public class RelayNetworkStatusConsensusImplTest {
cb.setBandwidthWeightsLine(null);
/* This does not break, because directory footers were optional before
* consensus method 9. */
- RelayNetworkStatusConsensus consensus = cb.buildConsensus(true);
+ RelayNetworkStatusConsensus consensus = cb.buildConsensus();
assertNull(consensus.getBandwidthWeights());
}
@@ -1599,7 +1599,7 @@ public class RelayNetworkStatusConsensusImplTest {
byte[] consensusBytes = cb.buildConsensusBytes();
consensusBytes[20] = (byte) 200;
new RelayNetworkStatusConsensusImpl(consensusBytes,
- new int[] { 0, consensusBytes.length }, null, true);
+ new int[] { 0, consensusBytes.length }, null);
}
@Test
@@ -1613,7 +1613,7 @@ public class RelayNetworkStatusConsensusImplTest {
byte[] consensusBytes = cb.buildConsensusBytes();
consensusBytes[0] = (byte) 200;
new RelayNetworkStatusConsensusImpl(consensusBytes,
- new int[] { 0, consensusBytes.length }, null, true);
+ new int[] { 0, consensusBytes.length }, null);
}
@Test
@@ -1623,8 +1623,7 @@ public class RelayNetworkStatusConsensusImplTest {
this.thrown.expectMessage(
"Unrecognized line 'unrecognized-line 1' in consensus.");
String unrecognizedLine = "unrecognized-line 1";
- ConsensusBuilder.createWithUnrecognizedHeaderLine(unrecognizedLine,
- true);
+ ConsensusBuilder.createWithUnrecognizedHeaderLine(unrecognizedLine);
}
@Test
@@ -1632,7 +1631,7 @@ public class RelayNetworkStatusConsensusImplTest {
throws DescriptorParseException {
String unrecognizedLine = "unrecognized-line 1";
RelayNetworkStatusConsensus consensus = ConsensusBuilder
- .createWithUnrecognizedHeaderLine(unrecognizedLine, false);
+ .createWithUnrecognizedHeaderLine(unrecognizedLine);
List<String> unrecognizedLines = new ArrayList<>();
unrecognizedLines.add(unrecognizedLine);
assertEquals(unrecognizedLines, consensus.getUnrecognizedLines());
@@ -1645,8 +1644,7 @@ public class RelayNetworkStatusConsensusImplTest {
this.thrown.expectMessage(
"Unrecognized line 'unrecognized-line 1' in dir-source entry.");
String unrecognizedLine = "unrecognized-line 1";
- ConsensusBuilder.createWithUnrecognizedDirSourceLine(unrecognizedLine,
- true);
+ ConsensusBuilder.createWithUnrecognizedDirSourceLine(unrecognizedLine);
}
@Test
@@ -1654,7 +1652,7 @@ public class RelayNetworkStatusConsensusImplTest {
throws DescriptorParseException {
String unrecognizedLine = "unrecognized-line 1";
RelayNetworkStatusConsensus consensus = ConsensusBuilder
- .createWithUnrecognizedDirSourceLine(unrecognizedLine, false);
+ .createWithUnrecognizedDirSourceLine(unrecognizedLine);
List<String> unrecognizedLines = new ArrayList<>();
unrecognizedLines.add(unrecognizedLine);
assertEquals(unrecognizedLines, consensus.getUnrecognizedLines());
@@ -1668,7 +1666,7 @@ public class RelayNetworkStatusConsensusImplTest {
+ "status entry.");
String unrecognizedLine = "unrecognized-line 1";
ConsensusBuilder.createWithUnrecognizedStatusEntryLine(
- unrecognizedLine, true);
+ unrecognizedLine);
}
@Test
@@ -1676,7 +1674,7 @@ public class RelayNetworkStatusConsensusImplTest {
throws DescriptorParseException {
String unrecognizedLine = "unrecognized-line 1";
RelayNetworkStatusConsensus consensus = ConsensusBuilder
- .createWithUnrecognizedStatusEntryLine(unrecognizedLine, false);
+ .createWithUnrecognizedStatusEntryLine(unrecognizedLine);
List<String> unrecognizedLines = new ArrayList<>();
unrecognizedLines.add(unrecognizedLine);
assertEquals(unrecognizedLines, consensus.getUnrecognizedLines());
@@ -1689,8 +1687,7 @@ public class RelayNetworkStatusConsensusImplTest {
this.thrown.expectMessage(
"Unrecognized line 'unrecognized-line 1' in consensus.");
String unrecognizedLine = "unrecognized-line 1";
- ConsensusBuilder.createWithUnrecognizedFooterLine(unrecognizedLine,
- true);
+ ConsensusBuilder.createWithUnrecognizedFooterLine(unrecognizedLine);
}
@Test
@@ -1698,7 +1695,7 @@ public class RelayNetworkStatusConsensusImplTest {
throws DescriptorParseException {
String unrecognizedLine = "unrecognized-line 1";
RelayNetworkStatusConsensus consensus = ConsensusBuilder
- .createWithUnrecognizedFooterLine(unrecognizedLine, false);
+ .createWithUnrecognizedFooterLine(unrecognizedLine);
List<String> unrecognizedLines = new ArrayList<>();
unrecognizedLines.add(unrecognizedLine);
assertEquals(unrecognizedLines, consensus.getUnrecognizedLines());
@@ -1712,7 +1709,7 @@ public class RelayNetworkStatusConsensusImplTest {
"Unrecognized line 'unrecognized-line 1' in dir-source entry.");
String unrecognizedLine = "unrecognized-line 1";
ConsensusBuilder.createWithUnrecognizedDirectorySignatureLine(
- unrecognizedLine, true);
+ unrecognizedLine);
}
@Test
@@ -1720,8 +1717,7 @@ public class RelayNetworkStatusConsensusImplTest {
throws DescriptorParseException {
String unrecognizedLine = "unrecognized-line 1";
RelayNetworkStatusConsensus consensus = ConsensusBuilder
- .createWithUnrecognizedDirectorySignatureLine(unrecognizedLine,
- false);
+ .createWithUnrecognizedDirectorySignatureLine(unrecognizedLine);
List<String> unrecognizedLines = new ArrayList<>();
unrecognizedLines.add(unrecognizedLine);
assertEquals(unrecognizedLines, consensus.getUnrecognizedLines());
diff --git a/src/test/java/org/torproject/descriptor/impl/RelayNetworkStatusVoteImplTest.java b/src/test/java/org/torproject/descriptor/impl/RelayNetworkStatusVoteImplTest.java
index 9727f50..060cbbb 100644
--- a/src/test/java/org/torproject/descriptor/impl/RelayNetworkStatusVoteImplTest.java
+++ b/src/test/java/org/torproject/descriptor/impl/RelayNetworkStatusVoteImplTest.java
@@ -43,7 +43,7 @@ public class RelayNetworkStatusVoteImplTest {
throws DescriptorParseException {
VoteBuilder vb = new VoteBuilder();
vb.networkStatusVersionLine = line;
- return vb.buildVote(true);
+ return vb.buildVote();
}
private String voteStatusLine = "vote-status vote";
@@ -53,7 +53,7 @@ public class RelayNetworkStatusVoteImplTest {
throws DescriptorParseException {
VoteBuilder vb = new VoteBuilder();
vb.voteStatusLine = line;
- return vb.buildVote(true);
+ return vb.buildVote();
}
private String consensusMethodsLine =
@@ -64,7 +64,7 @@ public class RelayNetworkStatusVoteImplTest {
throws DescriptorParseException {
VoteBuilder vb = new VoteBuilder();
vb.consensusMethodsLine = line;
- return vb.buildVote(true);
+ return vb.buildVote();
}
private String publishedLine = "published 2011-11-30 08:50:01";
@@ -74,7 +74,7 @@ public class RelayNetworkStatusVoteImplTest {
throws DescriptorParseException {
VoteBuilder vb = new VoteBuilder();
vb.publishedLine = line;
- return vb.buildVote(true);
+ return vb.buildVote();
}
private String validAfterLine = "valid-after 2011-11-30 09:00:00";
@@ -84,7 +84,7 @@ public class RelayNetworkStatusVoteImplTest {
throws DescriptorParseException {
VoteBuilder vb = new VoteBuilder();
vb.validAfterLine = line;
- return vb.buildVote(true);
+ return vb.buildVote();
}
private String freshUntilLine = "fresh-until 2011-11-30 10:00:00";
@@ -94,7 +94,7 @@ public class RelayNetworkStatusVoteImplTest {
throws DescriptorParseException {
VoteBuilder vb = new VoteBuilder();
vb.freshUntilLine = line;
- return vb.buildVote(true);
+ return vb.buildVote();
}
private String validUntilLine = "valid-until 2011-11-30 12:00:00";
@@ -104,7 +104,7 @@ public class RelayNetworkStatusVoteImplTest {
throws DescriptorParseException {
VoteBuilder vb = new VoteBuilder();
vb.validUntilLine = line;
- return vb.buildVote(true);
+ return vb.buildVote();
}
private String votingDelayLine = "voting-delay 300 300";
@@ -114,7 +114,7 @@ public class RelayNetworkStatusVoteImplTest {
throws DescriptorParseException {
VoteBuilder vb = new VoteBuilder();
vb.votingDelayLine = line;
- return vb.buildVote(true);
+ return vb.buildVote();
}
private String clientVersionsLine = "client-versions 0.2.1.31,"
@@ -125,7 +125,7 @@ public class RelayNetworkStatusVoteImplTest {
throws DescriptorParseException {
VoteBuilder vb = new VoteBuilder();
vb.clientVersionsLine = line;
- return vb.buildVote(true);
+ return vb.buildVote();
}
private String serverVersionsLine = "server-versions 0.2.1.31,"
@@ -136,7 +136,7 @@ public class RelayNetworkStatusVoteImplTest {
throws DescriptorParseException {
VoteBuilder vb = new VoteBuilder();
vb.serverVersionsLine = line;
- return vb.buildVote(true);
+ return vb.buildVote();
}
private String packageLines = null;
@@ -146,7 +146,7 @@ public class RelayNetworkStatusVoteImplTest {
throws DescriptorParseException {
VoteBuilder vb = new VoteBuilder();
vb.packageLines = lines;
- return vb.buildVote(true);
+ return vb.buildVote();
}
private String knownFlagsLine = "known-flags Authority BadExit Exit "
@@ -157,7 +157,7 @@ public class RelayNetworkStatusVoteImplTest {
throws DescriptorParseException {
VoteBuilder vb = new VoteBuilder();
vb.knownFlagsLine = line;
- return vb.buildVote(true);
+ return vb.buildVote();
}
private String recommendedClientProtocolsLine =
@@ -169,7 +169,7 @@ public class RelayNetworkStatusVoteImplTest {
throws DescriptorParseException {
VoteBuilder vb = new VoteBuilder();
vb.recommendedClientProtocolsLine = line;
- return vb.buildVote(true);
+ return vb.buildVote();
}
private String recommendedRelayProtocolsLine =
@@ -181,7 +181,7 @@ public class RelayNetworkStatusVoteImplTest {
throws DescriptorParseException {
VoteBuilder vb = new VoteBuilder();
vb.recommendedRelayProtocolsLine = line;
- return vb.buildVote(true);
+ return vb.buildVote();
}
private String requiredClientProtocolsLine =
@@ -193,7 +193,7 @@ public class RelayNetworkStatusVoteImplTest {
throws DescriptorParseException {
VoteBuilder vb = new VoteBuilder();
vb.requiredClientProtocolsLine = line;
- return vb.buildVote(true);
+ return vb.buildVote();
}
private String requiredRelayProtocolsLine =
@@ -205,7 +205,7 @@ public class RelayNetworkStatusVoteImplTest {
throws DescriptorParseException {
VoteBuilder vb = new VoteBuilder();
vb.requiredRelayProtocolsLine = line;
- return vb.buildVote(true);
+ return vb.buildVote();
}
private String flagThresholdsLine = "flag-thresholds "
@@ -218,7 +218,7 @@ public class RelayNetworkStatusVoteImplTest {
throws DescriptorParseException {
VoteBuilder vb = new VoteBuilder();
vb.flagThresholdsLine = line;
- return vb.buildVote(true);
+ return vb.buildVote();
}
private String paramsLine = "params "
@@ -232,7 +232,7 @@ public class RelayNetworkStatusVoteImplTest {
throws DescriptorParseException {
VoteBuilder vb = new VoteBuilder();
vb.paramsLine = line;
- return vb.buildVote(true);
+ return vb.buildVote();
}
private String dirSourceLine = "dir-source urras "
@@ -244,7 +244,7 @@ public class RelayNetworkStatusVoteImplTest {
throws DescriptorParseException {
VoteBuilder vb = new VoteBuilder();
vb.dirSourceLine = line;
- return vb.buildVote(true);
+ return vb.buildVote();
}
private String contactLine = "contact 4096R/E012B42D Jacob Appelbaum "
@@ -255,7 +255,7 @@ public class RelayNetworkStatusVoteImplTest {
throws DescriptorParseException {
VoteBuilder vb = new VoteBuilder();
vb.contactLine = line;
- return vb.buildVote(true);
+ return vb.buildVote();
}
private String sharedRandParticipateLine = "shared-rand-participate";
@@ -264,7 +264,7 @@ public class RelayNetworkStatusVoteImplTest {
String line) throws DescriptorParseException {
VoteBuilder vb = new VoteBuilder();
vb.sharedRandParticipateLine = line;
- return vb.buildVote(true);
+ return vb.buildVote();
}
private List<String> sharedRandCommitLines = Arrays.asList(new String[] {
@@ -279,7 +279,7 @@ public class RelayNetworkStatusVoteImplTest {
List<String> lines) throws DescriptorParseException {
VoteBuilder vb = new VoteBuilder();
vb.sharedRandCommitLines = lines;
- return vb.buildVote(true);
+ return vb.buildVote();
}
private String sharedRandPreviousValueLine =
@@ -290,7 +290,7 @@ public class RelayNetworkStatusVoteImplTest {
String line) throws DescriptorParseException {
VoteBuilder vb = new VoteBuilder();
vb.sharedRandPreviousValueLine = line;
- return vb.buildVote(true);
+ return vb.buildVote();
}
private String sharedRandCurrentValueLine =
@@ -301,7 +301,7 @@ public class RelayNetworkStatusVoteImplTest {
String line) throws DescriptorParseException {
VoteBuilder vb = new VoteBuilder();
vb.sharedRandCurrentValueLine = line;
- return vb.buildVote(true);
+ return vb.buildVote();
}
private String legacyDirKeyLine = null;
@@ -311,7 +311,7 @@ public class RelayNetworkStatusVoteImplTest {
throws DescriptorParseException {
VoteBuilder vb = new VoteBuilder();
vb.legacyDirKeyLine = line;
- return vb.buildVote(true);
+ return vb.buildVote();
}
private String dirKeyCertificateVersionLine =
@@ -322,7 +322,7 @@ public class RelayNetworkStatusVoteImplTest {
throws DescriptorParseException {
VoteBuilder vb = new VoteBuilder();
vb.dirKeyCertificateVersionLine = line;
- return vb.buildVote(true);
+ return vb.buildVote();
}
private String fingerprintLine = "fingerprint "
@@ -333,7 +333,7 @@ public class RelayNetworkStatusVoteImplTest {
throws DescriptorParseException {
VoteBuilder vb = new VoteBuilder();
vb.fingerprintLine = line;
- return vb.buildVote(true);
+ return vb.buildVote();
}
private String dirKeyPublishedLine = "dir-key-published 2011-04-27 "
@@ -344,7 +344,7 @@ public class RelayNetworkStatusVoteImplTest {
throws DescriptorParseException {
VoteBuilder vb = new VoteBuilder();
vb.dirKeyPublishedLine = line;
- return vb.buildVote(true);
+ return vb.buildVote();
}
private String dirKeyExpiresLine = "dir-key-expires 2012-04-27 "
@@ -355,7 +355,7 @@ public class RelayNetworkStatusVoteImplTest {
throws DescriptorParseException {
VoteBuilder vb = new VoteBuilder();
vb.dirKeyExpiresLine = line;
- return vb.buildVote(true);
+ return vb.buildVote();
}
private String dirIdentityKeyLines = "dir-identity-key\n"
@@ -376,7 +376,7 @@ public class RelayNetworkStatusVoteImplTest {
throws DescriptorParseException {
VoteBuilder vb = new VoteBuilder();
vb.dirIdentityKeyLines = lines;
- return vb.buildVote(true);
+ return vb.buildVote();
}
private String dirSigningKeyLines = "dir-signing-key\n"
@@ -392,7 +392,7 @@ public class RelayNetworkStatusVoteImplTest {
throws DescriptorParseException {
VoteBuilder vb = new VoteBuilder();
vb.dirSigningKeyLines = lines;
- return vb.buildVote(true);
+ return vb.buildVote();
}
private String dirKeyCrosscertLines = "dir-key-crosscert\n"
@@ -407,7 +407,7 @@ public class RelayNetworkStatusVoteImplTest {
throws DescriptorParseException {
VoteBuilder vb = new VoteBuilder();
vb.dirKeyCrosscertLines = lines;
- return vb.buildVote(true);
+ return vb.buildVote();
}
private String dirKeyCertificationLines = "dir-key-certification\n"
@@ -428,7 +428,7 @@ public class RelayNetworkStatusVoteImplTest {
throws DescriptorParseException {
VoteBuilder vb = new VoteBuilder();
vb.dirKeyCertificationLines = lines;
- return vb.buildVote(true);
+ return vb.buildVote();
}
private List<String> statusEntries = null;
@@ -437,7 +437,7 @@ public class RelayNetworkStatusVoteImplTest {
List<String> statusEntries) throws DescriptorParseException {
VoteBuilder vb = new VoteBuilder();
vb.statusEntries = statusEntries;
- return vb.buildVote(true);
+ return vb.buildVote();
}
private String directoryFooterLine = "directory-footer";
@@ -447,7 +447,7 @@ public class RelayNetworkStatusVoteImplTest {
throws DescriptorParseException {
VoteBuilder vb = new VoteBuilder();
vb.directoryFooterLine = line;
- return vb.buildVote(true);
+ return vb.buildVote();
}
private String directorySignatureLines = "directory-signature "
@@ -464,7 +464,7 @@ public class RelayNetworkStatusVoteImplTest {
throws DescriptorParseException {
VoteBuilder vb = new VoteBuilder();
vb.directorySignatureLines = lines;
- return vb.buildVote(true);
+ return vb.buildVote();
}
private String unrecognizedHeaderLine = null;
@@ -475,7 +475,7 @@ public class RelayNetworkStatusVoteImplTest {
throws DescriptorParseException {
VoteBuilder vb = new VoteBuilder();
vb.unrecognizedHeaderLine = line;
- return vb.buildVote(failUnrecognizedDescriptorLines);
+ return vb.buildVote();
}
private String unrecognizedDirSourceLine = null;
@@ -486,7 +486,7 @@ public class RelayNetworkStatusVoteImplTest {
throws DescriptorParseException {
VoteBuilder vb = new VoteBuilder();
vb.unrecognizedDirSourceLine = line;
- return vb.buildVote(failUnrecognizedDescriptorLines);
+ return vb.buildVote();
}
private String unrecognizedStatusEntryLine = null;
@@ -497,7 +497,7 @@ public class RelayNetworkStatusVoteImplTest {
throws DescriptorParseException {
VoteBuilder vb = new VoteBuilder();
vb.unrecognizedStatusEntryLine = line;
- return vb.buildVote(failUnrecognizedDescriptorLines);
+ return vb.buildVote();
}
private String unrecognizedFooterLine = null;
@@ -508,7 +508,7 @@ public class RelayNetworkStatusVoteImplTest {
throws DescriptorParseException {
VoteBuilder vb = new VoteBuilder();
vb.unrecognizedFooterLine = line;
- return vb.buildVote(failUnrecognizedDescriptorLines);
+ return vb.buildVote();
}
private String unrecognizedDirectorySignatureLine = null;
@@ -519,7 +519,7 @@ public class RelayNetworkStatusVoteImplTest {
throws DescriptorParseException {
VoteBuilder vb = new VoteBuilder();
vb.unrecognizedDirectorySignatureLine = line;
- return vb.buildVote(failUnrecognizedDescriptorLines);
+ return vb.buildVote();
}
private VoteBuilder() {
@@ -552,13 +552,11 @@ public class RelayNetworkStatusVoteImplTest {
return sb.toString().getBytes();
}
- private RelayNetworkStatusVoteImpl buildVote(
- boolean failUnrecognizedDescriptorLines)
+ private RelayNetworkStatusVoteImpl buildVote()
throws DescriptorParseException {
byte[] voteBytes = this.buildVoteBytes();
return new RelayNetworkStatusVoteImpl(voteBytes,
- new int[] { 0, voteBytes.length }, null,
- failUnrecognizedDescriptorLines);
+ new int[] { 0, voteBytes.length }, null);
}
private void appendHeader(StringBuilder sb) {
@@ -705,7 +703,7 @@ public class RelayNetworkStatusVoteImplTest {
@Test
public void testSampleVote() throws DescriptorParseException {
VoteBuilder vb = new VoteBuilder();
- RelayNetworkStatusVote vote = vb.buildVote(true);
+ RelayNetworkStatusVote vote = vb.buildVote();
assertEquals(3, vote.getNetworkStatusVersion());
List<Integer> consensusMethods = Arrays.asList(
new Integer[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11});
@@ -1220,7 +1218,7 @@ public class RelayNetworkStatusVoteImplTest {
@Test
public void testFlagThresholdsLine() throws DescriptorParseException {
VoteBuilder vb = new VoteBuilder();
- RelayNetworkStatusVote vote = vb.buildVote(true);
+ RelayNetworkStatusVote vote = vb.buildVote();
assertEquals(693369L, vote.getStableUptime());
assertEquals(153249L, vote.getStableMtbf());
assertEquals(40960L, vote.getFastBandwidth());
@@ -1288,7 +1286,7 @@ public class RelayNetworkStatusVoteImplTest {
VoteBuilder vb = new VoteBuilder();
vb.flagThresholdsLine = vb.flagThresholdsLine + "\n"
+ vb.flagThresholdsLine;
- vb.buildVote(true);
+ vb.buildVote();
}
@Test
@@ -1785,7 +1783,8 @@ public class RelayNetworkStatusVoteImplTest {
assertEquals(signingKeyDigestSha1,
secondSignature.getSigningKeyDigestSha1Hex());
assertEquals(signatureSha1 + "\n", secondSignature.getSignature());
- assertEquals(signingKeyDigestSha1, vote.getSigningKeyDigest());
+ assertEquals(signingKeyDigestSha1, vote.getSignatures().get(0)
+ .getSigningKeyDigestSha1Hex());
assertEquals("c0d58c8d3c3695526f6eb5c0d9f8452b2234d303",
vote.getDigestSha1Hex());
}
diff --git a/src/test/java/org/torproject/descriptor/impl/ServerDescriptorImplTest.java b/src/test/java/org/torproject/descriptor/impl/ServerDescriptorImplTest.java
index d0c2561..5f369ad 100644
--- a/src/test/java/org/torproject/descriptor/impl/ServerDescriptorImplTest.java
+++ b/src/test/java/org/torproject/descriptor/impl/ServerDescriptorImplTest.java
@@ -43,7 +43,7 @@ public class ServerDescriptorImplTest {
String line) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.routerLine = line;
- return db.buildDescriptor(true);
+ return db.buildDescriptor();
}
private String bandwidthLine = "bandwidth 51200 51200 53470";
@@ -52,7 +52,7 @@ public class ServerDescriptorImplTest {
String line) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.bandwidthLine = line;
- return db.buildDescriptor(true);
+ return db.buildDescriptor();
}
private String platformLine = "platform Tor 0.2.2.35 "
@@ -62,7 +62,7 @@ public class ServerDescriptorImplTest {
String line) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.platformLine = line;
- return db.buildDescriptor(true);
+ return db.buildDescriptor();
}
private String publishedLine = "published 2012-01-01 04:03:19";
@@ -71,7 +71,7 @@ public class ServerDescriptorImplTest {
String line) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.publishedLine = line;
- return db.buildDescriptor(true);
+ return db.buildDescriptor();
}
private String fingerprintLine = "opt fingerprint D873 3048 FC8E "
@@ -81,7 +81,7 @@ public class ServerDescriptorImplTest {
String line) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.fingerprintLine = line;
- return db.buildDescriptor(true);
+ return db.buildDescriptor();
}
private String hibernatingLine = null;
@@ -90,7 +90,7 @@ public class ServerDescriptorImplTest {
String line) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.hibernatingLine = line;
- return db.buildDescriptor(true);
+ return db.buildDescriptor();
}
private String uptimeLine = "uptime 48";
@@ -99,7 +99,7 @@ public class ServerDescriptorImplTest {
String line) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.uptimeLine = line;
- return db.buildDescriptor(true);
+ return db.buildDescriptor();
}
private String onionKeyLines = "onion-key\n"
@@ -114,7 +114,7 @@ public class ServerDescriptorImplTest {
String lines) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.onionKeyLines = lines;
- return db.buildDescriptor(true);
+ return db.buildDescriptor();
}
private String signingKeyLines = "signing-key\n"
@@ -129,7 +129,7 @@ public class ServerDescriptorImplTest {
String lines) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.signingKeyLines = lines;
- return db.buildDescriptor(true);
+ return db.buildDescriptor();
}
private String onionKeyCrosscertLines = null;
@@ -138,7 +138,7 @@ public class ServerDescriptorImplTest {
String lines) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.onionKeyCrosscertLines = lines;
- return db.buildDescriptor(true);
+ return db.buildDescriptor();
}
private String ntorOnionKeyCrosscertLines = null;
@@ -147,7 +147,7 @@ public class ServerDescriptorImplTest {
String lines) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.ntorOnionKeyCrosscertLines = lines;
- return db.buildDescriptor(true);
+ return db.buildDescriptor();
}
private String exitPolicyLines = "reject *:*";
@@ -156,7 +156,7 @@ public class ServerDescriptorImplTest {
String lines) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.exitPolicyLines = lines;
- return db.buildDescriptor(true);
+ return db.buildDescriptor();
}
private String contactLine = "contact Random Person <nobody AT "
@@ -166,7 +166,7 @@ public class ServerDescriptorImplTest {
String line) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.contactLine = line;
- return db.buildDescriptor(true);
+ return db.buildDescriptor();
}
private String familyLine = null;
@@ -175,7 +175,7 @@ public class ServerDescriptorImplTest {
String line) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.familyLine = line;
- return db.buildDescriptor(true);
+ return db.buildDescriptor();
}
private String readHistoryLine = null;
@@ -184,7 +184,7 @@ public class ServerDescriptorImplTest {
String line) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.readHistoryLine = line;
- return db.buildDescriptor(true);
+ return db.buildDescriptor();
}
private String writeHistoryLine = null;
@@ -193,7 +193,7 @@ public class ServerDescriptorImplTest {
String line) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.writeHistoryLine = line;
- return db.buildDescriptor(true);
+ return db.buildDescriptor();
}
private String eventdnsLine = null;
@@ -202,7 +202,7 @@ public class ServerDescriptorImplTest {
String line) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.eventdnsLine = line;
- return db.buildDescriptor(true);
+ return db.buildDescriptor();
}
private String cachesExtraInfoLine = null;
@@ -211,7 +211,7 @@ public class ServerDescriptorImplTest {
String line) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.cachesExtraInfoLine = line;
- return db.buildDescriptor(true);
+ return db.buildDescriptor();
}
private String extraInfoDigestLine = "opt extra-info-digest "
@@ -221,7 +221,7 @@ public class ServerDescriptorImplTest {
String line) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.extraInfoDigestLine = line;
- return db.buildDescriptor(true);
+ return db.buildDescriptor();
}
private String hiddenServiceDirLine = "opt hidden-service-dir";
@@ -230,7 +230,7 @@ public class ServerDescriptorImplTest {
String line) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.hiddenServiceDirLine = line;
- return db.buildDescriptor(true);
+ return db.buildDescriptor();
}
private String protocolsLine = null;
@@ -239,7 +239,7 @@ public class ServerDescriptorImplTest {
String line) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.protocolsLine = line;
- return db.buildDescriptor(true);
+ return db.buildDescriptor();
}
private String protoLine = "proto Cons=1-2 Desc=1-2 DirCache=1 HSDir=1 "
@@ -249,7 +249,7 @@ public class ServerDescriptorImplTest {
String line) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.protoLine = line;
- return db.buildDescriptor(true);
+ return db.buildDescriptor();
}
private String allowSingleHopExitsLine = null;
@@ -259,7 +259,7 @@ public class ServerDescriptorImplTest {
throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.allowSingleHopExitsLine = line;
- return db.buildDescriptor(true);
+ return db.buildDescriptor();
}
private String ipv6PolicyLine = null;
@@ -268,7 +268,7 @@ public class ServerDescriptorImplTest {
String line) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.ipv6PolicyLine = line;
- return db.buildDescriptor(true);
+ return db.buildDescriptor();
}
private String ntorOnionKeyLine = null;
@@ -277,7 +277,7 @@ public class ServerDescriptorImplTest {
String line) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.ntorOnionKeyLine = line;
- return db.buildDescriptor(true);
+ return db.buildDescriptor();
}
private String tunnelledDirServerLine = null;
@@ -286,7 +286,7 @@ public class ServerDescriptorImplTest {
String line) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.tunnelledDirServerLine = line;
- return db.buildDescriptor(true);
+ return db.buildDescriptor();
}
private String routerSignatureLines = "router-signature\n"
@@ -300,17 +300,16 @@ public class ServerDescriptorImplTest {
String line) throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.routerSignatureLines = line;
- return db.buildDescriptor(true);
+ return db.buildDescriptor();
}
private String unrecognizedLine = null;
- private static ServerDescriptor createWithUnrecognizedLine(
- String line, boolean failUnrecognizedDescriptorLines)
+ private static ServerDescriptor createWithUnrecognizedLine(String line)
throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.unrecognizedLine = line;
- return db.buildDescriptor(failUnrecognizedDescriptorLines);
+ return db.buildDescriptor();
}
private byte[] nonAsciiLineBytes = null;
@@ -320,7 +319,7 @@ public class ServerDescriptorImplTest {
throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
db.nonAsciiLineBytes = lineBytes;
- return db.buildDescriptor(failUnrecognizedDescriptorLines);
+ return db.buildDescriptor();
}
private String identityEd25519Lines = null;
@@ -336,7 +335,7 @@ public class ServerDescriptorImplTest {
db.identityEd25519Lines = identityEd25519Lines;
db.masterKeyEd25519Line = masterKeyEd25519Line;
db.routerSigEd25519Line = routerSigEd25519Line;
- return db.buildDescriptor(true);
+ return db.buildDescriptor();
}
private byte[] buildDescriptorBytes() {
@@ -451,20 +450,18 @@ public class ServerDescriptorImplTest {
return sb.toString().getBytes();
}
- private ServerDescriptorImpl buildDescriptor(
- boolean failUnrecognizedDescriptorLines)
+ private ServerDescriptorImpl buildDescriptor()
throws DescriptorParseException {
byte[] descriptorBytes = this.buildDescriptorBytes();
return new RelayServerDescriptorImpl(descriptorBytes,
- new int[] { 0, descriptorBytes.length }, null,
- failUnrecognizedDescriptorLines);
+ new int[] { 0, descriptorBytes.length }, null);
}
}
@Test
public void testSampleDescriptor() throws DescriptorParseException {
DescriptorBuilder db = new DescriptorBuilder();
- ServerDescriptor descriptor = db.buildDescriptor(true);
+ ServerDescriptor descriptor = db.buildDescriptor();
assertEquals("saberrider2008", descriptor.getNickname());
assertEquals("94.134.192.243", descriptor.getAddress());
assertEquals(9001, (int) descriptor.getOrPort());
@@ -1715,7 +1712,7 @@ public class ServerDescriptorImplTest {
this.thrown.expect(DescriptorParseException.class);
this.thrown.expectMessage(
"Unrecognized line 'unrecognized-line 1' in server descriptor.");
- DescriptorBuilder.createWithUnrecognizedLine(unrecognizedLine, true);
+ DescriptorBuilder.createWithUnrecognizedLine(unrecognizedLine);
}
@Test
@@ -1723,7 +1720,7 @@ public class ServerDescriptorImplTest {
throws DescriptorParseException {
String unrecognizedLine = "unrecognized-line 1";
ServerDescriptor descriptor = DescriptorBuilder
- .createWithUnrecognizedLine(unrecognizedLine, false);
+ .createWithUnrecognizedLine(unrecognizedLine);
List<String> unrecognizedLines = new ArrayList<>();
unrecognizedLines.add(unrecognizedLine);
assertEquals(unrecognizedLines, descriptor.getUnrecognizedLines());
@@ -1746,7 +1743,7 @@ public class ServerDescriptorImplTest {
sb.append("\n").append(line);
}
ServerDescriptor descriptor = DescriptorBuilder
- .createWithUnrecognizedLine(sb.toString().substring(1), false);
+ .createWithUnrecognizedLine(sb.toString().substring(1));
assertEquals(unrecognizedLines, descriptor.getUnrecognizedLines());
}
@@ -1767,7 +1764,7 @@ public class ServerDescriptorImplTest {
sb.append("\n").append(line);
}
ServerDescriptor descriptor = DescriptorBuilder
- .createWithUnrecognizedLine(sb.toString().substring(1), false);
+ .createWithUnrecognizedLine(sb.toString().substring(1));
assertEquals(unrecognizedLines, descriptor.getUnrecognizedLines());
}
@@ -1963,7 +1960,7 @@ public class ServerDescriptorImplTest {
+ "\nrouter-digest " + digestSha1Hex;
byte[] descriptorBytes = db.buildDescriptorBytes();
BridgeServerDescriptor descriptor = new BridgeServerDescriptorImpl(
- descriptorBytes, new int[] { 0, descriptorBytes.length }, null, true);
+ descriptorBytes, new int[] { 0, descriptorBytes.length }, null);
assertEquals(digestSha1Hex, descriptor.getDigestSha1Hex());
assertEquals(digestSha256Base64, descriptor.getDigestSha256Base64());
}
@@ -1974,7 +1971,7 @@ public class ServerDescriptorImplTest {
DescriptorBuilder db = new DescriptorBuilder();
byte[] descriptorBytes = db.buildDescriptorBytes();
BridgeServerDescriptor descriptor = new BridgeServerDescriptorImpl(
- descriptorBytes, new int[] { 0, descriptorBytes.length }, null, true);
+ descriptorBytes, new int[] { 0, descriptorBytes.length }, null);
assertNull(descriptor.getDigestSha1Hex());
assertNull(descriptor.getDigestSha256Base64());
}
diff --git a/src/test/java/org/torproject/descriptor/impl/TestDescriptor.java b/src/test/java/org/torproject/descriptor/impl/TestDescriptor.java
index e3a0c7c..cf5efd5 100644
--- a/src/test/java/org/torproject/descriptor/impl/TestDescriptor.java
+++ b/src/test/java/org/torproject/descriptor/impl/TestDescriptor.java
@@ -8,10 +8,9 @@ import org.torproject.descriptor.DescriptorParseException;
public class TestDescriptor extends DescriptorImpl {
protected TestDescriptor(byte[] rawDescriptorBytes, int[] offsetAndLength,
- boolean failUnrecognizedDescriptorLines, boolean blankLinesAllowed)
+ boolean blankLinesAllowed)
throws DescriptorParseException {
- super(rawDescriptorBytes, offsetAndLength, null,
- failUnrecognizedDescriptorLines, blankLinesAllowed);
+ super(rawDescriptorBytes, offsetAndLength, null, blankLinesAllowed);
}
}
diff --git a/src/test/java/org/torproject/descriptor/impl/TestServerDescriptor.java b/src/test/java/org/torproject/descriptor/impl/TestServerDescriptor.java
index 0afd7b4..406e9c0 100644
--- a/src/test/java/org/torproject/descriptor/impl/TestServerDescriptor.java
+++ b/src/test/java/org/torproject/descriptor/impl/TestServerDescriptor.java
@@ -3,16 +3,16 @@
package org.torproject.descriptor.impl;
+import org.torproject.descriptor.DescriptorParseException;
+
import java.io.File;
public class TestServerDescriptor extends ServerDescriptorImpl {
protected TestServerDescriptor(byte[] rawDescriptorBytes,
- int[] offsetAndLength, File descriptorFile,
- boolean failUnrecognizedDescriptorLines)
+ int[] offsetAndLength, File descriptorFile)
throws DescriptorParseException {
- super(rawDescriptorBytes, offsetAndLength, descriptorFile,
- failUnrecognizedDescriptorLines);
+ super(rawDescriptorBytes, offsetAndLength, descriptorFile);
}
}
diff --git a/src/test/java/org/torproject/descriptor/impl/TorperfResultImplTest.java b/src/test/java/org/torproject/descriptor/impl/TorperfResultImplTest.java
index 7df4269..f648c7b 100644
--- a/src/test/java/org/torproject/descriptor/impl/TorperfResultImplTest.java
+++ b/src/test/java/org/torproject/descriptor/impl/TorperfResultImplTest.java
@@ -20,7 +20,7 @@ public class TorperfResultImplTest {
public void testAnnotatedInput() throws Exception {
TorperfResultImpl result = (TorperfResultImpl)
(TorperfResultImpl.parseTorperfResults((torperfAnnotation + input)
- .getBytes("US-ASCII"), null, false).get(0));
+ .getBytes("US-ASCII"), null).get(0));
assertEquals("Expected one annotation.", 1,
result.getAnnotations().size());
assertEquals(torperfAnnotation.substring(0, 17),
@@ -37,7 +37,7 @@ public class TorperfResultImplTest {
byte[] asciiBytes = (torperfAnnotation
+ input + input + input).getBytes("US-ASCII");
List<Descriptor> result = TorperfResultImpl.parseTorperfResults(
- asciiBytes, null, false);
+ asciiBytes, null);
assertEquals("Expected one annotation.", 1,
((TorperfResultImpl)(result.get(0))).getAnnotations().size());
assertEquals(3, result.size());
@@ -53,7 +53,7 @@ public class TorperfResultImplTest {
+ torperfAnnotation + input
+ torperfAnnotation + input).getBytes("US-ASCII");
List<Descriptor> result = TorperfResultImpl.parseTorperfResults(
- asciiBytes, null, false);
+ asciiBytes, null);
assertEquals("Expected one annotation.", 1,
((TorperfResultImpl)(result.get(0))).getAnnotations().size());
assertEquals(3, result.size());
@@ -90,7 +90,7 @@ public class TorperfResultImplTest {
@Test
public void testDatapercNonNumeric() throws Exception {
List<Descriptor> result = TorperfResultImpl.parseTorperfResults(
- ("DATAPERMILLE=2.0 " + input).getBytes(), null, false);
+ ("DATAPERMILLE=2.0 " + input).getBytes(), null);
assertEquals(1, result.size());
TorperfResultImpl torperfResult = (TorperfResultImpl) result.get(0);
assertEquals(1, torperfResult.getUnrecognizedKeys().size());
@@ -125,7 +125,7 @@ public class TorperfResultImplTest {
public void testEndpointsHostnamesSourceAddress()
throws DescriptorParseException {
List<Descriptor> result = TorperfResultImpl.parseTorperfResults(
- input2.getBytes(), null, true);
+ input2.getBytes(), null);
assertEquals(1, result.size());
TorperfResultImpl torperfResult = (TorperfResultImpl) result.get(0);
assertNull(torperfResult.getUnrecognizedKeys());
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits