Search in sources :

Example 1 with RepositoryEvent

use of org.sonatype.aether.RepositoryEvent in project sonatype-aether by sonatype.

the class DefaultDeployerTest method testSuccessfulMetadataEvents.

@Test
public void testSuccessfulMetadataEvents() throws DeploymentException {
    request.addMetadata(metadata);
    deployer.deploy(session, request);
    List<EventWrapper> events = listener.getEvents();
    assertEquals(2, events.size());
    EventWrapper wrapper = events.get(0);
    assertEquals(METADATA_DEPLOYING, wrapper.getType());
    RepositoryEvent event = wrapper.getEvent();
    assertEquals(metadata, event.getMetadata());
    assertNull(event.getException());
    wrapper = events.get(1);
    assertEquals(METADATA_DEPLOYED, wrapper.getType());
    event = wrapper.getEvent();
    assertEquals(metadata, event.getMetadata());
    assertNull(event.getException());
}
Also used : RepositoryEvent(org.sonatype.aether.RepositoryEvent) EventWrapper(org.sonatype.aether.test.impl.RecordingRepositoryListener.EventWrapper) Test(org.junit.Test)

Example 2 with RepositoryEvent

use of org.sonatype.aether.RepositoryEvent in project sonatype-aether by sonatype.

the class DefaultInstallerTest method checkEvents.

private void checkEvents(String msg, Artifact artifact, boolean failed) {
    List<EventWrapper> events = listener.getEvents();
    assertEquals(msg, 2, events.size());
    EventWrapper wrapper = events.get(0);
    assertEquals(msg, ARTIFACT_INSTALLING, wrapper.getType());
    RepositoryEvent event = wrapper.getEvent();
    assertEquals(msg, artifact, event.getArtifact());
    assertNull(msg, event.getException());
    wrapper = events.get(1);
    assertEquals(msg, ARTIFACT_INSTALLED, wrapper.getType());
    event = wrapper.getEvent();
    assertEquals(msg, artifact, event.getArtifact());
    if (failed) {
        assertNotNull(msg + " > expected exception", event.getException());
    } else {
        assertNull(msg + " > " + event.getException(), event.getException());
    }
}
Also used : RepositoryEvent(org.sonatype.aether.RepositoryEvent) EventWrapper(org.sonatype.aether.test.impl.RecordingRepositoryListener.EventWrapper)

Example 3 with RepositoryEvent

use of org.sonatype.aether.RepositoryEvent in project sonatype-aether by sonatype.

the class DefaultInstallerTest method checkEvents.

private void checkEvents(String msg, Metadata metadata, boolean failed) {
    List<EventWrapper> events = listener.getEvents();
    assertEquals(msg, 2, events.size());
    EventWrapper wrapper = events.get(0);
    assertEquals(msg, METADATA_INSTALLING, wrapper.getType());
    RepositoryEvent event = wrapper.getEvent();
    assertEquals(msg, metadata, event.getMetadata());
    assertNull(msg, event.getException());
    wrapper = events.get(1);
    assertEquals(msg, METADATA_INSTALLED, wrapper.getType());
    event = wrapper.getEvent();
    assertEquals(msg, metadata, event.getMetadata());
    if (failed) {
        assertNotNull(msg, event.getException());
    } else {
        assertNull(msg, event.getException());
    }
}
Also used : RepositoryEvent(org.sonatype.aether.RepositoryEvent) EventWrapper(org.sonatype.aether.test.impl.RecordingRepositoryListener.EventWrapper)

Example 4 with RepositoryEvent

use of org.sonatype.aether.RepositoryEvent in project sonatype-aether by sonatype.

the class DefaultDeployerTest method testSuccessfulArtifactEvents.

@Test
public void testSuccessfulArtifactEvents() throws DeploymentException {
    request.addArtifact(artifact);
    deployer.deploy(session, request);
    List<EventWrapper> events = listener.getEvents();
    assertEquals(2, events.size());
    EventWrapper wrapper = events.get(0);
    assertEquals(ARTIFACT_DEPLOYING, wrapper.getType());
    RepositoryEvent event = wrapper.getEvent();
    assertEquals(artifact, event.getArtifact());
    assertNull(event.getException());
    wrapper = events.get(1);
    assertEquals(ARTIFACT_DEPLOYED, wrapper.getType());
    event = wrapper.getEvent();
    assertEquals(artifact, event.getArtifact());
    assertNull(event.getException());
}
Also used : RepositoryEvent(org.sonatype.aether.RepositoryEvent) EventWrapper(org.sonatype.aether.test.impl.RecordingRepositoryListener.EventWrapper) Test(org.junit.Test)

Aggregations

RepositoryEvent (org.sonatype.aether.RepositoryEvent)4 EventWrapper (org.sonatype.aether.test.impl.RecordingRepositoryListener.EventWrapper)4 Test (org.junit.Test)2