You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by GitBox <gi...@apache.org> on 2022/05/31 07:11:36 UTC

[GitHub] [incubator-inlong] yunqingmoswu commented on a diff in pull request #4396: [INLONG-4301][Manager] Support oracle source

yunqingmoswu commented on code in PR #4396:
URL: https://github.com/apache/incubator-inlong/pull/4396#discussion_r885276555


##########
inlong-sort/sort-common/src/main/java/org/apache/inlong/sort/protocol/constant/OracleConstant.java:
##########
@@ -111,6 +113,15 @@ public enum ScanStartUpMode {
         ScanStartUpMode(String value) {
             this.value = value;
         }
+
+        public static ScanStartUpMode forName(String name) {
+            for (ScanStartUpMode dataType : ScanStartUpMode.values()) {
+                if (dataType.getValue().equals(name.toLowerCase(Locale.ROOT))) {

Review Comment:
   Maybe it is better to use equalsIgnoreCase?



##########
inlong-manager/manager-service/src/test/java/org/apache/inlong/manager/service/core/source/OracleSourceServiceTest.java:
##########
@@ -0,0 +1,102 @@
+/*
+ * 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.inlong.manager.service.core.source;
+
+import org.apache.inlong.manager.common.enums.SourceType;
+import org.apache.inlong.manager.common.pojo.source.StreamSource;
+import org.apache.inlong.manager.common.pojo.source.oralce.OracleSource;
+import org.apache.inlong.manager.common.pojo.source.oralce.OracleSourceRequest;
+import org.apache.inlong.manager.common.util.CommonBeanUtils;
+import org.apache.inlong.manager.service.ServiceBaseTest;
+import org.apache.inlong.manager.service.core.impl.InlongStreamServiceTest;
+import org.apache.inlong.manager.service.source.StreamSourceService;
+import org.junit.Assert;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+
+/**
+ * Oracle source service test
+ */
+public class OracleSourceServiceTest extends ServiceBaseTest {
+
+    private final String sourceName = "stream_source_service_test";
+    private static final String hostname = "127.0.0.1";
+    private static final Integer port = 1251;

Review Comment:
   Maybe it is 1521?



##########
inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/sort/util/ExtractNodeUtils.java:
##########
@@ -283,4 +288,45 @@ public static PostgresExtractNode createExtractNode(PostgresSource postgresSourc
                 postgresSource.getSchema(), postgresSource.getPort(),
                 postgresSource.getDecodingPluginName());
     }
+
+    /**
+     * Create oracleExtractNode based on OracleSourceResponse
+     *
+     * @param oracleSource oracle source response info
+     * @return oracle extract node info
+     */
+    public static OracleExtractNode createExtractNode(OracleSource oracleSource) {
+        final String id = oracleSource.getSourceName();
+        final String name = oracleSource.getSourceName();
+        final String database = oracleSource.getDatabase();
+        final String schemaName = oracleSource.getSchemaName();
+        final String tableName = oracleSource.getTableName();
+        final String primaryKey = oracleSource.getPrimaryKey();
+        final String hostName = oracleSource.getHostname();
+        final String userName = oracleSource.getUsername();
+        final String password = oracleSource.getPassword();
+        final Integer port = oracleSource.getPort();
+        ScanStartUpMode scanStartupMode = StringUtils.isBlank(oracleSource.getScanStartupMode()) ?
+                null : ScanStartUpMode.forName(oracleSource.getScanStartupMode());
+        List<StreamField> streamFieldInfos = oracleSource.getFieldList();
+        final List<FieldInfo> fieldInfos = streamFieldInfos.stream()
+                .map(streamFieldInfo -> FieldInfoUtils.parseStreamFieldInfo(streamFieldInfo, name))
+                .collect(Collectors.toList());
+        Map<String, String> properties = Maps.newHashMap();
+        return new OracleExtractNode(id,
+                name,
+                fieldInfos,
+                null,

Review Comment:
   Why it is null?



-- 
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: commits-unsubscribe@inlong.apache.org

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