Example usage for org.apache.http.impl.cookie BasicClientCookie getAttribute

List of usage examples for org.apache.http.impl.cookie BasicClientCookie getAttribute

Introduction

In this page you can find the example usage for org.apache.http.impl.cookie BasicClientCookie getAttribute.

Prototype

public String getAttribute(final String name) 

Source Link

Usage

From source file:br.com.autonomiccs.apacheCloudStack.client.ApacheCloudStackClientTest.java

@Test
public void createCookieForHeaderElementTest() {
    String cookiePath = "/client/api";

    String paramName = "paramName1";
    String paramValue = "paramVale1";
    NameValuePair[] parameters = new NameValuePair[1];
    parameters[0] = new BasicNameValuePair(paramName, paramValue);

    String headerName = "headerElementName";
    String headerValue = "headerElementValue";
    HeaderElement headerElement = new BasicHeaderElement(headerName, headerValue, parameters);

    Mockito.doNothing().when(apacheCloudStackClient)
            .configureDomainForCookie(Mockito.any(BasicClientCookie.class));

    BasicClientCookie cookieForHeaderElement = apacheCloudStackClient
            .createCookieForHeaderElement(headerElement);

    Assert.assertNotNull(cookieForHeaderElement);
    Assert.assertEquals(headerName, cookieForHeaderElement.getName());
    Assert.assertEquals(headerValue, cookieForHeaderElement.getValue());
    Assert.assertEquals(paramValue, cookieForHeaderElement.getAttribute(paramName));
    Assert.assertEquals(cookiePath, cookieForHeaderElement.getPath());

    Mockito.verify(apacheCloudStackClient).configureDomainForCookie(Mockito.eq(cookieForHeaderElement));
}