[ 
https://issues.apache.org/jira/browse/WICKET-7029?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17699398#comment-17699398
 ] 

ASF GitHub Bot commented on WICKET-7029:
----------------------------------------

timtebeek commented on code in PR #556:
URL: https://github.com/apache/wicket/pull/556#discussion_r1133324249


##########
wicket-migration/src/test/java/org/apache/wicket/migration/MigrateToWicket10Test.java:
##########
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2010-2023. wicket Framework
+ *
+ * Licensed 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.wicket.migration;
+
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+import org.openrewrite.config.Environment;
+import org.openrewrite.java.JavaParser;
+import org.openrewrite.test.RecipeSpec;
+import org.openrewrite.test.RewriteTest;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.openrewrite.java.Assertions.java;
+import static org.openrewrite.java.Assertions.mavenProject;
+import static org.openrewrite.maven.Assertions.pomXml;
+
+class MigrateToWicket10Test implements RewriteTest {
+
+    @Override
+    public void defaults(RecipeSpec spec) {
+        spec
+                .parser(JavaParser.fromJavaVersion()
+                        .logCompilationWarningsAndErrors(true)
+                        .classpath("rewrite-migrate-java"))
+                .recipe(Environment.builder()
+                        .scanRuntimeClasspath()
+                        .build()
+                        
.activateRecipes("org.apache.wicket.MigrateToWicket10"));
+    }
+
+    @Test
+    void migrateImports() {
+        //language=java
+        rewriteRun(
+                java("""
+                        package org.apache.wicket.http2.markup.head;
+
+                        public class PushHeaderItem { }"""),

Review Comment:
   This is a quick stub to ensure the replacement below can access the type 
without dependency on wicket-http2-core:9.x





> Add migration recipes to Wicket 10
> ----------------------------------
>
>                 Key: WICKET-7029
>                 URL: https://issues.apache.org/jira/browse/WICKET-7029
>             Project: Wicket
>          Issue Type: New Feature
>    Affects Versions: 10.0.0
>            Reporter: Tim te Beek
>            Priority: Minor
>              Labels: migration
>
> The [Migration to Wicket 
> 10.0|https://cwiki.apache.org/confluence/display/WICKET/Migration+to+Wicket+10.0]
>  guide contains a number of breaking changes, that users will have to adopt. 
> Examples include merging `wicket-http2` into `wicket-core`, and the 
> associated package change of `PushHeaderItem` to 
> `org.apache.wicket.markup.head.http2`. And while understandably necessary, 
> these nonetheless can be a hurdle for users to adopt.
> To help users adopt Wicket 10 and the associated upgrade to Java 17 and 
> Servlet 5+ I propose to add a module containing [OpenRewrite migration 
> recipes|https://docs.openrewrite.org/]. For those unfamiliar: OpenRewrite 
> allows you to define migration steps either through Yaml or with Java 
> visitors, and compose these steps to achieve larger migrations. Such 
> migrations have been [applied to Wicket 
> before,|https://github.com/apache/wicket/pull/546] but they can also be 
> defined and distributed for Apache Wicket users.
> As a recent example, migration recipes have been [added to Axon 
> Framework|https://developer.axoniq.io/w/upgrading-to-axon-framework-4.7-automated].
>  In practice that comes down to the following code changes, which also 
> include instructions on their use: 
> [https://github.com/AxonFramework/AxonFramework/pull/2597/files]
> Wicket 10 migration recipes can include a number of existing recipes that 
> help modernize applications:
>  # [Use lambdas where 
> possible|https://docs.openrewrite.org/reference/recipes/java/cleanup/uselambdaforfunctionalinterface]
>  # [Migrate to Jakarta EE 
> 9|https://docs.openrewrite.org/reference/recipes/java/migrate/jakarta/javaxmigrationtojakarta]
>  # [Migrate to Java 
> 17|https://docs.openrewrite.org/reference/recipes/java/migrate/upgradetojava17]
> The Wicket 10 specific recipes can reuse common building blocks such as 
> ChangeType to adopt package name changes, and RemoveDependency to remove 
> `wicket-http2`.
> Technically this wouldn't have to be very difficult initially, even more so 
> when the goal is to assist a migration rather than to achieve a complete 
> migration. The Axon Framework migration can serve as a template, and I'm 
> happy to provide guidance.
> Would this be something worth adding to Apache Wicket?



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to