private void mockResponseFor(String httpMethod, int status) { when(mockParams.getUrl()).thenReturn(TEST_URL); when(mockParams.getProtocol()).thenReturn(HTTP); when(mockContext.getEnvironmentValue(Constants.HTTP_REQUEST.METHOD.attributeId)).thenReturn(httpMethod); String cLen = Long.toString(System.currentTimeMillis()); when(mockResponse.getResponseHeaderValue(HttpHeaders.CONTENT_LENGTH, "-1")).thenReturn(cLen); when(mockResponse.getResponseHeaders()).thenReturn(new Header[0]); when(mockResponse.getStatusCode()).thenReturn(status); when(mockTranslator.makeAbsoluteURLs(TEST_URL)).thenReturn(TEST_URL); when(mockParams.getTranslator()).thenReturn(mockTranslator); mockStatic(ServerUtility.class); when(ServerUtility.isURLFedoraServer(TEST_URL)).thenReturn(false); }
long length = Long.parseLong(response.getResponseHeaderValue(HttpHeaders.CONTENT_LENGTH,"-1")); Property[] headerArray = toPropertyArray(response.getResponseHeaders()); if (mimeType == null || mimeType.isEmpty()) { mimeType = DEFAULT_MIMETYPE; Header[] respHeaders = response.getResponseHeaders(); Property[] properties = new Property[respHeaders.length]; for (int i = 0; i < respHeaders.length; i++){
long length = Long.parseLong(response.getResponseHeaderValue(HttpHeaders.CONTENT_LENGTH,"-1")); Property[] headerArray = toPropertyArray(response.getResponseHeaders()); if (mimeType == null || mimeType.isEmpty()) { mimeType = DEFAULT_MIMETYPE; Header[] respHeaders = response.getResponseHeaders(); Property[] properties = new Property[respHeaders.length]; for (int i = 0; i < respHeaders.length; i++){