use of org.commonjava.maven.galley.model.ConcreteResource in project indy by Commonjava.
the class MavenMetadataGeneratorTest method setupVersionsStructureWith2Versions.
private StoreResource setupVersionsStructureWith2Versions() throws Exception {
final RemoteRepository store = new RemoteRepository(MAVEN_PKG_KEY, "testrepo", "http://foo.bar");
stores.storeArtifactStore(store, summary, false, true, new EventMetadata());
final String path = "org/group/artifact";
final KeyedLocation location = LocationUtils.toLocation(store);
final StoreResource resource = new StoreResource(location, path);
fixture.getTransport().registerListing(resource, new TestListing(new ListingResult(resource, new String[] { "1.0/", "1.1/" })));
ConcreteResource versionDir = (resource.getChild("1.0/"));
fixture.getTransport().registerListing(versionDir, new TestListing(new ListingResult(versionDir, new String[] { "artifact-1.0.jar", "artifact-1.0.pom" })));
versionDir = (resource.getChild("1.1/"));
fixture.getTransport().registerListing(versionDir, new TestListing(new ListingResult(versionDir, new String[] { "artifact-1.1.jar", "artifact-1.1.pom" })));
return resource;
}
use of org.commonjava.maven.galley.model.ConcreteResource in project indy by Commonjava.
the class MavenMetadataGeneratorTest method generateFileContent_VersionsMetadataWith2Versions.
@Test
public void generateFileContent_VersionsMetadataWith2Versions() throws Exception {
final StoreResource resource = setupVersionsStructureWith2Versions();
final ConcreteResource metadataFile = resource.getChild("maven-metadata.xml");
final Transfer transfer = generator.generateFileContent(stores.getArtifactStore(resource.getStoreKey()), metadataFile.getPath(), new EventMetadata());
assertThat(transfer, notNullValue());
final MavenMetadataView metadata = metadataReader.readMetadata(new SimpleProjectVersionRef("org.group", "artifact", "1.0-SNAPSHOT"), Collections.singletonList(transfer), new EventMetadata());
assertThat(metadata, notNullValue());
final VersioningView versioning = metadata.getVersioning();
final List<SingleVersion> versions = versioning.getVersions();
assertThat(versions, notNullValue());
assertThat(versions.get(0).renderStandard(), equalTo("1.0"));
assertThat(versions.get(1).renderStandard(), equalTo("1.1"));
assertThat(versioning.getReleaseVersion().renderStandard(), equalTo("1.1"));
assertThat(versioning.getLatestVersion().renderStandard(), equalTo("1.1"));
}
use of org.commonjava.maven.galley.model.ConcreteResource in project indy by Commonjava.
the class GroupMetadataFileDeletionTest method run.
@Test
public void run() throws Exception {
File f1 = getPhysicalStorageFile(LocationUtils.toLocation(g1), METADATA_PATH);
File f2 = getPhysicalStorageFile(LocationUtils.toLocation(g2), METADATA_PATH);
// Files exist
assertTrue(f1.exists());
assertTrue(f2.exists());
// Delete cache file from G1, which will delete parent G2's cache too
client.content().deleteCache(g1.getKey(), METADATA_PATH);
sleepAndRunFileGC(1000);
// Verify files were deleted
ConcreteResource r1 = new ConcreteResource(LocationUtils.toLocation(g1), METADATA_PATH);
ConcreteResource r2 = new ConcreteResource(LocationUtils.toLocation(g2), METADATA_PATH);
assertFalse(cacheProvider.exists(r1));
assertFalse(cacheProvider.exists(r2));
// Re-generate
assertContent(g1, METADATA_PATH, METADATA_CONTENT);
}
use of org.commonjava.maven.galley.model.ConcreteResource in project indy by Commonjava.
the class PathMappedController method delete.
public PathMappedDeleteResult delete(String packageType, String type, String name, String path) throws Exception {
ConcreteResource resource = getConcreteResource(packageType, type, name, path);
boolean result = pathMappedCacheProvider.delete(resource);
return new PathMappedDeleteResult(packageType, type, name, path, result);
}
use of org.commonjava.maven.galley.model.ConcreteResource in project indy by Commonjava.
the class PathMappedController method getConcreteResource.
private ConcreteResource getConcreteResource(String packageType, String type, String name, String path) throws Exception {
StoreKey storeKey = new StoreKey(packageType, StoreType.get(type), name);
// we just need a simple keyed location which provides the name to underlying pathMappedCacheProvider
Location location = new SimpleKeyedLocation(storeKey);
return new ConcreteResource(location, path);
}
Aggregations