martinzink commented on code in PR #1634: URL: https://github.com/apache/nifi-minifi-cpp/pull/1634#discussion_r1320123797
########## extensions/smb/tests/SmbConnectionControllerServiceTests.cpp: ########## @@ -0,0 +1,72 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "TestBase.h" +#include "Catch.h" +#include "SmbConnectionControllerService.h" +#include "utils/TempSmbShare.h" + +namespace org::apache::nifi::minifi::extensions::smb::test { + +struct SmbConnectionControllerServiceFixture { + SmbConnectionControllerServiceFixture() = default; + + TestController test_controller_{}; + std::shared_ptr<TestPlan> plan_ = test_controller_.createPlan(); + std::shared_ptr<minifi::core::controller::ControllerServiceNode> smb_connection_node_ = plan_->addController("SmbConnectionControllerService", "smb_connection_controller_service"); + std::shared_ptr<SmbConnectionControllerService> smb_connection_ = std::dynamic_pointer_cast<SmbConnectionControllerService>(smb_connection_node_->getControllerServiceImplementation()); +}; + + +TEST_CASE_METHOD(SmbConnectionControllerServiceFixture, "SmbConnectionControllerService onEnable throws when empty") { + REQUIRE_THROWS(plan_->finalize()); +} + +TEST_CASE_METHOD(SmbConnectionControllerServiceFixture, "SmbConnectionControllerService anonymous connection") { + auto temp_directory = test_controller_.createTempDirectory(); + auto share_local_name = temp_directory.filename().wstring(); + + auto temp_smb_share = TempSmbShare::create(share_local_name, temp_directory.wstring()); + if (!temp_smb_share && temp_smb_share.error() == std::error_code(5, std::system_category())) { + SKIP("SmbConnectionControllerService tests needs administrator privileges"); + return; Review Comment: It is, I think this was written before the catch2 upgrade and I didnt rebase it properly. fixed it in https://github.com/apache/nifi-minifi-cpp/pull/1634/commits/3b513dcd2120d5e5ab361e8230060721450c6551#diff-82f9975bf7caf25eb3c29b632c7350d8f6e0ff1c6f18fd3aa2de9f61444392ddL47 -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
