pandaapo commented on code in PR #4522:
URL: https://github.com/apache/eventmesh/pull/4522#discussion_r1376339458


##########
eventmesh-connectors/eventmesh-connector-feishu/src/main/java/org/apache/eventmesh/connector/feishu/config/FeishuServerConfig.java:
##########
@@ -0,0 +1,32 @@
+/*
+ * 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.eventmesh.connector.feishu.config;
+
+import org.apache.eventmesh.openconnect.api.config.Config;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class FeishuServerConfig extends Config {
+
+    private boolean sourceEnable;

Review Comment:
   You are implementing a sink connector, so this field and its corresponding 
config is not needed.



##########
eventmesh-connectors/eventmesh-connector-feishu/src/test/java/org/apache/eventmesh/connector/s3/source/FeishuSinkConnectorTest.java:
##########
@@ -0,0 +1,62 @@
+/*
+ * 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.eventmesh.connector.s3.source;
+
+import org.apache.eventmesh.connector.feishu.sink.config.FeishuSinkConfig;
+import org.apache.eventmesh.connector.feishu.sink.config.SinkConnectorConfig;
+import 
org.apache.eventmesh.connector.feishu.sink.connector.FeishuSinkConnector;
+import org.apache.eventmesh.openconnect.offsetmgmt.api.data.ConnectRecord;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+
+
+@Disabled
+public class FeishuSinkConnectorTest {
+
+    private static final FeishuSinkConfig sinkConfig;
+
+    private static final SinkConnectorConfig SOURCE_CONNECTOR_CONFIG;
+
+    static {
+        sinkConfig = new FeishuSinkConfig();
+        SOURCE_CONNECTOR_CONFIG = new SinkConnectorConfig();
+        SOURCE_CONNECTOR_CONFIG.setConnectorName("FeishuSinkConnector");
+        SOURCE_CONNECTOR_CONFIG.setAppId("xxx");
+        SOURCE_CONNECTOR_CONFIG.setAppSecret("xxx");
+        SOURCE_CONNECTOR_CONFIG.setReceiveId("xxx");
+        SOURCE_CONNECTOR_CONFIG.setReceiveIdType("open_id");
+        sinkConfig.setConnectorConfig(SOURCE_CONNECTOR_CONFIG);
+    }
+
+
+    @Test
+    public void testFeishuSinkConnector() throws Exception {
+        FeishuSinkConnector feishuSinkConnector = new FeishuSinkConnector();
+        feishuSinkConnector.init(sinkConfig);
+        feishuSinkConnector.start();
+        List<ConnectRecord> connectRecords = new ArrayList<>();
+        connectRecords.add(new ConnectRecord(null,null,0L,"test"));
+        feishuSinkConnector.put(connectRecords);
+    }

Review Comment:
   You can use Mockito to verify that the number of calls to `Retryer#call()` 
is equal to the size of `connectRecords`. Alternatively, simply use JUnit5's 
`assertDoesNotThrow()` to verify that no exceptions are thrown. This makes the 
test more meaningful.
   
   ---
   
你可以用Mockito来验证`Retryer#call()`的调用次数等于`connectRecords`的大小。或者简单地使用JUnit的`assertDoesNotThrow()`
 来验证不抛异常。这样使该测试更有意义。



##########
eventmesh-connectors/eventmesh-connector-feishu/src/test/java/org/apache/eventmesh/connector/s3/source/FeishuSinkConnectorTest.java:
##########
@@ -0,0 +1,62 @@
+/*
+ * 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.eventmesh.connector.s3.source;
+
+import org.apache.eventmesh.connector.feishu.sink.config.FeishuSinkConfig;
+import org.apache.eventmesh.connector.feishu.sink.config.SinkConnectorConfig;
+import 
org.apache.eventmesh.connector.feishu.sink.connector.FeishuSinkConnector;
+import org.apache.eventmesh.openconnect.offsetmgmt.api.data.ConnectRecord;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+
+
+@Disabled
+public class FeishuSinkConnectorTest {
+
+    private static final FeishuSinkConfig sinkConfig;
+
+    private static final SinkConnectorConfig SOURCE_CONNECTOR_CONFIG;
+
+    static {
+        sinkConfig = new FeishuSinkConfig();
+        SOURCE_CONNECTOR_CONFIG = new SinkConnectorConfig();
+        SOURCE_CONNECTOR_CONFIG.setConnectorName("FeishuSinkConnector");
+        SOURCE_CONNECTOR_CONFIG.setAppId("xxx");
+        SOURCE_CONNECTOR_CONFIG.setAppSecret("xxx");
+        SOURCE_CONNECTOR_CONFIG.setReceiveId("xxx");
+        SOURCE_CONNECTOR_CONFIG.setReceiveIdType("open_id");
+        sinkConfig.setConnectorConfig(SOURCE_CONNECTOR_CONFIG);
+    }
+
+
+    @Test
+    public void testFeishuSinkConnector() throws Exception {
+        FeishuSinkConnector feishuSinkConnector = new FeishuSinkConnector();
+        feishuSinkConnector.init(sinkConfig);
+        feishuSinkConnector.start();
+        List<ConnectRecord> connectRecords = new ArrayList<>();
+        connectRecords.add(new ConnectRecord(null,null,0L,"test"));
+        feishuSinkConnector.put(connectRecords);
+    }

Review Comment:
   You can use Mockito to verify that the number of calls to `Retryer#call()` 
is equal to the size of `connectRecords`. Alternatively, simply use JUnit5's 
`assertDoesNotThrow()` to verify that no exceptions are thrown. This makes the 
test more meaningful.
   
   ---
   
你可以用Mockito来验证`Retryer#call()`的调用次数等于`connectRecords`的大小。或者简单地使用JUnit的`assertDoesNotThrow()`
 来验证不抛异常。这样使该测试更有意义。



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to