Skip to content

Commit

Permalink
Add 'forks' config into xml config (apache#2568)
Browse files Browse the repository at this point in the history
* Add forks into xml config.

* Add forks into xml config.

* Add forks into xml config.
  • Loading branch information
carryxyh authored and CrazyHZM committed Dec 6, 2018
1 parent 7509369 commit 0a8ec8b
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,19 @@ public abstract class AbstractMethodConfig extends AbstractConfig {
// customized parameters
protected Map<String, String> parameters;

/**
* forks for forking cluster
*/
protected Integer forks;

public Integer getForks() {
return forks;
}

public void setForks(Integer forks) {
this.forks = forks;
}

public Integer getTimeout() {
return timeout;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ public void testTimeout() throws Exception {
assertThat(methodConfig.getTimeout(), equalTo(10));
}

@Test
public void testForks() throws Exception {
MethodConfig methodConfig = new MethodConfig();
methodConfig.setForks(10);
assertThat(methodConfig.getForks(), equalTo(10));
}

@Test
public void testRetries() throws Exception {
MethodConfig methodConfig = new MethodConfig();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@
<xsd:documentation><![CDATA[ Use cluster strategy. ]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="forks" type="xsd:string">
<xsd:annotation>
<xsd:documentation><![CDATA[ ForkingCluster forks. ]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="filter" type="xsd:string">
<xsd:annotation>
<xsd:documentation><![CDATA[ The filter. ]]></xsd:documentation>
Expand Down Expand Up @@ -492,6 +497,11 @@
<xsd:documentation><![CDATA[ The registry cluster type. ]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="forks" type="xsd:string">
<xsd:annotation>
<xsd:documentation><![CDATA[ ForkingCluster forks. ]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="group" type="xsd:string">
<xsd:annotation>
<xsd:documentation><![CDATA[ The registry group. ]]></xsd:documentation>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@
<xsd:documentation><![CDATA[ Use cluster strategy. ]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="forks" type="xsd:string">
<xsd:annotation>
<xsd:documentation><![CDATA[ ForkingCluster forks. ]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="filter" type="xsd:string">
<xsd:annotation>
<xsd:documentation><![CDATA[ The filter. ]]></xsd:documentation>
Expand Down Expand Up @@ -486,6 +491,11 @@
<xsd:documentation><![CDATA[ The registry cluster type. ]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="forks" type="xsd:string">
<xsd:annotation>
<xsd:documentation><![CDATA[ ForkingCluster forks. ]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="group" type="xsd:string">
<xsd:annotation>
<xsd:documentation><![CDATA[ The registry group. ]]></xsd:documentation>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,20 @@ public void testToString() {
assertTrue(str.endsWith(" />"));
}

@Test
public void testForks() {
ReferenceConfig<DemoService> reference = new ReferenceConfig<DemoService>();
reference.setApplication(new ApplicationConfig("consumer"));
reference.setRegistry(new RegistryConfig(RegistryConfig.NO_AVAILABLE));
reference.setInterface(DemoService.class);
reference.setUrl("dubbo://127.0.0.1:20881");

int forks = 10;
reference.setForks(forks);
String str = reference.toString();
assertTrue(str.contains("forks=\"" + forks + "\""));
}

@Test
public void testMultiProtocol() {
ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(ConfigTest.class.getPackage().getName().replace('.', '/') + "/multi-protocol.xml");
Expand Down

0 comments on commit 0a8ec8b

Please sign in to comment.