You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@linkis.apache.org by pe...@apache.org on 2022/09/17 04:48:35 UTC

[incubator-linkis] branch dev-1.3.0 updated: fix:fix test unit compilation errors (#3442)

This is an automated email from the ASF dual-hosted git repository.

peacewong pushed a commit to branch dev-1.3.0
in repository https://gitbox.apache.org/repos/asf/incubator-linkis.git


The following commit(s) were added to refs/heads/dev-1.3.0 by this push:
     new ed05cfcb5 fix:fix test unit compilation errors (#3442)
ed05cfcb5 is described below

commit ed05cfcb582d8251fcd13c9ecd9f315826295683
Author: jack tao <79...@qq.com>
AuthorDate: Sat Sep 17 12:48:27 2022 +0800

    fix:fix test unit compilation errors (#3442)
---
 .../linkis/rpc/message/utils/MessageUtilsTest.java | 85 +++++++++++++++++++++
 .../linkis/rpc/message/utils/MessageUtilsTest.java | 86 ----------------------
 2 files changed, 85 insertions(+), 86 deletions(-)

diff --git a/linkis-commons/linkis-rpc/src/test/java/org/apache/linkis/rpc/message/utils/MessageUtilsTest.java b/linkis-commons/linkis-rpc/src/test/java/org/apache/linkis/rpc/message/utils/MessageUtilsTest.java
new file mode 100644
index 000000000..151680870
--- /dev/null
+++ b/linkis-commons/linkis-rpc/src/test/java/org/apache/linkis/rpc/message/utils/MessageUtilsTest.java
@@ -0,0 +1,85 @@
+/*
+ * 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 org.apache.linkis.rpc.message.method.MethodExecuteWrapper;
+import org.apache.linkis.rpc.message.parser.ServiceMethod;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+class MessageUtilsTest {
+
+  private List<ServiceMethod> notRepeatedServiceMethods;
+  private List<ServiceMethod> repeatedServiceMethods;
+
+  @BeforeEach
+  void setUp() {
+    notRepeatedServiceMethods = new ArrayList<>();
+    for (int i = 0; i < 10; i++) {
+      ServiceMethod tmp = new ServiceMethod();
+      tmp.setOrder(i);
+      notRepeatedServiceMethods.add(tmp);
+    }
+    repeatedServiceMethods = new ArrayList<>();
+    repeatedServiceMethods.addAll(notRepeatedServiceMethods);
+    for (int i = 0; i < 10; i++) {
+      ServiceMethod tmp = new ServiceMethod();
+      tmp.setOrder(i);
+      repeatedServiceMethods.add(tmp);
+    }
+  }
+
+  @Test
+  void getMinOrders() {
+    List<MethodExecuteWrapper> notRepeatedWrapper = new ArrayList<>();
+    for (ServiceMethod serviceMethod : notRepeatedServiceMethods) {
+      notRepeatedWrapper.add(new MethodExecuteWrapper(serviceMethod));
+    }
+    List<MethodExecuteWrapper> result = MessageUtils.getMinOrders(notRepeatedWrapper);
+    assertThat(result).singleElement().isNotNull();
+    assertThat(result.get(0).getOrder()).isZero();
+
+    List<MethodExecuteWrapper> repeatedWrapper = new ArrayList<>();
+    for (ServiceMethod serviceMethod : repeatedServiceMethods) {
+      repeatedWrapper.add(new MethodExecuteWrapper(serviceMethod));
+    }
+    result = MessageUtils.getMinOrders(repeatedWrapper);
+    assertThat(result).size().isEqualTo(2);
+    assertThat(result.get(0).getOrder()).isZero();
+  }
+
+  @Test
+  void orderIsLast() {
+    int maxOrder = Integer.MAX_VALUE;
+    assertThat(MessageUtils.orderIsLast(maxOrder, notRepeatedServiceMethods)).isTrue();
+    assertThat(MessageUtils.orderIsLast(11, notRepeatedServiceMethods)).isTrue();
+    assertThat(MessageUtils.orderIsLast(5, notRepeatedServiceMethods)).isFalse();
+  }
+
+  @Test
+  void repeatOrder() {
+    assertThat(MessageUtils.repeatOrder(notRepeatedServiceMethods)).isNull();
+    assertThat(MessageUtils.repeatOrder(repeatedServiceMethods)).isZero();
+  }
+}
diff --git a/linkis-commons/linkis-rpc/src/test/scala/org/apache/linkis/rpc/message/utils/MessageUtilsTest.java b/linkis-commons/linkis-rpc/src/test/scala/org/apache/linkis/rpc/message/utils/MessageUtilsTest.java
deleted file mode 100644
index f828ae84b..000000000
--- a/linkis-commons/linkis-rpc/src/test/scala/org/apache/linkis/rpc/message/utils/MessageUtilsTest.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * 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 org.apache.linkis.rpc.message.method.MethodExecuteWrapper;
-import org.apache.linkis.rpc.message.parser.ServiceMethod;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-class MessageUtilsTest {
-
-    private List<ServiceMethod> notRepeatedServiceMethods;
-    private List<ServiceMethod> repeatedServiceMethods;
-
-    @BeforeEach
-    void setUp() {
-        notRepeatedServiceMethods = new ArrayList<>();
-        for (int i = 0; i < 10; i++) {
-            ServiceMethod tmp = new ServiceMethod();
-            tmp.setOrder(i);
-            notRepeatedServiceMethods.add(tmp);
-        }
-        repeatedServiceMethods =  new ArrayList<>();
-        repeatedServiceMethods.addAll(notRepeatedServiceMethods);
-        for (int i = 0; i < 10; i++) {
-            ServiceMethod tmp = new ServiceMethod();
-            tmp.setOrder(i);
-            repeatedServiceMethods.add(tmp);
-        }
-    }
-
-    @Test
-    void getMinOrders() {
-        List<MethodExecuteWrapper> notRepeatedWrapper = new ArrayList<>();
-        for (ServiceMethod serviceMethod : notRepeatedServiceMethods) {
-            notRepeatedWrapper.add(new MethodExecuteWrapper(serviceMethod));
-        }
-        List<MethodExecuteWrapper> result = MessageUtils.getMinOrders(notRepeatedWrapper);
-        assertThat(result).singleElement().isNotNull();
-        assertThat(result.get(0).getOrder()).isZero();
-
-        List<MethodExecuteWrapper> repeatedWrapper = new ArrayList<>();
-        for (ServiceMethod serviceMethod : repeatedServiceMethods) {
-            repeatedWrapper.add(new MethodExecuteWrapper(serviceMethod));
-        }
-        result = MessageUtils.getMinOrders(repeatedWrapper);
-        assertThat(result).size().isEqualTo(2);
-        assertThat(result.get(0).getOrder()).isZero();
-    }
-
-    @Test
-    void orderIsLast() {
-        int maxOrder = Integer.MAX_VALUE;
-        assertThat(MessageUtils.orderIsLast(maxOrder, notRepeatedServiceMethods)).isTrue();
-        assertThat(MessageUtils.orderIsLast(11, notRepeatedServiceMethods)).isTrue();
-        assertThat(MessageUtils.orderIsLast(5, notRepeatedServiceMethods)).isFalse();
-    }
-
-    @Test
-    void repeatOrder() {
-        assertThat(MessageUtils.repeatOrder(notRepeatedServiceMethods)).isNull();
-        assertThat(MessageUtils.repeatOrder(repeatedServiceMethods)).isZero();
-    }
-
-}
\ No newline at end of file


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@linkis.apache.org
For additional commands, e-mail: commits-help@linkis.apache.org