richardstartin commented on a change in pull request #8274:
URL: https://github.com/apache/pinot/pull/8274#discussion_r817606771



##########
File path: 
pinot-plugins/pinot-stream-ingestion/pinot-rocketmq/src/test/java/org/apache/pinot/plugin/stream/rocketmq/RocketMQStreamLevelConsumerTest.java
##########
@@ -0,0 +1,308 @@
+/**
+ * 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.pinot.plugin.stream.rocketmq;
+
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+import org.apache.pinot.plugin.stream.rocketmq.utils.MiniRocketMQCluster;
+import org.apache.pinot.spi.data.readers.GenericRow;
+import org.apache.pinot.spi.stream.LongMsgOffset;
+import org.apache.pinot.spi.stream.OffsetCriteria;
+import org.apache.pinot.spi.stream.StreamConfig;
+import org.apache.pinot.spi.stream.StreamConsumerFactory;
+import org.apache.pinot.spi.stream.StreamConsumerFactoryProvider;
+import org.apache.pinot.spi.stream.StreamDecoderProvider;
+import org.apache.pinot.spi.stream.StreamLevelConsumer;
+import org.apache.pinot.spi.stream.StreamMessageDecoder;
+import org.apache.rocketmq.client.producer.DefaultMQProducer;
+import org.apache.rocketmq.client.producer.MessageQueueSelector;
+import org.apache.rocketmq.common.consumer.ConsumeFromWhere;
+import org.apache.rocketmq.common.message.Message;
+import org.mockito.MockedStatic;
+import org.mockito.Mockito;
+import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+
+public class RocketMQStreamLevelConsumerTest {
+
+  private static final long STABILIZE_SLEEP_DELAYS = 3000;
+  private static final String TEST_TOPIC_1 = "foo";
+  private static final String TEST_TOPIC_2 = "bar";
+  private static final int NUM_MSG_PRODUCED_PER_PARTITION = 1000;
+
+  private MiniRocketMQCluster _rocketmqCluster;
+  private String _namesrvAddress;
+
+  @BeforeClass
+  public void setUp()
+      throws Exception {
+    _rocketmqCluster = new MiniRocketMQCluster("default_cluster", 
"default_broker");
+    _rocketmqCluster.start();
+    _namesrvAddress = _rocketmqCluster.getNamesrvAddress();
+    System.out.println("nameserver: " + _namesrvAddress);
+    Thread.sleep(STABILIZE_SLEEP_DELAYS);
+    _rocketmqCluster.initTopic(TEST_TOPIC_1, 1);
+    _rocketmqCluster.initTopic(TEST_TOPIC_2, 2);
+    produceMsgToRocketMQ();
+    Thread.sleep(STABILIZE_SLEEP_DELAYS);
+  }
+
+  private void produceMsgToRocketMQ() {
+    DefaultMQProducer producer = new DefaultMQProducer("TEST_PRODUCER");
+    producer.setNamesrvAddr(_namesrvAddress);
+    try {
+      producer.start();
+
+      MessageQueueSelector queueSelector = (mqs, msg, arg) -> {
+        return mqs.stream().filter(q -> 
arg.equals(q.getQueueId())).collect(Collectors.toList()).get(0);
+      };
+
+      for (int i = 0; i < NUM_MSG_PRODUCED_PER_PARTITION; i++) {
+        producer.send(new Message(TEST_TOPIC_1, ("sample_msg_" + 
i).getBytes(StandardCharsets.UTF_8)));
+        // TEST_TOPIC_2 has 2 partitions
+        producer.send(new Message(TEST_TOPIC_2, ("sample_msg_0_" + 
i).getBytes(StandardCharsets.UTF_8)), queueSelector,
+            0);
+        producer.send(new Message(TEST_TOPIC_2, ("sample_msg_1_" + 
i).getBytes(StandardCharsets.UTF_8)), queueSelector,
+            1);
+      }
+    } catch (Throwable e) {
+      Assert.fail("failed to produce messages", e);
+    } finally {
+      producer.shutdown();
+    }
+  }
+
+  @AfterClass
+  public void tearDown()
+      throws Exception {
+    _rocketmqCluster.close();

Review comment:
       This appears to fail in CI:
   ```
   Error:  WARNING: An illegal reflective access operation has occurred
   
[24844](https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true#step:5:24844)
   Error:  WARNING: Illegal reflective access by 
org.apache.rocketmq.store.MappedFile$1 
(file:/home/runner/.m2/repository/org/apache/rocketmq/rocketmq-store/4.9.0/rocketmq-store-4.9.0.jar)
 to method java.nio.DirectByteBuffer.attachment()
   
[24845](https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true#step:5:24845)
   Error:  WARNING: Please consider reporting this to the maintainers of 
org.apache.rocketmq.store.MappedFile$1
   
[24846](https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true#step:5:24846)
   Error:  WARNING: Use --illegal-access=warn to enable warnings of further 
illegal reflective access operations
   
[24847](https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true#step:5:24847)
   Error:  WARNING: All illegal access operations will be denied in a future 
release
   
[24848](https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true#step:5:24848)
   Error:  Tests run: 5, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 
122.343 s <<< FAILURE! - in 
org.apache.pinot.plugin.stream.rocketmq.RocketMQStreamLevelConsumerTest
   
[24849](https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true#step:5:24849)
   Error:  
org.apache.pinot.plugin.stream.rocketmq.RocketMQStreamLevelConsumerTest.testBuildRocketMQConfig
  Time elapsed: 0.105 s
   
[24850](https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true#step:5:24850)
   Error:  
org.apache.pinot.plugin.stream.rocketmq.RocketMQStreamLevelConsumerTest.testConsumer
  Time elapsed: 97.216 s
   
[24851](https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true#step:5:24851)
   Error:  
org.apache.pinot.plugin.stream.rocketmq.RocketMQStreamLevelConsumerTest.testFetchOffsets
  Time elapsed: 0.018 s
   
[24852](https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true#step:5:24852)
   Error:  
org.apache.pinot.plugin.stream.rocketmq.RocketMQStreamLevelConsumerTest.testGetPartitionCount
  Time elapsed: 0.003 s
   
[24853](https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true#step:5:24853)
   Error:  
org.apache.pinot.plugin.stream.rocketmq.RocketMQStreamLevelConsumerTest.tearDown
  Time elapsed: 2.988 s  <<< FAILURE!
   
[24854](https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true#step:5:24854)
   java.lang.IllegalStateException: 
java.lang.reflect.InaccessibleObjectException: Unable to make public void 
jdk.internal.ref.Cleaner.clean() accessible: module java.base does not "exports 
jdk.internal.ref" to unnamed module @42e26948
   
[24855](https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true#step:5:24855)
        at org.apache.rocketmq.store.MappedFile$1.run(MappedFile.java:104)
   
[24856](https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true#step:5:24856)
        at java.base/java.security.AccessController.doPrivileged(Native Method)
   
[24857](https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true#step:5:24857)
        at org.apache.rocketmq.store.MappedFile.invoke(MappedFile.java:97)
   
[24858](https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true#step:5:24858)
        at org.apache.rocketmq.store.MappedFile.clean(MappedFile.java:93)
   
[24859](https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true#step:5:24859)
        at org.apache.rocketmq.store.MappedFile.cleanup(MappedFile.java:431)
   
[24860](https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true#step:5:24860)
        at 
org.apache.rocketmq.store.ReferenceResource.release(ReferenceResource.java:63)
   
[24861](https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true#step:5:24861)
        at 
org.apache.rocketmq.store.ReferenceResource.shutdown(ReferenceResource.java:47)
   
[24862](https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true#step:5:24862)
        at org.apache.rocketmq.store.MappedFile.destroy(MappedFile.java:439)
   
[24863](https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true#step:5:24863)
        at 
org.apache.rocketmq.store.AllocateMappedFileService.shutdown(AllocateMappedFileService.java:129)
   
[24864](https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true#step:5:24864)
        at 
org.apache.rocketmq.store.DefaultMessageStore.shutdown(DefaultMessageStore.java:320)
   
[24865](https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true#step:5:24865)
        at 
org.apache.rocketmq.broker.BrokerController.shutdown(BrokerController.java:770)
   
[24866](https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true#step:5:24866)
        at 
org.apache.pinot.plugin.stream.rocketmq.utils.MiniRocketMQCluster.close(MiniRocketMQCluster.java:73)
   
[24867](https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true#step:5:24867)
        at 
org.apache.pinot.plugin.stream.rocketmq.RocketMQStreamLevelConsumerTest.tearDown(RocketMQStreamLevelConsumerTest.java:102)
   
[24868](https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true#step:5:24868)
        at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   
[24869](https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true#step:5:24869)
        at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   
[24870](https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true#step:5:24870)
        at 
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   
[24871](https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true#step:5:24871)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
   
[24872](https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true#step:5:24872)
        at 
org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:108)
   
[24873](https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true#step:5:24873)
        at 
org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:523)
   
[24874](https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true#step:5:24874)
        at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:224)
   
[24875](https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true#step:5:24875)
        at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:146)
   
[24876](https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true#step:5:24876)
        at 
org.testng.internal.TestMethodWorker.invokeAfterClassMethods(TestMethodWorker.java:212)
   
[24877](https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true#step:5:24877)
        at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
   
[24878](https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true#step:5:24878)
        at org.testng.TestRunner.privateRun(TestRunner.java:744)
   
[24879](https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true#step:5:24879)
        at org.testng.TestRunner.run(TestRunner.java:602)
   
[24880](https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true#step:5:24880)
        at org.testng.SuiteRunner.runTest(SuiteRunner.java:380)
   
[24881](https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true#step:5:24881)
        at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:375)
   
[24882](https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true#step:5:24882)
        at org.testng.SuiteRunner.privateRun(SuiteRunner.java:340)
   
[24883](https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true#step:5:24883)
        at org.testng.SuiteRunner.run(SuiteRunner.java:289)
   
[24884](https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true#step:5:24884)
        at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
   
[24885](https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true#step:5:24885)
        at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
   
[24886](https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true#step:5:24886)
        at org.testng.TestNG.runSuitesSequentially(TestNG.java:1301)
   
[24887](https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true#step:5:24887)
        at org.testng.TestNG.runSuitesLocally(TestNG.java:1226)
   
[24888](https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true#step:5:24888)
        at org.testng.TestNG.runSuites(TestNG.java:1144)
   
[24889](https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true#step:5:24889)
        at org.testng.TestNG.run(TestNG.java:1115)
   
[24890](https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true#step:5:24890)
        at 
org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:136)
   
[24891](https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true#step:5:24891)
        at 
org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.executeSingleClass(TestNGDirectoryTestSuite.java:112)
   
[24892](https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true#step:5:24892)
        at 
org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:99)
   
[24893](https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true#step:5:24893)
        at 
org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:145)
   
[24894](https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true#step:5:24894)
        at 
org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:428)
   
[24895](https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true#step:5:24895)
        at 
org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:162)
   
[24896](https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true#step:5:24896)
        at 
org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:562)
   
[24897](https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true#step:5:24897)
        at 
org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:548)
   
[24898](https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true#step:5:24898)
   Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make 
public void jdk.internal.ref.Cleaner.clean() accessible: module java.base does 
not "exports jdk.internal.ref" to unnamed module @42e26948
   
[24899](https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true#step:5:24899)
        at 
java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:340)
   
[24900](https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true#step:5:24900)
        at 
java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:280)
   
[24901](https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true#step:5:24901)
        at 
java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:198)
   
[24902](https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true#step:5:24902)
        at java.base/java.lang.reflect.Method.setAccessible(Method.java:192)
   
[24903](https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true#step:5:24903)
        at org.apache.rocketmq.store.MappedFile$1.run(MappedFile.java:101)
   
[24904](https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true#step:5:24904)
        ... 42 more
   
[24905](https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true#step:5:24905)
   ```
   
   https://github.com/apache/pinot/runs/5389825306?check_suite_focus=true




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



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to