Switch to jacoco

This commit is contained in:
James Agnew 2016-06-15 17:34:50 -04:00
parent e2f1beef2c
commit 1683cf8cef
15 changed files with 523 additions and 64 deletions

View File

@ -19,7 +19,7 @@ before_script:
- export MAVEN_SKIP_RC=true - export MAVEN_SKIP_RC=true
script: script:
# - mvn -e -B clean install && cd hapi-fhir-cobertura && mvn -e -B -DTRAVIS_JOB_ID=$TRAVIS_JOB_ID clean test jacoco:report coveralls:report # - mvn -e -B clean install && cd hapi-fhir-ra && mvn -e -B -DTRAVIS_JOB_ID=$TRAVIS_JOB_ID clean test jacoco:report coveralls:report
- mvn -e -B clean install && cd hapi-fhir-cobertura && mvn -e -B -DTRAVIS_JOB_ID=$TRAVIS_JOB_ID -P COBERTURA clean cobertura:cobertura coveralls:report - mvn -e -B clean install && cd hapi-fhir-jacoco && mvn -e -B -DTRAVIS_JOB_ID=$TRAVIS_JOB_ID jacoco:report coveralls:report

View File

@ -144,11 +144,9 @@
<configuration> <configuration>
<classFolders> <classFolders>
<classFolder>${basedir}/target/classes</classFolder> <classFolder>${basedir}/target/classes</classFolder>
<classFolder>${basedir}/../hapi-fhir-base/target/classes</classFolder>
</classFolders> </classFolders>
<sourceFolders> <sourceFolders>
<sourceFolder>${basedir}/src/main/java</sourceFolder> <sourceFolder>${basedir}/src/main/java</sourceFolder>
<sourceFolder>${basedir}/../hapi-fhir-base/src/main/java</sourceFolder>
</sourceFolders> </sourceFolders>
<dumpOnExit>true</dumpOnExit> <dumpOnExit>true</dumpOnExit>
</configuration> </configuration>
@ -161,6 +159,13 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>${argLine} -Dfile.encoding=UTF-8 -Xmx712m</argLine>
</configuration>
</plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId> <artifactId>maven-source-plugin</artifactId>

View File

@ -428,7 +428,8 @@ public abstract class BaseDateTimeDt extends BasePrimitive<Date> {
myPrecision = thePrecision; myPrecision = thePrecision;
myFractionalSeconds = ""; myFractionalSeconds = "";
if (theValue != null) { if (theValue != null) {
myFractionalSeconds = Integer.toString((int) (theValue.getTime() % 1000)); String fractionalSeconds = Integer.toString((int) (theValue.getTime() % 1000));
myFractionalSeconds = StringUtils.leftPad(fractionalSeconds, 3, '0');
} }
super.setValue(theValue); super.setValue(theValue);
} }

358
hapi-fhir-jacoco/pom.xml Normal file
View File

