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

The following examples show how to use org.apache.commons.lang3.StringUtils#wrap() . 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 File: JobServiceGetJobsTest.java    From herd with 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 File: SnowflakeReader.java    From components with 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
Source File: QueryPolicyExecutorTask.java    From cf-butler with 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 4
Source File: ProductMetric.java    From cf-butler with 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 File: Release.java    From cf-butler with 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 File: ServiceInstanceDetail.java    From cf-butler with 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 File: AppDetail.java    From cf-butler with 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 File: HistoricalRecord.java    From cf-butler with 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 File: AppRelationship.java    From cf-butler with 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 File: UserAccounts.java    From cf-butler with Apache License 2.0 4 votes vote down vote up
private static String wrap(String value) {
	return value != null ? StringUtils.wrap(value, '"') : StringUtils.wrap("", '"');
}