|
1 |
| -<?xml version="1.0"?> |
2 |
| -<!-- |
3 |
| - This file is licensed to You under the Apache License, Version 2.0 |
4 |
| - (the "License"); you may not use this file except in compliance with |
5 |
| - the License. You may obtain a copy of the License at |
| 1 | +#!/bin/sh |
| 2 | +set -e |
6 | 3 |
|
7 |
| - http://www.apache.org/licenses/LICENSE-2.0 |
| 4 | +if [ "$#" -ne 2 ]; then |
| 5 | + echo "Usage: hamcrest-test.sh XMLUNIT_VERSION HAMCREST_VERSION" |
| 6 | + exit 1 |
| 7 | +fi |
8 | 8 |
|
9 |
| - Unless required by applicable law or agreed to in writing, software |
10 |
| - distributed under the License is distributed on an "AS IS" BASIS, |
11 |
| - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 |
| - See the License for the specific language governing permissions and |
13 |
| - limitations under the License. |
14 |
| ---> |
| 9 | +XMLUNIT_VERSION=$1 |
| 10 | +HAMCREST_VERSION=$2 |
| 11 | + |
| 12 | +SCRATCH_DIR=scratch/hamcrest-${HAMCREST_VERSION} |
| 13 | + |
| 14 | +rm -rf scratch && mkdir -p ${SCRATCH_DIR}/src/test/java/org/xmlunit/ |
| 15 | + |
| 16 | +cat > ${SCRATCH_DIR}/pom.xml <<EOF |
| 17 | +<?xml version="1.0"?> |
15 | 18 | <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
16 | 19 | <modelVersion>4.0.0</modelVersion>
|
17 | 20 |
|
18 | 21 | <parent>
|
19 | 22 | <groupId>org.xmlunit</groupId>
|
20 | 23 | <artifactId>xmlunit-parent</artifactId>
|
21 |
| - <version>2.6.5-SNAPSHOT</version> |
22 |
| - <relativePath>../..</relativePath> |
| 24 | + <version>${XMLUNIT_VERSION}</version> |
| 25 | + <relativePath>../../..</relativePath> |
23 | 26 | </parent>
|
24 | 27 |
|
25 | 28 | <groupId>org.xmlunit</groupId>
|
26 |
| - <artifactId>xmlunit-compat-tests-hamcrest-2.x</artifactId> |
| 29 | + <artifactId>xmlunit-compat-tests-hamcrest-${HAMCREST_VERSION}</artifactId> |
27 | 30 | <packaging>jar</packaging>
|
28 |
| - <name>org.xmlunit:xmlunit-compat-tests-hamcrest-2.x</name> |
29 |
| - <description>Verifies the Hamcrest Matchers are compatible with the latest version of Hamcrest</description> |
| 31 | + <name>org.xmlunit:xmlunit-compat-tests-hamcrest-${HAMCREST_VERSION}</name> |
| 32 | + <description>Verifies the Hamcrest Matchers are compatible with Hamcrest ${HAMCREST_VERSION}</description> |
30 | 33 | <url>https://www.xmlunit.org/</url>
|
31 | 34 |
|
32 | 35 | <properties>
|
33 |
| - <automatic.module.name>${project.groupId}.compat-tests-hamcrest-2.x</automatic.module.name> |
34 |
| - <hamcrest.version>2.2</hamcrest.version> |
| 36 | + <automatic.module.name>\${project.groupId}.compat-tests-hamcrest-${HAMCREST_VERSION}</automatic.module.name> |
| 37 | + <hamcrest.version>${HAMCREST_VERSION}</hamcrest.version> |
35 | 38 | </properties>
|
36 | 39 |
|
37 | 40 | <dependencies>
|
|
48 | 51 | <dependency>
|
49 | 52 | <groupId>org.hamcrest</groupId>
|
50 | 53 | <artifactId>hamcrest-core</artifactId>
|
51 |
| - <version>${hamcrest.version}</version> |
| 54 | + <version>\${hamcrest.version}</version> |
52 | 55 | <scope>test</scope>
|
53 | 56 | </dependency>
|
54 | 57 | <dependency>
|
55 | 58 | <groupId>org.hamcrest</groupId>
|
56 | 59 | <artifactId>hamcrest-library</artifactId>
|
57 |
| - <version>${hamcrest.version}</version> |
| 60 | + <version>\${hamcrest.version}</version> |
58 | 61 | <scope>test</scope>
|
59 | 62 | </dependency>
|
60 | 63 | <dependency>
|
|
69 | 72 | </dependency>
|
70 | 73 | </dependencies>
|
71 | 74 | </project>
|
| 75 | +EOF |
| 76 | + |
| 77 | +cat > ${SCRATCH_DIR}/src/test/java/org/xmlunit/TestResources.java <<'EOF' |
| 78 | +/* |
| 79 | + This file is licensed to You under the Apache License, Version 2.0 |
| 80 | + (the "License"); you may not use this file except in compliance with |
| 81 | + the License. You may obtain a copy of the License at |
| 82 | +
|
| 83 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 84 | +
|
| 85 | + Unless required by applicable law or agreed to in writing, software |
| 86 | + distributed under the License is distributed on an "AS IS" BASIS, |
| 87 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 88 | + See the License for the specific language governing permissions and |
| 89 | + limitations under the License. |
| 90 | +*/ |
| 91 | +package org.xmlunit; |
| 92 | +
|
| 93 | +public final class TestResources { |
| 94 | + public static final String TEST_RESOURCE_DIR = "../../../test-resources/"; |
| 95 | +
|
| 96 | + public static final String ANIMAL_FILE = TEST_RESOURCE_DIR + "test1.xml"; |
| 97 | + public static final String BLAME_FILE = TEST_RESOURCE_DIR + "test.blame.html"; |
| 98 | + public static final String ANIMAL_XSL = TEST_RESOURCE_DIR + "animal.xsl"; |
| 99 | + public static final String DOG_FILE = TEST_RESOURCE_DIR + "testAnimal.xml"; |
| 100 | +
|
| 101 | + public static final String BOOK_DTD = TEST_RESOURCE_DIR + "Book.dtd"; |
| 102 | + public static final String BOOK_XSD = TEST_RESOURCE_DIR + "Book.xsd"; |
| 103 | +
|
| 104 | + private TestResources() { } |
| 105 | +} |
| 106 | +EOF |
| 107 | + |
| 108 | +cp -r ../xmlunit-matchers/src/test/java/org/xmlunit/bugreports ${SCRATCH_DIR}/src/test/java/org/xmlunit |
| 109 | +cp -r ../xmlunit-matchers/src/test/java/org/xmlunit/matchers ${SCRATCH_DIR}/src/test/java/org/xmlunit |
| 110 | + |
| 111 | +mvn -f ${SCRATCH_DIR}/pom.xml test |
| 112 | + |
0 commit comments