{
log.info("Starting testSubscribeUnSubscribeOid()");
publishOid = "";
String oid = "SomeDummySubscribe";
SubscribeReturnQos subRet = null;
try {
SubscribeKey sk = new SubscribeKey(glob, oid);
SubscribeQos sq = new SubscribeQos(glob);
subRet = senderConnection.subscribe(sk.toXml(), sq.toXml());
log.info("testSubscribeUnSubscribeOid() subscribed to " + subRet.getSubscriptionId());
}
catch (XmlBlasterException e) {
log.severe("testSubscribeUnSubscribeOid() subscribe failed: " + e.getMessage());
fail("testSubscribeUnSubscribeOid() subscribe failed: " + e.getMessage());
}
try {
// !! Here we unsubscribe with the oid instead of using the subId !!
UnSubscribeKey uk = new UnSubscribeKey(glob, oid);
UnSubscribeQos uq = new UnSubscribeQos(glob);
UnSubscribeReturnQos[] urq = senderConnection.unSubscribe(uk.toXml(), uq.toXml());
log.info("testSubscribeUnSubscribeOid() unSubscribed");
assertEquals("Return wrong", 1, urq.length);
assertEquals("SubId wrong", subRet.getSubscriptionId(), urq[0].getSubscriptionId());
}
catch (XmlBlasterException e) {
log.severe("testSubscribeUnSubscribeOid() unSubscribe failed: " + e.getMessage());
fail("testSubscribeUnSubscribeOid() unSubscribe failed: " + e.getMessage());
}