Skip to content

Commit aa25cfd

Browse files
committed
Tests pass
1 parent 7ac5999 commit aa25cfd

File tree

7 files changed

+411
-11
lines changed

7 files changed

+411
-11
lines changed

.gitattributes

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#
2+
# https://help.github.com/articles/dealing-with-line-endings/
3+
#
4+
# These are explicitly windows files and should use crlf
5+
*.bat text eol=crlf
6+

.github/workflows/test.yml

+2-11
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,8 @@ jobs:
1919
auth2_tests:
2020
runs-on: ubuntu-latest
2121
strategy:
22+
fail-fast: false
2223
matrix:
23-
# Note that there's a mongo-only ant test directive. Use that for all mongo versions
24-
# except for one if there's > 1 mongo version to test. No need for testing code that
25-
# doesn't touch mongo against multiple mongo versions
2624
include:
2725
- java: '8'
2826
mongo: 'mongodb-linux-x86_64-ubuntu2204-7.0.4'
@@ -40,13 +38,6 @@ jobs:
4038
distribution: 'temurin'
4139
java-version: ${{matrix.java}}
4240

43-
- name: Clone jars as sister repo
44-
shell: bash
45-
run: |
46-
cd ..
47-
git clone https://github.com/kbase/jars
48-
cd -
49-
5041
- name: Install mongo and set up test config
5142
shell: bash
5243
run: |
@@ -62,7 +53,7 @@ jobs:
6253
cat test.cfg
6354
6455
- name: Run tests
65-
run: ant test
56+
run: ./gradlew test
6657

6758
- name: Upload coverage to Codecov
6859
uses: codecov/codecov-action@v3

build.gradle

