jade.jademx.mbean
Class JadeAgentTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by jade.jademx.mbean.JadeAgentTest
All Implemented Interfaces:
java.util.EventListener, javax.management.NotificationListener, junit.framework.Test

public class JadeAgentTest
extends junit.framework.TestCase
implements javax.management.NotificationListener

JadeAgent MBean test

Author:
David Bernstein, Caboodle Networks, Inc.

Field Summary
private static java.lang.String AGENT_LOCAL_NAME_PINGER1
          name for 1st ping agent
private static java.lang.String AGENT_LOCAL_NAME_PINGER2
          name for 2nd ping agent
private  jade.jademx.server.JadeMXServer jadeMXServer
          jadeMXServer we're using
private  jade.jademx.mbean.JadeRuntime jadeRuntime
          runtime for test use
private  java.util.LinkedList notificationQueue
          a queue for notifications
private static java.lang.Object[] PINGER2_ARGS_AS_ARR
           
private static java.lang.Object PINGER2_ARGS_AS_OBJ
          expected arguments for pinger2
private  java.lang.String PINGER2_CLASS_NAME
          expected class name for pinger2 agent
private static java.lang.String PINGER2_EXPECTED_MBEAN_NAME_STRING
          string verion of expected MBean name for pinger2 agent
private static java.lang.String PINGER2_EXPECTED_PLATFORM_OBJECT_NAME_STRING
          expected string MBean name for pinger2 agent
(package private)  jade.jademx.mbean.JadePlatform platformMBean
          mbean for platform under test
private static java.lang.String TWO_PING_CONFIG_RESOURCE
          resource name for configuration of two ping agents
 
Constructor Summary
JadeAgentTest()
           
 
Method Summary
 void handleNotification(javax.management.Notification notification, java.lang.Object handback)
           
private  java.lang.String pinger2ExpectedFullName()
          expected full JADE name name for pinger2 agent
protected  void setUp()
           
static junit.framework.Test suite()
          return the implicit suite of tests
protected  void tearDown()
           
 void testAgentKill()
          test killing an agent
 void testAgentMBeanInfo()
          test MBeanInfo for agent
 void testAgentNameProp()
          test getting name property for the agent mbean
 void testGetArguments()
          test getting agent's arguments
 void testGetClassName()
          test getting agent's classname
 void testGetFullName()
          test getting agent's full JADE name
 void testGetLocalName()
          test getting agent's local name
 void testGetPlatformObjectNameString()
          test getting agent's platform's object name string
 void testGetStateCode()
          test getting agent's JADE state code
 void testGetStateName()
          test getting agent's state JADE name
private  void verifyAttr(javax.management.MBeanInfo mbi, java.lang.String name, java.lang.String type, boolean readable, boolean writable, javax.management.AttributeList aList, java.lang.Object value)
          verify that given attribute in given MBeanInfo
private  void verifyNotif(javax.management.MBeanInfo mbi, java.lang.String type)
          verify given notification in given MBeanInfo
private  void verifyOper(javax.management.MBeanInfo mbi, java.lang.String name, java.lang.String type)
          verify given operation in given MBeanInfo
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

jadeMXServer

private jade.jademx.server.JadeMXServer jadeMXServer
jadeMXServer we're using


jadeRuntime

private jade.jademx.mbean.JadeRuntime jadeRuntime
runtime for test use


platformMBean

jade.jademx.mbean.JadePlatform platformMBean
mbean for platform under test


TWO_PING_CONFIG_RESOURCE

private static final java.lang.String TWO_PING_CONFIG_RESOURCE
resource name for configuration of two ping agents

See Also:
Constant Field Values

AGENT_LOCAL_NAME_PINGER1

private static final java.lang.String AGENT_LOCAL_NAME_PINGER1
name for 1st ping agent

See Also:
Constant Field Values

AGENT_LOCAL_NAME_PINGER2

private static final java.lang.String AGENT_LOCAL_NAME_PINGER2
name for 2nd ping agent

See Also:
Constant Field Values

notificationQueue

private java.util.LinkedList notificationQueue
a queue for notifications


PINGER2_ARGS_AS_OBJ

private static final java.lang.Object PINGER2_ARGS_AS_OBJ
expected arguments for pinger2


PINGER2_ARGS_AS_ARR

private static final java.lang.Object[] PINGER2_ARGS_AS_ARR