@ -0,0 +1,358 @@
<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">
<modelVersion>4.0.0</modelVersion>
<!-- The parent of this project is the deployable POM. This project isn't deployable, but this keeps it before the root pom in the reactor order when building the site. I don't know why this works...
Need to investigate this. -->
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>1.6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>
<artifactId>hapi-fhir-jacoco</artifactId>
<packaging>jar</packaging>
<name>HAPI FHIR - JaCoCo Test Coverage</name>
<dependencies>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>1.6-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu</artifactId>
<version>1.6-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu2</artifactId>
<version>1.6-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu3</artifactId>
<version>1.6-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-hl7org-dstu2</artifactId>
<version>1.6-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-validation-resources-dstu2</artifactId>
<version>1.6-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-validation-resources-dstu3</artifactId>
<version>1.6-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-jpaserver-base</artifactId>
<version>1.6-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.phloc</groupId>
<artifactId>phloc-schematron</artifactId>
</dependency>
<dependency>
<groupId>com.phloc</groupId>
<artifactId>phloc-commons</artifactId>
</dependency>
<dependency>
<groupId>org.thymeleaf</groupId>
<artifactId>thymeleaf</artifactId>
</dependency>
<!-- Use an older version of SLF4j just to make sure we compile correctly against old SLF4j - Some people can't upgrade and we have no real need for recent features. -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>
<!-- Test Database -->
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-dbcp2</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlets</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-util</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>xmlunit</groupId>
<artifactId>xmlunit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<classifier>jdk15</classifier>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<classifier>jdk15-sources</classifier>
<scope>test</scope>
</dependency>
<dependency>
<groupId>directory-naming</groupId>
<artifactId>naming-java</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>org.ebaysf.web</groupId>
<artifactId>cors-filter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>xmlunit</groupId>
<artifactId>xmlunit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>websocket-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>websocket-client</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>websocket-server</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<properties>
</properties>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<configuration>
<skipDeploy>true</skipDeploy>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<executions>
<execution>
<id>jacoco-merge</id>
<goals>
<goal>merge</goal>
</goals>
<phase>install</phase>
<configuration>
<fileSets>
<fileSet implementation="org.apache.maven.shared.model.fileset.FileSet">
<directory>${basedir}/..</directory>
<includes>
<include>hapi-fhir-base/target/jacoco.exec</include>
<include>hapi-fhir-structures-dstu/target/jacoco.exec</include>
<include>hapi-fhir-structures-dstu2/target/jacoco.exec</include>
<include>hapi-fhir-structures-hl7org-dstu2/target/jacoco.exec</include>
<include>hapi-fhir-structures-dstu3/target/jacoco.exec</include>
<include>hapi-fhir-jpaserver-base/target/jacoco.exec</include>
</includes>
</fileSet>
</fileSets>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eluder.coveralls</groupId>
<artifactId>coveralls-maven-plugin</artifactId>
<configuration>
<sourceEncoding>UTF-8</sourceEncoding>
<serviceName>travis-ci</serviceName>
<serviceJobId>${env.TRAVIS_JOB_ID}</serviceJobId>
<sourceDirectories>
<sourceDirectory>../hapi-fhir-structures-dstu/src/test/java</sourceDirectory>
<sourceDirectory>../hapi-fhir-structures-dstu2/src/test/java</sourceDirectory>
<sourceDirectory>../hapi-fhir-structures-hl7org-dstu2/src/test/java</sourceDirectory>
<sourceDirectory>../hapi-fhir-jpaserver-base/src/test/java</sourceDirectory>
<sourceDirectory>../hapi-fhir-base/src/main/java</sourceDirectory>
<sourceDirectory>../hapi-fhir-jpaserver-base/src/main/java</sourceDirectory>
</sourceDirectories>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>../hapi-fhir-base/src/main/java</source>
<source>../hapi-fhir-jpaserver-base/src/main/java</source>
</sources>
</configuration>
</execution>
<!--
<execution>
<id>add-test-source</id>
<phase>generate-test-sources</phase>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>../hapi-fhir-structures-dstu/src/test/java</source>
<source>../hapi-fhir-structures-dstu2/src/test/java</source>
<source>../hapi-fhir-structures-hl7org-dstu2/src/test/java</source>
<source>../hapi-fhir-structures-dstu3/src/test/java</source>
<source>../hapi-fhir-jpaserver-base/src/test/java</source>
<source>../hapi-fhir-base/src/test/java</source>
</sources>
</configuration>
</execution>
-->
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
<resources>
</resources>
<testResources>
<testResource>
<directory>../hapi-fhir-base/src/test/resources</directory>
</testResource>
<testResource>
<directory>../hapi-fhir-jpaserver-base/src/test/resources</directory>
</testResource>
<testResource>
<directory>../hapi-fhir-structures-dstu/src/test/resources</directory>
</testResource>
<testResource>
<directory>../hapi-fhir-structures-dstu2/src/test/resources</directory>
</testResource>
<testResource>
<directory>../hapi-fhir-structures-hl7org-dstu2/src/test/resources</directory>
</testResource>
<testResource>
<directory>../hapi-fhir-structures-dstu3/src/test/resources</directory>
</testResource>
</testResources>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<reportSets>
<reportSet>
<reports>
<report>cobertura</report>
</reports>
<configuration>
<check>
<haltOnFailure>true</haltOnFailure>
</check>
</configuration>
</reportSet>
</reportSets>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>${maven_project_info_plugin_version}</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</reporting>
</project>

View File

