szaszm commented on code in PR #2176:
URL: https://github.com/apache/nifi-minifi-cpp/pull/2176#discussion_r3453490720


##########
extensions/stable-api-testing/AnimalControllerServices.h:
##########
@@ -0,0 +1,67 @@
+/**
+ * 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.
+ */
+
+#pragma once
+
+#include "AnimalControllerServiceApis.h"
+#include "api/core/ControllerServiceImpl.h"
+#include "api/utils/Export.h"
+#include "core/PropertyDefinitionBuilder.h"
+#include "minifi-cpp/core/ProvidedControllerServiceInterface.h"
+
+namespace org::apache::nifi::minifi::api_testing {
+class DogController : public api::core::ControllerServiceImpl, public 
CanFlyControllerApi, public NumberOfLegsControllerApi {
+ public:
+  EXTENSIONAPI static constexpr const char* Description = "Test DogController";
+  EXTENSIONAPI static constexpr auto HasJetpack = 
core::PropertyDefinitionBuilder<>::createProperty("Has Jetpack")
+                                                      
.withDescription("Whether or not the dog has a jetpack")
+                                                      
.withDefaultValue("false")
+                                                      
.withValidator(core::StandardPropertyValidators::BOOLEAN_VALIDATOR)
+                                                      .build();

Review Comment:
   ```suggestion
     EXTENSIONAPI static constexpr auto HasJetpack = 
core::PropertyDefinitionBuilder<>::createProperty("Has Jetpack")
         .withDescription("Whether or not the dog has a jetpack")
         .withDefaultValue("false")
         .withValidator(core::StandardPropertyValidators::BOOLEAN_VALIDATOR)
         .build();
   ```



##########
extensions/stable-api-testing/AnimalControllerServices.h:
##########
@@ -0,0 +1,67 @@
+/**
+ * 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.
+ */
+
+#pragma once
+
+#include "AnimalControllerServiceApis.h"
+#include "api/core/ControllerServiceImpl.h"
+#include "api/utils/Export.h"
+#include "core/PropertyDefinitionBuilder.h"
+#include "minifi-cpp/core/ProvidedControllerServiceInterface.h"
+
+namespace org::apache::nifi::minifi::api_testing {
+class DogController : public api::core::ControllerServiceImpl, public 
CanFlyControllerApi, public NumberOfLegsControllerApi {

Review Comment:
   ```suggestion
   /// DogController and DuckController are testing that one ControllerService 
type can implement multiple interfaces
   class DogController : public api::core::ControllerServiceImpl, public 
CanFlyControllerApi, public NumberOfLegsControllerApi {
   ```



##########
libminifi/src/core/state/nodes/AgentInformation.cpp:
##########
@@ -17,46 +17,93 @@
  */
 #include "core/state/nodes/AgentInformation.h"
 
-#include "minifi-cpp/agent/agent_version.h"
-#include "core/Resource.h"
 #include "core/ClassLoader.h"
-#include "utils/OsUtils.h"
+#include "core/Resource.h"
 #include "core/state/nodes/SchedulingNodes.h"
 #include "core/state/nodes/SupportedOperations.h"
+#include "minifi-c/minifi-c.h"
+#include "minifi-cpp/agent/agent_version.h"
+#include "minifi-cpp/controllers/AttributeProviderService.h"
+#include "minifi-cpp/controllers/ProxyConfigurationServiceInterface.h"
+#include "minifi-cpp/controllers/RecordSetReader.h"
+#include "minifi-cpp/controllers/RecordSetWriter.h"
+#include "minifi-cpp/controllers/SSLContextServiceInterface.h"
+#include "utils/OsUtils.h"
+#include "range/v3/algorithm/contains.hpp"
 
 namespace org::apache::nifi::minifi::state::response {
 
 utils::ProcessCpuUsageTracker AgentStatus::cpu_load_tracker_;
 std::mutex AgentStatus::cpu_load_tracker_mutex_;
 
 namespace {
+
+std::string allowedTypeGroupName(const std::string_view allowed_type) {
+  constexpr std::string_view APACHE_GROUP_STR = "org.apache.nifi.minifi";
+  if (allowed_type.starts_with(APACHE_GROUP_STR)) {
+    return std::string{APACHE_GROUP_STR};
+  }
+  return std::string{allowed_type.substr(0, allowed_type.find_last_of('.'))};
+}
+
+constexpr std::string_view shortNameFromFullName(std::string_view sv) {
+  auto pos = sv.rfind('.');
+  return (pos == std::string_view::npos) ? sv : sv.substr(pos + 1);
+}

Review Comment:
   you could switch these and call shortNameFromFullName from 
allowedTypeGroupName. Unless you would rather keep them conceptually separate, 
regardless of the type compatibility.



-- 
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]

Reply via email to