Initial pubsub; waiting on MockFace to fully test
diff --git a/src/test/java/com/intel/jndn/utils/ClientTest.java b/src/test/java/com/intel/jndn/utils/ClientTest.java
index 0ac93b5..62b67d5 100644
--- a/src/test/java/com/intel/jndn/utils/ClientTest.java
+++ b/src/test/java/com/intel/jndn/utils/ClientTest.java
@@ -20,50 +20,68 @@
import net.named_data.jndn.Face;
import net.named_data.jndn.Name;
import net.named_data.jndn.util.Blob;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
/**
*
* @author Andrew Brown <andrew.brown@intel.com>
*/
public class ClientTest {
+
+
+ /**
+ * Setup logging
+ */
+ private static final Logger logger = LogManager.getLogger();
- @Test
- public void testGetSync() {
- // setup face
- MockTransport transport = new MockTransport();
- Face face = new Face(transport, null);
+ /**
+ * Test retrieving data synchronously
+ */
+ @Test
+ public void testGetSync() {
+ // setup face
+ MockTransport transport = new MockTransport();
+ Face face = new Face(transport, null);
- // setup return data
- Data response = new Data(new Name("/a/b/c"));
- response.setContent(new Blob("..."));
- transport.respondWith(response);
+ // setup return data
+ Data response = new Data(new Name("/a/b/c"));
+ response.setContent(new Blob("..."));
+ transport.respondWith(response);
- // retrieve data
- Client client = new Client();
- Data data = client.getSync(face, new Name("/a/b/c"));
- assertEquals(new Blob("...").buf(), data.getContent().buf());
- }
+ // retrieve data
+ logger.info("Client expressing interest synchronously: /a/b/c");
+ Client client = new Client();
+ Data data = client.getSync(face, new Name("/a/b/c"));
+ assertEquals(new Blob("...").buf(), data.getContent().buf());
+ }
- @Test
- public void testGetAsync() throws InterruptedException {
- // setup face
- MockTransport transport = new MockTransport();
- Face face = new Face(transport, null);
+ /**
+ * Test retrieving data asynchronously
+ *
+ * @throws InterruptedException
+ */
+ @Test
+ public void testGetAsync() throws InterruptedException {
+ // setup face
+ MockTransport transport = new MockTransport();
+ Face face = new Face(transport, null);
- // setup return data
- Data response = new Data(new Name("/a/b/c"));
- response.setContent(new Blob("..."));
- transport.respondWith(response);
+ // setup return data
+ Data response = new Data(new Name("/a/b/c"));
+ response.setContent(new Blob("..."));
+ transport.respondWith(response);
- // retrieve data
- Client client = new Client();
- ClientObserver observer = client.get(face, new Name("/a/b/c"));
-
- // wait
- while(observer.responses() == 0){
- Thread.sleep(10);
- }
- Data data = (Data) observer.getFirst().getPacket();
- assertEquals(new Blob("...").buf(), data.getContent().buf());
- }
+ // retrieve data
+ logger.info("Client expressing interest asynchronously: /a/b/c");
+ Client client = new Client();
+ ClientObserver observer = client.get(face, new Name("/a/b/c"));
+
+ // wait
+ while (observer.responses() == 0) {
+ Thread.sleep(10);
+ }
+ Data data = (Data) observer.getFirst().getPacket();
+ assertEquals(new Blob("...").buf(), data.getContent().buf());
+ }
}