test_class.declarator: HTTP_200_STATUS_LINE = new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")
test_class.modifier: private static final
test_class.original_string: private static final BasicStatusLine HTTP_200_STATUS_LINE = new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK");
test_class.type: BasicStatusLine
test_class.var_name: HTTP_200_STATUS_LINE
test_class.declarator: gson = new GsonBuilder().setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES).create()
test_class.modifier: private static final
test_class.original_string: private static final Gson gson = new GsonBuilder().setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES).create();
test_class.type: Gson
test_class.var_name: gson
test_class.declarator: DEFAULT_TEST_PARAMETERS = new HashMap<>()
test_class.modifier: private static final
test_class.original_string: private static final Map<String, String> DEFAULT_TEST_PARAMETERS = new HashMap<>();
test_class.type: Map<String, String>
test_class.var_name: DEFAULT_TEST_PARAMETERS
test_class.file: cosmic-common/src/test/java/com/cloud/utils/rest/RESTServiceConnectorTest.java
test_class.identifier: RESTServiceConnectorTest
test_case.body: @Test
      public void testExecuteCreateObject() throws Exception {
          final TestPojo newObject = new TestPojo();
          newObject.setField("newValue");
          final String newObjectJson = gson.toJson(newObject);
          final CloseableHttpResponse response = mock(CloseableHttpResponse.class);
          when(response.getEntity()).thenReturn(new StringEntity(newObjectJson));
          when(response.getStatusLine()).thenReturn(HTTP_200_STATUS_LINE);
          final CloseableHttpClient httpClient = mock(CloseableHttpClient.class);
          when(httpClient.execute(any(HttpHost.class), any(HttpRequest.class), any(HttpClientContext.class))).thenReturn(response);
          final RestClient restClient = new BasicRestClient(httpClient, HttpClientContext.create(), "localhost");
          final RESTServiceConnector connector = new RESTServiceConnector.Builder().client(restClient).build();
  
          final TestPojo object = connector.executeCreateObject(newObject, "/somepath");
  
          assertThat(object, notNullValue());
          assertThat(object, equalTo(newObject));
          verify(httpClient).execute(any(HttpHost.class), HttpUriRequestMethodMatcher.aMethod("POST"), any(HttpClientContext.class));
          verify(httpClient).execute(any(HttpHost.class), HttpUriRequestPayloadMatcher.aPayload(newObjectJson), any(HttpClientContext.class));
          verify(response).close();
      }
