Search in sources :

Example 1 with ArtipieProperties

use of com.artipie.misc.ArtipieProperties in project artipie by artipie.

the class VersionSliceTest method returnVersionOfApplication.

@Test
void returnVersionOfApplication() {
    final ArtipieProperties proprts = new ArtipieProperties();
    MatcherAssert.assertThat(new VersionSlice(proprts), new SliceHasResponse(Matchers.allOf(new RsHasStatus(RsStatus.OK), new RsHasBody(new IsJson(new JsonContains(new JsonHas("version", new JsonValueIs(proprts.version())))))), new RequestLine(RqMethod.GET, "/.version")));
}
Also used : RequestLine(com.artipie.http.rq.RequestLine) SliceHasResponse(com.artipie.http.hm.SliceHasResponse) RsHasStatus(com.artipie.http.hm.RsHasStatus) RsHasBody(com.artipie.http.hm.RsHasBody) ArtipieProperties(com.artipie.misc.ArtipieProperties) JsonContains(wtf.g4s8.hamcrest.json.JsonContains) IsJson(com.artipie.IsJson) JsonHas(wtf.g4s8.hamcrest.json.JsonHas) JsonValueIs(wtf.g4s8.hamcrest.json.JsonValueIs) Test(org.junit.jupiter.api.Test)

Example 2 with ArtipieProperties

use of com.artipie.misc.ArtipieProperties 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();
}
Also used : Path(java.nio.file.Path) Options(org.apache.commons.cli.Options) Vertx(io.vertx.reactivex.core.Vertx) CommandLine(org.apache.commons.cli.CommandLine) JettyClientSlices(com.artipie.http.client.jetty.JettyClientSlices) ArtipieProperties(com.artipie.misc.ArtipieProperties) CommandLineParser(org.apache.commons.cli.CommandLineParser) DefaultParser(org.apache.commons.cli.DefaultParser)

Aggregations

ArtipieProperties (com.artipie.misc.ArtipieProperties)2 IsJson (com.artipie.IsJson)1 JettyClientSlices (com.artipie.http.client.jetty.JettyClientSlices)1 RsHasBody (com.artipie.http.hm.RsHasBody)1 RsHasStatus (com.artipie.http.hm.RsHasStatus)1 SliceHasResponse (com.artipie.http.hm.SliceHasResponse)1 RequestLine (com.artipie.http.rq.RequestLine)1 Vertx (io.vertx.reactivex.core.Vertx)1 Path (java.nio.file.Path)1 CommandLine (org.apache.commons.cli.CommandLine)1 CommandLineParser (org.apache.commons.cli.CommandLineParser)1 DefaultParser (org.apache.commons.cli.DefaultParser)1 Options (org.apache.commons.cli.Options)1 Test (org.junit.jupiter.api.Test)1 JsonContains (wtf.g4s8.hamcrest.json.JsonContains)1 JsonHas (wtf.g4s8.hamcrest.json.JsonHas)1 JsonValueIs (wtf.g4s8.hamcrest.json.JsonValueIs)1