when(context.getType("service1")).thenReturn(withGroupServiceClass);
RopContext ropContext = new DefaultRopContext(context);
//method1:都在ServiceMethodGroup中定义,在ServiceMethod中直接采用
ServiceMethodHandler handler = ropContext.getServiceMethodHandler("service.method1", "1.0");
ServiceMethodDefinition definition = handler.getServiceMethodDefinition();
assertNotNull(definition);
assertEquals(definition.getMethod(), "service.method1");
assertEquals(definition.getMethodTitle(), "测试方法1");
assertEquals(definition.getMethodGroup(), "GROUP1");
assertEquals(definition.getMethodGroupTitle(), "分组1");
assertEquals(definition.getTags(), new String[]{"TAG1", "TAG2"});
assertEquals(definition.isIgnoreSign(), true);
assertEquals(definition.isNeedInSession(), false);
assertEquals(definition.getTimeout(), 100);
assertEquals(definition.getVersion(), "1.0");
//method2:在ServiceMethodGroup中定义,在ServiceMethod显式覆盖之
ServiceMethodHandler handler2 = ropContext.getServiceMethodHandler("service.method2", "2.0");
ServiceMethodDefinition definition2 = handler2.getServiceMethodDefinition();
assertNotNull(definition2);
assertEquals(definition2.getMethod(), "service.method2");
assertEquals(definition2.getMethodTitle(), "测试方法2");
assertEquals(definition2.getMethodGroup(), "GROUP2");
assertEquals(definition2.getMethodGroupTitle(), "分组2");
assertEquals(definition2.getTags(), new String[]{"TAG11", "TAG21"});
assertEquals(definition2.isIgnoreSign(), false);
assertEquals(definition2.isNeedInSession(), true);
assertEquals(definition2.getTimeout(), 200);
assertEquals(definition2.getVersion(), "2.0");
}