commit b6b152565fbc24750a930306d66ebecd93c16cf7 Author: Karsten Loesing karsten.loesing@gmx.net Date: Thu Aug 14 16:21:32 2014 +0200
Split ApplicationFactory into four factories.
This is to avoid a circular dependency between the docs and the util package.
Based on a suggestion by iwakeh in #12866. --- .../java/org/torproject/onionoo/cron/Main.java | 7 +-- .../org/torproject/onionoo/docs/DocumentStore.java | 4 +- .../org/torproject/onionoo/server/NodeIndexer.java | 11 ++-- .../onionoo/server/PerformanceMetrics.java | 4 +- .../torproject/onionoo/server/RequestHandler.java | 4 +- .../torproject/onionoo/server/ResourceServlet.java | 12 ++--- .../torproject/onionoo/server/ResponseBuilder.java | 4 +- .../onionoo/updater/BandwidthStatusUpdater.java | 9 ++-- .../onionoo/updater/ClientsStatusUpdater.java | 9 ++-- .../onionoo/updater/NodeDetailsStatusUpdater.java | 9 ++-- .../onionoo/updater/ReverseDomainNameResolver.java | 4 +- .../onionoo/updater/UptimeStatusUpdater.java | 13 +++-- .../onionoo/updater/WeightsStatusUpdater.java | 9 ++-- .../onionoo/util/ApplicationFactory.java | 55 -------------------- .../java/org/torproject/onionoo/util/LockFile.java | 2 +- .../java/org/torproject/onionoo/util/Logger.java | 2 +- .../onionoo/writer/BandwidthDocumentWriter.java | 10 ++-- .../onionoo/writer/ClientsDocumentWriter.java | 10 ++-- .../onionoo/writer/DetailsDocumentWriter.java | 10 ++-- .../onionoo/writer/SummaryDocumentWriter.java | 4 +- .../onionoo/writer/UptimeDocumentWriter.java | 10 ++-- .../onionoo/writer/WeightsDocumentWriter.java | 10 ++-- .../torproject/onionoo/ResourceServletTest.java | 10 ++-- .../onionoo/UptimeDocumentWriterTest.java | 28 +++++----- .../org/torproject/onionoo/UptimeStatusTest.java | 4 +- .../onionoo/UptimeStatusUpdaterTest.java | 17 +++--- 26 files changed, 118 insertions(+), 153 deletions(-)
diff --git a/src/main/java/org/torproject/onionoo/cron/Main.java b/src/main/java/org/torproject/onionoo/cron/Main.java index ba905fa..bd4b95a 100644 --- a/src/main/java/org/torproject/onionoo/cron/Main.java +++ b/src/main/java/org/torproject/onionoo/cron/Main.java @@ -3,9 +3,10 @@ package org.torproject.onionoo.cron;
import org.torproject.onionoo.docs.DocumentStore; +import org.torproject.onionoo.docs.DocumentStoreFactory; import org.torproject.onionoo.updater.DescriptorSource; +import org.torproject.onionoo.updater.DescriptorSourceFactory; import org.torproject.onionoo.updater.StatusUpdateRunner; -import org.torproject.onionoo.util.ApplicationFactory; import org.torproject.onionoo.util.LockFile; import org.torproject.onionoo.util.Logger; import org.torproject.onionoo.writer.DocumentWriterRunner; @@ -29,9 +30,9 @@ public class Main { return; }
- DescriptorSource dso = ApplicationFactory.getDescriptorSource(); + DescriptorSource dso = DescriptorSourceFactory.getDescriptorSource(); Logger.printStatusTime("Initialized descriptor source"); - DocumentStore ds = ApplicationFactory.getDocumentStore(); + DocumentStore ds = DocumentStoreFactory.getDocumentStore(); Logger.printStatusTime("Initialized document store"); StatusUpdateRunner sur = new StatusUpdateRunner(); Logger.printStatusTime("Initialized status update runner"); diff --git a/src/main/java/org/torproject/onionoo/docs/DocumentStore.java b/src/main/java/org/torproject/onionoo/docs/DocumentStore.java index ea906ed..73da1ae 100644 --- a/src/main/java/org/torproject/onionoo/docs/DocumentStore.java +++ b/src/main/java/org/torproject/onionoo/docs/DocumentStore.java @@ -21,9 +21,9 @@ import java.util.Stack; import java.util.TreeMap; import java.util.TreeSet;
-import org.torproject.onionoo.util.ApplicationFactory; import org.torproject.onionoo.util.Logger; import org.torproject.onionoo.util.Time; +import org.torproject.onionoo.util.TimeFactory;
import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -46,7 +46,7 @@ public class DocumentStore { private Time time;
public DocumentStore() { - this.time = ApplicationFactory.getTime(); + this.time = TimeFactory.getTime(); }
private long listOperations = 0L, listedFiles = 0L, storedFiles = 0L, diff --git a/src/main/java/org/torproject/onionoo/server/NodeIndexer.java b/src/main/java/org/torproject/onionoo/server/NodeIndexer.java index 19545ee..f72d322 100644 --- a/src/main/java/org/torproject/onionoo/server/NodeIndexer.java +++ b/src/main/java/org/torproject/onionoo/server/NodeIndexer.java @@ -17,22 +17,23 @@ import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextListener;
import org.torproject.onionoo.docs.DocumentStore; +import org.torproject.onionoo.docs.DocumentStoreFactory; import org.torproject.onionoo.docs.SummaryDocument; import org.torproject.onionoo.docs.UpdateStatus; -import org.torproject.onionoo.util.ApplicationFactory; import org.torproject.onionoo.util.DateTimeHelper; import org.torproject.onionoo.util.Time; +import org.torproject.onionoo.util.TimeFactory;
public class NodeIndexer implements ServletContextListener, Runnable {
public void contextInitialized(ServletContextEvent contextEvent) { ServletContext servletContext = contextEvent.getServletContext(); File outDir = new File(servletContext.getInitParameter("outDir")); - DocumentStore documentStore = ApplicationFactory.getDocumentStore(); + DocumentStore documentStore = DocumentStoreFactory.getDocumentStore(); documentStore.setOutDir(outDir); /* The servlet container created us, and we need to avoid that * ApplicationFactory creates another instance of us. */ - ApplicationFactory.setNodeIndexer(this); + NodeIndexerFactory.setNodeIndexer(this); this.startIndexing(); }
@@ -94,7 +95,7 @@ public class NodeIndexer implements ServletContextListener, Runnable {
private void indexNodeStatuses() { long updateStatusMillis = -1L; - DocumentStore documentStore = ApplicationFactory.getDocumentStore(); + DocumentStore documentStore = DocumentStoreFactory.getDocumentStore(); UpdateStatus updateStatus = documentStore.retrieve(UpdateStatus.class, false); if (updateStatus != null && @@ -148,7 +149,7 @@ public class NodeIndexer implements ServletContextListener, Runnable { currentBridges.add(node); } } - Time time = ApplicationFactory.getTime(); + Time time = TimeFactory.getTime(); List<String> orderRelaysByConsensusWeight = new ArrayList<String>(); for (SummaryDocument entry : currentRelays) { String fingerprint = entry.getFingerprint().toUpperCase(); diff --git a/src/main/java/org/torproject/onionoo/server/PerformanceMetrics.java b/src/main/java/org/torproject/onionoo/server/PerformanceMetrics.java index c7fc7f9..7639580 100644 --- a/src/main/java/org/torproject/onionoo/server/PerformanceMetrics.java +++ b/src/main/java/org/torproject/onionoo/server/PerformanceMetrics.java @@ -12,9 +12,9 @@ import java.util.SortedSet; import java.util.TreeMap; import java.util.TreeSet;
-import org.torproject.onionoo.util.ApplicationFactory; import org.torproject.onionoo.util.DateTimeHelper; import org.torproject.onionoo.util.Time; +import org.torproject.onionoo.util.TimeFactory;
class Counter { int value = 0; @@ -144,7 +144,7 @@ public class PerformanceMetrics { long writtenResponseMillis) { synchronized (lock) { if (time == null) { - time = ApplicationFactory.getTime(); + time = TimeFactory.getTime(); } if (lastLoggedMillis < 0L) { lastLoggedMillis = time.currentTimeMillis(); diff --git a/src/main/java/org/torproject/onionoo/server/RequestHandler.java b/src/main/java/org/torproject/onionoo/server/RequestHandler.java index 22e82fb..79987fb 100644 --- a/src/main/java/org/torproject/onionoo/server/RequestHandler.java +++ b/src/main/java/org/torproject/onionoo/server/RequestHandler.java @@ -12,8 +12,8 @@ import java.util.Set; import java.util.SortedMap;
import org.torproject.onionoo.docs.DocumentStore; +import org.torproject.onionoo.docs.DocumentStoreFactory; import org.torproject.onionoo.docs.SummaryDocument; -import org.torproject.onionoo.util.ApplicationFactory;
public class RequestHandler {
@@ -23,7 +23,7 @@ public class RequestHandler {
public RequestHandler(NodeIndex nodeIndex) { this.nodeIndex = nodeIndex; - this.documentStore = ApplicationFactory.getDocumentStore(); + this.documentStore = DocumentStoreFactory.getDocumentStore(); }
private String resourceType; diff --git a/src/main/java/org/torproject/onionoo/server/ResourceServlet.java b/src/main/java/org/torproject/onionoo/server/ResourceServlet.java index ee71218..5f22c39 100644 --- a/src/main/java/org/torproject/onionoo/server/ResourceServlet.java +++ b/src/main/java/org/torproject/onionoo/server/ResourceServlet.java @@ -17,9 +17,9 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse;
-import org.torproject.onionoo.util.ApplicationFactory; import org.torproject.onionoo.util.DateTimeHelper; import org.torproject.onionoo.util.Time; +import org.torproject.onionoo.util.TimeFactory;
public class ResourceServlet extends HttpServlet {
@@ -39,7 +39,7 @@ public class ResourceServlet extends HttpServlet { if (this.maintenanceMode) { return super.getLastModified(request); } else { - return ApplicationFactory.getNodeIndexer().getLastIndexed( + return NodeIndexerFactory.getNodeIndexer().getLastIndexed( DateTimeHelper.TEN_SECONDS); } } @@ -61,9 +61,9 @@ public class ResourceServlet extends HttpServlet { return; }
- long nowMillis = ApplicationFactory.getTime().currentTimeMillis(); + long nowMillis = TimeFactory.getTime().currentTimeMillis(); long indexWrittenMillis = - ApplicationFactory.getNodeIndexer().getLastIndexed( + NodeIndexerFactory.getNodeIndexer().getLastIndexed( DateTimeHelper.TEN_SECONDS); long indexAgeMillis = nowMillis - indexWrittenMillis; if (indexAgeMillis > DateTimeHelper.SIX_HOURS) { @@ -74,14 +74,14 @@ public class ResourceServlet extends HttpServlet { ((DateTimeHelper.FOURTY_FIVE_MINUTES - indexAgeMillis) / DateTimeHelper.FIVE_MINUTES) * DateTimeHelper.FIVE_MINUTES);
- NodeIndex nodeIndex = ApplicationFactory.getNodeIndexer(). + NodeIndex nodeIndex = NodeIndexerFactory.getNodeIndexer(). getLatestNodeIndex(DateTimeHelper.TEN_SECONDS); if (nodeIndex == null) { response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); return; }
- Time time = ApplicationFactory.getTime(); + Time time = TimeFactory.getTime(); long receivedRequestMillis = time.currentTimeMillis();
String uri = request.getRequestURI(); diff --git a/src/main/java/org/torproject/onionoo/server/ResponseBuilder.java b/src/main/java/org/torproject/onionoo/server/ResponseBuilder.java index 458f7db..676a039 100644 --- a/src/main/java/org/torproject/onionoo/server/ResponseBuilder.java +++ b/src/main/java/org/torproject/onionoo/server/ResponseBuilder.java @@ -10,10 +10,10 @@ import org.torproject.onionoo.docs.BandwidthDocument; import org.torproject.onionoo.docs.ClientsDocument; import org.torproject.onionoo.docs.DetailsDocument; import org.torproject.onionoo.docs.DocumentStore; +import org.torproject.onionoo.docs.DocumentStoreFactory; import org.torproject.onionoo.docs.SummaryDocument; import org.torproject.onionoo.docs.UptimeDocument; import org.torproject.onionoo.docs.WeightsDocument; -import org.torproject.onionoo.util.ApplicationFactory;
import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -23,7 +23,7 @@ public class ResponseBuilder { private DocumentStore documentStore;
public ResponseBuilder() { - this.documentStore = ApplicationFactory.getDocumentStore(); + this.documentStore = DocumentStoreFactory.getDocumentStore(); }
private String resourceType; diff --git a/src/main/java/org/torproject/onionoo/updater/BandwidthStatusUpdater.java b/src/main/java/org/torproject/onionoo/updater/BandwidthStatusUpdater.java index bc7dd74..d9d5e14 100644 --- a/src/main/java/org/torproject/onionoo/updater/BandwidthStatusUpdater.java +++ b/src/main/java/org/torproject/onionoo/updater/BandwidthStatusUpdater.java @@ -9,8 +9,9 @@ import org.torproject.descriptor.Descriptor; import org.torproject.descriptor.ExtraInfoDescriptor; import org.torproject.onionoo.docs.BandwidthStatus; import org.torproject.onionoo.docs.DocumentStore; -import org.torproject.onionoo.util.ApplicationFactory; +import org.torproject.onionoo.docs.DocumentStoreFactory; import org.torproject.onionoo.util.DateTimeHelper; +import org.torproject.onionoo.util.TimeFactory;
public class BandwidthStatusUpdater implements DescriptorListener, StatusUpdater { @@ -22,9 +23,9 @@ public class BandwidthStatusUpdater implements DescriptorListener, private long now;
public BandwidthStatusUpdater() { - this.descriptorSource = ApplicationFactory.getDescriptorSource(); - this.documentStore = ApplicationFactory.getDocumentStore(); - this.now = ApplicationFactory.getTime().currentTimeMillis(); + this.descriptorSource = DescriptorSourceFactory.getDescriptorSource(); + this.documentStore = DocumentStoreFactory.getDocumentStore(); + this.now = TimeFactory.getTime().currentTimeMillis(); this.registerDescriptorListeners(); }
diff --git a/src/main/java/org/torproject/onionoo/updater/ClientsStatusUpdater.java b/src/main/java/org/torproject/onionoo/updater/ClientsStatusUpdater.java index 79c1060..72d5142 100644 --- a/src/main/java/org/torproject/onionoo/updater/ClientsStatusUpdater.java +++ b/src/main/java/org/torproject/onionoo/updater/ClientsStatusUpdater.java @@ -13,9 +13,10 @@ import org.torproject.descriptor.ExtraInfoDescriptor; import org.torproject.onionoo.docs.ClientsHistory; import org.torproject.onionoo.docs.ClientsStatus; import org.torproject.onionoo.docs.DocumentStore; -import org.torproject.onionoo.util.ApplicationFactory; +import org.torproject.onionoo.docs.DocumentStoreFactory; import org.torproject.onionoo.util.DateTimeHelper; import org.torproject.onionoo.util.Logger; +import org.torproject.onionoo.util.TimeFactory;
/* * Example extra-info descriptor used as input: @@ -45,9 +46,9 @@ public class ClientsStatusUpdater implements DescriptorListener, private long now;
public ClientsStatusUpdater() { - this.descriptorSource = ApplicationFactory.getDescriptorSource(); - this.documentStore = ApplicationFactory.getDocumentStore(); - this.now = ApplicationFactory.getTime().currentTimeMillis(); + this.descriptorSource = DescriptorSourceFactory.getDescriptorSource(); + this.documentStore = DocumentStoreFactory.getDocumentStore(); + this.now = TimeFactory.getTime().currentTimeMillis(); this.registerDescriptorListeners(); }
diff --git a/src/main/java/org/torproject/onionoo/updater/NodeDetailsStatusUpdater.java b/src/main/java/org/torproject/onionoo/updater/NodeDetailsStatusUpdater.java index c687704..09eef9b 100644 --- a/src/main/java/org/torproject/onionoo/updater/NodeDetailsStatusUpdater.java +++ b/src/main/java/org/torproject/onionoo/updater/NodeDetailsStatusUpdater.java @@ -23,10 +23,11 @@ import org.torproject.descriptor.RelayNetworkStatusConsensus; import org.torproject.descriptor.ServerDescriptor; import org.torproject.onionoo.docs.DetailsStatus; import org.torproject.onionoo.docs.DocumentStore; +import org.torproject.onionoo.docs.DocumentStoreFactory; import org.torproject.onionoo.docs.NodeStatus; -import org.torproject.onionoo.util.ApplicationFactory; import org.torproject.onionoo.util.DateTimeHelper; import org.torproject.onionoo.util.Logger; +import org.torproject.onionoo.util.TimeFactory;
public class NodeDetailsStatusUpdater implements DescriptorListener, StatusUpdater { @@ -59,11 +60,11 @@ public class NodeDetailsStatusUpdater implements DescriptorListener, public NodeDetailsStatusUpdater( ReverseDomainNameResolver reverseDomainNameResolver, LookupService lookupService) { - this.descriptorSource = ApplicationFactory.getDescriptorSource(); + this.descriptorSource = DescriptorSourceFactory.getDescriptorSource(); this.reverseDomainNameResolver = reverseDomainNameResolver; this.lookupService = lookupService; - this.documentStore = ApplicationFactory.getDocumentStore(); - this.now = ApplicationFactory.getTime().currentTimeMillis(); + this.documentStore = DocumentStoreFactory.getDocumentStore(); + this.now = TimeFactory.getTime().currentTimeMillis(); this.registerDescriptorListeners(); }
diff --git a/src/main/java/org/torproject/onionoo/updater/ReverseDomainNameResolver.java b/src/main/java/org/torproject/onionoo/updater/ReverseDomainNameResolver.java index 8694155..833c900 100644 --- a/src/main/java/org/torproject/onionoo/updater/ReverseDomainNameResolver.java +++ b/src/main/java/org/torproject/onionoo/updater/ReverseDomainNameResolver.java @@ -10,17 +10,17 @@ import java.util.List; import java.util.Map; import java.util.Set;
-import org.torproject.onionoo.util.ApplicationFactory; import org.torproject.onionoo.util.DateTimeHelper; import org.torproject.onionoo.util.Logger; import org.torproject.onionoo.util.Time; +import org.torproject.onionoo.util.TimeFactory;
public class ReverseDomainNameResolver {
Time time;
public ReverseDomainNameResolver() { - this.time = ApplicationFactory.getTime(); + this.time = TimeFactory.getTime(); }
static final long RDNS_LOOKUP_MAX_REQUEST_MILLIS = diff --git a/src/main/java/org/torproject/onionoo/updater/UptimeStatusUpdater.java b/src/main/java/org/torproject/onionoo/updater/UptimeStatusUpdater.java index 2a12caf..6a7a2b1 100644 --- a/src/main/java/org/torproject/onionoo/updater/UptimeStatusUpdater.java +++ b/src/main/java/org/torproject/onionoo/updater/UptimeStatusUpdater.java @@ -13,8 +13,8 @@ import org.torproject.descriptor.Descriptor; import org.torproject.descriptor.NetworkStatusEntry; import org.torproject.descriptor.RelayNetworkStatusConsensus; import org.torproject.onionoo.docs.DocumentStore; +import org.torproject.onionoo.docs.DocumentStoreFactory; import org.torproject.onionoo.docs.UptimeStatus; -import org.torproject.onionoo.util.ApplicationFactory; import org.torproject.onionoo.util.DateTimeHelper; import org.torproject.onionoo.util.Logger;
@@ -26,8 +26,8 @@ public class UptimeStatusUpdater implements DescriptorListener, private DocumentStore documentStore;
public UptimeStatusUpdater() { - this.descriptorSource = ApplicationFactory.getDescriptorSource(); - this.documentStore = ApplicationFactory.getDocumentStore(); + this.descriptorSource = DescriptorSourceFactory.getDescriptorSource(); + this.documentStore = DocumentStoreFactory.getDocumentStore(); this.registerDescriptorListeners(); }
@@ -113,10 +113,9 @@ public class UptimeStatusUpdater implements DescriptorListener, private void updateStatus(boolean relay, String fingerprint, SortedSet<Long> newUptimeHours) { UptimeStatus uptimeStatus = (fingerprint == null) ? - ApplicationFactory.getDocumentStore().retrieve( - UptimeStatus.class, true) : - ApplicationFactory.getDocumentStore().retrieve( - UptimeStatus.class, true, fingerprint); + this.documentStore.retrieve(UptimeStatus.class, true) : + this.documentStore.retrieve(UptimeStatus.class, true, + fingerprint); if (uptimeStatus == null) { uptimeStatus = new UptimeStatus(); } diff --git a/src/main/java/org/torproject/onionoo/updater/WeightsStatusUpdater.java b/src/main/java/org/torproject/onionoo/updater/WeightsStatusUpdater.java index 333afcc..f060470 100644 --- a/src/main/java/org/torproject/onionoo/updater/WeightsStatusUpdater.java +++ b/src/main/java/org/torproject/onionoo/updater/WeightsStatusUpdater.java @@ -14,9 +14,10 @@ import org.torproject.descriptor.NetworkStatusEntry; import org.torproject.descriptor.RelayNetworkStatusConsensus; import org.torproject.descriptor.ServerDescriptor; import org.torproject.onionoo.docs.DocumentStore; +import org.torproject.onionoo.docs.DocumentStoreFactory; import org.torproject.onionoo.docs.WeightsStatus; -import org.torproject.onionoo.util.ApplicationFactory; import org.torproject.onionoo.util.DateTimeHelper; +import org.torproject.onionoo.util.TimeFactory;
public class WeightsStatusUpdater implements DescriptorListener, StatusUpdater { @@ -28,9 +29,9 @@ public class WeightsStatusUpdater implements DescriptorListener, private long now;
public WeightsStatusUpdater() { - this.descriptorSource = ApplicationFactory.getDescriptorSource(); - this.documentStore = ApplicationFactory.getDocumentStore(); - this.now = ApplicationFactory.getTime().currentTimeMillis(); + this.descriptorSource = DescriptorSourceFactory.getDescriptorSource(); + this.documentStore = DocumentStoreFactory.getDocumentStore(); + this.now = TimeFactory.getTime().currentTimeMillis(); this.registerDescriptorListeners(); }
diff --git a/src/main/java/org/torproject/onionoo/util/ApplicationFactory.java b/src/main/java/org/torproject/onionoo/util/ApplicationFactory.java deleted file mode 100644 index 8eafca9..0000000 --- a/src/main/java/org/torproject/onionoo/util/ApplicationFactory.java +++ /dev/null @@ -1,55 +0,0 @@ -/* Copyright 2014 The Tor Project - * See LICENSE for licensing information */ -package org.torproject.onionoo.util; - -import org.torproject.onionoo.docs.DocumentStore; -import org.torproject.onionoo.server.NodeIndexer; -import org.torproject.onionoo.updater.DescriptorSource; - -public class ApplicationFactory { - - private static Time timeInstance; - public static void setTime(Time time) { - timeInstance = time; - } - public static Time getTime() { - if (timeInstance == null) { - timeInstance = new Time(); - } - return timeInstance; - } - - private static DescriptorSource descriptorSourceInstance; - public static void setDescriptorSource( - DescriptorSource descriptorSource) { - descriptorSourceInstance = descriptorSource; - } - public static DescriptorSource getDescriptorSource() { - if (descriptorSourceInstance == null) { - descriptorSourceInstance = new DescriptorSource(); - } - return descriptorSourceInstance; - } - - private static DocumentStore documentStoreInstance; - public static void setDocumentStore(DocumentStore documentStore) { - documentStoreInstance = documentStore; - } - public static DocumentStore getDocumentStore() { - if (documentStoreInstance == null) { - documentStoreInstance = new DocumentStore(); - } - return documentStoreInstance; - } - - private static NodeIndexer nodeIndexerInstance; - public static void setNodeIndexer(NodeIndexer nodeIndexer) { - nodeIndexerInstance = nodeIndexer; - } - public static NodeIndexer getNodeIndexer() { - if (nodeIndexerInstance == null) { - nodeIndexerInstance = new NodeIndexer(); - } - return nodeIndexerInstance; - } -} diff --git a/src/main/java/org/torproject/onionoo/util/LockFile.java b/src/main/java/org/torproject/onionoo/util/LockFile.java index 01c4dcb..9c6b723 100644 --- a/src/main/java/org/torproject/onionoo/util/LockFile.java +++ b/src/main/java/org/torproject/onionoo/util/LockFile.java @@ -12,7 +12,7 @@ public class LockFile { private final File lockFile = new File("lock");
public boolean acquireLock() { - Time time = ApplicationFactory.getTime(); + Time time = TimeFactory.getTime(); try { if (this.lockFile.exists()) { return false; diff --git a/src/main/java/org/torproject/onionoo/util/Logger.java b/src/main/java/org/torproject/onionoo/util/Logger.java index 443c1ca..b85059d 100644 --- a/src/main/java/org/torproject/onionoo/util/Logger.java +++ b/src/main/java/org/torproject/onionoo/util/Logger.java @@ -12,7 +12,7 @@ public class Logger { private static Time time;
public static void setTime() { - time = ApplicationFactory.getTime(); + time = TimeFactory.getTime(); }
private static long currentTimeMillis() { diff --git a/src/main/java/org/torproject/onionoo/writer/BandwidthDocumentWriter.java b/src/main/java/org/torproject/onionoo/writer/BandwidthDocumentWriter.java index 908ec7c..c5ae22e 100644 --- a/src/main/java/org/torproject/onionoo/writer/BandwidthDocumentWriter.java +++ b/src/main/java/org/torproject/onionoo/writer/BandwidthDocumentWriter.java @@ -14,13 +14,15 @@ import java.util.SortedSet; import org.torproject.onionoo.docs.BandwidthDocument; import org.torproject.onionoo.docs.BandwidthStatus; import org.torproject.onionoo.docs.DocumentStore; +import org.torproject.onionoo.docs.DocumentStoreFactory; import org.torproject.onionoo.docs.GraphHistory; import org.torproject.onionoo.updater.DescriptorSource; +import org.torproject.onionoo.updater.DescriptorSourceFactory; import org.torproject.onionoo.updater.DescriptorType; import org.torproject.onionoo.updater.FingerprintListener; -import org.torproject.onionoo.util.ApplicationFactory; import org.torproject.onionoo.util.DateTimeHelper; import org.torproject.onionoo.util.Logger; +import org.torproject.onionoo.util.TimeFactory;
public class BandwidthDocumentWriter implements FingerprintListener, DocumentWriter{ @@ -32,9 +34,9 @@ public class BandwidthDocumentWriter implements FingerprintListener, private long now;
public BandwidthDocumentWriter() { - this.descriptorSource = ApplicationFactory.getDescriptorSource(); - this.documentStore = ApplicationFactory.getDocumentStore(); - this.now = ApplicationFactory.getTime().currentTimeMillis(); + this.descriptorSource = DescriptorSourceFactory.getDescriptorSource(); + this.documentStore = DocumentStoreFactory.getDocumentStore(); + this.now = TimeFactory.getTime().currentTimeMillis(); this.registerFingerprintListeners(); }
diff --git a/src/main/java/org/torproject/onionoo/writer/ClientsDocumentWriter.java b/src/main/java/org/torproject/onionoo/writer/ClientsDocumentWriter.java index 976804c..ae64f86 100644 --- a/src/main/java/org/torproject/onionoo/writer/ClientsDocumentWriter.java +++ b/src/main/java/org/torproject/onionoo/writer/ClientsDocumentWriter.java @@ -16,12 +16,14 @@ import org.torproject.onionoo.docs.ClientsGraphHistory; import org.torproject.onionoo.docs.ClientsHistory; import org.torproject.onionoo.docs.ClientsStatus; import org.torproject.onionoo.docs.DocumentStore; +import org.torproject.onionoo.docs.DocumentStoreFactory; import org.torproject.onionoo.updater.DescriptorSource; +import org.torproject.onionoo.updater.DescriptorSourceFactory; import org.torproject.onionoo.updater.DescriptorType; import org.torproject.onionoo.updater.FingerprintListener; -import org.torproject.onionoo.util.ApplicationFactory; import org.torproject.onionoo.util.DateTimeHelper; import org.torproject.onionoo.util.Logger; +import org.torproject.onionoo.util.TimeFactory;
/* * Clients status file produced as intermediate output: @@ -56,9 +58,9 @@ public class ClientsDocumentWriter implements FingerprintListener, private long now;
public ClientsDocumentWriter() { - this.descriptorSource = ApplicationFactory.getDescriptorSource(); - this.documentStore = ApplicationFactory.getDocumentStore(); - this.now = ApplicationFactory.getTime().currentTimeMillis(); + this.descriptorSource = DescriptorSourceFactory.getDescriptorSource(); + this.documentStore = DocumentStoreFactory.getDocumentStore(); + this.now = TimeFactory.getTime().currentTimeMillis(); this.registerFingerprintListeners(); }
diff --git a/src/main/java/org/torproject/onionoo/writer/DetailsDocumentWriter.java b/src/main/java/org/torproject/onionoo/writer/DetailsDocumentWriter.java index 03f7024..8e2cb9f 100644 --- a/src/main/java/org/torproject/onionoo/writer/DetailsDocumentWriter.java +++ b/src/main/java/org/torproject/onionoo/writer/DetailsDocumentWriter.java @@ -11,13 +11,15 @@ import java.util.TreeSet; import org.torproject.onionoo.docs.DetailsDocument; import org.torproject.onionoo.docs.DetailsStatus; import org.torproject.onionoo.docs.DocumentStore; +import org.torproject.onionoo.docs.DocumentStoreFactory; import org.torproject.onionoo.docs.NodeStatus; import org.torproject.onionoo.updater.DescriptorSource; +import org.torproject.onionoo.updater.DescriptorSourceFactory; import org.torproject.onionoo.updater.DescriptorType; import org.torproject.onionoo.updater.FingerprintListener; -import org.torproject.onionoo.util.ApplicationFactory; import org.torproject.onionoo.util.DateTimeHelper; import org.torproject.onionoo.util.Logger; +import org.torproject.onionoo.util.TimeFactory;
public class DetailsDocumentWriter implements FingerprintListener, DocumentWriter { @@ -29,9 +31,9 @@ public class DetailsDocumentWriter implements FingerprintListener, private long now;
public DetailsDocumentWriter() { - this.descriptorSource = ApplicationFactory.getDescriptorSource(); - this.documentStore = ApplicationFactory.getDocumentStore(); - this.now = ApplicationFactory.getTime().currentTimeMillis(); + this.descriptorSource = DescriptorSourceFactory.getDescriptorSource(); + this.documentStore = DocumentStoreFactory.getDocumentStore(); + this.now = TimeFactory.getTime().currentTimeMillis(); this.registerFingerprintListeners(); }
diff --git a/src/main/java/org/torproject/onionoo/writer/SummaryDocumentWriter.java b/src/main/java/org/torproject/onionoo/writer/SummaryDocumentWriter.java index 1b4630e..c175533 100644 --- a/src/main/java/org/torproject/onionoo/writer/SummaryDocumentWriter.java +++ b/src/main/java/org/torproject/onionoo/writer/SummaryDocumentWriter.java @@ -7,9 +7,9 @@ import java.util.List; import java.util.SortedSet;
import org.torproject.onionoo.docs.DocumentStore; +import org.torproject.onionoo.docs.DocumentStoreFactory; import org.torproject.onionoo.docs.NodeStatus; import org.torproject.onionoo.docs.SummaryDocument; -import org.torproject.onionoo.util.ApplicationFactory; import org.torproject.onionoo.util.DateTimeHelper; import org.torproject.onionoo.util.Logger;
@@ -18,7 +18,7 @@ public class SummaryDocumentWriter implements DocumentWriter { private DocumentStore documentStore;
public SummaryDocumentWriter() { - this.documentStore = ApplicationFactory.getDocumentStore(); + this.documentStore = DocumentStoreFactory.getDocumentStore(); }
private int writtenDocuments = 0, deletedDocuments = 0; diff --git a/src/main/java/org/torproject/onionoo/writer/UptimeDocumentWriter.java b/src/main/java/org/torproject/onionoo/writer/UptimeDocumentWriter.java index 3e04abb..f58ec93 100644 --- a/src/main/java/org/torproject/onionoo/writer/UptimeDocumentWriter.java +++ b/src/main/java/org/torproject/onionoo/writer/UptimeDocumentWriter.java @@ -10,16 +10,18 @@ import java.util.SortedSet; import java.util.TreeSet;
import org.torproject.onionoo.docs.DocumentStore; +import org.torproject.onionoo.docs.DocumentStoreFactory; import org.torproject.onionoo.docs.GraphHistory; import org.torproject.onionoo.docs.UptimeDocument; import org.torproject.onionoo.docs.UptimeHistory; import org.torproject.onionoo.docs.UptimeStatus; import org.torproject.onionoo.updater.DescriptorSource; +import org.torproject.onionoo.updater.DescriptorSourceFactory; import org.torproject.onionoo.updater.DescriptorType; import org.torproject.onionoo.updater.FingerprintListener; -import org.torproject.onionoo.util.ApplicationFactory; import org.torproject.onionoo.util.DateTimeHelper; import org.torproject.onionoo.util.Logger; +import org.torproject.onionoo.util.TimeFactory;
public class UptimeDocumentWriter implements FingerprintListener, DocumentWriter { @@ -31,9 +33,9 @@ public class UptimeDocumentWriter implements FingerprintListener, private long now;
public UptimeDocumentWriter() { - this.descriptorSource = ApplicationFactory.getDescriptorSource(); - this.documentStore = ApplicationFactory.getDocumentStore(); - this.now = ApplicationFactory.getTime().currentTimeMillis(); + this.descriptorSource = DescriptorSourceFactory.getDescriptorSource(); + this.documentStore = DocumentStoreFactory.getDocumentStore(); + this.now = TimeFactory.getTime().currentTimeMillis(); this.registerFingerprintListeners(); }
diff --git a/src/main/java/org/torproject/onionoo/writer/WeightsDocumentWriter.java b/src/main/java/org/torproject/onionoo/writer/WeightsDocumentWriter.java index ddd2774..e0601c1 100644 --- a/src/main/java/org/torproject/onionoo/writer/WeightsDocumentWriter.java +++ b/src/main/java/org/torproject/onionoo/writer/WeightsDocumentWriter.java @@ -12,15 +12,17 @@ import java.util.SortedMap; import java.util.SortedSet;
import org.torproject.onionoo.docs.DocumentStore; +import org.torproject.onionoo.docs.DocumentStoreFactory; import org.torproject.onionoo.docs.GraphHistory; import org.torproject.onionoo.docs.WeightsDocument; import org.torproject.onionoo.docs.WeightsStatus; import org.torproject.onionoo.updater.DescriptorSource; +import org.torproject.onionoo.updater.DescriptorSourceFactory; import org.torproject.onionoo.updater.DescriptorType; import org.torproject.onionoo.updater.FingerprintListener; -import org.torproject.onionoo.util.ApplicationFactory; import org.torproject.onionoo.util.DateTimeHelper; import org.torproject.onionoo.util.Logger; +import org.torproject.onionoo.util.TimeFactory;
public class WeightsDocumentWriter implements FingerprintListener, DocumentWriter { @@ -32,9 +34,9 @@ public class WeightsDocumentWriter implements FingerprintListener, private long now;
public WeightsDocumentWriter() { - this.descriptorSource = ApplicationFactory.getDescriptorSource(); - this.documentStore = ApplicationFactory.getDocumentStore(); - this.now = ApplicationFactory.getTime().currentTimeMillis(); + this.descriptorSource = DescriptorSourceFactory.getDescriptorSource(); + this.documentStore = DocumentStoreFactory.getDocumentStore(); + this.now = TimeFactory.getTime().currentTimeMillis(); this.registerFingerprintListeners(); }
diff --git a/src/test/java/org/torproject/onionoo/ResourceServletTest.java b/src/test/java/org/torproject/onionoo/ResourceServletTest.java index d27f499..db359e8 100644 --- a/src/test/java/org/torproject/onionoo/ResourceServletTest.java +++ b/src/test/java/org/torproject/onionoo/ResourceServletTest.java @@ -21,14 +21,16 @@ import java.util.TreeSet;
import org.junit.Before; import org.junit.Test; +import org.torproject.onionoo.docs.DocumentStoreFactory; import org.torproject.onionoo.docs.UpdateStatus; import org.torproject.onionoo.server.HttpServletRequestWrapper; import org.torproject.onionoo.server.HttpServletResponseWrapper; import org.torproject.onionoo.server.NodeIndexer; +import org.torproject.onionoo.server.NodeIndexerFactory; import org.torproject.onionoo.server.ResourceServlet; -import org.torproject.onionoo.util.ApplicationFactory; import org.torproject.onionoo.util.DateTimeHelper; import org.torproject.onionoo.util.Time; +import org.torproject.onionoo.util.TimeFactory;
import com.google.gson.Gson;
@@ -198,7 +200,7 @@ public class ResourceServletTest {
private void createDummyTime() { Time dummyTime = new DummyTime(this.currentTimeMillis); - ApplicationFactory.setTime(dummyTime); + TimeFactory.setTime(dummyTime); }
private void createDummyDocumentStore() { @@ -215,13 +217,13 @@ public class ResourceServletTest { this.bridges.entrySet()) { documentStore.addDocument(e.getValue(), e.getKey()); } - ApplicationFactory.setDocumentStore(documentStore); + DocumentStoreFactory.setDocumentStore(documentStore); }
private void createNodeIndexer() { NodeIndexer newNodeIndexer = new NodeIndexer(); newNodeIndexer.startIndexing(); - ApplicationFactory.setNodeIndexer(newNodeIndexer); + NodeIndexerFactory.setNodeIndexer(newNodeIndexer); }
private void makeRequest(String requestURI, diff --git a/src/test/java/org/torproject/onionoo/UptimeDocumentWriterTest.java b/src/test/java/org/torproject/onionoo/UptimeDocumentWriterTest.java index 5a77514..f430c0b 100644 --- a/src/test/java/org/torproject/onionoo/UptimeDocumentWriterTest.java +++ b/src/test/java/org/torproject/onionoo/UptimeDocumentWriterTest.java @@ -10,12 +10,14 @@ import java.util.List;
import org.junit.Before; import org.junit.Test; +import org.torproject.onionoo.docs.DocumentStoreFactory; import org.torproject.onionoo.docs.GraphHistory; import org.torproject.onionoo.docs.UptimeDocument; import org.torproject.onionoo.docs.UptimeStatus; +import org.torproject.onionoo.updater.DescriptorSourceFactory; import org.torproject.onionoo.updater.DescriptorType; -import org.torproject.onionoo.util.ApplicationFactory; import org.torproject.onionoo.util.DateTimeHelper; +import org.torproject.onionoo.util.TimeFactory; import org.torproject.onionoo.writer.UptimeDocumentWriter;
public class UptimeDocumentWriterTest { @@ -28,7 +30,7 @@ public class UptimeDocumentWriterTest { @Before public void createDummyTime() { this.dummyTime = new DummyTime(TEST_TIME); - ApplicationFactory.setTime(this.dummyTime); + TimeFactory.setTime(this.dummyTime); }
private DummyDescriptorSource descriptorSource; @@ -36,7 +38,7 @@ public class UptimeDocumentWriterTest { @Before public void createDummyDescriptorSource() { this.descriptorSource = new DummyDescriptorSource(); - ApplicationFactory.setDescriptorSource(this.descriptorSource); + DescriptorSourceFactory.setDescriptorSource(this.descriptorSource); }
private DummyDocumentStore documentStore; @@ -44,7 +46,7 @@ public class UptimeDocumentWriterTest { @Before public void createDummyDocumentStore() { this.documentStore = new DummyDocumentStore(); - ApplicationFactory.setDocumentStore(this.documentStore); + DocumentStoreFactory.setDocumentStore(this.documentStore); }
@Test @@ -122,7 +124,7 @@ public class UptimeDocumentWriterTest { this.addStatusOneWeekSample("r 2014-03-23-11 1\n", "r 2014-03-23-11 1\n"); UptimeDocumentWriter writer = new UptimeDocumentWriter(); - ApplicationFactory.getDescriptorSource().readDescriptors(); + DescriptorSourceFactory.getDescriptorSource().readDescriptors(); writer.writeDocuments(); assertEquals("Should write exactly one document.", 1, this.documentStore.getPerformedStoreOperations()); @@ -137,7 +139,7 @@ public class UptimeDocumentWriterTest { this.addStatusOneWeekSample("r 2014-03-23-10 2\n", "r 2014-03-23-10 2\n"); UptimeDocumentWriter writer = new UptimeDocumentWriter(); - ApplicationFactory.getDescriptorSource().readDescriptors(); + DescriptorSourceFactory.getDescriptorSource().readDescriptors(); writer.writeDocuments(); assertEquals("Should write exactly one document.", 1, this.documentStore.getPerformedStoreOperations()); @@ -152,7 +154,7 @@ public class UptimeDocumentWriterTest { this.addStatusOneWeekSample("r 2014-03-23-09 1\nr 2014-03-23-11 1\n", "r 2014-03-23-09 1\nr 2014-03-23-11 1\n"); UptimeDocumentWriter writer = new UptimeDocumentWriter(); - ApplicationFactory.getDescriptorSource().readDescriptors(); + DescriptorSourceFactory.getDescriptorSource().readDescriptors(); writer.writeDocuments(); assertEquals("Should write exactly one document.", 1, this.documentStore.getPerformedStoreOperations()); @@ -167,7 +169,7 @@ public class UptimeDocumentWriterTest { this.addStatusOneWeekSample("r 2014-03-23-09 3\n", "r 2014-03-23-09 1\nr 2014-03-23-11 1\n"); UptimeDocumentWriter writer = new UptimeDocumentWriter(); - ApplicationFactory.getDescriptorSource().readDescriptors(); + DescriptorSourceFactory.getDescriptorSource().readDescriptors(); writer.writeDocuments(); assertEquals("Should write exactly one document.", 1, this.documentStore.getPerformedStoreOperations()); @@ -183,7 +185,7 @@ public class UptimeDocumentWriterTest { this.addStatusOneWeekSample("r 2014-03-23-09 3\n", "r 2014-03-23-09 2\n"); UptimeDocumentWriter writer = new UptimeDocumentWriter(); - ApplicationFactory.getDescriptorSource().readDescriptors(); + DescriptorSourceFactory.getDescriptorSource().readDescriptors(); writer.writeDocuments(); assertEquals("Should write exactly one document.", 1, this.documentStore.getPerformedStoreOperations()); @@ -199,7 +201,7 @@ public class UptimeDocumentWriterTest { this.addStatusOneWeekSample("r 2014-03-16-12 168\n", "r 2014-03-16-12 168\n"); UptimeDocumentWriter writer = new UptimeDocumentWriter(); - ApplicationFactory.getDescriptorSource().readDescriptors(); + DescriptorSourceFactory.getDescriptorSource().readDescriptors(); writer.writeDocuments(); assertEquals("Should write exactly one document.", 1, this.documentStore.getPerformedStoreOperations()); @@ -214,7 +216,7 @@ public class UptimeDocumentWriterTest { this.addStatusOneWeekSample("r 2014-03-16-11 169\n", "r 2014-03-16-11 169\n"); UptimeDocumentWriter writer = new UptimeDocumentWriter(); - ApplicationFactory.getDescriptorSource().readDescriptors(); + DescriptorSourceFactory.getDescriptorSource().readDescriptors(); writer.writeDocuments(); assertEquals("Should write exactly one document.", 1, this.documentStore.getPerformedStoreOperations()); @@ -231,7 +233,7 @@ public class UptimeDocumentWriterTest { this.addStatusOneWeekSample("r 2014-03-16-08 8\n", "r 2014-03-16-11 5\n"); UptimeDocumentWriter writer = new UptimeDocumentWriter(); - ApplicationFactory.getDescriptorSource().readDescriptors(); + DescriptorSourceFactory.getDescriptorSource().readDescriptors(); writer.writeDocuments(); assertEquals("Should write exactly one document.", 1, this.documentStore.getPerformedStoreOperations()); @@ -246,7 +248,7 @@ public class UptimeDocumentWriterTest { this.addStatusOneWeekSample("r 2014-03-16-08 8\n", "r 2014-03-16-10 1\nr 2014-03-16-12 1\n"); UptimeDocumentWriter writer = new UptimeDocumentWriter(); - ApplicationFactory.getDescriptorSource().readDescriptors(); + DescriptorSourceFactory.getDescriptorSource().readDescriptors(); writer.writeDocuments(); assertEquals("Should write exactly one document.", 1, this.documentStore.getPerformedStoreOperations()); diff --git a/src/test/java/org/torproject/onionoo/UptimeStatusTest.java b/src/test/java/org/torproject/onionoo/UptimeStatusTest.java index 9e235d5..f981da3 100644 --- a/src/test/java/org/torproject/onionoo/UptimeStatusTest.java +++ b/src/test/java/org/torproject/onionoo/UptimeStatusTest.java @@ -12,9 +12,9 @@ import java.util.TreeSet;
import org.junit.Before; import org.junit.Test; +import org.torproject.onionoo.docs.DocumentStoreFactory; import org.torproject.onionoo.docs.UptimeHistory; import org.torproject.onionoo.docs.UptimeStatus; -import org.torproject.onionoo.util.ApplicationFactory; import org.torproject.onionoo.util.DateTimeHelper;
public class UptimeStatusTest { @@ -24,7 +24,7 @@ public class UptimeStatusTest { @Before public void createDummyDocumentStore() { this.documentStore = new DummyDocumentStore(); - ApplicationFactory.setDocumentStore(this.documentStore); + DocumentStoreFactory.setDocumentStore(this.documentStore); }
private static final String MORIA1_FINGERPRINT = diff --git a/src/test/java/org/torproject/onionoo/UptimeStatusUpdaterTest.java b/src/test/java/org/torproject/onionoo/UptimeStatusUpdaterTest.java index 8070ae4..3620b7c 100644 --- a/src/test/java/org/torproject/onionoo/UptimeStatusUpdaterTest.java +++ b/src/test/java/org/torproject/onionoo/UptimeStatusUpdaterTest.java @@ -6,11 +6,12 @@ import static org.junit.Assert.assertEquals;
import org.junit.Before; import org.junit.Test; +import org.torproject.onionoo.docs.DocumentStoreFactory; import org.torproject.onionoo.docs.UptimeHistory; import org.torproject.onionoo.docs.UptimeStatus; +import org.torproject.onionoo.updater.DescriptorSourceFactory; import org.torproject.onionoo.updater.DescriptorType; import org.torproject.onionoo.updater.UptimeStatusUpdater; -import org.torproject.onionoo.util.ApplicationFactory; import org.torproject.onionoo.util.DateTimeHelper;
public class UptimeStatusUpdaterTest { @@ -20,7 +21,7 @@ public class UptimeStatusUpdaterTest { @Before public void createDummyDescriptorSource() { this.descriptorSource = new DummyDescriptorSource(); - ApplicationFactory.setDescriptorSource(this.descriptorSource); + DescriptorSourceFactory.setDescriptorSource(this.descriptorSource); }
private DummyDocumentStore documentStore; @@ -28,13 +29,13 @@ public class UptimeStatusUpdaterTest { @Before public void createDummyDocumentStore() { this.documentStore = new DummyDocumentStore(); - ApplicationFactory.setDocumentStore(this.documentStore); + DocumentStoreFactory.setDocumentStore(this.documentStore); }
@Test public void testNoDescriptorsNoStatusFiles() { UptimeStatusUpdater updater = new UptimeStatusUpdater(); - ApplicationFactory.getDescriptorSource().readDescriptors(); + DescriptorSourceFactory.getDescriptorSource().readDescriptors(); updater.updateStatuses(); assertEquals("Without providing any data, nothing should be written " + "to disk.", 0, @@ -62,7 +63,7 @@ public class UptimeStatusUpdaterTest { public void testOneConsensusNoStatusFiles() { this.addConsensusSample(); UptimeStatusUpdater updater = new UptimeStatusUpdater(); - ApplicationFactory.getDescriptorSource().readDescriptors(); + DescriptorSourceFactory.getDescriptorSource().readDescriptors(); updater.updateStatuses(); assertEquals("Two status files should have been written to disk.", 2, this.documentStore.getPerformedStoreOperations()); @@ -99,7 +100,7 @@ public class UptimeStatusUpdaterTest { this.addAllRelaysAndBridgesUptimeSample(); this.addConsensusSample(); UptimeStatusUpdater updater = new UptimeStatusUpdater(); - ApplicationFactory.getDescriptorSource().readDescriptors(); + DescriptorSourceFactory.getDescriptorSource().readDescriptors(); updater.updateStatuses(); assertEquals("Two status files should have been written to disk.", 2, this.documentStore.getPerformedStoreOperations()); @@ -137,7 +138,7 @@ public class UptimeStatusUpdaterTest { public void testOneBridgeStatusNoStatusFiles() { this.addBridgeStatusSample(); UptimeStatusUpdater updater = new UptimeStatusUpdater(); - ApplicationFactory.getDescriptorSource().readDescriptors(); + DescriptorSourceFactory.getDescriptorSource().readDescriptors(); updater.updateStatuses(); assertEquals("Two status files should have been written to disk.", 2, this.documentStore.getPerformedStoreOperations()); @@ -162,7 +163,7 @@ public class UptimeStatusUpdaterTest { this.addAllRelaysAndBridgesUptimeSample(); this.addBridgeStatusSample(); UptimeStatusUpdater updater = new UptimeStatusUpdater(); - ApplicationFactory.getDescriptorSource().readDescriptors(); + DescriptorSourceFactory.getDescriptorSource().readDescriptors(); updater.updateStatuses(); assertEquals("Two status files should have been written to disk.", 2, this.documentStore.getPerformedStoreOperations());
tor-commits@lists.torproject.org