1.0.0

org.eclipse.soda.dk.device.testcase
Class DeviceTestcase

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.eclipse.soda.dk.device.testcase.DeviceTestcase
All Implemented Interfaces:
junit.framework.Test, CommandListener, DeviceListener, MeasurementListener, SignalListener, ErrorListener

public abstract class DeviceTestcase
extends junit.framework.TestCase
implements DeviceListener, CommandListener, MeasurementListener, SignalListener

Version:
1.0.0

Field Summary
static java.lang.String CLASS_NAME
          Defines the class name.
protected  CommandService commandReceived
          Define the command received (CommandService) field.
protected  java.lang.Object commandReceivedData
          Define the command received data (Object) field.
protected  java.lang.Object commandWait
          Define the command wait (Object) field.
protected  DeviceService device
          Define the device (DeviceService) field.
protected  MeasurementService measurementReceived
          Define the measurement received (MeasurementService) field.
protected  java.lang.Object measurementReceivedData
          Define the measurement received data (Object) field.
protected  java.lang.Object measurementWait
          Define the measurement wait (Object) field.
protected static int MESSAGE_KEY_NOT_NUMBER_RESOURCE
          Define the message key not number resource (int) constant.
protected  MessageService messageReceived
          Define the message received (MessageService) field.
protected  java.lang.Object messageReceivedWait
          Define the message received wait (Object) field.
protected  MessageService responseMessage
          Define the response message (MessageService) field.
protected  SignalService signalReceived
          Define the signal received (SignalService) field.
protected  java.lang.Object signalReceivedData
          Define the signal received data (Object) field.
protected  java.lang.Object signalWait
          Define the signal wait (Object) field.
protected  java.lang.Object stateWait
          Define the state wait (Object) field.
protected  TransportService transport
          Define the transport (TestTransport) field.
 
Fields inherited from interface org.eclipse.soda.dk.device.service.DeviceListener
ADDED, CHANGED, REMOVED
 
Constructor Summary
DeviceTestcase()
          Constructs a new instance of the DeviceTestcase class.
DeviceTestcase(java.lang.String name)
          Constructs an instance of this class from the specified name parameter.
 
Method Summary
 void commandExecuted(CommandService source, java.lang.Object timestamp, java.lang.Object data)
          Command executed with the specified source, timestamp and data parameters.
 void controlChanged(DeviceService device, java.lang.Object timestamp, ControlService control, int code)
          Control changed with the specified device, timestamp, control and code parameters.
abstract  DeviceService createDevice()
          Create device and return the DeviceService result.
 TransportService createTransport()
          Create transport and return the TransportService result.
 void deviceChanged(DeviceService source, java.lang.Object timestamp, int newState, int oldState)
          Device changed with the specified source, timestamp, new state and old state parameters.
 void errorOccurred(java.lang.Object source, java.lang.Object timestamp, java.lang.Object data)
          Error occurred with the specified source, timestamp and data parameters.
 CommandService getCommandReceived()
          Gets the command received (CommandService) value.
 java.lang.Object getCommandReceivedData()
          Gets the command received data (Object) value.
 java.lang.Object getCommandWait()
          Gets the command wait (Object) value.
 DeviceService getDevice()
          Gets the device (DeviceService) value.
 MeasurementService getMeasurementReceived()
          Gets the measurement received (MeasurementService) value.
 java.lang.Object getMeasurementReceivedData()
          Gets the measurement received data (Object) value.
 java.lang.Object getMeasurementWait()
          Gets the measurement wait (Object) value.
 java.lang.Object getMessageKey(MessageService message)
          Get message key with the specified message parameter and return the Object result.
 MessageService getMessageReceived()
          Gets the message received (MessageService) value.
 java.lang.Object getMessageReceivedWait()
          Gets the message received wait (Object) value.
 java.lang.String getResource(int resourceId)
          Gets the string resource using the supplied resourceId.
 MessageService getResponseMessage()
          Gets the response message (MessageService) value.
 SignalService getSignalReceived()
          Gets the signal received (SignalService) value.
 java.lang.Object getSignalReceivedData()
          Gets the signal received data (Object) value.
 java.lang.Object getSignalWait()
          Gets the signal wait (Object) value.
 java.lang.Object getStateWait()
          Gets the state wait (Object) value.
 TransportService getTransport()
          Gets the transport (TransportService) value.
 void measurementChanged(MeasurementService source, java.lang.Object timestamp, java.lang.Object newValue, java.lang.Object oldValue)
          Measurement changed with the specified source, timestamp, new value and old value parameters.
 void messageReceived(TransportService transportService, java.lang.Object timestamp, MessageService message)
          Message received with the specified transport service, timestamp and message parameters.
 void printTable(java.util.Hashtable table, int messageCapacity)
          Print table with the specified table parameter.
 int registerMessageHandler(MessageService message, java.util.Dictionary messageHandlers)
          Register message handler with the specified message and message handlers parameters.
 void setCommandReceived(CommandService commandReceived)
          Sets the command received value.
 void setCommandReceivedData(java.lang.Object commandReceivedData)
          Sets the command received data value.
 void setDevice(DeviceService device)
          Sets the device value.
 void setMeasurementReceived(MeasurementService measurementReceived)
          Sets the measurement received value.
 void setMeasurementReceivedData(java.lang.Object measurementReceivedData)
          Sets the measurement received data value.
 void setMessageReceived(MessageService messageReceived)
          Sets the message received value.
 void setResponseMessage(MessageService responseMessage)
          Sets the response message value.
 void setSignalReceived(SignalService signalReceived)
          Sets the signal received value.
 void setSignalReceivedData(java.lang.Object signalReceivedData)
          Sets the signal received data value.
 void setTransport(TransportService transport)
          Sets the transport value.
