}
//any jar should be fine. Use canned jar
InputStream originalBinaryStream = this.getClass().getClassLoader()
.getResourceAsStream("binary-blob-sample.jar");
String originalDigest = new MessageDigestGenerator(MessageDigestGenerator.SHA_256)
.calcDigestString(originalBinaryStream);
originalBinaryStream.close();
originalBinaryStream = this.getClass().getClassLoader()
.getResourceAsStream("binary-blob-sample.jar");
contentManager.updateBlobStream(originalBinaryStream, packageBits, null);
packageBits = em.find(PackageBits.class, packageBits.getId());
// test that the bits are available and stored in the DB: Reading the Blob
composite = contentUIManager.getLoadedPackageBitsComposite(pkgVer.getId());
assert composite != null;
assert composite.getPackageVersionId() == pkgVer.getId();
assert composite.getPackageBitsId() == packageBits.getId();
assert composite.isPackageBitsAvailable();
assert composite.isPackageBitsInDatabase();
FileOutputStream outputStream = new FileOutputStream(retrieved);
contentManager.writeBlobOutToStream(outputStream, packageBits, false);
//Check that db content equal to file system content
String newDigest = new MessageDigestGenerator(MessageDigestGenerator.SHA_256)
.calcDigestString(retrieved);
assertEquals("Uploaded and retrieved digests differ:", originalDigest, newDigest);
} catch (Throwable t) {
t.printStackTrace();