Skip to content

Commit ecb7dbb

Browse files
ludochgae-java-bot
authored andcommitted
Use java17 instead of java8 apps in tests.
PiperOrigin-RevId: 920201149 Change-Id: If799fb759266a92944ad12b4e2b2a617913e5ce1
1 parent b95e358 commit ecb7dbb

46 files changed

Lines changed: 69 additions & 102 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

api_dev/src/test/java/com/google/appengine/tools/development/BackendServersTest.java

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,39 +25,38 @@
2525
/** Test @code {@link BackendServersBase} */
2626
public class BackendServersTest extends TestCase {
2727

28-
public void testServerInstanceEntryHashCode() throws Exception{
28+
public void testServerInstanceEntryHashCode() throws Exception {
2929
ServerInstanceEntry server1 = new ServerInstanceEntry("server1", 17);
3030
ServerInstanceEntry server1copy = new ServerInstanceEntry("server1", 17);
3131
ServerInstanceEntry server2 = new ServerInstanceEntry("server2", 17);
32-
32+
3333
assertThat(server1.hashCode()).isNotEqualTo(server2.hashCode());
34-
assertEquals(server1.hashCode(), server1copy.hashCode());
34+
assertEquals(server1.hashCode(), server1copy.hashCode());
3535
}
36-
37-
public void testServerInstanceEntryEquals() throws Exception{
36+
37+
public void testServerInstanceEntryEquals() throws Exception {
3838
ServerInstanceEntry server1 = new ServerInstanceEntry("server1", 17);
3939
ServerInstanceEntry server1copy = new ServerInstanceEntry("server1", 17);
4040
ServerInstanceEntry server2 = new ServerInstanceEntry("server2", 17);
4141
ServerInstanceEntry server3 = new ServerInstanceEntry(null, 17);
4242
ServerInstanceEntry server3copy = new ServerInstanceEntry(null, 17);
43-
43+
4444
assertEquals(server1, server1copy);
4545
assertFalse(server1.equals(server2));
4646
assertFalse(server2.equals(server3));
4747
assertEquals(server3, server3copy);
4848
}
49-
50-
51-
public void testServerInstanceIsHashSetCompatible() throws Exception{
49+
50+
public void testServerInstanceIsHashSetCompatible() throws Exception {
5251
ServerInstanceEntry server1 = new ServerInstanceEntry("server1", 17);
53-
ServerInstanceEntry server1copy = new ServerInstanceEntry("server1", 17);
52+
ServerInstanceEntry server1copy = new ServerInstanceEntry("server1", 17);
5453
ServerInstanceEntry server2 = new ServerInstanceEntry("server2", 17);
5554
ServerInstanceEntry server3 = new ServerInstanceEntry("server1", 18);
56-
55+
5756
HashSet<ServerInstanceEntry> set = new HashSet<ServerInstanceEntry>();
5857
set.add(server1);
5958
assertThat(set).contains(server1copy);
6059
assertFalse(set.contains(server2));
6160
assertFalse(set.contains(server3));
62-
}
61+
}
6362
}

applications/proberapp/src/main/webapp/WEB-INF/appengine-web.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
limitations under the License.
1616
-->
1717
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
18-
<runtime>java8</runtime>
18+
<runtime>java17</runtime>
1919
<app-engine-apis>true</app-engine-apis>
2020
<threadsafe>true</threadsafe>
2121
<system-properties>

e2etests/stagingtests/src/test/java/com/google/appengine/tools/admin/ApplicationTest.java

Lines changed: 11 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@
6363
import javax.xml.parsers.ParserConfigurationException;
6464
import org.junit.After;
6565
import org.junit.Before;
66-
import org.junit.Ignore;
6766
import org.junit.Rule;
6867
import org.junit.Test;
6968
import org.junit.rules.TemporaryFolder;
@@ -478,39 +477,6 @@ public void testSaneStagingDefaults() throws Exception {
478477
assertFileContains(appYaml, "application: 'sampleapp'");
479478
}
480479

481-
@Test
482-
public void testStagingForGcloudWithFilesAndConfigErasure() throws Exception {
483-
Application testApp = Application.readApplication(TEST_FILES, null, null, null);
484-
testApp.setDetailsWriter(
485-
new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out, UTF_8))));
486-
487-
testApp.validateForStaging();
488-
489-
ApplicationProcessingOptions opts = new ApplicationProcessingOptions();
490-
opts.setStagingOptions(StagingOptions.builder().setSplitJarFiles(Optional.of(true)).build());
491-
492-
File stagingDir = testApp.createStagingDirectory(opts, temporaryFolder.newFolder());
493-
testStagedFiles(testApp);
494-
// user staging copies yaml files from appengine-generated into the root
495-
File copiedAppYaml = new File(stagingDir, "app.yaml");
496-
File originalAppYaml = new File(stagingDir, "WEB-INF/appengine-generated/app.yaml");
497-
assertThat(copiedAppYaml.canRead()).isTrue();
498-
499-
// the copied app.yaml is the original with a precautionary new line and an
500-
// extra 'skip_files' line.
501-
List<String> expectedCopiedAppYaml = Files.readLines(originalAppYaml, UTF_8);
502-
expectedCopiedAppYaml.add("");
503-
expectedCopiedAppYaml.add("skip_files: app.yaml");
504-
assertThat(Files.readLines(copiedAppYaml, UTF_8)).isEqualTo(expectedCopiedAppYaml);
505-
506-
String yamlString = Files.asCharSource(copiedAppYaml, UTF_8).read();
507-
assertThat(yamlString.startsWith("application:")).isFalse();
508-
assertThat(yamlString).doesNotContain("\napplication:");
509-
assertThat(yamlString.startsWith("version:")).isFalse();
510-
assertThat(yamlString).doesNotContain("\nversion:");
511-
assertFileContains(copiedAppYaml, "\nskip_files: app.yaml");
512-
}
513-
514480
private static void testStagedFiles(Application testApp) throws Exception {
515481
File stage = testApp.getStagingDir();
516482
File html = new File(stage, "__static__/random.html");
@@ -521,8 +487,8 @@ private static void testStagedFiles(Application testApp) throws Exception {
521487
assertThat(new File(stage, "WEB-INF/appengine-web.xml").canRead()).isTrue();
522488
File jspJar = new File(stage, "WEB-INF/lib/_ah_compiled_jsps-0000.jar");
523489
assertThat(jspJar.exists()).isTrue();
524-
// Test that the classes in the generated jar are for Java8.
525-
assertThat(getJavaJarVersion(jspJar)).isEqualTo(8);
490+
// Test that the classes in the generated jar are for Java17.
491+
assertThat(getJavaJarVersion(jspJar)).isEqualTo(17);
526492
checkIfEntryIsInJarFile(jspJar, "org/apache/jsp/nested/testing_jsp.class");
527493
assertThat(new File(stage, "nested/dukebanner.html").canRead()).isTrue();
528494
assertThat(new File(stage, "WEB-INF/lib").isDirectory()).isTrue();
@@ -627,7 +593,7 @@ private static void doTestAppEngineApiJarIncluded(File tmpDir, String testName,
627593
}
628594

629595
@Test
630-
public void testStagingJava8() throws Exception {
596+
public void testStagingJava17Simple() throws Exception {
631597
Application testApp = Application.readApplication(TEST_FILES);
632598
testApp.setDetailsWriter(
633599
new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out, UTF_8))));
@@ -642,7 +608,8 @@ public void testStagingJava8() throws Exception {
642608
assertThat(new File(stage, "WEB-INF/web.xml").canRead()).isTrue();
643609
assertThat(new File(stage, "WEB-INF/appengine-web.xml").canRead()).isTrue();
644610
assertThat(new File(stage, "WEB-INF/appengine-generated/app.yaml").canRead()).isTrue();
645-
assertFileContains(new File(stage, "WEB-INF/appengine-generated/app.yaml"), "runtime: java8\n");
611+
assertFileContains(
612+
new File(stage, "WEB-INF/appengine-generated/app.yaml"), "runtime: java17\n");
646613
}
647614

648615
@Test
@@ -693,17 +660,18 @@ public void testJspCompilerJava8() throws Exception {
693660
}
694661

695662
@Test
696-
public void testStagingJava8RuntimeJava8JarFile() throws Exception {
663+
public void testStagingJava17RuntimeJava17JarFile() throws Exception {
697664
Application testApp = Application.readApplication(JAVA8_JAR_TEST_FILES);
698665
ApplicationProcessingOptions opts = new ApplicationProcessingOptions();
699666
opts.setAllowAnyRuntime(true);
700-
opts.setRuntime("java8");
667+
opts.setRuntime("java17");
701668
File stage = testApp.createStagingDirectory(opts);
702669
assertThat(new File(stage, "WEB-INF").isDirectory()).isTrue();
703670
assertThat(new File(stage, "WEB-INF/web.xml").canRead()).isTrue();
704671
assertThat(new File(stage, "WEB-INF/appengine-web.xml").canRead()).isTrue();
705672
assertThat(new File(stage, "WEB-INF/appengine-generated/app.yaml").canRead()).isTrue();
706-
assertFileContains(new File(stage, "WEB-INF/appengine-generated/app.yaml"), "runtime: java8\n");
673+
assertFileContains(
674+
new File(stage, "WEB-INF/appengine-generated/app.yaml"), "runtime: java17\n");
707675
}
708676

709677
@Test
@@ -1709,7 +1677,7 @@ public void testMimetypes() throws Exception {
17091677
}
17101678

17111679
@Test
1712-
public void testJava8NoWebXmlNoApiJar() throws Exception {
1680+
public void testJava17NoWebXmlNoApiJar() throws Exception {
17131681

17141682
Path temp = CopyDirVisitor.createTempDirectoryFrom(Paths.get(JAVA8_NO_WEBXML));
17151683
Application testApp = Application.readApplication(temp.toFile().getAbsolutePath());
@@ -1722,7 +1690,7 @@ public void testJava8NoWebXmlNoApiJar() throws Exception {
17221690
File stageDir = testApp.createStagingDirectory(opts, temporaryFolder.newFolder());
17231691

17241692
File appYaml = new File(stageDir, "WEB-INF/appengine-generated/app.yaml");
1725-
assertFileContains(appYaml, "runtime: java8");
1693+
assertFileContains(appYaml, "runtime: java17");
17261694
}
17271695

17281696
/** returns the Java version of the first class in the jar, or -1 if error. */

e2etests/testlocalapps/badcron/src/main/webapp/WEB-INF/appengine-web.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
1818
<application>sampleapp</application>
1919
<version>1</version>
20-
<runtime>java8</runtime>
20+
<runtime>java17</runtime>
2121

2222
<!-- files in the war which are servable as statics: none -->
2323
<static-files/>

e2etests/testlocalapps/bundle_standard/src/main/webapp/WEB-INF/appengine-web.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@
1919
<version>1</version>
2020
<threadsafe>true</threadsafe>
2121
<sessions-enabled>true</sessions-enabled>
22-
<runtime>java8</runtime>
22+
<runtime>java17</runtime>
2323
</appengine-web-app>

e2etests/testlocalapps/bundle_standard_with_container_initializer/src/main/webapp/WEB-INF/appengine-web.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@
1919
<version>1</version>
2020
<threadsafe>true</threadsafe>
2121
<sessions-enabled>true</sessions-enabled>
22-
<runtime>java8</runtime>
22+
<runtime>java17</runtime>
2323
</appengine-web-app>

e2etests/testlocalapps/bundle_standard_with_no_jsp/src/main/webapp/WEB-INF/appengine-web.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@
1919
<version>1</version>
2020
<threadsafe>true</threadsafe>
2121
<sessions-enabled>true</sessions-enabled>
22-
<runtime>java8</runtime>
22+
<runtime>java17</runtime>
2323
</appengine-web-app>

e2etests/testlocalapps/bundle_standard_with_weblistener_memcache/src/main/webapp/WEB-INF/appengine-web.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@
1919
<version>1</version>
2020
<threadsafe>true</threadsafe>
2121
<sessions-enabled>true</sessions-enabled>
22-
<runtime>java8</runtime>
22+
<runtime>java17</runtime>
2323
</appengine-web-app>

e2etests/testlocalapps/cron-bad-job-age-limit/src/main/webapp/WEB-INF/appengine-web.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
1919
<application>sampleapp</application>
2020
<version>1</version>
21-
<runtime>java8</runtime>
21+
<runtime>java17</runtime>
2222

2323
<!-- files in the war which are servable as statics: none -->
2424
<static-files/>

e2etests/testlocalapps/cron-good-retry-parameters/src/main/webapp/WEB-INF/appengine-web.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
1919
<application>sampleapp</application>
2020
<version>1</version>
21-
<runtime>java8</runtime>
21+
<runtime>java17</runtime>
2222

2323
<!-- files in the war which are servable as statics: none -->
2424
<static-files/>

0 commit comments

Comments
 (0)