下面列出了org.apache.commons.lang3.StringUtils#wrap ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@Test
public void testGetJobsAssertJobNameTrimmed() throws Exception
{
String namespace = "namespace";
String jobName = StringUtils.wrap("jobName", BLANK_TEXT);
JobStatusEnum jobStatus = JobStatusEnum.COMPLETED;
Set<String> authorizedNamespaces = new HashSet<>(Arrays.asList("namespace"));
when(namespaceSecurityHelper.getAuthorizedNamespaces(any())).thenReturn(authorizedNamespaces);
NamespaceEntity namespaceEntity = new NamespaceEntity();
namespaceEntity.setCode(namespace);
when(namespaceDao.getNamespaceByCd(any())).thenReturn(namespaceEntity);
jobServiceImpl.getJobs(namespace, jobName, jobStatus, NO_START_TIME, NO_END_TIME);
verify(jobDefinitionDao).getJobDefinitionsByFilter(eq(authorizedNamespaces), eq(jobName.trim()));
}
protected String getQueryString() throws IOException {
String condition = null;
if (properties.manualQuery.getValue()) {
return properties.getQuery();
} else {
condition = properties.condition.getStringValue();
}
StringBuilder sb = new StringBuilder();
boolean isUpperCase = properties.convertColumnsAndTableToUppercase.getValue();
sb.append("select "); //$NON-NLS-1$
int count = 0;
for (Schema.Field se : getSchema().getFields()) {
if (count++ > 0) {
sb.append(", "); //$NON-NLS-1$
}
String columnName = se.getProp(SchemaConstants.TALEND_COLUMN_DB_COLUMN_NAME);
sb.append(isUpperCase ? columnName : StringUtils.wrap(columnName, '"'));
}
sb.append(" from "); //$NON-NLS-1$
String tableName = isUpperCase ? properties.getTableName() : StringUtils.wrap(properties.getTableName(), '"');
sb.append(tableName);
if (condition != null && condition.trim().length() > 0) {
sb.append(" where ");
sb.append(condition);
}
return sb.toString();
}
private static String wrap(String value) {
return value != null ? StringUtils.wrap(value, '"') : StringUtils.wrap("", '"');
}
private static String wrap(String value) {
return value != null ? StringUtils.wrap(value, '"') : StringUtils.wrap("", '"');
}
private static String wrap(String value) {
return value != null ? StringUtils.wrap(value, '"') : StringUtils.wrap("", '"');
}
private static String wrap(String value) {
return value != null ? StringUtils.wrap(value, '"') : StringUtils.wrap("", '"');
}
private static String wrap(String value) {
return value != null ? StringUtils.wrap(value, '"') : StringUtils.wrap("", '"');
}
private static String wrap(String value) {
return value != null ? StringUtils.wrap(value, '"') : StringUtils.wrap("", '"');
}
private static String wrap(String value) {
return value != null ? StringUtils.wrap(value, '"') : StringUtils.wrap("", '"');
}
private static String wrap(String value) {
return value != null ? StringUtils.wrap(value, '"') : StringUtils.wrap("", '"');
}