Search in sources :

Example 71 with EventMetadata

use of org.commonjava.maven.galley.event.EventMetadata in project indy by Commonjava.

the class NPMContentAccessResource method doCreate.

@ApiOperation("Store NPM artifact content under the given artifact store (type/name), packageName and versionTarball (/version or /-/tarball).")
@ApiResponses({ @ApiResponse(code = 201, message = "Content was stored successfully"), @ApiResponse(code = 400, message = "No appropriate storage location was found in the specified store (this store, or a member if a group is specified).") })
@PUT
@Path("/{packageName}/{versionTarball: (.*)}")
public Response doCreate(@ApiParam(allowableValues = "hosted,group,remote", required = true) @PathParam("type") final String type, @ApiParam(required = true) @PathParam("name") final String name, @PathParam("packageName") final String packageName, @PathParam("versionTarball") final String versionTarball, @Context final UriInfo uriInfo, @Context final HttpServletRequest request) {
    final String path = Paths.get(packageName, versionTarball).toString();
    Class cls = NPMContentAccessResource.class;
    return handler.doCreate(NPM_PKG_KEY, type, name, path, request, new EventMetadata(), () -> uriInfo.getBaseUriBuilder().path(cls).path(path).build(NPM_PKG_KEY, type, name));
}
Also used : EventMetadata(org.commonjava.maven.galley.event.EventMetadata) Path(javax.ws.rs.Path) ApiOperation(io.swagger.annotations.ApiOperation) ApiResponses(io.swagger.annotations.ApiResponses) PUT(javax.ws.rs.PUT)

Example 72 with EventMetadata

use of org.commonjava.maven.galley.event.EventMetadata in project galley by Commonjava.

the class Transfer method createFile.

public void createFile() throws IOException {
    provider.waitForWriteUnlock(resource);
    if (decorator != null) {
        decorator.decorateCreateFile(this, new EventMetadata());
    }
    provider.createFile(resource);
}
Also used : EventMetadata(org.commonjava.maven.galley.event.EventMetadata)

Example 73 with EventMetadata

use of org.commonjava.maven.galley.event.EventMetadata in project galley by Commonjava.

the class VersionResolverImplTest method resolveSnapshot_FirstMatch_TwoLocationList_TwoSingletonSnapshotList_LatestVersionStrategy.

@Test
public void resolveSnapshot_FirstMatch_TwoLocationList_TwoSingletonSnapshotList_LatestVersionStrategy() throws Exception {
    final String testResource = "2-snapshots-2-locations/maven-metadata-1.xml";
    final String testResource2 = "2-snapshots-2-locations/maven-metadata-2.xml";
    final ProjectVersionRef ref = new SimpleProjectVersionRef("org.group2", "artifact", "1.0-SNAPSHOT");
    final String path = fixture.snapshotMetadataPath(ref);
    fixture.getTransport().registerDownload(new ConcreteResource(LOCATION, path), new TestDownload(ROOT + testResource));
    fixture.getTransport().registerDownload(new ConcreteResource(LOCATION2, path), new TestDownload(ROOT + testResource2));
    final ProjectVersionRef result = fixture.getVersionResolver().resolveFirstMatchVariableVersion(TWO_LOCATIONS, ref, LatestVersionSelectionStrategy.INSTANCE, new EventMetadata());
    assertThat(result, notNullValue());
    // newest snapshot is in the SECOND location, but we're using first-match semantics here.
    assertThat(result.getVersionString(), equalTo("1.0-20140604.101244-1"));
}
Also used : TestDownload(org.commonjava.maven.galley.testing.core.transport.job.TestDownload) ProjectVersionRef(org.commonjava.maven.atlas.ident.ref.ProjectVersionRef) SimpleProjectVersionRef(org.commonjava.maven.atlas.ident.ref.SimpleProjectVersionRef) ConcreteResource(org.commonjava.maven.galley.model.ConcreteResource) SimpleProjectVersionRef(org.commonjava.maven.atlas.ident.ref.SimpleProjectVersionRef) EventMetadata(org.commonjava.maven.galley.event.EventMetadata) Test(org.junit.Test)

Example 74 with EventMetadata

use of org.commonjava.maven.galley.event.EventMetadata in project galley by Commonjava.

the class VersionResolverImplTest method resolveSnapshot_FirstMatch_SingletonLocationList_TwoSnapshotList_LatestVersionStrategy.

