use of org.camunda.bpm.model.bpmn.instance.camunda.CamundaInputParameter in project camunda-bpmn-model by camunda.
the class CamundaExtensionsTest method testCamundaMapInputParameter.
@Test
public void testCamundaMapInputParameter() {
CamundaInputParameter inputParameter = findInputParameterByName(serviceTask, "shouldBeMap");
assertThat(inputParameter.getCamundaName()).isEqualTo("shouldBeMap");
assertThat(inputParameter.getTextContent()).isNotEmpty();
assertThat(inputParameter.getUniqueChildElementByNameNs(CAMUNDA_NS, "map")).isNotNull();
CamundaMap map = inputParameter.getValue();
assertThat(map.getCamundaEntries()).hasSize(2);
for (CamundaEntry entry : map.getCamundaEntries()) {
if (entry.getCamundaKey().equals("foo")) {
assertThat(entry.getTextContent()).isEqualTo("bar");
} else {
assertThat(entry.getCamundaKey()).isEqualTo("hello");
assertThat(entry.getTextContent()).isEqualTo("world");
}
}
map = modelInstance.newInstance(CamundaMap.class);
CamundaEntry entry = modelInstance.newInstance(CamundaEntry.class);
entry.setCamundaKey("test");
entry.setTextContent("value");
map.getCamundaEntries().add(entry);
inputParameter.setValue(map);
map = inputParameter.getValue();
assertThat(map.getCamundaEntries()).hasSize(1);
entry = map.getCamundaEntries().iterator().next();
assertThat(entry.getCamundaKey()).isEqualTo("test");
assertThat(entry.getTextContent()).isEqualTo("value");
Collection<CamundaEntry> entries = map.getCamundaEntries();
entries.add(modelInstance.newInstance(CamundaEntry.class));
assertThat(entries).hasSize(2);
inputParameter.removeValue();
assertThat(inputParameter.getValue()).isNull();
}
use of org.camunda.bpm.model.bpmn.instance.camunda.CamundaInputParameter in project camunda-bpmn-model by camunda.
the class AbstractEventBuilder method camundaInputParameter.
/**
* Creates a new camunda input parameter extension element with the
* given name and value.
*
* @param name the name of the input parameter
* @param value the value of the input parameter
* @return the builder object
*/
public B camundaInputParameter(String name, String value) {
CamundaInputOutput camundaInputOutput = getCreateSingleExtensionElement(CamundaInputOutput.class);
CamundaInputParameter camundaInputParameter = createChild(camundaInputOutput, CamundaInputParameter.class);
camundaInputParameter.setCamundaName(name);
camundaInputParameter.setTextContent(value);
return myself;
}
use of org.camunda.bpm.model.bpmn.instance.camunda.CamundaInputParameter in project camunda-bpmn-model by camunda.
the class CamundaInputParameterImpl method registerType.
public static void registerType(ModelBuilder modelBuilder) {
ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(CamundaInputParameter.class, CAMUNDA_ELEMENT_INPUT_PARAMETER).namespaceUri(CAMUNDA_NS).instanceProvider(new ModelTypeInstanceProvider<CamundaInputParameter>() {
public CamundaInputParameter newInstance(ModelTypeInstanceContext instanceContext) {
return new CamundaInputParameterImpl(instanceContext);
}
});
camundaNameAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_NAME).namespace(CAMUNDA_NS).required().build();
typeBuilder.build();
}
use of org.camunda.bpm.model.bpmn.instance.camunda.CamundaInputParameter in project camunda-bpmn-model by camunda.
the class CamundaExtensionsTest method testCamundaConstantInputParameter.
@Test
public void testCamundaConstantInputParameter() {
CamundaInputParameter inputParameter = findInputParameterByName(serviceTask, "shouldBeConstant");
assertThat(inputParameter.getCamundaName()).isEqualTo("shouldBeConstant");
assertThat(inputParameter.getTextContent()).isEqualTo("foo");
}
use of org.camunda.bpm.model.bpmn.instance.camunda.CamundaInputParameter in project camunda-bpmn-model by camunda.
the class CamundaExtensionsTest method testCamundaConnector.
@Test
public void testCamundaConnector() {
CamundaConnector camundaConnector = serviceTask.getExtensionElements().getElementsQuery().filterByType(CamundaConnector.class).singleResult();
assertThat(camundaConnector).isNotNull();
CamundaConnectorId camundaConnectorId = camundaConnector.getCamundaConnectorId();
assertThat(camundaConnectorId).isNotNull();
assertThat(camundaConnectorId.getTextContent()).isEqualTo("soap-http-connector");
CamundaInputOutput camundaInputOutput = camundaConnector.getCamundaInputOutput();
Collection<CamundaInputParameter> inputParameters = camundaInputOutput.getCamundaInputParameters();
assertThat(inputParameters).hasSize(1);
CamundaInputParameter inputParameter = inputParameters.iterator().next();
assertThat(inputParameter.getCamundaName()).isEqualTo("endpointUrl");
assertThat(inputParameter.getTextContent()).isEqualTo("http://example.com/webservice");
Collection<CamundaOutputParameter> outputParameters = camundaInputOutput.getCamundaOutputParameters();
assertThat(outputParameters).hasSize(1);
CamundaOutputParameter outputParameter = outputParameters.iterator().next();
assertThat(outputParameter.getCamundaName()).isEqualTo("result");
assertThat(outputParameter.getTextContent()).isEqualTo("output");
}
Aggregations