use of com.artipie.asto.memory.InMemoryStorage in project artipie by artipie.
the class CachedCredsTest method setUp.
@BeforeEach
void setUp() {
this.storage = new InMemoryStorage();
this.cache = CacheBuilder.newBuilder().expireAfterWrite(1, TimeUnit.MINUTES).softValues().build();
}
use of com.artipie.asto.memory.InMemoryStorage in project maven-adapter by artipie.
the class MavenITCase method init.
void init(final boolean anonymous) throws IOException {
final Pair<Permissions, Authentication> auth = this.auth(anonymous);
this.storage = new InMemoryStorage();
this.server = new VertxSliceServer(MavenITCase.VERTX, new LoggingSlice(new MavenSlice(this.storage, auth.getKey(), auth.getValue())));
this.port = this.server.start();
Testcontainers.exposeHostPorts(this.port);
this.cntn = new GenericContainer<>("maven:3.6.3-jdk-11").withCommand("tail", "-f", "/dev/null").withWorkingDirectory("/home/").withFileSystemBind(this.tmp.toString(), "/home");
this.cntn.start();
this.settings(this.getUser(anonymous));
}
use of com.artipie.asto.memory.InMemoryStorage in project maven-adapter by artipie.
the class MavenProxyIT method setUp.
@BeforeEach
void setUp() throws Exception {
final JettyClientSlices slices = new JettyClientSlices();
slices.start();
this.storage = new InMemoryStorage();
this.server = new VertxSliceServer(MavenProxyIT.VERTX, new LoggingSlice(new MavenProxySlice(slices, URI.create("https://repo.maven.apache.org/maven2"), Authenticator.ANONYMOUS, new FromStorageCache(this.storage))));
this.port = this.server.start();
Testcontainers.exposeHostPorts(this.port);
this.cntn = new GenericContainer<>("maven:3.6.3-jdk-11").withCommand("tail", "-f", "/dev/null").withWorkingDirectory("/home/").withFileSystemBind(this.tmp.toString(), "/home");
this.cntn.start();
}
use of com.artipie.asto.memory.InMemoryStorage in project maven-adapter by artipie.
the class AstoValidUploadTest method init.
@BeforeEach
void init() {
this.storage = new InMemoryStorage();
this.bsto = new BlockingStorage(this.storage);
this.validupload = new AstoValidUpload(this.storage);
}
use of com.artipie.asto.memory.InMemoryStorage in project maven-adapter by artipie.
the class RepositoryChecksumsTest method generatesChecksums.
@Test
void generatesChecksums() {
final Storage storage = new InMemoryStorage();
final Key key = new Key.From("my-artifact.jar");
final byte[] content = "my artifact content".getBytes();
storage.save(key, new Content.From(content));
new RepositoryChecksums(storage).generate(key).toCompletableFuture().join();
MatcherAssert.assertThat("Generates sha1", new PublisherAs(storage.value(new Key.From(String.format("%s.sha1", key.string()))).join()).asciiString().toCompletableFuture().join(), new IsEqual<>(DigestUtils.sha1Hex(content)));
MatcherAssert.assertThat("Generates sha256", new PublisherAs(storage.value(new Key.From(String.format("%s.sha256", key.string()))).join()).asciiString().toCompletableFuture().join(), new IsEqual<>(DigestUtils.sha256Hex(content)));
MatcherAssert.assertThat("Generates sha512", new PublisherAs(storage.value(new Key.From(String.format("%s.sha512", key.string()))).join()).asciiString().toCompletableFuture().join(), new IsEqual<>(DigestUtils.sha512Hex(content)));
MatcherAssert.assertThat("Generates md5", new PublisherAs(storage.value(new Key.From(String.format("%s.md5", key.string()))).join()).asciiString().toCompletableFuture().join(), new IsEqual<>(DigestUtils.md5Hex(content)));
}
Aggregations