Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include Jakarta NoSQL TCK at mongodb databases #277

Merged
merged 58 commits into from
Jan 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
170c87b
chore: include mongodb tck driver
otaviojava Jun 2, 2024
9f813db
feat: include mongodb configuration to run tests
otaviojava Jun 2, 2024
cf2b334
feat: update and rebase codebase
otaviojava Dec 24, 2024
460cdc0
feat: cfix conversion
otaviojava Dec 24, 2024
3680b37
chore: refactoring mongodb template
otaviojava Dec 25, 2024
06ba201
feat: update mongodd template
otaviojava Dec 25, 2024
ddc588d
feat: update report to magazine
otaviojava Dec 25, 2024
ebadb2a
chore: creating tck maven profile
dearrudam Dec 29, 2024
0a2a713
chore: added property to enable nosql tck tests execution
dearrudam Dec 29, 2024
7248bbe
chore: removed unnecessary method calling
dearrudam Dec 29, 2024
5b86341
chore: added documentation about performing the Jakarta NoSQL TCK
dearrudam Dec 29, 2024
3526e63
feat: small fix at dynamo document manager
otaviojava Jan 1, 2025
e08a52b
feat: remove unecessary extends object
otaviojava Jan 1, 2025
2952c65
feat: remove unecessary toString
otaviojava Jan 1, 2025
be7815d
feat: remove unecessary semi comma
otaviojava Jan 1, 2025
a2fcc05
feat: remove unecessary imports
otaviojava Jan 1, 2025
5ca9e8c
feat: enhnace switch case at DynamoDB converter
otaviojava Jan 1, 2025
cf66341
feat: update orientdb with Safe varags annotations
otaviojava Jan 1, 2025
0085225
feat: update cassandra template with lambda
otaviojava Jan 1, 2025
a759bf3
feat: enhance code with method reference
otaviojava Jan 1, 2025
b65bc9e
docs: enhance documentation at solr configuration
otaviojava Jan 1, 2025
2351e66
feat: fix log creation at TableCreation configuration at oracle database
otaviojava Jan 1, 2025
97d1252
feat: remove unecessary method at orientdbbean
otaviojava Jan 1, 2025
cf5cf6c
chore: rebase remote branch
dearrudam Jan 3, 2025
62d6ffc
Merge branch 'main' into include-tck-nosql
dearrudam Jan 3, 2025
184e6dc
feat: update mapping integration
otaviojava Jan 3, 2025
c651f85
feat: fix mongodb
otaviojava Jan 3, 2025
bd62173
feat: update contact cassandra sample
otaviojava Jan 3, 2025
60b3d2d
feat: update contact entity at cassandra
otaviojava Jan 3, 2025
d0fac1b
feat: inline to Animal
otaviojava Jan 4, 2025
d8bf029
feat: update creature
otaviojava Jan 4, 2025
9e78f36
feat: rename entity class
otaviojava Jan 4, 2025
a567c88
feat: rename entity
otaviojava Jan 4, 2025
9d69776
test: update test on graph
otaviojava Jan 4, 2025
af3e735
feat: rename and update entities
otaviojava Jan 4, 2025
ee33c10
feat: update terminology
otaviojava Jan 4, 2025
1f7f32c
feat: rename to magazine at araongdb
otaviojava Jan 4, 2025
a086bf5
feat: update arangodb entities
otaviojava Jan 4, 2025
e850103
fat: rename and update human repository
otaviojava Jan 4, 2025
f8a20e4
update couchbase properties
otaviojava Jan 4, 2025
04ac9b3
feat: udpate human sample code
otaviojava Jan 4, 2025
15926f5
feat: udpate casandra code smaple
otaviojava Jan 4, 2025
823885e
feat: udpate structure terminology
otaviojava Jan 4, 2025
5385c72
feat: update article instead of mongodb book
otaviojava Jan 4, 2025
1b58ddf
test: udpate mongodb test integration
otaviojava Jan 4, 2025
8ce39ee
feat: update magainze sample code
otaviojava Jan 4, 2025
400f97b
feat: udpate ES database
otaviojava Jan 4, 2025
b50929d
feat: update tests
otaviojava Jan 4, 2025
ad6e269
fat: update structure avoid tck names
otaviojava Jan 4, 2025
e7ed2c7
feat: update test structure
otaviojava Jan 4, 2025
c2a8653
test: update arangodb test
otaviojava Jan 4, 2025
c70be15
test: fix dynamodb test
otaviojava Jan 4, 2025
30b7aea
test: update ES
otaviojava Jan 4, 2025
4009ca8
test: update arangodb
otaviojava Jan 4, 2025
8ac1638
chore: update orientdb version 3.2.36
otaviojava Jan 4, 2025
68c5d8e
chore: update dynamodb
otaviojava Jan 4, 2025
1933e5a
chore: update couchbase
otaviojava Jan 4, 2025
8a854b9
docs: update changelog
otaviojava Jan 4, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@ and this project adheres to https://semver.org/spec/v2.0.0.html[Semantic Version

