View | Details | Raw Unified | Return to bug 301295 | Differences between
and this patch

Collapse All | Expand All

(-)build.xml (+1 lines)
Lines 99-104 Link Here
99
    <echo message="user.home            = '${user.home}'"/>
99
    <echo message="user.home            = '${user.home}'"/>
100
    <echo message="Loading user properties from: '${user.home}/build.properties'"/>
100
    <echo message="Loading user properties from: '${user.home}/build.properties'"/>
101
    <property file="${user.home}/build.properties"/>
101
    <property file="${user.home}/build.properties"/>
102
    <property file="${user.home}/test.properties"/>
102
    <!-- Sets default junit.lib and all extensions.depend dir locations to static paths -->
103
    <!-- Sets default junit.lib and all extensions.depend dir locations to static paths -->
103
    <!-- temporary until all build files reworked -->
104
    <!-- temporary until all build files reworked -->
104
    <property name="oracle.extensions.depend.dir" value="${trunk.build.location}/../extension.oracle.lib.external"/>
105
    <property name="oracle.extensions.depend.dir" value="${trunk.build.location}/../extension.oracle.lib.external"/>
(-)jpa/eclipselink.jpa.test/jboss.properties (-1 / +4 lines)
Lines 19-24 Link Here
19
#persistence10.jar=${jboss.server}/lib/ejb3-persistence.jar
19
#persistence10.jar=${jboss.server}/lib/ejb3-persistence.jar
20
20
21
## JBoss 5.1.x specific properties.
21
## JBoss 5.1.x specific properties.
22
jboss.home=../../../jboss-5.1.0.GA
22
jboss.home=C:/jboss-5.1.0.GA
23
server.testrunner=TestRunner/remote-org.eclipse.persistence.testing.framework.server.TestRunner
23
server.testrunner=TestRunner/remote-org.eclipse.persistence.testing.framework.server.TestRunner
24
server.testrunner.wdf=ServerTestRunnerImpl/remote-org.eclipse.persistence.testing.framework.wdf.server.ServerTestRunner
24
persistence10.jar=${jboss.home}/common/lib/ejb3-persistence.jar
25
persistence10.jar=${jboss.home}/common/lib/ejb3-persistence.jar
26
27
(-)jpa/eclipselink.jpa.test/netweaver.properties (+2 lines)
Lines 44-49 Link Here
44
# DO NOT CHANGE
44
# DO NOT CHANGE
45
####################################
45
####################################
46
server.testrunner=JavaEE/servertest/REMOTE/TestRunner/org.eclipse.persistence.testing.framework.server.TestRunner
46
server.testrunner=JavaEE/servertest/REMOTE/TestRunner/org.eclipse.persistence.testing.framework.server.TestRunner
47
server.testrunner.wdf=JavaEE/servertest/REMOTE/ServerTestRunnerImpl/org.eclipse.persistence.testing.framework.wdf.server.ServerTestRunner
47
server.lib=${netweaver.instance.dir}/j2ee/j2eeclient
48
server.lib=${netweaver.instance.dir}/j2ee/j2eeclient
48
server.platform=NetWeaver_7_1
49
server.platform=NetWeaver_7_1
49
#server.platform=org.eclipse.persistence.platform.server.sap.SAPNetWeaver_7_1_Platform
50
#server.platform=org.eclipse.persistence.platform.server.sap.SAPNetWeaver_7_1_Platform
Lines 57-59 Link Here
57
netweaver.deployment.dir=${netweaver.instance.dir}/j2ee/deployment
58
netweaver.deployment.dir=${netweaver.instance.dir}/j2ee/deployment
58
netweaver.deployment.ant.dir=${netweaver.deployment.dir}/ant/lib
59
netweaver.deployment.ant.dir=${netweaver.deployment.dir}/ant/lib
59
eclipselink.home=../..
60
eclipselink.home=../..
61
extensions.home=../../../incubator/extensions/trunk
(-)jpa/eclipselink.jpa.wdf.test/build.xml (-18 / +210 lines)
Lines 29-40 Link Here
29
*   - Ant properties are lower case.
29
*   - Ant properties are lower case.
30
*
30
*
31
* Contributors:
31
* Contributors:
32
*     tware - initial API and implementation
32
*     tware -  initial API and implementation
33
*     egwin   Update and add to nightly process.
33
*     egwin    Update and add to nightly process.
34
*     agoerler prepare for server-tests
34
#******************************************************************************/-->
35
#******************************************************************************/-->
35
36
36
<!-- This ant project includes the following tasks:
37
<!-- This ant project includes the following tasks:
37
        - all (default) : compiles all JPA tests, packages test jars
38
        - build (default) : compiles all JPA tests, packages test jars
38
        - compile : compiles all JPA tests
39
        - compile : compiles all JPA tests
39
        - package : jars JPA persistent units and tests jars
40
        - package : jars JPA persistent units and tests jars
40
        - test : runs als JPA WDF tests
41
        - test : runs als JPA WDF tests
Lines 63-68 Link Here
63
    <property name="wdf_test.2.moxy.dir"           value="${wdf_test.2.trunk.dir}/moxy/org.eclipse.persistence.moxy"/>
64
    <property name="wdf_test.2.moxy.dir"           value="${wdf_test.2.trunk.dir}/moxy/org.eclipse.persistence.moxy"/>
64
    <property name="wdf_test.2.core.test.dir"      value="${wdf_test.2.trunk.dir}/foundation/eclipselink.core.test"/>
65
    <property name="wdf_test.2.core.test.dir"      value="${wdf_test.2.trunk.dir}/foundation/eclipselink.core.test"/>
65
    <property name="env" environment="env"         value="env"/>
66
    <property name="env" environment="env"         value="env"/>
67
    <property name="eclipselink.jpa.test"          value="../eclipselink.jpa.test"/>
66
68
67
    <!-- Allows a user to overide certain user specific properties. -->
69
    <!-- Allows a user to overide certain user specific properties. -->
68
    <property file="${user.home}/build.properties"/>
70
    <property file="${user.home}/build.properties"/>
Lines 76-84 Link Here
76
    <target name="build-against-jar"     depends="clean, init_against_jar, compile, package"                description="build JPA WDF testing jars"/>
78
    <target name="build-against-jar"     depends="clean, init_against_jar, compile, package"                description="build JPA WDF testing jars"/>
77
    <target name="build-against-classes" depends="clean, init_against_classes, compile, package"            description="build JPA WDF testing jars"/>
79
    <target name="build-against-classes" depends="clean, init_against_classes, compile, package"            description="build JPA WDF testing jars"/>
78
    <target name="build-against-bundles" depends="clean, init_against_bundles, compile, package"            description="build JPA WDF testing jars"/>
80
    <target name="build-against-bundles" depends="clean, init_against_bundles, compile, package"            description="build JPA WDF testing jars"/>
79
    <target name="test-against-jar"      depends="clean-test, init_against_jar, init_runtime, test-lrg"     description="run JPA WDF tests"/>
81
    <target name="test-against-jar"      depends="clean-test, init_against_jar, init_runtime,  test-lrg"     description="run JPA WDF tests"/>
80
    <target name="test-against-classes"  depends="clean-test, init_against_classes, init_runtime, test-lrg" description="run JPA WDF tests"/>
82
    <target name="test-against-classes"  depends="clean-test, init_against_classes, init_runtime, test-lrg" description="run JPA WDF tests"/>
81
    <target name="test-against-bundles"  depends="clean-test, init_against_bundles, init_runtime, test-lrg" description="run JPA WDF tests"/>
83
    <target name="test-against-bundles"  depends="clean-test, init_against_bundles, init_runtime, test-lrg" description="run JPA WDF tests"/>
84
    <target name="server-test"           depends="server-test-internal" description="run JPA WDF tests on server configured by property server.name"/>
82
    <!-- convienience targets -->
85
    <!-- convienience targets -->
83
    <target name="build"     depends="build-against-jar"/>
86
    <target name="build"     depends="build-against-jar"/>
84
    <target name="test"      depends="test-against-jar"/>
87
    <target name="test"      depends="test-against-jar"/>
Lines 100-110 Link Here
100
            <pathelement path="${wdf_test.2.core.test.dir}/${classes.dir}"/>
103
            <pathelement path="${wdf_test.2.core.test.dir}/${classes.dir}"/>
101
            <pathelement path="${wdf_test.2.core.test.dir}/${eclipselink.tests.jar}"/>
104
            <pathelement path="${wdf_test.2.core.test.dir}/${eclipselink.tests.jar}"/>
102
            <pathelement path="${wdf_test.2.jpa.plugins.dir}/${persistence20.jar}"/>
105
            <pathelement path="${wdf_test.2.jpa.plugins.dir}/${persistence20.jar}"/>
106
            <pathelement path="${wdf_test.2.common.plugins.dir}/${ejb.jar}"/>
103
            <!-- These paths are unneeded for compile or run (from core.depend) may be needed in future -->
107
            <!-- These paths are unneeded for compile or run (from core.depend) may be needed in future -->
104
            <!-- pathelement path="${wdf_test.2.common.plugins.dir}/${unsigned.persistence10.jar}"/ -->
108
            <!-- pathelement path="${wdf_test.2.common.plugins.dir}/${unsigned.persistence10.jar}"/ -->
105
            <!-- pathelement path="${wdf_test.2.common.plugins.dir}/${activation.jar}"/ -->
109
            <!-- pathelement path="${wdf_test.2.common.plugins.dir}/${activation.jar}"/ -->
106
            <!-- pathelement path="${wdf_test.2.common.plugins.dir}/${resource.jar}"/ -->
110
            <!-- pathelement path="${wdf_test.2.common.plugins.dir}/${resource.jar}"/ -->
107
            <!-- pathelement path="${wdf_test.2.common.plugins.dir}/${ejb.jar}"/ -->
108
            <!-- pathelement path="${wdf_test.2.common.plugins.dir}/${jms.jar}"/ -->
111
            <!-- pathelement path="${wdf_test.2.common.plugins.dir}/${jms.jar}"/ -->
109
            <!-- pathelement path="${wdf_test.2.common.plugins.dir}/${stax_api.jar}"/ -->
112
            <!-- pathelement path="${wdf_test.2.common.plugins.dir}/${stax_api.jar}"/ -->
110
            <!-- pathelement path="${wdf_test.2.common.plugins.dir}/${mail.jar}"/ -->
113
            <!-- pathelement path="${wdf_test.2.common.plugins.dir}/${mail.jar}"/ -->
Lines 178-210 Link Here
178
                <path refid="compile.path"/>
181
                <path refid="compile.path"/>
179
            </classpath>
182
            </classpath>
180
        </javac>
183
        </javac>
184
        <javac
185
            srcdir="${wdf_test.2.core.test.dir}/${src.dir}"
186
               destdir="${classes.dir}"
187
               debug="${javac.debug}"
188
               debuglevel="${javac.debuglevel}"
189
               optimize="${javac.optimize}"
190
               source="${javac.version}"
191
               target="${javac.version}"
192
               deprecation="${javac.deprecation}"
193
               failonerror="true"
194
            includes="org/eclipse/persistence/testing/framework/junit/**,
195
                org/eclipse/persistence/testing/framework/AutoVerifyTestCase.java,
196
                org/eclipse/persistence/testing/framework/TestCase.java,
197
                org/eclipse/persistence/testing/framework/TestEntity.java,
198
                org/eclipse/persistence/testing/framework/TestModel.java,
