private static boolean isCredentialShellInteractiveEnabled() { boolean ret = false; String fieldName = "interactive"; CredentialShell cs = new CredentialShell(); try { Field interactiveField = cs.getClass().getDeclaredField(fieldName); if (interactiveField != null) { interactiveField.setAccessible(true); ret = interactiveField.getBoolean(cs); System.out.println( "FOUND value of [" + fieldName + "] field in the Class [" + cs.getClass().getName() + "] = [" + ret + "]"); } } catch (Throwable e) { System.out.println( "Unable to find the value of [" + fieldName + "] field in the Class [" + cs.getClass().getName() + "]. Skiping -f option"); e.printStackTrace(); ret = false; } return ret; }
@Before public void setup() throws Exception { int ret; // // adding a delete before creating a keystore // try { if (ksFile != null) { if (ksFile.exists()) { System.out.println( "Keystore File [" + ksFile.getAbsolutePath() + "] is available - and deleting"); ksFile.delete(); System.out.println("Keystore File [" + ksFile.getAbsolutePath() + "] is deleted."); } else { System.out.println("Keystore File [" + ksFile.getAbsolutePath() + "] is not available"); } } else { System.out.println("Keystore File is NULL"); } } catch (Throwable t) { t.printStackTrace(); } Configuration conf = new Configuration(); CredentialShell cs = new CredentialShell(); cs.setConf(conf); try { ret = cs.run(argsCreate); } catch (Exception e) { throw e; } assertEquals(0, ret); System.out.println("(1) Number of active Threads : " + Thread.activeCount()); listThreads(); }
@After public void teardown() throws Exception { System.out.println("In teardown : Number of active Threads : " + Thread.activeCount()); int ret; Configuration conf = new Configuration(); CredentialShell cs = new CredentialShell(); cs.setConf(conf); try { ret = cs.run(argsDelete); } catch (Exception e) { throw e; } assertEquals(0, ret); listThreads(); }