(SIGAR-199) add arp_list test

This commit is contained in:
Doug MacEachern 2010-01-18 16:48:12 -08:00
parent 9847f6a454
commit 34c0007c9a
2 changed files with 49 additions and 0 deletions

View File

@ -79,6 +79,7 @@ public class SigarTestRunner extends SigarCommandBase {
TestThreadCpu.class, TestThreadCpu.class,
TestUptime.class, TestUptime.class,
TestVMware.class, TestVMware.class,
TestArp.class,
TestWho.class, TestWho.class,
TestHumidor.class TestHumidor.class
}; };

View File

@ -0,0 +1,48 @@
/*
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
* This file is part of SIGAR.
*
* SIGAR is free software; you can redistribute it and/or modify
* it under the terms version 2 of the GNU General Public License as
* published by the Free Software Foundation. This program is distributed
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*/
package org.hyperic.sigar.test;
import org.hyperic.sigar.SigarException;
import org.hyperic.sigar.SigarNotImplementedException;
import org.hyperic.sigar.Arp;
public class TestArp extends SigarTestCase {
public TestArp(String name) {
super(name);
}
public void testCreate() throws Exception {
try {
Arp[] entries = getSigar().getArpList();
for (int i=0; i<entries.length; i++) {
Arp arp = entries[i];
assertTrueTrace("Address", arp.getAddress());
assertTrueTrace("Ifname", arp.getIfname());
assertTrueTrace("Hwaddr", arp.getHwaddr());
assertTrueTrace("Type", arp.getType());
traceln("Flags=" + arp.getFlags());
}
} catch (SigarNotImplementedException e) {
return;
} catch (SigarException e) {
return;
}
}
}