当前位置: 首页>>代码示例>>Java>>正文


Java ConsulRawClient类代码示例

本文整理汇总了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());
}
 
开发者ID:Ecwid,项目名称:consul-api,代码行数:20,代码来源:ConsulRawClientTest.java

示例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());
}
 
开发者ID:Ecwid,项目名称:consul-api,代码行数:19,代码来源:ConsulRawClientTest.java

示例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);
}
 
开发者ID:hortonworks,项目名称:cloudbreak,代码行数:9,代码来源:ConsulUtils.java

示例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);
}
 
开发者ID:hortonworks,项目名称:cloudbreak,代码行数:12,代码来源:ConsulHostServiceTypeCheckerTaskTest.java

示例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);
}
 
开发者ID:hortonworks,项目名称:cloudbreak,代码行数:13,代码来源:ConsulHostServiceTypeCheckerTaskTest.java

示例6: AclConsulClient

import com.ecwid.consul.v1.ConsulRawClient; //导入依赖的package包/类
public AclConsulClient(ConsulRawClient rawClient) {
	this.rawClient = rawClient;
}
 
开发者ID:flyaruu,项目名称:tasman,代码行数:4,代码来源:AclConsulClient.java

示例7: StatusConsulClient

import com.ecwid.consul.v1.ConsulRawClient; //导入依赖的package包/类
public StatusConsulClient(ConsulRawClient rawClient) {
	this.rawClient = rawClient;
}
 
开发者ID:flyaruu,项目名称:tasman,代码行数:4,代码来源:StatusConsulClient.java

示例8: CatalogConsulClient

import com.ecwid.consul.v1.ConsulRawClient; //导入依赖的package包/类
public CatalogConsulClient(ConsulRawClient rawClient) {
	this.rawClient = rawClient;
}
 
开发者ID:flyaruu,项目名称:tasman,代码行数:4,代码来源:CatalogConsulClient.java

示例9: SessionConsulClient

import com.ecwid.consul.v1.ConsulRawClient; //导入依赖的package包/类
public SessionConsulClient(ConsulRawClient rawClient) {
	this.rawClient = rawClient;
}
 
开发者ID:flyaruu,项目名称:tasman,代码行数:4,代码来源:SessionConsulClient.java

示例10: AgentConsulClient

import com.ecwid.consul.v1.ConsulRawClient; //导入依赖的package包/类
public AgentConsulClient(ConsulRawClient rawClient) {
	this.rawClient = rawClient;
}
 
开发者ID:flyaruu,项目名称:tasman,代码行数:4,代码来源:AgentConsulClient.java

示例11: HealthConsulClient

import com.ecwid.consul.v1.ConsulRawClient; //导入依赖的package包/类
public HealthConsulClient(ConsulRawClient rawClient) {
	this.rawClient = rawClient;
}
 
开发者ID:flyaruu,项目名称:tasman,代码行数:4,代码来源:HealthConsulClient.java

示例12: EventConsulClient

import com.ecwid.consul.v1.ConsulRawClient; //导入依赖的package包/类
public EventConsulClient(ConsulRawClient rawClient) {
	this.rawClient = rawClient;
}
 
开发者ID:flyaruu,项目名称:tasman,代码行数:4,代码来源:EventConsulClient.java

示例13: KeyValueConsulClient

import com.ecwid.consul.v1.ConsulRawClient; //导入依赖的package包/类
public KeyValueConsulClient(ConsulRawClient rawClient) {
	this.rawClient = rawClient;
}
 
开发者ID:flyaruu,项目名称:tasman,代码行数:4,代码来源:KeyValueConsulClient.java


注:本文中的com.ecwid.consul.v1.ConsulRawClient类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。