Examples of BusinessService


Examples of org.uddi.api_v3.BusinessService

      // Now get the entity and check the values
      GetServiceDetail gs = new GetServiceDetail();
      gs.getServiceKey().add(serviceKey);
      ServiceDetail sd = inquiry.getServiceDetail(gs);
      List<BusinessService> bsOutList = sd.getBusinessService();
      BusinessService bsOut = bsOutList.get(0);

      assertEquals(bsIn.getServiceKey(), bsOut.getServiceKey());
     
      TckValidator.checkNames(bsIn.getName(), bsOut.getName());
      TckValidator.checkDescriptions(bsIn.getDescription(), bsOut.getDescription());
      TckValidator.checkBindingTemplates(bsIn.getBindingTemplates(), bsOut.getBindingTemplates());
      TckValidator.checkCategories(bsIn.getCategoryBag(), bsOut.getCategoryBag());
    }
    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.BusinessService

      List<ServiceInfo> siList = sInfos.getServiceInfo();
      if (siList == null || siList.size() == 0)
        Assert.fail("No result from find service operation");
      ServiceInfo siOut = siList.get(0);
     
      BusinessService bsIn = (BusinessService)EntityCreator.buildFromDoc(TckBusinessService.JOE_SERVICE_XML, "org.uddi.api_v3");
     
      assertEquals(bsIn.getServiceKey(), siOut.getServiceKey());
     
      TckValidator.checkNames(bsIn.getName(), siOut.getName());
      serviceKey = siOut.getServiceKey();
    }
    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.BusinessService

      List<ServiceInfo> siList = sInfos.getServiceInfo();
      if (siList == null || siList.size() == 0)
        Assert.fail("No result from getSubscriptionResults operation");
      ServiceInfo siOut = siList.get(0);
     
      BusinessService bsIn = (BusinessService)EntityCreator.buildFromDoc(TckBusinessService.JOE_SERVICE_XML, "org.uddi.api_v3");

      assertEquals(bsIn.getServiceKey(), siOut.getServiceKey());
     
      TckValidator.checkNames(bsIn.getName(), siOut.getName());
    }
    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.BusinessService

   * Register a service.
   *
   */
  public BusinessService register(BusinessService service, Node node) {
   
    BusinessService businessService=null;
    log.info("Registering service " + service.getName().get(0).getValue()
        + " with key " + service.getServiceKey());
    try {
      String authToken = getAuthToken(node.getSecurityUrl());
      SaveService saveService = new SaveService();
View Full Code Here

Examples of org.uddi.api_v3.BusinessService

    
     @Test
     public void testReadingServiceAnnotation() {
       try {
         AnnotationProcessor ap = new AnnotationProcessor();
         BusinessService service = ap.readServiceAnnotations(HelloWorldMockup.class.getName(),null);
         assertNotNull(service);
         assertEquals("HelloWorld",service.getName().get(0).getValue());
         assertEquals(1,service.getBindingTemplates().getBindingTemplate().size());
         assertNull(service.getCategoryBag());
       } catch (Exception e) {
         //we should not have any issues reading the annotations
           e.printStackTrace();
           Assert.fail();
       }
View Full Code Here

Examples of org.uddi.api_v3.BusinessService

       try {
         AnnotationProcessor ap = new AnnotationProcessor();
         Properties properties = new Properties();
         properties.put("serverName", "localhost");
         properties.put("serverPort", "8080");
         BusinessService service = ap.readServiceAnnotations(HelloWorldMockup2.class.getName(),properties);
         assertNotNull(service);
         assertEquals("HelloWorldMockup2",service.getName().get(0).getValue());
         assertEquals(1,service.getBindingTemplates().getBindingTemplate().size());
         BindingTemplate binding = service.getBindingTemplates().getBindingTemplate().get(0);
         String endPoint = binding.getAccessPoint().getValue();
         assertEquals("http://localhost:8080/subscription-listener/helloworld",endPoint);
         String serviceKey = binding.getServiceKey();
         assertEquals(service.getServiceKey(),serviceKey);
         assertNull(service.getCategoryBag());
       } catch (Exception e) {
         //we should not have any issues reading the annotations
           e.printStackTrace();
           Assert.fail();
       }
View Full Code Here

Examples of org.uddi.api_v3.BusinessService

 
  public Collection<BusinessService> readServiceAnnotations(String[] classesWithAnnotations, Properties properties) {
    Collection<BusinessService> services = new ArrayList<BusinessService>();
    for (String className : classesWithAnnotations) {
      try {   
        BusinessService service = readServiceAnnotations(className, properties);
        services.add(service);
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
View Full Code Here

Examples of org.uddi.api_v3.BusinessService

    return services;
  }
 
  public BusinessService readServiceAnnotations(String classWithAnnotations, Properties properties) throws ClassNotFoundException {
   
    BusinessService service = new BusinessService();
    Class<?> clazz = Loader.loadClass(classWithAnnotations);
    UDDIService uddiService= (UDDIService) clazz.getAnnotation(UDDIService.class);
    WebService webServiceAnnotation = (WebService) clazz.getAnnotation(WebService.class);
   
    if (uddiService!=null) {
      //service
      String lang = "en"; //default to english
      if (uddiService.lang()!=null) {
        lang = uddiService.lang();
      }
      Name name = new Name();
      name.setLang(lang);
      service.setBusinessKey(TokenResolver.replaceTokens(uddiService.businessKey(),properties));
      service.setServiceKey(TokenResolver.replaceTokens(uddiService.serviceKey(),properties));
      if (!"".equals(uddiService.serviceName())) {
        name.setValue(TokenResolver.replaceTokens(uddiService.serviceName(),properties));
      } else if (webServiceAnnotation!=null && !"".equals(webServiceAnnotation.serviceName())) {
        name.setValue(webServiceAnnotation.serviceName());
      } else {
        name.setValue(clazz.getSimpleName());
      }
      service.getName().add(name);
      Description description = new Description();
      description.setLang(lang);
      description.setValue(TokenResolver.replaceTokens(uddiService.description(),properties));
      service.getDescription().add(description);
     
      //categoryBag on the service
      if (!"".equals(uddiService.categoryBag())) {
        CategoryBag categoryBag = parseCategoryBag(uddiService.categoryBag());
            service.setCategoryBag(categoryBag);
      }
     
      //bindingTemplate on service
      BindingTemplate bindingTemplate = parseServiceBinding(clazz, lang, webServiceAnnotation, properties);
      if (bindingTemplate!=null) {
        bindingTemplate.setServiceKey(service.getServiceKey());
        if (service.getBindingTemplates()==null) {
          service.setBindingTemplates(new BindingTemplates());
        }
        service.getBindingTemplates().getBindingTemplate().add(bindingTemplate);
      }
     
     
    } else {
      log.error("Missing UDDIService annotation in class " + classWithAnnotations);
View Full Code Here

Examples of org.uddi.api_v3.BusinessService

         UDDIClerkManager manager = UDDIClientContainer.getUDDIClerkManager(null);
         Map<String,UDDIClerk> clerks = manager.getClientConfig().getUDDIClerks();
        AnnotationProcessor ap = new AnnotationProcessor();
        if (clerks.containsKey("default")) {
          UDDIClerk clerk = clerks.get("default");
          BusinessService service = ap.readServiceAnnotations(
              HelloWorldMockup.class.getName(), clerk.getUDDINode().getProperties());
          assertEquals("uddi:juddi.apache.org:services-helloworld",service.getServiceKey());
        } else {
         Assert.fail("Could not find expected clerk='default'");
        }
       } catch (Exception e) {
         //we should not have any issues reading the config
View Full Code Here

Examples of org.uddi.api_v3.BusinessService

        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();
            }
            log.info("Service was not found in the destination UDDI " + toClerk.getNode().getName()
                + ", going to add it in.");
            new XRegistration(fromService.getServiceKey(), new UDDIClerk(fromClerk), new UDDIClerk(toClerk)).xRegisterService();
          }
          //now the service exists in the toNode and we can add this binding
          new XRegistration(bindingTemplate.getBindingKey(), new UDDIClerk(fromClerk), new UDDIClerk(toClerk)).xRegisterServiceBinding();
        } catch (Exception e) {
          log.error(e.getMessage(),e)
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.