Skip to content

Commit 33665a4

Browse files
authored
Merge pull request #337 from IBM/issue-305
Issues #304 and #305 - remove JAXB and add java 11 to github CI
2 parents 178681f + 6001658 commit 33665a4

30 files changed

Lines changed: 368 additions & 71 deletions

File tree

.github/workflows/build.yml

Lines changed: 106 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,15 @@ on:
88
jobs:
99
build-tools:
1010
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
java: [ '1.8', '11.0.1' ]
1114
steps:
1215
- uses: actions/checkout@v1
13-
- name: Set up JDK 1.8
16+
- name: Set up JDK
1417
uses: actions/setup-java@v1
1518
with:
16-
java-version: 1.8
19+
java-version: ${{ matrix.java }}
1720
- name: Build tools
1821
run: mvn -B install --file fhir-tools/pom.xml
1922
- name: Build samples
@@ -26,24 +29,119 @@ jobs:
2629
run: mvn -B package --file fhir-benchmark/pom.xml
2730
build:
2831
runs-on: ubuntu-latest
32+
strategy:
33+
matrix:
34+
java: [ '1.8', '11.0.1' ]
2935
steps:
3036
- uses: actions/checkout@v1
31-
- name: Set up JDK 1.8
37+
- name: Set up JDK
3238
uses: actions/setup-java@v1
3339
with:
34-
java-version: 1.8
40+
java-version: ${{ matrix.java }}
3541
- name: Build samples
3642
run: mvn -B install --file fhir-examples/pom.xml
3743
- name: Build parent with tests
3844
run: mvn -B -T2C package --file fhir-parent/pom.xml
45+
e2e-java8:
46+
runs-on: ubuntu-latest
47+
steps:
48+
- name: Checkout
49+
uses: actions/checkout@v1
50+
- name: Download OpenJDK 8
51+
run: wget "https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u232-b09_openj9-0.17.0/OpenJDK8U-jdk_x64_linux_openj9_8u232b09_openj9-0.17.0.tar.gz"
52+
- name: Set up JDK
53+
uses: actions/setup-java@v1
54+
with:
55+
java-version: 8
56+
architecture: x64
57+
jdkFile: OpenJDK8U-jdk_x64_linux_openj9_8u232b09_openj9-0.17.0.tar.gz
58+
- name: Build samples
59+
run: mvn -B install --file fhir-examples/pom.xml
60+
- name: Build parent without tests
61+
run: mvn -B install --file fhir-parent/pom.xml -DskipTests
62+
- name: Server Integration Tests
63+
env:
64+
LC_ALL: en_US.UTF-8
65+
run: |
66+
export WORKSPACE=${GITHUB_WORKSPACE}
67+
build/pre-integration-test.sh
68+
env
69+
mvn -B test -DskipTests=false -f fhir-server-test/pom.xml -DskipWebSocketTest=true
70+
build/post-integration-test.sh
71+
- name: Gather error logs
72+
if: failure()
73+
run: |
74+
it_results=SIT/integration-test-results
75+
rm -fr ${it_results} 2>/dev/null
76+
mkdir -p ${it_results}/server-logs
77+
mkdir -p ${it_results}/fhir-server-test
78+
echo "Gathering post-test server logs..."
79+
cp -pr SIT/wlp/usr/servers/fhir-server/logs ${it_results}/server-logs
80+
echo "Gathering integration test output"
81+
cp -pr ${GITHUB_WORKSPACE}/fhir-server-test/target/surefire-reports/* ${it_results}/fhir-server-test
82+
- name: Upload logs
83+
if: always()
84+
uses: actions/upload-artifact@master
85+
with:
86+
name: integration-test-results-java8
87+
path: SIT/integration-test-results
88+
e2e-java11:
89+
runs-on: ubuntu-latest
90+
steps:
91+
- name: Checkout
92+
uses: actions/checkout@v1
93+
- name: Download OpenJDK 11
94+
run: wget "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk11u-2019-10-16-10-43/OpenJDK11U-jdk_x64_linux_openj9_2019-10-16-10-43.tar.gz"
95+
- name: Set up JDK
96+
uses: actions/setup-java@v1
97+
with:
98+
java-version: 11
99+
architecture: x64
100+
jdkFile: OpenJDK11U-jdk_x64_linux_openj9_2019-10-16-10-43.tar.gz
101+
- name: Build samples
102+
run: mvn -B install --file fhir-examples/pom.xml
103+
- name: Build parent without tests
104+
run: mvn -B install --file fhir-parent/pom.xml -DskipTests
105+
- name: Server Integration Tests
106+
env:
107+
LC_ALL: en_US.UTF-8
108+
run: |
109+
export WORKSPACE=${GITHUB_WORKSPACE}
110+
build/pre-integration-test.sh
111+
env
112+
mvn -B test -DskipTests=false -f fhir-server-test/pom.xml -DskipWebSocketTest=true
113+
build/post-integration-test.sh
114+
- name: Gather error logs
115+
if: failure()
116+
run: |
117+
it_results=SIT/integration-test-results
118+
rm -fr ${it_results} 2>/dev/null
119+
mkdir -p ${it_results}/server-logs
120+
mkdir -p ${it_results}/fhir-server-test
121+
mkdir -p ${it_results}/derby
122+
echo "Gathering post-test server logs..."
123+
cp -pr SIT/wlp/usr/servers/fhir-server/logs ${it_results}/server-logs
124+
echo "Gathering post-test derby..."
125+
cp -pr SIT/wlp/usr/servers/fhir-server/derby ${it_results}/derby
126+
echo "Gathering integration test output"
127+
cp -pr ${GITHUB_WORKSPACE}/fhir-server-test/target/surefire-reports/* ${it_results}/fhir-server-test
128+
- name: Upload logs
129+
if: always()
130+
uses: actions/upload-artifact@master
131+
with:
132+
name: integration-test-results-java11
133+
path: SIT/integration-test-results
39134
e2e-tests:
40135
runs-on: ubuntu-latest
136+
strategy:
137+
matrix:
138+
java: [ '11.0.1', '1.8' ]
41139
steps:
42140
- uses: actions/checkout@v1
43-
- name: Set up JDK 1.8
141+
- name: Set up JDK
44142
uses: actions/setup-java@v1
45143
with:
46-
java-version: 1.8
144+
java-version: ${{ matrix.java }}
47145
- name: Build samples
48146
run: mvn -B install --file fhir-examples/pom.xml
49147
- name: Build parent without tests
@@ -52,7 +150,7 @@ jobs:
52150
run: |
53151
export WORKSPACE=${GITHUB_WORKSPACE}
54152
build/pre-integration-test.sh
55-
mvn test -DskipTests=false -f fhir-server-test/pom.xml -DskipWebSocketTest=true
153+
mvn -B test -DskipTests=false -f fhir-server-test/pom.xml -DskipWebSocketTest=true
56154
build/post-integration-test.sh
57155
- name: Gather error logs
58156
if: failure()
@@ -69,5 +167,5 @@ jobs:
69167
if: always()
70168
uses: actions/upload-artifact@master
71169
with:
72-
name: integration-test-results
170+
name: integration-test-results-${{ matrix.java }}
73171
path: SIT/integration-test-results

build/pre-integration-test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ tries=0
7575
status=0
7676
while [ $status -ne 200 -a $tries -lt ${MAX_TRIES} ]; do
7777
tries=$((tries + 1))
78-
cmd="curl -k -o ${WORKSPACE}/metadata.json -I -w "%{http_code}" -u fhiruser:change-password $metadata_url"
78+
cmd="curl -sS -k -o ${WORKSPACE}/metadata.json -I -w %{http_code} -u fhiruser:change-password $metadata_url "
7979
echo "Executing[$tries]: $cmd"
8080
status=$($cmd)
8181
echo "Status code: $status"

fhir-client/pom.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,5 @@
5555
<artifactId>jsonassert</artifactId>
5656
<scope>test</scope>
5757
</dependency>
58-
<dependency>
59-
<groupId>jakarta.xml.bind</groupId>
60-
<artifactId>jakarta.xml.bind-api</artifactId>
61-
</dependency>
6258
</dependencies>
6359
</project>

fhir-client/src/main/java/com/ibm/fhir/client/impl/FHIRBasicAuthenticator.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
package com.ibm.fhir.client.impl;
88

99
import java.io.IOException;
10+
import java.util.Base64;
1011

1112
import javax.ws.rs.client.ClientRequestContext;
1213
import javax.ws.rs.client.ClientRequestFilter;
1314
import javax.ws.rs.core.MultivaluedMap;
14-
import javax.xml.bind.DatatypeConverter;
1515

1616
/**
1717
* This class is responsible for adding the Authorization header to outbound REST API requests.
@@ -48,9 +48,7 @@ public void setPassword(String password) {
4848
this.password = password;
4949
}
5050

51-
/* (non-Javadoc)
52-
* @see javax.ws.rs.client.ClientRequestFilter#filter(javax.ws.rs.client.ClientRequestContext)
53-
*
51+
/**
5452
* This method is called by the JAX-RS client runtime and will add an Authorization header to the
5553
* outbound REST API request to supply the necessary basic auth security token.
5654
*/
@@ -59,7 +57,7 @@ public void filter(ClientRequestContext ctxt) throws IOException {
5957
if (getUsername() != null && !getUsername().isEmpty()) {
6058
MultivaluedMap<String, Object> headers = ctxt.getHeaders();
6159
String basicAuthToken = getUsername() + ":" + getPassword();
62-
String basicAuthString = "Basic " + DatatypeConverter.printBase64Binary(basicAuthToken.getBytes());
60+
String basicAuthString = "Basic " + Base64.getEncoder().encodeToString(basicAuthToken.getBytes());
6361
headers.add("Authorization", basicAuthString);
6462
}
6563
}

