Groovy JDK,Process Management,Regular Expressions, Getting Started Guide
Date
String VS Array
#!/usr/bin/groovystr = "str1,str2,S333,S566,S88A88G"def strArray = str.split('[ \t]*,[ \t]*')println strArrayprintln strArray.join("-")
Map
def items = [:]items["key1"] = "4.00"items["key2"] = "4.02"println itemsitems = items.minus(["key2":"4.02"])// after v1.8.7 items = items.dropWhile {it.key == "key2"}println items
Find last modifIEd file(a unix/linux way,it is not compatible with windows)
import java.util.regex.Patterndef lsDateFormat = "%Y-%m-%d_%H:%M:%s" // for ls commanddef dateFormat = "yyyy-MM-dd_HH:mm:ss" // for Datedef lscmd = """ls -lt --time-" + "\"+${lsDateFormat}\" "lscmd += """/home/Prime/cycles/ | grep .*.csv$ -m 1 | cut -d ' ' -f 6-7"""def f = file.createTempfile('bash','.sh')f.write("#!/bin/bash\n")f.append(lscmd)f.append("\n")def fpath = f.getabsolutePath()"chmod +x ${fpath}".execute()def cmd = fpathlog.info(cmd)def proc1 = cmd.execute()proc1.waitFor()if ( 0 != proc1.exitValue() ) { throw new Exception("Execute ${cmd} Failed.")}def str = proc1.in.textf.delete()def pattern = Pattern.compile('([^ ]{1,}) (.*)')def matcher = pattern.matcher(str)def dStr = (new Date()).format(dateFormat)if (matcher.find()) { //count = Integer.valueOf(matcher.group(1)); dStr = matcher.group(1) filename = matcher.group(2) def d = Date.parse(dateFormat,dStr) log.info(dStr) log.info("Last modifIEd file: ${filename}. ModifIEd date: ${d}" )} else { log.error("Non file found.")}
Java
Java API
String
SoapUI
SoapUI API
TestCase,TestRunner 总结
以上是内存溢出为你收集整理的Groovy and SoapUI全部内容,希望文章能够帮你解决Groovy and SoapUI所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)