blob: e282cefb483438552b61d9da25abc0c843560ea3 [file] [log] [blame] [view]
Andrew Browna5a07732015-02-21 13:11:56 -08001# jndn-mock
2
3This project consists of tools for testing NDN applications without network IO. It relies on the [NDN Protocol](https://named-data.net) and its associated [client library](https://github.com/named-data/jndn).
4
5## Install
Andrew Brown58191872016-02-05 22:16:57 -08006
Andrew Browna5a07732015-02-21 13:11:56 -08007With Maven, add the following to your POM:
Andrew Brown58191872016-02-05 22:16:57 -08008```xml
Andrew Browna5a07732015-02-21 13:11:56 -08009<dependency>
10 <groupId>com.intel.jndn.mock</groupId>
11 <artifactId>jndn-mock</artifactId>
12 <version>RELEASE</version> <!-- or a specific version -->
13</dependency>
14```
15
16## Use
Andrew Browna5a07732015-02-21 13:11:56 -080017
Andrew Brown58191872016-02-05 22:16:57 -080018`MockFace` is a test tool that can be passed to applications instead of a network IO `Face`; management of the `Face.processEvents()` is still the user's responsibility, though this may change in a future release. For example:
19```java
20Face face = new MockFace();
21face.expressInterest(interest, onData, onTimeout);
22face.processEvents();
23```
24
25When using the `MockFace`, retrieve statistics about sent/received Interests and Data packets like:
26```java
27MockFace face = new MockFace();
28assertEquals(0, face.sentDatas.size());
29assertEquals(0, face.sentInterests.size());
30
31face.expressInterest(interest, onData, onTimeout);
32...
33face.processEvents();
34...
35assertEquals(1, face.sentInterests.size());
Andrew Browna5a07732015-02-21 13:11:56 -080036```
37
38## License
Andrew Brown58191872016-02-05 22:16:57 -080039
40Copyright 2015, Intel Corporation.
andrewsbrown533c6ef2015-03-03 16:08:41 -080041
42This program is free software; you can redistribute it and/or modify it under the terms and conditions of the GNU Lesser General Public License, version 3, as published by the Free Software Foundation.
43
44This program is distributed in the hope it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the [GNU Lesser General Public License](https://github.com/01org/jndn-mock/blob/master/LICENSE) for more details.