Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 337277

Summary: Modify object-counting tests to query more selectively
Product: [Modeling] EMF Reporter: Caspar D. <caspar_d>
Component: cdo.coreAssignee: Caspar D. <caspar_d>
Status: CLOSED WONTFIX QA Contact:
Severity: enhancement    
Priority: P3 CC: saulius.tvarijonas
Version: 4.2   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

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.