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 76714 Details for
Bug 113590
Historical reference to test suite not deleted
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]
Fix for Historical reference to test suite not deleted
113590.patch (text/plain), 18.55 KB, created by
Joe Toomey
on 2007-08-22 17:13:29 EDT
(
hide
)
Description:
Fix for Historical reference to test suite not deleted
Filename:
MIME Type:
Creator:
Joe Toomey
Created:
2007-08-22 17:13:29 EDT
Size:
18.55 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.tptp.platform.models >Index: src-hierarchy/org/eclipse/hyades/models/hierarchy/util/EMFUtil.java >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.models/src-hierarchy/org/eclipse/hyades/models/hierarchy/util/EMFUtil.java,v >retrieving revision 1.14 >diff -u -r1.14 EMFUtil.java >--- src-hierarchy/org/eclipse/hyades/models/hierarchy/util/EMFUtil.java 23 Mar 2006 20:44:59 -0000 1.14 >+++ src-hierarchy/org/eclipse/hyades/models/hierarchy/util/EMFUtil.java 22 Aug 2007 21:13:21 -0000 >@@ -117,11 +117,11 @@ > changedResources.add(object.eResource()); > > deleteList.add(object); >- object.eAdapters().clear(); > for (int i = deleteList.size() - 1; i >= 0; i--) { > unsetAllFeatures((EObject) deleteList.get(i)); > } > deleteList.clear(); >+ object.eAdapters().clear(); > > return changedResources; > } >Index: src-test/org/eclipse/hyades/models/common/facades/behavioral/impl/HyadesBVRInteractionAdapter.java >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.models/src-test/org/eclipse/hyades/models/common/facades/behavioral/impl/HyadesBVRInteractionAdapter.java,v >retrieving revision 1.4 >diff -u -r1.4 HyadesBVRInteractionAdapter.java >--- src-test/org/eclipse/hyades/models/common/facades/behavioral/impl/HyadesBVRInteractionAdapter.java 8 Feb 2006 19:56:39 -0000 1.4 >+++ src-test/org/eclipse/hyades/models/common/facades/behavioral/impl/HyadesBVRInteractionAdapter.java 22 Aug 2007 21:13:21 -0000 >@@ -95,25 +95,15 @@ > BVRInteractionImpl interaction = (BVRInteractionImpl) notification.getNotifier(); > BVRInteractionFragmentImpl fragment = null; > List fragments = null; >-// TPFBehaviorImpl implementor = null; >-// BVRLifelineImpl selfLifeline = null; > BVRLifelineImpl lifeline = null; > Iterator iter = null; > List lifelines = null; > Iterator itLifelines = null; >-// TPFTestSuiteImpl testSuite = null; > > switch(eventType) { > case Notification.ADD: > fragment = (BVRInteractionFragmentImpl)notification.getNewValue(); > HyadesUtil.INSTANCE.createSUTInstances(interaction, fragment); >- >- // (Add the self lifeline to the the InteractionFragment's lifeline collection. >- // (Convention -- for MessageEnd, caller lifeline is first, then invoked lifeline.) >-// implementor = (TPFBehaviorImpl)interaction.getBehavior(); >-// selfLifeline = implementor.getSelfLifeline(); >- // Add it to the front of the collection >-// fragment.getLifelines().add(0,selfLifeline); > > if(fragment instanceof ITestInvocation) > { >@@ -130,60 +120,8 @@ > } > > break; >- case Notification.ADD_MANY: >- fragments = (List)notification.getNewValue(); >- iter = fragments.iterator(); >- while (iter.hasNext()) { >- fragment = (BVRInteractionFragmentImpl)iter.next(); >- >- // (Add the self lifeline to the the InteractionFragment's lifeline collection. >- // (Convention -- for MessageEnd, caller lifeline is first, then invoked lifeline.) >-// implementor = (TPFBehaviorImpl)interaction.getBehavior(); >-// selfLifeline = implementor.getSelfLifeline(); >- // Add it to the front of the collection >-// fragment.getLifelines().add(0,selfLifeline); >- >- HyadesUtil.INSTANCE.createSUTInstances(interaction, fragment); >- if(fragment instanceof ITestInvocation) >- { >- ITestSuite test = HyadesUtil.INSTANCE.getTestSuite(((ITestInvocation)fragment).getInvokedTest()); >- ITestSuite owner = (ITestSuite) EcoreUtil.getRootContainer(interaction); >- >- if(owner != null && test != null && !owner.getId().equals(test.getId())) >- { >- if(!HyadesUtil.INSTANCE.containsSuite(owner.getIReferencedSuites(), test)) >- { >- owner.getIReferencedSuites().add(test); >- } >- } >- } >- } >- break; > case Notification.REMOVE: > fragment = (BVRInteractionFragmentImpl)notification.getOldValue(); >- if(fragment instanceof ITestInvocation) >- { >- ITestSuite test = null; >- BVRExecutionOccurrenceImpl executionOccurrenceImpl = (BVRExecutionOccurrenceImpl)fragment; >- if((executionOccurrenceImpl.getOtherBehavior() != null) && (executionOccurrenceImpl.getOtherBehavior().eIsProxy())) >- { >- TPFBehavior behavior = (TPFBehavior)EcoreUtil.resolve(((BVRExecutionOccurrenceImpl)fragment).getOtherBehavior(), interaction.eResource().getResourceSet()); >- if(behavior != null) >- { >- test = HyadesUtil.INSTANCE.getTestSuite((ITest)behavior.getTest()); >- } >- } >- else >- { >- test = HyadesUtil.INSTANCE.getTestSuite(((ITestInvocation)fragment).getInvokedTest()); >- } >- ITestSuite owner = HyadesUtil.INSTANCE.getTestSuite(((TPFBehaviorImpl)interaction.getBehavior()).getOwner()); >- >- if(owner != null && test != null && !hasSuite(interaction.getInteractionFragments(), test, interaction)) >- { >- owner.getIReferencedSuites().remove(test); >- } >- } > > // Iterate over all lifelines in the interaction, and remove > // any references to this interaction fragment from each of them. >@@ -195,79 +133,10 @@ > lifeline.getInteractionFragments().remove(fragment); > } > break; >- case Notification.REMOVE_MANY: >- fragments = (List)notification.getOldValue(); >- iter = fragments.iterator(); >- while (iter.hasNext()) { >- fragment = (BVRInteractionFragmentImpl)iter.next(); >- if(fragment instanceof ITestInvocation) >- { >- ITestSuite test = null; >- if(((BVRExecutionOccurrenceImpl)fragment).getOtherBehavior().eIsProxy()) >- { >- TPFBehavior behavior = (TPFBehavior)EcoreUtil.resolve(((BVRExecutionOccurrenceImpl)fragment).getOtherBehavior(), interaction.eResource().getResourceSet()); >- if(behavior != null) >- { >- test = HyadesUtil.INSTANCE.getTestSuite((ITest)behavior.getTest()); >- } >- } >- else >- { >- test = HyadesUtil.INSTANCE.getTestSuite(((ITestInvocation)fragment).getInvokedTest()); >- } >- ITestSuite owner = HyadesUtil.INSTANCE.getTestSuite(((TPFBehaviorImpl)interaction.getBehavior()).getOwner()); >- >- if(owner != null && test != null && !hasSuite(interaction.getInteractionFragments(), test, interaction)) >- { >- owner.getIReferencedSuites().remove(test); >- } >- } >- >- // Iterate over all lifelines in the interaction, and remove >- // any references to this interaction fragment from each of them. >- lifelines = interaction.getLifelines(); >- itLifelines = lifelines.iterator(); >- while ( itLifelines.hasNext() ) >- { >- lifeline = (BVRLifelineImpl)itLifelines.next(); >- lifeline.getInteractionFragments().remove(fragment); >- } >- } >- break; > } > break; > } > } > } > >- private boolean hasSuite(List otherInteractionFragments, ITestSuite suite, BVRInteraction interaction) >- { >- Iterator iter = otherInteractionFragments.iterator(); >- while(iter.hasNext()) >- { >- BVRInteractionFragmentImpl fragment = (BVRInteractionFragmentImpl)iter.next(); >- if(fragment instanceof BVRExecutionOccurrenceImpl) >- { >- ITestSuite test = null; >- if(((BVRExecutionOccurrenceImpl)fragment).getOtherBehavior().eIsProxy()) >- { >- TPFBehavior behavior = (TPFBehavior)EcoreUtil.resolve(((BVRExecutionOccurrenceImpl)fragment).getOtherBehavior(), interaction.eResource().getResourceSet()); >- if(behavior != null) >- { >- test = HyadesUtil.INSTANCE.getTestSuite((ITest)behavior.getTest()); >- } >- } >- else >- { >- test = HyadesUtil.INSTANCE.getTestSuite(((ITestInvocation)fragment).getInvokedTest()); >- } >- >- if(test.getId().equals(suite.getId())) >- { >- return true; >- } >- } >- } >- return false; >- } > } >Index: src-test/org/eclipse/hyades/models/common/facades/behavioral/impl/FacadeResourceImpl.java >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.models/src-test/org/eclipse/hyades/models/common/facades/behavioral/impl/FacadeResourceImpl.java,v >retrieving revision 1.11 >diff -u -r1.11 FacadeResourceImpl.java >--- src-test/org/eclipse/hyades/models/common/facades/behavioral/impl/FacadeResourceImpl.java 24 Jul 2007 20:58:49 -0000 1.11 >+++ src-test/org/eclipse/hyades/models/common/facades/behavioral/impl/FacadeResourceImpl.java 22 Aug 2007 21:13:21 -0000 >@@ -36,6 +36,7 @@ > import org.eclipse.emf.ecore.xmi.XMLResource; > import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl; > import org.eclipse.hyades.models.common.fragments.Common_Behavior_FragmentsPackage; >+import org.eclipse.hyades.models.common.interactions.Common_Behavior_InteractionsPackage; > import org.eclipse.hyades.models.common.testprofile.Common_TestprofilePackage; > import org.eclipse.hyades.models.common.util.FileUtil; > import org.eclipse.hyades.models.hierarchy.util.HierarchyURIConverterImpl; >@@ -137,6 +138,13 @@ > HyadesCommon_TestprofileAdapterFactory adaptorFactory = new HyadesCommon_TestprofileAdapterFactory(); > adaptorFactory.adapt(arg0, Common_TestprofilePackage.eINSTANCE.getTPFTestComponent()); > } >+ >+ if(arg0.eClass().equals(Common_Behavior_InteractionsPackage.eINSTANCE.getBVRExecutionOccurrence())) >+ { >+ TptpCommon_BVRExecutionOccurrenceAdapterFactory adaptorFactory = new TptpCommon_BVRExecutionOccurrenceAdapterFactory(); >+ adaptorFactory.adapt(arg0, Common_Behavior_InteractionsPackage.eINSTANCE.getBVRExecutionOccurrence()); >+ } >+ > } > > /* (non-Javadoc) >@@ -165,13 +173,13 @@ > options.put(XMLResource.OPTION_RECORD_UNKNOWN_FEATURE, Boolean.TRUE); > > /* try { >- if ( inputStream.available() == 0 ) >+ if ( inputStream.available() == 0 ) >+ return; >+ } >+ catch (IOException ex) >+ { > return; >- } >- catch (IOException ex) >- { >- return; >- } >+ } > */ > if ( inputStream instanceof ZipInputStream ) > { >@@ -183,7 +191,7 @@ > try { > FileOutputStream file = new FileOutputStream(tempResourceContents); > BufferedOutputStream bufFile = new BufferedOutputStream(file); >- >+ > int bufSize = 65536; > byte[] readBuffer = new byte[bufSize]; > int count; >@@ -384,4 +392,6 @@ > protected URIConverter getURIConverter() { > return new HierarchyURIConverterImpl(); > } >+ >+ > } >Index: src-test/org/eclipse/hyades/models/common/facades/behavioral/impl/TptpBVRExecutionOccurrenceAdapter.java >=================================================================== >RCS file: src-test/org/eclipse/hyades/models/common/facades/behavioral/impl/TptpBVRExecutionOccurrenceAdapter.java >diff -N src-test/org/eclipse/hyades/models/common/facades/behavioral/impl/TptpBVRExecutionOccurrenceAdapter.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src-test/org/eclipse/hyades/models/common/facades/behavioral/impl/TptpBVRExecutionOccurrenceAdapter.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,142 @@ >+/********************************************************************** >+ * Copyright (c) 2007 IBM Corporation and others. >+ * 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 >+ * $Id: $ >+ * >+ * Contributors: >+ * IBM - Initial API and implementation >+ **********************************************************************/ >+package org.eclipse.hyades.models.common.facades.behavioral.impl; >+ >+import java.util.ArrayList; >+import java.util.Iterator; >+import java.util.List; >+import java.util.Set; >+ >+import org.eclipse.emf.common.notify.Notification; >+import org.eclipse.emf.common.notify.impl.AdapterImpl; >+import org.eclipse.emf.ecore.EObject; >+import org.eclipse.emf.ecore.resource.Resource; >+import org.eclipse.emf.ecore.util.EcoreUtil; >+import org.eclipse.hyades.models.common.facades.behavioral.IImplementor; >+import org.eclipse.hyades.models.common.facades.behavioral.ITest; >+import org.eclipse.hyades.models.common.facades.behavioral.ITestInvocation; >+import org.eclipse.hyades.models.common.facades.behavioral.ITestSuite; >+import org.eclipse.hyades.models.common.fragments.BVRInteraction; >+import org.eclipse.hyades.models.common.fragments.Common_Behavior_FragmentsPackage; >+import org.eclipse.hyades.models.common.fragments.impl.BVRInteractionImpl; >+import org.eclipse.hyades.models.common.interactions.BVRExecutionOccurrence; >+import org.eclipse.hyades.models.common.interactions.Common_Behavior_InteractionsPackage; >+import org.eclipse.hyades.models.common.interactions.impl.BVRExecutionOccurrenceImpl; >+import org.eclipse.hyades.models.common.interactions.impl.BVRInteractionFragmentImpl; >+import org.eclipse.hyades.models.common.interactions.impl.BVRLifelineImpl; >+import org.eclipse.hyades.models.common.testprofile.TPFBehavior; >+import org.eclipse.hyades.models.common.testprofile.TPFTestSuite; >+import org.eclipse.hyades.models.common.testprofile.impl.TPFBehaviorImpl; >+import org.eclipse.hyades.models.common.testprofile.impl.TPFTestSuiteImpl; >+import org.eclipse.hyades.models.hierarchy.util.ContainmentTraverser; >+ >+ >+/** >+ * @author jtoomey >+ * >+ */ >+public class TptpBVRExecutionOccurrenceAdapter extends AdapterImpl { >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.emf.common.notify.Adapter#isAdapterForType(java.lang.Object) >+ */ >+ public boolean isAdapterForType(Object obj) { >+ if (obj instanceof EObject) >+ { >+ return ((EObject)obj).eClass() == Common_Behavior_InteractionsPackage.eINSTANCE.getBVRExecutionOccurrence(); >+ } >+ return false; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.emf.common.notify.Adapter#notifyChanged(org.eclipse.emf.common.notify.Notification) >+ */ >+ public void notifyChanged(Notification notification) { >+ >+ if (notification.getEventType() == Notification.SET) >+ { >+ if (isLoading((EObject) notification.getNotifier())) >+ return; >+ >+ switch (notification.getFeatureID(BVRExecutionOccurrence.class)) >+ { >+ case Common_Behavior_InteractionsPackage.BVR_EXECUTION_OCCURRENCE__OTHER_BEHAVIOR: >+ BVRExecutionOccurrence executionOccurrence = (BVRExecutionOccurrence) notification.getNotifier(); >+ ITestSuite invokedTestSuite = HyadesUtil.INSTANCE.getTestSuite(executionOccurrence.getInvokedTest()); >+ >+ if (invokedTestSuite == null) { >+ // The invocation is being removed -- clean up the referenced test suite collection >+ ITestSuite notInvokedTestSuite = HyadesUtil.INSTANCE.getTestSuite(((TPFBehavior) notification.getOldValue()).getTest()); >+ ITestSuite notInvoker = (ITestSuite) EcoreUtil.getRootContainer(executionOccurrence); >+ if(notInvoker != notInvokedTestSuite && notInvoker != null && notInvokedTestSuite != null && >+ !invokesTest(notInvoker, notInvokedTestSuite)) >+ { >+ notInvoker.getIReferencedSuites().remove(notInvokedTestSuite); >+ } >+ >+ } >+ break; >+ } >+ } >+ } >+ >+ private boolean isLoading(EObject obj) { >+ Resource res = obj.eResource(); >+ if (res != null && res instanceof FacadeResourceImpl) { >+ return ((FacadeResourceImpl)res).isLoading(); >+ } >+ return false; >+ } >+ >+ private boolean invokesTest(ITestSuite notInvoker, >+ final ITestSuite notInvokedTestSuite) { >+ ArrayList roots = new ArrayList(); >+ roots.add(notInvoker); >+ final MutableBoolean invokes = new MutableBoolean(false); >+ >+ ContainmentTraverser invokesTraverser = new ContainmentTraverser(roots) { >+ protected boolean beforeChildren(EObject element) { >+ if (element instanceof BVRExecutionOccurrence) { >+ BVRExecutionOccurrence executionOccurrence = (BVRExecutionOccurrence) element; >+ ITest test = executionOccurrence.getInvokedTest(); >+ if (test != null) { >+ ITestSuite invokedTestSuite = HyadesUtil.INSTANCE.getTestSuite(test); >+ if (invokedTestSuite.getId() == notInvokedTestSuite.getId()) { >+ invokes.setState(true); >+ return true; >+ } >+ } >+ } >+ return true; >+ } >+ }; >+ >+ invokesTraverser.traverse(); >+ return invokes.getState(); >+ } >+ >+ private class MutableBoolean { >+ private boolean state; >+ >+ public MutableBoolean (boolean state) { >+ this.state = state; >+ } >+ >+ public void setState(boolean state) { >+ this.state = state; >+ } >+ >+ public boolean getState() { >+ return state; >+ } >+ } >+} >Index: src-test/org/eclipse/hyades/models/common/facades/behavioral/impl/TptpCommon_BVRExecutionOccurrenceAdapterFactory.java >=================================================================== >RCS file: src-test/org/eclipse/hyades/models/common/facades/behavioral/impl/TptpCommon_BVRExecutionOccurrenceAdapterFactory.java >diff -N src-test/org/eclipse/hyades/models/common/facades/behavioral/impl/TptpCommon_BVRExecutionOccurrenceAdapterFactory.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src-test/org/eclipse/hyades/models/common/facades/behavioral/impl/TptpCommon_BVRExecutionOccurrenceAdapterFactory.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,34 @@ >+/********************************************************************** >+ * Copyright (c) 2007 IBM Corporation and others. >+ * 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 >+ * $Id: $ >+ * >+ * Contributors: >+ * IBM - Initial API and implementation >+ **********************************************************************/ >+package org.eclipse.hyades.models.common.facades.behavioral.impl; >+ >+import org.eclipse.emf.common.notify.Adapter; >+import org.eclipse.hyades.models.common.interactions.util.Common_Behavior_InteractionsAdapterFactory; >+ >+/** >+ * @author jtoomey >+ * >+ */ >+public class TptpCommon_BVRExecutionOccurrenceAdapterFactory extends >+ Common_Behavior_InteractionsAdapterFactory { >+ >+ public TptpCommon_BVRExecutionOccurrenceAdapterFactory() { >+ super(); >+ } >+ >+ public Adapter createBVRExecutionOccurrenceAdapter() { >+ return new TptpBVRExecutionOccurrenceAdapter(); >+ } >+ >+ >+ >+}
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 113590
: 76714