You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by mm...@apache.org on 2018/09/27 18:24:40 UTC

[geode-native] branch GEODE-5768 created (now fe295b0)

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

mmartell pushed a change to branch GEODE-5768
in repository https://gitbox.apache.org/repos/asf/geode-native.git.


      at fe295b0  GEODE-5768: Refactored CqListners to override OnEvent method for specific type - added JMX port info to start/stop server scripting

This branch includes the following new commits:

     new fe295b0  GEODE-5768: Refactored CqListners to override OnEvent method for specific type - added JMX port info to start/stop server scripting

The 1 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.



[geode-native] 01/01: GEODE-5768: Refactored CqListners to override OnEvent method for specific type - added JMX port info to start/stop server scripting

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

mmartell pushed a commit to branch GEODE-5768
in repository https://gitbox.apache.org/repos/asf/geode-native.git

commit fe295b0ad1cbac810b2b8bcaecc4daf2d8d91ec0
Author: Ivan Godwin <ig...@pivotal.io>
AuthorDate: Thu Sep 27 11:15:48 2018 -0700

    GEODE-5768: Refactored CqListners to override OnEvent method for specific type
    - added JMX port info to start/stop server scripting
---
 clicache/integration-test2/CMakeLists.txt     |   4 +-
 clicache/integration-test2/CqOperationTest.cs | 182 ++++++++++++++++----
 clicache/integration-test2/GeodeServer.cs     |  27 +--
 clicache/integration-test2/Position.cs        | 239 ++++++++++++++++++++++++++
 clicache/integration-test2/server.xml         |  26 +++
 tests/javaobject/Position.java                |  20 +--
 6 files changed, 438 insertions(+), 60 deletions(-)

diff --git a/clicache/integration-test2/CMakeLists.txt b/clicache/integration-test2/CMakeLists.txt
index 745a1da..0bbdcc7 100644
--- a/clicache/integration-test2/CMakeLists.txt
+++ b/clicache/integration-test2/CMakeLists.txt
@@ -36,7 +36,9 @@ add_library( ${PROJECT_NAME} SHARED
     CqOperationTest.cs
     RegionTest.cs
     RegionSSLTest.cs
+    Position.cs
     cache.xml
+    server.xml
     geode.properties
     xunit.runner.json
     packages.config
@@ -47,7 +49,7 @@ add_library( ${PROJECT_NAME} SHARED
     ServerSslKeys/server_truststore.jks
 )
 
-set_source_files_properties(cache.xml xunit.runner.json geode.properties ClientSslKeys/client_keystore.password.pem ClientSslKeys/client_truststore.pem ServerSslKeys/server_keystore.jks ServerSslKeys/server_truststore.jks PROPERTIES
+set_source_files_properties(cache.xml server.xml xunit.runner.json geode.properties ClientSslKeys/client_keystore.password.pem ClientSslKeys/client_truststore.pem ServerSslKeys/server_keystore.jks ServerSslKeys/server_truststore.jks PROPERTIES
   VS_COPY_TO_OUT_DIR Always
   VS_TOOL_OVERRIDE "None"
 )
diff --git a/clicache/integration-test2/CqOperationTest.cs b/clicache/integration-test2/CqOperationTest.cs
index ad6bfa9..8d0e147 100644
--- a/clicache/integration-test2/CqOperationTest.cs
+++ b/clicache/integration-test2/CqOperationTest.cs
@@ -64,7 +64,7 @@ namespace Apache.Geode.Client.IntegrationTests
         }
     }
 
