use of org.commonjava.indy.change.event.ArtifactStorePreUpdateEvent in project indy by Commonjava.
the class ImpliedRepoMaintainerTest method dontRemoveImpliedRepoWhenRepoRemovedFromGroup.
@Test
public void dontRemoveImpliedRepoWhenRepoRemovedFromGroup() throws Exception {
final Group g = new Group(MAVEN_PKG_KEY, "test");
storeDataManager.storeArtifactStore(g, summary, false, true, new EventMetadata());
final RemoteRepository repo1 = new RemoteRepository(MAVEN_PKG_KEY, "one", "http://www.foo.com/repo");
storeDataManager.storeArtifactStore(repo1, summary, false, true, new EventMetadata());
final RemoteRepository repo2 = new RemoteRepository(MAVEN_PKG_KEY, "one", "http://www.foo.com/repo");
storeDataManager.storeArtifactStore(repo2, summary, false, true, new EventMetadata());
metadataManager.addImpliedMetadata(repo1, Collections.singletonList(repo2));
// Simulates removal of repo1...odd, I know, but since they post-process these updates, it's what the
// event observers would see.
g.addConstituent(repo2);
final ArtifactStorePreUpdateEvent event = new ArtifactStorePreUpdateEvent(ArtifactStoreUpdateType.UPDATE, new EventMetadata(), Collections.singletonMap(g.copyOf(), g));
maintainer.updateImpliedStores(event);
assertThat(g.getConstituents().contains(repo2.getKey()), equalTo(true));
}
use of org.commonjava.indy.change.event.ArtifactStorePreUpdateEvent in project indy by Commonjava.
the class ImpliedRepoMaintainerTest method addImpliedRepoWhenRepoAddedToGroup.
@Test
public void addImpliedRepoWhenRepoAddedToGroup() throws Exception {
final Group g = new Group(MAVEN_PKG_KEY, "test");
storeDataManager.storeArtifactStore(g, summary, false, true, new EventMetadata());
final RemoteRepository repo1 = new RemoteRepository(MAVEN_PKG_KEY, "one", "http://www.foo.com/repo");
storeDataManager.storeArtifactStore(repo1, summary, false, true, new EventMetadata());
final RemoteRepository repo2 = new RemoteRepository(MAVEN_PKG_KEY, "one", "http://www.foo.com/repo");
storeDataManager.storeArtifactStore(repo2, summary, false, true, new EventMetadata());
metadataManager.addImpliedMetadata(repo1, Collections.singletonList(repo2));
g.addConstituent(repo1);
final ArtifactStorePreUpdateEvent event = new ArtifactStorePreUpdateEvent(ArtifactStoreUpdateType.UPDATE, new EventMetadata(), Collections.singletonMap(g.copyOf(), g));
maintainer.updateImpliedStores(event);
assertThat(g.getConstituents().contains(repo2.getKey()), equalTo(true));
}
use of org.commonjava.indy.change.event.ArtifactStorePreUpdateEvent in project indy by Commonjava.
the class DefaultStoreEventDispatcher method updating.
@Override
public void updating(final ArtifactStoreUpdateType type, final EventMetadata eventMetadata, final Map<ArtifactStore, ArtifactStore> changeMap) {
// logger.debug( "Trying to fire pre-update event for: {}", new JoinString( ", ", stores ) );
if (updatePreEvent != null) {
// executor.execute( () -> {
final ArtifactStorePreUpdateEvent event = new ArtifactStorePreUpdateEvent(type, eventMetadata, changeMap);
// logger.debug( "Firing pre-update event: {} (for: {}) via:\n {}", event, new JoinString( ", ", stores ),
// new JoinString( "\n ", Thread.currentThread()
// .getStackTrace() ) );
updatePreEvent.fire(event);
// } );
}
}
Aggregations