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


Java StringUtil.isBlank方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: invokeCustomDataProvider

import com.qmetry.qaf.automation.util.StringUtil; //导入方法依赖的package包/类
private Iterator<Object[]> invokeCustomDataProvider(ITestNGMethod tm, ITestContext c, String dp, String dpc) {
	if(StringUtil.isBlank(dpc)){
		dpc=getBundle().getString("global.dataproviderclass",getBundle().getString("dataproviderclass"));
	}
	if(StringUtil.isNotBlank(dpc)){
		Method m = getDataProviderMethod(dp, dpc);
		Object instanceToUse = ClassHelper.newInstanceOrNull(m.getDeclaringClass());
		return InvocatoinHelper.invokeDataProvider(instanceToUse, m, tm, c, null, new Configuration().getAnnotationFinder());
	}else{
		throw new AutomationError("Data-provider class not found. Please provide fully qualified class name as dataProviderClass");
	}
}
 
开发者ID:qmetry,项目名称:qaf,代码行数:13,代码来源:DataDrivenScenario.java

示例5: processStatements

import com.qmetry.qaf.automation.util.StringUtil; //导入方法依赖的package包/类
protected void processStatements(Object[][] statements, String referece, List<Scenario> scenarios) {

		for (int statementIndex = 0; statementIndex < statements.length; statementIndex++) {

			String type = ((String) statements[statementIndex][0]).trim();

			// ignore blanks and statements outside scenario or step-def
			if (StringUtil.isBlank(type) || type.equalsIgnoreCase(TEST_DATA) || !(type.equalsIgnoreCase(STEP_DEF)
					|| type.equalsIgnoreCase(SCENARIO) || type.equalsIgnoreCase(END))) {
				String nextSteptype = "";
				do {
					statementIndex++;
					if (statements.length > (statementIndex + 2)) {
						nextSteptype = ((String) statements[statementIndex + 1][0]).trim();
					} else {
						nextSteptype = END; //
					}
				} while (!(nextSteptype.equalsIgnoreCase(STEP_DEF) || nextSteptype.equalsIgnoreCase(SCENARIO)
						|| nextSteptype.equalsIgnoreCase(END)));
			}

			// Custom step definition
			if (type.equalsIgnoreCase(STEP_DEF)) {
				statementIndex = parseStepDef(statements, statementIndex, referece);
			} else if (type.equalsIgnoreCase(SCENARIO)) {
				statementIndex = parseScenario(statements, statementIndex, referece, scenarios);
			}
		}

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

示例6: processStatements

import com.qmetry.qaf.automation.util.StringUtil; //导入方法依赖的package包/类
protected void processStatements(Object[][] statements, String referece,
		List<Scenario> scenarios) {

	for (int statementIndex =
			0; statementIndex < statements.length; statementIndex++) {

		String type = ((String) statements[statementIndex][0]).trim();

		// ignore blanks and statements outside scenario or step-def
		if (StringUtil.isBlank(type)
				|| !(type.equalsIgnoreCase(FEATURE) || type.equalsIgnoreCase(SCENARIO)
						|| type.equalsIgnoreCase(EXAMPLES))) {
			String nextSteptype = "";
			do {
				statementIndex++;
				if (statements.length > (statementIndex + 2)) {
					nextSteptype = ((String) statements[statementIndex][0]).trim();
				} else {
					nextSteptype = END; //
				}
			} while (!(nextSteptype.equalsIgnoreCase(EXAMPLES)
					|| nextSteptype.equalsIgnoreCase(SCENARIO)
					|| nextSteptype.equalsIgnoreCase(END)));
		}

		// Custom step definition
		if (type.equalsIgnoreCase(STEP_DEF)) {
			statementIndex = parseStepDef(statements, statementIndex, referece);
		} else if (type.equalsIgnoreCase(SCENARIO)) {
			statementIndex =
					parseScenario(statements, statementIndex, referece, scenarios);
		}
	}

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

示例7: getType

import com.qmetry.qaf.automation.util.StringUtil; //导入方法依赖的package包/类
public static Type getType(String stmt) {
	if (StringUtil.isBlank(stmt)) {
		return EmptyLine;
	}
	for (Type type : Type.values()) {
		if (type.equals(EmptyLine)) {
			break;
		}
		if (StringMatcher.startsWithIgnoringCase(type.indicator).match(stmt)) {
			return type;
		}
	}
	return Other;
}
 
开发者ID:qmetry,项目名称:qaf,代码行数:15,代码来源:CodeGenerator.java

示例8: getLastCapturedScreenShot

import com.qmetry.qaf.automation.util.StringUtil; //导入方法依赖的package包/类
public String getLastCapturedScreenShot() {
	if (StringUtil.isBlank(lastCapturedScreenShot)) {
		return "";
	}
	String dir = ApplicationProperties.SCREENSHOT_RELATIVE_PATH
			.getStringVal(FileUtil.getReletivePath(ApplicationProperties.REPORT_DIR.getStringVal("./"),
					ApplicationProperties.SCREENSHOT_DIR.getStringVal("./img/")));
	if (!dir.endsWith("/")) {
		dir = dir + "/";
	}
	return dir + lastCapturedScreenShot;
}
 
开发者ID:qmetry,项目名称:qaf,代码行数:13,代码来源:AssertionService.java

示例9: getLastCapturedScreenShot

import com.qmetry.qaf.automation.util.StringUtil; //导入方法依赖的package包/类
public String getLastCapturedScreenShot() {
	if (!hasDriver() || StringUtil.isBlank(lastCapturedScreenShot)) {
		return "";
	}
	String dir = ApplicationProperties.SCREENSHOT_RELATIVE_PATH
			.getStringVal(FileUtil.getReletivePath(ApplicationProperties.REPORT_DIR.getStringVal("./"),
					ApplicationProperties.SCREENSHOT_DIR.getStringVal("./img/")));
	if (!dir.endsWith("/")) {
		dir = dir + "/";
	}
	return dir + lastCapturedScreenShot;
}
 
开发者ID:qmetry,项目名称:qaf,代码行数:13,代码来源:QAFTestBase.java

示例10: processResult

import com.qmetry.qaf.automation.util.StringUtil; //导入方法依赖的package包/类
protected void processResult(ITestResult tr, ITestContext context) {
	QAFTestBase stb = TestBaseProvider.instance().get();

	if ((stb.getVerificationErrors() > 0)
			&& (tr.getStatus() == ITestResult.SUCCESS)) {
		setFailure(tr, context);
	}

	if (tr.getStatus() == ITestResult.FAILURE) {
		String failiremsg = getFailureMessage(tr.getThrowable());
		CheckpointResultBean lastFailedChkPoint =
				getLastFailedCheckpointResultBean(stb.getCheckPointResults());

		// not an assertion of verification failure
		if (null != lastFailedChkPoint) {
			// ensure last failed check-point has screenshot

			if (StringUtil.isBlank(lastFailedChkPoint.getScreenshot())) {
				// get last failed sub-checkpoint
				CheckpointResultBean lastFailedSubChkPoint =
						getLastFailedCheckpointResultBean(
								lastFailedChkPoint.getSubCheckPoints());

				if (lastFailedSubChkPoint != null && StringUtil
						.isNotBlank(lastFailedSubChkPoint.getScreenshot())) {
					lastFailedChkPoint
							.setScreenshot(lastFailedSubChkPoint.getScreenshot());

				} else {
					stb.takeScreenShot();
					lastFailedChkPoint.setScreenshot(stb.getLastCapturedScreenShot());
				}
			}
		} else if (StringUtil.isNotBlank(failiremsg)) {
			logger.error(tr.getThrowable());

			// stb.addAssertionLogWithScreenShot(failiremsg,
			// MessageTypes.Fail);
			stb.takeScreenShot();
			CheckpointResultBean stepResultBean = new CheckpointResultBean();
			stepResultBean.setMessage(failiremsg);
			stepResultBean.setType(MessageTypes.Fail);
			stepResultBean.setScreenshot(stb.getLastCapturedScreenShot());
			stb.getCheckPointResults().add(stepResultBean);

		}
		// discontinue support for "selenium.wait.failure.setskip". Use QAS
		// listener instead
		// if ((tr.getThrowable() instanceof WaitTimedOutException)
		// && (getBundle().getBoolean("selenium.wait.failure.setskip"))) {
		// setSkip(tr, context);
		// }
	}
}
 
开发者ID:qmetry,项目名称:qaf,代码行数:55,代码来源:QAFTestNGListener.java

示例11: getTestName

import com.qmetry.qaf.automation.util.StringUtil; //导入方法依赖的package包/类
private static String getTestName(String testname) {
	return StringUtil.isBlank(testname) ? ""
			: testname.replaceAll("[^a-zA-Z0-9_]+", "");
}
 
开发者ID:qmetry,项目名称:qaf,代码行数:5,代码来源:ReporterUtil.java

示例12: removePrefix

import com.qmetry.qaf.automation.util.StringUtil; //导入方法依赖的package包/类
private static String removePrefix(String prefix, String s) {
	if (StringUtil.isBlank(prefix))
		return s;
	return s.substring(prefix.length()).trim();
}
 
开发者ID:qmetry,项目名称:qaf,代码行数:6,代码来源:StringTestStep.java

示例13: getCodeSnippet

import com.qmetry.qaf.automation.util.StringUtil; //导入方法依赖的package包/类
public String getCodeSnippet() {
	if (StringUtil.isBlank(codeSnippet)) {
		generateCodeSnippet();
	}
	return codeSnippet;
}
 
开发者ID:qmetry,项目名称:qaf,代码行数:7,代码来源:StringTestStep.java

示例14: parseStepDef

import com.qmetry.qaf.automation.util.StringUtil; //导入方法依赖的package包/类
protected int parseStepDef(Object[][] statements, int statementIndex, String referece) {

		Object[] stepDef = statements[statementIndex];

		String stepName = stepDef.length > 1 ? ((String) stepDef[1]).trim() : "";
		String description = stepName;

		int lineNo = getLineNum(statements, statementIndex);
		ArrayList<TestStep> steps = new ArrayList<TestStep>();

		CustomStep customStep = new CustomStep(stepName, StringUtil.isBlank(description) ? stepName : description,
				steps);
		customStep.setFileName(referece);
		customStep.setLineNumber(lineNo);

		String nextSteptype = "";
		do {
			statementIndex++;
			lineNo = getLineNum(statements, statementIndex);

			String currStepName = (String) statements[statementIndex][0];

			if (!currStepName.equalsIgnoreCase(END)) {
				StringTestStep step = new StringTestStep((String) statements[statementIndex][0],
						gson.fromJson((String) statements[statementIndex][1], Object[].class));
				step.setResultParamName((String) statements[statementIndex][2]);
				step.setFileName(referece);
				step.setLineNumber(lineNo);
				steps.add(step);
			}
			if (statements.length > (statementIndex + 2)) {
				nextSteptype = ((String) statements[statementIndex + 1][0]).trim();
			} else {
				nextSteptype = END; //
			}
		} while (!(nextSteptype.equalsIgnoreCase(STEP_DEF) || nextSteptype.equalsIgnoreCase(SCENARIO)
				|| nextSteptype.equalsIgnoreCase(END) || nextSteptype.equalsIgnoreCase(TEST_DATA)));

		if (stepDef.length > 2 && null != stepDef[2]) {
			try {
				String metadatastr = (String) stepDef[2];

				Map<String, Object> metadata = StringUtil.isBlank(metadatastr) ? new HashMap<String, Object>()
						: JSONUtil.toMap(metadatastr);
				customStep.setMetaData(metadata);

				if (metadata.containsKey("name")) {
					stepName = (String) metadata.get("name");
					customStep.setName(stepName);

				}
				if (metadata.containsKey("description")) {
					description = (String) metadata.get("description");
					customStep.setDescription(description);
				}
				if (metadata.containsKey("threshold")) {
					int threshold = ((Number) metadata.get("threshold")).intValue();
					customStep.setThreshold(threshold);
				}

			} catch (JSONException e) {

			}
		}
		StringTestStep.addStep(stepName, customStep);

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

示例15: parseScenario

import com.qmetry.qaf.automation.util.StringUtil; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
protected int parseScenario(Object[][] statements, int statementIndex, String referece, List<Scenario> scenarios) {

	String description = statements[statementIndex].length > 2 ? (String) statements[statementIndex][2] : "";
	String stepName = statements[statementIndex].length > 1 ? ((String) statements[statementIndex][1]).trim() : "";

	int lineNo = getLineNum(statements, statementIndex);

	// collect all steps of scenario
	Collection<TestStep> steps = new ArrayList<TestStep>();

	Map<String, Object> metadata = new TreeMap<String, Object>(String.CASE_INSENSITIVE_ORDER);
	if (StringUtil.isNotBlank(description)) {
		metadata.putAll(gson.fromJson(description, Map.class));
	}
	metadata.put("referece", referece);
	metadata.put("lineNo", lineNo);

	/**
	 * check enabled flag in meta-data and apply groups filter if configured
	 * in xml configuration file. the custom meta-data filter will covered
	 * in method filter where it will not include groups from xml
	 * configuration file.
	 */
	if (include(includeGroups, excludeGroups, metadata)) {
		String dataProvider = getDP(metadata);
		Scenario scenario = StringUtil.isBlank(dataProvider) ? new Scenario(stepName, steps, metadata)
				: new DataDrivenScenario(stepName, steps, dataProvider, metadata);

		scenarios.add(scenario);
	} else {
		logger.debug("Excluded SCENARIO - " + stepName + ":" + metadata.get(DESCRIPTION));
	}
	String nextSteptype = "";
	do {
		statementIndex++;
		lineNo = getLineNum(statements, statementIndex);

		String currStepName = (String) statements[statementIndex][0];
		if (!currStepName.equalsIgnoreCase(END)) {
			TestStep step = parseStepCall(statements[statementIndex], referece, lineNo);
			steps.add(step);
		}

		if (statements.length > (statementIndex + 2)) {
			nextSteptype = ((String) statements[statementIndex + 1][0]).trim();
		} else {
			nextSteptype = END; // EOF
		}
	} while (!(nextSteptype.equalsIgnoreCase(STEP_DEF) || nextSteptype.equalsIgnoreCase(SCENARIO)
			|| nextSteptype.equalsIgnoreCase(END) || nextSteptype.equalsIgnoreCase(TEST_DATA)));

	return statementIndex;

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


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