예제 #1
0
  @Test
  public void testPolicies() throws ModelConversionException, FileNotFoundException, JAXBException {

    File file = getResourceFile("/samples/test_parse_windows.xml");
    eu.atos.sla.parser.data.wsag.Agreement agreementXML = readXml(file);
    IAgreement a =
        modelConverter.getAgreementFromAgreementXML(
            (eu.atos.sla.parser.data.wsag.IAgreement) agreementXML, "");

    checkPolicyExists(
        new Policy(2, new Date(120 * 1000)), a.getGuaranteeTerms().get(0).getPolicies());
    checkPolicyExists(
        new Policy(3, new Date(3600 * 1000)), a.getGuaranteeTerms().get(0).getPolicies());
  }
예제 #2
0
  @Test
  public void testCustomBusinessValue()
      throws JAXBException, FileNotFoundException, ModelConversionException {

    File file = getResourceFile("/samples/test_parse_business.xml");
    eu.atos.sla.parser.data.wsag.Agreement agreementXML = readXml(file);
    IAgreement a =
        modelConverter.getAgreementFromAgreementXML(
            (eu.atos.sla.parser.data.wsag.IAgreement) agreementXML, "");

    IPenaltyDefinition[] expected =
        new IPenaltyDefinition[] {
          new PenaltyDefinition(1, new Date(0), "discount", "%", "35", "P1D"),
          new PenaltyDefinition(5, new Date(24 * 60 * 60 * 1000), "service", "", "sms", "P1M")
        };
    for (IGuaranteeTerm gt : a.getGuaranteeTerms()) {
      int i = 0;
      for (IPenaltyDefinition actual : gt.getBusinessValueList().getPenalties()) {

        assertEquals(expected[i], actual);
        i++;
      }
    }
  }