当前位置: 首页>>代码示例>>Java>>正文


Java StringUtil类代码示例

本文整理汇总了Java中com.qmetry.qaf.automation.util.StringUtil的典型用法代码示例。如果您正苦于以下问题:Java StringUtil类的具体用法?Java StringUtil怎么用?Java StringUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


StringUtil类属于com.qmetry.qaf.automation.util包,在下文中一共展示了StringUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getDataProvider

import com.qmetry.qaf.automation.util.StringUtil; //导入依赖的package包/类
public static final String getDataProvider(Map<String, String> map) {
	if ((null == map) || map.isEmpty()) {
		return "";
	}
	if(map.containsKey(params.JSON_DATA_TABLE.name())){
		return dataproviders.isfw_json.name();
	}
	String f = map.get(params.DATAFILE.name());

	if (StringUtil.isNotBlank(f)) {
		if (f.endsWith(".xls")) {
			return StringUtil.isNotBlank(map.get(params.KEY.name())) ? dataproviders.isfw_excel_table.name()
					: dataproviders.isfw_excel.name();
		} else if (f.endsWith(".json")) {
			return dataproviders.isfw_json.name();
		} else {
			return dataproviders.isfw_csv.name();
		}
	}
	return StringUtil.isNotBlank(map.get(params.SQLQUERY.name())) ? dataproviders.isfw_database.name()
			: StringUtil.isNotBlank(map.get(params.KEY.name())) ? dataproviders.isfw_property.name() : "";
}
 
开发者ID:qmetry,项目名称:qaf,代码行数:23,代码来源:DataProviderFactory.java

示例2: getOptionElement

import com.qmetry.qaf.automation.util.StringUtil; //导入依赖的package包/类
private QAFExtendedWebElement getOptionElement(String loc, String val,
		Class<? extends QAFExtendedWebElement> eleClass) {
	String optLoc;
	if (!val.contains("=")) {
		if (StringUtil.isNumeric(val)) {
			optLoc = String.format(
					".//option[@value='%s' or @lineNo=%s or  @id='%s' or contains(.,'%s') ]",
					val, val, val, val);
		} else {
			optLoc = String.format(
					".//option[translate(.,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')='%s' or translate(@value,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')='%s' or translate(@id,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')='%s']",
					val.toUpperCase(), val.toUpperCase(), val.toUpperCase());
		}
	} else {
		String[] parts = val.split("=", 2);
		if (parts[0].equalsIgnoreCase("label") || parts[0].equalsIgnoreCase("text")) {
			optLoc = String.format(".//option[contains(.,'%s')]", parts[1]);
		} else if (parts[0].equalsIgnoreCase("lineNo")) {
			optLoc = String.format(".//option[%d]", Integer.parseInt(parts[1]) + 1);
		} else {
			optLoc = String.format(".//option[@%s='%s']", parts[0], parts[1]);
		}

	}
	return new QAFExtendedWebElement(getElement(loc, eleClass), By.xpath(optLoc));
}
 
开发者ID:qmetry,项目名称:qaf,代码行数:27,代码来源:ElementInteractor.java

示例3: verifyUiElements

import com.qmetry.qaf.automation.util.StringUtil; //导入依赖的package包/类
final public boolean verifyUiElements(String... fieldmapnames) {
	Field[] flds = this.getClass().getDeclaredFields();
	List<String> includeLst = null;
	boolean outcome = true;
	if ((fieldmapnames != null) && (fieldmapnames.length > 0)) {
		includeLst = Arrays.asList(fieldmapnames);
	}
	for (Field fld : flds) {
		fld.setAccessible(true);
		if (fld.isAnnotationPresent(UiElement.class)) {
			UiElement map = fld.getAnnotation(UiElement.class);
			String mapName = StringUtil.isNotBlank(map.viewLoc()) ? map.viewLoc() : fld.getName();
			if ((includeLst == null) || includeLst.contains(mapName)) {
				outcome = outcome && verifyUiData(fld);
			}
		}
	}
	return outcome;
}
 
