Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import jakarta.persistence.Table;
import java.math.BigDecimal;
import java.sql.SQLFeatureNotSupportedException;
import java.time.Instant;
import java.util.Collection;
import java.util.LinkedHashSet;
import java.util.List;
Expand Down Expand Up @@ -94,6 +95,7 @@ void testArrayAndCollectionValues() {
new String[] {null, "str"},
new BigDecimal[] {null, BigDecimal.valueOf(10.1)},
new ObjectId[] {new ObjectId("000000000000000000000001"), null},
new Instant[] {Instant.parse("2007-12-03T10:15:30Z")},
new StructAggregateEmbeddableIntegrationTests.Single[] {
new StructAggregateEmbeddableIntegrationTests.Single(1), null
},
Expand All @@ -105,7 +107,8 @@ void testArrayAndCollectionValues() {
asList("str", null),
asList(BigDecimal.valueOf(10.1), null),
asList(null, new ObjectId("000000000000000000000001")),
asList(new StructAggregateEmbeddableIntegrationTests.Single(1), null));
asList(new StructAggregateEmbeddableIntegrationTests.Single(1), null),
List.of(Instant.parse("2007-12-03T10:15:30Z")));
sessionFactoryScope.inTransaction(session -> session.persist(item));
assertCollectionContainsExactly(
"""
Expand Down Expand Up @@ -134,7 +137,9 @@ void testArrayAndCollectionValues() {
stringsCollection: ["str", null],
bigDecimalsCollection: [{$numberDecimal: "10.1"}, null],
objectIdsCollection: [null, {$oid: "000000000000000000000001"}],
structAggregateEmbeddablesCollection: [{a: 1}, null]
structAggregateEmbeddablesCollection: [{a: 1}, null],
instants: [{"$date": "2007-12-03T10:15:30Z"}],
instantsCollection: [{"$date": "2007-12-03T10:15:30Z"}]
}
""");
var loadedItem = sessionFactoryScope.fromTransaction(
Expand Down Expand Up @@ -176,7 +181,9 @@ void testArrayAndCollectionValues() {
stringsCollection: ["str", null],
bigDecimalsCollection: [{$numberDecimal: "10.1"}, null],
objectIdsCollection: [null, {$oid: "000000000000000000000001"}],
structAggregateEmbeddablesCollection: [{a: 1}, null]
structAggregateEmbeddablesCollection: [{a: 1}, null],
instants: [{"$date": "2007-12-03T10:15:30Z"}],
instantsCollection: [{"$date": "2007-12-03T10:15:30Z"}]
}
""");
loadedItem = sessionFactoryScope.fromTransaction(
Expand All @@ -202,6 +209,7 @@ void testArrayAndCollectionEmptyValues() {
new String[0],
new BigDecimal[0],
new ObjectId[0],
new Instant[0],
new StructAggregateEmbeddableIntegrationTests.Single[0],
List.of(),
List.of(),
Expand All @@ -211,6 +219,7 @@ void testArrayAndCollectionEmptyValues() {
List.of(),
List.of(),
List.of(),
List.of(),
List.of());
sessionFactoryScope.inTransaction(session -> session.persist(item));
assertCollectionContainsExactly(
Expand Down Expand Up @@ -240,7 +249,9 @@ void testArrayAndCollectionEmptyValues() {
stringsCollection: [],
bigDecimalsCollection: [],
objectIdsCollection: [],
structAggregateEmbeddablesCollection: []
structAggregateEmbeddablesCollection: [],
instants: [],
instantsCollection: []
}
""");
var loadedItem = sessionFactoryScope.fromTransaction(
Expand All @@ -252,7 +263,7 @@ void testArrayAndCollectionEmptyValues() {
void testArrayAndCollectionNullValues() {
var item = new ItemWithArrayAndCollectionValues(
1, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null);
null, null, null, null, null, null, null, null, null);
sessionFactoryScope.inTransaction(session -> session.persist(item));
assertCollectionContainsExactly(
"""
Expand Down Expand Up @@ -281,7 +292,9 @@ void testArrayAndCollectionNullValues() {
stringsCollection: null,
bigDecimalsCollection: null,
objectIdsCollection: null,
structAggregateEmbeddablesCollection: null
structAggregateEmbeddablesCollection: null,
instants: null,
instantsCollection: null
}
""");
var loadedItem = sessionFactoryScope.fromTransaction(
Expand All @@ -306,6 +319,7 @@ void testArrayAndCollectionValuesOfStructAggregateEmbeddablesHavingArraysAndColl
new String[] {"str"},
new BigDecimal[] {BigDecimal.valueOf(10.1)},
new ObjectId[] {new ObjectId("000000000000000000000001")},
new Instant[] {Instant.parse("2007-12-03T10:15:30Z")},
new StructAggregateEmbeddableIntegrationTests.Single[] {
new StructAggregateEmbeddableIntegrationTests.Single(1)
},
Expand All @@ -318,7 +332,8 @@ void testArrayAndCollectionValuesOfStructAggregateEmbeddablesHavingArraysAndColl
List.of("str"),
List.of(BigDecimal.valueOf(10.1)),
List.of(new ObjectId("000000000000000000000001")),
List.of(new StructAggregateEmbeddableIntegrationTests.Single(1)));
List.of(new StructAggregateEmbeddableIntegrationTests.Single(1)),
List.of(Instant.parse("2007-12-03T10:15:30Z")));
var item = new ItemWithArrayAndCollectionValuesOfStructAggregateEmbeddablesHavingArraysAndCollections(
1, new ArraysAndCollections[] {arraysAndCollections}, List.of());
sessionFactoryScope.inTransaction(session -> session.persist(item));
Expand Down Expand Up @@ -350,7 +365,9 @@ void testArrayAndCollectionValuesOfStructAggregateEmbeddablesHavingArraysAndColl
stringsCollection: ["str"],
bigDecimalsCollection: [{$numberDecimal: "10.1"}],
objectIdsCollection: [{$oid: "000000000000000000000001"}],
structAggregateEmbeddablesCollection: [{a: 1}]
structAggregateEmbeddablesCollection: [{a: 1}],
instants: [{"$date": "2007-12-03T10:15:30Z"}],
instantsCollection: [{"$date": "2007-12-03T10:15:30Z"}]
}],
structAggregateEmbeddablesCollection: []
}
Expand Down Expand Up @@ -395,7 +412,9 @@ void testArrayAndCollectionValuesOfStructAggregateEmbeddablesHavingArraysAndColl
stringsCollection: ["str"],
bigDecimalsCollection: [{$numberDecimal: "10.1"}],
objectIdsCollection: [{$oid: "000000000000000000000001"}],
structAggregateEmbeddablesCollection: [{a: 1}]
structAggregateEmbeddablesCollection: [{a: 1}],
instants: [{"$date": "2007-12-03T10:15:30Z"}],
instantsCollection: [{"$date": "2007-12-03T10:15:30Z"}]
}]
}
""");
Expand All @@ -413,7 +432,7 @@ void testArrayAndCollectionValuesOfStructAggregateEmbeddablesHavingArraysAndColl
public void testArrayAndCollectionValuesOfEmptyStructAggregateEmbeddables() {
var emptyStructAggregateEmbeddable = new ArraysAndCollections(
null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null);
null, null, null, null, null, null, null, null, null);
var item = new ItemWithArrayAndCollectionValuesOfStructAggregateEmbeddablesHavingArraysAndCollections(
1,
new ArraysAndCollections[] {emptyStructAggregateEmbeddable},
Expand Down Expand Up @@ -447,7 +466,9 @@ public void testArrayAndCollectionValuesOfEmptyStructAggregateEmbeddables() {
stringsCollection: null,
bigDecimalsCollection: null,
objectIdsCollection: null,
structAggregateEmbeddablesCollection: null
structAggregateEmbeddablesCollection: null,
instants: null,
instantsCollection: null,
}],
structAggregateEmbeddablesCollection: [{
bytes: null,
Expand All @@ -473,7 +494,9 @@ public void testArrayAndCollectionValuesOfEmptyStructAggregateEmbeddables() {
stringsCollection: null,
bigDecimalsCollection: null,
objectIdsCollection: null,
structAggregateEmbeddablesCollection: null
structAggregateEmbeddablesCollection: null,
instants: null,
instantsCollection: null,
}]
}
""");
Expand Down Expand Up @@ -506,6 +529,7 @@ static class ItemWithArrayAndCollectionValues {
String[] strings;
BigDecimal[] bigDecimals;
ObjectId[] objectIds;
Instant[] instants;
StructAggregateEmbeddableIntegrationTests.Single[] structAggregateEmbeddables;
Collection<Character> charsCollection;
Collection<Integer> intsCollection;
Expand All @@ -516,6 +540,7 @@ static class ItemWithArrayAndCollectionValues {
Collection<BigDecimal> bigDecimalsCollection;
Collection<ObjectId> objectIdsCollection;
Collection<StructAggregateEmbeddableIntegrationTests.Single> structAggregateEmbeddablesCollection;
Collection<Instant> instantsCollection;

ItemWithArrayAndCollectionValues() {}

Expand All @@ -535,6 +560,7 @@ static class ItemWithArrayAndCollectionValues {
String[] strings,
BigDecimal[] bigDecimals,
ObjectId[] objectIds,
Instant[] instants,
StructAggregateEmbeddableIntegrationTests.Single[] structAggregateEmbeddables,
Collection<Character> charsCollection,
Collection<Integer> intsCollection,
Expand All @@ -544,7 +570,8 @@ static class ItemWithArrayAndCollectionValues {
Collection<String> stringsCollection,
Collection<BigDecimal> bigDecimalsCollection,
Collection<ObjectId> objectIdsCollection,
Collection<StructAggregateEmbeddableIntegrationTests.Single> structAggregateEmbeddablesCollection) {
Collection<StructAggregateEmbeddableIntegrationTests.Single> structAggregateEmbeddablesCollection,
List<Instant> instantsCollection) {
this.id = id;
this.bytes = bytes;
this.chars = chars;
Expand All @@ -570,6 +597,8 @@ static class ItemWithArrayAndCollectionValues {
this.bigDecimalsCollection = bigDecimalsCollection;
this.objectIdsCollection = objectIdsCollection;
this.structAggregateEmbeddablesCollection = structAggregateEmbeddablesCollection;
this.instants = instants;
this.instantsCollection = instantsCollection;
}
}

Expand Down
Loading