gora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lewi...@apache.org
Subject svn commit: r1538057 - in /gora/branches/GORA_94: gora-compiler/src/main/java/org/apache/gora/compiler/ gora-compiler/src/main/velocity/org/apache/gora/compiler/templates/ gora-core/src/examples/avro/ gora-core/src/examples/java/org/apache/gora/example...
Date Fri, 01 Nov 2013 20:46:21 GMT
Author: lewismc
Date: Fri Nov  1 20:46:20 2013
New Revision: 1538057

URL: http://svn.apache.org/r1538057
Log:
GORA-94v9 patch. All tests in gora-core now pass and module stabalized.

Modified:
    gora/branches/GORA_94/gora-compiler/src/main/java/org/apache/gora/compiler/GoraCompiler.java
    gora/branches/GORA_94/gora-compiler/src/main/velocity/org/apache/gora/compiler/templates/record.vm
    gora/branches/GORA_94/gora-core/src/examples/avro/employee.json
    gora/branches/GORA_94/gora-core/src/examples/avro/webpage.json
    gora/branches/GORA_94/gora-core/src/examples/java/org/apache/gora/examples/WebPageDataCreator.java
    gora/branches/GORA_94/gora-core/src/examples/java/org/apache/gora/examples/generated/Employee.java
    gora/branches/GORA_94/gora-core/src/examples/java/org/apache/gora/examples/generated/Metadata.java
    gora/branches/GORA_94/gora-core/src/examples/java/org/apache/gora/examples/generated/WebPage.java
    gora/branches/GORA_94/gora-core/src/main/java/org/apache/gora/mapreduce/GoraMapReduceUtils.java
    gora/branches/GORA_94/gora-core/src/main/java/org/apache/gora/mapreduce/PersistentSerializer.java
    gora/branches/GORA_94/gora-core/src/main/java/org/apache/gora/persistency/impl/PersistentBase.java
    gora/branches/GORA_94/gora-core/src/main/java/org/apache/gora/store/impl/DataStoreBase.java
    gora/branches/GORA_94/gora-core/src/main/java/org/apache/gora/util/ReflectionUtils.java
    gora/branches/GORA_94/gora-core/src/test/java/org/apache/gora/GoraTestDriver.java
    gora/branches/GORA_94/gora-core/src/test/java/org/apache/gora/mapreduce/TestPersistentSerialization.java
    gora/branches/GORA_94/gora-core/src/test/java/org/apache/gora/persistency/impl/TestPersistentBase.java
    gora/branches/GORA_94/gora-core/src/test/java/org/apache/gora/store/DataStoreTestUtil.java
    gora/branches/GORA_94/gora-core/src/test/java/org/apache/gora/store/TestDataStoreFactory.java
    gora/branches/GORA_94/gora-tutorial/src/main/java/org/apache/gora/tutorial/log/generated/Pageview.java

Modified: gora/branches/GORA_94/gora-compiler/src/main/java/org/apache/gora/compiler/GoraCompiler.java
URL: http://svn.apache.org/viewvc/gora/branches/GORA_94/gora-compiler/src/main/java/org/apache/gora/compiler/GoraCompiler.java?rev=1538057&r1=1538056&r2=1538057&view=diff
==============================================================================
--- gora/branches/GORA_94/gora-compiler/src/main/java/org/apache/gora/compiler/GoraCompiler.java
(original)
+++ gora/branches/GORA_94/gora-compiler/src/main/java/org/apache/gora/compiler/GoraCompiler.java
Fri Nov  1 20:46:20 2013
@@ -17,6 +17,7 @@
  */
 package org.apache.gora.compiler;
 
+import java.beans.PersistenceDelegate;
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
@@ -32,6 +33,7 @@ import org.apache.avro.Schema;
 import org.apache.avro.Schema.Field;
 import org.apache.avro.Schema.Type;
 import org.apache.avro.compiler.specific.SpecificCompiler;
+import org.apache.avro.generic.GenericData.StringType;
 import org.codehaus.jackson.JsonNode;
 import org.codehaus.jackson.node.JsonNodeFactory;
 
@@ -66,19 +68,16 @@ public class GoraCompiler extends Specif
 
     }
   }
-  
 
   public static String generateAppropriateImmutabilityModifier(Schema schema){
     switch (schema.getType()) {
-      case STRING:
-        return ".toString()";
       case BYTES:
         return ".asReadOnlyBuffer()";
       default:
         return "";
     }
   }
-	
+
   public static String generateAppropriateWrapperOrValue(Schema schema) {
     switch (schema.getType()) {
       case MAP:
@@ -87,14 +86,57 @@ public class GoraCompiler extends Specif
       case ARRAY:
         return "(value instanceof org.apache.gora.persistency.Dirtyable) ? "
           + "value : new org.apache.gora.persistency.impl.DirtyListWrapper(value)";
-      case STRING:
-        return "value.toString()";
       case BYTES:
         return "deepCopyToReadOnlyBuffer(value)";
       default:
         return "value";
     }
   }