199
                org/eclipse/persistence/testing/framework/*TestHelper.java,
200
                org/eclipse/persistence/testing/framework/QuerySQLTracker.java,
201
                org/eclipse/persistence/testing/framework/TestWarningException.java,
202
                org/eclipse/persistence/testing/framework/TestException.java,
203
                org/eclipse/persistence/testing/framework/TestErrorException.java,
204
                org/eclipse/persistence/testing/framework/TestProblemException.java,
205
                org/eclipse/persistence/testing/framework/ResultInterface.java,
206
                org/eclipse/persistence/testing/framework/TestCollection.java,
207
                org/eclipse/persistence/testing/framework/PerformanceComparisonTest.java,
208
                org/eclipse/persistence/testing/framework/PerformanceComparisonTestCase.java,
209
                org/eclipse/persistence/testing/framework/TestResult.java,
210
                org/eclipse/persistence/testing/framework/PerformanceComparisonTestResult.java,
211
                org/eclipse/persistence/testing/framework/PerformanceRegressionTest.java,
212
                org/eclipse/persistence/testing/framework/PerformanceRegressionTestCase.java,
213
                org/eclipse/persistence/testing/framework/ConcurrencyTestAdapter.java,
214
                org/eclipse/persistence/testing/framework/ConcurrentPerformanceComparisonTest.java,
215
                org/eclipse/persistence/testing/framework/ConcurrentPerformanceRegressionTest.java">
216
            <classpath refid="compile.path"/>
217
        </javac>
181
    </target>
218
    </target>
219
    
220
    <target name="get-server-properties">
221
        <property file="${user.home}/${server.name}.properties"/>
222
        <property file="${eclipselink.jpa.test}/${server.name}.properties"/>
223
        <echo message="server.lib=${server.lib}"/>
224
        <echo message="server.depend=${server.depend}"/>
225
        <echo message="server.name=${server.name}"/>
226
        <echo message="server.platform=${server.platform}"/>
227
    </target>
182
228
183
    <!-- Packages JPA persistent unit test jars. -->
229
    <!-- Packages JPA persistent unit test jars. -->
184
    <target name="package" depends="package-wdf-jpa2-model, package-wdf-jpa1-model" description="build EclipseLink jar">
230
    <target name="package" depends="package-tests, package-wdf-jpa2-model, package-wdf-jpa1-model" description="build EclipseLink jar"/>
231
    
232
233
    <target name="package-tests" depends="get-server-properties">
234
        <mkdir dir="${wdf_test.build.location}/stage"/>
235
        <filter token="server.user" value="${server.user}"/>
236
        <filter token="server.pwd" value="${server.pwd}"/>
237
        <filter token="server.factory" value="${server.factory}"/>
238
        <echo message="eclipselink.jpa.test=${eclipselink.jpa.test}"/>
239
        
240
        <copy file="${wdf_test.build.location}/../eclipselink.jpa.test/resource/server/jndi.properties" todir="stage" filtering="true"/> 
241
185
        <jar jarfile="${wdf_test.build.location}/${eclipselink.tests.jar}">
242
        <jar jarfile="${wdf_test.build.location}/${eclipselink.tests.jar}">
243
           <zipfileset dir="${wdf_test.build.location}/resource/ejb" includes="*.xml" prefix="META-INF"/>
186
           <fileset dir="${wdf_test.build.location}/${classes.dir}"
244
           <fileset dir="${wdf_test.build.location}/${classes.dir}"
187
                    includes="org/eclipse/persistence/testing/framework/**/*.class,
245
                    includes="org/eclipse/persistence/testing/framework/**/*.class,
188
                        org/eclipse/persistence/testing/tests/**/*.class"/>
246
                        org/eclipse/persistence/testing/tests/**/*.class"/>
247
           <fileset dir="${wdf_test.build.location}/stage"
248
                    includes="jndi.properties"/>
189
        </jar>
249
        </jar>
250
        <delete dir="stage"/> 
190
    </target>
251
    </target>
191
252
192
    <target name="package-wdf-jpa2-model">
253
    <target name="package-model" depends="get-server-properties,set-app-name">
193
        <jar jarfile="${wdf_test.build.location}/${eclipselink.wdf.jpa2.model}.jar">
254
        <copy overwrite="true" file="${wdf_test.build.location}/resource/${MODEL}/persistence.xml" todir="${build.dir}/META-INF"/>
194
            <zipfileset dir="${wdf_test.build.location}/resource/${eclipselink.wdf.jpa2.model}" includes="*.xml" prefix="META-INF"/>
255
        <replace dir="${build.dir}/META-INF" token='%%database-platform%%' value="${db.platform}">
256
            <include name="persistence.xml"/>
257
        </replace>
258
        <replace dir="${build.dir}/META-INF" token='%%data-source-name%%' value="${DS_NAME}">
259
            <include name="persistence.xml"/>
260
        </replace>
261
        <replace dir="${build.dir}/META-INF" token='%%server-platform%%' value="${server.platform}">
262
            <include name="persistence.xml"/>
263
        </replace>
264
        <jar jarfile="${wdf_test.build.location}/${MODEL}.jar">
265
            <zipfileset dir="${build.dir}/META-INF" includes="*.xml" prefix="META-INF"/>
195
            <fileset dir="${wdf_test.build.location}/${classes.dir}"
266
            <fileset dir="${wdf_test.build.location}/${classes.dir}"
196
                     includes="org/eclipse/persistence/testing/models/wdf/jpa2/**"/>
267
                     includes="${PACKAGE}"/>
197
        </jar>
268
        </jar>
269
        <delete dir="${build.dir}/META-INF"/> 
198
    </target>
270
    </target>
199
271
200
    <target name="package-wdf-jpa1-model">
272
    <target name="package-wdf-jpa1-model">
201
        <jar jarfile="${wdf_test.build.location}/${eclipselink.wdf.jpa1.model}.jar">
273
        <antcall target="package-model">
202
            <zipfileset dir="${wdf_test.build.location}/resource/${eclipselink.wdf.jpa1.model}" includes="*.xml" prefix="META-INF"/>
274
            <param name="MODEL"   value="${eclipselink.wdf.jpa1.model}"/>
203
            <fileset dir="${wdf_test.build.location}/${classes.dir}"
275
            <param name="PACKAGE" value="org/eclipse/persistence/testing/models/wdf/jpa1/**"/>
204
                     includes="org/eclipse/persistence/testing/models/wdf/jpa1/**"/>
276
        </antcall>
205
        </jar>
206
    </target>
277
    </target>
207
278
279
    <target name="package-wdf-jpa2-model">
280
        <antcall target="package-model">
281
            <param name="MODEL"   value="${eclipselink.wdf.jpa2.model}"/>
282
            <param name="PACKAGE" value="org/eclipse/persistence/testing/models/wdf/jpa2/**"/>
283
        </antcall>
284
    </target>
285
208
    <!-- Testing -->
286
    <!-- Testing -->
209
287
210
    <!-- Clean all build generated content. -->
288
    <!-- Clean all build generated content. -->
Lines 227-240 Link Here
227
    </target>
305
    </target>
228
306
229
    <!-- Default test target, run the LRG -->
307
    <!-- Default test target, run the LRG -->
230
    <target name="test-lrg" depends="clean-test">
308
    <target name="test-lrg">
231
        <antcall target="run-test" inheritRefs="true">
309
        <antcall target="run-test" inheritRefs="true">
232
            <param name="TEST_CLASS" value="${test.class}"/>
310
            <param name="TEST_CLASS" value="${test.class}"/>
233
            <param name="TEST_AGENT" value="${test.agent}"/>
311
            <param name="TEST_AGENT" value="${test.agent}"/> 
234
            <param name="TEST_WEAVING" value="${test.weaving}"/>
312
            <param name="TEST_WEAVING" value="${test.weaving}"/> 
235
            <param name="ORM_TESTING" value="-Dorm.testing=jpa"/>
313
            <param name="ORM_TESTING" value="-Dorm.testing=jpa"/>
236
            <param name="RUN_PATH" value="run.path"/>
314
            <param name="RUN_PATH" value="run.path"/>
237
            <param name="DB_URL" value="${db.url}"/>
315
            <param name="DB_URL" value="${db.url}"/>
316
            <param name="SERVER" value="false"/>
238
        </antcall>
317
        </antcall>
239
        <antcall target="generate-report" inheritRefs="true"/>
318
        <antcall target="generate-report" inheritRefs="true"/>
240
    </target>
319
    </target>
Lines 260-265 Link Here
260
            <jvmarg value="-Ddb.user=${db.user}"/>
339
            <jvmarg value="-Ddb.user=${db.user}"/>
261
            <jvmarg value="-Ddb.pwd=${db.pwd}"/>
340
            <jvmarg value="-Ddb.pwd=${db.pwd}"/>
262
            <jvmarg value="${jvmarg.db.platform}"/>
341
            <jvmarg value="${jvmarg.db.platform}"/>
342
            <jvmarg value="-Dservertest=${SERVER}"/>
343
            <sysproperty key="server.url" value="${server.url}${APP_NAME}"/>
344
            <sysproperty key="server.testrunner.wdf" value="${server.testrunner.wdf}"/>
345
            <sysproperty key="datasource.name" value="${DS_LOOKUP_NAME}"/>
263
            <classpath>
346
            <classpath>
264
                <path refid="${RUN_PATH}"/>
347
                <path refid="${RUN_PATH}"/>
265
            </classpath>
348
            </classpath>
Lines 281-284 Link Here
281
        </junitreport>
364
        </junitreport>
282
    </target>
365
    </target>
283
366
367
368
    <!-- Build server test ear. -->
369
    <target name="server-build-ear" depends="build-against-jar" >
370
        <copy overwrite="true" file="./resource/ear/application.xml" todir="${build.dir}/META-INF"/>
371
        <ear destfile="${wdf_test.build.location}/${build.dir}/servertest.ear" appxml="${build.dir}/META-INF/application.xml">
372
            <fileset file="${wdf_test.build.location}/${eclipselink.tests.jar}"/>
373
            <zipfileset dir="${wdf_test.build.location}" includes="${eclipselink.wdf.jpa1.model}.jar" prefix="${LIB_PREFIX}"/> 
374
        </ear>
375
        <copy file="${wdf_test.build.location}/${build.dir}/servertest.ear" todir="${basedir}"/>  
376
    </target>
377
    
378
    <target name="server-deploy">
379
        <ant antfile="${eclipselink.jpa.test}/${server.name}.xml" target="${server.name}-deploy" inheritRefs="true">
380
            <property name="ear.name" value="${ear.name}"/>
381
            <property name="application.name" value="${application.name}"/>
382
        </ant>
383
    </target>
384
    
385
    <target name="server-undeploy">
386
        <ant antfile="${eclipselink.jpa.test}/${server.name}.xml" target="${server.name}-undeploy" inheritRefs="true">
387
            <property name="application.name" value="${application.name}"/>
388
        </ant>
389
    </target>
390
391
    <!-- Allows we run websphere tests from Windows & Linux both. -->
392
    <target name="detect-os">
393
        <condition property="is.windows" value="true">
394
            <os family="windows"/>
395
        </condition>
396
        <condition property="is.unix" value="true">
397
            <os family="unix"/>
398
        </condition>
399
        <condition property="suffix" value="bat">
400
            <isset property="is.windows"/>
401
        </condition>
402
        <condition property="suffix" value="sh">
403
            <isset property="is.unix"/>
404
        </condition>
405
         <echo message="suffix=${suffix}"/>
406
    </target>
407
408
409
    <target name="set-app-name" depends="detect-os">
410
        <condition property="APP_NAME" value="">
411
            <contains string="${server.name}" substring="websphere"/>
412
        </condition>
413
        <condition property="APP_NAME" value="servertest">
414
            <not>
415
                <isset property="is.websphere"/>
416
            </not>
417
        </condition>
418
419
        <condition property="DS_NAME" value="java:/EclipseLinkDS">
420
            <contains string="${server.name}" substring="jboss"/>
421
        </condition>
422
        <condition property="DS_NAME" value="jdbc/EclipseLinkDS">
423
            <not>
424
                <isset property="is.jboss"/>
425
            </not>
426
        </condition>
427
428
        <condition property="DS_LOOKUP_NAME" value="jdbc/${DS_NAME}">
429
            <contains string="${server.name}" substring="netweaver"/>
430
        </condition>
431
        <condition property="DS_LOOKUP_NAME" value="${DS_NAME}">
432
            <not>
433
                <isset property="is.netweaver"/>
434
            </not>
435
        </condition>
436
437
438
        <condition property="LIB_PREFIX" value="">
439
            <contains string="${server.name}" substring="netweaver"/>
440
        </condition>
441
        <condition property="LIB_PREFIX" value="lib">
442
            <not>
443
                <isset property="is.netweaver"/>
444
            </not>
445
        </condition>
446
    </target>
447
448
    <!-- Build, deploy and run a test suite on the server. -->
449
    <target name="server-test-internal" depends="get-server-properties, detect-os, set-app-name, server-build-ear, init_runtime">
450
        <antcall target="server-deploy" inheritRefs="true">
451
            <param name="ear.name" value="servertest.ear"/>
452
            <param name="application.name" value="servertest"/>
453
        </antcall>
454
        <path id="run.path.server">
455
            <fileset dir="${server.lib}" includes="${server.depend}"/>
456
            <path refid="run.path"/>
457
        </path>
458
        <antcall target="run-test" inheritRefs="true">
459
            <param name="TEST_CLASS" value="${test.class}"/>
460
            <param name="TEST_AGENT" value="${test.agent}"/> 
461
            <param name="TEST_WEAVING" value="${test.weaving}"/> 
462
            <param name="ORM_TESTING" value="-Dorm.testing=jpa"/>
463
            <param name="RUN_PATH" value="run.path.server"/>
464
            <param name="DB_URL" value="${db.url}"/>
465
            <param name="SERVER" value="true"/>
466
        </antcall>
467
        <antcall target="generate-report" inheritRefs="true"/>
