[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [onionoo/release] Removes DetailsDocumentFields interface



commit 6baeaa81ffd5d076afc2e800fb1b030ba7cbcc53
Author: Iain R. Learmonth <irl@xxxxxxxx>
Date:   Fri Aug 17 09:48:36 2018 +0100

    Removes DetailsDocumentFields interface
    
    This interface only ever provided two of the many fields in details
    documents.
    
    Fixes: #27180
---
 .../org/torproject/onionoo/docs/DetailsDocumentFields.java  | 13 -------------
 .../org/torproject/onionoo/server/OrderParameterValues.java | 10 ++++------
 .../java/org/torproject/onionoo/server/ResponseBuilder.java |  5 ++---
 .../onionoo/server/SummaryDocumentComparatorTest.java       |  3 +--
 4 files changed, 7 insertions(+), 24 deletions(-)

diff --git a/src/main/java/org/torproject/onionoo/docs/DetailsDocumentFields.java b/src/main/java/org/torproject/onionoo/docs/DetailsDocumentFields.java
deleted file mode 100644
index 2abcd53..0000000
--- a/src/main/java/org/torproject/onionoo/docs/DetailsDocumentFields.java
+++ /dev/null
@@ -1,13 +0,0 @@
-/* Copyright 2017--2018 The Tor Project
- * See LICENSE for licensing information */
-
-package org.torproject.onionoo.docs;
-
-/** Provides constants for details document field names. */
-public interface DetailsDocumentFields {
-
-  public static final String FIRST_SEEN = "first_seen";
-
-  public static final String CONSENSUS_WEIGHT = "consensus_weight";
-}
-
diff --git a/src/main/java/org/torproject/onionoo/server/OrderParameterValues.java b/src/main/java/org/torproject/onionoo/server/OrderParameterValues.java
index 6f76a5f..ebfda12 100644
--- a/src/main/java/org/torproject/onionoo/server/OrderParameterValues.java
+++ b/src/main/java/org/torproject/onionoo/server/OrderParameterValues.java
@@ -3,22 +3,20 @@
 
 package org.torproject.onionoo.server;
 
-import org.torproject.onionoo.docs.DetailsDocumentFields;
-
 /** Provides constants for order parameter values. */
 public class OrderParameterValues {
 
   private static final String DESCENDING = "-";
 
-  public static final String FIRST_SEEN_ASC = DetailsDocumentFields.FIRST_SEEN;
+  public static final String FIRST_SEEN_ASC = "first_seen";
 
   public static final String FIRST_SEEN_DES =
-      DESCENDING + DetailsDocumentFields.FIRST_SEEN;
+      DESCENDING + FIRST_SEEN_ASC;
 
   public static final String CONSENSUS_WEIGHT_ASC =
-      DetailsDocumentFields.CONSENSUS_WEIGHT;
+      "consensus_weight";
 
   public static final String CONSENSUS_WEIGHT_DES =
-      DESCENDING + DetailsDocumentFields.CONSENSUS_WEIGHT;
+      DESCENDING + CONSENSUS_WEIGHT_ASC;
 }
 
diff --git a/src/main/java/org/torproject/onionoo/server/ResponseBuilder.java b/src/main/java/org/torproject/onionoo/server/ResponseBuilder.java
index a5bce5f..8b350b0 100644
--- a/src/main/java/org/torproject/onionoo/server/ResponseBuilder.java
+++ b/src/main/java/org/torproject/onionoo/server/ResponseBuilder.java
@@ -6,7 +6,6 @@ package org.torproject.onionoo.server;
 import org.torproject.onionoo.docs.BandwidthDocument;
 import org.torproject.onionoo.docs.ClientsDocument;
 import org.torproject.onionoo.docs.DetailsDocument;
-import org.torproject.onionoo.docs.DetailsDocumentFields;
 import org.torproject.onionoo.docs.DocumentStore;
 import org.torproject.onionoo.docs.DocumentStoreFactory;
 import org.torproject.onionoo.docs.SummaryDocument;
@@ -261,7 +260,7 @@ public class ResponseBuilder {
           } else if (field.equals("last_changed_address_or_port")) {
             dd.setLastChangedAddressOrPort(
                 detailsDocument.getLastChangedAddressOrPort());
-          } else if (field.equals(DetailsDocumentFields.FIRST_SEEN)) {
+          } else if (field.equals("first_seen")) {
             dd.setFirstSeen(detailsDocument.getFirstSeen());
           } else if (field.equals("running")) {
             dd.setRunning(detailsDocument.getRunning());
@@ -285,7 +284,7 @@ public class ResponseBuilder {
             dd.setAsNumber(detailsDocument.getAsNumber());
           } else if (field.equals("as_name")) {
             dd.setAsName(detailsDocument.getAsName());
-          } else if (field.equals(DetailsDocumentFields.CONSENSUS_WEIGHT)) {
+          } else if (field.equals("consensus_weight")) {
             dd.setConsensusWeight(detailsDocument.getConsensusWeight());
           } else if (field.equals("verified_host_names")) {
             dd.setVerifiedHostNames(detailsDocument.getVerifiedHostNames());
diff --git a/src/test/java/org/torproject/onionoo/server/SummaryDocumentComparatorTest.java b/src/test/java/org/torproject/onionoo/server/SummaryDocumentComparatorTest.java
index c87fa42..44db510 100644
--- a/src/test/java/org/torproject/onionoo/server/SummaryDocumentComparatorTest.java
+++ b/src/test/java/org/torproject/onionoo/server/SummaryDocumentComparatorTest.java
@@ -6,7 +6,6 @@ package org.torproject.onionoo.server;
 import static org.junit.Assert.assertEquals;
 
 import org.torproject.onionoo.docs.DateTimeHelper;
-import org.torproject.onionoo.docs.DetailsDocumentFields;
 import org.torproject.onionoo.docs.SummaryDocument;
 
 import org.hamcrest.Matchers;
@@ -73,7 +72,7 @@ public class SummaryDocumentComparatorTest {
   public SummaryDocumentComparatorTest(String order, long[] vals) {
     for (int i = 0; i < sd.length; i++) {
       sd[i] = createSummaryDoc();
-      if (order.contains(DetailsDocumentFields.FIRST_SEEN)) {
+      if (order.contains("first_seen")) {
         sd[i].setFirstSeenMillis(vals[i]);
       } else {
         sd[i].setConsensusWeight(vals[i]);



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits