当前位置: 首页>>代码示例>>Java>>正文


Java ITemplate.setUuid方法代码示例

本文整理汇总了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;
}
 
开发者ID:Atos-FiwareOps,项目名称:sla-framework,代码行数:32,代码来源:ModelConversion.java

示例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;
}
 
开发者ID:Atos-FiwareOps,项目名称:sla-framework,代码行数:8,代码来源:AgreementEnforcementTest.java

示例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;
}
 
开发者ID:SeaCloudsEU,项目名称:SeaCloudsPlatform,代码行数:32,代码来源:ModelConversion.java

示例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;
}
 
开发者ID:SeaCloudsEU,项目名称:SeaCloudsPlatform,代码行数:8,代码来源:AgreementEnforcementTest.java

示例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);
}
 
开发者ID:Atos-FiwareOps,项目名称:sla-framework,代码行数:51,代码来源:EnforcementServiceTest.java

示例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) {

	}

}
 
开发者ID:Atos-FiwareOps,项目名称:sla-framework,代码行数:67,代码来源:AgreementDAOJpaTest.java

示例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);
}
 
开发者ID:SeaCloudsEU,项目名称:SeaCloudsPlatform,代码行数:51,代码来源:EnforcementServiceTest.java

示例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) {

    }

}
 
开发者ID:SeaCloudsEU,项目名称:SeaCloudsPlatform,代码行数:67,代码来源:AgreementDAOJpaTest.java


注:本文中的eu.atos.sla.datamodel.ITemplate.setUuid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。