Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 337277 - Modify object-counting tests to query more selectively
Summary: Modify object-counting tests to query more selectively
Status: CLOSED WONTFIX
Alias: None
Product: EMF
Classification: Modeling
Component: cdo.core (show other bugs)
Version: 4.2   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Caspar D. CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-16 01:46 EST by Caspar D. CLA
Modified: 2012-12-30 10:47 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Caspar D. CLA 2011-02-16 01:46:31 EST
We have a handful of tests that count certain objects in the repo in
order to assert that the test passes. Some examples:

PartialCommitTest.java
ResourceTest.java
PushTransactionTest.java
BranchingTest.java
InvalidationTest.java
CommitInfoTest.java
PackageRegistryTest.java

What these tests do, is typically something like:
1. add some stuff to a resource
2. perform some operations
3. query the *entire* repo for some of "the stuff"
4. verify that the number of "stuff" is as expected

The implicit assumption in (3) is that the repo/store was empty before
the test, for otherwise the number of objects found cannot be
predicted. This makes it impossible for the test to work with an
existing store. (And it happens to be my aim to make this possible for
as many tests as we can, in order to improve test performance.)

Therefore, I'd like to modify these tests where possible to count more
selectively, e.g. to query only into the test-specific resource
instead of the entire repo.

In some cases, the test logic might get too complicated if I change
them in this way. For such cases, I'd like to introduce a method
ConfigTest.needsCleanRepository(), that the test class can override to
return true, so that the test infra knows not to re-use an existing
store, if one is present.
Comment 1 Caspar D. CLA 2011-02-16 06:11:15 EST
> In some cases, the test logic might get too complicated if I change
> them in this way. For such cases, I'd like to introduce a method
> ConfigTest.needsCleanRepository(), that the test class can override to
> return true, so that the test infra knows not to re-use an existing
> store, if one is present.

On second thought, an annotation on the method is obviously better,
as the config is set up and torn down per method.
Comment 2 Caspar D. CLA 2011-02-27 22:43:56 EST
Removed 'blocks' relationship with bug 335653
Comment 3 Eike Stepper CLA 2011-06-23 03:56:46 EDT
Moving all open enhancement requests to 4.1
Comment 4 Eike Stepper CLA 2012-08-14 22:54:57 EDT
Moving all open issues to 4.2. Open bugs can be ported to 4.1 maintenance after they've been fixed in master.
Comment 5 Eike Stepper CLA 2012-12-30 10:47:03 EST
Closing because of no activity on this bug.