diff --git a/.travis.yml b/.travis.yml index 4f6cc8d..8b44ebd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,25 +1,24 @@ -language: scala sudo: false +language: scala jdk: - - oraclejdk8 -# This skips the install step. -# See https://docs.travis-ci.com/user/customizing-the-build#Skipping-the-Installation-Ste +- openjdk8 +- openjdk11 install: true -script: $SCRIPT -env: - matrix: - - SCRIPT="mvn test -B" +script: mvn test -B + +matrix: + allow_failures: + - jdk: openjdk11 + fast_finish: true + cache: directories: - $HOME/.m2 - - $HOME/.ivy2/cache - $HOME/.nvm + before_cache: - # Ensure changes to the cache aren't persisted - rm -rf $HOME/.m2/repository/com/lightbend/lagom/sample/chirper - - rm -rf $HOME/.ivy2/cache/com/lightbend/lagom/sample/chirper - # Delete all ivydata files since ivy touches them on each build - - find $HOME/.ivy2/cache -name "ivydata-*.properties" | xargs rm + notifications: webhooks: urls: diff --git a/chirp-impl/src/test/java/sample/chirper/chirp/impl/ChirpTimelineEntityTest.java b/chirp-impl/src/test/java/sample/chirper/chirp/impl/ChirpTimelineEntityTest.java index d9d8c22..90a5577 100644 --- a/chirp-impl/src/test/java/sample/chirper/chirp/impl/ChirpTimelineEntityTest.java +++ b/chirp-impl/src/test/java/sample/chirper/chirp/impl/ChirpTimelineEntityTest.java @@ -4,7 +4,7 @@ import akka.NotUsed; import akka.actor.ActorSystem; import akka.stream.javadsl.Source; -import akka.testkit.JavaTestKit; +import akka.testkit.javadsl.TestKit; import com.lightbend.lagom.javadsl.testkit.PersistentEntityTestDriver; import org.junit.AfterClass; import org.junit.BeforeClass; @@ -28,7 +28,7 @@ public static void setup() { @AfterClass public static void teardown() { - JavaTestKit.shutdownActorSystem(system); + TestKit.shutdownActorSystem(system); system = null; } diff --git a/friend-impl/src/test/java/sample/chirper/friend/impl/FriendEntityTest.java b/friend-impl/src/test/java/sample/chirper/friend/impl/FriendEntityTest.java index 0bc0d94..9ebd39d 100644 --- a/friend-impl/src/test/java/sample/chirper/friend/impl/FriendEntityTest.java +++ b/friend-impl/src/test/java/sample/chirper/friend/impl/FriendEntityTest.java @@ -8,6 +8,7 @@ import java.util.Collections; import java.util.Optional; +import akka.testkit.javadsl.TestKit; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; @@ -19,7 +20,6 @@ import akka.Done; import akka.actor.ActorSystem; -import akka.testkit.JavaTestKit; import sample.chirper.friend.api.User; import sample.chirper.friend.impl.FriendCommand.AddFriend; import sample.chirper.friend.impl.FriendCommand.CreateUser; @@ -40,7 +40,7 @@ public static void setup() { @AfterClass public static void teardown() { - JavaTestKit.shutdownActorSystem(system); + TestKit.shutdownActorSystem(system); system = null; } diff --git a/front-end/pom.xml b/front-end/pom.xml index ae92fb8..59c5236 100644 --- a/front-end/pom.xml +++ b/front-end/pom.xml @@ -53,11 +53,6 @@ api-tools_${scala.binary.version} ${lagom.version} - - com.lightbend.lagom - lagom-javadsl-client_${scala.binary.version} - ${lagom.version} - com.lightbend.rp reactive-lib-akka-cluster-bootstrap_${scala.binary.version} diff --git a/front-end/src/main/java/router/Routes.java b/front-end/src/main/java/router/Routes.java index c4cd0da..a8db6de 100644 --- a/front-end/src/main/java/router/Routes.java +++ b/front-end/src/main/java/router/Routes.java @@ -54,38 +54,34 @@ public Routes(Application application, private Router buildRouter() { return this.routingDsl // Index - .GET("/").routeTo(application::index) - .GET("/signup").routeTo(application::index) - .GET("/addFriend").routeTo(application::index) - .GET("/users/:id").routeTo(application::userStream) - .GET("/cb").routeTo(application::circuitBreaker) + .GET("/").routingTo((_req) -> application.index()) + .GET("/signup").routingTo((_req) -> application.index()) + .GET("/addFriend").routingTo((_req) -> application.index()) + .GET("/users/:id").routingTo((_req, userId) -> application.userStream(userId)) + .GET("/cb").routingTo((_req) -> application.circuitBreaker()) // Assets - .GET("/webjars/_requirejs").routeAsync(() -> + .GET("/webjars/_requirejs").routingAsync((req) -> requireJs.setup() .asJava() - .apply(requestHeader()) + .apply(req) .run(materializer) ) - .GET("/assets/*file").routeAsync((String file) -> + .GET("/assets/*file").routingAsync((req, file) -> assets.at("/public", file, false) .asJava() - .apply(requestHeader()) + .apply(req) .run(materializer) ) - .GET("/webjars/*file").routeAsync((String file) -> + .GET("/webjars/*file").routingAsync((req, file) -> webJars.at(file) .asJava() - .apply(requestHeader()) + .apply(req) .run(materializer) ) .build().asScala(); } - private Http.RequestHeader requestHeader() { - return Http.Context.current().request(); - } - @Override public PartialFunction routes() { return router.routes(); diff --git a/load-test-impl/src/main/java/sample/chirper/load/impl/LoadTestServiceImpl.java b/load-test-impl/src/main/java/sample/chirper/load/impl/LoadTestServiceImpl.java index 5fd159e..d2c08b3 100644 --- a/load-test-impl/src/main/java/sample/chirper/load/impl/LoadTestServiceImpl.java +++ b/load-test-impl/src/main/java/sample/chirper/load/impl/LoadTestServiceImpl.java @@ -5,6 +5,7 @@ import akka.NotUsed; import com.lightbend.lagom.javadsl.api.ServiceCall; +import java.time.Duration; import java.time.LocalDate; import java.time.ZoneOffset; import java.util.ArrayList; @@ -12,11 +13,10 @@ import java.util.List; import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletionStage; -import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicLong; import javax.inject.Inject; -import play.Logger; -import play.Logger.ALogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import sample.chirper.activity.api.ActivityStreamService; import sample.chirper.chirp.api.Chirp; import sample.chirper.chirp.api.ChirpService; @@ -25,7 +25,6 @@ import sample.chirper.friend.api.User; import sample.chirper.load.api.LoadTestService; import sample.chirper.load.api.TestParams; -import scala.concurrent.duration.FiniteDuration; import akka.japi.Pair; import akka.stream.Materializer; @@ -38,7 +37,7 @@ public class LoadTestServiceImpl implements LoadTestService { private final ActivityStreamService activityService; private final ChirpService chirpService; private final Materializer materializer; - private final ALogger log = Logger.of(getClass()); + private static final Logger log = LoggerFactory.getLogger(LoadTestServiceImpl.class); // to create "unique" user ids we prefix them with this, convenient // to not have overlapping user ids when running in dev mode @@ -114,7 +113,7 @@ public ServiceCall startLoadHeadless() { Source writes = Source.from(Arrays.asList(createdUsers, addedFriends, postedChirps)) .flatMapConcat(s -> s); - final FiniteDuration interval = FiniteDuration.create(5, TimeUnit.SECONDS); + final Duration interval = Duration.ofSeconds(5); Source clientsThroughput = Source.tick(interval, interval, "tick") .scan(new Throughput(System.nanoTime(), System.nanoTime(), 0, 0), (t, tick) -> { long now = System.nanoTime(); @@ -148,7 +147,7 @@ public ServiceCall startLoadHeadless() { return Flow.of(NotUsed.class) .scan(0, (count, elem) -> count + 1) .drop(1) - .groupedWithin(1000, FiniteDuration.create(1, TimeUnit.SECONDS)) + .groupedWithin(1000, Duration.ofSeconds(1)) .map(list -> list.get(list.size() - 1)) .map(c -> title + ": " + c); } diff --git a/pom.xml b/pom.xml index fb09d43..a1afe33 100644 --- a/pom.xml +++ b/pom.xml @@ -22,6 +22,24 @@ + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.5.1 + + 1.8 + 1.8 + + -parameters + -Xlint:all,-options,-path + -Werror + + + + + org.apache.maven.plugins @@ -53,14 +71,6 @@ org.apache.maven.plugins maven-compiler-plugin - 3.5.1 - - 1.8 - 1.8 - - -parameters - - org.apache.maven.plugins @@ -138,7 +148,7 @@ org.webjars webjars-play_${scala.binary.version} - 2.6.3 + 2.7.0-RC3 org.webjars @@ -171,7 +181,7 @@ UTF-8 - 1.4.9 + 1.5.0-RC1 2.12