private void cleanup(FileTransferClient client, String dir) throws Exception { client.chdir(dir); String[] files = client.dir(); for (String file : files) { client.delete(file); } client.chdir(".."); }
@Override protected void tearDown() throws Exception { if (areTestsEnabled()) { FileTransferClient client = connectRawClient(); cleanup(client, getRemoteDirectory()); client.rmdir(getRemoteDirectory()); client.disconnect(); } }
@Override protected void setUp() throws Exception { if (areTestsEnabled()) { FileTransferClient client = connectRawClient(); try { client.mkdir(getRemoteDirectory()); } catch (Exception e) { } finally { client.disconnect(); } } }