@Test(expected = InvalidParseOperationException.class) public void givenEmptyDSLWhenSlectObjectsThenThrowsInvalidParseOperationException() throws Exception { final JsonNode jsonQuery = JsonHandler.getFromString(QUERY); doThrow(new InvalidParseOperationException("")).when(metaDataClient) .selectObjectGroups(jsonQuery); accessModuleImpl.selectObjects(fromStringToJson(QUERY)); }
@Override public JsonNode selectObjects(JsonNode jsonQuery) throws IllegalArgumentException, InvalidParseOperationException, AccessInternalExecutionException { JsonNode jsonNode = null; LOGGER.debug("DEBUG: start selectObjects {}", jsonQuery); try (MetaDataClient metaDataClient = metaDataClientFactory.getClient()) { SanityChecker.checkJsonAll(jsonQuery); LOGGER.debug("{}", jsonNode); final RequestParserMultiple parser = RequestParserHelper.getParser(jsonQuery.deepCopy()); parser.getRequest().reset(); if (!(parser instanceof SelectParserMultiple)) { throw new InvalidParseOperationException(NOT_A_SELECT_OPERATION); } jsonNode = metaDataClient.selectObjectGroups(jsonQuery); LOGGER.debug("DEBUG {}", jsonNode); } catch (final InvalidParseOperationException e) { LOGGER.error(PARSING_ERROR, e); throw e; } catch (final IllegalArgumentException e) { LOGGER.error(ILLEGAL_ARGUMENT, e); throw e; } catch (final Exception e) { LOGGER.error("exeption thrown", e); throw new AccessInternalExecutionException(e); } removeFileName(jsonNode); return jsonNode; }
AccessInternalModuleImpl implements AccessInternalModule { @Override public JsonNode selectObjects(JsonNode jsonQuery) throws IllegalArgumentException, InvalidParseOperationException, AccessInternalExecutionException { JsonNode jsonNode = null; LOGGER.debug("DEBUG: start selectObjects {}", jsonQuery); try (MetaDataClient metaDataClient = metaDataClientFactory.getClient()) { SanityChecker.checkJsonAll(jsonQuery); LOGGER.debug("{}", jsonNode); final RequestParserMultiple parser = RequestParserHelper.getParser(jsonQuery.deepCopy()); parser.getRequest().reset(); if (!(parser instanceof SelectParserMultiple)) { throw new InvalidParseOperationException(NOT_A_SELECT_OPERATION); } jsonNode = metaDataClient.selectObjectGroups(jsonQuery); LOGGER.debug("DEBUG {}", jsonNode); } catch (final InvalidParseOperationException e) { LOGGER.error(PARSING_ERROR, e); throw e; } catch (final IllegalArgumentException e) { LOGGER.error(ILLEGAL_ARGUMENT, e); throw e; } catch (final Exception e) { LOGGER.error("exeption thrown", e); throw new AccessInternalExecutionException(e); } removeFileName(jsonNode); return jsonNode; } }
AccessInternalModuleImpl implements AccessInternalModule { @Override public JsonNode selectObjects(JsonNode jsonQuery) throws IllegalArgumentException, InvalidParseOperationException, AccessInternalExecutionException { JsonNode jsonNode = null; LOGGER.debug("DEBUG: start selectObjects {}", jsonQuery); try (MetaDataClient metaDataClient = metaDataClientFactory.getClient()) { SanityChecker.checkJsonAll(jsonQuery); LOGGER.debug("{}", jsonNode); final RequestParserMultiple parser = RequestParserHelper.getParser(jsonQuery.deepCopy()); parser.getRequest().reset(); if (!(parser instanceof SelectParserMultiple)) { throw new InvalidParseOperationException(NOT_A_SELECT_OPERATION); } jsonNode = metaDataClient.selectObjectGroups(jsonQuery); LOGGER.debug("DEBUG {}", jsonNode); } catch (final InvalidParseOperationException e) { LOGGER.error(PARSING_ERROR, e); throw e; } catch (final IllegalArgumentException e) { LOGGER.error(ILLEGAL_ARGUMENT, e); throw e; } catch (final Exception e) { LOGGER.error("exeption thrown", e); throw new AccessInternalExecutionException(e); } removeFileName(jsonNode); return jsonNode; } AccessInternalModuleImpl(); @VisibleForTesting  AccessInternalModuleImpl(LogbookLifeCyclesClientFactory logbookLifeCyclesClientFactory,
        LogbookOperationsClientFactory logbookOperationsClientFactory, StorageClientFactory storageClientFactory,
        WorkspaceClientFactory workspaceClientFactory, AdminManagementClientFactory adminManagementClientFactory,
        MetaDataClientFactory metaDataClientFactory); }
