Developing lightweight computation at the DSG edge

Commit ec128966 authored by Mathias Weber's avatar Mathias Weber
Browse files

set test

parent 3dd25506
......@@ -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("keySet"),
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 {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment