Skip to content
This repository was archived by the owner on May 28, 2018. It is now read-only.

Commit c15bdd6

Browse files
author
Adam Lindenthal
committed
J-87 Fix moxy and xdk hudson jobs
Change-Id: I960c72f406f42c748bf6ddd2d8581a49748a9298
1 parent d3b0e84 commit c15bdd6

File tree

4 files changed

+86
-37
lines changed

4 files changed

+86
-37
lines changed

core-common/pom.xml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,12 +221,27 @@
221221

222222
<profiles>
223223
<profile>
224-
<id>xdk</id>
224+
<id>securityOff</id>
225225
<properties>
226-
<!-- do not use security manager for xdk -->
227-
<surefire.security.argline />
226+
<surefire.security.argline />
228227
</properties>
228+
<build>
229+
<plugins>
230+
<plugin>
231+
<groupId>org.apache.maven.plugins</groupId>
232+
<artifactId>maven-surefire-plugin</artifactId>
233+
<inherited>true</inherited>
234+
<configuration combine.self="append">
235+
<excludes>
236+
<exclude>**/SecurityManagerConfiguredTest.java</exclude>
237+
<exclude>**/ReflectionHelperTest.java</exclude>
238+
</excludes>
239+
</configuration>
240+
</plugin>
241+
</plugins>
242+
</build>
229243
</profile>
244+
230245
</profiles>
231246

232247
<properties>

core-server/pom.xml

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -201,16 +201,24 @@
201201

202202
<profiles>
203203
<profile>
204-
<id>moxy</id>
205-
<properties>
206-
<surefire.security.argline />
207-
</properties>
208-
</profile>
209-
<profile>
210-
<id>xdk</id>
204+
<id>securityOff</id>
211205
<properties>
212206
<surefire.security.argline />
213207
</properties>
208+
<build>
209+
<plugins>
210+
<plugin>
211+
<groupId>org.apache.maven.plugins</groupId>
212+
<artifactId>maven-surefire-plugin</artifactId>
213+
<inherited>true</inherited>
214+
<configuration combine.self="append">
215+
<excludes>
216+
<exclude>**/SecurityManagerConfiguredTest.java</exclude>
217+
</excludes>
218+
</configuration>
219+
</plugin>
220+
</plugins>
221+
</build>
214222
</profile>
215223
</profiles>
216224

pom.xml

