Skip to content

Commit 4d19804

Browse files
committed
fix test
1 parent 7fc1c87 commit 4d19804

File tree

4 files changed

+24
-103
lines changed

4 files changed

+24
-103
lines changed

src/DataBlobs/entities/BlobEntry.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ StructUtils.@kwarg struct Blobentry
4242
""" MIME description describing the format of binary data in the `Blob`, e.g. 'image/png' or 'application/json'. """
4343
mimetype::String = "application/octet-stream" #FIXME ::MIME = MIME("application/octet-stream")
4444
""" Storage for a couple of bytes directly in the graph. Use with caution and keep it small and simple."""
45-
metadata::JSONText = JSONText("")
45+
metadata::JSONText = JSONText("{}")
4646
""" When the Blob itself was first created. Serialized as an ISO 8601 string."""
4747
timestamp::NanoDate = ndnow(UTC) & (json = (lower = timestamp,),)
4848
""" Type version of this Blobentry."""

test/fileDFGTests.jl

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,8 @@ using UUIDs
3030
blobid = uuid4(),
3131
label = :testing,
3232
blobstore = :store,
33-
hash = "",
34-
origin = "",
35-
description = "",
36-
mimeType = "",
37-
timestamp = now(localzone()),
33+
# timestamp = now(localzone()),
34+
timestamp = DFG.ndnow(UTC),
3835
),
3936
),
4037
verts,
@@ -46,11 +43,8 @@ using UUIDs
4643
blobid = uuid4(),
4744
label = :testing2,
4845
blobstore = :store,
49-
hash = "",
50-
origin = "",
51-
description = "",
52-
mimeType = "",
53-
timestamp = ZonedDateTime(2014, 5, 30, 21, tz"UTC-4"),
46+
# timestamp = ZonedDateTime(2014, 5, 30, 21, tz"UTC-4"),
47+
timestamp = DFG.NanoDate(2014, 5, 30, 21),
5448
),
5549
),
5650
verts,
@@ -99,11 +93,8 @@ using UUIDs
9993
blobid = uuid4(),
10094
label = :testing2,
10195
blobstore = :store,
102-
hash = "",
103-
origin = "",
104-
description = "",
105-
mimeType = "",
106-
timestamp = ZonedDateTime(2023, 2, 3, 20, tz"UTC+1"),
96+
# timestamp = NanoDate(2023, 2, 3, 20, tz"UTC+1"),
97+
timestamp = DFG.NanoDate(2023, 2, 3, 20),
10798
)
10899

109100
addGraphBlobentry!(dfg, be)

test/iifInterfaceTests.jl

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -214,34 +214,15 @@ end
214214
end
215215

216216
@testset "Data Entries" begin
217-
de1 = Blobentry(;
218-
blobid = uuid4(),
219-
label = :key1,
220-
blobstore = :test,
221-
hash = "",
222-
origin = "",
223-
description = "",
224-
mimeType = "",
225-
)
217+
de1 = Blobentry(; blobid = uuid4(), label = :key1, blobstore = :test)
226218

227-
de2 = Blobentry(;
228-
blobid = uuid4(),
229-
label = :key2,
230-
blobstore = :test,
231-
hash = "",
232-
origin = "",
233-
description = "",
234-
mimeType = "",
235-
)
219+
de2 = Blobentry(; blobid = uuid4(), label = :key2, blobstore = :test)
236220

237221
de2_update = Blobentry(;
238222
blobid = uuid4(),
239223
label = :key2,
240224
blobstore = :test,
241-
hash = "",
242-
origin = "",
243-
description = "",
244-
mimeType = "image/jpg",
225+
mimetype = "image/jpg",
245226
)
246227

247228
#add

test/testBlocks.jl

Lines changed: 14 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -180,17 +180,7 @@ end
180180

181181
# User, Robot, Session Data Blob Entries
182182
function GraphAgentBlobentries!(fg::AbstractDFG)
183-
be = Blobentry(;
184-
id = uuid4(),
185-
blobid = uuid4(),
186-
label = :key1,
187-
blobstore = :b,
188-
hash = "",
189-
origin = "",
190-
description = "",
191-
mimeType = "",
192-
metadata = "",
193-
)
183+
be = Blobentry(; label = :key1, blobstore = :b)
194184

