You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@storm.apache.org by "jnioche (via GitHub)" <gi...@apache.org> on 2026/03/28 07:20:28 UTC
[PR] Port Clojure tests to Java: versioned_store_test and tuple_test (storm)
jnioche opened a new pull request, #8443:
URL: https://github.com/apache/storm/pull/8443
## Context
Storm was originally written in Clojure. The core was rewritten in Java, but ~5,000 lines of Clojure integration tests remain in `storm-core/test/clj/` (107 test functions across 13 files). These are the main reason the Clojure dependency (1.12.4, carbonite, tools.logging, clojure-maven-plugin, shade transformer) is still in the build. Porting them to Java enables full removal of the Clojure stack.
The Java testing infrastructure is already mature: `Testing.java` provides 33 public methods (`completeTopology`, `readTuples`, `multiseteq`, `withSimulatedTime`, etc.), and JUnit 5, Mockito 5.14, and Awaitility 4.3 are all available. 48 Java test files already exist under `storm-server/src/test/`.
## Summary
First phase of porting Clojure tests to Java to enable eventual removal of the
Clojure dependency. Ports 8 test functions from 2 Clojure files to Java/JUnit 5.
## Changes
| Clojure source | Java target | Tests |
|---|---|---|
| `storm-core/test/clj/org/apache/storm/versioned_store_test.clj` | `storm-core/test/jvm/org/apache/storm/utils/VersionedStoreTest.java` | 2 |
| `storm-core/test/clj/org/apache/storm/trident/tuple_test.clj` | `storm-core/test/jvm/org/apache/storm/trident/TridentTupleViewTest.java` | 6 |
**Not ported:** `serialization_test.clj` (1 test) — only tests Clojure-specific data
types (keywords, sets, maps) that won't exist after Clojure removal. The existing
Java `SerializationTest` already covers Java type roundtrips.
## Context
This is Phase 1 of an 8-phase plan to port all ~107 Clojure test functions to Java,
enabling full removal of the `storm-clojure`, `storm-clojure-test` modules and the
Clojure build dependency. The Clojure test files are not deleted yet — that happens
in the final cleanup phase after all tests are ported.
## Test plan
- [x] `mvn test -pl storm-core -Dtest="VersionedStoreTest,TridentTupleViewTest"` — 8 tests, all pass
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
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: issues-unsubscribe@storm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Port Clojure tests to Java: versioned_store_test and tuple_test (storm)
Posted by "rzo1 (via GitHub)" <gi...@apache.org>.
rzo1 commented on code in PR #8443:
URL: https://github.com/apache/storm/pull/8443#discussion_r3004607731
##########
storm-core/test/jvm/org/apache/storm/utils/VersionedStoreTest.java:
##########
@@ -0,0 +1,74 @@
+/*
+ * 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.storm.utils;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.storm.testing.TmpPath;
+import org.junit.jupiter.api.Test;
+
+/**
+ * Ported from versioned_store_test.clj.
+ */
+class VersionedStoreTest {
+
+ private void writeToFile(String file) throws IOException {
+ FileUtils.writeStringToFile(new File(file), "time:" + System.currentTimeMillis(), "UTF-8");
+ }
+
+ @Test
+ void testEmptyVersion() throws Exception {
+ try (TmpPath dir = new TmpPath()) {
+ VersionedStore vs = new VersionedStore(dir.getPath(), true);
+ String v = vs.createVersion();
+ vs.succeedVersion(v);
+ writeToFile(v);
+ assertEquals(1, vs.getAllVersions().size());
+ assertEquals(v, vs.mostRecentVersionPath());
+ }
+ }
+
+ @Test
+ void testMultipleVersions() throws Exception {
+ try (TmpPath dir = new TmpPath()) {
+ VersionedStore vs = new VersionedStore(dir.getPath(), true);
+
+ String v1 = vs.createVersion();
+ vs.succeedVersion(v1);
+ writeToFile(v1);
+
+ Thread.sleep(100);
Review Comment:
AFAIR, we have https://github.com/awaitility/awaitility in the classpath, i.e. it should be possible to avoid active Thread.sleep(...) calls, which might break on CI or slower machines
--
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: issues-unsubscribe@storm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Port Clojure tests to Java: versioned_store_test and tuple_test (storm)
Posted by "jnioche (via GitHub)" <gi...@apache.org>.
jnioche commented on code in PR #8443:
URL: https://github.com/apache/storm/pull/8443#discussion_r3006175856
##########
storm-core/test/jvm/org/apache/storm/utils/VersionedStoreTest.java:
##########
@@ -0,0 +1,74 @@
+/*
+ * 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.storm.utils;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.storm.testing.TmpPath;
+import org.junit.jupiter.api.Test;
+
+/**
+ * Ported from versioned_store_test.clj.
+ */
+class VersionedStoreTest {
+
+ private void writeToFile(String file) throws IOException {
+ FileUtils.writeStringToFile(new File(file), "time:" + System.currentTimeMillis(), "UTF-8");
+ }
+
+ @Test
+ void testEmptyVersion() throws Exception {
+ try (TmpPath dir = new TmpPath()) {
+ VersionedStore vs = new VersionedStore(dir.getPath(), true);
+ String v = vs.createVersion();
+ vs.succeedVersion(v);
+ writeToFile(v);
+ assertEquals(1, vs.getAllVersions().size());
+ assertEquals(v, vs.mostRecentVersionPath());
+ }
+ }
+
+ @Test
+ void testMultipleVersions() throws Exception {
+ try (TmpPath dir = new TmpPath()) {
+ VersionedStore vs = new VersionedStore(dir.getPath(), true);
+
+ String v1 = vs.createVersion();
+ vs.succeedVersion(v1);
+ writeToFile(v1);
+
+ Thread.sleep(100);
Review Comment:
should be done now
--
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: issues-unsubscribe@storm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Port Clojure tests to Java: versioned_store_test and tuple_test (storm)
Posted by "jnioche (via GitHub)" <gi...@apache.org>.
jnioche merged PR #8443:
URL: https://github.com/apache/storm/pull/8443
--
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: issues-unsubscribe@storm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org