diff --git a/.github/workflows/build_publish.yml b/.github/workflows/build_publish.yml index 6edfdc5..a4a5354 100644 --- a/.github/workflows/build_publish.yml +++ b/.github/workflows/build_publish.yml @@ -12,15 +12,13 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Setup Java 8 + - name: Setup Java 17 uses: actions/setup-java@v4 with: distribution: "zulu" - java-version: "8" - # - name: Run Unit Tests - # run: mvn --no-transfer-progress clean test - - name: Install bower - run: npm install -g bower + java-version: "17" + - name: Run Unit Tests + run: mvn --no-transfer-progress clean test - name: Package run: mvn --no-transfer-progress clean package -DskipTests - uses: actions/upload-artifact@v4 diff --git a/package/docker/.appversion b/package/docker/.appversion index afaf360..359a5b9 100644 --- a/package/docker/.appversion +++ b/package/docker/.appversion @@ -1 +1 @@ -1.0.0 \ No newline at end of file +2.0.0 \ No newline at end of file diff --git a/package/docker/Dockerfile b/package/docker/Dockerfile index 415abe1..f8f06df 100644 --- a/package/docker/Dockerfile +++ b/package/docker/Dockerfile @@ -1,4 +1,4 @@ -FROM amazoncorretto:8 +FROM amazoncorretto:17 COPY package/docker/resources/application.yml.template . COPY package/docker/resources/start.sh . COPY package/docker/resources/*.jar . diff --git a/package/docker/resources/application.yml.template b/package/docker/resources/application.yml.template index 27c15e8..34f0dc5 100644 --- a/package/docker/resources/application.yml.template +++ b/package/docker/resources/application.yml.template @@ -1,6 +1,7 @@ server: port: 9080 - contextPath: /atomfeed-console + servlet: + context-path: /atomfeed-console appConfigs: - appName: OpenMRS diff --git a/package/docker/resources/start.sh b/package/docker/resources/start.sh index 73091fc..33b8626 100644 --- a/package/docker/resources/start.sh +++ b/package/docker/resources/start.sh @@ -4,4 +4,4 @@ set -e echo "[INFO] Substituting Environment Variables" envsubst < application.yml.template > application.yml echo "[INFO] Starting Application" -java -jar *.jar --spring.config.location=appilcation.yml \ No newline at end of file +java -jar *.jar --spring.config.location=application.yml \ No newline at end of file diff --git a/pom.xml b/pom.xml index 2f0a066..eac957a 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ org.springframework.boot spring-boot-starter-parent - 1.3.2.RELEASE + 3.4.5 @@ -23,7 +23,6 @@ org.springframework.boot spring-boot-starter-test - 1.3.2.RELEASE test @@ -34,45 +33,39 @@ org.postgresql postgresql - 9.4.1211.jre7 + 42.7.4 - mysql - mysql-connector-java - 5.1.8 + com.mysql + mysql-connector-j + 9.1.0 - c3p0 + com.mchange c3p0 - 0.9.1.2 - - - log4j - log4j - 1.2.17 - provided + 0.9.5.5 com.h2database h2 - 1.4.191 test + - com.github.searls - jasmine-maven-plugin + org.junit.vintage + junit-vintage-engine test - 2.1 + - com.kelveden - maven-karma-plugin - 1.6 + org.slf4j + log4j-over-slf4j - 1.7 + 17 + 10.1.55 1 @@ -83,44 +76,6 @@ org.springframework.boot spring-boot-maven-plugin - - org.codehaus.mojo - exec-maven-plugin - - - generate-sources - - exec - - - - - bower - - install - - ${basedir}/src/main - - - - - - com.kelveden - maven-karma-plugin - 1.6 - - - process-test-classes - - start - - - - - ${basedir}/src/main/resources/static/node_modules/karma/bin/karma - src/main/resources/static/test/karma.conf.js - - org.codehaus.mojo rpm-maven-plugin diff --git a/src/main/java/org/ict4h/config/WebConfig.java b/src/main/java/org/ict4h/config/WebConfig.java index 5baea2f..628fa26 100644 --- a/src/main/java/org/ict4h/config/WebConfig.java +++ b/src/main/java/org/ict4h/config/WebConfig.java @@ -3,20 +3,19 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @Configuration public class WebConfig { @Bean - public WebMvcConfigurerAdapter forwardToIndex() { - return new WebMvcConfigurerAdapter() { + public WebMvcConfigurer forwardToIndex() { + return new WebMvcConfigurer() { @Override public void addViewControllers(ViewControllerRegistry registry) { - // forward requests to /admin and /user to their index.html + // forward requests to /app to its index.html registry.addViewController("/app").setViewName( - "/Users/kritikaj/kritika_code/atomfeed-console/src/main/static/index.html"); - + "forward:/index.html"); } }; } diff --git a/src/main/java/org/ict4h/jdbc/ConnectionPools.java b/src/main/java/org/ict4h/jdbc/ConnectionPools.java index bc5436c..6c02d87 100644 --- a/src/main/java/org/ict4h/jdbc/ConnectionPools.java +++ b/src/main/java/org/ict4h/jdbc/ConnectionPools.java @@ -6,7 +6,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; import java.sql.Connection; import java.sql.SQLException; import java.util.HashMap; diff --git a/src/main/java/org/ict4h/service/AppStatusService.java b/src/main/java/org/ict4h/service/AppStatusService.java index e4114f2..1f896c5 100644 --- a/src/main/java/org/ict4h/service/AppStatusService.java +++ b/src/main/java/org/ict4h/service/AppStatusService.java @@ -1,6 +1,5 @@ package org.ict4h.service; -import org.apache.log4j.Logger; import org.ict4h.atomfeed.client.domain.Marker; import org.ict4h.atomfeed.client.repository.AllFailedEvents; import org.ict4h.atomfeed.client.repository.AllMarkers; @@ -11,6 +10,8 @@ import org.ict4h.domain.Feeds; import org.ict4h.domain.Feed; import org.ict4h.jdbc.ConnectionPools; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -21,7 +22,7 @@ @Component public class AppStatusService { - private static Logger logger = Logger.getLogger(AppStatusService.class); + private static Logger logger = LoggerFactory.getLogger(AppStatusService.class); ConnectionPools connectionPools; @Autowired diff --git a/src/main/java/org/ict4h/service/FailedEventRetryLogService.java b/src/main/java/org/ict4h/service/FailedEventRetryLogService.java index 9d8fdde..1d32c4b 100644 --- a/src/main/java/org/ict4h/service/FailedEventRetryLogService.java +++ b/src/main/java/org/ict4h/service/FailedEventRetryLogService.java @@ -1,10 +1,11 @@ package org.ict4h.service; -import org.apache.log4j.Logger; import org.ict4h.atomfeed.client.domain.FailedEventRetryLog; import org.ict4h.atomfeed.client.repository.AllFailedEvents; import org.ict4h.atomfeed.client.repository.jdbc.AllFailedEventsJdbcImpl; import org.ict4h.domain.configuration.AppConfig; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -12,7 +13,7 @@ @Component public class FailedEventRetryLogService { - private static Logger logger = Logger.getLogger(FailedEventRetryLogService.class); + private static Logger logger = LoggerFactory.getLogger(FailedEventRetryLogService.class); @Autowired private AppStatusService appStatusService; diff --git a/src/main/java/org/ict4h/service/FailedEventService.java b/src/main/java/org/ict4h/service/FailedEventService.java index d5fec60..34e8199 100644 --- a/src/main/java/org/ict4h/service/FailedEventService.java +++ b/src/main/java/org/ict4h/service/FailedEventService.java @@ -1,10 +1,11 @@ package org.ict4h.service; -import org.apache.log4j.Logger; import org.ict4h.atomfeed.client.domain.FailedEvent; import org.ict4h.atomfeed.client.repository.AllFailedEvents; import org.ict4h.atomfeed.client.repository.jdbc.AllFailedEventsJdbcImpl; import org.ict4h.domain.configuration.AppConfig; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -12,7 +13,7 @@ @Component public class FailedEventService { - private static Logger logger = Logger.getLogger(FailedEventService.class); + private static Logger logger = LoggerFactory.getLogger(FailedEventService.class); @Autowired private AppStatusService appStatusService; diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 31b058d..261eb21 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -1,6 +1,7 @@ server: port: 9080 - contextPath: /atomfeed-console + servlet: + context-path: /atomfeed-console appConfigs: - appName: App1 diff --git a/src/test/java/org/ict4h/controller/AppStatusControllerTest.java b/src/test/java/org/ict4h/controller/AppStatusControllerTest.java index 4aadc40..9bb8f3e 100644 --- a/src/test/java/org/ict4h/controller/AppStatusControllerTest.java +++ b/src/test/java/org/ict4h/controller/AppStatusControllerTest.java @@ -2,13 +2,10 @@ import org.ict4h.AtomfeedConsoleApplication; import org.ict4h.controllers.AppController; -import org.ict4h.domain.configuration.AppConfig; -import org.ict4h.domain.configuration.AppConfigs; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.test.SpringApplicationConfiguration; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import java.util.List; @@ -18,13 +15,12 @@ import static org.junit.Assert.*; @RunWith(SpringJUnit4ClassRunner.class) -@SpringApplicationConfiguration(AtomfeedConsoleApplication.class) +@SpringBootTest(classes = AtomfeedConsoleApplication.class) public class AppStatusControllerTest { @Autowired private AppController appController; - @Value("${../../resources/application.yml}") @Test public void shouldRetrieveConfig() { List appDetails = appController.getAppDetails(); diff --git a/src/test/java/org/ict4h/controller/FailedEventControllerTest.java b/src/test/java/org/ict4h/controller/FailedEventControllerTest.java index e220546..ef9fe2e 100644 --- a/src/test/java/org/ict4h/controller/FailedEventControllerTest.java +++ b/src/test/java/org/ict4h/controller/FailedEventControllerTest.java @@ -9,7 +9,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.SpringApplicationConfiguration; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import java.sql.SQLException; @@ -21,7 +21,7 @@ import static org.junit.Assert.assertThat; @RunWith(SpringJUnit4ClassRunner.class) -@SpringApplicationConfiguration(AtomfeedConsoleApplication.class) +@SpringBootTest(classes = AtomfeedConsoleApplication.class) public class FailedEventControllerTest extends BaseTest { private int failedEventId = 1; diff --git a/src/test/java/org/ict4h/controller/FailedEventRetryLogControllerTest.java b/src/test/java/org/ict4h/controller/FailedEventRetryLogControllerTest.java index 0fbc617..98cdf9d 100644 --- a/src/test/java/org/ict4h/controller/FailedEventRetryLogControllerTest.java +++ b/src/test/java/org/ict4h/controller/FailedEventRetryLogControllerTest.java @@ -9,7 +9,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.SpringApplicationConfiguration; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import java.sql.SQLException; @@ -20,7 +20,7 @@ import static org.junit.Assert.assertThat; @RunWith(SpringJUnit4ClassRunner.class) -@SpringApplicationConfiguration(AtomfeedConsoleApplication.class) +@SpringBootTest(classes = AtomfeedConsoleApplication.class) public class FailedEventRetryLogControllerTest extends BaseTest { private int failedEventRetryId = 1; diff --git a/src/test/java/org/ict4h/controller/FeedsControllerTest.java b/src/test/java/org/ict4h/controller/FeedsControllerTest.java index 71691d8..27e1797 100644 --- a/src/test/java/org/ict4h/controller/FeedsControllerTest.java +++ b/src/test/java/org/ict4h/controller/FeedsControllerTest.java @@ -10,7 +10,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.SpringApplicationConfiguration; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import java.sql.SQLException; @@ -21,7 +21,7 @@ @RunWith(SpringJUnit4ClassRunner.class) -@SpringApplicationConfiguration(AtomfeedConsoleApplication.class) +@SpringBootTest(classes = AtomfeedConsoleApplication.class) public class FeedsControllerTest extends BaseTest { private static final String CREATE_MARKERS= "insert into markers " + diff --git a/src/test/java/org/ict4h/controller/ResetRetriesForFailedEventTest.java b/src/test/java/org/ict4h/controller/ResetRetriesForFailedEventTest.java index 29c9485..5719af8 100644 --- a/src/test/java/org/ict4h/controller/ResetRetriesForFailedEventTest.java +++ b/src/test/java/org/ict4h/controller/ResetRetriesForFailedEventTest.java @@ -7,7 +7,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.SpringApplicationConfiguration; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import java.sql.SQLException; @@ -18,7 +18,7 @@ import static org.junit.Assert.assertThat; @RunWith(SpringJUnit4ClassRunner.class) -@SpringApplicationConfiguration(AtomfeedConsoleApplication.class) +@SpringBootTest(classes = AtomfeedConsoleApplication.class) public class ResetRetriesForFailedEventTest extends BaseTest { private int failedEventId = 1; diff --git a/src/test/java/org/ict4h/util/Database.java b/src/test/java/org/ict4h/util/Database.java index 3513f8c..9dd8568 100644 --- a/src/test/java/org/ict4h/util/Database.java +++ b/src/test/java/org/ict4h/util/Database.java @@ -14,7 +14,7 @@ public static void createDatabase() throws SQLException { } public static Connection getConnection() throws SQLException { - return DriverManager.getConnection("jdbc:h2:mem:test;DB_CLOSE_DELAY=-1", "", ""); + return DriverManager.getConnection("jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;MODE=MySQL", "", ""); } private static final String CREATE_MARKERS_TABLE = "CREATE TABLE markers (\n" + diff --git a/src/test/resources/application.yml b/src/test/resources/application.yml index 7a11cda..5f33621 100644 --- a/src/test/resources/application.yml +++ b/src/test/resources/application.yml @@ -1,6 +1,6 @@ appConfigs: - appName: testApp - dbUrl: jdbc:h2:mem:test;DB_CLOSE_DELAY=-1 + dbUrl: jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;MODE=MySQL dbUser: dbPassword: