< prev index next >

test/sun/security/tools/jarsigner/warnings/Test.java

Print this page




 228             analyzer.shouldContain(JAR_VERIFIED_WITH_SIGNER_ERRORS);
 229         }
 230     }
 231 
 232     protected void checkSigning(OutputAnalyzer analyzer, String... warnings) {
 233         analyzer.shouldHaveExitValue(0);
 234         int count = 0;
 235         for (String warning : warnings) {
 236             if (warning.startsWith("!")) {
 237                 analyzer.shouldNotContain(warning.substring(1));
 238             } else {
 239                 count++;
 240                 analyzer.shouldContain(warning);
 241             }
 242         }
 243         if (count > 0) {
 244             analyzer.shouldMatch(WARNING_OR_ERROR);
 245         }
 246         analyzer.shouldContain(JAR_SIGNED);
 247     }
 248 
 249     protected OutputAnalyzer keytool(String... cmd) throws Throwable {
 250         return tool(KEYTOOL, cmd);
 251     }
 252 
 253     protected OutputAnalyzer jarsigner(String... cmd) throws Throwable {
 254         return tool(JARSIGNER, cmd);
 255     }
 256 
 257     private OutputAnalyzer tool(String tool, String... args) throws Throwable {
 258         List<String> cmd = new ArrayList<>();
 259         cmd.add(tool);
 260         cmd.add("-J-Duser.language=en");
 261         cmd.add("-J-Duser.country=US");
 262         cmd.addAll(Arrays.asList(args));
 263         return ProcessTools.executeCommand(cmd.toArray(new String[cmd.size()]));
 264     }
 265 }


 228             analyzer.shouldContain(JAR_VERIFIED_WITH_SIGNER_ERRORS);
 229         }
 230     }
 231 
 232     protected void checkSigning(OutputAnalyzer analyzer, String... warnings) {
 233         analyzer.shouldHaveExitValue(0);
 234         int count = 0;
 235         for (String warning : warnings) {
 236             if (warning.startsWith("!")) {
 237                 analyzer.shouldNotContain(warning.substring(1));
 238             } else {
 239                 count++;
 240                 analyzer.shouldContain(warning);
 241             }
 242         }
 243         if (count > 0) {
 244             analyzer.shouldMatch(WARNING_OR_ERROR);
 245         }
 246         analyzer.shouldContain(JAR_SIGNED);
 247     }

















 248 }
< prev index next >