Package org.apache.ws.scout.model.uddi.v2

Examples of org.apache.ws.scout.model.uddi.v2.BusinessEntity


  public void find() {
    try {
      UDDIClient uddiClient = new UDDIClient("META-INF/wsdl2uddi-uddi.xml");
      UDDIClerk clerk = uddiClient.getClerk("joe");
         
          BusinessEntity businessEntity = clerk.findBusiness("uddi:uddi.joepublisher.com:business-for-wsdl");
          //
          if (businessEntity!=null) {
            System.out.println("Found business with name " + businessEntity.getName().get(0).getValue());
            System.out.println("Number of services: " + businessEntity.getBusinessServices().getBusinessService().size());
           
            for (BusinessService businessService: businessEntity.getBusinessServices().getBusinessService()) {
              System.out.println("Service Name        = '" + businessService.getName().get(0).getValue() + "'");
              System.out.println("Service Key         = '" + businessService.getServiceKey() + "'");
              System.out.println("Service Description = '" + businessService.getDescription().get(0).getValue() + "'");
              System.out.println("BindingTemplates: " + businessService.getBindingTemplates().getBindingTemplate().size());
             
              for (int i=0; i<businessService.getBindingTemplates().getBindingTemplate().size(); i++) {
              BindingTemplate bindingTemplate = businessService.getBindingTemplates().getBindingTemplate().get(i);
              System.out.println("--BindingTemplate" + " " + i + ":");
              System.out.println("  bindingKey          = " + bindingTemplate.getBindingKey());
              System.out.println("  accessPoint useType = " + bindingTemplate.getAccessPoint().getUseType());
              System.out.println("  accessPoint value   = " + bindingTemplate.getAccessPoint().getValue());
              System.out.println("  description         = " + bindingTemplate.getDescription().get(0).getValue());
              }
            }
          }
             
          businessEntity.getBusinessServices();
         
          //TODO JUDDI-610
      //FindTModel findBindingTModel = WSDL2UDDI.createFindBindingTModelForPortType(portType, namespace);
     
    }
View Full Code Here


   * Register a service.
   * returns null if not successful
   */
  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);
      if (log.isDebugEnabled()) log.debug("Registering businessEntity " + businessEntity.getName().get(0).getValue() + " completed.");
    } 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()
View Full Code Here

    checkNumberOfServices(JOE_BUSINESS3_KEY,expectedNumberOfServices);
  }
  
  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

      GetBusinessDetail gb = new GetBusinessDetail();
      gb.getBusinessKey().add(businessKey);
      BusinessDetail bd;
      bd = inquiry.getBusinessDetail(gb);
      List<BusinessEntity> beOutList = bd.getBusinessEntity();
      BusinessEntity beOut = beOutList.get(0);
      if (expectedServices > 0) {
        assertEquals(expectedServices, beOut.getBusinessServices().getBusinessService().size());
      } else {
        Assert.assertNull(beOut.getBusinessServices());
      }
    } catch (RemoteException e) {
      logger.error(e.getMessage(),e);
      Assert.fail("No exception should be thrown");
    }
View Full Code Here

            try {
                GetBusinessDetail gb = new GetBusinessDetail();
                gb.getBusinessKey().add(businessKey);
                BusinessDetail bd = inquiry.getBusinessDetail(gb);
                List<BusinessEntity> beOutList = bd.getBusinessEntity();
                BusinessEntity bizEntity = beOutList.get(0);
                bizEntity.getSignature().clear();
                BusinessEntity bizEntitySigned = signJAXBObject(bizEntity);
                       
                SaveBusiness sb = new SaveBusiness();
                sb.setAuthInfo(authInfo);
                sb.getBusinessEntity().add(bizEntitySigned);
                publication.saveBusiness(sb);
View Full Code Here

            try {
                GetBusinessDetail gb = new GetBusinessDetail();
                gb.getBusinessKey().add(businessKey);
                BusinessDetail bd = inquiry.getBusinessDetail(gb);
                List<BusinessEntity> beOutList = bd.getBusinessEntity();
                BusinessEntity bizEntity = beOutList.get(0);
                       
                boolean sigOk = verifySignedJAXBObject(bizEntity);
                assertTrue("Signature invalid!", sigOk);
            } catch(Throwable e) {
                logger.error(e.getMessage(),e);
View Full Code Here

  public void saveBusiness(String authInfo, String businessXML, String businessKey, boolean serialize) {
    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);

            if (serialize) {
                JAXB.marshal(beOut, new File("target/aftersave.xml"));
            }
           
      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());
      TckValidator.checkSignatures(beIn.getSignature(), beOut.getSignature());
    } catch(Throwable e) {
      logger.error(e.getMessage(),e);
      Assert.fail("No exception should be thrown");
    }
View Full Code Here

      // 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

    @Test(expected = ValueNotAllowedException.class)
    public void BusinessKeyTooLongTest() throws DispositionReportFaultMessage, RemoteException {
        System.out.println("BusinessKeyTooLongTest");
        SaveBusiness sb = new SaveBusiness();
        sb.setAuthInfo(authInfoJoe);
        BusinessEntity be = new BusinessEntity();
        Name n = new Name();
        n.setValue("Hello Nurse");
        be.getName().add(n);
        be.setBusinessKey(strkey256_1);
        sb.getBusinessEntity().add(be);
        try {
            BusinessDetail saveBusiness = publication.saveBusiness(sb);
            DeleteBusiness db = new DeleteBusiness();
            db.setAuthInfo(authInfoJoe);
View Full Code Here

    @Test(expected = ValueNotAllowedException.class)
    public void BusinessNameTooShortTest() throws DispositionReportFaultMessage, RemoteException {
        System.out.println("BusinessNameTooShortTest");
        SaveBusiness sb = new SaveBusiness();
        sb.setAuthInfo(authInfoJoe);
        BusinessEntity be = new BusinessEntity();
        Name n = new Name();
        n.setValue("");
        be.getName().add(n);
        sb.getBusinessEntity().add(be);
        try {
            BusinessDetail saveBusiness = publication.saveBusiness(sb);
            DeleteBusiness db = new DeleteBusiness();
            db.setAuthInfo(authInfoJoe);
View Full Code Here

TOP

Related Classes of org.apache.ws.scout.model.uddi.v2.BusinessEntity

Copyright © 2018 www.massapicom. 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.