Search in sources :

Example 1 with SysoutLogger

use of org.sonatype.aether.test.impl.SysoutLogger in project sonatype-aether by sonatype.

the class AsyncHandlerExceptionTest method testIt.

@Test
public void testIt() throws Exception {
    HttpServer server = new HttpServer();
    server.addResources("/", baseDir.getAbsolutePath());
    server.start();
    try {
        RemoteRepository repo = new RemoteRepository("id", "default", server.getHttpUrl() + "/repo");
        RepositorySystemSession session = new DefaultRepositorySystemSession();
        AsyncRepositoryConnector connector = new AsyncRepositoryConnector(repo, session, new TestFileProcessor(), new SysoutLogger());
        try {
            StubArtifact artifact = new StubArtifact("gid:aid:1.0");
            for (int i = 0; i < 16; i++) {
                System.out.println("RUN #" + i);
                TestFileUtils.delete(baseDir);
                ArtifactDownload download = new ArtifactDownload(artifact, "project", new File(baseDir, "a.jar"), "ignore");
                System.out.println("GET");
                connector.get(Arrays.asList(download), null);
                assertTrue(String.valueOf(download.getException()), download.getException() instanceof ArtifactNotFoundException);
                ArtifactUpload upload = new ArtifactUpload(artifact, new File("pom.xml"));
                System.out.println("PUT");
                connector.put(Arrays.asList(upload), null);
                if (upload.getException() != null) {
                    upload.getException().printStackTrace();
                }
                assertNull(String.valueOf(upload.getException()), upload.getException());
            }
        } finally {
            connector.close();
        }
    } finally {
        server.stop();
    }
}
Also used : RepositorySystemSession(org.sonatype.aether.RepositorySystemSession) DefaultRepositorySystemSession(org.sonatype.aether.util.DefaultRepositorySystemSession) SysoutLogger(org.sonatype.aether.test.impl.SysoutLogger) ArtifactUpload(org.sonatype.aether.spi.connector.ArtifactUpload) RemoteRepository(org.sonatype.aether.repository.RemoteRepository) ArtifactDownload(org.sonatype.aether.spi.connector.ArtifactDownload) DefaultRepositorySystemSession(org.sonatype.aether.util.DefaultRepositorySystemSession) TestFileProcessor(org.sonatype.aether.test.impl.TestFileProcessor) StubArtifact(org.sonatype.aether.test.util.impl.StubArtifact) File(java.io.File) ArtifactNotFoundException(org.sonatype.aether.transfer.ArtifactNotFoundException) Test(org.junit.Test)

Example 2 with SysoutLogger

use of org.sonatype.aether.test.impl.SysoutLogger in project sonatype-aether by sonatype.

the class PlexusSupportTest method testExistenceOfPlexusComponentMetadata.

public void testExistenceOfPlexusComponentMetadata() throws Exception {
    getContainer().addComponent(new SysoutLogger(), Logger.class, null);
    getContainer().addComponent(new TestFileProcessor(), FileProcessor.class, null);
    RepositoryConnectorFactory factory = lookup(RepositoryConnectorFactory.class, "async-http");
    assertNotNull(factory);
    assertEquals(AsyncRepositoryConnectorFactory.class, factory.getClass());
}
Also used : TestFileProcessor(org.sonatype.aether.test.impl.TestFileProcessor) SysoutLogger(org.sonatype.aether.test.impl.SysoutLogger) RepositoryConnectorFactory(org.sonatype.aether.spi.connector.RepositoryConnectorFactory)

Example 3 with SysoutLogger

use of org.sonatype.aether.test.impl.SysoutLogger in project sonatype-aether by sonatype.

the class PlexusSupportTest method testExistenceOfPlexusComponentMetadata.

public void testExistenceOfPlexusComponentMetadata() throws Exception {
    getContainer().addComponent(new SysoutLogger(), Logger.class, null);
    getContainer().addComponent(new TestFileProcessor(), FileProcessor.class, null);
    RepositoryConnectorFactory factory = lookup(RepositoryConnectorFactory.class, "file");
    assertNotNull(factory);
    assertEquals(FileRepositoryConnectorFactory.class, factory.getClass());
}
Also used : TestFileProcessor(org.sonatype.aether.test.impl.TestFileProcessor) SysoutLogger(org.sonatype.aether.test.impl.SysoutLogger) RepositoryConnectorFactory(org.sonatype.aether.spi.connector.RepositoryConnectorFactory)

Example 4 with SysoutLogger

use of org.sonatype.aether.test.impl.SysoutLogger in project sonatype-aether by sonatype.

the class PlexusSupportTest method testExistenceOfPlexusComponentMetadata.

public void testExistenceOfPlexusComponentMetadata() throws Exception {
    getContainer().addComponent(new SysoutLogger(), Logger.class, null);
    getContainer().addComponent(new TestFileProcessor(), FileProcessor.class, null);
    RepositoryConnectorFactory factory = lookup(RepositoryConnectorFactory.class, "wagon");
    assertNotNull(factory);
    assertEquals(WagonRepositoryConnectorFactory.class, factory.getClass());
}
Also used : TestFileProcessor(org.sonatype.aether.test.impl.TestFileProcessor) SysoutLogger(org.sonatype.aether.test.impl.SysoutLogger) RepositoryConnectorFactory(org.sonatype.aether.spi.connector.RepositoryConnectorFactory)

Example 5 with SysoutLogger

use of org.sonatype.aether.test.impl.SysoutLogger in project sonatype-aether by sonatype.

the class ResumeGetTest method before.

@Before
public void before() throws Exception {
    factory = new AsyncRepositoryConnectorFactory(new SysoutLogger(), new TestFileProcessor());
    session = new TestRepositorySystemSession();
    artifact = new StubArtifact("gid", "aid", "classifier", "extension", "version");
    server = new Server(0);
}
Also used : TestRepositorySystemSession(org.sonatype.aether.test.impl.TestRepositorySystemSession) TestFileProcessor(org.sonatype.aether.test.impl.TestFileProcessor) Server(org.eclipse.jetty.server.Server) SysoutLogger(org.sonatype.aether.test.impl.SysoutLogger) StubArtifact(org.sonatype.aether.test.util.impl.StubArtifact) Before(org.junit.Before)

Aggregations

SysoutLogger (org.sonatype.aether.test.impl.SysoutLogger)6 TestFileProcessor (org.sonatype.aether.test.impl.TestFileProcessor)5 RepositoryConnectorFactory (org.sonatype.aether.spi.connector.RepositoryConnectorFactory)3 Before (org.junit.Before)2 TestRepositorySystemSession (org.sonatype.aether.test.impl.TestRepositorySystemSession)2 StubArtifact (org.sonatype.aether.test.util.impl.StubArtifact)2 File (java.io.File)1 Server (org.eclipse.jetty.server.Server)1 Test (org.junit.Test)1 RepositorySystemSession (org.sonatype.aether.RepositorySystemSession)1 RemoteRepository (org.sonatype.aether.repository.RemoteRepository)1 ArtifactDownload (org.sonatype.aether.spi.connector.ArtifactDownload)1 ArtifactUpload (org.sonatype.aether.spi.connector.ArtifactUpload)1 ArtifactNotFoundException (org.sonatype.aether.transfer.ArtifactNotFoundException)1 DefaultRepositorySystemSession (org.sonatype.aether.util.DefaultRepositorySystemSession)1