Andrew Brown | a5a0773 | 2015-02-21 13:11:56 -0800 | [diff] [blame] | 1 | # jndn-mock |
| 2 | |
| 3 | This 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 Brown | 5819187 | 2016-02-05 22:16:57 -0800 | [diff] [blame] | 6 | |
Andrew Brown | a5a0773 | 2015-02-21 13:11:56 -0800 | [diff] [blame] | 7 | With Maven, add the following to your POM: |
Andrew Brown | 5819187 | 2016-02-05 22:16:57 -0800 | [diff] [blame] | 8 | ```xml |
Andrew Brown | a5a0773 | 2015-02-21 13:11:56 -0800 | [diff] [blame] | 9 | <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 Brown | a5a0773 | 2015-02-21 13:11:56 -0800 | [diff] [blame] | 17 | |
Andrew Brown | 5819187 | 2016-02-05 22:16:57 -0800 | [diff] [blame] | 18 | `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 |
| 20 | Face face = new MockFace(); |
| 21 | face.expressInterest(interest, onData, onTimeout); |
| 22 | face.processEvents(); |
| 23 | ``` |
| 24 | |
| 25 | When using the `MockFace`, retrieve statistics about sent/received Interests and Data packets like: |
| 26 | ```java |
| 27 | MockFace face = new MockFace(); |
| 28 | assertEquals(0, face.sentDatas.size()); |
| 29 | assertEquals(0, face.sentInterests.size()); |
| 30 | |
| 31 | face.expressInterest(interest, onData, onTimeout); |
| 32 | ... |
| 33 | face.processEvents(); |
| 34 | ... |
| 35 | assertEquals(1, face.sentInterests.size()); |
Andrew Brown | a5a0773 | 2015-02-21 13:11:56 -0800 | [diff] [blame] | 36 | ``` |
| 37 | |
| 38 | ## License |
Andrew Brown | 5819187 | 2016-02-05 22:16:57 -0800 | [diff] [blame] | 39 | |
Davide Pesavento | c2a6570 | 2020-04-17 23:30:27 -0400 | [diff] [blame^] | 40 | Copyright © 2015, Intel Corporation. |
andrewsbrown | 533c6ef | 2015-03-03 16:08:41 -0800 | [diff] [blame] | 41 | |
Davide Pesavento | c2a6570 | 2020-04-17 23:30:27 -0400 | [diff] [blame^] | 42 | This 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. |
andrewsbrown | 533c6ef | 2015-03-03 16:08:41 -0800 | [diff] [blame] | 43 | |
Davide Pesavento | c2a6570 | 2020-04-17 23:30:27 -0400 | [diff] [blame^] | 44 | This 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. |