}
//register for callbacks
SubscriptionCallbackListener.registerCallback(this);
Subscription sub = new Subscription();
sub.setNotificationInterval(DatatypeFactory.newInstance().newDuration(1000));
sub.setBindingKey(start.getBindingKey());
sub.setSubscriptionFilter(new SubscriptionFilter());
sub.getSubscriptionFilter().setFindBusiness(new FindBusiness());
sub.getSubscriptionFilter().getFindBusiness().setFindQualifiers(new FindQualifiers());
sub.getSubscriptionFilter().getFindBusiness().getFindQualifiers().getFindQualifier().add(UDDIConstants.APPROXIMATE_MATCH);
sub.getSubscriptionFilter().getFindBusiness().getName().add(new Name(UDDIConstants.WILDCARD, null));
Subscription subscription = clerk.register(sub, clerk.getUDDINode().getApiNode());
if (TckCommon.isDebug()) {
PrintUDDI<Subscription> p2 = new PrintUDDI<Subscription>();
logger.info(p2.print(subscription));
}
Assert.assertNotNull(subscription);
Assert.assertNotNull(subscription.getBindingKey());
Assert.assertNotNull(subscription.getSubscriptionKey());
logger.info("Registered subscription key: " + (subscription.getSubscriptionKey()) + " bindingkey: " + subscription.getBindingKey());
//fetch the business just to verify binding registration
BusinessEntity businessDetail = clerk.getBusinessDetail("uddi:somebusiness:somebusinesskey");
Assert.assertNotNull(businessDetail);
Assert.assertNotNull(businessDetail.getBusinessKey());
Assert.assertNotNull(businessDetail.getBusinessServices());
Assert.assertNotNull(businessDetail.getBusinessServices().getBusinessService().get(0));
Assert.assertNotNull(businessDetail.getBusinessServices().getBusinessService().get(0).getBindingTemplates());
Assert.assertNotNull(businessDetail.getBusinessServices().getBusinessService().get(0).getBindingTemplates().getBindingTemplate().get(0));
if (TckCommon.isDebug()) {
PrintUDDI<BusinessEntity> p2 = new PrintUDDI<BusinessEntity>();
logger.info(p2.print(businessDetail));
}
//trigger the callback
BusinessEntity trigger = new BusinessEntity();
trigger.getName().add(new Name("somebusiness trigger SubscriptionCallbackTest1", null));
BusinessEntity triggered = clerk.register(trigger);
//wait up to 30 seconds or until we get something
long wait = TckPublisher.getSubscriptionTimeout();
while (wait > 0 && notifications == 0) {
Thread.sleep(1000);
System.out.print(".");
wait--;
}
logger.info("Callback check." + notifications);
//Thread.sleep(2000);
SubscriptionCallbackListener.stop(manager, "default", start.getBindingKey());
clerk.unRegisterSubscription(subscription.getSubscriptionKey());
clerk.unRegisterTModel(createKeyGenator.getTModelKey());
clerk.unRegisterBusiness(triggered.getBusinessKey());
clerk.unRegisterBusiness(businessDetail.getBusinessKey());
//verify