Search in sources :

Example 21 with InMemoryStorage

use of com.artipie.asto.memory.InMemoryStorage in project front by artipie.

the class YamlUsersTest method init.

@BeforeEach
void init() {
    this.blsto = new BlockingStorage(new InMemoryStorage());
    this.users = new YamlUsers(YamlUsersTest.KEY, this.blsto);
}
Also used : InMemoryStorage(com.artipie.asto.memory.InMemoryStorage) BlockingStorage(com.artipie.asto.blocking.BlockingStorage) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 22 with InMemoryStorage

use of com.artipie.asto.memory.InMemoryStorage in project maven-adapter by artipie.

the class MavenProxySliceAuthIT method setUp.

@BeforeEach
void setUp() throws Exception {
    final Storage storage = new InMemoryStorage();
    new TestResource("com/artipie/helloworld").addFilesTo(storage, new Key.From("com", "artipie", "helloworld"));
    final String username = "alice";
    final String password = "qwerty";
    this.server = new VertxSliceServer(MavenProxySliceAuthIT.VERTX, new LoggingSlice(new MavenSlice(storage, (user, action) -> user.name().equals(username), new Authentication.Single(username, password))));
    final int port = this.server.start();
    this.client.start();
    this.proxy = new LoggingSlice(new MavenProxySlice(this.client, URI.create(String.format("http://localhost:%d", port)), new BasicAuthenticator(username, password), Cache.NOP));
}
Also used : RqMethod(com.artipie.http.rq.RqMethod) BeforeEach(org.junit.jupiter.api.BeforeEach) Headers(com.artipie.http.Headers) InMemoryStorage(com.artipie.asto.memory.InMemoryStorage) Slice(com.artipie.http.Slice) LoggingSlice(com.artipie.http.slice.LoggingSlice) RsStatus(com.artipie.http.rs.RsStatus) Content(com.artipie.asto.Content) Key(com.artipie.asto.Key) Disabled(org.junit.jupiter.api.Disabled) RsHasStatus(com.artipie.http.hm.RsHasStatus) Test(org.junit.jupiter.api.Test) RequestLine(com.artipie.http.rq.RequestLine) Vertx(io.vertx.reactivex.core.Vertx) AfterEach(org.junit.jupiter.api.AfterEach) MatcherAssert(org.hamcrest.MatcherAssert) Storage(com.artipie.asto.Storage) JettyClientSlices(com.artipie.http.client.jetty.JettyClientSlices) VertxSliceServer(com.artipie.vertx.VertxSliceServer) BasicAuthenticator(com.artipie.http.client.auth.BasicAuthenticator) Cache(com.artipie.asto.cache.Cache) URI(java.net.URI) Authentication(com.artipie.http.auth.Authentication) TestResource(com.artipie.asto.test.TestResource) TestResource(com.artipie.asto.test.TestResource) InMemoryStorage(com.artipie.asto.memory.InMemoryStorage) InMemoryStorage(com.artipie.asto.memory.InMemoryStorage) Storage(com.artipie.asto.Storage) VertxSliceServer(com.artipie.vertx.VertxSliceServer) BasicAuthenticator(com.artipie.http.client.auth.BasicAuthenticator) Key(com.artipie.asto.Key) LoggingSlice(com.artipie.http.slice.LoggingSlice) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 23 with InMemoryStorage

use of com.artipie.asto.memory.InMemoryStorage in project maven-adapter by artipie.

the class MavenProxySliceITCase method setUp.

@BeforeEach
void setUp() throws Exception {
    this.client.start();
    this.storage = new InMemoryStorage();
    this.server = new VertxSliceServer(MavenProxySliceITCase.VERTX, new LoggingSlice(new MavenProxySlice(this.client, URI.create("https://repo.maven.apache.org/maven2"), Authenticator.ANONYMOUS, new FromStorageCache(this.storage))));
    this.port = this.server.start();
}
Also used : InMemoryStorage(com.artipie.asto.memory.InMemoryStorage) VertxSliceServer(com.artipie.vertx.VertxSliceServer) FromStorageCache(com.artipie.asto.cache.FromStorageCache) LoggingSlice(com.artipie.http.slice.LoggingSlice) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 24 with InMemoryStorage

use of com.artipie.asto.memory.InMemoryStorage in project maven-adapter by artipie.

the class ArtifactGetResponseTest method notFoundIfDoesnExist.

@Test
void notFoundIfDoesnExist() {
    final Storage storage = new InMemoryStorage();
    MatcherAssert.assertThat(new ArtifactGetResponse(storage, new Key.From("none")), new RsHasStatus(RsStatus.NOT_FOUND));
}
Also used : InMemoryStorage(com.artipie.asto.memory.InMemoryStorage) Storage(com.artipie.asto.Storage) InMemoryStorage(com.artipie.asto.memory.InMemoryStorage) BlockingStorage(com.artipie.asto.blocking.BlockingStorage) RsHasStatus(com.artipie.http.hm.RsHasStatus) Test(org.junit.jupiter.api.Test)

Example 25 with InMemoryStorage

use of com.artipie.asto.memory.InMemoryStorage in project maven-adapter by artipie.

the class ArtifactHeadResponseTest method notFoundIfDoesnExist.

@Test
void notFoundIfDoesnExist() {
    final Storage storage = new InMemoryStorage();
    MatcherAssert.assertThat(new ArtifactHeadResponse(storage, new Key.From("none")), new RsHasStatus(RsStatus.NOT_FOUND));
}
Also used : InMemoryStorage(com.artipie.asto.memory.InMemoryStorage) Storage(com.artipie.asto.Storage) InMemoryStorage(com.artipie.asto.memory.InMemoryStorage) BlockingStorage(com.artipie.asto.blocking.BlockingStorage) RsHasStatus(com.artipie.http.hm.RsHasStatus) 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