Skip to content

Commit

Permalink
version bump 4.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
DemonicTutor committed Nov 28, 2023
1 parent 13e1246 commit 6684f6d
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 14 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>com.noenv</groupId>
<artifactId>vertx-wiremongo</artifactId>
<version>4.4.7-SNAPSHOT</version>
<version>4.5.0</version>

<parent>
<groupId>io.vertx</groupId>
Expand All @@ -18,7 +18,7 @@
<url>http://github.com/NoEnv/vertx-wiremongo</url>

<properties>
<stack.version>4.4.7-SNAPSHOT</stack.version>
<stack.version>4.5.0</stack.version>
</properties>

<dependencyManagement>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public void testBulkWrite(TestContext ctx) {
mock.bulkWrite()
.inCollection("bulkwrite")
.withOperations(Collections.singletonList(BulkOperation.createInsert(new JsonObject().put("test", "testBulkWrite"))))
.returns(new MongoClientBulkWriteResult(1, 0, 0, 0, null));
.returns(new MongoClientBulkWriteResult(1, 0, 0, 0, null, null));

db.rxBulkWrite("bulkwrite", Collections.singletonList(BulkOperation.createInsert(new JsonObject().put("test", "testBulkWrite"))))
.subscribe(MaybeHelper.toObserver(ctx.asyncAssertSuccess(r -> ctx.assertEquals(1L, r.getInsertedCount()))));
Expand Down Expand Up @@ -54,8 +54,8 @@ public void testBulkWriteJsonMatcher(TestContext ctx) {

@Test
public void testBulkWriteReturnedObjectNotModified(TestContext ctx) {
final MongoClientBulkWriteResult given = new MongoClientBulkWriteResult(1, 2, 3, 4, new ArrayList<>(Collections.singletonList(
new JsonObject()
final MongoClientBulkWriteResult given = new MongoClientBulkWriteResult(1, 2, 3, 4,
new ArrayList<>(Collections.singletonList(new JsonObject()
.put("field1", "value1")
.put("field2", "value2")
.put("field3", new JsonObject()
Expand All @@ -66,7 +66,17 @@ public void testBulkWriteReturnedObjectNotModified(TestContext ctx) {
.add("value6")
)
)
)));
)),
new ArrayList<>(Collections.singletonList(new JsonObject()
.put("field7", "value7")
.put("field8", new JsonObject()
.put("field9", "value9")
.put("field10", new JsonArray()
.add("value11")
.add("value12")
)
)
)));
final MongoClientBulkWriteResult expected = new MongoClientBulkWriteResult(given.toJson().copy());

mock.bulkWrite()
Expand All @@ -85,6 +95,9 @@ public void testBulkWriteReturnedObjectNotModified(TestContext ctx) {
actual.getUpserts().get(0).getJsonObject("field3").put("add", "add");
actual.getUpserts().get(0).getJsonObject("field3").getJsonArray("field6").remove(0);
actual.getUpserts().get(0).getJsonObject("field3").getJsonArray("field6").add("add");
actual.getInserts().get(0).put("field7", "replace");
actual.getInserts().get(0).getJsonObject("field8").put("field9", "replace");
actual.getInserts().get(0).getJsonObject("field8").getJsonArray("field10").remove(0);
})
.repeat(2)
.ignoreElements()
Expand All @@ -93,13 +106,15 @@ public void testBulkWriteReturnedObjectNotModified(TestContext ctx) {

@Test
public void testBulkWriteFileReturnedObjectNotModified(TestContext ctx) {
final MongoClientBulkWriteResult expected = new MongoClientBulkWriteResult(0, 0, 28, 0, new ArrayList<>(Collections.singletonList(new JsonObject().put("field1", "value1"))));
final MongoClientBulkWriteResult expected = new MongoClientBulkWriteResult(0, 0, 28, 0, new ArrayList<>(Collections.singletonList(new JsonObject().put("field1", "value1"))), new ArrayList<>(Collections.singletonList(new JsonObject().put("field2", "value2"))));

db.rxBulkWrite("bulkwrite", Collections.singletonList(BulkOperation.createInsert(new JsonObject().put("test", "testBulkWriteFile"))))
.doOnSuccess(actual -> ctx.assertEquals(expected.toJson(), actual.toJson()))
.doOnSuccess(actual -> {
actual.getUpserts().get(0).put("field1", "replace");
actual.getUpserts().get(0).put("add", "add");
actual.getInserts().get(0).put("field2", "replace");
actual.getInserts().get(0).put("add", "add");
})
.repeat(2)
.ignoreElements()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public void testBulkWriteWithOptions(TestContext ctx) {
operationWithCollation
))
.withOptions(new BulkWriteOptions().setOrdered(false))
.returns(new MongoClientBulkWriteResult(0, 24, 0, 0, null));
.returns(new MongoClientBulkWriteResult(0, 24, 0, 0, null, null));

db.rxBulkWriteWithOptions("bulkwritewithoptions",
Arrays.asList(
Expand Down Expand Up @@ -64,8 +64,8 @@ public void testBulkWriteWithOptionsFileError(TestContext ctx) {

@Test
public void testBulkWriteWithOptionsReturnedObjectNotModified(TestContext ctx) {
final MongoClientBulkWriteResult given = new MongoClientBulkWriteResult(1, 2, 3, 4, new ArrayList<>(Collections.singletonList(
new JsonObject()
final MongoClientBulkWriteResult given = new MongoClientBulkWriteResult(1, 2, 3, 4,
new ArrayList<>(Collections.singletonList(new JsonObject()
.put("field1", "value1")
.put("field2", "value2")
.put("field3", new JsonObject()
Expand All @@ -76,7 +76,17 @@ public void testBulkWriteWithOptionsReturnedObjectNotModified(TestContext ctx) {
.add("value6")
)
)
)));
)),
new ArrayList<>(Collections.singletonList(new JsonObject()
.put("field7", "value7")
.put("field8", new JsonObject()
.put("field9", "value9")
.put("field10", new JsonArray()
.add("value11")
.add("value12")
)
)
)));
final MongoClientBulkWriteResult expected = new MongoClientBulkWriteResult(given.toJson().copy());

mock.bulkWriteWithOptions()
Expand Down Expand Up @@ -104,13 +114,15 @@ public void testBulkWriteWithOptionsReturnedObjectNotModified(TestContext ctx) {

@Test
public void testBulkWriteWithOptionsFileReturnedObjectNotModified(TestContext ctx) {
final MongoClientBulkWriteResult expected = new MongoClientBulkWriteResult(0, 0, 0, 71, new ArrayList<>(Collections.singletonList(new JsonObject().put("field1", "value1"))));
final MongoClientBulkWriteResult expected = new MongoClientBulkWriteResult(0, 0, 0, 71, new ArrayList<>(Collections.singletonList(new JsonObject().put("field1", "value1"))), new ArrayList<>(Collections.singletonList(new JsonObject().put("field2", "value2"))));

db.rxBulkWriteWithOptions("bulkwritewithoptions", Collections.singletonList(BulkOperation.createInsert(new JsonObject().put("test", "testBulkWriteWithOptionsFile"))), new BulkWriteOptions().setWriteOption(WriteOption.ACKNOWLEDGED))
.doOnSuccess(actual -> ctx.assertEquals(expected.toJson(), actual.toJson()))
.doOnSuccess(actual -> {
actual.getUpserts().get(0).put("field1", "replace");
actual.getUpserts().get(0).put("add", "add");
actual.getInserts().get(0).put("field2", "replace");
actual.getInserts().get(0).put("add", "add");
})
.repeat(2)
.ignoreElements()
Expand Down
3 changes: 2 additions & 1 deletion src/test/resources/wiremongo-mocks/bulkwrite/bulkWrite.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
},
"response": {
"deletedCount": 28,
"upserts": [ { "field1": "value1" } ]
"upserts": [ { "field1": "value1" } ],
"inserts": [ { "field2": "value2" } ]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
},
"response": {
"modifiedCount": 71,
"upserts": [ { "field1": "value1" } ]
"upserts": [ { "field1": "value1" } ],
"inserts": [ { "field2": "value2" } ]
}
}

0 comments on commit 6684f6d

Please sign in to comment.