Skip to content

Commit e11e671

Browse files
committed
chore: initial project structure
Signed-off-by: Otavio Santana <[email protected]>
1 parent e9676d4 commit e11e671

File tree

16 files changed

+821
-25
lines changed

16 files changed

+821
-25
lines changed

.gitignore

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,15 @@
1-
# Compiled class file
2-
*.class
3-
4-
# Log file
1+
target/
2+
pom.xml.tag
3+
pom.xml.releaseBackup
4+
pom.xml.versionsBackup
5+
pom.xml.next
6+
test-output/
7+
/doc
8+
*.iml
59
*.log
6-
7-
# BlueJ files
8-
*.ctxt
9-
10-
# Mobile Tools for Java (J2ME)
11-
.mtj.tmp/
12-
13-
# Package Files #
14-
*.jar
15-
*.war
16-
*.nar
17-
*.ear
18-
*.zip
19-
*.tar.gz
20-
*.rar
21-
22-
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
23-
hs_err_pid*
24-
replay_pid*
10+
.classpath
11+
-project
12+
/.resourceCache
13+
/.project
14+
/.idea
15+
.settings/

README.adoc

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1-
# data-driven-test-oracle-nosql
1+
= Data Driven Test
2+
:toc: auto
23

3-
Introduction to Data Driven Test with OracleNoSQL
4+
image::http://www.jnosql.org/img/logos/mongodb.png[MongoDB, width=200px]
5+
6+
**Mongodb**: MongoDB is a free and open-source cross-platform document-oriented database program. Classified as a NoSQL database program, MongoDB uses JSON-like documents with schemas.
7+
8+
== How to install with Docker
9+
10+
1. Install docker: https://www.docker.com/
11+
2. https://hub.docker.com/_/mongo
12+
3. Run docker command:
13+
14+
[source, bash]
15+
----
16+
docker run -d --name mongodb-instance -p 27017:27017 mongo
17+
----

pom.xml