+154
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
/*
2+
* This file was generated by the Gradle 'init' task.
3+
*
4+
* This generated file contains a sample Java application project to get you started.
5+
* For more details take a look at the 'Building Java & JVM projects' chapter in the Gradle
6+
* User Manual available at https://docs.gradle.org/7.4.2/userguide/building_java_projects.html
7+
*/
8+
9+
plugins {
10+
id 'java'
11+
id 'war'
12+
id 'jacoco'
13+
}
14+
15+
repositories {
16+
mavenCentral()
17+
}
18+
19+
compileJava {
20+
if (JavaVersion.current() <= JavaVersion.VERSION_1_8) {
21+
// TODO BUILD remove when we no longer support java 8
22+
java.sourceCompatibility = JavaVersion.VERSION_1_8
23+
java.targetCompatibility = JavaVersion.VERSION_1_8
24+
} else {
25+
options.release = 8
26+
}
27+
// TODO NOW build in git commit
28+
// TODO NOW javadocs
29+
}
30+
31+
test {
32+
/*
33+
* TODO TEST Figure out why tests fail without this and remove. Might have something to do
34+
* with the stfuLoggers() call in many of the tests, might kill logging for tests that
35+
* require it
36+
* Although it seems to make Mongo start up correctly as well which is odd
37+
*/
38+
/*
39+
* TODO TEST split tests into mongo wrapper tests & all other tests (incl. integration).
40+
* Set up GHA to run the non-mongo tests with a single version of mongo and run the
41+
* mong tests with matrixed mongo versions. Combine coverage at the end somehow
42+
*/
43+
forkEvery = 1
44+
systemProperty "AUTH2_TEST_CONFIG", "./test.cfg"
45+
testLogging {
46+
exceptionFormat = 'full'
47+
showStandardStreams = true
48+
}
49+
// TODO NOW coverage working?
50+
}
51+
52+
// TODO NOW make auth, test, and template jars
53+
// TODO NOW make script
54+
55+
// Custom java project layout
56+
sourceSets {
57+
main {
58+
java {
59+
srcDirs = ["src"]
60+
exclude '**/test/**'
61+
}
62+
}
63+
test {
64+
java {
65+
srcDirs = ["src"]
66+
include '**/test/**'
67+
}
68+
resources {
69+
srcDirs = ["src"]
70+
include "**/*.testdata"
71+
include "**/authjars"
72+
}
73+
}
74+
}
75+
76+
war {
77+
webXml = file('war/web.xml')
78+
// TODO NOW GRADLE probably needs updates
79+
}
80+
81+
def fromURL = { url, name ->
82+
File file = new File("$buildDir/download/${name}.jar")
83+
file.parentFile.mkdirs()
84+
if (!file.exists()) {
85+
new URL(url).withInputStream { downloadStream ->
86+
file.withOutputStream { fileOut ->
87+
fileOut << downloadStream
88+
}
89+
}
90+
}
91+
files(file.absolutePath)
92+
}
93+
94+
dependencies {
95+
96+
// ### General application dependencies ###
97+
98+
implementation 'commons-codec:commons-codec:1.8'
99+
implementation 'commons-validator:commons-validator:1.5.1'
100+
implementation 'com.google.guava:guava:18.0'
101+
implementation 'org.ini4j:ini4j:0.5.2'
102+
implementation 'com.beust:jcommander:1.48'
103+
implementation 'org.mongodb:mongodb-driver-core:4.11.1'
104+
implementation 'org.mongodb:mongodb-driver-sync:4.11.1'
105+
implementation 'org.mongodb:bson-record-codec:4.11.1'
106+
implementation 'org.mongodb:bson:4.11.1'
107+
implementation 'com.github.spullara.mustache.java:compiler:0.9.3'
108+
implementation 'com.nulab-inc:zxcvbn:1.2.2'
109+
implementation 'nl.basjes.parse.useragent:yauaa:1.3'
110+
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.5.4'
111+
implementation 'com.fasterxml.jackson.core:jackson-databind:2.5.4'
112+
implementation 'com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:2.5.4'
113+
implementation 'com.github.zafarkhaja:java-semver:0.9.0'
114+
implementation 'org.glassfish.jersey.containers:jersey-container-servlet:2.23.2'
115+
implementation 'org.glassfish.jersey.media:jersey-media-json-jackson:2.23.2'
116+
implementation 'org.glassfish.jersey.ext:jersey-mvc-mustache:2.23.2'
117+
implementation 'javax.persistence:persistence-api:1.0'
118+
implementation 'javax.servlet:javax.servlet-api:3.0.1'
119+
implementation 'javax.xml.bind:jaxb-api:2.4.0-b180830.0359'
120+
121+
122+
// ### Logging dependencies ###
123+
implementation fromURL(
124+
'https://github.com/kbase/jars/raw/master/lib/jars/kbase/common/kbase-common-0.0.22.jar',
125+
'kbase-common-0.0.22'
126+
)
127+
implementation 'ch.qos.logback:logback-classic:1.1.2'
128+
implementation 'org.slf4j:slf4j-api:1.7.25'
129+
// Syslog4j 0.9.46 doesn't appear to be available on Maven. It apparently lives in
130+
// a JetBrains artifact server, but that's too much trouble and there's only one version there
131+
// anyway.
132+
// https://mvnrepository.com/artifact/org.jetbrains/syslog4j/0.9.46
133+
// Need to rework the java common logger to not use syslog4j at all since it's abandonware
134+
// and has a ton of CVEs, even in the newer versions.
135+
implementation fromURL(
136+
'https://github.com/kbase/jars/raw/master/lib/jars/syslog4j/syslog4j-0.9.46.jar',
137+
'syslog4j-0.9.46'
138+
)
139+
// needed for syslog
140+
implementation 'net.java.dev.jna:jna:3.4.0'
141+
142+
// ### Test ###
143+
144+
testImplementation 'commons-io:commons-io:2.4'
145+
testImplementation 'nl.jqno.equalsverifier:equalsverifier:3.1.10'
146+
testImplementation 'junit:junit:4.12'
147+
testImplementation 'org.mock-server:mockserver-netty:3.10.4'
148+
testImplementation 'org.eclipse.jetty:jetty-server:9.3.11.v20160721'
149+
testImplementation 'org.eclipse.jetty:jetty-servlet:9.3.11.v20160721'
150+
testImplementation 'io.github.java-diff-utils:java-diff-utils:2.2.0'
151+
testImplementation 'de.danielbechler:java-object-diff:0.94'
152+
testImplementation 'org.jsoup:jsoup:1.10.2'
153+
testImplementation 'org.mockito:mockito-core:3.0.0'
154+
}

gradle/wrapper/gradle-wrapper.jar

58.4 KB
Binary file not shown.
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)