description1 = new ServiceDescription.Builder(NAME, TYPE1).description(DESCRIPTION).inputFormats(PRONOM_TIFF,
PRONOM_PNG).endpoint(endpoint1).build();
/* We register another one using the TIFF extension ID as input format: */
description2 = new ServiceDescription.Builder(NAME, TYPE2).inputFormats(EXT_TIFF, PRONOM_PNG).endpoint(
endpoint2).build();
Response register = registry.register(description1);
if (!register.success()) {
System.err.println(register.getMessage());
}
/* Register another description, which is restricted, and will not be returned unless authenticated via UI: */
register = registry.register(new ServiceDescription.Builder(NAME, TYPE1).description(DESCRIPTION).inputFormats(
PRONOM_TIFF, PRONOM_PNG).endpoint(endpoint4).properties(Property.authorizedRoles("admin, provider"))
.build());
if (!register.success()) {
System.err.println(register.getMessage());
}
Assert.assertTrue("Could not register when it should work", register.success());
/* But we can't register descriptions without an endpoint: */
Response fail = registry.register(new ServiceDescription.Builder(NAME, TYPE1).build());
Assert.assertFalse("Could register when it should not work", fail.success());
registry.register(description2);
/* We finally register one service using the mime URI: */
Assert.assertTrue("Failed to register using mime type", registry.register(
new ServiceDescription.Builder("third", TYPE2).inputFormats(MIME_TIFF).endpoint(endpoint3).build())
.success());