本文整理汇总了Java中com.autonomy.aci.client.transport.AciHttpClient类的典型用法代码示例。如果您正苦于以下问题:Java AciHttpClient类的具体用法?Java AciHttpClient怎么用?Java AciHttpClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AciHttpClient类属于com.autonomy.aci.client.transport包,在下文中一共展示了AciHttpClient类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testExecuteActionProcessorException
import com.autonomy.aci.client.transport.AciHttpClient; //导入依赖的package包/类
@Test
@SuppressWarnings("unchecked")
public void testExecuteActionProcessorException() throws AciServiceException, IOException, AciHttpException {
final AciHttpClient mockAciHttpClient = mock(AciHttpClient.class);
final AciResponseInputStream mockAciResponseInputStream = mock(AciResponseInputStream.class);
when(mockAciHttpClient.executeAction(any(AciServerDetails.class), anySetOf(AciParameter.class))).thenReturn(mockAciResponseInputStream);
final Processor<?> mockProcessor = mock(Processor.class);
when(mockProcessor.process(any(AciResponseInputStream.class))).thenThrow(ProcessorException.class);
try {
new AciServiceImpl(mockAciHttpClient, details).executeAction(details, new ActionParameters("test"), mockProcessor);
fail("Should have thrown an AciServiceException.");
} catch (final AciServiceException ase) {
assertThat("Exception cause is wrong", ase.getCause(), is(instanceOf(ProcessorException.class)));
verify(mockAciResponseInputStream).close();
}
}
示例2: testExecuteAction
import com.autonomy.aci.client.transport.AciHttpClient; //导入依赖的package包/类
@Test
@SuppressWarnings("unchecked")
public void testExecuteAction() throws AciServiceException, IOException, AciHttpException {
final AciHttpClient mockAciHttpClient = mock(AciHttpClient.class);
final AciResponseInputStream mockAciResponseInputStream = mock(AciResponseInputStream.class);
when(mockAciHttpClient.executeAction(any(AciServerDetails.class), anySetOf(AciParameter.class))).thenReturn(mockAciResponseInputStream);
final Processor<String> mockProcessor = mock(Processor.class);
when(mockProcessor.process(mockAciResponseInputStream)).thenReturn("Success!");
final String result = new AciServiceImpl(mockAciHttpClient)
.executeAction(details, new ActionParameters("test"), (Processor<String>) mockProcessor);
assertThat(result, is(equalTo("Success!")));
verify(mockAciResponseInputStream).close();
}
示例3: AbstractMigrateUsersToIncludeUsernames
import com.autonomy.aci.client.transport.AciHttpClient; //导入依赖的package包/类
protected AbstractMigrateUsersToIncludeUsernames() {
final String host = System.getProperty(COMMUNITY_HOST);
final int port = Integer.parseInt(System.getProperty(COMMUNITY_PORT));
final AciServerDetails.TransportProtocol transportProtocol = AciServerDetails.TransportProtocol.valueOf(System.getProperty(COMMUNITY_PROTOCOL));
serverDetails = new AciServerDetails(transportProtocol, host, port);
processorFactory = new ProcessorFactoryImpl(new Jaxb2MarshallerFactory());
final SocketConfig socketConfig = SocketConfig.custom().setSoTimeout(HTTP_SOCKET_TIMEOUT).build();
final HttpClient httpClient = HttpClientBuilder.create()
.setMaxConnPerRoute(MAX_CONNECTIONS_PER_ROUTE)
.setMaxConnTotal(MAX_CONNECTIONS_TOTAL)
.setDefaultSocketConfig(socketConfig)
.build();
final AciHttpClient aciHttpClient = new AciHttpClientImpl(httpClient);
aciService = new AciServiceImpl(aciHttpClient, serverDetails);
}
示例4: testSinglePropertyConstructor
import com.autonomy.aci.client.transport.AciHttpClient; //导入依赖的package包/类
@Test
public void testSinglePropertyConstructor() {
// Create a new service implementation...
final AciHttpClient mockAciHttpClient = mock(AciHttpClient.class);
final AciServiceImpl service = new AciServiceImpl(mockAciHttpClient);
// Check...
assertThat(service.getAciHttpClient(), is(sameInstance(mockAciHttpClient)));
assertThat(service.getAciServerDetails(), is(nullValue()));
}
示例5: testDoublePropertyConstructor
import com.autonomy.aci.client.transport.AciHttpClient; //导入依赖的package包/类
@Test
public void testDoublePropertyConstructor() {
// Create a new service implementation...
final AciHttpClient mockAciHttpClient = mock(AciHttpClient.class);
final AciServiceImpl service = new AciServiceImpl(mockAciHttpClient, details);
// Check...
assertThat(service.getAciHttpClient(), is(sameInstance(mockAciHttpClient)));
assertThat(service.getAciServerDetails(), is(sameInstance(details)));
}
示例6: testExecuteActionWithDetailsBadParameterSetNullProcessor
import com.autonomy.aci.client.transport.AciHttpClient; //导入依赖的package包/类
@Test(expected = IllegalArgumentException.class)
public void testExecuteActionWithDetailsBadParameterSetNullProcessor() throws AciServiceException {
final ActionParameters parameters = new ActionParameters();
parameters.add(AciConstants.PARAM_FORMAT, "wibble");
parameters.add(AciConstants.PARAM_DATA, "wobble");
parameters.add(AciConstants.PARAM_ACTION, AciConstants.ACTION_GET_LICENSE_INFO);
new AciServiceImpl(mock(AciHttpClient.class)).executeAction(details, parameters, null);
fail("Should have thrown an IllegalArgumentException.");
}
示例7: testExecuteActionAciHttpException
import com.autonomy.aci.client.transport.AciHttpClient; //导入依赖的package包/类
@Test
@SuppressWarnings("unchecked")
public void testExecuteActionAciHttpException() throws AciServiceException, IOException, AciHttpException {
final AciHttpClient mockAciHttpClient = mock(AciHttpClient.class);
when(mockAciHttpClient.executeAction(any(AciServerDetails.class), anySetOf(AciParameter.class))).thenThrow(AciHttpException.class);
try {
new AciServiceImpl(mockAciHttpClient, details).executeAction(details, new ActionParameters("test"), mock(Processor.class));
fail("Should have thrown an AciServiceException.");
} catch (final AciServiceException ase) {
assertThat("Exception cause is wrong", ase.getCause(), is(instanceOf(AciHttpException.class)));
}
}
示例8: testExecuteActionIOException
import com.autonomy.aci.client.transport.AciHttpClient; //导入依赖的package包/类
@Test
@SuppressWarnings("unchecked")
public void testExecuteActionIOException() throws AciServiceException, IOException, AciHttpException {
final AciHttpClient mockAciHttpClient = mock(AciHttpClient.class);
when(mockAciHttpClient.executeAction(any(AciServerDetails.class), anySetOf(AciParameter.class))).thenThrow(IOException.class);
try {
new AciServiceImpl(mockAciHttpClient, details).executeAction(details, new ActionParameters("test"), mock(Processor.class));
fail("Should have thrown an AciServiceException.");
} catch (final AciServiceException ase) {
assertThat("Exception cause is wrong", ase.getCause(), is(instanceOf(IOException.class)));
}
}
示例9: testAciHttpClientProperty
import com.autonomy.aci.client.transport.AciHttpClient; //导入依赖的package包/类
@Test
public void testAciHttpClientProperty() {
// Create a new service implementation...
final AciServiceImpl service = new AciServiceImpl();
assertThat(service.getAciHttpClient(), is(nullValue()));
// Set and check...
final AciHttpClient mockAciHttpClient = mock(AciHttpClient.class);
service.setAciHttpClient(mockAciHttpClient);
assertThat(service.getAciHttpClient(), is(sameInstance(mockAciHttpClient)));
// Set to null and check...
service.setAciHttpClient(null);
assertThat(service.getAciHttpClient(), is(nullValue()));
}
示例10: FlywayIdolConfigUpdateHandler
import com.autonomy.aci.client.transport.AciHttpClient; //导入依赖的package包/类
@Autowired
public FlywayIdolConfigUpdateHandler (
final ProcessorFactory processorFactory,
final Flyway flyway,
final AciHttpClient aciHttpClient
) {
this.processorFactory = processorFactory;
this.flyway = flyway;
aciService = new AciServiceImpl(aciHttpClient);
}
示例11: aciService
import com.autonomy.aci.client.transport.AciHttpClient; //导入依赖的package包/类
@Bean
@ConditionalOnMissingBean(name = ACI_SERVICE_BEAN_NAME)
public AciService aciService(final AciHttpClient aciHttpClient) {
return new AciServiceImpl(aciHttpClient);
}
示例12: validatorAciService
import com.autonomy.aci.client.transport.AciHttpClient; //导入依赖的package包/类
@Bean
@ConditionalOnMissingBean(name = VALIDATOR_ACI_SERVICE_BEAN_NAME)
public AciService validatorAciService(final AciHttpClient validatorAciHttpClient) {
return new AciServiceImpl(validatorAciHttpClient);
}
示例13: aciHttpClient
import com.autonomy.aci.client.transport.AciHttpClient; //导入依赖的package包/类
@Bean
@ConditionalOnMissingBean(name = ACI_HTTP_CLIENT_BEAN_NAME)
public AciHttpClient aciHttpClient(final HttpClient httpClient) {
return new AciHttpClientImpl(httpClient);
}
示例14: validatorAciHttpClient
import com.autonomy.aci.client.transport.AciHttpClient; //导入依赖的package包/类
@Bean
@ConditionalOnMissingBean(name = VALIDATOR_ACI_HTTP_CLIENT_BEAN_NAME)
public AciHttpClient validatorAciHttpClient(final HttpClient validatorHttpClient) {
return new AciHttpClientImpl(validatorHttpClient);
}
示例15: testExecuteActionNullConnectionDetails
import com.autonomy.aci.client.transport.AciHttpClient; //导入依赖的package包/类
@Test(expected = IllegalArgumentException.class)
public void testExecuteActionNullConnectionDetails() throws AciServiceException {
new AciServiceImpl(mock(AciHttpClient.class)).executeAction(new ActionParameters("test"), null);
fail("Should have thrown an IllegalArgumentException.");
}