blob: 7bcf8fd976cd3a93e7f0f492194e578bfc467491 [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
Davide Pesaventoc2a65702020-04-17 23:30:27 -040040Copyright © 2015, Intel Corporation.
andrewsbrown533c6ef2015-03-03 16:08:41 -080041
Davide Pesaventoc2a65702020-04-17 23:30:27 -040042This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 3, as published by the Free Software Foundation.
andrewsbrown533c6ef2015-03-03 16:08:41 -080043
Davide Pesaventoc2a65702020-04-17 23:30:27 -040044This program is distributed in the hope that 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](LICENSE.md) for more details.