Skip to content

Commit 7133077

Browse files
committed
Resync CRUD spec tests to use transaction spec test format
JAVA-3138
1 parent 653de0e commit 7133077

Some content is hidden

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

44 files changed

+673
-203
lines changed

driver-async/src/test/functional/com/mongodb/async/client/CrudTest.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,7 @@ public CrudTest(final String filename, final String description, final String da
8484
@Before
8585
public void setUp() {
8686
assumeFalse(skipTest);
87-
// No runOn syntax for legacy CRUD, so skipping these manually for now
88-
assumeFalse(isSharded() && description.startsWith("Aggregate with $currentOp"));
87+
assumeFalse(isSharded());
8988

9089
collectionHelper = new CollectionHelper<Document>(new DocumentCodec(), new MongoNamespace(databaseName, collectionName));
9190
collectionHelper.killAllSessions();
@@ -128,17 +127,16 @@ public void shouldPassAllOutcomes() {
128127
if (definition.containsKey("operation")) {
129128
runOperation(expectedOutcome, definition.getDocument("operation"),
130129
expectedOutcome.containsKey("result") && expectedOutcome.isDocument("result")
131-
? expectedOutcome.get("result").asDocument() : null);
130+
? expectedOutcome.get("result") : null);
132131
} else { // v2 test
133132
BsonArray operations = definition.getArray("operations");
134133
for (BsonValue operation : operations) {
135-
runOperation(expectedOutcome, operation.asDocument(),
136-
operation.asDocument().containsKey("result") ? operation.asDocument().getDocument("result") : null);
134+
runOperation(expectedOutcome, operation.asDocument(), operation.asDocument().get("result", null));
137135
}
138136
}
139137
}
140138

141-
private void runOperation(final BsonDocument expectedOutcome, final BsonDocument operation, final BsonDocument expectedResult) {
139+
private void runOperation(final BsonDocument expectedOutcome, final BsonDocument operation, final BsonValue expectedResult) {
142140
BsonDocument outcome = null;
143141
boolean wasException = false;
144142
try {
@@ -189,7 +187,7 @@ public static Collection<Object[]> data() throws URISyntaxException, IOException
189187
data.add(new Object[]{file.getName(), test.asDocument().getString("description").getValue(),
190188
testDocument.getString("database_name", new BsonString(getDefaultDatabaseName())).getValue(),
191189
testDocument.getString("collection_name", new BsonString("test")).getValue(),
192-
testDocument.getArray("data"), test.asDocument(), skipTest(testDocument, test.asDocument())});
190+
testDocument.getArray("data", new BsonArray()), test.asDocument(), skipTest(testDocument, test.asDocument())});
193191
}
194192
}
195193
return data;

driver-core/src/test/resources/crud/db/db-aggregate.json

Lines changed: 0 additions & 149 deletions
This file was deleted.

driver-core/src/test/resources/crud/read/aggregate-out.json renamed to driver-core/src/test/resources/crud/v1/read/aggregate-out.json

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,6 @@
4141
}
4242
},
4343
"outcome": {
44-
"result": [
45-
{
46-
"_id": 2,
47-
"x": 22
48-
},
49-
{
50-
"_id": 3,
51-
"x": 33
52-
}
53-
],
5444
"collection": {
5545
"name": "other_test_collection",
5646
"data": [
@@ -92,16 +82,6 @@
9282
}
9383
},
9484
"outcome": {
95-
"result": [
96-
{
97-
"_id": 2,
98-
"x": 22
99-
},
100-
{
101-
"_id": 3,
102-
"x": 33
103-
}
104-
],
10585
"collection": {
10686
"name": "other_test_collection",
10787
"data": [

0 commit comments

Comments
 (0)