mirror of
https://github.com/apache/sqoop.git
synced 2025-05-06 11:21:30 +08:00
SQOOP-1105. Sqoop2: Remove our implementation of StringUtils
(Raghav Kumar Gautam via Hari Shreedharan)
This commit is contained in:
parent
4997f97bc3
commit
20bbef04c4
@ -17,6 +17,7 @@
|
||||
*/
|
||||
package org.apache.sqoop.client.utils;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.sqoop.client.core.Constants;
|
||||
import org.apache.sqoop.model.MAccountableEntity;
|
||||
import org.apache.sqoop.model.MBooleanInput;
|
||||
@ -31,7 +32,6 @@
|
||||
import org.apache.sqoop.model.MJobForms;
|
||||
import org.apache.sqoop.model.MMapInput;
|
||||
import org.apache.sqoop.model.MStringInput;
|
||||
import org.apache.sqoop.utils.StringUtils;
|
||||
import org.apache.sqoop.validation.Status;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -17,6 +17,7 @@
|
||||
*/
|
||||
package org.apache.sqoop.json.util;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.sqoop.model.MBooleanInput;
|
||||
import org.apache.sqoop.model.MEnumInput;
|
||||
import org.apache.sqoop.model.MForm;
|
||||
@ -26,7 +27,6 @@
|
||||
import org.apache.sqoop.model.MIntegerInput;
|
||||
import org.apache.sqoop.model.MMapInput;
|
||||
import org.apache.sqoop.model.MStringInput;
|
||||
import org.apache.sqoop.utils.StringUtils;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
|
@ -17,8 +17,8 @@
|
||||
*/
|
||||
package org.apache.sqoop.model;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.sqoop.common.SqoopException;
|
||||
import org.apache.sqoop.utils.StringUtils;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
|
@ -1,51 +0,0 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.sqoop.utils;
|
||||
|
||||
/**
|
||||
* Convenience String methods.
|
||||
*
|
||||
* We might consider replacing this with commons-lang library at some point.
|
||||
*/
|
||||
public final class StringUtils {
|
||||
|
||||
public static String join(String []array, String separator) {
|
||||
if(array == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
boolean first = true;
|
||||
|
||||
for(String item : array) {
|
||||
if(first) {
|
||||
first = false;
|
||||
} else {
|
||||
sb.append(separator);
|
||||
}
|
||||
|
||||
sb.append(item);
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private StringUtils() {
|
||||
// Instantiation is prohibited
|
||||
}
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.sqoop.utils;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class TestStringUtils extends TestCase {
|
||||
|
||||
public void testJoin() {
|
||||
assertNull(StringUtils.join(null, "a"));
|
||||
|
||||
String []a = new String[] {"a", "b", "c"};
|
||||
|
||||
assertEquals("a,b,c", StringUtils.join(a, ","));
|
||||
assertEquals("abc", StringUtils.join(a, ""));
|
||||
}
|
||||
}
|
@ -42,6 +42,11 @@ limitations under the License.
|
||||
<artifactId>derby</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-lang</groupId>
|
||||
<artifactId>commons-lang</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
|
@ -39,6 +39,7 @@
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.sqoop.common.SqoopException;
|
||||
import org.apache.sqoop.model.MBooleanInput;
|
||||
import org.apache.sqoop.model.MConnection;
|
||||
@ -63,7 +64,6 @@
|
||||
import org.apache.sqoop.submission.counter.Counter;
|
||||
import org.apache.sqoop.submission.counter.CounterGroup;
|
||||
import org.apache.sqoop.submission.counter.Counters;
|
||||
import org.apache.sqoop.utils.StringUtils;
|
||||
|
||||
/**
|
||||
* JDBC based repository handler for Derby database.
|
||||
|
Loading…
Reference in New Issue
Block a user