-    public class MyCqListener<TKey, TResult> : ICqListener<TKey, TResult>
+    public class CqListener<TKey, TResult> : ICqListener<TKey, TResult>
     {
         public AutoResetEvent RegionClearEvent { get; private set; }
         public AutoResetEvent CreatedEvent { get; private set; }
@@ -72,9 +72,9 @@ namespace Apache.Geode.Client.IntegrationTests
         public AutoResetEvent DestroyedNonNullEvent { get; private set; }
         public AutoResetEvent DestroyedNullEvent { get; private set; }
         public AutoResetEvent InvalidatedEvent { get; private set; }
-        public bool ReceivedUnknownEventType { get; private set; }
+        public bool ReceivedUnknownEventType { get; internal set; }
 
-        public MyCqListener()
+        public CqListener()
         {
             CreatedEvent = new AutoResetEvent(false);
             UpdatedEvent = new AutoResetEvent(false);
@@ -87,8 +87,25 @@ namespace Apache.Geode.Client.IntegrationTests
 
         public virtual void OnEvent(CqEvent<TKey, TResult> ev)
         {
-            Debug.WriteLine("MyCqListener::OnEvent called");
-            MyOrder val = ev.getNewValue() as MyOrder;
+        }
+
+        public virtual void OnError(CqEvent<TKey, TResult> ev)
+        {
+            Debug.WriteLine("CqListener::OnError called");
+        }
+
+        public virtual void Close()
+        {
+            Debug.WriteLine("CqListener::close called");
+        }
+    }
+
+    public class PdxCqListener<TKey, TResult> : CqListener<TKey, TResult>
+    {
+        public override void OnEvent(CqEvent<TKey, TResult> ev)
+        {
+            Debug.WriteLine("CqListener::OnEvent called");
+            var val = ev.getNewValue() as MyOrder;
             TKey key = ev.getKey();
 
             switch (ev.getQueryOperation())
@@ -120,15 +137,44 @@ namespace Apache.Geode.Client.IntegrationTests
                     break;
             }
         }
+    }
 
-        public virtual void OnError(CqEvent<TKey, TResult> ev)
+    public class DataCqListener<TKey, TResult> : CqListener<TKey, TResult>
+    {
+        public override void OnEvent(CqEvent<TKey, TResult> ev)
         {
-            Debug.WriteLine("MyCqListener::OnError called");
-        }
+            Debug.WriteLine("CqListener::OnEvent called");
+            var val = ev.getNewValue() as Position;
+            TKey key = ev.getKey();
 
-        public virtual void Close()
-        {
-            Debug.WriteLine("MyCqListener::close called");
+            switch (ev.getQueryOperation())
+            {
+                case CqOperation.OP_TYPE_REGION_CLEAR:
+                    RegionClearEvent.Set();
+                    break;
+                case CqOperation.OP_TYPE_CREATE:
+                    CreatedEvent.Set();
+                    break;
+                case CqOperation.OP_TYPE_UPDATE:
+                    UpdatedEvent.Set();
+                    break;
+                case CqOperation.OP_TYPE_INVALIDATE:
+                    InvalidatedEvent.Set();
+                    break;
+                case CqOperation.OP_TYPE_DESTROY:
+                    if (val == null)
+                    {
+                        DestroyedNullEvent.Set();
+                    }
+                    else
+                    {
+                        DestroyedNonNullEvent.Set();
+                    }
+                    break;
+                default:
+                    ReceivedUnknownEventType = true;
+                    break;
+            }
         }
     }
 
@@ -138,42 +184,42 @@ namespace Apache.Geode.Client.IntegrationTests
         private readonly Cache _cache;
         private readonly GeodeServer _geodeServer;
         private static int _waitInterval = 1000;
-
+  
         public CqOperationTest()
         {
             var cacheFactory = new CacheFactory()
                 .Set("log-level", "error");
-
+  
             _cache = cacheFactory.Create();
             _geodeServer = new GeodeServer();
-
+  
         }
-
+  
         public void Dispose()
         {
             _cache.Close();
             _geodeServer.Dispose();
         }
-
+  
         [Fact]
-        public void NotificationsHaveCorrectValues()
+        public void NotificationsHaveCorrectValuesPdxSerializable()
         {
             _cache.TypeRegistry.RegisterPdxType(MyOrder.CreateDeserializable);
-
+  
             var poolFactory = _cache.GetPoolFactory()
                 .AddLocator("localhost", _geodeServer.LocatorPort);
             var pool = poolFactory
               .SetSubscriptionEnabled(true)
               .Create("pool");
-
+  
             var regionFactory = _cache.CreateRegionFactory(RegionShortcut.PROXY)
                 .SetPoolName("pool");
-
+  
             var region = regionFactory.Create<string, MyOrder>("cqTestRegion");
-
+  
             var queryService = pool.GetQueryService();
             var cqAttributesFactory = new CqAttributesFactory<string, MyOrder>();
-            var cqListener = new MyCqListener<string, MyOrder>();
+            var cqListener = new PdxCqListener<string, MyOrder>();
             cqAttributesFactory.AddCqListener(cqListener);
             var cqAttributes = cqAttributesFactory.Create();
             
@@ -181,36 +227,98 @@ namespace Apache.Geode.Client.IntegrationTests
             Debug.WriteLine("Executing continuous query");
             query.Execute();
                   
-            Debug.WriteLine("Putting and changing Order objects in the region");
+            Debug.WriteLine("Putting and changing Position objects in the region");
             var order1 = new MyOrder(1, "product x", 23);
             var order2 = new MyOrder(2, "product y", 37);
             var order3 = new MyOrder(3, "product z", 101);
-            
+  
             region.Put("order1", order1);
+  
             region.Put("order2", order2);
-            Assert.True(cqListener.CreatedEvent.WaitOne(_waitInterval), "Didn't receieve expected CREATE event");
-
+            Assert.True(cqListener.CreatedEvent.WaitOne(_waitInterval), "Didn't receive expected CREATE event");
+  
             order1.Quantity = 60;
             region.Put("order1", order1);
-            Assert.True(cqListener.CreatedEvent.WaitOne(_waitInterval), "Didn't receieve expected CREATE event");
-
+            Assert.True(cqListener.CreatedEvent.WaitOne(_waitInterval), "Didn't receive expected CREATE event");
+  
             order2.Quantity = 45;
             region.Put("order2", order2);
-            Assert.True(cqListener.UpdatedEvent.WaitOne(_waitInterval), "Didn't receieve expected UPDATE event");
-
+            Assert.True(cqListener.UpdatedEvent.WaitOne(_waitInterval), "Didn't receive expected UPDATE event");
+  
             order2.Quantity = 11;
             region.Put("order2", order2);
-            Assert.True(cqListener.DestroyedNonNullEvent.WaitOne(_waitInterval), "Didn't receieve expected DESTROY event");
-
+            Assert.True(cqListener.DestroyedNonNullEvent.WaitOne(_waitInterval), "Didn't receive expected DESTROY event");
+  
             region.Remove("order1");
-            Assert.True(cqListener.DestroyedNullEvent.WaitOne(_waitInterval), "Didn't receieve expected DESTROY event");
-
+            Assert.True(cqListener.DestroyedNullEvent.WaitOne(_waitInterval), "Didn't receive expected DESTROY event");
+  
             region.Put("order3", order3);
-            Assert.True(cqListener.CreatedEvent.WaitOne(_waitInterval), "Didn't receieve expected CREATE event");
-
+            Assert.True(cqListener.CreatedEvent.WaitOne(_waitInterval), "Didn't receive expected CREATE event");
+  
             region.Clear();
             Assert.True(cqListener.RegionClearEvent.WaitOne(_waitInterval), "Didn't receive expected CLEAR event");
-
+  
+            Assert.False(cqListener.ReceivedUnknownEventType, "An unknown event was received by CQ listener");
+        }
+  
+        [Fact]
+        public void NotificationsHaveCorrectValuesDataSerializable()
+        {
+            _cache.TypeRegistry.RegisterType(Position.CreateDeserializable, 2);
+  
+            var poolFactory = _cache.GetPoolFactory()
+            .AddLocator("localhost", _geodeServer.LocatorPort);
+            var pool = poolFactory
+            .SetSubscriptionEnabled(true)
+            .Create("pool");
+  
+            var regionFactory = _cache.CreateRegionFactory(RegionShortcut.PROXY)
+            .SetPoolName("pool");
+  
+            var region = regionFactory.Create<string, Position>("cqTestRegion");
+  
+            var queryService = pool.GetQueryService();
+            var cqAttributesFactory = new CqAttributesFactory<string, Position>();
+            var cqListener = new DataCqListener<string, Position>();
+            cqAttributesFactory.AddCqListener(cqListener);
+            var cqAttributes = cqAttributesFactory.Create();
+  
+            var query = queryService.NewCq("MyCq", "SELECT * FROM /cqTestRegion WHERE sharesOutstanding > 30", cqAttributes, false);
+            Debug.WriteLine("Executing continuous query");
+            query.Execute();
+  
+            Debug.WriteLine("Putting and changing Position objects in the region");
+            var order1 = new Position("GOOG", 23);
+            var order2 = new Position("IBM", 37);
+            var order3 = new Position("PVTL", 101);
+  
+            region.Put("order1", order1);
+            var Value = region["order1"];
+  
+            region.Put("order2", order2);
+            Assert.True(cqListener.CreatedEvent.WaitOne(_waitInterval), "Didn't receive expected CREATE event");
+  
+            order1.SharesOutstanding = 55;
+            region.Put("order1", order1);
+            Assert.True(cqListener.CreatedEvent.WaitOne(_waitInterval), "Didn't receive expected CREATE event");
+  
+            order2.SharesOutstanding = 77;
+            region.Put("order2", order2);
+            Assert.True(cqListener.UpdatedEvent.WaitOne(_waitInterval), "Didn't receive expected UPDATE event");
+  
+            order2.SharesOutstanding = 11;
+            region.Put("order2", order2);
+            Assert.True(cqListener.DestroyedNonNullEvent.WaitOne(_waitInterval), "Didn't receive expected DESTROY event");
+  
+            region.Remove("order1");
+            Assert.True(cqListener.DestroyedNullEvent.WaitOne(_waitInterval), "Didn't receive expected DESTROY event");
+  
+            region.Put("order3", order3);
+            Assert.True(cqListener.CreatedEvent.WaitOne(_waitInterval), "Didn't receive expected CREATE event");
+  
+            region.Clear();
+            Assert.True(cqListener.RegionClearEvent.WaitOne(_waitInterval), "Didn't receive expected CLEAR event");
+  
             Assert.False(cqListener.ReceivedUnknownEventType, "An unknown event was received by CQ listener");
         }
     }
diff --git a/clicache/integration-test2/GeodeServer.cs b/clicache/integration-test2/GeodeServer.cs
index 0844d88..3f34905 100644
--- a/clicache/integration-test2/GeodeServer.cs
+++ b/clicache/integration-test2/GeodeServer.cs
@@ -87,18 +87,21 @@ public class GeodeServer : IDisposable
       {
         StartInfo =
         {
-          FileName = Config.GeodeGfsh,
-          Arguments = " -e \"start locator --bind-address=localhost --port=" + LocatorPort +
-                      " --J=-Dgemfire.jmx-manager-port=" + LocatorJmxPort + " --http-service-port=0" + "\"" +
-                      " -e \"start server --bind-address=localhost --server-port=0\"" +
-                      " -e \"create region --name=" + regionName + " --type=PARTITION\"" +
-                      " -e \"create region --name=testRegion1 --type=PARTITION\"" +
-                      " -e \"create region --name=cqTestRegion --type=REPLICATE\"",
-          WindowStyle = ProcessWindowStyle.Hidden,
-          UseShellExecute = false,
-          RedirectStandardOutput = true,
-          RedirectStandardError = true,
-          CreateNoWindow = true
+
+            FileName = Config.GeodeGfsh,
+            Arguments = " -e \"start locator --name=locator1 --bind-address=localhost --port=" + LocatorPort +
+                        " --J=-Dgemfire.jmx-manager-port=" + LocatorJmxPort + " --http-service-port=0" + "\"" +
+                        " -e \"deploy --jar=..\\..\\..\\tests\\javaobject\\javaobject.jar\"" +
+                        " -e \"start server --name=server1 --bind-address=localhost --cache-xml-file=server.xml --server-port=0\"" +
+                        " -e \"start server --name=server1 --bind-address=localhost --server-port=0\"" +
+                        " -e \"create region --name=" + regionName + " --type=PARTITION\"" +
+                        " -e \"create region --name=testRegion1 --type=PARTITION\"" +
+                        " -e \"create region --name=cqTestRegion --type=REPLICATE\"",
+            WindowStyle = ProcessWindowStyle.Hidden,
+            UseShellExecute = false,
+            RedirectStandardOutput = true,
+            RedirectStandardError = true,
+            CreateNoWindow = true
         }
       };
     }
diff --git a/clicache/integration-test2/Position.cs b/clicache/integration-test2/Position.cs
new file mode 100644
index 0000000..ca3730f
--- /dev/null
+++ b/clicache/integration-test2/Position.cs
@@ -0,0 +1,239 @@
+/*
+ * 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.
+ */
+
+using System;
+
+namespace Apache.Geode.Client.IntegrationTests
+{
+  using Apache.Geode.Client;
+  public class Position
+    : IDataSerializable
+  {
+    #region Private members
+
+    private long m_avg20DaysVol;
+    private string m_bondRating;
+    private double m_convRatio;
+    private string m_country;
+    private double m_delta;
+    private long m_industry;
+    private long m_issuer;
+    private double m_mktValue;
+    private double m_qty;
+    private string m_secId;
+    private string m_secLinks;
+    private string m_secType;
+    private int m_sharesOutstanding;
+    private string m_underlyer;
+    private long m_volatility;
+    private int m_pid;
+
+    private static int m_count = 0;
+
+    #endregion
+
+    #region Private methods
+
+    private void Init()
+    {
+      m_avg20DaysVol = 0;
+      m_bondRating = "bondRatingString";
+      m_convRatio = 0.0;
+      m_country = null;
+      m_delta = 0.0;
+      m_industry = 0;
+      m_issuer = 0;
+      m_mktValue = 0.0;
+      m_qty = 0.0;
+      m_secId = null;
+      m_secLinks = null;
+      m_secType = null;
+      m_sharesOutstanding = 0;
+      m_underlyer = null;
+      m_volatility = 0;
+      m_pid = 0;
+    }
+
+    private UInt64 GetObjectSize(ISerializable obj)
+    {
+      return (obj == null ? 0 : obj.ObjectSize);
+    }
+
+    #endregion
+
+    #region Public accessors
+
+    public string SecId
+    {
+      get
+      {
+        return m_secId;
+      }
+    }
+
+    public int Id
+    {
+      get
+      {
+        return m_pid;
+      }
+    }
+
+    public int SharesOutstanding
+    {
+      get
+      {
+        return m_sharesOutstanding;
+      }
+      set
+      {
+        m_sharesOutstanding = value;
+      }
+    }
+
+    public static int Count
+    {
+      get
+      {
+        return m_count;
+      }
+      set
+      {
+        m_count = value;
+      }
+    }
+
+    public override string ToString()
+    {
+      return "Position [secId=" + m_secId + " sharesOutstanding=" + m_sharesOutstanding + " type=" + m_secType + " id=" + m_pid + "]";
+    }
+    #endregion
+
+    #region Constructors
+
+    public Position()
+    {
+      Init();
+    }
+
+    //This ctor is for a data validation test
+    public Position(Int32 iForExactVal)
+    {
+      Init();
+
+      char[] id = new char[iForExactVal + 1];
+      for (int i = 0; i <= iForExactVal; i++)
+      {
+        id[i] = 'a';
+      }
+      m_secId = id.ToString();
+      m_qty = iForExactVal % 2 == 0 ? 1000 : 100;
+      m_mktValue = m_qty * 2;
+      m_sharesOutstanding = iForExactVal;
+      m_secType = "a";
+      m_pid = iForExactVal;
+    }
+
+    public Position(string id, int shares)
+    {
+      Init();
+      m_secId = id;
+      m_qty = shares * (m_count % 2 == 0 ? 10.0 : 100.0);
+      m_mktValue = m_qty * 1.2345998;
+      m_sharesOutstanding = shares;
+      m_secType = "a";
+      m_pid = m_count++;
+    }
+
+    #endregion
+
+    #region IDataSerializable Members
+
+    public void FromData(DataInput input)
+    {
+      m_avg20DaysVol = input.ReadInt64();
+      m_bondRating = input.ReadUTF();
+      m_convRatio = input.ReadDouble();
+      m_country = input.ReadUTF();
+      m_delta = input.ReadDouble();
+      m_industry = input.ReadInt64();
+      m_issuer = input.ReadInt64();
+      m_mktValue = input.ReadDouble();
+      m_qty = input.ReadDouble();
+      m_secId = input.ReadUTF();
+      m_secLinks = input.ReadUTF();
+      m_secType = input.ReadUTF();
+      m_sharesOutstanding = input.ReadInt32();
+      m_underlyer = input.ReadUTF();
+      m_volatility = input.ReadInt64();
+      m_pid = input.ReadInt32();
+    }
+
+    public void ToData(DataOutput output)
+    {
+      output.WriteInt64(m_avg20DaysVol);
+      output.WriteUTF(m_bondRating);
+      output.WriteDouble(m_convRatio);
+      output.WriteUTF(m_country);
+      output.WriteDouble(m_delta);
+      output.WriteInt64(m_industry);
+      output.WriteInt64(m_issuer);
+      output.WriteDouble(m_mktValue);
+      output.WriteDouble(m_qty);
+      output.WriteUTF(m_secId);
+      output.WriteUTF(m_secLinks);
+      output.WriteUTF(m_secType);
+      output.WriteInt32(m_sharesOutstanding);
+      output.WriteUTF(m_underlyer);
+      output.WriteInt64(m_volatility);
+      output.WriteInt32(m_pid);
+      
+    }
+
+    public UInt64 ObjectSize
+    {
+      get
+      {
+        UInt64 objectSize = 0;
+        objectSize += (UInt64)sizeof(long);
+        objectSize += (UInt64) (m_bondRating.Length * sizeof(char));
+        objectSize += (UInt64)sizeof(double);
+        objectSize += (UInt64)(m_country.Length * sizeof(char));
+        objectSize += (UInt64)sizeof(double);
+        objectSize += (UInt64)sizeof(Int64);
+        objectSize += (UInt64)sizeof(Int64);
+        objectSize += (UInt64)sizeof(double);
+        objectSize += (UInt64)sizeof(double);
+        objectSize += (UInt64)(m_secId.Length * sizeof(char));
+        objectSize += (UInt64)(m_secLinks.Length * sizeof(char));
+        objectSize += (UInt64)(m_secType == null ? 0 : sizeof(char) * m_secType.Length);
+        objectSize += (UInt64)sizeof(Int32);
+        objectSize += (UInt64)(m_underlyer.Length * sizeof(char));
+        objectSize += (UInt64)sizeof(Int64);
+        objectSize += (UInt64)sizeof(Int32);
+        return objectSize;
+      }
+    }
+
+    #endregion
+
+    public static ISerializable CreateDeserializable()
+    {
+      return new Position();
+    }
+  }
+}
diff --git a/clicache/integration-test2/server.xml b/clicache/integration-test2/server.xml
new file mode 100644
index 0000000..b1a8a6a
--- /dev/null
+++ b/clicache/integration-test2/server.xml
@@ -0,0 +1,26 @@
+<?xml version="1.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.
+-->
+<cache 
+	xmlns="http://geode.apache.org/schema/cache" 
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://geode.apache.org/schema/cache http://geode.apache.org/schema/cache/cache-1.0.xsd" version="1.0">
+	<serialization-registration>
+		<instantiator id="2">
+			<class-name>javaobject.Position</class-name>
+		</instantiator>
+	</serialization-registration>
+</cache>
\ No newline at end of file
diff --git a/tests/javaobject/Position.java b/tests/javaobject/Position.java
index 61e5499..058f356 100644
--- a/tests/javaobject/Position.java
+++ b/tests/javaobject/Position.java
@@ -113,38 +113,38 @@ public class Position implements Declarable, Serializable, DataSerializable {
   
   public void fromData(DataInput in) throws IOException, ClassNotFoundException {
     this.avg20DaysVol = in.readLong();
-    this.bondRating = (String)DataSerializer.readObject(in);
+    this.bondRating = in.readUTF();
     this.convRatio = in.readDouble();
-    this.country = (String)DataSerializer.readObject(in);
+    this.country = in.readUTF();
     this.delta = in.readDouble();
     this.industry = in.readLong();
     this.issuer = in.readLong();
     this.mktValue = in.readDouble();
     this.qty = in.readDouble();
-    this.secId = (String)DataSerializer.readObject(in);
-    this.secLinks = (String)DataSerializer.readObject(in);
+    this.secId = in.readUTF();
+    this.secLinks = in.readUTF();
     this.secType = in.readUTF();
     this.sharesOutstanding = in.readInt();
-    this.underlyer = (String)DataSerializer.readObject(in);
+    this.underlyer = in.readUTF();
     this.volatility = in.readLong();
     this.pid = in.readInt();
   }
   
   public void toData(DataOutput out) throws IOException {
     out.writeLong(this.avg20DaysVol);
-    DataSerializer.writeObject(this.bondRating, out);
+    out.writeUTF(this.bondRating);
     out.writeDouble(this.convRatio);
-    DataSerializer.writeObject(this.country, out);
+    out.writeUTF(this.country);
     out.writeDouble(this.delta);
     out.writeLong(this.industry);
     out.writeLong(this.issuer);
     out.writeDouble(this.mktValue);
     out.writeDouble(this.qty);
-    DataSerializer.writeObject(this.secId, out);
-    DataSerializer.writeObject(this.secLinks, out);
+    out.writeUTF(this.secId);
+    out.writeUTF(this.secLinks);
     out.writeUTF(this.secType);
     out.writeInt(this.sharesOutstanding);
-    DataSerializer.writeObject(this.underlyer, out);
+    out.writeUTF(this.underlyer);
     out.writeLong(this.volatility);
     out.writeInt(this.pid);
   }