Skip to content

Commit 720bde1

Browse files
committed
Add test data and validation rules for the initial DSL implementation
1 parent 62557f9 commit 720bde1

File tree

6 files changed

+118
-3
lines changed

6 files changed

+118
-3
lines changed

core/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>be.sddevelopment</groupId>
99
<artifactId>modular-validators</artifactId>
10-
<version>1.0.0-SNAPSHOT</version>
10+
<version>1.1.0-SNAPSHOT</version>
1111
<relativePath>../pom.xml</relativePath>
1212
</parent>
1313

dsl/pom.xml

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,51 @@
77
<parent>
88
<groupId>be.sddevelopment</groupId>
99
<artifactId>modular-validators</artifactId>
10-
<version>1.0.0-SNAPSHOT</version>
10+
<version>1.1.0-SNAPSHOT</version>
1111
<relativePath>../pom.xml</relativePath>
1212
</parent>
1313

1414
<artifactId>dsl</artifactId>
1515

16+
<description>
17+
A Domain Specific Language (DSL) to define validation rules, using a PlantUML like syntax to enable easy
18+
visualisation of the ruleset.
19+
</description>
20+
1621
<properties>
1722
<maven.compiler.source>21</maven.compiler.source>
1823
<maven.compiler.target>21</maven.compiler.target>
1924
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
2025
</properties>
2126

27+
<dependencies>
28+
<dependency>
29+
<groupId>be.sddevelopment</groupId>
30+
<artifactId>core</artifactId>
31+
</dependency>
32+
33+
<!-- BEGIN TEST SCOPE -->
34+
<dependency>
35+
<groupId>org.junit.jupiter</groupId>
36+
<artifactId>junit-jupiter-api</artifactId>
37+
<scope>test</scope>
38+
</dependency>
39+
<dependency>
40+
<groupId>org.junit.jupiter</groupId>
41+
<artifactId>junit-jupiter-engine</artifactId>
42+
<scope>test</scope>
43+
</dependency>
44+
<dependency>
45+
<groupId>org.assertj</groupId>
46+
<artifactId>assertj-core</artifactId>
47+
<scope>test</scope>
48+
</dependency>
49+
<dependency>
50+
<groupId>org.mockito</groupId>
51+
<artifactId>mockito-junit-jupiter</artifactId>
52+
<scope>test</scope>
53+
</dependency>
54+
</dependencies>
55+
2256

