String type = "Implements";
Key savekey = null;
Key assockey = null;
BusinessQueryManager bqm2 = null;
BusinessLifeCycleManager blm2 = null;
Collection associationKeys = null;
Collection sourceKeys = null;
Collection targetKeys = null;
String targetId = null;
String sourceId = null;
String orgTarget = "Target Organization";
try
{
login();
getJAXREssentials();
// Authenticate second user
Connection con2 = loginSecondUser();
RegistryService rs2 = con2.getRegistryService();
blm2 = rs2.getBusinessLifeCycleManager();
bqm2 = rs2.getBusinessQueryManager();
Organization source = blm.createOrganization(blm.createInternationalString(orgSource));
Organization target = blm2.createOrganization(blm.createInternationalString(orgTarget));
// publish the source organization
Collection orgs = new ArrayList();
orgs.add(source);
br = blm.saveOrganizations(orgs);
if (br.getExceptions() != null)
{
fail(" Source:Save Orgs failed");
}
sourceKeys = br.getCollection();
Iterator iter = sourceKeys.iterator();
while (iter.hasNext())
{
savekey = (Key)iter.next();
}
sourceId = savekey.getId();
String objectType = LifeCycleManager.ORGANIZATION;
Organization pubSource = (Organization)bqm.getRegistryObject(sourceId, objectType);
assertNotNull(pubSource.getName().getValue());
// publish the target
orgs.clear();
orgs.add(target);
br = blm2.saveOrganizations(orgs);
if (br.getExceptions() != null)
{
fail(" Target:Save Orgs failed");
}
targetKeys = br.getCollection();
iter = targetKeys.iterator();
while (iter.hasNext())
{
savekey = (Key)iter.next();
}
targetId = savekey.getId();
Organization pubTarget = (Organization)bqm2.getRegistryObject(targetId, objectType);
Concept associationType = getAssociationConcept(type);
if (associationType == null)
fail(" getAssociationConcept returned null associationType");