GT-2740 revision to facilitate test use of ServerAdmin utility

This commit is contained in:
ghidra1 2019-04-25 11:46:11 -04:00
parent 7eb614ab88
commit a28ebc6ff2
2 changed files with 19 additions and 4 deletions

View File

@ -50,7 +50,7 @@ public class ServerAdmin implements GhidraLaunchable {
private boolean propertyUsed = false;
/**
* Main method for running the UserAdmin Application.
* Main method for launching the ServerAdmin Application via GhidraLauncher.
* The following properties may be set:
* <pre>
* UserAdmin.invocation - identifies the name of the application used when displaying usage text.
@ -69,6 +69,20 @@ public class ServerAdmin implements GhidraLaunchable {
Application.initializeApplication(layout, configuration);
}
execute(args);
}
/**
* Main method for processing ServerAdmin command line arguments.
* The following properties may be set:
* <pre>
* UserAdmin.invocation - identifies the name of the application used when displaying usage text.
* UserAdmin.serverDir - identifies the server directory instead of passing on command line.
* </pre>
* @param args command line arguments
*/
public void execute(String[] args) {
File serverDir = null;
int ix = 0;

View File

@ -40,7 +40,7 @@ import ghidra.framework.store.local.LocalFileSystem;
import ghidra.framework.store.local.LocalFolderItem;
import ghidra.net.*;
import ghidra.program.model.listing.Program;
import ghidra.server.UserAdmin;
import ghidra.server.ServerAdmin;
import ghidra.server.UserManager;
import ghidra.test.ToyProgramBuilder;
import ghidra.util.*;
@ -940,11 +940,12 @@ public class ServerTestUtil {
* @throws Exception
*/
public static void addPKIUser(File serverRoot, String userName, String dn) throws Exception {
ServerAdmin serverAdmin = new ServerAdmin();
if (dn != null) {
UserAdmin.main(new String[] { serverRoot.getAbsolutePath(), "-dn", userName, dn });
serverAdmin.execute(new String[] { serverRoot.getAbsolutePath(), "-dn", userName, dn });
}
else {
UserAdmin.main(new String[] { serverRoot.getAbsolutePath(), "-add", userName });
serverAdmin.execute(new String[] { serverRoot.getAbsolutePath(), "-add", userName });
}
}