Skip to content

Commit 5e611f0

Browse files
committed
Fixes #509 - Cleanup various bits
1 parent 6682772 commit 5e611f0

File tree

7 files changed

+139
-12
lines changed

7 files changed

+139
-12
lines changed

WORKFLOWS.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,6 @@
106106
| | Create an Azure Front Door Endpoint | [![afd/create-endpoint/README.md](https://github.com/Azure-Samples/java-on-azure-examples/actions/workflows/afd_create-endpoint_README_md.yml/badge.svg)](https://github.com/Azure-Samples/java-on-azure-examples/actions/workflows/afd_create-endpoint_README_md.yml) | 0 1 * * 5 |
107107
| | Add a route | [![afd/add-route/README.md](https://github.com/Azure-Samples/java-on-azure-examples/actions/workflows/afd_add-route_README_md.yml/badge.svg)](https://github.com/Azure-Samples/java-on-azure-examples/actions/workflows/afd_add-route_README_md.yml) | 0 2 * * 5 |
108108
| | Add origins to origin group | [![afd/add-origins-to-origin-group/README.md](https://github.com/Azure-Samples/java-on-azure-examples/actions/workflows/afd_add-origins-to-origin-group_README_md.yml/badge.svg)](https://github.com/Azure-Samples/java-on-azure-examples/actions/workflows/afd_add-origins-to-origin-group_README_md.yml) | 0 3 * * 5 |
109-
| | Push a Hello World job image to your ACR | [![acr/helloworldjob/README.md](https://github.com/Azure-Samples/java-on-azure-examples/actions/workflows/acr_helloworldjob_README_md.yml/badge.svg)](https://github.com/Azure-Samples/java-on-azure-examples/actions/workflows/acr_helloworldjob_README_md.yml) | 0 12 * * 5 |
110-
111109
-->
112110

113111
| Example | Workflow Status | Workflow Schedule | Update schedule |
@@ -119,7 +117,8 @@
119117
| [Create and push a Dropwizard application to Azure Container Registry](acr/dropwizard/README.md) | [![acr/dropwizard/README.md](https://github.com/Azure-Samples/java-on-azure-examples/actions/workflows/acr_dropwizard_README_md.yml/badge.svg)](https://github.com/Azure-Samples/java-on-azure-examples/actions/workflows/acr_dropwizard_README_md.yml) | 0 3 * * 0 | Week 4 |
120118
| [Create and push a Glassfish image to Azure Container Registry](acr/glassfish/README.md) | [![acr/glassfish/README.md](https://github.com/Azure-Samples/java-on-azure-examples/actions/workflows/acr_glassfish_README_md.yml/badge.svg)](https://github.com/Azure-Samples/java-on-azure-examples/actions/workflows/acr_glassfish_README_md.yml) | 0 4 * * 0 | Week 5 |
121119
| [Create and push a GraalVM application to Azure Container Registry](acr/graalvm/README.md) | [![acr/graalvm/README.md](https://github.com/Azure-Samples/java-on-azure-examples/actions/workflows/acr_graalvm_README_md.yml/badge.svg)](https://github.com/Azure-Samples/java-on-azure-examples/actions/workflows/acr_graalvm_README_md.yml) | 0 5 * * 0 | Week 6 |
122-
| [Create and push a Helidon application to Azure Container Registry](acr/helidon/README.md) | [![acr/helidon/README.md](https://github.com/Azure-Samples/java-on-azure-examples/actions/workflows/acr_helidon_README_md.yml/badge.svg)](https://github.com/Azure-Samples/java-on-azure-examples/actions/workflows/acr_helidon_README_md.yml) | 0 6 * * 0 |
120+
| [Create and push a Helidon application to Azure Container Registry](acr/helidon/README.md) | [![acr/helidon/README.md](https://github.com/Azure-Samples/java-on-azure-examples/actions/workflows/acr_helidon_README_md.yml/badge.svg)](https://github.com/Azure-Samples/java-on-azure-examples/actions/workflows/acr_helidon_README_md.yml) | 0 6 * * 0 | Week 7 |
121+
| [Create and push a Hello World job to Azure Container Registry](acr/helloworldjob/README.md) | [![acr/helloworldjob/README.md](https://github.com/Azure-Samples/java-on-azure-examples/actions/workflows/acr_helloworldjob_README_md.yml/badge.svg)](https://github.com/Azure-Samples/java-on-azure-examples/actions/workflows/acr_helloworldjob_README_md.yml) | 0 7 * * 0 | Week 8 |
123122
| Azure Kubernetes Service examples
124123
| [Create a Kubernetes cluster](aks/create/README.md)| [![aks/create/README.md](https://github.com/Azure-Samples/java-on-azure-examples/actions/workflows/aks_create_README_md.yml/badge.svg)](https://github.com/Azure-Samples/java-on-azure-examples/actions/workflows/aks_create_README_md.yml) | 0 0 * * 2 |
125124
| Azure Container Apps examples

acr/helloworldjob/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ This example assumes you have previously completed the following examples:
1717
fi
1818
1919
-->
20-
<!-- workflow.cron(0 12 * * 5) -->
20+
<!-- workflow.cron(0 7 * * 0) -->
2121
<!-- workflow.javaVersion(17) -->
2222
<!-- workflow.include(../create/README.md) -->
2323

acr/helloworldjob/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
<modelVersion>4.0.0</modelVersion>
55
<groupId>examples.azure.acr</groupId>
66
<version>1-SNAPSHOT</version>
7-
<artifactId>acr-helloworldjob</artifactId>
7+
<artifactId>helloworldjob</artifactId>
88
<name>Build and push a Hello World Job application to ACR</name>
99
<properties>
1010
<!-- other -->
1111
<java.version>17</java.version>
1212
<!-- plugins -->
13-
<maven-compiler-plugin.version>3.12.1</maven-compiler-plugin.version>
14-
<maven-jar-plugin.version>3.3.0</maven-jar-plugin.version>
13+
<maven-compiler-plugin.version>3.13.0</maven-compiler-plugin.version>
14+
<maven-jar-plugin.version>3.4.2</maven-jar-plugin.version>
1515
</properties>
1616
<build>
1717
<finalName>helloworldjob</finalName>

containerapp/create-manual-job/README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,27 @@ if [[ -z $ACA_JOB_NAME ]]; then
3636
fi
3737
-->
3838

39-
To create the manual job use the command line below.
39+
To create the manual job use the command lines below.
4040

4141
```shell
42+
az containerapp job create \
43+
--name $ACA_JOB_NAME \
44+
--resource-group $RESOURCE_GROUP \
45+
--environment $ACA_ENVIRONMENT_NAME \
46+
--trigger-type Manual \
47+
--replica-timeout 1800 \
48+
--replica-retry-limit 1 \
49+
--replica-completion-count 1 \
50+
--parallelism 1 \
51+
--registry-identity system \
52+
--registry-server $ACR_NAME.azurecr.io \
53+
--image $ACR_NAME.azurecr.io/$ACR_HELLOWORLDJOB_IMAGE || true
54+
55+
az role assignment create \
56+
--assignee $(az containerapp job identity show --name $ACA_JOB_NAME --resource-group $RESOURCE_GROUP --query principalId --output tsv) \
57+
--role acrpull \
58+
--scope $(az acr show --name $ACR_NAME --query id --output tsv)
59+
4260
az containerapp job create \
4361
--name $ACA_JOB_NAME \
4462
--resource-group $RESOURCE_GROUP \

containerapp/get-job-execution-log/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<!--
88
99
if [[ -z $REGION ]]; then
10-
export REGION=westus
10+
export REGION=westus2
1111
fi
1212
1313
-->

spring/helloworld/pom.xml

Lines changed: 92 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,23 @@
88
<parent>
99
<groupId>org.springframework.boot</groupId>
1010
<artifactId>spring-boot-starter-parent</artifactId>
11-
<version>2.7.18</version>
11+
<version>3.3.6</version>
1212
<relativePath/>
1313
</parent>
1414
<artifactId>spring-helloworld</artifactId>
15+
<version>1-SNAPSHOT</version>
1516
<packaging>jar</packaging>
1617
<name>Deploy a Hello World Spring Boot application</name>
1718
<properties>
19+
<!-- dependencies -->
20+
<junit.version>5.8.1</junit.version>
21+
<playwright.version>1.49.0</playwright.version>
1822
<!-- other -->
1923
<java.version>11</java.version>
2024
<!-- plugins -->
21-
<maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version>
25+
<maven-compiler-plugin.version>3.13.0</maven-compiler-plugin.version>
26+
<maven-failsafe-plugin.version>3.5.2</maven-failsafe-plugin.version>
27+
<exec-maven-plugin.version>3.5.0</exec-maven-plugin.version>
2228
</properties>
2329
<build>
2430
<finalName>spring-helloworld</finalName>
@@ -27,7 +33,22 @@
2733
<groupId>org.apache.maven.plugins</groupId>
2834
<artifactId>maven-compiler-plugin</artifactId>
2935
<version>${maven-compiler-plugin.version}</version>
30-
<configuration>${java.version}</configuration>
36+
<configuration>
37+
<release>${java.version}</release>
38+
</configuration>
39+
</plugin>
40+
<plugin>
41+
<groupId>org.apache.maven.plugins</groupId>
42+
<artifactId>maven-failsafe-plugin</artifactId>
43+
<version>${maven-failsafe-plugin.version}</version>
44+
<executions>
45+
<execution>
46+
<goals>
47+
<goal>integration-test</goal>
48+
<goal>verify</goal>
49+
</goals>
50+
</execution>
51+
</executions>
3152
</plugin>
3253
<plugin>
3354
<groupId>org.springframework.boot</groupId>
@@ -38,6 +59,18 @@
3859
<goal>repackage</goal>
3960
</goals>
4061
</execution>
62+
<execution>
63+
<id>pre-integration-test</id>
64+
<goals>
65+
<goal>start</goal>
66+
</goals>
67+
</execution>
68+
<execution>
69+
<id>post-integration-test</id>
70+
<goals>
71+
<goal>stop</goal>
72+
</goals>
73+
</execution>
4174
</executions>
4275
</plugin>
4376
</plugins>
@@ -47,5 +80,61 @@
4780
<groupId>org.springframework.boot</groupId>
4881
<artifactId>spring-boot-starter-web</artifactId>
4982
</dependency>
83+
<dependency>
84+
<groupId>org.junit.jupiter</groupId>
85+
<artifactId>junit-jupiter-api</artifactId>
86+
<version>${junit.version}</version>
87+
<scope>test</scope>
88+
</dependency>
89+
<dependency>
90+
<groupId>org.junit.jupiter</groupId>
91+
<artifactId>junit-jupiter-engine</artifactId>
92+
<version>${junit.version}</version>
93+
<scope>test</scope>
94+
</dependency>
95+
<dependency>
96+
<groupId>com.microsoft.playwright</groupId>
97+
<artifactId>playwright</artifactId>
98+
<version>${playwright.version}</version>
99+
<scope>test</scope>
100+
</dependency>
50101
</dependencies>
102+
<profiles>
103+
<!--
104+
105+
This profile can be used to generate Playwright tests using the codegen command.
106+
107+
To generate tests, run the following command:
108+
109+
mvn -Pplaywright-codegen exec:java@codegen
110+
111+
-->
112+
<profile>
113+
<id>playwright-codegen</id>
114+
<build>
115+
<plugins>
116+
<plugin>
117+
<groupId>org.codehaus.mojo</groupId>
118+
<artifactId>exec-maven-plugin</artifactId>
119+
<version>${exec-maven-plugin.version}</version>
120+
<executions>
121+
<execution>
122+
<id>codegen</id>
123+
<goals>
124+
<goal>java</goal>
125+
</goals>
126+
</execution>
127+
</executions>
128+
<configuration>
129+
<mainClass>com.microsoft.playwright.CLI</mainClass>
130+
<arguments>
131+
<argument>codegen</argument>
132+
</arguments>
133+
<classpathScope>test</classpathScope>
134+
</configuration>
135+
</plugin>
136+
</plugins>
137+
</build>
138+
</profile>
139+
</profiles>
51140
</project>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package helloworld;
2+
3+
import org.junit.jupiter.api.Test;
4+
import static org.junit.jupiter.api.Assertions.assertTrue;
5+
import com.microsoft.playwright.*;
6+
7+
public class HelloWorldIT {
8+
9+
@Test
10+
public void testHelloWorld() {
11+
try (Playwright playwright = Playwright.create()) {
12+
Browser browser = playwright.chromium().launch(new BrowserType.LaunchOptions()
13+
.setHeadless(true));
14+
BrowserContext context = browser.newContext();
15+
Page page = context.newPage();
16+
page.navigate("http://localhost:8080/");
17+
// Assert that "Hello World" is found on the page
18+
assertTrue(page.content().contains("Hello World"));
19+
}
20+
}
21+
}

0 commit comments

Comments
 (0)