}
}
@Test
public void testFindVAppTemplate() throws Exception {
Org org = getVCloudApi().getOrgClient().findOrgNamed(null);
for (ReferenceType cat : org.getCatalogs().values()) {
Catalog response = getVCloudApi().getCatalogClient().getCatalog(cat.getHref());
for (ReferenceType resource : response.values()) {
if (resource.getType().equals(VCloudMediaType.CATALOGITEM_XML)) {
CatalogItem item = getVCloudApi().getCatalogClient().getCatalogItem(resource.getHref());
if (item.getEntity().getType().equals(VCloudMediaType.VAPPTEMPLATE_XML)) {
VAppTemplate template = getVCloudApi().getVAppTemplateClient().findVAppTemplateInOrgCatalogNamed(
org.getName(), response.getName(), item.getEntity().getName());
if (template != null) {
// the UUID in the href is the only way to actually link templates
assertEquals(template.getHref(), item.getEntity().getHref());
} else {
// null can be no longer available or auth exception