Examples of BusinessEntity


Examples of org.uddi.api_v3.BusinessEntity

    @Test
    public void testSignBusinessSerialAndIssuerOnly() throws CertificateException {
        System.out.println("testSignBusinessSerialAndIssuerOnly signing");
        SerialAndIssuerOnly();

        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

Examples of org.uddi.api_v3.BusinessEntity

    @Test
    public void testSignBusinessEverything() throws CertificateException {
        System.out.println("testSignBusinessEverything signing");
        Everything();

        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

Examples of org.uddi.api_v3.BusinessEntity

    public void testSignBusiness() throws CertificateException {
        Default();


        System.out.println("testSignBusiness 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);
        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

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

                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.info("Saved business with key " + businessName + "-" + i);
                        }
View Full Code Here

Examples of org.uddi.api_v3.BusinessEntity

                        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

Examples of org.uddi.api_v3.BusinessEntity

                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

Examples of org.uddi.api_v3.BusinessEntity

                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

Examples of org.uddi.api_v3.BusinessEntity

                logger.info("attempting to save business " + businessKey + " from " + businessXML);
                try {
                        SaveBusiness sb = new SaveBusiness();
                        sb.setAuthInfo(authInfo);

                        BusinessEntity beIn = (BusinessEntity) EntityCreator.buildFromDoc(businessXML, "org.uddi.api_v3");
                        if (beIn == null) {
                                throw new Exception("Unload to load source xml document from " + businessXML);
                        }
                        sb.getBusinessEntity().add(beIn);
                        BusinessDetail saveBusiness = publication.saveBusiness(sb);
                        logger.info("Business saved with key " + saveBusiness.getBusinessEntity().get(0).getBusinessKey());
                        if (serialize) {
                                JAXB.marshal(saveBusiness, System.out);
                        }

                        // 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());
                        return beOut;
                } 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
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.