468
        <antcall target="server-undeploy" inheritRefs="true">
469
            <param name="application.name" value="servertest"/>
470
        </antcall>
471
    </target>
472
473
284
</project>
474
</project>
475
476
(-)jpa/eclipselink.jpa.wdf.test/resource/ear/application.xml (+13 lines)
Line 0 Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
3
<application xmlns="http://java.sun.com/xml/ns/javaee"
4
	      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5
	      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
6
		http://java.sun.com/xml/ns/javaee/application_5.xsd"
7
	      version="5">
8
    <description>servertest</description>
9
    <display-name>servertest</display-name>
10
    <module>
11
        <ejb>eclipselink-tests.jar</ejb>
12
    </module>
13
</application>
(-)jpa/eclipselink.jpa.wdf.test/resource/eclipselink-wdf-jpa1-model/persistence.xml (-6 / +24 lines)
Lines 2-10 Link Here
2
<persistence version="1.0"
2
<persistence version="1.0"
3
	xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3
	xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
	xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
4
	xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
5
	<persistence-unit name="jpa1testmodel">
5
	<persistence-unit name="jpa1testmodel" transaction-type="RESOURCE_LOCAL">
6
		<description>ATS Test Persistence Unit</description>
6
		<description>ATS Test Persistence Unit</description>
7
		<jta-data-source>JPA2_TEST</jta-data-source>
7
	        <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
8
		<non-jta-data-source>%%data-source-name%%</non-jta-data-source>
8
		<class>org.eclipse.persistence.testing.models.wdf.jpa1.component.Component</class>
9
		<class>org.eclipse.persistence.testing.models.wdf.jpa1.component.Component</class>
9
		<class>org.eclipse.persistence.testing.models.wdf.jpa1.component.Metric</class>
10
		<class>org.eclipse.persistence.testing.models.wdf.jpa1.component.Metric</class>
10
		<class>org.eclipse.persistence.testing.models.wdf.jpa1.component.MetricFloat</class>
11
		<class>org.eclipse.persistence.testing.models.wdf.jpa1.component.MetricFloat</class>
Lines 83-93 Link Here
83
84
84
		<exclude-unlisted-classes>true</exclude-unlisted-classes>
85
		<exclude-unlisted-classes>true</exclude-unlisted-classes>
85
		<properties>
86
		<properties>
86
            <property name="eclipselink.ddl-generation" value="drop-and-create-tables"/>
87
                   <property name="eclipselink.target-server" value="%%server-platform%%"/>
87
            <property name="eclipselink.cache.shared.default" value="false"/>
88
                   <property name="eclipselink.target-database" value="%%database-platform%%"/>
88
            <property name="eclipselink.temporal.mutable" value="true"/> 
89
                   <property name="eclipselink.ddl-generation" value="drop-and-create-tables"/>
89
            <property name="eclipselink.weaving" value="false"/>
90
                   <property name="eclipselink.cache.shared.default" value="false"/>
91
                   <property name="eclipselink.temporal.mutable" value="true"/> 
92
                   <property name="eclipselink.weaving" value="false"/>
90
		</properties>
93
		</properties>
91
	</persistence-unit>
94
	</persistence-unit>
95
	<!--
96
	<persistence-unit name="jpa1testmodel_jta">
97
		<description>ATS Test Persistence Unit</description>
98
	        <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
99
		<jta-data-source>jdbc/EclipseLinkDS</jta-data-source>
100
		<properties>
101
                   <property name="eclipselink.target-server" value="%%server-platform%%"/>
102
                   <property name="eclipselink.target-database" value="%%database-platform%%"/>
103
                   <property name="eclipselink.ddl-generation" value="drop-and-create-tables"/>
104
                   <property name="eclipselink.cache.shared.default" value="false"/>
105
                   <property name="eclipselink.temporal.mutable" value="true"/> 
106
                   <property name="eclipselink.weaving" value="false"/>
107
		</properties>
108
	</persistence-unit>
109
	-->
92
</persistence>
110
</persistence>
93
111
(-)jpa/eclipselink.jpa.wdf.test/resource/eclipselink-wdf-jpa2-model/persistence.xml (-4 / +9 lines)
Lines 2-10 Link Here
2
<persistence version="2.0"
2
<persistence version="2.0"
3
	xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3
	xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
	xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
4
	xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
5
	<persistence-unit name="jpa2testmodel">
5
	<persistence-unit name="jpa2testmodel" transaction-type="RESOURCE_LOCAL">
6
		<description>ATS Test Persistence Unit</description>
6
		<description>ATS Test Persistence Unit</description>
7
		<jta-data-source>JPA2_TEST</jta-data-source>
7
	        <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
8
		<jta-data-source>jdbc/EclipseLinkDS</jta-data-source>
8
		<class>org.eclipse.persistence.testing.models.wdf.jpa2.employee.Address</class>
9
		<class>org.eclipse.persistence.testing.models.wdf.jpa2.employee.Address</class>
9
		<class>org.eclipse.persistence.testing.models.wdf.jpa2.employee.ContactInfo</class>
10
		<class>org.eclipse.persistence.testing.models.wdf.jpa2.employee.ContactInfo</class>
10
		<class>org.eclipse.persistence.testing.models.wdf.jpa2.employee.Department</class>
11
		<class>org.eclipse.persistence.testing.models.wdf.jpa2.employee.Department</class>
Lines 22-29 Link Here
22
		<class>org.eclipse.persistence.testing.models.wdf.jpa2.embedded.EmbeddingPropertyAccess</class>
23
		<class>org.eclipse.persistence.testing.models.wdf.jpa2.embedded.EmbeddingPropertyAccess</class>
23
		<exclude-unlisted-classes>true</exclude-unlisted-classes>
24
		<exclude-unlisted-classes>true</exclude-unlisted-classes>
24
		<properties>
25
		<properties>
25
            <property name="eclipselink.ddl-generation" value="drop-and-create-tables"/>
26
                   <!--<property name="eclipselink.target-server" value="org.eclipse.persistence.platform.server.sap.SAPNetWeaver_7_1_Platform"/>  -->
26
            <property name="eclipselink.cache.shared.default" value="false"/>
27
                   <property name="eclipselink.target-database" value="%%database-platform%%"/>
28
                   <property name="eclipselink.ddl-generation" value="drop-and-create-tables"/>
29
                   <property name="eclipselink.cache.shared.default" value="false"/>
30
                   <property name="eclipselink.temporal.mutable" value="true"/> 
31
                   <property name="eclipselink.weaving" value="false"/>
27
		</properties>
32
		</properties>
28
	</persistence-unit>
33
	</persistence-unit>
29
</persistence>
34
</persistence>
(-)jpa/eclipselink.jpa.wdf.test/resource/ejb/ejb-jar.xml (+38 lines)
Line 0 Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee"
3
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
          xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
5
          http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"
6
          version="3.0">
7
    <enterprise-beans>
8
        <session>
9
            <ejb-name>ServerTestRunnerImpl</ejb-name>
10
            <persistence-unit-ref>
11
                <persistence-unit-ref-name>persistence/jpa1testmodel_rl/factory</persistence-unit-ref-name>
12
                <persistence-unit-name>jpa1testmodel</persistence-unit-name>
13
            </persistence-unit-ref>
14
            <!--
15
            <persistence-unit-ref>
16
                <persistence-unit-ref-name>persistence/jpa1testmodel_jta/factory</persistence-unit-ref-name>
17
                <persistence-unit-name>../lib/eclipselink-wdf-jpa1-model.jar#jpa1testmodel_jta</persistence-unit-name>
18
            </persistence-unit-ref>
19
            <persistence-unit-ref>
20
                <persistence-unit-ref-name>persistence/jpa2testmodel_rl/factory</persistence-unit-ref-name>
21
                <persistence-unit-name>../lib/eclipselink-wdf-jpa2-model.jar#jpa2testmodel</persistence-unit-name>
22
            </persistence-unit-ref>
23
            <persistence-context-ref>
24
                <persistence-context-ref-name>persistence/jpa2testmodel_rl/entity-manager</persistence-context-ref-name>
25
                <persistence-unit-name>../lib/eclipselink-wdf-jpa2-model.jar#jpa2testmodel</persistence-unit-name>
26
            </persistence-context-ref>
27
            <persistence-context-ref>
28
                <persistence-context-ref-name>persistence/jpa1testmodel_rl/entity-manager</persistence-context-ref-name>
29
                <persistence-unit-name>../lib/eclipselink-wdf-jpa1-model.jar#jpa1testmodel</persistence-unit-name>
30
            </persistence-context-ref>
31
            <persistence-context-ref>
32
                <persistence-context-ref-name>persistence/jpa1testmodel_jta/entity-manager</persistence-context-ref-name>
33
                <persistence-unit-name>../lib/eclipselink-wdf-jpa1-model.jar#jpa1testmodel_jta</persistence-unit-name>
34
            </persistence-context-ref>
35
            -->
36
        </session>
37
    </enterprise-beans>
