public void findMapping()
{
Container basicAttributes = new Container(NAMESPACE, "basicAttributes", "Basic Attributes");
InteractionUnit root = new Builder()
.start(new Container(NAMESPACE, "root", "Root", OrderIndependance))
.mappedBy(new DMRMapping().setAddress("root"))
.add(new Select(NAMESPACE, "table", "Table"))
.start(new Container(NAMESPACE, "forms", "Forms", Choice))
.add(basicAttributes)
.mappedBy(new DMRMapping().setAddress("basicAttributes"))
.add(new Container(NAMESPACE, "extendedAttributes", "Basic Attributes"))
.end()
.end().build();
// TODO: find resource mapping type & namespace is what we actual needs I think.
DMRMapping mapping = (DMRMapping) basicAttributes.findMapping(DMR, new Predicate<DMRMapping>() {
@Override
public boolean appliesTo(DMRMapping candidate) {
return true; // candidate.getNamespace().equals(NAMESPACE);
}
});
assertNotNull(mapping);
assertEquals("basicAttributes", mapping.getAddress());
mapping = (DMRMapping) basicAttributes.findMapping(DMR, new Predicate<DMRMapping>()
{
@Override
public boolean appliesTo(final DMRMapping candidate)
{
return "root".equals(candidate.getAddress());
}
});
assertNotNull(mapping);
assertEquals("root", mapping.getAddress());
}