Refactoring QueryTest class and entities

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@804068 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Dick 2009-08-14 01:59:56 +00:00
parent c9695c2fb9
commit 3f6ab72c52
10 changed files with 23 additions and 19 deletions

View File

@ -673,7 +673,7 @@
<exclude>org/apache/openjpa/persistence/annotations/TestEntityOrderBy.java</exclude>
<exclude>org/apache/openjpa/persistence/annotations/TestPropertyAccess.java</exclude>
<exclude>org/apache/openjpa/persistence/annotations/TestVersion.java</exclude>
<exclude>org/apache/openjpa/persistence/cache/TestQueryCache.java</exclude>
<exclude>org/apache/openjpa/persistence/querycache/TestQueryCache.java</exclude>
<exclude>org/apache/openjpa/persistence/conf/TestOpenJPAConfiguration.java</exclude>
<exclude>org/apache/openjpa/persistence/datacache/TestCacheMultiThreadedLoad.java</exclude>
<exclude>org/apache/openjpa/persistence/datacache/TestConcurrentDataCache.java</exclude>

View File

@ -27,10 +27,8 @@ import org.apache.openjpa.persistence.OpenJPAEntityManagerFactorySPI;
import org.apache.openjpa.persistence.OpenJPAEntityManagerSPI;
import org.apache.openjpa.persistence.StoreCache;
import org.apache.openjpa.persistence.StoreCacheImpl;
import org.apache.openjpa.persistence.cache.common.apps.
BidirectionalOne2OneOwned;
import org.apache.openjpa.persistence.cache.common.apps.
BidirectionalOne2OneOwner;
import org.apache.openjpa.persistence.querycache.common.apps.BidirectionalOne2OneOwned;
import org.apache.openjpa.persistence.querycache.common.apps.BidirectionalOne2OneOwner;
import org.apache.openjpa.persistence.common.utils.AbstractTestCase;
import org.apache.openjpa.persistence.datacache.common.apps.PObject;

View File

@ -16,15 +16,16 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.openjpa.persistence.cache;
package org.apache.openjpa.persistence.querycache;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.NamedQuery;
import org.apache.openjpa.persistence.cache.common.apps.Entity1;
import org.apache.openjpa.persistence.cache.common.apps.Entity2;
import org.apache.openjpa.persistence.common.utils.AbstractTestCase;
import org.apache.openjpa.persistence.querycache.common.apps.Entity1;
import org.apache.openjpa.persistence.querycache.common.apps.Entity2;
@NamedQuery(name = "setParam1",
query = "SELECT o FROM Entity1 o WHERE o.pk LIKE :pk")
@ -33,7 +34,7 @@ public class TestQueryCache extends AbstractTestCase {
EntityManager em;
public TestQueryCache(String name) {
super(name);
super(name, "");
System.setProperty("cactus.contextURL",
"http://localhost:9000/cachecactus");
em = currentEntityManager();
@ -111,7 +112,7 @@ public class TestQueryCache extends AbstractTestCase {
.executeUpdate();
assertEquals(ret, 1);
//cascade remove doesn't remove the entity2
// cascade remove doesn't remove the entity2
int retTmp = em.createQuery("Delete FROM Entity2 o WHERE o.pk LIKE :pk")
.setParameter("pk", entity1.getEntity2Field().getPk())
.executeUpdate();
@ -178,6 +179,11 @@ public class TestQueryCache extends AbstractTestCase {
endTx(em);
}
@Override
public String getPersistenceUnitName() {
return "QueryCache";
}
//rest of the interface is tested by the CTS
}

View File

@ -1,4 +1,4 @@
package org.apache.openjpa.persistence.cache.common.apps;
package org.apache.openjpa.persistence.querycache.common.apps;
import javax.persistence.*;
/*

View File

@ -17,7 +17,7 @@
* under the License.
*/
package org.apache.openjpa.persistence.cache.common.apps;
package org.apache.openjpa.persistence.querycache.common.apps;
import javax.persistence.*;

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.openjpa.persistence.cache.common.apps;
package org.apache.openjpa.persistence.querycache.common.apps;
import java.io.Serializable;
import javax.persistence.Basic;

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.openjpa.persistence.cache.common.apps;
package org.apache.openjpa.persistence.querycache.common.apps;
import java.io.Serializable;
import javax.persistence.Basic;

View File

@ -17,7 +17,7 @@
* under the License.
*/
package org.apache.openjpa.persistence.cache.common.apps;
package org.apache.openjpa.persistence.querycache.common.apps;
import javax.persistence.*;
/**

View File

@ -17,7 +17,7 @@
* under the License.
*/
package org.apache.openjpa.persistence.cache.common.apps;
package org.apache.openjpa.persistence.querycache.common.apps;
import javax.persistence.*;

View File

@ -22,8 +22,8 @@
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
version="1.0">
<persistence-unit name="TestConv" transaction-type="RESOURCE_LOCAL">
<class>org.apache.openjpa.persistence.cache.common.apps.Entity1</class>
<class>org.apache.openjpa.persistence.cache.common.apps.Entity2</class>
<persistence-unit name="QueryCache" transaction-type="RESOURCE_LOCAL">
<class>org.apache.openjpa.persistence.querycache.common.apps.Entity1</class>
<class>org.apache.openjpa.persistence.querycache.common.apps.Entity2</class>
</persistence-unit>
</persistence>