A class to help write tests without a repository or setting up a separate thread to read data. More...
Public Member Functions | |
Flosser () throws ConfigurationException, IOException | |
Constructors that called handleNamespace() now throwing NullPointerException as this doesn't exist yet. | |
Flosser (ContentName namespace) throws ConfigurationException, IOException | |
void | stopMonitoringNamespace (String namespace) throws MalformedContentNameStringException |
void | stopMonitoringNamespace (ContentName namespace) |
void | stopMonitoringNamespaces () |
void | handleNamespace (String namespace) throws MalformedContentNameStringException, IOException |
void | handleNamespace (ContentName namespace) throws IOException |
Handle a top-level namespace. | |
void | handleNamespace (ContentName namespace, ContentName parent) throws IOException |
Interest | handleContent (ContentObject result, Interest interest) |
Callback called when we get new results for our query. | |
void | stop () |
void | logNamespaces () |
Set< ContentName > | getNamespaces () |
Protected Member Functions | |
void | removeInterest (ContentName namespace) |
void | processContent (ContentObject result) |
Override in subclasses that want to do something more interesting than log. | |
Package Attributes | |
CCNHandle | _handle |
Map< ContentName, Interest > | _interests = new HashMap<ContentName, Interest>() |
Map< ContentName, Set < ContentName > > | _subInterests = new HashMap<ContentName, Set<ContentName>>() |
HashSet< ContentObject > | _processedObjects = new HashSet<ContentObject>() |
boolean | _shutdown = false |
A class to help write tests without a repository or setting up a separate thread to read data.
A Flosser tries to pull all content written under a set of specified namespaces; essentially loading that content into ccnd. Based on ccnslurp, uses excludes to not get the same data back. Not as efficient as it could be; currently stops enumerating underneath segments (assumes that there is only one content object per segment of a given version; very likely in the absence of adversarial data).
Call stopMonitoringNamespace as soon as you are done with a namespace to improve performance.
Still has a few performance snags -- mysterious delays for the interest reexpression interval; so Flosser-based tests can be slow. Shouldn't be like that, there is likely a lingering bug somewhere.
See CCNVersionedInputStream for related stream-based flossing code (basically a precursor to the full Flosser).
The "floss" term refers to "mental floss" -- think a picture of someone running dental floss in and out through their ears; here we are running content from an app, in through ccnd, to the flosser, so other parts of the (test) app can pull it back from ccnd later.
org.ccnx.ccn.test.Flosser.Flosser | ( | ) | throws ConfigurationException, IOException |
Constructors that called handleNamespace() now throwing NullPointerException as this doesn't exist yet.
ConfigurationException | ||
IOException |
Interest org.ccnx.ccn.test.Flosser.handleContent | ( | ContentObject | data, | |
Interest | interest | |||
) |
Callback called when we get new results for our query.
data | the ContentObject that matched our Interest | |
interest | Interest that was satisfied |
Implements org.ccnx.ccn.CCNInterestListener.
void org.ccnx.ccn.test.Flosser.handleNamespace | ( | ContentName | namespace | ) | throws IOException |
Handle a top-level namespace.
namespace |
IOException |
void org.ccnx.ccn.test.Flosser.processContent | ( | ContentObject | result | ) | [protected] |
Override in subclasses that want to do something more interesting than log.
result |