test_class.declarator: HTTPS_PORT = 443
test_class.modifier: private static final
test_class.original_string: private static final int HTTPS_PORT = 443;
test_class.type: int
test_class.var_name: HTTPS_PORT
test_class.declarator: HTTPS = "HTTPS"
test_class.modifier: private static final
test_class.original_string: private static final String HTTPS = "HTTPS";
test_class.type: String
test_class.var_name: HTTPS
test_class.declarator: LOGIN_PATH = "/login"
test_class.modifier: private static final
test_class.original_string: private static final String LOGIN_PATH = "/login";
test_class.type: String
test_class.var_name: LOGIN_PATH
test_class.declarator: LOCALHOST = "localhost"
test_class.modifier: private static final
test_class.original_string: private static final String LOCALHOST = "localhost";
test_class.type: String
test_class.var_name: LOCALHOST
test_class.declarator: ADMIN = "admin"
test_class.modifier: private static final
test_class.original_string: private static final String ADMIN = "admin";
test_class.type: String
test_class.var_name: ADMIN
test_class.declarator: ADMIN_PASSWORD = "adminpassword"
test_class.modifier: private static final
test_class.original_string: private static final String ADMIN_PASSWORD = "adminpassword";
test_class.type: String
test_class.var_name: ADMIN_PASSWORD
test_class.declarator: HTTP_HOST = new HttpHost(LOCALHOST, HTTPS_PORT, HTTPS)
test_class.modifier: private static final
test_class.original_string: private static final HttpHost HTTP_HOST = new HttpHost(LOCALHOST, HTTPS_PORT, HTTPS);
test_class.type: HttpHost
test_class.var_name: HTTP_HOST
test_class.declarator: HTTP_200_STATUSLINE = new BasicStatusLine(new ProtocolVersion(HTTPS, 1, 1), 200, "OK")
test_class.modifier: private static final
test_class.original_string: private static final StatusLine HTTP_200_STATUSLINE = new BasicStatusLine(new ProtocolVersion(HTTPS, 1, 1), 200, "OK");
test_class.type: StatusLine
test_class.var_name: HTTP_200_STATUSLINE
test_class.declarator: HTTP_401_STATUSLINE = new BasicStatusLine(new ProtocolVersion(HTTPS, 1, 1), 401, "Unauthorized")
test_class.modifier: private static final
test_class.original_string: private static final StatusLine HTTP_401_STATUSLINE = new BasicStatusLine(new ProtocolVersion(HTTPS, 1, 1), 401, "Unauthorized");
test_class.type: StatusLine
test_class.var_name: HTTP_401_STATUSLINE
test_class.declarator: loginParameters = new HashMap<>()
test_class.modifier: private static final
test_class.original_string: private static final Map<String, String> loginParameters = new HashMap<>();
test_class.type: Map<String, String>
test_class.var_name: loginParameters
test_class.declarator: request
test_class.modifier: private static
test_class.original_string: private static HttpUriRequest request;
test_class.type: HttpUriRequest
test_class.var_name: request
test_class.declarator: loginRequest
test_class.modifier: private static
test_class.original_string: private static HttpUriRequest loginRequest;
test_class.type: HttpUriRequest
test_class.var_name: loginRequest
test_class.declarator: httpClient = mock(CloseableHttpClient.class)
test_class.modifier: private final
test_class.original_string: private final CloseableHttpClient httpClient = mock(CloseableHttpClient.class);
test_class.type: CloseableHttpClient
test_class.var_name: httpClient
test_class.declarator: mockResponse = mock(CloseableHttpResponse.class)
test_class.modifier: private final
test_class.original_string: private final CloseableHttpResponse mockResponse = mock(CloseableHttpResponse.class);
test_class.type: CloseableHttpResponse
test_class.var_name: mockResponse
test_class.declarator: httpClientContext
test_class.modifier: private
test_class.original_string: private HttpClientContext httpClientContext;
test_class.type: HttpClientContext
test_class.var_name: httpClientContext
test_class.declarator: client
test_class.modifier: private
test_class.original_string: private NiciraRestClient client;
test_class.type: NiciraRestClient
test_class.var_name: client
test_class.file: cosmic-core/server/src/test/java/com/cloud/network/nicira/NiciraRestClientTest.java
test_class.identifier: NiciraRestClientTest
test_case.body: @Test
      public void testExecuteUnauthorizedThenSuccess() throws Exception {
          when(mockResponse.getStatusLine())
                  .thenReturn(HTTP_401_STATUSLINE)
                  .thenReturn(HTTP_200_STATUSLINE)
                  .thenReturn(HTTP_200_STATUSLINE);
          when(httpClient.execute(eq(HTTP_HOST), HttpRequestMatcher.eq(request), eq(httpClientContext)))
                  .thenReturn(mockResponse)
                  .thenReturn(mockResponse);
          when(httpClient.execute(eq(HTTP_HOST), HttpRequestMatcher.eq(loginRequest), eq(httpClientContext)))
                  .thenReturn(mockResponse);
  
          final CloseableHttpResponse response = client.execute(request);
  
          assertThat(response, notNullValue());
          assertThat(response, sameInstance(mockResponse));
          verifyPrivate(client).invoke("execute", HttpRequestMatcher.eq(request), eq(0));
          verifyPrivate(client).invoke("execute", HttpRequestMatcher.eq(loginRequest), eq(401));
          verifyPrivate(client).invoke("execute", HttpRequestMatcher.eq(request), eq(200));
      }