protected  void setUp()
          Set up.
 void signalOccurred(SignalService source, java.lang.Object timestamp, java.lang.Object data)
          Signal occurred with the specified source, timestamp and data parameters.
 void startDevice()
          Start device.
protected  void tearDown()
          Tear down.
 void test_Fields()
          Test_ fields.
 void test_InterestMask()
          Test_ controls.
 void test_Interfaces()
          Test_ interfaces.
 void test_MessageKey()
          Test_ controls.
 
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, failNotEquals, failNotSame, failSame, format
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CLASS_NAME

public static final java.lang.String CLASS_NAME
Defines the class name.


MESSAGE_KEY_NOT_NUMBER_RESOURCE

protected static final int MESSAGE_KEY_NOT_NUMBER_RESOURCE
Define the message key not number resource (int) constant.

See Also:
Constant Field Values

device

protected DeviceService device
Define the device (DeviceService) field.


transport

protected TransportService transport
Define the transport (TestTransport) field.


messageReceived

protected MessageService messageReceived
Define the message received (MessageService) field.


responseMessage

protected MessageService responseMessage
Define the response message (MessageService) field.


signalReceived

protected SignalService signalReceived
Define the signal received (SignalService) field.


signalReceivedData

protected java.lang.Object signalReceivedData
Define the signal received data (Object) field.


commandReceived

protected CommandService commandReceived
Define the command received (CommandService) field.


commandReceivedData

protected java.lang.Object commandReceivedData
Define the command received data (Object) field.


commandWait

protected final java.lang.Object commandWait
Define the command wait (Object) field.


measurementReceived

protected MeasurementService measurementReceived
Define the measurement received (MeasurementService) field.


measurementReceivedData

protected java.lang.Object measurementReceivedData
Define the measurement received data (Object) field.


measurementWait

protected final java.lang.Object measurementWait
Define the measurement wait (Object) field.


stateWait

protected final java.lang.Object stateWait
Define the state wait (Object) field.


messageReceivedWait

protected final java.lang.Object messageReceivedWait
Define the message received wait (Object) field.


signalWait

protected final java.lang.Object signalWait
Define the signal wait (Object) field.

Constructor Detail

DeviceTestcase

public DeviceTestcase()
Constructs a new instance of the DeviceTestcase class.

See Also:
DeviceTestcase(String)

DeviceTestcase

public DeviceTestcase(java.lang.String name)
Constructs an instance of this class from the specified name parameter.

Parameters:
name - The name (String) parameter.
See Also:
DeviceTestcase()
Method Detail

commandExecuted

public void commandExecuted(CommandService source,
                            java.lang.Object timestamp,
                            java.lang.Object data)
Command executed with the specified source, timestamp and data parameters.

Specified by:
commandExecuted in interface CommandListener
Parameters:
source - The source (CommandService) parameter.
timestamp - The timestamp (Object) parameter.
data - The data (Object) parameter.

controlChanged

public void controlChanged(DeviceService device,
                           java.lang.Object timestamp,
                           ControlService control,
                           int code)
Control changed with the specified device, timestamp, control and code parameters.

Specified by:
controlChanged in interface DeviceListener
Parameters:
container - The device (DeviceService) parameter.
timestamp - The timestamp (Object) parameter.
control - The control (ControlService) parameter.
code - The code (int) parameter.
device - The device (DeviceService) parameter.
See Also:
deviceChanged(DeviceService,Object,int,int), measurementChanged(MeasurementService,Object,Object,Object)

createDevice

public abstract DeviceService createDevice()
Create device and return the DeviceService result.

Returns:
Results of the create device (DeviceService) value.
See Also:
getDevice(), setDevice(DeviceService), startDevice()

createTransport

public TransportService createTransport()
Create transport and return the TransportService result.

