This is an automated email from the ASF dual-hosted git repository.
peacewong 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 7499d9f4e linkis-bml-client module errorcode optimization and
documentation (#3488)
7499d9f4e is described below
commit 7499d9f4e9b2db2fcce04d7e5eaf2f4d920400e0
Author: huangxiaoping <[email protected]>
AuthorDate: Fri Sep 23 18:14:58 2022 +0800
linkis-bml-client module errorcode optimization and documentation (#3488)
---
docs/errorcode/linkis-bml-client.md | 9 ++
.../errorcode/BmlClientErrorCodeSummary.java | 97 ++++++++++++++
.../linkis/bml/client/impl/HttpBmlClient.scala | 143 ++++++++++++++++----
.../bml/common/POSTActionFailException.scala | 29 +---
.../errorcode/BmlClientErrorCodeSummaryTest.java | 147 +++++++++++++++++++++
5 files changed, 371 insertions(+), 54 deletions(-)
diff --git a/docs/errorcode/linkis-bml-client.md
b/docs/errorcode/linkis-bml-client.md
new file mode 100644
index 000000000..0210a6411
--- /dev/null
+++ b/docs/errorcode/linkis-bml-client.md
@@ -0,0 +1,9 @@
+## linkis-bml-client errorcode
+
+
+| 模块名(服务名) | 错误码 | 描述 | module |
+| -------- |-------| ----- |---------|
+|linkis-bml-client| 20060 |the result returned by the repository client POST
request does not match(物料库客户端POST请求返回的result不匹配)|bmlClient|
+|linkis-bml-client| 20061 |failed to copy inputStream and outputStream
(inputStream和outputStream流copy失败)|bmlClient|
+|linkis-bml-client| 20062 |serverUrl cannot be null(服务器URL不能为空)|bmlClient|
+
diff --git
a/linkis-public-enhancements/linkis-bml/linkis-bml-client/src/main/java/org/apache/linkis/bml/client/errorcode/BmlClientErrorCodeSummary.java
b/linkis-public-enhancements/linkis-bml/linkis-bml-client/src/main/java/org/apache/linkis/bml/client/errorcode/BmlClientErrorCodeSummary.java
new file mode 100644
index 000000000..afb6d0152
--- /dev/null
+++
b/linkis-public-enhancements/linkis-bml/linkis-bml-client/src/main/java/org/apache/linkis/bml/client/errorcode/BmlClientErrorCodeSummary.java
@@ -0,0 +1,97 @@
+/*
+ * 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.bml.client.errorcode;
+
+import org.apache.linkis.common.errorcode.ErrorCodeUtils;
+
+public enum BmlClientErrorCodeSummary {
+ /**
+ * 10000-10999 linkis-frame 11000-12999 linkis-commons 13000-14999
linkis-spring-cloud-services
+ * 15000-19999 linkis-public-enhancements 20000-24999
linkis-computation-governance 25000-25999
+ * linkis-extensions 26000-29999 linkis-engineconn-plugins
+ */
+ POST_REQUEST_RESULT_NOT_MATCH(
+ 20060,
+ "the result returned by the repository client POST request does not
match(物料库客户端POST请求返回的result不匹配)",
+ "the result returned by the repository client POST request does not
match(物料库客户端POST请求返回的result不匹配)",
+ "bmlClient"),
+
+ BML_CLIENT_FAILED(
+ 20061,
+ "failed to copy inputStream and outputStream
(inputStream和outputStream流copy失败)",
+ "failed to copy inputStream and outputStream
(inputStream和outputStream流copy失败)",
+ "bmlClient"),
+ SERVER_URL_NOT_NULL(
+ 20062,
+ "serverUrl cannot be null(服务器URL不能为空)",
+ "serverUrl cannot be null(服务器URL不能为空)",
+ "bmlClient");
+
+ private int errorCode;
+
+ private String errorDesc;
+
+ private String comment;
+
+ private String module;
+
+ BmlClientErrorCodeSummary(int errorCode, String errorDesc, String comment,
String module) {
+ ErrorCodeUtils.validateErrorCode(errorCode, 20000, 24999);
+ this.errorCode = errorCode;
+ this.errorDesc = errorDesc;
+ this.comment = comment;
+ this.module = module;
+ }
+
+ public int getErrorCode() {
+ return errorCode;
+ }
+
+ public void setErrorCode(int errorCode) {
+ this.errorCode = errorCode;
+ }
+
+ public String getErrorDesc() {
+ return errorDesc;
+ }
+
+ public void setErrorDesc(String errorDesc) {
+ this.errorDesc = errorDesc;
+ }
+
+ public String getComment() {
+ return comment;
+ }
+
+ public void setComment(String comment) {
+ this.comment = comment;
+ }
+
+ public String getModule() {
+ return module;
+ }
+
+ public void setModule(String module) {
+ this.module = module;
+ }
+
+ @Override
+ public String toString() {
+ return "errorCode: " + this.errorCode + ", errorDesc:" + this.errorDesc;
+ }
+}
diff --git
a/linkis-public-enhancements/linkis-bml/linkis-bml-client/src/main/scala/org/apache/linkis/bml/client/impl/HttpBmlClient.scala
b/linkis-public-enhancements/linkis-bml/linkis-bml-client/src/main/scala/org/apache/linkis/bml/client/impl/HttpBmlClient.scala
index f2d8bb3e2..e71ddb464 100644
---
a/linkis-public-enhancements/linkis-bml/linkis-bml-client/src/main/scala/org/apache/linkis/bml/client/impl/HttpBmlClient.scala
+++
b/linkis-public-enhancements/linkis-bml/linkis-bml-client/src/main/scala/org/apache/linkis/bml/client/impl/HttpBmlClient.scala
@@ -18,6 +18,11 @@
package org.apache.linkis.bml.client.impl
import org.apache.linkis.bml.client.AbstractBmlClient
+import org.apache.linkis.bml.client.errorcode.BmlClientErrorCodeSummary.{
+ BML_CLIENT_FAILED,
+ POST_REQUEST_RESULT_NOT_MATCH,
+ SERVER_URL_NOT_NULL
+}
import org.apache.linkis.bml.common._
import org.apache.linkis.bml.conf.BmlConfiguration._
import org.apache.linkis.bml.http.HttpConf
@@ -69,7 +74,12 @@ class HttpBmlClient(
private def createClientConfig(): DWSClientConfig = {
val _serverUrl = if (StringUtils.isEmpty(serverUrl))
HttpConf.gatewayInstance else serverUrl
- if (StringUtils.isEmpty(_serverUrl)) throw
BmlClientFailException("serverUrl cannot be null.")
+ if (StringUtils.isEmpty(_serverUrl)) {
+ throw BmlClientFailException(
+ SERVER_URL_NOT_NULL.getErrorCode,
+ SERVER_URL_NOT_NULL.getErrorDesc
+ )
+ }
val config = if (properties == null) {
new util.HashMap[String, Object]()
} else {
@@ -198,9 +208,8 @@ class HttpBmlClient(
"failed to copy inputStream and outputStream
(inputStream和outputStream流copy失败)",
e
)
- val exception = BmlClientFailException(
- "failed to copy inputStream and outputStream
(inputStream和outputStream流copy失败)"
- )
+ val exception =
+ BmlClientFailException(BML_CLIENT_FAILED.getErrorCode,
BML_CLIENT_FAILED.getErrorDesc)
exception.initCause(e)
throw exception
case t: Throwable =>
@@ -246,9 +255,8 @@ class HttpBmlClient(
"failed to copy inputStream and outputStream
(inputStream和outputStream流copy失败)",
e
)
- val exception = BmlClientFailException(
- "failed to copy inputStream and outputStream
(inputStream和outputStream流copy失败)"
- )
+ val exception =
+ BmlClientFailException(BML_CLIENT_FAILED.getErrorCode,
BML_CLIENT_FAILED.getErrorDesc)
exception.initCause(e)
throw e
case t: Throwable =>
@@ -309,8 +317,15 @@ class HttpBmlClient(
}
case r: BmlResult =>
logger.error(s"result type ${r.getResultType} not match
BmlResourceDownloadResult")
- throw POSTResultNotMatchException()
- case _ => throw POSTResultNotMatchException()
+ throw POSTResultNotMatchException(
+ POST_REQUEST_RESULT_NOT_MATCH.getErrorCode,
+ POST_REQUEST_RESULT_NOT_MATCH.getErrorDesc
+ )
+ case _ =>
+ throw POSTResultNotMatchException(
+ POST_REQUEST_RESULT_NOT_MATCH.getErrorCode,
+ POST_REQUEST_RESULT_NOT_MATCH.getErrorDesc
+ )
}
}
@@ -354,8 +369,15 @@ class HttpBmlClient(
}
case r: BmlResult =>
logger.error(s"result type ${r.getResultType} not match
BmlResourceDownloadResult")
- throw POSTResultNotMatchException()
- case _ => throw POSTResultNotMatchException()
+ throw POSTResultNotMatchException(
+ POST_REQUEST_RESULT_NOT_MATCH.getErrorCode,
+ POST_REQUEST_RESULT_NOT_MATCH.getErrorDesc
+ )
+ case _ =>
+ throw POSTResultNotMatchException(
+ POST_REQUEST_RESULT_NOT_MATCH.getErrorCode,
+ POST_REQUEST_RESULT_NOT_MATCH.getErrorDesc
+ )
}
}
@@ -412,8 +434,15 @@ class HttpBmlClient(
}
case r: BmlResult =>
logger.error(s"result type ${r.getResultType} not match
BmlResourceDownloadResult")
- throw POSTResultNotMatchException()
- case _ => throw POSTResultNotMatchException()
+ throw POSTResultNotMatchException(
+ POST_REQUEST_RESULT_NOT_MATCH.getErrorCode,
+ POST_REQUEST_RESULT_NOT_MATCH.getErrorDesc
+ )
+ case _ =>
+ throw POSTResultNotMatchException(
+ POST_REQUEST_RESULT_NOT_MATCH.getErrorCode,
+ POST_REQUEST_RESULT_NOT_MATCH.getErrorDesc
+ )
}
}
@@ -445,8 +474,15 @@ class HttpBmlClient(
}
case r: BmlResult =>
logger.error(s"result type ${r.getResultType} not match
BmlResourceDownloadResult")
- throw POSTResultNotMatchException()
- case _ => throw POSTResultNotMatchException()
+ throw POSTResultNotMatchException(
+ POST_REQUEST_RESULT_NOT_MATCH.getErrorCode,
+ POST_REQUEST_RESULT_NOT_MATCH.getErrorDesc
+ )
+ case _ =>
+ throw POSTResultNotMatchException(
+ POST_REQUEST_RESULT_NOT_MATCH.getErrorCode,
+ POST_REQUEST_RESULT_NOT_MATCH.getErrorDesc
+ )
}
}
@@ -480,8 +516,15 @@ class HttpBmlClient(
}
case r: BmlResult =>
logger.error(s"result type ${r.getResultType} not match
BmlCreateBmlProjectResult")
- throw POSTResultNotMatchException()
- case _ => throw POSTResultNotMatchException()
+ throw POSTResultNotMatchException(
+ POST_REQUEST_RESULT_NOT_MATCH.getErrorCode,
+ POST_REQUEST_RESULT_NOT_MATCH.getErrorDesc
+ )
+ case _ =>
+ throw POSTResultNotMatchException(
+ POST_REQUEST_RESULT_NOT_MATCH.getErrorCode,
+ POST_REQUEST_RESULT_NOT_MATCH.getErrorDesc
+ )
}
}
@@ -514,8 +557,15 @@ class HttpBmlClient(
}
case r: BmlResult =>
logger.error(s"result type ${r.getResultType} not match
BmlResourceDownloadResult")
- throw POSTResultNotMatchException()
- case _ => throw POSTResultNotMatchException()
+ throw POSTResultNotMatchException(
+ POST_REQUEST_RESULT_NOT_MATCH.getErrorCode,
+ POST_REQUEST_RESULT_NOT_MATCH.getErrorDesc
+ )
+ case _ =>
+ throw POSTResultNotMatchException(
+ POST_REQUEST_RESULT_NOT_MATCH.getErrorCode,
+ POST_REQUEST_RESULT_NOT_MATCH.getErrorDesc
+ )
}
}
@@ -576,8 +626,15 @@ class HttpBmlClient(
}
case r: BmlResult =>
logger.error(s"result type ${r.getResultType} not match
BmlResourceDownloadResult")
- throw POSTResultNotMatchException()
- case _ => throw POSTResultNotMatchException()
+ throw POSTResultNotMatchException(
+ POST_REQUEST_RESULT_NOT_MATCH.getErrorCode,
+ POST_REQUEST_RESULT_NOT_MATCH.getErrorDesc
+ )
+ case _ =>
+ throw POSTResultNotMatchException(
+ POST_REQUEST_RESULT_NOT_MATCH.getErrorCode,
+ POST_REQUEST_RESULT_NOT_MATCH.getErrorDesc
+ )
}
}
@@ -615,8 +672,15 @@ class HttpBmlClient(
}
case r: BmlResult =>
logger.error(s"result type ${r.getResultType} not match
BmlCreateBmlProjectResult")
- throw POSTResultNotMatchException()
- case _ => throw POSTResultNotMatchException()
+ throw POSTResultNotMatchException(
+ POST_REQUEST_RESULT_NOT_MATCH.getErrorCode,
+ POST_REQUEST_RESULT_NOT_MATCH.getErrorDesc
+ )
+ case _ =>
+ throw POSTResultNotMatchException(
+ POST_REQUEST_RESULT_NOT_MATCH.getErrorCode,
+ POST_REQUEST_RESULT_NOT_MATCH.getErrorDesc
+ )
}
}
@@ -645,8 +709,15 @@ class HttpBmlClient(
}
case r: BmlResult =>
logger.error(s"result type ${r.getResultType} not match
BmlUpdateProjectResult")
- throw POSTResultNotMatchException()
- case _ => throw POSTResultNotMatchException()
+ throw POSTResultNotMatchException(
+ POST_REQUEST_RESULT_NOT_MATCH.getErrorCode,
+ POST_REQUEST_RESULT_NOT_MATCH.getErrorDesc
+ )
+ case _ =>
+ throw POSTResultNotMatchException(
+ POST_REQUEST_RESULT_NOT_MATCH.getErrorCode,
+ POST_REQUEST_RESULT_NOT_MATCH.getErrorDesc
+ )
}
}
@@ -690,8 +761,15 @@ class HttpBmlClient(
}
case r: BmlResult =>
logger.error(s"result type ${r.getResultType} not match
BmlCopyResourceResult")
- throw POSTResultNotMatchException()
- case _ => throw POSTResultNotMatchException()
+ throw POSTResultNotMatchException(
+ POST_REQUEST_RESULT_NOT_MATCH.getErrorCode,
+ POST_REQUEST_RESULT_NOT_MATCH.getErrorDesc
+ )
+ case _ =>
+ throw POSTResultNotMatchException(
+ POST_REQUEST_RESULT_NOT_MATCH.getErrorCode,
+ POST_REQUEST_RESULT_NOT_MATCH.getErrorDesc
+ )
}
}
@@ -720,8 +798,15 @@ class HttpBmlClient(
}
case r: BmlResult =>
logger.error(s"result type ${r.getResultType} not match
BmlRollbackVersionResult")
- throw POSTResultNotMatchException()
- case _ => throw POSTResultNotMatchException()
+ throw POSTResultNotMatchException(
+ POST_REQUEST_RESULT_NOT_MATCH.getErrorCode,
+ POST_REQUEST_RESULT_NOT_MATCH.getErrorDesc
+ )
+ case _ =>
+ throw POSTResultNotMatchException(
+ POST_REQUEST_RESULT_NOT_MATCH.getErrorCode,
+ POST_REQUEST_RESULT_NOT_MATCH.getErrorDesc
+ )
}
}
diff --git
a/linkis-public-enhancements/linkis-bml/linkis-bml-client/src/main/scala/org/apache/linkis/bml/common/POSTActionFailException.scala
b/linkis-public-enhancements/linkis-bml/linkis-bml-client/src/main/scala/org/apache/linkis/bml/common/POSTActionFailException.scala
index 874fe9f19..0aaf68bbb 100644
---
a/linkis-public-enhancements/linkis-bml/linkis-bml-client/src/main/scala/org/apache/linkis/bml/common/POSTActionFailException.scala
+++
b/linkis-public-enhancements/linkis-bml/linkis-bml-client/src/main/scala/org/apache/linkis/bml/common/POSTActionFailException.scala
@@ -19,29 +19,8 @@ package org.apache.linkis.bml.common
import org.apache.linkis.common.exception.ErrorException
-case class POSTActionFailException()
- extends ErrorException(70025, "material house client request
failed(物料库客户端请求失败)") {}
+case class POSTResultNotMatchException(errorCode: Int, errorMsg: String)
+ extends ErrorException(errorCode, errorMsg)
-case class POSTResultNotMatchException()
- extends ErrorException(
- 70021,
- "The result returned by the repository client POST request does not
match(物料库客户端POST请求返回的result不匹配)"
- )
-
-case class IllegalPathException()
- extends ErrorException(
- 70035,
- "The catalog that was passed into the store does not exist or is
illegal(传入物料库的目录不存在或非法)"
- )
-
-case class BmlResponseErrorException(errorMessage: String)
- extends ErrorException(70038, errorMessage)
-
-case class GetResultNotMatchException()
- extends ErrorException(
- 70078,
- "The result returned by the repository client GET request does not
match(物料库客户端GET请求返回的result不匹配)"
- )
-
-case class BmlClientFailException(errorMsg: String)
- extends ErrorException(70081, "An error occurred in the material
client(物料库客户端出现错误)")
+case class BmlClientFailException(errorCode: Int, errorMsg: String)
+ extends ErrorException(errorCode, errorMsg)
diff --git
a/linkis-public-enhancements/linkis-bml/linkis-bml-client/src/test/java/org/apache/linkis/bml/client/errorcode/BmlClientErrorCodeSummaryTest.java
b/linkis-public-enhancements/linkis-bml/linkis-bml-client/src/test/java/org/apache/linkis/bml/client/errorcode/BmlClientErrorCodeSummaryTest.java
new file mode 100644
index 000000000..d524d2723
--- /dev/null
+++
b/linkis-public-enhancements/linkis-bml/linkis-bml-client/src/test/java/org/apache/linkis/bml/client/errorcode/BmlClientErrorCodeSummaryTest.java
@@ -0,0 +1,147 @@
+/*
+ * 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.bml.client.errorcode;
+
+import org.junit.jupiter.api.Test;
+
+import static
org.apache.linkis.bml.client.errorcode.BmlClientErrorCodeSummary.BML_CLIENT_FAILED;
+import static
org.apache.linkis.bml.client.errorcode.BmlClientErrorCodeSummary.POST_REQUEST_RESULT_NOT_MATCH;
+import static
org.apache.linkis.bml.client.errorcode.BmlClientErrorCodeSummary.SERVER_URL_NOT_NULL;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+public class BmlClientErrorCodeSummaryTest {
+ @Test
+ void testGetErrorCode() {
+ assertEquals(20060, POST_REQUEST_RESULT_NOT_MATCH.getErrorCode());
+ assertEquals(20061, BML_CLIENT_FAILED.getErrorCode());
+ assertEquals(20062, SERVER_URL_NOT_NULL.getErrorCode());
+ }
+
+ @Test
+ void testSetErrorCode() {
+ POST_REQUEST_RESULT_NOT_MATCH.setErrorCode(1);
+ assertEquals(1, POST_REQUEST_RESULT_NOT_MATCH.getErrorCode());
+ POST_REQUEST_RESULT_NOT_MATCH.setErrorCode(20060);
+ assertEquals(20060, POST_REQUEST_RESULT_NOT_MATCH.getErrorCode());
+
+ BML_CLIENT_FAILED.setErrorCode(1);
+ assertEquals(1, BML_CLIENT_FAILED.getErrorCode());
+ BML_CLIENT_FAILED.setErrorCode(20061);
+ assertEquals(20061, BML_CLIENT_FAILED.getErrorCode());
+
+ SERVER_URL_NOT_NULL.setErrorCode(1);
+ assertEquals(1, SERVER_URL_NOT_NULL.getErrorCode());
+ SERVER_URL_NOT_NULL.setErrorCode(20062);
+ assertEquals(20062, SERVER_URL_NOT_NULL.getErrorCode());
+ }
+
+ @Test
+ void testGetErrorDesc() {
+ assertEquals(
+ "the result returned by the repository client POST request does not
match(物料库客户端POST请求返回的result不匹配)",
+ POST_REQUEST_RESULT_NOT_MATCH.getErrorDesc());
+ assertEquals(
+ "failed to copy inputStream and outputStream
(inputStream和outputStream流copy失败)",
+ BML_CLIENT_FAILED.getErrorDesc());
+ assertEquals("serverUrl cannot be null(服务器URL不能为空)",
SERVER_URL_NOT_NULL.getErrorDesc());
+ }
+
+ @Test
+ void testSetErrorDesc() {
+ POST_REQUEST_RESULT_NOT_MATCH.setErrorDesc("test");
+ assertEquals("test", POST_REQUEST_RESULT_NOT_MATCH.getErrorDesc());
+ POST_REQUEST_RESULT_NOT_MATCH.setErrorDesc(
+ "the result returned by the repository client POST request does not
match(物料库客户端POST请求返回的result不匹配)");
+ assertEquals(
+ "the result returned by the repository client POST request does not
match(物料库客户端POST请求返回的result不匹配)",
+ POST_REQUEST_RESULT_NOT_MATCH.getErrorDesc());
+
+ BML_CLIENT_FAILED.setErrorDesc("test");
+ assertEquals("test", BML_CLIENT_FAILED.getErrorDesc());
+ BML_CLIENT_FAILED.setErrorDesc(
+ "failed to copy inputStream and outputStream
(inputStream和outputStream流copy失败)");
+ assertEquals(
+ "failed to copy inputStream and outputStream
(inputStream和outputStream流copy失败)",
+ BML_CLIENT_FAILED.getErrorDesc());
+
+ SERVER_URL_NOT_NULL.setErrorDesc("test");
+ assertEquals("test", SERVER_URL_NOT_NULL.getErrorDesc());
+ SERVER_URL_NOT_NULL.setErrorDesc("serverUrl cannot be null(服务器URL不能为空)");
+ assertEquals("serverUrl cannot be null(服务器URL不能为空)",
SERVER_URL_NOT_NULL.getErrorDesc());
+ }
+
+ @Test
+ void testGetComment() {
+ assertEquals(
+ "the result returned by the repository client POST request does not
match(物料库客户端POST请求返回的result不匹配)",
+ POST_REQUEST_RESULT_NOT_MATCH.getComment());
+ assertEquals(
+ "failed to copy inputStream and outputStream
(inputStream和outputStream流copy失败)",
+ BML_CLIENT_FAILED.getComment());
+ assertEquals("serverUrl cannot be null(服务器URL不能为空)",
SERVER_URL_NOT_NULL.getComment());
+ }
+
+ @Test
+ void testSetComment() {
+ POST_REQUEST_RESULT_NOT_MATCH.setComment("test");
+ assertEquals("test", POST_REQUEST_RESULT_NOT_MATCH.getComment());
+ POST_REQUEST_RESULT_NOT_MATCH.setComment(
+ "the result returned by the repository client POST request does not
match(物料库客户端POST请求返回的result不匹配)");
+ assertEquals(
+ "the result returned by the repository client POST request does not
match(物料库客户端POST请求返回的result不匹配)",
+ POST_REQUEST_RESULT_NOT_MATCH.getComment());
+
+ BML_CLIENT_FAILED.setComment("test");
+ assertEquals("test", BML_CLIENT_FAILED.getComment());
+ BML_CLIENT_FAILED.setComment(
+ "failed to copy inputStream and outputStream
(inputStream和outputStream流copy失败)");
+ assertEquals(
+ "failed to copy inputStream and outputStream
(inputStream和outputStream流copy失败)",
+ BML_CLIENT_FAILED.getComment());
+
+ SERVER_URL_NOT_NULL.setComment("test");
+ assertEquals("test", SERVER_URL_NOT_NULL.getComment());
+ SERVER_URL_NOT_NULL.setComment("serverUrl cannot be null(服务器URL不能为空)");
+ assertEquals("serverUrl cannot be null(服务器URL不能为空)",
SERVER_URL_NOT_NULL.getComment());
+ }
+
+ @Test
+ void testGetModule() {
+ assertEquals("bmlClient", POST_REQUEST_RESULT_NOT_MATCH.getModule());
+ assertEquals("bmlClient", BML_CLIENT_FAILED.getModule());
+ assertEquals("bmlClient", SERVER_URL_NOT_NULL.getModule());
+ }
+
+ @Test
+ void testSetModule() {
+ POST_REQUEST_RESULT_NOT_MATCH.setModule("test");
+ assertEquals("test", POST_REQUEST_RESULT_NOT_MATCH.getModule());
+ POST_REQUEST_RESULT_NOT_MATCH.setModule("bmlClient");
+ assertEquals("bmlClient", POST_REQUEST_RESULT_NOT_MATCH.getModule());
+
+ BML_CLIENT_FAILED.setModule("test");
+ assertEquals("test", BML_CLIENT_FAILED.getModule());
+ BML_CLIENT_FAILED.setModule("bmlClient");
+ assertEquals("bmlClient", BML_CLIENT_FAILED.getModule());
+
+ SERVER_URL_NOT_NULL.setModule("test");
+ assertEquals("test", SERVER_URL_NOT_NULL.getModule());
+ SERVER_URL_NOT_NULL.setModule("bmlClient");
+ assertEquals("bmlClient", SERVER_URL_NOT_NULL.getModule());
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]