Examples of BusinessEntity


Examples of org.uddi.api_v3.BusinessEntity

      deleteBusinesses(authInfoJoe, JOE_BUSINESS_XML, JOE_BUSINESS_KEY, numberOfCopies);
    }
  
  public void saveBusinesses(String authInfo, String businessXML, String businessKey, int numberOfCopies) {
    try {     
      BusinessEntity beIn = (BusinessEntity)EntityCreator.buildFromDoc(businessXML, "org.uddi.api_v3");
      String businessName = beIn.getName().get(0).getValue();
      for (int i=0; i<numberOfCopies; i++) {
        SaveBusiness sb = new SaveBusiness();
        sb.setAuthInfo(authInfo);
        beIn.getName().get(0).setValue(businessName + "-" + i);
        beIn.setBusinessKey(businessKey + "-" + i);
        sb.getBusinessEntity().add(beIn);
        publication.saveBusiness(sb);
        logger.debug("Saved business with key " + businessName + "-" + i);
      }
     
View Full Code Here

Examples of org.uddi.api_v3.BusinessEntity

    try {
      SaveBusiness sb = new SaveBusiness();
      sb.setAuthInfo(authInfo);

     
      BusinessEntity beIn = (BusinessEntity)EntityCreator.buildFromDoc(businessXML, "org.uddi.api_v3");
      sb.getBusinessEntity().add(beIn);
      publication.saveBusiness(sb);
 
      // Now get the entity and check the values
      GetBusinessDetail gb = new GetBusinessDetail();
      gb.getBusinessKey().add(businessKey);
      BusinessDetail bd = inquiry.getBusinessDetail(gb);
      List<BusinessEntity> beOutList = bd.getBusinessEntity();
      BusinessEntity beOut = beOutList.get(0);

      assertEquals(beIn.getBusinessKey(), beOut.getBusinessKey());
     
      TckValidator.checkNames(beIn.getName(), beOut.getName());
      TckValidator.checkDescriptions(beIn.getDescription(), beOut.getDescription());
      TckValidator.checkDiscoveryUrls(beIn.getDiscoveryURLs(), beOut.getDiscoveryURLs());
      TckValidator.checkContacts(beIn.getContacts(), beOut.getContacts());
      TckValidator.checkCategories(beIn.getCategoryBag(), beOut.getCategoryBag());
     
    } catch(Throwable e) {
      logger.error(e.getMessage(),e);
      Assert.fail("No exception should be thrown");
    }
View Full Code Here

Examples of org.uddi.api_v3.BusinessEntity

      // Now get the entity and check the values
      GetBusinessDetail gb = new GetBusinessDetail();
      gb.getBusinessKey().add(businessKey);
      BusinessDetail bd = inquiry.getBusinessDetail(gb);
      List<BusinessEntity> beOutList = bd.getBusinessEntity();
      BusinessEntity beOut = beOutList.get(0);
      //We are expecting 2 services
      assertEquals(2,beOut.getBusinessServices().getBusinessService().size());
     
      //Now updating the business by adding another description
      SaveBusiness sb = new SaveBusiness();
      sb.setAuthInfo(authInfo);
      BusinessEntity beIn = beOut;
      Description desc2= new Description();
      desc2.setLang("nl");
      desc2.setValue("Omschrijving");
      beIn.getDescription().add(desc2);
      sb.getBusinessEntity().add(beIn);
      publication.saveBusiness(sb);
 
      // Now get the entity and check the values
      BusinessDetail bdnew = inquiry.getBusinessDetail(gb);
      List<BusinessEntity> beOutListNew = bdnew.getBusinessEntity();
      BusinessEntity beOutNew = beOutListNew.get(0);

      assertEquals(beIn.getBusinessKey(), beOutNew.getBusinessKey());
      // After the update we still are supposed to see two services.
      assertNotNull(beOutNew.getBusinessServices());
      assertEquals(2,beOutNew.getBusinessServices().getBusinessService().size());
     
     
    } catch(Throwable e) {
      logger.error(e.getMessage(),e);
      Assert.fail("No exception should be thrown");
View Full Code Here

Examples of org.uddi.api_v3.BusinessEntity

   * Register a service.
   *
   */
  public BusinessEntity register(BusinessEntity business, Node node) {
   
    BusinessEntity businessEntity=null;
    log.info("Registering business " + business.getName().get(0).getValue()
        + " with key " + business.getBusinessKey());
    try {
      String authToken = getAuthToken(node.getSecurityUrl());
      SaveBusiness saveBusiness = new SaveBusiness();
      saveBusiness.setAuthInfo(authToken);
      saveBusiness.getBusinessEntity().add(business);
      BusinessDetail businessDetail = getUDDINode().getTransport().getUDDIPublishService(node.getPublishUrl()).saveBusiness(saveBusiness);
      businessEntity = businessDetail.getBusinessEntity().get(0);
    } catch (Exception e) {
      log.error("Unable to register business " + business.getName().get(0).getValue()
          + " ." + e.getMessage(),e);
    } catch (Throwable t) {
      log.error("Unable to register business " + business.getName().get(0).getValue()
          + " ." + t.getMessage(),t);
    }
    log.info("Registering businessEntity " + businessEntity.getName().get(0).getValue() + " completed.");
    return businessEntity;
  }
View Full Code Here

Examples of org.uddi.api_v3.BusinessEntity

    //SERVICE LIST
    if (list.getServiceList()!=null) {
      log.info("Subscription result for ServiceList with subscription key=" + list.getSubscription().getSubscriptionKey());
      for (ServiceInfo serviceInfo : list.getServiceList().getServiceInfos().getServiceInfo() ) {
       
        BusinessEntity existingBusinessEntity = null;
        try {
          if (existingBusinessEntity==null) {
            existingBusinessEntity = uddiToClerk.findBusiness(serviceInfo.getBusinessKey(), toClerk.getNode());
          }
          if (existingBusinessEntity!=null) {
            log.debug("Found business with key " +  existingBusinessEntity.getBusinessKey() + ". No need to add it again");
          } else {
            log.info("Business was not found in the destination UDDI " + toClerk.getNode().getName()
                + ", going to add it in.");
            new XRegistration(serviceInfo.getBusinessKey(), new UDDIClerk(fromClerk), new UDDIClerk(toClerk)).xRegisterBusiness();
          }
          new XRegistration(serviceInfo.getServiceKey(), new UDDIClerk(fromClerk), new UDDIClerk(toClerk)).xRegisterServiceAndBindings();
        } catch (Exception e) {
          log.error(e.getMessage(),e)
        }
      }
    }
    //SERVICE DETAIL
    if (list.getServiceDetail()!=null) {
      log.info("Subscription result for ServiceDetail with subscription key=" + list.getSubscription().getSubscriptionKey());
      ServiceDetail serviceDetail = list.getServiceDetail();
      if (serviceDetail.isTruncated()) {
        log.info("The serviceDetail is truncated, the maxEntries must have been hit. The number of services is " + serviceDetail.getBusinessService().size());
      }
      for (BusinessService service : serviceDetail.getBusinessService()) {
        BusinessEntity existingBusinessEntity = null;
        try {
          if (existingBusinessEntity==null) {
            existingBusinessEntity = uddiToClerk.findBusiness(service.getBusinessKey(), toClerk.getNode());
          }
          if (existingBusinessEntity!=null) {
            log.debug("Found business with key " +  existingBusinessEntity.getBusinessKey() + ". No need to add it again");
          } else {
            log.info("Business was not found in the destination UDDI " + toClerk.getNode().getName()
                + ", going to add it in.");
            new XRegistration(service.getBusinessKey(), new UDDIClerk(fromClerk), new UDDIClerk(toClerk)).xRegisterBusiness();
          }
          new XRegistration(service.getServiceKey(), new UDDIClerk(fromClerk), new UDDIClerk(toClerk)).xRegisterServiceAndBindings();
        } catch (Exception e) {
          log.error(e.getMessage(),e)
        }
      }
    }
   
    //BUSINESS LIST
    if (list.getBusinessList()!=null) {
      log.info("Subscription result for BusinessList with subscription key=" + list.getSubscription().getSubscriptionKey());
      for (BusinessInfo businessInfo : list.getBusinessList().getBusinessInfos().getBusinessInfo()) {
        new XRegistration(businessInfo.getBusinessKey(), new UDDIClerk(fromClerk), new UDDIClerk(toClerk)).xRegisterBusinessAndServices();
      }
    }
   
    //BUSINESS DETAIL
    if (list.getBusinessDetail()!=null) {
      log.info("Subscription result for BusinessDetail with subscription key=" + list.getSubscription().getSubscriptionKey());
      BusinessDetail businessDetail = list.getBusinessDetail();
      if (businessDetail.isTruncated()) {
        log.info("The businessDetail is truncated, the maxEntries must have been hit. The number of businesses is " + businessDetail.getBusinessEntity().size());
      }
      for (BusinessEntity businessEntity : businessDetail.getBusinessEntity()) {
        new XRegistration(businessEntity.getBusinessKey(), new UDDIClerk(fromClerk), new UDDIClerk(toClerk)).xRegisterBusinessAndServices();
      }
    }
   
    //KEY BAG, NOT IMPLEMENTED
    if (list.getKeyBag()!=null) {
      log.info("Returning results when a 'brief' format is selected, please do not use 'brief' results when using the XRegistration functionality");
    }
   
    //BINDING DETAIL
    if (list.getBindingDetail()!=null) {
      log.info("Subscription result for BindingDetail with subscription key=" + list.getSubscription().getSubscriptionKey());
      BindingDetail bindingDetail = list.getBindingDetail();
      if (bindingDetail.isTruncated()) {
        log.info("The bindingDetail is truncated, the maxEntries must have been hit. The number of bindings is " + bindingDetail.getBindingTemplate().size());
      }
      for (BindingTemplate bindingTemplate : bindingDetail.getBindingTemplate()) {
        try {
          //check if the service exist
          BusinessService existingToService = uddiToClerk.findService(bindingTemplate.getServiceKey(), toClerk.getNode());
          if (existingToService!=null) {
            log.debug("Found service with key " +  existingToService.getServiceKey() + ". No need to add it again");
          } else {
            BusinessService fromService = uddiFromClerk.findService(bindingTemplate.getServiceKey(), fromClerk.getNode());
            fromService.getBusinessKey();
            //check if the business exist
            BusinessEntity existingBusinessEntity = uddiToClerk.findBusiness(fromService.getBusinessKey(), toClerk.getNode());
            if (existingBusinessEntity!=null) {
              log.debug("Found business with key " +  existingBusinessEntity.getBusinessKey() + ". No need to add it again");
            } else {
              log.info("Business was not found in the destination UDDI " + toClerk.getNode().getName()
                  + ", going to add it in.");
              new XRegistration(fromService.getBusinessKey(), new UDDIClerk(fromClerk), new UDDIClerk(toClerk)).xRegisterBusiness();
            }
View Full Code Here

Examples of org.uddi.api_v3.BusinessEntity

      List<BusinessInfo> biList = bInfos.getBusinessInfo();
      if (biList == null || biList.size() == 0)
        Assert.fail("No result from find business operation");
      BusinessInfo biOut = biList.get(0);
     
      BusinessEntity beIn = (BusinessEntity)EntityCreator.buildFromDoc(TckBusiness.JOE_BUSINESS_XML, "org.uddi.api_v3");
     
      assertEquals(beIn.getBusinessKey(), biOut.getBusinessKey());
     
      TckValidator.checkNames(beIn.getName(), biOut.getName());
      TckValidator.checkDescriptions(beIn.getDescription(), biOut.getDescription());
    }
    catch(Exception e) {
      logger.error(e.getMessage(), e);
      Assert.fail("No exception should be thrown.");
    }
View Full Code Here

Examples of org.uddi.api_v3.BusinessEntity

    //All contact for the business. Here only one is generated.
    Contacts contacts = new Contacts();
    contacts.getContact().add(contact);
   
    //Pass info to business entity.
    BusinessEntity businessEntity = new BusinessEntity();
    businessEntity.setDiscoveryURLs(discoveryURLs);
    businessEntity.getName().add(name);
    businessEntity.getDescription().add(description);
    businessEntity.setContacts(contacts);
       
    //Pass Entity to SaveBussiness object and publish.
    SaveBusiness saveBusiness = new SaveBusiness();
    saveBusiness.setAuthInfo(authenticationToken.getAuthInfo());
    saveBusiness.getBusinessEntity().add(businessEntity);
View Full Code Here

Examples of org.uddi.api_v3.BusinessEntity

   */
  public static BusinessEntity generateBusinessEntity(List<Name> names, List<Description> descriptions,
      Contacts contacts, DiscoveryURLs discoveryURLs, CategoryBag categoryBag, IdentifierBag identifierBag,
      List<SignatureType> signatures, BusinessServices businessServices, String businessKey)
  {
    BusinessEntity businessEntity = new BusinessEntity();
    for (Name n : names)
      businessEntity.getName().add(n);
    if (descriptions != null)
    {
      for (Description d : descriptions)
        businessEntity.getDescription().add(d);
    }
    if (contacts != null)
      businessEntity.setContacts(contacts);
    if (discoveryURLs != null)
      businessEntity.setDiscoveryURLs(discoveryURLs);
    if (categoryBag != null)
      businessEntity.setCategoryBag(categoryBag);
    if (identifierBag != null)
      businessEntity.setIdentifierBag(identifierBag);
    if (signatures != null)
      for (SignatureType st : signatures)
        businessEntity.getSignature().add(st);
    if (businessServices != null)
      businessEntity.setBusinessServices(businessServices);
    if (businessKey != null)
      businessEntity.setBusinessKey(businessKey);
   
    return businessEntity;
  }
View Full Code Here

Examples of org.uddi.api_v3.BusinessEntity

      String contactName, String contactPhone, String contactAddress,
      String contactDescription, String contactEmail, String discoveryURL,
      String categoryBag, String identifierBag, String signature, String businessServices,
      String businessKey)
  {
    BusinessEntity businessEntity = new BusinessEntity();
   
    businessEntity.getName().add(generateName(businessName));
    businessEntity.getDescription().add(generateDescription(businessDescription));
   
    Contacts contacts = new Contacts();
    contacts.getContact().add(generateContact(contactAddress, contactDescription, contactEmail,
        contactName, contactPhone, null));
    businessEntity.setContacts(contacts);
   
    DiscoveryURLs discoveryURLs = new DiscoveryURLs();
    discoveryURLs.getDiscoveryURL().add(generateDiscoveryURL(discoveryURL));
    businessEntity.setDiscoveryURLs(discoveryURLs);
   
    //businessEntity.setCategoryBag(?)
    //businessEntity.setIdentifierBag(?)
    //businessEntity.getSignature(?)
    //businessEntity.setBusinessServices(?)
View Full Code Here

Examples of org.uddi.api_v3.BusinessEntity

    @Test
    public void testSignBusinessSubjectDNOnly() throws CertificateException {

        SubjectDNOnly();
        System.out.println("testSignBusinessSubjectDNOnly signing");
        BusinessEntity be = new BusinessEntity();
        be.setBusinessKey("uddi:juddi.apache.org:testkey");
        be.setDiscoveryURLs(new DiscoveryURLs());
        be.getDiscoveryURLs().getDiscoveryURL().add(new DiscoveryURL("website", "http://localhost"));
        be.getDescription().add(new Description("a description", "en"));
        be.getName().add(new Name("My biz", "en"));

        BusinessEntity signUDDI_JAXBObject = ds.signUddiEntity(be);
        if (serialize)
        DigSigUtil.JAXB_ToStdOut(signUDDI_JAXBObject);
        Assert.assertNotSame("items are the same", be, signUDDI_JAXBObject);
        //System.out.println("verifing");
        AtomicReference<String> msg = new AtomicReference<String>();
        boolean verifySigned_UDDI_JAXB_Object = ds.verifySignedUddiEntity(signUDDI_JAXBObject, msg);
        if (verifySigned_UDDI_JAXB_Object) {
            //System.out.println("signature validation passed (expected)");
        } else {
            System.out.println("signature validation failed (not expected)");
            Assert.fail(msg.get());
        }
        validAllSignatureElementsArePresent(signUDDI_JAXBObject.getSignature());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.