From f491356d55ea564a0e6ee94ae853bc4d83d7fb9d Mon Sep 17 00:00:00 2001 From: Brian Demers Date: Mon, 3 Jun 2024 15:49:57 -0400 Subject: [PATCH 01/11] Run tests in parallel on different JVM forks --- pom.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pom.xml b/pom.xml index 91b253c5159..d142cbfe948 100644 --- a/pom.xml +++ b/pom.xml @@ -107,6 +107,13 @@ + + org.apache.maven.plugins + maven-surefire-plugin + + 1C + + From 898dbd8d2c2f9957fef7a0e12226ba612e164fdd Mon Sep 17 00:00:00 2001 From: evanchooly Date: Thu, 24 Oct 2024 22:45:49 -0400 Subject: [PATCH 02/11] working on some rewrite stuff --- ...ewrite.java => PipelineRewriteStage1.java} | 46 +---------- .../rewrite/recipes/PipelineVisitor.java | 2 +- .../resources/META-INF/rewrite/morphia3.yml | 7 +- ...st.java => PipelineRewriteStage1Test.java} | 6 +- .../test/PipelineRewriteStage2Test.java | 77 +++++++++++++++++++ 5 files changed, 84 insertions(+), 54 deletions(-) rename rewrite/src/main/java/dev/morphia/rewrite/recipes/{PipelineRewrite.java => PipelineRewriteStage1.java} (69%) rename rewrite/src/test/java/dev/morphia/rewrite/recipes/test/{PipelineRewriteTest.java => PipelineRewriteStage1Test.java} (95%) create mode 100644 rewrite/src/test/java/dev/morphia/rewrite/recipes/test/PipelineRewriteStage2Test.java diff --git a/rewrite/src/main/java/dev/morphia/rewrite/recipes/PipelineRewrite.java b/rewrite/src/main/java/dev/morphia/rewrite/recipes/PipelineRewriteStage1.java similarity index 69% rename from rewrite/src/main/java/dev/morphia/rewrite/recipes/PipelineRewrite.java rename to rewrite/src/main/java/dev/morphia/rewrite/recipes/PipelineRewriteStage1.java index b4ba7a50a42..36e33c09492 100644 --- a/rewrite/src/main/java/dev/morphia/rewrite/recipes/PipelineRewrite.java +++ b/rewrite/src/main/java/dev/morphia/rewrite/recipes/PipelineRewriteStage1.java @@ -1,26 +1,19 @@ package dev.morphia.rewrite.recipes; -import java.util.ArrayList; -import java.util.Collections; import java.util.List; -import java.util.StringJoiner; import org.jetbrains.annotations.NotNull; import org.openrewrite.ExecutionContext; import org.openrewrite.Recipe; import org.openrewrite.TreeVisitor; import org.openrewrite.java.JavaIsoVisitor; -import org.openrewrite.java.JavaParser; -import org.openrewrite.java.JavaTemplate; import org.openrewrite.java.MethodMatcher; -import org.openrewrite.java.tree.Expression; -import org.openrewrite.java.tree.J; import org.openrewrite.java.tree.J.MethodInvocation; -public class PipelineRewrite extends Recipe { +public class PipelineRewriteStage1 extends Recipe { static final String AGGREGATION = "dev.morphia.aggregation.Aggregation"; - static final MethodMatcher pipeline = new MethodMatcher(PipelineRewrite.AGGREGATION + " pipeline(..)"); + static final MethodMatcher pipeline = new MethodMatcher(PipelineRewriteStage1.AGGREGATION + " pipeline(..)"); static final List matchers = List.of( new MethodMatcher(AGGREGATION + " addFields(dev.morphia.aggregation.stages.AddFields)"), new MethodMatcher(AGGREGATION + " autoBucket(dev.morphia.aggregation.stages.AutoBucket)"), @@ -74,7 +67,6 @@ public TreeVisitor getVisitor() { @Override public MethodInvocation visitMethodInvocation(MethodInvocation methodInvocation, @NotNull ExecutionContext context) { return working(methodInvocation, context); - // return notWorking(methodInvocation, context); } public MethodInvocation working(MethodInvocation methodInvocation, @NotNull ExecutionContext context) { @@ -87,40 +79,6 @@ public MethodInvocation working(MethodInvocation methodInvocation, @NotNull Exec } } - public MethodInvocation notWorking(MethodInvocation methodInvocation, @NotNull ExecutionContext context) { - if (matchers.stream().anyMatch(matcher -> matcher.matches(methodInvocation))) { - MethodInvocation mi = methodInvocation; - List arguments = new ArrayList<>(); - Expression expression = mi; - while (expression instanceof MethodInvocation invocation) { - arguments.add(invocation.getArguments().get(0)); - mi = invocation; - expression = mi.getSelect(); - } - Collections.reverse(arguments); - - return applyTemplate(expression, arguments, expression); - } else { - return super.visitMethodInvocation(methodInvocation, context); - - } - } - - private J.MethodInvocation applyTemplate(Expression expression, List arguments, Expression target) { - String code = buildTemplate(expression, arguments); - return JavaTemplate.builder(code) - .contextSensitive() - .javaParser(JavaParser.fromJavaVersion()) - .build() - .apply(getCursor(), target.getCoordinates().replace()); - } - - private String buildTemplate(Expression toReplace, List arguments) { - StringJoiner joiner = new StringJoiner(",\n\t", toReplace + ".pipeline(", ")"); - arguments.forEach(argument -> joiner.add(argument.toString())); - - return joiner.toString(); - } }; } } diff --git a/rewrite/src/main/java/dev/morphia/rewrite/recipes/PipelineVisitor.java b/rewrite/src/main/java/dev/morphia/rewrite/recipes/PipelineVisitor.java index 2c98bd10ca9..e108fbe17ee 100644 --- a/rewrite/src/main/java/dev/morphia/rewrite/recipes/PipelineVisitor.java +++ b/rewrite/src/main/java/dev/morphia/rewrite/recipes/PipelineVisitor.java @@ -10,7 +10,7 @@ class PipelineVisitor extends JavaIsoVisitor { @Override public MethodInvocation visitMethodInvocation(MethodInvocation methodInvocation, @NotNull ExecutionContext context) { - if (PipelineRewrite.pipeline.matches(methodInvocation)) { + if (PipelineRewriteStage1.pipeline.matches(methodInvocation)) { Expression select = methodInvocation.getSelect(); System.out.println("\n\nselect = " + select); System.out.println("select.getSideEffects() = " + select.getSideEffects()); diff --git a/rewrite/src/main/resources/META-INF/rewrite/morphia3.yml b/rewrite/src/main/resources/META-INF/rewrite/morphia3.yml index f0eb4381f23..32ccc062d3b 100644 --- a/rewrite/src/main/resources/META-INF/rewrite/morphia3.yml +++ b/rewrite/src/main/resources/META-INF/rewrite/morphia3.yml @@ -3,12 +3,7 @@ name: dev.morphia.UpgradeToMorphia30 displayName: Upgrade to Morphia 3.0 description: Adopt new dependencies and breaking changes in moving to Morphia 3. recipeList: - - org.openrewrite.java.ChangeMethodName: - methodPattern: dev.morphia.aggregation.stages.Out to(..) - newMethodName: out - matchOverrides: "true" - ignoreDefinition: "false" - - dev.morphia.rewrite.recipes.PipelineRewrite: + - dev.morphia.rewrite.recipes.PipelineRewriteStage1: matchOverrides: "true" ignoreDefinition: "false" - org.openrewrite.java.ChangeType: diff --git a/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/PipelineRewriteTest.java b/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/PipelineRewriteStage1Test.java similarity index 95% rename from rewrite/src/test/java/dev/morphia/rewrite/recipes/test/PipelineRewriteTest.java rename to rewrite/src/test/java/dev/morphia/rewrite/recipes/test/PipelineRewriteStage1Test.java index b7af7cbd90f..50429201249 100644 --- a/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/PipelineRewriteTest.java +++ b/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/PipelineRewriteStage1Test.java @@ -1,6 +1,6 @@ package dev.morphia.rewrite.recipes.test; -import dev.morphia.rewrite.recipes.PipelineRewrite; +import dev.morphia.rewrite.recipes.PipelineRewriteStage1; import org.jetbrains.annotations.NotNull; import org.junit.jupiter.api.Test; @@ -8,12 +8,12 @@ import static org.openrewrite.java.Assertions.java; -public class PipelineRewriteTest extends MorphiaRewriteTest { +public class PipelineRewriteStage1Test extends MorphiaRewriteTest { @Override @NotNull protected Recipe getRecipe() { - return new PipelineRewrite(); + return new PipelineRewriteStage1(); } @Test diff --git a/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/PipelineRewriteStage2Test.java b/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/PipelineRewriteStage2Test.java new file mode 100644 index 00000000000..9554c9dee77 --- /dev/null +++ b/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/PipelineRewriteStage2Test.java @@ -0,0 +1,77 @@ +package dev.morphia.rewrite.recipes.test; + +import dev.morphia.rewrite.recipes.PipelineRewriteStage1; +import org.jetbrains.annotations.NotNull; +import org.junit.jupiter.api.Test; +import org.openrewrite.Recipe; + +import static org.openrewrite.java.Assertions.java; + +public class PipelineRewriteStage2Test extends MorphiaRewriteTest { + + @Override + @NotNull + protected Recipe getRecipe() { + return new PipelineRewriteStage1(); + } + +// @Test + void unwrapStageMethods() { + rewriteRun( + //language=java + java( + """ + import dev.morphia.aggregation.expressions.ComparisonExpressions; + + import static dev.morphia.aggregation.expressions.AccumulatorExpressions.sum; + import static dev.morphia.aggregation.stages.Group.group; + import static dev.morphia.aggregation.stages.Group.id; + import static dev.morphia.aggregation.stages.Projection.project; + import static dev.morphia.aggregation.expressions.Expressions.field; + import static dev.morphia.aggregation.expressions.Expressions.value; + import static dev.morphia.aggregation.stages.Sort.sort; + + import dev.morphia.aggregation.Aggregation; + import org.bson.Document; + + public class UnwrapTest { + public void update(Aggregation aggregation) { + aggregation + .pipeline(group(id("author")).field("count", sum(value(1)))) + .pipeline(sort().ascending("1")) + .pipeline(sort().ascending("2")) + .pipeline(sort().ascending("3")) + .pipeline(sort().ascending("4")) + .execute(Document.class); + } + } + """, + """ + import dev.morphia.aggregation.expressions.ComparisonExpressions; + + import static dev.morphia.aggregation.expressions.AccumulatorExpressions.sum; + import static dev.morphia.aggregation.stages.Group.group; + import static dev.morphia.aggregation.stages.Group.id; + import static dev.morphia.aggregation.stages.Projection.project; + import static dev.morphia.aggregation.expressions.Expressions.field; + import static dev.morphia.aggregation.expressions.Expressions.value; + import static dev.morphia.aggregation.stages.Sort.sort; + + import dev.morphia.aggregation.Aggregation; + import org.bson.Document; + + public class UnwrapTest { + public void update(Aggregation aggregation) { + aggregation + .pipeline( + group(id("author")).field("count", sum(value(1))), + sort().ascending("1"), + sort().ascending("2"), + sort().ascending("3"), + sort().ascending("4")) + .execute(Document.class); + } + } + """)); + } +} From d9f5b7c3f9a744fb2032c387a36776a5c642c551 Mon Sep 17 00:00:00 2001 From: evanchooly Date: Mon, 11 Nov 2024 20:21:53 -0500 Subject: [PATCH 03/11] checkpointing. doesn't work just yet. --- .../dev/morphia/aggregation/Aggregation.java | 2 +- rewrite/pom.xml | 4 + .../recipes/PipelineRewriteStage1.java | 6 +- .../recipes/PipelineRewriteStage2.java | 150 +++++++++++++++++ .../resources/META-INF/rewrite/morphia3.yml | 3 + .../recipes/test/Morphia2RewriteTest.java | 18 +++ .../recipes/test/MorphiaRewriteTest.java | 60 +++---- .../test/PipelineRewriteStage1Test.java | 8 +- .../test/PipelineRewriteStage2Test.java | 152 +++++++++++------- .../rewrite/recipes/test/UnwrapFieldTest.java | 33 +++- rewrite/src/test/resources/logback-test.xml | 39 +++++ 11 files changed, 375 insertions(+), 100 deletions(-) create mode 100644 rewrite/src/main/java/dev/morphia/rewrite/recipes/PipelineRewriteStage2.java create mode 100644 rewrite/src/test/java/dev/morphia/rewrite/recipes/test/Morphia2RewriteTest.java create mode 100644 rewrite/src/test/resources/logback-test.xml diff --git a/core/src/main/java/dev/morphia/aggregation/Aggregation.java b/core/src/main/java/dev/morphia/aggregation/Aggregation.java index 1b5a5f91f48..263a6e1be8c 100644 --- a/core/src/main/java/dev/morphia/aggregation/Aggregation.java +++ b/core/src/main/java/dev/morphia/aggregation/Aggregation.java @@ -59,7 +59,7 @@ public interface Aggregation { /** * Execute the aggregation. This form and {@link #execute(AggregationOptions)} should be used for pipelines with $out and $merge - * that do no expect any results to be returned. + * that do not expect any results to be returned. * * @see #execute(AggregationOptions) */ diff --git a/rewrite/pom.xml b/rewrite/pom.xml index c323673cff1..50b7e08125c 100644 --- a/rewrite/pom.xml +++ b/rewrite/pom.xml @@ -87,6 +87,10 @@ ${morphia.prior.version} test + + ch.qos.logback + logback-classic + \ No newline at end of file diff --git a/rewrite/src/main/java/dev/morphia/rewrite/recipes/PipelineRewriteStage1.java b/rewrite/src/main/java/dev/morphia/rewrite/recipes/PipelineRewriteStage1.java index 36e33c09492..56402da7548 100644 --- a/rewrite/src/main/java/dev/morphia/rewrite/recipes/PipelineRewriteStage1.java +++ b/rewrite/src/main/java/dev/morphia/rewrite/recipes/PipelineRewriteStage1.java @@ -66,14 +66,10 @@ public TreeVisitor getVisitor() { @Override public MethodInvocation visitMethodInvocation(MethodInvocation methodInvocation, @NotNull ExecutionContext context) { - return working(methodInvocation, context); - } - - public MethodInvocation working(MethodInvocation methodInvocation, @NotNull ExecutionContext context) { if (matchers.stream().anyMatch(matcher -> matcher.matches(methodInvocation))) { return super.visitMethodInvocation(methodInvocation .withName(methodInvocation.getName().withSimpleName("pipeline")), - context); + context); } else { return super.visitMethodInvocation(methodInvocation, context); } diff --git a/rewrite/src/main/java/dev/morphia/rewrite/recipes/PipelineRewriteStage2.java b/rewrite/src/main/java/dev/morphia/rewrite/recipes/PipelineRewriteStage2.java new file mode 100644 index 00000000000..e0511bf098a --- /dev/null +++ b/rewrite/src/main/java/dev/morphia/rewrite/recipes/PipelineRewriteStage2.java @@ -0,0 +1,150 @@ +package dev.morphia.rewrite.recipes; + +import org.openrewrite.ExecutionContext; +import org.openrewrite.Preconditions; +import org.openrewrite.Recipe; +import org.openrewrite.TreeVisitor; +import org.openrewrite.java.JavaIsoVisitor; +import org.openrewrite.java.JavaTemplate; +import org.openrewrite.java.MethodMatcher; +import org.openrewrite.java.search.UsesMethod; +import org.openrewrite.java.tree.Expression; +import org.openrewrite.java.tree.J; +import org.openrewrite.java.tree.J.Block; +import org.openrewrite.java.tree.J.Identifier; +import org.openrewrite.java.tree.J.MethodInvocation; +import org.openrewrite.java.tree.JContainer; +import org.openrewrite.java.tree.JRightPadded; +import org.openrewrite.java.tree.Space; +import org.openrewrite.java.tree.Statement; +import org.openrewrite.marker.Markers; + +import java.lang.annotation.ElementType; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.UUID; + +import static java.util.List.of; +import static org.openrewrite.java.tree.JRightPadded.build; + +public class PipelineRewriteStage2 extends Recipe { + + static final String AGGREGATION = "dev.morphia.aggregation.Aggregation"; + + static final MethodMatcher PIPELINE = new MethodMatcher(PipelineRewriteStage2.AGGREGATION + " pipeline(..)"); + + private final JavaTemplate pipelineTemplate = null; //JavaTemplate.builder("pipeline(..)").contextSensitive().build(); + + @Override + public String getDisplayName() { + return "Aggregation pipeline rewrite"; + } + + @Override + public String getDescription() { + return "Rewrites an aggregation from using stage-named methods to using pipeline(Stage...)."; + } + + @Override + public TreeVisitor getVisitor() { + return Preconditions.check(new UsesMethod<>(PIPELINE), new JavaIsoVisitor<>() { + + public MethodInvocation visitMethodInvocation(MethodInvocation method, ExecutionContext p) { + // exit if method doesn't match isEqualTo(..) + if (!PIPELINE.matches(method.getSelect()/*.getMethodType()*/)) { + return method; + } + + var arguments = new ArrayList>(); + var select = method.getSelect(); + while (PIPELINE.matches(select)) { +// System.out.println("select = " + select); + J.MethodInvocation invocation = (J.MethodInvocation) select; + arguments.add(build(invocation.getArguments().get(0))); + select = invocation.getSelect(); + } + System.out.println("done: select = " + select); + Collections.reverse(arguments); + Markers markers = new Markers(UUID.randomUUID(), of()); + Identifier identifier = (Identifier) select; + Space prefix = method.getPrefix(); + var newInvocation = new MethodInvocation( + UUID.randomUUID(), prefix, markers, build(method.getSelect()), null, identifier, + JContainer.build(arguments), + method.getMethodType()); + return newInvocation; + } +/* + @Override + public J.Block visitBlock(J.Block block, ExecutionContext ctx) { + J.Block bl = super.visitBlock(block, ctx); + return bl.withStatements(rewritePipelineStatements(bl)); + } +*/ + +/* + private MethodInvocation rewritePipelineStatements(Block bl) { + List statements = new ArrayList<>(); + for (var statement : bl.getStatements()) { + if (statement instanceof J.MethodInvocation && isPipeline(statement)) { + List arguments = new ArrayList<>(); + J.MethodInvocation pipeline = (J.MethodInvocation) statement; + var select = pipeline.getSelect(); + while (PIPELINE.matches(select)) { + System.out.println("select = " + select); + J.MethodInvocation invocation = (J.MethodInvocation) select; + arguments.add(invocation.getArguments().get(0)); + select = invocation.getSelect(); + } + System.out.println("done: select = " + select); + Collections.reverse(arguments); +// Markers markers = new Markers(UUID.randomUUID(), of()); +// Identifier identifier = (Identifier) select; +// Space prefix = statement.getPrefix(); +// var newInvocation = new MethodInvocation( +// UUID.randomUUID(), prefix, markers, null, null, identifier, arguments, +// ((MethodInvocation) statement).getMethodType() ); + MethodInvocation m = pipelineTemplate.apply(getCursor(), statement.getCoordinates().replace()); + return m; + statements.add((newInvocation)); + } else { + statements.add(statement); + } + } + return statements; + } +*/ + + private boolean isPipeline(Statement statement) { + J.MethodInvocation methodInvocation = (J.MethodInvocation) statement; + // Only match method invocations where the select is an assertThat, containing a non-method call argument + if (PIPELINE.matches(methodInvocation.getSelect())) { + J.MethodInvocation invocation = (J.MethodInvocation) methodInvocation.getSelect(); + if (invocation != null && PIPELINE.matches(invocation.getSelect())) { + return true; + } + } + return false; + } + + private J.MethodInvocation getCollapsedAssertThat(List consecutiveAssertThatStatement) { + assert !consecutiveAssertThatStatement.isEmpty(); + Space originalPrefix = consecutiveAssertThatStatement.get(0).getPrefix(); + String continuationIndent = originalPrefix.getIndent().contains("\t") ? "\t\t" : " "; + Space indentedNewline = Space.format(originalPrefix.getLastWhitespace().replaceAll("^\\s+\n", "\n") + + continuationIndent); + J.MethodInvocation collapsed = null; + for (Statement st : consecutiveAssertThatStatement) { + J.MethodInvocation assertion = (J.MethodInvocation) st; + J.MethodInvocation assertThat = (J.MethodInvocation) assertion.getSelect(); + assert assertThat != null; + J.MethodInvocation newSelect = collapsed == null ? assertThat : collapsed; + collapsed = assertion.getPadding().withSelect(build((Expression) newSelect.withPrefix(Space.EMPTY)) + .withAfter(indentedNewline)); + } + return collapsed.withPrefix(originalPrefix); + } + }); + } +} diff --git a/rewrite/src/main/resources/META-INF/rewrite/morphia3.yml b/rewrite/src/main/resources/META-INF/rewrite/morphia3.yml index 32ccc062d3b..5eb0c253a39 100644 --- a/rewrite/src/main/resources/META-INF/rewrite/morphia3.yml +++ b/rewrite/src/main/resources/META-INF/rewrite/morphia3.yml @@ -6,6 +6,9 @@ recipeList: - dev.morphia.rewrite.recipes.PipelineRewriteStage1: matchOverrides: "true" ignoreDefinition: "false" + - dev.morphia.rewrite.recipes.PipelineRewriteStage2: + matchOverrides: "true" + ignoreDefinition: "false" - org.openrewrite.java.ChangeType: oldFullyQualifiedTypeName: dev.morphia.EntityInterceptor newFullyQualifiedTypeName: dev.morphia.EntityListener diff --git a/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/Morphia2RewriteTest.java b/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/Morphia2RewriteTest.java new file mode 100644 index 00000000000..29f47b3835f --- /dev/null +++ b/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/Morphia2RewriteTest.java @@ -0,0 +1,18 @@ +package dev.morphia.rewrite.recipes.test; + +import org.jetbrains.annotations.NotNull; + +public abstract class Morphia2RewriteTest extends MorphiaRewriteTest { + @Override + protected @NotNull String findMorphiaCore() { + var core = runtimeClasspath.stream() + .filter(uri -> { + String string = uri.toString(); + return string.contains("morphia") && string.contains("core"); + }) + .findFirst().orElseThrow().toString(); + + final String artifact = core.contains("morphia-core") ? "morphia-core" : "morphia/core"; + return artifact; + } +} diff --git a/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/MorphiaRewriteTest.java b/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/MorphiaRewriteTest.java index 0da5111c110..82c8d83fb5f 100644 --- a/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/MorphiaRewriteTest.java +++ b/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/MorphiaRewriteTest.java @@ -1,56 +1,46 @@ package dev.morphia.rewrite.recipes.test; -import java.io.File; -import java.net.URI; -import java.util.ArrayList; -import java.util.List; - +import io.github.classgraph.ClassGraph; import org.jetbrains.annotations.NotNull; import org.openrewrite.Recipe; import org.openrewrite.java.JavaParser; import org.openrewrite.test.RecipeSpec; import org.openrewrite.test.RewriteTest; -import io.github.classgraph.ClassGraph; +import java.io.File; +import java.net.URI; +import java.util.ArrayList; +import java.util.List; public abstract class MorphiaRewriteTest implements RewriteTest { - public static final String ARTIFACT; - - public static final List classpath; - - static { - List runtimeClasspath = new ClassGraph().disableNestedJarScanning().getClasspathURIs(); - classpath = runtimeClasspath.stream() - .filter(uri -> { - String string = uri.toString(); - return string.contains("mongodb") || string.contains("bson"); - }) - .map(uri -> { - return new File(uri).getName().replaceAll("-[0-9].*", ""); - }) - .collect(ArrayList::new, List::add, List::addAll); - var core = runtimeClasspath.stream() - .filter(uri -> { - String string = uri.toString(); - return string.contains("morphia") && string.contains("core"); - }) - .findFirst().orElseThrow().toString(); - if (core.contains("morphia-core")) { - ARTIFACT = "morphia-core"; - } else { - ARTIFACT = "morphia/core"; - } - - classpath.add(ARTIFACT); + protected List runtimeClasspath = new ClassGraph().disableNestedJarScanning().getClasspathURIs(); + + public String[] classpath() { + List classpath = findMongoArtifacts(); + + classpath.add(findMorphiaCore()); + return classpath.toArray(new String[0]); } @Override public void defaults(RecipeSpec spec) { spec.recipe(getRecipe()) .parser(JavaParser.fromJavaVersion() - .classpath(classpath.toArray(new String[0]))); + .classpath(classpath())); } + @NotNull + protected List findMongoArtifacts() { + List classpath = runtimeClasspath.stream() + .filter(uri -> uri.toString().contains("mongodb") || uri.toString().contains("bson")) + .map(uri -> new File(uri).getAbsolutePath()/*.getName().replaceAll("-[0-9].*", "")*/) + .collect(ArrayList::new, List::add, List::addAll); + return classpath; + } + + @NotNull + protected abstract String findMorphiaCore(); + @NotNull protected abstract Recipe getRecipe(); } diff --git a/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/PipelineRewriteStage1Test.java b/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/PipelineRewriteStage1Test.java index 50429201249..72bffe9fc2c 100644 --- a/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/PipelineRewriteStage1Test.java +++ b/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/PipelineRewriteStage1Test.java @@ -2,13 +2,19 @@ import dev.morphia.rewrite.recipes.PipelineRewriteStage1; +import io.github.classgraph.ClassGraph; import org.jetbrains.annotations.NotNull; import org.junit.jupiter.api.Test; import org.openrewrite.Recipe; +import java.io.File; +import java.net.URI; +import java.util.ArrayList; +import java.util.List; + import static org.openrewrite.java.Assertions.java; -public class PipelineRewriteStage1Test extends MorphiaRewriteTest { +public class PipelineRewriteStage1Test extends Morphia2RewriteTest { @Override @NotNull diff --git a/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/PipelineRewriteStage2Test.java b/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/PipelineRewriteStage2Test.java index 9554c9dee77..154ac47e45a 100644 --- a/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/PipelineRewriteStage2Test.java +++ b/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/PipelineRewriteStage2Test.java @@ -1,77 +1,115 @@ package dev.morphia.rewrite.recipes.test; -import dev.morphia.rewrite.recipes.PipelineRewriteStage1; +import dev.morphia.rewrite.recipes.PipelineRewriteStage2; import org.jetbrains.annotations.NotNull; import org.junit.jupiter.api.Test; import org.openrewrite.Recipe; +import org.openrewrite.java.JavaParser; +import org.openrewrite.java.JavaParser.Builder; +import org.openrewrite.test.RecipeSpec; + +import java.io.File; +import java.nio.file.Path; +import java.util.List; import static org.openrewrite.java.Assertions.java; public class PipelineRewriteStage2Test extends MorphiaRewriteTest { - @Override - @NotNull - protected Recipe getRecipe() { - return new PipelineRewriteStage1(); + private static final String classesFolder; + + static { + var root = new File(".").getAbsoluteFile(); + while (!new File(root, ".git").exists()) { + root = root.getParentFile(); + } + + classesFolder = new File(root, "core/target/classes").getAbsolutePath(); } -// @Test + @Test void unwrapStageMethods() { rewriteRun( - //language=java - java( - """ - import dev.morphia.aggregation.expressions.ComparisonExpressions; - - import static dev.morphia.aggregation.expressions.AccumulatorExpressions.sum; - import static dev.morphia.aggregation.stages.Group.group; - import static dev.morphia.aggregation.stages.Group.id; - import static dev.morphia.aggregation.stages.Projection.project; - import static dev.morphia.aggregation.expressions.Expressions.field; - import static dev.morphia.aggregation.expressions.Expressions.value; - import static dev.morphia.aggregation.stages.Sort.sort; + //language=java + java( + """ + import dev.morphia.aggregation.expressions.ComparisonExpressions; + + import static dev.morphia.aggregation.expressions.AccumulatorExpressions.sum; + import static dev.morphia.aggregation.stages.Group.group; + import static dev.morphia.aggregation.stages.Group.id; + import static dev.morphia.aggregation.stages.Projection.project; + import static dev.morphia.aggregation.expressions.Expressions.field; + import static dev.morphia.aggregation.expressions.Expressions.value; + import static dev.morphia.aggregation.stages.Sort.sort; + + import dev.morphia.aggregation.Aggregation; + import org.bson.Document; + + public class UnwrapTest { + public void update(Aggregation aggregation) { + aggregation + .pipeline(group(id("author")).field("count", sum(value(1)))) + .pipeline(sort().ascending("1")) + .pipeline(sort().ascending("2")) + .pipeline(sort().ascending("3")) + .pipeline(sort().ascending("4")) + .execute(Document.class); + var dummy = 42; + } + } + """, + """ + import dev.morphia.aggregation.expressions.ComparisonExpressions; + + import static dev.morphia.aggregation.expressions.AccumulatorExpressions.sum; + import static dev.morphia.aggregation.stages.Group.group; + import static dev.morphia.aggregation.stages.Group.id; + import static dev.morphia.aggregation.stages.Projection.project; + import static dev.morphia.aggregation.expressions.Expressions.field; + import static dev.morphia.aggregation.expressions.Expressions.value; + import static dev.morphia.aggregation.stages.Sort.sort; + + import dev.morphia.aggregation.Aggregation; + import org.bson.Document; + + public class UnwrapTest { + public void update(Aggregation aggregation) { + aggregation + .pipeline( + group(id("author")).field("count", sum(value(1))), + sort().ascending("1"), + sort().ascending("2"), + sort().ascending("3"), + sort().ascending("4")) + .execute(Document.class); + } + } + """)); + } @Override + protected @NotNull String findMorphiaCore() { + return classesFolder; + } - import dev.morphia.aggregation.Aggregation; - import org.bson.Document; + public String[] classpath() { + return findMongoArtifacts().toArray(new String[0]); + } - public class UnwrapTest { - public void update(Aggregation aggregation) { - aggregation - .pipeline(group(id("author")).field("count", sum(value(1)))) - .pipeline(sort().ascending("1")) - .pipeline(sort().ascending("2")) - .pipeline(sort().ascending("3")) - .pipeline(sort().ascending("4")) - .execute(Document.class); - } - } - """, - """ - import dev.morphia.aggregation.expressions.ComparisonExpressions; + @Override + public void defaults(RecipeSpec spec) { + Builder builder = JavaParser.fromJavaVersion() + .addClasspathEntry(Path.of(classesFolder)); + findMongoArtifacts().stream().map(Path::of) + .forEach(builder::addClasspathEntry); + spec.recipe(getRecipe()) + .parser(builder); + } - import static dev.morphia.aggregation.expressions.AccumulatorExpressions.sum; - import static dev.morphia.aggregation.stages.Group.group; - import static dev.morphia.aggregation.stages.Group.id; - import static dev.morphia.aggregation.stages.Projection.project; - import static dev.morphia.aggregation.expressions.Expressions.field; - import static dev.morphia.aggregation.expressions.Expressions.value; - import static dev.morphia.aggregation.stages.Sort.sort; + @Override + @NotNull + protected Recipe getRecipe() { + return new PipelineRewriteStage2(); + } - import dev.morphia.aggregation.Aggregation; - import org.bson.Document; - public class UnwrapTest { - public void update(Aggregation aggregation) { - aggregation - .pipeline( - group(id("author")).field("count", sum(value(1))), - sort().ascending("1"), - sort().ascending("2"), - sort().ascending("3"), - sort().ascending("4")) - .execute(Document.class); - } - } - """)); - } } diff --git a/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/UnwrapFieldTest.java b/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/UnwrapFieldTest.java index 25db7ceaaf5..f78a3303f0c 100644 --- a/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/UnwrapFieldTest.java +++ b/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/UnwrapFieldTest.java @@ -2,13 +2,44 @@ import dev.morphia.rewrite.recipes.UnwrapFieldExpressions; +import io.github.classgraph.ClassGraph; import org.jetbrains.annotations.NotNull; import org.junit.jupiter.api.Test; import org.openrewrite.Recipe; +import java.io.File; +import java.net.URI; +import java.util.ArrayList; +import java.util.List; + import static org.openrewrite.java.Assertions.java; -public class UnwrapFieldTest extends MorphiaRewriteTest { +public class UnwrapFieldTest extends Morphia2RewriteTest { + + @Override + public String[] classpath() { + List runtimeClasspath = new ClassGraph().disableNestedJarScanning().getClasspathURIs(); + List classpath = runtimeClasspath.stream() + .filter(uri -> { + String string = uri.toString(); + return string.contains("mongodb") || string.contains("bson"); + }) + .map(uri -> { + return new File(uri).getName().replaceAll("-[0-9].*", ""); + }) + .collect(ArrayList::new, List::add, List::addAll); + var core = runtimeClasspath.stream() + .filter(uri -> { + String string = uri.toString(); + return string.contains("morphia") && string.contains("core"); + }) + .findFirst().orElseThrow().toString(); + + final String artifact = core.contains("morphia-core") ? "morphia-core" : "morphia/core"; + + classpath.add(artifact); + return classpath.toArray(new String[0]); + } @Override @NotNull diff --git a/rewrite/src/test/resources/logback-test.xml b/rewrite/src/test/resources/logback-test.xml new file mode 100644 index 00000000000..e65a3b44546 --- /dev/null +++ b/rewrite/src/test/resources/logback-test.xml @@ -0,0 +1,39 @@ + + + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{40} - %msg%n + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From b9e37c6d0864d51ce7b24fcdc368d2dc0faa2ac9 Mon Sep 17 00:00:00 2001 From: evanchooly Date: Mon, 11 Nov 2024 20:55:51 -0500 Subject: [PATCH 04/11] stage 2 works. need to fix classpath for stage 1 test. --- .../recipes/PipelineRewriteStage1.java | 2 +- .../recipes/PipelineRewriteStage2.java | 125 +++-------------- .../recipes/test/Morphia2RewriteTest.java | 10 +- .../recipes/test/MorphiaRewriteTest.java | 17 +-- .../test/PipelineRewriteStage1Test.java | 6 - .../test/PipelineRewriteStage2Test.java | 127 +++++++++--------- .../rewrite/recipes/test/UnwrapFieldTest.java | 17 +-- 7 files changed, 100 insertions(+), 204 deletions(-) diff --git a/rewrite/src/main/java/dev/morphia/rewrite/recipes/PipelineRewriteStage1.java b/rewrite/src/main/java/dev/morphia/rewrite/recipes/PipelineRewriteStage1.java index 56402da7548..f57977eae21 100644 --- a/rewrite/src/main/java/dev/morphia/rewrite/recipes/PipelineRewriteStage1.java +++ b/rewrite/src/main/java/dev/morphia/rewrite/recipes/PipelineRewriteStage1.java @@ -69,7 +69,7 @@ public MethodInvocation visitMethodInvocation(MethodInvocation methodInvocation, if (matchers.stream().anyMatch(matcher -> matcher.matches(methodInvocation))) { return super.visitMethodInvocation(methodInvocation .withName(methodInvocation.getName().withSimpleName("pipeline")), - context); + context); } else { return super.visitMethodInvocation(methodInvocation, context); } diff --git a/rewrite/src/main/java/dev/morphia/rewrite/recipes/PipelineRewriteStage2.java b/rewrite/src/main/java/dev/morphia/rewrite/recipes/PipelineRewriteStage2.java index e0511bf098a..b793ba4108b 100644 --- a/rewrite/src/main/java/dev/morphia/rewrite/recipes/PipelineRewriteStage2.java +++ b/rewrite/src/main/java/dev/morphia/rewrite/recipes/PipelineRewriteStage2.java @@ -1,40 +1,21 @@ package dev.morphia.rewrite.recipes; +import java.util.ArrayList; + import org.openrewrite.ExecutionContext; import org.openrewrite.Preconditions; import org.openrewrite.Recipe; import org.openrewrite.TreeVisitor; import org.openrewrite.java.JavaIsoVisitor; -import org.openrewrite.java.JavaTemplate; import org.openrewrite.java.MethodMatcher; import org.openrewrite.java.search.UsesMethod; -import org.openrewrite.java.tree.Expression; -import org.openrewrite.java.tree.J; -import org.openrewrite.java.tree.J.Block; -import org.openrewrite.java.tree.J.Identifier; import org.openrewrite.java.tree.J.MethodInvocation; -import org.openrewrite.java.tree.JContainer; -import org.openrewrite.java.tree.JRightPadded; -import org.openrewrite.java.tree.Space; -import org.openrewrite.java.tree.Statement; -import org.openrewrite.marker.Markers; - -import java.lang.annotation.ElementType; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.UUID; - -import static java.util.List.of; -import static org.openrewrite.java.tree.JRightPadded.build; public class PipelineRewriteStage2 extends Recipe { - static final String AGGREGATION = "dev.morphia.aggregation.Aggregation"; - - static final MethodMatcher PIPELINE = new MethodMatcher(PipelineRewriteStage2.AGGREGATION + " pipeline(..)"); + private static final String AGGREGATION = "dev.morphia.aggregation.Aggregation"; - private final JavaTemplate pipelineTemplate = null; //JavaTemplate.builder("pipeline(..)").contextSensitive().build(); + private static final MethodMatcher PIPELINE = new MethodMatcher(PipelineRewriteStage2.AGGREGATION + " pipeline(..)"); @Override public String getDisplayName() { @@ -51,100 +32,24 @@ public TreeVisitor getVisitor() { return Preconditions.check(new UsesMethod<>(PIPELINE), new JavaIsoVisitor<>() { public MethodInvocation visitMethodInvocation(MethodInvocation method, ExecutionContext p) { - // exit if method doesn't match isEqualTo(..) - if (!PIPELINE.matches(method.getSelect()/*.getMethodType()*/)) { + if (!PIPELINE.matches(method.getSelect())) { return method; } - var arguments = new ArrayList>(); - var select = method.getSelect(); - while (PIPELINE.matches(select)) { -// System.out.println("select = " + select); - J.MethodInvocation invocation = (J.MethodInvocation) select; - arguments.add(build(invocation.getArguments().get(0))); - select = invocation.getSelect(); - } - System.out.println("done: select = " + select); - Collections.reverse(arguments); - Markers markers = new Markers(UUID.randomUUID(), of()); - Identifier identifier = (Identifier) select; - Space prefix = method.getPrefix(); - var newInvocation = new MethodInvocation( - UUID.randomUUID(), prefix, markers, build(method.getSelect()), null, identifier, - JContainer.build(arguments), - method.getMethodType()); - return newInvocation; - } -/* - @Override - public J.Block visitBlock(J.Block block, ExecutionContext ctx) { - J.Block bl = super.visitBlock(block, ctx); - return bl.withStatements(rewritePipelineStatements(bl)); - } -*/ - -/* - private MethodInvocation rewritePipelineStatements(Block bl) { - List statements = new ArrayList<>(); - for (var statement : bl.getStatements()) { - if (statement instanceof J.MethodInvocation && isPipeline(statement)) { - List arguments = new ArrayList<>(); - J.MethodInvocation pipeline = (J.MethodInvocation) statement; - var select = pipeline.getSelect(); - while (PIPELINE.matches(select)) { - System.out.println("select = " + select); - J.MethodInvocation invocation = (J.MethodInvocation) select; - arguments.add(invocation.getArguments().get(0)); - select = invocation.getSelect(); - } - System.out.println("done: select = " + select); - Collections.reverse(arguments); -// Markers markers = new Markers(UUID.randomUUID(), of()); -// Identifier identifier = (Identifier) select; -// Space prefix = statement.getPrefix(); -// var newInvocation = new MethodInvocation( -// UUID.randomUUID(), prefix, markers, null, null, identifier, arguments, -// ((MethodInvocation) statement).getMethodType() ); - MethodInvocation m = pipelineTemplate.apply(getCursor(), statement.getCoordinates().replace()); - return m; - statements.add((newInvocation)); - } else { - statements.add(statement); - } - } - return statements; - } -*/ - - private boolean isPipeline(Statement statement) { - J.MethodInvocation methodInvocation = (J.MethodInvocation) statement; - // Only match method invocations where the select is an assertThat, containing a non-method call argument - if (PIPELINE.matches(methodInvocation.getSelect())) { - J.MethodInvocation invocation = (J.MethodInvocation) methodInvocation.getSelect(); - if (invocation != null && PIPELINE.matches(invocation.getSelect())) { - return true; + var updated = method; + while (PIPELINE.matches(updated.getSelect()) && PIPELINE.matches(((MethodInvocation) updated.getSelect()).getSelect())) { + var select = updated.getSelect(); + MethodInvocation invocation = (MethodInvocation) select; + if (PIPELINE.matches(invocation.getSelect())) { + MethodInvocation parent = (MethodInvocation) invocation.getSelect(); + var args = new ArrayList<>(parent.getArguments()); + args.addAll(invocation.getArguments()); + updated = updated.withSelect(((MethodInvocation) invocation.getSelect()).withArguments(args)); } } - return false; + return updated; } - private J.MethodInvocation getCollapsedAssertThat(List consecutiveAssertThatStatement) { - assert !consecutiveAssertThatStatement.isEmpty(); - Space originalPrefix = consecutiveAssertThatStatement.get(0).getPrefix(); - String continuationIndent = originalPrefix.getIndent().contains("\t") ? "\t\t" : " "; - Space indentedNewline = Space.format(originalPrefix.getLastWhitespace().replaceAll("^\\s+\n", "\n") + - continuationIndent); - J.MethodInvocation collapsed = null; - for (Statement st : consecutiveAssertThatStatement) { - J.MethodInvocation assertion = (J.MethodInvocation) st; - J.MethodInvocation assertThat = (J.MethodInvocation) assertion.getSelect(); - assert assertThat != null; - J.MethodInvocation newSelect = collapsed == null ? assertThat : collapsed; - collapsed = assertion.getPadding().withSelect(build((Expression) newSelect.withPrefix(Space.EMPTY)) - .withAfter(indentedNewline)); - } - return collapsed.withPrefix(originalPrefix); - } }); } } diff --git a/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/Morphia2RewriteTest.java b/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/Morphia2RewriteTest.java index 29f47b3835f..5935c34f402 100644 --- a/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/Morphia2RewriteTest.java +++ b/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/Morphia2RewriteTest.java @@ -6,11 +6,11 @@ public abstract class Morphia2RewriteTest extends MorphiaRewriteTest { @Override protected @NotNull String findMorphiaCore() { var core = runtimeClasspath.stream() - .filter(uri -> { - String string = uri.toString(); - return string.contains("morphia") && string.contains("core"); - }) - .findFirst().orElseThrow().toString(); + .filter(uri -> { + String string = uri.toString(); + return string.contains("morphia") && string.contains("core"); + }) + .findFirst().orElseThrow().toString(); final String artifact = core.contains("morphia-core") ? "morphia-core" : "morphia/core"; return artifact; diff --git a/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/MorphiaRewriteTest.java b/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/MorphiaRewriteTest.java index 82c8d83fb5f..9038ebe4fec 100644 --- a/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/MorphiaRewriteTest.java +++ b/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/MorphiaRewriteTest.java @@ -1,16 +1,17 @@ package dev.morphia.rewrite.recipes.test; -import io.github.classgraph.ClassGraph; +import java.io.File; +import java.net.URI; +import java.util.ArrayList; +import java.util.List; + import org.jetbrains.annotations.NotNull; import org.openrewrite.Recipe; import org.openrewrite.java.JavaParser; import org.openrewrite.test.RecipeSpec; import org.openrewrite.test.RewriteTest; -import java.io.File; -import java.net.URI; -import java.util.ArrayList; -import java.util.List; +import io.github.classgraph.ClassGraph; public abstract class MorphiaRewriteTest implements RewriteTest { protected List runtimeClasspath = new ClassGraph().disableNestedJarScanning().getClasspathURIs(); @@ -32,9 +33,9 @@ public void defaults(RecipeSpec spec) { @NotNull protected List findMongoArtifacts() { List classpath = runtimeClasspath.stream() - .filter(uri -> uri.toString().contains("mongodb") || uri.toString().contains("bson")) - .map(uri -> new File(uri).getAbsolutePath()/*.getName().replaceAll("-[0-9].*", "")*/) - .collect(ArrayList::new, List::add, List::addAll); + .filter(uri -> uri.toString().contains("mongodb") || uri.toString().contains("bson")) + .map(uri -> new File(uri).getAbsolutePath()/* .getName().replaceAll("-[0-9].*", "") */) + .collect(ArrayList::new, List::add, List::addAll); return classpath; } diff --git a/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/PipelineRewriteStage1Test.java b/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/PipelineRewriteStage1Test.java index 72bffe9fc2c..8dfeb8df303 100644 --- a/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/PipelineRewriteStage1Test.java +++ b/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/PipelineRewriteStage1Test.java @@ -2,16 +2,10 @@ import dev.morphia.rewrite.recipes.PipelineRewriteStage1; -import io.github.classgraph.ClassGraph; import org.jetbrains.annotations.NotNull; import org.junit.jupiter.api.Test; import org.openrewrite.Recipe; -import java.io.File; -import java.net.URI; -import java.util.ArrayList; -import java.util.List; - import static org.openrewrite.java.Assertions.java; public class PipelineRewriteStage1Test extends Morphia2RewriteTest { diff --git a/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/PipelineRewriteStage2Test.java b/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/PipelineRewriteStage2Test.java index 154ac47e45a..b59c3f79697 100644 --- a/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/PipelineRewriteStage2Test.java +++ b/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/PipelineRewriteStage2Test.java @@ -1,6 +1,10 @@ package dev.morphia.rewrite.recipes.test; +import java.io.File; +import java.nio.file.Path; + import dev.morphia.rewrite.recipes.PipelineRewriteStage2; + import org.jetbrains.annotations.NotNull; import org.junit.jupiter.api.Test; import org.openrewrite.Recipe; @@ -8,10 +12,6 @@ import org.openrewrite.java.JavaParser.Builder; import org.openrewrite.test.RecipeSpec; -import java.io.File; -import java.nio.file.Path; -import java.util.List; - import static org.openrewrite.java.Assertions.java; public class PipelineRewriteStage2Test extends MorphiaRewriteTest { @@ -30,65 +30,61 @@ public class PipelineRewriteStage2Test extends MorphiaRewriteTest { @Test void unwrapStageMethods() { rewriteRun( - //language=java - java( - """ - import dev.morphia.aggregation.expressions.ComparisonExpressions; - - import static dev.morphia.aggregation.expressions.AccumulatorExpressions.sum; - import static dev.morphia.aggregation.stages.Group.group; - import static dev.morphia.aggregation.stages.Group.id; - import static dev.morphia.aggregation.stages.Projection.project; - import static dev.morphia.aggregation.expressions.Expressions.field; - import static dev.morphia.aggregation.expressions.Expressions.value; - import static dev.morphia.aggregation.stages.Sort.sort; - - import dev.morphia.aggregation.Aggregation; - import org.bson.Document; - - public class UnwrapTest { - public void update(Aggregation aggregation) { - aggregation - .pipeline(group(id("author")).field("count", sum(value(1)))) - .pipeline(sort().ascending("1")) - .pipeline(sort().ascending("2")) - .pipeline(sort().ascending("3")) - .pipeline(sort().ascending("4")) - .execute(Document.class); - var dummy = 42; - } - } - """, - """ - import dev.morphia.aggregation.expressions.ComparisonExpressions; - - import static dev.morphia.aggregation.expressions.AccumulatorExpressions.sum; - import static dev.morphia.aggregation.stages.Group.group; - import static dev.morphia.aggregation.stages.Group.id; - import static dev.morphia.aggregation.stages.Projection.project; - import static dev.morphia.aggregation.expressions.Expressions.field; - import static dev.morphia.aggregation.expressions.Expressions.value; - import static dev.morphia.aggregation.stages.Sort.sort; - - import dev.morphia.aggregation.Aggregation; - import org.bson.Document; - - public class UnwrapTest { - public void update(Aggregation aggregation) { - aggregation - .pipeline( - group(id("author")).field("count", sum(value(1))), - sort().ascending("1"), - sort().ascending("2"), - sort().ascending("3"), - sort().ascending("4")) - .execute(Document.class); - } - } - """)); - } @Override + //language=java + java( + """ + import dev.morphia.aggregation.expressions.ComparisonExpressions; + + import static dev.morphia.aggregation.expressions.AccumulatorExpressions.sum; + import static dev.morphia.aggregation.stages.Group.group; + import static dev.morphia.aggregation.stages.Group.id; + import static dev.morphia.aggregation.stages.Projection.project; + import static dev.morphia.aggregation.expressions.Expressions.field; + import static dev.morphia.aggregation.expressions.Expressions.value; + import static dev.morphia.aggregation.stages.Sort.sort; + + import dev.morphia.aggregation.Aggregation; + import org.bson.Document; + + public class UnwrapTest { + public void update(Aggregation aggregation) { + aggregation + .pipeline(group(id("author")).field("count", sum(value(1)))) + .pipeline(sort().ascending("1")) + .pipeline(sort().ascending("2")) + .pipeline(sort().ascending("3")) + .pipeline(sort().ascending("4")) + .execute(Document.class); + } + } + """, + """ + import dev.morphia.aggregation.expressions.ComparisonExpressions; + + import static dev.morphia.aggregation.expressions.AccumulatorExpressions.sum; + import static dev.morphia.aggregation.stages.Group.group; + import static dev.morphia.aggregation.stages.Group.id; + import static dev.morphia.aggregation.stages.Projection.project; + import static dev.morphia.aggregation.expressions.Expressions.field; + import static dev.morphia.aggregation.expressions.Expressions.value; + import static dev.morphia.aggregation.stages.Sort.sort; + + import dev.morphia.aggregation.Aggregation; + import org.bson.Document; + + public class UnwrapTest { + public void update(Aggregation aggregation) { + aggregation + .pipeline(group(id("author")).field("count", sum(value(1))),sort().ascending("1"),sort().ascending("2"),sort().ascending("3"),sort().ascending("4")) + .execute(Document.class); + } + } + """)); + } + + @Override protected @NotNull String findMorphiaCore() { - return classesFolder; + return classesFolder; } public String[] classpath() { @@ -98,11 +94,11 @@ public String[] classpath() { @Override public void defaults(RecipeSpec spec) { Builder builder = JavaParser.fromJavaVersion() - .addClasspathEntry(Path.of(classesFolder)); + .addClasspathEntry(Path.of(classesFolder)); findMongoArtifacts().stream().map(Path::of) - .forEach(builder::addClasspathEntry); + .forEach(builder::addClasspathEntry); spec.recipe(getRecipe()) - .parser(builder); + .parser(builder); } @Override @@ -111,5 +107,4 @@ protected Recipe getRecipe() { return new PipelineRewriteStage2(); } - } diff --git a/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/UnwrapFieldTest.java b/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/UnwrapFieldTest.java index f78a3303f0c..06dd1d19a05 100644 --- a/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/UnwrapFieldTest.java +++ b/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/UnwrapFieldTest.java @@ -1,16 +1,17 @@ package dev.morphia.rewrite.recipes.test; +import java.io.File; +import java.net.URI; +import java.util.ArrayList; +import java.util.List; + import dev.morphia.rewrite.recipes.UnwrapFieldExpressions; -import io.github.classgraph.ClassGraph; import org.jetbrains.annotations.NotNull; import org.junit.jupiter.api.Test; import org.openrewrite.Recipe; -import java.io.File; -import java.net.URI; -import java.util.ArrayList; -import java.util.List; +import io.github.classgraph.ClassGraph; import static org.openrewrite.java.Assertions.java; @@ -20,14 +21,14 @@ public class UnwrapFieldTest extends Morphia2RewriteTest { public String[] classpath() { List runtimeClasspath = new ClassGraph().disableNestedJarScanning().getClasspathURIs(); List classpath = runtimeClasspath.stream() - .filter(uri -> { + .filter(uri -> { String string = uri.toString(); return string.contains("mongodb") || string.contains("bson"); }) - .map(uri -> { + .map(uri -> { return new File(uri).getName().replaceAll("-[0-9].*", ""); }) - .collect(ArrayList::new, List::add, List::addAll); + .collect(ArrayList::new, List::add, List::addAll); var core = runtimeClasspath.stream() .filter(uri -> { String string = uri.toString(); From 75dd250b397dfc091d5ee7f1aeb2a8cdbfd223a5 Mon Sep 17 00:00:00 2001 From: evanchooly Date: Mon, 11 Nov 2024 21:13:37 -0500 Subject: [PATCH 05/11] recipes now working. --- .../recipes/test/Morphia2RewriteTest.java | 14 ----- .../recipes/test/MorphiaRewriteTest.java | 35 +++++++---- .../test/PipelineRewriteStage1Test.java | 2 +- .../test/PipelineRewriteStage2Test.java | 22 ++++--- .../rewrite/recipes/test/UnwrapFieldTest.java | 61 +++++++++---------- 5 files changed, 64 insertions(+), 70 deletions(-) diff --git a/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/Morphia2RewriteTest.java b/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/Morphia2RewriteTest.java index 5935c34f402..7bc2f16a981 100644 --- a/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/Morphia2RewriteTest.java +++ b/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/Morphia2RewriteTest.java @@ -1,18 +1,4 @@ package dev.morphia.rewrite.recipes.test; -import org.jetbrains.annotations.NotNull; - public abstract class Morphia2RewriteTest extends MorphiaRewriteTest { - @Override - protected @NotNull String findMorphiaCore() { - var core = runtimeClasspath.stream() - .filter(uri -> { - String string = uri.toString(); - return string.contains("morphia") && string.contains("core"); - }) - .findFirst().orElseThrow().toString(); - - final String artifact = core.contains("morphia-core") ? "morphia-core" : "morphia/core"; - return artifact; - } } diff --git a/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/MorphiaRewriteTest.java b/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/MorphiaRewriteTest.java index 9038ebe4fec..34f1220f9f7 100644 --- a/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/MorphiaRewriteTest.java +++ b/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/MorphiaRewriteTest.java @@ -2,12 +2,14 @@ import java.io.File; import java.net.URI; +import java.nio.file.Path; import java.util.ArrayList; import java.util.List; import org.jetbrains.annotations.NotNull; import org.openrewrite.Recipe; import org.openrewrite.java.JavaParser; +import org.openrewrite.java.JavaParser.Builder; import org.openrewrite.test.RecipeSpec; import org.openrewrite.test.RewriteTest; @@ -16,31 +18,38 @@ public abstract class MorphiaRewriteTest implements RewriteTest { protected List runtimeClasspath = new ClassGraph().disableNestedJarScanning().getClasspathURIs(); - public String[] classpath() { - List classpath = findMongoArtifacts(); - - classpath.add(findMorphiaCore()); - return classpath.toArray(new String[0]); - } - @Override public void defaults(RecipeSpec spec) { + // spec.recipe(getRecipe()) + // .parser(JavaParser.fromJavaVersion() + // .classpath(classpath())); + + Builder builder = JavaParser.fromJavaVersion() + .addClasspathEntry(Path.of(findMorphiaCore())); + findMongoDependencies().stream() + .map(Path::of) + .forEach(builder::addClasspathEntry); spec.recipe(getRecipe()) - .parser(JavaParser.fromJavaVersion() - .classpath(classpath())); + .parser(builder); } @NotNull - protected List findMongoArtifacts() { + protected List findMongoDependencies() { List classpath = runtimeClasspath.stream() .filter(uri -> uri.toString().contains("mongodb") || uri.toString().contains("bson")) - .map(uri -> new File(uri).getAbsolutePath()/* .getName().replaceAll("-[0-9].*", "") */) + .map(uri -> new File(uri).getAbsolutePath()) .collect(ArrayList::new, List::add, List::addAll); return classpath; } - @NotNull - protected abstract String findMorphiaCore(); + protected @NotNull String findMorphiaCore() { + var core = runtimeClasspath.stream() + .filter(uri -> uri.toString().contains("morphia-core")) + .map(uri -> new File(uri).getAbsolutePath()) + .findFirst().orElseThrow().toString(); + + return core; + } @NotNull protected abstract Recipe getRecipe(); diff --git a/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/PipelineRewriteStage1Test.java b/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/PipelineRewriteStage1Test.java index 8dfeb8df303..50429201249 100644 --- a/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/PipelineRewriteStage1Test.java +++ b/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/PipelineRewriteStage1Test.java @@ -8,7 +8,7 @@ import static org.openrewrite.java.Assertions.java; -public class PipelineRewriteStage1Test extends Morphia2RewriteTest { +public class PipelineRewriteStage1Test extends MorphiaRewriteTest { @Override @NotNull diff --git a/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/PipelineRewriteStage2Test.java b/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/PipelineRewriteStage2Test.java index b59c3f79697..b18f1945c28 100644 --- a/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/PipelineRewriteStage2Test.java +++ b/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/PipelineRewriteStage2Test.java @@ -82,20 +82,24 @@ public void update(Aggregation aggregation) { """)); } - @Override - protected @NotNull String findMorphiaCore() { - return classesFolder; - } - - public String[] classpath() { - return findMongoArtifacts().toArray(new String[0]); - } + /* + * @Override + * protected @NotNull String findMorphiaCore() { + * return classesFolder; + * } + */ + + /* + * public String[] classpath() { + * return findMongoArtifacts().toArray(new String[0]); + * } + */ @Override public void defaults(RecipeSpec spec) { Builder builder = JavaParser.fromJavaVersion() .addClasspathEntry(Path.of(classesFolder)); - findMongoArtifacts().stream().map(Path::of) + findMongoDependencies().stream().map(Path::of) .forEach(builder::addClasspathEntry); spec.recipe(getRecipe()) .parser(builder); diff --git a/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/UnwrapFieldTest.java b/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/UnwrapFieldTest.java index 06dd1d19a05..a5662daeed3 100644 --- a/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/UnwrapFieldTest.java +++ b/rewrite/src/test/java/dev/morphia/rewrite/recipes/test/UnwrapFieldTest.java @@ -1,46 +1,41 @@ package dev.morphia.rewrite.recipes.test; -import java.io.File; -import java.net.URI; -import java.util.ArrayList; -import java.util.List; - import dev.morphia.rewrite.recipes.UnwrapFieldExpressions; import org.jetbrains.annotations.NotNull; import org.junit.jupiter.api.Test; import org.openrewrite.Recipe; -import io.github.classgraph.ClassGraph; - import static org.openrewrite.java.Assertions.java; -public class UnwrapFieldTest extends Morphia2RewriteTest { - - @Override - public String[] classpath() { - List runtimeClasspath = new ClassGraph().disableNestedJarScanning().getClasspathURIs(); - List classpath = runtimeClasspath.stream() - .filter(uri -> { - String string = uri.toString(); - return string.contains("mongodb") || string.contains("bson"); - }) - .map(uri -> { - return new File(uri).getName().replaceAll("-[0-9].*", ""); - }) - .collect(ArrayList::new, List::add, List::addAll); - var core = runtimeClasspath.stream() - .filter(uri -> { - String string = uri.toString(); - return string.contains("morphia") && string.contains("core"); - }) - .findFirst().orElseThrow().toString(); - - final String artifact = core.contains("morphia-core") ? "morphia-core" : "morphia/core"; - - classpath.add(artifact); - return classpath.toArray(new String[0]); - } +public class UnwrapFieldTest extends MorphiaRewriteTest { + + /* + * @Override + * public String[] classpath() { + * List runtimeClasspath = new ClassGraph().disableNestedJarScanning().getClasspathURIs(); + * List classpath = runtimeClasspath.stream() + * .filter(uri -> { + * String string = uri.toString(); + * return string.contains("mongodb") || string.contains("bson"); + * }) + * .map(uri -> { + * return new File(uri).getName().replaceAll("-[0-9].*", ""); + * }) + * .collect(ArrayList::new, List::add, List::addAll); + * var core = runtimeClasspath.stream() + * .filter(uri -> { + * String string = uri.toString(); + * return string.contains("morphia") && string.contains("core"); + * }) + * .findFirst().orElseThrow().toString(); + * + * final String artifact = core.contains("morphia-core") ? "morphia-core" : "morphia/core"; + * + * classpath.add(artifact); + * return classpath.toArray(new String[0]); + * } + */ @Override @NotNull From 5d750285266116bfded7ccb5acdaff3aea480811 Mon Sep 17 00:00:00 2001 From: evanchooly Date: Mon, 11 Nov 2024 21:39:55 -0500 Subject: [PATCH 06/11] include the develocity info --- .github/workflows/pull-request.yml | 2 ++ .../java/dev/morphia/rewrite/recipes/PipelineRewriteStage2.java | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 4f2f284848d..c02b4dc4da2 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -8,5 +8,7 @@ on: jobs: Build: uses: evanchooly/workflows/.github/workflows/pull-request.yml@master + secrets: + DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }} with: java: 17 diff --git a/rewrite/src/main/java/dev/morphia/rewrite/recipes/PipelineRewriteStage2.java b/rewrite/src/main/java/dev/morphia/rewrite/recipes/PipelineRewriteStage2.java index b793ba4108b..8bb8f9980de 100644 --- a/rewrite/src/main/java/dev/morphia/rewrite/recipes/PipelineRewriteStage2.java +++ b/rewrite/src/main/java/dev/morphia/rewrite/recipes/PipelineRewriteStage2.java @@ -31,7 +31,7 @@ public String getDescription() { public TreeVisitor getVisitor() { return Preconditions.check(new UsesMethod<>(PIPELINE), new JavaIsoVisitor<>() { - public MethodInvocation visitMethodInvocation(MethodInvocation method, ExecutionContext p) { + public MethodInvocation visitMethodInvocation(MethodInvocation method, ExecutionContext ignored) { if (!PIPELINE.matches(method.getSelect())) { return method; } From 227b1d3b0ec404d2a0a6a49dda85fbaf79a9d905 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Nov 2024 02:53:40 +0000 Subject: [PATCH 07/11] Bump ksp.version from 2.0.21-1.0.25 to 2.0.21-1.0.27 Bumps `ksp.version` from 2.0.21-1.0.25 to 2.0.21-1.0.27. Updates `com.google.devtools.ksp:symbol-processing-api` from 2.0.21-1.0.25 to 2.0.21-1.0.27 - [Release notes](https://github.com/google/ksp/releases) - [Commits](https://github.com/google/ksp/compare/2.0.21-1.0.25...2.0.21-1.0.27) Updates `com.google.devtools.ksp:symbol-processing-common-deps` from 2.0.21-1.0.25 to 2.0.21-1.0.27 - [Release notes](https://github.com/google/ksp/releases) - [Commits](https://github.com/google/ksp/compare/2.0.21-1.0.25...2.0.21-1.0.27) Updates `com.google.devtools.ksp:symbol-processing-aa-embeddable` from 2.0.21-1.0.25 to 2.0.21-1.0.27 - [Release notes](https://github.com/google/ksp/releases) - [Commits](https://github.com/google/ksp/compare/2.0.21-1.0.25...2.0.21-1.0.27) --- updated-dependencies: - dependency-name: com.google.devtools.ksp:symbol-processing-api dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: com.google.devtools.ksp:symbol-processing-common-deps dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: com.google.devtools.ksp:symbol-processing-aa-embeddable dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- critter/core/pom.xml | 6 +++--- pom.xml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/critter/core/pom.xml b/critter/core/pom.xml index 008d85b2cd4..ac6616557d6 100644 --- a/critter/core/pom.xml +++ b/critter/core/pom.xml @@ -54,17 +54,17 @@ com.google.devtools.ksp symbol-processing-api - 2.0.21-1.0.25 + 2.0.21-1.0.27 com.google.devtools.ksp symbol-processing-common-deps - 2.0.21-1.0.25 + 2.0.21-1.0.27 com.google.devtools.ksp symbol-processing-aa-embeddable - 2.0.21-1.0.25 + 2.0.21-1.0.27 org.jboss.forge.roaster diff --git a/pom.xml b/pom.xml index 9b9398734ca..be97f6c0a31 100644 --- a/pom.xml +++ b/pom.xml @@ -67,7 +67,7 @@ UTF-8 17 9.7.1 - 2.0.21-1.0.25 + 2.0.21-1.0.27 From 3ee777f21a4e1317f71237561456930512035c21 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Nov 2024 02:53:39 +0000 Subject: [PATCH 08/11] Bump net.bytebuddy:byte-buddy from 1.15.5 to 1.15.10 Bumps [net.bytebuddy:byte-buddy](https://github.com/raphw/byte-buddy) from 1.15.5 to 1.15.10. - [Release notes](https://github.com/raphw/byte-buddy/releases) - [Changelog](https://github.com/raphw/byte-buddy/blob/master/release-notes.md) - [Commits](https://github.com/raphw/byte-buddy/compare/byte-buddy-1.15.5...byte-buddy-1.15.10) --- updated-dependencies: - dependency-name: net.bytebuddy:byte-buddy dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index be97f6c0a31..61017681772 100644 --- a/pom.xml +++ b/pom.xml @@ -317,7 +317,7 @@ net.bytebuddy byte-buddy - 1.15.5 + 1.15.10 io.github.classgraph From 249fe67ddecfb1110a677de35dd4ce9232024828 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Nov 2024 02:53:30 +0000 Subject: [PATCH 09/11] Bump org.openrewrite.recipe:rewrite-recipe-bom from 2.21.0 to 2.21.1 Bumps [org.openrewrite.recipe:rewrite-recipe-bom](https://github.com/openrewrite/rewrite-recipe-bom) from 2.21.0 to 2.21.1. - [Release notes](https://github.com/openrewrite/rewrite-recipe-bom/releases) - [Commits](https://github.com/openrewrite/rewrite-recipe-bom/compare/v2.21.0...v2.21.1) --- updated-dependencies: - dependency-name: org.openrewrite.recipe:rewrite-recipe-bom dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- rewrite/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rewrite/pom.xml b/rewrite/pom.xml index 50b7e08125c..8ef815e5db2 100644 --- a/rewrite/pom.xml +++ b/rewrite/pom.xml @@ -24,7 +24,7 @@ org.openrewrite.recipe rewrite-recipe-bom - 2.21.0 + 2.21.1 pom import From c64f736cf51c897dc08a0400b8c79e353b8351aa Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Nov 2024 02:53:41 +0000 Subject: [PATCH 10/11] Bump com.squareup:kotlinpoet-jvm from 1.18.1 to 2.0.0 Bumps [com.squareup:kotlinpoet-jvm](https://github.com/square/kotlinpoet) from 1.18.1 to 2.0.0. - [Release notes](https://github.com/square/kotlinpoet/releases) - [Changelog](https://github.com/square/kotlinpoet/blob/main/docs/changelog.md) - [Commits](https://github.com/square/kotlinpoet/compare/1.18.1...2.0.0) --- updated-dependencies: - dependency-name: com.squareup:kotlinpoet-jvm dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- build-plugins/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-plugins/pom.xml b/build-plugins/pom.xml index 4186f423ce7..5850a4491f5 100644 --- a/build-plugins/pom.xml +++ b/build-plugins/pom.xml @@ -139,7 +139,7 @@ com.squareup kotlinpoet-jvm - 1.18.1 + 2.0.0 From 0d063265b1edf95ae3b0fba61bc126573b836f21 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Nov 2024 02:56:53 +0000 Subject: [PATCH 11/11] Bump org.testcontainers:mongodb from 1.20.2 to 1.20.3 Bumps [org.testcontainers:mongodb](https://github.com/testcontainers/testcontainers-java) from 1.20.2 to 1.20.3. - [Release notes](https://github.com/testcontainers/testcontainers-java/releases) - [Changelog](https://github.com/testcontainers/testcontainers-java/blob/main/CHANGELOG.md) - [Commits](https://github.com/testcontainers/testcontainers-java/compare/1.20.2...1.20.3) --- updated-dependencies: - dependency-name: org.testcontainers:mongodb dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 61017681772..e3c1b45be4f 100644 --- a/pom.xml +++ b/pom.xml @@ -217,7 +217,7 @@ org.testcontainers mongodb - 1.20.2 + 1.20.3 test