Add JKD11 support for Karaf
This commit is contained in:
parent
5bcf62ba44
commit
1bd63f4454
|
@ -1687,6 +1687,9 @@ public class XmlUtil {
|
|||
XMLInputFactory inputFactory;
|
||||
try {
|
||||
inputFactory = XMLInputFactory.newInstance();
|
||||
if (inputFactory.isPropertySupported(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES)) {
|
||||
inputFactory.setProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES, true);
|
||||
}
|
||||
throwUnitTestExceptionIfConfiguredToDoSo();
|
||||
} catch (Throwable e) {
|
||||
throw new ConfigurationException("Unable to initialize StAX - XML processing is disabled", e);
|
||||
|
|
|
@ -56,12 +56,8 @@
|
|||
<feature name='hapi-fhir-hl7org-dstu2' version='${project.version}' start-level='50'>
|
||||
<feature version='${project.version}'>hapi-fhir</feature>
|
||||
<feature version='${project.version}'>hapi-fhir-utilities</feature>
|
||||
<bundle dependency='true'>
|
||||
mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.saxon/${servicemix_saxon_version}
|
||||
</bundle>
|
||||
<bundle dependency='true'>
|
||||
mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.xmlresolver/${servicemix_xmlresolver_version}
|
||||
</bundle>
|
||||
<bundle dependency='true'>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.saxon/${servicemix_saxon_version}</bundle>
|
||||
<bundle dependency='true'>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.xmlresolver/${servicemix_xmlresolver_version}</bundle>
|
||||
<bundle>mvn:ca.uhn.hapi.fhir/hapi-fhir-structures-hl7org-dstu2/${project.version}</bundle>
|
||||
</feature>
|
||||
|
||||
|
@ -84,18 +80,17 @@
|
|||
</feature>
|
||||
|
||||
<feature name='hapi-fhir-ph-schematron' version='${project.version}' start-level='50'>
|
||||
<bundle dependency='true'>
|
||||
mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.saxon/${servicemix_saxon_version}
|
||||
</bundle>
|
||||
<bundle dependency='true'>
|
||||
mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.xmlresolver/${servicemix_xmlresolver_version}
|
||||
</bundle>
|
||||
<bundle dependency='true'>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.saxon/${servicemix_saxon_version}</bundle>
|
||||
<bundle dependency='true'>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.xmlresolver/${servicemix_xmlresolver_version}</bundle>
|
||||
<bundle dependency="true">mvn:org.apache.aries.spifly/org.apache.aries.spifly.dynamic.bundle/${aries_spifly_version}</bundle>
|
||||
<bundle dependency='true'>mvn:com.google.code.findbugs/jsr305/${jsr305_version}</bundle>
|
||||
<bundle dependency='true'>mvn:com.helger/ph-commons/${ph_commons_version}</bundle>
|
||||
<bundle dependency='true'>mvn:com.helger/ph-collection/${ph_commons_version}</bundle>
|
||||
<!-- needed by ph-xml 9.1.1, will be removed in later versions -->
|
||||
<bundle dependency='true'>mvn:javax.jws/javax.jws-api/1.1</bundle>
|
||||
<bundle dependency='true'>mvn:com.helger/ph-xml/${ph_commons_version}</bundle>
|
||||
<bundle dependency='true'>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxb-impl/${jaxb_bundle_version}</bundle>
|
||||
<bundle start-level="20">mvn:com.sun.xml.bind/jaxb-impl/${jaxb_core_version}</bundle>
|
||||
<bundle start-level="20">mvn:com.sun.xml.bind/jaxb-core/${jaxb_core_version}</bundle>
|
||||
<bundle dependency='true'>mvn:com.helger/ph-jaxb/${ph_commons_version}</bundle>
|
||||
<bundle dependency='true'>mvn:com.helger/ph-schematron/${ph_schematron_version}</bundle>
|
||||
</feature>
|
||||
|
|
|
@ -97,11 +97,11 @@
|
|||
<artifactId>hapi-fhir-validation</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependency>
|
||||
<groupId>org.ops4j.pax.url</groupId>
|
||||
<artifactId>pax-url-aether</artifactId>
|
||||
<version>2.5.4</version>
|
||||
</dependency>
|
||||
</dependency>
|
||||
|
||||
<!-- karaf test -->
|
||||
<dependency>
|
||||
|
@ -129,8 +129,8 @@
|
|||
<type>tar.gz</type>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.ops4j.pax.logging</groupId>
|
||||
<artifactId>pax-logging-api</artifactId>
|
||||
<groupId>*</groupId>
|
||||
<artifactId>*</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
@ -148,6 +148,14 @@
|
|||
<type>xml</type>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.karaf.features</groupId>
|
||||
<artifactId>standard</artifactId>
|
||||
<version>${apache_karaf_version}</version>
|
||||
<classifier>features</classifier>
|
||||
<type>xml</type>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.karaf.features</groupId>
|
||||
<artifactId>enterprise</artifactId>
|
||||
|
@ -162,7 +170,6 @@
|
|||
<version>1.3_1</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>jcl-over-slf4j</artifactId>
|
||||
|
@ -172,8 +179,6 @@
|
|||
<artifactId>logback-classic</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@ -197,6 +202,9 @@
|
|||
<configuration>
|
||||
<forkCount>1</forkCount>
|
||||
<reuseForks>false</reuseForks>
|
||||
<systemPropertyVariables>
|
||||
<karaf.version>${apache_karaf_version}</karaf.version>
|
||||
</systemPropertyVariables>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
|
|
@ -1,12 +1,19 @@
|
|||
package ca.uhn.fhir.tests.integration.karaf;
|
||||
|
||||
import org.ops4j.pax.exam.CoreOptions;
|
||||
import org.ops4j.pax.exam.Option;
|
||||
import org.ops4j.pax.exam.karaf.container.internal.JavaVersionUtil;
|
||||
import org.ops4j.pax.exam.karaf.options.KarafDistributionOption;
|
||||
import org.ops4j.pax.exam.karaf.options.LogLevelOption;
|
||||
import org.ops4j.pax.exam.options.DefaultCompositeOption;
|
||||
import org.ops4j.pax.exam.options.extra.VMOption;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.ServerSocket;
|
||||
|
||||
import static org.ops4j.pax.exam.CoreOptions.maven;
|
||||
import static org.ops4j.pax.exam.CoreOptions.systemProperty;
|
||||
import static org.ops4j.pax.exam.CoreOptions.when;
|
||||
import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.configureConsole;
|
||||
import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.karafDistributionConfiguration;
|
||||
import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.keepRuntimeFolder;
|
||||
|
@ -21,10 +28,46 @@ public enum PaxExamOptions {
|
|||
.groupId("org.apache.karaf")
|
||||
.artifactId("apache-karaf")
|
||||
.versionAsInProject()
|
||||
.type("zip"))
|
||||
.type("tar.gz"))
|
||||
.name("Apache Karaf")
|
||||
.useDeployFolder(false)
|
||||
.unpackDirectory(new File("target/paxexam/unpack/")),
|
||||
when(JavaVersionUtil.getMajorVersion() >= 9)
|
||||
.useOptions(
|
||||
systemProperty("pax.exam.osgi.unresolved.fail").value("true"),
|
||||
systemProperty("java.awt.headless").value("true"),
|
||||
KarafDistributionOption.logLevel(LogLevelOption.LogLevel.INFO),
|
||||
KarafDistributionOption.editConfigurationFilePut("etc/org.ops4j.pax.web.cfg", "org.osgi.service.http.port", Integer.toString(getAvailablePort(9080, 9999))),
|
||||
KarafDistributionOption.editConfigurationFilePut("etc/org.apache.karaf.management.cfg", "rmiRegistryPort", Integer.toString(getAvailablePort(1099, 9999))),
|
||||
KarafDistributionOption.editConfigurationFilePut("etc/org.apache.karaf.management.cfg", "rmiServerPort", Integer.toString(getAvailablePort(44444, 66666))),
|
||||
KarafDistributionOption.editConfigurationFilePut("etc/org.apache.karaf.shell.cfg", "sshPort", Integer.toString(getAvailablePort(8101, 8888))),
|
||||
new VMOption("--add-reads=java.xml=java.logging"),
|
||||
new VMOption("--add-exports=java.base/org.apache.karaf.specs.locator=java.xml,ALL-UNNAMED"),
|
||||
new VMOption("--patch-module"),
|
||||
new VMOption("java.base=lib/endorsed/org.apache.karaf.specs.locator-"
|
||||
+ System.getProperty("karaf.version", "4.2.2") + ".jar"),
|
||||
new VMOption("--patch-module"),
|
||||
new VMOption("java.xml=lib/endorsed/org.apache.karaf.specs.java.xml-"
|
||||
+ System.getProperty("karaf.version", "4.2.2") + ".jar"),
|
||||
new VMOption("--add-opens"),
|
||||
new VMOption("java.base/java.security=ALL-UNNAMED"),
|
||||
new VMOption("--add-opens"),
|
||||
new VMOption("java.base/java.net=ALL-UNNAMED"),
|
||||
new VMOption("--add-opens"),
|
||||
new VMOption("java.base/java.lang=ALL-UNNAMED"),
|
||||
new VMOption("--add-opens"),
|
||||
new VMOption("java.base/java.util=ALL-UNNAMED"),
|
||||
new VMOption("--add-opens"),
|
||||
new VMOption("java.naming/javax.naming.spi=ALL-UNNAMED"),
|
||||
new VMOption("--add-opens"),
|
||||
new VMOption("java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED"),
|
||||
new VMOption("--add-exports=java.base/sun.net.www.protocol.http=ALL-UNNAMED"),
|
||||
new VMOption("--add-exports=java.base/sun.net.www.protocol.https=ALL-UNNAMED"),
|
||||
new VMOption("--add-exports=java.base/sun.net.www.protocol.jar=ALL-UNNAMED"),
|
||||
new VMOption("--add-exports=jdk.naming.rmi/com.sun.jndi.url.rmi=ALL-UNNAMED"),
|
||||
new VMOption("-classpath"),
|
||||
new VMOption("lib/jdk9plus/*" + File.pathSeparator + "lib/boot/*")
|
||||
),
|
||||
keepRuntimeFolder(),
|
||||
configureConsole().ignoreLocalConsole(),
|
||||
logLevel(LogLevelOption.LogLevel.INFO)
|
||||
|
@ -33,7 +76,7 @@ public enum PaxExamOptions {
|
|||
features(
|
||||
maven()
|
||||
.groupId("org.apache.karaf.features")
|
||||
.artifactId("enterprise")
|
||||
.artifactId("standard")
|
||||
.type("xml")
|
||||
.classifier("features")
|
||||
.versionAsInProject(),
|
||||
|
@ -136,6 +179,18 @@ public enum PaxExamOptions {
|
|||
this.options = options;
|
||||
}
|
||||
|
||||
public static int getAvailablePort(int min, int max) {
|
||||
for (int i = min; i <= max; i++) {
|
||||
try (ServerSocket socket = new ServerSocket(i)) {
|
||||
return socket.getLocalPort();
|
||||
} catch (Exception e) {
|
||||
System.err.println("Port " + i + " not available, trying next one");
|
||||
continue; // try next port
|
||||
}
|
||||
}
|
||||
throw new IllegalStateException("Can't find available network ports");
|
||||
}
|
||||
|
||||
public Option option() {
|
||||
return new DefaultCompositeOption(options);
|
||||
}
|
||||
|
|
|
@ -74,7 +74,6 @@ import org.hl7.fhir.dstu3.model.SimpleQuantity;
|
|||
import org.hl7.fhir.dstu3.model.StringType;
|
||||
import org.hl7.fhir.dstu3.model.UriType;
|
||||
import org.hl7.fhir.dstu3.model.ValueSet;
|
||||
import org.hl7.fhir.exceptions.FHIRFormatError;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IIdType;
|
||||
import org.junit.Assert;
|
||||
|
@ -3197,8 +3196,8 @@ public class Dstu3XmlParserTest {
|
|||
try {
|
||||
ourCtx.newXmlParser().parseResource(Patient.class, input);
|
||||
fail();
|
||||
} catch (FHIRFormatError e) {
|
||||
assertThat(e.toString(), containsString("unable to parse character reference "));
|
||||
} catch (DataFormatException e) {
|
||||
assertThat(e.toString(), containsString("Undeclared general entity"));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue