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 |
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.
static AssertionCCNHandle org.ccnx.ccn.test.AssertionCCNHandle.open | ( | ) | throws ConfigurationException, IOException [static] |
Create a new CCNHandle, opening a new connection to the CCN network.
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.
keyManager | the KeyManager to use |
IOException |
Reimplemented from org.ccnx.ccn.CCNHandle.
void org.ccnx.ccn.test.AssertionCCNHandle.cancelInterest | ( | Interest | interest, | |
CCNContentHandler | handler | |||
) |
Cancel this interest.
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.
filter | ||
callbackHandler |
Reimplemented from org.ccnx.ccn.CCNHandle.
void org.ccnx.ccn.test.AssertionCCNHandle.unregisterFilter | ( | ContentName | filter, | |
CCNInterestHandler | callbackHandler | |||
) |
Unregister a standing interest filter.
filter | ||
callbackHandler |
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.
timeout | millis to wait for callback to occur - doesn't wait if NO_TIMEOUT is used |
Error | ||
InterruptedException |