Coverage Summary for Class: NodeCliFlags (co.rsk.config)

Class Class, % Method, % Line, %
NodeCliFlags 0% (0/1) 0% (0/4) 0% (0/16)


1 /* 2  * This file is part of RskJ 3  * Copyright (C) 2018 RSK Labs Ltd. 4  * 5  * This program is free software: you can redistribute it and/or modify 6  * it under the terms of the GNU Lesser General Public License as published by 7  * the Free Software Foundation, either version 3 of the License, or 8  * (at your option) any later version. 9  * 10  * This program is distributed in the hope that it will be useful, 11  * but WITHOUT ANY WARRANTY; without even the implied warranty of 12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13  * GNU Lesser General Public License for more details. 14  * 15  * You should have received a copy of the GNU Lesser General Public License 16  * along with this program. If not, see <http://www.gnu.org/licenses/>. 17  */ 18 package co.rsk.config; 19  20 import co.rsk.cli.CliArg; 21 import com.typesafe.config.Config; 22 import com.typesafe.config.ConfigValueFactory; 23 import org.ethereum.config.SystemProperties; 24  25 /** 26  * Flags that the node can receive via command line arguments. 27  * E.g. --testnet 28  */ 29 public enum NodeCliFlags implements CliArg { 30  DB_RESET("reset", SystemProperties.PROPERTY_DB_RESET, true), 31  DB_IMPORT("import", SystemProperties.PROPERTY_DB_IMPORT, true), 32  VERIFY_CONFIG("verify-config", SystemProperties.PROPERTY_BC_VERIFY, true), 33  PRINT_SYSTEM_INFO("print-system-info", SystemProperties.PROPERTY_PRINT_SYSTEM_INFO, true), 34  SKIP_JAVA_CHECK("skip-java-check", SystemProperties.PROPERTY_SKIP_JAVA_VERSION_CHECK, false), 35  NETWORK_TESTNET("testnet", SystemProperties.PROPERTY_BC_CONFIG_NAME, "testnet"), 36  NETWORK_REGTEST("regtest", SystemProperties.PROPERTY_BC_CONFIG_NAME, "regtest"), 37  NETWORK_DEVNET("devnet", SystemProperties.PROPERTY_BC_CONFIG_NAME, "devnet"), 38  NETWORK_MAINNET("main", SystemProperties.PROPERTY_BC_CONFIG_NAME, "main"), 39  ; 40  41  private final String flagName; 42  private final String configPath; 43  private final Object configValue; 44  45  NodeCliFlags(String flagName, String configPath, Object configValue) { 46  this.flagName = flagName; 47  this.configPath = configPath; 48  this.configValue = configValue; 49  } 50  51  @Override 52  public String getName() { 53  return flagName; 54  } 55  56  /** 57  * @return a new, augmented config with settings for this flag. 58  */ 59  public Config withConfig(Config config) { 60  return config.withValue(configPath, ConfigValueFactory.fromAnyRef(configValue)); 61  } 62 }