@Test public void testCreateDropRole() throws Exception { runTestAsSubject(new TestOperation() { @Override public void runTestAsSubject() throws Exception { String[] args = { "-cr", "-r", TEST_ROLE_NAME_1, "-conf", confPath.getAbsolutePath() }; SentryShellSolr.main(args); args = new String[] { "--create_role", "-r", TEST_ROLE_NAME_2, "-conf", confPath.getAbsolutePath() }; SentryShellSolr.main(args); args = new String[] { "-lr", "-conf", confPath.getAbsolutePath() }; SentryShellSolr sentryShell = new SentryShellSolr(); Set<String> roleNames = getShellResultWithOSRedirect(sentryShell, args, true); validateRoleNames(roleNames, TEST_ROLE_NAME_1, TEST_ROLE_NAME_2); args = new String[] { "--list_role", "-conf", confPath.getAbsolutePath() }; sentryShell = new SentryShellSolr(); roleNames = getShellResultWithOSRedirect(sentryShell, args, true); validateRoleNames(roleNames, TEST_ROLE_NAME_1, TEST_ROLE_NAME_2); args = new String[] { "-dr", "-r", TEST_ROLE_NAME_1, "-conf", confPath.getAbsolutePath() }; SentryShellSolr.main(args); args = new String[] { "--drop_role", "-r", TEST_ROLE_NAME_2, "-conf", confPath.getAbsolutePath() }; SentryShellSolr.main(args); Set<TSentryRole> roles = client.listAllRoles(requestorName, SOLR); assertEquals("Incorrect number of roles", 0, roles.size()); } }); }
public static void main(String[] args) throws Exception { SentryShellSolr sentryShell = new SentryShellSolr(); try { sentryShell.executeShell(args); } catch (Exception e) { LOGGER.error(e.getMessage(), e); Throwable current = e; while (current != null && current.getMessage() == null) { current = current.getCause(); } String error = ""; if (current != null && current.getMessage() != null) { error = "Message: " + current.getMessage(); } System.out.println("The operation failed. " + error); System.exit(1); } }
SentryShellSolr extends SentryShellCommon { public static void main(String[] args) throws Exception { SentryShellSolr sentryShell = new SentryShellSolr(); try { sentryShell.executeShell(args); } catch (Exception e) { LOGGER.error(e.getMessage(), e); Throwable current = e; while (current != null && current.getMessage() == null) { current = current.getCause(); } String error = ""; if (current != null && current.getMessage() != null) { error = "Message: " + current.getMessage(); } System.out.println("The operation failed. " + error); System.exit(1); } } }
SentryShellSolr extends SentryShellCommon { public static void main(String[] args) throws Exception { SentryShellSolr sentryShell = new SentryShellSolr(); try { sentryShell.executeShell(args); } catch (Exception e) { LOGGER.error(e.getMessage(), e); Throwable current = e; while (current != null && current.getMessage() == null) { current = current.getCause(); } String error = ""; if (current != null && current.getMessage() != null) { error = "Message: " + current.getMessage(); } System.out.println("The operation failed. " + error); System.exit(1); } }  }
SentryShellSolr extends SentryShellCommon { public static void main(String[] args) throws Exception { SentryShellSolr sentryShell = new SentryShellSolr(); try { sentryShell.executeShell(args); } catch (Exception e) { LOGGER.error(e.getMessage(), e); Throwable current = e; while (current != null && current.getMessage() == null) { current = current.getCause(); } String error = ""; if (current != null && current.getMessage() != null) { error = "Message: " + current.getMessage(); } System.out.println("The operation failed. " + error); System.exit(1); } }  @Override void run(); static void main(String[] args); }
SentryShellSolr extends SentryShellCommon { public static void main(String[] args) throws Exception { SentryShellSolr sentryShell = new SentryShellSolr(); try { sentryShell.executeShell(args); } catch (Exception e) { LOGGER.error(e.getMessage(), e); Throwable current = e; while (current != null && current.getMessage() == null) { current = current.getCause(); } String error = ""; if (current != null && current.getMessage() != null) { error = "Message: " + current.getMessage(); } System.out.println("The operation failed. " + error); System.exit(1); } }  @Override void run(); static void main(String[] args); static final String SOLR_SERVICE_NAME; }