You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@avro.apache.org by fo...@apache.org on 2019/05/07 18:26:04 UTC

[avro] branch branch-1.9 updated (24ff48c -> 3c76495)

This is an automated email from the ASF dual-hosted git repository.

fokko pushed a change to branch branch-1.9
in repository https://gitbox.apache.org/repos/asf/avro.git.


    from 24ff48c  Also exclude the new sums from being re-summed
     new 16de62a  AVRO-XXXX: Remove the SNAPSHOT postfix in the tests
     new 3c76495  AVRO-2386: Make customEncode and customDecode public (#511)

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../apache/avro/specific/SpecificRecordBase.java   |  4 ++--
 .../specific/templates/java/classic/record.vm      |  4 ++--
 ... TestNestedRecordsWithDifferentNamespaces.java} | 20 ++++++-------------
 .../avro/nested_records_different_namespace.avsc   | 23 ++++++++++++++++++++++
 .../src/test/resources/unit/idl/pom-joda.xml       |  2 +-
 .../src/test/resources/unit/idl/pom-jsr310.xml     |  2 +-
 .../src/test/resources/unit/protocol/pom-joda.xml  |  2 +-
 .../test/resources/unit/protocol/pom-jsr310.xml    |  2 +-
 .../src/test/resources/unit/schema/pom-joda.xml    |  2 +-
 .../src/test/resources/unit/schema/pom-jsr310.xml  |  2 +-
 .../avro/examples/baseball/Player.java             |  4 ++--
 .../tools/src/test/compiler/output/Player.java     |  4 ++--
 12 files changed, 43 insertions(+), 28 deletions(-)
 mode change 100644 => 100755 lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/record.vm
 copy lang/java/integration-test/codegen-test/src/test/java/org/apache/avro/codegentest/{TestNullableLogicalTypes.java => TestNestedRecordsWithDifferentNamespaces.java} (60%)
 mode change 100644 => 100755
 create mode 100755 lang/java/integration-test/codegen-test/src/test/resources/avro/nested_records_different_namespace.avsc


