lvyanquan commented on code in PR #3254:
URL: https://github.com/apache/flink-cdc/pull/3254#discussion_r1872459342


##########
flink-cdc-e2e-tests/flink-cdc-pipeline-e2e-tests/src/test/java/org/apache/flink/cdc/pipeline/tests/MaxComputeE2eITCase.java:
##########
@@ -0,0 +1,193 @@
+/*
+ * 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.flink.cdc.pipeline.tests;
+
+import org.apache.flink.api.common.JobStatus;
+import org.apache.flink.api.common.time.Deadline;
+import org.apache.flink.cdc.common.test.utils.TestUtils;
+import org.apache.flink.cdc.connectors.maxcompute.options.MaxComputeOptions;
+import org.apache.flink.cdc.connectors.maxcompute.utils.MaxComputeUtils;
+import org.apache.flink.cdc.pipeline.tests.utils.PipelineTestEnvironment;
+import org.apache.flink.client.program.rest.RestClusterClient;
+import org.apache.flink.runtime.client.JobStatusMessage;
+import org.apache.flink.table.api.ValidationException;
+
+import com.aliyun.odps.Instance;
+import com.aliyun.odps.Odps;
+import com.aliyun.odps.data.Record;
+import com.aliyun.odps.task.SQLTask;
+import org.junit.Assert;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testcontainers.containers.GenericContainer;
+import org.testcontainers.containers.wait.strategy.Wait;
+import org.testcontainers.utility.DockerImageName;
+
+import java.io.OutputStream;
+import java.net.HttpURLConnection;
+import java.net.InetAddress;
+import java.net.URL;
+import java.net.UnknownHostException;
+import java.nio.file.Path;
+import java.time.Duration;
+import java.util.Collection;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+
+/** End-to-end tests for maxcompute cdc pipeline job. */
+public class MaxComputeE2eITCase extends PipelineTestEnvironment {
+    private static final Logger LOG = 
LoggerFactory.getLogger(MaxComputeE2eITCase.class);
+
+    public static final DockerImageName MAXCOMPUTE_IMAGE =
+            DockerImageName.parse("maxcompute/maxcompute-emulator:v0.0.4");
+
+    @ClassRule
+    public static GenericContainer<?> maxcompute =
+            new GenericContainer<>(MAXCOMPUTE_IMAGE)
+                    .withExposedPorts(8080)
+                    .waitingFor(
+                            Wait.forLogMessage(".*Started 
MaxcomputeEmulatorApplication.*\\n", 1))
+                    .withLogConsumer(frame -> 
System.out.print(frame.getUtf8String()));
+
+    public final MaxComputeOptions testOptions =
+            MaxComputeOptions.builder("ak", "sk", getEndpoint(), "mocked_mc")
+                    .withTunnelEndpoint(getEndpoint())
+                    .build();
+
+    @Test
+    public void testSingleSplitSingleTable() throws Exception {
+        startTest("SINGLE_SPLIT_SINGLE_TABLE");
+        Instance instance =
+                SQLTask.run(
+                        MaxComputeUtils.getOdps(testOptions),
+                        "select * from table1 order by col1;");
+        instance.waitForSuccess();
+        List<Record> result = SQLTask.getResult(instance);
+        System.out.println(result);
+        Assert.assertEquals(2, result.size());
+        // 2,x
+        Assert.assertEquals("2", result.get(0).get(0));
+        Assert.assertEquals("x", result.get(0).get(1));
+        // 3, NULL (MaxCompute Emulator use 'NULL' instead of null)
+        Assert.assertEquals("3", result.get(1).get(0));
+        Assert.assertEquals("NULL", result.get(1).get(1));
+    }
+
+    private void startTest(String testSet) throws Exception {
+        sendPOST(getEndpoint() + "/init", getEndpoint());
+
+        Odps odps = MaxComputeUtils.getOdps(testOptions);
+        odps.tables().delete("table1", true);
+        odps.tables().delete("table2", true);
+
+        String pipelineJob =
+                "source:\n"
+                        + "   type: values\n"

Review Comment:
   It's better to use MySQL as source connector like 
[MySqlToDorisE2eITCase](https://github.com/apache/flink-cdc/blob/26f5880fbf985aec9393a84bc4ed762b528daa9d/flink-cdc-e2e-tests/flink-cdc-pipeline-e2e-tests/src/test/java/org/apache/flink/cdc/pipeline/tests/MySqlToDorisE2eITCase.java#L62)
 and try to cover more types.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to