diff options
author | Christian W. Damus | 2017-11-30 20:10:49 +0000 |
---|---|---|
committer | vincent lorenzo | 2017-12-04 09:24:24 +0000 |
commit | 03b7e261ec29faac085f7dae200131ccf9bbd63b (patch) | |
tree | 6631ab72b3364de50a24714a72900b3ca8d1fcee | |
parent | 3205e9f3327c1e81326562b8f67f7ef53aa8433c (diff) | |
download | org.eclipse.papyrus-03b7e261ec29faac085f7dae200131ccf9bbd63b.tar.gz org.eclipse.papyrus-03b7e261ec29faac085f7dae200131ccf9bbd63b.tar.xz org.eclipse.papyrus-03b7e261ec29faac085f7dae200131ccf9bbd63b.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
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)); |