< prev index next >

test/runtime/CommandLine/OptionsValidation/common/optionsvalidation/JVMOption.java

Print this page




  38 import static optionsvalidation.JVMOptionsUtils.VMType;
  39 
  40 public abstract class JVMOption {
  41 
  42     /**
  43      * Executor for JCMD
  44      */
  45     private final static CommandExecutor executor = new JMXExecutor();
  46 
  47     /**
  48      * Name of the tested parameter
  49      */
  50     protected String name;
  51 
  52     /**
  53      * Range is defined for option inside VM
  54      */
  55     protected boolean withRange;
  56 
  57     /**










  58      * Prepend string which added before testing option to the command line
  59      */
  60     private final List<String> prepend;
  61     private final StringBuilder prependString;
  62 
  63     protected JVMOption() {
  64         this.prepend = new ArrayList<>();
  65         prependString = new StringBuilder();
  66         withRange = false;


  67     }
  68 
  69     /**
  70      * Create JVM Option with given type and name.
  71      *
  72      * @param type type: "intx", "size_t", "uintx", "uint64_t" or "double"
  73      * @param name name of the option
  74      * @return created JVMOption
  75      */
  76     static JVMOption createVMOption(String type, String name) {
  77         JVMOption parameter;
  78 
  79         switch (type) {
  80             case "int":
  81             case "intx":
  82             case "size_t":
  83             case "uint":
  84             case "uintx":
  85             case "uint64_t":
  86                 parameter = new IntJVMOption(name, type);


 116             }
 117             prepend.add(toAdd);
 118             prependString.append(toAdd).append(" ");
 119         }
 120     }
 121 
 122     /**
 123      * Get name of the option
 124      *
 125      * @return name of the option
 126      */
 127     final String getName() {
 128         return name;
 129     }
 130 
 131     /**
 132      * Mark this option as option which range is defined inside VM
 133      */
 134     final void optionWithRange() {
 135         withRange = true;














 136     }
 137 
 138     /**
 139      * Set new minimum option value
 140      *
 141      * @param min new minimum value
 142      */
 143     abstract void setMin(String min);
 144 
 145     /**
 146      * Get string with minimum value of the option
 147      *
 148      * @return string with minimum value of the option
 149      */
 150     abstract String getMin();
 151 
 152     /**
 153      * Set new maximum option value
 154      *
 155      * @param max new maximum value




  38 import static optionsvalidation.JVMOptionsUtils.VMType;
  39 
  40 public abstract class JVMOption {
  41 
  42     /**
  43      * Executor for JCMD
  44      */
  45     private final static CommandExecutor executor = new JMXExecutor();
  46 
  47     /**
  48      * Name of the tested parameter
  49      */
  50     protected String name;
  51 
  52     /**
  53      * Range is defined for option inside VM
  54      */
  55     protected boolean withRange;
  56 
  57     /**
  58      * Test valid min range value and additional small values
  59      */
  60     protected boolean testMinRange;
  61 
  62     /**
  63      * Test valid max range value and additional big values
  64      */
  65     protected boolean testMaxRange;
  66 
  67     /**
  68      * Prepend string which added before testing option to the command line
  69      */
  70     private final List<String> prepend;
  71     private final StringBuilder prependString;
  72 
  73     protected JVMOption() {
  74         this.prepend = new ArrayList<>();
  75         prependString = new StringBuilder();
  76         withRange = false;
  77         testMinRange = true;
  78         testMaxRange = true;
  79     }
  80 
  81     /**
  82      * Create JVM Option with given type and name.
  83      *
  84      * @param type type: "intx", "size_t", "uintx", "uint64_t" or "double"
  85      * @param name name of the option
  86      * @return created JVMOption
  87      */
  88     static JVMOption createVMOption(String type, String name) {
  89         JVMOption parameter;
  90 
  91         switch (type) {
  92             case "int":
  93             case "intx":
  94             case "size_t":
  95             case "uint":
  96             case "uintx":
  97             case "uint64_t":
  98                 parameter = new IntJVMOption(name, type);


 128             }
 129             prepend.add(toAdd);
 130             prependString.append(toAdd).append(" ");
 131         }
 132     }
 133 
 134     /**
 135      * Get name of the option
 136      *
 137      * @return name of the option
 138      */
 139     final String getName() {
 140         return name;
 141     }
 142 
 143     /**
 144      * Mark this option as option which range is defined inside VM
 145      */
 146     final void optionWithRange() {
 147         withRange = true;
 148     }
 149 
 150     /**
 151      * Exclude testing of min range value for this option
 152      */
 153     public final void excludeTestMinRange() {
 154         testMinRange = false;
 155     }
 156 
 157     /**
 158      * Exclude testing of max range value for this option
 159      */
 160     public final void excludeTestMaxRange() {
 161         testMaxRange = false;
 162     }
 163 
 164     /**
 165      * Set new minimum option value
 166      *
 167      * @param min new minimum value
 168      */
 169     abstract void setMin(String min);
 170 
 171     /**
 172      * Get string with minimum value of the option
 173      *
 174      * @return string with minimum value of the option
 175      */
 176     abstract String getMin();
 177 
 178     /**
 179      * Set new maximum option value
 180      *
 181      * @param max new maximum value


< prev index next >