== [Unreleased]

=== Added

- Include TCK tests

=== Changed

- Update OrientDB driver to 3.2.36
- Update Couchbase client 3.7.6
- Update DynamoDB driver 2.29.45

== [1.1.4] - 2024-10-24

== Changes
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ b) in the case of each subsequent Contributor:
i) changes to the Program, and
ii) additions to the Program;
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.
"Contributor" means any person or entity that distributes the Program.
"Contributor" means any contact or entity that distributes the Program.

"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.

Expand Down
36 changes: 36 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -1960,6 +1960,42 @@ class IntegrationSampleTest {
}
----

== Performing the Jakarta NoSQL TCK

To perform the Jakarta NoSQL TCK you should activate the `tck` profile. This profile will download the TCK and run it.

[IMPORTANT]
====
By default, the TCK will run in all modules that have the `tck.nosql.skip` property defined as `false`.
====

[source,bash]
----
mvn test -Ptck
----

To run the Jakarta NoSQL TCK only in a specific module, you can use the `-pl` option, for example:

[source,bash]
----
mvn test -Ptck -pl jnosql-mongodb
----


[IMPORTANT]
====
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.
[source,bash]
----
mvn test -Ptck -DskipTests
----
====

The JNoSQL Database API implementations that support Jakarta NoSQL TCK execution already:

- link:#_mongodb[MongoDB]


== Want to Contribute a New Driver?

