@Test()
  public void JUDDI_712_SaveServiceProjectionNoServiceKey2WithSignature()
      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_SaveServiceProjectionNoServiceKey2WithSignature");
    be.getName().add(n);
    be.setBusinessKey(TckBusiness.JOE_BUSINESS_KEY);

    BusinessService bs = new BusinessService();
    bs.setBusinessKey(TckBusiness.JOE_BUSINESS_KEY);
    bs.setServiceKey(null);
    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 {
      BusinessDetail saveBusiness = publicationJoe.saveBusiness(sb);
      Assert.fail("unexpected success");
    } catch (Exception ex) {
      logger.info("Expected failure: " + ex.getMessage());
    }
  }
  @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);
    }
  }
  public void JUDDI_712_SaveBusinessNoneDefined() throws Exception {
    Assume.assumeTrue(TckPublisher.isEnabled());
    SaveBusiness sb = new SaveBusiness();
    sb.setAuthInfo(authInfoJoe);
    BusinessEntity be = new BusinessEntity();
    Name n = new Name();
    n.setValue("JUDDI_712_SaveServiceWithSignature");
    be.getName().add(n);
    be.setBusinessKey(TckBusiness.JOE_BUSINESS_KEY);

    try {
      BusinessDetail saveBusiness = publicationJoe.saveBusiness(sb);
      Assert.fail("unexpected success");
    } catch (Exception ex) {
      logger.info("Expected failure: " + ex.getMessage());
      throw ex;
    }
  }
 @Test()
 public void JUDDI_712_SaveBusinessProjectionWithSignature() throws CertificateException {
   Assume.assumeTrue(TckPublisher.isEnabled());
   SaveBusiness sb = new SaveBusiness();
   sb.setAuthInfo(authInfoJoe);
   BusinessEntity be = new BusinessEntity();
   Name n = new Name();
   n.setValue("JUDDI_JUDDI_712_SaveBusinessProjectionWithSignature");
   be.getName().add(n);
   DigSigUtil ds = GetDigSig();
   be = ds.signUddiEntity(be);
   sb.getBusinessEntity().add(be);
   try {
     BusinessDetail saveBusiness = publicationJoe.saveBusiness(sb);
     Assert.fail("unexpected success");
   } catch (Exception ex) {
     logger.info("Expected failure: " + ex.getMessage());
   }
 }
  // JUDDI-716
  @Test()
  public void JUDDI_716_SaveBusinessAllOptions() throws CertificateException {
    Assume.assumeTrue(TckPublisher.isEnabled());
    SaveBusiness sb = new SaveBusiness();
    sb.setAuthInfo(authInfoJoe);
    BusinessEntity be = new BusinessEntity();
    be.setBusinessKey(TckBusiness.JOE_BUSINESS_KEY);

    Name n = new Name();
    n.setValue("JUDDI_716_SaveBusinessAllOptions");
    be.getName().add(n);
    DigSigUtil ds = GetDigSig();
    ds.put(DigSigUtil.SIGNATURE_OPTION_CERT_INCLUSION_SERIAL, "true");
    ds.put(DigSigUtil.SIGNATURE_OPTION_CERT_INCLUSION_SUBJECTDN, "true");
    be = ds.signUddiEntity(be);
    sb.getBusinessEntity().add(be);
    BusinessDetail saveBusiness = null;
    try {
      saveBusiness = publicationJoe.saveBusiness(sb);
      GetBusinessDetail gsb = new GetBusinessDetail();
      gsb.setAuthInfo(authInfoJoe);
      gsb.getBusinessKey().add(saveBusiness.getBusinessEntity().get(0).getBusinessKey());
      BusinessDetail businessDetail = inquiryJoe.getBusinessDetail(gsb);
      PrintUDDI<BusinessEntity> printer = new PrintUDDI<BusinessEntity>();
      if (TckCommon.isDebug())
        System.out.println(printer.print(businessDetail.getBusinessEntity().get(0)));
      AtomicReference<String> msg = new AtomicReference<String>();
      boolean b = ds.verifySignedUddiEntity(businessDetail.getBusinessEntity().get(0), msg);
      Assert.assertTrue(msg.get(), b);
      Assert.assertTrue(msg.get() == null || msg.get().length() == 0);

    } catch (Exception ex) {
      logger.error("unExpected failure: ", ex);
      Assert.fail("unexpected failure");
    } finally {
      DeleteBusinesses(
          saveBusiness.getBusinessEntity().get(0).getBusinessKey(), authInfoJoe, publicationJoe);
    }
  }