Example usage for org.apache.http.impl.client SystemDefaultHttpClient getParams

List of usage examples for org.apache.http.impl.client SystemDefaultHttpClient getParams

Introduction

In this page you can find the example usage for org.apache.http.impl.client SystemDefaultHttpClient getParams.

Prototype

public synchronized final HttpParams getParams() 

Source Link

Usage

From source file:org.cloudifysource.quality.iTests.test.cli.cloudify.UnsupportedOperationErrorMsgTest.java

@Test(timeOut = AbstractTestSupport.DEFAULT_TEST_TIMEOUT * 2, enabled = true)
public void UnsupportedGetServiceStatusOperationTest() throws MalformedURLException {

    SystemDefaultHttpClient httpClient = new SystemDefaultHttpClient();
    final HttpParams httpParams = httpClient.getParams();
    HttpConnectionParams.setConnectionTimeout(httpParams, CloudifyConstants.DEFAULT_HTTP_CONNECTION_TIMEOUT);
    HttpConnectionParams.setSoTimeout(httpParams, CloudifyConstants.DEFAULT_HTTP_READ_TIMEOUT);

    RestClientExecutor restClientExecutor = new RestClientExecutor(httpClient, new URL(restUrl));

    try {//from  w  ww.  j a v a  2s . co m
        restClientExecutor.get(PlatformVersion.getVersion() + "/deployments/default/services/simple",
                new TypeReference<Response<Void>>() {
                });
    } catch (RestClientException e) {
        String messageCode = e.getMessageCode();
        String expectedMessageCode = CloudifyErrorMessages.UNSUPPORTED_OPERATION.getName();
        Assert.assertTrue("message code [" + messageCode + "] expected to be " + expectedMessageCode,
                expectedMessageCode.equals(messageCode));
        String message = e.getMessageFormattedText();
        Assert.assertTrue("Formatted message [" + message + "] does not to contain " + OPERATION_NAME,
                message.contains(OPERATION_NAME));
    }

}