From 59bd5b0d3f891f16d7f9ca93dea13b40c082c11d Mon Sep 17 00:00:00 2001 From: Michael Dick Date: Wed, 9 May 2007 23:05:16 +0000 Subject: [PATCH] OPENJPA-51 removing testcases git-svn-id: https://svn.apache.org/repos/asf/incubator/openjpa/trunk@536706 13f79535-47bb-0310-9956-ffa450edef68 --- .../persistence/query/CustomerEntity.java | 87 ----------------- .../persistence/query/OrderEntity.java | 80 ---------------- .../persistence/query/TestSubQuery.java | 94 ------------------- 3 files changed, 261 deletions(-) delete mode 100644 openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/CustomerEntity.java delete mode 100644 openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/OrderEntity.java delete mode 100644 openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestSubQuery.java diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/CustomerEntity.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/CustomerEntity.java deleted file mode 100644 index 594b66844..000000000 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/CustomerEntity.java +++ /dev/null @@ -1,87 +0,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. - */ -package org.apache.openjpa.persistence.query; - -import javax.persistence.*; - -import java.util.Collection; -import java.util.ArrayList; - -@Entity(name="Customer") -@Table(name="CUSTOMERTB") -public class CustomerEntity { - - public enum CreditRating { POOR, GOOD, EXCELLENT }; - - @Id - @GeneratedValue - long cid; - @Column(length=30) - String name; - @Enumerated - CreditRating creditRating; - @Version - long version; - - @OneToMany(fetch=FetchType.LAZY, mappedBy="customer") - private Collection orders = new ArrayList(); - - public CustomerEntity() {} - - public CustomerEntity(String name, CreditRating rating){ - this.name=name; - this.creditRating=rating; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public CreditRating getRating() { - return creditRating; - } - - public void setRating(CreditRating rating) { - this.creditRating = rating; - } - - public Collection getOrders() { - return orders; - } - - public void setOrders(Collection orders) { - this.orders = orders; - } - - public String toString() { - return "Customer:"+cid+" name:"+name; - } - - public long getCid() { - return cid; - } - - public void setCid(long cid) { - this.cid = cid; - } -} diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/OrderEntity.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/OrderEntity.java deleted file mode 100644 index a09f3ecb0..000000000 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/OrderEntity.java +++ /dev/null @@ -1,80 +0,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. - */ -package org.apache.openjpa.persistence.query; - -import javax.persistence.*; - -@Entity(name="Order") -@Table(name="ORDERTB") -public class OrderEntity { - @Id - @GeneratedValue - int oid; - - double amount; - boolean delivered; - - @ManyToOne - CustomerEntity customer; - - @Version - long version; - - public OrderEntity(){} - - public OrderEntity( double amt, boolean delivered, CustomerEntity c){ - amount=amt; - this.delivered=delivered; - customer=c; - if (c!=null) c.getOrders().add(this); - } - - public double getAmount() { - return amount; - } - - public void setAmount(double amount) { - this.amount = amount; - } - - public CustomerEntity getCustomer() { - return customer; - } - - public void setCustomer(CustomerEntity customer) { - this.customer = customer; - } - - public boolean isDelivered() { - return delivered; - } - - public void setDelivered(boolean delivered) { - this.delivered = delivered; - } - - public int getOid() { - return oid; - } - - public String toString(){ - return "Order:"+oid+" amount:"+amount+" delivered:"+delivered+" customer:"+ - ( customer!=null ? customer.getCid() : -1 ); - } -} diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestSubQuery.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestSubQuery.java deleted file mode 100644 index f2eab7afc..000000000 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestSubQuery.java +++ /dev/null @@ -1,94 +0,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. - */ -package org.apache.openjpa.persistence.query; - -import java.util.List; -import javax.persistence.EntityManager; - -import junit.textui.TestRunner; -import org.apache.openjpa.persistence.test.SingleEMFTestCase; - -/** - * Test queries with subselects - * - * @author Catalina Wei - */ -public class TestSubQuery - extends SingleEMFTestCase { - - public void setUp() { - setUp(CustomerEntity.class, CustomerEntity.class, - OrderEntity.class, OrderEntity.class); - } - - public void testQuery() { - EntityManager em = emf.createEntityManager(); - String[] query = new String[] { - "select o from Customer c, in(c.orders) o where o.amount > " - + "(select avg(o.amount) from Order o)", - "select c from Customer c, in(c.orders) o where o.amount > " - + "(select avg(o.amount) from in(c.orders) o)", - "select c from Customer c where " - + "((select sum(o.amount) from Order o where o.customer = c) " - + "between 100 and 200) order by c.name", - "select o from Order o where o.amount < " - + "(select max(o2.amount) from Order o2 where " - + "o2.amount = o.amount)", - "select o from Order o where o.amount > " - + "(select avg(o.amount) from Customer c, in(c.orders) o)", - "select o.oid from Order o where o.amount > 10 " - + "and o.amount < (select min(o2.amount) from Order o2 where " - + "o2.amount > 0)", - "select o from Order o where o.amount > any " - + "(select o.amount from Customer c, in (c.orders) o where " - + "c.cid = 1)", - "select o from Order o where o.amount between " - + "(select min(o.amount) from Customer c, in(c.orders) o) and " - + "(select avg(o.amount) from Customer c, in(c.orders) o)" - }; - - int failures = 0; - for (int i=0; i