You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@crunch.apache.org by jw...@apache.org on 2012/08/22 08:26:48 UTC
[6/9] git commit: Swap out generated avro classes for the avro maven
plugin
Swap out generated avro classes for the avro maven plugin
Signed-off-by: Josh Wills <jw...@cloudera.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-crunch/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-crunch/commit/11819871
Tree: http://git-wip-us.apache.org/repos/asf/incubator-crunch/tree/11819871
Diff: http://git-wip-us.apache.org/repos/asf/incubator-crunch/diff/11819871
Branch: refs/heads/master
Commit: 11819871bb7206f9802c0e67f1fbd6d9b42988f0
Parents: 457a067
Author: jwills <jw...@apache.org>
Authored: Fri Aug 17 19:14:06 2012 -0700
Committer: Josh Wills <jw...@cloudera.com>
Committed: Tue Aug 21 18:54:29 2012 -0700
----------------------------------------------------------------------
crunch/pom.xml | 18 +
crunch/src/it/resources/employee.avro | 9 -
crunch/src/it/resources/person.avro | 9 -
crunch/src/test/avro/employee.avsc | 26 ++
crunch/src/test/avro/person.avsc | 26 ++
.../test/java/org/apache/crunch/test/Employee.java | 261 ---------------
.../test/java/org/apache/crunch/test/Person.java | 260 --------------
pom.xml | 2 +-
8 files changed, 71 insertions(+), 540 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-crunch/blob/11819871/crunch/pom.xml
----------------------------------------------------------------------
diff --git a/crunch/pom.xml b/crunch/pom.xml
index df41df3..20c75b7 100644
--- a/crunch/pom.xml
+++ b/crunch/pom.xml
@@ -177,6 +177,24 @@ under the License.
</execution>
</executions>
</plugin>
+ <plugin>
+ <groupId>org.apache.avro</groupId>
+ <artifactId>avro-maven-plugin</artifactId>
+ <version>${avro.version}</version>
+ <executions>
+ <execution>
+ <id>schemas</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>schema</goal>
+ </goals>
+ <configuration>
+ <testSourceDirectory>${project.basedir}/src/test/avro/</testSourceDirectory>
+ <testOutputDirectory>target/generated-test-sources/</testOutputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
http://git-wip-us.apache.org/repos/asf/incubator-crunch/blob/11819871/crunch/src/it/resources/employee.avro
----------------------------------------------------------------------
diff --git a/crunch/src/it/resources/employee.avro b/crunch/src/it/resources/employee.avro
deleted file mode 100644
index 94b7483..0000000
--- a/crunch/src/it/resources/employee.avro
+++ /dev/null
@@ -1,9 +0,0 @@
-{
-"namespace": "org.apache.crunch.test",
-"name": "Employee",
-"type": "record",
-"fields": [
- {"name": "name", "type": ["string", "null"] },
- {"name": "salary", "type": "int"},
- {"name": "department", "type": ["string", "null"] } ]
-}
http://git-wip-us.apache.org/repos/asf/incubator-crunch/blob/11819871/crunch/src/it/resources/person.avro
----------------------------------------------------------------------
diff --git a/crunch/src/it/resources/person.avro b/crunch/src/it/resources/person.avro
deleted file mode 100644
index 82fd6ec..0000000
--- a/crunch/src/it/resources/person.avro
+++ /dev/null
@@ -1,9 +0,0 @@
-{
-"namespace": "org.apache.crunch.test",
-"name": "Person",
-"type": "record",
-"fields": [
- {"name": "name", "type": ["string", "null"] },
- {"name": "age", "type": "int"},
- {"name": "siblingnames", "type": {"type": "array", "items": "string"}} ]
-}
http://git-wip-us.apache.org/repos/asf/incubator-crunch/blob/11819871/crunch/src/test/avro/employee.avsc
----------------------------------------------------------------------
diff --git a/crunch/src/test/avro/employee.avsc b/crunch/src/test/avro/employee.avsc
new file mode 100644
index 0000000..35726e1
--- /dev/null
+++ b/crunch/src/test/avro/employee.avsc
@@ -0,0 +1,26 @@
+/**
+ * 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.
+ */
+{
+"namespace": "org.apache.crunch.test",
+"name": "Employee",
+"type": "record",
+"fields": [
+ {"name": "name", "type": ["string", "null"] },
+ {"name": "salary", "type": "int"},
+ {"name": "department", "type": ["string", "null"] } ]
+}
http://git-wip-us.apache.org/repos/asf/incubator-crunch/blob/11819871/crunch/src/test/avro/person.avsc
----------------------------------------------------------------------
diff --git a/crunch/src/test/avro/person.avsc b/crunch/src/test/avro/person.avsc
new file mode 100644
index 0000000..babd808
--- /dev/null
+++ b/crunch/src/test/avro/person.avsc
@@ -0,0 +1,26 @@
+/**
+ * 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.
+ */
+{
+"namespace": "org.apache.crunch.test",
+"name": "Person",
+"type": "record",
+"fields": [
+ {"name": "name", "type": ["string", "null"] },
+ {"name": "age", "type": "int"},
+ {"name": "siblingnames", "type": {"type": "array", "items": "string"}} ]
+}
http://git-wip-us.apache.org/repos/asf/incubator-crunch/blob/11819871/crunch/src/test/java/org/apache/crunch/test/Employee.java
----------------------------------------------------------------------
diff --git a/crunch/src/test/java/org/apache/crunch/test/Employee.java b/crunch/src/test/java/org/apache/crunch/test/Employee.java
deleted file mode 100644
index 94e7931..0000000
--- a/crunch/src/test/java/org/apache/crunch/test/Employee.java
+++ /dev/null
@@ -1,261 +0,0 @@
-/**
- * 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.crunch.test;
-
-@SuppressWarnings("all")
-public class Employee extends org.apache.avro.specific.SpecificRecordBase implements
- org.apache.avro.specific.SpecificRecord {
- public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser()
- .parse("{\"type\":\"record\",\"name\":\"Employee\",\"namespace\":\"org.apache.crunch.test\",\"fields\":[{\"name\":\"name\",\"type\":[\"string\",\"null\"]},{\"name\":\"salary\",\"type\":\"int\"},{\"name\":\"department\",\"type\":[\"string\",\"null\"]}]}");
- @Deprecated
- public java.lang.CharSequence name;
- @Deprecated
- public int salary;
- @Deprecated
- public java.lang.CharSequence department;
-
- public org.apache.avro.Schema getSchema() {
- return SCHEMA$;
- }
-
- // Used by DatumWriter. Applications should not call.
- public java.lang.Object get(int field$) {
- switch (field$) {
- case 0:
- return name;
- case 1:
- return salary;
- case 2:
- return department;
- default:
- throw new org.apache.avro.AvroRuntimeException("Bad index");
- }
- }
-
- // Used by DatumReader. Applications should not call.
- @SuppressWarnings(value = "unchecked")
- public void put(int field$, java.lang.Object value$) {
- switch (field$) {
- case 0:
- name = (java.lang.CharSequence) value$;
- break;
- case 1:
- salary = (java.lang.Integer) value$;
- break;
- case 2:
- department = (java.lang.CharSequence) value$;
- break;
- default:
- throw new org.apache.avro.AvroRuntimeException("Bad index");
- }
- }
-
- /**
- * Gets the value of the 'name' field.
- */
- public java.lang.CharSequence getName() {
- return name;
- }
-
- /**
- * Sets the value of the 'name' field.
- *
- * @param value
- * the value to set.
- */
- public void setName(java.lang.CharSequence value) {
- this.name = value;
- }
-
- /**
- * Gets the value of the 'salary' field.
- */
- public java.lang.Integer getSalary() {
- return salary;
- }
-
- /**
- * Sets the value of the 'salary' field.
- *
- * @param value
- * the value to set.
- */
- public void setSalary(java.lang.Integer value) {
- this.salary = value;
- }
-
- /**
- * Gets the value of the 'department' field.
- */
- public java.lang.CharSequence getDepartment() {
- return department;
- }
-
- /**
- * Sets the value of the 'department' field.
- *
- * @param value
- * the value to set.
- */
- public void setDepartment(java.lang.CharSequence value) {
- this.department = value;
- }
-
- /** Creates a new Employee RecordBuilder */
- public static org.apache.crunch.test.Employee.Builder newBuilder() {
- return new org.apache.crunch.test.Employee.Builder();
- }
-
- /** Creates a new Employee RecordBuilder by copying an existing Builder */
- public static org.apache.crunch.test.Employee.Builder newBuilder(org.apache.crunch.test.Employee.Builder other) {
- return new org.apache.crunch.test.Employee.Builder(other);
- }
-
- /**
- * Creates a new Employee RecordBuilder by copying an existing Employee
- * instance
- */
- public static org.apache.crunch.test.Employee.Builder newBuilder(org.apache.crunch.test.Employee other) {
- return new org.apache.crunch.test.Employee.Builder(other);
- }
-
- /**
- * RecordBuilder for Employee instances.
- */
- public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<Employee> implements
- org.apache.avro.data.RecordBuilder<Employee> {
-
- private java.lang.CharSequence name;
- private int salary;
- private java.lang.CharSequence department;
-
- /** Creates a new Builder */
- private Builder() {
- super(org.apache.crunch.test.Employee.SCHEMA$);
- }
-
- /** Creates a Builder by copying an existing Builder */
- private Builder(org.apache.crunch.test.Employee.Builder other) {
- super(other);
- }
-
- /** Creates a Builder by copying an existing Employee instance */
- private Builder(org.apache.crunch.test.Employee other) {
- super(org.apache.crunch.test.Employee.SCHEMA$);
- if (isValidValue(fields()[0], other.name)) {
- this.name = (java.lang.CharSequence) data().deepCopy(fields()[0].schema(), other.name);
- fieldSetFlags()[0] = true;
- }
- if (isValidValue(fields()[1], other.salary)) {
- this.salary = (java.lang.Integer) data().deepCopy(fields()[1].schema(), other.salary);
- fieldSetFlags()[1] = true;
- }
- if (isValidValue(fields()[2], other.department)) {
- this.department = (java.lang.CharSequence) data().deepCopy(fields()[2].schema(), other.department);
- fieldSetFlags()[2] = true;
- }
- }
-
- /** Gets the value of the 'name' field */
- public java.lang.CharSequence getName() {
- return name;
- }
-
- /** Sets the value of the 'name' field */
- public org.apache.crunch.test.Employee.Builder setName(java.lang.CharSequence value) {
- validate(fields()[0], value);
- this.name = value;
- fieldSetFlags()[0] = true;
- return this;
- }
-
- /** Checks whether the 'name' field has been set */
- public boolean hasName() {
- return fieldSetFlags()[0];
- }
-
- /** Clears the value of the 'name' field */
- public org.apache.crunch.test.Employee.Builder clearName() {
- name = null;
- fieldSetFlags()[0] = false;
- return this;
- }
-
- /** Gets the value of the 'salary' field */
- public java.lang.Integer getSalary() {
- return salary;
- }
-
- /** Sets the value of the 'salary' field */
- public org.apache.crunch.test.Employee.Builder setSalary(int value) {
- validate(fields()[1], value);
- this.salary = value;
- fieldSetFlags()[1] = true;
- return this;
- }
-
- /** Checks whether the 'salary' field has been set */
- public boolean hasSalary() {
- return fieldSetFlags()[1];
- }
-
- /** Clears the value of the 'salary' field */
- public org.apache.crunch.test.Employee.Builder clearSalary() {
- fieldSetFlags()[1] = false;
- return this;
- }
-
- /** Gets the value of the 'department' field */
- public java.lang.CharSequence getDepartment() {
- return department;
- }
-
- /** Sets the value of the 'department' field */
- public org.apache.crunch.test.Employee.Builder setDepartment(java.lang.CharSequence value) {
- validate(fields()[2], value);
- this.department = value;
- fieldSetFlags()[2] = true;
- return this;
- }
-
- /** Checks whether the 'department' field has been set */
- public boolean hasDepartment() {
- return fieldSetFlags()[2];
- }
-
- /** Clears the value of the 'department' field */
- public org.apache.crunch.test.Employee.Builder clearDepartment() {
- department = null;
- fieldSetFlags()[2] = false;
- return this;
- }
-
- @Override
- public Employee build() {
- try {
- Employee record = new Employee();
- record.name = fieldSetFlags()[0] ? this.name : (java.lang.CharSequence) defaultValue(fields()[0]);
- record.salary = fieldSetFlags()[1] ? this.salary : (java.lang.Integer) defaultValue(fields()[1]);
- record.department = fieldSetFlags()[2] ? this.department : (java.lang.CharSequence) defaultValue(fields()[2]);
- return record;
- } catch (Exception e) {
- throw new org.apache.avro.AvroRuntimeException(e);
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-crunch/blob/11819871/crunch/src/test/java/org/apache/crunch/test/Person.java
----------------------------------------------------------------------
diff --git a/crunch/src/test/java/org/apache/crunch/test/Person.java b/crunch/src/test/java/org/apache/crunch/test/Person.java
deleted file mode 100644
index fb78ce9..0000000
--- a/crunch/src/test/java/org/apache/crunch/test/Person.java
+++ /dev/null
@@ -1,260 +0,0 @@
-/**
- * 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.crunch.test;
-
-@SuppressWarnings("all")
-public class Person extends org.apache.avro.specific.SpecificRecordBase implements
- org.apache.avro.specific.SpecificRecord {
- public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser()
- .parse("{\"type\":\"record\",\"name\":\"Person\",\"namespace\":\"org.apache.crunch.test\",\"fields\":[{\"name\":\"name\",\"type\":[\"string\",\"null\"]},{\"name\":\"age\",\"type\":\"int\"},{\"name\":\"siblingnames\",\"type\":{\"type\":\"array\",\"items\":\"string\"}}]}");
- @Deprecated
- public java.lang.CharSequence name;
- @Deprecated
- public int age;
- @Deprecated
- public java.util.List<java.lang.CharSequence> siblingnames;
-
- public org.apache.avro.Schema getSchema() {
- return SCHEMA$;
- }
-
- // Used by DatumWriter. Applications should not call.
- public java.lang.Object get(int field$) {
- switch (field$) {
- case 0:
- return name;
- case 1:
- return age;
- case 2:
- return siblingnames;
- default:
- throw new org.apache.avro.AvroRuntimeException("Bad index");
- }
- }
-
- // Used by DatumReader. Applications should not call.
- @SuppressWarnings(value = "unchecked")
- public void put(int field$, java.lang.Object value$) {
- switch (field$) {
- case 0:
- name = (java.lang.CharSequence) value$;
- break;
- case 1:
- age = (java.lang.Integer) value$;
- break;
- case 2:
- siblingnames = (java.util.List<java.lang.CharSequence>) value$;
- break;
- default:
- throw new org.apache.avro.AvroRuntimeException("Bad index");
- }
- }
-
- /**
- * Gets the value of the 'name' field.
- */
- public java.lang.CharSequence getName() {
- return name;
- }
-
- /**
- * Sets the value of the 'name' field.
- *
- * @param value
- * the value to set.
- */
- public void setName(java.lang.CharSequence value) {
- this.name = value;
- }
-
- /**
- * Gets the value of the 'age' field.
- */
- public java.lang.Integer getAge() {
- return age;
- }
-
- /**
- * Sets the value of the 'age' field.
- *
- * @param value
- * the value to set.
- */
- public void setAge(java.lang.Integer value) {
- this.age = value;
- }
-
- /**
- * Gets the value of the 'siblingnames' field.
- */
- public java.util.List<java.lang.CharSequence> getSiblingnames() {
- return siblingnames;
- }
-
- /**
- * Sets the value of the 'siblingnames' field.
- *
- * @param value
- * the value to set.
- */
- public void setSiblingnames(java.util.List<java.lang.CharSequence> value) {
- this.siblingnames = value;
- }
-
- /** Creates a new Person RecordBuilder */
- public static org.apache.crunch.test.Person.Builder newBuilder() {
- return new org.apache.crunch.test.Person.Builder();
- }
-
- /** Creates a new Person RecordBuilder by copying an existing Builder */
- public static org.apache.crunch.test.Person.Builder newBuilder(org.apache.crunch.test.Person.Builder other) {
- return new org.apache.crunch.test.Person.Builder(other);
- }
-
- /** Creates a new Person RecordBuilder by copying an existing Person instance */
- public static org.apache.crunch.test.Person.Builder newBuilder(org.apache.crunch.test.Person other) {
- return new org.apache.crunch.test.Person.Builder(other);
- }
-
- /**
- * RecordBuilder for Person instances.
- */
- public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<Person> implements
- org.apache.avro.data.RecordBuilder<Person> {
-
- private java.lang.CharSequence name;
- private int age;
- private java.util.List<java.lang.CharSequence> siblingnames;
-
- /** Creates a new Builder */
- private Builder() {
- super(org.apache.crunch.test.Person.SCHEMA$);
- }
-
- /** Creates a Builder by copying an existing Builder */
- private Builder(org.apache.crunch.test.Person.Builder other) {
- super(other);
- }
-
- /** Creates a Builder by copying an existing Person instance */
- private Builder(org.apache.crunch.test.Person other) {
- super(org.apache.crunch.test.Person.SCHEMA$);
- if (isValidValue(fields()[0], other.name)) {
- this.name = (java.lang.CharSequence) data().deepCopy(fields()[0].schema(), other.name);
- fieldSetFlags()[0] = true;
- }
- if (isValidValue(fields()[1], other.age)) {
- this.age = (java.lang.Integer) data().deepCopy(fields()[1].schema(), other.age);
- fieldSetFlags()[1] = true;
- }
- if (isValidValue(fields()[2], other.siblingnames)) {
- this.siblingnames = (java.util.List<java.lang.CharSequence>) data().deepCopy(fields()[2].schema(),
- other.siblingnames);
- fieldSetFlags()[2] = true;
- }
- }
-
- /** Gets the value of the 'name' field */
- public java.lang.CharSequence getName() {
- return name;
- }
-
- /** Sets the value of the 'name' field */
- public org.apache.crunch.test.Person.Builder setName(java.lang.CharSequence value) {
- validate(fields()[0], value);
- this.name = value;
- fieldSetFlags()[0] = true;
- return this;
- }
-
- /** Checks whether the 'name' field has been set */
- public boolean hasName() {
- return fieldSetFlags()[0];
- }
-
- /** Clears the value of the 'name' field */
- public org.apache.crunch.test.Person.Builder clearName() {
- name = null;
- fieldSetFlags()[0] = false;
- return this;
- }
-
- /** Gets the value of the 'age' field */
- public java.lang.Integer getAge() {
- return age;
- }
-
- /** Sets the value of the 'age' field */
- public org.apache.crunch.test.Person.Builder setAge(int value) {
- validate(fields()[1], value);
- this.age = value;
- fieldSetFlags()[1] = true;
- return this;
- }
-
- /** Checks whether the 'age' field has been set */
- public boolean hasAge() {
- return fieldSetFlags()[1];
- }
-
- /** Clears the value of the 'age' field */
- public org.apache.crunch.test.Person.Builder clearAge() {
- fieldSetFlags()[1] = false;
- return this;
- }
-
- /** Gets the value of the 'siblingnames' field */
- public java.util.List<java.lang.CharSequence> getSiblingnames() {
- return siblingnames;
- }
-
- /** Sets the value of the 'siblingnames' field */
- public org.apache.crunch.test.Person.Builder setSiblingnames(java.util.List<java.lang.CharSequence> value) {
- validate(fields()[2], value);
- this.siblingnames = value;
- fieldSetFlags()[2] = true;
- return this;
- }
-
- /** Checks whether the 'siblingnames' field has been set */
- public boolean hasSiblingnames() {
- return fieldSetFlags()[2];
- }
-
- /** Clears the value of the 'siblingnames' field */
- public org.apache.crunch.test.Person.Builder clearSiblingnames() {
- siblingnames = null;
- fieldSetFlags()[2] = false;
- return this;
- }
-
- @Override
- public Person build() {
- try {
- Person record = new Person();
- record.name = fieldSetFlags()[0] ? this.name : (java.lang.CharSequence) defaultValue(fields()[0]);
- record.age = fieldSetFlags()[1] ? this.age : (java.lang.Integer) defaultValue(fields()[1]);
- record.siblingnames = fieldSetFlags()[2] ? this.siblingnames
- : (java.util.List<java.lang.CharSequence>) defaultValue(fields()[2]);
- return record;
- } catch (Exception e) {
- throw new org.apache.avro.AvroRuntimeException(e);
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-crunch/blob/11819871/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 5b3f097..e397663 100644
--- a/pom.xml
+++ b/pom.xml
@@ -542,7 +542,7 @@ under the License.
<exclude>.gitignore</exclude>
<exclude>.repository/</exclude>
<exclude>**/resources/*.txt</exclude>
- <exclude>**/resources/*.avro</exclude>
+ <exclude>**/target/generated-test-sources/**</exclude>
<exclude>**/scripts/scrunch</exclude>
</excludes>
</configuration>