Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Feature/async sse. Do not merge. #518

Draft
wants to merge 17 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 51 additions & 12 deletions cwms-data-api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ configurations {
docker
baseLibs
tomcatLibs
jettyLibs
}

configurations.implementation {
exclude group: 'com.oracle.database.jdbc'
// exclude group: 'com.oracle.database.jdbc'
}

dependencies {
Expand All @@ -39,7 +40,7 @@ dependencies {
exclude group: "mil.army.usace.hec", module: "cwms-db-jooq-codegen"

}
implementation(libs.cwms.db.jooq.codegen) {
implementation(libs.cwms.db.jooq.codegen) {
exclude group: "com.oracle", module: "*"
exclude group: "com.oracle.database.jdbc", module: "*"
exclude group: "org.jooq.pro", module: "*"
Expand Down Expand Up @@ -85,13 +86,13 @@ dependencies {
implementation(libs.geojson.jackson)

implementation(libs.javalin.core) {
exclude group: "org.eclipse.jetty"
exclude group: "org.eclipse.jetty.websocket"
// exclude group: "org.eclipse.jetty"
// exclude group: "org.eclipse.jetty.websocket"
}
implementation(libs.javalin.openapi) {
//exclude group: "org.eclipse.jetty"
exclude group: "org.eclipse.jetty.websocket"
exclude group: "jakarta.xml.bind", module: "*"
// //exclude group: "org.eclipse.jetty"
// exclude group: "org.eclipse.jetty.websocket"
// exclude group: "jakarta.xml.bind", module: "*"
}
implementation(libs.swagger.core) {
exclude group: "jakarta.xml.bind", module: "*"
Expand Down Expand Up @@ -123,8 +124,11 @@ dependencies {

baseLibs(libs.oracle.jdbc.driver)

compileOnly(libs.oracle.jdbc.driver)
testRuntimeOnly(libs.oracle.jdbc.driver)
baseLibs 'com.oracle.database.jdbc:ojdbc8:21.9.0.0'
implementation 'com.oracle.database.jdbc:ojdbc8:19.3.0.0'
testImplementation 'com.oracle.database.jdbc:ojdbc8:19.3.0.0'
implementation(libs.oracle.jdbc.driver)
testImplementation(libs.oracle.jdbc.driver)

testImplementation(libs.bundles.jackson)
testImplementation(libs.rest.assured)
Expand All @@ -135,8 +139,13 @@ dependencies {
tomcatLibs(libs.google.flogger.api)
tomcatLibs(libs.google.flogger.backend)

jettyLibs('org.eclipse.jetty:jetty-util:9.4.48.v20220622')
jettyLibs('org.eclipse.jetty:jetty-server:9.4.48.v20220622')
jettyLibs( 'org.eclipse.jetty:jetty-servlets:9.4.48.v20220622')
jettyLibs(libs.google.flogger.api)
jettyLibs(libs.google.flogger.backend)

testImplementation(libs.bundles.testcontainers)


testImplementation(libs.apache.commons.csv)
testImplementation(libs.cwms.tomcat.auth)
Expand Down Expand Up @@ -187,13 +196,20 @@ sourceSets {
}
main {
runtimeClasspath += formatList.runtimeClasspath
resources {
srcDir 'src/main/webapp' // I don't think this did what I wanted.
}
}
test {
runtimeClasspath += formatList.runtimeClasspath
}
}

test {
systemProperties += project.properties.findAll { k, v -> k.startsWith("RADAR") }
systemProperties += project.properties.findAll { k, v -> k.startsWith("CDA") }
systemProperties += project.properties.findAll { k, v -> k.startsWith("cwms") }

useJUnitPlatform() {
excludeTags "integration"
}
Expand Down Expand Up @@ -224,6 +240,7 @@ task run(type: JavaExec) {
classpath += configurations.baseLibs
classpath += configurations.tomcatLibs
classpath += sourceSets.test.output // to get the fixture
classpath += sourceSets.main.runtimeClasspath

mainClass = "fixtures.TomcatServer"
systemProperties += project.properties.findAll { k, v -> k.startsWith("RADAR") }
Expand All @@ -235,15 +252,37 @@ task run(type: JavaExec) {
jvmArgs += "-DTOMCAT_RESOURCES=$buildDir/tomcat/conf/context.xml"
jvmArgs += "-Dorg.apache.tomcat.util.digester.PROPERTY_SOURCE=org.apache.tomcat.util.digester.EnvironmentPropertySource"
jvmArgs += "-Dcatalina.base=$buildDir/tomcat"
// If you have the docker-compose environment up and are trying to run
// If you have the docker-compose environment up and are trying to run
// CDA from run to debug uncomment the following lines.
//jvmArgs += "-Dcwms.dataapi.access.providers=KeyAccessManager,CwmsAccessManager,OpenID"
//jvmArgs += "-Dcwms.dataapi.access.openid.wellKnownUrl=https://auth.test:8444/auth/realms/cwms/.well-known/openid-configuration"
//jvmArgs += "-Dcwms.dataapi.access.openid.issuer=https://auth.test:8444/auth/realms/cwms"
}

task runApiServlet(type: JavaExec) {
dependsOn generateConfig

classpath += configurations.baseLibs
classpath += configurations.jettyLibs

classpath += sourceSets.test.output
classpath += sourceSets.main.runtimeClasspath

mainClass = "cwms.cda.ApiServlet"
systemProperties += project.properties.findAll { k, v -> k.startsWith("RADAR") }
systemProperties += project.properties.findAll { k, v -> k.startsWith("CDA") }
systemProperties += project.properties.findAll { k, v -> k.startsWith("cwms") }

jvmArgs += "-Djava.util.logging.config.file=$projectDir/logging.properties"

jvmArgs += "-Dcwms.dataapi.access.providers=KeyAccessManager,CwmsAccessManager"
jvmArgs += "-Dcwms.dataapi.default.office=SPK"
jvmArgs += "-Dcwms.dataapi.external.root.dir.1=$buildDir\\..\\src\\main\\webapp"
jvmArgs += "-Dcwms.dataapi.external.root.dir.2=$buildDir\\extra"
}

task integrationTests(type: Test) {
dependsOn test
// dependsOn test
dependsOn generateConfig
dependsOn war

Expand Down
50 changes: 2 additions & 48 deletions cwms-data-api/logging.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,62 +13,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.

handlers = 1catalina.org.apache.juli.AsyncFileHandler, \
2localhost.org.apache.juli.AsyncFileHandler, java.util.logging.ConsoleHandler
handlers = \
java.util.logging.ConsoleHandler

.handlers = 1catalina.org.apache.juli.AsyncFileHandler, java.util.logging.ConsoleHandler

############################################################
# Handler specific properties.
# Describes specific configuration info for Handlers.
############################################################

1catalina.org.apache.juli.AsyncFileHandler.level = FINE
1catalina.org.apache.juli.AsyncFileHandler.directory = ${catalina.base}/logs
1catalina.org.apache.juli.AsyncFileHandler.prefix = catalina.
1catalina.org.apache.juli.AsyncFileHandler.maxDays = 4
1catalina.org.apache.juli.AsyncFileHandler.encoding = UTF-8

2localhost.org.apache.juli.AsyncFileHandler.level = FINE
2localhost.org.apache.juli.AsyncFileHandler.directory = ${catalina.base}/logs
2localhost.org.apache.juli.AsyncFileHandler.prefix = localhost.
2localhost.org.apache.juli.AsyncFileHandler.maxDays = 4
2localhost.org.apache.juli.AsyncFileHandler.encoding = UTF-8

java.util.logging.ConsoleHandler.level = INFO
java.util.logging.ConsoleHandler.formatter = org.apache.juli.OneLineFormatter
java.util.logging.ConsoleHandler.encoding = UTF-8


############################################################
# Facility specific properties.
# Provides extra control for each logger.
############################################################

org.apache.catalina.core.ContainerBase.[Catalina].[localhost].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].handlers = 2localhost.org.apache.juli.AsyncFileHandler

org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/cwms-data].level = FINE
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/cwms-data].handlers = 2localhost.org.apache.juli.AsyncFileHandler

# For example, set the org.apache.catalina.util.LifecycleBase logger to log
# each component that extends LifecycleBase changing state:
#org.apache.catalina.util.LifecycleBase.level = FINE

# To see debug messages in TldLocationsCache, uncomment the following line:
#org.apache.jasper.compiler.TldLocationsCache.level = FINE

# To see debug messages for HTTP/2 handling, uncomment the following line:
#org.apache.coyote.http2.level = FINE

# To see debug messages for WebSocket handling, uncomment the following line:
#org.apache.tomcat.websocket.level = FINE


fixtures.level=FINE
cwms.cda.datasource.level=FINE
org.apache.level=FINE
org.apache.catalina.realm.level=INFO
org.apache.catalina.realm.useParentHandlers=true
org.apache.catalina.authenticator.level=INFO
org.apache.catalina.authenticator.useParentHandlers=true
Loading