开发者ID:qmetry,项目名称:qaf,代码行数:20,代码来源:BaseFormDataBean.java

示例4: verifyUiVaules

import com.qmetry.qaf.automation.util.StringUtil; //导入依赖的package包/类
final public boolean verifyUiVaules(String... fieldmapnames) {
	Field[] flds = this.getClass().getDeclaredFields();
	List<String> includeLst = null;
	boolean outcome = true;
	if ((fieldmapnames != null) && (fieldmapnames.length > 0)) {
		includeLst = Arrays.asList(fieldmapnames);
	}
	for (Field fld : flds) {
		fld.setAccessible(true);
		if (fld.isAnnotationPresent(UiElement.class)) {
			UiElement map = fld.getAnnotation(UiElement.class);
			String mapName = StringUtil.isNotBlank(map.viewLoc()) ? map.viewLoc() : fld.getName();
			if ((includeLst == null) || includeLst.contains(mapName)) {
				outcome = outcome && verifyUiData(fld);
			}
		}
	}
	return outcome;
}
 
开发者ID:qmetry,项目名称:qaf,代码行数:20,代码来源:BaseFormDataBean.java

示例5: fetchUiData

import com.qmetry.qaf.automation.util.StringUtil; //导入依赖的package包/类
private Object fetchUiData(Field field) {
	try {
		Method m = this.getClass().getDeclaredMethod("fetch" + StringUtil.getTitleCase(field.getName()));
		m.setAccessible(true);
		logger.debug("invoking custom fetch method for field " + field.getName());
		return m.invoke(this);

	} catch (Exception e) {
	}
	UiElement map = field.getAnnotation(UiElement.class);
	if ((null == map)) {
		return null;
	}
	Type type = map.fieldType();
	String loc = map.fieldLoc();
	Class<? extends QAFExtendedWebElement> eleClass = map.elementClass();

	return interactor.fetchValue(loc, type,eleClass);
}
 
开发者ID:qmetry,项目名称:qaf,代码行数:20,代码来源:BaseFormDataBean.java

示例6: verifyUiData

import com.qmetry.qaf.automation.util.StringUtil; //导入依赖的package包/类
private boolean verifyUiData(Field fld) {
	UiElement map = fld.getAnnotation(UiElement.class);
	Type type = map.fieldType();
	String loc = map.fieldLoc();
	String depends = map.dependsOnField();
	String depVal = map.dependingValue();
	Class<? extends QAFExtendedWebElement> eleClass = map.elementClass();

	try {
		if (StringUtil.isBlank(depends) || checkParent(depends, depVal)) {
			return interactor.verifyValue(loc, String.valueOf(getBeanData(loc)), type,eleClass);
		}
	} catch (Exception e1) {
		e1.printStackTrace();
		return false;
	}
	// Skipped so just return success
	return true;

}
 
开发者ID:qmetry,项目名称:qaf,代码行数:21,代码来源:BaseFormDataBean.java

示例7: absractArgsAandSetDesciption

import com.qmetry.qaf.automation.util.StringUtil; //导入依赖的package包/类
private void absractArgsAandSetDesciption() {
	String prefix = BDDKeyword.getKeywordFrom(name);
	if (actualArgs == null || actualArgs.length == 0) {
		final String REGEX = ParamType.getParamValueRegx();
		List<String> arguments = new ArrayList<String>();

		description = removePrefix(prefix, name);

		Pattern p = Pattern.compile(REGEX);
		Matcher m = p.matcher(description); // get a matcher object
		int count = 0;

		while (m.find()) {
			String arg = description.substring(m.start(), m.end());
			arguments.add(arg);
			count++;
		}
		for (int i = 0; i < count; i++) {
			description = description.replaceFirst(Pattern.quote(arguments.get(i)),
					Matcher.quoteReplacement("{" + i + "}"));
		}
		actualArgs = arguments.toArray(new String[]{});
	}
	name = StringUtil
			.toCamelCaseIdentifier(description.length() > 0 ? description : name);
}
 
