本文整理汇总了Java中com.surenpi.autotest.utils.StringUtils.isBlank方法的典型用法代码示例。如果您正苦于以下问题:Java StringUtils.isBlank方法的具体用法?Java StringUtils.isBlank怎么用?Java StringUtils.isBlank使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.surenpi.autotest.utils.StringUtils
的用法示例。
在下文中一共展示了StringUtils.isBlank方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execFileChoose
import com.surenpi.autotest.utils.StringUtils; //导入方法依赖的package包/类
/**
* 执行文件选择
* @param title 标题
* @param file 文件
*/
public void execFileChoose(String title, File file)
{
if(StringUtils.isBlank(title))
{
title = autoItPro.getProperty("dialog.title");
}
if(file == null || !file.isFile())
{
throw new RuntimeException(String.format("File is null or not a file [%s].", file));
}
execFileChoose(title, file.getAbsolutePath());
}
示例2: findStrategy
import com.surenpi.autotest.utils.StringUtils; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public <T> ElementSearchStrategy<T> findStrategy(Class<T> type, Element element)
{
String strategy = element.getStrategy();
strategy = StringUtils.isBlank(strategy) ? "prioritySearchStrategy" : strategyMap.get(strategy);
return (ElementSearchStrategy<T>) context.getBean(strategy, ElementSearchStrategy.class);
}
示例3: findElementsStrategy
import com.surenpi.autotest.utils.StringUtils; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public <T> ElementsSearchStrategy<T> findElementsStrategy(Class<T> type, Element element)
{
String strategy = element.getStrategy();
strategy = StringUtils.isBlank(strategy) ? "prioritySearchStrategy" : strategyMap.get(strategy);
return (ElementsSearchStrategy<T>) context.getBean(strategy, ElementsSearchStrategy.class);
}
示例4: fillNotBlankValue
import com.surenpi.autotest.utils.StringUtils; //导入方法依赖的package包/类
@Override
public void fillNotBlankValue(Element ele, Object value)
{
if(value == null || StringUtils.isBlank(value.toString()))
{
throw new RuntimeException("Can not allow null or empty value!");
}
fillValue(ele, value, true);
}
示例5: runFromClasspathFile
import com.surenpi.autotest.utils.StringUtils; //导入方法依赖的package包/类
/**
* 从类路径中查找配置文件
* @param filePath
* @throws Exception
*/
public void runFromClasspathFile(final String filePath)
throws Exception
{
if(StringUtils.isBlank(filePath))
{
throw new IllegalArgumentException("File path can not be empty.");
}
ClassLoader classLoader = SuiteRunner.class.getClassLoader();
int resCount = 0;
Enumeration<URL> resources = classLoader.getResources(filePath);
while(resources.hasMoreElements())
{
URL url = resources.nextElement();
resCount++;
progressInfo.setInfo(String.format("Prepare to run from file : [%s].", url));
//
// try(InputStream input4Valid = url.openStream())
// {
// Validation.validationSuite(input4Valid);
// }
try(InputStream input = url.openStream())
{
Suite suite = suiteParser.parse(input);
progressInfo.setInfo(String.format("Parse file [%s] complete.", url));
runSuite(suite);
}
}
progressInfo.setInfo(String.format("All runner is done, total [%s].", resCount));
}
示例6: visit
import com.surenpi.autotest.utils.StringUtils; //导入方法依赖的package包/类
@Override
public void visit(Element node)
{
if (!"locator".equals(node.getName()))
{
return;
}
String name = node.attributeValue("name");
String value = node.attributeValue("value");
String timeoutStr = node.attributeValue("timeout");
String extend = node.attributeValue("extend");
if(StringUtils.isBlank(name) || StringUtils.isBlank(value))
{
logger.error("locator has empty name or value.");
}
long timeout = 0;
if(StringUtils.isNotBlank(timeoutStr))
{
try
{
timeout = Long.parseLong(timeoutStr);
}
catch(NumberFormatException e){}
}
Map<String, Locator> beans = context.getBeansOfType(Locator.class);
Collection<Locator> locatorList = beans.values();
for(Locator locator : locatorList)
{
if(!name.equals(locator.getType()))
{
continue;
}
if(locator instanceof LocatorAware)
{
LocatorAware locatorAware = (LocatorAware) locator;
locatorAware.setValue(value);
locatorAware.setTimeout(timeout);
locatorAware.setExtend(extend);
absEle.getLocatorList().add(locator);
break;
}
}
}
示例7: initPageData
import com.surenpi.autotest.utils.StringUtils; //导入方法依赖的package包/类
/**
* 从数据源中加载指定的数据组到指定的Page类中
* @param page 页面对象
* @param row 数据组序号(从1开始)
* @return 数据源
*/
public DynamicDataSource initPageData(Page page, int row)
{
String dataSourceStr = page.getDataSource();
if(StringUtils.isBlank(dataSourceStr))
{
return null;
}
final DataSourceInfo dataSourceInfo = dataSourceMap.get(dataSourceStr);
if(dataSourceInfo == null)
{
return null;
}
getDynamicDataSources();
@SuppressWarnings({ "unchecked", "rawtypes" })
DataSource<Page> dataSource = (DataSource) dynamicDataSourceMap.get(dataSourceInfo.getType());
if(dataSource == null)
{
throw new AutoTestException("Can not found dataSource by type : " + dataSourceInfo.getType());
}
String resoucePathName = dataSourceInfo.getResource();
DataResource clzResource = new ClasspathResource(
Phoenix.class, resoucePathName);
try
{
if(clzResource.getUrl() == null)
{
if(configFile != null)
{
File file = new File(configFile.getParentFile(), dataSourceInfo.getResource());
if(!file.isFile())
{
throw new ConfigNotFoundException("dataSourceFile", file.getAbsolutePath());
}
clzResource = new FileResource(file);
}
else
{
throw new ConfigNotFoundException(String.format("Can not found dataSource file '%s' from classpath.",
resoucePathName));
}
}
}
catch (IOException e)
{
logger.error("", e);
}
dataSource.loadData(clzResource, row, page);
return dataSource;
}
示例8: runSuite
import com.surenpi.autotest.utils.StringUtils; //导入方法依赖的package包/类
/**
* 测试套件运行入口
* @param suite
* @throws DocumentException
* @throws IOException
* @throws SecurityException
* @throws NoSuchFieldException
* @throws IllegalAccessException
* @throws IllegalArgumentException
* @throws InterruptedException
* @throws SAXException
*/
private void runSuite(Suite suite)
throws IOException, DocumentException, NoSuchFieldException,
SecurityException, IllegalArgumentException, IllegalAccessException, InterruptedException, SAXException
{
String xmlConfPath = suite.getXmlConfPath();
if(StringUtils.isBlank(xmlConfPath))
{
throw new RuntimeException("Suite xml config is emtpy!");
}
URL suitePathUrl = suite.getPathUrl();
try(Phoenix phoenix = applicationClazz == null ? new Phoenix(): new Phoenix(applicationClazz))
{
phoenix.init();
String[] xmlConfArray = xmlConfPath.split(",");
for(String xmlConf : xmlConfArray)
{
this.progressInfo.setInfo(String.format("解析元素定位配置文件[%s]!", xmlConf));
if(suitePathUrl != null)
{
File patentFile = new File(URLDecoder.decode(suitePathUrl.getFile(), "utf-8"));
patentFile = patentFile.getParentFile();
phoenix.readFromSystemPath(new File(patentFile, xmlConf).toString());
}
else
{
phoenix.readFromClassPath(xmlConf);
}
}
phoenix.getEngine().setProgressId("progress_identify", progressInfo.getIdentify());
List<SuitePage> pageList = suite.getPageList();
//执行指定的数据组(按照数据序列)
Integer[] rowsArray = suite.getRowsArray();
for(int row : rowsArray)
{
long afterSleep = suite.getAfterSleep();
this.progressInfo.setInfo(String.format("准备使用第[%s]组数据运行套件,然后休眠时间[%s]毫秒!", row, afterSleep));
runSuiteWithData(phoenix, row, pageList);
if(afterSleep > 0)
{
Thread.sleep(afterSleep);
}
}
}
}