}
}
@Test
public void testFindVAppTemplate() throws Exception {
Org org = getVCloudApi().getOrgApi().findOrgNamed(null);
for (ReferenceType cat : org.getCatalogs().values()) {
Catalog response = getVCloudApi().getCatalogApi().getCatalog(cat.getHref());
for (ReferenceType resource : response.values()) {
if (resource.getType().equals(VCloudMediaType.CATALOGITEM_XML)) {
CatalogItem item = getVCloudApi().getCatalogApi().getCatalogItem(resource.getHref());
if (item.getEntity().getType().equals(VCloudMediaType.VAPPTEMPLATE_XML)) {
VAppTemplate template = getVCloudApi().getVAppTemplateApi().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