Source:
public void testValidate() throws Exception { IArtifactKey dupKey = PublisherHelper.createBinaryArtifactKey("testKeyId", Version.create("1.2.3")); File artifact1 = getTestData("0.0", "/testData/mirror/mirrorSourceRepo1 with space/artifacts.xml"); File artifact2 = getTestData("0.0", "/testData/mirror/mirrorSourceRepo2/artifacts.xml"); IArtifactDescriptor descriptor1 = PublisherHelper.createArtifactDescriptor(dupKey, artifact1); IArtifactDescriptor descriptor2 = PublisherHelper.createArtifactDescriptor(dupKey, artifact2); assertEquals("Ensuring Descriptors are the same", descriptor1, descriptor2); Assert.assertNotEquals("Ensuring MD5 values are different", descriptor1.getProperty(IArtifactDescriptor.DOWNLOAD_MD5), descriptor2.getProperty(IArtifactDescriptor.DOWNLOAD_MD5)); File repo1Location = getTestFolder(getUniqueString()); File repo2Location = getTestFolder(getUniqueString()); File compRepoLocation = getTestFolder(getUniqueString()); IArtifactRepository repo1 = null; IArtifactRepository repo2 = null; CompositeArtifactRepository compRepo = null; try { repo1 = getArtifactRepositoryManager().createRepository(repo1Location.toURI(), "Repo 1", IArtifactRepositoryManager.TYPE_SIMPLE_REPOSITORY, null); repo1.addDescriptor(descriptor1); repo2 = getArtifactRepositoryManager().createRepository(repo2Location.toURI(), "Repo 2", IArtifactRepositoryManager.TYPE_SIMPLE_REPOSITORY, null); repo2.addDescriptor(descriptor2); compRepo = (CompositeArtifactRepository) getArtifactRepositoryManager().createRepository(compRepoLocation.toURI(), "Composite Repo", IArtifactRepositoryManager.TYPE_COMPOSITE_REPOSITORY, null); getArtifactRepositoryManager().removeRepository(repo1Location.toURI()); getArtifactRepositoryManager().removeRepository(repo2Location.toURI()); } catch (ProvisionException e) { fail("Error creating repositories", e); } compRepo.addChild(repo1Location.toURI()); compRepo.addChild(repo2Location.toURI()); ArtifactRepositoryValidator validator = new ArtifactRepositoryValidator(MD5ArtifactComparator.MD5_COMPARATOR_ID); assertFalse("Running verify on invalid repository", validator.validateComposite(compRepo).isOK()); }

Target:
public void testValidate() throws Exception { IArtifactKey dupKey = PublisherHelper.createBinaryArtifactKey("testKeyId", Version.create("1.2.3")); File artifact1 = getTestData("0.0", "/testData/mirror/mirrorSourceRepo1 with space/artifacts.xml"); File artifact2 = getTestData("0.0", "/testData/mirror/mirrorSourceRepo2/artifacts.xml"); IArtifactDescriptor descriptor1 = PublisherHelper.createArtifactDescriptor(dupKey, artifact1); IArtifactDescriptor descriptor2 = PublisherHelper.createArtifactDescriptor(dupKey, artifact2); assertEquals("Ensuring Descriptors are the same", descriptor1, descriptor2); assertNotEquals("Ensuring MD5 values are different", descriptor1.getProperty(IArtifactDescriptor.DOWNLOAD_MD5), descriptor2.getProperty(IArtifactDescriptor.DOWNLOAD_MD5)); File repo1Location = getTestFolder(getUniqueString()); File repo2Location = getTestFolder(getUniqueString()); File compRepoLocation = getTestFolder(getUniqueString()); IArtifactRepository repo1 = null; IArtifactRepository repo2 = null; CompositeArtifactRepository compRepo = null; try { repo1 = getArtifactRepositoryManager().createRepository(repo1Location.toURI(), "Repo 1", IArtifactRepositoryManager.TYPE_SIMPLE_REPOSITORY, null); repo1.addDescriptor(descriptor1); repo2 = getArtifactRepositoryManager().createRepository(repo2Location.toURI(), "Repo 2", IArtifactRepositoryManager.TYPE_SIMPLE_REPOSITORY, null); repo2.addDescriptor(descriptor2); compRepo = (CompositeArtifactRepository) getArtifactRepositoryManager().createRepository(compRepoLocation.toURI(), "Composite Repo", IArtifactRepositoryManager.TYPE_COMPOSITE_REPOSITORY, null); getArtifactRepositoryManager().removeRepository(repo1Location.toURI()); getArtifactRepositoryManager().removeRepository(repo2Location.toURI()); } catch (ProvisionException e) { fail("Error creating repositories", e); } compRepo.addChild(repo1Location.toURI()); compRepo.addChild(repo2Location.toURI()); ArtifactRepositoryValidator validator = new ArtifactRepositoryValidator(MD5ArtifactComparator.MD5_COMPARATOR_ID); assertFalse("Running verify on invalid repository", validator.validateComposite(compRepo).isOK()); }