andrewsbrown | e8e8e85 | 2015-03-09 13:48:31 -0700 | [diff] [blame] | 1 | /* |
| 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 | */ |
| 14 | package com.intel.jndn.management; |
| 15 | |
| 16 | import com.intel.jndn.management.types.LocalControlHeader; |
| 17 | import com.intel.jndn.utils.Client; |
| 18 | import java.util.logging.Logger; |
| 19 | import net.named_data.jndn.Data; |
| 20 | import net.named_data.jndn.Face; |
| 21 | import net.named_data.jndn.Name; |
| 22 | import net.named_data.jndn.encoding.EncodingException; |
| 23 | import net.named_data.jndn.security.KeyChain; |
| 24 | import static org.junit.Assert.assertTrue; |
| 25 | |
| 26 | /** |
| 27 | * Test functionality for LocalControlHeader |
| 28 | * |
| 29 | * @author Andrew Brown <andrew.brown@intel.com> |
| 30 | */ |
| 31 | public 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 | } |