@RunWithCustomExecutor @Test public void givenBlankID_whenSelectUnitById_ThenRaiseAnException() throws Exception { VitamThreadUtils.getVitamSession().setRequestId(DUMMY_REQUEST_ID); final JsonNode queryJson = JsonHandler.getFromString(queryDsl); assertThatThrownBy(() -> client.selectUnitbyId(queryJson, "")) .isInstanceOf(IllegalArgumentException.class); }
@Override public RequestResponse<JsonNode> selectUnitbyId(JsonNode selectQuery, String idUnit) throws InvalidParseOperationException, AccessInternalClientServerException, AccessInternalClientNotFoundException, AccessUnauthorizedException { ParametersChecker.checkParameter(BLANK_UNIT_ID, idUnit); try (Response response = make(get().withBefore(CHECK_REQUEST_ID).withPath(UNITS + idUnit).withBody(selectQuery, BLANK_DSL).withJson())) { check(response); return RequestResponse.parseFromResponse(response); } catch (VitamClientInternalException | NoWritingPermissionException | PreconditionFailedClientException | ExpectationFailedClientException | ForbiddenClientException e) { throw new AccessInternalClientServerException(e); } catch (BadRequestException e) { throw new InvalidParseOperationException(e); } }
AccessInternalClientRest extends DefaultClient implements AccessInternalClient { @Override public RequestResponse<JsonNode> selectUnitbyId(JsonNode selectQuery, String idUnit) throws InvalidParseOperationException, AccessInternalClientServerException, AccessInternalClientNotFoundException, AccessUnauthorizedException { ParametersChecker.checkParameter(BLANK_UNIT_ID, idUnit); try (Response response = make(get().withBefore(CHECK_REQUEST_ID).withPath(UNITS + idUnit).withBody(selectQuery, BLANK_DSL).withJson())) { check(response); return RequestResponse.parseFromResponse(response); } catch (VitamClientInternalException | NoWritingPermissionException | PreconditionFailedClientException | ExpectationFailedClientException | ForbiddenClientException e) { throw new AccessInternalClientServerException(e); } catch (BadRequestException e) { throw new InvalidParseOperationException(e); } } }
AccessInternalClientRest extends DefaultClient implements AccessInternalClient { @Override public RequestResponse<JsonNode> selectUnitbyId(JsonNode selectQuery, String idUnit) throws InvalidParseOperationException, AccessInternalClientServerException, AccessInternalClientNotFoundException, AccessUnauthorizedException { ParametersChecker.checkParameter(BLANK_UNIT_ID, idUnit); try (Response response = make(get().withBefore(CHECK_REQUEST_ID).withPath(UNITS + idUnit).withBody(selectQuery, BLANK_DSL).withJson())) { check(response); return RequestResponse.parseFromResponse(response); } catch (VitamClientInternalException | NoWritingPermissionException | PreconditionFailedClientException | ExpectationFailedClientException | ForbiddenClientException e) { throw new AccessInternalClientServerException(e); } catch (BadRequestException e) { throw new InvalidParseOperationException(e); } } AccessInternalClientRest(AccessInternalClientFactory factory); }
AccessInternalClientRest extends DefaultClient implements AccessInternalClient { @Override public RequestResponse<JsonNode> selectUnitbyId(JsonNode selectQuery, String idUnit) throws InvalidParseOperationException, AccessInternalClientServerException, AccessInternalClientNotFoundException, AccessUnauthorizedException { ParametersChecker.checkParameter(BLANK_UNIT_ID, idUnit); try (Response response = make(get().withBefore(CHECK_REQUEST_ID).withPath(UNITS + idUnit).withBody(selectQuery, BLANK_DSL).withJson())) { check(response); return RequestResponse.parseFromResponse(response); } catch (VitamClientInternalException | NoWritingPermissionException | PreconditionFailedClientException | ExpectationFailedClientException | ForbiddenClientException e) { throw new AccessInternalClientServerException(e); } catch (BadRequestException e) { throw new InvalidParseOperationException(e); } } AccessInternalClientRest(AccessInternalClientFactory factory); @Override RequestResponse<JsonNode> selectUnits(JsonNode selectQuery); @Override RequestResponse<JsonNode> selectUnitbyId(JsonNode selectQuery, String idUnit); @Override RequestResponse<JsonNode> updateUnitbyId(JsonNode updateQuery, String unitId); @Override RequestResponse<JsonNode> updateUnits(JsonNode updateQuery); @Override RequestResponse<JsonNode> updateUnitsRules(MassUpdateUnitRuleRequest massUpdateUnitRuleRequest); @Override RequestResponse<JsonNode> selectObjectbyId(JsonNode selectObjectQuery, String objectId); @Override Response getObject(String objectGroupId, String usage, int version, String unitId); @Override RequestResponse<JsonNode> selectOperation(JsonNode select); @Override RequestResponse<JsonNode> selectOperationSliced(JsonNode select); @Override RequestResponse<JsonNode> selectOperationById(String processId, JsonNode select); @Override RequestResponse<JsonNode> selectUnitLifeCycleById(String idUnit, JsonNode queryDsl); @Override RequestResponse<JsonNode> selectObjectGroupLifeCycleById(String idObject, JsonNode queryDsl); @Override RequestResponse<JsonNode> checkTraceabilityOperation(JsonNode query); @Override Response downloadTraceabilityFile(String operationId); @Override RequestResponse<JsonNode> exportDIP(JsonNode dslRequest); @Override RequestResponse<JsonNode> exportByUsageFilter(ExportRequest exportRequest); @Override Response findExportByID(String id); @Override Response findTransferSIPByID(String id); @Override RequestResponse<JsonNode> reclassification(JsonNode reclassificationRequest); @Override RequestResponse<JsonNode> selectObjects(JsonNode selectQuery); @Override RequestResponse<JsonNode> selectUnitsWithInheritedRules(JsonNode selectQuery); @Override Response downloadAccessLogFile(JsonNode params); @Override RequestResponse<JsonNode> startEliminationAnalysis(EliminationRequestBody eliminationRequestBody); @Override RequestResponse<JsonNode> startEliminationAction(EliminationRequestBody eliminationRequestBody); @Override RequestResponse<JsonNode> startPreservation(PreservationRequest preservationRequest); @Override RequestResponse<JsonNode> startComputeInheritedRules(JsonNode dslQuery); @Override RequestResponse<JsonNode> deleteComputeInheritedRules(JsonNode dslQuery); @Override RequestResponse<JsonNode> startTransferReplyWorkflow(InputStream transferReply); }
AccessInternalClientRest extends DefaultClient implements AccessInternalClient { @Override public RequestResponse<JsonNode> selectUnitbyId(JsonNode selectQuery, String idUnit) throws InvalidParseOperationException, AccessInternalClientServerException, AccessInternalClientNotFoundException, AccessUnauthorizedException { ParametersChecker.checkParameter(BLANK_UNIT_ID, idUnit); try (Response response = make(get().withBefore(CHECK_REQUEST_ID).withPath(UNITS + idUnit).withBody(selectQuery, BLANK_DSL).withJson())) { check(response); return RequestResponse.parseFromResponse(response); } catch (VitamClientInternalException | NoWritingPermissionException | PreconditionFailedClientException | ExpectationFailedClientException | ForbiddenClientException e) { throw new AccessInternalClientServerException(e); } catch (BadRequestException e) { throw new InvalidParseOperationException(e); } } AccessInternalClientRest(AccessInternalClientFactory factory); @Override RequestResponse<JsonNode> selectUnits(JsonNode selectQuery); @Override RequestResponse<JsonNode> selectUnitbyId(JsonNode selectQuery, String idUnit); @Override RequestResponse<JsonNode> updateUnitbyId(JsonNode updateQuery, String unitId); @Override RequestResponse<JsonNode> updateUnits(JsonNode updateQuery); @Override RequestResponse<JsonNode> updateUnitsRules(MassUpdateUnitRuleRequest massUpdateUnitRuleRequest); @Override RequestResponse<JsonNode> selectObjectbyId(JsonNode selectObjectQuery, String objectId); @Override Response getObject(String objectGroupId, String usage, int version, String unitId); @Override RequestResponse<JsonNode> selectOperation(JsonNode select); @Override RequestResponse<JsonNode> selectOperationSliced(JsonNode select); @Override RequestResponse<JsonNode> selectOperationById(String processId, JsonNode select); @Override RequestResponse<JsonNode> selectUnitLifeCycleById(String idUnit, JsonNode queryDsl); @Override RequestResponse<JsonNode> selectObjectGroupLifeCycleById(String idObject, JsonNode queryDsl); @Override RequestResponse<JsonNode> checkTraceabilityOperation(JsonNode query); @Override Response downloadTraceabilityFile(String operationId); @Override RequestResponse<JsonNode> exportDIP(JsonNode dslRequest); @Override RequestResponse<JsonNode> exportByUsageFilter(ExportRequest exportRequest); @Override Response findExportByID(String id); @Override Response findTransferSIPByID(String id); @Override RequestResponse<JsonNode> reclassification(JsonNode reclassificationRequest); @Override RequestResponse<JsonNode> selectObjects(JsonNode selectQuery); @Override RequestResponse<JsonNode> selectUnitsWithInheritedRules(JsonNode selectQuery); @Override Response downloadAccessLogFile(JsonNode params); @Override RequestResponse<JsonNode> startEliminationAnalysis(EliminationRequestBody eliminationRequestBody); @Override RequestResponse<JsonNode> startEliminationAction(EliminationRequestBody eliminationRequestBody); @Override RequestResponse<JsonNode> startPreservation(PreservationRequest preservationRequest); @Override RequestResponse<JsonNode> startComputeInheritedRules(JsonNode dslQuery); @Override RequestResponse<JsonNode> deleteComputeInheritedRules(JsonNode dslQuery); @Override RequestResponse<JsonNode> startTransferReplyWorkflow(InputStream transferReply);  }