Skip to content

Commit eaab356

Browse files
committed
chore(deps): Update recaptcha demosite dependencies.
1 parent a638305 commit eaab356

File tree

3 files changed

+53
-33
lines changed

3 files changed

+53
-33
lines changed

recaptcha_enterprise/demosite/pom.xml

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<?xml version='1.0' encoding='UTF-8'?>
22
<project xmlns="http://maven.apache.org/POM/4.0.0"
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
54
<modelVersion>4.0.0</modelVersion>
65
<groupId>com.example.recaptchaenterprise</groupId>
76
<artifactId>demosite</artifactId>
@@ -37,7 +36,7 @@
3736
<groupId>com.google.cloud</groupId>
3837
<scope>import</scope>
3938
<type>pom</type>
40-
<version>26.32.0</version>
39+
<version>26.75.0</version>
4140
</dependency>
4241
</dependencies>
4342
</dependencyManagement>
@@ -46,11 +45,18 @@
4645
<maven.compiler.source>11</maven.compiler.source>
4746
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
4847
<app.mainclass>app.SpringbootMain</app.mainclass>
49-
<spring.boot.version>2.7.18</spring.boot.version>
48+
<spring.boot.version>4.1.0-M4</spring.boot.version>
49+
<jacoco.version>0.8.12</jacoco.version>
5050
</properties>
5151

5252
<dependencies>
5353

54+
<dependency>
55+
<groupId>org.springframework.boot</groupId>
56+
<artifactId>spring-boot-starter-actuator</artifactId>
57+
</dependency>
58+
59+
5460
<dependency>
5561
<groupId>com.google.cloud</groupId>
5662
<artifactId>google-cloud-recaptchaenterprise</artifactId>
@@ -60,7 +66,7 @@
6066
<dependency>
6167
<groupId>org.json</groupId>
6268
<artifactId>json</artifactId>
63-
<version>20231013</version>
69+
<version>20251224</version>
6470
</dependency>
6571

6672

@@ -89,10 +95,15 @@
8995
<artifactId>junit-vintage-engine</artifactId>
9096
<scope>test</scope>
9197
</dependency>
98+
<dependency>
99+
<groupId>org.junit.platform</groupId>
100+
<artifactId>junit-platform-launcher</artifactId>
101+
<scope>test</scope>
102+
</dependency>
92103
<dependency>
93104
<groupId>com.google.truth</groupId>
94105
<artifactId>truth</artifactId>
95-
<version>1.4.0</version>
106+
<version>1.4.5</version>
96107
<scope>test</scope>
97108
</dependency>
98109
<!-- end_test_dependencies -->
@@ -178,6 +189,25 @@
178189
</dependency>
179190
</dependencies>
180191
</plugin>
192+
<plugin>
193+
<groupId>org.jacoco</groupId>
194+
<artifactId>jacoco-maven-plugin</artifactId>
195+
<version>${jacoco.version}</version>
196+
<executions>
197+
<execution>
198+
<goals>
199+
<goal>prepare-agent</goal>
200+
</goals>
201+
</execution>
202+
<execution>
203+
<id>report</id>
204+
<phase>test</phase>
205+
<goals>
206+
<goal>report</goal>
207+
</goals>
208+
</execution>
209+
</executions>
210+
</plugin>
181211
</plugins>
182212
</build>
183213

recaptcha_enterprise/demosite/src/test/java/ScoreKeyIT.java

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
* limitations under the License.
1515
*/
1616

17-
package app;
18-
1917
import static com.google.common.truth.Truth.assertThat;
2018
import static com.google.common.truth.Truth.assertWithMessage;
2119

@@ -38,7 +36,6 @@
3836
import org.junit.BeforeClass;
3937
import org.junit.Ignore;
4038
import org.junit.Test;
41-
import org.junit.runner.RunWith;
4239
import org.openqa.selenium.By;
4340
import org.openqa.selenium.JavascriptExecutor;
4441
import org.openqa.selenium.SearchContext;
@@ -51,10 +48,8 @@
5148
import org.springframework.boot.test.context.SpringBootTest;
5249
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
5350
import org.springframework.boot.test.web.server.LocalServerPort;
54-
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
5551
import org.springframework.web.util.UriComponentsBuilder;
5652

