Fix a few tests and don't crash on old Woodstox

This commit is contained in:
James Agnew 2015-09-04 13:59:57 -04:00
parent e3c3600700
commit abdfb50b40
23 changed files with 56 additions and 35 deletions

View File

@ -1,5 +1,4 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <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/xsd/maven-4.0.0.xsd">
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
@ -19,14 +18,19 @@
<dependency> <dependency>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId> <artifactId>slf4j-api</artifactId>
<version>1.6.0</version> <version>1.6.0</version><!--$NO-MVN-MAN-VER$ -->
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId> <artifactId>slf4j-simple</artifactId>
<version>1.6.0</version> <version>1.6.0</version>
</dependency> </dependency>
<!--
Woodstox note: The hapi-fhir-base-testmindeps-client project includes no Woodstox at all, so that we use the
StAX version that's bundled with the JDK. The hapi-fhir-base-testmindeps-server
project uses a really old Woodstox version so that we test that.
-->
<dependency> <dependency>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId> <artifactId>hapi-fhir-base</artifactId>
@ -64,7 +68,7 @@
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@ -26,6 +26,17 @@
<version>1.7.7</version> <version>1.7.7</version>
</dependency> </dependency>
<!--
Woodstox note: The hapi-fhir-base-testmindeps-client project includes no Woodstox at all, so that we use the
StAX version that's bundled with the JDK. The hapi-fhir-base-testmindeps-server
project uses a really old Woodstox version so that we test that.
-->
<dependency>
<groupId>org.codehaus.woodstox</groupId>
<artifactId>wstx-asl</artifactId>
<version>3.0.0</version>
</dependency>
<dependency> <dependency>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId> <artifactId>hapi-fhir-base</artifactId>

View File

