use of com.artipie.asto.ext.KeyLastPart in project maven-adapter by artipie.
the class AstoMavenTest method addsMetadataChecksums.
@Test
void addsMetadataChecksums() {
final String version = "0.1";
new TestResource("maven-metadata.xml.example").saveTo(this.storage, new Key.From(AstoMavenTest.LGR_UPLOAD, version, PutMetadataSlice.SUB_META, "maven-metadata.xml"));
new AstoMaven(this.storage).update(new Key.From(AstoMavenTest.LGR_UPLOAD, version), AstoMavenTest.LGR).toCompletableFuture().join();
MatcherAssert.assertThat(this.storage.list(AstoMavenTest.LGR).join().stream().map(key -> new KeyLastPart(key).get()).filter(key -> key.contains("maven-metadata.xml")).toArray(String[]::new), Matchers.arrayContainingInAnyOrder("maven-metadata.xml", "maven-metadata.xml.sha1", "maven-metadata.xml.sha256", "maven-metadata.xml.sha512", "maven-metadata.xml.md5"));
}
use of com.artipie.asto.ext.KeyLastPart in project maven-adapter by artipie.
the class LocalMavenSlice method response.
@Override
public Response response(final String line, final Iterable<Entry<String, String>> headers, final Publisher<ByteBuffer> body) {
final RequestLineFrom rline = new RequestLineFrom(line);
final Key key = new KeyFromPath(rline.uri().getPath());
final Matcher match = LocalMavenSlice.PTN_ARTIFACT.matcher(new KeyLastPart(key).get());
final Response response;
if (match.matches()) {
response = this.artifactResponse(rline.method(), key);
} else {
response = this.plainResponse(rline.method(), key);
}
return response;
}
Aggregations