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 78395 Details for
Bug 202064
More client-side intelligence (SmartReadAhead Thread)
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.
[patch]
TestCase - EContentAdapter
20070913-1-ContentAdapter.patch (text/plain), 5.70 KB, created by
Simon Mc Duff
on 2007-09-13 21:00:49 EDT
(
hide
)
Description:
TestCase - EContentAdapter
Filename:
MIME Type:
Creator:
Simon Mc Duff
Created:
2007-09-13 21:00:49 EDT
Size:
5.70 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.emf.cdo.tests >Index: src/org/eclipse/emf/cdo/tests/InitialTest.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf.cdo/tests/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/InitialTest.java,v >retrieving revision 1.2 >diff -u -r1.2 InitialTest.java >--- src/org/eclipse/emf/cdo/tests/InitialTest.java 31 Aug 2007 15:25:39 -0000 1.2 >+++ src/org/eclipse/emf/cdo/tests/InitialTest.java 14 Sep 2007 00:52:40 -0000 >@@ -14,6 +14,7 @@ > import org.eclipse.emf.cdo.CDOState; > import org.eclipse.emf.cdo.CDOTransaction; > import org.eclipse.emf.cdo.eresource.CDOResource; >+import org.eclipse.emf.cdo.protocol.CDOID; > import org.eclipse.emf.cdo.tests.model1.Model1Factory; > import org.eclipse.emf.cdo.tests.model1.PurchaseOrder; > import org.eclipse.emf.cdo.tests.model1.Supplier; >@@ -22,11 +23,15 @@ > import org.eclipse.net4j.IBufferHandler; > import org.eclipse.net4j.IChannel; > >+import org.eclipse.emf.common.notify.Notification; > 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.ResourceSet; > import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; >+import org.eclipse.emf.ecore.util.EContentAdapter; >+import org.eclipse.emf.internal.cdo.CDOSessionImpl; >+import org.eclipse.emf.internal.cdo.CDOTransactionImpl; > > import java.util.Date; > >@@ -624,4 +629,80 @@ > msg("Verifying name"); > assertEquals("Stepper", s.getName()); > } >+ >+ public void testContentAdapterUsingCDOResource() throws Exception >+ { >+ final boolean notified[] = new boolean[1]; >+ >+ EContentAdapter contentAdapter = new EContentAdapter() >+ { >+ public void notifyChanged(Notification notification) >+ { >+ super.notifyChanged(notification); >+ notified[0] = true; >+ } >+ protected boolean resolve() >+ { >+ return false; >+ } >+ }; >+ CDOID supplierID = null; >+ { >+ CDOSession session = openModel1Session(); >+ CDOTransaction transaction = session.openTransaction(new ResourceSetImpl()); >+ >+ CDOResource resource = transaction.createResource("/test2"); >+ >+ resource.eAdapters().add( contentAdapter ); >+ >+ Supplier supplier = Model1Factory.eINSTANCE.createSupplier(); >+ >+ resource.getContents().add( supplier ); >+ notified[0] = false; >+ >+ // contentAdapter should receive notification >+ supplier.setName("HELLO"); >+ >+ assertEquals(true, notified[0]); >+ >+ supplierID = supplier.cdoID(); >+ >+ transaction.commit(); >+ >+ supplierID = supplier.cdoID(); >+ >+ transaction.close(); >+ session.close(); >+ } >+ { >+ CDOSessionImpl session = (CDOSessionImpl)openModel1Session(); >+ >+ CDOFetchRuleManagerInfo info = new CDOFetchRuleManagerInfo(); >+ session.getRevisionManager().setRuleManager(info); >+ >+ CDOTransactionImpl transaction = session.openTransaction(new ResourceSetImpl()); >+ CDOResource resource = transaction.getResource("/test2"); >+ >+ // I don't want to fetch my objects!! >+ >+ resource.eAdapters().add( contentAdapter ); >+ >+ // By adding an adapter, we shouldn`t fetch objects >+ assertEquals(false, info.getOIDSet().contains(supplierID)); >+ >+ Supplier supplier = (Supplier)transaction.getObject(supplierID); >+ >+ notified[0] = false; >+ >+ // contentAdapter should receive notification >+ supplier.setName("HELLO"); >+ >+ // Should have been notified!! >+ assertEquals(true, notified[0]); >+ >+ transaction.commit(); >+ transaction.close(); >+ } >+ } >+ > } >Index: src/org/eclipse/emf/cdo/tests/CDOFetchRuleManagerInfo.java >=================================================================== >RCS file: src/org/eclipse/emf/cdo/tests/CDOFetchRuleManagerInfo.java >diff -N src/org/eclipse/emf/cdo/tests/CDOFetchRuleManagerInfo.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/emf/cdo/tests/CDOFetchRuleManagerInfo.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,60 @@ >+/*************************************************************************** >+ * Copyright (c) 2004 - 2007 Eike Stepper, Germany. >+ * 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: >+ * Simon McDuff - initial API and implementation >+ **************************************************************************/ >+ >+package org.eclipse.emf.cdo.tests; >+ >+import java.util.Collection; >+import java.util.HashSet; >+import java.util.List; >+ >+import org.eclipse.emf.cdo.analyzer.CDOFetchRuleManager; >+import org.eclipse.emf.cdo.internal.protocol.CDOIDNull; >+import org.eclipse.emf.cdo.protocol.CDOID; >+import org.eclipse.emf.cdo.protocol.analyzer.CDOFetchRule; >+/** >+ * @author Simon McDuff >+ */ >+public class CDOFetchRuleManagerInfo implements CDOFetchRuleManager >+{ >+ >+ private HashSet<CDOID> objectFetchs = new HashSet<CDOID>(); >+ >+ public CDOID getContext() >+ { >+ // TODO Auto-generated method stub >+ return CDOIDNull.NULL; >+ } >+ >+ public void clear() >+ { >+ objectFetchs.clear(); >+ } >+ public HashSet<CDOID> getOIDSet() >+ { >+ return objectFetchs; >+ } >+ public List<CDOFetchRule> getFetchRules(Collection<CDOID> ids) >+ { >+ // accumulate changes >+ for (CDOID id : ids) >+ { >+ objectFetchs.add(id); >+ } >+ return null; >+ } >+ >+ public int getLoadRevisionCollectionChunkSize() >+ { >+ // TODO Auto-generated method stub >+ return 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 Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 202064
:
77860
|
77861
|
77950
|
77969
|
78135
|
78236
|
78242
|
78243
| 78395