rpuch commented on code in PR #4239: URL: https://github.com/apache/ignite-3/pull/4239#discussion_r1723195376
########## modules/runner/src/integrationTest/java/org/apache/ignite/internal/app/ItShutDownServerApiReferencesTest.java: ########## @@ -0,0 +1,70 @@ +/* + * 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.ignite.internal.app; + +import static java.util.concurrent.TimeUnit.SECONDS; +import static org.apache.ignite.internal.testframework.asserts.CompletableFutureAssert.assertWillThrow; +import static org.apache.ignite.internal.testframework.matchers.CompletableFutureMatcher.willCompleteSuccessfully; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; +import static org.junit.jupiter.api.Assertions.assertThrows; + +import org.apache.ignite.internal.ClusterPerClassIntegrationTest; +import org.apache.ignite.lang.IgniteException; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.EnumSource; + +/** + * Makes sure that references to API objects obtained in embedded mode stop functioning after the node gets shut down. + */ +class ItShutDownServerApiReferencesTest extends ClusterPerClassIntegrationTest { + private static IgniteServerImpl server; + + private static References beforeShutdown; + + @Override + protected int initialNodes() { + return 1; + } + + @BeforeAll + void init() throws Exception { + server = (IgniteServerImpl) CLUSTER.server(0); + + server.api().sql().executeScript("CREATE TABLE test (id INT PRIMARY KEY, val VARCHAR)"); + + beforeShutdown = new References(server); + + assertThat(server.shutdownAsync(), willCompleteSuccessfully()); + } + + @ParameterizedTest + @EnumSource(SyncApiOperation.class) + void syncOperationsThrowAfterShutdown(SyncApiOperation operation) { + IgniteException ex = assertThrows(IgniteException.class, () -> operation.execute(beforeShutdown)); Review Comment: What's the advantage? -- 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]
