use of org.sonatype.aether.test.impl.TestFileProcessor 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();
}
}
use of org.sonatype.aether.test.impl.TestFileProcessor 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());
}
use of org.sonatype.aether.test.impl.TestFileProcessor 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());
}
use of org.sonatype.aether.test.impl.TestFileProcessor 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());
}
use of org.sonatype.aether.test.impl.TestFileProcessor in project sonatype-aether by sonatype.
the class AsyncConnectorSuiteConfiguration method before.
@Override
@Before
public void before() throws Exception {
super.before();
this.factory = new AsyncRepositoryConnectorFactory(NullLogger.INSTANCE, new TestFileProcessor());
this.session = new TestRepositorySystemSession();
this.repository = new RemoteRepository("async-test-repo", "default", url("repo"));
this.artifact = new StubArtifact("gid", "aid", "classifier", "extension", "version", null);
this.metadata = new StubMetadata("gid", "aid", "version", "maven-metadata.xml", Metadata.Nature.RELEASE_OR_SNAPSHOT, null);
connector = null;
}
Aggregations