use of com.artipie.vertx.VertxSliceServer in project artipie by artipie.
the class VertxMain method listenOn.
/**
* Starts HTTP server listening on specified port.
*
* @param slice Slice.
* @param metrics Metrics.
* @param sport Server port.
* @return Port server started to listen on.
*/
private int listenOn(final Slice slice, final Metrics metrics, final int sport) {
final VertxSliceServer server = new VertxSliceServer(this.vertx, new BaseSlice(metrics, slice), sport);
this.servers.add(server);
return server.start();
}
use of com.artipie.vertx.VertxSliceServer 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.vertx.VertxSliceServer 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.vertx.VertxSliceServer 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));
}
use of com.artipie.vertx.VertxSliceServer 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();
}
Aggregations