Skip to content

Commit 1048133

Browse files
authored
Merge pull request #16 from Sassine/develop
Develop
2 parents 0a699b7 + 635beb4 commit 1048133

9 files changed

Lines changed: 174 additions & 41 deletions

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Compute coverage
2+
3+
on:
4+
push:
5+
branches: [ main , develop ]
6+
7+
8+
jobs:
9+
compute-coverage:
10+
name: Compute coverage
11+
runs-on: ubuntu-latest
12+
environment:
13+
name: coveralls
14+
steps:
15+
- uses: actions/checkout@v3
16+
- uses: actions/setup-java@v3
17+
with:
18+
java-version: '11'
19+
distribution: 'adopt'
20+
- name: Build and test
21+
run: cd sqlschema2java-core && mvn clean test jacoco:report coveralls:report -DrepoToken=${{ secrets.coveralls_repo_token }}

.github/workflows/deploy.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
runs-on: ubuntu-latest
2626
needs: publish-core
2727
steps:
28-
- name: Sleep for 30 seconds
28+
- name: Sleep for 5 minutes
2929
uses: jakejarvis/wait-action@master
3030
with:
3131
time: '5m'
@@ -44,7 +44,7 @@ jobs:
4444
with:
4545
java-version: '11'
4646
distribution: 'adopt'
47-
- name: Publish package SQLSchema2Java Core
47+
- name: Publish package SQLSchema2Java MavenPLugin
4848
run: |
4949
cd sqlschema2java-maven-plugin
5050
mvn --batch-mode deploy

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@ sqlschema2java-example/src
2020
sqlschema2java-maven-plugin/.settings/org.eclipse.jdt.core.prefs
2121
sqlschema2java-maven-plugin/.settings/org.eclipse.m2e.core.prefs
2222
sqlschema2java-maven-plugin/.settings/org.springframework.ide.eclipse.prefs
23+
bin/

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33

