Skip to content

Commit f42bcf5

Browse files
authored
Merge pull request #277 from eclipse-jnosql/include-tck-nosql
Include Jakarta NoSQL TCK at mongodb databases
2 parents 1a8512c + 8a854b9 commit f42bcf5

File tree

136 files changed

+1699
-1636
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

136 files changed

+1699
-1636
lines changed

CHANGELOG.adoc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,16 @@ and this project adheres to https://semver.org/spec/v2.0.0.html[Semantic Version
88

99
== [Unreleased]
1010

11+
=== Added
12+
13+
- Include TCK tests
14+
15+
=== Changed
16+
17+
- Update OrientDB driver to 3.2.36
18+
- Update Couchbase client 3.7.6
19+
- Update DynamoDB driver 2.29.45
20+
1121
== [1.1.4] - 2024-10-24
1222

1323
== Changes

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ b) in the case of each subsequent Contributor:
1313
i) changes to the Program, and
1414
ii) additions to the Program;
1515
where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program.
16-
"Contributor" means any person or entity that distributes the Program.
16+
"Contributor" means any contact or entity that distributes the Program.
1717

1818
"Licensed Patents" mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program.
1919

README.adoc

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1960,6 +1960,42 @@ class IntegrationSampleTest {
19601960
}
19611961
----
19621962

1963+
== Performing the Jakarta NoSQL TCK
1964+
1965+
To perform the Jakarta NoSQL TCK you should activate the `tck` profile. This profile will download the TCK and run it.
1966+
1967+
[IMPORTANT]
1968+
====
1969+
By default, the TCK will run in all modules that have the `tck.nosql.skip` property defined as `false`.
1970+
====
1971+
1972+
[source,bash]
1973+
----
1974+
mvn test -Ptck
1975+
----
1976+
1977+
To run the Jakarta NoSQL TCK only in a specific module, you can use the `-pl` option, for example:
1978+
1979+
[source,bash]
1980+
----
1981+
mvn test -Ptck -pl jnosql-mongodb
1982+
----
1983+
1984+
1985+
[IMPORTANT]
1986+
====
1987+
By default, activating the `tck` profile does not disable the execution of the default tests. To skip the default tests you can use `-DskipTests`. It will skip the unit tests and run only the TCK tests.
1988+
[source,bash]
1989+
----
1990+
mvn test -Ptck -DskipTests
1991+
----
1992+
====
1993+
1994+
The JNoSQL Database API implementations that support Jakarta NoSQL TCK execution already:
1995+
1996+
- link:#_mongodb[MongoDB]
1997+
1998+
19631999
== Want to Contribute a New Driver?
19642000

19652001
As an open-source project, you're free to create any driver, and you're welcome to join and participate in the process.

