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 1f74d7667 feat: linkis-cli-core unit test add (#3819)
1f74d7667 is described below
commit 1f74d7667c262afd4a81418289ac7a237fa9689f
Author: ruY <[email protected]>
AuthorDate: Sun Nov 13 21:38:54 2022 +0800
feat: linkis-cli-core unit test add (#3819)
---
.../cli/core/constants/CommonConstantsTest.java | 60 ++++++++++++++++++++++
.../cli/core/exception/error/CommonErrMsgTest.java | 41 +++++++++++++++
.../interactor/command/fitter/FitterUtilsTest.java | 34 ++++++++++++
.../cli/core/present/PresentModeImplTest.java | 36 +++++++++++++
4 files changed, 171 insertions(+)
diff --git
a/linkis-computation-governance/linkis-client/linkis-cli/linkis-cli-core/src/test/java/org/apache/linkis/cli/core/constants/CommonConstantsTest.java
b/linkis-computation-governance/linkis-client/linkis-cli/linkis-cli-core/src/test/java/org/apache/linkis/cli/core/constants/CommonConstantsTest.java
new file mode 100644
index 000000000..a1fb04f01
--- /dev/null
+++
b/linkis-computation-governance/linkis-client/linkis-cli/linkis-cli-core/src/test/java/org/apache/linkis/cli/core/constants/CommonConstantsTest.java
@@ -0,0 +1,60 @@
+/*
+ * 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.cli.core.constants;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+
+public class CommonConstantsTest {
+
+ @Test
+ @DisplayName("constTest")
+ public void constTest() {
+
+ Long jobQuerySleepMills = CommonConstants.JOB_QUERY_SLEEP_MILLS;
+ Integer requestMaxRetryTime = CommonConstants.REQUEST_MAX_RETRY_TIME;
+ String universalSubcmd = CommonConstants.UNIVERSAL_SUBCMD;
+ String universalSubcmdDesc = CommonConstants.UNIVERSAL_SUBCMD_DESC;
+ String successIndicator = CommonConstants.SUCCESS_INDICATOR;
+ String failureIndicator = CommonConstants.FAILURE_INDICATOR;
+ String arraySeq = CommonConstants.ARRAY_SEQ;
+ String arraySeqRegex = CommonConstants.ARRAY_SEQ_REGEX;
+ int maxNumOfCommandArguements =
CommonConstants.MAX_NUM_OF_COMMAND_ARGUEMENTS;
+ String configDir = CommonConstants.CONFIG_DIR;
+ String[] configExtension = CommonConstants.CONFIG_EXTENSION;
+ String systemPropertiesIdentifier =
CommonConstants.SYSTEM_PROPERTIES_IDENTIFIER;
+ String systemEnvIdentifier = CommonConstants.SYSTEM_ENV_IDENTIFIER;
+
+ Assertions.assertTrue(2000l == jobQuerySleepMills);
+ Assertions.assertTrue(3 == requestMaxRetryTime);
+ Assertions.assertEquals("linkis-cli", universalSubcmd);
+ Assertions.assertEquals(
+ "command for all types of jobs supported by Linkis",
universalSubcmdDesc);
+
+ Assertions.assertEquals("############Execute Success!!!########",
successIndicator);
+ Assertions.assertEquals("############Execute Error!!!########",
failureIndicator);
+ Assertions.assertEquals("@#@", arraySeq);
+ Assertions.assertEquals("(?=([^\"]*\"[^\"]*\")*[^\"]*$)", arraySeqRegex);
+ Assertions.assertTrue(10 == maxNumOfCommandArguements);
+ Assertions.assertEquals("config.path", configDir);
+ Assertions.assertTrue(configExtension.length == 1);
+ Assertions.assertEquals("SYS_PROP", systemPropertiesIdentifier);
+ Assertions.assertEquals("SYS_ENV", systemEnvIdentifier);
+ }
+}
diff --git
a/linkis-computation-governance/linkis-client/linkis-cli/linkis-cli-core/src/test/java/org/apache/linkis/cli/core/exception/error/CommonErrMsgTest.java
b/linkis-computation-governance/linkis-client/linkis-cli/linkis-cli-core/src/test/java/org/apache/linkis/cli/core/exception/error/CommonErrMsgTest.java
new file mode 100644
index 000000000..cdd51f4ae
--- /dev/null
+++
b/linkis-computation-governance/linkis-client/linkis-cli/linkis-cli-core/src/test/java/org/apache/linkis/cli/core/exception/error/CommonErrMsgTest.java
@@ -0,0 +1,41 @@
+/*
+ * 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.cli.core.exception.error;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+
+public class CommonErrMsgTest {
+
+ @Test
+ @DisplayName("enumTest")
+ public void enumTest() {
+
+ String templateGenerr = CommonErrMsg.TemplateGenErr.getMsgTemplate();
+ String fitErrMsgTemplate = CommonErrMsg.TemplateFitErr.getMsgTemplate();
+ String parserInitErrMsgTemplate =
CommonErrMsg.ParserInitErr.getMsgTemplate();
+ String parseErrMsgTemplate = CommonErrMsg.ParserParseErr.getMsgTemplate();
+
+ Assertions.assertEquals("Cannot generate template. :{0}", templateGenerr);
+ Assertions.assertEquals("Cannot fit input into template: {0}",
fitErrMsgTemplate);
+
+ Assertions.assertEquals("Failed to init parser: {0}",
parserInitErrMsgTemplate);
+ Assertions.assertEquals("Failed to parse. {0}", parseErrMsgTemplate);
+ }
+}
diff --git
a/linkis-computation-governance/linkis-client/linkis-cli/linkis-cli-core/src/test/java/org/apache/linkis/cli/core/interactor/command/fitter/FitterUtilsTest.java
b/linkis-computation-governance/linkis-client/linkis-cli/linkis-cli-core/src/test/java/org/apache/linkis/cli/core/interactor/command/fitter/FitterUtilsTest.java
new file mode 100644
index 000000000..5c51a582f
--- /dev/null
+++
b/linkis-computation-governance/linkis-client/linkis-cli/linkis-cli-core/src/test/java/org/apache/linkis/cli/core/interactor/command/fitter/FitterUtilsTest.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.cli.core.interactor.command.fitter;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+
+public class FitterUtilsTest {
+
+ @Test
+ @DisplayName("isOptionTest")
+ public void isOptionTest() {
+
+ String name = "-hadoop";
+ boolean option = FitterUtils.isOption(name);
+ Assertions.assertTrue(option);
+ }
+}
diff --git
a/linkis-computation-governance/linkis-client/linkis-cli/linkis-cli-core/src/test/java/org/apache/linkis/cli/core/present/PresentModeImplTest.java
b/linkis-computation-governance/linkis-client/linkis-cli/linkis-cli-core/src/test/java/org/apache/linkis/cli/core/present/PresentModeImplTest.java
new file mode 100644
index 000000000..8f776bef8
--- /dev/null
+++
b/linkis-computation-governance/linkis-client/linkis-cli/linkis-cli-core/src/test/java/org/apache/linkis/cli/core/present/PresentModeImplTest.java
@@ -0,0 +1,36 @@
+/*
+ * 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.cli.core.present;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+
+public class PresentModeImplTest {
+
+ @Test
+ @DisplayName("enumTest")
+ public void enumTest() {
+
+ String stdoutName = PresentModeImpl.STDOUT.getName();
+ String textFileName = PresentModeImpl.TEXT_FILE.getName();
+
+ Assertions.assertEquals("STDOUT", stdoutName);
+ Assertions.assertEquals("TEXT_FILE", textFileName);
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]