Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 256283 - [composite repo] CompositeArtifactRepository should be able to verify its sanity
Summary: [composite repo] CompositeArtifactRepository should be able to verify its sanity
Status: RESOLVED FIXED
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: p2 (show other bugs)
Version: 3.5   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.5 M4   Edit
Assignee: P2 Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-11-24 09:39 EST by Andrew Cattle CLA
Modified: 2008-12-04 16:56 EST (History)
1 user (show)

See Also:


Attachments
Adds sanity checking to CompositeArtifactRepository (14.01 KB, patch)
2008-11-24 09:39 EST, Andrew Cattle CLA
no flags Details | Diff
Updates previous patch to reflect recent changes in HEAD. Adds test cases. (16.98 KB, patch)
2008-12-01 08:16 EST, Andrew Cattle CLA
no flags Details | Diff
Reflects latest changes in HEAD (10.48 KB, patch)
2008-12-03 10:49 EST, Andrew Cattle CLA
dj.houghton: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Cattle CLA 2008-11-24 09:39:36 EST
Created attachment 118591 [details]
Adds sanity checking to CompositeArtifactRepository

Composite repositories should have the ability to verify if they are in a sane state (all artifacts with the same name and version are the same bytes).

I've included a patch that moves the artifactComparator retrieval code out of mirroring and into a new stand alone file. I've also implemented two new methods for CompositeArtifactRepository:

addChild(URI, String) which performs a sanity check using a comparator with the ID specified by the string and returns a boolean "true" and adds the UR if it does not conflict with existing children. Otherwise the URI is not added and the method returns false.

sanityCheck(String) which checks the existing children to ensure it does not conflict with any other children. Returns true is repository is sonsistent, false otherwise.
Comment 1 DJ Houghton CLA 2008-11-24 17:09:42 EST
One initial comment is that perhaps the sanity check should be called #validate or something like that.

Comment 2 Andrew Cattle CLA 2008-11-25 09:10:23 EST
I think you have a point. I also found a rather obvious error in my code that, quite frankly, I shouldn't have allowed to get this far.

For now I will change the method name to validate and resubmit a patch when we settle on a method name.
Comment 3 Andrew Cattle CLA 2008-11-27 09:00:12 EST
I released a patch for Bug 255678 that contains some of the code from my first patch on this bug. Because of this I am unable to resubmit this patch until my patch for Bug 255678 is released.
Comment 4 Andrew Cattle CLA 2008-12-01 08:16:09 EST
Created attachment 119137 [details]
Updates previous patch to reflect recent changes in HEAD. Adds test cases.
Comment 5 Andrew Cattle CLA 2008-12-02 13:46:26 EST
This patch contains some changes identical to those also included in a patch I submitted for Bug 255691. If this causes merge errors I can resubmit a patch once Bug 255691 is released.
Comment 6 Andrew Cattle CLA 2008-12-02 14:05:35 EST
(In reply to comment #5)
> This patch contains some changes identical to those also included in a patch I
> submitted for Bug 255691. If this causes merge errors I can resubmit a patch
> once Bug 255691 is released.
> 

It has been brought to my attention the latest patch as of writing creates compilation errors due to some left over code from a Bug 255691 patch that mistakenly was included. Because this code has since been changed in my latest patch for that bug, I will resubmit once my queue thins out.

Sorry for any inconvenience.
Comment 7 Andrew Cattle CLA 2008-12-03 10:49:20 EST
Created attachment 119390 [details]
Reflects latest changes in HEAD

Hopefully this will resolve the issues with applying the previous patch.
Comment 8 Andrew Niefer CLA 2008-12-04 16:43:47 EST
At first I released this with a change to use a HashMap to avoid the innermost for loop.  But then I changed my mind because we are only likely to have 1 or 2 descriptors per key, so that would not have been worth the effort.

Actual changes were minor, plus some string externalizations.