Skip to content

Commit

Permalink
[JPA] Ajout TNR Java
Browse files Browse the repository at this point in the history
  • Loading branch information
gideruette committed Aug 5, 2024
1 parent f18c689 commit 329abb5
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 12 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,12 @@ jobs:

- name: tmdgen
run: dotnet run --project TopModel.ModelGenerator/TopModel.ModelGenerator.csproj -f net8.0 -- -f samples/generators/open-api/tmdgen.config -c

- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn test
2 changes: 1 addition & 1 deletion TopModel.Generator.Jpa/SpringClientApiGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ protected override void HandleFile(string filePath, string fileName, string tag,
if (endpoints.First().ModelFile.Options.Endpoints.Prefix != null)
{
fw.WriteLine($@"@HttpExchange(""{endpoints.First().ModelFile.Options.Endpoints.Prefix}"")");
fw.AddImport("org.springframework.web.service.annotation");
fw.AddImport("org.springframework.web.service.annotation.HttpExchange");
}

var javaOrJakarta = Config.PersistenceMode.ToString().ToLower();
Expand Down
26 changes: 17 additions & 9 deletions samples/generators/jpa/pom.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<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 https://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>
<version>3.1.3</version>
<version>3.3.2</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>topmodel.jpa.sample</groupId>
Expand All @@ -30,12 +32,6 @@
<artifactId>jaxb-runtime</artifactId>
<scope>provided</scope>
</dependency>

<!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-tomcat</artifactId>-->
<!-- <scope>provided</scope>-->
<!-- </dependency>-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
Expand All @@ -49,6 +45,18 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web-services</artifactId>
</dependency>
<!-- Dependance POSTGRESQL ... -->
<dependency>
<groupId>org.postgresql</groupId>
Expand Down Expand Up @@ -92,4 +100,4 @@
</plugin>
</plugins>
</build>
</project>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.service.annotation;
import org.springframework.web.service.annotation.GetExchange;
import org.springframework.web.service.annotation.HttpExchange;
import org.springframework.web.service.annotation.PostExchange;
import org.springframework.web.service.annotation.PutExchange;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.service.annotation;
import org.springframework.web.service.annotation.DeleteExchange;
import org.springframework.web.service.annotation.GetExchange;
import org.springframework.web.service.annotation.HttpExchange;
import org.springframework.web.service.annotation.PostExchange;
import org.springframework.web.service.annotation.PutExchange;

Expand Down
14 changes: 14 additions & 0 deletions samples/generators/jpa/src/test/java/ProfilItemTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import static org.assertj.core.api.Assertions.assertThat;

import org.junit.jupiter.api.Test;

import topmodel.jpa.sample.demo.dtos.securite.profil.ProfilItem;

class ProfilItemTest {
@Test
void isInterfaceWithMethods() {
assertThat(ProfilItem.class)
.isInterface()
.hasMethods("getId", "getLibelle", "getNombreUtilisateurs", "hydrate");
}
}

0 comments on commit 329abb5

Please sign in to comment.