jnosql-arangodb/src/test/java/org/eclipse/jnosql/databases/arangodb/communication/ArangoDBDocumentManagerTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ void shouldCount() {
202202
void shouldReadFromDifferentBaseDocumentUsingInstance() {
203203
entityManager.insert(getEntity());
204204
ArangoDB arangoDB = DefaultArangoDBDocumentManager.class.cast(entityManager).getArangoDB();
205-
arangoDB.db(DATABASE).collection(COLLECTION_NAME).insertDocument(new Person());
205+
arangoDB.db(DATABASE).collection(COLLECTION_NAME).insertDocument(new Human());
206206
SelectQuery select = select().from(COLLECTION_NAME).build();
207207
List<CommunicationEntity> entities = entityManager.select(select).collect(Collectors.toList());
208208
assertFalse(entities.isEmpty());

jnosql-arangodb/src/test/java/org/eclipse/jnosql/databases/arangodb/communication/Person.java renamed to jnosql-arangodb/src/test/java/org/eclipse/jnosql/databases/arangodb/communication/Human.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*/
1515
package org.eclipse.jnosql.databases.arangodb.communication;
1616

17-
public class Person {
17+
public class Human {
1818

1919
private String name = "Ada";
2020

jnosql-arangodb/src/test/java/org/eclipse/jnosql/databases/arangodb/integration/ArangoDBTemplateIntegrationTest.java

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848

4949
@EnableAutoWeld
5050
@AddPackages(value = {Database.class, EntityConverter.class, DocumentTemplate.class})
51-
@AddPackages(Book.class)
51+
@AddPackages(Magazine.class)
5252
@AddPackages(ArangoDBTemplate.class)
5353
@AddExtensions({EntityMetadataExtension.class,
5454
DocumentExtension.class})
@@ -68,101 +68,101 @@ class ArangoDBTemplateIntegrationTest {
6868

6969
@BeforeEach
7070
void setUp() {
71-
this.template.delete(Book.class).execute();
71+
this.template.delete(Magazine.class).execute();
7272
}
7373

7474
@Test
7575
void shouldInsert() {
76-
Book book = new Book(randomUUID().toString(), "Effective Java", 1);
77-
template.insert(book);
78-
Optional<Book> optional = template.find(Book.class, book.id());
76+
Magazine magazine = new Magazine(randomUUID().toString(), "Effective Java", 1);
77+
template.insert(magazine);
78+
Optional<Magazine> optional = template.find(Magazine.class, magazine.id());
7979
assertThat(optional).isNotNull().isNotEmpty()
80-
.get().isEqualTo(book);
80+
.get().isEqualTo(magazine);
8181
}
8282

8383
@Test
8484
void shouldUpdate() {
85-
Book book = new Book(randomUUID().toString(), "Effective Java", 1);
86-
assertThat(template.insert(book))
85+
Magazine magazine = new Magazine(randomUUID().toString(), "Effective Java", 1);
86+
assertThat(template.insert(magazine))
8787
.isNotNull()
88-
.isEqualTo(book);
88+
.isEqualTo(magazine);
8989

90-
Book updated = new Book(book.id(), book.title() + " updated", 2);
90+
Magazine updated = new Magazine(magazine.id(), magazine.title() + " updated", 2);
9191

9292
assertThat(template.update(updated))
9393
.isNotNull()
94-
.isNotEqualTo(book);
94+
.isNotEqualTo(magazine);
9595

96-
assertThat(template.find(Book.class, book.id()))
96+
assertThat(template.find(Magazine.class, magazine.id()))
9797
.isNotNull().get().isEqualTo(updated);
9898

9999
}
100100

101101
@Test
102102
void shouldFindById() {
103-
Book book = new Book(randomUUID().toString(), "Effective Java", 1);
104-
assertThat(template.insert(book))
103+
Magazine magazine = new Magazine(randomUUID().toString(), "Effective Java", 1);
104+
assertThat(template.insert(magazine))
105105
.isNotNull()
106-
.isEqualTo(book);
106+
.isEqualTo(magazine);
107107

108-
assertThat(template.find(Book.class, book.id()))
109-
.isNotNull().get().isEqualTo(book);
108+
assertThat(template.find(Magazine.class, magazine.id()))
109+
.isNotNull().get().isEqualTo(magazine);
110110
}
111111

112112
@Test
113113
void shouldDelete() {
114-
Book book = new Book(randomUUID().toString(), "Effective Java", 1);
115-
assertThat(template.insert(book))
114+
Magazine magazine = new Magazine(randomUUID().toString(), "Effective Java", 1);
115+
assertThat(template.insert(magazine))
116116
.isNotNull()
117-
.isEqualTo(book);
117+
.isEqualTo(magazine);
118118

119-
template.delete(Book.class, book.id());
120-
assertThat(template.find(Book.class, book.id()))
119+
template.delete(Magazine.class, magazine.id());
120+
assertThat(template.find(Magazine.class, magazine.id()))
121121
.isNotNull().isEmpty();
122122
}
123123

124124
@Test
125125
void shouldDeleteAll() {
126126
for (int index = 0; index < 20; index++) {
127-
Book book = new Book(randomUUID().toString(), "Effective Java", 1);
128-
assertThat(template.insert(book))
127+
Magazine magazine = new Magazine(randomUUID().toString(), "Effective Java", 1);
128+
assertThat(template.insert(magazine))
129129
.isNotNull()
130-
.isEqualTo(book);
130+
.isEqualTo(magazine);
131131
}
132132

133-
template.delete(Book.class).execute();
134-
assertThat(template.select(Book.class).result()).isEmpty();
133+
template.delete(Magazine.class).execute();
134+
assertThat(template.select(Magazine.class).result()).isEmpty();
135135
}
136136

137137

138138
@Test
139139
void shouldUpdateNullValues() {
140-
var book = new Book(randomUUID().toString(), "Effective Java", 1);
140+
var book = new Magazine(randomUUID().toString(), "Effective Java", 1);
141141
template.insert(book);
142-
template.update(new Book(book.id(), null, 2));
143-
Optional<Book> optional = template.select(Book.class).where("id")
142+
template.update(new Magazine(book.id(), null, 2));
143+
Optional<Magazine> optional = template.select(Magazine.class).where("id")
144144
.eq(book.id()).singleResult();
145145
SoftAssertions.assertSoftly(softly -> {
146146
softly.assertThat(optional).isPresent();
147-
softly.assertThat(optional).get().extracting(Book::title).isNull();
148-
softly.assertThat(optional).get().extracting(Book::edition).isEqualTo(2);
147+
softly.assertThat(optional).get().extracting(Magazine::title).isNull();
148+
softly.assertThat(optional).get().extracting(Magazine::edition).isEqualTo(2);
149149
});
150150
}
151151

152152
@Test
153153
void shouldExecuteLimit() {
154154

155155
for (int index = 1; index < 10; index++) {
156-
var book = new Book(randomUUID().toString(), "Effective Java", index);
156+
var book = new Magazine(randomUUID().toString(), "Effective Java", index);
157157
template.insert(book);
158158
}
159159

160-
List<Book> books = template.select(Book.class).orderBy("edition")
160+
List<Magazine> magazines = template.select(Magazine.class).orderBy("edition")
161161
.asc().limit(4).result();
162162

163163
SoftAssertions.assertSoftly(soft -> {
164-
soft.assertThat(books).hasSize(4);
165-
var editions = books.stream().map(Book::edition).toList();
164+
soft.assertThat(magazines).hasSize(4);
165+
var editions = magazines.stream().map(Magazine::edition).toList();
166166
soft.assertThat(editions).hasSize(4).contains(1, 2, 3, 4);
167167
});
168168

@@ -171,52 +171,52 @@ void shouldExecuteLimit() {
171171
@Test
172172
void shouldExecuteSkip() {
173173
for (int index = 1; index < 10; index++) {
174-
var book = new Book(randomUUID().toString(), "Effective Java", index);
174+
var book = new Magazine(randomUUID().toString(), "Effective Java", index);
175175
template.insert(book);
176176
}
177177

178-
List<Book> books = template.select(Book.class).orderBy("edition")
178+
List<Magazine> magazines = template.select(Magazine.class).orderBy("edition")
179179
.asc().skip(4).result();
180180

181181
SoftAssertions.assertSoftly(soft -> {
182-
soft.assertThat(books).hasSize(5);
183-
var editions = books.stream().map(Book::edition).toList();
182+
soft.assertThat(magazines).hasSize(5);
183+
var editions = magazines.stream().map(Magazine::edition).toList();
184184
soft.assertThat(editions).hasSize(5).contains(5, 6, 7, 8, 9);
185185
});
186186
}
187187

188188
@Test
189189
void shouldExecuteLimitStart() {
190190
for (int index = 1; index < 10; index++) {
191-
var book = new Book(randomUUID().toString(), "Effective Java", index);
191+
var book = new Magazine(randomUUID().toString(), "Effective Java", index);
192192
template.insert(book);
193193
}
194194

195-
List<Book> books = template.select(Book.class).orderBy("edition")
195+
List<Magazine> magazines = template.select(Magazine.class).orderBy("edition")
196196
.asc().skip(4).limit(3).result();
197197

198198
SoftAssertions.assertSoftly(soft -> {
199-
soft.assertThat(books).hasSize(3);
200-
var editions = books.stream().map(Book::edition).toList();
199+
soft.assertThat(magazines).hasSize(3);
200+
var editions = magazines.stream().map(Magazine::edition).toList();
201201
soft.assertThat(editions).hasSize(3).contains(5, 6, 7);
202202
});
203203
}
204204

205205
@Test
206206
void shouldSelectCursorSize() {
207207
for (int index = 1; index < 10; index++) {
208-
var book = new Book(randomUUID().toString(), "Effective Java", index);
208+
var book = new Magazine(randomUUID().toString(), "Effective Java", index);
209209
template.insert(book);
210210
}
211-
var select = SelectQuery.select().from("Book").orderBy("edition").asc()
211+
var select = SelectQuery.select().from("Magazine").orderBy("edition").asc()
212212
.skip(4).limit(3).build();
213213
var pageRequest = PageRequest.ofSize(3);
214-
CursoredPage<Book> entities = template.selectCursor(select, pageRequest);
214+
CursoredPage<Magazine> entities = template.selectCursor(select, pageRequest);
215215

216216
SoftAssertions.assertSoftly(soft -> {
217217
var content = entities.content();
218218
soft.assertThat(content).hasSize(3);
219-
var editions = content.stream().map(Book::edition).toList();
219+
var editions = content.stream().map(Magazine::edition).toList();
220220
soft.assertThat(editions).hasSize(3).contains(1, 2, 3);
221221
});
222222
}

jnosql-arangodb/src/test/java/org/eclipse/jnosql/databases/arangodb/integration/Book.java renamed to jnosql-arangodb/src/test/java/org/eclipse/jnosql/databases/arangodb/integration/Magazine.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import java.util.Objects;
2222

2323
@Entity
24-
public class Book {
24+
public class Magazine {
2525

2626
@Id("_key")
2727
private String id;
@@ -32,13 +32,13 @@ public class Book {
3232
@Column("edition")
3333
private int edition;
3434

35-
public Book(String id, String title, int edition) {
35+
public Magazine(String id, String title, int edition) {
3636
this.id = id;
3737
this.title = title;
3838
this.edition = edition;
3939
}
4040

41-
Book() {
41+
Magazine() {
4242
}
4343

4444
public String id() {
@@ -57,10 +57,10 @@ public int edition() {
5757
public boolean equals(Object o) {
5858
if (this == o) return true;
5959
if (o == null || getClass() != o.getClass()) return false;
60-
Book book = (Book) o;
61-
return edition == book.edition
62-
&& Objects.equals(id, book.id)
63-
&& Objects.equals(title, book.title);
60+
Magazine magazine = (Magazine) o;
61+
return edition == magazine.edition
62+
&& Objects.equals(id, magazine.id)
63+
&& Objects.equals(title, magazine.title);
6464
}
6565

6666
@Override

0 commit comments

Comments
 (0)