Skip to content

Commit 57aa03e

Browse files
authored
closes #80 prepare demo for mule to boot migration (#81)
1 parent 943e64b commit 57aa03e

File tree

21 files changed

+346
-4
lines changed

21 files changed

+346
-4
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
### Adds
44
- Unmarshalling ejb-jar.xml for EJB 2.1 (#62)
5+
- Demo for Mule to Boot migration (#80)
56

67
### Fixes
78
- Paths and CLI rendering under Windows (#58)

components/sbm-core/src/main/java/org/springframework/sbm/engine/precondition/PreconditionCheck.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424

2525
public abstract class PreconditionCheck {
2626

27-
private ResultState resultState;
28-
2927
public abstract PreconditionCheckResult verify(Path projectRoot, List<Resource> projectResources);
3028

3129
public enum ResultState {

components/sbm-core/src/main/java/org/springframework/sbm/engine/recipe/AbstractAction.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616
package org.springframework.sbm.engine.recipe;
1717

18+
import com.fasterxml.jackson.annotation.JsonIgnore;
1819
import lombok.AllArgsConstructor;
1920
import lombok.Getter;
2021
import lombok.NoArgsConstructor;
@@ -38,6 +39,7 @@ public abstract class AbstractAction implements Action {
3839
private Condition condition = Condition.TRUE;
3940

4041
@Autowired
42+
@JsonIgnore
4143
@Getter
4244
private ApplicationEventPublisher eventPublisher;
4345

components/sbm-support-weblogic/src/test/java/org/springframework/sbm/jee/wls/actions/MigrateWlsEjbDeploymentDescriptorTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
package org.springframework.sbm.jee.wls.actions;
1717

1818
import org.junit.jupiter.api.Test;
19+
import org.springframework.context.ApplicationEventPublisher;
1920
import org.springframework.sbm.GitHubIssue;
2021
import org.springframework.sbm.engine.context.ProjectContext;
2122
import org.springframework.sbm.jee.wls.JeeWlsEjbJarProjectResourceRegistrar;
@@ -24,6 +25,7 @@
2425
import java.nio.file.Path;
2526

2627
import static org.assertj.core.api.Assertions.assertThat;
28+
import static org.mockito.Mockito.mock;
2729

2830
class MigrateWlsEjbDeploymentDescriptorTest {
2931
@Test
@@ -93,6 +95,7 @@ void shouldAddTransactionalAnnotationAndTimeoutIfAnnotationDoesNotExist() {
9395

9496

9597
MigrateWlsEjbDeploymentDescriptor sut = new MigrateWlsEjbDeploymentDescriptor();
98+
sut.setEventPublisher(mock(ApplicationEventPublisher.class));
9699
sut.apply(projectContext);
97100

98101
String resultingJavaSource = projectContext.getProjectJavaSources().list().get(0).getResource().print();
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
testcode/result/*
2+
/**/.git
3+
/.rewrite-cache/
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
= Migrate Mule 3.9 to Spring Integration
2+
3+
== Introduction
4+
5+
This demo shows how SBM can be used to migrate a https://docs.mulesoft.com/release-notes/mule-runtime/mule-3.9.0-release-notes[Mule 3.9]
6+
application to Spring Integration by applying recipe `migrate-mule-to-boot`.
7+
8+
=== Requirements
9+
10+
The demo was created on Mac OS but should run under Windows with a shell too.
11+
12+
- JDK 11
13+
- Maven
14+
- Docker
15+
- IntelliJ (can be changed)
16+
17+
== The Demo
18+
19+
A Mulesoft application with one flow using `http:listener` and `amqp:outbound-endpoint` gets migrated to Spring Integration.
20+
The migrated application provides a REST endpoint that sends a message received as POST request to a RabbitMQ queue.
21+
22+
=== Run the demo
23+
24+
* Call the `run-demo.sh` shell script to ru the full demo +
25+
`./run-demo.sh`
26+
27+
The script
28+
29+
* Moves all resources from `testcode/given`
30+
* Initializes Git repository in the project to migrate
31+
* Uses `docker-compose` to start a RabbitMQ instance with `sales_queue` configured
32+
* Waits, and proceeds on `enter`
33+
* Runs the migration by applying the commands in `commands.txt` (`initalize-spring-boot-migration`, `migrate-mule-to-boot`)
34+
* Opens IntelliJ IDEA +
35+
Under `Git/Log` in IntelliJ you should be able to find the commits for the applied recipes and compare the applied changes.
36+
37+
image::media/intellij-git-perspective.png[]
38+
39+
You can select the commits to compare
40+
41+
image::media/intellij-git-compare-commit.png[]
42+
43+
image::media/intellij-git-compare-commit-2.png[]
44+
45+
image::media/intellij-git-compare-commit-3.png[]
46+
47+
* Builds the migrated application +
48+
You'll need to exit the application manually using `Ctrl + c` as the `exit` is currently broken (v0.10.0)
49+
* Waits, and proceeds on `enter`
50+
* Starts the migrated application +
51+
The application is started in the background and console output can be found in `./application.log`
52+
* Find the URL for the RabbitMQ console in console output, verify no message exists
53+
* Waits, and proceeds on `enter`
54+
* Sends a message to the REST endpoint +
55+
`curl --location --request POST 'http://localhost:8081/' --header 'Content-Type: text/plain' --data-raw '{"hello": "from mule spring world"}'`
56+
* Waits, and proceeds on `enter`, this lets you verify one message was sent
57+
* The message can be checked in the http://localhost:15672/#/queues/%2F/sales_queue[RabbiMQ console] +
58+
**You might have to refresh the browser few times (or wait few seconds)**
59+
* Waits, and proceeds on `enter`
60+
* shuts down the application
61+
* performs clean up
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
s ./testcode/result/spring-amqp-mule
2+
a initialize-spring-boot-migration
3+
a migrate-mule-to-boot
4+
exit
37.7 KB
Loading
158 KB
Loading
19.8 KB
Loading

0 commit comments

Comments
 (0)