// add repo content
fillInRepo();
// our patients, group and one member
final GroupRepository group = (GroupRepository) repositoryRegistry.getRepository("public");
final Repository member = repositoryRegistry.getRepository("snapshots");
// reindex
indexerManager.reindexAllRepositories(null, true);
// Note: public by default contains snapshots repository as member
// Snapshots repository is the only one that contains GroupID "org.sonatype.plexus".
// Meaning, the presence of this search (is in result set or not) is used
// to validate the group member changes.
// assure context does exists (if Igor comments out few lines or so, as MI will plainly swallow targeted search
// against nonexistent context!)
Assert.assertNotNull(((DefaultIndexerManager) indexerManager).getRepositoryIndexContext(group));
Assert.assertNotNull(((DefaultIndexerManager) indexerManager).getRepositoryIndexContext(member));
// do searches
searchFor("org.sonatype.plexus", 1, member.getId()); // is in this repo
searchFor("org.sonatype.plexus", 1, group.getId()); // snapshots is member of public
// reconfigure group member: make it non-indexable
member.setSearchable(false);
member.setIndexable(false);
nexusConfiguration().saveConfiguration();
waitForTasksToStop();
wairForAsyncEventsToCalmDown();
// assure context does exists (if Igor comments out few lines or so, as MI will plainly swallow targeted search
// against nonexistent context!)
Assert.assertNotNull(((DefaultIndexerManager) indexerManager).getRepositoryIndexContext(group));
Assert.assertNull(((DefaultIndexerManager) indexerManager).getRepositoryIndexContext(member));
// do searches
searchFor("org.sonatype.plexus", 0, member.getId()); // is in this repo
searchFor("org.sonatype.plexus", 0, group.getId()); // snapshots is not member of public
// reconfigure group: add apache-snapshots
member.setSearchable(true);
member.setIndexable(true);
nexusConfiguration().saveConfiguration();
waitForTasksToStop();
wairForAsyncEventsToCalmDown();
// assure context does exists (if Igor comments out few lines or so, as MI will plainly swallow targeted search
// against nonexistent context!)
Assert.assertNotNull(((DefaultIndexerManager) indexerManager).getRepositoryIndexContext(group));
Assert.assertNotNull(((DefaultIndexerManager) indexerManager).getRepositoryIndexContext(member));
// do searches
searchFor("org.sonatype.plexus", 1, member.getId()); // is in this repo
searchFor("org.sonatype.plexus", 1, group.getId()); // snapshots is not member of public
}