Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add forks support for ForkingCluster. #2751

Merged
merged 1 commit into from
Nov 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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" use="optional">
<xsd:annotation>
<xsd:documentation><![CDATA[ The filter. ]]></xsd:documentation>
Expand Down Expand Up @@ -480,6 +485,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" use="optional">
<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" use="optional">
<xsd:annotation>
<xsd:documentation><![CDATA[ The filter. ]]></xsd:documentation>
Expand Down Expand Up @@ -480,6 +485,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" use="optional">
<xsd:annotation>
<xsd:documentation><![CDATA[ The registry group. ]]></xsd:documentation>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,19 @@ 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