Skip to content

Commit b4e3557

Browse files
author
Divjot Arora
committed
Add support for GridFS.
GODRIVER-24 Change-Id: I9cb9ff268dde3314c95c7ff33db6a62f724ee2a0
1 parent c96a956 commit b4e3557

15 files changed

+5058
-0
lines changed

data/gridfs/delete.json

Lines changed: 291 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,291 @@
1+
{
2+
"data": {
3+
"files": [
4+
{
5+
"_id": {
6+
"$oid": "000000000000000000000001"
7+
},
8+
"length": 0,
9+
"chunkSize": 4,
10+
"uploadDate": {
11+
"$date": "1970-01-01T00:00:00.000Z"
12+
},
13+
"md5": "d41d8cd98f00b204e9800998ecf8427e",
14+
"filename": "length-0",
15+
"contentType": "application/octet-stream",
16+
"aliases": [],
17+
"metadata": {}
18+
},
19+
{
20+
"_id": {
21+
"$oid": "000000000000000000000002"
22+
},
23+
"length": 0,
24+
"chunkSize": 4,
25+
"uploadDate": {
26+
"$date": "1970-01-01T00:00:00.000Z"
27+
},
28+
"md5": "d41d8cd98f00b204e9800998ecf8427e",
29+
"filename": "length-0-with-empty-chunk",
30+
"contentType": "application/octet-stream",
31+
"aliases": [],
32+
"metadata": {}
33+
},
34+
{
35+
"_id": {
36+
"$oid": "000000000000000000000003"
37+
},
38+
"length": 2,
39+
"chunkSize": 4,
40+
"uploadDate": {
41+
"$date": "1970-01-01T00:00:00.000Z"
42+
},
43+
"md5": "c700ed4fdb1d27055aa3faa2c2432283",
44+
"filename": "length-2",
45+
"contentType": "application/octet-stream",
46+
"aliases": [],
47+
"metadata": {}
48+
},
49+
{
50+
"_id": {
51+
"$oid": "000000000000000000000004"
52+
},
53+
"length": 8,
54+
"chunkSize": 4,
55+
"uploadDate": {
56+
"$date": "1970-01-01T00:00:00.000Z"
57+
},
58+
"md5": "dd254cdc958e53abaa67da9f797125f5",
59+
"filename": "length-8",
60+
"contentType": "application/octet-stream",
61+
"aliases": [],
62+
"metadata": {}
63+
}
64+
],
65+
"chunks": [
66+
{
67+
"_id": {
68+
"$oid": "000000000000000000000001"
69+
},
70+
"files_id": {
71+
"$oid": "000000000000000000000002"
72+
},
73+
"n": 0,
74+
"data": {
75+
"$hex": ""
76+
}
77+
},
78+
{
79+
"_id": {
80+
"$oid": "000000000000000000000002"
81+
},
82+
"files_id": {
83+
"$oid": "000000000000000000000003"
84+
},
85+
"n": 0,
86+
"data": {
87+
"$hex": "1122"
88+
}
89+
},
90+
{
91+
"_id": {
92+
"$oid": "000000000000000000000003"
93+
},
94+
"files_id": {
95+
"$oid": "000000000000000000000004"
96+
},
97+
"n": 0,
98+
"data": {
99+
"$hex": "11223344"
100+
}
101+
},
102+
{
103+
"_id": {
104+
"$oid": "000000000000000000000004"
105+
},
106+
"files_id": {
107+
"$oid": "000000000000000000000004"
108+
},
109+
"n": 1,
110+
"data": {
111+
"$hex": "55667788"
112+
}
113+
}
114+
]
115+
},
116+
"tests": [
117+
{
118+
"description": "Delete when length is 0",
119+
"act": {
120+
"operation": "delete",
121+
"arguments": {
122+
"id": {
123+
"$oid": "000000000000000000000001"
124+
}
125+
}
126+
},
127+
"assert": {
128+
"result": "void",
129+
"data": [
130+
{
131+
"delete": "expected.files",
132+
"deletes": [
133+
{
134+
"q": {
135+
"_id": {
136+
"$oid": "000000000000000000000001"
137+
}
138+
},
139+
"limit": 1
140+
}
141+
]
142+
}
143+
]
144+
}
145+
},
146+
{
147+
"description": "Delete when length is 0 and there is one extra empty chunk",
148+
"act": {
149+
"operation": "delete",
150+
"arguments": {
151+
"id": {
152+
"$oid": "000000000000000000000002"
153+
}
154+
}
155+
},
156+
"assert": {
157+
"result": "void",
158+
"data": [
159+
{
160+
"delete": "expected.files",
161+
"deletes": [
162+
{
163+
"q": {
164+
"_id": {
165+
"$oid": "000000000000000000000002"
166+
}
167+
},
168+
"limit": 1
169+
}
170+
]
171+
},
172+
{
173+
"delete": "expected.chunks",
174+
"deletes": [
175+
{
176+
"q": {
177+
"files_id": {
178+
"$oid": "000000000000000000000002"
179+
}
180+
},
181+
"limit": 0
182+
}
183+
]
184+
}
185+
]
186+
}
187+
},
188+
{
189+
"description": "Delete when length is 8",
190+
"act": {
191+
"operation": "delete",
192+
"arguments": {
193+
"id": {
194+
"$oid": "000000000000000000000004"
195+
}
196+
}
197+
},
198+
"assert": {
199+
"result": "void",
200+
"data": [
201+
{
202+
"delete": "expected.files",
203+
"deletes": [
204+
{
205+
"q": {
206+
"_id": {
207+
"$oid": "000000000000000000000004"
208+
}
209+
},
210+
"limit": 1
211+
}
212+
]
213+
},
214+
{
215+
"delete": "expected.chunks",
216+
"deletes": [
217+
{
218+
"q": {
219+
"files_id": {
220+
"$oid": "000000000000000000000004"
221+
}
222+
},
223+
"limit": 0
224+
}
225+
]
226+
}
227+
]
228+
}
229+
},
230+
{
231+
"description": "Delete when files entry does not exist",
232+
"act": {
233+
"operation": "delete",
234+
"arguments": {
235+
"id": {
236+
"$oid": "000000000000000000000000"
237+
}
238+
}
239+
},
240+
"assert": {
241+
"error": "FileNotFound"
242+
}
243+
},
244+
{
245+
"description": "Delete when files entry does not exist and there are orphaned chunks",
246+
"arrange": {
247+
"data": [
248+
{
249+
"delete": "fs.files",
250+
"deletes": [
251+
{
252+
"q": {
253+
"_id": {
254+
"$oid": "000000000000000000000004"
255+
}
256+
},
257+
"limit": 1
258+
}
259+
]
260+
}
261+
]
262+
},
263+
"act": {
264+
"operation": "delete",
265+
"arguments": {
266+
"id": {
267+
"$oid": "000000000000000000000004"
268+
}
269+
}
270+
},
271+
"assert": {
272+
"error": "FileNotFound",
273+
"data": [
274+
{
275+
"delete": "expected.files",
276+
"deletes": [
277+
{
278+
"q": {
279+
"_id": {
280+
"$oid": "000000000000000000000004"
281+
}
282+
},
283+
"limit": 1
284+
}
285+
]
286+
}
287+
]
288+
}
289+
}
290+
]
291+
}

0 commit comments

Comments
 (0)