add graphql getServiceInstance instanceUUID field. (#3595)

* add graphql getServiceInstance instanceUUID field.

* add graphql getServiceInstance instanceUUID field.

* add graphql getServiceInstance instanceUUID field.

* sync query-protocol repo

* add instanceUUID field e2e

* add instanceUUID field e2e

* add instanceUUID field e2e

* add instanceUUID field e2e
This commit is contained in:
Kdump 2019-10-17 11:38:00 +08:00 committed by 吴晟 Wu Sheng
parent d68c0883ed
commit c0be757f43
7 changed files with 41 additions and 5 deletions

View File

@ -32,6 +32,7 @@ public class ServiceInstance {
@Setter private String name;
private final List<Attribute> attributes;
@Setter private Language language = Language.UNKNOWN;
@Setter private String instanceUUID;
public ServiceInstance() {
this.attributes = new ArrayList<>();

@ -1 +1 @@
Subproject commit f9bb3fe4d85b7c989d0692f38c3341c3c13646e7
Subproject commit c970b1972ad69d2622eb0b41a067c230d46b3da8

View File

@ -245,6 +245,7 @@ public class MetadataQueryEsDAO extends EsDAO implements IMetadataQueryDAO {
ServiceInstance serviceInstance = new ServiceInstance();
serviceInstance.setId(String.valueOf(sourceAsMap.get(ServiceInstanceInventory.SEQUENCE)));
serviceInstance.setName((String)sourceAsMap.get(ServiceInstanceInventory.NAME));
serviceInstance.setInstanceUUID((String)sourceAsMap.get(ServiceInstanceInventory.INSTANCE_UUID));
String propertiesString = (String)sourceAsMap.get(ServiceInstanceInventory.PROPERTIES);
if (!Strings.isNullOrEmpty(propertiesString)) {

View File

@ -277,6 +277,7 @@ public class H2MetadataQueryDAO implements IMetadataQueryDAO {
ServiceInstance serviceInstance = new ServiceInstance();
serviceInstance.setId(resultSet.getString(ServiceInstanceInventory.SEQUENCE));
serviceInstance.setName(resultSet.getString(ServiceInstanceInventory.NAME));
serviceInstance.setInstanceUUID(resultSet.getString(ServiceInstanceInventory.INSTANCE_UUID));
String propertiesString = resultSet.getString(ServiceInstanceInventory.PROPERTIES);
if (!Strings.isNullOrEmpty(propertiesString)) {

View File

@ -27,6 +27,7 @@ public class Instance {
private String key;
private String label;
private List<Attribute> attributes;
private String instanceUUID;
public String getKey() {
return key;
@ -54,12 +55,22 @@ public class Instance {
this.attributes = attributes;
}
public String getInstanceUUID() {
return instanceUUID;
}
public Instance setInstanceUUID(String instanceUUID) {
this.instanceUUID = instanceUUID;
return this;
}
@Override
public String toString() {
return "Instance{" +
"key='" + key + '\'' +
", label='" + label + '\'' +
", attributes=" + attributes +
", instanceUUID=" + instanceUUID +
'}';
}
}

View File

@ -34,6 +34,7 @@ public class InstanceMatcher extends AbstractMatcher<Instance> {
private String key;
private String label;
private String instanceUUID;
private List<AttributeMatcher> attributes;
@Override
@ -46,6 +47,10 @@ public class InstanceMatcher extends AbstractMatcher<Instance> {
verifyLabel(instance);
}
if (Objects.nonNull(getInstanceUUID())) {
verifyInstanceUUID(instance);
}
if (Objects.nonNull(getAttributes())) {
verifyAttributes(instance);
}
@ -65,6 +70,13 @@ public class InstanceMatcher extends AbstractMatcher<Instance> {
doVerify(expected, actual);
}
private void verifyInstanceUUID(Instance instance) {
final String expected = this.getInstanceUUID();
final String actual = instance.getInstanceUUID();
doVerify(expected, actual);
}
private void verifyAttributes(Instance instance) {
final List<AttributeMatcher> expected = this.getAttributes();
final List<Attribute> actual = instance.getAttributes();
@ -94,6 +106,14 @@ public class InstanceMatcher extends AbstractMatcher<Instance> {
this.label = label;
}
public String getInstanceUUID() {
return instanceUUID;
}
public void setInstanceUUID(String instanceUUID) {
this.instanceUUID = instanceUUID;
}
public List<AttributeMatcher> getAttributes() {
return attributes;
}
@ -107,6 +127,7 @@ public class InstanceMatcher extends AbstractMatcher<Instance> {
return "InstanceMatcher{" +
"key='" + key + '\'' +
", label='" + label + '\'' +
", instanceUUID='" + instanceUUID + '\'' +
", attributes=" + attributes +
'}';
}

View File

@ -23,6 +23,7 @@
name
value
}
instanceUUID
}
}",
"variables": {