Author: cutting
Date: Fri Sep 25 21:22:47 2009
New Revision: 819021
URL: http://svn.apache.org/viewvc?rev=819021&view=rev
Log:
AVRO-123. Fix Java's specific protocol compiler so that parameters and return
types are unboxed.
Modified:
hadoop/avro/trunk/CHANGES.txt
hadoop/avro/trunk/src/java/org/apache/avro/specific/SpecificCompiler.java
hadoop/avro/trunk/src/test/java/org/apache/avro/TestProtocolSpecific.java
hadoop/avro/trunk/src/test/schemata/simple.avpr
Modified: hadoop/avro/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/hadoop/avro/trunk/CHANGES.txt?rev=819021&r1=819020&r2=819021&view=diff
==============================================================================
--- hadoop/avro/trunk/CHANGES.txt (original)
+++ hadoop/avro/trunk/CHANGES.txt Fri Sep 25 21:22:47 2009
@@ -62,6 +62,9 @@
the command line that depend on ivy, ivy does not fail. (phunt
via cutting)
+ AVRO-123. Fix Java's specific protocol compiler so that
+ parameters and return types are unboxed. (cutting)
+
Avro 1.1.0 (8 September 2009)
INCOMPATIBLE CHANGES
Modified:
hadoop/avro/trunk/src/java/org/apache/avro/specific/SpecificCompiler.java
URL:
http://svn.apache.org/viewvc/hadoop/avro/trunk/src/java/org/apache/avro/specific/SpecificCompiler.java?rev=819021&r1=819020&r2=819021&view=diff
==============================================================================
--- hadoop/avro/trunk/src/java/org/apache/avro/specific/SpecificCompiler.java
(original)
+++ hadoop/avro/trunk/src/java/org/apache/avro/specific/SpecificCompiler.java
Fri Sep 25 21:22:47 2009
@@ -110,7 +110,7 @@
Message message = e.getValue();
Schema request = message.getRequest();
Schema response = message.getResponse();
- line(1, type(response)+" "+name+"("+params(request)+")");
+ line(1, unbox(response)+" "+name+"("+params(request)+")");
line(2,"throws AvroRemoteException"+errors(message.getErrors())+";");
}
line(0, "}");
@@ -160,7 +160,7 @@
int count = 0;
for (Map.Entry<String, Schema> param : request.getFieldSchemas()) {
String paramName = param.getKey();
- b.append(type(param.getValue()));
+ b.append(unbox(param.getValue()));
b.append(" ");
b.append(paramName);
if (++count < request.getFields().size())
Modified:
hadoop/avro/trunk/src/test/java/org/apache/avro/TestProtocolSpecific.java
URL:
http://svn.apache.org/viewvc/hadoop/avro/trunk/src/test/java/org/apache/avro/TestProtocolSpecific.java?rev=819021&r1=819020&r2=819021&view=diff
==============================================================================
--- hadoop/avro/trunk/src/test/java/org/apache/avro/TestProtocolSpecific.java
(original)
+++ hadoop/avro/trunk/src/test/java/org/apache/avro/TestProtocolSpecific.java
Fri Sep 25 21:22:47 2009
@@ -53,6 +53,7 @@
public static class TestImpl implements Simple {
public Utf8 hello(Utf8 greeting) { return new Utf8("goodbye"); }
+ public int add(int arg1, int arg2) { return arg1 + arg2; }
public TestRecord echo(TestRecord record) { return record; }
public ByteBuffer echoBytes(ByteBuffer data) { return data; }
public Void error() throws AvroRemoteException {
@@ -94,6 +95,12 @@
}
@Test
+ public void testAdd() throws IOException {
+ int result = proxy.add(1, 2);
+ assertEquals(3, result);
+ }
+
+ @Test
public void testEchoBytes() throws IOException {
Random random = new Random();
int length = random.nextInt(1024*16);
Modified: hadoop/avro/trunk/src/test/schemata/simple.avpr
URL:
http://svn.apache.org/viewvc/hadoop/avro/trunk/src/test/schemata/simple.avpr?rev=819021&r1=819020&r2=819021&view=diff
==============================================================================
--- hadoop/avro/trunk/src/test/schemata/simple.avpr (original)
+++ hadoop/avro/trunk/src/test/schemata/simple.avpr Fri Sep 25 21:22:47 2009
@@ -33,6 +33,11 @@
"response": "TestRecord"
},
+ "add": {
+ "request": [{"name": "arg1", "type": "int"}, {"name": "arg2", "type":
"int"}],
+ "response": "int"
+ },
+
"echoBytes": {
"request": [{"name": "data", "type": "bytes"}],
"response": "bytes"