AccessInternalModuleImpl implements AccessInternalModule { @Override public JsonNode selectObjects(JsonNode jsonQuery) throws IllegalArgumentException, InvalidParseOperationException, AccessInternalExecutionException { JsonNode jsonNode = null; LOGGER.debug("DEBUG: start selectObjects {}", jsonQuery); try (MetaDataClient metaDataClient = metaDataClientFactory.getClient()) { SanityChecker.checkJsonAll(jsonQuery); LOGGER.debug("{}", jsonNode); final RequestParserMultiple parser = RequestParserHelper.getParser(jsonQuery.deepCopy()); parser.getRequest().reset(); if (!(parser instanceof SelectParserMultiple)) { throw new InvalidParseOperationException(NOT_A_SELECT_OPERATION); } jsonNode = metaDataClient.selectObjectGroups(jsonQuery); LOGGER.debug("DEBUG {}", jsonNode); } catch (final InvalidParseOperationException e) { LOGGER.error(PARSING_ERROR, e); throw e; } catch (final IllegalArgumentException e) { LOGGER.error(ILLEGAL_ARGUMENT, e); throw e; } catch (final Exception e) { LOGGER.error("exeption thrown", e); throw new AccessInternalExecutionException(e); } removeFileName(jsonNode); return jsonNode; } AccessInternalModuleImpl(); @VisibleForTesting  AccessInternalModuleImpl(LogbookLifeCyclesClientFactory logbookLifeCyclesClientFactory,
        LogbookOperationsClientFactory logbookOperationsClientFactory, StorageClientFactory storageClientFactory,
        WorkspaceClientFactory workspaceClientFactory, AdminManagementClientFactory adminManagementClientFactory,
        MetaDataClientFactory metaDataClientFactory); @Override JsonNode selectUnit(JsonNode jsonQuery); @Override JsonNode selectUnitbyId(JsonNode jsonQuery, String idUnit); @Override JsonNode selectObjectGroupById(JsonNode jsonQuery, String idObjectGroup); @Override Response getOneObjectFromObjectGroup(String idObjectGroup, String qualifier, int version, String idUnit); @Override Response getAccessLog(JsonNode params); void checkClassificationLevel(JsonNode query); @Override JsonNode updateUnitById(JsonNode queryJson, String idUnit, String requestId); @Override Response findDIPByOperationId(String id); @Override Response findTransferSIPByOperationId(String id); @Override JsonNode selectObjects(JsonNode jsonQuery); @Override JsonNode selectUnitsWithInheritedRules(JsonNode jsonQuery); }
AccessInternalModuleImpl implements AccessInternalModule { @Override public JsonNode selectObjects(JsonNode jsonQuery) throws IllegalArgumentException, InvalidParseOperationException, AccessInternalExecutionException { JsonNode jsonNode = null; LOGGER.debug("DEBUG: start selectObjects {}", jsonQuery); try (MetaDataClient metaDataClient = metaDataClientFactory.getClient()) { SanityChecker.checkJsonAll(jsonQuery); LOGGER.debug("{}", jsonNode); final RequestParserMultiple parser = RequestParserHelper.getParser(jsonQuery.deepCopy()); parser.getRequest().reset(); if (!(parser instanceof SelectParserMultiple)) { throw new InvalidParseOperationException(NOT_A_SELECT_OPERATION); } jsonNode = metaDataClient.selectObjectGroups(jsonQuery); LOGGER.debug("DEBUG {}", jsonNode); } catch (final InvalidParseOperationException e) { LOGGER.error(PARSING_ERROR, e); throw e; } catch (final IllegalArgumentException e) { LOGGER.error(ILLEGAL_ARGUMENT, e); throw e; } catch (final Exception e) { LOGGER.error("exeption thrown", e); throw new AccessInternalExecutionException(e); } removeFileName(jsonNode); return jsonNode; } AccessInternalModuleImpl(); @VisibleForTesting  AccessInternalModuleImpl(LogbookLifeCyclesClientFactory logbookLifeCyclesClientFactory,
        LogbookOperationsClientFactory logbookOperationsClientFactory, StorageClientFactory storageClientFactory,
        WorkspaceClientFactory workspaceClientFactory, AdminManagementClientFactory adminManagementClientFactory,
        MetaDataClientFactory metaDataClientFactory); @Override JsonNode selectUnit(JsonNode jsonQuery); @Override JsonNode selectUnitbyId(JsonNode jsonQuery, String idUnit); @Override JsonNode selectObjectGroupById(JsonNode jsonQuery, String idObjectGroup); @Override Response getOneObjectFromObjectGroup(String idObjectGroup, String qualifier, int version, String idUnit); @Override Response getAccessLog(JsonNode params); void checkClassificationLevel(JsonNode query); @Override JsonNode updateUnitById(JsonNode queryJson, String idUnit, String requestId); @Override Response findDIPByOperationId(String id); @Override Response findTransferSIPByOperationId(String id); @Override JsonNode selectObjects(JsonNode jsonQuery); @Override JsonNode selectUnitsWithInheritedRules(JsonNode jsonQuery);  }