Skip to content

Commit 46a00f7

Browse files
committed
catup 1.8 updates
2 parents f1d25ac + fcb9af9 commit 46a00f7

15 files changed

Lines changed: 1045 additions & 1 deletion

File tree

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
##1.8.33**
44
* support plugin test engine
5+
* Choose port randomly when running automation test in batch mode #1317
56
* wrong file object inject from form field into the controller param #1316
67
* API doc - URL path variable in POST endpoint info is incorrect #1284
78
* `SampleData.ProvidedBy` is not effective on int type field #1310

‎src/main/java/act/conf/AppConfig.java‎

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,11 @@
7272

7373
import java.awt.*;
7474
import java.io.File;
75+
import java.io.IOException;
7576
import java.lang.reflect.Field;
7677
import java.lang.reflect.Method;
7778
import java.lang.reflect.Modifier;
79+
import java.net.ServerSocket;
7880
import java.nio.charset.StandardCharsets;
7981
import java.text.DateFormat;
8082
import java.text.SimpleDateFormat;
@@ -1877,7 +1879,11 @@ protected T httpPort(int port) {
18771879

18781880
public int httpPort() {
18791881
if (-1 == httpPort) {
1880-
httpPort = get(HTTP_PORT, 5460);
1882+
if ("test".equalsIgnoreCase(Act.profile())) {
1883+
httpPort = randomPort();
1884+
} else {
1885+
httpPort = get(HTTP_PORT, 5460);
1886+
}
18811887
}
18821888
return httpPort;
18831889
}
@@ -1888,6 +1894,18 @@ private void _mergeHttpPort(AppConfig conf) {
18881894
}
18891895
}
18901896

1897+
private static int randomPort() {
1898+
ServerSocket ss = null;
1899+
try {
1900+
ss = new ServerSocket(0);
1901+
return ss.getLocalPort();
1902+
} catch (IOException e) {
1903+
throw E.ioException(e);
1904+
} finally {
1905+
IO.close(ss);
1906+
}
1907+
}
1908+
18911909
private Boolean httpSecure = null;
18921910

18931911
protected T httpSecure(boolean secure) {

‎testapps/GH1315/.gitignore‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
*.iml
2+
target
3+
.idea
4+
classes
5+
*.log
6+
*.DS_Store
7+
*all.sql
8+
tmp/
9+
**/.act*
10+
**/.classpath
11+
**/.settings
12+
**/.project
13+
**/.settings/
14+
store1/
15+
test.mv.db
16+
test.trace.db
17+
act.pid
18+
.workspace
19+
*.geany

‎testapps/GH1315/pom.xml‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xmlns="http://maven.apache.org/POM/4.0.0"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<artifactId>gh1315-test</artifactId>
8+
<version>1.8.8.8-SNAPSHOT</version>
9+
10+
<name>ActFramework Test App for Github Issue 863</name>
11+
12+
<parent>
13+
<groupId>org.actframework</groupId>
14+
<artifactId>act-starter-parent</artifactId>
15+
<version>1.8.32.0</version>
16+
</parent>
17+
18+
<properties>
19+
<!-- remove the following line if you are on Java 7-->
20+
<java.version>1.8</java.version>
21+
<app.entry>test.AppEntry</app.entry>
22+
</properties>
23+
24+
<dependencies>
25+
<!-- add your dependencies here -->
26+
<dependency>
27+
<groupId>org.actframework</groupId>
28+
<artifactId>act</artifactId>
29+
<version>1.8.33-SNAPSHOT</version>
30+
</dependency>
31+
<dependency>
32+
<groupId>org.actframework</groupId>
33+
<artifactId>act-beetl</artifactId>
34+
</dependency>
35+
</dependencies>
36+
37+
</project>

‎testapps/GH1315/run_dev‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
echo building ...
3+
mvn -q compile act:run

‎testapps/GH1315/run_dev.bat‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
echo building ...
2+
mvn -q compile act:run

‎testapps/GH1315/run_e2e‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
echo building ...
3+
mvn -q compile act:e2e

‎testapps/GH1315/run_e2e.bat‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
echo building ...
2+
mvn -q compile act:e2e

‎testapps/GH1315/run_prod‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/sh
2+
if [ ! -f target/dist/start ]; then
3+
echo building ...
4+
mvn -q clean package
5+
cd target/dist
6+
tar xzf *.tar.gz
7+
else
8+
cd target/dist
9+
fi
10+
./run $*
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package test;
2+
3+
import act.Act;
4+
import act.controller.Controller;
5+
import act.util.JsonView;
6+
import org.osgl.mvc.annotation.GetAction;
7+
8+
@SuppressWarnings("unused")
9+
@JsonView
10+
public class AppEntry extends Controller.Util {
11+
12+
@GetAction
13+
public void test() {
14+
renderTemplate("/test.html");
15+
}
16+
17+
18+
public static void main(String[] args) throws Exception {
19+
Act.start();
20+
}
21+
22+
}

0 commit comments

Comments
 (0)