195185
# Agent Blob Entries
196186
ae = addAgentBlobentry!(fg, be)
@@ -847,57 +837,22 @@ function DataEntriesTestBlock!(fg, v2)
847837
# listBlobentries
848838
# emptyDataEntries
849839
# mergeDataEntries
850-
storeEntry = Blobentry(;
851-
id = uuid4(),
852-
blobid = uuid4(),
853-
label = :a,
854-
blobstore = :b,
855-
origin = "",
856-
description = "",
857-
mimetype = "",
858-
metadata = "",
859-
)
840+
storeEntry = Blobentry(; blobid = uuid4(), label = :a, blobstore = :b)
860841
@test getLabel(storeEntry) == storeEntry.label
861842
@test getTimestamp(storeEntry) == storeEntry.timestamp
862843

863844
# oid = zeros(UInt8,12); oid[12] = 0x01
864845
# de1 = MongodbDataEntry(:key1, uuid4(), NTuple{12,UInt8}(oid), "", now(localzone()))
865-
de1 = Blobentry(;
866-
id = uuid4(),
867-
blobid = uuid4(),
868-
label = :key1,
869-
blobstore = :b,
870-
origin = "",
871-
description = "",
872-
mimeType = "",
873-
metadata = "",
874-
)
846+
de1 = Blobentry(; blobid = uuid4(), label = :key1, blobstore = :b)
875847

876848
# oid = zeros(UInt8,12); oid[12] = 0x02
877849
# de2 = MongodbDataEntry(:key2, uuid4(), NTuple{12,UInt8}(oid), "", now(localzone()))
878-
de2 = Blobentry(;
879-
id = uuid4(),
880-
blobid = uuid4(),
881-
label = :key2,
882-
blobstore = :b,
883-
origin = "",
884-
description = "",
885-
mimeType = "",
886-
metadata = "",
887-
)
850+
de2 = Blobentry(; blobid = uuid4(), label = :key2, blobstore = :b)
888851

889852
# oid = zeros(UInt8,12); oid[12] = 0x03
890853
# de2_update = MongodbDataEntry(:key2, uuid4(), NTuple{12,UInt8}(oid), "", now(localzone()))
891-
de2_update = Blobentry(;
892-
id = uuid4(),
893-
blobid = uuid4(),
894-
label = :key2,
895-
blobstore = :b,
896-
origin = "",
897-
description = "Yay",
898-
mimeType = "",
899-
metadata = "",
900-
)
854+
de2_update =
855+
Blobentry(; blobid = uuid4(), label = :key2, blobstore = :b, description = "Yay")
901856

902857
#add
903858
v1 = getVariable(fg, :a)
@@ -947,39 +902,33 @@ end
947902

948903
function blobsStoresTestBlock!(fg)
949904
de1 = Blobentry(;
950-
id = uuid4(),
951905
blobid = uuid4(),
952906
label = :label1,
953907
blobstore = :store1,
954-
hash = "AAAA",
908+
crchash = 0xAAAA,
955909
origin = "origin1",
956910
description = "description1",
957-
mimeType = "mimetype1",
958-
metadata = "",
911+
mimetype = "mimetype1",
959912
)
960913
de2 = Blobentry(;
961-
id = uuid4(),
962914
blobid = uuid4(),
963915
label = :label2,
964916
blobstore = :store2,
965-
hash = "FFFF",
917+
crchash = 0xFFFF,
966918
origin = "origin2",
967919
description = "description2",
968-
mimeType = "mimetype2",
969-
metadata = "",
970-
timestamp = ZonedDateTime("2020-08-12T12:00:00.000+00:00"),
920+
mimetype = "mimetype2",
921+
timestamp = DFG.NanoDate("2020-08-12T12:00:00.000"),
971922
)
972923
de2_update = Blobentry(;
973-
id = uuid4(),
974924
blobid = uuid4(),
975925
label = :label2,
976926
blobstore = :store2,
977-
hash = "0123",
927+
crchash = 0x0123,
978928
origin = "origin2",
979929
description = "description2",
980-
mimeType = "mimetype2",
981-
metadata = "",
982-
timestamp = ZonedDateTime("2020-08-12T12:00:00.000+00:00"),
930+
mimetype = "mimetype2",
931+
timestamp = DFG.NanoDate("2020-08-12T12:00:00.000"),
983932
)
984933
@test getLabel(de1) == de1.label
985934
@test getTimestamp(de1) == de1.timestamp

0 commit comments

Comments
 (0)