Search in sources :

Example 6 with CamundaInputParameter

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();
}
Also used : CamundaMap(org.camunda.bpm.model.bpmn.instance.camunda.CamundaMap) CamundaEntry(org.camunda.bpm.model.bpmn.instance.camunda.CamundaEntry) CamundaInputParameter(org.camunda.bpm.model.bpmn.instance.camunda.CamundaInputParameter) Test(org.junit.Test)

Example 7 with CamundaInputParameter

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;
}
Also used : CamundaInputOutput(org.camunda.bpm.model.bpmn.instance.camunda.CamundaInputOutput) CamundaInputParameter(org.camunda.bpm.model.bpmn.instance.camunda.CamundaInputParameter)

Example 8 with CamundaInputParameter

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();
}
Also used : ModelElementTypeBuilder(org.camunda.bpm.model.xml.type.ModelElementTypeBuilder) CamundaInputParameter(org.camunda.bpm.model.bpmn.instance.camunda.CamundaInputParameter) ModelTypeInstanceContext(org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext)

Example 9 with CamundaInputParameter

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");
}
Also used : CamundaInputParameter(org.camunda.bpm.model.bpmn.instance.camunda.CamundaInputParameter) Test(org.junit.Test)

Example 10 with CamundaInputParameter

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");
}
Also used : CamundaOutputParameter(org.camunda.bpm.model.bpmn.instance.camunda.CamundaOutputParameter) CamundaConnector(org.camunda.bpm.model.bpmn.instance.camunda.CamundaConnector) CamundaConnectorId(org.camunda.bpm.model.bpmn.instance.camunda.CamundaConnectorId) CamundaInputOutput(org.camunda.bpm.model.bpmn.instance.camunda.CamundaInputOutput) CamundaInputParameter(org.camunda.bpm.model.bpmn.instance.camunda.CamundaInputParameter) Test(org.junit.Test)

Aggregations

CamundaInputParameter (org.camunda.bpm.model.bpmn.instance.camunda.CamundaInputParameter)12 Test (org.junit.Test)8 CamundaInputOutput (org.camunda.bpm.model.bpmn.instance.camunda.CamundaInputOutput)4 ArrayList (java.util.ArrayList)2 CamundaOutputParameter (org.camunda.bpm.model.bpmn.instance.camunda.CamundaOutputParameter)2 BpmnModelElementInstance (org.camunda.bpm.model.bpmn.instance.BpmnModelElementInstance)1 CamundaConnector (org.camunda.bpm.model.bpmn.instance.camunda.CamundaConnector)1 CamundaConnectorId (org.camunda.bpm.model.bpmn.instance.camunda.CamundaConnectorId)1 CamundaConstraint (org.camunda.bpm.model.bpmn.instance.camunda.CamundaConstraint)1 CamundaEntry (org.camunda.bpm.model.bpmn.instance.camunda.CamundaEntry)1 CamundaList (org.camunda.bpm.model.bpmn.instance.camunda.CamundaList)1 CamundaMap (org.camunda.bpm.model.bpmn.instance.camunda.CamundaMap)1 CamundaScript (org.camunda.bpm.model.bpmn.instance.camunda.CamundaScript)1 CamundaValue (org.camunda.bpm.model.bpmn.instance.camunda.CamundaValue)1 ModelTypeInstanceContext (org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext)1 ModelElementTypeBuilder (org.camunda.bpm.model.xml.type.ModelElementTypeBuilder)1