@Test void toJzonbieOptions() { final JzonbieOptions jzonbieOptions = CommandLineOptions.toJzonbieOptions( CommandLineOptions.parse(new String[]{ "-p", "8000", "-z", "name", "--https", "--https-port", "8001", "-k", "keystore", "-kp", "password", "-cn", "common-name", "--call-history-capacity", "100", "--failed-requests-capacity", "50", "--initial-priming-file", "initial", "--default-priming-file", "default", } ) ); assertThat(jzonbieOptions.getHttpPort()).isEqualTo(8000); assertThat(jzonbieOptions.getZombieHeaderName()).isEqualTo("name"); assertThat(jzonbieOptions.getCallHistoryCapacity()).isEqualTo(100); assertThat(jzonbieOptions.getFailedRequestsCapacity()).isEqualTo(50); assertThat(jzonbieOptions.getInitialPrimingFile()).contains(new File("initial")); assertThat(jzonbieOptions.getDefaultPrimingFile()).contains(new File("default")); final HttpsOptions httpsOptions = jzonbieOptions.getHttpsOptions().get(); assertThat(httpsOptions.getPort()).isEqualTo(8001); assertThat(httpsOptions.getKeystoreLocation()).contains("keystore"); assertThat(httpsOptions.getKeystorePassword()).contains("password"); assertThat(httpsOptions.getCommonName()).isEqualTo("common-name"); }
public static JzonbieOptions toJzonbieOptions(CommandLineOptions commandLineOptions) { final JzonbieOptions options = options(); if(commandLineOptions.httpPort != null) { options.withHttpPort(commandLineOptions.httpPort); } if(commandLineOptions.zombieHeaderName != null) { options.withZombieHeaderName(commandLineOptions.zombieHeaderName); } if(commandLineOptions.callHistoryCapacity != null) { options.withCallHistoryCapacity(commandLineOptions.callHistoryCapacity); } if(commandLineOptions.failedRequestsCapacity != null) { options.withFailedRequestsCapacity(commandLineOptions.failedRequestsCapacity); } if(commandLineOptions.httpsEnabled) { final HttpsOptions httpsOptions = httpsOptions(); if(commandLineOptions.httpsPort != null){ httpsOptions.withPort(commandLineOptions.httpsPort); } if(commandLineOptions.keystoreLocation != null){ httpsOptions.withKeystoreLocation(commandLineOptions.keystoreLocation); } if(commandLineOptions.keystorePassword != null){ httpsOptions.withKeystorePassword(commandLineOptions.keystorePassword); } if(commandLineOptions.commonName != null){ httpsOptions.withCommonName(commandLineOptions.commonName); } options.withHttps(httpsOptions); } if (commandLineOptions.initialPrimingFile != null) { options.withInitialPrimingFile(commandLineOptions.initialPrimingFile); } if (commandLineOptions.defaultPrimingFile != null) { options.withDefaultPrimingFile(commandLineOptions.defaultPrimingFile); } return options; }
CommandLineOptions { public static JzonbieOptions toJzonbieOptions(CommandLineOptions commandLineOptions) { final JzonbieOptions options = options(); if(commandLineOptions.httpPort != null) { options.withHttpPort(commandLineOptions.httpPort); } if(commandLineOptions.zombieHeaderName != null) { options.withZombieHeaderName(commandLineOptions.zombieHeaderName); } if(commandLineOptions.callHistoryCapacity != null) { options.withCallHistoryCapacity(commandLineOptions.callHistoryCapacity); } if(commandLineOptions.failedRequestsCapacity != null) { options.withFailedRequestsCapacity(commandLineOptions.failedRequestsCapacity); } if(commandLineOptions.httpsEnabled) { final HttpsOptions httpsOptions = httpsOptions(); if(commandLineOptions.httpsPort != null){ httpsOptions.withPort(commandLineOptions.httpsPort); } if(commandLineOptions.keystoreLocation != null){ httpsOptions.withKeystoreLocation(commandLineOptions.keystoreLocation); } if(commandLineOptions.keystorePassword != null){ httpsOptions.withKeystorePassword(commandLineOptions.keystorePassword); } if(commandLineOptions.commonName != null){ httpsOptions.withCommonName(commandLineOptions.commonName); } options.withHttps(httpsOptions); } if (commandLineOptions.initialPrimingFile != null) { options.withInitialPrimingFile(commandLineOptions.initialPrimingFile); } if (commandLineOptions.defaultPrimingFile != null) { options.withDefaultPrimingFile(commandLineOptions.defaultPrimingFile); } return options; } }
CommandLineOptions { public static JzonbieOptions toJzonbieOptions(CommandLineOptions commandLineOptions) { final JzonbieOptions options = options(); if(commandLineOptions.httpPort != null) { options.withHttpPort(commandLineOptions.httpPort); } if(commandLineOptions.zombieHeaderName != null) { options.withZombieHeaderName(commandLineOptions.zombieHeaderName); } if(commandLineOptions.callHistoryCapacity != null) { options.withCallHistoryCapacity(commandLineOptions.callHistoryCapacity); } if(commandLineOptions.failedRequestsCapacity != null) { options.withFailedRequestsCapacity(commandLineOptions.failedRequestsCapacity); } if(commandLineOptions.httpsEnabled) { final HttpsOptions httpsOptions = httpsOptions(); if(commandLineOptions.httpsPort != null){ httpsOptions.withPort(commandLineOptions.httpsPort); } if(commandLineOptions.keystoreLocation != null){ httpsOptions.withKeystoreLocation(commandLineOptions.keystoreLocation); } if(commandLineOptions.keystorePassword != null){ httpsOptions.withKeystorePassword(commandLineOptions.keystorePassword); } if(commandLineOptions.commonName != null){ httpsOptions.withCommonName(commandLineOptions.commonName); } options.withHttps(httpsOptions); } if (commandLineOptions.initialPrimingFile != null) { options.withInitialPrimingFile(commandLineOptions.initialPrimingFile); } if (commandLineOptions.defaultPrimingFile != null) { options.withDefaultPrimingFile(commandLineOptions.defaultPrimingFile); } return options; }  }
CommandLineOptions { public static JzonbieOptions toJzonbieOptions(CommandLineOptions commandLineOptions) { final JzonbieOptions options = options(); if(commandLineOptions.httpPort != null) { options.withHttpPort(commandLineOptions.httpPort); } if(commandLineOptions.zombieHeaderName != null) { options.withZombieHeaderName(commandLineOptions.zombieHeaderName); } if(commandLineOptions.callHistoryCapacity != null) { options.withCallHistoryCapacity(commandLineOptions.callHistoryCapacity); } if(commandLineOptions.failedRequestsCapacity != null) { options.withFailedRequestsCapacity(commandLineOptions.failedRequestsCapacity); } if(commandLineOptions.httpsEnabled) { final HttpsOptions httpsOptions = httpsOptions(); if(commandLineOptions.httpsPort != null){ httpsOptions.withPort(commandLineOptions.httpsPort); } if(commandLineOptions.keystoreLocation != null){ httpsOptions.withKeystoreLocation(commandLineOptions.keystoreLocation); } if(commandLineOptions.keystorePassword != null){ httpsOptions.withKeystorePassword(commandLineOptions.keystorePassword); } if(commandLineOptions.commonName != null){ httpsOptions.withCommonName(commandLineOptions.commonName); } options.withHttps(httpsOptions); } if (commandLineOptions.initialPrimingFile != null) { options.withInitialPrimingFile(commandLineOptions.initialPrimingFile); } if (commandLineOptions.defaultPrimingFile != null) { options.withDefaultPrimingFile(commandLineOptions.defaultPrimingFile); } return options; }  static CommandLineOptions parse(String[] args); static JzonbieOptions toJzonbieOptions(CommandLineOptions commandLineOptions); }
CommandLineOptions { public static JzonbieOptions toJzonbieOptions(CommandLineOptions commandLineOptions) { final JzonbieOptions options = options(); if(commandLineOptions.httpPort != null) { options.withHttpPort(commandLineOptions.httpPort); } if(commandLineOptions.zombieHeaderName != null) { options.withZombieHeaderName(commandLineOptions.zombieHeaderName); } if(commandLineOptions.callHistoryCapacity != null) { options.withCallHistoryCapacity(commandLineOptions.callHistoryCapacity); } if(commandLineOptions.failedRequestsCapacity != null) { options.withFailedRequestsCapacity(commandLineOptions.failedRequestsCapacity); } if(commandLineOptions.httpsEnabled) { final HttpsOptions httpsOptions = httpsOptions(); if(commandLineOptions.httpsPort != null){ httpsOptions.withPort(commandLineOptions.httpsPort); } if(commandLineOptions.keystoreLocation != null){ httpsOptions.withKeystoreLocation(commandLineOptions.keystoreLocation); } if(commandLineOptions.keystorePassword != null){ httpsOptions.withKeystorePassword(commandLineOptions.keystorePassword); } if(commandLineOptions.commonName != null){ httpsOptions.withCommonName(commandLineOptions.commonName); } options.withHttps(httpsOptions); } if (commandLineOptions.initialPrimingFile != null) { options.withInitialPrimingFile(commandLineOptions.initialPrimingFile); } if (commandLineOptions.defaultPrimingFile != null) { options.withDefaultPrimingFile(commandLineOptions.defaultPrimingFile); } return options; }  static CommandLineOptions parse(String[] args); static JzonbieOptions toJzonbieOptions(CommandLineOptions commandLineOptions); @Option(names = {"-h", "--help"}, usageHelp = true, description = "display this help message")
    public boolean usageHelpRequested; @Option(names = {"-p", "--port"}, paramLabel = "PORT", description = "port the HTTP server will listen on")
    public Integer httpPort; @Option(names = {"-z", "--zombie-header-name"}, paramLabel = "NAME", description = "name of the HTTP header used to drive Jzonbie functions")
    public String zombieHeaderName; @Option(names = {"--https"}, description = "enable HTTPS")
    public boolean httpsEnabled; @Option(names = {"--https-port"}, paramLabel = "PORT", description = "port the HTTPS server will listen on")
    public Integer httpsPort; @Option(names = {"-k", "--keystore"}, paramLabel = "PATH", description = "path to keystore")
    public String keystoreLocation; @Option(names = {"-kp", "--keystore-password"}, paramLabel = "PASSWORD", description = "password to supplied keystore")
    public String keystorePassword; @Option(names = {"-cn", "--common-name"}, paramLabel = "NAME", description = "common name of generated HTTPS certificate")
    public String commonName; @Option(names = {"--call-history-capacity"}, paramLabel = "SIZE", description = "maximum capacity of the stored call history")
    public Integer callHistoryCapacity; @Option(names = {"--failed-requests-capacity"}, paramLabel = "SIZE", description = "maximum capacity of the stored failed requests")
    public Integer failedRequestsCapacity; @Option(names = {"--initial-priming-file"}, paramLabel = "PATH", description = "path to initial priming file JSON")
    public File initialPrimingFile; @Option(names = {"--default-priming-file"}, paramLabel = "PATH", description = "path to default priming file JSON")
    public File defaultPrimingFile; }