|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjunit.framework.Assert
org.eclipse.core.tests.resources.ResourceDeltaVerifier
public class ResourceDeltaVerifier
Verifies the state of an IResourceDelta by comparing
it with a client's expectations. The delta is considered valid
if it contains exactly the set of changes expected by the client,
and parents of those changes.
Example usage:
ResourceDeltaVerifier verifier = new ResourceDeltaComparer();
IResourceChangeListener listener = (IResourceChangeListener)verifier;
IWorkspace workspace = ResourcesPlugin.getWorkspace();
IProject proj = workspace.getRoot().getProject("MyProject");
// Assume the project is accessible
workspace.addResourceChangeListener(listener);
verifier.addExpectedChange(proj, REMOVED, 0);
try {
proj.delete(true, true, null);
} catch(CoreException e){
fail("1.0", e);
}
assert("2.0 "+verifier.getMessage(), verifier.isDeltaValid());
| Constructor Summary | |
|---|---|
ResourceDeltaVerifier()
|
|
| Method Summary | |
|---|---|
void |
addExpectedChange(IResource[] resources,
int status,
int changeFlags)
|
void |
addExpectedChange(IResource resource,
int status,
int changeFlags)
Signals to the comparer that the given resource is expected to change in the specified way. |
void |
addExpectedChange(IResource resource,
int status,
int changeFlags,
org.eclipse.core.runtime.IPath movedFromPath,
org.eclipse.core.runtime.IPath movedToPath)
Signals to the comparer that the given resource is expected to change in the specified way. |
void |
addExpectedChange(IResource resource,
IResource topLevelParent,
int status,
int changeFlags)
Signals to the comparer that the given resource is expected to change in the specified way. |
void |
addExpectedChange(IResource resource,
IResource topLevelParent,
int status,
int changeFlags,
org.eclipse.core.runtime.IPath movedFromPath,
org.eclipse.core.runtime.IPath movedToPath)
Signals to the comparer that the given resource is expected to change in the specified way. |
void |
addExpectedDeletion(IResource resource)
Adds an expected deletion for the given resource and all children. |
java.lang.String |
getMessage()
Returns a message that describes the result of the resource delta verification checks. |
boolean |
hasBeenNotified()
Returns true if this verifier has received a delta notification since the last reset, and false otherwise. |
boolean |
hasExpectedChanges()
Returns true if this verifier currently has an expected changes, and false otherwise. |
boolean |
isDeltaValid()
Returns whether the resource delta passed all verification checks. |
static void |
main(java.lang.String[] args)
Tests message formatting. |
void |
reset()
Resets the listener to its initial state. |
void |
resourceChanged(IResourceChangeEvent e)
Part of the IResourceChangedListener interface. |
void |
verifyDelta(IResourceDelta delta)
Compares the given delta with the expected changes. |
| Methods inherited from class junit.framework.Assert |
|---|
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ResourceDeltaVerifier()
| Method Detail |
|---|
public void addExpectedChange(IResource[] resources,
int status,
int changeFlags)
addExpectedChange(org.eclipse.core.resources.IResource[], int, int)public void addExpectedDeletion(IResource resource)
public void addExpectedChange(IResource resource,
int status,
int changeFlags)
resource - the resource that is expected to changestatus - the type of change (ADDED, REMOVED, CHANGED)changeFlags - the type of change (CONTENT, SYNC, etc)IResourceConstants
public void addExpectedChange(IResource resource,
int status,
int changeFlags,
org.eclipse.core.runtime.IPath movedFromPath,
org.eclipse.core.runtime.IPath movedToPath)
resource - the resource that is expected to changestatus - the type of change (ADDED, REMOVED, CHANGED)changeFlags - the type of change (CONTENT, SYNC, etc)movedPath - or nullIResourceConstants
public void addExpectedChange(IResource resource,
IResource topLevelParent,
int status,
int changeFlags)
resource - the resource that is expected to changetopLevelParent - Do not added expected changes above this parentstatus - the type of change (ADDED, REMOVED, CHANGED)changeFlags - the type of change (CONTENT, SYNC, etc)movedPath - or nullIResourceConstants
public void addExpectedChange(IResource resource,
IResource topLevelParent,
int status,
int changeFlags,
org.eclipse.core.runtime.IPath movedFromPath,
org.eclipse.core.runtime.IPath movedToPath)
resource - the resource that is expected to changetopLevelParent - Do not added expected changes above this parentstatus - the type of change (ADDED, REMOVED, CHANGED)changeFlags - the type of change (CONTENT, SYNC, etc)movedPath - or nullIResourceConstantspublic java.lang.String getMessage()
public boolean hasBeenNotified()
public boolean hasExpectedChanges()
public boolean isDeltaValid()
public static void main(java.lang.String[] args)
public void reset()
public void resourceChanged(IResourceChangeEvent e)
IResourceChangedListener interface.
resourceChanged in interface IResourceChangeListenere - the resource change eventIResourceChangedListenerpublic void verifyDelta(IResourceDelta delta)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||