Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorcdamus2013-04-12 16:40:46 -0400
committercdamus2013-04-12 16:40:46 -0400
commit43b2b4675e5784996e246b14010839aaf8ff5b02 (patch)
tree663a20dfcbdf2ada01f06d5f2276294d5b2720b3 /tests
parent9abaca0ae5b1e65b4afae3e5ab56d6d1a821aaea (diff)
downloadorg.eclipse.papyrus-43b2b4675e5784996e246b14010839aaf8ff5b02.tar.gz
org.eclipse.papyrus-43b2b4675e5784996e246b14010839aaf8ff5b02.tar.xz
org.eclipse.papyrus-43b2b4675e5784996e246b14010839aaf8ff5b02.zip
[403808] Validation ignores AppliedStereotypes
https://bugs.eclipse.org/bugs/show_bug.cgi?id=403808 Fix compilation error on missed refactoring of the core validation API.
Diffstat (limited to 'tests')
-rw-r--r--tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.tests/src/org/eclipse/papyrus/cdo/internal/ui/markers/tests/ModelValidationMarkersTest.java51
1 files changed, 18 insertions, 33 deletions
diff --git a/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.tests/src/org/eclipse/papyrus/cdo/internal/ui/markers/tests/ModelValidationMarkersTest.java b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.tests/src/org/eclipse/papyrus/cdo/internal/ui/markers/tests/ModelValidationMarkersTest.java
index 514b651599d..916e17939d0 100644
--- a/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.tests/src/org/eclipse/papyrus/cdo/internal/ui/markers/tests/ModelValidationMarkersTest.java
+++ b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.ui.tests/src/org/eclipse/papyrus/cdo/internal/ui/markers/tests/ModelValidationMarkersTest.java
@@ -32,6 +32,7 @@ import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
import org.eclipse.papyrus.infra.services.markerlistener.IPapyrusMarker;
import org.eclipse.papyrus.infra.services.markerlistener.MarkersMonitorService;
+import org.eclipse.papyrus.infra.services.validation.EcoreDiagnostician;
import org.eclipse.papyrus.infra.services.validation.commands.ValidateDelMarkersFromModelCommand;
import org.eclipse.papyrus.infra.services.validation.commands.ValidateModelCommand;
import org.eclipse.ui.PartInitException;
@@ -44,8 +45,7 @@ import com.google.common.collect.Lists;
/**
* This is the ModelValidationMarkersTest type. Enjoy.
*/
-public class ModelValidationMarkersTest
- extends AbstractPapyrusCDOUITest {
+public class ModelValidationMarkersTest extends AbstractPapyrusCDOUITest {
public ModelValidationMarkersTest() {
super();
@@ -62,9 +62,7 @@ public class ModelValidationMarkersTest
// get some marker
IPapyrusMarker marker = null;
try {
- marker = Iterables.getFirst(
- getMarkersMonitorService().getMarkers(
- getUMLModel().eResource(), null, true), null);
+ marker = Iterables.getFirst(getMarkersMonitorService().getMarkers(getUMLModel().eResource(), null, true), null);
assertThat("Did not find a marker.", marker, notNullValue());
} catch (CoreException e) {
e.printStackTrace();
@@ -83,16 +81,14 @@ public class ModelValidationMarkersTest
// get the markers
List<IPapyrusMarker> markers = null;
try {
- markers = Lists.newArrayList(getMarkersMonitorService().getMarkers(
- getUMLModel().eResource(), null, true));
- assertThat("Did not find any markers.", markers.isEmpty(),
- is(false));
+ markers = Lists.newArrayList(getMarkersMonitorService().getMarkers(getUMLModel().eResource(), null, true));
+ assertThat("Did not find any markers.", markers.isEmpty(), is(false));
} catch (CoreException e) {
e.printStackTrace();
fail("Could not get problem markers.");
}
- for (IPapyrusMarker next : markers) {
+ for(IPapyrusMarker next : markers) {
try {
next.delete();
} catch (CoreException e) {
@@ -102,10 +98,7 @@ public class ModelValidationMarkersTest
}
try {
- assertThat(
- "Found markers.",
- getMarkersMonitorService().getMarkers(
- getUMLModel().eResource(), null, true).isEmpty(), is(true));
+ assertThat("Found markers.", getMarkersMonitorService().getMarkers(getUMLModel().eResource(), null, true).isEmpty(), is(true));
} catch (CoreException e) {
e.printStackTrace();
fail("Could not get problem markers.");
@@ -113,8 +106,7 @@ public class ModelValidationMarkersTest
}
@Test
- public void testMemoryLeaksInValidation()
- throws InterruptedException {
+ public void testMemoryLeaksInValidation() throws InterruptedException {
openEditor();
@@ -125,9 +117,7 @@ public class ModelValidationMarkersTest
// get some marker
IPapyrusMarker marker = null;
try {
- marker = Iterables.getFirst(
- getMarkersMonitorService().getMarkers(
- getUMLModel().eResource(), null, true), null);
+ marker = Iterables.getFirst(getMarkersMonitorService().getMarkers(getUMLModel().eResource(), null, true), null);
assertThat("Did not find a marker.", marker, notNullValue());
} catch (CoreException e) {
e.printStackTrace();
@@ -145,12 +135,12 @@ public class ModelValidationMarkersTest
closeEditor();
// try to force GC
- for (int i = 0; i < 10; i++) {
+ for(int i = 0; i < 10; i++) {
System.gc();
}
// assert that the marker and its underlying EProblem are unreachable
- for (int i = 0; i < 2; i++) {
+ for(int i = 0; i < 2; i++) {
Reference<?> ref = queue.remove(1000);
assertThat(references.remove(ref), is(true));
}
@@ -161,17 +151,13 @@ public class ModelValidationMarkersTest
//
@Before
- public void ensureValidationView()
- throws PartInitException {
- getWorkbenchPage().showView(
- "org.eclipse.papyrus.views.validation.ModelValidationView");
+ public void ensureValidationView() throws PartInitException {
+ getWorkbenchPage().showView("org.eclipse.papyrus.views.validation.ModelValidationView");
}
void execute(IUndoableOperation operation) {
try {
- getWorkbenchPage().getWorkbenchWindow().getWorkbench()
- .getOperationSupport().getOperationHistory()
- .execute(operation, new NullProgressMonitor(), null);
+ getWorkbenchPage().getWorkbenchWindow().getWorkbench().getOperationSupport().getOperationHistory().execute(operation, new NullProgressMonitor(), null);
} catch (ExecutionException e) {
e.printStackTrace();
fail("Failed to execute operation: " + operation);
@@ -179,19 +165,18 @@ public class ModelValidationMarkersTest
}
void validateModel() {
- execute(new ValidateModelCommand(getUMLModel()));
+ execute(new ValidateModelCommand(getUMLModel(), new EcoreDiagnostician()));
}
void deleteMarkers() {
- execute(new ValidateDelMarkersFromModelCommand(getUMLModel()));
+ execute(new ValidateDelMarkersFromModelCommand(getUMLModel(), new EcoreDiagnostician()));
}
MarkersMonitorService getMarkersMonitorService() {
MarkersMonitorService result = null;
try {
- result = ServiceUtils.getInstance().getService(
- MarkersMonitorService.class, getEditor().getServicesRegistry());
+ result = ServiceUtils.getInstance().getService(MarkersMonitorService.class, getEditor().getServicesRegistry());
} catch (ServiceException e) {
e.printStackTrace();
fail("Failed to get MarkersMonitorService.");
@@ -206,7 +191,7 @@ public class ModelValidationMarkersTest
try {
Field eProblemField = marker.getClass().getDeclaredField("problem");
eProblemField.setAccessible(true);
- result = (EProblem) eProblemField.get(marker);
+ result = (EProblem)eProblemField.get(marker);
} catch (Exception e) {
e.printStackTrace();
fail("Failed to get EProblem wrapped by IPapyrusMarker.");

Back to the top