test_case.class_method_signature: RESTServiceConnectorTest.testExecuteCreateObject()
test_case.full_signature: @Test public void testExecuteCreateObject()
test_case.identifier: testExecuteCreateObject
test_case.invocations: setField toJson mock thenReturn when getEntity thenReturn when getStatusLine mock thenReturn when execute any any any create build client executeCreateObject assertThat notNullValue assertThat equalTo execute verify any aMethod any execute verify any aPayload any close verify
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testExecuteCreateObject()
focal_class.declarator: s_logger = LoggerFactory.getLogger(RESTServiceConnector.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger s_logger = LoggerFactory.getLogger(RESTServiceConnector.class);
focal_class.type: Logger
focal_class.var_name: s_logger
focal_class.declarator: ABSENT = Optional.absent()
focal_class.modifier: private static final
focal_class.original_string: private static final Optional<String> ABSENT = Optional.absent();
focal_class.type: Optional<String>
focal_class.var_name: ABSENT
focal_class.declarator: client
focal_class.modifier: private final
focal_class.original_string: private final RestClient client;
focal_class.type: RestClient
focal_class.var_name: client
focal_class.declarator: gson
focal_class.modifier: private final
focal_class.original_string: private final Gson gson;
focal_class.type: Gson
focal_class.var_name: gson
focal_class.file: cosmic-common/src/main/java/com/cloud/utils/rest/RESTServiceConnector.java
focal_class.identifier: RESTServiceConnector
focal_class.class_method_signature: RESTServiceConnector.RESTServiceConnector(final Builder builder)
focal_class.full_signature: private  RESTServiceConnector(final Builder builder)
focal_class.identifier: RESTServiceConnector
focal_class.modifiers: private
focal_class.parameters: (final Builder builder)
focal_class.signature:  RESTServiceConnector(final Builder builder)
focal_class.class_method_signature: RESTServiceConnector.setGsonDeserializer(final Map<Class<?>, JsonDeserializer<?>> classToDeserializerMap)
focal_class.full_signature: private static Gson setGsonDeserializer(final Map<Class<?>, JsonDeserializer<?>> classToDeserializerMap)
focal_class.identifier: setGsonDeserializer
focal_class.modifiers: private static
focal_class.parameters: (final Map<Class<?>, JsonDeserializer<?>> classToDeserializerMap)
focal_class.return: Gson
focal_class.signature: Gson setGsonDeserializer(final Map<Class<?>, JsonDeserializer<?>> classToDeserializerMap)
focal_class.class_method_signature: RESTServiceConnector.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: RESTServiceConnector.executeUpdateObject(final T newObject, final String path)
focal_class.full_signature: public void executeUpdateObject(final T newObject, final String path)
focal_class.identifier: executeUpdateObject
focal_class.modifiers: public
focal_class.parameters: (final T newObject, final String path)
focal_class.return: void
focal_class.signature: void executeUpdateObject(final T newObject, final String path)
focal_class.class_method_signature: RESTServiceConnector.executeUpdateObject(final T newObject, final String path, final Map<String, String> parameters)
focal_class.full_signature: public void executeUpdateObject(final T newObject, final String path, final Map<String, String> parameters)
focal_class.identifier: executeUpdateObject
focal_class.modifiers: public
focal_class.parameters: (final T newObject, final String path, final Map<String, String> parameters)
focal_class.return: void
focal_class.signature: void executeUpdateObject(final T newObject, final String path, final Map<String, String> parameters)
focal_class.class_method_signature: RESTServiceConnector.createAndExecuteRequest(final HttpMethods method, final String path, final Map<String, String> parameters, final Optional<String> jsonPayLoad)
focal_class.full_signature: private CloseableHttpResponse createAndExecuteRequest(final HttpMethods method, final String path, final Map<String, String> parameters, final Optional<String> jsonPayLoad)
focal_class.identifier: createAndExecuteRequest
focal_class.modifiers: private
focal_class.parameters: (final HttpMethods method, final String path, final Map<String, String> parameters, final Optional<String> jsonPayLoad)
focal_class.return: CloseableHttpResponse
focal_class.signature: CloseableHttpResponse createAndExecuteRequest(final HttpMethods method, final String path, final Map<String, String> parameters, final Optional<String> jsonPayLoad)
focal_class.class_method_signature: RESTServiceConnector.executeRequest(final HttpUriRequest httpRequest)
focal_class.full_signature: private CloseableHttpResponse executeRequest(final HttpUriRequest httpRequest)
focal_class.identifier: executeRequest
focal_class.modifiers: private
focal_class.parameters: (final HttpUriRequest httpRequest)
focal_class.return: CloseableHttpResponse
focal_class.signature: CloseableHttpResponse executeRequest(final HttpUriRequest httpRequest)
focal_class.class_method_signature: RESTServiceConnector.executeCreateObject(final T newObject, final String uri)
focal_class.full_signature: public T executeCreateObject(final T newObject, final String uri)
focal_class.identifier: executeCreateObject
focal_class.modifiers: public
focal_class.parameters: (final T newObject, final String uri)
focal_class.return: T
focal_class.signature: T executeCreateObject(final T newObject, final String uri)
focal_class.class_method_signature: RESTServiceConnector.executeCreateObject(final T newObject, final String path, final Map<String, String> parameters)
focal_class.full_signature: public T executeCreateObject(final T newObject, final String path, final Map<String, String> parameters)
focal_class.identifier: executeCreateObject
focal_class.modifiers: public
focal_class.parameters: (final T newObject, final String path, final Map<String, String> parameters)
focal_class.return: T
focal_class.signature: T executeCreateObject(final T newObject, final String path, final Map<String, String> parameters)
focal_class.class_method_signature: RESTServiceConnector.readResponseBody(final CloseableHttpResponse response, final Type type)
focal_class.full_signature: private T readResponseBody(final CloseableHttpResponse response, final Type type)
focal_class.identifier: readResponseBody
focal_class.modifiers: private
focal_class.parameters: (final CloseableHttpResponse response, final Type type)
focal_class.return: T
focal_class.signature: T readResponseBody(final CloseableHttpResponse response, final Type type)
focal_class.class_method_signature: RESTServiceConnector.executeDeleteObject(final String path)
focal_class.full_signature: public void executeDeleteObject(final String path)
focal_class.identifier: executeDeleteObject
focal_class.modifiers: public
focal_class.parameters: (final String path)
focal_class.return: void
focal_class.signature: void executeDeleteObject(final String path)
focal_class.class_method_signature: RESTServiceConnector.executeRetrieveObject(final Type returnObjectType, final String path)
focal_class.full_signature: public T executeRetrieveObject(final Type returnObjectType, final String path)
focal_class.identifier: executeRetrieveObject
focal_class.modifiers: public
focal_class.parameters: (final Type returnObjectType, final String path)
focal_class.return: T
focal_class.signature: T executeRetrieveObject(final Type returnObjectType, final String path)
focal_class.class_method_signature: RESTServiceConnector.executeRetrieveObject(final Type returnObjectType, final String path, final Map<String, String> parameters)
focal_class.full_signature: public T executeRetrieveObject(final Type returnObjectType, final String path, final Map<String, String> parameters)
focal_class.identifier: executeRetrieveObject
focal_class.modifiers: public
focal_class.parameters: (final Type returnObjectType, final String path, final Map<String, String> parameters)
focal_class.return: T
focal_class.signature: T executeRetrieveObject(final Type returnObjectType, final String path, final Map<String, String> parameters)
focal_method.body: public <T> T executeCreateObject(final T newObject, final String uri) throws CosmicRESTException {
          return executeCreateObject(newObject, uri, new HashMap<>());
      }
focal_method.class_method_signature: RESTServiceConnector.executeCreateObject(final T newObject, final String uri)
focal_method.full_signature: public T executeCreateObject(final T newObject, final String uri)
focal_method.identifier: executeCreateObject
focal_method.invocations: executeCreateObject
focal_method.modifiers: public
focal_method.parameters: (final T newObject, final String uri)
focal_method.return: T
focal_method.signature: T executeCreateObject(final T newObject, final String uri)