The Meta-Environment API

nl.cwi.sen1.tunit
Class TestToolBridge

java.lang.Object
  extended by toolbus.adapter.ToolBridge
      extended by nl.cwi.sen1.tunit.TestToolBridge
All Implemented Interfaces:
java.lang.Runnable, toolbus.communication.IDataHandler, toolbus.IOperations

public class TestToolBridge
extends toolbus.adapter.ToolBridge


Nested Class Summary
private static class TestToolBridge.WaitLock
           
 
Field Summary
private  TestToolBridge.WaitLock actionLock
           
private  java.util.List<aterm.ATerm> actionQueue
           
private  java.lang.Object completionLock
           
static long DEFAULTTIMEOUT
           
private  java.util.Map<java.lang.String,TestToolBridge.WaitLock> expectedAckEvents
           
private  java.util.Set<aterm.ATerm> expectedDos
           
private  java.util.Map<aterm.ATerm,aterm.ATerm> expectedEvals
           
private  boolean expecting
           
private  TestToolBridge.WaitLock expectLock
           
private  aterm.pure.PureFactory termFactory
           
private  TUnitTestCase testCase
           
private  toolbus.adapter.AbstractTool tool
           
private  boolean verbose
           
 
Fields inherited from interface toolbus.IOperations
ACKDO, ACKEVENT, CONNECT, DEBUGPERFORMANCESTATS, DISCONNECT, DO, END, EVAL, EVENT, PERFORMANCESTATS, REQUEST, RESPONSE, TERMINATE, UNDEFINED, VALUE
 
Constructor Summary
TestToolBridge(TUnitTestCase testCase, aterm.pure.PureFactory termFactory, toolbus.adapter.AbstractTool tool, java.lang.String toolName, int toolID, java.lang.ClassLoader classLoader, toolbus.ToolBus toolbus, boolean verbose)
           
TestToolBridge(TUnitTestCase testCase, aterm.pure.PureFactory termFactory, toolbus.adapter.AbstractTool tool, java.lang.String toolName, int toolID, java.net.InetAddress host, int port, boolean verbose)
           
 
Method Summary
 boolean checkSignature(aterm.ATerm signature)
           
 void doDo(aterm.ATerm aTerm)
           
 aterm.ATerm doEval(aterm.ATerm aTerm)
           
 aterm.ATerm doGetPerformanceStats()
           
 void doReceiveAckEvent(aterm.ATerm aTerm)
           
 void doTerminate(aterm.ATerm aTerm)
           
 void expectAction(long timeout)
           
private  aterm.ATerm getPerformanceStats()
          Gathers performance statistics about this tool, like memory usage and the user-/system-time spend per thread.
 void receive(byte operation, aterm.ATerm aTerm)
           
 void registerForDo(aterm.ATerm action)
           
 void registerForEval(aterm.ATerm action, aterm.ATerm expectedResult)
           
 void sendEvent(aterm.ATerm event, long timeout)
           
 aterm.ATerm sendRequest(aterm.ATerm request, aterm.ATerm expectedResponse, long timeout)
           
 void waitForCompletion(long timeout)
           
 
Methods inherited from class toolbus.adapter.ToolBridge
exceptionOccured, getFactory, getHost, getPort, getToolID, getToolName, getType, postEvent, postRequest, run, send, setIOHandler, setToolID, shutDown, terminate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULTTIMEOUT

public static final long DEFAULTTIMEOUT
See Also:
Constant Field Values

completionLock

private final java.lang.Object completionLock

expectLock

private final TestToolBridge.WaitLock expectLock

actionLock

private final TestToolBridge.WaitLock actionLock

testCase

private final TUnitTestCase testCase

termFactory

private final aterm.pure.PureFactory termFactory

tool

private final toolbus.adapter.AbstractTool tool

expectedAckEvents

private final java.util.Map<java.lang.String,TestToolBridge.WaitLock> expectedAckEvents

expectedEvals

private final java.util.Map<aterm.ATerm,aterm.ATerm> expectedEvals

expectedDos

private final java.util.Set<aterm.ATerm> expectedDos

actionQueue

private final java.util.List<aterm.ATerm> actionQueue

expecting

private volatile boolean expecting

verbose

private final boolean verbose
Constructor Detail

TestToolBridge

public TestToolBridge(TUnitTestCase testCase,
                      aterm.pure.PureFactory termFactory,
                      toolbus.adapter.AbstractTool tool,
                      java.lang.String toolName,
                      int toolID,
                      java.net.InetAddress host,
                      int port,
                      boolean verbose)

TestToolBridge

public TestToolBridge(TUnitTestCase testCase,
                      aterm.pure.PureFactory termFactory,
                      toolbus.adapter.AbstractTool tool,
                      java.lang.String toolName,
                      int toolID,
                      java.lang.ClassLoader classLoader,
                      toolbus.ToolBus toolbus,
                      boolean verbose)
Method Detail

receive

public void receive(byte operation,
                    aterm.ATerm aTerm)
Specified by:
receive in interface toolbus.communication.IDataHandler
Overrides:
receive in class toolbus.adapter.ToolBridge

checkSignature

public boolean checkSignature(aterm.ATerm signature)
Specified by:
checkSignature in class toolbus.adapter.ToolBridge

doDo

public void doDo(aterm.ATerm aTerm)
Specified by:
doDo in class toolbus.adapter.ToolBridge

doEval

public aterm.ATerm doEval(aterm.ATerm aTerm)
Specified by:
doEval in class toolbus.adapter.ToolBridge

doGetPerformanceStats

public aterm.ATerm doGetPerformanceStats()
Specified by:
doGetPerformanceStats in class toolbus.adapter.ToolBridge

doReceiveAckEvent

public void doReceiveAckEvent(aterm.ATerm aTerm)
Specified by:
doReceiveAckEvent in class toolbus.adapter.ToolBridge

doTerminate

public void doTerminate(aterm.ATerm aTerm)
Specified by:
doTerminate in class toolbus.adapter.ToolBridge

sendEvent

public void sendEvent(aterm.ATerm event,
                      long timeout)

sendRequest

public aterm.ATerm sendRequest(aterm.ATerm request,
                               aterm.ATerm expectedResponse,
                               long timeout)

registerForDo

public void registerForDo(aterm.ATerm action)

registerForEval

public void registerForEval(aterm.ATerm action,
                            aterm.ATerm expectedResult)

expectAction

public void expectAction(long timeout)

waitForCompletion

public void waitForCompletion(long timeout)

getPerformanceStats

private aterm.ATerm getPerformanceStats()
Gathers performance statistics about this tool, like memory usage and the user-/system-time spend per thread.

Returns:
Performance statictics.

The Meta-Environment API