LOGGER.info(String.format(" HTTP POST Entity Content:%n%s", stringWriter.toString())); BusinessObjectDataSearchResult businessObjectDataSearchResult = getBusinessObjectDataSearchResult(httpClientOperations.execute(client, request));
LOGGER.info(String.format(" HTTP POST Entity Content:%n%s", sw.toString())); businessObjectDataStatusUpdateResponse = getBusinessObjectDataStatusUpdateResponse(httpClientOperations.execute(client, httpPut));
LOGGER.info(String.format(" HTTP POST Entity Content:%n%s", sw.toString())); businessObjectDataStatusUpdateResponse = getBusinessObjectDataStatusUpdateResponse(httpClientOperations.execute(client, httpPut));
LOGGER.info(String.format(" HTTP GET Headers: %s", Arrays.toString(request.getAllHeaders()))); storage = getStorage(httpClientOperations.execute(client, request));
LOGGER.info(String.format(" HTTP GET Headers: %s", Arrays.toString(request.getAllHeaders()))); storage = getStorage(httpClientOperations.execute(client, request));
LOGGER.info(String.format(" HTTP GET Headers: %s", Arrays.toString(request.getAllHeaders()))); BusinessObjectDefinition businessObjectDefinition = getBusinessObjectDefinition(httpClientOperations.execute(client, request));
LOGGER.info(String.format(" HTTP GET Headers: %s", Arrays.toString(httpGet.getAllHeaders()))); businessObjectDataVersions = getBusinessObjectDataVersions(httpClientOperations.execute(client, httpGet));
LOGGER.info(String.format(" HTTP GET Headers: %s", Arrays.toString(request.getAllHeaders()))); s3KeyPrefixInformation = getS3KeyPrefixInformation(httpClientOperations.execute(client, request));
LOGGER.info(String.format(" HTTP GET Headers: %s", Arrays.toString(request.getAllHeaders()))); s3KeyPrefixInformation = getS3KeyPrefixInformation(httpClientOperations.execute(client, request));
getBusinessObjectData(httpClientOperations.execute(client, request), "retrieve business object data from the registration server");
LOGGER.info(String.format(" HTTP POST Headers: %s", Arrays.toString(request.getAllHeaders()))); BusinessObjectData businessObjectData = destroyBusinessObjectData(httpClientOperations.execute(client, request));
getBusinessObjectData(httpClientOperations.execute(client, post), "register business object data with the registration server");
getBusinessObjectData(httpClientOperations.execute(client, post), "register business object data with the registration server");
businessObjectDataStorageFilesCreateResponse = getBusinessObjectDataStorageFilesCreateResponse(httpClientOperations.execute(client, post));
businessObjectDataStorageFilesCreateResponse = getBusinessObjectDataStorageFilesCreateResponse(httpClientOperations.execute(client, post));
@Test public void testGetBusinessObjectDataAssertNoAuthorizationHeaderWhenNoSsl() throws Exception { HttpClientOperations mockHttpClientOperations = mock(HttpClientOperations.class); HttpClientOperations originalHttpClientOperations = (HttpClientOperations) ReflectionTestUtils.getField(downloaderWebClient, "httpClientOperations"); ReflectionTestUtils.setField(downloaderWebClient, "httpClientOperations", mockHttpClientOperations); try { CloseableHttpResponse closeableHttpResponse = mock(CloseableHttpResponse.class); when(mockHttpClientOperations.execute(any(), any())).thenReturn(closeableHttpResponse); when(closeableHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(HttpVersion.HTTP_1_1, 200, "OK")); when(closeableHttpResponse.getEntity()).thenReturn(new StringEntity(xmlHelper.objectToXml(new BusinessObjectData()))); DownloaderInputManifestDto manifest = new DownloaderInputManifestDto(); downloaderWebClient.getRegServerAccessParamsDto().setUseSsl(false); downloaderWebClient.getBusinessObjectData(manifest); verify(mockHttpClientOperations).execute(any(), argThat(httpUriRequest -> httpUriRequest.getFirstHeader("Authorization") == null)); } finally { ReflectionTestUtils.setField(downloaderWebClient, "httpClientOperations", originalHttpClientOperations); } }
@Test public void testGetBusinessObjectDataDownloadCredentialAssertNoAuthorizationHeaderWhenNoSsl() throws Exception { HttpClientOperations mockHttpClientOperations = mock(HttpClientOperations.class); HttpClientOperations originalHttpClientOperations = (HttpClientOperations) ReflectionTestUtils.getField(downloaderWebClient, "httpClientOperations"); ReflectionTestUtils.setField(downloaderWebClient, "httpClientOperations", mockHttpClientOperations); try { CloseableHttpResponse closeableHttpResponse = mock(CloseableHttpResponse.class); when(mockHttpClientOperations.execute(any(), any())).thenReturn(closeableHttpResponse); when(closeableHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(HttpVersion.HTTP_1_1, 200, "SUCCESS")); when(closeableHttpResponse.getEntity()).thenReturn(new StringEntity(xmlHelper.objectToXml(new StorageUnitDownloadCredential()))); DownloaderInputManifestDto downloaderInputManifestDto = new DownloaderInputManifestDto(); String storageName = "storageName"; boolean useSsl = false; downloaderWebClient.getRegServerAccessParamsDto().setUseSsl(useSsl); downloaderWebClient.getStorageUnitDownloadCredential(downloaderInputManifestDto, storageName); verify(mockHttpClientOperations).execute(any(), argThat(httpUriRequest -> httpUriRequest.getFirstHeader("Authorization") == null)); } finally { ReflectionTestUtils.setField(downloaderWebClient, "httpClientOperations", originalHttpClientOperations); } }
when(mockHttpClientOperations.execute(any(), any())).thenReturn(closeableHttpResponse);
when(mockHttpClientHelper.createHttpClient(any(), any())).thenReturn(closeableHttpClient); when(mockHttpClientOperations.execute(any(), any())).thenThrow(expectedException);
return getStorageUnitDownloadCredential(httpClientOperations.execute(httpClient, httpGet));