blob: a8116fb1c6eff4760f6cdd6bb8f93613b5ea4d60 [file] [log] [blame]
andrewsbrowne8e8e852015-03-09 13:48:31 -07001/*
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
16import com.intel.jndn.management.types.LocalControlHeader;
17import com.intel.jndn.utils.Client;
18import java.util.logging.Logger;
19import net.named_data.jndn.Data;
20import net.named_data.jndn.Face;
21import net.named_data.jndn.Name;
22import net.named_data.jndn.encoding.EncodingException;
23import net.named_data.jndn.security.KeyChain;
24import static org.junit.Assert.assertTrue;
25
26/**
27 * Test functionality for LocalControlHeader
28 *
29 * @author Andrew Brown <andrew.brown@intel.com>
30 */
31public class LocalControlHeaderTest {
32
33 private static final Logger logger = Logger.getLogger(IntegrationSuite.class.getName());
34
35 /**
36 * Integration test to run on actual system
37 *
38 * @param args
39 * @throws EncodingException
40 */
41 public static void main(String[] args) throws Exception {
42 // setup forwarder face
43 Face forwarder = new Face("localhost");
44 KeyChain keyChain = IntegrationSuite.buildTestKeyChain();
45 forwarder.setCommandSigningInfo(keyChain, keyChain.getDefaultCertificateName());
46
47 // enable incoming face ID header
48 boolean success = NFD.enableLocalControlHeader(forwarder, LocalControlHeader.INCOMING_FACE_ID);
49 assertTrue(success);
50
51 // use and verify
52 Data data = Client.getDefault().getSync(forwarder, new Name("/localhop/nfd"));
53 long faceId = data.getIncomingFaceId();
54 logger.info("Face ID for this client on the forwarder: " + faceId);
55 }
56}