44
[![Publish package to GitHub Packages](https://github.com/Sassine/sqlschema2java/actions/workflows/deploy.yml/badge.svg)](https://github.com/Sassine/sqlschema2java/actions/workflows/deploy.yml)
55
[![CodeQL main](https://github.com/Sassine/sqlschema2java/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/Sassine/sqlschema2java/actions/workflows/codeql-analysis.yml)
6+
67
[![GitHub release](https://img.shields.io/github/release/Sassine/sqlschema2java.svg)](https://GitHub.com/Sassine/sqlschema2java/releases/)
8+
[![Coverage Status](https://coveralls.io/repos/github/Sassine/sqlschema2java/badge.svg)](https://coveralls.io/github/Sassine/sqlschema2java)
79

810
![Logo SQL2JAVA and website adress sassine.dev/sqlschema2java](https://sassine.dev/assets/images/SQLSchema2Java_Logo2.png)
911

sqlschema2java-core/pom.xml

Lines changed: 80 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,16 @@
88
<artifactId>sqlschema2java-core</artifactId>
99
<version>1.0.0-beta1</version>
1010
<name>sqlschema2java-core</name>
11-
11+
1212
<description>Auto generate Class DTO, Entity and Repository from SQL Query. </description>
1313
<url>https://sassine.dev/</url>
1414

1515
<properties>
1616
<java.version>11</java.version>
17+
<coveralls-maven-plugin.version>4.3.0</coveralls-maven-plugin.version>
18+
<jacoco-maven-plugin.version>0.8.8</jacoco-maven-plugin.version>
19+
<copyright.holder>Sassine El-Asmar</copyright.holder>
20+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1721
</properties>
1822

1923
<developers>
@@ -30,6 +34,32 @@
3034
</developers>
3135

3236
<build>
37+
<resources>
38+
<resource>
39+
<directory>${project.basedir}</directory>
40+
<includes>
41+
<include>**LICENSE</include>
42+
</includes>
43+
<targetPath>META-INF</targetPath>
44+
</resource>
45+
<resource>
46+
<directory>${project.basedir}/src/main/resources</directory>
47+
<includes>
48+
<include>**</include>
49+
</includes>
50+
</resource>
51+
</resources>
52+
<testResources>
53+
<testResource>
54+
<directory>${project.basedir}/src/test/java</directory>
55+
<excludes>
56+
<exclude>**/*.java</exclude>
57+
</excludes>
58+
</testResource>
59+
<testResource>
60+
<directory>${project.basedir}/src/test/resources</directory>
61+
</testResource>
62+
</testResources>
3363
<plugins>
3464
<plugin>
3565
<groupId>org.pitest</groupId>
@@ -80,15 +110,63 @@
80110
<artifactId>maven-compiler-plugin</artifactId>
81111
<version>3.8.0</version>
82112
<configuration>
83-
<sql-file>./sql.sql</sql-file>
84113
<encoding>UTF-8</encoding>
85114
<source>11</source>
86115
<target>11</target>
87116
</configuration>
88117
</plugin>
118+
<plugin>
119+
<groupId>org.eluder.coveralls</groupId>
120+
<artifactId>coveralls-maven-plugin</artifactId>
121+
<version>${coveralls-maven-plugin.version}</version>
122+
<configuration>
123+
<sourceDirectories>
124+
<sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>
125+
</sourceDirectories>
126+
</configuration>
127+
<dependencies>
128+
<dependency>
129+
<groupId>javax.xml.bind</groupId>
130+
<artifactId>jaxb-api</artifactId>
131+
<version>2.3.1</version>
132+
</dependency>
133+
</dependencies>
134+
</plugin>
135+
<plugin>
136+
<groupId>org.jacoco</groupId>
137+
<artifactId>jacoco-maven-plugin</artifactId>
138+
<version>${jacoco-maven-plugin.version}</version>
139+
<executions>
140+
<execution>
141+
<id>prepare-agent</id>
142+
<goals>
143+
<goal>prepare-agent</goal>
144+
</goals>
145+
</execution>
146+
<execution>
147+
<id>default-report</id>
148+
<phase>prepare-package</phase>
149+
<goals>
150+
<goal>report</goal>
151+
</goals>
152+
</execution>
153+
</executions>
154+
<configuration>
155+
<excludes>
156+
<exclude>**/*SqlListener*</exclude>
157+
<exclude>**/*SqlBaseListener*</exclude>
158+
<exclude>**/*SqlLexer*</exclude>
159+
<exclude>**/*SqlParser*</exclude>
160+
<exclude>**/*Main*</exclude>
161+
<exclude>**/*Sqlschema2Java*</exclude>
162+
<exclude>**/builder/**</exclude>
163+
</excludes>
164+
</configuration>
165+
</plugin>
89166
</plugins>
90167
</build>
91168

169+
92170
<dependencies>
93171
<dependency>
94172
<groupId>org.antlr</groupId>
@@ -113,7 +191,6 @@
113191
<groupId>org.projectlombok</groupId>
114192
<artifactId>lombok</artifactId>
115193
<version>1.18.22</version>
116-
<scope>provided</scope>
117194
</dependency>
118195

119196
<dependency>

sqlschema2java-core/src/main/java/dev/sassine/api/structure/model/java/FieldModel.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ public class FieldModel {
2020
private String defaultValue;
2121
private Integer minOccurs;
2222
private String maxOccurs;
23-
private boolean isEmbedded;
2423

2524
public FieldModel(String name) {
2625
this.name = name;
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package dev.sassine.api.structure.model.java;
2+
3+
import static org.junit.Assert.assertEquals;
4+
import static org.junit.Assert.assertNull;
5+
6+
import org.junit.Test;
7+
8+
public class EntityModelTest {
9+
10+
11+
@Test
12+
public void getFieldForNameTest() {
13+
var entity = new EntityModel("table", "auto");
14+
var field = new FieldModel();
15+
field.setName("teste_1");
16+
field.setType("Integer");
17+
entity.getFields().add(field);
18+
var value = entity.getFieldForName("teste_1");
19+
assertEquals("teste1",value.getCamelName());
20+
assertEquals("Teste1",value.getCamelNameUpper());
21+
assertEquals("Integer",value.getType());
22+
assertNull(entity.getFieldForName("teste_2"));
23+
}
24+
25+
}

sqlschema2java-example/pom.xml

Lines changed: 42 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<project xmlns="http://maven.apache.org/POM/4.0.0"
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5-
<modelVersion>4.0.0</modelVersion>
6-
<groupId>dev.sasine.api</groupId>
7-
<artifactId>sqlschema2java-example</artifactId>
8-
<version>1.0.0-beta1</version>
9-
<packaging>pom</packaging>
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
<groupId>dev.sasine.api</groupId>
7+
<artifactId>sqlschema2java-example</artifactId>
8+
<version>1.0.0-beta1</version>
9+
<packaging>pom</packaging>
1010

1111
<developers>
1212
<developer>
@@ -20,35 +20,43 @@
2020
</roles>
2121
</developer>
2222
</developers>
23-
23+
2424
<properties>
25-
<is.postgres>false</is.postgres>
26-
<auto.increment.enabled>false</auto.increment.enabled>
27-
<path.arquivo>./input.sql</path.arquivo>
28-
</properties>
25+
<is.postgres>false</is.postgres>
26+
<auto.increment.enabled>false</auto.increment.enabled>
27+
<path.arquivo>./input.sql</path.arquivo>
28+
</properties>
29+
2930

31+
<build>
32+
<plugins>
33+
<plugin>
34+
<groupId>dev.sassine.api</groupId>
35+
<artifactId>sqlschema2java-maven-plugin</artifactId>
36+
<version>1.0.0-beta1</version>
37+
<executions>
38+
<execution>
39+
<goals>
40+
<goal>generate</goal>
41+
</goals>
42+
</execution>
43+
</executions>
44+
<configuration>
45+
<isPostgres>${is.postgres}</isPostgres>
46+
<sourceDirectory>${path.arquivo}</sourceDirectory>
47+
<useAutoIncrement>${auto.increment.enabled}</useAutoIncrement>
48+
<debugEnabled>false</debugEnabled>
49+
</configuration>
50+
</plugin>
51+
</plugins>
52+
</build>
3053

31-
<build>
32-
<plugins>
33-
<plugin>
34-
<groupId>dev.sassine.api</groupId>
35-
<artifactId>sqlschema2java-maven-plugin</artifactId>
36-
<version>1.0.0-beta1</version>
37-
<executions>
38-
<execution>
39-
<goals>
40-
<goal>generate</goal>
41-
</goals>
42-
</execution>
43-
</executions>
44-
<configuration>
45-
<isPostgres>${is.postgres}</isPostgres>
46-
<sourceDirectory>${path.arquivo}</sourceDirectory>
47-
<useAutoIncrement>${auto.increment.enabled}</useAutoIncrement>
48-
<debugEnabled>false</debugEnabled>
49-
</configuration>
50-
</plugin>
51-
</plugins>
52-
</build>
54+
<repositories>
55+
<repository>
56+
<id>github</id>
57+
<name>GitHub Packages SQLSchema2Java</name>
58+
<url>https://maven.pkg.github.com/Sassine/sqlschema2java</url>
59+
</repository>
60+
</repositories>
5361

5462
</project>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/bin/sh
22

3-
mvn dev.sassine.api:sqlschema2java-maven-plugin:sqlschema2java
3+
mvn dev.sassine.api:sqlschema2java-maven-plugin:generate

0 commit comments

Comments
 (0)