use of de.tum.in.www1.artemis.service.compass.umlmodel.UMLDiagram in project ArTEMiS by ls1intum.
the class UMLModelParserTest method buildModelFromJSON_communicationDiagram_empty.
@Test
void buildModelFromJSON_communicationDiagram_empty() throws Exception {
JsonObject communicationDiagramJson = loadFileFromResources("test-data/model-submission/empty-communication-diagram.json");
UMLDiagram umlDiagram = UMLModelParser.buildModelFromJSON(communicationDiagramJson, 123456789);
assertThat(umlDiagram.getModelSubmissionId()).isEqualTo(123456789);
assertThat(umlDiagram.getAllModelElements()).isEmpty();
}
use of de.tum.in.www1.artemis.service.compass.umlmodel.UMLDiagram in project ArTEMiS by ls1intum.
the class UMLModelParserTest method buildModelFromJSON_deploymentDiagram_empty.
@Test
void buildModelFromJSON_deploymentDiagram_empty() throws Exception {
JsonObject deploymentDiagramJson = loadFileFromResources("test-data/model-submission/empty-deployment-diagram.json");
UMLDiagram umlDiagram = UMLModelParser.buildModelFromJSON(deploymentDiagramJson, 123456789);
assertThat(umlDiagram.getModelSubmissionId()).isEqualTo(123456789);
assertThat(umlDiagram.getAllModelElements()).isEmpty();
}
use of de.tum.in.www1.artemis.service.compass.umlmodel.UMLDiagram in project ArTEMiS by ls1intum.
the class UMLObjectDiagramTest method parseObjectDiagramModelCorrectly.
@Test
void parseObjectDiagramModelCorrectly() throws IOException {
UMLDiagram diagram = UMLModelParser.buildModelFromJSON(parseString(UMLObjectDiagrams.OBJECT_MODEL_2).getAsJsonObject(), 1L);
assertThat(diagram).isInstanceOf(UMLObjectDiagram.class);
UMLObjectDiagram communicationDiagram = (UMLObjectDiagram) diagram;
assertThat(communicationDiagram.getObjectList()).hasSize(3);
assertThat(communicationDiagram.getObjectLinkList()).hasSize(2);
assertThat(communicationDiagram.getElementByJSONID("cf26446e-06ea-4e25-99c4-ded25948e856")).isInstanceOf(UMLObject.class);
assertThat(communicationDiagram.getElementByJSONID("ea1a2901-eefd-4ffe-a64c-b8e84f977c48")).isInstanceOf(UMLObjectLink.class);
}
use of de.tum.in.www1.artemis.service.compass.umlmodel.UMLDiagram in project ArTEMiS by ls1intum.
the class PetriNetTest method parsePetriNetModelCorrectly.
@Test
void parsePetriNetModelCorrectly() throws IOException {
UMLDiagram diagram = UMLModelParser.buildModelFromJSON(parseString(PETRI_NET_MODEL_1B).getAsJsonObject(), 1L);
assertThat(diagram).isInstanceOf(PetriNet.class);
PetriNet petriNet = (PetriNet) diagram;
assertThat(petriNet.getPlaces()).hasSize(2);
assertThat(petriNet.getTransitions()).hasSize(2);
assertThat(petriNet.getArcs()).hasSize(4);
assertThat(petriNet.getElementByJSONID("f406d5df-9404-4914-8631-8588cd289566")).asInstanceOf(type(PetriNetTransition.class)).satisfies(transition -> {
assertThat(transition.getName()).isEqualTo("t1");
});
assertThat(petriNet.getElementByJSONID("c67e50de-22a0-42df-8056-1cc65fc0f950")).asInstanceOf(type(PetriNetPlace.class)).satisfies(place -> {
assertThat(place.getName()).isEqualTo("b");
assertThat(place.getAmountOfTokens()).isEqualTo("0");
assertThat(place.getCapacity()).isEqualTo("Infinity");
});
assertThat(petriNet.getElementByJSONID("818fd351-bf3e-48b8-b41b-d775b23c13e5")).asInstanceOf(type(PetriNetArc.class)).satisfies(arc -> {
assertThat(arc.getMultiplicity()).isEqualTo("1");
assertThat(arc.getSource()).isNotNull().isSameAs(petriNet.getElementByJSONID("a12c5ed0-56aa-4174-b64b-7aead67429fd"));
assertThat(arc.getTarget()).isNotNull().isSameAs(petriNet.getElementByJSONID("9336eb67-ddfb-4622-8593-d640402a04fc"));
});
}
use of de.tum.in.www1.artemis.service.compass.umlmodel.UMLDiagram in project ArTEMiS by ls1intum.
the class UMLUseCaseDiagramTest method parseUseCaseDiagramModelCorrectly.
@Test
void parseUseCaseDiagramModelCorrectly() throws IOException {
UMLDiagram diagram = UMLModelParser.buildModelFromJSON(parseString(UMLUseCaseDiagrams.USE_CASE_MODEL_2).getAsJsonObject(), 1L);
assertThat(diagram).isInstanceOf(UMLUseCaseDiagram.class);
UMLUseCaseDiagram useCaseDiagram = (UMLUseCaseDiagram) diagram;
assertThat(useCaseDiagram.getSystemBoundaryList()).hasSize(1);
assertThat(useCaseDiagram.getActorList()).hasSize(2);
assertThat(useCaseDiagram.getUseCaseList()).hasSize(9);
assertThat(useCaseDiagram.getUseCaseAssociationList()).hasSize(9);
assertThat(useCaseDiagram.getElementByJSONID("559c80d8-5778-4c65-a57e-a0a7980404ed")).isInstanceOf(UMLActor.class);
assertThat(useCaseDiagram.getElementByJSONID("67f8af32-d803-4b36-b69c-bd0bb7b65207")).isInstanceOf(UMLUseCase.class);
assertThat(useCaseDiagram.getElementByJSONID("f84c7d48-a98f-4667-83be-76aded95df10")).isInstanceOf(UMLUseCaseAssociation.class);
}
Aggregations