Skip to content

Commit

Permalink
[SCB-2017]fix invoke with appid and highway throw error
Browse files Browse the repository at this point in the history
  • Loading branch information
liubao68 committed Jun 22, 2020
1 parent 1d1225e commit 5cee981
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public Proto convert() {
}

public static String escapePackageName(String name) {
return name.replaceAll("\\-", "_");
return name.replaceAll("[\\-\\:]", "_");
}

public static String escapeMessageName(String name) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public void testEscape() {
Assert.assertEquals("hello_my_service", SwaggerToProtoGenerator.escapeMessageName("hello_my_service"));
Assert.assertEquals("hello.my_service", SwaggerToProtoGenerator.escapePackageName("hello.my-service"));
Assert.assertEquals("hello.test.test", SwaggerToProtoGenerator.escapePackageName("hello.test.test"));
Assert.assertEquals("hello_my.test.test", SwaggerToProtoGenerator.escapePackageName("hello:my.test.test"));
Assert.assertEquals(false, SwaggerToProtoGenerator.isValidEnum("hello.test.test"));
Assert.assertEquals(false, SwaggerToProtoGenerator.isValidEnum("hello.my-service"));
Assert.assertEquals(true, SwaggerToProtoGenerator.isValidEnum("My_ENum"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ public class TestWeakSpringmvc implements CategorizedTestCase {
@RpcReference(microserviceName = "springmvc", schemaId = "weakSpringmvc")
private SpecialNameModelInf specialNameModelInf;

@RpcReference(microserviceName = "springmvctest:springmvc", schemaId = "weakSpringmvc")
private SpecialNameModelInf specialNameModelInfWithAppId;

private RestTemplate restTemplate = RestTemplateBuilder.create();

@Override
Expand Down Expand Up @@ -139,6 +142,8 @@ private void testSpecailNameModel() {
model.setaIntName(30);
SpecialNameModel result = specialNameModelInf.specialNameModel(0, model);
TestMgr.check(30, result.getaIntName());
result = specialNameModelInfWithAppId.specialNameModel(0, model);
TestMgr.check(30, result.getaIntName());
}

private void testGenericsModel() throws JsonProcessingException {
Expand Down Expand Up @@ -176,9 +181,15 @@ private void testDiffName() {
TestMgr.check(7, diffNames.differentName(2, 3));
TestMgr.check(8, diffNames2.differentName(2, 3));
TestMgr.check(7, restTemplate.getForObject("cse://springmvc/weakSpringmvc/diffNames?x=2&y=3", Integer.class));
TestMgr.check(7, restTemplate
.getForObject("cse://springmvctest:springmvc/weakSpringmvc/diffNames?x=2&y=3",
Integer.class));
Map<String, Object> args = new HashMap<>();
args.put("x", 2);
args.put("y", 3);
TestMgr.check(7, InvokerUtils.syncInvoke("springmvc", "weakSpringmvc", "differentName", args));
TestMgr.check(7, InvokerUtils.syncInvoke("springmvc",
"weakSpringmvc", "differentName", args));
TestMgr.check(7, InvokerUtils.syncInvoke("springmvctest:springmvc",
"weakSpringmvc", "differentName", args));
}
}

0 comments on commit 5cee981

Please sign in to comment.