Re: [PR] KAFKA-16921: Migrate test of Stream module to Junit5 (Stream state) [kafka]

2024-06-18 Thread via GitHub


chia7712 commented on code in PR #16356:
URL: https://github.com/apache/kafka/pull/16356#discussion_r1644229011


##
streams/src/test/java/org/apache/kafka/streams/state/internals/RocksDBVersionedStoreSegmentValueFormatterTest.java:
##
@@ -18,61 +18,49 @@
 
 import static org.hamcrest.CoreMatchers.equalTo;
 import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Collection;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Stream;
+
 import 
org.apache.kafka.streams.state.internals.RocksDBVersionedStoreSegmentValueFormatter.SegmentValue;
 import 
org.apache.kafka.streams.state.internals.RocksDBVersionedStoreSegmentValueFormatter.SegmentValue.SegmentSearchResult;
-import org.junit.Test;
-import org.junit.experimental.runners.Enclosed;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
 
-@RunWith(Enclosed.class)
 public class RocksDBVersionedStoreSegmentValueFormatterTest {
 
 /**
  * Non-exceptional scenarios which are expected to occur during regular 
store operation.
  */
-@RunWith(Parameterized.class)
 public static class ExpectedCasesTest {

Review Comment:
   I means - please do a bit refactor to avoid nested tests



-- 
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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] KAFKA-16921: Migrate test of Stream module to Junit5 (Stream state) [kafka]

2024-06-18 Thread via GitHub


chia7712 commented on PR #16356:
URL: https://github.com/apache/kafka/pull/16356#issuecomment-2175742237

   @m1a2st Could you please update the jira number? It should be KAFKA-15623, 
right?


-- 
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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] KAFKA-16921: Migrate test of Stream module to Junit5 (Stream state) [kafka]

2024-06-17 Thread via GitHub


m1a2st commented on code in PR #16356:
URL: https://github.com/apache/kafka/pull/16356#discussion_r1643586369


##
streams/src/test/java/org/apache/kafka/streams/state/internals/RocksDBVersionedStoreSegmentValueFormatterTest.java:
##
@@ -18,61 +18,49 @@
 
 import static org.hamcrest.CoreMatchers.equalTo;
 import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Collection;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Stream;
+
 import 
org.apache.kafka.streams.state.internals.RocksDBVersionedStoreSegmentValueFormatter.SegmentValue;
 import 
org.apache.kafka.streams.state.internals.RocksDBVersionedStoreSegmentValueFormatter.SegmentValue.SegmentSearchResult;
-import org.junit.Test;
-import org.junit.experimental.runners.Enclosed;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
 
-@RunWith(Enclosed.class)
 public class RocksDBVersionedStoreSegmentValueFormatterTest {
 
 /**
  * Non-exceptional scenarios which are expected to occur during regular 
store operation.
  */
-@RunWith(Parameterized.class)
 public static class ExpectedCasesTest {

Review Comment:
   @chia7712, Thanks for your comment, I don't really understand that I should 
extract which test case? Could you talk more details, Thanks for your patience.



-- 
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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] KAFKA-16921: Migrate test of Stream module to Junit5 (Stream state) [kafka]

2024-06-17 Thread via GitHub


chia7712 commented on code in PR #16356:
URL: https://github.com/apache/kafka/pull/16356#discussion_r1642920606


##
streams/src/test/java/org/apache/kafka/streams/state/internals/AbstractRocksDBSessionStoreTest.java:
##
@@ -0,0 +1,75 @@
+/*
+ * 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.kafka.streams.state.internals;
+
+import org.apache.kafka.common.serialization.Serde;
+import org.apache.kafka.streams.state.SessionStore;
+import org.apache.kafka.streams.state.Stores;
+
+import static java.time.Duration.ofMillis;
+
+public abstract class AbstractRocksDBSessionStoreTest extends 
AbstractSessionBytesStoreTest {
+
+private static final String STORE_NAME = "rocksDB session store";
+
+public abstract StoreType storeType();

Review Comment:
   please remove `public`



##
streams/src/test/java/org/apache/kafka/streams/state/internals/RocksDBTimeOrderedSessionStoreWithIndexTest.java:
##
@@ -0,0 +1,25 @@
+/*
+ * 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.kafka.streams.state.internals;
+
+public class RocksDBTimeOrderedSessionStoreWithIndexTest extends 
AbstractRocksDBSessionStoreTest {
+
+@Override
+public StoreType storeType() {

Review Comment:
   please remove `public`



##
streams/src/test/java/org/apache/kafka/streams/state/internals/RocksDBTimeOrderedWindowSchemaWithIndexSegmentedBytesStoreTest.java:
##
@@ -0,0 +1,30 @@
+/*
+ * 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.kafka.streams.state.internals;
+
+public class RocksDBTimeOrderedWindowSchemaWithIndexSegmentedBytesStoreTest 
extends AbstractRocksDBTimeOrderedWindowSegmentedBytesStoreTest {
+
+@Override
+protected boolean hasIndex() {
+return true;
+}
+
+@Override
+protected 
AbstractRocksDBTimeOrderedWindowSegmentedBytesStoreTest.SchemaType schemaType() 
{

Review Comment:
   please remove "protected"



##
streams/src/test/java/org/apache/kafka/streams/state/internals/AbstractRocksDBTimeOrderedWindowSegmentedBytesStoreTest.java:
##
@@ -16,59 +16,37 @@
  */
 package org.apache.kafka.streams.state.internals;
 
-import static java.util.Arrays.asList;
-
-import java.util.Collection;
 import 
org.apache.kafka.streams.state.internals.PrefixedSessionKeySchemas.KeyFirstSessionKeySchema;
 import 
org.apache.kafka.streams.state.internals.PrefixedSessionKeySchemas.TimeFirstSessionKeySchema;
 import 
org.apache.kafka.streams.state.internals.PrefixedWindowKeySchemas.KeyFirstWindowKeySchema;
 import 
org.apache.kafka.streams.state.internals.PrefixedWindowKeySchemas.TimeFirstWindowKeySchema;
 import 

Re: [PR] KAFKA-16921: Migrate test of Stream module to Junit5 (Stream state) [kafka]

2024-06-15 Thread via GitHub


m1a2st commented on PR #16356:
URL: https://github.com/apache/kafka/pull/16356#issuecomment-2171061086

   @C0urante, Thanks for your comment, It's my mistake, I change title to 
stream module.


-- 
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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org