use of io.atlasmap.v2.Property in project kie-wb-common by kiegroup.
the class ProcessPropertyWriter method setProcessVariables.
public void setProcessVariables(BaseProcessVariables processVariables) {
String value = processVariables.getValue();
DeclarationList declarationList = DeclarationList.fromString(value);
List<Property> properties = process.getProperties();
declarationList.getDeclarations().forEach(decl -> {
VariableScope.Variable variable = variableScope.declare(this.process.getId(), decl.getIdentifier(), decl.getType(), decl.getTags());
if (!decl.getTags().isEmpty()) {
CustomElement.customTags.of(variable.getTypedIdentifier()).set(decl.getTags());
}
properties.add(variable.getTypedIdentifier());
this.itemDefinitions.add(variable.getTypeDeclaration());
});
}
use of io.atlasmap.v2.Property in project kie-wb-common by kiegroup.
the class SubProcessConverterTest method assertVariables.
private static void assertVariables(List<Pair<String, String>> expectedVariables, List<Property> properties) {
assertEquals(expectedVariables.size(), properties.size());
Pair<String, String> expectedVariable;
Property property;
for (int i = 0; i < expectedVariables.size(); i++) {
expectedVariable = expectedVariables.get(i);
property = properties.get(i);
assertEquals(expectedVariable.getK1(), property.getId());
assertEquals(expectedVariable.getK1(), property.getName());
assertEquals(String.format("_%sItem", expectedVariable.getK1()), property.getItemSubjectRef().getId());
assertEquals(expectedVariable.getK2(), property.getItemSubjectRef().getStructureRef());
}
}
use of io.atlasmap.v2.Property in project kie-wb-common by kiegroup.
the class MultipleInstanceActivityPropertyWriterTest method setUp.
@Before
public void setUp() {
activity = Factories.bpmn2.createUserTask();
activity.setId(ACTIVITY_ID);
variableScope = mock(VariableScope.class);
VariableScope.Variable variable = mock(VariableScope.Variable.class);
when(variableScope.lookup(PROPERTY_ID)).thenReturn(Optional.of(variable));
Property property = mockProperty(PROPERTY_ID, ITEM_ID);
when(variable.getTypedIdentifier()).thenReturn(property);
writer = new MultipleInstanceActivityPropertyWriter(activity, variableScope, new HashSet<>());
}
use of io.atlasmap.v2.Property in project kie-wb-common by kiegroup.
the class BPMNDirectDiagramMarshallerTest method testMarshallProcessVariables.
@Test
public void testMarshallProcessVariables() throws Exception {
Diagram<Graph, Metadata> diagram = unmarshall(BPMN_PROCESSVARIABLES);
String result = tested.marshall(diagram);
assertDiagram(result, 1, 7, 7);
Definitions definitions = new DefinitionsConverter(diagram.getGraph()).toDefinitions();
assertNotNull(definitions);
List<RootElement> rootElements = definitions.getRootElements();
assertNotNull(rootElements);
assertItemExists(rootElements, "_employeeItem", "java.lang.String");
assertItemExists(rootElements, "_reasonItem", "java.lang.String");
assertItemExists(rootElements, "_performanceItem", "java.lang.String");
Process process = getProcess(definitions);
assertNotNull(process);
List<Property> properties = process.getProperties();
assertNotNull(properties);
assertNotNull(getProcessProperty(properties, "employee", "_employeeItem"));
assertNotNull(getProcessProperty(properties, "reason", "_reasonItem"));
assertNotNull(getProcessProperty(properties, "performance", "_performanceItem"));
}
use of io.atlasmap.v2.Property in project kie-wb-common by kiegroup.
the class OutputAssignmentReaderTest method testFromAssociationWithPropertyName.
@Test
public void testFromAssociationWithPropertyName() {
Property property = mockProperty(TARGET_ID, TARGET_NAME);
DataOutputAssociation outputAssociation = mockDataOutputAssociation(SOURCE_NAME, property);
OutputAssignmentReader outputReader = OutputAssignmentReader.fromAssociation(outputAssociation);
assertNotNull(outputReader);
assertResult(SOURCE_NAME, TARGET_NAME, AssociationDeclaration.Type.SourceTarget, outputReader.getAssociationDeclaration());
}
Aggregations