Skip to content

Commit d6aae07

Browse files
authored
#2748: Provider should disable mock configuration (#2750)
1 parent ef4ecdf commit d6aae07

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ServiceConfig.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -820,6 +820,16 @@ public void setGeneric(String generic) {
820820
}
821821
}
822822

823+
@Override
824+
public void setMock(Boolean mock) {
825+
throw new IllegalArgumentException("mock doesn't support on provider side");
826+
}
827+
828+
@Override
829+
public void setMock(String mock) {
830+
throw new IllegalArgumentException("mock doesn't support on provider side");
831+
}
832+
823833
public List<URL> getExportedUrls() {
824834
return urls;
825835
}

dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/ServiceConfigTest.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,18 @@ public void testGeneric2() throws Exception {
194194
service.setGeneric("illegal");
195195
}
196196

197+
@Test(expected = IllegalArgumentException.class)
198+
public void testMock() throws Exception {
199+
ServiceConfig service = new ServiceConfig();
200+
service.setMock("true");
201+
}
202+
203+
@Test(expected = IllegalArgumentException.class)
204+
public void testMock2() throws Exception {
205+
ServiceConfig service = new ServiceConfig();
206+
service.setMock(true);
207+
}
208+
197209
@Test
198210
public void testUniqueServiceName() throws Exception {
199211
ServiceConfig<Greeting> service = new ServiceConfig<Greeting>();

0 commit comments

Comments
 (0)