Skip to content

Commit

Permalink
replay-test: fix multi-module-app test
Browse files Browse the repository at this point in the history
- move "play.plugins" back to "app" where it was in Play1
- modify BaseSpec to actually run "HelloWorldApp" instead of the Starter
helper class

replay-tests/multi-module-app/core/src/main/resources/conf/play.plugins
  • Loading branch information
xabolcs committed Apr 24, 2024
1 parent 301fa5a commit 0975f9a
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ Where this is possible the guide below points this out with a **TIP**.
The following list breaks down the porting effort into tasks:

* Port the dependency specification from `conf/dependencies.yml` (Ivy2 format) to `build.gradle` (Gradle format).
* Move `app/play.plugins` to `conf/` and add all plugins you need explicitly (see the section on "Plugins").
* Ensure that `app/play.plugins` file (or the file where the `play.plugins.descriptor` configuration property is pointing) is on the classpath (e.g. `sourceSets.main.resources { srcDir 'app' }`) and add all plugins you need explicitly (see the section on "Plugins").
* Add the `app/<appname>/Application.java` and `app/<appname>/Module.java` (see the
[RePlay example project](/Users/andrei/projects/replay/replay-tests/criminals) for inspiration).
* Play1's [`PropertiesEnhancer`](https://github.com/playframework/play1/blob/master/framework/src/play/classloading/enhancers/PropertiesEnhancer.java) was removed.
Expand Down
7 changes: 0 additions & 7 deletions replay-tests/multi-module-app/app/app/HelloWorldApp.java

This file was deleted.

12 changes: 12 additions & 0 deletions replay-tests/multi-module-app/app/app/hello/HelloWorldApp.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package hello;

import play.server.Starter;

public class HelloWorldApp {
public int start(String playId) {
return Starter.start(playId);
}
public static void main(String[] args) {
new HelloWorldApp().start(System.getProperty("play.id", "prod"));
}
}
4 changes: 2 additions & 2 deletions replay-tests/multi-module-app/app/test/ui/hello/BaseSpec.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package ui.hello;

import com.codeborne.selenide.Configuration;
import hello.HelloWorldApp;
import org.junit.jupiter.api.BeforeEach;
import play.Play;
import play.server.Starter;

import java.util.concurrent.atomic.AtomicBoolean;

Expand All @@ -20,7 +20,7 @@ public void setUp() {
private static synchronized void startApp() {
if (appStarted.get()) return;

int port = Starter.start("test");
int port = new HelloWorldApp().start("test");

Configuration.baseUrl = "http://localhost:" + port;
Play.configuration.setProperty("application.baseUrl", Configuration.baseUrl);
Expand Down

0 comments on commit 0975f9a

Please sign in to comment.