< prev index next >

test/serviceability/dcmd/vm/SetVMFlagTest.java

Print this page




  78         String newFlagVal = out.firstMatch(MANAGEABLE_PATTERN.replace("(\\S+)", flagName), 1);
  79 
  80         assertNotEquals(newFlagVal, flagVal);
  81     }
  82 
  83     private void setMutableFlagWithInvalidValue(CommandExecutor executor) {
  84         OutputAnalyzer out = getAllFlags(executor);
  85         String flagName = out.firstMatch(MANAGEABLE_PATTERN, 1);
  86         String flagVal = out.firstMatch(MANAGEABLE_PATTERN, 2);
  87 
  88         System.out.println("### Setting a mutable flag '" + flagName + "' to an invalid value");
  89 
  90         if (flagVal == null) {
  91             System.err.println(out.getOutput());
  92             throw new Error("Can not find a boolean manageable flag");
  93         }
  94 
  95         // a boolean flag accepts only 0/1 as its value
  96         out = executor.execute("VM.set_flag " + flagName + " unexpected_value");
  97         out.stderrShouldBeEmpty();
  98         out.stdoutShouldContain("flag value must be a boolean (1 or 0)");
  99 
 100         out = getAllFlags(executor);
 101 
 102         String newFlagVal = out.firstMatch(MANAGEABLE_PATTERN.replace("(\\S+)", flagName), 1);
 103 
 104         assertEquals(newFlagVal, flagVal);
 105     }
 106 
 107     private void setImmutableFlag(CommandExecutor executor) {
 108         OutputAnalyzer out = getAllFlags(executor);
 109         String flagName = out.firstMatch(IMMUTABLE_PATTERN, 1);
 110         String flagVal = out.firstMatch(IMMUTABLE_PATTERN, 2);
 111 
 112         System.out.println("### Setting an immutable flag '" + flagName + "'");
 113 
 114         if (flagVal == null) {
 115             System.err.println(out.getOutput());
 116             throw new Error("Can not find an immutable uintx flag");
 117         }
 118 




  78         String newFlagVal = out.firstMatch(MANAGEABLE_PATTERN.replace("(\\S+)", flagName), 1);
  79 
  80         assertNotEquals(newFlagVal, flagVal);
  81     }
  82 
  83     private void setMutableFlagWithInvalidValue(CommandExecutor executor) {
  84         OutputAnalyzer out = getAllFlags(executor);
  85         String flagName = out.firstMatch(MANAGEABLE_PATTERN, 1);
  86         String flagVal = out.firstMatch(MANAGEABLE_PATTERN, 2);
  87 
  88         System.out.println("### Setting a mutable flag '" + flagName + "' to an invalid value");
  89 
  90         if (flagVal == null) {
  91             System.err.println(out.getOutput());
  92             throw new Error("Can not find a boolean manageable flag");
  93         }
  94 
  95         // a boolean flag accepts only 0/1 as its value
  96         out = executor.execute("VM.set_flag " + flagName + " unexpected_value");
  97         out.stderrShouldBeEmpty();
  98         out.stdoutShouldContain("flag value must be a boolean (1/0 or true/false)");
  99 
 100         out = getAllFlags(executor);
 101 
 102         String newFlagVal = out.firstMatch(MANAGEABLE_PATTERN.replace("(\\S+)", flagName), 1);
 103 
 104         assertEquals(newFlagVal, flagVal);
 105     }
 106 
 107     private void setImmutableFlag(CommandExecutor executor) {
 108         OutputAnalyzer out = getAllFlags(executor);
 109         String flagName = out.firstMatch(IMMUTABLE_PATTERN, 1);
 110         String flagVal = out.firstMatch(IMMUTABLE_PATTERN, 2);
 111 
 112         System.out.println("### Setting an immutable flag '" + flagName + "'");
 113 
 114         if (flagVal == null) {
 115             System.err.println(out.getOutput());
 116             throw new Error("Can not find an immutable uintx flag");
 117         }
 118 


< prev index next >