test_case.class_method_signature: NiciraRestClientTest.testExecuteUnauthorizedThenSuccess()
test_case.full_signature: @Test public void testExecuteUnauthorizedThenSuccess()
test_case.identifier: testExecuteUnauthorizedThenSuccess
test_case.invocations: thenReturn thenReturn thenReturn when getStatusLine thenReturn thenReturn when execute eq eq eq thenReturn when execute eq eq eq execute assertThat notNullValue assertThat sameInstance invoke verifyPrivate eq eq invoke verifyPrivate eq eq invoke verifyPrivate eq eq
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testExecuteUnauthorizedThenSuccess()
focal_class.declarator: s_logger = LoggerFactory.getLogger(NiciraRestClient.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger s_logger = LoggerFactory.getLogger(NiciraRestClient.class);
focal_class.type: Logger
focal_class.var_name: s_logger
focal_class.declarator: CONTENT_TYPE = HttpConstants.CONTENT_TYPE
focal_class.modifier: private static final
focal_class.original_string: private static final String CONTENT_TYPE = HttpConstants.CONTENT_TYPE;
focal_class.type: String
focal_class.var_name: CONTENT_TYPE
focal_class.declarator: TEXT_HTML_CONTENT_TYPE = HttpConstants.TEXT_HTML_CONTENT_TYPE
focal_class.modifier: private static final
focal_class.original_string: private static final String TEXT_HTML_CONTENT_TYPE = HttpConstants.TEXT_HTML_CONTENT_TYPE;
focal_class.type: String
focal_class.var_name: TEXT_HTML_CONTENT_TYPE
focal_class.declarator: DEFAULT_BODY_RESP_MAX_LEN = 1024
focal_class.modifier: private static final
focal_class.original_string: private static final int DEFAULT_BODY_RESP_MAX_LEN = 1024;
focal_class.type: int
focal_class.var_name: DEFAULT_BODY_RESP_MAX_LEN
focal_class.declarator: DEFAULT_EXECUTION_LIMIT = 5
focal_class.modifier: private static final
focal_class.original_string: private static final int DEFAULT_EXECUTION_LIMIT = 5;
focal_class.type: int
focal_class.var_name: DEFAULT_EXECUTION_LIMIT
focal_class.declarator: counter
focal_class.modifier: private final
focal_class.original_string: private final ExecutionCounter counter;
focal_class.type: ExecutionCounter
focal_class.var_name: counter
focal_class.declarator: maxResponseErrorMesageLength
focal_class.modifier: private final
focal_class.original_string: private final int maxResponseErrorMesageLength;
focal_class.type: int
focal_class.var_name: maxResponseErrorMesageLength
focal_class.declarator: executionLimit
focal_class.modifier: private final
focal_class.original_string: private final int executionLimit;
focal_class.type: int
focal_class.var_name: executionLimit
focal_class.declarator: username
focal_class.modifier: private final
focal_class.original_string: private final String username;
focal_class.type: String
focal_class.var_name: username
focal_class.declarator: password
focal_class.modifier: private final
focal_class.original_string: private final String password;
focal_class.type: String
focal_class.var_name: password
focal_class.declarator: loginUrl
focal_class.modifier: private final
focal_class.original_string: private final String loginUrl;
focal_class.type: String
focal_class.var_name: loginUrl
focal_class.file: cosmic-core/server/src/main/java/com/cloud/network/nicira/NiciraRestClient.java
focal_class.identifier: NiciraRestClient
focal_class.class_method_signature: NiciraRestClient.NiciraRestClient(final Builder builder)
focal_class.full_signature: private  NiciraRestClient(final Builder builder)
focal_class.identifier: NiciraRestClient
focal_class.modifiers: private
focal_class.parameters: (final Builder builder)
focal_class.signature:  NiciraRestClient(final Builder builder)
focal_class.class_method_signature: NiciraRestClient.create()
focal_class.full_signature: public static Builder create()
focal_class.identifier: create
focal_class.modifiers: public static
focal_class.parameters: ()
focal_class.return: Builder
focal_class.signature: Builder create()
focal_class.class_method_signature: NiciraRestClient.execute(final HttpUriRequest request)
focal_class.full_signature: @Override public CloseableHttpResponse execute(final HttpUriRequest request)
focal_class.identifier: execute
focal_class.modifiers: @Override public
focal_class.parameters: (final HttpUriRequest request)
focal_class.return: CloseableHttpResponse
focal_class.signature: CloseableHttpResponse execute(final HttpUriRequest request)
focal_class.class_method_signature: NiciraRestClient.execute(final HttpUriRequest request, final int previousStatusCode)
focal_class.full_signature: private CloseableHttpResponse execute(final HttpUriRequest request, final int previousStatusCode)
focal_class.identifier: execute
focal_class.modifiers: private
focal_class.parameters: (final HttpUriRequest request, final int previousStatusCode)
focal_class.return: CloseableHttpResponse
focal_class.signature: CloseableHttpResponse execute(final HttpUriRequest request, final int previousStatusCode)
focal_class.class_method_signature: NiciraRestClient.handleUnauthorizedResponse(final HttpUriRequest request, final int previousStatusCode, final CloseableHttpResponse response, final int statusCode)
focal_class.full_signature: private CloseableHttpResponse handleUnauthorizedResponse(final HttpUriRequest request, final int previousStatusCode, final CloseableHttpResponse response, final int statusCode)
focal_class.identifier: handleUnauthorizedResponse
focal_class.modifiers: private
focal_class.parameters: (final HttpUriRequest request, final int previousStatusCode, final CloseableHttpResponse response, final int statusCode)
focal_class.return: CloseableHttpResponse
focal_class.signature: CloseableHttpResponse handleUnauthorizedResponse(final HttpUriRequest request, final int previousStatusCode, final CloseableHttpResponse response, final int statusCode)
focal_class.class_method_signature: NiciraRestClient.handleSuccessResponse(final HttpUriRequest request, final CloseableHttpResponse response)
focal_class.full_signature: private CloseableHttpResponse handleSuccessResponse(final HttpUriRequest request, final CloseableHttpResponse response)
focal_class.identifier: handleSuccessResponse
focal_class.modifiers: private
focal_class.parameters: (final HttpUriRequest request, final CloseableHttpResponse response)
focal_class.return: CloseableHttpResponse
focal_class.signature: CloseableHttpResponse handleSuccessResponse(final HttpUriRequest request, final CloseableHttpResponse response)
focal_class.class_method_signature: NiciraRestClient.createAuthenticationRequest()
focal_class.full_signature: private HttpUriRequest createAuthenticationRequest()
focal_class.identifier: createAuthenticationRequest
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: HttpUriRequest
focal_class.signature: HttpUriRequest createAuthenticationRequest()
focal_class.class_method_signature: NiciraRestClient.responseToErrorMessage(final CloseableHttpResponse response)
focal_class.full_signature: private String responseToErrorMessage(final CloseableHttpResponse response)
focal_class.identifier: responseToErrorMessage
focal_class.modifiers: private
focal_class.parameters: (final CloseableHttpResponse response)
focal_class.return: String
focal_class.signature: String responseToErrorMessage(final CloseableHttpResponse response)
focal_class.superclass: extends BasicRestClient
focal_method.body: @Override
      public CloseableHttpResponse execute(final HttpUriRequest request) throws CosmicRESTException {
          return execute(request, 0);
      }
focal_method.class_method_signature: NiciraRestClient.execute(final HttpUriRequest request)
focal_method.full_signature: @Override public CloseableHttpResponse execute(final HttpUriRequest request)
focal_method.identifier: execute
focal_method.invocations: execute
focal_method.modifiers: @Override public
focal_method.parameters: (final HttpUriRequest request)
focal_method.return: CloseableHttpResponse
focal_method.signature: CloseableHttpResponse execute(final HttpUriRequest request)