Java Code Examples for org.apache.commons.lang3.StringUtils#wrap()

The following examples show how to use org.apache.commons.lang3.StringUtils#wrap() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: herd   File: JobServiceGetJobsTest.java    License: Apache License 2.0 6 votes vote down vote up
@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()));
}
 
Example 2
Source Project: components   File: SnowflakeReader.java    License: Apache License 2.0 5 votes vote down vote up
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();
}
 
Example 3
private static String wrap(String value) {
return value != null ? StringUtils.wrap(value, '"') : StringUtils.wrap("", '"');
  }
 
Example 4
Source Project: cf-butler   File: ProductMetric.java    License: Apache License 2.0 4 votes vote down vote up
private static String wrap(String value) {
return value != null ? StringUtils.wrap(value, '"') : StringUtils.wrap("", '"');
  }
 
Example 5
Source Project: cf-butler   File: Release.java    License: Apache License 2.0 4 votes vote down vote up
private static String wrap(String value) {
return value != null ? StringUtils.wrap(value, '"') : StringUtils.wrap("", '"');
  }
 
Example 6
Source Project: cf-butler   File: ServiceInstanceDetail.java    License: Apache License 2.0 4 votes vote down vote up
private static String wrap(String value) {
	return value != null ? StringUtils.wrap(value, '"') : StringUtils.wrap("", '"');
}
 
Example 7
Source Project: cf-butler   File: AppDetail.java    License: Apache License 2.0 4 votes vote down vote up
private static String wrap(String value) {
	return value != null ? StringUtils.wrap(value, '"') : StringUtils.wrap("", '"');
}
 
Example 8
Source Project: cf-butler   File: HistoricalRecord.java    License: Apache License 2.0 4 votes vote down vote up
private static String wrap(String value) {
	return value != null ? StringUtils.wrap(value, '"') : StringUtils.wrap("", '"');
}
 
Example 9
Source Project: cf-butler   File: AppRelationship.java    License: Apache License 2.0 4 votes vote down vote up
private static String wrap(String value) {
	return value != null ? StringUtils.wrap(value, '"') : StringUtils.wrap("", '"');
}
 
Example 10
Source Project: cf-butler   File: UserAccounts.java    License: Apache License 2.0 4 votes vote down vote up
private static String wrap(String value) {
	return value != null ? StringUtils.wrap(value, '"') : StringUtils.wrap("", '"');
}