Search in sources :

Example 6 with InMemoryStorage

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();
}
Also used : InMemoryStorage(com.artipie.asto.memory.InMemoryStorage) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 7 with InMemoryStorage

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));
}
Also used : InMemoryStorage(com.artipie.asto.memory.InMemoryStorage) VertxSliceServer(com.artipie.vertx.VertxSliceServer) Authentication(com.artipie.http.auth.Authentication) Permissions(com.artipie.http.auth.Permissions) MavenSlice(com.artipie.maven.http.MavenSlice) GenericContainer(org.testcontainers.containers.GenericContainer) LoggingSlice(com.artipie.http.slice.LoggingSlice)

Example 8 with InMemoryStorage

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();
}
Also used : InMemoryStorage(com.artipie.asto.memory.InMemoryStorage) VertxSliceServer(com.artipie.vertx.VertxSliceServer) FromStorageCache(com.artipie.asto.cache.FromStorageCache) JettyClientSlices(com.artipie.http.client.jetty.JettyClientSlices) GenericContainer(org.testcontainers.containers.GenericContainer) MavenProxySlice(com.artipie.maven.http.MavenProxySlice) LoggingSlice(com.artipie.http.slice.LoggingSlice) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 9 with InMemoryStorage

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);
}
Also used : InMemoryStorage(com.artipie.asto.memory.InMemoryStorage) BlockingStorage(com.artipie.asto.blocking.BlockingStorage) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 10 with InMemoryStorage

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)));
}
Also used : InMemoryStorage(com.artipie.asto.memory.InMemoryStorage) PublisherAs(com.artipie.asto.ext.PublisherAs) Storage(com.artipie.asto.Storage) InMemoryStorage(com.artipie.asto.memory.InMemoryStorage) BlockingStorage(com.artipie.asto.blocking.BlockingStorage) Content(com.artipie.asto.Content) Key(com.artipie.asto.Key) Test(org.junit.jupiter.api.Test)

Aggregations

InMemoryStorage (com.artipie.asto.memory.InMemoryStorage)30 BlockingStorage (com.artipie.asto.blocking.BlockingStorage)17 Key (com.artipie.asto.Key)16 Storage (com.artipie.asto.Storage)14 BeforeEach (org.junit.jupiter.api.BeforeEach)14 Test (org.junit.jupiter.api.Test)13 RsHasStatus (com.artipie.http.hm.RsHasStatus)6 LoggingSlice (com.artipie.http.slice.LoggingSlice)4 VertxSliceServer (com.artipie.vertx.VertxSliceServer)4 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)4 PublisherAs (com.artipie.asto.ext.PublisherAs)3 TestResource (com.artipie.asto.test.TestResource)3 YamlUsers (com.artipie.front.auth.YamlUsers)3 RepoSettings (com.artipie.front.settings.RepoSettings)3 RsHasBody (com.artipie.http.hm.RsHasBody)3 Content (com.artipie.asto.Content)2 FromStorageCache (com.artipie.asto.cache.FromStorageCache)2 Authentication (com.artipie.http.auth.Authentication)2 JettyClientSlices (com.artipie.http.client.jetty.JettyClientSlices)2 RequestLine (com.artipie.http.rq.RequestLine)2