-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
changes to POM files to include JDK17 e2e tests
- Loading branch information
Showing
8 changed files
with
279 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<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"> | ||
|
||
|
||
<parent> | ||
<groupId>org.evomaster</groupId> | ||
<artifactId>evomaster-e2e-tests</artifactId> | ||
<version>2.0.1-SNAPSHOT</version> | ||
</parent> | ||
|
||
|
||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>evomaster-e2e-tests-spring-rest-jakarta</artifactId> | ||
<packaging>jar</packaging> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>jakarta.validation</groupId> | ||
<artifactId>jakarta.validation-api</artifactId> | ||
<version>3.0.0</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>jakarta.persistence</groupId> | ||
<artifactId>jakarta.persistence-api</artifactId> | ||
<version>3.1.0</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.evomaster</groupId> | ||
<artifactId>evomaster-e2e-tests-utils</artifactId> | ||
<type>test-jar</type> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.evomaster</groupId> | ||
<artifactId>evomaster-client-java-controller</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.evomaster</groupId> | ||
<artifactId>evomaster-core</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.evomaster</groupId> | ||
<artifactId>evomaster-client-java-instrumentation</artifactId> | ||
<type>test-jar</type> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-web</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-data-jpa</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-security</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>io.springfox</groupId> | ||
<artifactId>springfox-swagger2</artifactId> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>io.swagger</groupId> | ||
<artifactId>*</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.springfox</groupId> | ||
<artifactId>springfox-spring-web</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.swagger</groupId> | ||
<artifactId>swagger-parser</artifactId> | ||
</dependency> | ||
|
||
|
||
|
||
</dependencies> | ||
|
||
<profiles> | ||
<profile> | ||
<id>skipE2E_V2</id> | ||
<properties> | ||
<maven.test.skip>true</maven.test.skip> | ||
</properties> | ||
</profile> | ||
</profiles> | ||
|
||
</project> |
16 changes: 16 additions & 0 deletions
16
e2e-tests/spring-rest-jakarta/src/main/java/com/foo/jakarta/entity/JakartaApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.foo.jakarta.entity; | ||
|
||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration; | ||
import springfox.documentation.swagger2.annotations.EnableSwagger2; | ||
|
||
@EnableSwagger2 | ||
@SpringBootApplication(exclude = SecurityAutoConfiguration.class) | ||
public class JakartaApplication extends SwaggerConfiguration { | ||
|
||
public static void main(String[] args) { | ||
SpringApplication.run(JakartaApplication.class, args); | ||
} | ||
|
||
} |
44 changes: 44 additions & 0 deletions
44
e2e-tests/spring-rest-jakarta/src/main/java/com/foo/jakarta/entity/JakartaRest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package com.foo.jakarta.entity; | ||
|
||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestMethod; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import javax.ws.rs.core.MediaType; | ||
import java.util.List; | ||
|
||
@RestController | ||
@RequestMapping(path = "/api/jakarta/person") | ||
public class JakartaRest { | ||
|
||
@Autowired | ||
private PersonRepository repository; | ||
|
||
|
||
@RequestMapping( | ||
method = RequestMethod.POST | ||
) | ||
public ResponseEntity<Void> post(String name) { | ||
PersonEntity entity = new PersonEntity(); | ||
entity.name = name; | ||
repository.save(entity); | ||
return ResponseEntity.status(200).build(); | ||
} | ||
|
||
|
||
@RequestMapping( | ||
method = RequestMethod.GET, | ||
produces = MediaType.APPLICATION_JSON | ||
) | ||
public ResponseEntity<Void> get(String name) { | ||
|
||
List<PersonEntity> list = repository.findByName(name); | ||
if (list.isEmpty()) { | ||
return ResponseEntity.status(400).build(); | ||
} else { | ||
return ResponseEntity.status(200).build(); | ||
} | ||
} | ||
} |
68 changes: 68 additions & 0 deletions
68
e2e-tests/spring-rest-jakarta/src/main/java/com/foo/jakarta/entity/PersonEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package com.foo.jakarta.entity; | ||
|
||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.Id; | ||
import jakarta.validation.constraints.*; | ||
import java.time.LocalDate; | ||
import java.util.List; | ||
|
||
@Entity | ||
public class PersonEntity { | ||
|
||
@Id | ||
@GeneratedValue | ||
private Long id; | ||
|
||
@Min(value = 0) | ||
public int age; | ||
|
||
@Max(value = 200) | ||
public int maxAge; | ||
|
||
@NotBlank | ||
public String name; | ||
|
||
public String emailAddress; | ||
|
||
@Negative | ||
public int debt; | ||
|
||
@NegativeOrZero | ||
public int netWorth; | ||
|
||
@Positive | ||
public int income; | ||
|
||
@PositiveOrZero | ||
public int savings; | ||
|
||
@Future | ||
public LocalDate birthDate; | ||
|
||
@FutureOrPresent | ||
public LocalDate nextAppointment; | ||
|
||
@Past | ||
public LocalDate graduationDate; | ||
|
||
@PastOrPresent | ||
public LocalDate lastUpdate; | ||
|
||
@Null | ||
public Object nullField; | ||
|
||
@DecimalMin(value = "0.0", message = "Value must be at least 0.0") | ||
@DecimalMax(value = "1000000.0", message = "Value must be at most 1,000,000.0") | ||
private Float annualIncome; | ||
|
||
@Pattern(regexp = "^[A-Za-z]+$", message = "Only alphabetic characters are allowed") | ||
private String nickname; | ||
|
||
@Size(min = 0, max = 100, message = "Must contain between 0 and 100 items") | ||
private List<String> otherDetails; | ||
|
||
@Digits(integer = 6, fraction = 2, message = "Invalid format, max 6 digits with 2 decimal places") | ||
private float weight; | ||
} |
10 changes: 10 additions & 0 deletions
10
e2e-tests/spring-rest-jakarta/src/main/java/com/foo/jakarta/entity/PersonRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.foo.jakarta.entity; | ||
|
||
import org.springframework.data.repository.CrudRepository; | ||
|
||
import java.util.List; | ||
|
||
public interface PersonRepository extends CrudRepository<PersonEntity, Long> { | ||
|
||
List<PersonEntity> findByName(String name); | ||
} |
32 changes: 32 additions & 0 deletions
32
e2e-tests/spring-rest-jakarta/src/main/java/com/foo/jakarta/entity/SwaggerConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.foo.jakarta.entity; | ||
|
||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.security.core.Authentication; | ||
import org.springframework.web.context.request.WebRequest; | ||
import springfox.documentation.builders.ApiInfoBuilder; | ||
import springfox.documentation.service.ApiInfo; | ||
import springfox.documentation.spi.DocumentationType; | ||
import springfox.documentation.spring.web.plugins.Docket; | ||
|
||
import static springfox.documentation.builders.PathSelectors.regex; | ||
|
||
public class SwaggerConfiguration { | ||
|
||
@Bean | ||
public Docket docketApi() { | ||
return new Docket(DocumentationType.SWAGGER_2) | ||
.apiInfo(apiInfo()) | ||
.select() | ||
.paths(regex("/api/.*")) | ||
.build() | ||
.ignoredParameterTypes(WebRequest.class, Authentication.class); | ||
} | ||
|
||
private ApiInfo apiInfo() { | ||
return new ApiInfoBuilder() | ||
.title("API") | ||
.description("Some description") | ||
.version("1.0") | ||
.build(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters