use of aQute.bnd.deployer.repository.api.CheckResult in project bnd by bndtools.
the class TestR5Recognition method testAcceptOnCapabilityChildElementNames.
public static void testAcceptOnCapabilityChildElementNames() throws Exception {
String testdata;
ByteArrayInputStream stream;
CheckResult result;
// Must be R5
testdata = "<repository><resource><capability><attribute/>...";
stream = new ByteArrayInputStream(testdata.getBytes());
result = new R5RepoContentProvider().checkStream("xxx", stream);
assertEquals(accept, result.getDecision());
// Must be R5
testdata = "<repository><resource><capability><directive/>...";
stream = new ByteArrayInputStream(testdata.getBytes());
result = new R5RepoContentProvider().checkStream("xxx", stream);
assertEquals(accept, result.getDecision());
// Arbitrary elements under repo, resource and capability are allowed
testdata = "<repository><XXX/><resource><YYY/><capability><ZZZ/><attribute/>...";
stream = new ByteArrayInputStream(testdata.getBytes());
result = new R5RepoContentProvider().checkStream("xxx", stream);
assertEquals(accept, result.getDecision());
}
use of aQute.bnd.deployer.repository.api.CheckResult in project bnd by bndtools.
the class TestR5Recognition method testUnparseable.
public static void testUnparseable() throws Exception {
String testdata = "<?xml version='1.0' encoding='utf-8'?>" + "<repository name='index1'>";
ByteArrayInputStream stream = new ByteArrayInputStream(testdata.getBytes());
CheckResult result = new R5RepoContentProvider().checkStream("xxx", stream);
assertEquals(reject, result.getDecision());
assertTrue(result.getException() != null && result.getException() instanceof XMLStreamException);
}
Aggregations