aboutsummaryrefslogtreecommitdiff
path: root/test/org/gnunet/nse/NSETest.java
diff options
context:
space:
mode:
Diffstat (limited to 'test/org/gnunet/nse/NSETest.java')
-rw-r--r--test/org/gnunet/nse/NSETest.java56
1 files changed, 56 insertions, 0 deletions
diff --git a/test/org/gnunet/nse/NSETest.java b/test/org/gnunet/nse/NSETest.java
new file mode 100644
index 0000000..c3e6512
--- /dev/null
+++ b/test/org/gnunet/nse/NSETest.java
@@ -0,0 +1,56 @@
1/*
2 This file is part of GNUnet.
3 (C) 2011, 2012 Christian Grothoff (and other contributing authors)
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19 */
20
21package org.gnunet.nse;
22
23import org.gnunet.testing.TestingSetup;
24import org.gnunet.testing.TestingSubsystem;
25import org.gnunet.util.AbsoluteTime;
26import org.gnunet.util.Scheduler;
27import org.gnunet.util.Wrapper;
28import org.junit.Test;
29
30import static org.junit.Assert.assertNotNull;
31import static org.junit.Assert.assertTrue;
32
33/**
34 * @author Florian Dold
35 */
36public class NSETest {
37 @Test
38 public void test_nse() {
39 final Wrapper<Boolean> gotResult = new Wrapper<Boolean>(false);
40 TestingSubsystem ts = new TestingSubsystem("nse");
41
42 final NetworkSizeEstimation nse = new NetworkSizeEstimation(ts.getConfiguration());
43 nse.subscribe(new NetworkSizeEstimation.Subscriber() {
44 @Override
45 public void update(AbsoluteTime timestamp, double estimate, double deviation) {
46 assertNotNull(timestamp);
47 gotResult.set(true);
48 nse.disconnect();
49 }
50 });
51
52 Scheduler.run();
53
54 assertTrue(gotResult.get());
55 }
56}