@Test public void refreshMetadataAfterMoveTest() throws IOException { when(destination.facet(StorageFacet.class)).thenReturn(storageFacet); when(storageFacet.txSupplier()).thenReturn(() -> tx); when(destination.facet(AptHostedFacet.class)).thenReturn(sourceFacet); AptComponentDirector director = new AptComponentDirector(bucketStore, repositoryManager); director.afterMove(Collections.emptyList(), destination); verify(sourceFacet).rebuildIndexes(); }
@Override public void afterMove(final List<Map<String, String>> components, final Repository destination) { destination.facet(StorageFacet.class).txSupplier(); UnitOfWork.begin(destination.facet(StorageFacet.class).txSupplier()); try { AptHostedFacet hostedFacet = destination.facet(AptHostedFacet.class); hostedFacet.rebuildIndexes(); } catch (IOException e) { log.error("Failed to update metadata, repository: {}", destination.getName(), e); throw new UncheckedIOException(e); } finally { UnitOfWork.end(); } }
AptComponentDirector extends ComponentSupport implements ComponentDirector { @Override public void afterMove(final List<Map<String, String>> components, final Repository destination) { destination.facet(StorageFacet.class).txSupplier(); UnitOfWork.begin(destination.facet(StorageFacet.class).txSupplier()); try { AptHostedFacet hostedFacet = destination.facet(AptHostedFacet.class); hostedFacet.rebuildIndexes(); } catch (IOException e) { log.error("Failed to update metadata, repository: {}", destination.getName(), e); throw new UncheckedIOException(e); } finally { UnitOfWork.end(); } } }
AptComponentDirector extends ComponentSupport implements ComponentDirector { @Override public void afterMove(final List<Map<String, String>> components, final Repository destination) { destination.facet(StorageFacet.class).txSupplier(); UnitOfWork.begin(destination.facet(StorageFacet.class).txSupplier()); try { AptHostedFacet hostedFacet = destination.facet(AptHostedFacet.class); hostedFacet.rebuildIndexes(); } catch (IOException e) { log.error("Failed to update metadata, repository: {}", destination.getName(), e); throw new UncheckedIOException(e); } finally { UnitOfWork.end(); } } @Inject  AptComponentDirector(final BucketStore bucketStore,
                              final RepositoryManager repositoryManager); }
AptComponentDirector extends ComponentSupport implements ComponentDirector { @Override public void afterMove(final List<Map<String, String>> components, final Repository destination) { destination.facet(StorageFacet.class).txSupplier(); UnitOfWork.begin(destination.facet(StorageFacet.class).txSupplier()); try { AptHostedFacet hostedFacet = destination.facet(AptHostedFacet.class); hostedFacet.rebuildIndexes(); } catch (IOException e) { log.error("Failed to update metadata, repository: {}", destination.getName(), e); throw new UncheckedIOException(e); } finally { UnitOfWork.end(); } } @Inject  AptComponentDirector(final BucketStore bucketStore,
                              final RepositoryManager repositoryManager); @Override boolean allowMoveTo(final Repository destination); @Override boolean allowMoveTo(final Component component, final Repository destination); @Override boolean allowMoveFrom(final Repository source); @Override void afterMove(final List<Map<String, String>> components, final Repository destination); }
AptComponentDirector extends ComponentSupport implements ComponentDirector { @Override public void afterMove(final List<Map<String, String>> components, final Repository destination) { destination.facet(StorageFacet.class).txSupplier(); UnitOfWork.begin(destination.facet(StorageFacet.class).txSupplier()); try { AptHostedFacet hostedFacet = destination.facet(AptHostedFacet.class); hostedFacet.rebuildIndexes(); } catch (IOException e) { log.error("Failed to update metadata, repository: {}", destination.getName(), e); throw new UncheckedIOException(e); } finally { UnitOfWork.end(); } } @Inject  AptComponentDirector(final BucketStore bucketStore,
                              final RepositoryManager repositoryManager); @Override boolean allowMoveTo(final Repository destination); @Override boolean allowMoveTo(final Component component, final Repository destination); @Override boolean allowMoveFrom(final Repository source); @Override void afterMove(final List<Map<String, String>> components, final Repository destination);  }