exceptionfactory commented on code in PR #11488: URL: https://github.com/apache/nifi/pull/11488#discussion_r3677226468
########## nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/restart/AutoResumeStateControllerServiceIT.java: ########## @@ -0,0 +1,77 @@ +/* + * 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. + */ + +package org.apache.nifi.tests.system.restart; + +import org.apache.nifi.tests.system.NiFiSystemIT; +import org.apache.nifi.toolkit.client.NiFiClientException; +import org.apache.nifi.util.NiFiProperties; +import org.apache.nifi.web.api.entity.ControllerServiceEntity; +import org.apache.nifi.web.api.entity.ProcessGroupEntity; +import org.junit.jupiter.api.Test; + +import java.io.IOException; + +import static org.junit.jupiter.api.Assertions.assertNotEquals; + +public class AutoResumeStateControllerServiceIT extends NiFiSystemIT { Review Comment: The `public` modifiers can be removed ########## nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/restart/AutoResumeStateControllerServiceIT.java: ########## @@ -0,0 +1,77 @@ +/* + * 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. + */ + +package org.apache.nifi.tests.system.restart; + +import org.apache.nifi.tests.system.NiFiSystemIT; +import org.apache.nifi.toolkit.client.NiFiClientException; +import org.apache.nifi.util.NiFiProperties; +import org.apache.nifi.web.api.entity.ControllerServiceEntity; +import org.apache.nifi.web.api.entity.ProcessGroupEntity; +import org.junit.jupiter.api.Test; + +import java.io.IOException; + +import static org.junit.jupiter.api.Assertions.assertNotEquals; + +public class AutoResumeStateControllerServiceIT extends NiFiSystemIT { + + @Override + protected boolean isDestroyEnvironmentAfterEachTest() { + return true; + } + + @Override + protected boolean isAllowFactoryReuse() { + return false; + } + + @Test + public void testRootControllerServiceNotResumedWhenAutoResumeDisabled() throws NiFiClientException, IOException, InterruptedException { + final ControllerServiceEntity service = getClientUtil().createRootLevelControllerService("StandardCountService"); + getClientUtil().enableControllerService(service); + getClientUtil().waitForControllerServiceRunStatus(service.getId(), "ENABLED"); Review Comment: The `ENABLED` string could be declared once and reused ########## nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/restart/AutoResumeStateControllerServiceIT.java: ########## @@ -0,0 +1,77 @@ +/* + * 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. + */ + +package org.apache.nifi.tests.system.restart; + +import org.apache.nifi.tests.system.NiFiSystemIT; +import org.apache.nifi.toolkit.client.NiFiClientException; +import org.apache.nifi.util.NiFiProperties; +import org.apache.nifi.web.api.entity.ControllerServiceEntity; +import org.apache.nifi.web.api.entity.ProcessGroupEntity; +import org.junit.jupiter.api.Test; + +import java.io.IOException; + +import static org.junit.jupiter.api.Assertions.assertNotEquals; + +public class AutoResumeStateControllerServiceIT extends NiFiSystemIT { + + @Override + protected boolean isDestroyEnvironmentAfterEachTest() { + return true; + } + + @Override + protected boolean isAllowFactoryReuse() { + return false; + } + + @Test + public void testRootControllerServiceNotResumedWhenAutoResumeDisabled() throws NiFiClientException, IOException, InterruptedException { + final ControllerServiceEntity service = getClientUtil().createRootLevelControllerService("StandardCountService"); + getClientUtil().enableControllerService(service); + getClientUtil().waitForControllerServiceRunStatus(service.getId(), "ENABLED"); + + restartWithAutoResumeStateDisabled(); + + final ControllerServiceEntity serviceAfterRestart = getNifiClient().getControllerServicesClient().getControllerService(service.getId()); + assertNotEquals("ENABLED", serviceAfterRestart.getComponent().getState()); + } + + @Test + public void testProcessGroupControllerServiceNotResumedWhenAutoResumeDisabled() throws NiFiClientException, IOException, InterruptedException { + final ProcessGroupEntity processGroup = getClientUtil().createProcessGroup("Auto Resume Test", "root"); + final ControllerServiceEntity service = getClientUtil().createControllerService("StandardCountService", processGroup.getId()); + getClientUtil().enableControllerService(service); + getClientUtil().waitForControllerServiceRunStatus(service.getId(), "ENABLED"); + + restartWithAutoResumeStateDisabled(); + + final ControllerServiceEntity serviceAfterRestart = getNifiClient().getControllerServicesClient().getControllerService(service.getId()); + assertNotEquals("ENABLED", serviceAfterRestart.getComponent().getState()); + } + + private void restartWithAutoResumeStateDisabled() throws IOException, InterruptedException { + Thread.sleep(3000); Review Comment: This sleep could be brittle, is there any kind of status that could be polled instead, or is the sleep even needed before stopping? -- 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]
