diff options
Diffstat (limited to 'src/test/java/com/amazon/carbonado/stored')
27 files changed, 1542 insertions, 0 deletions
diff --git a/src/test/java/com/amazon/carbonado/stored/Address.java b/src/test/java/com/amazon/carbonado/stored/Address.java new file mode 100644 index 0000000..3043e54 --- /dev/null +++ b/src/test/java/com/amazon/carbonado/stored/Address.java @@ -0,0 +1,64 @@ +/*
 + * 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 com.amazon.carbonado.Alias;
 +import com.amazon.carbonado.Independent;
 +import com.amazon.carbonado.Storable;
 +import com.amazon.carbonado.Nullable;
 +import com.amazon.carbonado.PrimaryKey;
 +import com.amazon.carbonado.Sequence;
 +
 +/**
 + *
 + *
 + * @author Brian S O'Neill
 + */
 +@Alias("TEST_ADDRESS")
 +@PrimaryKey("addressID")
 +public interface Address extends Storable {
 +    @Sequence("TEST_ADDRESS_ID_SEQ")
 +    long getAddressID();
 +    void setAddressID(long id);
 +
 +    String getAddressLine1();
 +    void setAddressLine1(String value);
 +
 +    @Nullable
 +    String getAddressLine2();
 +    void setAddressLine2(String value);
 +
 +    String getAddressCity();
 +    void setAddressCity(String value);
 +
 +    @Nullable
 +    String getAddressState();
 +    void setAddressState(String value);
 +
 +    String getAddressZip();
 +    void setAddressZip(String value);
 +
 +    String getAddressCountry();
 +    void setAddressCountry(String value);
 +
 +    @Independent
 +    String getCustomData();
 +    void setCustomData(String str);
 +}
 +
 diff --git a/src/test/java/com/amazon/carbonado/stored/Dummy.java b/src/test/java/com/amazon/carbonado/stored/Dummy.java new file mode 100644 index 0000000..980c718 --- /dev/null +++ b/src/test/java/com/amazon/carbonado/stored/Dummy.java @@ -0,0 +1,145 @@ +/*
 + * 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 com.amazon.carbonado.*;
 +
 +/**
 + * Implements all the Storable methods, but each throws
 + * UnsupportedOperationException. Methods defined in Object are left alone.
 + *
 + * @author Brian S O'Neill
 + */
 +public class Dummy implements Storable {
 +    public void load() throws FetchException {
 +        throw error();
 +    }
 +
 +    public boolean tryLoad() throws FetchException {
 +        throw error();
 +    }
 +
 +    public void insert() throws PersistException {
 +        throw error();
 +    }
 +
 +    public boolean tryInsert() throws PersistException {
 +        throw error();
 +    }
 +
 +    public void update() throws PersistException {
 +        throw error();
 +    }
 +
 +    public boolean tryUpdate() throws PersistException {
 +        throw error();
 +    }
 +
 +    public void delete() throws PersistException {
 +        throw error();
 +    }
 +
 +    public boolean tryDelete() throws PersistException {
 +        throw error();
 +    }
 +
 +    public Storage storage() {
 +        throw error();
 +    }
 +
 +    public Class storableType() {
 +        throw error();
 +    }
 +
 +    public void copyAllProperties(Storable target) {
 +        throw error();
 +    }
 +
 +    public void copyPrimaryKeyProperties(Storable target) {
 +        throw error();
 +    }
 +
 +    public void copyVersionProperty(Storable target) {
 +        throw error();
 +    }
 +
 +    public void copyUnequalProperties(Storable target) {
 +        throw error();
 +    }
 +
 +    public void copyDirtyProperties(Storable target) {
 +        throw error();
 +    }
 +
 +    public boolean hasDirtyProperties() {
 +        throw error();
 +    }
 +
 +    public void markPropertiesClean() {
 +        throw error();
 +    }
 +
 +    public void markAllPropertiesClean() {
 +        throw error();
 +    }
 +
 +    public void markPropertiesDirty() {
 +        throw error();
 +    }
 +
 +    public void markAllPropertiesDirty() {
 +        throw error();
 +    }
 +
 +    public boolean isPropertyUninitialized(String propertyName) {
 +        throw error();
 +    }
 +
 +    public boolean isPropertyDirty(String propertyName) {
 +        throw error();
 +    }
 +
 +    public boolean isPropertyClean(String propertyName) {
 +        throw error();
 +    }
 +
 +    public boolean isPropertySupported(String propertyName) {
 +        throw error();
 +    }
 +
 +    public Storable copy() {
 +        throw error();
 +    }
 +
 +    public boolean equalPrimaryKeys(Object obj) {
 +        throw error();
 +    }
 +
 +    public boolean equalProperties(Object obj) {
 +        throw error();
 +    }
 +
 +    public String toStringKeyOnly() {
 +        throw error();
 +    }
 +
 +    protected UnsupportedOperationException error() {
 +        return new UnsupportedOperationException();
 +    }
 +}
 diff --git a/src/test/java/com/amazon/carbonado/stored/FileInfo.java b/src/test/java/com/amazon/carbonado/stored/FileInfo.java new file mode 100644 index 0000000..c3245e3 --- /dev/null +++ b/src/test/java/com/amazon/carbonado/stored/FileInfo.java @@ -0,0 +1,100 @@ +/*
 + * 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 java.io.*;
 +
 +import org.joda.time.DateTime;
 +
 +import com.amazon.carbonado.*;
 +import com.amazon.carbonado.lob.*;
 +import com.amazon.carbonado.adapter.*;
 +
 +/**
 + * 
 + *
 + * @author Brian S O'Neill
 + */
 +@Indexes({
 +    @Index("name"),
 +    @Index({"length", "lastModified"}),
 +    @Index("lastModified"),
 +    @Index("parentID")
 +})
 +@Alias("CBN_TEST_FILE_INFO")
 +@AlternateKeys({
 +    @Key({"parentID", "name"})
 +})
 +@PrimaryKey("ID")
 +public abstract class FileInfo implements Storable {
 +    @Sequence("com.amazon.carbonado.storables.FileInfo")
 +    public abstract int getID();
 +    public abstract void setID(int value);
 +
 +    @Nullable
 +    public abstract Integer getParentID();
 +    public abstract void setParentID(Integer id);
 +
 +    @Nullable
 +    @Join(internal="parentID", external="ID")
 +    public abstract FileInfo getParent() throws FetchException;
 +    public abstract void setParent(FileInfo value);
 +
 +    @Join(internal="ID", external="parentID")
 +    public abstract Query<FileInfo> getChildren() throws FetchException;
 +
 +    @Alias("FILE_NAME")
 +    public abstract String getName();
 +    public abstract void setName(String value);
 +
 +    @YesNoAdapter
 +    public abstract boolean isDirectory();
 +    public abstract void setDirectory(boolean value);
 +
 +    @Alias("FILE_LENGTH")
 +    public abstract long getLength();
 +    public abstract void setLength(long value);
 +
 +    @Nullable
 +    public abstract DateTime getLastModified();
 +    public abstract void setLastModified(DateTime value);
 +
 +    @Version
 +    @Alias("RECORD_VERSION_NUMBER")
 +    public abstract int getVersionNumber();
 +    public abstract void setVersionNumber(int version);
 +
 +    @Nullable
 +    public abstract Blob getFileData();
 +    public abstract void setFileData(Blob data);
 +
 +    public String getFullPath() throws FetchException {
 +        FileInfo parent;
 +        try {
 +            parent = getParent();
 +        } catch (FetchNoneException e) {
 +            parent = null;
 +        }
 +        if (parent == null) {
 +            return getName();
 +        } else {
 +            return parent.getFullPath() + '/' + getName();
 +        }
 +    }
 +}
 diff --git a/src/test/java/com/amazon/carbonado/stored/ManyKeys2.java b/src/test/java/com/amazon/carbonado/stored/ManyKeys2.java new file mode 100644 index 0000000..282ff02 --- /dev/null +++ b/src/test/java/com/amazon/carbonado/stored/ManyKeys2.java @@ -0,0 +1,47 @@ +/*
 + * 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 com.amazon.carbonado.*;
 +
 +/**
 + * 
 + *
 + * @author Brian S O'Neill
 + */
 +@PrimaryKey({"a", "b", "c", "d", "e", "f"})
 +public interface ManyKeys2 extends Storable {
 +    int getA();
 +    void setA(int value);
 +
 +    int getB();
 +    void setB(int value);
 +
 +    int getC();
 +    void setC(int value);
 +
 +    int getD();
 +    void setD(int value);
 +
 +    int getE();
 +    void setE(int value);
 +
 +    int getF();
 +    void setF(int value);
 +}
 diff --git a/src/test/java/com/amazon/carbonado/stored/Order.java b/src/test/java/com/amazon/carbonado/stored/Order.java new file mode 100644 index 0000000..91804d9 --- /dev/null +++ b/src/test/java/com/amazon/carbonado/stored/Order.java @@ -0,0 +1,68 @@ +/*
 + * 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 com.amazon.carbonado.Alias;
 +import com.amazon.carbonado.Storable;
 +import com.amazon.carbonado.FetchException;
 +import com.amazon.carbonado.Join;
 +import com.amazon.carbonado.Nullable;
 +import com.amazon.carbonado.PrimaryKey;
 +import com.amazon.carbonado.Query;
 +import com.amazon.carbonado.Sequence;
 +
 +/**
 + * 
 + *
 + * @author Brian S O'Neill
 + */
 +@Alias("TEST_ORDER")
 +@PrimaryKey("orderID")
 +public interface Order extends Storable<Order> {
 +    @Sequence("TEST_ORDER_ID_SEQ")
 +    long getOrderID();
 +    void setOrderID(long id);
 +
 +    String getOrderNumber();
 +    void setOrderNumber(String value);
 +
 +    int getOrderTotal();
 +    void setOrderTotal(int value);
 +
 +    @Nullable
 +    String getOrderComments();
 +    void setOrderComments(String value);
 +
 +    long getAddressID();
 +    void setAddressID(long value);
 +
 +    @Join
 +    @Nullable
 +    Address getAddress() throws FetchException;
 +    void setAddress(Address value);
 +
 +    @Join
 +    Query<OrderItem> getOrderItems() throws FetchException;
 +
 +    @Join
 +    Query<Shipment> getShipments() throws FetchException;
 +
 +    @Join
 +    Query<Promotion> getPromotions() throws FetchException;
 +}
 diff --git a/src/test/java/com/amazon/carbonado/stored/OrderItem.java b/src/test/java/com/amazon/carbonado/stored/OrderItem.java new file mode 100644 index 0000000..dba2477 --- /dev/null +++ b/src/test/java/com/amazon/carbonado/stored/OrderItem.java @@ -0,0 +1,68 @@ +/*
 + * 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 com.amazon.carbonado.Alias;
 +import com.amazon.carbonado.Storable;
 +import com.amazon.carbonado.FetchException;
 +import com.amazon.carbonado.Index;
 +import com.amazon.carbonado.Indexes;
 +import com.amazon.carbonado.Join;
 +import com.amazon.carbonado.PrimaryKey;
 +import com.amazon.carbonado.Sequence;
 +import com.amazon.carbonado.constraint.IntegerConstraint;
 +
 +/**
 + * 
 + *
 + * @author Brian S O'Neill
 + */
 +@Alias("TEST_ORDER_ITEM")
 +@Indexes({@Index("+orderID"), @Index("+shipmentID")})
 +@PrimaryKey("orderItemID")
 +public interface OrderItem extends Storable<OrderItem> {
 +    @Sequence("TEST_ORDER_ITEM_ID_SEQ")
 +    long getOrderItemID();
 +    void setOrderItemID(long id);
 +
 +    long getOrderID();
 +    void setOrderID(long value);
 +
 +    @Join
 +    Order getOrder() throws FetchException;
 +    void setOrder(Order value);
 +
 +    String getItemDescription();
 +    void setItemDescription(String value);
 +
 +    int getItemQuantity();
 +    @IntegerConstraint(min=1, max=100)
 +    void setItemQuantity(int value);
 +
 +    int getItemPrice();
 +    void setItemPrice(int value);
 +
 +    long getShipmentID();
 +    void setShipmentID(long value);
 +
 +    @Join
 +    Shipment getShipment() throws FetchException;
 +    void setShipment(Shipment value);
 +}
 +
 diff --git a/src/test/java/com/amazon/carbonado/stored/Promotion.java b/src/test/java/com/amazon/carbonado/stored/Promotion.java new file mode 100644 index 0000000..18f4a2e --- /dev/null +++ b/src/test/java/com/amazon/carbonado/stored/Promotion.java @@ -0,0 +1,55 @@ +/*
 + * 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 com.amazon.carbonado.Alias;
 +import com.amazon.carbonado.Storable;
 +import com.amazon.carbonado.FetchException;
 +import com.amazon.carbonado.Join;
 +import com.amazon.carbonado.PrimaryKey;
 +
 +/**
 + * 
 + *
 + * @author Brian S O'Neill
 + */
 +@Alias("TEST_PROMOTION")
 +@PrimaryKey({"orderID", "promotionID"})
 +public interface Promotion extends Storable<Promotion> {
 +    long getOrderID();
 +    void setOrderID(long value);
 +
 +    String getPromotionID();
 +    void setPromotionID(String value);
 +
 +    @Join
 +    Order getOrder() throws FetchException;
 +    void setOrder(Order value);
 +
 +    @Join
 +    Promotion getPromotion() throws FetchException;
 +    void setPromotion(Promotion value);
 +
 +    String getPromotionTitle();
 +    void setPromotionTitle(String value);
 +
 +    String getPromotionDetails();
 +    void setPromotionDetails(String value);
 +}
 +
 diff --git a/src/test/java/com/amazon/carbonado/stored/Shipment.java b/src/test/java/com/amazon/carbonado/stored/Shipment.java new file mode 100644 index 0000000..670806d --- /dev/null +++ b/src/test/java/com/amazon/carbonado/stored/Shipment.java @@ -0,0 +1,69 @@ +/*
 + * 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.Alias;
 +import com.amazon.carbonado.Storable;
 +import com.amazon.carbonado.FetchException;
 +import com.amazon.carbonado.Index;
 +import com.amazon.carbonado.Indexes;
 +import com.amazon.carbonado.Join;
 +import com.amazon.carbonado.PrimaryKey;
 +import com.amazon.carbonado.Query;
 +import com.amazon.carbonado.Sequence;
 +
 +/**
 + * 
 + *
 + * @author Brian S O'Neill
 + */
 +@Alias("TEST_SHIPMENT")
 +@Indexes(@Index("+orderID"))
 +@PrimaryKey("shipmentID")
 +public interface Shipment extends Storable<Shipment> {
 +    @Sequence("TEST_SHIPMENT_ID_SEQ")
 +    long getShipmentID();
 +    void setShipmentID(long id);
 +
 +    String getShipmentNotes();
 +    void setShipmentNotes(String value);
 +
 +    DateTime getShipmentDate();
 +    void setShipmentDate(DateTime value);
 +
 +    long getOrderID();
 +    void setOrderID(long value);
 +
 +    @Join
 +    Order getOrder() throws FetchException;
 +    void setOrder(Order value);
 +
 +    long getShipperID();
 +    void setShipperID(long value);
 +
 +    @Join
 +    Shipper getShipper() throws FetchException;
 +    void setShipper(Shipper value);
 +
 +    @Join
 +    Query<OrderItem> getOrderItems() throws FetchException;
 +}
 +
 diff --git a/src/test/java/com/amazon/carbonado/stored/Shipper.java b/src/test/java/com/amazon/carbonado/stored/Shipper.java new file mode 100644 index 0000000..41e60f4 --- /dev/null +++ b/src/test/java/com/amazon/carbonado/stored/Shipper.java @@ -0,0 +1,52 @@ +/*
 + * 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 com.amazon.carbonado.Alias;
 +import com.amazon.carbonado.Storable;
 +import com.amazon.carbonado.FetchException;
 +import com.amazon.carbonado.Join;
 +import com.amazon.carbonado.PrimaryKey;
 +import com.amazon.carbonado.Sequence;
 +
 +/**
 + * 
 + *
 + * @author Brian S O'Neill
 + */
 +@Alias("TEST_SHIPPER")
 +@PrimaryKey("shipperID")
 +public interface Shipper extends Storable<Shipper> {
 +    @Sequence("TEST_SHIPPER_ID_SEQ")
 +    long getShipperID();
 +    void setShipperID(long id);
 +
 +    String getShipperName();
 +    void setShipperName(String value);
 +
 +    String getShipperDetails();
 +    void setShipperDetails(String value);
 +
 +    long getAddressID();
 +    void setAddressID(long value);
 +
 +    @Join
 +    Address getAddress() throws FetchException;
 +    void setAddress(Address value);
 +}
 diff --git a/src/test/java/com/amazon/carbonado/stored/StorableDateIndex.java b/src/test/java/com/amazon/carbonado/stored/StorableDateIndex.java new file mode 100644 index 0000000..5e7d063 --- /dev/null +++ b/src/test/java/com/amazon/carbonado/stored/StorableDateIndex.java @@ -0,0 +1,46 @@ +/*
 + * 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.Index;
 +import com.amazon.carbonado.Indexes;
 +import com.amazon.carbonado.PrimaryKey;
 +import com.amazon.carbonado.Storable;
 +import com.amazon.carbonado.adapter.DateTimeAdapter;
 +
 +/**
 + * 
 + *
 + * @author Brian S O'Neill
 + */
 +@Indexes(@Index("orderDate"))
 +@PrimaryKey("ID")
 +public interface StorableDateIndex extends Storable {
 +    int getID();
 +
 +    void setID(int id);
 +
 +    @DateTimeAdapter(timeZone="America/New_York")
 +    DateTime getOrderDate();
 +
 +    void setOrderDate(DateTime date);
 +}
 diff --git a/src/test/java/com/amazon/carbonado/stored/StorableSequenced.java b/src/test/java/com/amazon/carbonado/stored/StorableSequenced.java new file mode 100644 index 0000000..770d6f0 --- /dev/null +++ b/src/test/java/com/amazon/carbonado/stored/StorableSequenced.java @@ -0,0 +1,67 @@ +/*
 + * 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 com.amazon.carbonado.Nullable;
 +import com.amazon.carbonado.PrimaryKey;
 +import com.amazon.carbonado.Sequence;
 +import com.amazon.carbonado.Storable;
 +
 +/**
 + * 
 + *
 + * @author Brian S O'Neill
 + */
 +@PrimaryKey("ID")
 +public interface StorableSequenced extends Storable<StorableSequenced> {
 +    @Sequence("pk")
 +    long getID();
 +
 +    void setID(long id);
 +
 +    @Sequence("some_int")
 +    int getSomeInt();
 +
 +    void setSomeInt(int i);
 +
 +    @Sequence("some_IntegerObj")
 +    Integer getSomeIntegerObj();
 +
 +    void setSomeIntegerObj(Integer i);
 +
 +    @Sequence("some_long")
 +    long getSomeLong();
 +
 +    void setSomeLong(long i);
 +
 +    @Sequence("some_LongObj")
 +    @Nullable
 +    Long getSomeLongObj();
 +
 +    void setSomeLongObj(Long i);
 +
 +    @Sequence("some_String")
 +    String getSomeString();
 +
 +    void setSomeString(String str);
 +
 +    String getData();
 +
 +    void setData(String data);
 +}
 diff --git a/src/test/java/com/amazon/carbonado/stored/StorableTestAssymetric.java b/src/test/java/com/amazon/carbonado/stored/StorableTestAssymetric.java new file mode 100644 index 0000000..3808c1f --- /dev/null +++ b/src/test/java/com/amazon/carbonado/stored/StorableTestAssymetric.java @@ -0,0 +1,38 @@ +/* + * 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 com.amazon.carbonado.Storable; +import com.amazon.carbonado.PrimaryKey; + +/* + * StorableTestAssymetric + * + * @author Don Schneider + */ +@PrimaryKey("id") +public abstract class StorableTestAssymetric implements Storable { +    public abstract int getId(); +    public abstract void setId(int id); + +    public int getAssymetricGet() +    { +       return getId()*3; +    }; +} diff --git a/src/test/java/com/amazon/carbonado/stored/StorableTestBasic.java b/src/test/java/com/amazon/carbonado/stored/StorableTestBasic.java new file mode 100644 index 0000000..0857518 --- /dev/null +++ b/src/test/java/com/amazon/carbonado/stored/StorableTestBasic.java @@ -0,0 +1,114 @@ +/*
 + * 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 java.util.Random;
 +
 +import org.joda.time.DateTime;
 +
 +import com.amazon.carbonado.Nullable;
 +import com.amazon.carbonado.Storable;
 +import com.amazon.carbonado.PrimaryKey;
 +import com.amazon.carbonado.Storage;
 +import com.amazon.carbonado.Repository;
 +import com.amazon.carbonado.RepositoryException;
 +
 +/**
 + * StorableTestBasic
 + *
 + * @author Don Schneider
 + */
 +@PrimaryKey("id")
 +public abstract class StorableTestBasic implements Storable {
 +    public abstract int getId();
 +    public abstract void setId(int id);
 +
 +    // Basic coverage of the primitives
 +    public abstract String getStringProp();
 +    public abstract void setStringProp(String aStringThing);
 +
 +    public abstract int getIntProp();
 +    public abstract void setIntProp(int anInt);
 +
 +    public abstract long getLongProp();
 +    public abstract void setLongProp(long aLong);
 +
 +    public abstract double getDoubleProp();
 +    public abstract void setDoubleProp(double aDouble);
 +
 +    @Nullable
 +    public abstract DateTime getDate();
 +    public abstract void setDate(DateTime aDate);
 +
 +    public void initPrimaryKeyProperties() {
 +        setId(10);
 +    }
 +
 +    public void initBasicProperties() {
 +        setStringProp("foo");
 +        setIntProp(10);
 +        setLongProp(120);
 +        setDoubleProp(1.2);
 +    }
 +
 +    public void initPropertiesRandomly(int id) {
 +        setId(id);
 +
 +        Random random = new Random(1000);
 +
 +        setIntProp(random.nextInt());
 +        setLongProp(random.nextLong());
 +        setDoubleProp(random.nextDouble());
 +        setStringProp("imaString_" + id % 10);
 +    }
 +
 +    public void initPropertiesPredictably(int id) {
 +        setId(id);
 +
 +        setIntProp(id*10);
 +        setLongProp(id*10);
 +        setDoubleProp(id/2.0);
 +        setStringProp("string-" + id % 100);
 +    }
 +
 +    public static void insertBunches(Repository repository, int count)
 +            throws RepositoryException
 +    {
 +        insertBunches(repository, count, 0, true);
 +    }
 +
 +
 +    public static void insertBunches(Repository repository,
 +                                     int count, int startId,
 +                                     boolean doRandom)
 +        throws RepositoryException
 +    {
 +        Storage<StorableTestBasic> storage = repository.storageFor(StorableTestBasic.class);
 +        StorableTestBasic s;
 +
 +        for (int i = 0; i < count; i ++) {
 +            s = storage.prepare();
 +            if (doRandom) {
 +                s.initPropertiesRandomly(i);
 +            } else {
 +                s.initPropertiesPredictably(i+startId);
 +            }
 +            s.insert();
 +        }
 +    }
 +}
 diff --git a/src/test/java/com/amazon/carbonado/stored/StorableTestBasicIndexed.java b/src/test/java/com/amazon/carbonado/stored/StorableTestBasicIndexed.java new file mode 100644 index 0000000..c9de396 --- /dev/null +++ b/src/test/java/com/amazon/carbonado/stored/StorableTestBasicIndexed.java @@ -0,0 +1,37 @@ +/* + * 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 com.amazon.carbonado.Index; +import com.amazon.carbonado.Indexes; +import com.amazon.carbonado.PrimaryKey; + +/** + * StorableTestBasicIndexed + * + * @author Brian S O'Neill + */ +@Indexes({ +    @Index("stringProp"), +    @Index("intProp"), +    @Index("longProp"), +    @Index("doubleProp") +}) +@PrimaryKey("id") +public abstract class StorableTestBasicIndexed extends StorableTestBasic { +} diff --git a/src/test/java/com/amazon/carbonado/stored/StorableTestInvalid.java b/src/test/java/com/amazon/carbonado/stored/StorableTestInvalid.java new file mode 100644 index 0000000..bd9fed2 --- /dev/null +++ b/src/test/java/com/amazon/carbonado/stored/StorableTestInvalid.java @@ -0,0 +1,40 @@ +/* + * 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 com.amazon.carbonado.Storable; +import com.amazon.carbonado.PrimaryKey; + +/** + * StorableTestInvalid + * + * @author Don Schneider + */ +@PrimaryKey("pk") +public interface StorableTestInvalid extends Storable { +    int getPk(); +    void setPk(int id); + +    Custom getCustom(); +    void setCustom(Custom aCustom); + + +    // Probably more than is needed +    class Custom {    } +} diff --git a/src/test/java/com/amazon/carbonado/stored/StorableTestKeyValue.java b/src/test/java/com/amazon/carbonado/stored/StorableTestKeyValue.java new file mode 100644 index 0000000..44ecc2f --- /dev/null +++ b/src/test/java/com/amazon/carbonado/stored/StorableTestKeyValue.java @@ -0,0 +1,43 @@ +/* + * 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 com.amazon.carbonado.Storable; +import com.amazon.carbonado.PrimaryKey; + +/** + * StorableTestKeyValue + * + * @author Don Schneider + */ +@PrimaryKey({"key1", "key2"}) +public interface StorableTestKeyValue extends Storable { +    int getKey1(); +    void setKey1(int id); + +    int getKey2(); +    void setKey2(int id); + +    int getValue1(); +    void setValue1(int value); + +    int getValue2(); +    void setValue2(int value); + +} diff --git a/src/test/java/com/amazon/carbonado/stored/StorableTestMinimal.java b/src/test/java/com/amazon/carbonado/stored/StorableTestMinimal.java new file mode 100644 index 0000000..a1aae70 --- /dev/null +++ b/src/test/java/com/amazon/carbonado/stored/StorableTestMinimal.java @@ -0,0 +1,32 @@ +/*
 + * 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 com.amazon.carbonado.Storable;
 +import com.amazon.carbonado.PrimaryKey;
 +
 +/**
 + * StorableTestBasic
 + *
 + * @author Don Schneider
 + */
 +@PrimaryKey("id")
 +public interface StorableTestMinimal extends Storable {
 +    int getId();
 +    void setId(int id);
 +}
 diff --git a/src/test/java/com/amazon/carbonado/stored/StorableTestMultiPK.java b/src/test/java/com/amazon/carbonado/stored/StorableTestMultiPK.java new file mode 100644 index 0000000..ace031b --- /dev/null +++ b/src/test/java/com/amazon/carbonado/stored/StorableTestMultiPK.java @@ -0,0 +1,40 @@ +/* + * 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 com.amazon.carbonado.PrimaryKey; +import com.amazon.carbonado.Storable; + +/** + * StorableTestMultiPK + * + * @author Don Schneider + */ +@PrimaryKey({"idPK", "stringPK"}) +public interface StorableTestMultiPK extends Storable { +    int getIdPK(); +    void setIdPK(int id); + +    // Basic coverage of the primitives +    String getStringPK(); +    void setStringPK(String aString); + +    String getStringData(); +    void setStringData(String aData); +} diff --git a/src/test/java/com/amazon/carbonado/stored/StorableTimestamped.java b/src/test/java/com/amazon/carbonado/stored/StorableTimestamped.java new file mode 100644 index 0000000..d93ffeb --- /dev/null +++ b/src/test/java/com/amazon/carbonado/stored/StorableTimestamped.java @@ -0,0 +1,38 @@ +/*
 + * 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.Storable;
 +import com.amazon.carbonado.PrimaryKey;
 +
 +/**
 + * 
 + *
 + * @author Brian S O'Neill
 + */
 +@PrimaryKey("id")
 +public interface StorableTimestamped extends Storable, Timestamped {
 +    int getId();
 +    void setId(int id);
 +
 +    String getValue();
 +    void setValue(String str);
 +}
 diff --git a/src/test/java/com/amazon/carbonado/stored/StorableVersioned.java b/src/test/java/com/amazon/carbonado/stored/StorableVersioned.java new file mode 100644 index 0000000..2de9640 --- /dev/null +++ b/src/test/java/com/amazon/carbonado/stored/StorableVersioned.java @@ -0,0 +1,50 @@ +/*
 + * 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 com.amazon.carbonado.Nullable;
 +import com.amazon.carbonado.Storable;
 +import com.amazon.carbonado.PrimaryKey;
 +import com.amazon.carbonado.Version;
 +
 +/**
 + * 
 + *
 + * @author Brian S O'Neill
 + */
 +@PrimaryKey("ID")
 +public interface StorableVersioned extends Storable {
 +    int getID();
 +
 +    void setID(int id);
 +
 +    String getValue();
 +
 +    void setValue(String value);
 +
 +    @Nullable
 +    String getName();
 +
 +    void setName(String name);
 +
 +    @Version
 +    int getVersion();
 +
 +    void setVersion(int version);
 +}
 diff --git a/src/test/java/com/amazon/carbonado/stored/StorableVersionedIndexed.java b/src/test/java/com/amazon/carbonado/stored/StorableVersionedIndexed.java new file mode 100644 index 0000000..906e8be --- /dev/null +++ b/src/test/java/com/amazon/carbonado/stored/StorableVersionedIndexed.java @@ -0,0 +1,36 @@ +/*
 + * 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 com.amazon.carbonado.Index;
 +import com.amazon.carbonado.Indexes;
 +import com.amazon.carbonado.PrimaryKey;
 +
 +/**
 + * 
 + *
 + * @author Brian S O'Neill
 + */
 +@Indexes({
 +    @Index("value"),
 +    @Index("name")
 +})
 +@PrimaryKey("ID")
 +public interface StorableVersionedIndexed extends StorableVersioned {
 +}
 diff --git a/src/test/java/com/amazon/carbonado/stored/StorableVersionedWithLong.java b/src/test/java/com/amazon/carbonado/stored/StorableVersionedWithLong.java new file mode 100644 index 0000000..6d55d54 --- /dev/null +++ b/src/test/java/com/amazon/carbonado/stored/StorableVersionedWithLong.java @@ -0,0 +1,44 @@ +/*
 + * 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 com.amazon.carbonado.Storable;
 +import com.amazon.carbonado.PrimaryKey;
 +import com.amazon.carbonado.Version;
 +
 +/**
 + * 
 + *
 + * @author Brian S O'Neill
 + */
 +@PrimaryKey("ID")
 +public interface StorableVersionedWithLong extends Storable {
 +    int getID();
 +
 +    void setID(int id);
 +
 +    String getValue();
 +
 +    void setValue(String value);
 +
 +    @Version
 +    long getVersion();
 +
 +    void setVersion(long version);
 +}
 diff --git a/src/test/java/com/amazon/carbonado/stored/StorableVersionedWithLongObj.java b/src/test/java/com/amazon/carbonado/stored/StorableVersionedWithLongObj.java new file mode 100644 index 0000000..2acfdf8 --- /dev/null +++ b/src/test/java/com/amazon/carbonado/stored/StorableVersionedWithLongObj.java @@ -0,0 +1,46 @@ +/*
 + * 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 com.amazon.carbonado.Nullable;
 +import com.amazon.carbonado.Storable;
 +import com.amazon.carbonado.PrimaryKey;
 +import com.amazon.carbonado.Version;
 +
 +/**
 + * 
 + *
 + * @author Brian S O'Neill
 + */
 +@PrimaryKey("ID")
 +public interface StorableVersionedWithLongObj extends Storable {
 +    int getID();
 +
 +    void setID(int id);
 +
 +    String getValue();
 +
 +    void setValue(String value);
 +
 +    @Version
 +    @Nullable
 +    Long getVersion();
 +
 +    void setVersion(Long version);
 +}
 diff --git a/src/test/java/com/amazon/carbonado/stored/StorableVersionedWithObj.java b/src/test/java/com/amazon/carbonado/stored/StorableVersionedWithObj.java new file mode 100644 index 0000000..29f313c --- /dev/null +++ b/src/test/java/com/amazon/carbonado/stored/StorableVersionedWithObj.java @@ -0,0 +1,46 @@ +/*
 + * 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 com.amazon.carbonado.Nullable;
 +import com.amazon.carbonado.Storable;
 +import com.amazon.carbonado.PrimaryKey;
 +import com.amazon.carbonado.Version;
 +
 +/**
 + * 
 + *
 + * @author Brian S O'Neill
 + */
 +@PrimaryKey("ID")
 +public interface StorableVersionedWithObj extends Storable {
 +    int getID();
 +
 +    void setID(int id);
 +
 +    String getValue();
 +
 +    void setValue(String value);
 +
 +    @Version
 +    @Nullable
 +    Integer getVersion();
 +
 +    void setVersion(Integer version);
 +}
 diff --git a/src/test/java/com/amazon/carbonado/stored/Timestamped.java b/src/test/java/com/amazon/carbonado/stored/Timestamped.java new file mode 100644 index 0000000..b38ee28 --- /dev/null +++ b/src/test/java/com/amazon/carbonado/stored/Timestamped.java @@ -0,0 +1,34 @@ +/*
 + * 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;
 +
 +/**
 + * 
 + *
 + * @author Brian S O'Neill
 + */
 +public interface Timestamped {
 +    DateTime getSubmitDateTime();
 +    void setSubmitDateTime(DateTime dt);
 +
 +    DateTime getModifyDateTime();
 +    void setModifyDateTime(DateTime dt);
 +}
 diff --git a/src/test/java/com/amazon/carbonado/stored/UserAddress.java b/src/test/java/com/amazon/carbonado/stored/UserAddress.java new file mode 100644 index 0000000..466f6eb --- /dev/null +++ b/src/test/java/com/amazon/carbonado/stored/UserAddress.java @@ -0,0 +1,66 @@ +/*
 + * 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 com.amazon.carbonado.*;
 +
 +/**
 + * 
 + *
 + * @author Brian S O'Neill (boneill)
 + */
 +@Indexes({
 +    @Index({"country", "state", "city"}),
 +    @Index({"state", "city"}),
 +    @Index("city")
 +})
 +@PrimaryKey("addressID")
 +public abstract class UserAddress implements Storable<UserAddress> {
 +    public abstract int getAddressID();
 +    public abstract void setAddressID(int id);
 +
 +    public abstract String getLine1();
 +    public abstract void setLine1(String value);
 +
 +    @Nullable
 +    public abstract String getLine2();
 +    public abstract void setLine2(String value);
 +
 +    public abstract String getCity();
 +    public abstract void setCity(String value);
 +
 +    public abstract String getState();
 +    public abstract void setState(String value);
 +
 +    public abstract String getCountry();
 +    public abstract void setCountry(String value);
 +
 +    @Nullable
 +    public abstract String getPostalCode();
 +    public abstract void setPostalCode(String value);
 +
 +    @Nullable
 +    public abstract Integer getNeighborAddressID();
 +    public abstract void setNeighborAddressID(Integer id);
 +
 +    @Nullable
 +    @Join(internal="neighborAddressID", external="addressID")
 +    public abstract UserAddress getNeighbor() throws FetchException;
 +    public abstract void setNeighbor(UserAddress address) throws FetchException;
 +}
 diff --git a/src/test/java/com/amazon/carbonado/stored/UserInfo.java b/src/test/java/com/amazon/carbonado/stored/UserInfo.java new file mode 100644 index 0000000..e0bffa4 --- /dev/null +++ b/src/test/java/com/amazon/carbonado/stored/UserInfo.java @@ -0,0 +1,57 @@ +/*
 + * 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 com.amazon.carbonado.*;
 +import com.amazon.carbonado.constraint.*;
 +
 +/**
 + * 
 + *
 + * @author Brian S O'Neill (boneill)
 + */
 +@Indexes({
 +    @Index("firstName"),
 +    @Index("lastName"),
 +    @Index("addressID")
 +})
 +@PrimaryKey("userID")
 +public abstract class UserInfo implements Storable<UserInfo> {
 +    public abstract int getUserID();
 +    public abstract void setUserID(int id);
 +
 +    public abstract int getStateID();
 +    @IntegerConstraint(allowed={1, 2, 3})
 +    public abstract void setStateID(int state);
 +
 +    public abstract String getFirstName();
 +    @LengthConstraint(min=1, max=50)
 +    public abstract void setFirstName(String value);
 +
 +    public abstract String getLastName();
 +    @LengthConstraint(min=1, max=50)
 +    public abstract void setLastName(String value);
 +
 +    public abstract int getAddressID();
 +    public abstract void setAddressID(int id);
 +
 +    @Join
 +    public abstract UserAddress getAddress() throws FetchException;
 +    public abstract void setAddress(UserAddress address);
 +}
  | 
