use of com.artipie.http.client.jetty.JettyClientSlices in project artipie by artipie.
the class RepositoriesFromStorageCacheTest method readAliasesFromCache.
@Test
void readAliasesFromCache() {
final Key alias = new Key.From("_storages.yaml");
final Key config = new Key.From("bin.yaml");
new TestResource(alias.string()).saveTo(this.storage);
new BlockingStorage(this.storage).save(config, "repo:\n storage: default".getBytes());
final ClientSlices http = new JettyClientSlices();
new RepositoriesFromStorage(http, this.storage).config(config.string()).toCompletableFuture().join();
this.storage.save(alias, Content.EMPTY).join();
MatcherAssert.assertThat(new RepositoriesFromStorage(http, this.storage).config(config.string()).toCompletableFuture().join().storageOpt().isPresent(), new IsEqual<>(true));
}
use of com.artipie.http.client.jetty.JettyClientSlices 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.http.client.jetty.JettyClientSlices in project artipie by artipie.
the class RepositoriesFromStorageCacheTest method readConfigFromCacheAfterSavingNewValueInStorage.
@Test
void readConfigFromCacheAfterSavingNewValueInStorage() {
final Key key = new Key.From("some-repo.yaml");
final byte[] old = "some: data".getBytes();
final byte[] upd = "some: new data".getBytes();
new BlockingStorage(this.storage).save(key, old);
final ClientSlices http = new JettyClientSlices();
new RepositoriesFromStorage(http, this.storage).config(key.string()).toCompletableFuture().join();
new BlockingStorage(this.storage).save(key, upd);
MatcherAssert.assertThat(new RepositoriesFromStorage(http, this.storage).config(key.string()).toCompletableFuture().join().toString(), new IsEqual<>(new String(old)));
}
use of com.artipie.http.client.jetty.JettyClientSlices in project artipie by artipie.
the class VertxMain method main.
/**
* Entry point.
* @param args CLI args
* @throws Exception If fails
*/
public static void main(final String... args) throws Exception {
final Vertx vertx = Vertx.vertx();
final Path config;
final int port;
final int defp = 80;
final Options options = new Options();
final String popt = "p";
final String fopt = "f";
options.addOption(popt, "port", true, "The port to start artipie on");
options.addOption(fopt, "config-file", true, "The path to artipie configuration file");
final CommandLineParser parser = new DefaultParser();
final CommandLine cmd = parser.parse(options, args);
if (cmd.hasOption(popt)) {
port = Integer.parseInt(cmd.getOptionValue(popt));
} else {
Logger.info(VertxMain.class, "Using default port: %d", defp);
port = defp;
}
if (cmd.hasOption(fopt)) {
config = Path.of(cmd.getOptionValue(fopt));
} else {
throw new IllegalStateException("Storage is not configured");
}
Logger.info(VertxMain.class, "Used version of Artipie: %s", new ArtipieProperties().version());
final JettyClientSlices http = new JettyClientSlices(new HttpClientSettings());
http.start();
new VertxMain(http, config, vertx, port).start();
}
Aggregations