@Test public void want_to_deprovision_defaults_to_false() { String nodeData = "{\n" + " \"type\" : \"tenant\",\n" + " \"flavor\" : \"large\",\n" + " \"openStackId\" : \"myId\",\n" + " \"hostname\" : \"myHostname\",\n" + " \"ipAddresses\" : [\"127.0.0.1\"]\n" + "}"; Node node = nodeSerializer.fromJson(State.provisioned, Utf8.toBytes(nodeData)); assertFalse(node.status().wantToDeprovision()); }
public Node fromJson(Node.State state, byte[] data) { var key = Hashing.sipHash24().newHasher() .putString(state.name(), StandardCharsets.UTF_8) .putBytes(data).hash() .asLong(); try { return cache.get(key, () -> nodeFromSlime(state, SlimeUtils.jsonToSlime(data).get())); } catch (ExecutionException e) { throw new UncheckedExecutionException(e); } }
NodeSerializer { public Node fromJson(Node.State state, byte[] data) { var key = Hashing.sipHash24().newHasher() .putString(state.name(), StandardCharsets.UTF_8) .putBytes(data).hash() .asLong(); try { return cache.get(key, () -> nodeFromSlime(state, SlimeUtils.jsonToSlime(data).get())); } catch (ExecutionException e) { throw new UncheckedExecutionException(e); } } }
NodeSerializer { public Node fromJson(Node.State state, byte[] data) { var key = Hashing.sipHash24().newHasher() .putString(state.name(), StandardCharsets.UTF_8) .putBytes(data).hash() .asLong(); try { return cache.get(key, () -> nodeFromSlime(state, SlimeUtils.jsonToSlime(data).get())); } catch (ExecutionException e) { throw new UncheckedExecutionException(e); } } NodeSerializer(NodeFlavors flavors, long cacheSize); }
NodeSerializer { public Node fromJson(Node.State state, byte[] data) { var key = Hashing.sipHash24().newHasher() .putString(state.name(), StandardCharsets.UTF_8) .putBytes(data).hash() .asLong(); try { return cache.get(key, () -> nodeFromSlime(state, SlimeUtils.jsonToSlime(data).get())); } catch (ExecutionException e) { throw new UncheckedExecutionException(e); } } NodeSerializer(NodeFlavors flavors, long cacheSize); byte[] toJson(Node node); CacheStats cacheStats(); Node fromJson(Node.State state, byte[] data); }
NodeSerializer { public Node fromJson(Node.State state, byte[] data) { var key = Hashing.sipHash24().newHasher() .putString(state.name(), StandardCharsets.UTF_8) .putBytes(data).hash() .asLong(); try { return cache.get(key, () -> nodeFromSlime(state, SlimeUtils.jsonToSlime(data).get())); } catch (ExecutionException e) { throw new UncheckedExecutionException(e); } } NodeSerializer(NodeFlavors flavors, long cacheSize); byte[] toJson(Node node); CacheStats cacheStats(); Node fromJson(Node.State state, byte[] data);  }