本文整理汇总了Java中eu.atos.sla.datamodel.ITemplate.setUuid方法的典型用法代码示例。如果您正苦于以下问题:Java ITemplate.setUuid方法的具体用法?Java ITemplate.setUuid怎么用?Java ITemplate.setUuid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eu.atos.sla.datamodel.ITemplate
的用法示例。
在下文中一共展示了ITemplate.setUuid方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTemplateFromTemplateXML
import eu.atos.sla.datamodel.ITemplate; //导入方法依赖的package包/类
@Override
public ITemplate getTemplateFromTemplateXML(eu.atos.sla.parser.data.wsag.Template templateXML, String payload) throws ModelConversionException{
ITemplate template = new Template();
if (templateXML.getTemplateId() != null) {
logger.debug("TemplateId at header will be used:{}", templateXML.getTemplateId());
template.setUuid(templateXML.getTemplateId());
} else {
// uuid
if (templateXML.getContext().getTemplateId() != null) {
logger.debug("TemplateId in context will be used:{}", templateXML.getTemplateId());
template.setUuid(templateXML.getContext().getTemplateId());
}else{
String templateId = UUID.randomUUID().toString();
template.setUuid(templateId);
}
}
if (templateXML.getContext().getService()!=null){
template.setServiceId(templateXML.getContext().getService());
}else{
logger.error("Service is null, field must be informed");
throw new ModelConversionException("Service is null, field must be informed");
}
// Text
template.setText(payload);
// Name
template.setName(templateXML.getName());
template.setProvider(getProviderFromTemplate(templateXML));
return template;
}
示例2: newTemplate
import eu.atos.sla.datamodel.ITemplate; //导入方法依赖的package包/类
private ITemplate newTemplate(IProvider provider) {
ITemplate template = new Template();
template.setUuid("templateId");
template.setText("");
template.setProvider(provider);
return template;
}
示例3: getTemplateFromTemplateXML
import eu.atos.sla.datamodel.ITemplate; //导入方法依赖的package包/类
@Override
public ITemplate getTemplateFromTemplateXML(eu.atos.sla.parser.data.wsag.Template templateXML, String payload) throws ModelConversionException{
ITemplate template = new Template();
if (templateXML.getTemplateId() != null) {
logger.debug("TemplateId at header will be used:{}", templateXML.getTemplateId());
template.setUuid(templateXML.getTemplateId());
} else {
// uuid
if (templateXML.getContext().getTemplateId() != null) {
logger.debug("TemplateId in context will be used:{}", templateXML.getTemplateId());
template.setUuid(templateXML.getContext().getTemplateId());
}else{
String templateId = UUID.randomUUID().toString();
template.setUuid(templateId);
}
}
if (templateXML.getContext().getService()!=null){
template.setServiceId(templateXML.getContext().getService());
}else{
logger.error("Service is null, field must be informed");
throw new ModelConversionException("Service is null, field must be informed");
}
// Text
template.setText(payload);
// Name
template.setName(templateXML.getName());
template.setProvider(getProviderFromTemplate(templateXML));
return template;
}
示例4: newTemplate
import eu.atos.sla.datamodel.ITemplate; //导入方法依赖的package包/类
private ITemplate newTemplate(IProvider provider) {
ITemplate template = new Template();
template.setUuid("templateId");
template.setText("");
template.setProvider(provider);
return template;
}
示例5: testEnforceReceivedMetrics
import eu.atos.sla.datamodel.ITemplate; //导入方法依赖的package包/类
@Test
@Transactional
public void testEnforceReceivedMetrics() throws Exception {
String kpiName = "responsetime";
/*
* create provider
*/
IProvider provider = new Provider(null, "provider-test", "provider-test");
providerDao.save(provider);
ITemplate template = new Template();
template.setUuid(UUID.randomUUID().toString());
template.setText("");
provider.addTemplate(template);
template.setProvider(provider);
templateDao.save(template);
/* create agreement */
IGuaranteeTerm term = TestAgreementFactory.newGuaranteeTerm(kpiName, kpiName + " LT 100");
IAgreement agreement = TestAgreementFactory.newAgreement(
UUID.randomUUID().toString(),
provider,
"consumer",
Arrays.asList(
term,
TestAgreementFactory.newGuaranteeTerm("performance", "performance GT 0.9")
)
);
agreement.setTemplate(template);
agreementDao.save(agreement);
/* create ejob */
IEnforcementJob job = new EnforcementJob();
job.setAgreement(agreement);
service.createEnforcementJob(job);
List<IMonitoringMetric> metrics = Arrays.asList(
(IMonitoringMetric) new MonitoringMetric(kpiName, 99, new Date()),
(IMonitoringMetric) new MonitoringMetric(kpiName, 100, new Date())
);
Map<IGuaranteeTerm, List<IMonitoringMetric>> metricsMap =
new HashMap<IGuaranteeTerm, List<IMonitoringMetric>>();
metricsMap.put(term, metrics);
service.doEnforcement(agreement, metricsMap);
}
示例6: save
import eu.atos.sla.datamodel.ITemplate; //导入方法依赖的package包/类
@Test
public void save() {
StringBuilder agreementText = new StringBuilder();
String agreementId = UUID.randomUUID().toString();
agreementText
.append("<Agreement xmlns=\"http://www.ggf.org/namespaces/ws-agreement\" AgreementId=\""
+ agreementId + "\">\n");
agreementText.append(" <Name>ExampleAgreement</name>\n");
agreementText.append(" <Context>\n");
agreementText
.append(" <AggreementInitiator>RandomClient</AgreementInitiator>\n");
agreementText
.append(" <AgreementResponder>Provider01</AgreementResponder>\n");
agreementText
.append(" <ServiceProvider>AgreementResponder</ServiceProvider>\n");
agreementText
.append(" <ExpirationTime>2014-03-07-1200</ExpirationTime>\n");
agreementText
.append(" <TemplateId>contract-template-2007-12-04</<TemplateId>>\n");
agreementText.append(" </Context>\n");
agreementText.append("</Agreement>\n");
eu.atos.sla.datamodel.IAgreement.AgreementStatus status = eu.atos.sla.datamodel.IAgreement.AgreementStatus.PENDING;
String templateUuid = UUID.randomUUID().toString();
ITemplate template = new Template();
template.setText("Template name 1");
template.setUuid(templateUuid);
// Guarantee terms
IGuaranteeTerm guaranteeTerm = new GuaranteeTerm();
guaranteeTerm.setName("guarantee term name");
guaranteeTerm.setServiceName("service Name");
List<IGuaranteeTerm> guaranteeTerms = new ArrayList<IGuaranteeTerm>();
guaranteeTerms.add(guaranteeTerm);
IAgreement agreement = new Agreement();
agreement.setAgreementId(agreementId);
agreement.setConsumer("Consumer2");
agreement.setProvider(new Provider(null, UUID.randomUUID().toString(),
"Provider2"));
agreement.setStatus(status);
agreement.setTemplate(template);
agreement.setText(agreementText.toString());
agreement.setGuaranteeTerms(guaranteeTerms);
IViolation violation = new Violation();
violation.setContractUuid(agreementId);
violation.setActualValue("8.0");
violation.setExpectedValue("5.0");
@SuppressWarnings("unused")
IAgreement agreementSaved = new Agreement();
try {
agreementSaved = agreementDAO.save(agreement);
} catch (Exception e) {
}
}
示例7: testEnforceReceivedMetrics
import eu.atos.sla.datamodel.ITemplate; //导入方法依赖的package包/类
@Test
@Transactional
public void testEnforceReceivedMetrics() throws Exception {
String kpiName = "responsetime";
/*
* create provider
*/
IProvider provider = new Provider(null, "provider-test", "provider-test");
providerDao.save(provider);
ITemplate template = new Template();
template.setUuid(UUID.randomUUID().toString());
template.setText("");
provider.addTemplate(template);
template.setProvider(provider);
templateDao.save(template);
/* create agreement */
IGuaranteeTerm term = TestAgreementFactory.newGuaranteeTerm(kpiName, kpiName + " LT 100");
IAgreement agreement = TestAgreementFactory.newAgreement(
UUID.randomUUID().toString(),
provider,
"consumer",
Arrays.asList(
term,
TestAgreementFactory.newGuaranteeTerm("performance", "performance GT 0.9")
)
);
agreement.setTemplate(template);
agreementDao.save(agreement);
/* create ejob */
IEnforcementJob job = new EnforcementJob();
job.setAgreement(agreement);
service.createEnforcementJob(job);
List<IMonitoringMetric> metrics = Arrays.asList(
(IMonitoringMetric) new MonitoringMetric(kpiName, 99, new Date()),
(IMonitoringMetric) new MonitoringMetric(kpiName, 100, new Date())
);
Map<IGuaranteeTerm, List<IMonitoringMetric>> metricsMap =
new HashMap<IGuaranteeTerm, List<IMonitoringMetric>>();
metricsMap.put(term, metrics);
service.doEnforcement(agreement, metricsMap);
}
示例8: save
import eu.atos.sla.datamodel.ITemplate; //导入方法依赖的package包/类
@Test
public void save() {
StringBuilder agreementText = new StringBuilder();
String agreementId = UUID.randomUUID().toString();
agreementText
.append("<Agreement xmlns=\"http://www.ggf.org/namespaces/ws-agreement\" AgreementId=\""
+ agreementId + "\">\n");
agreementText.append(" <Name>ExampleAgreement</name>\n");
agreementText.append(" <Context>\n");
agreementText
.append(" <AggreementInitiator>RandomClient</AgreementInitiator>\n");
agreementText
.append(" <AgreementResponder>Provider01</AgreementResponder>\n");
agreementText
.append(" <ServiceProvider>AgreementResponder</ServiceProvider>\n");
agreementText
.append(" <ExpirationTime>2014-03-07-1200</ExpirationTime>\n");
agreementText
.append(" <TemplateId>contract-template-2007-12-04</<TemplateId>>\n");
agreementText.append(" </Context>\n");
agreementText.append("</Agreement>\n");
eu.atos.sla.datamodel.IAgreement.AgreementStatus status = eu.atos.sla.datamodel.IAgreement.AgreementStatus.PENDING;
String templateUuid = UUID.randomUUID().toString();
ITemplate template = new Template();
template.setText("Template name 1");
template.setUuid(templateUuid);
// Guarantee terms
IGuaranteeTerm guaranteeTerm = new GuaranteeTerm();
guaranteeTerm.setName("guarantee term name");
guaranteeTerm.setServiceName("service Name");
List<IGuaranteeTerm> guaranteeTerms = new ArrayList<IGuaranteeTerm>();
guaranteeTerms.add(guaranteeTerm);
IAgreement agreement = new Agreement();
agreement.setAgreementId(agreementId);
agreement.setConsumer("Consumer2");
agreement.setProvider(new Provider(null, UUID.randomUUID().toString(),
"Provider2"));
agreement.setStatus(status);
agreement.setTemplate(template);
agreement.setText(agreementText.toString());
agreement.setGuaranteeTerms(guaranteeTerms);
IViolation violation = new Violation();
violation.setContractUuid(agreementId);
violation.setActualValue("8.0");
violation.setExpectedValue("5.0");
@SuppressWarnings("unused")
IAgreement agreementSaved = new Agreement();
try {
agreementSaved = agreementDAO.save(agreement);
} catch (Exception e) {
}
}