use of org.sonatype.aether.test.impl.TestLocalRepositoryManager in project sonatype-aether by sonatype.
the class DefaultMetadataResolverTest method testResolve.
@Test
public void testResolve() throws IOException {
connector.setExpectGet(metadata);
// prepare "download"
File file = new File(session.getLocalRepository().getBasedir(), session.getLocalRepositoryManager().getPathForRemoteMetadata(metadata, repository, ""));
TestFileUtils.write(file.getAbsolutePath(), file);
MetadataRequest request = new MetadataRequest(metadata, repository, "");
List<MetadataResult> results = resolver.resolveMetadata(session, Arrays.asList(request));
assertEquals(1, results.size());
MetadataResult result = results.get(0);
assertSame(request, result.getRequest());
assertNull(result.getException());
assertNotNull(result.getMetadata());
assertNotNull(result.getMetadata().getFile());
assertEquals(file, result.getMetadata().getFile());
assertEquals(metadata, result.getMetadata().setFile(null));
connector.assertSeenExpected();
Set<Metadata> metadataRegistration = ((TestLocalRepositoryManager) session.getLocalRepositoryManager()).getMetadataRegistration();
assertTrue(metadataRegistration.contains(metadata));
assertEquals(1, metadataRegistration.size());
}
Aggregations