@ -335,13 +335,36 @@
</plugins> </plugins>
</pluginManagement> </pluginManagement>
<plugins> <plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<configuration>
<classFolders>
<classFolder>${basedir}/target/classes</classFolder>
<classFolder>${basedir}../hapi-fhir-base/target/classes</classFolder>
</classFolders>
<sourceFolders>
<sourceFolder>${basedir}/src/main/java</sourceFolder>
<sourceFolder>${basedir}/../hapi-fhir-base/src/main/java</sourceFolder>
</sourceFolders>
<dumpOnExit>true</dumpOnExit>
</configuration>
<executions>
<execution>
<id>default-prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<configuration> <configuration>
<!-- These tests all use a shared database, so it's easier if they run in a predictable order -->
<runOrder>alphabetical</runOrder> <runOrder>alphabetical</runOrder>
<!--<reuseForks>false</reuseForks>--> <argLine>${argLine} -Dfile.encoding=UTF-8 -Xmx712m</argLine>
<forkCount>1</forkCount>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>

View File

@ -160,12 +160,13 @@ public class FhirResourceDaoDstu3UpdateTest extends BaseJpaDstu3Test {
myPatientDao.create(p, mySrd).getId(); myPatientDao.create(p, mySrd).getId();
InstantDt start = InstantDt.withCurrentTime(); InstantDt start = InstantDt.withCurrentTime();
ourLog.info("First time: {}", start.getValueAsString());
Thread.sleep(100); Thread.sleep(100);
p = new Patient(); p = new Patient();
p.addIdentifier().setSystem("urn:system").setValue(methodName); p.addIdentifier().setSystem("urn:system").setValue(methodName);
IIdType id = myPatientDao.create(p, mySrd).getId(); IIdType id = myPatientDao.create(p, mySrd).getId();
ourLog.info("Created patient, got it: {}", id); ourLog.info("Created patient, got ID: {}", id);
Thread.sleep(100); Thread.sleep(100);
@ -174,7 +175,9 @@ public class FhirResourceDaoDstu3UpdateTest extends BaseJpaDstu3Test {
p.addName().addFamily("Hello"); p.addName().addFamily("Hello");
p.setId("Patient/" + methodName); p.setId("Patient/" + methodName);
myPatientDao.update(p, "Patient?_lastUpdated=gt" + start.getValueAsString(), mySrd); String matchUrl = "Patient?_lastUpdated=gt" + start.getValueAsString();
ourLog.info("URL is: {}", matchUrl);
myPatientDao.update(p, matchUrl, mySrd);
p = myPatientDao.read(id.toVersionless(), mySrd); p = myPatientDao.read(id.toVersionless(), mySrd);
assertThat(p.getIdElement().toVersionless().toString(), not(containsString("test"))); assertThat(p.getIdElement().toVersionless().toString(), not(containsString("test")));

View File

@ -1559,6 +1559,7 @@ public class ResourceProviderDstu2Test extends BaseResourceProviderDstu2Test {
@Test @Test
public void testSearchLastUpdatedParamRp() throws InterruptedException { public void testSearchLastUpdatedParamRp() throws InterruptedException {
String methodName = "testSearchLastUpdatedParamRp"; String methodName = "testSearchLastUpdatedParamRp";
ourLog.info("Starting " + methodName);
int sleep = 100; int sleep = 100;
Thread.sleep(sleep); Thread.sleep(sleep);
@ -1668,8 +1669,10 @@ public class ResourceProviderDstu2Test extends BaseResourceProviderDstu2Test {
@Test @Test
public void testSearchReturnsSearchDate() throws Exception { public void testSearchReturnsSearchDate() throws Exception {
ourLog.info("Starting testSearchReturnsSearchDate");
Date before = new Date(); Date before = new Date();
Thread.sleep(1); Thread.sleep(100);
//@formatter:off //@formatter:off
ca.uhn.fhir.model.dstu2.resource.Bundle found = ourClient ca.uhn.fhir.model.dstu2.resource.Bundle found = ourClient
@ -1680,7 +1683,7 @@ public class ResourceProviderDstu2Test extends BaseResourceProviderDstu2Test {
.execute(); .execute();
//@formatter:on //@formatter:on
Thread.sleep(1); Thread.sleep(100);
Date after = new Date(); Date after = new Date();
InstantDt updated = ResourceMetadataKeyEnum.UPDATED.get(found); InstantDt updated = ResourceMetadataKeyEnum.UPDATED.get(found);

View File

@ -175,7 +175,7 @@ public class ResourceProviderDstu3Test extends BaseResourceProviderDstu3Test {
List<Date> preDates = Lists.newArrayList(); List<Date> preDates = Lists.newArrayList();
List<String> ids = Lists.newArrayList(); List<String> ids = Lists.newArrayList();
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
Thread.sleep(10); Thread.sleep(100);
preDates.add(new Date()); preDates.add(new Date());
patient.setId(id); patient.setId(id);
patient.getName().get(0).getFamily().get(0).setValue(methodName + "_i"); patient.getName().get(0).getFamily().get(0).setValue(methodName + "_i");

View File

@ -149,6 +149,7 @@
<sourceFolder>${basedir}/src/main/java</sourceFolder> <sourceFolder>${basedir}/src/main/java</sourceFolder>
<sourceFolder>${basedir}/../hapi-fhir-base/src/main/java</sourceFolder> <sourceFolder>${basedir}/../hapi-fhir-base/src/main/java</sourceFolder>
</sourceFolders> </sourceFolders>
<dumpOnExit>true</dumpOnExit>
</configuration> </configuration>
<executions> <executions>
<execution> <execution>
@ -159,6 +160,13 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>${argLine} -Dfile.encoding=UTF-8 -Xmx712m</argLine>
</configuration>
</plugin>
<plugin> <plugin>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-tinder-plugin</artifactId> <artifactId>hapi-tinder-plugin</artifactId>

View File

@ -46,12 +46,12 @@ public class DateRangeParamTest {
DateRangeParam range = new DateRangeParam(startDateTime, endDateTime); DateRangeParam range = new DateRangeParam(startDateTime, endDateTime);
assertEquals("2009-12-31T19:00:00.000-05:00", range.getValuesAsQueryTokens().get(0).getValueAsString()); assertEquals("2009-12-31T19:00:00.000-05:00", range.getValuesAsQueryTokens().get(0).getValueAsString());
assertEquals("2009-12-31T19:00:00.100-05:00", range.getValuesAsQueryTokens().get(1).getValueAsString()); assertEquals("2009-12-31T19:00:00.001-05:00", range.getValuesAsQueryTokens().get(1).getValueAsString());
// Now try with arguments reversed (should still create same range) // Now try with arguments reversed (should still create same range)
range = new DateRangeParam(endDateTime, startDateTime); range = new DateRangeParam(endDateTime, startDateTime);
assertEquals("2009-12-31T19:00:00.000-05:00", range.getValuesAsQueryTokens().get(0).getValueAsString()); assertEquals("2009-12-31T19:00:00.000-05:00", range.getValuesAsQueryTokens().get(0).getValueAsString());
assertEquals("2009-12-31T19:00:00.100-05:00", range.getValuesAsQueryTokens().get(1).getValueAsString()); assertEquals("2009-12-31T19:00:00.001-05:00", range.getValuesAsQueryTokens().get(1).getValueAsString());
} finally { } finally {
TimeZone.setDefault(tz); TimeZone.setDefault(tz);

View File

@ -158,6 +158,7 @@
<sourceFolder>${basedir}/src/main/java</sourceFolder> <sourceFolder>${basedir}/src/main/java</sourceFolder>
<sourceFolder>${basedir}/../hapi-fhir-base/src/main/java</sourceFolder> <sourceFolder>${basedir}/../hapi-fhir-base/src/main/java</sourceFolder>
</sourceFolders> </sourceFolders>
<dumpOnExit>true</dumpOnExit>
</configuration> </configuration>
<executions> <executions>
<execution> <execution>
@ -168,6 +169,13 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>${argLine} -Dfile.encoding=UTF-8 -Xmx712m</argLine>
</configuration>
</plugin>
<plugin> <plugin>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-tinder-plugin</artifactId> <artifactId>hapi-tinder-plugin</artifactId>

View File

@ -35,6 +35,46 @@ public class BaseDateTimeDtDstu2Test {
private SimpleDateFormat myDateInstantParser; private SimpleDateFormat myDateInstantParser;
private FastDateFormat myDateInstantZoneParser; private FastDateFormat myDateInstantZoneParser;
@Test
public void testFromTime() {
long millis;
InstantDt dt;
millis = 1466022208001L;
String expected = "2016-06-15T20:23:28.001Z";
validate(millis, expected);
millis = 1466022208123L;
expected = "2016-06-15T20:23:28.123Z";
validate(millis, expected);
millis = 1466022208100L;
expected = "2016-06-15T20:23:28.100Z";
validate(millis, expected);
millis = 1466022208000L;
expected = "2016-06-15T20:23:28.000Z";
validate(millis, expected);
}
private void validate(long millis, String expected) {
InstantDt dt;
dt = new InstantDt(new Date(millis));
dt.setTimeZoneZulu(true);
assertEquals(expected, dt.getValueAsString());
assertEquals(millis % 1000, dt.getMillis().longValue());
assertEquals((millis % 1000) * BaseDateTimeDt.NANOS_PER_MILLIS, dt.getNanos().longValue());
dt = new InstantDt();
dt.setTimeZone(TimeZone.getTimeZone("GMT+0:00"));
dt.setValue(new Date(millis));
assertEquals(expected.replace("Z", "+00:00"), dt.getValueAsString());
}
@Test @Test
public void testSetPartialsYearFromExisting() { public void testSetPartialsYearFromExisting() {
InstantDt dt = new InstantDt("2011-03-11T15:44:13.27564757855254768473697463986328969635-08:00"); InstantDt dt = new InstantDt("2011-03-11T15:44:13.27564757855254768473697463986328969635-08:00");

View File

@ -175,13 +175,34 @@
<build> <build>
<plugins> <plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<configuration>
<classFolders>
<classFolder>${basedir}/target/classes</classFolder>
<classFolder>${basedir}/../hapi-fhir-base/target/classes</classFolder>
</classFolders>
<sourceFolders>
<sourceFolder>${basedir}/src/main/java</sourceFolder>
<sourceFolder>${basedir}/../hapi-fhir-base/src/main/java</sourceFolder>
</sourceFolders>
<dumpOnExit>true</dumpOnExit>
</configuration>
<executions>
<execution>
<id>default-prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<configuration> <configuration>
<!--<redirectTestOutputToFile>false</redirectTestOutputToFile>--> <argLine>${argLine} -Dfile.encoding=UTF-8 -Xmx712m</argLine>
<runOrder>random</runOrder>
<reuseForks>false</reuseForks>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>

View File

@ -183,12 +183,13 @@
<configuration> <configuration>
<classFolders> <classFolders>
<classFolder>${basedir}/target/classes</classFolder> <classFolder>${basedir}/target/classes</classFolder>
<classFolder>${basedir}/../hapi-fhir-base/target/classes</classFolder> <classFolder>${basedir}../hapi-fhir-base/target/classes</classFolder>
</classFolders> </classFolders>
<sourceFolders> <sourceFolders>
<sourceFolder>${basedir}/src/main/java</sourceFolder> <sourceFolder>${basedir}/src/main/java</sourceFolder>
<sourceFolder>${basedir}/../hapi-fhir-base/src/main/java</sourceFolder> <sourceFolder>${basedir}/../hapi-fhir-base/src/main/java</sourceFolder>
</sourceFolders> </sourceFolders>
<dumpOnExit>true</dumpOnExit>
</configuration> </configuration>
<executions> <executions>
<execution> <execution>
@ -199,6 +200,13 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>${argLine} -Dfile.encoding=UTF-8 -Xmx712m</argLine>
</configuration>
</plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>

73
pom.xml
View File

@ -804,9 +804,8 @@
<configuration> <configuration>
<redirectTestOutputToFile>true</redirectTestOutputToFile> <redirectTestOutputToFile>true</redirectTestOutputToFile>
<runOrder>random</runOrder> <runOrder>random</runOrder>
<argLine>${argLine} -Dfile.encoding=UTF-8 -Xmx712m</argLine> <argLine>-Dfile.encoding=UTF-8 -Xmx712m</argLine>
<forkCount>1</forkCount> <forkCount>1</forkCount>
<!--<reuseForks>false</reuseForks> -->
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
@ -1373,30 +1372,6 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<!--
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<executions>
<execution>
<id>jacoco-merge</id>
<goals>
<goal>merge</goal>
</goals>
<phase>install</phase>
<inherited>false</inherited>
<configuration>
<fileSet implementation="org.apache.maven.shared.model.fileset.FileSet">
<directory>hapi-fhir-base/target</directory>
<includes>
<include>*.exec</include>
</includes>
</fileSet>
</configuration>
</execution>
</executions>
</plugin>
-->
<!-- <plugin> <groupId>com.github.github</groupId> <artifactId>site-maven-plugin</artifactId> <version>0.12</version> <configuration> <message>Building site for ${project.version}</message> <server>github</server> <!-- <plugin> <groupId>com.github.github</groupId> <artifactId>site-maven-plugin</artifactId> <version>0.12</version> <configuration> <message>Building site for ${project.version}</message> <server>github</server>
</configuration> <executions> <execution> <goals> <goal>site</goal> </goals> <phase>site-deploy</phase> </execution> </executions> </plugin> --> </configuration> <executions> <execution> <goals> <goal>site</goal> </goals> <phase>site-deploy</phase> </execution> </executions> </plugin> -->
</plugins> </plugins>
@ -1406,21 +1381,8 @@
<plugins> <plugins>
<!-- <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-checkstyle-plugin</artifactId> <reportSets> <reportSet> <reports><report>checkstyle-aggregate</report></reports> </reportSet> <!-- <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-checkstyle-plugin</artifactId> <reportSets> <reportSet> <reports><report>checkstyle-aggregate</report></reports> </reportSet>
</reportSets> <configuration> <configLocation>config/sun_checks.xml</configLocation> <includes> hapi-fhir-base/src/main/java/**/*.java </includes> </configuration> </plugin> --> </reportSets> <configuration> <configLocation>config/sun_checks.xml</configLocation> <includes> hapi-fhir-base/src/main/java/**/*.java </includes> </configuration> </plugin> -->
<plugin> <!-- <plugin> <groupId>org.jacoco</groupId> <artifactId>jacoco-maven-plugin</artifactId> <version>0.7.7.201606060606</version> <reportSets> <reportSet> <reports> <report>report</report> </reports> <configuration>
<groupId>org.jacoco</groupId> <dataFileIncludes>${baseDir}/hapi-fhir-base/target/jacoco.exec</dataFileIncludes> </configuration> </reportSet> </reportSets> </plugin> -->
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.7.201606060606</version>
<reportSets>
<reportSet>
<reports>
<report>report</report>
</reports>
<configuration>
<dataFileIncludes>${baseDir}/hapi-fhir-base/target/jacoco.exec</dataFileIncludes>
</configuration>
</reportSet>
</reportSets>
</plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-changes-plugin</artifactId> <artifactId>maven-changes-plugin</artifactId>
@ -1569,11 +1531,30 @@
<modules> <modules>
<module>hapi-deployable-pom</module> <module>hapi-deployable-pom</module>
<module>hapi-fhir-base</module> <module>hapi-fhir-base</module>
<!-- <module>hapi-fhir-base-test-mindeps-client</module> <module>hapi-fhir-base-test-mindeps-server</module> <module>hapi-tinder-plugin</module> <module>hapi-tinder-test</module> <module>hapi-fhir-structures-dstu</module> <module>hapi-fhir-base-test-mindeps-client</module>
<module>hapi-fhir-validation-resources-dstu2</module> <module>hapi-fhir-structures-dstu2</module> <module>hapi-fhir-structures-hl7org-dstu2</module> <module>hapi-fhir-validation-resources-dstu3</module> <module>hapi-fhir-base-test-mindeps-server</module>
<module>hapi-fhir-structures-dstu3</module> <module>hapi-fhir-jaxrsserver-base</module> <module>hapi-fhir-jaxrsserver-example</module> <module>hapi-fhir-jpaserver-base</module> <module>hapi-fhir-jpaserver-example</module> <module>hapi-tinder-plugin</module>
<module>restful-server-example</module> <module>restful-server-example-test</module> <module>hapi-fhir-testpage-overlay</module> <module>hapi-fhir-jpaserver-uhnfhirtest</module> <module>hapi-fhir-android</module> <module>hapi-tinder-test</module>
<module>hapi-fhir-cli</module> <module>hapi-fhir-dist</module> <module>examples</module> <module>hapi-fhir-base-example-embedded-ws</module> --> <module>hapi-fhir-structures-dstu</module>
<module>hapi-fhir-validation-resources-dstu2</module>
<module>hapi-fhir-structures-dstu2</module>
<module>hapi-fhir-structures-hl7org-dstu2</module>
<module>hapi-fhir-validation-resources-dstu3</module>
<module>hapi-fhir-structures-dstu3</module>
<module>hapi-fhir-jaxrsserver-base</module>
<module>hapi-fhir-jaxrsserver-example</module>
<module>hapi-fhir-jpaserver-base</module>
<module>hapi-fhir-jpaserver-example</module>
<module>restful-server-example</module>
<module>restful-server-example-test</module>
<module>hapi-fhir-testpage-overlay</module>
<module>hapi-fhir-jpaserver-uhnfhirtest</module>
<module>hapi-fhir-android</module>
<module>hapi-fhir-cli</module>
<module>hapi-fhir-dist</module>
<module>examples</module>
<module>hapi-fhir-base-example-embedded-ws</module>
<module>hapi-fhir-jacoco</module>
</modules> </modules>
</profile> </profile>
<profile> <profile>