diff options
| author | Brian S. O'Neill <bronee@gmail.com> | 2009-02-26 19:07:58 +0000 |
|---|---|---|
| committer | Brian S. O'Neill <bronee@gmail.com> | 2009-02-26 19:07:58 +0000 |
| commit | 855ca3029ab4afc2a5766fd9198c3b3a93f7b594 (patch) | |
| tree | 72d98f70384fac7621dfd43742c4ac6bef5bf178 | |
| parent | 42a1c5872f939485ffc5e5b23aea7833a8761af8 (diff) | |
Don't check if independent properties are set. This fixes a regression in which independent properties did not work as advertised.
| -rw-r--r-- | src/test/java/com/amazon/carbonado/TestStorables.java | 21 | ||||
| -rw-r--r-- | src/test/java/com/amazon/carbonado/stored/StorableIndependent.java | 43 |
2 files changed, 64 insertions, 0 deletions
diff --git a/src/test/java/com/amazon/carbonado/TestStorables.java b/src/test/java/com/amazon/carbonado/TestStorables.java index 4704cdc..3e18fa7 100644 --- a/src/test/java/com/amazon/carbonado/TestStorables.java +++ b/src/test/java/com/amazon/carbonado/TestStorables.java @@ -655,6 +655,27 @@ public class TestStorables extends TestCase { } } + public void test_independent() throws Exception { + // Just make sure that no check is performed for unset independent property. + Storage<StorableIndependent> storage = + getRepository().storageFor(StorableIndependent.class); + StorableIndependent s = storage.prepare(); + s.setID(100); + try { + s.insert(); + fail(); + } catch (ConstraintException e) { + // Din't set name. + } + + s.setValue("value"); + // Should not check unset independent property, name. + s.insert(); + + s.setName("bob"); + s.update(); + } + public void test_nonDestructiveUpdate() throws Exception { Storage<StorableTestBasic> storage = getRepository().storageFor(StorableTestBasic.class); StorableTestBasic s = storage.prepare(); diff --git a/src/test/java/com/amazon/carbonado/stored/StorableIndependent.java b/src/test/java/com/amazon/carbonado/stored/StorableIndependent.java new file mode 100644 index 0000000..e81e37e --- /dev/null +++ b/src/test/java/com/amazon/carbonado/stored/StorableIndependent.java @@ -0,0 +1,43 @@ +/*
+ * Copyright 2009 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 com.amazon.carbonado.Independent;
+import com.amazon.carbonado.Nullable;
+import com.amazon.carbonado.Storable;
+import com.amazon.carbonado.PrimaryKey;
+
+/**
+ *
+ *
+ * @author Brian S O'Neill
+ */
+@PrimaryKey("ID")
+public interface StorableIndependent extends Storable {
+ int getID();
+ void setID(int id);
+
+ String getValue();
+ void setValue(String value);
+
+ @Independent
+ @Nullable
+ String getName();
+ void setName(String name);
+}
|
