UDDITransform implements ExchangeTransforms<BusinessDetail> { @Override public OrganizationListType transform(BusinessDetail bDetail) throws ExchangeTransformException { try { return buildOrganization(bDetail); } catch (Exception ex) { LOG.error("Transforming UDDI data resulted in exception: {}", ex.getLocalizedMessage(), ex); throw new ExchangeTransformException(ex); } }  @Override OrganizationListType transform(BusinessDetail bDetail);  }
@Test public void testBusinessEntity() throws ExchangeTransformException { List<OrganizationType> org = transformer.transform(bDetail).getOrganization(); verifyOrganizationsWithBusinessEntities(org); }
@Test public void testNullBusinessEnity() throws ExchangeTransformException { List<OrganizationType> org = transformer.transform(null).getOrganization(); assertNotNull(org); assertEquals("Expecting emoty organization list", 0, org.size()); }
@Test public void testEmptyBusinessEnity() throws ExchangeTransformException { List<OrganizationType> org = transformer.transform(new BusinessDetail()).getOrganization(); assertNotNull(org); assertEquals("Expecting emoty organization list", 0, org.size()); }
@Test public void testEmptyBusinessEnityWithNoService() throws ExchangeTransformException { BusinessDetail uddiDetail = new BusinessDetail(); uddiDetail.getBusinessEntity().add(bDetail.getBusinessEntity().get(1)); List<OrganizationType> org = transformer.transform(uddiDetail).getOrganization(); assertNotNull(org); assertNull(org.get(0).getEndpointList()); }
@Test public void testBusinessEnityWithNoEndpoints() throws ExchangeTransformException { BusinessDetail uddiDetail = new BusinessDetail(); uddiDetail.getBusinessEntity().add(bDetail.getBusinessEntity().get(2)); List<OrganizationType> org = transformer.transform(uddiDetail).getOrganization(); assertNotNull(org); assertNotNull(org.get(0).getEndpointList()); assertEquals("Expecting an empty EndpointList", 0, org.get(0).getEndpointList().getEndpoint().size()); }
@Test public void transformICI() throws ExchangeManagerException, ExchangeTransformException { try { InternalConnectionInfoDAOFileImpl internalDao = createInternalConnectionInfoDAO(ICI_FILE); OrganizationListType org = transformer.transform(internalDao.loadBusinessDetail()); ExchangeInfoType exInfo = new ExchangeInfoType(); exInfo.setDefaultExchange("adapter"); ExchangeListType exList = new ExchangeListType(); ExchangeType exType = new ExchangeType(); exType.setName("adapter"); exType.setType("local"); exType.setOrganizationList(org); exList.getExchange().add(exType); exInfo.setExchanges(exList); InternalExchangeInfoDAOFileImpl exDao = createInternalExchangeInfoDAO(INTERNAL_EXCHANE_FILE); exDao.saveExchangeInfo(exInfo); } catch (ConnectionManagerException | ExchangeManagerException ex) { LOG.error("Unable to save {} {}", ICI_FILE, ex.getLocalizedMessage(), ex); } }