Skip to content

Commit

Permalink
rename util
Browse files Browse the repository at this point in the history
  • Loading branch information
liuxiaocs7 committed Jan 31, 2023
1 parent 7d31445 commit 8876415
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import com.bytedance.bitsail.common.configuration.BitSailConfiguration;
import com.bytedance.bitsail.connector.elasticsearch.option.ElasticsearchReaderOptions;
import com.bytedance.bitsail.connector.elasticsearch.rest.source.EsSourceRequest;
import com.bytedance.bitsail.connector.elasticsearch.utils.SplitStringUtils;
import com.bytedance.bitsail.connector.elasticsearch.util.SplitStringUtil;

import lombok.AllArgsConstructor;
import lombok.Data;
Expand Down Expand Up @@ -48,7 +48,7 @@ public List<ElasticsearchSourceSplit> getElasticsearchSplits(BitSailConfiguratio
String indices = jobConf.getNecessaryOption(ElasticsearchReaderOptions.ES_INDEX, REQUIRED_VALUE);
EsSourceRequest esSourceRequest = new EsSourceRequest(restHighLevelClient);

String[] splitIndices = SplitStringUtils.splitString(indices);
String[] splitIndices = SplitStringUtil.splitString(indices);
int idx = 0;
for (String index : splitIndices) {
if (check(index, esSourceRequest)) {
Expand All @@ -73,7 +73,7 @@ private boolean check(String index, EsSourceRequest esSourceRequest) {
@Override
public int estimateSplitNum(BitSailConfiguration configuration) {
String indices = configuration.getNecessaryOption(ElasticsearchReaderOptions.ES_INDEX, REQUIRED_VALUE);
int estimatedSplitNum = SplitStringUtils.splitString(indices).length;
int estimatedSplitNum = SplitStringUtil.splitString(indices).length;
LOG.info("Estimated split num is: {}", estimatedSplitNum);
return estimatedSplitNum;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
* limitations under the License.
*/

package com.bytedance.bitsail.connector.elasticsearch.utils;
package com.bytedance.bitsail.connector.elasticsearch.util;

import java.util.ArrayList;
import java.util.List;

import static com.bytedance.bitsail.connector.elasticsearch.base.EsConstants.SPLIT_COMMA;

public class SplitStringUtils {
public class SplitStringUtil {

public static String[] splitString(String indices) {
String[] splits = indices.split(SPLIT_COMMA);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import com.bytedance.bitsail.common.configuration.BitSailConfiguration;
import com.bytedance.bitsail.connector.elasticsearch.option.ElasticsearchReaderOptions;
import com.bytedance.bitsail.connector.elasticsearch.option.ElasticsearchWriterOptions;
import com.bytedance.bitsail.connector.elasticsearch.utils.SourceSetupUtils;
import com.bytedance.bitsail.connector.elasticsearch.util.SourceSetupUtil;
import com.bytedance.bitsail.test.connector.test.EmbeddedFlinkCluster;
import com.bytedance.bitsail.test.connector.test.testcontainers.elasticsearch.ElasticsearchCluster;
import com.bytedance.bitsail.test.connector.test.utils.JobConfUtils;
Expand All @@ -44,7 +44,7 @@ public class ElasticsearchSourceITCase {

private final int count = 10;

private SourceSetupUtils sourceEnv;
private SourceSetupUtil sourceEnv;

@Before
public void prepareEsCluster() throws Exception {
Expand All @@ -57,7 +57,7 @@ public void prepareEsCluster() throws Exception {
Collections.singletonList(esCluster.getHttpHostAddress()));

this.sourceEnv =
SourceSetupUtils.builder()
SourceSetupUtil.builder()
.esCluster(esCluster)
.jobConf(jobConf)
.indices(Arrays.asList("test1", "test2"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import com.bytedance.bitsail.common.configuration.BitSailConfiguration;
import com.bytedance.bitsail.connector.elasticsearch.option.ElasticsearchWriterOptions;
import com.bytedance.bitsail.connector.elasticsearch.utils.SourceSetupUtils;
import com.bytedance.bitsail.connector.elasticsearch.util.SourceSetupUtil;
import com.bytedance.bitsail.test.connector.test.testcontainers.elasticsearch.ElasticsearchCluster;

import org.junit.After;
Expand All @@ -38,7 +38,7 @@
public class EsSourceRequestITCase {

private static final Logger LOG = LoggerFactory.getLogger(EsSourceRequestITCase.class);
private SourceSetupUtils sourceEnv;
private SourceSetupUtil sourceEnv;

private ElasticsearchCluster esCluster;

Expand All @@ -59,7 +59,7 @@ public void setup() throws IOException, InterruptedException {
Collections.singletonList(esCluster.getHttpHostAddress()));

this.sourceEnv =
SourceSetupUtils.builder()
SourceSetupUtil.builder()
.esCluster(esCluster)
.jobConf(jobConf)
.indices(Collections.singletonList(index))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import com.bytedance.bitsail.common.configuration.BitSailConfiguration;
import com.bytedance.bitsail.connector.elasticsearch.option.ElasticsearchReaderOptions;
import com.bytedance.bitsail.connector.elasticsearch.source.split.ElasticsearchSourceSplit;
import com.bytedance.bitsail.connector.elasticsearch.utils.SourceSetupUtils;
import com.bytedance.bitsail.connector.elasticsearch.util.SourceSetupUtil;
import com.bytedance.bitsail.test.connector.test.testcontainers.elasticsearch.ElasticsearchCluster;

import org.junit.After;
Expand All @@ -48,7 +48,7 @@ public class ElasticsearchSourceSplitCoordinatorITCase {

private ElasticsearchCluster esCluster;

private SourceSetupUtils sourceEnv;
private SourceSetupUtil sourceEnv;

private BitSailConfiguration jobConf;

Expand All @@ -66,7 +66,7 @@ public void setup() throws IOException, InterruptedException {
jobConf.set(ElasticsearchReaderOptions.SPLIT_STRATEGY, "round_robin");

this.sourceEnv =
SourceSetupUtils.builder()
SourceSetupUtil.builder()
.esCluster(esCluster)
.jobConf(jobConf)
.indices(Arrays.asList("test1", "test2", "test3"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.bytedance.bitsail.connector.elasticsearch.utils;
package com.bytedance.bitsail.connector.elasticsearch.util;

import com.bytedance.bitsail.common.configuration.BitSailConfiguration;
import com.bytedance.bitsail.connector.elasticsearch.rest.EsRestClientBuilder;
Expand Down Expand Up @@ -50,9 +50,9 @@
import static org.junit.Assert.assertTrue;

@Builder
public class SourceSetupUtils {
public class SourceSetupUtil {

private static final Logger LOG = LoggerFactory.getLogger(SourceSetupUtils.class);
private static final Logger LOG = LoggerFactory.getLogger(SourceSetupUtil.class);

private final String mappings = "{\n" +
" \"properties\": {\n" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.bytedance.bitsail.connector.elasticsearch.utils;
package com.bytedance.bitsail.connector.elasticsearch.util;

import org.junit.Assert;
import org.junit.Test;
Expand All @@ -23,13 +23,13 @@

import java.util.Arrays;

public class SplitStringUtilsTest {
public class SplitStringUtilTest {

private static final Logger LOG = LoggerFactory.getLogger(SplitStringUtilsTest.class);
private static final Logger LOG = LoggerFactory.getLogger(SplitStringUtilTest.class);

@Test
public void testSplitString() {
String[] splitNames = SplitStringUtils.splitString(" test1, test2, , test3 , test4 ");
String[] splitNames = SplitStringUtil.splitString(" test1, test2, , test3 , test4 ");
LOG.info("split names: {}", Arrays.toString(splitNames));
Assert.assertEquals("Index names parse error.", 4, splitNames.length);
}
Expand Down

0 comments on commit 8876415

Please sign in to comment.