@Test public void totalConversionWithNA1300() throws Exception { setupFakeProviderRegistry(); OvfDefinition ovfDefinition = OVFUtils.getOvfDefinition(na1300OvfString); SLATemplate slaTemplate = SLATemplateCreator.generateSLATemplate(ovfDefinition, "http: SLASOITemplateRenderer slasoiTemplateRenderer = new SLASOITemplateRenderer(); SLATemplateDocument slaTemplateRendered = SLATemplateDocument.Factory.parse(slasoiTemplateRenderer.renderSLATemplate(slaTemplate)); String slaTemplateString = slaTemplateRendered.toString(); System.out.println("SLA rendered as XML: ############################## "); System.out.println("SLA rendered as XML: ############################## "); System.out.println("SLA rendered as XML: ############################## "); System.out.println("SLA rendered as XML: ############################## "); System.out.println(slaTemplateString); eu.ascetic.paas.applicationmanager.slam.sla.model.SLATemplate slat = null; try { JAXBContext jaxbContext = JAXBContext.newInstance(eu.ascetic.paas.applicationmanager.slam.sla.model.SLATemplate.class); Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); slat = (eu.ascetic.paas.applicationmanager.slam.sla.model.SLATemplate) jaxbUnmarshaller.unmarshal(new StringReader(slaTemplateString)); } catch(JAXBException jaxbExpcetion) { jaxbExpcetion.printStackTrace(); } assertEquals("Aggregated Guarantees", slat.getAgreemenTerms().get(2).getId()); assertEquals("anticipatedWorkload_for_NA-Server", slat.getAgreemenTerms().get(2).getGuaranteed().getState().getId()); assertEquals("http: slat.getAgreemenTerms().get(2).getGuaranteed().getState().getConstraint().getTypeConstraintExpr().getValue().getFuncExpr().getOperator()); assertEquals(OVFToSLANames.COMPARATORS.get("LTE"), slat.getAgreemenTerms().get(2).getGuaranteed().getState().getConstraint().getTypeConstraintExpr().getDomain().getSimpleDomainExpr().getComparisonOp()); assertEquals("0.0", slat.getAgreemenTerms().get(2).getGuaranteed().getState().getConstraint().getTypeConstraintExpr().getDomain().getSimpleDomainExpr().getValue().getConstVariable().getValue()); assertEquals(OVFToSLANames.METRIC_UNITS.get("decimal"), slat.getAgreemenTerms().get(2).getGuaranteed().getState().getConstraint().getTypeConstraintExpr().getDomain().getSimpleDomainExpr().getValue().getConstVariable().getDatatype()); }
public static SLATemplate generateSLATemplate(OvfDefinition ovf, String ovfURL, SLAApplicationTerms appTerms) { SLATemplate slaTemplate = new SLATemplate(); UUID uuid = new UUID("ASCETiC-SLaTemplate-Example-01"); slaTemplate.setUuid(uuid); addProperties(slaTemplate); addProviderEndPointToTemplate(slaTemplate); addUserEndPointToTemplate(slaTemplate); addInterfaceDclr(slaTemplate, ovf, ovfURL); addAppAgreementTerm(slaTemplate, ovf, APP_ENERGY_CONSUMPTION_OVF, APP_ENERGY_CONSUMPTION_SLA_OPERATOR, APP_ENERGY_CONSUMPTION_SLA, appTerms); addAppAgreementTerm(slaTemplate, ovf, APP_POWER_CONSUMPTION_OVF, APP_POWER_CONSUMPTION_SLA_OPERATOR, APP_POWER_CONSUMPTION_SLA, appTerms); addAppAgreementTerm(slaTemplate, ovf, APP_PRICE_PER_HOUR_OVF, APP_PRICE_PER_HOUR_SLA_OPERATOR, APP_PRICE_PER_HOUR_SLA, appTerms); addVMSpecificAgreementTerms(slaTemplate, ovf); AgreementTerm[] agreementTerms = slaTemplate.getAgreementTerms(); if(agreementTerms == null || agreementTerms.length == 0) { addSimpleAgreementTermForApp(slaTemplate, ovf); } return slaTemplate; }
SLATemplateCreator { public static SLATemplate generateSLATemplate(OvfDefinition ovf, String ovfURL, SLAApplicationTerms appTerms) { SLATemplate slaTemplate = new SLATemplate(); UUID uuid = new UUID("ASCETiC-SLaTemplate-Example-01"); slaTemplate.setUuid(uuid); addProperties(slaTemplate); addProviderEndPointToTemplate(slaTemplate); addUserEndPointToTemplate(slaTemplate); addInterfaceDclr(slaTemplate, ovf, ovfURL); addAppAgreementTerm(slaTemplate, ovf, APP_ENERGY_CONSUMPTION_OVF, APP_ENERGY_CONSUMPTION_SLA_OPERATOR, APP_ENERGY_CONSUMPTION_SLA, appTerms); addAppAgreementTerm(slaTemplate, ovf, APP_POWER_CONSUMPTION_OVF, APP_POWER_CONSUMPTION_SLA_OPERATOR, APP_POWER_CONSUMPTION_SLA, appTerms); addAppAgreementTerm(slaTemplate, ovf, APP_PRICE_PER_HOUR_OVF, APP_PRICE_PER_HOUR_SLA_OPERATOR, APP_PRICE_PER_HOUR_SLA, appTerms); addVMSpecificAgreementTerms(slaTemplate, ovf); AgreementTerm[] agreementTerms = slaTemplate.getAgreementTerms(); if(agreementTerms == null || agreementTerms.length == 0) { addSimpleAgreementTermForApp(slaTemplate, ovf); } return slaTemplate; } }
SLATemplateCreator { public static SLATemplate generateSLATemplate(OvfDefinition ovf, String ovfURL, SLAApplicationTerms appTerms) { SLATemplate slaTemplate = new SLATemplate(); UUID uuid = new UUID("ASCETiC-SLaTemplate-Example-01"); slaTemplate.setUuid(uuid); addProperties(slaTemplate); addProviderEndPointToTemplate(slaTemplate); addUserEndPointToTemplate(slaTemplate); addInterfaceDclr(slaTemplate, ovf, ovfURL); addAppAgreementTerm(slaTemplate, ovf, APP_ENERGY_CONSUMPTION_OVF, APP_ENERGY_CONSUMPTION_SLA_OPERATOR, APP_ENERGY_CONSUMPTION_SLA, appTerms); addAppAgreementTerm(slaTemplate, ovf, APP_POWER_CONSUMPTION_OVF, APP_POWER_CONSUMPTION_SLA_OPERATOR, APP_POWER_CONSUMPTION_SLA, appTerms); addAppAgreementTerm(slaTemplate, ovf, APP_PRICE_PER_HOUR_OVF, APP_PRICE_PER_HOUR_SLA_OPERATOR, APP_PRICE_PER_HOUR_SLA, appTerms); addVMSpecificAgreementTerms(slaTemplate, ovf); AgreementTerm[] agreementTerms = slaTemplate.getAgreementTerms(); if(agreementTerms == null || agreementTerms.length == 0) { addSimpleAgreementTermForApp(slaTemplate, ovf); } return slaTemplate; }  }
SLATemplateCreator { public static SLATemplate generateSLATemplate(OvfDefinition ovf, String ovfURL, SLAApplicationTerms appTerms) { SLATemplate slaTemplate = new SLATemplate(); UUID uuid = new UUID("ASCETiC-SLaTemplate-Example-01"); slaTemplate.setUuid(uuid); addProperties(slaTemplate); addProviderEndPointToTemplate(slaTemplate); addUserEndPointToTemplate(slaTemplate); addInterfaceDclr(slaTemplate, ovf, ovfURL); addAppAgreementTerm(slaTemplate, ovf, APP_ENERGY_CONSUMPTION_OVF, APP_ENERGY_CONSUMPTION_SLA_OPERATOR, APP_ENERGY_CONSUMPTION_SLA, appTerms); addAppAgreementTerm(slaTemplate, ovf, APP_POWER_CONSUMPTION_OVF, APP_POWER_CONSUMPTION_SLA_OPERATOR, APP_POWER_CONSUMPTION_SLA, appTerms); addAppAgreementTerm(slaTemplate, ovf, APP_PRICE_PER_HOUR_OVF, APP_PRICE_PER_HOUR_SLA_OPERATOR, APP_PRICE_PER_HOUR_SLA, appTerms); addVMSpecificAgreementTerms(slaTemplate, ovf); AgreementTerm[] agreementTerms = slaTemplate.getAgreementTerms(); if(agreementTerms == null || agreementTerms.length == 0) { addSimpleAgreementTermForApp(slaTemplate, ovf); } return slaTemplate; }  static SLATemplate generateSLATemplate(OvfDefinition ovf, String ovfURL, SLAApplicationTerms appTerms); }
SLATemplateCreator { public static SLATemplate generateSLATemplate(OvfDefinition ovf, String ovfURL, SLAApplicationTerms appTerms) { SLATemplate slaTemplate = new SLATemplate(); UUID uuid = new UUID("ASCETiC-SLaTemplate-Example-01"); slaTemplate.setUuid(uuid); addProperties(slaTemplate); addProviderEndPointToTemplate(slaTemplate); addUserEndPointToTemplate(slaTemplate); addInterfaceDclr(slaTemplate, ovf, ovfURL); addAppAgreementTerm(slaTemplate, ovf, APP_ENERGY_CONSUMPTION_OVF, APP_ENERGY_CONSUMPTION_SLA_OPERATOR, APP_ENERGY_CONSUMPTION_SLA, appTerms); addAppAgreementTerm(slaTemplate, ovf, APP_POWER_CONSUMPTION_OVF, APP_POWER_CONSUMPTION_SLA_OPERATOR, APP_POWER_CONSUMPTION_SLA, appTerms); addAppAgreementTerm(slaTemplate, ovf, APP_PRICE_PER_HOUR_OVF, APP_PRICE_PER_HOUR_SLA_OPERATOR, APP_PRICE_PER_HOUR_SLA, appTerms); addVMSpecificAgreementTerms(slaTemplate, ovf); AgreementTerm[] agreementTerms = slaTemplate.getAgreementTerms(); if(agreementTerms == null || agreementTerms.length == 0) { addSimpleAgreementTermForApp(slaTemplate, ovf); } return slaTemplate; }  static SLATemplate generateSLATemplate(OvfDefinition ovf, String ovfURL, SLAApplicationTerms appTerms);  }