Commit 95bcafbe authored by Marco Konersmann's avatar Marco Konersmann

Towards events in the cocome-case study

parent 934a6e9a
Pipeline #2922 failed with stages
in 2 minutes and 42 seconds
......@@ -19,12 +19,17 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runners.MethodSorters;
import org.osgi.framework.FrameworkUtil;
import org.palladiosimulator.pcm.core.composition.AssemblyContext;
import org.palladiosimulator.pcm.repository.BasicComponent;
import org.palladiosimulator.pcm.repository.CompositeComponent;
......@@ -88,11 +93,21 @@ public class CoCoMECaseStudyIT extends MayHaveIssues {
specificationLanguage, null, projects);
}
@Test void verifyAgainstOracleModel() {
CoCoMECaseStudyIT.class.getClassLoader().getResourceAsStream("/oracle/")
protected final String BUNDLE_NAME = FrameworkUtil.getBundle(getClass()).getSymbolicName();
@Test
public void verifyAgainstOracleModel() {
List<EObject> expected = loadModel(
URI.createPlatformPluginURI(BUNDLE_NAME + "/src/main/resources/expected_pcm.xmi", true));
new CompareEcoreModels().compare(expected, pcmModel);
}
private List<EObject> loadModel(URI uri) {
ResourceSet resSet = new ResourceSetImpl();
final Resource resource = resSet.getResource(uri, true);
return resource.getContents();
}
@Test
public void _3_verifySystem() {
System system = getSystem(pcmModel);
......@@ -102,10 +117,13 @@ public class CoCoMECaseStudyIT extends MayHaveIssues {
public void _2_verifyRepository() {
Repository repository = getRepository(pcmModel);
EList<Interface> interfaces = repository.getInterfaces__Repository();
assertEquals(11, interfaces.size());
int operationInterfacesCount = 11;
int eventInterfacesCount =0 ;
int totalInterfacesCount = operationInterfacesCount + eventInterfacesCount;
assertEquals(totalInterfacesCount, interfaces.size());
EList<RepositoryComponent> components = repository.getComponents__Repository();
assertEquals(18, components.size());
assertEquals(19, components.size());
}
@Test
......@@ -114,43 +132,43 @@ public class CoCoMECaseStudyIT extends MayHaveIssues {
EList<RepositoryComponent> components = repository.getComponents__Repository();
for (RepositoryComponent repositoryComponent : components) {
switch (repositoryComponent.getEntityName()) {
case "ProductDispatcher":
case "ProductDispatcherServer":
verifyComponentProductDispatcher(repositoryComponent);
break;
case "Reporting":
case "ReportingServer":
verifyComponentReporting(repositoryComponent);
break;
case "Store":
verifyComponentStore(repositoryComponent);
case "StoreServer":
verifyComponentStoreServer(repositoryComponent);
break;
case "TrivialBank":
case "TrivialBankServer":
verifyComponentTrivialBank(repositoryComponent);
break;
case "CashBox":
case "CashBoxModel":
verifyComponentCashBox(repositoryComponent);
break;
case "ExpressLight":
case "ExpressLightModel":
verifyComponentExpressLight(repositoryComponent);
break;
case "cashdeskline":
verifyComponentCashdeskline(repositoryComponent);
break;
case "BarcodeScanner":
case "BarcodeScannerModel":
verifyComponentBarcodeScanner(repositoryComponent);
break;
case "CardReader":
case "CardReaderModel":
verifyComponentCardReader(repositoryComponent);
break;
case "Printer":
case "PrinterModel":
verifyComponentPrinter(repositoryComponent);
break;
case "UserDisplay":
case "UserDisplayModel":
verifyComponentUserDisplay(repositoryComponent);
break;
case "Coordinator":
case "CoordinatorModel":
verifyComponentCoordinator(repositoryComponent);
break;
case "CashDesk":
case "CashDeskModel":
verifyComponentCashDesk(repositoryComponent);
break;
case "console":
......@@ -162,6 +180,11 @@ public class CoCoMECaseStudyIT extends MayHaveIssues {
case "inventory":
verifyComponentInventory(repositoryComponent);
break;
case "CashDeskModel_Internal":
verifyComponentCashDeskInternal(repositoryComponent);
break;
default:
fail("Found unexpected component " + repository.getEntityName());
}
}
}
......@@ -201,11 +224,13 @@ public class CoCoMECaseStudyIT extends MayHaveIssues {
private void verifyComponentInventory(RepositoryComponent repositoryComponent) {
verifyIsCompositeComponent(repositoryComponent);
CompositeComponent component = (CompositeComponent) repositoryComponent;
assertEquals(1, component.getProvidedRoles_InterfaceProvidingEntity().size());
assertEquals(4, component.getProvidedRoles_InterfaceProvidingEntity().size());
verifyHasAssemblyContextsOfComponents(component, "console", "application");
verifyDelegatesProvision(component, new String[] { "IStoreInventory", "application" },
new String[] { "IStoreInventoryManager", "application" });
new String[] { "IStoreInventoryManager", "application" },
new String[] { "IReporting", "ReportingServer" },
new String[] { "IProductDispatcher", "ProductDispatcherServer" });
verifyDelegatesRequirement(component);
verifyConnects(component, "console", "application", "IStoreInventoryManager");
verifyConnects(component, "console", "application", "IReporting");
......@@ -226,6 +251,11 @@ public class CoCoMECaseStudyIT extends MayHaveIssues {
CompositeComponent component = (CompositeComponent) repositoryComponent;
}
private void verifyComponentCashDeskInternal(RepositoryComponent repositoryComponent) {
verifyIsWellFormedBasicComponent(repositoryComponent);
BasicComponent component = (BasicComponent) repositoryComponent;
}
private void verifyComponentCoordinator(RepositoryComponent repositoryComponent) {
verifyIsWellFormedBasicComponent(repositoryComponent);
BasicComponent component = (BasicComponent) repositoryComponent;
......@@ -280,7 +310,7 @@ public class CoCoMECaseStudyIT extends MayHaveIssues {
}
private void verifyComponentStore(RepositoryComponent repositoryComponent) {
private void verifyComponentStoreServer(RepositoryComponent repositoryComponent) {
verifyIsWellFormedBasicComponent(repositoryComponent);
BasicComponent component = (BasicComponent) repositoryComponent;
if (provides(component, "IStore")) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment