diff options
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/java/com/amazon/carbonado/gen/TestStorableSerializer.java | 22 | ||||
| -rw-r--r-- | src/test/java/com/amazon/carbonado/stored/StorableDatePk.java | 39 | 
2 files changed, 61 insertions, 0 deletions
diff --git a/src/test/java/com/amazon/carbonado/gen/TestStorableSerializer.java b/src/test/java/com/amazon/carbonado/gen/TestStorableSerializer.java index 883b84a..7e51fa6 100644 --- a/src/test/java/com/amazon/carbonado/gen/TestStorableSerializer.java +++ b/src/test/java/com/amazon/carbonado/gen/TestStorableSerializer.java @@ -82,6 +82,28 @@ public class TestStorableSerializer extends TestCase {          stb2.readFrom(din);
          assertEquals(stb, stb2);
 +        assertEquals(stb.toString(), stb2.toString());
 +    }
 +
 +    public void testReadAndWrite2() throws Exception {
 +        Storage<StorableDatePk> storage = mRepository.storageFor(StorableDatePk.class);
 +        StorableDatePk s = storage.prepare();
 +        s.setId(50);
 +        s.setOrderDate(new org.joda.time.DateTime());
 +
 +        // This should not interfere with date property being set when deserialized.
 +        s.markAllPropertiesClean();
 +
 +        ByteArrayOutputStream bout = new ByteArrayOutputStream();
 +        s.writeTo(bout);
 +        byte[] bytes = bout.toByteArray();
 +
 +        ByteArrayInputStream bin = new ByteArrayInputStream(bytes);
 +        StorableDatePk s2 = storage.prepare();
 +        s2.readFrom(bin);
 +
 +        assertEquals(s, s2);
 +        assertEquals(s.toString(), s2.toString());
      }
      /*
 diff --git a/src/test/java/com/amazon/carbonado/stored/StorableDatePk.java b/src/test/java/com/amazon/carbonado/stored/StorableDatePk.java new file mode 100644 index 0000000..0a53cb8 --- /dev/null +++ b/src/test/java/com/amazon/carbonado/stored/StorableDatePk.java @@ -0,0 +1,39 @@ +/*
 + * Copyright 2006 Amazon Technologies, Inc. or its affiliates.
 + * Amazon, Amazon.com and Carbonado are trademarks or registered trademarks
 + * of Amazon Technologies, Inc. or its affiliates.  All rights reserved.
 + *
 + * Licensed 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 com.amazon.carbonado.stored;
 +
 +import org.joda.time.DateTime;
 +
 +
 +import com.amazon.carbonado.PrimaryKey;
 +import com.amazon.carbonado.Storable;
 +
 +/**
 + * 
 + *
 + * @author Brian S O'Neill
 + */
 +@PrimaryKey("orderDate")
 +public interface StorableDatePk extends Storable {
 +    int getId();
 +    void setId(int id);
 +
 +    DateTime getOrderDate();
 +    void setOrderDate(DateTime date);
 +}
  | 