+  
+  public static String generateAppropriateWrapperOrValueForPut(Schema schema) {
+    switch (schema.getType()) {
+      case MAP:
+        return "(value instanceof org.apache.gora.persistency.Dirtyable) ? "
+          + "value : new org.apache.gora.persistency.impl.DirtyMapWrapper((java.util.Map)value)";
+      case ARRAY:
+        return "(value instanceof org.apache.gora.persistency.Dirtyable) ? "
+          + "value : new org.apache.gora.persistency.impl.DirtyListWrapper((java.util.List)value)";
+      default:
+        return "value";
+    }
+  }
+  
+  public static String generateAppropriateWrapper(Schema schema, Field field) {
+    if (field.name() == "__g__dirty") {
+      return "java.nio.ByteBuffer.wrap(new byte["
+        + getNumberOfBytesNeededForDirtyBits(schema) + "])";
+    } else {
+      switch (field.schema().getType()) {
+      case RECORD:
+        return field.schema().getName()+".newBuilder().build()";
+      case MAP:
+        return "new org.apache.gora.persistency.impl.DirtyMapWrapper((java.util.Map)defaultValue(fields()["+field.pos()+"]))";
+      case ARRAY:
+        return "new org.apache.gora.persistency.impl.DirtyListWrapper((java.util.List)defaultValue(fields()["+field.pos()+"]))";
+      default:
+        return "defaultValue(fields()["+field.pos()+"])";
+      }
+    }
+    
+  }
+  
+  public static String generateAppropriateValue(Field field) {
+    switch (field.schema().getType()) {
+      case RECORD:
+        return field.schema().getName()+".newBuilder().build()";
+      case MAP:
+        return "new org.apache.gora.persistency.impl.DirtyMapWrapper(new java.util.HashMap())";
+      case ARRAY:
+        return "new org.apache.gora.persistency.impl.DirtyListWrapper(new java.util.ArrayList())";
+      default:
+        return "this."+field.name();
+    }
+  }
 
   private static int getNumberOfBytesNeededForDirtyBits(Schema originalSchema) {
     return (int) Math.ceil((originalSchema.getFields().size() + 1) * 0.125);

Modified: gora/branches/GORA_94/gora-compiler/src/main/velocity/org/apache/gora/compiler/templates/record.vm
URL: http://svn.apache.org/viewvc/gora/branches/GORA_94/gora-compiler/src/main/velocity/org/apache/gora/compiler/templates/record.vm?rev=1538057&r1=1538056&r2=1538057&view=diff
==============================================================================
--- gora/branches/GORA_94/gora-compiler/src/main/velocity/org/apache/gora/compiler/templates/record.vm
(original)
+++ gora/branches/GORA_94/gora-compiler/src/main/velocity/org/apache/gora/compiler/templates/record.vm
Fri Nov  1 20:46:20 2013
@@ -24,13 +24,6 @@ package $schema.getNamespace();  
 #end
 public class ${this.mangle($schema.getName())}#if ($schema.isError()) extends org.apache.avro.specific.SpecificExceptionBase#else
extends org.apache.gora.persistency.impl.PersistentBase#end implements org.apache.avro.specific.SpecificRecord,
org.apache.gora.persistency.Persistent {
   public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("${this.javaEscape($schema.toString())}");
-  
-  public static final String[] _ALL_FIELDS = {
-#foreach ($field in $schema.getFields())
-  "${this.mangle($field.name(), $schema.isError())}",
-#end		
-  };
-
 #foreach ($field in $schema.getFields())
 #if ($field.doc())
   /** $field.doc() */
@@ -68,13 +61,14 @@ public class ${this.mangle($schema.getNa
     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$) {
+  public void put(int field$, java.lang.Object value) {
     switch (field$) {
 #set ($i = 0)
 #foreach ($field in $schema.getFields())
-    case $i: ${this.mangle($field.name(), $schema.isError())} = (${this.javaType($field.schema())})value$;
break;
+    case $i: ${this.mangle($field.name(), $schema.isError())} = (${this.javaType($field.schema())})(${this.generateAppropriateWrapperOrValueForPut($field.schema())});
break;
 #set ($i = $i + 1)
 #end
     default: throw new org.apache.avro.AvroRuntimeException("Bad index");
@@ -245,7 +239,7 @@ public class ${this.mangle($schema.getNa
       try {
         ${this.mangle($schema.getName())} record = new ${this.mangle($schema.getName())}(#if
($schema.isError())getValue(), getCause()#end);
 #foreach ($field in $schema.getFields())
-        record.${this.mangle($field.name(), $schema.isError())} = fieldSetFlags()[$field.pos()]
? this.${this.mangle($field.name(), $schema.isError())} : (${this.javaType($field.schema())})
defaultValue(fields()[$field.pos()]);
+        record.${this.mangle($field.name(), $schema.isError())} = fieldSetFlags()[$field.pos()]
? this.${this.mangle($field.name(), $schema.isError())} : (${this.javaType($field.schema())})
${this.generateAppropriateWrapper($schema,$field)};
 #end
         return record;
       } catch (Exception e) {

Modified: gora/branches/GORA_94/gora-core/src/examples/avro/employee.json
URL: http://svn.apache.org/viewvc/gora/branches/GORA_94/gora-core/src/examples/avro/employee.json?rev=1538057&r1=1538056&r2=1538057&view=diff
==============================================================================
--- gora/branches/GORA_94/gora-core/src/examples/avro/employee.json (original)
+++ gora/branches/GORA_94/gora-core/src/examples/avro/employee.json Fri Nov  1 20:46:20 2013
@@ -1,30 +1,30 @@
   {
     "type": "record",
-    "name": "Employee",
+    "name": "Employee","default":null,
     "namespace": "org.apache.gora.examples.generated",
     "fields" : [
-      {"name": "name", "type": ["string","null"]},
-      {"name": "dateOfBirth", "type": "long"},
-      {"name": "ssn", "type": "string"},
-      {"name": "salary", "type": "int"},
-      {"name": "boss", "type":["null","Employee","string"]},
-      {"name": "webpage", "type":["null",
+      {"name": "name", "type": ["null","string"],"default":null},
+      {"name": "dateOfBirth", "type": "long","default":0},
+      {"name": "ssn", "type": ["null","string"],"default":null},
+      {"name": "salary", "type": "int","default":0},
+      {"name": "boss", "type":["null","Employee","string"],"default":null},
+      {"name": "webpage","default":null, "type":["null",
         {
       	  "type": "record",
       	  "name": "WebPage",
       	  "namespace": "org.apache.gora.examples.generated",
           "fields" : [
-           {"name": "url", "type": "string"},
-           {"name": "content", "type": ["null","bytes"]},
-           {"name": "parsedContent", "type": {"type":"array", "items": "string"}},
-           {"name": "outlinks", "type": {"type":"map", "values":"string"}},
-           {"name": "metadata", "type": {
+           {"name": "url", "type": ["null","string"], "default":null},
+           {"name": "content", "type": ["null","bytes"],"default":null},
+           {"name": "parsedContent", "type": {"type":"array", "items": "string"},"default":null},
+           {"name": "outlinks", "type": {"type":"map", "values":"string"},"default":null},
+           {"name": "metadata", "default":null, "type": {
             "name": "Metadata",
             "type": "record",
             "namespace": "org.apache.gora.examples.generated",
             "fields": [
-             {"name": "version", "type": "int"},
-             {"name": "data", "type": {"type": "map", "values": "string"}}
+             {"name": "version", "type": "int","default":0},
+             {"name": "data", "type": {"type": "map", "values": "string"},"default":null}
             ]
           }}
           ]

Modified: gora/branches/GORA_94/gora-core/src/examples/avro/webpage.json
URL: http://svn.apache.org/viewvc/gora/branches/GORA_94/gora-core/src/examples/avro/webpage.json?rev=1538057&r1=1538056&r2=1538057&view=diff
==============================================================================
--- gora/branches/GORA_94/gora-core/src/examples/avro/webpage.json (original)
+++ gora/branches/GORA_94/gora-core/src/examples/avro/webpage.json Fri Nov  1 20:46:20 2013
@@ -1,20 +1,20 @@
 {
   "type": "record",
-  "name": "WebPage",
+  "name": "WebPage","default":null,
   "namespace": "org.apache.gora.examples.generated",
   "fields" : [
-    {"name": "url", "type": "string"},
-    {"name": "content", "type": ["null","bytes"]},
-    {"name": "parsedContent", "type": {"type":"array", "items": "string"}},
-    {"name": "outlinks", "type": {"type":"map", "values":"string"}},
-    {"name": "metadata", "type": {
+    {"name": "url", "type": ["null","string"], "default":null},
+    {"name": "content", "type": ["null","bytes"],"default":null},
+    {"name": "parsedContent", "type": {"type":"array", "items": "string"}, "default":null},
+    {"name": "outlinks", "type": {"type":"map", "values":"string"}, "default":null},
+    {"name": "metadata", "default":null, "type": {
       "name": "Metadata",
       "type": "record",
       "namespace": "org.apache.gora.examples.generated",
-      "fields": [
-        {"name": "version", "type": "int"},
-        {"name": "data", "type": {"type": "map", "values": "string"}}
-      ]
+      "fields" : [
+			  {"name":"version","type":"int","default":0},
+			  {"name":"data","type":{"type":"map","values":"string"}, "default":null}
+			]
     }}
   ]
 }

Modified: gora/branches/GORA_94/gora-core/src/examples/java/org/apache/gora/examples/WebPageDataCreator.java
URL: http://svn.apache.org/viewvc/gora/branches/GORA_94/gora-core/src/examples/java/org/apache/gora/examples/WebPageDataCreator.java?rev=1538057&r1=1538056&r2=1538057&view=diff
==============================================================================
--- gora/branches/GORA_94/gora-core/src/examples/java/org/apache/gora/examples/WebPageDataCreator.java
(original)
+++ gora/branches/GORA_94/gora-core/src/examples/java/org/apache/gora/examples/WebPageDataCreator.java
Fri Nov  1 20:46:20 2013
@@ -51,6 +51,7 @@ public class WebPageDataCreator {
     "http://baz.com/1.jsp&q=barbaz&p=foo",
     "http://baz.com/1.jsp&q=foo",
     "http://bazbar.com",
+    //"http://example.com",
   };
   
   public static HashMap<String, Integer> URL_INDEXES = new HashMap<String, Integer>();
@@ -72,6 +73,7 @@ public class WebPageDataCreator {
     "a b b b b b a",
     "a a a",
     "foo bar baz",
+    //"fck fck dck",
   };
   
   public static final int[][] LINKS = {
@@ -115,14 +117,14 @@ public class WebPageDataCreator {
       log.info("creating web page data");
       
       for(int i=0; i<URLS.length; i++) {
-        page = new WebPage();
+        page = WebPage.newBuilder().build();
         page.setUrl(new Utf8(URLS[i]));
         page.setParsedContent(new ArrayList<CharSequence>());
 	    if (CONTENTS[i]!=null){
-		  page.setContent(ByteBuffer.wrap(CONTENTS[i].getBytes()));
-		  for(String token : CONTENTS[i].split(" ")) {
-		    page.getParsedContent().add(new Utf8(token));  
-		  }
+		    page.setContent(ByteBuffer.wrap(CONTENTS[i].getBytes()));
+		    for(String token : CONTENTS[i].split(" ")) {
+		      page.getParsedContent().add(new Utf8(token));  
+		    }
 	    }
         
         page.setOutlinks(new HashMap<CharSequence, CharSequence>());
@@ -130,7 +132,7 @@ public class WebPageDataCreator {
           page.getOutlinks().put(new Utf8(URLS[LINKS[i][j]]), new Utf8(ANCHORS[i][j]));
         }
         
-        Metadata metadata = new Metadata();
+        Metadata metadata = Metadata.newBuilder().build();
         metadata.setVersion(1);
         metadata.setData(new HashMap<CharSequence, CharSequence>());
         metadata.getData().put(new Utf8("metakey"), new Utf8("metavalue"));

Modified: gora/branches/GORA_94/gora-core/src/examples/java/org/apache/gora/examples/generated/Employee.java
URL: http://svn.apache.org/viewvc/gora/branches/GORA_94/gora-core/src/examples/java/org/apache/gora/examples/generated/Employee.java?rev=1538057&r1=1538056&r2=1538057&view=diff
==============================================================================
--- gora/branches/GORA_94/gora-core/src/examples/java/org/apache/gora/examples/generated/Employee.java
(original)
+++ gora/branches/GORA_94/gora-core/src/examples/java/org/apache/gora/examples/generated/Employee.java
Fri Nov  1 20:46:20 2013
@@ -6,18 +6,7 @@
 package org.apache.gora.examples.generated;  
 @SuppressWarnings("all")
 public class Employee extends org.apache.gora.persistency.impl.PersistentBase implements
org.apache.avro.specific.SpecificRecord, org.apache.gora.persistency.Persistent {
-  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"Employee\",\"namespace\":\"org.apache.gora.examples.generated\",\"fields\":[{\"name\":\"__g__dirty\",\"type\":\"bytes\",\"doc\":\"Bytes
used to represent weather or not a field is dirty.\",\"default\":\"AA==\"},{\"name\":\"name\",\"type\":[\"string\",\"null\"]},{\"name\":\"dateOfBirth\",\"type\":\"long\"},{\"name\":\"ssn\",\"type\":\"string\"},{\"name\":\"salary\",\"type\":\"int\"},{\"name\":\"boss\",\"type\":[\"null\",\"Employee\",\"string\"]},{\"name\":\"webpage\",\"type\":[\"null\",{\"type\":\"record\",\"name\":\"WebPage\",\"fields\":[{\"name\":\"__g__dirty\",\"type\":\"bytes\",\"doc\":\"Bytes
used to represent weather or not a field is dirty.\",\"default\":\"AA==\"},{\"name\":\"url\",\"type\":\"string\"},{\"name\":\"content\",\"type\":[\"null\",\"bytes\"]},{\"name\":\"parsedContent\",\"type\":{\"type\":\"array\",\"items\":\"string\"}},{\"name\":\"outl
 inks\",\"type\":{\"type\":\"map\",\"values\":\"string\"}},{\"name\":\"metadata\",\"type\":{\"type\":\"record\",\"name\":\"Metadata\",\"fields\":[{\"name\":\"__g__dirty\",\"type\":\"bytes\",\"doc\":\"Bytes
used to represent weather or not a field is dirty.\",\"default\":\"AA==\"},{\"name\":\"version\",\"type\":\"int\"},{\"name\":\"data\",\"type\":{\"type\":\"map\",\"values\":\"string\"}}]}}]}]}]}");
-  
-  public static final String[] _ALL_FIELDS = {
-  "__g__dirty",
-  "name",
-  "dateOfBirth",
-  "ssn",
-  "salary",
-  "boss",
-  "webpage",
-  };
-
+  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"Employee\",\"namespace\":\"org.apache.gora.examples.generated\",\"fields\":[{\"name\":\"__g__dirty\",\"type\":\"bytes\",\"doc\":\"Bytes
used to represent weather or not a field is dirty.\",\"default\":\"AA==\"},{\"name\":\"name\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"dateOfBirth\",\"type\":\"long\",\"default\":0},{\"name\":\"ssn\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"salary\",\"type\":\"int\",\"default\":0},{\"name\":\"boss\",\"type\":[\"null\",\"Employee\",\"string\"],\"default\":null},{\"name\":\"webpage\",\"type\":[\"null\",{\"type\":\"record\",\"name\":\"WebPage\",\"fields\":[{\"name\":\"__g__dirty\",\"type\":\"bytes\",\"doc\":\"Bytes
used to represent weather or not a field is dirty.\",\"default\":\"AA==\"},{\"name\":\"url\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"content\",\"type\":
 [\"null\",\"bytes\"],\"default\":null},{\"name\":\"parsedContent\",\"type\":{\"type\":\"array\",\"items\":\"string\"},\"default\":null},{\"name\":\"outlinks\",\"type\":{\"type\":\"map\",\"values\":\"string\"},\"default\":null},{\"name\":\"metadata\",\"type\":{\"type\":\"record\",\"name\":\"Metadata\",\"fields\":[{\"name\":\"__g__dirty\",\"type\":\"bytes\",\"doc\":\"Bytes
used to represent weather or not a field is dirty.\",\"default\":\"AA==\"},{\"name\":\"version\",\"type\":\"int\",\"default\":0},{\"name\":\"data\",\"type\":{\"type\":\"map\",\"values\":\"string\"},\"default\":null}]},\"default\":null}]}],\"default\":null}]}");
   /** Bytes used to represent weather or not a field is dirty. */
   private java.nio.ByteBuffer __g__dirty = java.nio.ByteBuffer.wrap(new byte[1]);
   private java.lang.CharSequence name;
@@ -40,17 +29,18 @@ public class Employee extends org.apache
     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$) {
+  public void put(int field$, java.lang.Object value) {
     switch (field$) {
-    case 0: __g__dirty = (java.nio.ByteBuffer)value$; break;
-    case 1: name = (java.lang.CharSequence)value$; break;
-    case 2: dateOfBirth = (java.lang.Long)value$; break;
-    case 3: ssn = (java.lang.CharSequence)value$; break;
-    case 4: salary = (java.lang.Integer)value$; break;
-    case 5: boss = (java.lang.Object)value$; break;
-    case 6: webpage = (org.apache.gora.examples.generated.WebPage)value$; break;
+    case 0: __g__dirty = (java.nio.ByteBuffer)(value); break;
+    case 1: name = (java.lang.CharSequence)(value); break;
+    case 2: dateOfBirth = (java.lang.Long)(value); break;
+    case 3: ssn = (java.lang.CharSequence)(value); break;
+    case 4: salary = (java.lang.Integer)(value); break;
+    case 5: boss = (java.lang.Object)(value); break;
+    case 6: webpage = (org.apache.gora.examples.generated.WebPage)(value); break;
     default: throw new org.apache.avro.AvroRuntimeException("Bad index");
     }
   }
@@ -107,7 +97,7 @@ public class Employee extends org.apache
    * Gets the value of the 'ssn' field.
    */
   public java.lang.CharSequence getSsn() {
-    return ssn.toString();
+    return ssn;
   }
 
   /**
@@ -115,7 +105,7 @@ public class Employee extends org.apache
    * @param value the value to set.
    */
   public void setSsn(java.lang.CharSequence value) {
-    this.ssn = value.toString();
+    this.ssn = value;
     setDirty(3);
   }
   
@@ -446,7 +436,7 @@ public class Employee extends org.apache
     public Employee build() {
       try {
         Employee record = new Employee();
-        record.__g__dirty = fieldSetFlags()[0] ? this.__g__dirty : (java.nio.ByteBuffer)
defaultValue(fields()[0]);
+        record.__g__dirty = fieldSetFlags()[0] ? this.__g__dirty : (java.nio.ByteBuffer)
java.nio.ByteBuffer.wrap(new byte[1]);
         record.name = fieldSetFlags()[1] ? this.name : (java.lang.CharSequence) defaultValue(fields()[1]);
         record.dateOfBirth = fieldSetFlags()[2] ? this.dateOfBirth : (java.lang.Long) defaultValue(fields()[2]);
         record.ssn = fieldSetFlags()[3] ? this.ssn : (java.lang.CharSequence) defaultValue(fields()[3]);

Modified: gora/branches/GORA_94/gora-core/src/examples/java/org/apache/gora/examples/generated/Metadata.java
URL: http://svn.apache.org/viewvc/gora/branches/GORA_94/gora-core/src/examples/java/org/apache/gora/examples/generated/Metadata.java?rev=1538057&r1=1538056&r2=1538057&view=diff
==============================================================================
--- gora/branches/GORA_94/gora-core/src/examples/java/org/apache/gora/examples/generated/Metadata.java
(original)
+++ gora/branches/GORA_94/gora-core/src/examples/java/org/apache/gora/examples/generated/Metadata.java
Fri Nov  1 20:46:20 2013
@@ -6,7 +6,14 @@
 package org.apache.gora.examples.generated;  
 @SuppressWarnings("all")
 public class Metadata extends org.apache.gora.persistency.impl.PersistentBase implements
org.apache.avro.specific.SpecificRecord, org.apache.gora.persistency.Persistent {
-  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"Metadata\",\"namespace\":\"org.apache.gora.examples.generated\",\"fields\":[{\"name\":\"__g__dirty\",\"type\":\"bytes\",\"doc\":\"Bytes
used to represent weather or not a field is dirty.\",\"default\":\"AA==\"},{\"name\":\"version\",\"type\":\"int\"},{\"name\":\"data\",\"type\":{\"type\":\"map\",\"values\":\"string\"}}]}");
+  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"Metadata\",\"namespace\":\"org.apache.gora.examples.generated\",\"fields\":[{\"name\":\"__g__dirty\",\"type\":\"bytes\",\"doc\":\"Bytes
used to represent weather or not a field is dirty.\",\"default\":\"AA==\"},{\"name\":\"version\",\"type\":\"int\",\"default\":0},{\"name\":\"data\",\"type\":{\"type\":\"map\",\"values\":\"string\"},\"default\":null}]}");
+  
+  public static final String[] _ALL_FIELDS = {
+  "__g__dirty",
+  "version",
+  "data",
+  };
+
   /** Bytes used to represent weather or not a field is dirty. */
   private java.nio.ByteBuffer __g__dirty = java.nio.ByteBuffer.wrap(new byte[1]);
   private int version;

Modified: gora/branches/GORA_94/gora-core/src/examples/java/org/apache/gora/examples/generated/WebPage.java
URL: http://svn.apache.org/viewvc/gora/branches/GORA_94/gora-core/src/examples/java/org/apache/gora/examples/generated/WebPage.java?rev=1538057&r1=1538056&r2=1538057&view=diff
==============================================================================
--- gora/branches/GORA_94/gora-core/src/examples/java/org/apache/gora/examples/generated/WebPage.java
(original)
+++ gora/branches/GORA_94/gora-core/src/examples/java/org/apache/gora/examples/generated/WebPage.java
Fri Nov  1 20:46:20 2013
@@ -6,7 +6,17 @@
 package org.apache.gora.examples.generated;  
 @SuppressWarnings("all")
 public class WebPage extends org.apache.gora.persistency.impl.PersistentBase implements org.apache.avro.specific.SpecificRecord,
org.apache.gora.persistency.Persistent {
-  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"WebPage\",\"namespace\":\"org.apache.gora.examples.generated\",\"fields\":[{\"name\":\"__g__dirty\",\"type\":\"bytes\",\"doc\":\"Bytes
used to represent weather or not a field is dirty.\",\"default\":\"AA==\"},{\"name\":\"url\",\"type\":\"string\"},{\"name\":\"content\",\"type\":[\"null\",\"bytes\"]},{\"name\":\"parsedContent\",\"type\":{\"type\":\"array\",\"items\":\"string\"}},{\"name\":\"outlinks\",\"type\":{\"type\":\"map\",\"values\":\"string\"}},{\"name\":\"metadata\",\"type\":{\"type\":\"record\",\"name\":\"Metadata\",\"fields\":[{\"name\":\"__g__dirty\",\"type\":\"bytes\",\"doc\":\"Bytes
used to represent weather or not a field is dirty.\",\"default\":\"AA==\"},{\"name\":\"version\",\"type\":\"int\"},{\"name\":\"data\",\"type\":{\"type\":\"map\",\"values\":\"string\"}}]}}]}");
+  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"WebPage\",\"namespace\":\"org.apache.gora.examples.generated\",\"fields\":[{\"name\":\"__g__dirty\",\"type\":\"bytes\",\"doc\":\"Bytes
used to represent weather or not a field is dirty.\",\"default\":\"AA==\"},{\"name\":\"url\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"content\",\"type\":[\"null\",\"bytes\"],\"default\":null},{\"name\":\"parsedContent\",\"type\":{\"type\":\"array\",\"items\":\"string\"},\"default\":null},{\"name\":\"outlinks\",\"type\":{\"type\":\"map\",\"values\":\"string\"},\"default\":null},{\"name\":\"metadata\",\"type\":{\"type\":\"record\",\"name\":\"Metadata\",\"fields\":[{\"name\":\"__g__dirty\",\"type\":\"bytes\",\"doc\":\"Bytes
used to represent weather or not a field is dirty.\",\"default\":\"AA==\"},{\"name\":\"version\",\"type\":\"int\",\"default\":0},{\"name\":\"data\",\"type\":{\"type\":\"map\",\"values\"
 :\"string\"},\"default\":null}]},\"default\":null}]}");
+  
+  public static final String[] _ALL_FIELDS = {
+  "__g__dirty",
+  "url",
+  "content",
+  "parsedContent",
+  "outlinks",
+  "metadata",
+  };
+
   /** Bytes used to represent weather or not a field is dirty. */
   private java.nio.ByteBuffer __g__dirty = java.nio.ByteBuffer.wrap(new byte[1]);
   private java.lang.CharSequence url;

Modified: gora/branches/GORA_94/gora-core/src/main/java/org/apache/gora/mapreduce/GoraMapReduceUtils.java
URL: http://svn.apache.org/viewvc/gora/branches/GORA_94/gora-core/src/main/java/org/apache/gora/mapreduce/GoraMapReduceUtils.java?rev=1538057&r1=1538056&r2=1538057&view=diff
==============================================================================
--- gora/branches/GORA_94/gora-core/src/main/java/org/apache/gora/mapreduce/GoraMapReduceUtils.java
(original)
+++ gora/branches/GORA_94/gora-core/src/main/java/org/apache/gora/mapreduce/GoraMapReduceUtils.java
Fri Nov  1 20:46:20 2013
@@ -44,6 +44,14 @@ public class GoraMapReduceUtils {
     }
   }
   
+  /**
+   * Add our own serializer (obtained via the {@link PersistentSerialization} 
+   * wrapper) to any other <code>io.serializations</code> which may be specified

+   * within existing Hadoop configuration.
+   * 
+   * @param conf the Hadoop configuration object
+   * @param reuseObjects boolean parameter to reuse objects
+   */
   public static void setIOSerializations(Configuration conf, boolean reuseObjects) {
     String serializationClass =
       PersistentSerialization.class.getCanonicalName();

Modified: gora/branches/GORA_94/gora-core/src/main/java/org/apache/gora/mapreduce/PersistentSerializer.java
URL: http://svn.apache.org/viewvc/gora/branches/GORA_94/gora-core/src/main/java/org/apache/gora/mapreduce/PersistentSerializer.java?rev=1538057&r1=1538056&r2=1538057&view=diff
==============================================================================
--- gora/branches/GORA_94/gora-core/src/main/java/org/apache/gora/mapreduce/PersistentSerializer.java
(original)
+++ gora/branches/GORA_94/gora-core/src/main/java/org/apache/gora/mapreduce/PersistentSerializer.java
Fri Nov  1 20:46:20 2013
@@ -27,7 +27,7 @@ import org.apache.gora.persistency.Persi
 import org.apache.hadoop.io.serializer.Serializer;
 
 /**
- * Hadoop serializer using {@link PersistentDatumWriter}
+ * Hadoop serializer using Avro's {@link SpecificDatumWriter}
  * with {@link BinaryEncoder}.
  */
 public class PersistentSerializer implements Serializer<Persistent> {
@@ -44,11 +44,19 @@ public class PersistentSerializer implem
     encoder.flush();
   }
 
+  /**
+   * Open a connection for the {@link OutputStream}; should be
+   * called before serialization occurs. N.B. the {@link PersistentSerializer#close()}
+   * should be called 'finally' after serialization is complete.
+   */
   @Override
   public void open(OutputStream out) throws IOException {
     encoder = EncoderFactory.get().directBinaryEncoder(out, null);
   }
 
+  /**
+   * Do the serialization of the {@link Persistent} object
+   */
   @Override
   public void serialize(Persistent persistent) throws IOException {
     datumWriter.setSchema(persistent.getSchema());

Modified: gora/branches/GORA_94/gora-core/src/main/java/org/apache/gora/persistency/impl/PersistentBase.java
URL: http://svn.apache.org/viewvc/gora/branches/GORA_94/gora-core/src/main/java/org/apache/gora/persistency/impl/PersistentBase.java?rev=1538057&r1=1538056&r2=1538057&view=diff
==============================================================================
--- gora/branches/GORA_94/gora-core/src/main/java/org/apache/gora/persistency/impl/PersistentBase.java
(original)
+++ gora/branches/GORA_94/gora-core/src/main/java/org/apache/gora/persistency/impl/PersistentBase.java
Fri Nov  1 20:46:20 2013
@@ -28,7 +28,7 @@ import org.apache.gora.persistency.Dirty
 import org.apache.gora.persistency.Persistent;
 
 /**
- * Base classs implementing common functionality for Persistent
+ * Base class implementing common functionality for Persistent
  * classes.
  */
 public abstract class PersistentBase extends SpecificRecordBase implements Persistent  {
@@ -113,9 +113,10 @@ public abstract class PersistentBase ext
     case RECORD:
     case MAP:
     case ARRAY:
-      return ((Dirtyable) get(field.pos())).isDirty();
-    case UNION:
       Object value = get(field.pos());
+      return value==null ? false : ((Dirtyable) value).isDirty();
+    case UNION:
+      value = get(field.pos());
       if (value instanceof Dirtyable) {
         return ((Dirtyable) value).isDirty();
       }

Modified: gora/branches/GORA_94/gora-core/src/main/java/org/apache/gora/store/impl/DataStoreBase.java
URL: http://svn.apache.org/viewvc/gora/branches/GORA_94/gora-core/src/main/java/org/apache/gora/store/impl/DataStoreBase.java?rev=1538057&r1=1538056&r2=1538057&view=diff
==============================================================================
--- gora/branches/GORA_94/gora-core/src/main/java/org/apache/gora/store/impl/DataStoreBase.java
(original)
+++ gora/branches/GORA_94/gora-core/src/main/java/org/apache/gora/store/impl/DataStoreBase.java
Fri Nov  1 20:46:20 2013
@@ -22,6 +22,7 @@ import java.io.Closeable;
 import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
@@ -33,6 +34,7 @@ import org.apache.avro.specific.Specific
 import org.apache.commons.lang.builder.EqualsBuilder;
 import org.apache.gora.avro.store.AvroStore;
 import org.apache.gora.persistency.BeanFactory;
+import org.apache.gora.persistency.Persistent;
 import org.apache.gora.persistency.impl.BeanFactoryImpl;
 import org.apache.gora.persistency.impl.PersistentBase;
 import org.apache.gora.store.DataStore;
@@ -165,11 +167,25 @@ public abstract class DataStoreBase<K, T
     if(fields != null) {
       return fields;
     }
+    return getFields();
+  }
+  
+  protected String[] getFields() {
     List<Field> schemaFields = beanFactory.getCachedPersistent().getSchema().getFields();
+    
+    List<Field> list = new ArrayList<Field>();
+    for (Field field : schemaFields) {
+      if (!Persistent.DIRTY_BYTES_FIELD_NAME.equalsIgnoreCase(field.name())) {
+        list.add(field);
+      }
+    }
+    schemaFields = list;
+    
     String[] fieldNames = new String[schemaFields.size()];
     for(int i = 0; i<fieldNames.length; i++ ){
       fieldNames[i] = schemaFields.get(i).name();
     }
+    
     return fieldNames;
   }
 

Modified: gora/branches/GORA_94/gora-core/src/main/java/org/apache/gora/util/ReflectionUtils.java
URL: http://svn.apache.org/viewvc/gora/branches/GORA_94/gora-core/src/main/java/org/apache/gora/util/ReflectionUtils.java?rev=1538057&r1=1538056&r2=1538057&view=diff
==============================================================================
--- gora/branches/GORA_94/gora-core/src/main/java/org/apache/gora/util/ReflectionUtils.java
(original)
+++ gora/branches/GORA_94/gora-core/src/main/java/org/apache/gora/util/ReflectionUtils.java
Fri Nov  1 20:46:20 2013
@@ -20,6 +20,10 @@ package org.apache.gora.util;
 
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import org.apache.avro.specific.SpecificRecordBuilderBase;
+import org.apache.gora.persistency.Persistent;
 
 /**
  * Utility methods related to reflection
@@ -100,4 +104,10 @@ public class ReflectionUtils {
     
     return clazz.getField(fieldName).get(null);
   }
+  
+  public static <T extends Persistent> SpecificRecordBuilderBase<T> classBuilder(Class<T>
clazz) throws SecurityException
+    , NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException
{
+    return (SpecificRecordBuilderBase<T>) clazz.getMethod("newBuilder").invoke(null);
+  }
+  
 }

Modified: gora/branches/GORA_94/gora-core/src/test/java/org/apache/gora/GoraTestDriver.java
URL: http://svn.apache.org/viewvc/gora/branches/GORA_94/gora-core/src/test/java/org/apache/gora/GoraTestDriver.java?rev=1538057&r1=1538056&r2=1538057&view=diff
==============================================================================
--- gora/branches/GORA_94/gora-core/src/test/java/org/apache/gora/GoraTestDriver.java (original)
+++ gora/branches/GORA_94/gora-core/src/test/java/org/apache/gora/GoraTestDriver.java Fri
Nov  1 20:46:20 2013
@@ -18,7 +18,6 @@
 
 package org.apache.gora;
 
-import java.io.IOException;
 import java.util.HashSet;
 import java.util.Properties;
 
@@ -112,4 +111,8 @@ public class GoraTestDriver {
   public Class<?> getDataStoreClass() {
     return dataStoreClass;
   }
+  
+  public Configuration getConfiguration() {
+    return this.conf;
+  }
 }

Modified: gora/branches/GORA_94/gora-core/src/test/java/org/apache/gora/mapreduce/TestPersistentSerialization.java
URL: http://svn.apache.org/viewvc/gora/branches/GORA_94/gora-core/src/test/java/org/apache/gora/mapreduce/TestPersistentSerialization.java?rev=1538057&r1=1538056&r2=1538057&view=diff
==============================================================================
--- gora/branches/GORA_94/gora-core/src/test/java/org/apache/gora/mapreduce/TestPersistentSerialization.java
(original)
+++ gora/branches/GORA_94/gora-core/src/test/java/org/apache/gora/mapreduce/TestPersistentSerialization.java
Fri Nov  1 20:46:20 2013
@@ -67,7 +67,7 @@ public class TestPersistentSerialization
    */
   @Test
   public void testSerdeEmployeeOneField() throws Exception {
-    Employee employee = new Employee();
+    Employee employee = Employee.newBuilder().build();
     employee.setSsn(new Utf8("11111"));
 
     TestIOUtils.testSerializeDeserialize(employee);
@@ -81,7 +81,7 @@ public class TestPersistentSerialization
    */
   @Test
   public void testSerdeEmployeeTwoFields() throws Exception {
-    Employee employee = new Employee();
+    Employee employee = Employee.newBuilder().build();
     employee.setSsn(new Utf8("11111"));
     employee.setSalary(100);
 
@@ -126,9 +126,9 @@ public class TestPersistentSerialization
    */
   @Test
   public void testSerdeMultipleWebPages() throws Exception {
-    WebPage page1 = new WebPage();
-    WebPage page2 = new WebPage();
-    WebPage page3 = new WebPage();
+    WebPage page1 = WebPage.newBuilder().build();
+    WebPage page2 = WebPage.newBuilder().build();
+    WebPage page3 = WebPage.newBuilder().build();
 
     page1.setUrl(new Utf8("foo"));
     page2.setUrl(new Utf8("baz"));

Modified: gora/branches/GORA_94/gora-core/src/test/java/org/apache/gora/persistency/impl/TestPersistentBase.java
URL: http://svn.apache.org/viewvc/gora/branches/GORA_94/gora-core/src/test/java/org/apache/gora/persistency/impl/TestPersistentBase.java?rev=1538057&r1=1538056&r2=1538057&view=diff
==============================================================================
--- gora/branches/GORA_94/gora-core/src/test/java/org/apache/gora/persistency/impl/TestPersistentBase.java
(original)
+++ gora/branches/GORA_94/gora-core/src/test/java/org/apache/gora/persistency/impl/TestPersistentBase.java
Fri Nov  1 20:46:20 2013
@@ -48,7 +48,7 @@ public class TestPersistentBase {
    */
   @Test
   public void testGetFields() {
-    WebPage page = new WebPage();
+    WebPage page = WebPage.newBuilder().build();
     List<Field> fields = page.getSchema().getFields();
     assertEquals(WebPage.SCHEMA$.getFields(), fields);
   }
@@ -59,7 +59,7 @@ public class TestPersistentBase {
    */
   @Test
   public void testGetField() {
-    WebPage page = new WebPage();
+    WebPage page = WebPage.newBuilder().build();
     for(int i=0; i<WebPage.SCHEMA$.getFields().toArray().length; i++) {
       Field field = page.getSchema().getFields().get(i);
       assertEquals(WebPage.SCHEMA$.getFields().get(i), field);
@@ -72,7 +72,7 @@ public class TestPersistentBase {
    */
   @Test
   public void testGetFieldIndex() {
-    WebPage page = new WebPage();
+    WebPage page = WebPage.newBuilder().build();
     for(int i=0; i<WebPage.SCHEMA$.getFields().toArray().length; i++) {
       int index = page.getSchema().getFields().get(i).pos();
       assertEquals(i, index);
@@ -86,13 +86,13 @@ public class TestPersistentBase {
    */
   @Test
   public void testFieldsWithTwoClasses() {
-    WebPage page = new WebPage();
+    WebPage page = WebPage.newBuilder().build();
     for(int i=0; i<WebPage.SCHEMA$.getFields().toArray().length; i++) {
       int index = page.getSchema().getFields().get(i).pos();
       assertEquals(i, index);
     }
-    Employee employee = new Employee();
-    for(int i=0; i<Employee._ALL_FIELDS.length; i++) {
+    Employee employee = Employee.newBuilder().build();
+    for(int i=0; i<Employee.SCHEMA$.getFields().toArray().length; i++) {
       int index = employee.getSchema().getFields().get(i).pos();
       assertEquals(i, index);
     }
@@ -112,7 +112,7 @@ public class TestPersistentBase {
   public void testClear() {
     
     //test clear all fields
-    WebPage page = new WebPage();
+    WebPage page = WebPage.newBuilder().build();
    
     page.setUrl(new Utf8("http://foo.com"));
     page.setParsedContent(new ArrayList<CharSequence>());
@@ -137,7 +137,7 @@ public class TestPersistentBase {
     page.setContent(ByteBuffer.wrap("foo baz bar barbaz".getBytes()));
     
     //test clear new object
-    page = new WebPage();
+    page = WebPage.newBuilder().build();
     page.clear();
   }
   

Modified: gora/branches/GORA_94/gora-core/src/test/java/org/apache/gora/store/DataStoreTestUtil.java
URL: http://svn.apache.org/viewvc/gora/branches/GORA_94/gora-core/src/test/java/org/apache/gora/store/DataStoreTestUtil.java?rev=1538057&r1=1538056&r2=1538057&view=diff
==============================================================================
--- gora/branches/GORA_94/gora-core/src/test/java/org/apache/gora/store/DataStoreTestUtil.java
(original)
+++ gora/branches/GORA_94/gora-core/src/test/java/org/apache/gora/store/DataStoreTestUtil.java
Fri Nov  1 20:46:20 2013
@@ -42,6 +42,7 @@ import static org.junit.Assert.assertFal
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.assertNull;
 
+import org.apache.avro.Schema.Field;
 import org.apache.avro.util.Utf8;
 import org.apache.gora.examples.WebPageDataCreator;
 import org.apache.gora.examples.generated.Employee;
@@ -169,12 +170,12 @@ public class DataStoreTestUtil {
 
     Employee employee = DataStoreTestUtil.createEmployee(dataStore);
     Employee boss = DataStoreTestUtil.createBoss(dataStore);
-    employee.setBoss(boss) ;
+    employee.setBoss(boss);
     
     String ssn = employee.getSsn().toString();
     dataStore.put(ssn, employee);
     dataStore.flush();
-    Employee after = dataStore.get(ssn, Employee._ALL_FIELDS);
+    Employee after = dataStore.get(ssn, getFields(Employee.SCHEMA$.getFields()));
     assertEquals(employee, after);
     assertEquals(boss, after.getBoss()) ;
   }
@@ -192,7 +193,7 @@ public class DataStoreTestUtil {
       String ssn = employee.getSsn().toString();
       dataStore.put(ssn, employee);
       dataStore.flush();
-      Employee after = dataStore.get(ssn, Employee._ALL_FIELDS);
+      Employee after = dataStore.get(ssn, getFields(Employee.SCHEMA$.getFields()));
       assertEquals(employee, after);
       assertEquals(boss, after.getBoss()) ;
       assertEquals(uberBoss, ((Employee)after.getBoss()).getBoss()) ;
@@ -214,7 +215,7 @@ public class DataStoreTestUtil {
    
     dataStore.put(ssn, employee);
     dataStore.flush();
-    Employee after = dataStore.get(ssn, Employee._ALL_FIELDS);
+    Employee after = dataStore.get(ssn, getFields(Employee.SCHEMA$.getFields()));
     assertEquals(employee, after);
     assertEquals(webpage, after.getWebpage()) ;
   }
@@ -228,7 +229,7 @@ public class DataStoreTestUtil {
     String ssn = employee.getSsn().toString();
     dataStore.put(ssn, employee);
     dataStore.flush();
-    Employee after = dataStore.get(ssn, Employee._ALL_FIELDS);
+    Employee after = dataStore.get(ssn, getFields(Employee.SCHEMA$.getFields()));
     assertEquals(employee, after);
     assertEquals("Real boss", ((Utf8)after.getBoss()).toString()) ;
   }
@@ -251,7 +252,7 @@ public class DataStoreTestUtil {
       if(subset.isEmpty())
         continue;
       Employee after = dataStore.get(ssn, subset.toArray(new String[subset.size()]));
-      Employee expected = new Employee();
+      Employee expected = Employee.newBuilder().build();
       for(String field:subset) {
         int index = expected.getSchema().getField(field).pos();
         expected.put(index, employee.get(index));
@@ -469,7 +470,7 @@ public class DataStoreTestUtil {
   }
 
   public static void testGetWebPage(DataStore<String, WebPage> store) throws IOException,
Exception {
-    testGetWebPage(store, WebPage.SCHEMA$.getFields().toArray(new String[0]));
+    testGetWebPage(store, getFields(WebPage.SCHEMA$.getFields()));
   }
 
   public static void testGetWebPageDefaultFields(DataStore<String, WebPage> store)
@@ -496,7 +497,7 @@ public class DataStoreTestUtil {
 
   public static void testQueryWebPageSingleKey(DataStore<String, WebPage> store)
   throws IOException, Exception {
-    testQueryWebPageSingleKey(store, WebPage.SCHEMA$.getFields().toArray(new String[0]));
+    testQueryWebPageSingleKey(store, getFields(WebPage.SCHEMA$.getFields()));
   }
 
   public static void testQueryWebPageSingleKeyDefaultFields(
@@ -822,7 +823,7 @@ public class DataStoreTestUtil {
 
     store.createSchema();
     WebPage page = store.newPersistent();
-    Metadata metadata = new Metadata();
+    Metadata metadata = Metadata.newBuilder().build();
     metadata.setVersion(1);
     metadata.getData().put(new Utf8("foo"), new Utf8("baz"));
 
@@ -894,5 +895,23 @@ public class DataStoreTestUtil {
     }
     return bytes;
   }
+  
+  public static String[] getFields(List<Field> schemaFields) {
+    
+    List<Field> list = new ArrayList<Field>();
+    for (Field field : schemaFields) {
+      if (!Persistent.DIRTY_BYTES_FIELD_NAME.equalsIgnoreCase(field.name())) {
+        list.add(field);
+      }
+    }
+    schemaFields = list;
+    
+    String[] fieldNames = new String[schemaFields.size()];
+    for(int i = 0; i<fieldNames.length; i++ ){
+      fieldNames[i] = schemaFields.get(i).name();
+    }
+    
+    return fieldNames;
+  }
 
 }

Modified: gora/branches/GORA_94/gora-core/src/test/java/org/apache/gora/store/TestDataStoreFactory.java
URL: http://svn.apache.org/viewvc/gora/branches/GORA_94/gora-core/src/test/java/org/apache/gora/store/TestDataStoreFactory.java?rev=1538057&r1=1538056&r2=1538057&view=diff
==============================================================================
--- gora/branches/GORA_94/gora-core/src/test/java/org/apache/gora/store/TestDataStoreFactory.java
(original)
+++ gora/branches/GORA_94/gora-core/src/test/java/org/apache/gora/store/TestDataStoreFactory.java
Fri Nov  1 20:46:20 2013
@@ -20,9 +20,9 @@ package org.apache.gora.store;
 
 import java.util.Properties;
 
-import static junit.framework.Assert.assertNotNull;
-import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertNotSame;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotSame;
 
 import org.apache.gora.avro.store.DataFileAvroStore;
 import org.apache.gora.mock.persistency.MockPersistent;

Modified: gora/branches/GORA_94/gora-tutorial/src/main/java/org/apache/gora/tutorial/log/generated/Pageview.java
URL: http://svn.apache.org/viewvc/gora/branches/GORA_94/gora-tutorial/src/main/java/org/apache/gora/tutorial/log/generated/Pageview.java?rev=1538057&r1=1538056&r2=1538057&view=diff
==============================================================================
--- gora/branches/GORA_94/gora-tutorial/src/main/java/org/apache/gora/tutorial/log/generated/Pageview.java
(original)
+++ gora/branches/GORA_94/gora-tutorial/src/main/java/org/apache/gora/tutorial/log/generated/Pageview.java
Fri Nov  1 20:46:20 2013
@@ -6,8 +6,21 @@
 package org.apache.gora.tutorial.log.generated;  
 @SuppressWarnings("all")
 public class Pageview extends org.apache.gora.persistency.impl.PersistentBase implements
org.apache.avro.specific.SpecificRecord, org.apache.gora.persistency.Persistent {
-  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"Pageview\",\"namespace\":\"org.apache.gora.tutorial.log.generated\",\"fields\":[{\"name\":\"__g__dirty\",\"type\":\"bytes\",\"doc\":\"Bytes
used to represent weather or not a field is dirty.\",\"default\":\"AAA=\"},{\"name\":\"url\",\"type\":\"string\"},{\"name\":\"timestamp\",\"type\":\"long\"},{\"name\":\"ip\",\"type\":\"string\"},{\"name\":\"httpMethod\",\"type\":\"string\"},{\"name\":\"httpStatusCode\",\"type\":\"int\"},{\"name\":\"responseSize\",\"type\":\"int\"},{\"name\":\"referrer\",\"type\":\"string\"},{\"name\":\"userAgent\",\"type\":\"string\"}]}");
-  /** Bytes used to represent weather or not a field is dirty. */
+  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"Pageview\",\"namespace\":\"org.apache.gora.tutorial.log.generated\",\"fields\":[{\"name\":\"__g__dirty\",\"type\":\"bytes\",\"doc\":\"Bytes
used to represent weather or not a field is dirty\",\"default\":\"AAA=\"},{\"name\":\"url\",\"type\":\"string\"},{\"name\":\"timestamp\",\"type\":\"long\"},{\"name\":\"ip\",\"type\":\"string\"},{\"name\":\"httpMethod\",\"type\":\"string\"},{\"name\":\"httpStatusCode\",\"type\":\"int\"},{\"name\":\"responseSize\",\"type\":\"int\"},{\"name\":\"referrer\",\"type\":\"string\"},{\"name\":\"userAgent\",\"type\":\"string\"}]}");
+  
+  public static final String[] _ALL_FIELDS = {
+  "__g__dirty",
+  "url",
+  "timestamp",
+  "ip",
+  "httpMethod",
+  "httpStatusCode",
+  "responseSize",
+  "referrer",
+  "userAgent",
+  };
+
+  /** Bytes used to represent weather or not a field is dirty */
   private java.nio.ByteBuffer __g__dirty = java.nio.ByteBuffer.wrap(new byte[2]);
   private java.lang.CharSequence url;
   private long timestamp;



Mime
View raw message