Fix @author tags
diff --git a/src/main/java/com/intel/jndn/utils/Client.java b/src/main/java/com/intel/jndn/utils/Client.java
index 711d24c..e38d38d 100644
--- a/src/main/java/com/intel/jndn/utils/Client.java
+++ b/src/main/java/com/intel/jndn/utils/Client.java
@@ -13,17 +13,18 @@
*/
package com.intel.jndn.utils;
-import java.io.IOException;
-import java.util.concurrent.CompletableFuture;
import net.named_data.jndn.Data;
import net.named_data.jndn.Face;
import net.named_data.jndn.Interest;
import net.named_data.jndn.Name;
+import java.io.IOException;
+import java.util.concurrent.CompletableFuture;
+
/**
* Base functionality provided by all NDN clients in this package.
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public interface Client {
@@ -38,7 +39,7 @@
* @param interest the {@link Interest} to send over the network
* @return a future {@link Data} packet
*/
- public CompletableFuture<Data> getAsync(Face face, Interest interest);
+ CompletableFuture<Data> getAsync(Face face, Interest interest);
/**
* Convenience method for calling
@@ -50,7 +51,7 @@
* @param name the {@link Name} to wrap inside a default {@link Interest}
* @return a future {@link Data} packet
*/
- public CompletableFuture<Data> getAsync(Face face, Name name);
+ CompletableFuture<Data> getAsync(Face face, Name name);
/**
* Synchronously retrieve the {@link Data} for an {@link Interest}; this will
@@ -64,7 +65,7 @@
* @return a {@link Data} packet
* @throws java.io.IOException if the request fails
*/
- public Data getSync(Face face, Interest interest) throws IOException;
+ Data getSync(Face face, Interest interest) throws IOException;
/**
* Convenience method for calling
@@ -77,5 +78,5 @@
* @return a {@link Data} packet
* @throws java.io.IOException if the request fails
*/
- public Data getSync(Face face, Name name) throws IOException;
+ Data getSync(Face face, Name name) throws IOException;
}
diff --git a/src/main/java/com/intel/jndn/utils/ProcessingStage.java b/src/main/java/com/intel/jndn/utils/ProcessingStage.java
index 68b2649..d665c84 100644
--- a/src/main/java/com/intel/jndn/utils/ProcessingStage.java
+++ b/src/main/java/com/intel/jndn/utils/ProcessingStage.java
@@ -18,7 +18,7 @@
* processing stage may convert a data packet with unencrypted content to one
* with encrypted content.
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public interface ProcessingStage<T, Y> {
@@ -30,5 +30,5 @@
* may be a new object)
* @throws Exception if the processing fails
*/
- public Y process(T input) throws Exception;
+ Y process(T input) throws Exception;
}
diff --git a/src/main/java/com/intel/jndn/utils/Server.java b/src/main/java/com/intel/jndn/utils/Server.java
index 197a52a..422074c 100644
--- a/src/main/java/com/intel/jndn/utils/Server.java
+++ b/src/main/java/com/intel/jndn/utils/Server.java
@@ -13,12 +13,13 @@
*/
package com.intel.jndn.utils;
-import java.util.concurrent.ScheduledThreadPoolExecutor;
import net.named_data.jndn.Data;
import net.named_data.jndn.Face;
import net.named_data.jndn.Name;
import net.named_data.jndn.OnInterestCallback;
+import java.util.concurrent.ScheduledThreadPoolExecutor;
+
/**
* Base interface for defining a server; see descendant interfaces for different
* modes of serving packets. This class extends {@link Runnable} expecting
@@ -26,20 +27,20 @@
* {@link Runnable#run()} block, thus allowing different ways to manage servers
* (e.g. single-thread vs {@link ScheduledThreadPoolExecutor}.
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public interface Server extends Runnable, OnInterestCallback {
/**
* @return the {@link Name} prefix this server is serving on.
*/
- public Name getPrefix();
+ Name getPrefix();
/**
* @return the registered prefix ID of the server on the {@link Face} or -1 if
* unregistered
*/
- public long getRegisteredPrefixId();
+ long getRegisteredPrefixId();
/**
* Add a stage to the server pipeline. Each stage should be processed once the
@@ -49,5 +50,5 @@
*
* @param stage a Data-to-Data processing stage
*/
- public void addPostProcessingStage(ProcessingStage<Data, Data> stage);
+ void addPostProcessingStage(ProcessingStage<Data, Data> stage);
}
diff --git a/src/main/java/com/intel/jndn/utils/client/DataStream.java b/src/main/java/com/intel/jndn/utils/client/DataStream.java
index 3f517a3..f558ab4 100644
--- a/src/main/java/com/intel/jndn/utils/client/DataStream.java
+++ b/src/main/java/com/intel/jndn/utils/client/DataStream.java
@@ -24,7 +24,7 @@
*
* TODO merge with Observable
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public interface DataStream extends OnData, OnTimeout, OnComplete, OnException {
diff --git a/src/main/java/com/intel/jndn/utils/client/OnComplete.java b/src/main/java/com/intel/jndn/utils/client/OnComplete.java
index 6cbbe86..5bd6811 100644
--- a/src/main/java/com/intel/jndn/utils/client/OnComplete.java
+++ b/src/main/java/com/intel/jndn/utils/client/OnComplete.java
@@ -16,12 +16,12 @@
/**
* Callback fired when an activity is finished.
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public interface OnComplete {
/**
* Called when an activity is finished
*/
- public void onComplete();
+ void onComplete();
}
diff --git a/src/main/java/com/intel/jndn/utils/client/OnException.java b/src/main/java/com/intel/jndn/utils/client/OnException.java
index d4c440d..976a874 100644
--- a/src/main/java/com/intel/jndn/utils/client/OnException.java
+++ b/src/main/java/com/intel/jndn/utils/client/OnException.java
@@ -17,7 +17,7 @@
* Callback fired when an activity throws an exception; this is necessary because
* some actions are performed asynchronously (e.g. in a thread pool) and exceptions
* could otherwise be lost.
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public interface OnException {
@@ -25,5 +25,5 @@
* Called when an activity throws an exception
* @param exception the exception thrown
*/
- public void onException(Exception exception);
+ void onException(Exception exception);
}
diff --git a/src/main/java/com/intel/jndn/utils/client/SegmentationType.java b/src/main/java/com/intel/jndn/utils/client/SegmentationType.java
index 166d81f..d0b6c6e 100644
--- a/src/main/java/com/intel/jndn/utils/client/SegmentationType.java
+++ b/src/main/java/com/intel/jndn/utils/client/SegmentationType.java
@@ -17,7 +17,7 @@
* Documents known partition types from
* http://named-data.net/doc/tech-memos/naming-conventions.pdf
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public enum SegmentationType {
diff --git a/src/main/java/com/intel/jndn/utils/client/SegmentedClient.java b/src/main/java/com/intel/jndn/utils/client/SegmentedClient.java
index d866675..6155398 100644
--- a/src/main/java/com/intel/jndn/utils/client/SegmentedClient.java
+++ b/src/main/java/com/intel/jndn/utils/client/SegmentedClient.java
@@ -13,15 +13,16 @@
*/
package com.intel.jndn.utils.client;
-import java.io.IOException;
import net.named_data.jndn.Face;
import net.named_data.jndn.Interest;
+import java.io.IOException;
+
/**
* Define a client that can retrieve segmented packets into a
* {@link DataStream}.
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public interface SegmentedClient {
@@ -35,5 +36,5 @@
* @return a data stream of packets returned
* @throws IOException if the initial request fails
*/
- public DataStream getSegmentsAsync(Face face, Interest interest) throws IOException;
+ DataStream getSegmentsAsync(Face face, Interest interest) throws IOException;
}
diff --git a/src/main/java/com/intel/jndn/utils/client/StreamingClient.java b/src/main/java/com/intel/jndn/utils/client/StreamingClient.java
index 3ab5fb6..9e75840 100644
--- a/src/main/java/com/intel/jndn/utils/client/StreamingClient.java
+++ b/src/main/java/com/intel/jndn/utils/client/StreamingClient.java
@@ -13,16 +13,17 @@
*/
package com.intel.jndn.utils.client;
-import java.io.IOException;
-import java.io.InputStream;
import net.named_data.jndn.Face;
import net.named_data.jndn.Interest;
+import java.io.IOException;
+import java.io.InputStream;
+
/**
* Define a client that can stream content bytes that are partitioned over
* multiple packets.
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public interface StreamingClient {
@@ -39,5 +40,5 @@
* @return a stream of content bytes
* @throws IOException if the stream setup fails
*/
- public InputStream getStreamAsync(Face face, Interest interest, SegmentationType partitionMarker) throws IOException;
+ InputStream getStreamAsync(Face face, Interest interest, SegmentationType partitionMarker) throws IOException;
}
diff --git a/src/main/java/com/intel/jndn/utils/client/impl/AdvancedClient.java b/src/main/java/com/intel/jndn/utils/client/impl/AdvancedClient.java
index 2659656..d1cdd51 100644
--- a/src/main/java/com/intel/jndn/utils/client/impl/AdvancedClient.java
+++ b/src/main/java/com/intel/jndn/utils/client/impl/AdvancedClient.java
@@ -13,51 +13,40 @@
*/
package com.intel.jndn.utils.client.impl;
+import com.intel.jndn.utils.client.DataStream;
import com.intel.jndn.utils.client.OnComplete;
import com.intel.jndn.utils.client.OnException;
import com.intel.jndn.utils.client.RetryClient;
-import com.intel.jndn.utils.client.SegmentedClient;
-import com.intel.jndn.utils.client.DataStream;
import com.intel.jndn.utils.client.SegmentationType;
+import com.intel.jndn.utils.client.SegmentedClient;
import com.intel.jndn.utils.client.StreamingClient;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.TimeoutException;
-import java.util.logging.Logger;
import net.named_data.jndn.Data;
import net.named_data.jndn.Face;
import net.named_data.jndn.Interest;
import net.named_data.jndn.OnTimeout;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.TimeoutException;
+import java.util.logging.Logger;
+
/**
* Implementation of a client that can handle segmented data, retries after
* failed requests, and streaming of data packets.
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public class AdvancedClient extends SimpleClient implements SegmentedClient, StreamingClient {
- private static final Logger logger = Logger.getLogger(AdvancedClient.class.getName());
public static final int DEFAULT_MAX_RETRIES = 3;
+ private static final Logger logger = Logger.getLogger(AdvancedClient.class.getName());
private static AdvancedClient defaultInstance;
private final SegmentedClient segmentedClient;
private final RetryClient retryClient;
private final StreamingClient streamingClient;
/**
- * Singleton access for simpler client use
- *
- * @return a default client
- */
- public static AdvancedClient getDefault() {
- if (defaultInstance == null) {
- defaultInstance = new AdvancedClient();
- }
- return defaultInstance;
- }
-
- /**
* Build an advanced client
*
* @param sleepTime for synchronous processing, the time to sleep the thread
@@ -90,6 +79,18 @@
}
/**
+ * Singleton access for simpler client use
+ *
+ * @return a default client
+ */
+ public static AdvancedClient getDefault() {
+ if (defaultInstance == null) {
+ defaultInstance = new AdvancedClient();
+ }
+ return defaultInstance;
+ }
+
+ /**
* {@inheritDoc}
*/
@Override
diff --git a/src/main/java/com/intel/jndn/utils/client/impl/DataAssembler.java b/src/main/java/com/intel/jndn/utils/client/impl/DataAssembler.java
index c1ca4fe..d06795a 100644
--- a/src/main/java/com/intel/jndn/utils/client/impl/DataAssembler.java
+++ b/src/main/java/com/intel/jndn/utils/client/impl/DataAssembler.java
@@ -13,18 +13,18 @@
*/
package com.intel.jndn.utils.client.impl;
-import com.intel.jndn.utils.client.SegmentedClient;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
import net.named_data.jndn.Data;
import net.named_data.jndn.util.Blob;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+
/**
* Internal class for assembling a list of {@link Data} packets into one large
* data packet; this implementation will use all properties of the first packet
* in the list and concatenate the content bytes of all packets in order.
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
class DataAssembler {
diff --git a/src/main/java/com/intel/jndn/utils/client/impl/DefaultRetryClient.java b/src/main/java/com/intel/jndn/utils/client/impl/DefaultRetryClient.java
index 21f1c0e..de85eb6 100644
--- a/src/main/java/com/intel/jndn/utils/client/impl/DefaultRetryClient.java
+++ b/src/main/java/com/intel/jndn/utils/client/impl/DefaultRetryClient.java
@@ -14,19 +14,20 @@
package com.intel.jndn.utils.client.impl;
import com.intel.jndn.utils.client.RetryClient;
-import java.io.IOException;
-import java.util.logging.Logger;
import net.named_data.jndn.Data;
import net.named_data.jndn.Face;
import net.named_data.jndn.Interest;
import net.named_data.jndn.OnData;
import net.named_data.jndn.OnTimeout;
+import java.io.IOException;
+import java.util.logging.Logger;
+
/**
* Default implementation of {@link RetryClient}; on request failure, this class
* immediately retries the request until a maximum number of retries is reached.
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public class DefaultRetryClient implements RetryClient {
@@ -80,11 +81,11 @@
*/
private class RetryContext implements OnData, OnTimeout {
- public int numFailures = 0;
public final Face face;
public final Interest interest;
public final OnData applicationOnData;
public final OnTimeout applicationOnTimeout;
+ public int numFailures = 0;
public RetryContext(Face face, Interest interest, OnData applicationOnData, OnTimeout applicationOnTimeout) {
this.face = face;
diff --git a/src/main/java/com/intel/jndn/utils/client/impl/DefaultSegmentedClient.java b/src/main/java/com/intel/jndn/utils/client/impl/DefaultSegmentedClient.java
index 83e0baa..302645c 100644
--- a/src/main/java/com/intel/jndn/utils/client/impl/DefaultSegmentedClient.java
+++ b/src/main/java/com/intel/jndn/utils/client/impl/DefaultSegmentedClient.java
@@ -13,10 +13,8 @@
*/
package com.intel.jndn.utils.client.impl;
-import com.intel.jndn.utils.client.SegmentedClient;
import com.intel.jndn.utils.client.DataStream;
-import java.io.IOException;
-import java.util.logging.Logger;
+import com.intel.jndn.utils.client.SegmentedClient;
import net.named_data.jndn.Data;
import net.named_data.jndn.Face;
import net.named_data.jndn.Interest;
@@ -24,12 +22,15 @@
import net.named_data.jndn.Name.Component;
import net.named_data.jndn.OnData;
+import java.io.IOException;
+import java.util.logging.Logger;
+
/**
* Retrieve segments one by one until the FinalBlockId indicates an end segment;
* then request remaining packets. This class currently only handles segmented
* data (not yet byte-offset segmented data).
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public class DefaultSegmentedClient implements SegmentedClient {
@@ -67,6 +68,26 @@
}
/**
+ * Replace the final component of an interest name with a segmented component;
+ * if the interest name does not have a segmented component, this will add
+ * one.
+ *
+ * @param interest the request
+ * @param segmentNumber a segment number
+ * @param marker a marker to use for segmenting the packet
+ * @return a segmented interest (a copy of the passed interest)
+ */
+ protected Interest replaceFinalComponent(Interest interest, long segmentNumber, byte marker) {
+ Interest copied = new Interest(interest);
+ Component lastComponent = Component.fromNumberWithMarker(segmentNumber, marker);
+ Name newName = (SegmentationHelper.isSegmented(copied.getName(), marker))
+ ? copied.getName().getPrefix(-1)
+ : new Name(copied.getName());
+ copied.setName(newName.append(lastComponent));
+ return copied;
+ }
+
+ /**
* Helper class to track the last requested segment for a given request
* context and request follow-on packets
*/
@@ -126,24 +147,4 @@
}
}
- /**
- * Replace the final component of an interest name with a segmented component;
- * if the interest name does not have a segmented component, this will add
- * one.
- *
- * @param interest the request
- * @param segmentNumber a segment number
- * @param marker a marker to use for segmenting the packet
- * @return a segmented interest (a copy of the passed interest)
- */
- protected Interest replaceFinalComponent(Interest interest, long segmentNumber, byte marker) {
- Interest copied = new Interest(interest);
- Component lastComponent = Component.fromNumberWithMarker(segmentNumber, marker);
- Name newName = (SegmentationHelper.isSegmented(copied.getName(), marker))
- ? copied.getName().getPrefix(-1)
- : new Name(copied.getName());
- copied.setName(newName.append(lastComponent));
- return copied;
- }
-
}
diff --git a/src/main/java/com/intel/jndn/utils/client/impl/DefaultStreamingClient.java b/src/main/java/com/intel/jndn/utils/client/impl/DefaultStreamingClient.java
index 55fa0f0..29e7c76 100644
--- a/src/main/java/com/intel/jndn/utils/client/impl/DefaultStreamingClient.java
+++ b/src/main/java/com/intel/jndn/utils/client/impl/DefaultStreamingClient.java
@@ -18,23 +18,24 @@
import com.intel.jndn.utils.client.SegmentationType;
import com.intel.jndn.utils.client.SegmentedClient;
import com.intel.jndn.utils.client.StreamingClient;
+import net.named_data.jndn.Data;
+import net.named_data.jndn.Face;
+import net.named_data.jndn.Interest;
+import net.named_data.jndn.OnData;
+
import java.io.IOException;
import java.io.InputStream;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
import java.util.logging.Level;
import java.util.logging.Logger;
-import net.named_data.jndn.Data;
-import net.named_data.jndn.Face;
-import net.named_data.jndn.Interest;
-import net.named_data.jndn.OnData;
/**
* Default implementation of {@link StreamingClient}; uses a segmented client to
* retrieve packets asynchronously and pipes them to a stream as they are
* received.
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public class DefaultStreamingClient implements StreamingClient {
diff --git a/src/main/java/com/intel/jndn/utils/client/impl/SegmentationHelper.java b/src/main/java/com/intel/jndn/utils/client/impl/SegmentationHelper.java
index 7a051ee..27d4187 100644
--- a/src/main/java/com/intel/jndn/utils/client/impl/SegmentationHelper.java
+++ b/src/main/java/com/intel/jndn/utils/client/impl/SegmentationHelper.java
@@ -20,7 +20,7 @@
* Helper methods for dealing with segmented packets (see
* http://named-data.net/doc/tech-memos/naming-conventions.pdf).
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public class SegmentationHelper {
@@ -33,7 +33,7 @@
* @return true if the name is segmented
*/
public static boolean isSegmented(Name name, byte marker) {
- return name.size() > 0 ? name.get(-1).getValue().buf().get(0) == marker : false;
+ return name.size() > 0 && name.get(-1).getValue().buf().get(0) == marker;
}
/**
diff --git a/src/main/java/com/intel/jndn/utils/client/impl/SegmentedDataStream.java b/src/main/java/com/intel/jndn/utils/client/impl/SegmentedDataStream.java
index 41fd86a..2d0f691 100644
--- a/src/main/java/com/intel/jndn/utils/client/impl/SegmentedDataStream.java
+++ b/src/main/java/com/intel/jndn/utils/client/impl/SegmentedDataStream.java
@@ -13,9 +13,16 @@
*/
package com.intel.jndn.utils.client.impl;
+import com.intel.jndn.utils.client.DataStream;
import com.intel.jndn.utils.client.OnComplete;
import com.intel.jndn.utils.client.OnException;
-import com.intel.jndn.utils.client.DataStream;
+import net.named_data.jndn.Data;
+import net.named_data.jndn.Interest;
+import net.named_data.jndn.Name;
+import net.named_data.jndn.OnData;
+import net.named_data.jndn.OnTimeout;
+import net.named_data.jndn.encoding.EncodingException;
+
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedList;
@@ -23,12 +30,6 @@
import java.util.Map;
import java.util.logging.Logger;
import java.util.stream.Collectors;
-import net.named_data.jndn.Data;
-import net.named_data.jndn.Interest;
-import net.named_data.jndn.Name;
-import net.named_data.jndn.OnData;
-import net.named_data.jndn.OnTimeout;
-import net.named_data.jndn.encoding.EncodingException;
/**
* As packets are received, they are mapped by their last component's segment
@@ -40,7 +41,7 @@
* data is received; if data is received out of order, the callbacks will not be
* fired until adjoining packets are received.
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public class SegmentedDataStream implements DataStream {
diff --git a/src/main/java/com/intel/jndn/utils/client/impl/SimpleClient.java b/src/main/java/com/intel/jndn/utils/client/impl/SimpleClient.java
index 9e2e594..00e224f 100644
--- a/src/main/java/com/intel/jndn/utils/client/impl/SimpleClient.java
+++ b/src/main/java/com/intel/jndn/utils/client/impl/SimpleClient.java
@@ -14,24 +14,25 @@
package com.intel.jndn.utils.client.impl;
import com.intel.jndn.utils.Client;
-import java.io.IOException;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeoutException;
-import java.util.logging.Level;
import net.named_data.jndn.Data;
import net.named_data.jndn.Face;
import net.named_data.jndn.Interest;
import net.named_data.jndn.Name;
import net.named_data.jndn.OnData;
import net.named_data.jndn.OnTimeout;
-import java.util.logging.Logger;
import net.named_data.jndn.encoding.EncodingException;
+import java.io.IOException;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeoutException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
/**
* Provide a client to simplify information retrieval over the NDN network.
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public class SimpleClient implements Client {
@@ -43,18 +44,6 @@
private final long interestLifetime;
/**
- * Singleton access for simpler client use
- *
- * @return a default client
- */
- public static SimpleClient getDefault() {
- if (defaultInstance == null) {
- defaultInstance = new SimpleClient();
- }
- return defaultInstance;
- }
-
- /**
* Build a simple client
*
* @param sleepTime for synchronous processing, the time to sleep the thread
@@ -76,6 +65,18 @@
}
/**
+ * Singleton access for simpler client use
+ *
+ * @return a default client
+ */
+ public static SimpleClient getDefault() {
+ if (defaultInstance == null) {
+ defaultInstance = new SimpleClient();
+ }
+ return defaultInstance;
+ }
+
+ /**
* {@inheritDoc}
*/
@Override
diff --git a/src/main/java/com/intel/jndn/utils/client/impl/StreamException.java b/src/main/java/com/intel/jndn/utils/client/impl/StreamException.java
index 59ad55a..7cf5c6f 100644
--- a/src/main/java/com/intel/jndn/utils/client/impl/StreamException.java
+++ b/src/main/java/com/intel/jndn/utils/client/impl/StreamException.java
@@ -15,7 +15,7 @@
/**
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public class StreamException extends Exception {
diff --git a/src/main/java/com/intel/jndn/utils/processing/impl/CompressionStage.java b/src/main/java/com/intel/jndn/utils/processing/impl/CompressionStage.java
index 21862fa..5befb6d 100644
--- a/src/main/java/com/intel/jndn/utils/processing/impl/CompressionStage.java
+++ b/src/main/java/com/intel/jndn/utils/processing/impl/CompressionStage.java
@@ -14,15 +14,16 @@
package com.intel.jndn.utils.processing.impl;
import com.intel.jndn.utils.ProcessingStage;
-import java.io.ByteArrayOutputStream;
-import java.util.zip.GZIPOutputStream;
import net.named_data.jndn.Data;
import net.named_data.jndn.util.Blob;
+import java.io.ByteArrayOutputStream;
+import java.util.zip.GZIPOutputStream;
+
/**
* Sample stage for compressing {@link Data} content using GZIP
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public class CompressionStage implements ProcessingStage<Data, Data> {
diff --git a/src/main/java/com/intel/jndn/utils/processing/impl/SigningStage.java b/src/main/java/com/intel/jndn/utils/processing/impl/SigningStage.java
index 3125db8..74df0b0 100644
--- a/src/main/java/com/intel/jndn/utils/processing/impl/SigningStage.java
+++ b/src/main/java/com/intel/jndn/utils/processing/impl/SigningStage.java
@@ -23,7 +23,7 @@
* As a part of a {@link com.intel.jndn.utils.ServerIn} pipeline, this stage
* will sign a {@link Data} packet.
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public class SigningStage implements ProcessingStage<Data, Data> {
diff --git a/src/main/java/com/intel/jndn/utils/pubsub/AnnouncementService.java b/src/main/java/com/intel/jndn/utils/pubsub/AnnouncementService.java
index 34818a4..4ab03aa 100644
--- a/src/main/java/com/intel/jndn/utils/pubsub/AnnouncementService.java
+++ b/src/main/java/com/intel/jndn/utils/pubsub/AnnouncementService.java
@@ -19,7 +19,7 @@
/**
* @author Andrew Brown, andrew.brown@intel.com
*/
-public interface AnnouncementService {
+interface AnnouncementService {
void announceEntrance(long id) throws IOException;
void announceExit(long id) throws IOException;
Cancellation discoverExistingAnnouncements(On<Long> onFound, On<Void> onComplete, On<Exception> onError);
diff --git a/src/main/java/com/intel/jndn/utils/pubsub/NdnSubscriber.java b/src/main/java/com/intel/jndn/utils/pubsub/NdnSubscriber.java
index 556b91f..83e3f28 100644
--- a/src/main/java/com/intel/jndn/utils/pubsub/NdnSubscriber.java
+++ b/src/main/java/com/intel/jndn/utils/pubsub/NdnSubscriber.java
@@ -74,9 +74,11 @@
if (newAnnouncementCancellation != null) {
newAnnouncementCancellation.cancel();
}
+
if (existingAnnouncementsCancellation != null) {
existingAnnouncementsCancellation.cancel();
}
+
for (Context c : known) {
c.cancel();
}
diff --git a/src/main/java/com/intel/jndn/utils/repository/impl/DataNotFoundException.java b/src/main/java/com/intel/jndn/utils/repository/impl/DataNotFoundException.java
index eba700a..af64f15 100644
--- a/src/main/java/com/intel/jndn/utils/repository/impl/DataNotFoundException.java
+++ b/src/main/java/com/intel/jndn/utils/repository/impl/DataNotFoundException.java
@@ -16,7 +16,7 @@
/**
* Thrown when a {@link Repository} cannot retrieve a stored packet.
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public class DataNotFoundException extends Exception {
diff --git a/src/main/java/com/intel/jndn/utils/server/DynamicServer.java b/src/main/java/com/intel/jndn/utils/server/DynamicServer.java
index 60caf35..1859897 100644
--- a/src/main/java/com/intel/jndn/utils/server/DynamicServer.java
+++ b/src/main/java/com/intel/jndn/utils/server/DynamicServer.java
@@ -14,7 +14,7 @@
package com.intel.jndn.utils.server;
import com.intel.jndn.utils.Server;
-import com.intel.jndn.utils.server.RespondWithData;
+
import java.io.IOException;
/**
@@ -23,7 +23,7 @@
* will run a callback to determine what packet to send back. As good practice,
* keep callback methods as short as possible.
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public interface DynamicServer extends Server {
@@ -36,5 +36,5 @@
* @param callback the callback instance
* @throws java.io.IOException if the server fails to register a prefix
*/
- public void respondUsing(RespondWithData callback) throws IOException;
+ void respondUsing(RespondWithData callback) throws IOException;
}
diff --git a/src/main/java/com/intel/jndn/utils/server/RepositoryServer.java b/src/main/java/com/intel/jndn/utils/server/RepositoryServer.java
index 09ebc23..a0db7e9 100644
--- a/src/main/java/com/intel/jndn/utils/server/RepositoryServer.java
+++ b/src/main/java/com/intel/jndn/utils/server/RepositoryServer.java
@@ -14,15 +14,16 @@
package com.intel.jndn.utils.server;
import com.intel.jndn.utils.Server;
-import java.io.IOException;
import net.named_data.jndn.Data;
+import java.io.IOException;
+
/**
* Defines the API for a {@link Server} producing {@link Data} packets and
* storing them until they are requested; this server corresponds closely to use
* cases such as: cache, file system, web server.
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public interface RepositoryServer extends Server {
@@ -32,10 +33,10 @@
* @param data the {@link Data} packet to store and serve
* @throws IOException if the underlying server fails to store the packet
*/
- public void serve(Data data) throws IOException;
+ void serve(Data data) throws IOException;
/**
* Clean up stale {@link Data} packets from the underlying content store.
*/
- public void cleanup();
+ void cleanup();
}
diff --git a/src/main/java/com/intel/jndn/utils/server/RespondWithBlob.java b/src/main/java/com/intel/jndn/utils/server/RespondWithBlob.java
index fe7f74a..d83e1d6 100644
--- a/src/main/java/com/intel/jndn/utils/server/RespondWithBlob.java
+++ b/src/main/java/com/intel/jndn/utils/server/RespondWithBlob.java
@@ -20,9 +20,9 @@
/**
* Functional interface for serving data from Server.on()
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public interface RespondWithBlob {
- public Blob onInterest(Name prefix, Interest interest) throws Exception;
+ Blob onInterest(Name prefix, Interest interest) throws Exception;
}
diff --git a/src/main/java/com/intel/jndn/utils/server/RespondWithData.java b/src/main/java/com/intel/jndn/utils/server/RespondWithData.java
index 95d0e6a..556d1d6 100644
--- a/src/main/java/com/intel/jndn/utils/server/RespondWithData.java
+++ b/src/main/java/com/intel/jndn/utils/server/RespondWithData.java
@@ -20,9 +20,9 @@
/**
* Functional interface for serving data from Server.on()
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public interface RespondWithData {
- public Data onInterest(Name prefix, Interest interest) throws Exception;
+ Data onInterest(Name prefix, Interest interest) throws Exception;
}
diff --git a/src/main/java/com/intel/jndn/utils/server/impl/SegmentedServer.java b/src/main/java/com/intel/jndn/utils/server/impl/SegmentedServer.java
index 6be4280..faade78 100644
--- a/src/main/java/com/intel/jndn/utils/server/impl/SegmentedServer.java
+++ b/src/main/java/com/intel/jndn/utils/server/impl/SegmentedServer.java
@@ -13,17 +13,9 @@
*/
package com.intel.jndn.utils.server.impl;
-import com.intel.jndn.utils.server.RepositoryServer;
-import com.intel.jndn.utils.repository.impl.ForLoopRepository;
import com.intel.jndn.utils.Repository;
-import com.intel.jndn.utils.server.impl.SegmentedServerHelper;
-import com.intel.jndn.utils.server.impl.ServerBaseImpl;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
+import com.intel.jndn.utils.repository.impl.ForLoopRepository;
+import com.intel.jndn.utils.server.RepositoryServer;
import net.named_data.jndn.Data;
import net.named_data.jndn.Face;
import net.named_data.jndn.Interest;
@@ -31,11 +23,18 @@
import net.named_data.jndn.Name;
import net.named_data.jndn.encoding.EncodingException;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
/**
* Implementation of a {@link RepositoryServer} that segments packets stored in
* its repository.
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public class SegmentedServer extends ServerBaseImpl implements RepositoryServer {
diff --git a/src/main/java/com/intel/jndn/utils/server/impl/SegmentedServerHelper.java b/src/main/java/com/intel/jndn/utils/server/impl/SegmentedServerHelper.java
index 78e3c27..68ab3eb 100644
--- a/src/main/java/com/intel/jndn/utils/server/impl/SegmentedServerHelper.java
+++ b/src/main/java/com/intel/jndn/utils/server/impl/SegmentedServerHelper.java
@@ -13,15 +13,16 @@
*/
package com.intel.jndn.utils.server.impl;
+import net.named_data.jndn.Data;
+import net.named_data.jndn.Name;
+import net.named_data.jndn.util.Blob;
+
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;
-import net.named_data.jndn.Data;
-import net.named_data.jndn.Name;
-import net.named_data.jndn.util.Blob;
/**
* Helper for segmenting an input stream into a list of Data packets. Current
@@ -30,7 +31,7 @@
* several assumptions: NDN packet size was limited to 8000 at the time this was
* written and signature size is unknown.
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public class SegmentedServerHelper {
diff --git a/src/main/java/com/intel/jndn/utils/server/impl/ServerBaseImpl.java b/src/main/java/com/intel/jndn/utils/server/impl/ServerBaseImpl.java
index 6110005..64130bd 100644
--- a/src/main/java/com/intel/jndn/utils/server/impl/ServerBaseImpl.java
+++ b/src/main/java/com/intel/jndn/utils/server/impl/ServerBaseImpl.java
@@ -15,11 +15,6 @@
import com.intel.jndn.utils.ProcessingStage;
import com.intel.jndn.utils.Server;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
import net.named_data.jndn.Data;
import net.named_data.jndn.Face;
import net.named_data.jndn.ForwardingFlags;
@@ -27,10 +22,16 @@
import net.named_data.jndn.OnRegisterFailed;
import net.named_data.jndn.encoding.EncodingException;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
/**
* Base implementation for a {@link Server}.
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public abstract class ServerBaseImpl implements Server {
diff --git a/src/main/java/com/intel/jndn/utils/server/impl/SimpleServer.java b/src/main/java/com/intel/jndn/utils/server/impl/SimpleServer.java
index cee7d7f..1c1a643 100644
--- a/src/main/java/com/intel/jndn/utils/server/impl/SimpleServer.java
+++ b/src/main/java/com/intel/jndn/utils/server/impl/SimpleServer.java
@@ -14,14 +14,8 @@
package com.intel.jndn.utils.server.impl;
import com.intel.jndn.utils.server.DynamicServer;
-import com.intel.jndn.utils.server.RespondWithData;
-import com.intel.jndn.utils.server.RespondWithBlob;
import com.intel.jndn.utils.server.RespondWithBlob;
import com.intel.jndn.utils.server.RespondWithData;
-import com.intel.jndn.utils.server.impl.ServerBaseImpl;
-import java.io.IOException;
-import java.util.logging.Level;
-import java.util.logging.Logger;
import net.named_data.jndn.Data;
import net.named_data.jndn.Face;
import net.named_data.jndn.Interest;
@@ -30,11 +24,15 @@
import net.named_data.jndn.OnInterest;
import net.named_data.jndn.util.Blob;
+import java.io.IOException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
/**
* Implementation of a {@link DynamicServer} that wraps the {@link OnInterest}
* callback with some encoding and pipeline support.
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public class SimpleServer extends ServerBaseImpl implements DynamicServer {
diff --git a/src/test/java/com/intel/jndn/utils/TestHelper.java b/src/test/java/com/intel/jndn/utils/TestHelper.java
index a73aba4..db4011c 100644
--- a/src/test/java/com/intel/jndn/utils/TestHelper.java
+++ b/src/test/java/com/intel/jndn/utils/TestHelper.java
@@ -14,6 +14,15 @@
package com.intel.jndn.utils;
import com.intel.jndn.mock.MockKeyChain;
+import net.named_data.jndn.Data;
+import net.named_data.jndn.Face;
+import net.named_data.jndn.Name;
+import net.named_data.jndn.encoding.EncodingException;
+import net.named_data.jndn.security.KeyChain;
+import net.named_data.jndn.security.SecurityException;
+import net.named_data.jndn.transport.UdpTransport;
+import net.named_data.jndn.util.Blob;
+
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@@ -26,19 +35,11 @@
import java.util.logging.Logger;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
-import net.named_data.jndn.Data;
-import net.named_data.jndn.Face;
-import net.named_data.jndn.Name;
-import net.named_data.jndn.encoding.EncodingException;
-import net.named_data.jndn.security.KeyChain;
-import net.named_data.jndn.security.SecurityException;
-import net.named_data.jndn.transport.UdpTransport;
-import net.named_data.jndn.util.Blob;
/**
* Collect assorted methods to help with testing
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public class TestHelper {
diff --git a/src/test/java/com/intel/jndn/utils/client/impl/AdvancedClientFileTestIT.java b/src/test/java/com/intel/jndn/utils/client/impl/AdvancedClientFileTestIT.java
index 45572a7..eab7055 100644
--- a/src/test/java/com/intel/jndn/utils/client/impl/AdvancedClientFileTestIT.java
+++ b/src/test/java/com/intel/jndn/utils/client/impl/AdvancedClientFileTestIT.java
@@ -16,15 +16,6 @@
import com.intel.jndn.utils.Client;
import com.intel.jndn.utils.TestHelper;
import com.intel.jndn.utils.server.impl.SegmentedServerHelper;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.util.List;
-import java.util.Random;
-import java.util.concurrent.CompletableFuture;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import java.util.stream.Collectors;
-import java.util.stream.IntStream;
import net.named_data.jndn.Data;
import net.named_data.jndn.Face;
import net.named_data.jndn.Interest;
@@ -34,11 +25,21 @@
import net.named_data.jndn.security.SecurityException;
import org.junit.Test;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.util.List;
+import java.util.Random;
+import java.util.concurrent.CompletableFuture;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import java.util.stream.Collectors;
+import java.util.stream.IntStream;
+
/**
* Test AdvancedClient.java; requires a hostname to an NFD accepting a generated
* key to register prefixes, e.g. mvn test -Dnfd.ip=10.10.10.1
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public class AdvancedClientFileTestIT {
diff --git a/src/test/java/com/intel/jndn/utils/client/impl/AdvancedClientStressTestIT.java b/src/test/java/com/intel/jndn/utils/client/impl/AdvancedClientStressTestIT.java
index 6a99599..af3232b 100644
--- a/src/test/java/com/intel/jndn/utils/client/impl/AdvancedClientStressTestIT.java
+++ b/src/test/java/com/intel/jndn/utils/client/impl/AdvancedClientStressTestIT.java
@@ -16,15 +16,6 @@
import com.intel.jndn.utils.Client;
import com.intel.jndn.utils.TestHelper;
import com.intel.jndn.utils.server.impl.SegmentedServerHelper;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.util.List;
-import java.util.Random;
-import java.util.concurrent.CompletableFuture;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import java.util.stream.Collectors;
-import java.util.stream.IntStream;
import net.named_data.jndn.Data;
import net.named_data.jndn.Face;
import net.named_data.jndn.Interest;
@@ -34,11 +25,21 @@
import net.named_data.jndn.security.SecurityException;
import org.junit.Test;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.util.List;
+import java.util.Random;
+import java.util.concurrent.CompletableFuture;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import java.util.stream.Collectors;
+import java.util.stream.IntStream;
+
/**
* Test AdvancedClient.java; requires a hostname to an NFD accepting a generated
* key to register prefixes, e.g. mvn test -Dnfd.ip=10.10.10.1
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public class AdvancedClientStressTestIT {
diff --git a/src/test/java/com/intel/jndn/utils/client/impl/DataAssemblerTest.java b/src/test/java/com/intel/jndn/utils/client/impl/DataAssemblerTest.java
index 39b6586..e3bdf7b 100644
--- a/src/test/java/com/intel/jndn/utils/client/impl/DataAssemblerTest.java
+++ b/src/test/java/com/intel/jndn/utils/client/impl/DataAssemblerTest.java
@@ -14,16 +14,18 @@
package com.intel.jndn.utils.client.impl;
import com.intel.jndn.utils.TestHelper;
-import java.util.concurrent.ExecutionException;
import net.named_data.jndn.Data;
import net.named_data.jndn.Name;
-import static org.junit.Assert.*;
import org.junit.Test;
+import java.util.concurrent.ExecutionException;
+
+import static org.junit.Assert.assertEquals;
+
/**
* Test that segment data packets are re-assembled correctly.
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public class DataAssemblerTest {
diff --git a/src/test/java/com/intel/jndn/utils/client/impl/DefaultStreamingClientTest.java b/src/test/java/com/intel/jndn/utils/client/impl/DefaultStreamingClientTest.java
index aaf43df..338a88d 100644
--- a/src/test/java/com/intel/jndn/utils/client/impl/DefaultStreamingClientTest.java
+++ b/src/test/java/com/intel/jndn/utils/client/impl/DefaultStreamingClientTest.java
@@ -15,14 +15,17 @@
import com.intel.jndn.utils.TestHelper;
import com.intel.jndn.utils.client.OnException;
-import java.io.InputStream;
import net.named_data.jndn.Name;
import org.junit.Test;
-import static org.junit.Assert.*;
+
+import java.io.InputStream;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
/**
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public class DefaultStreamingClientTest {
diff --git a/src/test/java/com/intel/jndn/utils/client/impl/SegmentedDataStreamTest.java b/src/test/java/com/intel/jndn/utils/client/impl/SegmentedDataStreamTest.java
index 2f165b9..28fd32f 100644
--- a/src/test/java/com/intel/jndn/utils/client/impl/SegmentedDataStreamTest.java
+++ b/src/test/java/com/intel/jndn/utils/client/impl/SegmentedDataStreamTest.java
@@ -14,20 +14,22 @@
package com.intel.jndn.utils.client.impl;
import com.intel.jndn.utils.TestHelper;
-import java.util.ArrayList;
-import java.util.stream.IntStream;
import net.named_data.jndn.Data;
import net.named_data.jndn.Interest;
import net.named_data.jndn.Name;
import net.named_data.jndn.Name.Component;
import net.named_data.jndn.encoding.EncodingException;
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.stream.IntStream;
+
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
-import org.junit.Test;
/**
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public class SegmentedDataStreamTest {
diff --git a/src/test/java/com/intel/jndn/utils/client/impl/SimpleClientTest.java b/src/test/java/com/intel/jndn/utils/client/impl/SimpleClientTest.java
index 4e529be..fc5ac4b 100644
--- a/src/test/java/com/intel/jndn/utils/client/impl/SimpleClientTest.java
+++ b/src/test/java/com/intel/jndn/utils/client/impl/SimpleClientTest.java
@@ -36,7 +36,7 @@
/**
* Test SimpleClient.java
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public class SimpleClientTest {
diff --git a/src/test/java/com/intel/jndn/utils/client/impl/SimpleClientTestIT.java b/src/test/java/com/intel/jndn/utils/client/impl/SimpleClientTestIT.java
index f49525b..ff888ee 100644
--- a/src/test/java/com/intel/jndn/utils/client/impl/SimpleClientTestIT.java
+++ b/src/test/java/com/intel/jndn/utils/client/impl/SimpleClientTestIT.java
@@ -13,14 +13,7 @@
*/
package com.intel.jndn.utils.client.impl;
-import com.intel.jndn.utils.client.impl.SimpleClient;
import com.intel.jndn.utils.TestHelper;
-import java.io.IOException;
-import java.util.concurrent.CompletableFuture;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import java.util.stream.IntStream;
-import java.util.stream.Stream;
import net.named_data.jndn.Data;
import net.named_data.jndn.Face;
import net.named_data.jndn.Interest;
@@ -30,24 +23,31 @@
import net.named_data.jndn.security.SecurityException;
import net.named_data.jndn.util.Blob;
import org.junit.Assert;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.util.concurrent.CompletableFuture;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import java.util.stream.IntStream;
+import java.util.stream.Stream;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
-import org.junit.Test;
/**
* Test SimpleClient.java; requires a hostname to an NFD accepting a generated
* key to register prefixes, e.g. mvn test -Dnfd.ip=10.10.10.1
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public class SimpleClientTestIT {
private static final Logger logger = Logger.getLogger(SimpleClientTestIT.class.getName());
private static final Name PREFIX_RETRIEVE = new Name("/test/simple-client/retrieve-one").append(TestHelper.buildRandomString(10));
private static final Name PREFIX_RETRIEVE_MULTIPLE = new Name("/test/simple-client/retrieve-multiple").append(TestHelper.buildRandomString(10));
-
- SimpleClient instance;
private final TestHelper.NdnEnvironment environment;
+ SimpleClient instance;
public SimpleClientTestIT() throws SecurityException {
String ip = System.getProperty("nfd.ip");
diff --git a/src/test/java/com/intel/jndn/utils/processing/impl/CompressionStageTest.java b/src/test/java/com/intel/jndn/utils/processing/impl/CompressionStageTest.java
index 763c361..495e307 100644
--- a/src/test/java/com/intel/jndn/utils/processing/impl/CompressionStageTest.java
+++ b/src/test/java/com/intel/jndn/utils/processing/impl/CompressionStageTest.java
@@ -14,17 +14,19 @@
package com.intel.jndn.utils.processing.impl;
import com.intel.jndn.utils.client.impl.AdvancedClient;
-import java.util.logging.Logger;
import net.named_data.jndn.Data;
import net.named_data.jndn.Name;
import net.named_data.jndn.util.Blob;
import org.junit.Test;
-import static org.junit.Assert.*;
+
+import java.util.logging.Logger;
+
+import static org.junit.Assert.assertTrue;
/**
* Test {@link CompressionStage}.
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public class CompressionStageTest {
diff --git a/src/test/java/com/intel/jndn/utils/processing/impl/SigningStageTest.java b/src/test/java/com/intel/jndn/utils/processing/impl/SigningStageTest.java
index 107e6c1..9ce0000 100644
--- a/src/test/java/com/intel/jndn/utils/processing/impl/SigningStageTest.java
+++ b/src/test/java/com/intel/jndn/utils/processing/impl/SigningStageTest.java
@@ -20,11 +20,12 @@
import net.named_data.jndn.security.SecurityException;
import net.named_data.jndn.util.Blob;
import org.junit.Test;
-import static org.junit.Assert.*;
+
+import static org.junit.Assert.assertTrue;
/**
* Test {@link SigningStage}.
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public class SigningStageTest {
diff --git a/src/test/java/com/intel/jndn/utils/repository/impl/ForLoopRepositoryTest.java b/src/test/java/com/intel/jndn/utils/repository/impl/ForLoopRepositoryTest.java
index 5691b8b..d73604e 100644
--- a/src/test/java/com/intel/jndn/utils/repository/impl/ForLoopRepositoryTest.java
+++ b/src/test/java/com/intel/jndn/utils/repository/impl/ForLoopRepositoryTest.java
@@ -16,7 +16,7 @@
/**
* Test {@link ForLoopRepository}.
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public class ForLoopRepositoryTest extends RepositoryTest {
diff --git a/src/test/java/com/intel/jndn/utils/repository/impl/RepoHelper.java b/src/test/java/com/intel/jndn/utils/repository/impl/RepoHelper.java
index fac32f9..e12e2da 100644
--- a/src/test/java/com/intel/jndn/utils/repository/impl/RepoHelper.java
+++ b/src/test/java/com/intel/jndn/utils/repository/impl/RepoHelper.java
@@ -21,7 +21,7 @@
/**
* Helper methods for testing.
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public class RepoHelper {
diff --git a/src/test/java/com/intel/jndn/utils/repository/impl/RepositoryTest.java b/src/test/java/com/intel/jndn/utils/repository/impl/RepositoryTest.java
index d981f91..abe0480 100644
--- a/src/test/java/com/intel/jndn/utils/repository/impl/RepositoryTest.java
+++ b/src/test/java/com/intel/jndn/utils/repository/impl/RepositoryTest.java
@@ -14,17 +14,18 @@
package com.intel.jndn.utils.repository.impl;
import com.intel.jndn.utils.Repository;
-import static com.intel.jndn.utils.repository.impl.RepoHelper.*;
import net.named_data.jndn.Data;
import net.named_data.jndn.Interest;
import net.named_data.jndn.Name;
import org.junit.Test;
+
+import static com.intel.jndn.utils.repository.impl.RepoHelper.*;
import static org.junit.Assert.*;
/**
* Extend this in descendant tests.
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public abstract class RepositoryTest {
diff --git a/src/test/java/com/intel/jndn/utils/server/impl/SegmentedServerHelperTest.java b/src/test/java/com/intel/jndn/utils/server/impl/SegmentedServerHelperTest.java
index b93e1a8..d46ebc4 100644
--- a/src/test/java/com/intel/jndn/utils/server/impl/SegmentedServerHelperTest.java
+++ b/src/test/java/com/intel/jndn/utils/server/impl/SegmentedServerHelperTest.java
@@ -13,18 +13,20 @@
*/
package com.intel.jndn.utils.server.impl;
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.util.List;
import net.named_data.jndn.Data;
import net.named_data.jndn.Name;
import org.junit.Test;
-import static org.junit.Assert.*;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.util.List;
+
+import static org.junit.Assert.assertEquals;
/**
* Test the SegmentedServerHelper
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public class SegmentedServerHelperTest {
diff --git a/src/test/java/com/intel/jndn/utils/server/impl/SegmentedServerTest.java b/src/test/java/com/intel/jndn/utils/server/impl/SegmentedServerTest.java
index fd6b516..8ec2a3d 100644
--- a/src/test/java/com/intel/jndn/utils/server/impl/SegmentedServerTest.java
+++ b/src/test/java/com/intel/jndn/utils/server/impl/SegmentedServerTest.java
@@ -15,21 +15,22 @@
import com.intel.jndn.mock.MockForwarder;
import com.intel.jndn.utils.client.impl.AdvancedClient;
-import com.intel.jndn.mock.MockFace;
-import java.io.IOException;
import net.named_data.jndn.Data;
import net.named_data.jndn.Face;
import net.named_data.jndn.Interest;
import net.named_data.jndn.Name;
import net.named_data.jndn.util.Blob;
-import static org.junit.Assert.*;
-
import org.junit.Before;
import org.junit.Test;
+import java.io.IOException;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
/**
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public class SegmentedServerTest {
diff --git a/src/test/java/com/intel/jndn/utils/server/impl/SegmentedServerTestIT.java b/src/test/java/com/intel/jndn/utils/server/impl/SegmentedServerTestIT.java
index a3409a3..e677135 100644
--- a/src/test/java/com/intel/jndn/utils/server/impl/SegmentedServerTestIT.java
+++ b/src/test/java/com/intel/jndn/utils/server/impl/SegmentedServerTestIT.java
@@ -16,8 +16,6 @@
import com.intel.jndn.mock.MockKeyChain;
import com.intel.jndn.utils.TestHelper;
import com.intel.jndn.utils.client.impl.AdvancedClient;
-import java.io.IOException;
-import java.util.logging.Logger;
import net.named_data.jndn.Data;
import net.named_data.jndn.Face;
import net.named_data.jndn.Interest;
@@ -26,20 +24,25 @@
import net.named_data.jndn.security.KeyChain;
import net.named_data.jndn.security.SecurityException;
import net.named_data.jndn.util.Blob;
-import static org.junit.Assert.*;
import org.junit.Test;
+import java.io.IOException;
+import java.util.logging.Logger;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
/**
* Test the {@link SegmentedServer} on an actual NFD; to run this, pass the NFD
* IP/host name as a parameter like <code>-Dnfd.ip=10.1.1.1</code>.
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public class SegmentedServerTestIT {
+ protected static final int DATA_SIZE_BYTES = 10000;
private static final Logger logger = Logger.getLogger(SegmentedServerTestIT.class.getName());
private static final Name PREFIX = new Name("/test/for/segmented-server");
- protected static final int DATA_SIZE_BYTES = 10000;
Face face;
SegmentedServer instance;
private String ip;
diff --git a/src/test/java/com/intel/jndn/utils/server/impl/ServerBaseImplTest.java b/src/test/java/com/intel/jndn/utils/server/impl/ServerBaseImplTest.java
index bd054cc..f12cd28 100644
--- a/src/test/java/com/intel/jndn/utils/server/impl/ServerBaseImplTest.java
+++ b/src/test/java/com/intel/jndn/utils/server/impl/ServerBaseImplTest.java
@@ -13,10 +13,8 @@
*/
package com.intel.jndn.utils.server.impl;
-import com.intel.jndn.utils.ProcessingStage;
import com.intel.jndn.mock.MockFace;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
+import com.intel.jndn.utils.ProcessingStage;
import net.named_data.jndn.Data;
import net.named_data.jndn.Face;
import net.named_data.jndn.Interest;
@@ -24,12 +22,16 @@
import net.named_data.jndn.Name;
import org.junit.Before;
import org.junit.Test;
+
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
import static org.junit.Assert.*;
/**
* Test base server implementation.
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public class ServerBaseImplTest {
@@ -42,18 +44,6 @@
instance = new ServerBaseImplImpl(face, new Name("/test/base"));
}
- public class ServerBaseImplImpl extends ServerBaseImpl {
-
- public ServerBaseImplImpl(Face face, Name prefix) {
- super(face, prefix);
- }
-
- @Override
- public void onInterest(Name prefix, Interest interest, Face face, long interestFilterId, InterestFilter filter) {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
- }
- }
-
/**
* Test of getPrefix method, of class ServerBaseImpl.
*/
@@ -61,7 +51,7 @@
public void testGetPrefix() {
assertNotNull(instance.getPrefix());
}
-
+
/**
* Test of getRegisteredPrefixId method, of class ServerBaseImpl
*/
@@ -106,4 +96,16 @@
assertTrue(instance.isRegistered());
executor.shutdownNow();
}
+
+ public class ServerBaseImplImpl extends ServerBaseImpl {
+
+ public ServerBaseImplImpl(Face face, Name prefix) {
+ super(face, prefix);
+ }
+
+ @Override
+ public void onInterest(Name prefix, Interest interest, Face face, long interestFilterId, InterestFilter filter) {
+ throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+ }
+ }
}
diff --git a/src/test/java/com/intel/jndn/utils/server/impl/SimpleServerTest.java b/src/test/java/com/intel/jndn/utils/server/impl/SimpleServerTest.java
index 4ce40ae..1f67d26 100644
--- a/src/test/java/com/intel/jndn/utils/server/impl/SimpleServerTest.java
+++ b/src/test/java/com/intel/jndn/utils/server/impl/SimpleServerTest.java
@@ -14,27 +14,27 @@
package com.intel.jndn.utils.server.impl;
import com.intel.jndn.mock.MeasurableFace;
-import com.intel.jndn.mock.MockFace;
import com.intel.jndn.mock.MockForwarder;
import com.intel.jndn.utils.server.RespondWithBlob;
import com.intel.jndn.utils.server.RespondWithData;
-import java.io.IOException;
import net.named_data.jndn.Data;
import net.named_data.jndn.Face;
import net.named_data.jndn.Interest;
import net.named_data.jndn.Name;
-import net.named_data.jndn.OnData;
import net.named_data.jndn.encoding.EncodingException;
import net.named_data.jndn.util.Blob;
-import static org.junit.Assert.*;
-
import org.junit.Before;
import org.junit.Test;
+import java.io.IOException;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
/**
* Test {@link SimpleServer}
*
- * @author Andrew Brown <andrew.brown@intel.com>
+ * @author Andrew Brown, andrew.brown@intel.com
*/
public class SimpleServerTest {