本文整理汇总了Java中com.ecwid.consul.v1.ConsulRawClient类的典型用法代码示例。如果您正苦于以下问题:Java ConsulRawClient类的具体用法?Java ConsulRawClient怎么用?Java ConsulRawClient使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ConsulRawClient类属于com.ecwid.consul.v1包,在下文中一共展示了ConsulRawClient类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: verifyUrlWithPath
import com.ecwid.consul.v1.ConsulRawClient; //导入依赖的package包/类
@Test
public void verifyUrlWithPath() throws Exception {
// Given
HttpClient httpClient = mock(HttpClient.class);
ConsulRawClient client = ConsulRawClient.Builder.builder()
.setHttpClient(httpClient)
.setHost(HOST)
.setPort(PORT)
.setPath(PATH)
.build();
// When
client.makeGetRequest(ENDPOINT, EMPTY_QUERY_PARAMS);
// Then
ArgumentCaptor<HttpUriRequest> calledUri = ArgumentCaptor.forClass(HttpUriRequest.class);
verify(httpClient).execute(calledUri.capture(), any(ResponseHandler.class));
assertEquals(EXPECTED_AGENT_ADDRESS, calledUri.getValue().getURI().toString());
}
示例2: verifyDefaultUrl
import com.ecwid.consul.v1.ConsulRawClient; //导入依赖的package包/类
@Test
public void verifyDefaultUrl() throws Exception {
// Given
HttpClient httpClient = mock(HttpClient.class);
ConsulRawClient client = ConsulRawClient.Builder.builder()
.setHttpClient(httpClient)
.setHost(HOST)
.setPort(PORT)
.build();
// When
client.makeGetRequest(ENDPOINT, EMPTY_QUERY_PARAMS);
// Then
ArgumentCaptor<HttpUriRequest> calledUri = ArgumentCaptor.forClass(HttpUriRequest.class);
verify(httpClient).execute(calledUri.capture(), any(ResponseHandler.class));
assertEquals(EXPECTED_AGENT_ADDRESS_NO_PATH, calledUri.getValue().getURI().toString());
}
示例3: createClient
import com.ecwid.consul.v1.ConsulRawClient; //导入依赖的package包/类
public static ConsulClient createClient(String apiAddress, int apiPort, TlsConfiguration tlsConfiguration) throws Exception {
HttpClient httpClient = createHttpClient(tlsConfiguration.getClientCert(), tlsConfiguration.getClientKey(), tlsConfiguration.getServerCert());
ConsulRawClient rawClient = new ConsulRawClient("https://" + apiAddress + ':' + apiPort, httpClient);
Field agentAddress = ReflectionUtils.findField(ConsulRawClient.class, "agentAddress");
ReflectionUtils.makeAccessible(agentAddress);
ReflectionUtils.setField(agentAddress, rawClient, "https://" + apiAddress + ':' + apiPort + "/consul");
return new ConsulClient(rawClient);
}
示例4: checkStatusForConnectionError
import com.ecwid.consul.v1.ConsulRawClient; //导入依赖的package包/类
@Test
@SuppressWarnings("unchecked")
public void checkStatusForConnectionError() {
ConsulRawClient raw1 = mock(ConsulRawClient.class);
ConsulClient client1 = new ConsulClient(raw1);
when(raw1.makeGetRequest(SERVICE_ENDPOINT + AMBARI_SERVICE, null, QueryParams.DEFAULT)).thenThrow(TransportException.class);
boolean result = task.checkStatus(new ConsulContext(stack, client1, Collections.singletonList(AMBARI_SERVICE)));
assertFalse(result);
}
示例5: checkStatusForOneNodeResponse
import com.ecwid.consul.v1.ConsulRawClient; //导入依赖的package包/类
@Test
@SuppressWarnings("unchecked")
public void checkStatusForOneNodeResponse() {
ConsulRawClient raw1 = mock(ConsulRawClient.class);
RawResponse rawResponse = new RawResponse(200, null, SERVICE_RESPONSE, null, null, null);
ConsulClient client1 = new ConsulClient(raw1);
when(raw1.makeGetRequest(SERVICE_ENDPOINT + AMBARI_SERVICE, null, QueryParams.DEFAULT)).thenReturn(rawResponse);
boolean result = task.checkStatus(new ConsulContext(stack, client1, Collections.singletonList(AMBARI_SERVICE)));
assertTrue(result);
}
示例6: AclConsulClient
import com.ecwid.consul.v1.ConsulRawClient; //导入依赖的package包/类
public AclConsulClient(ConsulRawClient rawClient) {
this.rawClient = rawClient;
}
示例7: StatusConsulClient
import com.ecwid.consul.v1.ConsulRawClient; //导入依赖的package包/类
public StatusConsulClient(ConsulRawClient rawClient) {
this.rawClient = rawClient;
}
示例8: CatalogConsulClient
import com.ecwid.consul.v1.ConsulRawClient; //导入依赖的package包/类
public CatalogConsulClient(ConsulRawClient rawClient) {
this.rawClient = rawClient;
}
示例9: SessionConsulClient
import com.ecwid.consul.v1.ConsulRawClient; //导入依赖的package包/类
public SessionConsulClient(ConsulRawClient rawClient) {
this.rawClient = rawClient;
}
示例10: AgentConsulClient
import com.ecwid.consul.v1.ConsulRawClient; //导入依赖的package包/类
public AgentConsulClient(ConsulRawClient rawClient) {
this.rawClient = rawClient;
}
示例11: HealthConsulClient
import com.ecwid.consul.v1.ConsulRawClient; //导入依赖的package包/类
public HealthConsulClient(ConsulRawClient rawClient) {
this.rawClient = rawClient;
}
示例12: EventConsulClient
import com.ecwid.consul.v1.ConsulRawClient; //导入依赖的package包/类
public EventConsulClient(ConsulRawClient rawClient) {
this.rawClient = rawClient;
}
示例13: KeyValueConsulClient
import com.ecwid.consul.v1.ConsulRawClient; //导入依赖的package包/类
public KeyValueConsulClient(ConsulRawClient rawClient) {
this.rawClient = rawClient;
}