As an open-source project, you're free to create any driver, and you're welcome to join and participate in the process.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ void shouldCount() {
void shouldReadFromDifferentBaseDocumentUsingInstance() {
entityManager.insert(getEntity());
ArangoDB arangoDB = DefaultArangoDBDocumentManager.class.cast(entityManager).getArangoDB();
arangoDB.db(DATABASE).collection(COLLECTION_NAME).insertDocument(new Person());
arangoDB.db(DATABASE).collection(COLLECTION_NAME).insertDocument(new Human());
SelectQuery select = select().from(COLLECTION_NAME).build();
List<CommunicationEntity> entities = entityManager.select(select).collect(Collectors.toList());
assertFalse(entities.isEmpty());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/
package org.eclipse.jnosql.databases.arangodb.communication;

public class Person {
public class Human {

private String name = "Ada";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

@EnableAutoWeld
@AddPackages(value = {Database.class, EntityConverter.class, DocumentTemplate.class})
@AddPackages(Book.class)
@AddPackages(Magazine.class)
@AddPackages(ArangoDBTemplate.class)
@AddExtensions({EntityMetadataExtension.class,
DocumentExtension.class})
Expand All @@ -68,101 +68,101 @@ class ArangoDBTemplateIntegrationTest {

@BeforeEach
void setUp() {
this.template.delete(Book.class).execute();
this.template.delete(Magazine.class).execute();
}

@Test
void shouldInsert() {
Book book = new Book(randomUUID().toString(), "Effective Java", 1);
template.insert(book);
Optional<Book> optional = template.find(Book.class, book.id());
Magazine magazine = new Magazine(randomUUID().toString(), "Effective Java", 1);
template.insert(magazine);
Optional<Magazine> optional = template.find(Magazine.class, magazine.id());
assertThat(optional).isNotNull().isNotEmpty()
.get().isEqualTo(book);
.get().isEqualTo(magazine);
}

@Test
void shouldUpdate() {
Book book = new Book(randomUUID().toString(), "Effective Java", 1);
assertThat(template.insert(book))
Magazine magazine = new Magazine(randomUUID().toString(), "Effective Java", 1);
assertThat(template.insert(magazine))
.isNotNull()
.isEqualTo(book);
.isEqualTo(magazine);

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

assertThat(template.update(updated))
.isNotNull()
.isNotEqualTo(book);
.isNotEqualTo(magazine);

assertThat(template.find(Book.class, book.id()))
assertThat(template.find(Magazine.class, magazine.id()))
.isNotNull().get().isEqualTo(updated);

}

@Test
void shouldFindById() {
Book book = new Book(randomUUID().toString(), "Effective Java", 1);
assertThat(template.insert(book))
Magazine magazine = new Magazine(randomUUID().toString(), "Effective Java", 1);
assertThat(template.insert(magazine))
.isNotNull()
.isEqualTo(book);
.isEqualTo(magazine);

assertThat(template.find(Book.class, book.id()))
.isNotNull().get().isEqualTo(book);
assertThat(template.find(Magazine.class, magazine.id()))
.isNotNull().get().isEqualTo(magazine);
}

@Test
void shouldDelete() {
Book book = new Book(randomUUID().toString(), "Effective Java", 1);
assertThat(template.insert(book))
Magazine magazine = new Magazine(randomUUID().toString(), "Effective Java", 1);
assertThat(template.insert(magazine))
.isNotNull()
.isEqualTo(book);
.isEqualTo(magazine);

template.delete(Book.class, book.id());
assertThat(template.find(Book.class, book.id()))
template.delete(Magazine.class, magazine.id());
assertThat(template.find(Magazine.class, magazine.id()))
.isNotNull().isEmpty();
}

@Test
void shouldDeleteAll() {
for (int index = 0; index < 20; index++) {
Book book = new Book(randomUUID().toString(), "Effective Java", 1);
assertThat(template.insert(book))
Magazine magazine = new Magazine(randomUUID().toString(), "Effective Java", 1);
assertThat(template.insert(magazine))
.isNotNull()
.isEqualTo(book);
.isEqualTo(magazine);
}

template.delete(Book.class).execute();
assertThat(template.select(Book.class).result()).isEmpty();
template.delete(Magazine.class).execute();
assertThat(template.select(Magazine.class).result()).isEmpty();
}


@Test
void shouldUpdateNullValues() {
var book = new Book(randomUUID().toString(), "Effective Java", 1);
var book = new Magazine(randomUUID().toString(), "Effective Java", 1);
template.insert(book);
template.update(new Book(book.id(), null, 2));
Optional<Book> optional = template.select(Book.class).where("id")
template.update(new Magazine(book.id(), null, 2));
Optional<Magazine> optional = template.select(Magazine.class).where("id")
.eq(book.id()).singleResult();
SoftAssertions.assertSoftly(softly -> {
softly.assertThat(optional).isPresent();
softly.assertThat(optional).get().extracting(Book::title).isNull();
softly.assertThat(optional).get().extracting(Book::edition).isEqualTo(2);
softly.assertThat(optional).get().extracting(Magazine::title).isNull();
softly.assertThat(optional).get().extracting(Magazine::edition).isEqualTo(2);
});
}

@Test
void shouldExecuteLimit() {

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

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

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

Expand All @@ -171,52 +171,52 @@ void shouldExecuteLimit() {
@Test
void shouldExecuteSkip() {
for (int index = 1; index < 10; index++) {
var book = new Book(randomUUID().toString(), "Effective Java", index);
var book = new Magazine(randomUUID().toString(), "Effective Java", index);
template.insert(book);
}

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

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

@Test
void shouldExecuteLimitStart() {
for (int index = 1; index < 10; index++) {
var book = new Book(randomUUID().toString(), "Effective Java", index);
var book = new Magazine(randomUUID().toString(), "Effective Java", index);
template.insert(book);
}

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

SoftAssertions.assertSoftly(soft -> {
soft.assertThat(books).hasSize(3);
var editions = books.stream().map(Book::edition).toList();
soft.assertThat(magazines).hasSize(3);
var editions = magazines.stream().map(Magazine::edition).toList();
soft.assertThat(editions).hasSize(3).contains(5, 6, 7);
});
}

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

SoftAssertions.assertSoftly(soft -> {
var content = entities.content();
soft.assertThat(content).hasSize(3);
var editions = content.stream().map(Book::edition).toList();
var editions = content.stream().map(Magazine::edition).toList();
soft.assertThat(editions).hasSize(3).contains(1, 2, 3);
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import java.util.Objects;

@Entity
public class Book {
public class Magazine {

@Id("_key")
private String id;
Expand All @@ -32,13 +32,13 @@ public class Book {
@Column("edition")
private int edition;

public Book(String id, String title, int edition) {
public Magazine(String id, String title, int edition) {
this.id = id;
this.title = title;
this.edition = edition;
}

Book() {
Magazine() {
}

public String id() {
Expand All @@ -57,10 +57,10 @@ public int edition() {
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Book book = (Book) o;
return edition == book.edition
&& Objects.equals(id, book.id)
&& Objects.equals(title, book.title);
Magazine magazine = (Magazine) o;
return edition == magazine.edition
&& Objects.equals(id, magazine.id)
&& Objects.equals(title, magazine.title);
}

@Override
Expand Down
Loading
Loading