Search in sources :

Example 1 with LoggingSlice

use of com.artipie.http.slice.LoggingSlice 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 2 with LoggingSlice

use of com.artipie.http.slice.LoggingSlice 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 3 with LoggingSlice

use of com.artipie.http.slice.LoggingSlice 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 4 with LoggingSlice

use of com.artipie.http.slice.LoggingSlice 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 5 with LoggingSlice

use of com.artipie.http.slice.LoggingSlice in project maven-adapter by artipie.

the class RepoHeadITCase method setUp.

@BeforeEach
void setUp() throws Exception {
    this.client.start();
    this.server = new VertxSliceServer(RepoHeadITCase.VERTX, new LoggingSlice(new FakeProxy(this.client)));
    this.port = this.server.start();
}
Also used : VertxSliceServer(com.artipie.vertx.VertxSliceServer) LoggingSlice(com.artipie.http.slice.LoggingSlice) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

LoggingSlice (com.artipie.http.slice.LoggingSlice)5 VertxSliceServer (com.artipie.vertx.VertxSliceServer)5 InMemoryStorage (com.artipie.asto.memory.InMemoryStorage)4 BeforeEach (org.junit.jupiter.api.BeforeEach)4 FromStorageCache (com.artipie.asto.cache.FromStorageCache)2 Authentication (com.artipie.http.auth.Authentication)2 JettyClientSlices (com.artipie.http.client.jetty.JettyClientSlices)2 GenericContainer (org.testcontainers.containers.GenericContainer)2 Content (com.artipie.asto.Content)1 Key (com.artipie.asto.Key)1 Storage (com.artipie.asto.Storage)1 Cache (com.artipie.asto.cache.Cache)1 TestResource (com.artipie.asto.test.TestResource)1 Headers (com.artipie.http.Headers)1 Slice (com.artipie.http.Slice)1 Permissions (com.artipie.http.auth.Permissions)1 BasicAuthenticator (com.artipie.http.client.auth.BasicAuthenticator)1 RsHasStatus (com.artipie.http.hm.RsHasStatus)1 RequestLine (com.artipie.http.rq.RequestLine)1 RqMethod (com.artipie.http.rq.RqMethod)1