@Test
public void resolveSnapshot_FirstMatch_SingletonLocationList_TwoSnapshotList_LatestVersionStrategy() throws Exception {
    final String testResource = "2-snapshots-1-location/two-snapshots.xml";
    final ProjectVersionRef ref = new SimpleProjectVersionRef("org.group2", "artifact", "1.0-SNAPSHOT");
    final ConcreteResource cr = new ConcreteResource(LOCATION, fixture.snapshotMetadataPath(ref));
    final TestDownload download = new TestDownload(ROOT + testResource);
    fixture.getTransport().registerDownload(cr, download);
    final ProjectVersionRef result = fixture.getVersionResolver().resolveFirstMatchVariableVersion(ONE_LOCATION, ref, LatestVersionSelectionStrategy.INSTANCE, new EventMetadata());
    assertThat(result, notNullValue());
    assertThat(result.getVersionString(), equalTo("1.0-20140604.102909-1"));
}
Also used : TestDownload(org.commonjava.maven.galley.testing.core.transport.job.TestDownload) ProjectVersionRef(org.commonjava.maven.atlas.ident.ref.ProjectVersionRef) SimpleProjectVersionRef(org.commonjava.maven.atlas.ident.ref.SimpleProjectVersionRef) ConcreteResource(org.commonjava.maven.galley.model.ConcreteResource) SimpleProjectVersionRef(org.commonjava.maven.atlas.ident.ref.SimpleProjectVersionRef) EventMetadata(org.commonjava.maven.galley.event.EventMetadata) Test(org.junit.Test)

Example 75 with EventMetadata

use of org.commonjava.maven.galley.event.EventMetadata in project galley by Commonjava.

the class VersionResolverImplTest method resolveSnapshot_Latest_TwoLocationList_TwoSingletonSnapshotList_LatestVersionStrategy.

@Test
public void resolveSnapshot_Latest_TwoLocationList_TwoSingletonSnapshotList_LatestVersionStrategy() throws Exception {
    final String testResource = "2-snapshots-2-locations/maven-metadata-1.xml";
    final String testResource2 = "2-snapshots-2-locations/maven-metadata-2.xml";
    final ProjectVersionRef ref = new SimpleProjectVersionRef("org.group2", "artifact", "1.0-SNAPSHOT");
    final String path = fixture.snapshotMetadataPath(ref);
    fixture.getTransport().registerDownload(new ConcreteResource(LOCATION, path), new TestDownload(ROOT + testResource));
    fixture.getTransport().registerDownload(new ConcreteResource(LOCATION2, path), new TestDownload(ROOT + testResource2));
    final ProjectVersionRef result = fixture.getVersionResolver().resolveLatestVariableVersion(TWO_LOCATIONS, ref, LatestVersionSelectionStrategy.INSTANCE, new EventMetadata());
    assertThat(result, notNullValue());
    // newest snapshot is in the SECOND location.
    assertThat(result.getVersionString(), equalTo("1.0-20140604.102909-1"));
}
Also used : TestDownload(org.commonjava.maven.galley.testing.core.transport.job.TestDownload) ProjectVersionRef(org.commonjava.maven.atlas.ident.ref.ProjectVersionRef) SimpleProjectVersionRef(org.commonjava.maven.atlas.ident.ref.SimpleProjectVersionRef) ConcreteResource(org.commonjava.maven.galley.model.ConcreteResource) SimpleProjectVersionRef(org.commonjava.maven.atlas.ident.ref.SimpleProjectVersionRef) EventMetadata(org.commonjava.maven.galley.event.EventMetadata) Test(org.junit.Test)

Aggregations

EventMetadata (org.commonjava.maven.galley.event.EventMetadata)154 Transfer (org.commonjava.maven.galley.model.Transfer)65 ChangeSummary (org.commonjava.indy.audit.ChangeSummary)49 Test (org.junit.Test)47 IndyDataException (org.commonjava.indy.data.IndyDataException)44 StoreKey (org.commonjava.indy.model.core.StoreKey)40 IndyWorkflowException (org.commonjava.indy.IndyWorkflowException)38 ConcreteResource (org.commonjava.maven.galley.model.ConcreteResource)37 RemoteRepository (org.commonjava.indy.model.core.RemoteRepository)35 ArtifactStore (org.commonjava.indy.model.core.ArtifactStore)28 Group (org.commonjava.indy.model.core.Group)26 ApiOperation (io.swagger.annotations.ApiOperation)23 Path (javax.ws.rs.Path)23 Logger (org.slf4j.Logger)23 ApiResponses (io.swagger.annotations.ApiResponses)22 IOException (java.io.IOException)21 InputStream (java.io.InputStream)20 HostedRepository (org.commonjava.indy.model.core.HostedRepository)20 KeyedLocation (org.commonjava.indy.model.galley.KeyedLocation)20 ArrayList (java.util.ArrayList)18