@Test(expected = FormatIdentifierNotFoundException.class) public void testSiegfriedIdentifyNotFound() throws Exception { reset(siegfriedClientRest); when(siegfriedClientRest.analysePath(any())).thenThrow(FormatIdentifierNotFoundException.class); siegfried.analysePath(FILE_PATH); }
@Override public List<FormatIdentifierResponse> analysePath(Path path) throws FileFormatNotFoundException, FormatIdentifierBadRequestException, FormatIdentifierTechnicalException, FormatIdentifierNotFoundException { if (LOGGER.isDebugEnabled()) { LOGGER.debug("identify format for " + path); } try (SiegfriedClient siegfriedClient = siegfriedClientFactory.getClient()) { final RequestResponse<JsonNode> response = siegfriedClient.analysePath(path); return extractFormat(response.toJsonNode().get("$results").get(0), path); } }
FormatIdentifierSiegfried implements FormatIdentifier { @Override public List<FormatIdentifierResponse> analysePath(Path path) throws FileFormatNotFoundException, FormatIdentifierBadRequestException, FormatIdentifierTechnicalException, FormatIdentifierNotFoundException { if (LOGGER.isDebugEnabled()) { LOGGER.debug("identify format for " + path); } try (SiegfriedClient siegfriedClient = siegfriedClientFactory.getClient()) { final RequestResponse<JsonNode> response = siegfriedClient.analysePath(path); return extractFormat(response.toJsonNode().get("$results").get(0), path); } } }
FormatIdentifierSiegfried implements FormatIdentifier { @Override public List<FormatIdentifierResponse> analysePath(Path path) throws FileFormatNotFoundException, FormatIdentifierBadRequestException, FormatIdentifierTechnicalException, FormatIdentifierNotFoundException { if (LOGGER.isDebugEnabled()) { LOGGER.debug("identify format for " + path); } try (SiegfriedClient siegfriedClient = siegfriedClientFactory.getClient()) { final RequestResponse<JsonNode> response = siegfriedClient.analysePath(path); return extractFormat(response.toJsonNode().get("$results").get(0), path); } } FormatIdentifierSiegfried(Map<String, Object> configurationProperties); @VisibleForTesting  FormatIdentifierSiegfried(SiegfriedClientFactory siegfriedClientFactory, Path versionPath); }
FormatIdentifierSiegfried implements FormatIdentifier { @Override public List<FormatIdentifierResponse> analysePath(Path path) throws FileFormatNotFoundException, FormatIdentifierBadRequestException, FormatIdentifierTechnicalException, FormatIdentifierNotFoundException { if (LOGGER.isDebugEnabled()) { LOGGER.debug("identify format for " + path); } try (SiegfriedClient siegfriedClient = siegfriedClientFactory.getClient()) { final RequestResponse<JsonNode> response = siegfriedClient.analysePath(path); return extractFormat(response.toJsonNode().get("$results").get(0), path); } } FormatIdentifierSiegfried(Map<String, Object> configurationProperties); @VisibleForTesting  FormatIdentifierSiegfried(SiegfriedClientFactory siegfriedClientFactory, Path versionPath); @Override FormatIdentifierInfo status(); @Override List<FormatIdentifierResponse> analysePath(Path path); }
FormatIdentifierSiegfried implements FormatIdentifier { @Override public List<FormatIdentifierResponse> analysePath(Path path) throws FileFormatNotFoundException, FormatIdentifierBadRequestException, FormatIdentifierTechnicalException, FormatIdentifierNotFoundException { if (LOGGER.isDebugEnabled()) { LOGGER.debug("identify format for " + path); } try (SiegfriedClient siegfriedClient = siegfriedClientFactory.getClient()) { final RequestResponse<JsonNode> response = siegfriedClient.analysePath(path); return extractFormat(response.toJsonNode().get("$results").get(0), path); } } FormatIdentifierSiegfried(Map<String, Object> configurationProperties); @VisibleForTesting  FormatIdentifierSiegfried(SiegfriedClientFactory siegfriedClientFactory, Path versionPath); @Override FormatIdentifierInfo status(); @Override List<FormatIdentifierResponse> analysePath(Path path); static final String PRONOM_NAMESPACE; static final String UNKNOW_NAMESPACE; }