Copy from Atlas Autobuild scripts as a starting point
This commit is contained in:
parent
b9a22c1989
commit
2d66e342df
92 changed files with 11897 additions and 0 deletions
32
Common_scripts/remoteaccess/ftp.groovy
Normal file
32
Common_scripts/remoteaccess/ftp.groovy
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
import org.apache.commons.net.ftp.FTPClient
|
||||
|
||||
class FTPSiteInfo {
|
||||
String url
|
||||
String username
|
||||
String password
|
||||
String workingdirectory
|
||||
|
||||
FTPSiteInfo(String url, String username, String password, String workingdirectory) {
|
||||
this.url = url
|
||||
this.username = username
|
||||
this.password = password
|
||||
this.workingdirectory = workingdirectory
|
||||
}
|
||||
}
|
||||
|
||||
FTPSiteInfo createFTPSiteInfo(String url, String username, String password, String workingdirectory) {
|
||||
FTPSiteInfo ftpsiteinfo = new FTPSiteInfo(url, username, password, workingdirectory)
|
||||
return ftpsiteinfo
|
||||
}
|
||||
|
||||
FTPClient createFTPClient(FTPSiteInfo ftpsiteinfo) {
|
||||
FTPClient ftpclient = new FTPClient()
|
||||
ftpclient.connect(ftpsiteinfo.url)
|
||||
ftpclient.enterLocalPassiveMode()
|
||||
ftpclient.login(ftpsiteinfo.username, ftpsiteinfo.password)
|
||||
ftpclient.changeWorkingDirectory(ftpsiteinfo.workingdirectory)
|
||||
|
||||
return ftpclient
|
||||
}
|
||||
|
||||
return this;
|
||||
28
Common_scripts/remoteaccess/hostedftp.groovy
Normal file
28
Common_scripts/remoteaccess/hostedftp.groovy
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
ftpremote = load("${autobuilder.commonscripts()}/remoteaccess/ftp.groovy")
|
||||
|
||||
def getHostedFTPSiteInfo() {
|
||||
hostedftpsiteinfo =
|
||||
ftpremote.createFTPSiteInfo("ftp.hostedftp.com",
|
||||
"ftp@globalinkjetsystems.com",
|
||||
"ramshorn42",
|
||||
"/Customers/")
|
||||
return hostedftpsiteinfo
|
||||
}
|
||||
|
||||
def getCustomerList() {
|
||||
def List<String> customerfilenames = new ArrayList<String>()
|
||||
def List<String> customers = new ArrayList<String>()
|
||||
|
||||
def ftpsiteinfo = getHostedFTPSiteInfo()
|
||||
def ftpclient = ftpremote.createFTPClient(ftpsiteinfo)
|
||||
|
||||
customerfilenames = ftpclient.listNames()
|
||||
for(customer in customerfilenames) {
|
||||
def String converted = new String(customer.getBytes("ISO-8859-1"), "UTF-8")
|
||||
customers.add(converted)
|
||||
}
|
||||
ftpclient.disconnect()
|
||||
return customers
|
||||
}
|
||||
|
||||
return this;
|
||||
Loading…
Add table
Add a link
Reference in a new issue