diff options
5 files changed, 6 insertions, 5 deletions
diff --git a/same/src/main/java/com/orbekk/same/Client.java b/same/src/main/java/com/orbekk/same/Client.java index b496aac..d29147b 100644 --- a/same/src/main/java/com/orbekk/same/Client.java +++ b/same/src/main/java/com/orbekk/same/Client.java @@ -32,7 +32,6 @@ public class Client implements DiscoveryListener { return new State(state); } - @Override public void set(String name, String data, long revision) throws UpdateConflict { String masterUrl = state.getDataOf(".masterUrl"); diff --git a/same/src/main/java/com/orbekk/same/ClientInterface.java b/same/src/main/java/com/orbekk/same/ClientInterface.java index 4b4c731..c534fce 100644 --- a/same/src/main/java/com/orbekk/same/ClientInterface.java +++ b/same/src/main/java/com/orbekk/same/ClientInterface.java @@ -2,7 +2,6 @@ package com.orbekk.same; public interface ClientInterface { State getState(); - void set(String name, String data, long revision) throws UpdateConflict; void set(State.Component component) throws UpdateConflict; void addStateListener(StateChangedListener listener); void removeStateListener(StateChangedListener listener); diff --git a/same/src/main/java/com/orbekk/same/State.java b/same/src/main/java/com/orbekk/same/State.java index 627f79e..2b48a00 100644 --- a/same/src/main/java/com/orbekk/same/State.java +++ b/same/src/main/java/com/orbekk/same/State.java @@ -234,7 +234,8 @@ public class State { return false; } Component o = (Component)other; - return name == o.name && data == o.data && revision == o.revision; + return name.equals(o.name) && data.equals(o.data) && + revision == o.revision; } } diff --git a/same/src/main/java/com/orbekk/same/VariableFactory.java b/same/src/main/java/com/orbekk/same/VariableFactory.java index 8c786c0..3f3b19c 100644 --- a/same/src/main/java/com/orbekk/same/VariableFactory.java +++ b/same/src/main/java/com/orbekk/same/VariableFactory.java @@ -40,7 +40,9 @@ public class VariableFactory { public void set(T value) throws UpdateConflict { try { String serializedValue = mapper.writeValueAsString(value); - client.set(identifier, serializedValue, revision); + State.Component update = new State.Component(identifier, + revision, serializedValue); + client.set(update); } catch (JsonGenerationException e) { logger.warn("Failed to convert to JSON: {}", value); logger.warn("Parse exception.", e); diff --git a/same/src/test/java/com/orbekk/same/VariableFactoryTest.java b/same/src/test/java/com/orbekk/same/VariableFactoryTest.java index ed0a962..bd0f923 100644 --- a/same/src/test/java/com/orbekk/same/VariableFactoryTest.java +++ b/same/src/test/java/com/orbekk/same/VariableFactoryTest.java @@ -57,7 +57,7 @@ public class VariableFactoryTest { Variable<String> string = vf.create("X", stringType); assertNull(string.get()); string.set("NewValue"); - verify(client).set("X", "\"NewValue\"", 0); + verify(client).set(new State.Component("X", 0, "\"NewValue\"")); } @Test |