use of com.ecwid.consul.v1.kv.model.GetValue in project spring-cloud-consul by spring-cloud.
the class ConfigWatchTests method watchPublishesEvent.
@Test
public void watchPublishesEvent() {
ApplicationEventPublisher eventPublisher = mock(ApplicationEventPublisher.class);
setupWatch(eventPublisher, new GetValue(), "/app/");
verify(eventPublisher, times(1)).publishEvent(any(RefreshEvent.class));
}
use of com.ecwid.consul.v1.kv.model.GetValue in project spring-cloud-consul by spring-cloud.
the class ConfigWatchTests method watchPublishesEventWithAcl.
@Test
public void watchPublishesEventWithAcl() {
ApplicationEventPublisher eventPublisher = mock(ApplicationEventPublisher.class);
setupWatch(eventPublisher, new GetValue(), "/app/", "2ee647bd-bd69-4118-9f34-b9a6e9e60746");
verify(eventPublisher, times(1)).publishEvent(any(RefreshEvent.class));
}
use of com.ecwid.consul.v1.kv.model.GetValue in project spring-cloud-consul by spring-cloud.
the class ConfigWatchTests method watchForFileFormatPublishesEvent.
@Test
public void watchForFileFormatPublishesEvent() {
ApplicationEventPublisher eventPublisher = mock(ApplicationEventPublisher.class);
configProperties.setFormat(FILES);
setupWatch(eventPublisher, new GetValue(), "/config/app.yml");
verify(eventPublisher, times(1)).publishEvent(any(RefreshEvent.class));
}
use of com.ecwid.consul.v1.kv.model.GetValue in project motan by weibocom.
the class ConsulRegistryService method getNodes.
@Override
public List<JSONObject> getNodes(String dcGroup, String service, String nodeType) {
List<JSONObject> results = new ArrayList<JSONObject>();
List<Check> checks = consulClient.getHealthChecksForService(getGroupName(dcGroup), new QueryParams(getDcName(dcGroup))).getValue();
for (Check check : checks) {
String serviceId = check.getServiceId();
String[] strings = serviceId.split("-");
if (strings[1].equals(service)) {
Check.CheckStatus status = check.getStatus();
JSONObject node = new JSONObject();
if (nodeType.equals(status.toString())) {
node.put("host", strings[0]);
node.put("info", null);
results.add(node);
}
}
}
return results;
}
use of com.ecwid.consul.v1.kv.model.GetValue in project motan by weibocom.
the class ConsulEcwidClient method lookupCommand.
@Override
public String lookupCommand(String group) {
Response<GetValue> response = client.getKVValue(ConsulConstants.CONSUL_MOTAN_COMMAND + ConsulUtils.convertGroupToServiceName(group));
GetValue value = response.getValue();
String command = "";
if (value == null) {
LoggerUtil.info("no command in group: " + group);
} else if (value.getValue() != null) {
command = value.getDecodedValue();
}
return command;
}
Aggregations