Lines changed: 195 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,195 @@
1+
<!--
2+
~ Copyright (c) 2022 Contributors to the Eclipse Foundation
3+
~ All rights reserved. This program and the accompanying materials
4+
~ are made available under the terms of the Eclipse Public License v1.0
5+
~ and Apache License v2.0 which accompanies this distribution.
6+
~ The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7+
~ and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php.
8+
~
9+
~ You may elect to redistribute this code under either of these licenses.
10+
-->
11+
12+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
13+
xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd">
14+
<modelVersion>4.0.0</modelVersion>
15+
<groupId>org.soujava.demos.mongodb</groupId>
16+
<artifactId>data-driven-test</artifactId>
17+
<version>1.0.0</version>
18+
<name>JNoSQL Demo using Java SE MongoDB exploring Data Driven Test</name>
19+
20+
<properties>
21+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
22+
<jnosql.version>1.1.8</jnosql.version>
23+
<maven.compiler.source>21</maven.compiler.source>
24+
<maven.compiler.target>21</maven.compiler.target>
25+
<maven.compile.version>3.5.1</maven.compile.version>
26+
<maven-surefire-plugin.version>3.1.0</maven-surefire-plugin.version>
27+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
28+
<jakarta.json.bind.version>3.0.0</jakarta.json.bind.version>
29+
<jakarta.json.version>2.1.1</jakarta.json.version>
30+
<tinkerpop.version>3.6.1</tinkerpop.version>
31+
<weld.se.core.version>6.0.3.Final</weld.se.core.version>
32+
<mockito.verson>5.18.0</mockito.verson>
33+
<assertj.version>3.24.2</assertj.version>
34+
<junit.version>5.9.2</junit.version>
35+
</properties>
36+
37+
<dependencies>
38+
<dependency>
39+
<groupId>net.datafaker</groupId>
40+
<artifactId>datafaker</artifactId>
41+
<version>2.4.4</version>
42+
</dependency>
43+
<dependency>
44+
<groupId>org.eclipse.jnosql.databases</groupId>
45+
<artifactId>jnosql-mongodb</artifactId>
46+
<version>${jnosql.version}</version>
47+
</dependency>
48+
<dependency>
49+
<groupId>org.jboss.weld.se</groupId>
50+
<artifactId>weld-se-shaded</artifactId>
51+
<version>${weld.se.core.version}</version>
52+
<scope>compile</scope>
53+
</dependency>
54+
<dependency>
55+
<groupId>org.eclipse</groupId>
56+
<artifactId>yasson</artifactId>
57+
<version>3.0.4</version>
58+
<scope>compile</scope>
59+
</dependency>
60+
<dependency>
61+
<groupId>io.smallrye.config</groupId>
62+
<artifactId>smallrye-config-core</artifactId>
63+
<version>3.13.3</version>
64+
<scope>compile</scope>
65+
</dependency>
66+
<dependency>
67+
<groupId>org.eclipse.microprofile.config</groupId>
68+
<artifactId>microprofile-config-api</artifactId>
69+
<version>3.1</version>
70+
<scope>compile</scope>
71+
</dependency>
72+
<dependency>
73+
<groupId>org.junit.jupiter</groupId>
74+
<artifactId>junit-jupiter-api</artifactId>
75+
<version>${junit.version}</version>
76+
<scope>test</scope>
77+
</dependency>
78+
<dependency>
79+
<groupId>org.junit.jupiter</groupId>
80+
<artifactId>junit-jupiter-engine</artifactId>
81+
<version>${junit.version}</version>
82+
<scope>test</scope>
83+
</dependency>
84+
<dependency>
85+
<groupId>org.junit.jupiter</groupId>
86+
<artifactId>junit-jupiter-params</artifactId>
87+
<version>${junit.version}</version>
88+
<scope>test</scope>
89+
</dependency>
90+
<dependency>
91+
<groupId>org.mockito</groupId>
92+
<artifactId>mockito-core</artifactId>
93+
<version>${mockito.verson}</version>
94+
<scope>test</scope>
95+
</dependency>
96+
<dependency>
97+
<groupId>org.mockito</groupId>
98+
<artifactId>mockito-junit-jupiter</artifactId>
99+
<version>${mockito.verson}</version>
100+
<scope>test</scope>
101+
</dependency>
102+
<dependency>
103+
<groupId>org.jboss.weld</groupId>
104+
<artifactId>weld-junit5</artifactId>
105+
<version>5.0.1.Final</version>
106+
<scope>test</scope>
107+
</dependency>
108+
<dependency>
109+
<groupId>org.testcontainers</groupId>
110+
<artifactId>mongodb</artifactId>
111+
<version>1.21.3</version>
112+
<scope>test</scope>
113+
</dependency>
114+
<dependency>
115+
<groupId>org.assertj</groupId>
116+
<artifactId>assertj-core</artifactId>
117+
<version>3.27.3</version>
118+
<scope>test</scope>
119+
</dependency>
120+
</dependencies>
121+
<build>
122+
<pluginManagement>
123+
<plugins>
124+
<plugin>
125+
<groupId>org.apache.maven.plugins</groupId>
126+
<artifactId>maven-compiler-plugin</artifactId>
127+
<version>${maven.compile.version}</version>
128+
<configuration>
129+
<target>${maven.compiler.target}</target>
130+
<source>${maven.compiler.source}</source>
131+
</configuration>
132+
</plugin>
133+
<plugin>
134+
<groupId>org.apache.maven.plugins</groupId>
135+
<artifactId>maven-surefire-plugin</artifactId>
136+
<version>${maven-surefire-plugin.version}</version>
137+
</plugin>
138+
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
139+
<plugin>
140+
<groupId>org.eclipse.m2e</groupId>
141+
<artifactId>lifecycle-mapping</artifactId>
142+
<version>1.1.4</version>
143+
<configuration>
144+
<lifecycleMappingMetadata>
145+
<pluginExecutions>
146+
<pluginExecution>
147+
<pluginExecutionFilter>
148+
<groupId>
149+
org.apache.rat
150+
</groupId>
151+
<artifactId>
152+
apache-rat-plugin
153+
</artifactId>
154+
<versionRange>
155+
[0.12,)
156+
</versionRange>
157+
<goals>
158+
<goal>check</goal>
159+
</goals>
160+
</pluginExecutionFilter>
161+
<action>
162+
<ignore></ignore>
163+
</action>
164+
</pluginExecution>
165+
</pluginExecutions>
166+
</lifecycleMappingMetadata>
167+
</configuration>
168+
</plugin>
169+
</plugins>
170+
</pluginManagement>
171+
</build>
172+
173+
<repositories>
174+
<repository>
175+
<id>jakarta.sonatype.org-snapshot</id>
176+
<url>https://jakarta.oss.sonatype.org/content/repositories/snapshots/</url>
177+
<releases>
178+
<enabled>false</enabled>
179+
</releases>
180+
<snapshots>
181+
<enabled>true</enabled>
182+
</snapshots>
183+
</repository>
184+
<repository>
185+
<id>oss.sonatype.org-snapshot</id>
186+
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
187+
<releases>
188+
<enabled>false</enabled>
189+
</releases>
190+
<snapshots>
191+
<enabled>true</enabled>
192+
</snapshots>
193+
</repository>
194+
</repositories>
195+
</project>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package org.soujava.demos.mongodb.document;
2+
3+
public enum CleanStatus {
4+
CLEAN,
5+
DIRTY,
6+
INSPECTION_NEEDED
7+
}
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
package org.soujava.demos.mongodb.document;
2+
3+
import jakarta.nosql.Column;
4+
import jakarta.nosql.Entity;
5+
import jakarta.nosql.Id;
6+
7+
import java.util.Objects;
8+
9+
@Entity
10+
public class Room {
11+
12+
@Id
13+
private String id;
14+
15+
@Column
16+
private int number;
17+
18+
@Column
19+
private RoomType type;
20+
21+
@Column
22+
private RoomStatus status;
23+
24+
@Column
25+
private CleanStatus cleanStatus;
26+
27+
@Column
28+
private boolean smokingAllowed;
29+
30+
@Column
31+
private boolean underMaintenance;
32+
33+
34+
public Room() {
35+
}
36+
37+
public Room(String id, int number,
38+
RoomType type, RoomStatus status,
39+
CleanStatus cleanStatus,
40+
boolean smokingAllowed, boolean underMaintenance) {
41+
this.id = id;
42+
this.number = number;
43+
this.type = type;
44+
this.status = status;
45+
this.cleanStatus = cleanStatus;
46+
this.smokingAllowed = smokingAllowed;
47+
this.underMaintenance = underMaintenance;
48+
}
49+
50+
public String getId() {
51+
return id;
52+
}
53+
54+
public int getNumber() {
55+
return number;
56+
}
57+
58+
public RoomType getType() {
59+
return type;
60+
}
61+
62+
public RoomStatus getStatus() {
63+
return status;
64+
}
65+
66+
public CleanStatus getCleanStatus() {
67+
return cleanStatus;
68+
}
69+
70+
public boolean isSmokingAllowed() {
71+
return smokingAllowed;
72+
}
73+
74+
public boolean isUnderMaintenance() {
75+
return underMaintenance;
76+
}
77+
78+
79+
@Override
80+
public boolean equals(Object o) {
81+
if (o == null || getClass() != o.getClass()) {
82+
return false;
83+
}
84+
Room room = (Room) o;
85+
return Objects.equals(id, room.id);
86+
}
87+
88+
@Override
89+
public int hashCode() {
90+
return Objects.hashCode(id);
91+
}
92+
93+
@Override
94+
public String toString() {
95+
return "Room{" +
96+
"id='" + id + '\'' +
97+
", roomNumber=" + number +
98+
", type=" + type +
99+
", status=" + status +
100+
", cleanStatus=" + cleanStatus +
101+
", smokingAllowed=" + smokingAllowed +
102+
", underMaintenance=" + underMaintenance +
103+
'}';
104+
}
105+
106+
107+
public static RoomBuilder builder() {
108+
return new RoomBuilder();
109+
}
110+
}

0 commit comments

Comments
 (0)