This is an automated email from the ASF dual-hosted git repository.
albumenj pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/master by this push:
new 9dda33c Add configurable file parameter to MetadataReportConfig
(#7747)
9dda33c is described below
commit 9dda33ccdc9695efd05c5af57a6e24358ae27ebb
Author: 灼华 <[email protected]>
AuthorDate: Sat May 15 16:09:32 2021 +0800
Add configurable file parameter to MetadataReportConfig (#7747)
---
.../apache/dubbo/config/MetadataReportConfig.java | 14 ++++++++
.../dubbo/config/MetadataReportConfigTest.java | 38 ++++++++++++++++++++++
.../src/main/resources/META-INF/dubbo.xsd | 5 +++
3 files changed, 57 insertions(+)
diff --git
a/dubbo-common/src/main/java/org/apache/dubbo/config/MetadataReportConfig.java
b/dubbo-common/src/main/java/org/apache/dubbo/config/MetadataReportConfig.java
index c3f8c93..2a1272d 100644
---
a/dubbo-common/src/main/java/org/apache/dubbo/config/MetadataReportConfig.java
+++
b/dubbo-common/src/main/java/org/apache/dubbo/config/MetadataReportConfig.java
@@ -84,6 +84,12 @@ public class MetadataReportConfig extends AbstractConfig {
*/
private String registry;
+ /**
+ * File for saving metadata center dynamic list
+ */
+ private String file;
+
+
public MetadataReportConfig() {
}
@@ -224,4 +230,12 @@ public class MetadataReportConfig extends AbstractConfig {
public void setRegistry(String registry) {
this.registry = registry;
}
+
+ public String getFile() {
+ return file;
+ }
+
+ public void setFile(String file) {
+ this.file = file;
+ }
}
diff --git
a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/MetadataReportConfigTest.java
b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/MetadataReportConfigTest.java
new file mode 100644
index 0000000..584eeec
--- /dev/null
+++
b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/MetadataReportConfigTest.java
@@ -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.dubbo.config;
+
+import org.apache.dubbo.common.URL;
+import org.junit.jupiter.api.Test;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.equalTo;
+
+public class MetadataReportConfigTest {
+ @Test
+ public void testFile() {
+ MetadataReportConfig metadataReportConfig = new MetadataReportConfig();
+ metadataReportConfig.setFile("file");
+ assertThat(metadataReportConfig.getFile(), equalTo("file"));
+
+ metadataReportConfig.setAddress("127.0.0.1:2181");
+ URL url = metadataReportConfig.toUrl();
+ assertThat(url.getParameter("file"), equalTo("file"));
+
+ }
+
+}
diff --git
a/dubbo-config/dubbo-config-spring/src/main/resources/META-INF/dubbo.xsd
b/dubbo-config/dubbo-config-spring/src/main/resources/META-INF/dubbo.xsd
index 339962d..0fc5589 100644
--- a/dubbo-config/dubbo-config-spring/src/main/resources/META-INF/dubbo.xsd
+++ b/dubbo-config/dubbo-config-spring/src/main/resources/META-INF/dubbo.xsd
@@ -690,6 +690,11 @@
<xsd:documentation><![CDATA[ registry config id.
]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>
+ <xsd:attribute name="file" type="xsd:string">
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[ The metadata report file store.
]]></xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
</xsd:complexType>
<xsd:complexType name="configCenterType">