Skip to content

Commit

Permalink
make compile pass
Browse files Browse the repository at this point in the history
  • Loading branch information
baisui1981 committed Jul 31, 2023
1 parent 2a62202 commit 09d46ba
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 27 deletions.
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
/**
* 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.
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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 com.qlangtech.tis.plugin.ds.cassandra;
Expand Down Expand Up @@ -54,7 +54,7 @@ public static CassandraDatasourceFactory getDS() {
public void testGetTableMetadata() {
Set<String> keys = Sets.newHashSet("city", "user_id", "user_name");
CassandraDatasourceFactory ds = getDS();
List<ColumnMetaData> colsMeta = ds.getTableMetadata(EntityName.parse("user_dtl"));
List<ColumnMetaData> colsMeta = ds.getTableMetadata(false, EntityName.parse("user_dtl"));
assertEquals(3, colsMeta.size());
for (ColumnMetaData col : colsMeta) {
assertTrue(keys.contains(col.getKey()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

package com.qlangtech.tis.plugin.datax;

import com.google.common.collect.Lists;
import com.qlangtech.tis.datax.IDataxProcessor;
import com.qlangtech.tis.datax.impl.DataxProcessor;
import com.qlangtech.tis.datax.impl.DataxWriter;
Expand All @@ -28,10 +29,8 @@
import com.qlangtech.tis.plugin.common.WriterTemplate;
import com.qlangtech.tis.plugin.ds.CMeta;
import com.qlangtech.tis.plugin.ds.DataXReaderColType;
import com.qlangtech.tis.plugin.ds.ISelectedTab;
import com.qlangtech.tis.plugin.ds.clickhouse.ClickHouseDataSourceFactory;
import org.apache.commons.io.FileUtils;
import org.apache.curator.shaded.com.google.common.collect.Lists;
import org.easymock.EasyMock;

import java.io.File;
Expand Down Expand Up @@ -254,7 +253,7 @@ public void testRealDump() throws Exception {
};
EasyMock.replay(dataXProcessor);
DataXClickhouseWriter writer = new DataXClickhouseWriter();
WriterTemplate.realExecuteDump( WriterJson.path( clickhouse_datax_writer_assert_without_optional), writer);
WriterTemplate.realExecuteDump(WriterJson.path(clickhouse_datax_writer_assert_without_optional), writer);

EasyMock.verify(dataXProcessor);
} finally {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@

package com.qlangtech.tis.plugin.datax;

import com.alibaba.datax.common.util.Configuration;
import com.qlangtech.tis.datax.impl.DataxReader;
import com.qlangtech.tis.extension.impl.IOUtils;
import com.qlangtech.tis.hdfs.impl.HdfsFileSystemFactory;
import com.qlangtech.tis.hdfs.test.HdfsFileSystemFactoryTestUtils;
import com.qlangtech.tis.plugin.common.PluginDesc;
Expand Down Expand Up @@ -120,7 +122,12 @@ public void testRealDump() throws Exception {
return dataxReader;
};

Configuration readerConf = IOUtils.loadResourceFromClasspath(
dataxReader.getClass(), "hdfs-datax-reader-assert-without-option-val.json", true, (writerJsonInput) -> {
return Configuration.from(writerJsonInput);
});

File rcontent = new File("hdfs-datax-reader-content.txt");
ReaderTemplate.realExecute("hdfs-datax-reader-assert-without-option-val.json", rcontent, dataxReader);
ReaderTemplate.realExecute(dataXName, readerConf,rcontent, dataxReader);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

import com.qlangtech.tis.assemble.FullbuildPhase;
import com.qlangtech.tis.cloud.ITISCoordinator;
import com.qlangtech.tis.datax.CuratorDataXTaskMessage;
import com.qlangtech.tis.datax.DataXJobInfo;
import com.qlangtech.tis.datax.DataXJobSubmit;
import com.qlangtech.tis.datax.IDataxProcessor;
import com.qlangtech.tis.exec.ExecutePhaseRange;
Expand Down Expand Up @@ -118,21 +120,26 @@ public void testCreateDataXJob() throws Exception {

DataXJobSubmit.TableDataXEntity dataXEntity
= DataXJobSubmit.TableDataXEntity.createTableEntity4Test(dataXfileName, dump_table_name);
CuratorDataXTaskMessage dataXTaskMessage = new CuratorDataXTaskMessage();
DataXJobInfo jobName = DataXJobInfo.parse("base_1.json/base_01,base_02");
// DataXJobSubmit.IDataXJobContext taskContext, RpcServiceReference statusRpc
// , DataXJobInfo jobName, IDataxProcessor processor, CuratorDataXTaskMessage dataXJobDTO

IRemoteTaskTrigger dataXJob = jobSubmit.createDataXJob(
dataXJobContext, statusRpc, dataxProcessor, dataXEntity, Collections.emptyList());
dataXJobContext, statusRpc, jobName ,dataxProcessor, dataXTaskMessage);

// RunningStatus running = getRunningStatus(dataXJob);
// assertTrue("running.isSuccess", running.isSuccess());

jobSubmit.setMainClassName(LocalDataXJobMainEntrypointThrowException.class.getName());
dataXJob = jobSubmit.createDataXJob(dataXJobContext, statusRpc, dataxProcessor, dataXEntity, Collections.emptyList());
dataXJob = jobSubmit.createDataXJob(dataXJobContext, statusRpc,jobName ,dataxProcessor, dataXTaskMessage);

// running = getRunningStatus(dataXJob);
// assertFalse("shall faild", running.isSuccess());
// assertTrue("shall complete", running.isComplete());

jobSubmit.setMainClassName(LocalDataXJobMainEntrypointCancellable.class.getName());
dataXJob = jobSubmit.createDataXJob(dataXJobContext, statusRpc, dataxProcessor, dataXEntity, Collections.emptyList());
dataXJob = jobSubmit.createDataXJob(dataXJobContext, statusRpc,jobName ,dataxProcessor , dataXTaskMessage);
// running = getRunningStatus(dataXJob, false);
Thread.sleep(2000);
dataXJob.cancel();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public void testCreateSinkFunction() throws Exception {
Map<String, TableAlias> aliasMap = new HashMap<>();
TableAlias tab = new TableAlias(tableName);
aliasMap.put(tableName, tab);
EasyMock.expect(dataxProcessor.getTabAlias()).andReturn(new TableAliasMapper(aliasMap));
EasyMock.expect(dataxProcessor.getTabAlias(null)).andReturn(new TableAliasMapper(aliasMap));

this.replay();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public void testTabAggre() {
// final String jdbcUrl = "jdbc_url_1";
DBIdentity dbId = DBIdentity.parseId("order2");
final String dataXCfgFileName = "base_0.json";
DefaultSplitTableStrategy splitTableStrategy = SplitTableStrategyUtils.createSplitTableStrategy();
DefaultSplitTableStrategy splitTableStrategy = new DefaultSplitTableStrategy();
TableInDB tableInDB = splitTableStrategy.createTableInDB(dbId);

for (String tab : splitTabs) {
Expand All @@ -78,8 +78,7 @@ public void testGetAllPhysicsTabs() {
String jdbcUrl = "jdbc:mysql://192.168.28.200:3306/order1?useUnicode=yes&useCursorFetch=true&useSSL=false&serverTimezone=Asia%2FShanghai&useCompression=true&characterEncoding=utf8";


DefaultSplitTableStrategy splitTableStrategy = SplitTableStrategyUtils.createSplitTableStrategy();

DefaultSplitTableStrategy splitTableStrategy = new DefaultSplitTableStrategy();
DataSourceFactory dsFactory = mock("dsFactory", DataSourceFactory.class);

DefaultSplitTableStrategy.SplitableTableInDB tabsInDB
Expand Down

0 comments on commit 09d46ba

Please sign in to comment.