use of org.glassfish.api.admin.CommandException in project Payara by payara.
the class CLIUtilTest method getUploadFileTest.
@Test
public void getUploadFileTest() {
BufferedWriter out = null;
String fileName = null;
try {
final File f = File.createTempFile("TestPasswordFile", ".tmp");
fileName = f.toString();
f.deleteOnExit();
out = new BufferedWriter(new FileWriter(f));
out.write("AS_ADMIN_PASSWORD=adminadmin\n");
out.write("AS_ADMIN_MASTERPASSWORD=changeit\n");
} catch (IOException ioe) {
} finally {
try {
if (out != null)
out.close();
} catch (final Exception ignore) {
}
}
try {
Map<String, String> po = CLIUtil.readPasswordFileOptions(fileName, false);
assertEquals("admin password", "adminadmin", po.get("password"));
assertEquals("master password", "changeit", po.get("masterpassword"));
assertEquals("null", null, po.get("foobar"));
} catch (CommandException ce) {
ce.printStackTrace();
}
}
Aggregations