ibelyakov commented on a change in pull request #7934:
URL: https://github.com/apache/ignite/pull/7934#discussion_r631882124



##########
File path: 
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/ContinuousQueryBufferCleanupAbstractTest.java
##########
@@ -0,0 +1,172 @@
+/*
+ * 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.processors.cache.query.continuous;
+
+import java.util.UUID;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicReference;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
+import org.apache.ignite.cache.query.AbstractContinuousQuery;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.internal.IgniteEx;
+import 
org.apache.ignite.internal.processors.continuous.GridContinuousProcessor;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+
+import static 
org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi.DFLT_ACK_SND_THRESHOLD;
+
+/**
+ * Test for continuous query buffer cleanup.
+ */
+public abstract class ContinuousQueryBufferCleanupAbstractTest extends 
GridCommonAbstractTest {
+    /** */
+    private static final int RECORDS_CNT = 10000;
+
+    /** */
+    private static final int ACK_THRESHOLD = 100;
+
+    /** */
+    private static final String REMOTE_ROUTINE_INFO_CLASS_NAME = 
"org.apache.ignite.internal.processors.continuous.GridContinuousProcessor$RemoteRoutineInfo";
+
+    /** */
+    private static final String LOCAL_ROUTINE_INFO_CLASS_NAME = 
"org.apache.ignite.internal.processors.continuous.GridContinuousProcessor$LocalRoutineInfo";
+
+    /** */
+    private static final String BATCH_CLASS_NAME = 
"org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryEventBuffer$Batch";
+
+    /** Continuous query updates counter */
+    protected final AtomicInteger updCntr = new AtomicInteger();
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        stopAllGrids();
+    }
+
+    /**
+     * @throws Exception If fail.
+     */
+    @Test
+    public void checkCacheWithSingleNode() throws Exception {
+        checkBuffer(1, 0, true);
+    }
+
+    /**
+     * @throws Exception If fail.
+     */
+    @Test
+    public void checkCacheWithMultipleNodes() throws Exception {
+        checkBuffer(2, 0, true);
+    }
+
+    /**
+     * @throws Exception If fail.
+     */
+    @Test
+    public void checkCacheWithMultipleNodesWithBackups() throws Exception {
+        checkBuffer(2, 1, true);
+    }
+
+    /**
+     * @throws Exception If fail.
+     */
+    @Test
+    public void checkCacheWithMultipleNodesWithBackupsWithoutClient() throws 
Exception {
+        checkBuffer(2, 1, false);
+    }
+
+    /** Provides continuous query for the test. */
+    protected abstract AbstractContinuousQuery<Integer, String> 
getContinuousQuery();
+
+    /** */
+    private void checkBuffer(int srvCnt, int backupsCnt, boolean useClient) 
throws Exception {
+        System.setProperty("IGNITE_CONTINUOUS_QUERY_ACK_THRESHOLD", 
Integer.toString(ACK_THRESHOLD));

Review comment:
       Default value is used.

##########
File path: 
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/ContinuousQueryBufferCleanupAbstractTest.java
##########
@@ -0,0 +1,172 @@
+/*
+ * 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.processors.cache.query.continuous;
+
+import java.util.UUID;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicReference;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
+import org.apache.ignite.cache.query.AbstractContinuousQuery;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.internal.IgniteEx;
+import 
org.apache.ignite.internal.processors.continuous.GridContinuousProcessor;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+
+import static 
org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi.DFLT_ACK_SND_THRESHOLD;
+
+/**
+ * Test for continuous query buffer cleanup.
+ */
+public abstract class ContinuousQueryBufferCleanupAbstractTest extends 
GridCommonAbstractTest {
+    /** */
+    private static final int RECORDS_CNT = 10000;
+
+    /** */
+    private static final int ACK_THRESHOLD = 100;
+
+    /** */
+    private static final String REMOTE_ROUTINE_INFO_CLASS_NAME = 
"org.apache.ignite.internal.processors.continuous.GridContinuousProcessor$RemoteRoutineInfo";
+
+    /** */
+    private static final String LOCAL_ROUTINE_INFO_CLASS_NAME = 
"org.apache.ignite.internal.processors.continuous.GridContinuousProcessor$LocalRoutineInfo";
+
+    /** */
+    private static final String BATCH_CLASS_NAME = 
"org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryEventBuffer$Batch";
+
+    /** Continuous query updates counter */
+    protected final AtomicInteger updCntr = new AtomicInteger();
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        stopAllGrids();
+    }
+
+    /**
+     * @throws Exception If fail.
+     */
+    @Test
+    public void checkCacheWithSingleNode() throws Exception {
+        checkBuffer(1, 0, true);
+    }
+
+    /**
+     * @throws Exception If fail.
+     */
+    @Test
+    public void checkCacheWithMultipleNodes() throws Exception {
+        checkBuffer(2, 0, true);
+    }
+
+    /**
+     * @throws Exception If fail.
+     */
+    @Test
+    public void checkCacheWithMultipleNodesWithBackups() throws Exception {
+        checkBuffer(2, 1, true);
+    }
+
+    /**
+     * @throws Exception If fail.
+     */
+    @Test
+    public void checkCacheWithMultipleNodesWithBackupsWithoutClient() throws 
Exception {
+        checkBuffer(2, 1, false);
+    }
+
+    /** Provides continuous query for the test. */
+    protected abstract AbstractContinuousQuery<Integer, String> 
getContinuousQuery();
+
+    /** */
+    private void checkBuffer(int srvCnt, int backupsCnt, boolean useClient) 
throws Exception {

Review comment:
       Implemented




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to