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 126607 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]
Make JPA/StructConverter model working on server and make modifications to JPA/Lob model
bug265885.patch (text/plain), 9.29 KB, created by
Yiping Zhao
on 2009-02-24 15:22:35 EST
(
hide
)
Description:
Make JPA/StructConverter model working on server and make modifications to JPA/Lob model
Filename:
MIME Type:
Creator:
Yiping Zhao
Created:
2009-02-24 15:22:35 EST
Size:
9.29 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,114 @@ >+/******************************************************************************* >+ * 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.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. >+ * @author tware >+ * >+ */ >+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")); >+ return suite; >+ } >+ >+ public void testSetup() { >+ clearCache(); >+ new JGeometryTableCreator().replaceTables(JUnitTestCase.getServerSession(STRUCT_CONVERTER_PU)); >+ } >+ >+ /** >+ * 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); >+ } >+ >+ /** >+ * 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> > >@@ -1458,6 +1459,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