38
</ejb-jar>
(-)jpa/eclipselink.jpa.wdf.test/src/org/eclipse/persistence/testing/framework/server/JEEPlatform.java (-2 / +2 lines)
Lines 91-97 Link Here
91
91
92
    public UserTransaction getUserTransaction() {
92
    public UserTransaction getUserTransaction() {
93
        try {
93
        try {
94
            return (UserTransaction) new InitialContext().lookup("java:comp/UserTransaction");
94
            return (UserTransaction) new InitialContext().lookup("java:comp/UserTransaction");  
95
        } catch (NamingException exception) {
95
        } catch (NamingException exception) {
96
            throw new RuntimeException(exception);
96
            throw new RuntimeException(exception);
97
        }
97
        }
Lines 158-164 Link Here
158
        if (entityManagerFactory != null) {
158
        if (entityManagerFactory != null) {
159
            return entityManagerFactory;
159
            return entityManagerFactory;
160
        }
160
        }
161
        String contextName = "java:comp/env/persistence/" + persistenceUnit + "/factory";
161
        String contextName = "java:comp/env/persistence/" + persistenceUnit + "_rl/factory";
162
        try {
162
        try {
163
            return (EntityManagerFactory) new InitialContext().lookup(contextName);
163
            return (EntityManagerFactory) new InitialContext().lookup(contextName);
164
        } catch (NamingException exception) {
164
        } catch (NamingException exception) {
(-)jpa/eclipselink.jpa.wdf.test/src/org/eclipse/persistence/testing/framework/wdf/AbstractBaseTest.java (-26 / +283 lines)
Lines 26-45 Link Here
26
import java.sql.Statement;
26
import java.sql.Statement;
27
import java.util.HashMap;
27
import java.util.HashMap;
28
import java.util.HashSet;
28
import java.util.HashSet;
29
import java.util.Hashtable;
29
import java.util.Locale;
30
import java.util.Locale;
30
import java.util.Map;
31
import java.util.Map;
31
import java.util.Properties;
32
import java.util.Properties;
32
import java.util.Set;
33
import java.util.Set;
33
34
35
import javax.naming.Context;
36
import javax.naming.InitialContext;
34
import javax.naming.NamingException;
37
import javax.naming.NamingException;
35
import javax.persistence.EntityManager;
38
import javax.persistence.EntityManager;
36
import javax.persistence.EntityManagerFactory;
39
import javax.persistence.EntityManagerFactory;
40
import javax.persistence.LockModeType;
37
import javax.persistence.Persistence;
41
import javax.persistence.Persistence;
38
import javax.sql.DataSource;
42
import javax.sql.DataSource;
39
43
40
import org.eclipse.persistence.config.PersistenceUnitProperties;
44
import org.eclipse.persistence.config.PersistenceUnitProperties;
41
import org.eclipse.persistence.testing.framework.junit.JUnitTestCase;
42
import org.eclipse.persistence.testing.framework.junit.JUnitTestCaseHelper;
45
import org.eclipse.persistence.testing.framework.junit.JUnitTestCaseHelper;
46
import org.eclipse.persistence.testing.framework.server.JEEPlatform;
47
import org.eclipse.persistence.testing.framework.server.ServerPlatform;
43
import org.eclipse.persistence.testing.tests.feature.TestDataSource;
48
import org.eclipse.persistence.testing.tests.feature.TestDataSource;
44
import org.junit.Assert;
49
import org.junit.Assert;
45
import org.junit.Before;
50
import org.junit.Before;
Lines 48-80 Link Here
48
53
49
@SuppressWarnings("unchecked")
54
@SuppressWarnings("unchecked")
50
@RunWith(SkipBugzillaTestRunner.class)
55
@RunWith(SkipBugzillaTestRunner.class)
51
public abstract class AbstractBaseTest extends JUnitTestCase {
56
public abstract class AbstractBaseTest {
52
57
58
    // /** System variable to set the tests to run on the server. */
59
    // public static final String RUN_ON_SERVER = "server.run";
60
    //
61
    private static Map<String, EntityManagerFactory> emfNamedPersistenceUnits = new Hashtable<String, EntityManagerFactory>();
62
63
    /** Determine if the test is running on a JEE server, or in JSE. */
64
65
    private static ServerPlatform serverPlatform;
66
53
    private final JPAEnvironment environment;
67
    private final JPAEnvironment environment;
54
    private final String puName;
68
    private final String puName;
55
    private final static DataSource dataSource;
69
    private final static DataSource dataSource;
56
    private final static Map EMF_PROPERTIES;
70
    private final static Map EMF_PROPERTIES;
57
71
72
    private static boolean seesJPA2 = (LockModeType.values().length > 2);
73
58
    static {
74
    static {
59
        Map<String, String> properties = JUnitTestCaseHelper.getDatabaseProperties();
75
        final DataSource aDataSource;
60
        String driver = properties.get(PersistenceUnitProperties.JDBC_DRIVER);
61
        String url = properties.get(PersistenceUnitProperties.JDBC_URL);
62
        String user = properties.get(PersistenceUnitProperties.JDBC_USER);
63
        String password = properties.get(PersistenceUnitProperties.JDBC_PASSWORD);
64
76
65
        Properties userPasswd = new Properties();
77
        if (!ServerInfoHolder.isOnServer()) {
66
        userPasswd.put("user", user);
78
            Map<String, String> properties = JUnitTestCaseHelper.getDatabaseProperties();
67
        userPasswd.put("password", password);
79
            String driver = properties.get(PersistenceUnitProperties.JDBC_DRIVER);
80
            String url = properties.get(PersistenceUnitProperties.JDBC_URL);
81
            String user = properties.get(PersistenceUnitProperties.JDBC_USER);
82
            String password = properties.get(PersistenceUnitProperties.JDBC_PASSWORD);
68
83
69
        DataSource ds = new TestDataSource(driver, url, userPasswd);
84
            Properties userPasswd = new Properties();
70
        dataSource = new PooledDataSource(ds);
85
            userPasswd.put("user", user);
86
            userPasswd.put("password", password);
87
88
            DataSource ds = new TestDataSource(driver, url, userPasswd);
89
            aDataSource = new PooledDataSource(ds);
90
91
        } else {
92
            Context context;
93
            try {
94
                context = new InitialContext();
95
                aDataSource = (DataSource) context.lookup(ServerInfoHolder.getDataSourceName()); 
96
            } catch (NamingException e) {
97
                throw new RuntimeException(e);
98
            }
99
        }
100
        dataSource = aDataSource;
71
        EMF_PROPERTIES = new HashMap();
101
        EMF_PROPERTIES = new HashMap();
72
        EMF_PROPERTIES.put("delimited-identifiers", "true");
102
        EMF_PROPERTIES.put("delimited-identifiers", "true");
73
        EMF_PROPERTIES.put(PersistenceUnitProperties.NON_JTA_DATASOURCE, dataSource);
103
        EMF_PROPERTIES.put(PersistenceUnitProperties.NON_JTA_DATASOURCE, dataSource);
74
    }
104
    }
75
105
76
    public AbstractBaseTest(String name) {
106
    public AbstractBaseTest(String name) {
77
        environment = new EnvironmentAdapter();
107
        environment = new ResourceLocalEnvironment();
78
        puName = name;
108
        puName = name;
79
    }
109
    }
80
110
Lines 87-96 Link Here
87
117
88
    }
118
    }
89
119
90
    final class EnvironmentAdapter implements JPAEnvironment {
120
    final class ResourceLocalEnvironment implements JPAEnvironment {
91
121
92
        @Override
122
        @Override
93
        public void beginTransaction(EntityManager em) {
123
        public void beginTransaction(EntityManager em) {
124
            em.getTransaction().begin();
125
        }
126
127
        @Override
128
        public void commitTransaction(EntityManager em) {
129
            em.getTransaction().commit();
130
        }
131
132
        @Override
133
        public void commitTransactionAndClear(EntityManager em) {
134
            try {
135
                commitTransaction(em);
136
            } finally {
137
                em.clear();
138
            }
139
        }
140
141
        @Override
142
        public EntityManagerFactory createNewEntityManagerFactory() throws NamingException {
143
            AbstractBaseTest.closeEntityManagerFactory(puName);
144
            return Persistence.createEntityManagerFactory(puName, EMF_PROPERTIES);
145
        }
146
147
        @Override
148
        public EntityManager getEntityManager() {
149
            return getEntityManagerFactory().createEntityManager();
150
            // return AbstractBaseTest.createEntityManager(puName,
151
            // EMF_PROPERTIES);
152
        }
153
154
        @Override
155
        public EntityManagerFactory getEntityManagerFactory() {
156
            return AbstractBaseTest.getEntityManagerFactory(puName, EMF_PROPERTIES);
157
        }
158
159
        @Override
160
        public boolean isTransactionActive(EntityManager em) {
161
            return em.getTransaction().isActive();
162
        }
163
164
        @Override
165
        public boolean isTransactionMarkedForRollback(EntityManager em) {
166
            return em.getTransaction().getRollbackOnly();
167
        }
168
169
        @Override
170
        public void markTransactionForRollback(EntityManager em) {
171
            throw new UnsupportedOperationException();
172
        }
173
174
        @Override
175
        public void rollbackTransaction(EntityManager em) {
176
            em.getTransaction().rollback();
177
        }
178
179
        @Override
180
        public void rollbackTransactionAndClear(EntityManager em) {
181
            try {
182
                rollbackTransaction(em);
183
            } finally {
184
                em.clear();
185
            }
186
        }
187
188
        @Override
189
        public boolean usesExtendedPC() {
190
            return true;
191
        }
192
193
        @Override
194
        public DataSource getDataSource() {
195
            return AbstractBaseTest.this.getDataSource();
196
        }
197
198
    }
199
200
    final class JTATxScopedEnvironment implements JPAEnvironment {
201
202
        @Override
203
        public void beginTransaction(EntityManager em) {
94
            AbstractBaseTest.this.beginTransaction(em);
204
            AbstractBaseTest.this.beginTransaction(em);
95
        }
205
        }
96
206
Lines 110-127 Link Here
110
220
111
        @Override
221
        @Override
112
        public EntityManagerFactory createNewEntityManagerFactory() throws NamingException {
222
        public EntityManagerFactory createNewEntityManagerFactory() throws NamingException {
113
            JUnitTestCase.closeEntityManagerFactory(puName);
223
            AbstractBaseTest.closeEntityManagerFactory(puName);
114
            return Persistence.createEntityManagerFactory(puName, EMF_PROPERTIES);
224
            return Persistence.createEntityManagerFactory(puName, EMF_PROPERTIES);
115
        }
225
        }
116
226
117
        @Override
227
        @Override
118
        public EntityManager getEntityManager() {
228
        public EntityManager getEntityManager() {
119
            return JUnitTestCase.createEntityManager(puName, EMF_PROPERTIES);
229
            return AbstractBaseTest.createEntityManager(puName, EMF_PROPERTIES);
120
        }
230
        }
121
231
122
        @Override
232
        @Override
123
        public EntityManagerFactory getEntityManagerFactory() {
233
        public EntityManagerFactory getEntityManagerFactory() {
124
            return JUnitTestCase.getEntityManagerFactory(puName, EMF_PROPERTIES);
234
            return AbstractBaseTest.getEntityManagerFactory(puName, EMF_PROPERTIES);
125
        }
235
        }
126
236
127
        @Override
237
        @Override
Lines 169-181 Link Here
169
        return dataSource;
279
        return dataSource;
170
    }
280
    }
171
281
172
    @Override
173
    final public void closeEntityManager(EntityManager em) {
282
    final public void closeEntityManager(EntityManager em) {
174
        if (!em.isOpen()) {
283
        if (!em.isOpen()) {
175
            return;
284
            return;
176
        }
285
        }
177
        if (environment.isTransactionActive(em)/*
286
        if (environment.isTransactionActive(em)/*
178
                                                * ||environment. isTransactionMarkedForRollback (em)
287
                                                * ||environment.
288
                                                * isTransactionMarkedForRollback
289
                                                * (em)
179
                                                */) { // FIXME discuss if tx is
290
                                                */) { // FIXME discuss if tx is
180
            // active if marked for
291
            // active if marked for
181
            // rollback
292
            // rollback
Lines 255-262 Link Here
255
366
256
    }
367
    }
257
368
258
    public static final <T extends Serializable> T serializeDeserialize(T serializable) throws IOException,
369
    public static final <T extends Serializable> T serializeDeserialize(T serializable) throws IOException, ClassNotFoundException {
259
            ClassNotFoundException {
260
        ByteArrayOutputStream out = new ByteArrayOutputStream();
370
        ByteArrayOutputStream out = new ByteArrayOutputStream();
261
        ObjectOutputStream objectOutputStream = new ObjectOutputStream(out);
371
        ObjectOutputStream objectOutputStream = new ObjectOutputStream(out);
262
        try {
372
        try {
Lines 273-284 Link Here
273
    }
383
    }
274
384
275
    /**
385
    /**
276
     * Checks whether the given throwable is of type java.lang.IllegalStateException, or otherwise if the throwable contains a
386
     * Checks whether the given throwable is of type
387
     * java.lang.IllegalStateException, or otherwise if the throwable contains a
277
     * java.lang.IllegalStateException somewhere in the cause stack.
388
     * java.lang.IllegalStateException somewhere in the cause stack.
278
     * 
389
     * 
279
     * @param e
390
     * @param e
280
     *            The throwable to check
391
     *            The throwable to check
281
     * @return <code>true</code> if the throwable is instance of or caused by java.lang.IllegalStateException
392
     * @return <code>true</code> if the throwable is instance of or caused by
393
     *         java.lang.IllegalStateException
282
     */
394
     */
283
    protected final boolean checkForIllegalStateException(Throwable e) {
395
    protected final boolean checkForIllegalStateException(Throwable e) {
284
        boolean contained = false;
396
        boolean contained = false;
Lines 293-304 Link Here
293
    }
405
    }
294
406
295
    /**
407
    /**
296
     * Checks whether the given throwable is of type java.sql.SQLException, or otherwise if the throwable contains a
408
     * Checks whether the given throwable is of type java.sql.SQLException, or
297
     * java.sql.SQLException somewhere in the cause stack.
409
     * otherwise if the throwable contains a java.sql.SQLException somewhere in
410
     * the cause stack.
298
     * 
411
     * 
299
     * @param e
412
     * @param e
300
     *            The throwable to check
413
     *            The throwable to check
301
     * @return <code>true</code> if the throwable is instance of or caused by java.sql.SQLException
414
     * @return <code>true</code> if the throwable is instance of or caused by
415
     *         java.sql.SQLException
302
     */
416
     */
303
    protected final boolean checkForSQLException(Throwable e) {
417
    protected final boolean checkForSQLException(Throwable e) {
304
        boolean contained = false;
418
        boolean contained = false;
Lines 312-315 Link Here
312
        return contained;
426
        return contained;
313
    }
427
    }
314
428
429
    /**
430
     * Return if the transaction is active. This allows the same code to be used
431
     * on the server where JTA is used.
432
     */
433
    public boolean isTransactionActive(EntityManager entityManager) {
434
        if (ServerInfoHolder.isOnServer()) {
435
            return getServerPlatform().isTransactionActive();
436
        } else {
437
            return entityManager.getTransaction().isActive();
438
        }
439
    }
440
441
    /**
442
     * Return if the transaction is roll back only. This allows the same code to
443
     * be used on the server where JTA is used.
444
     */
445
    public boolean getRollbackOnly(EntityManager entityManager) {
446
        if (ServerInfoHolder.isOnServer()) {
447
            return getServerPlatform().getRollbackOnly();
448
        } else {
449
            return entityManager.getTransaction().getRollbackOnly();
450
        }
451
    }
452
453
    /**
454
     * Begin a transaction on the entity manager. This allows the same code to
455
     * be used on the server where JTA is used.
456
     */
457
    public void beginTransaction(EntityManager entityManager) {
458
        if (ServerInfoHolder.isOnServer()) {
459
            getServerPlatform().beginTransaction();
460
        } else {
461
            entityManager.getTransaction().begin();
462
        }
463
    }
464
465
    /**
466
     * Commit a transaction on the entity manager. This allows the same code to
467
     * be used on the server where JTA is used.
468
     */
469
    public void commitTransaction(EntityManager entityManager) {
470
        if (ServerInfoHolder.isOnServer()) {
471
            getServerPlatform().commitTransaction();
472
        } else {
473
            entityManager.getTransaction().commit();
474
        }
475
    }
476
477
    /**
478
     * Rollback a transaction on the entity manager. This allows the same code
479
     * to be used on the server where JTA is used.
480
     */
481
    public void rollbackTransaction(EntityManager entityManager) {
482
        if (ServerInfoHolder.isOnServer()) {
483
            getServerPlatform().rollbackTransaction();
484
        } else {
485
            entityManager.getTransaction().rollback();
486
        }
487
    }
488
489
    /**
490
     * Return the server platform if running in JEE.
491
     */
492
    public static ServerPlatform getServerPlatform() {
493
        if (serverPlatform == null) {
494
            serverPlatform = new JEEPlatform();
495
        }
496
        return serverPlatform;
497
    }
498
499
    /**
500
     * Create a new entity manager for the "default" persistence unit. If in JEE
501
     * this will create or return the active managed entity manager.
502
     */
503
    public static EntityManager createEntityManager() {
504
        if (ServerInfoHolder.isOnServer()) {
505
            return getServerPlatform().getEntityManager("default");
506
        } else {
507
            return getEntityManagerFactory().createEntityManager();
508
        }
509
    }
510
511
    /**
512
     * Create a new entity manager for the persistence unit using the
513
     * properties. The properties will only be used the first time this entity
514
     * manager is accessed. If in JEE this will create or return the active
515
     * managed entity manager.
516
     */
517
    public static EntityManager createEntityManager(String persistenceUnitName, Map<String, String> properties) {
518
        if (ServerInfoHolder.isOnServer()) {
519
            return getServerPlatform().getEntityManager(persistenceUnitName);
520
        } else {
521
            return getEntityManagerFactory(persistenceUnitName, properties).createEntityManager();
522
        }
523
    }
524
525
    public static EntityManagerFactory getEntityManagerFactory(String persistenceUnitName) {
526
        return getEntityManagerFactory(persistenceUnitName, JUnitTestCaseHelper.getDatabaseProperties());
527
    }
528
529
    public static EntityManagerFactory getEntityManagerFactory(String persistenceUnitName, Map<String, String> properties) {
530
        if (ServerInfoHolder.isOnServer()) {
531
            return getServerPlatform().getEntityManagerFactory(persistenceUnitName);
532
        } else {
533
            EntityManagerFactory emfNamedPersistenceUnit = (EntityManagerFactory) emfNamedPersistenceUnits.get(persistenceUnitName);
534
            if (emfNamedPersistenceUnit == null) {
535
                emfNamedPersistenceUnit = Persistence.createEntityManagerFactory(persistenceUnitName, properties);
536
                emfNamedPersistenceUnits.put(persistenceUnitName, emfNamedPersistenceUnit);
537
            }
538
            return emfNamedPersistenceUnit;
539
        }
540
    }
541
542
    public static EntityManagerFactory getEntityManagerFactory() {
543
        return getEntityManagerFactory("default");
544
    }
545
546
    public static void closeEntityManagerFactory() {
547
        closeEntityManagerFactory("default");
548
    }
549
550
    public static void closeEntityManagerFactory(String persistenceUnitName) {
551
        EntityManagerFactory emfNamedPersistenceUnit = (EntityManagerFactory) emfNamedPersistenceUnits.get(persistenceUnitName);
552
        if (emfNamedPersistenceUnit != null) {
553
            if (emfNamedPersistenceUnit.isOpen()) {
554
                emfNamedPersistenceUnit.close();
555
            }
556
            emfNamedPersistenceUnits.remove(persistenceUnitName);
557
        }
558
    }
559
560
    public static boolean seesJPA2() {
561
        return seesJPA2;
562
    }
563
564
    public static Map<String, String> getTestProperties() {
565
        if (ServerInfoHolder.isOnServer()) {
566
            return ServerInfoHolder.getTestProperties();
567
        } else {
568
            return JUnitTestCaseHelper.getDatabaseProperties();
569
        }
570
571
    }
315
}
572
}
(-)jpa/eclipselink.jpa.wdf.test/src/org/eclipse/persistence/testing/framework/wdf/server/CollectNotificationsListener.java (+75 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2009 SAP. All rights reserved.
3
 * This program and the accompanying materials are made available under the 
4
 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
5
 * which accompanies this distribution. 
6
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7
 * and the Eclipse Distribution License is available at 
8
 * http://www.eclipse.org/org/documents/edl-v10.php.
9
 *
10
 * Contributors:
11
 *     SAP - initial API and implementation
12
 ******************************************************************************/
13
package org.eclipse.persistence.testing.framework.wdf.server;
14
15
import java.util.ArrayList;
16
import java.util.List;
17
18
import org.junit.runner.Description;
19
import org.junit.runner.Result;
20
import org.junit.runner.notification.Failure;
21
import org.junit.runner.notification.RunListener;
22
23
/**
24
 * Implementation of RunListener, which records serializable notifications so
25
 * that they can be replayed on the can be replayed on the client.
26
 */
27
final class CollectNotificationsListener extends RunListener {
28
    private final List<Notification> notifications = new ArrayList<Notification>();
29
    
30
    CollectNotificationsListener() {
31
    }
32
33
    /**
34
     * Get the list of notifications recorded.
35
     * @return the list of notifications recorded
36
     */
37
    public List<Notification> getNotifications() {
38
        return notifications;
39
    }
40
41
    @Override
42
    public void testAssumptionFailure(Failure failure) {
43
        notifications.add(new TestAssumptionFailed(failure));
44
    }
45
46
    @Override
47
    public void testFailure(Failure failure) throws Exception {
48
        notifications.add(new TestFailed(failure));
49
    }
50
51
    @Override
52
    public void testFinished(Description description) throws Exception {
53
        notifications.add(new TestFinished(description));
54
    }
55
56
    @Override
57
    public void testIgnored(Description description) throws Exception {
58
        notifications.add(new TestIgnored(description));
59
    }
60
61
    @Override
62
    public void testRunFinished(Result result) throws Exception {
63
        notifications.add(new TestRunFinished(result));
64
    }
65
66
    @Override
67
    public void testRunStarted(Description description) throws Exception {
68
        notifications.add(new TestRunStarted(description));
69
    }
70
71
    @Override
72
    public void testStarted(Description description) throws Exception {
73
        notifications.add(new TestStarted(description));
74
    }
75
}
(-)jpa/eclipselink.jpa.wdf.test/src/org/eclipse/persistence/testing/framework/wdf/server/Notification.java (+30 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2009 SAP. All rights reserved.
3
 * This program and the accompanying materials are made available under the 
4
 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
5
 * which accompanies this distribution. 
6
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7
 * and the Eclipse Distribution License is available at 
8
 * http://www.eclipse.org/org/documents/edl-v10.php.
9
 *
10
 * Contributors:
11
 *     SAP - initial API and implementation
12
 ******************************************************************************/
13
package org.eclipse.persistence.testing.framework.wdf.server;
14
15
import java.io.Serializable;
16
17
import org.junit.runner.notification.RunNotifier;
18
19
/**
20
 * A recordable notification.
21
 */
22
public interface Notification extends Serializable {
23
    
24
    /**
25
     * Notify a run notifier of this notification.
26
     * @param notifier
27
     */
28
    public void notify(RunNotifier notifier);
29
30
}
(-)jpa/eclipselink.jpa.wdf.test/src/org/eclipse/persistence/testing/framework/wdf/server/SerializableDescription.java (+72 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2009 SAP. All rights reserved.
3
 * This program and the accompanying materials are made available under the 
4
 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
5
 * which accompanies this distribution. 
6
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7
 * and the Eclipse Distribution License is available at 
8
 * http://www.eclipse.org/org/documents/edl-v10.php.
9
 *
10
 * Contributors:
11
 *     SAP - initial API and implementation
12
 ******************************************************************************/
13
package org.eclipse.persistence.testing.framework.wdf.server;
14
15
import java.io.Serializable;
16
import java.util.ArrayList;
17
import java.util.Collections;
18
import java.util.List;
19
20
import org.junit.runner.Description;
21
22
/**
23
 * Serializable version of org.junit.runner.Description.
24
 */
25
public class SerializableDescription implements Serializable {
26
27
    private static final long serialVersionUID = 1L;
28
    private final String displayName;
29
    private final List<SerializableDescription> children;
30
31
    private SerializableDescription(String theDisplayName, List<SerializableDescription> theChildren) {
32
        displayName = theDisplayName;
33
        children = theChildren;
34
    }
35
36
    /**
37
     * Create a SerializableDescription objects from an org.junit.runner.Description objects
38
     * @param description the org.junit.runner.Description object to be converted
39
     * @return the SerializableDescription object created from an org.junit.runner.Description object 
40
     */
41
    @SuppressWarnings("unchecked")
42
    public static SerializableDescription create(Description description) {
43
        final List<SerializableDescription> children;
44
        if (description.getChildren() != null) {
45
            children = new ArrayList<SerializableDescription>();
46
            for (Description child : description.getChildren()) {
47
                children.add(create(child));
48
            }
49
        } else {
50
            children = Collections.EMPTY_LIST;
51
        }
52
        return new SerializableDescription(description.getDisplayName(), children);
53
54
    }
55
56
    /**
57
     * Restore an org.junit.runner.Description from this SerializableDescription object
58
     * @return the restored org.junit.runner.Description object
59
     */
60
    public Description restore() {
61
        Description restored = Description.createSuiteDescription(displayName);
62
63
        if (children != null) {
64
            for (SerializableDescription child : children) {
65
                restored.addChild(child.restore());
66
            }
67
        }
68
69
        return restored;
70
    }
71
72
}
(-)jpa/eclipselink.jpa.wdf.test/src/org/eclipse/persistence/testing/framework/wdf/server/SerializableFailure.java (+50 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2009 SAP. All rights reserved.
3
 * This program and the accompanying materials are made available under the 
4
 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
5
 * which accompanies this distribution. 
6
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7
 * and the Eclipse Distribution License is available at 
8
 * http://www.eclipse.org/org/documents/edl-v10.php.
9
 *
10
 * Contributors:
11
 *     SAP - initial API and implementation
12
 ******************************************************************************/
13
package org.eclipse.persistence.testing.framework.wdf.server;
14
15
import java.io.Serializable;
16
17
import org.junit.runner.notification.Failure;
18
19
/**
20
 * Serializable version of org.junit.runner.notification.Failure.
21
 */
22
public class SerializableFailure implements Serializable {
23
    
24
    private static final long serialVersionUID = 1L;
25
    private final SerializableDescription description;
26
    private final Throwable thrownException;
27
    
28
    private SerializableFailure(SerializableDescription theDescription, Throwable throwable) {
29
        description = theDescription;
30
        thrownException = throwable;
31
    }
32
    
33
    /**
34
     * Create a SerializableFailure object from an org.junit.runner.notification.Failure object.
35
     * @param the failure object to be converted
36
     * @return a SerializableFailure object converted from an org.junit.runner.notification.Failure object
37
     */
38
    public static SerializableFailure create(Failure failure) {
39
        return new SerializableFailure(SerializableDescription.create(failure.getDescription()),failure.getException());
40
    }
41
    
42
    /**
43
     * Restore an org.junit.runner.notification.Failure object from this SerializableFailure object.
44
     * @return the restored org.junit.runner.notification.Failure object
45
     */
46
    public Failure restore() {
47
        return new Failure(description.restore(), thrownException);
48
    }
49
50
}
(-)jpa/eclipselink.jpa.wdf.test/src/org/eclipse/persistence/testing/framework/wdf/server/SerializableResult.java (+73 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2009 SAP. All rights reserved.
3
 * This program and the accompanying materials are made available under the 
4
 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
5
 * which accompanies this distribution. 
6
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7
 * and the Eclipse Distribution License is available at 
8
 * http://www.eclipse.org/org/documents/edl-v10.php.
9
 *
10
 * Contributors:
11
 *     SAP - initial API and implementation
12
 ******************************************************************************/
13
package org.eclipse.persistence.testing.framework.wdf.server;
14
15
import java.io.Serializable;
16
import java.util.ArrayList;
17
import java.util.Collections;
18
import java.util.List;
19
20
import org.junit.runner.Result;
21
import org.junit.runner.notification.Failure;
22
23
/**
24
 * Serializable version of org.junit.runner.Result.
25
 */
26
public class SerializableResult implements Serializable {
27
    
28
    private static final long serialVersionUID = 1L;
29
    @SuppressWarnings("unused")
30
    private final int count;
31
    @SuppressWarnings("unused")
32
    private final int ignoreCount;
33
    @SuppressWarnings("unused")
34
    private final List<SerializableFailure> failures;
35
    @SuppressWarnings("unused")
36
    private final long runTime;
37
    
38
    private SerializableResult(int cnt, int ign, List<SerializableFailure> fls, long rt) {
39
        count = cnt;
40
        ignoreCount = ign;
41
        failures = fls;
42
        runTime = rt;
43
    }
44
    
45
    /**
46
     * Create a SerializableResult object from an org.junit.runner.Result object.
47
     * @param other the org.junit.runner.Result object to be converted
48
     * @return the SerializableResult object created from an org.junit.runner.Result object
49
     */
50
    @SuppressWarnings("unchecked")
51
    public static SerializableResult create(Result other) {
52
        final List<SerializableFailure> failures;
53
        
54
        if (other.getFailures() != null) {
55
            failures = new ArrayList<SerializableFailure>();
56
            for(Failure failure : other.getFailures()) {
57
                failures.add(SerializableFailure.create(failure));
58
            }
59
        } else {
60
            failures = Collections.EMPTY_LIST;
61
        }
62
        
63
        return new SerializableResult(other.getFailureCount(), other.getIgnoreCount(), failures, other.getRunTime());
64
        
65
    }
66
    
67
    public Result restore() {
68
        return new Result(); // FIXME don't know how to restore the result 
69
        
70
    }
71
    
72
73
}
(-)jpa/eclipselink.jpa.wdf.test/src/org/eclipse/persistence/testing/framework/wdf/server/ServerTestRunner.java (+35 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2009 SAP. All rights reserved.
3
 * This program and the accompanying materials are made available under the 
4
 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
5
 * which accompanies this distribution. 
6
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7
 * and the Eclipse Distribution License is available at 
8
 * http://www.eclipse.org/org/documents/edl-v10.php.
9
 *
10
 * Contributors:
11
 *     SAP - initial API and implementation
12
 ******************************************************************************/
13
package org.eclipse.persistence.testing.framework.wdf.server;
14
15
import java.util.List;
16
import java.util.Map;
17
18
import javax.ejb.Remote;
19
20
/**
21
 * Session bean used to redirect JUnit 4 test execution from client to server
22
 */
23
@Remote
24
public interface ServerTestRunner {
25
    
26
    /**
27
     * Redirects test execution from client to server. 
28
     * @param className the name of test class to be executed 
29
     * @param dsName the JNID lookup name of the data source used by the test 
30
     * @param testProperties the test properties
31
     * @return a list of notifications recorded during test execution 
32
     */
33
    public List<Notification> runTestClass(String className, String dsName, Map<String, String> testProperties);
34
35
}
(-)jpa/eclipselink.jpa.wdf.test/src/org/eclipse/persistence/testing/framework/wdf/server/ServerTestRunnerImpl.java (+52 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2009 SAP. All rights reserved.
3
 * This program and the accompanying materials are made available under the 
4
 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
5
 * which accompanies this distribution. 
6
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7
 * and the Eclipse Distribution License is available at 
8
 * http://www.eclipse.org/org/documents/edl-v10.php.
9
 *
10
 * Contributors:
11
 *     SAP - initial API and implementation
12
 ******************************************************************************/
13
package org.eclipse.persistence.testing.framework.wdf.server;
14
15
import java.util.List;
16
import java.util.Map;
17
18
import javax.ejb.Stateless;
19
import javax.ejb.TransactionManagement;
20
import javax.ejb.TransactionManagementType;
21
22
import org.eclipse.persistence.testing.framework.wdf.ServerInfoHolder;
23
import org.junit.runner.JUnitCore;
24
25
/**
26
 * Implementation  of the server test runner. 
27
 */
28
29
@Stateless
30
@TransactionManagement(TransactionManagementType.BEAN)
31
public class ServerTestRunnerImpl implements ServerTestRunner {
32
    
33
    @Override
34
    public List<Notification> runTestClass(String className, String dsName, Map<String, String> testProperties) {
35
        
36
        Class<?> clazz;
37
        try {
38
            ServerInfoHolder.setServerInfo(dsName, testProperties);
39
            clazz = Class.forName(className);
40
        } catch (ClassNotFoundException e) {
41
            throw new RuntimeException(e);
42
        }
43
44
        JUnitCore core = new JUnitCore();
45
        CollectNotificationsListener listener = new CollectNotificationsListener();
46
        core.addListener(listener);
47
        core.run(clazz);
48
        
49
        return listener.getNotifications();
50
    }
51
52
}
(-)jpa/eclipselink.jpa.wdf.test/src/org/eclipse/persistence/testing/framework/wdf/server/TestAssumptionFailed.java (+35 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2009 SAP. All rights reserved.
3
 * This program and the accompanying materials are made available under the 
4
 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
5
 * which accompanies this distribution. 
6
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7
 * and the Eclipse Distribution License is available at 
8
 * http://www.eclipse.org/org/documents/edl-v10.php.
9
 *
10
 * Contributors:
11
 *     SAP - initial API and implementation
12
 ******************************************************************************/
13
package org.eclipse.persistence.testing.framework.wdf.server;
14
15
import org.junit.runner.notification.Failure;
16
import org.junit.runner.notification.RunNotifier;
17
18
/**
19
 * A notification indicating that a test assumption failed.
20
 */
21
public class TestAssumptionFailed implements Notification {
22
    
23
    private static final long serialVersionUID = 1L;
24
    private final SerializableFailure failure;
25
    
26
    public TestAssumptionFailed(Failure aFailure) {
27
        failure = SerializableFailure.create(aFailure);
28
    }
29
30
    @Override
31
    public void notify(RunNotifier notifier) {
32
        notifier.fireTestAssumptionFailed(failure.restore());
33
    }
34
35
}
(-)jpa/eclipselink.jpa.wdf.test/src/org/eclipse/persistence/testing/framework/wdf/server/TestFailed.java (+35 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2009 SAP. All rights reserved.
3
 * This program and the accompanying materials are made available under the 
4
 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
5
 * which accompanies this distribution. 
6
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7
 * and the Eclipse Distribution License is available at 
8
 * http://www.eclipse.org/org/documents/edl-v10.php.
9
 *
10
 * Contributors:
11
 *     SAP - initial API and implementation
12
 ******************************************************************************/
13
package org.eclipse.persistence.testing.framework.wdf.server;
14
15
import org.junit.runner.notification.Failure;
16
import org.junit.runner.notification.RunNotifier;
17
18
/**
19
 * A notification indicating that at test failed.
20
 */
21
public class TestFailed implements Notification {
22
    
23
    private static final long serialVersionUID = 1L;
24
    private final SerializableFailure failure;
25
    
26
    public TestFailed(Failure aFailure) {
27
        failure = SerializableFailure.create(aFailure);
28
    }
29
30
    @Override
31
    public void notify(RunNotifier notifier) {
32
        notifier.fireTestFailure(failure.restore());
33
    }
34
35
}
(-)jpa/eclipselink.jpa.wdf.test/src/org/eclipse/persistence/testing/framework/wdf/server/TestFinished.java (+35 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2009 SAP. All rights reserved.
3
 * This program and the accompanying materials are made available under the 
4
 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
5
 * which accompanies this distribution. 
6
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7
 * and the Eclipse Distribution License is available at 
8
 * http://www.eclipse.org/org/documents/edl-v10.php.
9
 *
10
 * Contributors:
11
 *     SAP - initial API and implementation
12
 ******************************************************************************/
13
package org.eclipse.persistence.testing.framework.wdf.server;
14
15
import org.junit.runner.Description;
16
import org.junit.runner.notification.RunNotifier;
17
18
/**
19
 * A notification indicating that the execution of a test has finished. 
20
 */
21
public class TestFinished implements Notification {
22
    
23
    private static final long serialVersionUID = 1L;
24
    private final SerializableDescription description;
25
    
26
    public TestFinished(Description aDescription) {
27
        description = SerializableDescription.create(aDescription);
28
    }
29
30
    @Override
31
    public void notify(RunNotifier notifier) {
32
        notifier.fireTestFinished(description.restore());
33
    }
34
35
}
(-)jpa/eclipselink.jpa.wdf.test/src/org/eclipse/persistence/testing/framework/wdf/server/TestIgnored.java (+35 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2009 SAP. All rights reserved.
3
 * This program and the accompanying materials are made available under the 
4
 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
5
 * which accompanies this distribution. 
6
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7
 * and the Eclipse Distribution License is available at 
8
 * http://www.eclipse.org/org/documents/edl-v10.php.
9
 *
10
 * Contributors:
11
 *     SAP - initial API and implementation
12
 ******************************************************************************/
13
package org.eclipse.persistence.testing.framework.wdf.server;
14
15
import org.junit.runner.Description;
16
import org.junit.runner.notification.RunNotifier;
17
18
/**
19
 * A notification indicating that a test has been ignored or skipped.
20
 */
21
public class TestIgnored implements Notification {
22
    
23
    private static final long serialVersionUID = 1L;
24
    private final SerializableDescription description;
25
    
26
    public TestIgnored(Description aDescription) {
27
        description = SerializableDescription.create(aDescription);
28
    }
29
30
    @Override
31
    public void notify(RunNotifier notifier) {
32
        notifier.fireTestIgnored(description.restore());
33
    }
34
35
}
(-)jpa/eclipselink.jpa.wdf.test/src/org/eclipse/persistence/testing/framework/wdf/server/TestRunFinished.java (+35 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2009 SAP. All rights reserved.
3
 * This program and the accompanying materials are made available under the 
4
 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
5
 * which accompanies this distribution. 
6
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7
 * and the Eclipse Distribution License is available at 
8
 * http://www.eclipse.org/org/documents/edl-v10.php.
9
 *
10
 * Contributors:
11
 *     SAP - initial API and implementation
12
 ******************************************************************************/
13
package org.eclipse.persistence.testing.framework.wdf.server;
14
15
import org.junit.runner.Result;
16
import org.junit.runner.notification.RunNotifier;
17
18
/**
19
 * A notification indicating that a test run has finished.
20
 */
21
public class TestRunFinished implements Notification {
22
    
23
    private static final long serialVersionUID = 1L;
24
    private final SerializableResult result;
25
    
26
    public TestRunFinished(Result aResult) {
27
        result = SerializableResult.create(aResult);
28
    }
29
30
    @Override
31
    public void notify(RunNotifier notifier) {
32
        notifier.fireTestRunFinished(result.restore());
33
    }
34
35
}
(-)jpa/eclipselink.jpa.wdf.test/src/org/eclipse/persistence/testing/framework/wdf/server/TestRunStarted.java (+35 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2009 SAP. All rights reserved.
3
 * This program and the accompanying materials are made available under the 
4
 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
5
 * which accompanies this distribution. 
6
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7
 * and the Eclipse Distribution License is available at 
8
 * http://www.eclipse.org/org/documents/edl-v10.php.
9
 *
10
 * Contributors:
11
 *     SAP - initial API and implementation
12
 ******************************************************************************/
13
package org.eclipse.persistence.testing.framework.wdf.server;
14
15
import org.junit.runner.Description;
16
import org.junit.runner.notification.RunNotifier;
17
18
/**
19
 * A notification indicating that a tes run has started.
20
 */
21
public class TestRunStarted implements Notification {
22
    
23
    private static final long serialVersionUID = 1L;
24
    private final SerializableDescription description;
25
    
26
    public TestRunStarted(Description aDescription) {
27
        description = SerializableDescription.create(aDescription);
28
        }
29
30
    @Override
31
    public void notify(RunNotifier notifier) {
32
        notifier.fireTestRunStarted(description.restore());
33
    }
34
35
}
(-)jpa/eclipselink.jpa.wdf.test/src/org/eclipse/persistence/testing/framework/wdf/server/TestStarted.java (+35 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2009 SAP. All rights reserved.
3
 * This program and the accompanying materials are made available under the 
4
 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
5
 * which accompanies this distribution. 
6
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7
 * and the Eclipse Distribution License is available at 
8
 * http://www.eclipse.org/org/documents/edl-v10.php.
9
 *
10
 * Contributors:
11
 *     SAP - initial API and implementation
12
 ******************************************************************************/
13
package org.eclipse.persistence.testing.framework.wdf.server;
14
15
import org.junit.runner.Description;
16
import org.junit.runner.notification.RunNotifier;
17
18
/**
19
 * A notification indicating that the execution of a test has started.
20
 */
21
public class TestStarted implements Notification {
22
    
23
    private static final long serialVersionUID = 1L;
24
    private final SerializableDescription description;
25
    
26
    public TestStarted(Description aDescription) {
27
        description = SerializableDescription.create(aDescription);
28
    }
29
30
    @Override
31
    public void notify(RunNotifier notifier) {
32
        notifier.fireTestStarted(description.restore());
33
    }
34
35
}
(-)jpa/eclipselink.jpa.wdf.test/src/org/eclipse/persistence/testing/framework/wdf/ServerInfoHolder.java (+70 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2009 SAP. All rights reserved.
3
 * This program and the accompanying materials are made available under the 
4
 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
5
 * which accompanies this distribution. 
6
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7
 * and the Eclipse Distribution License is available at 
8
 * http://www.eclipse.org/org/documents/edl-v10.php.
9
 *
10
 * Contributors:
11
 *     SAP - initial API and implementation
12
 ******************************************************************************/
13
package org.eclipse.persistence.testing.framework.wdf;
14
15
import java.util.Collections;
16
import java.util.Map;
17
18
/**
19
 * Static class to hold state shared between ServerTestRunner and tests 
20
 */
21
public class ServerInfoHolder {
22
    
23
    @SuppressWarnings("unchecked")
24
    private static Map<String, String> testProperties = Collections.EMPTY_MAP;
25
    private static String dataSourceName;
26
    private static boolean isOnServer = false;
27
28
    /**
29
     * Get the set of test properties
30
     * @return the set of test properties
31
     */
32
    public static synchronized Map<String, String> getTestProperties() {
33
        return testProperties;
34
    }
35
36
37
38
    // prevent instantiation
39
    private ServerInfoHolder() {
40
        
41
    }
42
43
    /**
44
     * @return if the test is running on a JEE server, or in JSE.
45
     */
46
    public static boolean isOnServer() {
47
        return isOnServer;
48
    }
49
50
51
    /**
52
     * Get the JNDI lookup name of the data source used by the tests 
53
     * @return the JNDI lookup name of the data source used by the tests
54
     */
55
    public synchronized static String getDataSourceName() {
56
        return dataSourceName;
57
    }
58
59
    /**
60
     * set info needed to execute the tests on the server
61
     * @param dsName the JNDI lookup name of the data source used by the tests
62
     * @param properties the test properties
63
     */
64
    public static synchronized void setServerInfo(String dsName, Map<String, String> properties) {
65
        isOnServer = true;
66
        dataSourceName = dsName;
67
        testProperties = properties;
68
    }
69
70
}
(-)jpa/eclipselink.jpa.wdf.test/src/org/eclipse/persistence/testing/framework/wdf/Skip.java (+5 lines)
Lines 28-31 Link Here
28
     * The databases on which this test should be skipped. Default: skip on all databases
28
     * The databases on which this test should be skipped. Default: skip on all databases
29
     */
29
     */
30
    Class<? extends DatabasePlatform>[] databases() default {};
30
    Class<? extends DatabasePlatform>[] databases() default {};
31
    
32
    /**
33
     * Indicates if this test should be skipped on server. 
34
     */
35
    boolean server() default false;
31
}
36
}
(-)jpa/eclipselink.jpa.wdf.test/src/org/eclipse/persistence/testing/framework/wdf/SkipBugzillaTestRunner.java (-10 / +98 lines)
Lines 15-25 Link Here
15
15
16
import java.lang.annotation.Annotation;
16
import java.lang.annotation.Annotation;
17
import java.lang.reflect.Method;
17
import java.lang.reflect.Method;
18
import java.util.List;
18
import java.util.Map;
19
import java.util.Map;
20
import java.util.Properties;
19
21
22
import javax.naming.Context;
23
import javax.naming.InitialContext;
24
import javax.naming.NamingException;
25
import javax.rmi.PortableRemoteObject;
26
20
import org.eclipse.persistence.config.PersistenceUnitProperties;
27
import org.eclipse.persistence.config.PersistenceUnitProperties;
21
import org.eclipse.persistence.platform.database.DatabasePlatform;
28
import org.eclipse.persistence.platform.database.DatabasePlatform;
22
import org.eclipse.persistence.testing.framework.junit.JUnitTestCaseHelper;
29
import org.eclipse.persistence.testing.framework.wdf.server.Notification;
30
import org.eclipse.persistence.testing.framework.wdf.server.ServerTestRunner;
31
import org.junit.Assert;
23
import org.junit.runner.Description;
32
import org.junit.runner.Description;
24
import org.junit.runner.notification.RunNotifier;
33
import org.junit.runner.notification.RunNotifier;
25
import org.junit.runners.BlockJUnit4ClassRunner;
34
import org.junit.runners.BlockJUnit4ClassRunner;
Lines 27-50 Link Here
27
36
28
public class SkipBugzillaTestRunner extends BlockJUnit4ClassRunner {
37
public class SkipBugzillaTestRunner extends BlockJUnit4ClassRunner {
29
38
39
    private static final String TEST_TO_BE_INVESTIGATED_RUN = "test.to-be-investigated.run";
40
    private static final String TEST_ISSUE_RUN = "test.issue.run";
41
    private static final String TEST_BUGZILLA_RUN = "test.bugzilla.run";
42
43
44
    @Override
45
    public void run(RunNotifier notifier) {
46
        if (Boolean.valueOf(System.getProperty("servertest"))) {
47
            runOnServer(notifier);
48
        } else {
49
            super.run(notifier);
50
        }
51
    }
52
53
    /**
54
     * Delegates test execution to the server. On the server, JUnit will be
55
     * invoked to run the tests with a special run listener, which collects
56
     * the notifications (events). On the client, the recorded notifications will be
57
     * replayed on the run notifier passed to this message.
58
     * @param notifier the run notifier to replay the notifications recorded on the server
59
     */
60
    private void runOnServer(RunNotifier notifier) {
61
        Properties properties = new Properties();
62
        String url = getMandatorySystemProperty("server.url");
63
        properties.put("java.naming.provider.url", url);
64
        Context context;
65
        try {
66
            context = new InitialContext(properties);
67
            String testrunner = getMandatorySystemProperty("server.testrunner.wdf");
68
            String dataSourceName = getMandatorySystemProperty("datasource.name");
69
70
            Object object = context.lookup(testrunner);
71
            ServerTestRunner runner = (ServerTestRunner) PortableRemoteObject.narrow(object, ServerTestRunner.class);
72
            String testClassName = getTestClass().getJavaClass().getName();
73
            List<Notification> notifications = runner.runTestClass(testClassName, dataSourceName, testProperties);
74
            
75
            for (Notification notification : notifications) {
76
                notification.notify(notifier);
77
            }
78
        } catch (NamingException e) {
79
            throw new RuntimeException(e);
80
        }
81
    }
82
83
    private String getMandatorySystemProperty(final String propertyName) {
84
        String url = System.getProperty(propertyName);
85
        if (url == null) {
86
            Assert.fail("System property '" + propertyName + "' must be set.");
87
        }
88
        return url;
89
    }
90
30
    final long bugid;
91
    final long bugid;
31
    final long issueid;
92
    final long issueid;
32
    final boolean runAllBugzilla;
93
    final boolean runAllBugzilla;
33
    final boolean runAllIssues;
94
    final boolean runAllIssues;
34
    final boolean runAllUnknown;
95
    final boolean runAllUnknown;
35
    final Class<? extends DatabasePlatform> databasePlatformClass;
96
    final Class<? extends DatabasePlatform> databasePlatformClass;
97
    private final Map<String, String> testProperties;
36
    
98
    
99
    
37
    @SuppressWarnings("unchecked")
100
    @SuppressWarnings("unchecked")
38
    public SkipBugzillaTestRunner(Class<?> klass) throws Throwable {
101
    public SkipBugzillaTestRunner(Class<?> klass) throws Throwable {
39
        super(klass);
102
        super(klass);
40
        
103
        
41
        Map<String, String> properties = JUnitTestCaseHelper.getDatabaseProperties();
104
        testProperties = AbstractBaseTest.getTestProperties();
105
        
106
        
107
        addProperty(TEST_BUGZILLA_RUN);
108
        addProperty(TEST_ISSUE_RUN);
109
        addProperty(TEST_TO_BE_INVESTIGATED_RUN);
42
110
43
        String databasePlatformClassName = properties.get(PersistenceUnitProperties.TARGET_DATABASE);
111
        String databasePlatformClassName = testProperties.get(PersistenceUnitProperties.TARGET_DATABASE); 
112
        
44
113
114
        if (databasePlatformClassName != null) {
45
        databasePlatformClass = (Class<? extends DatabasePlatform>) Class.forName(databasePlatformClassName);
115
        databasePlatformClass = (Class<? extends DatabasePlatform>) Class.forName(databasePlatformClassName);
116
        } else {
117
            databasePlatformClass = null; // FIXME
118
        }
46
119
47
        String testBugzillaRun = (String) properties.get("test.bugzilla.run");
120
        String testBugzillaRun = (String) testProperties.get(TEST_BUGZILLA_RUN);
48
        if ("all".equals(testBugzillaRun)) {
121
        if ("all".equals(testBugzillaRun)) {
49
            runAllBugzilla = true;
122
            runAllBugzilla = true;
50
            bugid = -1;
123
            bugid = -1;
Lines 57-63 Link Here
57
            }
130
            }
58
        }
131
        }
59
132
60
        String testIssueRun = (String) properties.get("test.issue.run");
133
        String testIssueRun = (String) testProperties.get(TEST_ISSUE_RUN);
61
        if ("all".equals(testIssueRun)) {
134
        if ("all".equals(testIssueRun)) {
62
            runAllIssues = true;
135
            runAllIssues = true;
63
            issueid = -1;
136
            issueid = -1;
Lines 70-84 Link Here
70
            }
143
            }
71
        }
144
        }
72
145
73
        String testToBeInvestigatedRun = (String) properties.get("test.to-be-investigated.run");
146
        String testToBeInvestigatedRun = (String) testProperties.get(TEST_TO_BE_INVESTIGATED_RUN);
74
        if ("all".equals(testToBeInvestigatedRun)) {
147
        if ("all".equals(testToBeInvestigatedRun)) {
75
            runAllUnknown = true;
148
            runAllUnknown = true;
76
        } else {
149
        } else {
77
            runAllUnknown = false;
150
            runAllUnknown = false;
78
        }
151
        }
152
        
79
153
80
    }
154
    }
81
155
156
    private void addProperty(final String name) {
157
        String value = System.getProperty(name);
158
        if(value != null) {
159
            testProperties.put(name, value);
160
        }
161
    }
162
82
    @Override
163
    @Override
83
    protected void runChild(FrameworkMethod method, RunNotifier notifier) {
164
    protected void runChild(FrameworkMethod method, RunNotifier notifier) {
84
        try {
165
        try {
Lines 115-124 Link Here
115
            throw new SkipException();
196
            throw new SkipException();
116
        }
197
        }
117
198
118
        for (Class<? extends DatabasePlatform> clazz : databases) {
199
        if (databasePlatformClass != null) {
119
            if (clazz.isAssignableFrom(databasePlatformClass)) {
200
            for (Class<? extends DatabasePlatform> clazz : databases) {
120
                // the current database platform is not supported
201
                if (clazz.isAssignableFrom(databasePlatformClass)) {
121
                throw new SkipException();
202
                    // the current database platform is not supported
203
                    throw new SkipException();
204
                }
122
            }
205
            }
123
        }
206
        }
124
207
Lines 148-153 Link Here
148
231
149
        @Override
232
        @Override
150
        public boolean runThis(Skip skip) {
233
        public boolean runThis(Skip skip) {
234
            
235
            if(skip.server()) {
236
                return !ServerInfoHolder.isOnServer();
237
            }
238
            
151
            return false;
239
            return false;
152
        }
240
        }
153
241
(-)jpa/eclipselink.jpa.wdf.test/src/org/eclipse/persistence/testing/tests/wdf/jpa1/entitymanager/TestEntityManagerFactory.java (+2 lines)
Lines 23-28 Link Here
23
import org.eclipse.persistence.testing.tests.wdf.jpa1.JPA1Base;
23
import org.eclipse.persistence.testing.tests.wdf.jpa1.JPA1Base;
24
import org.eclipse.persistence.testing.framework.wdf.AbstractBaseTest;
24
import org.eclipse.persistence.testing.framework.wdf.AbstractBaseTest;
25
import org.eclipse.persistence.testing.framework.wdf.JPAEnvironment;
25
import org.eclipse.persistence.testing.framework.wdf.JPAEnvironment;
26
import org.eclipse.persistence.testing.framework.wdf.Skip;
26
import org.eclipse.persistence.testing.framework.wdf.ToBeInvestigated;
27
import org.eclipse.persistence.testing.framework.wdf.ToBeInvestigated;
27
import org.eclipse.persistence.testing.models.wdf.jpa1.employee.Department;
28
import org.eclipse.persistence.testing.models.wdf.jpa1.employee.Department;
28
29
Lines 38-43 Link Here
38
    }
39
    }
39
40
40
    @Test()
41
    @Test()
42
    @Skip(server=true)
41
    public void testEntityManagerFactoryClose() throws NamingException {
43
    public void testEntityManagerFactoryClose() throws NamingException {
42
        final boolean closingEmfThrowsException = AbstractBaseTest.isInsideEngine();
44
        final boolean closingEmfThrowsException = AbstractBaseTest.isInsideEngine();
43
        final JPAEnvironment env = getEnvironment();
45
        final JPAEnvironment env = getEnvironment();
(-)jpa/eclipselink.jpa.wdf.test/src/org/eclipse/persistence/testing/tests/wdf/jpa1/entitymanager/TestRemove.java (-1 lines)
Lines 375-381 Link Here
375
        Department dep = new Department(40, "dep40");
375
        Department dep = new Department(40, "dep40");
376
        try {
376
        try {
377
            em.remove(dep);
377
            em.remove(dep);
378
            flop("exception not thrown as expected");
379
        } catch (TransactionRequiredException e) {
378
        } catch (TransactionRequiredException e) {
380
            // $JL-EXC$ expected behavior
379
            // $JL-EXC$ expected behavior
381
        } finally {
380
        } finally {
(-)jpa/eclipselink.jpa.wdf.test/src/org/eclipse/persistence/testing/tests/wdf/jpa1/lock/TestOptimistic.java (-1 / +1 lines)
Lines 242-249 Link Here
242
            caughtException = true;
242
            caughtException = true;
243
        } finally {
243
        } finally {
244
            closeEntityManager(em);
244
            closeEntityManager(em);
245
            verify(caughtException, "PersistenceException not thrown for versionModification");
246
        }
245
        }
246
        verify(caughtException, "PersistenceException not thrown for versionModification");
247
    }
247
    }
248
248
249
    @Test
249
    @Test
(-)jpa/eclipselink.jpa.wdf.test/src/org/eclipse/persistence/testing/tests/wdf/jpa1/query/TestSimpleQuery.java (-8 / +23 lines)
Lines 558-580 Link Here
558
            closeEntityManager(em);
558
            closeEntityManager(em);
559
        }
559
        }
560
    }
560
    }
561
    
562
    private static boolean hasGetmaxRowsMethod() {
563
        try {
564
            return Query.class.getMethod("getMaxResults") != null;
565
        } catch (NoSuchMethodException e) {
566
            return false;
567
        }
568
    }
561
569
562
    private void verifyRowCount(Query query, int maxRows, int startPos, int expected) {
570
    private void verifyRowCount(Query query, int maxRows, int startPos, int expected) throws SecurityException, NoSuchMethodException {
563
        query.setMaxResults(maxRows);
571
        query.setMaxResults(maxRows);
564
        query.setFirstResult(startPos);
572
        query.setFirstResult(startPos);
565
573
566
        assertEquals(query.getMaxResults(), maxRows);
574
        if (hasGetmaxRowsMethod()) {
567
        assertEquals(query.getFirstResult(), startPos);
575
            assertEquals(query.getMaxResults(), maxRows);
576
            assertEquals(query.getFirstResult(), startPos);
577
        }
568
578
569
        int count = query.getResultList().size();
579
        int count = query.getResultList().size();
570
        verify(count == expected, "wrong row count: " + count);
580
        verify(count == expected, "wrong row count: " + count);
571
        
581
572
        assertEquals(query.getMaxResults(), maxRows);
582
        if (hasGetmaxRowsMethod()) {
573
        assertEquals(query.getFirstResult(), startPos);
583
            assertEquals(query.getMaxResults(), maxRows);
584
            assertEquals(query.getFirstResult(), startPos);
585
        }
574
    }
586
    }
575
587
576
    @Test
588
    @Test
577
    public void testMaxResult() throws SQLException {
589
    public void testMaxResult() throws SQLException, SecurityException, NoSuchMethodException {
578
        clearAllTables();
590
        clearAllTables();
579
        JPAEnvironment env = getEnvironment();
591
        JPAEnvironment env = getEnvironment();
580
        EntityManager em = env.getEntityManager();
592
        EntityManager em = env.getEntityManager();
Lines 601-607 Link Here
601
    }
613
    }
602
614
603
    @Test
615
    @Test
604
    public void testMaxResultUnlimited() throws SQLException {
616
    public void testMaxResultUnlimited() throws SQLException, SecurityException, NoSuchMethodException {
605
        clearAllTables();
617
        clearAllTables();
606
        JPAEnvironment env = getEnvironment();
618
        JPAEnvironment env = getEnvironment();
607
        EntityManager em = env.getEntityManager();
619
        EntityManager em = env.getEntityManager();
Lines 623-628 Link Here
623
    
635
    
624
    @Test
636
    @Test
625
    public void testPagingDefaults() throws SQLException {
637
    public void testPagingDefaults() throws SQLException {
638
        if (!hasGetmaxRowsMethod()) {
639
            return;
640
        }
626
        JPAEnvironment env = getEnvironment();
641
        JPAEnvironment env = getEnvironment();
627
        EntityManager em = env.getEntityManager();
642
        EntityManager em = env.getEntityManager();
628
        try {
643
        try {
(-)jpa/eclipselink.jpa.wdf.test/src/org/eclipse/persistence/testing/tests/wdf/jpa1/relation/TestBidirectionalManyToMany.java (+27 lines)
Lines 425-430 Link Here
425
    }
425
    }
426
426
427
    @Test
427
    @Test
428
    public void testCopyProjectsToExistingTouching() throws SQLException {
429
        // copy all projects from hans to a new employee with out actually touching them
430
        JPAEnvironment env = getEnvironment();
431
        EntityManager em = env.getEntityManager();
432
        try {
433
            env.beginTransaction(em);
434
            Employee hans = em.find(Employee.class, HANS_ID);
435
            Employee fred = em.find(Employee.class, FRED_ID);
436
            hans.getProjects().size();
437
            fred.setProjects(hans.getProjects());
438
            env.commitTransactionAndClear(em);
439
            Set<Pair> expected = new HashSet<Pair>(SEED_SET);
440
            expected.removeAll(FRED_SET);
441
            for (Pair pair : HANS_SET) {
442
                expected.add(new Pair(FRED_ID_VALUE, pair.getProjectId()));
443
            }
444
            checkJoinTable(expected);
445
            env.beginTransaction(em);
446
            fred = em.find(Employee.class, FRED_ID);
447
            verify(fred.getProjects().size() == HANS_SET.size(), "Paul has wrong number of projects");
448
            env.rollbackTransactionAndClear(em);
449
        } finally {
450
            closeEntityManager(em);
451
        }
452
    }
453
454
    @Test
428
    @Issue(issueid = 10)
455
    @Issue(issueid = 10)
429
    public void testGuidCollection() throws SQLException {
456
    public void testGuidCollection() throws SQLException {
430
        JPAEnvironment env = getEnvironment();
457
        JPAEnvironment env = getEnvironment();
(-)jpa/eclipselink.jpa.wdf.test/src/org/eclipse/persistence/testing/tests/wdf/jpa1/simple/BufferReadTest.java (-1 lines)
Lines 312-318 Link Here
312
                    public void run() {
312
                    public void run() {
313
                        try {
313
                        try {
314
                            ResultSet rs = preparedStatement.executeQuery();
314
                            ResultSet rs = preparedStatement.executeQuery();
315
                            connection.commit();
316
                            try {
315
                            try {
317
                                rs.next();
316
                                rs.next();
318
                                new Department(rs.getInt(1), rs.getString(2));
317
                                new Department(rs.getInt(1), rs.getString(2));
(-)jpa/eclipselink.jpa.wdf.test/src/org/eclipse/persistence/testing/tests/wdf/jpa2/embeddable/TestEmbeddingWithMixedAccess.java (+3 lines)
Lines 16-21 Link Here
16
import javax.persistence.EntityManager;
16
import javax.persistence.EntityManager;
17
17
18
import org.eclipse.persistence.testing.framework.wdf.JPAEnvironment;
18
import org.eclipse.persistence.testing.framework.wdf.JPAEnvironment;
19
import org.eclipse.persistence.testing.framework.wdf.Skip;
19
import org.eclipse.persistence.testing.models.wdf.jpa2.embedded.EmbeddedFieldAccess;
20
import org.eclipse.persistence.testing.models.wdf.jpa2.embedded.EmbeddedFieldAccess;
20
import org.eclipse.persistence.testing.models.wdf.jpa2.embedded.EmbeddedPropertyAccess;
21
import org.eclipse.persistence.testing.models.wdf.jpa2.embedded.EmbeddedPropertyAccess;
21
import org.eclipse.persistence.testing.models.wdf.jpa2.embedded.EmbeddingFieldAccess;
22
import org.eclipse.persistence.testing.models.wdf.jpa2.embedded.EmbeddingFieldAccess;
Lines 25-30 Link Here
25
public class TestEmbeddingWithMixedAccess extends JPA2Base {
26
public class TestEmbeddingWithMixedAccess extends JPA2Base {
26
27
27
    @Test
28
    @Test
29
    @Skip(server=true)
28
    public void testFieldAccess() {
30
    public void testFieldAccess() {
29
        JPAEnvironment env = getEnvironment();
31
        JPAEnvironment env = getEnvironment();
30
        EntityManager em = env.getEntityManager();
32
        EntityManager em = env.getEntityManager();
Lines 45-50 Link Here
45
    }
47
    }
46
48
47
    @Test
49
    @Test
50
    @Skip(server=true)
48
    public void testPropertyAccess() {
51
    public void testPropertyAccess() {
49
        JPAEnvironment env = getEnvironment();
52
        JPAEnvironment env = getEnvironment();
50
        EntityManager em = env.getEntityManager();
53
        EntityManager em = env.getEntityManager();
(-)jpa/eclipselink.jpa.wdf.test/src/org/eclipse/persistence/testing/tests/wdf/jpa2/embeddable/TestNestedEmbeddables.java (+6 lines)
Lines 23-28 Link Here
23
import javax.persistence.Query;
23
import javax.persistence.Query;
24
24
25
import org.eclipse.persistence.testing.framework.wdf.JPAEnvironment;
25
import org.eclipse.persistence.testing.framework.wdf.JPAEnvironment;
26
import org.eclipse.persistence.testing.framework.wdf.Skip;
26
import org.eclipse.persistence.testing.models.wdf.jpa2.employee.Address;
27
import org.eclipse.persistence.testing.models.wdf.jpa2.employee.Address;
27
import org.eclipse.persistence.testing.models.wdf.jpa2.employee.ContactInfo;
28
import org.eclipse.persistence.testing.models.wdf.jpa2.employee.ContactInfo;
28
import org.eclipse.persistence.testing.models.wdf.jpa2.employee.Employee;
29
import org.eclipse.persistence.testing.models.wdf.jpa2.employee.Employee;
Lines 43-48 Link Here
43
    private static final String ORANGE = "Orange";
44
    private static final String ORANGE = "Orange";
44
45
45
    @Test
46
    @Test
47
    @Skip(server=true)
46
    public void testNonNested() {
48
    public void testNonNested() {
47
        JPAEnvironment env = getEnvironment();
49
        JPAEnvironment env = getEnvironment();
48
        EntityManager em = env.getEntityManager();
50
        EntityManager em = env.getEntityManager();
Lines 62-67 Link Here
62
    }
64
    }
63
65
64
    @Test
66
    @Test
67
    @Skip(server=true)
65
    public void testNested() {
68
    public void testNested() {
66
        JPAEnvironment env = getEnvironment();
69
        JPAEnvironment env = getEnvironment();
67
        EntityManager em = env.getEntityManager();
70
        EntityManager em = env.getEntityManager();
Lines 115-120 Link Here
115
    }
118
    }
116
119
117
    @Test
120
    @Test
121
    @Skip(server=true)
118
    public void testNestedOuterNull() {
122
    public void testNestedOuterNull() {
119
        JPAEnvironment env = getEnvironment();
123
        JPAEnvironment env = getEnvironment();
120
        EntityManager em = env.getEntityManager();
124
        EntityManager em = env.getEntityManager();
Lines 148-153 Link Here
148
    }
152
    }
149
153
150
    @Test
154
    @Test
155
    @Skip(server=true)
151
    public void testNestedInnerNull() {
156
    public void testNestedInnerNull() {
152
        JPAEnvironment env = getEnvironment();
157
        JPAEnvironment env = getEnvironment();
153
        EntityManager em = env.getEntityManager();
158
        EntityManager em = env.getEntityManager();
Lines 184-189 Link Here
184
    }
189
    }
185
190
186
    @Test
191
    @Test
192
    @Skip(server=true)
187
    public void testNestedQuery() {
193
    public void testNestedQuery() {
188
        JPAEnvironment env = getEnvironment();
194
        JPAEnvironment env = getEnvironment();
189
        EntityManager em = env.getEntityManager();
195
        EntityManager em = env.getEntityManager();

Return to bug 301295