#!/usr/bin/python2
# -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
#
# Copyright (C) 2014 University of Arizona
# Author: Jerald Paul Abraham <jeraldabraham@email.arizona.edu>
# See COPYING for copyright and distribution information.
#

import time
import unittest
import process_manager

class test_ndnping(unittest.TestCase, process_manager.ProcessManager):
    """Test case for testing ndnping application"""

    def setUp(self):
        print "\nTesting ndnping"
        print "********************"

    def tearDown(self):
        self.killNfd()
        self.killProcess("ndnpingserver")
        self.killProcess("ndnping")
        self.cleanupProcesses()

    def test_ping(self):
        self.startNfd()
        time.sleep(1)
        time.sleep(1)
        self.startProcess("ndnpingserver",
            ["ndnpingserver", "-p1", "/test/ndnping"], "-> Starting Ping Server")
        time.sleep(1)
        self.startProcess("ndnping",
            ["ndnping", "-c1", "/test/ndnping"], "-> Starting Ping Client")
        time.sleep(1)
        self.waitForProcessCompletion("ndnping", 10)
        self.waitForProcessCompletion("ndnpingserver", 10)
        if self.hasProcessCompleted("ndnping"):
            if self.getProcessReturnCode("ndnping") != 0:
                print self.getProcessError("ndnping")
                self.fail(">> TEST FAILED - received non-zero return code from ndnping")
        else:
            self.fail(">> TEST FAILED - ndnping failed to complete")
        if self.hasProcessCompleted("ndnpingserver"):
            if self.getProcessReturnCode("ndnpingserver") != 0:
                print self.getProcessError("ndnpingserver")
                self.fail(">> TEST FAILED - received non-zero return code from ndnpingserver")
        else:
            self.fail(">> TEST FAILED - ndnpingserver failed to complete")
        print ">> TEST SUCCESSFUL"