Returns:
Results of the create transport (TransportService) value.
See Also:
getTransport(), setTransport(TransportService)

deviceChanged

public void deviceChanged(DeviceService source,
                          java.lang.Object timestamp,
                          int newState,
                          int oldState)
Device changed with the specified source, timestamp, new state and old state parameters.

Specified by:
deviceChanged in interface DeviceListener
Parameters:
source - The source (DeviceService) parameter.
timestamp - The timestamp (Object) parameter.
newState - The new state (int) parameter.
oldState - The old state (int) parameter.
See Also:
controlChanged(DeviceService,Object,ControlService,int), measurementChanged(MeasurementService,Object,Object,Object)

errorOccurred

public void errorOccurred(java.lang.Object source,
                          java.lang.Object timestamp,
                          java.lang.Object data)
Error occurred with the specified source, timestamp and data parameters.

Specified by:
errorOccurred in interface ErrorListener
Parameters:
source - The source (Object) parameter.
timestamp - The timestamp (Object) parameter.
data - The data (Object) parameter.
See Also:
signalOccurred(SignalService,Object,Object)

getCommandReceived

public CommandService getCommandReceived()
Gets the command received (CommandService) value.

Returns:
The command received (CommandService) value.
See Also:
setCommandReceived(CommandService)

getCommandReceivedData

public java.lang.Object getCommandReceivedData()
Gets the command received data (Object) value.

Returns:
The command received data (Object) value.
See Also:
setCommandReceivedData(Object)

getCommandWait

public java.lang.Object getCommandWait()
Gets the command wait (Object) value.

Returns:
The command wait (Object) value.

getDevice

public DeviceService getDevice()
Gets the device (DeviceService) value.

Returns:
The device (DeviceService) value.
See Also:
createDevice(), setDevice(DeviceService), startDevice()

getMeasurementReceived

public MeasurementService getMeasurementReceived()
Gets the measurement received (MeasurementService) value.

Returns:
The measurement received (MeasurementService) value.
See Also:
setMeasurementReceived(MeasurementService)

getMeasurementReceivedData

public java.lang.Object getMeasurementReceivedData()
Gets the measurement received data (Object) value.

Returns:
The measurement received data (Object) value.
See Also:
setMeasurementReceivedData(Object)

getMeasurementWait

public java.lang.Object getMeasurementWait()
Gets the measurement wait (Object) value.

Returns:
The measurement wait (Object) value.

getMessageKey

public java.lang.Object getMessageKey(MessageService message)
Get message key with the specified message parameter and return the Object result.

Parameters:
message - The message (MessageService) parameter.
Returns:
Results of the get message key (Object) value.
See Also:
test_MessageKey()

getMessageReceived

public MessageService getMessageReceived()
Gets the message received (MessageService) value.

Returns:
The message received (MessageService) value.
See Also:
setMessageReceived(MessageService)

getMessageReceivedWait

public java.lang.Object getMessageReceivedWait()
Gets the message received wait (Object) value.

Returns:
The message received wait (Object) value.

getResource

public java.lang.String getResource(int resourceId)
Gets the string resource using the supplied resourceId.

Parameters:
resourceId - The resource id (int) parameter.
Returns:
Results of the get resource (String) value.

getResponseMessage

public MessageService getResponseMessage()
Gets the response message (MessageService) value.

Returns:
The response message (MessageService) value.
See Also:
setResponseMessage(MessageService)

getSignalReceived

public SignalService getSignalReceived()
Gets the signal received (SignalService) value.

Returns:
The signal received (SignalService) value.
See Also:
setSignalReceived(SignalService)

getSignalReceivedData

public java.lang.Object getSignalReceivedData()
Gets the signal received data (Object) value.

Returns:
The signal received data (Object) value.
See Also:
setSignalReceivedData(Object)

getSignalWait

public java.lang.Object getSignalWait()
Gets the signal wait (Object) value.

Returns:
The signal wait (Object) value.

getStateWait

public java.lang.Object getStateWait()
Gets the state wait (Object) value.

Returns:
The state wait (Object) value.

getTransport

public TransportService getTransport()
Gets the transport (TransportService) value.

Returns:
The transport (TransportService) value.
See Also:
createTransport(), setTransport(TransportService)

measurementChanged

public void measurementChanged(MeasurementService source,
                               java.lang.Object timestamp,
                               java.lang.Object newValue,
                               java.lang.Object oldValue)
Measurement changed with the specified source, timestamp, new value and old value parameters.

Specified by:
measurementChanged in interface MeasurementListener
Parameters:
source - The source (MeasurementService) parameter.
timestamp - The timestamp (Object) parameter.
newValue - The new value (Object) parameter.
oldValue - The old value (Object) parameter.
See Also:
controlChanged(DeviceService,Object,ControlService,int), deviceChanged(DeviceService,Object,int,int)

