Skip to content
Snippets Groups Projects
Commit c568defc authored by Benoit Lavenier's avatar Benoit Lavenier
Browse files

[fix] Fix SYnchroResult deserialization, to get synchro with valid last execution time

parent ef2f556a
No related branches found
No related tags found
No related merge requests found
......@@ -99,6 +99,7 @@ public class SynchroResult implements Serializable {
return deleteTotal;
}
public long getInvalidSignatures() {
return invalidSignatureTotal;
}
......@@ -108,6 +109,18 @@ public class SynchroResult implements Serializable {
return insertTotal + updateTotal + deleteTotal;
}
public void setInserts(long inserts) {
this.insertTotal = inserts;
}
public void setDeletes(long deletes) {
this.deleteTotal = deletes;
}
public void setUpdates(long updates) {
this.updateTotal = updates;
}
public void setInvalidSignatures(long invalidSignatures) {
this.invalidSignatureTotal = invalidSignatures;
}
public String toString() {
return new StringBuilder()
......
package org.duniter.elasticsearch.model;
import org.duniter.core.client.model.bma.jackson.JacksonUtils;
import org.junit.Assert;
import org.junit.Test;
import java.io.IOException;
public class SynchroExecutionTest {
@Test
public void deserialize() {
String json = "{\n" +
" \"issuer\" : null,\n" +
" \"hash\" : null,\n" +
" \"signature\" : null,\n" +
" \"time\" : 1505836503,\n" +
" \"currency\" : \"g1\",\n" +
" \"peer\" : \"CA99448CDD90AB3772474A4CBCCC5A392F4E9AD3F9FA1C4018C6FB432BC04BA8\",\n" +
" \"result\" : {\n" +
" \"inserts\" : 2,\n" +
" \"updates\" : 0,\n" +
" \"invalidSignatures\" : 0,\n" +
" \"deletes\" : 0\n" +
" }\n" +
" }";
try {
SynchroExecution obj = JacksonUtils.getThreadObjectMapper().readValue(json, SynchroExecution.class);
Assert.assertNotNull(obj);
}
catch(IOException e) {
Assert.fail(e.getMessage());
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment