adamdebreceni commented on code in PR #1640: URL: https://github.com/apache/nifi-minifi-cpp/pull/1640#discussion_r1371323656
########## libminifi/test/unit/FileSystemRepositoryTests.cpp: ########## @@ -177,4 +177,46 @@ TEST_CASE("FileSystemRepository removes non-existing resource file from purge li REQUIRE(content_repo->getPurgeList().empty()); } +TEST_CASE("Append Claim") { + TestController testController; + auto dir = testController.createTempDirectory(); + auto content_repo = std::make_shared<TestFileSystemRepository>(); + + auto configuration = std::make_shared<org::apache::nifi::minifi::Configure>(); + configuration->set(minifi::Configure::nifi_dbcontent_repository_directory_default, dir.string()); + REQUIRE(content_repo->initialize(configuration)); + + + const std::string content = "well hello there"; + + auto claim = std::make_shared<minifi::ResourceClaim>(content_repo); + content_repo->write(*claim)->write(as_bytes(std::span(content))); + + // requesting append before content end fails + CHECK(content_repo->append(*claim, 0) == nullptr); + auto lock = content_repo->append(*claim, content.length()); + // trying to append to the end succeeds + CHECK(lock != nullptr); + // simultaneously trying to append to the same claim fails + CHECK(content_repo->append(*claim, content.length()) == nullptr); Review Comment: the newly modified ContentSession::append does just that, this only checks if we can simultaneously lock for the resource for append -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org