|
SnmpDTest |
|
1 package com.mccrory.scott.spumoni.test; 2 3 //////////////////////////////////////////////////////////////////////////////// 4 // Copyright (C) 2002 Scott McCrory 5 // 6 // This program is free software; you can redistribute it and/or 7 // modify it under the terms of the GNU General Public License 8 // as published by the Free Software Foundation; either version 2 9 // of the License, or (at your option) any later version. 10 // 11 // This program is distributed in the hope that it will be useful, 12 // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 // GNU General Public License for more details. 15 // 16 // You should have received a copy of the GNU General Public License 17 // along with this program; if not, write to the Free Software 18 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 //////////////////////////////////////////////////////////////////////////////// 20 21 import junit.framework.TestCase; 22 /** 23 * <P>JUnit test case for the SnmpD class.</P> 24 * 25 * @author <a href="mailto:smccrory@users.sourceforge.net">Scott McCrory</a>. 26 * @version CVS $Id: SnmpDTest.java,v 1.2 2002/08/04 22:04:53 smccrory Exp $ 27 */ 28 public class SnmpDTest extends TestCase { 29 30 /** A class-wide storage container for the command-line arguments **/ 31 private static String[] myargs; 32 33 /** 34 * SnmpDTest constructor 35 * @param name java.lang.String 36 */ 37 public SnmpDTest(String name) { 38 super(name); 39 } 40 41 /** 42 * Runs the JUnit test from the command line. 43 * @param args java.lang.String[] 44 */ 45 public static void main(String[] args) { 46 47 myargs = args; 48 junit.textui.TestRunner.run(SnmpDTest.class); 49 50 } 51 52 /** 53 * Makes sure we can create the SnmpD object and send a few test GETs to it. 54 * Creation date: (1/12/2002 7:22:47 PM) 55 */ 56 public void testSnmpD() { 57 58 try { 59 /* 60 // First instantiate SnmpD to get the daemon running 61 SnmpAgentSession testDaemonSession = new SnmpAgentSession(new SnmpD(), 161); 62 assertNotNull(testDaemonSession); 63 64 System.out.println("SNMP Agent Starting..."); 65 synchronized(testDaemonSession) { 66 //testDaemonSession.wait(); 67 } 68 System.out.println("SNMP Agent Exiting"); 69 70 testDaemonSession.close(); 71 72 73 // Now send a few GETs and see if we get the expected values back 74 String m_startOid = ".1.3"; 75 */ 76 77 } 78 catch (Exception e) { 79 e.printStackTrace(); 80 fail("Should not encounter " + e.getMessage()); 81 } 82 83 } 84 85 }
|
SnmpDTest |
|