messageReceived

public void messageReceived(TransportService transportService,
                            java.lang.Object timestamp,
                            MessageService message)
Message received with the specified transport service, timestamp and message parameters.

Parameters:
transportService - The transport service (TransportService) parameter.
timestamp - The timestamp (Object) parameter.
message - The message (MessageService) parameter.
See Also:
getCommandReceived(), getMeasurementReceived(), getMessageReceived(), getSignalReceived(), setCommandReceived(CommandService), setMeasurementReceived(MeasurementService), setMessageReceived(MessageService), setSignalReceived(SignalService)

printTable

public void printTable(java.util.Hashtable table,
                       int messageCapacity)
Print table with the specified table parameter.

Parameters:
table - The table (Hashtable) parameter.
messageCapacity - The message capacity (int) parameter.

registerMessageHandler

public int registerMessageHandler(MessageService message,
                                  java.util.Dictionary messageHandlers)
Register message handler with the specified message and message handlers parameters.

Parameters:
message - The message (MessageService) parameter.
messageHandlers - The message handlers (Dictionary) parameter.
Returns:
Results of the register message handler (int) value.

setCommandReceived

public void setCommandReceived(CommandService commandReceived)
Sets the command received value.

Parameters:
commandReceived - The commandReceived (CommandService) parameter.
See Also:
getCommandReceived()

setCommandReceivedData

public void setCommandReceivedData(java.lang.Object commandReceivedData)
Sets the command received data value.

Parameters:
commandReceivedData - The commandReceivedData (Object) parameter.
See Also:
getCommandReceivedData()

setDevice

public void setDevice(DeviceService device)
Sets the device value.

Parameters:
device - The device (DeviceService) parameter.
See Also:
createDevice(), getDevice(), startDevice()

setMeasurementReceived

public void setMeasurementReceived(MeasurementService measurementReceived)
Sets the measurement received value.

Parameters:
measurementReceived - The measurementReceived (MeasurementService) parameter.
See Also:
getMeasurementReceived()

setMeasurementReceivedData

public void setMeasurementReceivedData(java.lang.Object measurementReceivedData)
Sets the measurement received data value.

Parameters:
measurementReceivedData - The measurementReceivedData (Object) parameter.
See Also:
getMeasurementReceivedData()

setMessageReceived

public void setMessageReceived(MessageService messageReceived)
Sets the message received value.

Parameters:
messageReceived - The messageReceived (MessageService) parameter.
See Also:
getMessageReceived()

setResponseMessage

public void setResponseMessage(MessageService responseMessage)
Sets the response message value.

Parameters:
responseMessage - The responseMessage (MessageService) parameter.
See Also:
getResponseMessage()

setSignalReceived

public void setSignalReceived(SignalService signalReceived)
Sets the signal received value.

Parameters:
signalReceived - The signalReceived (SignalService) parameter.
See Also:
getSignalReceived()

setSignalReceivedData

public void setSignalReceivedData(java.lang.Object signalReceivedData)
Sets the signal received data value.

Parameters:
signalReceivedData - The signalReceivedData (Object) parameter.
See Also:
getSignalReceivedData()

setTransport

public void setTransport(TransportService transport)
Sets the transport value.

Parameters:
transport - The transport (TransportService) parameter.
See Also:
createTransport(), getTransport()

setUp

protected void setUp()
              throws java.lang.Exception
Set up.

Overrides:
setUp in class junit.framework.TestCase
Throws:
Exception.
java.lang.Exception

signalOccurred

public void signalOccurred(SignalService source,
                           java.lang.Object timestamp,
                           java.lang.Object data)
Signal occurred with the specified source, timestamp and data parameters.

Specified by:
signalOccurred in interface SignalListener
Parameters:
source - The source (SignalService) parameter.
timestamp - The timestamp (Object) parameter.
data - The data (Object) parameter.
See Also:
errorOccurred(Object,Object,Object)

startDevice

public void startDevice()
                 throws java.lang.Exception
Start device.

Throws:
Exception.
java.lang.Exception
See Also:
createDevice(), getDevice(), setDevice(DeviceService)

tearDown

protected void tearDown()
                 throws java.lang.Exception
Tear down.

Overrides:
tearDown in class junit.framework.TestCase
Throws:
Exception.
java.lang.Exception

test_Fields

public void test_Fields()
Test_ fields.


test_InterestMask

public void test_InterestMask()
Test_ controls.


test_Interfaces

public void test_Interfaces()
Test_ interfaces.


test_MessageKey

public void test_MessageKey()
Test_ controls.

See Also:
getMessageKey(MessageService)

1.0.0

Copyright (c) 1999, 2007 IBM