tckBusiness.saveBusinesses(authInfoJoe, TOM_BUSINESS1_XML, TOM_BUSINESS1_KEY, 1);
tckBusiness.saveBusinesses(authInfoJoe, TOM_BUSINESS2_XML, TOM_BUSINESS2_KEY, 1);
tckBusiness.saveBusinesses(authInfoJoe, TOM_BUSINESS5_XML, TOM_BUSINESS5_KEY, 1);
try {
int size = 0;
ServiceList sl = null;
FindService fs = new FindService();
//by default keys are ADD, we should only find service 5
KeyedReference keyRef1 = new KeyedReference();
keyRef1.setTModelKey(TOM_PUBLISHER_TMODEL01_KEY);
keyRef1.setKeyValue("value-z");
KeyedReference keyRef2 = new KeyedReference();
keyRef2.setTModelKey(TOM_PUBLISHER_TMODEL02_KEY);
keyRef2.setKeyValue("value-x");
CategoryBag cb = new CategoryBag();
cb.getKeyedReference().add(keyRef1);
cb.getKeyedReference().add(keyRef2);
fs.setCategoryBag(cb);
sl = inquiry.findService(fs);
if (sl.getServiceInfos() == null) {
Assert.fail("Should have found one entry on FindService with TModelBag, "
+ "found " + size);
}
size = sl.getServiceInfos().getServiceInfo().size();
if (size != 1) {
Assert.fail("Should have found one entry on FindService with TModelBag, "
+ "found " + size);
} else {
List<ServiceInfo> siList = sl.getServiceInfos().getServiceInfo();
String serviceKey = siList.get(0).getServiceKey();
if (!SERVICE_KEY5.equals(serviceKey)) {
Assert.fail("Should have found service key " + SERVICE_KEY5
+ " but found [" + serviceKey + "]");
}