PINGER2_CLASS_NAME

private final java.lang.String PINGER2_CLASS_NAME
expected class name for pinger2 agent


PINGER2_EXPECTED_PLATFORM_OBJECT_NAME_STRING

private static final java.lang.String PINGER2_EXPECTED_PLATFORM_OBJECT_NAME_STRING
expected string MBean name for pinger2 agent

See Also:
Constant Field Values

PINGER2_EXPECTED_MBEAN_NAME_STRING

private static final java.lang.String PINGER2_EXPECTED_MBEAN_NAME_STRING
string verion of expected MBean name for pinger2 agent

See Also:
Constant Field Values
Constructor Detail

JadeAgentTest

public JadeAgentTest()
Method Detail

setUp

protected void setUp()
              throws java.lang.Exception
Overrides:
setUp in class junit.framework.TestCase
Throws:
java.lang.Exception

tearDown

protected void tearDown()
                 throws java.lang.Exception
Overrides:
tearDown in class junit.framework.TestCase
Throws:
java.lang.Exception

handleNotification

public void handleNotification(javax.management.Notification notification,
                               java.lang.Object handback)
Specified by:
handleNotification in interface javax.management.NotificationListener

testGetArguments

public void testGetArguments()
                      throws jade.jademx.mbean.JademxException
test getting agent's arguments

Throws:
JademxException - unexpected problems with jademx

testGetClassName

public void testGetClassName()
                      throws jade.jademx.mbean.JademxException
test getting agent's classname

Throws:
JademxException - unexpected problems with jademx

testGetLocalName

public void testGetLocalName()
                      throws jade.jademx.mbean.JademxException
test getting agent's local name

Throws:
JademxException - unexpected problems with jademx

testGetPlatformObjectNameString

public void testGetPlatformObjectNameString()
                                     throws jade.jademx.mbean.JademxException
test getting agent's platform's object name string

Throws:
JademxException - unexpected problems with jademx

pinger2ExpectedFullName

private java.lang.String pinger2ExpectedFullName()
expected full JADE name name for pinger2 agent


testGetFullName

public void testGetFullName()
                     throws jade.jademx.mbean.JademxException
test getting agent's full JADE name

Throws:
JademxException - unexpected problems with jademx

testGetStateCode

public void testGetStateCode()
                      throws jade.jademx.mbean.JademxException
test getting agent's JADE state code

Throws:
JademxException - unexpected problems with jademx

testGetStateName

public void testGetStateName()
                      throws jade.jademx.mbean.JademxException
test getting agent's state JADE name

Throws:
JademxException - unexpected problems with jademx

testAgentNameProp

public void testAgentNameProp()
                       throws jade.jademx.mbean.JademxException
test getting name property for the agent mbean

Throws:
JademxException - unexpected problems with jademx

testAgentKill

public void testAgentKill()
                   throws jade.jademx.mbean.JademxException
test killing an agent

Throws:
JademxException - unexpected problems with jademx

testAgentMBeanInfo

public void testAgentMBeanInfo()
                        throws jade.jademx.mbean.JademxException
test MBeanInfo for agent

Throws:
JademxException - unexpected problems with jademx

verifyAttr

private void verifyAttr(javax.management.MBeanInfo mbi,
                        java.lang.String name,
                        java.lang.String type,
                        boolean readable,
                        boolean writable,
                        javax.management.AttributeList aList,
                        java.lang.Object value)
verify that given attribute in given MBeanInfo

Parameters:
mbi - MBeanInfo to look in
name - attribute name
type - attribute type
readable - attribute readability
writable - attribute writability
aList - attribute list to get actual value from
value - expected value: if null then don't check

verifyOper

private void verifyOper(javax.management.MBeanInfo mbi,
                        java.lang.String name,
                        java.lang.String type)
verify given operation in given MBeanInfo

Parameters:
mbi - MBeanInfo to look in
name - operation name
type - operation type

verifyNotif

private void verifyNotif(javax.management.MBeanInfo mbi,
                         java.lang.String type)
verify given notification in given MBeanInfo

Parameters:
mbi - MBeanInfo to look in
type - notification type

suite

public static junit.framework.Test suite()
return the implicit suite of tests

Returns:
the implicit suite of tests


Copyright © 2005-2006 Caboodle Networks, Inc.
LGPL license