diff --git a/src/itest/java/com/orbitz/consul/CatalogITest.java b/src/itest/java/com/orbitz/consul/CatalogITest.java index 1a142728..e5ef7ec8 100644 --- a/src/itest/java/com/orbitz/consul/CatalogITest.java +++ b/src/itest/java/com/orbitz/consul/CatalogITest.java @@ -120,6 +120,7 @@ public void shouldGetTaggedAddressesForNode() throws UnknownHostException { public void shouldRegisterService() { String service = UUID.randomUUID().toString(); String serviceId = UUID.randomUUID().toString(); + String catalogId = UUID.randomUUID().toString(); createAndCheckService( ImmutableCatalogService.builder() @@ -131,11 +132,14 @@ public void shouldRegisterService() { .serviceId(serviceId) .serviceName(service) .servicePort(8080) - .serviceMeta(Collections.singletonMap("metakey", "metavalue")) + .putServiceMeta("metakey", "metavalue") + .putNodeMeta("a", "b") .serviceEnableTagOverride(true) .serviceWeights(ImmutableServiceWeights.builder().passing(42).warning(21).build()) .build(), ImmutableCatalogRegistration.builder() + .id(catalogId) + .putNodeMeta("a", "b") .address("localhost") .datacenter("dc1") .node("node") @@ -157,6 +161,7 @@ public void shouldRegisterService() { public void shouldRegisterServiceNoWeights() { String service = UUID.randomUUID().toString(); String serviceId = UUID.randomUUID().toString(); + String catalogId = UUID.randomUUID().toString(); createAndCheckService( ImmutableCatalogService.builder() @@ -168,11 +173,14 @@ public void shouldRegisterServiceNoWeights() { .serviceId(serviceId) .serviceName(service) .servicePort(8080) - .serviceMeta(Collections.singletonMap("metakey", "metavalue")) + .putServiceMeta("metakey", "metavalue") + .putNodeMeta("a", "b") .serviceEnableTagOverride(true) .serviceWeights(ImmutableServiceWeights.builder().passing(1).warning(1).build()) .build(), ImmutableCatalogRegistration.builder() + .id(catalogId) + .putNodeMeta("a", "b") .address("localhost") .datacenter("dc1") .node("node") @@ -196,8 +204,11 @@ public void shouldDeregisterWithDefaultDC() throws InterruptedException { String service = UUID.randomUUID().toString(); String serviceId = UUID.randomUUID().toString(); + String catalogId = UUID.randomUUID().toString(); CatalogRegistration registration = ImmutableCatalogRegistration.builder() + .id(catalogId) + .putNodeMeta("a", "b") .address("localhost") .datacenter("dc1") .node("node") @@ -274,8 +285,11 @@ public void shouldGetNodeInCallback() throws ExecutionException, InterruptedExce String nodeName = "node"; String serviceName = UUID.randomUUID().toString(); String serviceId = createAutoDeregisterServiceId(); + String catalogId = UUID.randomUUID().toString(); CatalogRegistration registration = ImmutableCatalogRegistration.builder() + .id(catalogId) + .putNodeMeta("a", "b") .address("localhost") .node(nodeName) .service(ImmutableService.builder() diff --git a/src/main/java/com/orbitz/consul/model/catalog/CatalogRegistration.java b/src/main/java/com/orbitz/consul/model/catalog/CatalogRegistration.java index 7e19145c..debdf057 100644 --- a/src/main/java/com/orbitz/consul/model/catalog/CatalogRegistration.java +++ b/src/main/java/com/orbitz/consul/model/catalog/CatalogRegistration.java @@ -4,7 +4,11 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize; + +import java.util.Map; import java.util.Optional; +import java.util.UUID; + import com.orbitz.consul.model.agent.Check; import com.orbitz.consul.model.health.Service; import org.immutables.value.Value; @@ -15,6 +19,9 @@ @JsonIgnoreProperties(ignoreUnknown = true) public abstract class CatalogRegistration { + @JsonProperty("ID") + public abstract Optional id(); + @JsonProperty("Datacenter") public abstract Optional datacenter(); @@ -24,6 +31,9 @@ public abstract class CatalogRegistration { @JsonProperty("Address") public abstract String address(); + @JsonProperty("NodeMeta") + public abstract Map nodeMeta(); + @JsonProperty("TaggedAddresses") public abstract Optional taggedAddresses(); @@ -35,4 +45,7 @@ public abstract class CatalogRegistration { @JsonProperty("WriteRequest") public abstract Optional writeRequest(); + + @JsonProperty("SkipNodeUpdate") + public abstract Optional skipNodeUpdate(); } diff --git a/src/main/java/com/orbitz/consul/model/catalog/CatalogService.java b/src/main/java/com/orbitz/consul/model/catalog/CatalogService.java index 5750acd5..94516737 100644 --- a/src/main/java/com/orbitz/consul/model/catalog/CatalogService.java +++ b/src/main/java/com/orbitz/consul/model/catalog/CatalogService.java @@ -46,11 +46,11 @@ public abstract class CatalogService { public abstract List getServiceTags(); @JsonProperty("ServiceMeta") - public abstract Optional> getServiceMeta(); + public abstract Map getServiceMeta(); @JsonProperty("ServiceWeights") public abstract Optional getServiceWeights(); @JsonProperty("NodeMeta") - public abstract Optional> getNodeMeta(); + public abstract Map getNodeMeta(); }