use of bpsim.ParameterValue in project kie-wb-common by kiegroup.
the class BaseEventPropertyReaderTest method testGetSimulationSet.
private void testGetSimulationSet(SimulationAttributeSet expectedResult, ParameterValue distributionType) {
ElementParameters parameters = mock(ElementParameters.class);
TimeParameters timeParams = mock(TimeParameters.class);
when(parameters.getTimeParameters()).thenReturn(timeParams);
Parameter processingTime = mock(Parameter.class);
when(timeParams.getProcessingTime()).thenReturn(processingTime);
EList<ParameterValue> parameterList = mock(EList.class);
when(processingTime.getParameterValue()).thenReturn(parameterList);
when(parameterList.get(0)).thenReturn(distributionType);
when(definitionResolver.resolveSimulationParameters(getCurrentEventMock().getId())).thenReturn(Optional.ofNullable(parameters));
assertEquals(expectedResult, propertyReader.getSimulationSet());
}
use of bpsim.ParameterValue in project kie-wb-common by kiegroup.
the class BaseEventPropertyReaderTest method testGetSimulationSetNormalDistribution.
@Test
public void testGetSimulationSetNormalDistribution() {
ParameterValue paramValue = mockNormalDistributionType(MEAN, STANDARD_DEVIATION);
testGetSimulationSet(new SimulationAttributeSet(0d, 0d, MEAN, "ms", STANDARD_DEVIATION, "normal"), paramValue);
}
use of bpsim.ParameterValue in project kie-wb-common by kiegroup.
the class Bpmn2JsonMarshaller method extractTimeParamsToProperties.
private void extractTimeParamsToProperties(ElementParameters eleType, Map<String, Object> properties) {
TimeParameters timeParams = eleType.getTimeParameters();
if (timeParams != null) {
Parameter processingTime = timeParams.getProcessingTime();
if (processingTime != null && processingTime.getParameterValue() != null && processingTime.getParameterValue().size() > 0) {
ParameterValue paramValue = processingTime.getParameterValue().get(0);
if (paramValue instanceof NormalDistributionType) {
NormalDistributionType ndt = (NormalDistributionType) paramValue;
properties.put(MEAN, ndt.getMean());
properties.put(STANDARDDEVIATION, ndt.getStandardDeviation());
properties.put(DISTRIBUTIONTYPE, "normal");
} else if (paramValue instanceof UniformDistributionType) {
UniformDistributionType udt = (UniformDistributionType) paramValue;
properties.put(MIN, udt.getMin());
properties.put(MAX, udt.getMax());
properties.put(DISTRIBUTIONTYPE, "uniform");
} else if (paramValue instanceof PoissonDistributionType) {
PoissonDistributionType pdt = (PoissonDistributionType) paramValue;
properties.put(MEAN, pdt.getMean());
properties.put(DISTRIBUTIONTYPE, "poisson");
}
if (timeParams.getWaitTime() != null) {
extractParamTypeToProperties(WAITTIME, timeParams.getWaitTime().getParameterValue(), properties);
}
}
}
}
use of bpsim.ParameterValue in project kie-wb-common by kiegroup.
the class BaseEventPropertyReaderTest method testGetSimulationSetPoissonDistribution.
@Test
public void testGetSimulationSetPoissonDistribution() {
ParameterValue paramValue = mockPoissonDistributionType(MEAN);
testGetSimulationSet(new SimulationAttributeSet(0d, 0d, MEAN, "ms", 0d, "poisson"), paramValue);
}
use of bpsim.ParameterValue in project kie-wb-common by kiegroup.
the class BaseEventPropertyReaderTest method testGetSimulationSetUniformDistribution.
@Test
public void testGetSimulationSetUniformDistribution() {
ParameterValue paramValue = mockUniformDistributionType(MIN, MAX);
testGetSimulationSet(new SimulationAttributeSet(MIN, MAX, 0d, "ms", 0d, "uniform"), paramValue);
}
Aggregations