@Test()
  public void JUDDI_712_SaveService2WithSignature() throws CertificateException {
    Assume.assumeTrue(TckPublisher.isEnabled());
    SaveBusiness sb = new SaveBusiness();
    sb.setAuthInfo(authInfoJoe);
    BusinessEntity be = new BusinessEntity();
    Name n = new Name();
    n.setValue("JUDDI_712_SaveService2WithSignature");
    be.getName().add(n);
    be.setBusinessKey(TckBusiness.JOE_BUSINESS_KEY);
    sb.getBusinessEntity().add(be);
    BusinessDetail saveBusiness = null;
    try {

      saveBusiness = publicationJoe.saveBusiness(sb);
    } catch (Exception ex) {
      logger.info("UnExpected failure: ", ex);
      Assert.fail();
    }

    SaveService ss = new SaveService();
    ss.setAuthInfo(authInfoJoe);
    BusinessService bs = new BusinessService();
    bs.setBusinessKey(TckBusiness.JOE_BUSINESS_KEY);
    bs.setServiceKey(TckBusinessService.JOE_SERVICE_KEY);
    bs.setBindingTemplates(new BindingTemplates());
    BindingTemplate bt = new BindingTemplate();
    bt.setBindingKey(null);
    bt.setServiceKey(TckBusinessService.JOE_SERVICE_KEY);
    bt.setAccessPoint(new AccessPoint("http://localhost", "wsdl"));
    bs.getBindingTemplates().getBindingTemplate().add(bt);
    bs.getName().add(new Name("Joe's bs", null));
    DigSigUtil ds = GetDigSig();
    bs = ds.signUddiEntity(bs);

    be.setBusinessServices(new BusinessServices());
    be.getBusinessServices().getBusinessService().add(bs);

    sb.getBusinessEntity().add(be);
    try {
      publicationJoe.saveService(ss);
      Assert.fail("unexpected success");
    } catch (Exception ex) {
      logger.info("Expected failure: " + ex.getMessage());
    } finally {
      DeleteBusinesses(
          saveBusiness.getBusinessEntity().get(0).getBusinessKey(), authInfoJoe, publicationJoe);
    }
  }
Esempio n. 2
0
  protected BindingTemplate parseServiceBinding(
      Class<?> classWithAnnotations,
      String lang,
      WebService webServiceAnnotation,
      Properties properties) {

    BindingTemplate bindingTemplate = null;
    UDDIServiceBinding uddiServiceBinding =
        (UDDIServiceBinding) classWithAnnotations.getAnnotation(UDDIServiceBinding.class);
    // binding
    if (uddiServiceBinding != null) {
      bindingTemplate = new BindingTemplate();

      bindingTemplate.setBindingKey(
          TokenResolver.replaceTokens(uddiServiceBinding.bindingKey(), properties));

      String bindingLang = String.valueOf(lang);
      if (uddiServiceBinding.lang() != null) {
        bindingLang = TokenResolver.replaceTokens(uddiServiceBinding.lang(), properties);
      }
      Description bindingDescription = new Description();
      bindingDescription.setLang(bindingLang);
      bindingDescription.setValue(
          TokenResolver.replaceTokens(uddiServiceBinding.description(), properties));
      bindingTemplate.getDescription().add(bindingDescription);

      AccessPoint accessPoint = new AccessPoint();
      accessPoint.setUseType(AccessPointType.WSDL_DEPLOYMENT.toString());
      if (!"".equals(uddiServiceBinding.accessPointType())) {
        accessPoint.setUseType(uddiServiceBinding.accessPointType());
      }
      if (!"".equals(uddiServiceBinding.accessPoint())) {
        String endPoint = uddiServiceBinding.accessPoint();
        endPoint = TokenResolver.replaceTokens(endPoint, properties);
        log.debug("AccessPoint EndPoint=" + endPoint);
        accessPoint.setValue(endPoint);
      } else if (webServiceAnnotation != null && webServiceAnnotation.wsdlLocation() != null) {
        accessPoint.setValue(webServiceAnnotation.wsdlLocation());
      }
      bindingTemplate.setAccessPoint(accessPoint);

      // tModelKeys on the binding
      if (!"".equals(uddiServiceBinding.tModelKeys())) {
        String[] tModelKeys = uddiServiceBinding.tModelKeys().split(",");
        for (String tModelKey : tModelKeys) {
          TModelInstanceInfo instanceInfo = new TModelInstanceInfo();
          instanceInfo.setTModelKey(tModelKey);
          if (bindingTemplate.getTModelInstanceDetails() == null) {
            bindingTemplate.setTModelInstanceDetails(new TModelInstanceDetails());
          }
          bindingTemplate.getTModelInstanceDetails().getTModelInstanceInfo().add(instanceInfo);
        }
      }
      // categoryBag on the binding
      if (!"".equals(uddiServiceBinding.categoryBag())) {
        CategoryBag categoryBag = parseCategoryBag(uddiServiceBinding.categoryBag());
        bindingTemplate.setCategoryBag(categoryBag);
      }
    } else {
      log.error("Missing UDDIServiceBinding annotation in class " + classWithAnnotations);
    }
    return bindingTemplate;
  }