@Test @RunWithCustomExecutor public void testInsertRequestWithValidationFailure() throws Exception { VitamThreadUtils.getVitamSession().setTenantId(TENANT_ID); DbRequestSingle dbRequestSingle = new DbRequestSingle(vitamCollection, Collections::emptyList); assertEquals(0, vitamCollection.getCollection().countDocuments()); final ArrayNode data = JsonHandler.createArrayNode(); data.add(getNewDocument(GUIDFactory.newGUID().toString(), "title one", 1)); final Insert insert = new Insert(); insert.setData(data); DocumentValidator documentValidator = mock(DocumentValidator.class); doThrow(new SchemaValidationException("Prb...")).when(documentValidator).validateDocument(any()); assertThatThrownBy(() -> dbRequestSingle.execute(insert, 0, documentValidator)) .isInstanceOf(SchemaValidationException.class); assertEquals(0, vitamCollection.getCollection().countDocuments()); }
public DbRequestResult execute(Select request) throws InvalidParseOperationException, DatabaseException, BadRequestException, InvalidCreateOperationException, VitamDBException, SchemaValidationException { DynamicParserTokens parserTokens = new DynamicParserTokens(vitamCollection.getVitamDescriptionResolver(), ontologyLoader.loadOntologies()); return findDocuments(request.getFinalSelect(), parserTokens); }
DbRequestSingle { public DbRequestResult execute(Select request) throws InvalidParseOperationException, DatabaseException, BadRequestException, InvalidCreateOperationException, VitamDBException, SchemaValidationException { DynamicParserTokens parserTokens = new DynamicParserTokens(vitamCollection.getVitamDescriptionResolver(), ontologyLoader.loadOntologies()); return findDocuments(request.getFinalSelect(), parserTokens); } }
DbRequestSingle { public DbRequestResult execute(Select request) throws InvalidParseOperationException, DatabaseException, BadRequestException, InvalidCreateOperationException, VitamDBException, SchemaValidationException { DynamicParserTokens parserTokens = new DynamicParserTokens(vitamCollection.getVitamDescriptionResolver(), ontologyLoader.loadOntologies()); return findDocuments(request.getFinalSelect(), parserTokens); } DbRequestSingle(VitamCollection collection, OntologyLoader ontologyLoader); }
DbRequestSingle { public DbRequestResult execute(Select request) throws InvalidParseOperationException, DatabaseException, BadRequestException, InvalidCreateOperationException, VitamDBException, SchemaValidationException { DynamicParserTokens parserTokens = new DynamicParserTokens(vitamCollection.getVitamDescriptionResolver(), ontologyLoader.loadOntologies()); return findDocuments(request.getFinalSelect(), parserTokens); } DbRequestSingle(VitamCollection collection, OntologyLoader ontologyLoader); DbRequestResult execute(Select request); DbRequestResult execute(Insert request, Integer version,
        DocumentValidator documentValidator); DbRequestResult execute(Delete request); DbRequestResult execute(Update request, DocumentValidator documentValidator); DbRequestResult execute(Update request, Integer version, DocumentValidator documentValidator); void replaceDocument(JsonNode document, String identifierValue, String identifierKey,
        VitamCollection vitamCollection); }
DbRequestSingle { public DbRequestResult execute(Select request) throws InvalidParseOperationException, DatabaseException, BadRequestException, InvalidCreateOperationException, VitamDBException, SchemaValidationException { DynamicParserTokens parserTokens = new DynamicParserTokens(vitamCollection.getVitamDescriptionResolver(), ontologyLoader.loadOntologies()); return findDocuments(request.getFinalSelect(), parserTokens); } DbRequestSingle(VitamCollection collection, OntologyLoader ontologyLoader); DbRequestResult execute(Select request); DbRequestResult execute(Insert request, Integer version,
        DocumentValidator documentValidator); DbRequestResult execute(Delete request); DbRequestResult execute(Update request, DocumentValidator documentValidator); DbRequestResult execute(Update request, Integer version, DocumentValidator documentValidator); void replaceDocument(JsonNode document, String identifierValue, String identifierKey,
        VitamCollection vitamCollection);  }