diff options
author | Christian W. Damus | 2017-11-30 20:10:49 +0000 |
---|---|---|
committer | vincent lorenzo | 2017-12-01 09:19:42 +0000 |
commit | 61512a97eb11f7eb576abff132140a2b9040ec9f (patch) | |
tree | 783b9d7f0db6331748aca068aa22fe5570dacbb3 | |
parent | 5824db4b3032457ebca2e8faddec2b093b7810c2 (diff) | |
download | org.eclipse.papyrus-61512a97eb11f7eb576abff132140a2b9040ec9f.tar.gz org.eclipse.papyrus-61512a97eb11f7eb576abff132140a2b9040ec9f.tar.xz org.eclipse.papyrus-61512a97eb11f7eb576abff132140a2b9040ec9f.zip |
Bug 527973: [Tests] Problems in Decorator Model tests
Ensure that the index manager is started when the Decorator
Model Index is accessed. Also ensure non-interference in the
listener test of pending index changes from prior test executions.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=527973
(cherry-picked from streams/3.0-maintenance)
Change-Id: I05c9b82d45eceac1ce2576498b4e853279b26834
2 files changed, 12 insertions, 2 deletions
diff --git a/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel/src/org/eclipse/papyrus/uml/decoratormodel/internal/resource/DecoratorModelIndex.java b/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel/src/org/eclipse/papyrus/uml/decoratormodel/internal/resource/DecoratorModelIndex.java index f69eb2f1581..49e040f2cda 100644 --- a/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel/src/org/eclipse/papyrus/uml/decoratormodel/internal/resource/DecoratorModelIndex.java +++ b/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel/src/org/eclipse/papyrus/uml/decoratormodel/internal/resource/DecoratorModelIndex.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2014, 2016 Christian W. Damus and others. + * Copyright (c) 2014, 2017 Christian W. Damus and others. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -122,7 +122,14 @@ public class DecoratorModelIndex { modelToDecorators.clear(); } + @SuppressWarnings("restriction") public static DecoratorModelIndex getInstance() { + org.eclipse.papyrus.infra.emf.internal.resource.index.IndexManager manager = org.eclipse.papyrus.infra.emf.internal.resource.index.IndexManager.getInstance(); + if (!manager.isStarted()) { + // Start the index manager, now that somebody wants to use the index + manager.startManager(); + } + return INSTANCE; } diff --git a/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/src/org/eclipse/papyrus/uml/decoratormodel/internal/resource/tests/DecoratorModelIndexTest.java b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/src/org/eclipse/papyrus/uml/decoratormodel/internal/resource/tests/DecoratorModelIndexTest.java index f0b8d0afe87..fabae1f8a78 100644 --- a/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/src/org/eclipse/papyrus/uml/decoratormodel/internal/resource/tests/DecoratorModelIndexTest.java +++ b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/src/org/eclipse/papyrus/uml/decoratormodel/internal/resource/tests/DecoratorModelIndexTest.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2014 Christian W. Damus and others. + * Copyright (c) 2014, 2017 Christian W. Damus and others. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -206,6 +206,9 @@ public class DecoratorModelIndexTest extends AbstractProfileExternalizationTest @Test public void listener() throws Exception { + // Wait for a stable point in the index + DecoratorModelIndex.getInstance().getDecoratorModels(); + final TestListener listener = new TestListener(); DecoratorModelIndex.getInstance().addIndexListener(houseKeeper.cleanUpLater(listener)); |