protected void prepareBytes(byte[] bytes, String md5) { expectStatusCode(200, false); prepareHeader( response, AbstractDownloadObjectCommand.ETAG, md5 == null ? DigestUtils.md5Hex(bytes) : md5); prepareHeader( response, AbstractDownloadObjectCommand.CONTENT_LENGTH, Long.toString(bytes.length)); httpEntity = new ByteArrayEntity(bytes); new NonStrictExpectations() { { response.getEntity(); result = httpEntity; } }; }
@Test public void emptyDeleteAt() { expectStatusCode(202); List<Header> headers = new ArrayList<Header>(); prepareHeader(response, LAST_MODIFIED, "Mon, 03 Sep 2012 05:40:33 GMT", headers); prepareHeadersForRetrieval(response, headers); assertNull(object.getDeleteAt()); assertNull(object.getDeleteAtAsDate()); }
protected void prepareMetadata() { List<Header> headers = new ArrayList<Header>(); prepareHeader(response, X_OBJECT_META_PREFIX + "Year", "1989", headers); prepareHeader(response, X_OBJECT_META_PREFIX + "Company", "42 BV", headers); prepareHeader(response, LAST_MODIFIED, "Mon, 03 Sep 2012 05:40:33 GMT", headers); prepareHeader(response, ETAG, "cae4ebb15a282e98ba7b65402a72f57c", headers); prepareHeader(response, CONTENT_LENGTH, "654321", headers); prepareHeader(response, CONTENT_TYPE, "image/png", headers); prepareHeader(response, X_DELETE_AT, "1339429105", headers); prepareHeadersForRetrieval(response, headers); }
protected AbstractStoredObject createStoredObjectForTempURL(String password) { account = new AccountImpl( null, httpClient, AccessTest.setUpAccessWithURLwithPaths(), true, TempUrlHashPrefixSource.INTERNAL_URL_PATH, '/'); List<Header> headers = new ArrayList<Header>(); prepareHeader( response, AccountMetadata.X_ACCOUNT_META_PREFIX + HashPassword.X_ACCOUNT_TEMP_URL_KEY, password, headers); prepareHeadersForRetrieval(response, headers); account.setHashPassword("welkom#42"); Container container = account.getContainer("alpha"); return (AbstractStoredObject) container.getObject("some-image.jpg"); }