Skip to content

Commit

Permalink
feat(objectionary#464): add the dummy integration test for the spring…
Browse files Browse the repository at this point in the history
… spring framework
  • Loading branch information
volodya-lombrozo committed Feb 28, 2024
1 parent 68b4ac7 commit d5b634f
Show file tree
Hide file tree
Showing 9 changed files with 238 additions and 4 deletions.
16 changes: 16 additions & 0 deletions src/it/spring-fat/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Spring Fat Jar Integration Test

Integration test that checks the correct transformation of an application
written with using of the Springs Framework. This integration test starts the
application with several beans and prints results to the console.
This is a similar integration test with the "spring" test in
the [spring](../spring) test.

The only difference is that in this test we download all the dependencies,
unpack them, transform using jeo-maven-plugin and then pack them back. In other
words, we test the fat jar transformation.

If you need to run only this test, use the following command:
```shell
mvn clean integration-test invoker:run -Dinvoker.test=spring-fat -DskipTests
```
1 change: 1 addition & 0 deletions src/it/spring-fat/invoker.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
invoker.goals = clean spring-boot:run -e
90 changes: 90 additions & 0 deletions src/it/spring-fat/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
The MIT License (MIT)
Copyright (c) 2016-2023 Objectionary.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<!--
The version of 3.2.0 and similar requires rather high java
version: 17 or higher. So we intentionally use the version 2.7.18
here that requires java 11 since our plugin should be compatible with
java 11.
-->
<version>2.7.18</version>
<relativePath/>
</parent>
<groupId>org.eolang</groupId>
<artifactId>jeo-spring-fat-it</artifactId>
<version>@project.version@</version>
<packaging>jar</packaging>
<description>
Integration test that checks correct transformation of an application written with using of the Springs Framework.
This integration test starts the application with several beans and prints results to the console.
This is a similar integration test with the "spring" test in the "src/it/spring" test.
The only difference is that in this test we download all the dependencies, unpack them, transform using jeo-maven-plugin
and then pack them back. In other words, we test the fat jar transformation.
If you need to run only this test, use the following command:
"mvn clean integration-test invoker:run -Dinvoker.test=spring-fat -DskipTests"
</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.eolang</groupId>
<artifactId>jeo-maven-plugin</artifactId>
<version>@project.version@</version>
<executions>
<execution>
<id>bytecode-to-eo</id>
<goals>
<goal>disassemble</goal>
</goals>
</execution>
<execution>
<id>eo-to-bytecode</id>
<goals>
<goal>assemble</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2016-2023 Objectionary.com
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.eolang.jeo.spring;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

/**
* Spring Application Entry Point.
* @since 0.2
*/
@SpringBootApplication
public class Application implements CommandLineRunner {

@Autowired
private Receptionist receptionist;

public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}

@Override
public void run(final String... args) {
this.receptionist.sayHello("Fat Spring");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2016-2023 Objectionary.com
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.eolang.jeo.spring;

import org.springframework.stereotype.Component;

/**
* Greeter bean.
* @since 0.2
*/
@Component
public class Receptionist {
public void sayHello(final String who) {
System.out.printf("Glad to see you, %s...%n", who);
}
}
31 changes: 31 additions & 0 deletions src/it/spring-fat/verify.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* MIT License
*
* Copyright (c) 2016-2023 Objectionary.com
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
//Check logs first.
String log = new File(basedir, 'build.log').text;
assert log.contains("BUILD SUCCESS")
assert log.contains("Glad to see you, Fat Spring...")
//Check that we have generated EO object files.
assert new File(basedir, 'target/generated-sources/jeo-xmir/org/eolang/jeo/spring/Application.xmir').exists()
assert new File(basedir, 'target/generated-sources/jeo-xmir/org/eolang/jeo/spring/Receptionist.xmir').exists()
true
11 changes: 11 additions & 0 deletions src/it/spring/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Spring Fat Jar Integration Test

Integration test that checks the correct transformation of an application
written with using of the Springs Framework. This integration test starts the
application with several beans and prints results to the console.

If you need to run only this test, use the following command:

```shell
mvn clean integration-test invoker:run -Dinvoker.test=spring -DskipTests
```
2 changes: 1 addition & 1 deletion src/it/spring/invoker.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invoker.goals = clean spring-boot:run -e
invoker.goals=clean spring-boot:run -e
5 changes: 2 additions & 3 deletions src/it/spring/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,8 @@ SOFTWARE.
<version>@project.version@</version>
<packaging>jar</packaging>
<description>
Integration test that checks correct transformation simple Java application
written with using Springs Framework. This application starts application
with several beans and prints results to the console.
Integration test that checks correct transformation of an application written with using of the Springs Framework.
This integration test starts the application with several beans and prints results to the console.
If you need to run only this test, use the following command:
"mvn clean integration-test invoker:run -Dinvoker.test=spring -DskipTests"
</description>
Expand Down

0 comments on commit d5b634f

Please sign in to comment.