@Test
public void testCommunicationIntegrityTests() {
loadFiles();
ComponentMapping comp1Mapping = archMapping.getComponentMapping("Comp1");
PortMapping pMapping = comp1Mapping.getPortMapping("p");
Component comp1 = architecture.getComponentByName("Comp1");
Port p = comp1.getPortByName("p");
assertTrue(mappingHelper.isClassExposedByPort(comp1Mapping.getInterfaceDefinition().get(0),
p, pMapping));
assertFalse(mappingHelper.isClassExposedByPort(comp1Mapping.getClassDefinition().get(0),
p, pMapping));
assertTrue(mappingHelper.isClassUsingPort(comp1Mapping.getClassDefinition().get(0),
p, pMapping));
assertFalse(mappingHelper.isClassUsingPort(comp1Mapping.getInterfaceDefinition().get(0),
p, pMapping));
assertTrue(mappingHelper.isClassExposedByPort(comp1Mapping.getInterfaceDefinition().get(1),
p, pMapping));
assertFalse(mappingHelper.isClassUsingPort(comp1Mapping.getInterfaceDefinition().get(1),
p, pMapping));
assertTrue(mappingHelper.mayClassReferenceOtherClass
("Comp1Interface3", "Comp1", "Comp2If1", "Comp2"));
Component comp2 = architecture.getComponentByName("Comp2");
ComponentMapping comp2Mapping = archMapping.getComponentMapping("Comp2");
Port p2 = comp2.getPortByName("p2");
assertFalse(mappingHelper.isClassUsingPort(comp2Mapping.getClassDefinition().get(0), p2, null));
assertTrue(mappingHelper.isClassExposedByPort(comp2Mapping.getClassDefinition().get(0), p2, null));
// every class is exposed by the port, so we can also test with null
// (which will be the case for classes defined by classNamePattern)
assertTrue(mappingHelper.isClassExposedByPort(null, p2, null));
assertTrue(mappingHelper.isClassUsingPort(comp2Mapping.getInterfaceDefinition().get(0),
p2, null));
// Test with implemented Connector
Component comp3 = architecture.getComponentByName("Comp3");
ComponentMapping comp3Mapping = archMapping.getComponentMapping("Comp3");
ClassDefinition classComp3Def = comp3Mapping.getClassDefinition().get(0);
ClassDefinition class2Comp3Def = comp3Mapping.getClassDefinition().get(1);
Connector connWithImpl = architecture.getConnectorByName("ConnWithImpl");
ConnectorMapping connWithImplMapping = archMapping.getConnectorMapping("ConnWithImpl");
ClassDefinition connClassDef = connWithImplMapping.getClassDefinition().get(0);