blob: b5cf5941b0604d0ee84ad491900fb83e339abfff [file] [log] [blame]
David Kral57316042019-09-03 11:22:43 +02001#!/bin/bash -x
2#
3# Copyright (c) 2019 Oracle and/or its affiliates. All rights reserved.
4# This program and the accompanying materials are made available under the
5# terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
6# which accompanies this distribution.
7# The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
8# and the Eclipse Distribution License is available at
9# http://www.eclipse.org/org/documents/edl-v10.php.
10#
11
Andrew Guibert3260ca32019-09-03 12:12:33 -050012mvn clean install -DskipTests
David Kral57316042019-09-03 11:22:43 +020013
14GF_BUNDLE_URL="central.maven.org/maven2/org/glassfish/main/distributions/glassfish/5.1.0/glassfish-5.1.0.zip"
15TCK_NAME=jsonb-tck
Andrew Guibert3260ca32019-09-03 12:12:33 -050016TCK_VERSION=1.0.0
17
18export TCK_HOME=`pwd`"/target-tck"
Andrew Guibertc204eae2019-09-03 12:15:24 -050019rm -r ${TCK_HOME}
20mkdir ${TCK_HOME}
21cd ${TCK_HOME}
22TS_HOME=${TCK_HOME}/${TCK_NAME}
David Kral57316042019-09-03 11:22:43 +020023
David Kral57316042019-09-03 11:22:43 +020024echo "Downloading JSON-B TCK tests"
Andrew Guibertc204eae2019-09-03 12:15:24 -050025wget -q http://download.eclipse.org/ee4j/jakartaee-tck/jakartaee8-eftl/promoted/eclipse-${TCK_NAME}-$TCK_VERSION.zip
David Kral57316042019-09-03 11:22:43 +020026echo "Exporting downloaded TCK tests"
Andrew Guibertc204eae2019-09-03 12:15:24 -050027unzip -qq eclipse-${TCK_NAME}-*.zip -d ${TCK_HOME}
David Kral57316042019-09-03 11:22:43 +020028
29echo "Downloading GlassFish"
Andrew Guibertc204eae2019-09-03 12:15:24 -050030wget -q --no-cache ${GF_BUNDLE_URL} -O latest-glassfish.zip
David Kral57316042019-09-03 11:22:43 +020031echo "Exporting downloaded GlassFish"
32unzip -qq ${TCK_HOME}/latest-glassfish.zip -d ${TCK_HOME}
33
34cp -a ${TCK_HOME}/target/yasson.jar ${TCK_HOME}/glassfish5/glassfish/modules/yasson.jar
35
Andrew Guibertc204eae2019-09-03 12:15:24 -050036cd ${TS_HOME}/bin
David Kral57316042019-09-03 11:22:43 +020037
Andrew Guibertc204eae2019-09-03 12:15:24 -050038# Intentionally no space between "-i" and ".bak" for interop with both MacOS and Linux
39sed -i.bak "s#^report.dir=.*#report.dir=${TS_HOME}report/${TCK_NAME}#g" ts.jte
40sed -i.bak "s#^work.dir=.*#work.dir=${TS_HOME}work/${TCK_NAME}#g" ts.jte
41sed -i.bak "s#jsonb\.classes=.*#jsonb.classes=${TCK_HOME}/glassfish5/glassfish/modules/jakarta.json.jar:${TCK_HOME}/glassfish5/glassfish/modules/jakarta.json.bind-api.jar:${TCK_HOME}/glassfish5/glassfish/modules/jakarta.json.jar:${TCK_HOME}/glassfish5/glassfish/modules/jakarta.inject.jar:${TCK_HOME}/glassfish5/glassfish/modules/jakarta.servlet-api.jar:${TCK_HOME}/glassfish5/glassfish/modules/yasson.jar#" ts.jte
David Kral57316042019-09-03 11:22:43 +020042
43# TCK test excludes
44# JDK 11 have date formating changed
45echo "com/sun/ts/tests/jsonb/api/annotation/AnnotationTest.java#testJsonbDateFormat_from_standalone" >> ts.jtx
46# Support for big numbers moved to Json-p
47# https://github.com/eclipse-ee4j/jsonb-api/issues/180
48echo "com/sun/ts/tests/jsonb/defaultmapping/basictypes/BasicJavaTypesMappingTest.java#testLongMapping_from_standalone" >> ts.jtx
49echo "com/sun/ts/tests/jsonb/defaultmapping/bignumbers/BigNumbersMappingTest.java#testBigNumberMarshalling_from_standalone" >> ts.jtx
50# There is incorrect negative test on deserialization of EnumMap and EnumSet. Both of them are not defined by the spec so their
51# support is up to the implementation. There should be no negative test present.
52# EnumMap https://github.com/eclipse-ee4j/yasson/issues/283
53# EnumSet https://github.com/eclipse-ee4j/yasson/issues/272
54echo "com/sun/ts/tests/jsonb/defaultmapping/collections/CollectionsMappingTest.java#testEnumMap_from_standalone" >> ts.jtx
55echo "com/sun/ts/tests/jsonb/defaultmapping/collections/CollectionsMappingTest.java#testEnumSet_from_standalone" >> ts.jtx
56# Signature test needs to run on JDK 1.8 . This allowes us to run on any JDK.
57echo "com/sun/ts/tests/signaturetest/jsonb/JSONBSigTest.java#signatureTest_from_standalone" >> ts.jtx
58
59mkdir -p ${TS_HOME}report/${TCK_NAME}
60mkdir -p ${TS_HOME}work/${TCK_NAME}
61
62# ant config.vi
Andrew Guibertc204eae2019-09-03 12:15:24 -050063cd ${TS_HOME}/src/com/sun/ts/tests/
David Kral57316042019-09-03 11:22:43 +020064#ant deploy.all
65ant run.all | tee ${TCK_HOME}/result.log
66export FAILED_COUNT=`grep -c "Finished Test: FAILED" ${TCK_HOME}/result.log`
67
68if [ "${FAILED_COUNT}" -gt "0" ]
69then
70 echo "FAILED TCK TESTS FOUND"
71 exit 1
72else
73 echo "TCK OK"
74 exit 0
75fi