Skip to content

Commit 7d0ce82

Browse files
authored
Merge pull request #15 from Sassine/feature/implements-test
feature: implements unit test - uping covarage margin and script comp…
2 parents 7791eba + 977564f commit 7d0ce82

8 files changed

Lines changed: 96 additions & 42 deletions

File tree

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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@v2
16+
- uses: actions/setup-java@v2.5.0
17+
with:
18+
java-version: 8
19+
distribution: 'zulu'
20+
architecture: x64
21+
- name: Build and test
22+
run: cd sqlschema2java-core && mvn clean test run-coveralls 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

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
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)
66

77
[![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?branch=develop)](https://coveralls.io/github/Sassine/sqlschema2java?branch=develop)
8+
[![Coverage Status](https://coveralls.io/repos/github/Sassine/sqlschema2java/badge.svg)](https://coveralls.io/github/Sassine/sqlschema2java)
99

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

sqlschema2java-core/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,9 @@
157157
<exclude>**/*SqlBaseListener*</exclude>
158158
<exclude>**/*SqlLexer*</exclude>
159159
<exclude>**/*SqlParser*</exclude>
160-
<exclude>**/*Main</exclude>
161-
<exclude>**/*Sqlschema2Java</exclude>
160+
<exclude>**/*Main*</exclude>
161+
<exclude>**/*Sqlschema2Java*</exclude>
162+
<exclude>**/builder/**</exclude>
162163
</excludes>
163164
</configuration>
164165
</plugin>
@@ -190,7 +191,6 @@
190191
<groupId>org.projectlombok</groupId>
191192
<artifactId>lombok</artifactId>
192193
<version>1.18.22</version>
193-
<scope>provided</scope>
194194
</dependency>
195195

196196
<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)