Return-Path: Delivered-To: apmail-jackrabbit-commits-archive@www.apache.org Received: (qmail 29792 invoked from network); 4 Oct 2010 13:55:11 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 4 Oct 2010 13:55:11 -0000 Received: (qmail 16731 invoked by uid 500); 4 Oct 2010 13:55:11 -0000 Delivered-To: apmail-jackrabbit-commits-archive@jackrabbit.apache.org Received: (qmail 16636 invoked by uid 500); 4 Oct 2010 13:55:10 -0000 Mailing-List: contact commits-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jackrabbit.apache.org Delivered-To: mailing list commits@jackrabbit.apache.org Received: (qmail 16629 invoked by uid 99); 4 Oct 2010 13:55:09 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Oct 2010 13:55:09 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Oct 2010 13:55:08 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 00E5023888D7; Mon, 4 Oct 2010 13:54:48 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1004239 - in /jackrabbit/trunk/jackrabbit-core/src: main/java/org/apache/jackrabbit/core/persistence/bundle/ main/java/org/apache/jackrabbit/core/persistence/pool/ main/java/org/apache/jackrabbit/core/persistence/util/ test/java/org/apache... Date: Mon, 04 Oct 2010 13:54:47 -0000 To: commits@jackrabbit.apache.org From: jukka@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20101004135448.00E5023888D7@eris.apache.org> Author: jukka Date: Mon Oct 4 13:54:47 2010 New Revision: 1004239 URL: http://svn.apache.org/viewvc?rev=1004239&view=rev Log: JCR-2762: Optimize bundle serialization Remove duplicate code by merging the checkBundle() and readBundle() functionality Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/BundleDbPersistenceManager.java jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/PostgreSQLPersistenceManager.java jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/pool/BundleDbPersistenceManager.java jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/pool/PostgreSQLPersistenceManager.java jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/BundleBinding.java jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/BundleReader.java jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/persistence/util/BundleBindingTest.java Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/BundleDbPersistenceManager.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/BundleDbPersistenceManager.java?rev=1004239&r1=1004238&r2=1004239&view=diff ============================================================================== --- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/BundleDbPersistenceManager.java (original) +++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/BundleDbPersistenceManager.java Mon Oct 4 13:54:47 2010 @@ -32,6 +32,7 @@ import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.List; @@ -746,7 +747,7 @@ public class BundleDbPersistenceManager try { // analyze child node bundles - NodePropBundle child = loadBundle(entry.getId(), true); + NodePropBundle child = loadBundle(entry.getId()); if (child == null) { log.error( "NodeState '" + id + "' references inexistent child" @@ -846,20 +847,14 @@ public class BundleDbPersistenceManager closeResultSet(bRs); } - try { // parse and check bundle - // checkBundle will log any problems itself - if (binding.checkBundle( - new ByteArrayInputStream(data))) { - NodePropBundle bundle = binding.readBundle( - new ByteArrayInputStream(data), id); - checkBundleConsistency(id, bundle, fix, modifications); - } else { - log.error("invalid bundle '" + id + "', see previous BundleBinding error log entry"); - } - } catch (Exception e) { - log.error("Error in bundle " + id + ": " + e); + NodePropBundle bundle = binding.readBundle( + new ByteArrayInputStream(data), id); + checkBundleConsistency(id, bundle, fix, modifications); + } catch (IOException e) { + log.error("Unable to parse bundle " + id + + ": " + Arrays.toString(data), e); } count++; if (count % 1000 == 0) { @@ -896,7 +891,7 @@ public class BundleDbPersistenceManager NodeId id = idList.get(i); try { // load the node from the database - NodePropBundle bundle = loadBundle(id, true); + NodePropBundle bundle = loadBundle(id); if (bundle == null) { log.error("No bundle found for uuid '" + id + "'"); @@ -1098,7 +1093,32 @@ public class BundleDbPersistenceManager */ protected synchronized NodePropBundle loadBundle(NodeId id) throws ItemStateException { - return loadBundle(id, false); + ResultSet rs = null; + try { + Statement stmt = connectionManager.executeStmt(bundleSelectSQL, getKey(id)); + rs = stmt.getResultSet(); + if (!rs.next()) { + return null; + } + byte[] bytes = getBytes(rs.getBlob(1)); + + try { + NodePropBundle bundle = + binding.readBundle(new ByteArrayInputStream(bytes), id); + bundle.setSize(bytes.length); + return bundle; + } catch (IOException e) { + log.error("Unable to parse serialization of bundle " + id + + ": " + Arrays.toString(bytes), e); + throw e; + } + } catch (Exception e) { + String msg = "failed to read bundle: " + id + ": " + e; + log.error(msg); + throw new ItemStateException(msg, e); + } finally { + closeResultSet(rs); + } } /** @@ -1126,49 +1146,6 @@ public class BundleDbPersistenceManager } /** - * Loads a bundle from the underlying system and optionally performs - * a check on the bundle first. - * - * @param id the node id of the bundle - * @param checkBeforeLoading check the bundle before loading it and log - * detailed information about it (slower) - * @return the loaded bundle or null if the bundle does not - * exist. - * @throws ItemStateException if an error while loading occurs. - */ - protected synchronized NodePropBundle loadBundle(NodeId id, boolean checkBeforeLoading) - throws ItemStateException { - ResultSet rs = null; - try { - Statement stmt = connectionManager.executeStmt(bundleSelectSQL, getKey(id)); - rs = stmt.getResultSet(); - if (!rs.next()) { - return null; - } - Blob b = rs.getBlob(1); - byte[] bytes = getBytes(b); - - if (checkBeforeLoading) { - if (!binding.checkBundle(new ByteArrayInputStream(bytes))) { - // gets wrapped as proper ItemStateException below - throw new Exception("invalid bundle, see previous BundleBinding error log entry"); - } - } - - NodePropBundle bundle = - binding.readBundle(new ByteArrayInputStream(bytes), id); - bundle.setSize(bytes.length); - return bundle; - } catch (Exception e) { - String msg = "failed to read bundle: " + id + ": " + e; - log.error(msg); - throw new ItemStateException(msg, e); - } finally { - closeResultSet(rs); - } - } - - /** * {@inheritDoc} */ protected synchronized void storeBundle(NodePropBundle bundle) throws ItemStateException { Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/PostgreSQLPersistenceManager.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/PostgreSQLPersistenceManager.java?rev=1004239&r1=1004238&r2=1004239&view=diff ============================================================================== --- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/PostgreSQLPersistenceManager.java (original) +++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/PostgreSQLPersistenceManager.java Mon Oct 4 13:54:47 2010 @@ -85,6 +85,7 @@ public class PostgreSQLPersistenceManage return SM_LONGLONG_KEYS; } + @Override protected synchronized NodePropBundle loadBundle(NodeId id) throws ItemStateException { try { Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/pool/BundleDbPersistenceManager.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/pool/BundleDbPersistenceManager.java?rev=1004239&r1=1004238&r2=1004239&view=diff ============================================================================== --- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/pool/BundleDbPersistenceManager.java (original) +++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/pool/BundleDbPersistenceManager.java Mon Oct 4 13:54:47 2010 @@ -26,6 +26,7 @@ import java.sql.Blob; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.List; @@ -713,7 +714,7 @@ public class BundleDbPersistenceManager try { // analyze child node bundles - NodePropBundle child = loadBundle(entry.getId(), true); + NodePropBundle child = loadBundle(entry.getId()); if (child == null) { log.error( "NodeState '" + id + "' references inexistent child" @@ -805,19 +806,14 @@ public class BundleDbPersistenceManager DbUtility.close(bRs); } - try { // parse and check bundle - // checkBundle will log any problems itself - if (binding.checkBundle(new ByteArrayInputStream(data))) { - NodePropBundle bundle = binding.readBundle( - new ByteArrayInputStream(data), id); - checkBundleConsistency(id, bundle, fix, modifications); - } else { - log.error("invalid bundle '" + id + "', see previous BundleBinding error log entry"); - } - } catch (Exception e) { - log.error("Error in bundle " + id + ": " + e); + NodePropBundle bundle = binding.readBundle( + new ByteArrayInputStream(data), id); + checkBundleConsistency(id, bundle, fix, modifications); + } catch (IOException e) { + log.error("Unable to parse bundle " + id + + ": " + Arrays.toString(data), e); } count++; if (count % 1000 == 0) { @@ -854,7 +850,7 @@ public class BundleDbPersistenceManager NodeId id = idList.get(i); try { // load the node from the database - NodePropBundle bundle = loadBundle(id, true); + NodePropBundle bundle = loadBundle(id); if (bundle == null) { log.error("No bundle found for uuid '" + id + "'"); @@ -1024,7 +1020,31 @@ public class BundleDbPersistenceManager * {@inheritDoc} */ protected NodePropBundle loadBundle(NodeId id) throws ItemStateException { - return loadBundle(id, false); + ResultSet rs = null; + try { + rs = conHelper.exec(bundleSelectSQL, getKey(id), false, 0); + if (!rs.next()) { + return null; + } + byte[] bytes = getBytes(rs.getBlob(1)); + + try { + NodePropBundle bundle = + binding.readBundle(new ByteArrayInputStream(bytes), id); + bundle.setSize(bytes.length); + return bundle; + } catch (IOException e) { + log.error("Unable to parse serialization of bundle " + id + + ": " + Arrays.toString(bytes), e); + throw e; + } + } catch (Exception e) { + String msg = "failed to read bundle: " + id + ": " + e; + log.error(msg); + throw new ItemStateException(msg, e); + } finally { + DbUtility.close(rs); + } } /** @@ -1052,49 +1072,6 @@ public class BundleDbPersistenceManager } /** - * Loads a bundle from the underlying system and optionally performs - * a check on the bundle first. - * - * @param id the node id of the bundle - * @param checkBeforeLoading check the bundle before loading it and log - * detailed information about it (slower) - * @return the loaded bundle or null if the bundle does not - * exist. - * @throws ItemStateException if an error while loading occurs. - */ - protected NodePropBundle loadBundle(NodeId id, boolean checkBeforeLoading) - throws ItemStateException { - ResultSet rs = null; - - try { - rs = conHelper.exec(bundleSelectSQL, getKey(id), false, 0); - if (!rs.next()) { - return null; - } - Blob b = rs.getBlob(1); - byte[] bytes = getBytes(b); - - if (checkBeforeLoading) { - if (!binding.checkBundle(new ByteArrayInputStream(bytes))) { - // gets wrapped as proper ItemStateException below - throw new Exception("invalid bundle, see previous BundleBinding error log entry"); - } - } - - NodePropBundle bundle = - binding.readBundle(new ByteArrayInputStream(bytes), id); - bundle.setSize(bytes.length); - return bundle; - } catch (Exception e) { - String msg = "failed to read bundle: " + id + ": " + e; - log.error(msg); - throw new ItemStateException(msg, e); - } finally { - DbUtility.close(rs); - } - } - - /** * {@inheritDoc} */ protected synchronized void storeBundle(NodePropBundle bundle) throws ItemStateException { Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/pool/PostgreSQLPersistenceManager.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/pool/PostgreSQLPersistenceManager.java?rev=1004239&r1=1004238&r2=1004239&view=diff ============================================================================== --- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/pool/PostgreSQLPersistenceManager.java (original) +++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/pool/PostgreSQLPersistenceManager.java Mon Oct 4 13:54:47 2010 @@ -91,6 +91,7 @@ public class PostgreSQLPersistenceManage * * {@inheritDoc} */ + @Override protected NodePropBundle loadBundle(NodeId id) throws ItemStateException { ResultSet rs = null; try { Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/BundleBinding.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/BundleBinding.java?rev=1004239&r1=1004238&r2=1004239&view=diff ============================================================================== --- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/BundleBinding.java (original) +++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/BundleBinding.java Mon Oct 4 13:54:47 2010 @@ -139,17 +139,6 @@ public class BundleBinding { } /** - * Checks a NodePropBundle from a data input stream. - * - * @param in the input stream - * @return true if the data is valid; - * false otherwise. - */ - public boolean checkBundle(InputStream in) { - return new BundleReader(this, in).checkBundle(); - } - - /** * Serializes a NodePropBundle to a data output stream * * @param out the output stream Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/BundleReader.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/BundleReader.java?rev=1004239&r1=1004238&r2=1004239&view=diff ============================================================================== --- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/BundleReader.java (original) +++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/BundleReader.java Mon Oct 4 13:54:47 2010 @@ -145,101 +145,6 @@ class BundleReader { } /** - * Checks a NodePropBundle from a data input stream. - * - * @return true if the data is valid; - * false otherwise. - */ - public boolean checkBundle() { - int version; - // primaryType & version - try { - // read version and primary type...special handling - int index = in.readInt(); - - // get version - version = (index >> 24) & 0xff; - index &= 0x00ffffff; - String uri = binding.nsIndex.indexToString(index); - String local = binding.nameIndex.indexToString(in.readInt()); - Name nodeTypeName = NameFactoryImpl.getInstance().create(uri, local); - - log.debug("Serialzation Version: " + version); - log.debug("NodeTypeName: " + nodeTypeName); - } catch (IOException e) { - log.error("Error while reading NodeTypeName: " + e); - return false; - } - try { - NodeId parentId = readNodeId(); - log.debug("ParentUUID: " + parentId); - } catch (IOException e) { - log.error("Error while reading ParentUUID: " + e); - return false; - } - try { - String definitionId = in.readUTF(); - log.debug("DefinitionId: " + definitionId); - } catch (IOException e) { - log.error("Error while reading DefinitionId: " + e); - return false; - } - try { - Name mixinName = readIndexedQName(); - while (mixinName != null) { - log.debug("MixinTypeName: " + mixinName); - mixinName = readIndexedQName(); - } - } catch (IOException e) { - log.error("Error while reading MixinTypes: " + e); - return false; - } - try { - Name propName = readIndexedQName(); - while (propName != null) { - log.debug("PropertyName: " + propName); - if (!checkPropertyState()) { - return false; - } - propName = readIndexedQName(); - } - } catch (IOException e) { - log.error("Error while reading property names: " + e); - return false; - } - try { - boolean hasUUID = in.readBoolean(); - log.debug("hasUUID: " + hasUUID); - } catch (IOException e) { - log.error("Error while reading 'hasUUID': " + e); - return false; - } - try { - NodeId cneId = readNodeId(); - while (cneId != null) { - Name cneName = readQName(); - log.debug("ChildNodentry: " + cneId + ":" + cneName); - cneId = readNodeId(); - } - } catch (IOException e) { - log.error("Error while reading child node entry: " + e); - return false; - } - - if (version >= BundleBinding.VERSION_1) { - try { - short modCount = readModCount(); - log.debug("modCount: " + modCount); - } catch (IOException e) { - log.error("Error while reading mod cout: " + e); - return false; - } - } - - return true; - } - - /** * Deserializes a PropertyState from the data input stream. * * @param id the property id for the new property entry @@ -334,174 +239,6 @@ class BundleReader { } /** - * Checks a PropertyState from the data input stream. - * - * @return true if the data is valid; - * false otherwise. - */ - private boolean checkPropertyState() { - int type; - try { - type = in.readInt(); - short modCount = (short) ((type >> 16) | 0xffff); - type &= 0xffff; - log.debug(" PropertyType: " + PropertyType.nameFromValue(type)); - log.debug(" ModCount: " + modCount); - } catch (IOException e) { - log.error("Error while reading property type: " + e); - return false; - } - try { - boolean isMV = in.readBoolean(); - log.debug(" MultiValued: " + isMV); - } catch (IOException e) { - log.error("Error while reading multivalued: " + e); - return false; - } - try { - String defintionId = in.readUTF(); - log.debug(" DefinitionId: " + defintionId); - } catch (IOException e) { - log.error("Error while reading definition id: " + e); - return false; - } - - int count; - try { - count = in.readInt(); - log.debug(" num values: " + count); - } catch (IOException e) { - log.error("Error while reading number of values: " + e); - return false; - } - for (int i = 0; i < count; i++) { - switch (type) { - case PropertyType.BINARY: - int size; - try { - size = in.readInt(); - log.debug(" binary size: " + size); - } catch (IOException e) { - log.error("Error while reading size of binary: " + e); - return false; - } - if (size == BundleBinding.BINARY_IN_DATA_STORE) { - try { - String s = in.readUTF(); - // truncate log output - if (s.length() > 80) { - s = s.substring(80) + "..."; - } - log.debug(" global data store id: " + s); - } catch (IOException e) { - log.error("Error while reading blob id: " + e); - return false; - } - } else if (size == BundleBinding.BINARY_IN_BLOB_STORE) { - try { - String s = in.readUTF(); - log.debug(" blobid: " + s); - } catch (IOException e) { - log.error("Error while reading blob id: " + e); - return false; - } - } else { - // short values into memory - byte[] data = new byte[size]; - try { - in.readFully(data); - log.debug(" binary: " + data.length + " bytes"); - } catch (IOException e) { - log.error("Error while reading inlined binary: " + e); - return false; - } - } - break; - case PropertyType.DOUBLE: - try { - double d = in.readDouble(); - log.debug(" double: " + d); - } catch (IOException e) { - log.error("Error while reading double value: " + e); - return false; - } - break; - case PropertyType.DECIMAL: - try { - BigDecimal d = readDecimal(); - log.debug(" decimal: " + d); - } catch (IOException e) { - log.error("Error while reading decimal value: " + e); - return false; - } - break; - case PropertyType.LONG: - try { - double l = in.readLong(); - log.debug(" long: " + l); - } catch (IOException e) { - log.error("Error while reading long value: " + e); - return false; - } - break; - case PropertyType.BOOLEAN: - try { - boolean b = in.readBoolean(); - log.debug(" boolean: " + b); - } catch (IOException e) { - log.error("Error while reading boolean value: " + e); - return false; - } - break; - case PropertyType.NAME: - try { - Name name = readQName(); - log.debug(" name: " + name); - } catch (IOException e) { - log.error("Error while reading name value: " + e); - return false; - } - break; - case PropertyType.WEAKREFERENCE: - case PropertyType.REFERENCE: - try { - NodeId id = readNodeId(); - log.debug(" reference: " + id); - } catch (IOException e) { - log.error("Error while reading reference value: " + e); - return false; - } - break; - default: - // because writeUTF(String) has a size limit of 64k, - // Strings are serialized as - int len; - try { - len = in.readInt(); - log.debug(" size of string value: " + len); - } catch (IOException e) { - log.error("Error while reading size of string value: " + e); - return false; - } - try { - byte[] bytes = new byte[len]; - in.readFully(bytes); - String s = new String(bytes, "UTF-8"); - // truncate log output - if (s.length() > 80) { - s = s.substring(80) + "..."; - } - log.debug(" string: " + s); - } catch (IOException e) { - log.error("Error while reading string value: " + e); - return false; - } - } - } - return true; - } - - /** * Deserializes a node identifier * * @return the node id Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/persistence/util/BundleBindingTest.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/persistence/util/BundleBindingTest.java?rev=1004239&r1=1004238&r2=1004239&view=diff ============================================================================== --- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/persistence/util/BundleBindingTest.java (original) +++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/persistence/util/BundleBindingTest.java Mon Oct 4 13:54:47 2010 @@ -116,16 +116,12 @@ public class BundleBindingTest extends T binding.writeBundle(buffer, bundle); byte[] bytes = buffer.toByteArray(); - assertTrue(binding.checkBundle(new ByteArrayInputStream(bytes))); - assertEquals(bundle, binding.readBundle( new ByteArrayInputStream(bytes), bundle.getId())); } private void assertBundleSerialization(NodePropBundle bundle, byte[] data) throws Exception { - assertTrue(binding.checkBundle(new ByteArrayInputStream(data))); - assertEquals(bundle, binding.readBundle( new ByteArrayInputStream(data), bundle.getId())); }