Copilot commented on code in PR #13884:
URL: https://github.com/apache/cloudstack/pull/13884#discussion_r4345737139


##########
engine/schema/src/test/java/com/cloud/storage/dao/StoragePoolTagsDaoImplTest.java:
##########
@@ -47,7 +49,7 @@
 public class StoragePoolTagsDaoImplTest extends TestCase {
 
     @Mock
-    ConfigurationDao _configDao;
+    ConfigDepotImpl configDepot;

Review Comment:
   `configDepot` is no longer annotated as a Mockito mock in the diff (it’s 
declared as a field but not guaranteed to be initialized). As written, 
`ConfigKey.init(configDepot)` and `when(configDepot.getConfigStringValue(...))` 
will throw a `NullPointerException` if `configDepot` is null. Make 
`configDepot` an actual Mockito mock (e.g., annotate it properly and ensure 
Mockito initialization runs, or instantiate it via 
`Mockito.mock(ConfigDepotImpl.class)` in `setup()`).



##########
engine/schema/src/test/java/com/cloud/storage/dao/StoragePoolTagsDaoImplTest.java:
##########
@@ -70,19 +72,25 @@ public class StoragePoolTagsDaoImplTest extends TestCase {
 
     @Before
     public void setup() {
-        
when(_configDao.getValue(batchSizeConfigurationKey)).thenReturn(batchSizeValue);
+        ConfigKey.init(configDepot);
+        when(configDepot.getConfigStringValue(batchSizeConfigurationKey, 
ConfigKey.Scope.Global, null)).thenReturn(batchSizeValue);

Review Comment:
   `configDepot` is no longer annotated as a Mockito mock in the diff (it’s 
declared as a field but not guaranteed to be initialized). As written, 
`ConfigKey.init(configDepot)` and `when(configDepot.getConfigStringValue(...))` 
will throw a `NullPointerException` if `configDepot` is null. Make 
`configDepot` an actual Mockito mock (e.g., annotate it properly and ensure 
Mockito initialization runs, or instantiate it via 
`Mockito.mock(ConfigDepotImpl.class)` in `setup()`).



##########
engine/components-api/src/main/java/com/cloud/network/NetworkStateListener.java:
##########
@@ -38,15 +36,16 @@
 
 public class NetworkStateListener implements StateListener<State, Event, 
Network> {
 
-    @Inject
-    private ConfigurationDao _configDao;
+    // Registered/owned by 
com.cloud.server.ManagementServer#PublishResourceStateEvent; declared here too 
so this
+    // module can read it without a reverse dependency on the server module.
+    private static final ConfigKey<Boolean> PublishResourceStateEvent = new 
ConfigKey<>("Advanced", Boolean.class, "publish.resource.state.events", "true",
+            "enable or disable publishing of alert events on the event bus", 
true);

Review Comment:
   The `PublishResourceStateEvent` description says it controls publishing of 
\"alert events\", but this listener publishes *resource state* events. Update 
the description to match the behavior to avoid confusing operators and future 
maintainers.



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