开发者ID:qmetry,项目名称:qaf,代码行数:27,代码来源:StringTestStep.java

示例8: quoteParams

import com.qmetry.qaf.automation.util.StringUtil; //导入依赖的package包/类
public static String quoteParams(String call) {
	String exp = "(\\s|^)\\$\\{[\\w\\.]*}(\\s|$)";
	Pattern p = Pattern.compile(exp);
	Matcher matcher = p.matcher(call);
	String resultString = new String(call);
	while (matcher.find()) {
		for (int i = 0; i <= matcher.groupCount(); i++) {
			String unQuatedparam = (matcher.group(i));
			if (StringUtil.isNotBlank(unQuatedparam)) {
				String quatedparam =
						unQuatedparam.replace("${", "'${").replace("}", "}'");
				resultString = new String(StringUtil.replace(new String(resultString),
						unQuatedparam, quatedparam));
			}
		}
	}
	return resultString;
}
 
开发者ID:qmetry,项目名称:qaf,代码行数:19,代码来源:BDDDefinitionHelper.java

示例9: getTestsFromFile

import com.qmetry.qaf.automation.util.StringUtil; //导入依赖的package包/类
@Factory
public Object[] getTestsFromFile(ITestContext context) {

	if (null != context) {
		includeGroups = Arrays.asList(context.getIncludedGroups());
		excludeGroups = Arrays.asList(context.getExcludedGroups());
	}

	String sanariosloc = MetaDataScanner.getParameter(context, "scenario.file.loc");
	if (StringUtil.isNotBlank(sanariosloc)) {
		ConfigurationManager.getBundle().setProperty("scenario.file.loc", sanariosloc);
	}

	System.out.printf("include groups %s\n exclude groups: %s Scanarios location: %s \n", includeGroups,
			excludeGroups, sanariosloc);
	logger.info("scenario.file.loc"
			+ ConfigurationManager.getBundle().getStringArray("scenario.file.loc", "./scenarios"));
	for (String fileName : ConfigurationManager.getBundle().getStringArray("scenario.file.loc", "./scenarios")) {
		process(fileName);
	}

	logger.info("total test found: " + scenarios.size());
	return scenarios.toArray(new Object[scenarios.size()]);

}
 
开发者ID:qmetry,项目名称:qaf,代码行数:26,代码来源:ScenarioFactory.java

示例10: parseStepCall

import com.qmetry.qaf.automation.util.StringUtil; //导入依赖的package包/类
protected TestStep parseStepCall(Object[] statement, String referece, int lineNo) {

		String currStepName = (String) statement[0];
		Object[] currStepArgs = null;
		try {
			currStepArgs = (StringUtil.isNotBlank((String) statement[1]))
					? gson.fromJson((String) statement[1], Object[].class) : null;
		} catch (JsonSyntaxException jse) {
			logger.error(jse.getMessage() + statement[1], jse);
		}
		String currStepRes = statement.length > 2 ? (String) statement[2] : "";

		StringTestStep step = new StringTestStep(currStepName, currStepArgs);
		step.setResultParamName(currStepRes);
		step.setFileName(referece);
		step.setLineNumber(lineNo);

		return step;

	}
 
开发者ID:qmetry,项目名称:qaf,代码行数:21,代码来源:AbstractScenarioFileParser.java

示例11: addAssertionLog

import com.qmetry.qaf.automation.util.StringUtil; //导入依赖的package包/类
public void addAssertionLog(String msg, MessageTypes type) {
	CheckpointResultBean bean = new CheckpointResultBean();
	bean.setMessage(msg);
	bean.setType(type);
	boolean added = addCheckpoint(bean);

	if (added && StringUtil.isBlank(getLastCapturedScreenShot())
			&& ((ApplicationProperties.FAILURE_SCREENSHOT.getBoolenVal(true) && (type == MessageTypes.Fail))
					|| ((type != MessageTypes.Info)
							&& ApplicationProperties.SUCEESS_SCREENSHOT.getBoolenVal(false)))) {

		takeScreenShot();
	}
	bean.setScreenshot(getLastCapturedScreenShot());
	setLastCapturedScreenShot("");

	if (type == MessageTypes.Fail) {
		verificationErrors.append(msg);
	}

}
 
