private String databagitemId;
public void testCreateNewCookbook() throws Exception {
// Define the file you want in the cookbook
File file = new File(System.getProperty("user.dir"), "pom.xml");
FilePayload content = Payloads.newFilePayload(file);
content.getContentMetadata().setContentType("application/x-binary");
// Get an md5 so that you can see if the server already has it or not
content.getContentMetadata().setContentMD5(Files.asByteSource(file).hash(Hashing.md5()).asBytes());
// Note that java collections cannot effectively do equals or hashcodes on
// byte arrays, so let's convert to a list of bytes.
List<Byte> md5 = Bytes.asList(content.getContentMetadata().getContentMD5());
// Request an upload site for this file
UploadSandbox site = api.createUploadSandboxForChecksums(ImmutableSet.of(md5));
assertTrue(site.getChecksums().containsKey(md5), md5 + " not in " + site.getChecksums());