Developing lightweight computation at the DSG edge
Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
LightKone
antidote-go-client
Commits
ec128966
Commit
ec128966
authored
Mar 20, 2018
by
Mathias Weber
Browse files
set test
parent
3dd25506
Changes
1
Hide whitespace changes
Inline
Side-by-side
antidoteclient_test.go
View file @
ec128966
...
...
@@ -18,15 +18,51 @@ func TestSimple(t *testing.T) {
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
crdtType
:=
CRDTType_
COUNTER
crdtType
:=
CRDTType_
ORSET
key
:=
&
ApbBoundObject
{
Bucket
:
[]
byte
(
"bucket"
),
Key
:
[]
byte
(
"key"
),
Key
:
[]
byte
(
"key
Set
"
),
Type
:
&
crdtType
}
one
:=
int64
(
1
)
addType
:=
ApbSetUpdate_ADD
tx
.
Update
(
&
ApbUpdateOp
{
Boundobject
:
key
,
Operation
:
&
ApbUpdateOperation
{
Counterop
:
&
ApbCounterUpdate
{
Inc
:
&
one
}},
Operation
:
&
ApbUpdateOperation
{
Setop
:
&
ApbSetUpdate
{
Optype
:
&
addType
,
Adds
:
[][]
byte
{[]
byte
(
"test1"
)}}},
})
resp
,
err
:=
tx
.
Read
(
key
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
fmt
.
Print
(
resp
.
Objects
[
0
])
_
,
err
=
tx
.
Commit
()
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
client
.
Close
()
}
func
TestSetUpdate
(
t
*
testing
.
T
)
{
client
,
err
:=
NewClient
(
Host
{
"127.0.0.1"
,
8087
})
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
tx
,
err
:=
client
.
StartTransaction
()
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
crdtType
:=
CRDTType_ORSET
key
:=
&
ApbBoundObject
{
Bucket
:
[]
byte
(
"bucket"
),
Key
:
[]
byte
(
"keySet"
),
Type
:
&
crdtType
}
addType
:=
ApbSetUpdate_ADD
tx
.
Update
(
&
ApbUpdateOp
{
Boundobject
:
key
,
Operation
:
&
ApbUpdateOperation
{
Setop
:
&
ApbSetUpdate
{
Optype
:
&
addType
,
Adds
:
[][]
byte
{[]
byte
(
"test1"
)}}},
})
resp
,
err
:=
tx
.
Read
(
key
)
if
err
!=
nil
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment