@Before public void setUp() throws Exception { Properties prop = new Properties(); InputStream input = null; FileInputStream fileInput = null; try { URL location = TestInitializeAsUnixUser.class.getProtectionDomain().getCodeSource().getLocation(); System.out.println(location.getFile()); File file = new File("config\\credentials.properties"); fileInput = new FileInputStream(file); // input = getClass().getResourceAsStream(filename); if (fileInput == null) { fail("could load configuration file"); return; } prop.load(fileInput); userName = prop.getProperty("username"); repository = prop.getProperty("repository"); password = prop.getProperty("password"); } catch (IOException ex) { ex.printStackTrace(); } finally { if (input != null) { try { input.close(); } catch (IOException e) { e.printStackTrace(); } } } sMgr = dfcUtils.getSessionManager(userName, password, repository); if (sMgr == null) { fail("could not retrieve sessionManager"); return; } session = sMgr.newSession(repository); if (session == null) { fail("could not retrieve session"); return; } }
@Test public void testValidArgsInput_shouldCallMethodAndWaitForResults() { try { assert (session != null); String arguments = "-docbase_name eimabupp -user_name dmadmin -job_id 080004bc80000395 -method_trace_level 10"; String methodName = "dm_LDAPSynchronization"; IDfCollection results = idfcutils.callMethodSynchronously(methodName, arguments, session); assertNotEquals(null, results); } catch (DfException df) { fail("DfException thrown when not expectd"); } }