开发者ID:qmetry,项目名称:qaf,代码行数:22,代码来源:AssertionService.java

示例12: captureScreenShot

import com.qmetry.qaf.automation.util.StringUtil; //导入依赖的package包/类
private String captureScreenShot() {
	String filename = StringUtil.createRandomString(getTestCaseName()) + ".png";
	try {
		selenium.captureEntirePageScreenshot(getScreenShotDir() + filename, "");
	} catch (Exception e) {
		try {
			selenium.windowFocus();
		} catch (Throwable t) {
			logger.error(t);
		}
		selenium.captureScreenshot(getScreenShotDir() + filename);
	}
	lastCapturedScreenShot = filename;
	logger.info("Captured screen shot: " + lastCapturedScreenShot);
	return filename;
}
 
开发者ID:qmetry,项目名称:qaf,代码行数:17,代码来源:AssertionService.java

示例13: getResults

import com.qmetry.qaf.automation.util.StringUtil; //导入依赖的package包/类
@Override
public String getResults(Collection<CheckpointResultBean> bean) {
	StringBuilder sb = new StringBuilder(SEC_Header);
	for (CheckpointResultBean checkpointResultBean : bean) {
		String msg = checkpointResultBean.getMessage();
		if (StringUtil.isNotBlank(checkpointResultBean.getScreenshot())) {
			msg = msg + formatScreenshot(checkpointResultBean.getScreenshot());
		}
		sb.append(MessageTypes.valueOf(checkpointResultBean.getType()).formatMessage(msg));
		if (!checkpointResultBean.getSubCheckPoints().isEmpty()) {
			sb.append(getResults(checkpointResultBean.getSubCheckPoints()));
		}
	}
	sb.append(SEC_Footer);
	return sb.toString();
}
 
开发者ID:qmetry,项目名称:qaf,代码行数:17,代码来源:HtmlCheckpointResultFormatter.java

示例14: addAssertionLog

import com.qmetry.qaf.automation.util.StringUtil; //导入依赖的package包/类
public void addAssertionLog(String msg, MessageTypes type) {
	logger.debug(type.formatText(msg));
	CheckpointResultBean bean = new CheckpointResultBean();
	bean.setMessage(msg);
	bean.setType(type);
	boolean added = addCheckpoint(bean);

	if (added && StringUtil.isBlank(getLastCapturedScreenShot())
			&& ((ApplicationProperties.FAILURE_SCREENSHOT.getBoolenVal(true) && (type.isFailure()))
					|| ((type != MessageTypes.Info)
							&& ApplicationProperties.SUCEESS_SCREENSHOT.getBoolenVal(false)))) {

		takeScreenShot();
	}
	bean.setScreenshot(getLastCapturedScreenShot());
	setLastCapturedScreenShot("");

	if (type == MessageTypes.Fail) {
		int verificationErrors = getVerificationErrors() +1;
		getContext().setProperty(VERIFICATION_ERRORS, verificationErrors);
	}

}
 
开发者ID:qmetry,项目名称:qaf,代码行数:24,代码来源:QAFTestBase.java

示例15: beforeInitialize

import com.qmetry.qaf.automation.util.StringUtil; //导入依赖的package包/类
@Override
public void beforeInitialize(Capabilities desiredCapabilities) {
	if (ConfigurationUtils.getBaseBundle().getString("remote.server", "").contains("perfecto")) {
		String eclipseExecutionId = ConfigurationUtils.getExecutionIdCapability();

		if (StringUtil.isNotBlank(eclipseExecutionId)) {
			((DesiredCapabilities) desiredCapabilities)
					.setCapability("eclipseExecutionId", eclipseExecutionId);
		}
	}
}
 
开发者ID:Project-Quantum,项目名称:Quantum,代码行数:12,代码来源:PerfectoDriverListener.java


注:本文中的com.qmetry.qaf.automation.util.StringUtil类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。