Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 268153 Details for
Bug 504494
Missed notifications in some cases can corrupt the "dirty" state of the session and make it impossible to save changes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
Simple test to expose the bug
MoveNotificationChangeTest.java (text/x-java), 3.50 KB, created by
Pierre-Charles David
on 2017-05-03 11:26:56 EDT
(
hide
)
Description:
Simple test to expose the bug
Filename:
MIME Type:
Creator:
Pierre-Charles David
Created:
2017-05-03 11:26:56 EDT
Size:
3.50 KB
patch
obsolete
>/******************************************************************************* > * Copyright (c) 2017 Obeo. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * > * Contributors: > * Obeo - initial API and implementation > *******************************************************************************/ >package org.eclipse.sirius.tests.unit.common; > >import static org.junit.Assert.assertTrue; > >import java.util.Collections; >import java.util.Map; > >import org.eclipse.emf.common.EMFPlugin; >import org.eclipse.emf.common.notify.Notification; >import org.eclipse.emf.ecore.EPackage; >import org.eclipse.emf.ecore.EcoreFactory; >import org.eclipse.emf.ecore.EcorePackage; >import org.eclipse.emf.ecore.resource.Resource; >import org.eclipse.emf.ecore.resource.ResourceSet; >import org.eclipse.emf.ecore.resource.impl.ResourceImpl; >import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; >import org.eclipse.emf.transaction.RecordingCommand; >import org.eclipse.emf.transaction.Transaction; >import org.eclipse.emf.transaction.TransactionalEditingDomain; >import org.eclipse.emf.transaction.util.TransactionUtil; >import org.eclipse.emf.transaction.util.ValidateEditSupport; >import org.eclipse.emf.transaction.util.ValidateEditSupport.Default; >import org.junit.BeforeClass; >import org.junit.Test; > >/** > * See https://bugs.eclipse.org/bugs/show_bug.cgi?id=504494 > * > * @author pcdavid > */ >public class MoveNotificationChangeTest { > @BeforeClass > public static void initializeEMF() { > if (!EMFPlugin.IS_ECLIPSE_RUNNING) { > @SuppressWarnings("unused") > EPackage ecore = EcorePackage.eINSTANCE; > } > } > > @Test > public void emf_tx_validate_edit_support_called_on_move() { > EPackage p = EcoreFactory.eINSTANCE.createEPackage(); > p.getEClassifiers().add(EcoreFactory.eINSTANCE.createEClass()); > p.getEClassifiers().add(EcoreFactory.eINSTANCE.createEClass()); > > Resource r = new ResourceImpl(); > r.getContents().add(p); > > ResourceSet rs = new ResourceSetImpl(); > rs.getResources().add(r); > > TransactionalEditingDomain ted = TransactionalEditingDomain.Factory.INSTANCE.createEditingDomain(rs); > > final boolean[] token = new boolean[1]; > TransactionalEditingDomain.DefaultOptions options = TransactionUtil.getAdapter(ted, TransactionalEditingDomain.DefaultOptions.class); > if (options != null) { > Map<String, Default> aMap = Collections.singletonMap(Transaction.OPTION_VALIDATE_EDIT, new ValidateEditSupport.Default() { > @Override > public void handleResourceChange(Resource resource, Notification notification) { > super.handleResourceChange(resource, notification); > if (notification.getEventType() == Notification.MOVE) { > token[0] = true; > } > > } > }); > options.setDefaultTransactionOptions(aMap); > } > > // Execute a simple transaction with a single MOVE > ted.getCommandStack().execute(new RecordingCommand(ted) { > @Override > protected void doExecute() { > p.getEClassifiers().move(1, 0); > } > }); > > assertTrue("ValidateEditSupport not called on EList.move()", token[0]); > } > >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 504494
:
264660
| 268153