"</qos>\n";
PublishQosServer publishQosServer = new PublishQosServer(glob, xml, true); // true prevents new timestamp
MsgUnit msgUnit = new MsgUnit(publishKey.getData(), "HO".getBytes(), publishQosServer.getData());
StorageId storageId = new StorageId(glob, "mystore", "someid");
MsgUnitWrapper msgUnitWrapper = new MsgUnitWrapper(glob, msgUnit, storageId);
I_EntryFactory factory = glob.getEntryFactory(); // storageId.getStrippedId()
/* MsgUnitWrapper.getOwnerCache() fails with this test as RequestBroker is unknown
msgUnitWrapper.incrementReferenceCounter(4);
assertEquals("", 4, msgUnitWrapper.getReferenceCounter());
msgUnitWrapper.incrementReferenceCounter(-4);
assertEquals("", 0, msgUnitWrapper.getReferenceCounter());
*/
int priority = msgUnitWrapper.getPriority();
long uniqueId = msgUnitWrapper.getUniqueId();
String type = msgUnitWrapper.getEmbeddedType();
boolean persistent = msgUnitWrapper.isPersistent();
long sizeInBytes = msgUnitWrapper.getSizeInBytes();
byte[] blob = factory.toBlob(msgUnitWrapper);
MsgUnitWrapper newWrapper = (MsgUnitWrapper)factory.createEntry(priority,
uniqueId, type, persistent, sizeInBytes, new ByteArrayInputStream(blob), storageId);
assertEquals("", msgUnitWrapper.getPriority(), newWrapper.getPriority());
assertEquals("", msgUnitWrapper.getReferenceCounter(), newWrapper.getReferenceCounter()); // A reference counter is reset to 0 when loaded from persistence
assertEquals("", msgUnitWrapper.isExpired(), newWrapper.isExpired());
assertEquals("", msgUnitWrapper.isPersistent(), newWrapper.isPersistent());
assertEquals("", msgUnitWrapper.getMsgUnit().getContentStr(), newWrapper.getMsgUnit().getContentStr());
assertEquals("", msgUnitWrapper.getKeyOid(), newWrapper.getKeyOid());
assertEquals("", msgUnitWrapper.getContentMime(), newWrapper.getContentMime());
assertEquals("", msgUnitWrapper.getContentMimeExtended(), newWrapper.getContentMimeExtended());
assertEquals("", msgUnitWrapper.getDomain(), newWrapper.getDomain());
assertEquals("", msgUnitWrapper.getSizeInBytes(), newWrapper.getSizeInBytes());
assertEquals("", msgUnitWrapper.getUniqueId(), newWrapper.getUniqueId());
assertEquals("", msgUnitWrapper.getLogId(), newWrapper.getLogId());
assertEquals("", msgUnitWrapper.isInternal(), newWrapper.isInternal());
assertEquals("", msgUnitWrapper.getEmbeddedType(), newWrapper.getEmbeddedType());
MsgQosData qos = newWrapper.getMsgQosData();
assertEquals("", false, qos.isVolatile());
assertEquals("", true, qos.isPersistent());
assertEquals("", true, qos.isReadonly());
assertEquals("", "Gesa", qos.getSender().getLoginName());
assertEquals("", 3, qos.getRouteNodes().length);
assertEquals("", 2, qos.getRouteNodes()[0].getStratum());
assertEquals("", 0, qos.getRouteNodes()[2].getStratum());
assertEquals("", 9408630500L, qos.getRouteNodes()[0].getTimestamp().getTimestamp());
assertEquals("", true, qos.getRouteNodes()[0].getDirtyRead());
assertEquals("", false, qos.getRouteNodes()[1].getDirtyRead());
assertEquals("", false, qos.getRouteNodes()[2].getDirtyRead());
assertEquals("", PriorityEnum.HIGH_PRIORITY.toString(), qos.getPriority().toString());
assertEquals("", timestamp.getTimestamp(), qos.getRcvTimestamp().getTimestamp());
System.out.println("SUCCESS BEFORE: " + msgUnitWrapper.toXml());
System.out.println("SUCCESS AFTER: " + newWrapper.toXml());
// The remaing life changes so we can't compare the XML strings directly:
//assertEquals("OLD="+msgUnitWrapper.getMsgQosData().toXml()+"\nNEW="+newWrapper.getMsgQosData().toXml(), msgUnitWrapper.getMsgQosData().toXml(), newWrapper.getMsgQosData().toXml());
assertEquals("", msgUnitWrapper.getMsgQosData().toXml().length(), newWrapper.getMsgQosData().toXml().length());
assertEquals("", msgUnitWrapper.getMsgKeyData().toXml(), newWrapper.getMsgKeyData().toXml());
assertTrue("Not different instances", msgUnitWrapper != newWrapper);
log.info("*** [SUCCESS]");
}