57-
@RunWith(SpringJUnit4ClassRunner.class)
5853
@EnableAutoConfiguration
5954
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
6055
@Ignore
@@ -69,16 +64,16 @@ public class ScoreKeyIT {
6964
// CSS selector of reCAPTCHA button in /home page. Used to execute Javascript actions.
7065
private static final String HOME_BUTTON_SELECTOR = "#example > button";
7166

72-
// CSS selector of reCAPTCHA button in all pages, except /home. Used to execute Javascript actions.
67+
// CSS selector of reCAPTCHA button in all pages, except /home. Used to execute Javascript
68+
// actions.
7369
private static final String BUTTON_SELECTOR = "button";
7470

7571
// CSS selector of reCAPTCHA result in page. Used to execute Javascript actions.
7672
private static final String RESULT_SELECTOR = "#result pre";
7773

7874
private static final String SHADOW_HOST_SELECTOR = "recaptcha-demo";
7975
private static WebDriver browser;
80-
@LocalServerPort
81-
private int randomServerPort;
76+
@LocalServerPort private int randomServerPort;
8277

8378
private ByteArrayOutputStream stdOut;
8479

@@ -95,7 +90,7 @@ public static void setUp() throws IOException, InterruptedException {
9590
requireEnvVar("GOOGLE_CLOUD_PROJECT");
9691

9792
// Create reCAPTCHA Score key.
98-
RECAPTCHA_SITE_KEY = app.Util.createSiteKey(PROJECT_ID, DOMAIN_NAME, IntegrationType.SCORE);
93+
RECAPTCHA_SITE_KEY = Util.createSiteKey(PROJECT_ID, DOMAIN_NAME, IntegrationType.SCORE);
9994
TimeUnit.SECONDS.sleep(5);
10095

10196
// Set Selenium Driver to Chrome.
@@ -110,7 +105,7 @@ public static void cleanUp()
110105
ByteArrayOutputStream stdOut = new ByteArrayOutputStream();
111106
System.setOut(new PrintStream(stdOut));
112107

113-
app.Util.deleteSiteKey(PROJECT_ID, RECAPTCHA_SITE_KEY);
108+
Util.deleteSiteKey(PROJECT_ID, RECAPTCHA_SITE_KEY);
114109
assertThat(stdOut.toString()).contains("reCAPTCHA Site key successfully deleted !");
115110

116111
browser.quit();
@@ -133,22 +128,20 @@ public void afterEach() {
133128

134129
// Construct the page URL with necessary context parameters.
135130
public static String makeRequest(String url, String siteKey) throws MalformedURLException {
136-
return
137-
UriComponentsBuilder.fromUriString(url)
138-
.queryParam("project_id", PROJECT_ID)
139-
.queryParam("site_key", siteKey)
140-
.build()
141-
.encode()
142-
.toUri()
143-
.toURL()
144-
.toString();
131+
return UriComponentsBuilder.fromUriString(url)
132+
.queryParam("project_id", PROJECT_ID)
133+
.queryParam("site_key", siteKey)
134+
.build()
135+
.encode()
136+
.toUri()
137+
.toURL()
138+
.toString();
145139
}
146140

147141
// Retrieve page and click the button specified by the element to obtain
148142
// response and redirect URL.
149-
public ImmutableMap<String, String> browserTest(String pageUrl, String buttonXPath,
150-
String resultXPath,
151-
boolean scoreOnPageLoad)
143+
public ImmutableMap<String, String> browserTest(
144+
String pageUrl, String buttonXPath, String resultXPath, boolean scoreOnPageLoad)
152145
throws JSONException, InterruptedException {
153146
browser.get(pageUrl);
154147

recaptcha_enterprise/demosite/src/test/java/Util.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
* limitations under the License.
1515
*/
1616

17-
package app;
18-
1917
import com.google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient;
2018
import com.google.recaptchaenterprise.v1.CreateKeyRequest;
2119
import com.google.recaptchaenterprise.v1.DeleteKeyRequest;
@@ -46,8 +44,8 @@ public static String createSiteKey(String projectID, String domainName, Integrat
4644
// For different types, see: https://cloud.google.com/recaptcha-enterprise/docs/keys
4745
Key scoreKey =
4846
Key.newBuilder()
49-
.setDisplayName("test-key-recaptcha-demosite-" +
50-
UUID.randomUUID().toString().split("-")[0])
47+
.setDisplayName(
48+
"test-key-recaptcha-demosite-" + UUID.randomUUID().toString().split("-")[0])
5149
.setWebSettings(
5250
WebKeySettings.newBuilder()
5351
.addAllowedDomains(domainName)
@@ -91,5 +89,4 @@ public static void deleteSiteKey(String projectID, String recaptchaSiteKey)
9189
System.out.println("reCAPTCHA Site key successfully deleted !");
9290
}
9391
}
94-
9592
}

0 commit comments

Comments
 (0)