[avro] 02/02: AVRO-2386: Make customEncode and customDecode public (#511)

Posted by fo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

fokko pushed a commit to branch branch-1.9
in repository https://gitbox.apache.org/repos/asf/avro.git

commit 3c76495e9524ef322726d03d7ee406be89e8fde0
Author: Katrin Skoglund <ka...@avanza.se>
AuthorDate: Tue May 7 20:23:40 2019 +0200

    AVRO-2386: Make customEncode and customDecode public (#511)
    
    * Make customEncode and customDecode methods public
    
    * Make methods in superclass public
    
    (cherry picked from commit e250dcc0ae0e3b32ce9d1cad0e9f580dbd241b15)
---
 .../apache/avro/specific/SpecificRecordBase.java   |  4 +--
 .../specific/templates/java/classic/record.vm      |  4 +--
 .../TestNestedRecordsWithDifferentNamespaces.java  | 34 ++++++++++++++++++++++
 .../avro/nested_records_different_namespace.avsc   | 23 +++++++++++++++
 .../avro/examples/baseball/Player.java             |  4 +--
 .../tools/src/test/compiler/output/Player.java     |  4 +--
 6 files changed, 65 insertions(+), 8 deletions(-)

diff --git a/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificRecordBase.java b/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificRecordBase.java
index 0084da0..1394dcb 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificRecordBase.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificRecordBase.java
@@ -115,11 +115,11 @@ public abstract class SpecificRecordBase
     return false;
   }
 
-  protected void customEncode(Encoder out) throws IOException {
+  public void customEncode(Encoder out) throws IOException {
     throw new UnsupportedOperationException();
   }
 
-  protected void customDecode(ResolvingDecoder in) throws IOException {
+  public void customDecode(ResolvingDecoder in) throws IOException {
     throw new UnsupportedOperationException();
   }
 }
diff --git a/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/record.vm b/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/record.vm
old mode 100644
new mode 100755
index 738ffac..ca9a131
--- a/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/record.vm
+++ b/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/record.vm
@@ -536,7 +536,7 @@ static {
 #if ($this.isCustomCodable($schema))
   @Override protected boolean hasCustomCoders() { return true; }
 
-  @Override protected void customEncode(org.apache.avro.io.Encoder out)
+  @Override public void customEncode(org.apache.avro.io.Encoder out)
     throws java.io.IOException
   {
 #set ($nv = 0)## Counter to ensure unique var-names
@@ -550,7 +550,7 @@ static {
 #end
   }
 
-  @Override protected void customDecode(org.apache.avro.io.ResolvingDecoder in)
+  @Override public void customDecode(org.apache.avro.io.ResolvingDecoder in)
     throws java.io.IOException
   {
     org.apache.avro.Schema.Field[] fieldOrder = in.readFieldOrderIfDiff();
diff --git a/lang/java/integration-test/codegen-test/src/test/java/org/apache/avro/codegentest/TestNestedRecordsWithDifferentNamespaces.java b/lang/java/integration-test/codegen-test/src/test/java/org/apache/avro/codegentest/TestNestedRecordsWithDifferentNamespaces.java
new file mode 100755
index 0000000..831de6a
--- /dev/null
+++ b/lang/java/integration-test/codegen-test/src/test/java/org/apache/avro/codegentest/TestNestedRecordsWithDifferentNamespaces.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.avro.codegentest;
+
+import org.apache.avro.codegentest.other.NestedOtherNamespaceRecord;
+import org.apache.avro.codegentest.some.NestedSomeNamespaceRecord;
+import org.junit.Test;
+
+public class TestNestedRecordsWithDifferentNamespaces extends AbstractSpecificRecordTest {
+
+  @Test
+  public void testNestedRecordsWithDifferentNamespaces() {
+    NestedSomeNamespaceRecord instanceOfGeneratedClass = NestedSomeNamespaceRecord.newBuilder()
+        .setNestedRecordBuilder(NestedOtherNamespaceRecord.newBuilder().setSomeField(1)).build();
+    verifySerDeAndStandardMethods(instanceOfGeneratedClass);
+  }
+
+}
diff --git a/lang/java/integration-test/codegen-test/src/test/resources/avro/nested_records_different_namespace.avsc b/lang/java/integration-test/codegen-test/src/test/resources/avro/nested_records_different_namespace.avsc
new file mode 100755
index 0000000..b5a8351
--- /dev/null
+++ b/lang/java/integration-test/codegen-test/src/test/resources/avro/nested_records_different_namespace.avsc
@@ -0,0 +1,23 @@
+{"namespace": "org.apache.avro.codegentest.some",
+  "type": "record",
+  "name": "NestedSomeNamespaceRecord",
+  "doc" : "Test nested types with different namespace than the outer type",
+  "fields": [
+    {
+      "name": "nestedRecord",
+      "type": {
+        "namespace": "org.apache.avro.codegentest.other",
+        "type": "record",
+        "name": "NestedOtherNamespaceRecord",
+        "fields": [
+          {
+            "name": "someField",
+            "type": "int"
+          }
+        ]
+      }
+    }]
+}
+
+
+
diff --git a/lang/java/tools/src/test/compiler/output-string/avro/examples/baseball/Player.java b/lang/java/tools/src/test/compiler/output-string/avro/examples/baseball/Player.java
index bd373ac..697d590 100644
--- a/lang/java/tools/src/test/compiler/output-string/avro/examples/baseball/Player.java
+++ b/lang/java/tools/src/test/compiler/output-string/avro/examples/baseball/Player.java
@@ -493,7 +493,7 @@ public class Player extends org.apache.avro.specific.SpecificRecordBase implemen
 
   @Override protected boolean hasCustomCoders() { return true; }
 
-  @Override protected void customEncode(org.apache.avro.io.Encoder out)
+  @Override public void customEncode(org.apache.avro.io.Encoder out)
     throws java.io.IOException
   {
     out.writeInt(this.number);
@@ -517,7 +517,7 @@ public class Player extends org.apache.avro.specific.SpecificRecordBase implemen
 
   }
 
-  @Override protected void customDecode(org.apache.avro.io.ResolvingDecoder in)
+  @Override public void customDecode(org.apache.avro.io.ResolvingDecoder in)
     throws java.io.IOException
   {
     org.apache.avro.Schema.Field[] fieldOrder = in.readFieldOrderIfDiff();
diff --git a/lang/java/tools/src/test/compiler/output/Player.java b/lang/java/tools/src/test/compiler/output/Player.java
index 642640c..e717d86 100644
--- a/lang/java/tools/src/test/compiler/output/Player.java
+++ b/lang/java/tools/src/test/compiler/output/Player.java
@@ -493,7 +493,7 @@ public class Player extends org.apache.avro.specific.SpecificRecordBase implemen
 
   @Override protected boolean hasCustomCoders() { return true; }
 
-  @Override protected void customEncode(org.apache.avro.io.Encoder out)
+  @Override public void customEncode(org.apache.avro.io.Encoder out)
     throws java.io.IOException
   {
     out.writeInt(this.number);
@@ -517,7 +517,7 @@ public class Player extends org.apache.avro.specific.SpecificRecordBase implemen
 
   }
 
-  @Override protected void customDecode(org.apache.avro.io.ResolvingDecoder in)
+  @Override public void customDecode(org.apache.avro.io.ResolvingDecoder in)
     throws java.io.IOException
   {
     org.apache.avro.Schema.Field[] fieldOrder = in.readFieldOrderIfDiff();


[avro] 01/02: AVRO-XXXX: Remove the SNAPSHOT postfix in the tests

Posted by fo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

fokko pushed a commit to branch branch-1.9
in repository https://gitbox.apache.org/repos/asf/avro.git

commit 16de62a54297a42e21c0f0c5197a8bf0432f2bce
Author: Fokko Driesprong <fo...@driesprong.frl>
AuthorDate: Tue May 7 08:46:40 2019 +0200

    AVRO-XXXX: Remove the SNAPSHOT postfix in the tests
---
 lang/java/maven-plugin/src/test/resources/unit/idl/pom-joda.xml        | 2 +-
 lang/java/maven-plugin/src/test/resources/unit/idl/pom-jsr310.xml      | 2 +-
 lang/java/maven-plugin/src/test/resources/unit/protocol/pom-joda.xml   | 2 +-
 lang/java/maven-plugin/src/test/resources/unit/protocol/pom-jsr310.xml | 2 +-
 lang/java/maven-plugin/src/test/resources/unit/schema/pom-joda.xml     | 2 +-
 lang/java/maven-plugin/src/test/resources/unit/schema/pom-jsr310.xml   | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/lang/java/maven-plugin/src/test/resources/unit/idl/pom-joda.xml b/lang/java/maven-plugin/src/test/resources/unit/idl/pom-joda.xml
index c011303..8cc9ca5 100644
--- a/lang/java/maven-plugin/src/test/resources/unit/idl/pom-joda.xml
+++ b/lang/java/maven-plugin/src/test/resources/unit/idl/pom-joda.xml
@@ -22,7 +22,7 @@
   <parent>
     <artifactId>avro-parent</artifactId>
     <groupId>org.apache.avro</groupId>
-    <version>1.9.0-SNAPSHOT</version>
+    <version>1.9.0</version>
     <relativePath>../../../../../../../../../pom.xml</relativePath>
   </parent>
 
diff --git a/lang/java/maven-plugin/src/test/resources/unit/idl/pom-jsr310.xml b/lang/java/maven-plugin/src/test/resources/unit/idl/pom-jsr310.xml
index ae9266a..d89303f 100644
--- a/lang/java/maven-plugin/src/test/resources/unit/idl/pom-jsr310.xml
+++ b/lang/java/maven-plugin/src/test/resources/unit/idl/pom-jsr310.xml
@@ -22,7 +22,7 @@
   <parent>
     <artifactId>avro-parent</artifactId>
     <groupId>org.apache.avro</groupId>
-    <version>1.9.0-SNAPSHOT</version>
+    <version>1.9.0</version>
     <relativePath>../../../../../../../../../pom.xml</relativePath>
   </parent>
 
diff --git a/lang/java/maven-plugin/src/test/resources/unit/protocol/pom-joda.xml b/lang/java/maven-plugin/src/test/resources/unit/protocol/pom-joda.xml
index e10462e..34744da 100644
--- a/lang/java/maven-plugin/src/test/resources/unit/protocol/pom-joda.xml
+++ b/lang/java/maven-plugin/src/test/resources/unit/protocol/pom-joda.xml
@@ -22,7 +22,7 @@
   <parent>
     <artifactId>avro-parent</artifactId>
     <groupId>org.apache.avro</groupId>
-    <version>1.9.0-SNAPSHOT</version>
+    <version>1.9.0</version>
     <relativePath>../../../../../../../../../pom.xml</relativePath>
   </parent>
 
diff --git a/lang/java/maven-plugin/src/test/resources/unit/protocol/pom-jsr310.xml b/lang/java/maven-plugin/src/test/resources/unit/protocol/pom-jsr310.xml
index 969970a..2256d86 100644
--- a/lang/java/maven-plugin/src/test/resources/unit/protocol/pom-jsr310.xml
+++ b/lang/java/maven-plugin/src/test/resources/unit/protocol/pom-jsr310.xml
@@ -22,7 +22,7 @@
   <parent>
     <artifactId>avro-parent</artifactId>
     <groupId>org.apache.avro</groupId>
-    <version>1.9.0-SNAPSHOT</version>
+    <version>1.9.0</version>
     <relativePath>../../../../../../../../../pom.xml</relativePath>
   </parent>
 
diff --git a/lang/java/maven-plugin/src/test/resources/unit/schema/pom-joda.xml b/lang/java/maven-plugin/src/test/resources/unit/schema/pom-joda.xml
index 621b6bb..b758468 100644
--- a/lang/java/maven-plugin/src/test/resources/unit/schema/pom-joda.xml
+++ b/lang/java/maven-plugin/src/test/resources/unit/schema/pom-joda.xml
@@ -22,7 +22,7 @@
   <parent>
     <artifactId>avro-parent</artifactId>
     <groupId>org.apache.avro</groupId>
-    <version>1.9.0-SNAPSHOT</version>
+    <version>1.9.0</version>
     <relativePath>../../../../../../../../../pom.xml</relativePath>
   </parent>
 
diff --git a/lang/java/maven-plugin/src/test/resources/unit/schema/pom-jsr310.xml b/lang/java/maven-plugin/src/test/resources/unit/schema/pom-jsr310.xml
index 62cf887..6656c7e 100644
--- a/lang/java/maven-plugin/src/test/resources/unit/schema/pom-jsr310.xml
+++ b/lang/java/maven-plugin/src/test/resources/unit/schema/pom-jsr310.xml
@@ -22,7 +22,7 @@
   <parent>
     <artifactId>avro-parent</artifactId>
     <groupId>org.apache.avro</groupId>
-    <version>1.9.0-SNAPSHOT</version>
+    <version>1.9.0</version>
     <relativePath>../../../../../../../../../pom.xml</relativePath>
   </parent>