Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 126863 Details for
Bug 265885
Need to get JPA/StructConverter test model working on Server and make modification to JPA/Lob model
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
added new test to StructConverterServerTestSuite.java
bug265885_new.patch (text/plain), 12.03 KB, created by
Yiping Zhao
on 2009-02-26 11:05:00 EST
(
hide
)
Description:
added new test to StructConverterServerTestSuite.java
Filename:
MIME Type:
Creator:
Yiping Zhao
Created:
2009-02-26 11:05:00 EST
Size:
12.03 KB
patch
obsolete
>Index: foundation/eclipselink.extension.oracle.test/src/org/eclipse/persistence/testing/tests/jpa/structconverter/StructConverterServerTestSuite.java >=================================================================== >--- foundation/eclipselink.extension.oracle.test/src/org/eclipse/persistence/testing/tests/jpa/structconverter/StructConverterServerTestSuite.java (revision 0) >+++ foundation/eclipselink.extension.oracle.test/src/org/eclipse/persistence/testing/tests/jpa/structconverter/StructConverterServerTestSuite.java (revision 0) >@@ -0,0 +1,158 @@ >+/******************************************************************************* >+ * Copyright (c) 1998, 2008 Oracle. All rights reserved. >+ * This program and the accompanying materials are made available under the >+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 >+ * which accompanies this distribution. >+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html >+ * and the Eclipse Distribution License is available at >+ * http://www.eclipse.org/org/documents/edl-v10.php. >+ * >+ * Contributors: >+ * Oracle - initial API and implementation from Oracle TopLink >+ ******************************************************************************/ >+package org.eclipse.persistence.testing.tests.jpa.structconverter; >+ >+import javax.persistence.EntityManager; >+ >+import junit.extensions.TestSetup; >+import junit.framework.Test; >+import junit.framework.TestSuite; >+import oracle.spatial.geometry.JGeometry; >+ >+import org.eclipse.persistence.expressions.Expression; >+import org.eclipse.persistence.expressions.ExpressionBuilder; >+import org.eclipse.persistence.expressions.spatial.SpatialExpressionFactory; >+import org.eclipse.persistence.expressions.spatial.SpatialParameters; >+import org.eclipse.persistence.expressions.spatial.SpatialParameters.Mask; >+import org.eclipse.persistence.queries.ReadAllQuery; >+import org.eclipse.persistence.platform.database.converters.StructConverter; >+ >+import org.eclipse.persistence.testing.framework.junit.JUnitTestCase; >+import org.eclipse.persistence.testing.models.jpa.structconverter.SimpleSpatial; >+import org.eclipse.persistence.testing.models.jpa.structconverter.SimpleXMLSpatial; >+import org.eclipse.persistence.testing.models.jpa.structconverter.JGeometryTableCreator; >+import org.eclipse.persistence.testing.models.jpa.structconverter.DummyStructConverterType; >+ >+/** >+ * TestSuite to ensure Annotation-based struct converters get properly added to the project >+ * >+ * This test suite ensures the project is properly set-up and does a sanity test using one of the >+ * converters. Other tests are handled by the StructConverter tests suites in the TestBrowser. >+ * >+ */ >+public class StructConverterServerTestSuite extends JUnitTestCase { >+ >+ public static final String STRUCT_CONVERTER_PU = "structConverter"; >+ >+ public StructConverterServerTestSuite(){ >+ } >+ >+ public StructConverterServerTestSuite(String name){ >+ super(name); >+ } >+ >+ public static Test suite() { >+ TestSuite suite = new TestSuite(); >+ suite.setName("Struct Converter Test Suite"); >+ suite.addTest(new StructConverterServerTestSuite("testSetup")); >+ suite.addTest(new StructConverterServerTestSuite("testPlatform")); >+ suite.addTest(new StructConverterServerTestSuite("testSimpleSpatialWrite")); >+ suite.addTest(new StructConverterServerTestSuite("testSimpleReadQuery")); >+ return suite; >+ } >+ >+ public void testSetup() { >+ clearCache(); >+ getServerSession(STRUCT_CONVERTER_PU).executeNonSelectingSQL("DELETE FROM USER_SDO_GEOM_METADATA WHERE TABLE_NAME = 'JPA_JGEOMETRY'"); >+ new JGeometryTableCreator().replaceTables(JUnitTestCase.getServerSession(STRUCT_CONVERTER_PU)); >+ getServerSession(STRUCT_CONVERTER_PU).executeNonSelectingSQL("INSERT INTO USER_SDO_GEOM_METADATA(TABLE_NAME, COLUMN_NAME, DIMINFO) VALUES('JPA_JGEOMETRY', 'JGEOMETRY'," + >+ " mdsys.sdo_dim_array(mdsys.sdo_dim_element('X', -100, 100, 0.005), mdsys.sdo_dim_element('Y', -100, 100, 0.005)))"); >+ >+ getServerSession(STRUCT_CONVERTER_PU).executeNonSelectingSQL("CREATE INDEX test_idx on JPA_JGEOMETRY(jgeometry) indextype is mdsys.spatial_index parameters ('sdo_level=5 sdo_numtiles=6')"); >+ } >+ >+ /** >+ * Ensure the DatabasePlatform is setup with the proper StructConverters >+ */ >+ public void testPlatform(){ >+ EntityManager em = createEntityManager(STRUCT_CONVERTER_PU); >+ try{ >+ // trigger deploy >+ em.find(SimpleSpatial.class, new Long(1)); >+ } catch (Exception e){}; >+ >+ StructConverter converter = getServerSession(STRUCT_CONVERTER_PU).getPlatform().getTypeConverters().get(JGeometry.class); >+ assertNotNull("Platform does not have correct JGeometryConverter.", converter); >+ assertTrue("JGeometery struct converter is wrong type.", converter.getClass().getName().indexOf("JGeometryConverter") >= 0); >+ >+ converter = getServerSession(STRUCT_CONVERTER_PU).getPlatform().getTypeConverters().get(DummyStructConverterType.class); >+ assertNotNull("Platform does not have correct DummyStructConverter.", converter); >+ assertTrue("JGeometery struct converter is wrong type.", converter.getClass().getName().indexOf("DummyStructConverter") >= 0); >+ } >+ >+ /** >+ * Sanity test to ensure a read and a write with a Converter specified by >+ * annotations work properly >+ */ >+ public void testSimpleSpatialWrite(){ >+ EntityManager em = createEntityManager(STRUCT_CONVERTER_PU); >+ >+ beginTransaction(em); >+ SimpleSpatial simpleSpatial = new SimpleSpatial(1000, pointCluster1()); >+ em.persist(simpleSpatial); >+ em.flush(); >+ >+ em.clear(); >+ >+ simpleSpatial = em.find(SimpleSpatial.class, new Long(1000)); >+ >+ assertNotNull("JGeometry was not properly read in.", simpleSpatial.getJGeometry()); >+ rollbackTransaction(em); >+ } >+ >+ /** >+ * Tests if SpatialExpressions will work properly without hung up when using ANYINTERACT query type >+ */ >+ public void testSimpleReadQuery(){ >+ >+ JGeometry circle = JGeometry.createCircle(-10, 0, 0, 10, 10, 0, 0); >+ JGeometry newCircle = JGeometry.createCircle(0, -10, 0, 10, 10, 0, 0); >+ EntityManager em = createEntityManager(); >+ try{ >+ beginTransaction(em); >+ SimpleSpatial simpleSpatial = new SimpleSpatial(2000, circle); >+ em.persist(simpleSpatial); >+ commitTransaction(em); >+ }catch (RuntimeException ex){ >+ if (isTransactionActive(em)){ >+ rollbackTransaction(em); >+ } >+ throw ex; >+ } >+ >+ clearCache(STRUCT_CONVERTER_PU); >+ >+ ReadAllQuery raq = new ReadAllQuery(SimpleSpatial.class); >+ ExpressionBuilder eb = raq.getExpressionBuilder(); >+ >+ SpatialParameters parameters = new SpatialParameters(); >+ parameters.setQueryType(SpatialParameters.QueryType.WINDOW).setMask(Mask.ANYINTERACT); >+ Expression selectionCriteria = SpatialExpressionFactory.relate(eb.get("jGeometry"), newCircle, parameters); >+ raq.setSelectionCriteria(selectionCriteria); >+ raq.addAscendingOrdering("id"); >+ getServerSession(STRUCT_CONVERTER_PU).executeQuery(raq); >+ } >+ >+ /** >+ * mdsys.sdo_geometry(5, >+ * NULL, null, >+ * mdsys.sdo_elem_info_array(1,1,3), >+ * mdsys.sdo_ordinate_array(1.1, 1.1, 2.2, 2.2, 3.3, 4.4))); >+ */ >+ public JGeometry pointCluster1() { >+ Object[] points = >+ new Object[] { new double[] { 1.1, 1.1 }, new double[] { 2.2, 2.2 }, >+ new double[] { 3.3, 4.4 } }; >+ return JGeometry.createMultiPoint(points, 2, 0); >+ } >+} >Index: jpa/eclipselink.jpa.test/build.xml >=================================================================== >--- jpa/eclipselink.jpa.test/build.xml (revision 3503) >+++ jpa/eclipselink.jpa.test/build.xml (working copy) >@@ -174,6 +174,7 @@ > <path id="compile.server.path"> > <path refid="compile.path"/> > <pathelement path="${jdbc.driver.jar}"/> >+ <pathelement path="${oracle.extensions.depend.dir}/${oracle.spatial.lib}"/> > </path> > </target> > >@@ -1170,6 +1171,7 @@ > <antcall target="server-test-xmltest" inheritRefs="true"/> > <antcall target="server-test-oracle-timestamptz" inheritRefs="true"/> > <antcall target="server-test-custom-features" inheritRefs="true"/> >+ <antcall target="server-test-struct-converter" inheritRefs="true"/> > <antcall target="generate-report" inheritRefs="true"/> > </target> > >@@ -1458,6 +1460,31 @@ > </antcall> > </target> > >+ <target name="server-test-struct-converter" if="is.oracle"> >+ <echo message="Creating MY_GEOMETRY datatype for spatial tests: ${db.url}..."/> >+ <sql driver="${db.driver}" >+ url="${db.url}" >+ userid="${db.user}" >+ password="${db.pwd}" >+ onerror="continue" >+ > >+ <classpath> >+ <pathelement location="${jdbc.driver.jar}"/> >+ </classpath> >+CREATE OR REPLACE TYPE MY_GEOMETRY AS OBJECT (id NUMBER, geom MDSYS.SDO_GEOMETRY); >+ </sql> >+ <antcall target="server-run-all" inheritRefs="true"> >+ <param name="PERSISTENCE_UNIT_NAME" value="structConverter"/> >+ <param name="MODEL_DIR" value="org/eclipse/persistence/testing/models/jpa/structconverter"/> >+ <param name="MODEL_NAME" value="eclipselink-structconverter-model"/> >+ <param name="TEST_DIR" value="org/eclipse/persistence/testing/tests/jpa/structconverter"/> >+ <param name="TEST_NAME" value="eclipselink-structconverter-model"/> >+ <param name="EAR_NAME" value="eclipselink-structconverter-model"/> >+ <param name="TEST_SUITE" value="org.eclipse.persistence.testing.tests.jpa.structconverter.StructConverterServerTestSuite"/> >+ <param name="eclipselink.jpa.test.dir" value="./../../foundation/eclipselink.extension.oracle.test"/> >+ </antcall> >+ </target> >+ > <!-- *********** CacheCoordination Test Targets --> > <target name="server-start-cachecoordination" depends="detect-os,config-trunk, config-flat"> > <ant antfile="${eclipselink.jpa.test}/cachecoordination_${server.name}.xml" target="${server.name}-start-cachecoordination" inheritRefs="true"/> >Index: jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/tests/jpa/lob/LobJUnitTestCase.java >=================================================================== >--- jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/tests/jpa/lob/LobJUnitTestCase.java (revision 3501) >+++ jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/tests/jpa/lob/LobJUnitTestCase.java (working copy) >@@ -64,7 +64,8 @@ > EntityManager em = createEntityManager(); > beginTransaction(em); > try { >- Image image = ImageSimulator.generateImage(1000, 800); >+ //Image image = ImageSimulator.generateImage(1000, 800); >+ Image image = ImageSimulator.generateImage(4800, 4500); > originalImage = image; > em.persist(image); > imageId = image.getId(); >Index: jpa/eclipselink.jpa.test/weblogic.xml >=================================================================== >--- jpa/eclipselink.jpa.test/weblogic.xml (revision 3503) >+++ jpa/eclipselink.jpa.test/weblogic.xml (working copy) >@@ -76,6 +76,7 @@ > <copy file="${eclipselink.jar.name}" todir="${weblogic.domain}/lib"/> > <copy file="${jdbc.driver.jar}" todir="${weblogic.domain}/lib"/> > <copy file="${oracle.extensions.depend.dir}/${oracle.xdb.lib}" todir="${weblogic.domain}/lib"/> >+ <copy file="${oracle.extensions.depend.dir}/${oracle.spatial.lib}" todir="${weblogic.domain}/lib"/> > <antcall target="weblogic-stop" inheritRefs="true"/> > </target> >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 265885
:
126607
| 126863