This is an automated email from the ASF dual-hosted git repository. liubao pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-servicecomb-java-chassis.git
commit d32bc852ac576ab20beb376b96b765f7ac606740 Author: wujimin <wuji...@huawei.com> AuthorDate: Mon May 7 15:18:19 2018 +0800 [scb-533] delete useless code --- .../common/javassist/TestJavassistUtils.java | 3 +- .../protobuf/definition/OperationProtobuf.java | 3 +- .../codec/protobuf/utils/ProtobufSchemaUtils.java | 4 +-- .../protobuf/utils/TestProtobufSchemaUtils.java | 4 +-- .../swagger/generator/jaxrs/TestJaxrs.java | 22 +++++++------- .../swagger/generator/springmvc/TestSpringmvc.java | 22 +++++++------- .../arguments/TestPojoConsumerEqualProducer.java | 22 +++++++------- .../arguments/TestPojoConsumerEqualSwagger.java | 34 +++++++++++----------- 8 files changed, 56 insertions(+), 58 deletions(-) diff --git a/common/common-javassist/src/test/java/org/apache/servicecomb/common/javassist/TestJavassistUtils.java b/common/common-javassist/src/test/java/org/apache/servicecomb/common/javassist/TestJavassistUtils.java index a69eb0f..e656ee7 100644 --- a/common/common-javassist/src/test/java/org/apache/servicecomb/common/javassist/TestJavassistUtils.java +++ b/common/common-javassist/src/test/java/org/apache/servicecomb/common/javassist/TestJavassistUtils.java @@ -109,7 +109,7 @@ public class TestJavassistUtils { } @Test - public void testInterface() throws Exception { + public void testInterface() { ClassConfig classConfig = new ClassConfig(); classConfig.setIntf(true); String intfName = "cse.ut.TestInterface"; @@ -213,7 +213,6 @@ public class TestJavassistUtils { .getOrCreateEnumWithPackageName(Thread.currentThread().getContextClassLoader(), packageName, Arrays.asList("a", "b"))); - } @Test diff --git a/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/definition/OperationProtobuf.java b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/definition/OperationProtobuf.java index fe97a7a..428af56 100644 --- a/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/definition/OperationProtobuf.java +++ b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/definition/OperationProtobuf.java @@ -33,8 +33,7 @@ public class OperationProtobuf { private WrapSchema responseSchema; - public OperationProtobuf(OperationMeta operationMeta) - throws Exception { + public OperationProtobuf(OperationMeta operationMeta) { this.operationMeta = operationMeta; requestSchema = ProtobufSchemaUtils.getOrCreateArgsSchema(operationMeta); diff --git a/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/utils/ProtobufSchemaUtils.java b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/utils/ProtobufSchemaUtils.java index 8fd1e89..52fd038 100644 --- a/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/utils/ProtobufSchemaUtils.java +++ b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/utils/ProtobufSchemaUtils.java @@ -72,7 +72,7 @@ public final class ProtobufSchemaUtils { } @Override - public void transfer(Pipe pipe, Input input, Output output, int number, boolean repeated) throws IOException { + public void transfer(Pipe pipe, Input input, Output output, int number, boolean repeated) { throw new IllegalStateException("not support."); } @@ -134,7 +134,7 @@ public final class ProtobufSchemaUtils { } // 为了支持method args的场景,全部实现ProtobufMessageWrapper接口,有的场景有点浪费,不过无关紧要 - private static WrapSchema createWrapSchema(WrapClassConfig config) throws Exception { + private static WrapSchema createWrapSchema(WrapClassConfig config) { Class<?> cls = JavassistUtils.createClass(config); Schema<?> schema = RuntimeSchema.createFrom(cls); return WrapSchemaFactory.createSchema(schema, config.getType()); diff --git a/common/common-protobuf/src/test/java/org/apache/servicecomb/codec/protobuf/utils/TestProtobufSchemaUtils.java b/common/common-protobuf/src/test/java/org/apache/servicecomb/codec/protobuf/utils/TestProtobufSchemaUtils.java index 883edb0..bfc0dc9 100644 --- a/common/common-protobuf/src/test/java/org/apache/servicecomb/codec/protobuf/utils/TestProtobufSchemaUtils.java +++ b/common/common-protobuf/src/test/java/org/apache/servicecomb/codec/protobuf/utils/TestProtobufSchemaUtils.java @@ -55,7 +55,7 @@ public class TestProtobufSchemaUtils { public void wrapPrimitive() throws Exception { Assert.assertNotNull(WrapType.ARGS_WRAP); Assert.assertNotNull(WrapType.NORMAL_WRAP); - testSchema((int) 1); + testSchema(1); testSchema("test"); testSchema(WrapType.ARGS_WRAP); Assert.assertTrue(true); @@ -77,7 +77,7 @@ public class TestProtobufSchemaUtils { FieldConfig expect = new FieldConfig(); expect.setName("test"); - FieldConfig result = (FieldConfig) writeThenRead(expect); + FieldConfig result = writeThenRead(expect); Assert.assertEquals(expect.getName(), result.getName()); } diff --git a/swagger/swagger-generator/generator-jaxrs/src/test/java/org/apache/servicecomb/swagger/generator/jaxrs/TestJaxrs.java b/swagger/swagger-generator/generator-jaxrs/src/test/java/org/apache/servicecomb/swagger/generator/jaxrs/TestJaxrs.java index e5a731b..fbaf303 100644 --- a/swagger/swagger-generator/generator-jaxrs/src/test/java/org/apache/servicecomb/swagger/generator/jaxrs/TestJaxrs.java +++ b/swagger/swagger-generator/generator-jaxrs/src/test/java/org/apache/servicecomb/swagger/generator/jaxrs/TestJaxrs.java @@ -35,12 +35,12 @@ public class TestJaxrs { } @Test - public void testResponse() throws Exception { + public void testResponse() { UnitTestSwaggerUtils.testSwagger("schemas/response.yaml", context, Echo.class, "response"); } @Test - public void testInvalidResponse() throws Exception { + public void testInvalidResponse() { UnitTestSwaggerUtils.testException( "generate operation swagger failed, org.apache.servicecomb.swagger.generator.jaxrs.Echo:invalidResponse", "Use ApiOperation or ApiResponses to declare response type", @@ -50,22 +50,22 @@ public class TestJaxrs { } @Test - public void testEcho() throws Exception { + public void testEcho() { UnitTestSwaggerUtils.testSwagger("schemas/echo.yaml", context, Echo.class, "echo"); } @Test - public void testForm() throws Exception { + public void testForm() { UnitTestSwaggerUtils.testSwagger("schemas/form.yaml", context, Echo.class, "form"); } @Test - public void testQuery() throws Exception { + public void testQuery() { UnitTestSwaggerUtils.testSwagger("schemas/query.yaml", context, Echo.class, "query"); } @Test - public void testQueryComplex() throws Exception { + public void testQueryComplex() { UnitTestSwaggerUtils.testException( "generate operation swagger failed, org.apache.servicecomb.swagger.generator.jaxrs.Echo:queryComplex", "not allow complex type for query parameter, method=org.apache.servicecomb.swagger.generator.jaxrs.Echo:queryComplex, paramIdx=0, type=java.util.List<org.apache.servicecomb.swagger.generator.jaxrs.User>", @@ -75,22 +75,22 @@ public class TestJaxrs { } @Test - public void testCookie() throws Exception { + public void testCookie() { UnitTestSwaggerUtils.testSwagger("schemas/cookie.yaml", context, Echo.class, "cookie"); } @Test - public void testEmptyPath() throws Exception { + public void testEmptyPath() { UnitTestSwaggerUtils.testSwagger("schemas/emptyPath.yaml", context, Echo.class, "emptyPath"); } @Test - public void testNonRestful() throws Exception { + public void testNonRestful() { UnitTestSwaggerUtils.testSwagger("schemas/emptyContract.yaml", context, Echo.class, "ignoredNonRestful"); } @Test - public void testClassMethodNoPath() throws Exception { + public void testClassMethodNoPath() { UnitTestSwaggerUtils.testException( "generate operation swagger failed, org.apache.servicecomb.swagger.generator.jaxrs.ClassMethodNoPath:p1", "Path must not both be empty in class and method", @@ -107,7 +107,7 @@ public class TestJaxrs { } @Test - public void testRawJsonStringMethod() throws Exception { + public void testRawJsonStringMethod() { UnitTestSwaggerUtils.testSwagger("schemas/rawJsonStringMethod.yaml", context, Echo.class, "rawJsonStringMethod"); } } diff --git a/swagger/swagger-generator/generator-springmvc/src/test/java/org/apache/servicecomb/swagger/generator/springmvc/TestSpringmvc.java b/swagger/swagger-generator/generator-springmvc/src/test/java/org/apache/servicecomb/swagger/generator/springmvc/TestSpringmvc.java index 48b8cb6..fa0f262 100644 --- a/swagger/swagger-generator/generator-springmvc/src/test/java/org/apache/servicecomb/swagger/generator/springmvc/TestSpringmvc.java +++ b/swagger/swagger-generator/generator-springmvc/src/test/java/org/apache/servicecomb/swagger/generator/springmvc/TestSpringmvc.java @@ -35,12 +35,12 @@ public class TestSpringmvc { } @Test - public void testResponseEntity() throws Exception { + public void testResponseEntity() { UnitTestSwaggerUtils.testSwagger("schemas/responseEntity.yaml", context, MethodResponseEntity.class); } @Test - public void testEmptyPath() throws Exception { + public void testEmptyPath() { UnitTestSwaggerUtils.testSwagger("schemas/emptyPath.yaml", context, Echo.class, "emptyPath"); UnitTestSwaggerUtils.testSwagger("schemas/MethodEmptyPath.yaml", context, @@ -48,27 +48,27 @@ public class TestSpringmvc { } @Test - public void testMixupAnnotations() throws Exception { + public void testMixupAnnotations() { UnitTestSwaggerUtils.testSwagger("schemas/mixupAnnotations.yaml", context, MethodMixupAnnotations.class); } @Test - public void testDefaultParameter() throws Exception { + public void testDefaultParameter() { UnitTestSwaggerUtils.testSwagger("schemas/defaultParameter.yaml", context, MethodDefaultParameter.class); } @Test - public void testInheritHttpMethod() throws Exception { + public void testInheritHttpMethod() { UnitTestSwaggerUtils.testSwagger("schemas/inheritHttpMethod.yaml", context, Echo.class, "inheritHttpMethod"); } @Test - public void testRawJsonStringMethod() throws Exception { + public void testRawJsonStringMethod() { UnitTestSwaggerUtils.testSwagger("schemas/rawJsonStringMethod.yaml", context, Echo.class, "rawJsonStringMethod"); } @Test - public void testClassMethodNoPath() throws Exception { + public void testClassMethodNoPath() { UnitTestSwaggerUtils.testException( "generate operation swagger failed, org.apache.servicecomb.swagger.generator.springmvc.ClassMethodNoPath:noPath", "Path must not both be empty in class and method", @@ -78,7 +78,7 @@ public class TestSpringmvc { } @Test - public void testClassMethodNoHttpMetod() throws Exception { + public void testClassMethodNoHttpMetod() { UnitTestSwaggerUtils.testException( "generate operation swagger failed, org.apache.servicecomb.swagger.generator.springmvc.ClassMethodNoHttpMethod:noHttpMethod", "HttpMethod must not both be empty in class and method", @@ -87,7 +87,7 @@ public class TestSpringmvc { } @Test - public void testMethodMultiHttpMethod() throws Exception { + public void testMethodMultiHttpMethod() { UnitTestSwaggerUtils.testException( "generate operation swagger failed, org.apache.servicecomb.swagger.generator.springmvc.Echo:multiHttpMethod", "not allowed multi http method for org.apache.servicecomb.swagger.generator.springmvc.Echo:multiHttpMethod", @@ -97,7 +97,7 @@ public class TestSpringmvc { } @Test - public void testClassMultiHttpMethod() throws Exception { + public void testClassMultiHttpMethod() { UnitTestSwaggerUtils.testException( "not allowed multi http method for org.apache.servicecomb.swagger.generator.springmvc.ClassMultiHttpMethod", context, @@ -165,7 +165,7 @@ public class TestSpringmvc { } @Test - public void testClassMultiPath() throws Exception { + public void testClassMultiPath() { UnitTestSwaggerUtils.testException( "not support multi path for org.apache.servicecomb.swagger.generator.springmvc.ClassMultiPath", context, diff --git a/swagger/swagger-invocation/invocation-core/src/test/java/org/apache/servicecomb/swagger/invocation/arguments/TestPojoConsumerEqualProducer.java b/swagger/swagger-invocation/invocation-core/src/test/java/org/apache/servicecomb/swagger/invocation/arguments/TestPojoConsumerEqualProducer.java index 04d2b30..d4addbe 100644 --- a/swagger/swagger-invocation/invocation-core/src/test/java/org/apache/servicecomb/swagger/invocation/arguments/TestPojoConsumerEqualProducer.java +++ b/swagger/swagger-invocation/invocation-core/src/test/java/org/apache/servicecomb/swagger/invocation/arguments/TestPojoConsumerEqualProducer.java @@ -55,7 +55,7 @@ public class TestPojoConsumerEqualProducer { } @Test - public void testSimple() throws Exception { + public void testSimple() { int result = proxy.testSimple(1, 2, 3); Object body = invoker.getSwaggerArgument(0); @@ -67,7 +67,7 @@ public class TestPojoConsumerEqualProducer { } @Test - public void testObject() throws Exception { + public void testObject() { Person person = new Person(); person.setName("abc"); @@ -94,7 +94,7 @@ public class TestPojoConsumerEqualProducer { } @Test - public void testSimpleAndObject() throws Exception { + public void testSimpleAndObject() { Person person = new Person(); person.setName("abc"); @@ -108,7 +108,7 @@ public class TestPojoConsumerEqualProducer { } @Test - public void testContext() throws Exception { + public void testContext() { InvocationContext threadContext = new InvocationContext(); threadContext.addContext("ta", "tvalue"); ContextUtils.setInvocationContext(threadContext); @@ -129,7 +129,7 @@ public class TestPojoConsumerEqualProducer { } @Test - public void testBytes() throws Exception { + public void testBytes() { byte[] bytes = new byte[] {1, 2}; byte[] result = proxy.testBytes(bytes); @@ -137,11 +137,11 @@ public class TestPojoConsumerEqualProducer { Object body = invoker.getSwaggerArgument(0); Assert.assertEquals(bytes, Utils.getFieldValue(body, "bytes")); - Assert.assertArrayEquals(bytes, (byte[]) result); + Assert.assertArrayEquals(bytes, result); } @Test - public void testArrayArray() throws Exception { + public void testArrayArray() { String[] array = new String[] {"a", "b"}; List<String> list = Arrays.asList(array); @@ -150,11 +150,11 @@ public class TestPojoConsumerEqualProducer { Object body = invoker.getSwaggerArgument(0); Assert.assertEquals(list, Utils.getFieldValue(body, "s")); - Assert.assertArrayEquals(array, (String[]) result); + Assert.assertArrayEquals(array, result); } @Test - public void testArrayList() throws Exception { + public void testArrayList() { String[] array = new String[] {"a", "b"}; List<String> list = Arrays.asList(array); List<String> result = proxy.testArrayList(array); @@ -166,7 +166,7 @@ public class TestPojoConsumerEqualProducer { } @Test - public void testListArray() throws Exception { + public void testListArray() { String[] array = new String[] {"a", "b"}; List<String> list = Arrays.asList(array); @@ -179,7 +179,7 @@ public class TestPojoConsumerEqualProducer { } @Test - public void testListList() throws Exception { + public void testListList() { List<String> list = Arrays.asList("a", "b"); List<String> result = proxy.testListList(list); diff --git a/swagger/swagger-invocation/invocation-core/src/test/java/org/apache/servicecomb/swagger/invocation/arguments/TestPojoConsumerEqualSwagger.java b/swagger/swagger-invocation/invocation-core/src/test/java/org/apache/servicecomb/swagger/invocation/arguments/TestPojoConsumerEqualSwagger.java index 7a1f4d5..159e554 100644 --- a/swagger/swagger-invocation/invocation-core/src/test/java/org/apache/servicecomb/swagger/invocation/arguments/TestPojoConsumerEqualSwagger.java +++ b/swagger/swagger-invocation/invocation-core/src/test/java/org/apache/servicecomb/swagger/invocation/arguments/TestPojoConsumerEqualSwagger.java @@ -53,7 +53,7 @@ public class TestPojoConsumerEqualSwagger { } @Test - public void testSimple() throws Exception { + public void testSimple() { int result = proxy.testSimple(1, 2, 3); Assert.assertEquals(1, (int) invoker.getSwaggerArgument(0)); @@ -64,7 +64,7 @@ public class TestPojoConsumerEqualSwagger { } @Test - public void testObject() throws Exception { + public void testObject() { Person person = new Person(); person.setName("abc"); @@ -77,7 +77,7 @@ public class TestPojoConsumerEqualSwagger { } @Test - public void testSimpleAndObject() throws Exception { + public void testSimpleAndObject() { Person person = new Person(); person.setName("abc"); @@ -90,7 +90,7 @@ public class TestPojoConsumerEqualSwagger { } @Test - public void testContext() throws Exception { + public void testContext() { InvocationContext threadContext = new InvocationContext(); threadContext.addContext("ta", "tvalue"); ContextUtils.setInvocationContext(threadContext); @@ -110,7 +110,7 @@ public class TestPojoConsumerEqualSwagger { } @Test - public void testBytes() throws Exception { + public void testBytes() { byte[] bytes = new byte[] {1, 2}; byte[] result = proxy.testBytes(bytes); @@ -121,19 +121,19 @@ public class TestPojoConsumerEqualSwagger { } @Test - public void testArrayArray() throws Exception { + public void testArrayArray() { String[] array = new String[] {"a", "b"}; List<String> list = Arrays.asList(array); String[] result = proxy.testArrayArray(array); - Assert.assertEquals(list, (List<?>) invoker.getSwaggerArgument(0)); + Assert.assertEquals(list, invoker.getSwaggerArgument(0)); - Assert.assertArrayEquals(array, (String[]) result); + Assert.assertArrayEquals(array, result); } @Test - public void testArrayList() throws Exception { + public void testArrayList() { String[] array = new String[] {"a", "b"}; List<String> list = Arrays.asList(array); List<String> result = proxy.testArrayList(array); @@ -144,7 +144,7 @@ public class TestPojoConsumerEqualSwagger { } @Test - public void testListArray() throws Exception { + public void testListArray() { String[] array = new String[] {"a", "b"}; List<String> list = Arrays.asList(array); @@ -156,7 +156,7 @@ public class TestPojoConsumerEqualSwagger { } @Test - public void testListList() throws Exception { + public void testListList() { List<String> list = Arrays.asList("a", "b"); List<String> result = proxy.testListList(list); @@ -167,19 +167,19 @@ public class TestPojoConsumerEqualSwagger { } @Test - public void testObjectArrayArray() throws Exception { + public void testObjectArrayArray() { Person[] array = new Person[] {new Person("a"), new Person("b")}; List<Person> list = Arrays.asList(array); Person[] result = proxy.testObjectArrayArray(array); - Assert.assertEquals(list, (List<?>) invoker.getSwaggerArgument(0)); + Assert.assertEquals(list, invoker.getSwaggerArgument(0)); - Assert.assertArrayEquals(array, (Person[]) result); + Assert.assertArrayEquals(array, result); } @Test - public void testObjectArrayList() throws Exception { + public void testObjectArrayList() { Person[] array = new Person[] {new Person("a"), new Person("b")}; List<Person> list = Arrays.asList(array); List<Person> result = proxy.testObjectArrayList(array); @@ -190,7 +190,7 @@ public class TestPojoConsumerEqualSwagger { } @Test - public void testObjectListArray() throws Exception { + public void testObjectListArray() { Person[] array = new Person[] {new Person("a"), new Person("b")}; List<Person> list = Arrays.asList(array); @@ -203,7 +203,7 @@ public class TestPojoConsumerEqualSwagger { } @Test - public void testObjectListList() throws Exception { + public void testObjectListList() { Person[] array = new Person[] {new Person("a"), new Person("b")}; List<Person> list = Arrays.asList(array); -- To stop receiving notification emails like this one, please contact liu...@apache.org.