log.info("TEST 2: The published message does match the pattern");
try {
PublishQos pubQos = new PublishQos(this.glob);
pubQos.addClientProperty("posX", 50);
pubQos.addClientProperty("posY", 150);
MsgUnit msgUnit = new MsgUnit(new PublishKey(this.glob, "MSG"), content, pubQos);
con.publish(msgUnit);
} catch(XmlBlasterException e) {
log.warning("XmlBlasterException: " + e.getMessage());
assertTrue("publish - XmlBlasterException: " + e.getMessage(), false);
}
try {
GetQos qos = new GetQos(glob);
qos.addAccessFilter(new AccessFilterQos(glob, "Sql92Filter", "1.0", filter));
MsgUnit[] msgUnits = con.get("<key oid='MSG'/>", qos.toXml());
assertTrue("Expected one returned message", msgUnits != null);
assertTrue("Expected exactly one returned message", msgUnits.length==1);
assertTrue("Message content in corrupted '" + new String(msgUnits[0].getContent()) + "' versus '" + content + "'",
msgUnits[0].getContent().length == content.length());
log.info("Success: Got one message.");
} catch(XmlBlasterException e) {
log.warning("XmlBlasterException: " + e.getMessage());
assertTrue("get - XmlBlasterException: " + e.getMessage(), false);
}
log.info("TEST 2: The published message does NOT match the pattern");
try {
PublishQos pubQos = new PublishQos(this.glob);
pubQos.addClientProperty("posX", 250);
pubQos.addClientProperty("posY", 150);
MsgUnit msgUnit = new MsgUnit(new PublishKey(this.glob, "MSG"), content, pubQos);
con.publish(msgUnit);
} catch(XmlBlasterException e) {
log.warning("XmlBlasterException: " + e.getMessage());
assertTrue("publish - XmlBlasterException: " + e.getMessage(), false);
}