2357
</project>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
* <p>
3+
* Contains the domain-specific language classes (DSL) for the validation framework. These classes are used to create the validation rules, based on the DSL specifications provided to it.
4+
* The most notable entries are {@link be.sddevelopment.validation.dsl.ValidatorParser}.
5+
* </p>
6+
*
7+
* @since 1.1.0-SNAPSHOT
8+
*/
9+
package be.sddevelopment.validation.dsl;
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
NAME,HEIGHT,MASS,HAIR_COLOR,SKIN_COLOR,EYE_COLOR,BIRTH_YEAR,GENDER,HOMEWORLD,SPECIES
2+
Luke Skywalker,172,77,blond,fair,blue,19BBY,male,Tatooine,Human
3+
C-3PO,167,75,NA,gold,yellow,112BBY,NA,Tatooine,Droid
4+
R2-D2,96,32,NA,"white, blue",red,33BBY,NA,Naboo,Droid
5+
Darth Vader,202,136,none,white,yellow,41.9BBY,male,Tatooine,Human
6+
Leia Organa,150,49,brown,light,brown,19BBY,female,Alderaan,Human
7+
Owen Lars,178,120,"brown, grey",light,blue,52BBY,male,Tatooine,Human
8+
Beru Whitesun lars,165,75,brown,light,blue,47BBY,female,Tatooine,Human
9+
R5-D4,97,32,NA,"white, red",red,NA,NA,Tatooine,Droid
10+
Biggs Darklighter,183,84,black,light,brown,24BBY,male,Tatooine,Human
11+
Obi-Wan Kenobi,182,77,"auburn, white",fair,blue-gray,57BBY,male,Stewjon,Human
12+
Anakin Skywalker,188,84,blond,fair,blue,41.9BBY,male,Tatooine,Human
13+
Wilhuff Tarkin,180,NA,"auburn, grey",fair,blue,64BBY,male,Eriadu,Human
14+
Chewbacca,228,112,brown,NA,blue,200BBY,male,Kashyyyk,Wookiee
15+
Han Solo,180,80,brown,fair,brown,29BBY,male,Corellia,Human
16+
Greedo,173,74,NA,green,black,44BBY,male,Rodia,Rodian
17+
Jabba Desilijic Tiure,175,"1,358",NA,"green-tan, brown",orange,600BBY,hermaphrodite,Nal Hutta,Hutt
18+
Wedge Antilles,170,77,brown,fair,hazel,21BBY,male,Corellia,Human
19+
Jek Tono Porkins,180,110,brown,fair,blue,NA,male,Bestine IV,Human
20+
Yoda,66,17,white,green,brown,896BBY,male,NA,Yoda's species
21+
Palpatine,170,75,grey,pale,yellow,82BBY,male,Naboo,Human
22+
Boba Fett,183,78.2,black,fair,brown,31.5BBY,male,Kamino,Human
23+
IG-88,200,140,none,metal,red,15BBY,none,NA,Droid
24+
Bossk,190,113,none,green,red,53BBY,male,Trandosha,Trandoshan
25+
Lando Calrissian,177,79,black,dark,brown,31BBY,male,Socorro,Human
26+
Lobot,175,79,none,light,blue,37BBY,male,Bespin,Human
27+
Ackbar,180,83,none,brown mottle,orange,41BBY,male,Mon Cala,Mon Calamari
28+
Mon Mothma,150,NA,auburn,fair,blue,48BBY,female,Chandrila,Human
29+
Arvel Crynyd,NA,NA,brown,fair,brown,NA,male,NA,Human
30+
Wicket Systri Warrick,88,20,brown,brown,brown,8BBY,male,Endor,Ewok
31+
Nien Nunb,160,68,none,grey,black,NA,male,Sullust,Sullustan
32+
Qui-Gon Jinn,193,89,brown,fair,blue,92BBY,male,NA,Human
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
ValidatorFor(".*STARWARS.*\\.csv") {
2+
Header{
3+
Field('NAME')
4+
Field('HEIGHT')
5+
Field('MASS')
6+
Field('HAIR_COLOR')
7+
Field('SKIN_COLOR')
8+
Field('EYE_COLOR')
9+
Field('BIRTH_YEAR')
10+
Field('GENDER')
11+
Field('HOMEWORLD')
12+
Field('SPECIES')
13+
}
14+
FieldPopulated('SPECIES')
15+
RecordIdentifier('NAME')
16+
17+
ValidationCase("GoldenBoy") {
18+
RecordExists('C-3PO')
19+
RecordHasValue('C-3PO', 'SKIN_COLOR', 'gold')
20+
RecordHasValue('C-3PO', 'SPECIES', 'Droid')
21+
}
22+
23+
ValidationCase("The true protagonist") {
24+
RecordExists('R2-D2')
25+
RecordHasValue('R2-D2', 'SKIN_COLOR', 'white, blue')
26+
RecordHasValue('R2-D2', 'SPECIES', 'Droid')
27+
}
28+
}

pom.xml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>be.sddevelopment</groupId>
88
<artifactId>modular-validators</artifactId>
9-
<version>1.0.0-SNAPSHOT</version>
9+
<version>1.1.0-SNAPSHOT</version>
1010
<packaging>pom</packaging>
1111

1212
<description>
@@ -64,6 +64,18 @@
6464
</properties>
6565
<dependencyManagement>
6666
<dependencies>
67+
<dependency>
68+
<groupId>be.sddevelopment</groupId>
69+
<artifactId>core</artifactId>
70+
<version>${version}</version>
71+
</dependency>
72+
73+
<dependency>
74+
<groupId>be.sddevelopment</groupId>
75+
<artifactId>dsl</artifactId>
76+
<version>${version}</version>
77+
</dependency>
78+
6779
<!-- BEGIN TEST SCOPE -->
6880
<dependency>
6981
<groupId>org.junit.jupiter</groupId>

0 commit comments

Comments
 (0)