fhir-database-utils/src/main/java/com/ibm/fhir/database/utils/api/IDatabaseTypeAdapter.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,19 @@ public interface IDatabaseTypeAdapter {
3434
*/
3535
public String varcharClause(int size);
3636

37+
/**
38+
* Generate a clause for TIMESTAMP
39+
* @param precision
40+
* @return
41+
* @implSpec the default implementation returns TIMESTAMP[(precision)]
42+
* and excludes the precision if it is null
43+
*/
44+
default public String timestampClause(Integer precision) {
45+
StringBuilder typeDef = new StringBuilder();
46+
if (precision != null) {
47+
typeDef.append("(" + precision + ")");
48+
}
49+
return typeDef.toString();
50+
};
51+
3752
}

fhir-database-utils/src/main/java/com/ibm/fhir/database/utils/derby/DerbyAdapter.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,12 @@ public String blobClause(long size, int inlineSize) {
203203
public String varcharClause(int size) {
204204
return "VARCHAR(" + size + ")";
205205
}
206+
207+
@Override
208+
public String timestampClause(Integer precision) {
209+
// Derby doesn't support the timestamp precision argument
210+
return "TIMESTAMP";
211+
}
206212

207213
@Override
208214
public void createForeignKeyConstraint(String constraintName, String schemaName, String name,

fhir-database-utils/src/main/java/com/ibm/fhir/database/utils/derby/DerbyTranslator.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,13 +142,12 @@ public String getUrl(Properties connectionProperties) {
142142
return "jdbc:derby:memory:" + adapter.getDatabase();
143143
}
144144
else {
145-
return "jdbc:derby:" + adapter.getDatabase();
145+
return "jdbc:derby:" + adapter.getDatabase();
146146
}
147147
}
148148

149149
@Override
150150
public boolean clobSupportsInline() {
151151
return false;
152152
}
153-
154153
}