Lines changed: 33 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -721,6 +721,7 @@
721721
<build>
722722
<plugins>
723723
<plugin>
724+
<!-- add xdk sax parser to the classpath and exclude xerces -->
724725
<groupId>org.apache.maven.plugins</groupId>
725726
<artifactId>maven-surefire-plugin</artifactId>
726727
<inherited>true</inherited>
@@ -731,13 +732,34 @@
731732
<classpathDependencyExcludes>
732733
<classpathDependencyExcludes>xerces:xercesImpl</classpathDependencyExcludes>
733734
</classpathDependencyExcludes>
734-
<excludes>
735-
<exclude>**/ReflectionHelperTest.java</exclude><!-- security is off for moxy, skip -->
736-
<exclude>**/e2e/server/monitoring/*.java</exclude><!-- contains jdk7 only tests -->
737-
<exclude>**/EntityExpansionTest.java</exclude><!-- does not work with xdk SaxParser -->
738-
</excludes>
739735
</configuration>
740736
</plugin>
737+
<plugin>
738+
<!-- ensure, that the path to the xdk sax parser has been set -->
739+
<groupId>org.apache.maven.plugins</groupId>
740+
<artifactId>maven-enforcer-plugin</artifactId>
741+
<executions>
742+
<execution>
743+
<id>enforce-property</id>
744+
<goals>
745+
<goal>enforce</goal>
746+
</goals>
747+
<configuration>
748+
<rules>
749+
<requireProperty>
750+
<property>xdk.absolute.path</property>
751+
<message>Property 'xdk.absolute.path' has to be specified.</message>
752+
<regex>.*/xmlparserv2.jar$</regex>
753+
<regexMessage>
754+
Property 'xdk.absolute.path' has to point to the xdk parser jar (xmlparserv2.jar).
755+
</regexMessage>
756+
</requireProperty>
757+
</rules>
758+
<fail>true</fail>
759+
</configuration>
760+
</execution>
761+
</executions>
762+
</plugin>
741763
</plugins>
742764
</build>
743765
</profile>
@@ -755,25 +777,6 @@
755777
<version>${moxy.version}</version>
756778
</dependency>
757779
</dependencies>
758-
<build>
759-
<plugins>
760-
<plugin>
761-
<groupId>org.apache.maven.plugins</groupId>
762-
<artifactId>maven-surefire-plugin</artifactId>
763-
<inherited>true</inherited>
764-
<configuration>
765-
<systemPropertyVariables>
766-
<javax.xml.bind.JAXBContext>org.eclipse.persistence.jaxb.JAXBContextFactory</javax.xml.bind.JAXBContext>
767-
</systemPropertyVariables>
768-
<excludes>
769-
<exclude>**/ReflectionHelperTest.java</exclude><!-- security is off for moxy, skip -->
770-
<exclude>**/e2e/server/monitoring/*.java</exclude><!-- contains jdk7 only tests -->
771-
<exclude>**/e2e/server/wadl/*.java</exclude><!-- works, but unstable with moxy -->
772-
</excludes>
773-
</configuration>
774-
</plugin>
775-
</plugins>
776-
</build>
777780
<repositories>
778781
<repository>
779782
<id>eclipselink.repository</id>
@@ -783,6 +786,12 @@
783786
</repository>
784787
</repositories>
785788
</profile>
789+
<profile>
790+
<id>securityOff</id>
791+
<properties>
792+
<surefire.security.argline />
793+
</properties>
794+
</profile>
786795
<profile>
787796
<id>project-info</id>
788797
<activation>

tests/e2e/src/test/java/org/glassfish/jersey/tests/e2e/server/EntityExpansionTest.java

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
33
*
4-
* Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
4+
* Copyright (c) 2013-2014 Oracle and/or its affiliates. All rights reserved.
55
*
66
* The contents of this file are subject to the terms of either the GNU
77
* General Public License Version 2 only ("GPL") or the Common Development
@@ -40,6 +40,8 @@
4040

4141
package org.glassfish.jersey.tests.e2e.server;
4242

43+
import java.util.logging.Logger;
44+
4345
import javax.ws.rs.BadRequestException;
4446
import javax.ws.rs.POST;
4547
import javax.ws.rs.Path;
@@ -54,11 +56,15 @@
5456
import javax.xml.bind.annotation.XmlAttribute;
5557
import javax.xml.bind.annotation.XmlElement;
5658
import javax.xml.bind.annotation.XmlRootElement;
59+
import javax.xml.parsers.SAXParserFactory;
5760

61+
import org.glassfish.jersey.internal.util.SaxHelper;
5862
import org.glassfish.jersey.server.ResourceConfig;
5963
import org.glassfish.jersey.test.JerseyTest;
6064

6165
import org.junit.Assert;
66+
import org.junit.Assume;
67+
import org.junit.BeforeClass;
6268
import org.junit.Test;
6369
import org.xml.sax.SAXParseException;
6470

@@ -69,6 +75,9 @@
6975
*/
7076
public class EntityExpansionTest extends JerseyTest {
7177

78+
private static final Logger LOG = Logger.getLogger(EntityExpansionTest.class.getName());
79+
private static boolean isXdk = false;
80+
7281
@Override
7382
protected Application configure() {
7483
System.setProperty("entityExpansionLimit", "10");
@@ -152,6 +161,16 @@ public void setInput(String input) {
152161
}
153162
}
154163

164+
@BeforeClass
165+
public static void setXdkFlag() {
166+
// XDK SAXParser does not support this feature, so the test has to be skipped if XDK detected.
167+
if (SaxHelper.isXdkParserFactory(SAXParserFactory.newInstance())) {
168+
LOG.warning("XDK SAXParser detected, FEATURE_SECURE_PROCESSING is not supported. Tests will be skipped.");
169+
isXdk = true;
170+
}
171+
Assume.assumeTrue(!isXdk);
172+
}
173+
155174
@Test
156175
public void testEntityExpansion() {
157176
String str = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" +
@@ -166,7 +185,6 @@ public void testEntityExpansion() {
166185
Assert.assertEquals(200, response.getStatus());
167186
final String entity = response.readEntity(String.class);
168187
Assert.assertTrue(entity.startsWith("PASSED"));
169-
System.out.println(entity);
170188
}
171189

172190
@Test
@@ -177,7 +195,6 @@ public void testMaxAttributes() {
177195
Assert.assertEquals(200, response.getStatus());
178196
final String entity = response.readEntity(String.class);
179197
Assert.assertTrue(entity.startsWith("PASSED"));
180-
System.out.println(entity);
181198
}
182199

183200
}

0 commit comments

Comments
 (0)