This is an automated email from the ASF dual-hosted git repository.
casion pushed a commit to branch dev-1.3.1
in repository https://gitbox.apache.org/repos/asf/incubator-linkis.git
The following commit(s) were added to refs/heads/dev-1.3.1 by this push:
new 7b72c2c26 feat: linkis-rpc unit test add (#3817)
7b72c2c26 is described below
commit 7b72c2c26cba2a852cd5016efc3b976ac22ab88a
Author: ruY <[email protected]>
AuthorDate: Mon Nov 14 22:11:02 2022 +0800
feat: linkis-rpc unit test add (#3817)
---
.../errorcode/LinkisRpcErrorCodeSummaryTest.java | 47 +++++++++++++++
.../utils/LoadBalancerOptionsUtilsTest.java | 34 +++++++++++
.../linkis/rpc/conf/RPCConfigurationTest.scala | 66 ++++++++++++++++++++++
.../rpc/errorcode/RPCErrorConstantsTest.scala | 38 +++++++++++++
4 files changed, 185 insertions(+)
diff --git
a/linkis-commons/linkis-rpc/src/test/java/org/apache/linkis/rpc/errorcode/LinkisRpcErrorCodeSummaryTest.java
b/linkis-commons/linkis-rpc/src/test/java/org/apache/linkis/rpc/errorcode/LinkisRpcErrorCodeSummaryTest.java
new file mode 100644
index 000000000..a9efe8185
--- /dev/null
+++
b/linkis-commons/linkis-rpc/src/test/java/org/apache/linkis/rpc/errorcode/LinkisRpcErrorCodeSummaryTest.java
@@ -0,0 +1,47 @@
+/*
+ * 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.linkis.rpc.errorcode;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+
+public class LinkisRpcErrorCodeSummaryTest {
+
+ @Test
+ @DisplayName("enumTest")
+ public void enumTest() {
+
+ int methodCallFailedCode =
LinkisRpcErrorCodeSummary.METHON_CALL_FAILED.getErrorCode();
+ int transmittedBeanIsNull =
LinkisRpcErrorCodeSummary.TRANSMITTED_BEAN_IS_NULL.getErrorCode();
+ int timeoutPeriodErrorCode =
LinkisRpcErrorCodeSummary.TIMEOUT_PERIOD.getErrorCode();
+ int correspondingNotFoundErrorCode =
+ LinkisRpcErrorCodeSummary.CORRESPONDING_NOT_FOUND.getErrorCode();
+ int correspondingToInitializeErrorCode =
+ LinkisRpcErrorCodeSummary.CORRESPONDING_TO_INITIALIZE.getErrorCode();
+ int applicationIsNotExistsErrorCode =
+ LinkisRpcErrorCodeSummary.APPLICATION_IS_NOT_EXISTS.getErrorCode();
+
+ Assertions.assertTrue(10000 == methodCallFailedCode);
+ Assertions.assertTrue(10001 == transmittedBeanIsNull);
+ Assertions.assertTrue(10002 == timeoutPeriodErrorCode);
+ Assertions.assertTrue(10003 == correspondingNotFoundErrorCode);
+ Assertions.assertTrue(10004 == correspondingToInitializeErrorCode);
+ Assertions.assertTrue(10051 == applicationIsNotExistsErrorCode);
+ }
+}
diff --git
a/linkis-commons/linkis-rpc/src/test/java/org/apache/linkis/rpc/message/utils/LoadBalancerOptionsUtilsTest.java
b/linkis-commons/linkis-rpc/src/test/java/org/apache/linkis/rpc/message/utils/LoadBalancerOptionsUtilsTest.java
new file mode 100644
index 000000000..d265371d6
--- /dev/null
+++
b/linkis-commons/linkis-rpc/src/test/java/org/apache/linkis/rpc/message/utils/LoadBalancerOptionsUtilsTest.java
@@ -0,0 +1,34 @@
+/*
+ * 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.linkis.rpc.message.utils;
+
+import feign.Request;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+
+public class LoadBalancerOptionsUtilsTest {
+
+ @Test
+ @DisplayName("getDefaultOptionsTest")
+ public void getDefaultOptionsTest() throws NoSuchFieldException,
IllegalAccessException {
+
+ Request.Options defaultOptions =
LoadBalancerOptionsUtils.getDefaultOptions();
+ Assertions.assertNotNull(defaultOptions);
+ }
+}
diff --git
a/linkis-commons/linkis-rpc/src/test/scala/org/apache/linkis/rpc/conf/RPCConfigurationTest.scala
b/linkis-commons/linkis-rpc/src/test/scala/org/apache/linkis/rpc/conf/RPCConfigurationTest.scala
new file mode 100644
index 000000000..6a5ab1e38
--- /dev/null
+++
b/linkis-commons/linkis-rpc/src/test/scala/org/apache/linkis/rpc/conf/RPCConfigurationTest.scala
@@ -0,0 +1,66 @@
+/*
+ * 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.linkis.rpc.conf
+
+import org.junit.jupiter.api.{Assertions, DisplayName, Test}
+
+class RPCConfigurationTest {
+
+ @Test
+ @DisplayName("constTest")
+ def constTest(): Unit = {
+
+ val bdprpcbroadcastthreadsize =
RPCConfiguration.BDP_RPC_BROADCAST_THREAD_SIZE.getValue
+ val bdprpceurekaservicerefreshinterval =
+ RPCConfiguration.BDP_RPC_EUREKA_SERVICE_REFRESH_INTERVAL.getValue.toLong
+ val bdprpcreceiverasynconsumerthreadmax =
+ RPCConfiguration.BDP_RPC_RECEIVER_ASYN_CONSUMER_THREAD_MAX.getValue
+ val bdprpcreceiverasynqueuecapacity =
+ RPCConfiguration.BDP_RPC_RECEIVER_ASYN_QUEUE_CAPACITY.getValue
+ val bdprpcsenderasynconsumerthreadmax =
+ RPCConfiguration.BDP_RPC_SENDER_ASYN_CONSUMER_THREAD_MAX.getValue
+ val bdprpcsenderasynqueuecapacity =
RPCConfiguration.BDP_RPC_SENDER_ASYN_QUEUE_CAPACITY.getValue
+ val publicserviceappprefix = RPCConfiguration.PUBLIC_SERVICE_APP_PREFIX
+ val enablepublicservice = RPCConfiguration.ENABLE_PUBLIC_SERVICE.getValue
+ val publicserviceapplicationname =
RPCConfiguration.PUBLIC_SERVICE_APPLICATION_NAME.getValue
+ val publicservicelist = RPCConfiguration.PUBLIC_SERVICE_LIST
+ val computationgovernanceappprefix =
RPCConfiguration.COMPUTATION_GOVERNANCE_APP_PREFIX
+ val linkismanagerservicemerged =
RPCConfiguration.LINKIS_MANAGER_SERVICE_MERGED.getValue
+ val linkismanagerapplicationname =
RPCConfiguration.LINKIS_MANAGER_APPLICATION_NAME.getValue
+ val linkismanagerservicelist = RPCConfiguration.LINKIS_MANAGER_SERVICE_LIST
+ val metadataqueryservicelist = RPCConfiguration.METADATAQUERY_SERVICE_LIST
+
+ Assertions.assertTrue(25 == bdprpcbroadcastthreadsize.intValue())
+ Assertions.assertTrue(1000L ==
bdprpceurekaservicerefreshinterval.longValue())
+ Assertions.assertTrue(400 ==
bdprpcreceiverasynconsumerthreadmax.intValue())
+ Assertions.assertTrue(5000 == bdprpcreceiverasynqueuecapacity.intValue())
+ Assertions.assertTrue(100 == bdprpcsenderasynconsumerthreadmax.intValue())
+ Assertions.assertTrue(2000 == bdprpcsenderasynqueuecapacity)
+ Assertions.assertEquals("linkis-ps-", publicserviceappprefix)
+ Assertions.assertTrue(enablepublicservice)
+ Assertions.assertEquals("linkis-ps-publicservice",
publicserviceapplicationname)
+ Assertions.assertTrue(publicservicelist.size > 0)
+ Assertions.assertEquals("linkis-cg-", computationgovernanceappprefix)
+ Assertions.assertTrue(linkismanagerservicemerged)
+ Assertions.assertEquals("linkis-cg-linkismanager",
linkismanagerapplicationname)
+ Assertions.assertTrue(linkismanagerservicelist.size > 0)
+ Assertions.assertTrue(metadataqueryservicelist.size > 0)
+
+ }
+
+}
diff --git
a/linkis-commons/linkis-rpc/src/test/scala/org/apache/linkis/rpc/errorcode/RPCErrorConstantsTest.scala
b/linkis-commons/linkis-rpc/src/test/scala/org/apache/linkis/rpc/errorcode/RPCErrorConstantsTest.scala
new file mode 100644
index 000000000..175287f6d
--- /dev/null
+++
b/linkis-commons/linkis-rpc/src/test/scala/org/apache/linkis/rpc/errorcode/RPCErrorConstantsTest.scala
@@ -0,0 +1,38 @@
+/*
+ * 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.linkis.rpc.errorcode
+
+import org.junit.jupiter.api.{Assertions, DisplayName, Test}
+
+class RPCErrorConstantsTest {
+
+ @Test
+ @DisplayName("constTest")
+ def constTest(): Unit = {
+
+ val fetchmapcacheerror = RPCErrorConstants.FETCH_MAPCACHE_ERROR
+ val rpciniterror = RPCErrorConstants.RPC_INIT_ERROR
+ val urlerror = RPCErrorConstants.URL_ERROR
+
+ Assertions.assertTrue(10021 == fetchmapcacheerror.intValue())
+ Assertions.assertTrue(10054 == rpciniterror.intValue())
+ Assertions.assertTrue(10000 == urlerror.intValue())
+
+ }
+
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]