org.ccnx.ccn.test.AssertionCCNHandle Class Reference

This class is designed to handle actually erroring in assertions that fail within CCN handlers. More...

Inheritance diagram for org.ccnx.ccn.test.AssertionCCNHandle:

org.ccnx.ccn.CCNHandle org.ccnx.ccn.CCNBase

List of all members.

Public Member Functions

void expressInterest (Interest interest, CCNContentHandler handler) throws IOException
 Overrides of CCNHandle calls referencing the listener.
void cancelInterest (Interest interest, CCNContentHandler handler)
 Cancel this interest.
void registerFilter (ContentName filter, CCNInterestHandler handler) throws IOException
 Register a standing interest filter with callback to receive any matching interests seen.
void unregisterFilter (ContentName filter, CCNInterestHandler handler)
 Unregister a standing interest filter.
void checkError (long timeout) throws Error, InterruptedException
 Should be called after any callback has been triggered on the handle that would have received the callback.

Static Public Member Functions

static AssertionCCNHandle open () throws ConfigurationException, IOException
 Create a new CCNHandle, opening a new connection to the CCN network.
static AssertionCCNHandle open (KeyManager keyManager) throws IOException
 Create a new CCNHandle, opening a new connection to the CCN network, and specifying the KeyManager it should use.

Protected Member Functions

 AssertionCCNHandle (KeyManager keyManager) throws IOException

Protected Attributes

Error _error = null
ArrayList< RelatedInterestHandler > _contentHandlers = new ArrayList<RelatedInterestHandler>()
ArrayList< RelatedFilterListener > _interestHandlers = new ArrayList<RelatedFilterListener>()

Classes

class  AssertionContentHandler
class  AssertionInterestHandler
class  RelatedFilterListener
class  RelatedInterestHandler


Detailed Description

This class is designed to handle actually erroring in assertions that fail within CCN handlers.

Normally since the handler is called by a different thread than the test, an assertion failure within the handler would not actually cause the test to fail.

To use this test, replace CCNHandle with an AssertionCCNHandle. Then after each expressInterest or registerFilter call within your test you must call checkError to insure that the handler ran without error.


Member Function Documentation

static AssertionCCNHandle org.ccnx.ccn.test.AssertionCCNHandle.open (  )  throws ConfigurationException, IOException [static]

Create a new CCNHandle, opening a new connection to the CCN network.

Returns:
the CCNHandle
Exceptions:
ConfigurationException if there is an issue in the user or system configuration which we cannot overcome without outside intervention. See the error message for details.
IOException if we encounter an error reading system, configuration, or keystore data that we expect to be well-formed.

Reimplemented from org.ccnx.ccn.CCNHandle.

static AssertionCCNHandle org.ccnx.ccn.test.AssertionCCNHandle.open ( KeyManager  keyManager  )  throws IOException [static]

Create a new CCNHandle, opening a new connection to the CCN network, and specifying the KeyManager it should use.

Particularly useful in testing, to run as if you were a different "user", with a different collection of keys.

Parameters:
keyManager the KeyManager to use
Returns:
the CCNHandle
Exceptions:
IOException 

Reimplemented from org.ccnx.ccn.CCNHandle.

void org.ccnx.ccn.test.AssertionCCNHandle.cancelInterest ( Interest  interest,
CCNContentHandler  handler 
)

Cancel this interest.

Parameters:
interest 
handler Used to distinguish the same interest requested by more than one listener.

Reimplemented from org.ccnx.ccn.CCNHandle.

void org.ccnx.ccn.test.AssertionCCNHandle.registerFilter ( ContentName  filter,
CCNInterestHandler  callbackHandler 
) throws IOException

Register a standing interest filter with callback to receive any matching interests seen.

Parameters:
filter 
callbackHandler 

Reimplemented from org.ccnx.ccn.CCNHandle.

void org.ccnx.ccn.test.AssertionCCNHandle.unregisterFilter ( ContentName  filter,
CCNInterestHandler  callbackHandler 
)

Unregister a standing interest filter.

Parameters:
filter 
callbackHandler 
Exceptions:
IOException if handle is closed

Reimplemented from org.ccnx.ccn.CCNHandle.

void org.ccnx.ccn.test.AssertionCCNHandle.checkError ( long  timeout  )  throws Error, InterruptedException

Should be called after any callback has been triggered on the handle that would have received the callback.

Parameters:
timeout millis to wait for callback to occur - doesn't wait if NO_TIMEOUT is used
Exceptions:
Error 
InterruptedException 


The documentation for this class was generated from the following file:

Generated on Thu Feb 16 00:45:07 2012 for Content-Centric Networking in Java by  doxygen 1.5.6