@ -5,10 +5,9 @@ import org.junit.Test;
public class SetupTest { public class SetupTest {
/** /**
* Ensure that Woodstox is not on the classpath (we're testing that the library works ok without it * Ensure that Woodstox is on the classpath
* elsewhere)
*/ */
@Test(expected=ClassNotFoundException.class) @Test()
public void testValidateEnvironment() throws ClassNotFoundException { public void testValidateEnvironment() throws ClassNotFoundException {
Class.forName("com.ctc.wstx.stax.WstxOutputFactory"); Class.forName("com.ctc.wstx.stax.WstxOutputFactory");
} }

View File

@ -1,10 +1,14 @@
package ca.uhn.fhir.testmindeps; package ca.uhn.fhir.testmindeps;
import static org.junit.Assert.*; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import org.junit.Test; import org.junit.Test;
import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.model.dstu2.resource.Patient;
import ca.uhn.fhir.validation.FhirValidator; import ca.uhn.fhir.validation.FhirValidator;
public class ValidatorTest { public class ValidatorTest {
@ -15,6 +19,8 @@ public class ValidatorTest {
FhirContext ctx = new FhirContext(); FhirContext ctx = new FhirContext();
FhirValidator val = ctx.newValidator(); FhirValidator val = ctx.newValidator();
val.validateWithResult(new Patient());
// Phloc is not onthe classpath // Phloc is not onthe classpath
assertTrue(val.isValidateAgainstStandardSchema()); assertTrue(val.isValidateAgainstStandardSchema());
assertFalse(val.isValidateAgainstStandardSchematron()); assertFalse(val.isValidateAgainstStandardSchematron());

View File

@ -1575,7 +1575,11 @@ public class XmlUtil {
if (inputFactory instanceof com.ctc.wstx.stax.WstxInputFactory) { if (inputFactory instanceof com.ctc.wstx.stax.WstxInputFactory) {
// inputFactory.setProperty(WstxInputFactory.IS_REPLACING_ENTITY_REFERENCES, false); // inputFactory.setProperty(WstxInputFactory.IS_REPLACING_ENTITY_REFERENCES, false);
inputFactory.setProperty(WstxInputProperties.P_UNDECLARED_ENTITY_RESOLVER, XML_RESOLVER); inputFactory.setProperty(WstxInputProperties.P_UNDECLARED_ENTITY_RESOLVER, XML_RESOLVER);
inputFactory.setProperty(WstxInputProperties.P_MAX_ATTRIBUTE_SIZE, "100000000"); try {
inputFactory.setProperty(WstxInputProperties.P_MAX_ATTRIBUTE_SIZE, "100000000");
} catch (IllegalArgumentException e) {
// ignore
}
} }
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
ourLog.debug("WstxOutputFactory (Woodstox) not found on classpath"); ourLog.debug("WstxOutputFactory (Woodstox) not found on classpath");

View File

@ -2,7 +2,7 @@ package ca.uhn.fhir.model.dstu2;
/* /*
* #%L * #%L
* HAPI FHIR Structures - DSTU2 (FHIR v0.5.0) * HAPI FHIR Structures - DSTU2 (FHIR v1.0.0)
* %% * %%
* Copyright (C) 2014 - 2015 University Health Network * Copyright (C) 2014 - 2015 University Health Network
* %% * %%

View File

@ -5,7 +5,7 @@ import ca.uhn.fhir.model.dstu2.composite.QuantityDt;
/* /*
* #%L * #%L
* HAPI FHIR Structures - DSTU2 (FHIR v0.5.0) * HAPI FHIR Structures - DSTU2 (FHIR v1.0.0)
* %% * %%
* Copyright (C) 2014 - 2015 University Health Network * Copyright (C) 2014 - 2015 University Health Network
* %% * %%

View File

@ -2,7 +2,7 @@ package ca.uhn.fhir.model.dstu2.composite;
/* /*
* #%L * #%L
* HAPI FHIR Structures - DSTU2 (FHIR v0.5.0) * HAPI FHIR Structures - DSTU2 (FHIR v1.0.0)
* %% * %%
* Copyright (C) 2014 - 2015 University Health Network * Copyright (C) 2014 - 2015 University Health Network
* %% * %%

View File

@ -2,7 +2,7 @@ package ca.uhn.fhir.model.dstu2.composite;
/* /*
* #%L * #%L
* HAPI FHIR Structures - DSTU2 (FHIR v0.5.0) * HAPI FHIR Structures - DSTU2 (FHIR v1.0.0)
* %% * %%
* Copyright (C) 2014 - 2015 University Health Network * Copyright (C) 2014 - 2015 University Health Network
* %% * %%

View File

@ -5,7 +5,7 @@ import ca.uhn.fhir.model.dstu2.composite.QuantityDt;
/* /*
* #%L * #%L
* HAPI FHIR Structures - DSTU2 (FHIR v0.5.0) * HAPI FHIR Structures - DSTU2 (FHIR v1.0.0)
* %% * %%
* Copyright (C) 2014 - 2015 University Health Network * Copyright (C) 2014 - 2015 University Health Network
* %% * %%

View File

@ -5,7 +5,7 @@ import ca.uhn.fhir.model.dstu2.composite.QuantityDt;
/* /*
* #%L * #%L
* HAPI FHIR Structures - DSTU2 (FHIR v0.5.0) * HAPI FHIR Structures - DSTU2 (FHIR v1.0.0)
* %% * %%
* Copyright (C) 2014 - 2015 University Health Network * Copyright (C) 2014 - 2015 University Health Network
* %% * %%

View File

@ -5,7 +5,7 @@ import ca.uhn.fhir.model.dstu2.composite.QuantityDt;
/* /*
* #%L * #%L
* HAPI FHIR Structures - DSTU2 (FHIR v0.5.0) * HAPI FHIR Structures - DSTU2 (FHIR v1.0.0)
* %% * %%
* Copyright (C) 2014 - 2015 University Health Network * Copyright (C) 2014 - 2015 University Health Network
* %% * %%

View File

@ -5,7 +5,7 @@ import ca.uhn.fhir.model.dstu2.composite.QuantityDt;
/* /*
* #%L * #%L
* HAPI FHIR Structures - DSTU2 (FHIR v0.5.0) * HAPI FHIR Structures - DSTU2 (FHIR v1.0.0)
* %% * %%
* Copyright (C) 2014 - 2015 University Health Network * Copyright (C) 2014 - 2015 University Health Network
* %% * %%

View File

@ -18,7 +18,7 @@ package ca.uhn.fhir.model.dstu2.composite;
/* /*
* #%L * #%L
* HAPI FHIR Structures - DSTU2 (FHIR v0.5.0) * HAPI FHIR Structures - DSTU2 (FHIR v1.0.0)
* %% * %%
* Copyright (C) 2014 - 2015 University Health Network * Copyright (C) 2014 - 2015 University Health Network
* %% * %%

View File

@ -18,7 +18,7 @@ package ca.uhn.fhir.model.dstu2.composite;
/* /*
* #%L * #%L
* HAPI FHIR Structures - DSTU2 (FHIR v0.5.0) * HAPI FHIR Structures - DSTU2 (FHIR v1.0.0)
* %% * %%
* Copyright (C) 2014 - 2015 University Health Network * Copyright (C) 2014 - 2015 University Health Network
* %% * %%

View File

@ -7,7 +7,7 @@ import ca.uhn.fhir.model.dstu2.valueset.QuantityComparatorEnum;
/* /*
* #%L * #%L
* HAPI FHIR Structures - DSTU2 (FHIR v0.5.0) * HAPI FHIR Structures - DSTU2 (FHIR v1.0.0)
* %% * %%
* Copyright (C) 2014 - 2015 University Health Network * Copyright (C) 2014 - 2015 University Health Network
* %% * %%

View File

@ -2,7 +2,7 @@ package ca.uhn.fhir.model.dstu2.resource;
/* /*
* #%L * #%L
* HAPI FHIR Structures - DSTU2 (FHIR v0.5.0) * HAPI FHIR Structures - DSTU2 (FHIR v1.0.0)
* %% * %%
* Copyright (C) 2014 - 2015 University Health Network * Copyright (C) 2014 - 2015 University Health Network
* %% * %%

View File

@ -2,7 +2,7 @@ package ca.uhn.fhir.rest.server.provider.dstu2;
/* /*
* #%L * #%L
* HAPI FHIR Structures - DSTU2 (FHIR v0.5.0) * HAPI FHIR Structures - DSTU2 (FHIR v1.0.0)
* %% * %%
* Copyright (C) 2014 - 2015 University Health Network * Copyright (C) 2014 - 2015 University Health Network
* %% * %%

View File

@ -2,7 +2,7 @@ package ca.uhn.fhir.rest.server.provider.dstu2;
/* /*
* #%L * #%L
* HAPI FHIR Structures - DSTU2 (FHIR v0.5.0) * HAPI FHIR Structures - DSTU2 (FHIR v1.0.0)
* %% * %%
* Copyright (C) 2014 - 2015 University Health Network * Copyright (C) 2014 - 2015 University Health Network
* %% * %%

View File

@ -2,7 +2,7 @@ package ca.uhn.fhir.rest.server.provider.dstu2;
/* /*
* #%L * #%L
* HAPI FHIR Structures - DSTU2 (FHIR v0.5.0) * HAPI FHIR Structures - DSTU2 (FHIR v1.0.0)
* %% * %%
* Copyright (C) 2014 - 2015 University Health Network * Copyright (C) 2014 - 2015 University Health Network
* %% * %%

View File

@ -35,20 +35,13 @@
<dependency> <dependency>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId> <artifactId>hapi-fhir-base</artifactId>
<version>0.7</version> <version>1.2-SNAPSHOT</version>
</dependency> </dependency>
<!--
Beginning in HAPI 0.8, at least one "structures" JAR must also be included.
For now it is commented out.
-->
<!--
<dependency> <dependency>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu</artifactId> <artifactId>hapi-fhir-structures-dstu</artifactId>
<version>0.8-SNAPSHOT</version> <version>1.2-SNAPSHOT</version>
</dependency> </dependency>
-->
<!-- <!--
HAPI-FHIR uses Logback for logging support. The logback library is included HAPI-FHIR uses Logback for logging support. The logback library is included

View File

@ -20,7 +20,6 @@
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes> <attributes>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="output" path="target/classes"/> <classpathentry kind="output" path="target/classes"/>

View File

@ -159,6 +159,11 @@
Server responses populate Bundle.entry.fullUrl if possible. Thanks Server responses populate Bundle.entry.fullUrl if possible. Thanks
to Bill de Beaubien for reporting! to Bill de Beaubien for reporting!
</action> </action>
<action type="fix">
XML parser failed to initialize in environments where a very old Woodstox
library is in use (earlier than 4.0). Thanks to Bill de Beaubien for
reporting!
</action>
</release> </release>
<release version="1.1" date="2015-07-13"> <release version="1.1" date="2015-07-13">
<action type="add"> <action type="add">