blob: 762ae7c92acdcdcf83d501f094eee783e71190ac [file] [log] [blame]
Alexander Afanasyeva8bc0d82016-01-25 17:25:30 -08001/*
2 * jndn-management
3 * Copyright (c) 2015, Intel Corporation.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU Lesser General Public License,
7 * version 3, as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT ANY
10 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
12 * more details.
13 */
14package com.intel.jndn.management;
15
Alexander Afanasyeva8bc0d82016-01-25 17:25:30 -080016import net.named_data.jndn.Face;
Alexander Afanasyev3c5ae7c2016-02-19 19:33:21 -080017import net.named_data.jndn.Name;
Alexander Afanasyeva8bc0d82016-01-25 17:25:30 -080018import net.named_data.jndn.security.SecurityException;
19import org.junit.Before;
20import org.junit.Test;
21
22import java.io.IOException;
Alexander Afanasyeva8bc0d82016-01-25 17:25:30 -080023
Alexander Afanasyev3c5ae7c2016-02-19 19:33:21 -080024import static org.junit.Assert.assertFalse;
Alexander Afanasyeve36e1af2016-02-19 18:06:05 -080025import static org.junit.Assert.assertTrue;
Alexander Afanasyeva8bc0d82016-01-25 17:25:30 -080026
27/**
Alexander Afanasyeve36e1af2016-02-19 18:06:05 -080028 * Testing basic pining using real NFD instance (NFD must be run locally while executing the test).
Alexander Afanasyeva8bc0d82016-01-25 17:25:30 -080029 *
30 * @author Andrew Brown <andrew.brown@intel.com>
31 */
32public class NdnPingClientIT {
33 private Face face;
34
35 @Before
36 public void setUp() throws SecurityException {
37 face = new Face("localhost");
38 }
39
40 @Test
41 public void testPingLocal() throws IOException, ManagementException {
42 boolean hasSucceeded = NdnPingClient.pingLocal(face);
43 assertTrue(hasSucceeded);
44 }
Alexander Afanasyev3c5ae7c2016-02-19 19:33:21 -080045
46 @Test
47 public void testFailedPing() {
48 boolean hasSucceeded = NdnPingClient.ping(face, new Name("/non/existent/name/of/data"));
49 assertFalse(hasSucceeded);
50 }
Alexander Afanasyeva8bc0d82016-01-25 17:25:30 -080051}