### Question:
MavenIndexManager implements ArchivaIndexManager { @Override public void scan(final ArchivaIndexingContext context) throws IndexUpdateFailedException { executeUpdateFunction( context, indexingContext -> { DefaultScannerListener listener = new DefaultScannerListener( indexingContext, indexerEngine, true, null ); ScanningRequest request = new ScanningRequest( indexingContext, listener ); ScanningResult result = scanner.scan( request ); if ( result.hasExceptions( ) ) { log.error( "Exceptions occured during index scan of " + context.getId( ) ); result.getExceptions( ).stream( ).map( e -> e.getMessage( ) ).distinct( ).limit( 5 ).forEach( s -> log.error( "Message: " + s ) ); } } ); }  static IndexingContext getMvnContext( ArchivaIndexingContext context ); @Override void pack( final ArchivaIndexingContext context ); @Override void scan(final ArchivaIndexingContext context); @Override void update(final ArchivaIndexingContext context, final boolean fullUpdate); @Override void addArtifactsToIndex( final ArchivaIndexingContext context, final Collection<URI> artifactReference ); @Override void removeArtifactsFromIndex( ArchivaIndexingContext context, Collection<URI> artifactReference ); @Override boolean supportsRepository( RepositoryType type ); @Override ArchivaIndexingContext createContext( Repository repository ); @Override ArchivaIndexingContext reset(ArchivaIndexingContext context); @Override ArchivaIndexingContext move(ArchivaIndexingContext context, Repository repo); @Override void updateLocalIndexPath(Repository repo); @Override ArchivaIndexingContext mergeContexts(Repository destinationRepo, List<ArchivaIndexingContext> contexts,
                                                boolean packIndex);  }### Answer:
@Test public void scan() throws Exception { createTestContext(); Path destDir = repository.getRoot().getFilePath().resolve("org/apache/archiva/archiva-webapp/1.0"); Path srcDir = Paths.get("src/test/maven-search-test-repo/org/apache/archiva/archiva-webapp/1.0"); org.apache.commons.io.FileUtils.copyDirectory(srcDir.toFile(),destDir.toFile()); mavenIndexManager.scan(ctx); IndexingContext mvnCtx = mavenIndexManager.getMvnContext(ctx); String term = "org.apache.archiva"; Query q = new BooleanQuery.Builder().add( queryCreator.constructQuery( MAVEN.GROUP_ID, new UserInputSearchExpression( term ) ), BooleanClause.Occur.SHOULD ).build(); assertEquals(4, mvnCtx.acquireIndexSearcher().count(q)); }