};
comp.getInternalRouter().attach("/local", localOnly);
String localBase = "riap://component/local";
Client dispatcher = comp.getContext().getClientDispatcher();
String msg = "this%20message";
String echoURI = localBase + "/echo/" + msg;
Representation echoRep = dispatcher.handle(
new Request(Method.GET, echoURI)).getEntity();
assertEquals("expected echo of uri-remainder", msg, echoRep.getText());
final String objURI = localBase + "/object";
final Representation objRep = dispatcher.handle(
new Request(Method.GET, objURI)).getEntity();
assertSame("expected specific test-object", JUST_SOME_OBJ,
((ObjectRepresentation<?>) objRep).getObject());
final String nullURI = localBase + "/null";
final Representation nullRep = dispatcher.handle(
new Request(Method.GET, nullURI)).getEntity();
assertNull("expected null",
((ObjectRepresentation<?>) nullRep).getObject());
final String anyURI = localBase + "/whatever";
final Representation anyRep = dispatcher.handle(
new Request(Method.GET, anyURI)).getEntity();
assertEquals("expected echo of uri-remainder", DEFAULT_MSG,
anyRep.getText());
final String aggURI = localBase + "/self-aggregated";
final Representation aggRep = dispatcher.handle(
new Request(Method.GET, aggURI)).getEntity();
final String expectedResult = buildAggregate(ECHO_TEST_MSG,
ECHO_TEST_MSG);
assertEquals("expected specific aggregated message", expectedResult,
aggRep.getText());
dispatcher.stop();
}