fhir-database-utils/src/main/java/com/ibm/fhir/database/utils/model/ColumnDef.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public class ColumnDef implements Comparable<ColumnDef> {
1414
private boolean nullable;
1515
private ColumnType columnType;
1616
private long size;
17-
private int precision;
17+
private Integer precision;
1818
private int inlineSize;
1919

2020
/**
@@ -47,7 +47,7 @@ public long getSize() {
4747
public void setSize(long size) {
4848
this.size = size;
4949
}
50-
public int getPrecision() {
50+
public Integer getPrecision() {
5151
return precision;
5252
}
5353
public void setPrecision(int precision) {

fhir-database-utils/src/main/java/com/ibm/fhir/database/utils/model/ColumnDefBuilder.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,11 @@ protected List<ColumnBase> buildColumns() {
156156
column = new DoubleColumn(cd.getName(), cd.isNullable());
157157
break;
158158
case TIMESTAMP:
159-
column = new TimestampColumn(cd.getName(), cd.isNullable());
159+
if (cd.getPrecision() == null) {
160+
column = new TimestampColumn(cd.getName(), cd.isNullable());
161+
} else {
162+
column = new TimestampColumn(cd.getName(), cd.isNullable(), cd.getPrecision());
163+
}
160164
break;
161165
case VARCHAR:
162166
if (cd.getSize() > Integer.MAX_VALUE) {

fhir-database-utils/src/main/java/com/ibm/fhir/database/utils/model/Table.java

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,19 @@ public Builder addTimestampColumn(String columnName, boolean nullable) {
261261
columns.add(cd);
262262
return this;
263263
}
264+
265+
public Builder addTimestampColumn(String columnName, int numberOfFractionalSecondDigits, boolean nullable) {
266+
ColumnDef cd = new ColumnDef(columnName);
267+
if (columns.contains(cd)) {
268+
throw new IllegalArgumentException("Duplicate column: " + columnName);
269+
}
270+
271+
cd.setNullable(nullable);
272+
cd.setColumnType(ColumnType.TIMESTAMP);
273+
cd.setPrecision(numberOfFractionalSecondDigits);
274+
columns.add(cd);
275+
return this;
276+
}
264277

265278
public Builder addVarcharColumn(String columnName, int size, boolean nullable) {
266279
ColumnDef cd = new ColumnDef(columnName);
@@ -498,7 +511,11 @@ protected List<ColumnBase> buildColumns() {
498511
column = new DoubleColumn(cd.getName(), cd.isNullable());
499512
break;
500513
case TIMESTAMP:
501-
column = new TimestampColumn(cd.getName(), cd.isNullable());
514+
if (cd.getPrecision() == null) {
515+
column = new TimestampColumn(cd.getName(), cd.isNullable());
516+
} else {
517+
column = new TimestampColumn(cd.getName(), cd.isNullable(), cd.getPrecision());
518+
}
502519
break;
503520
case VARCHAR:
504521
if (cd.getSize() > Integer.MAX_VALUE) {

0 commit comments

Comments
 (0)