Skip to content

Commit 6fc608b

Browse files
ludochgae-java-bot
authored andcommitted
Internal change
PiperOrigin-RevId: 432380584 Change-Id: I025baed90df4187a8458146f025cf12dfd9a6708
1 parent 936d419 commit 6fc608b

8 files changed

Lines changed: 186 additions & 163 deletions

File tree

pom.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,6 @@
180180
<systemPropertyVariables>
181181
<appengine.runtime.dir>../deployment/target/runtime-deployment-${project.version}</appengine.runtime.dir>
182182
<use.jetty94>true</use.jetty94>
183-
<use.mavenjars>true</use.mavenjars>
184183
<com.google.apphosting.runtime.jetty94.LEGACY_MODE>true</com.google.apphosting.runtime.jetty94.LEGACY_MODE>
185184
</systemPropertyVariables>
186185
<!-- Most of these tests were developed with Google's build system, which runs each test
@@ -208,7 +207,6 @@
208207
<systemPropertyVariables>
209208
<appengine.runtime.dir>../deployment/target/runtime-deployment-${project.version}</appengine.runtime.dir>
210209
<use.jetty94>true</use.jetty94>
211-
<use.mavenjars>true</use.mavenjars>
212210
<com.google.apphosting.runtime.jetty94.LEGACY_MODE>true</com.google.apphosting.runtime.jetty94.LEGACY_MODE>
213211
</systemPropertyVariables>
214212
<argLine>

runtime/deployment/src/assembly/component.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
<dependencySets>
2121
<dependencySet>
2222
<useProjectArtifact>true</useProjectArtifact>
23-
<outputDirectory>jars</outputDirectory>
2423
<!-- outputFileMapping produces for example "runtime-impl.jar" -->
2524
<outputFileNameMapping>${artifact.artifactId}.${artifact.extension}</outputFileNameMapping>
2625
<includes>

runtime/impl/src/test/java/com/google/apphosting/runtime/ClassPathUtilsTest.java

Lines changed: 121 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -20,88 +20,118 @@
2020

2121
import java.io.File;
2222
import org.junit.Before;
23+
import org.junit.Rule;
2324
import org.junit.Test;
25+
import org.junit.rules.TemporaryFolder;
2426
import org.junit.runner.RunWith;
2527
import org.junit.runners.JUnit4;
2628

2729
@RunWith(JUnit4.class)
2830
public final class ClassPathUtilsTest {
2931
private static final String PATH_SEPARATOR = System.getProperty("path.separator");
32+
private String runtimeLocation = null;
33+
@Rule public TemporaryFolder temporaryFolder = new TemporaryFolder();
3034

3135
@Before
32-
public void setUp() {
36+
public void setUp() throws Exception {
3337
System.clearProperty("use.jetty93");
3438
System.clearProperty("use.jetty94");
3539
System.clearProperty("use.java11");
3640
System.clearProperty("classpath.runtime-impl");
3741
System.clearProperty("use.mavenjars");
3842
System.clearProperty("classpath.appengine-api-legacy");
43+
System.clearProperty("classpath.connector-j");
44+
runtimeLocation = temporaryFolder.getRoot().getAbsolutePath();
45+
System.setProperty("classpath.runtimebase", runtimeLocation);
46+
}
3947

40-
System.setProperty("classpath.runtimebase", "/tmp");
48+
private void createJava8Environment() throws Exception {
49+
// Only Java8 runtime has the native launcher. This file is used to determine which env
50+
// must be used.
51+
temporaryFolder.newFile("java_runtime_launcher");
4152
}
4253

4354
@Test
4455
public void verifyDefaultPropertiesAreConfigured() throws Exception {
56+
createJava8Environment();
4557
ClassPathUtils cpu = new ClassPathUtils();
4658
assertThat(cpu.getConnectorJUrls()).hasLength(1);
4759
assertThat(System.getProperty("classpath.runtime-impl"))
4860
.isEqualTo(
49-
"/tmp/runtime-impl.jar"
61+
runtimeLocation
62+
+ "/runtime-impl.jar"
5063
+ PATH_SEPARATOR
51-
+ "/tmp/frozen_debugger.jar"
64+
+ runtimeLocation
65+
+ "/frozen_debugger.jar"
5266
+ PATH_SEPARATOR
53-
+ "/tmp/runtime-impl-third-party.jar"
67+
+ runtimeLocation
68+
+ "/runtime-impl-third-party.jar"
5469
+ PATH_SEPARATOR
55-
+ "/tmp/runtime-appengine-api.jar");
70+
+ runtimeLocation
71+
+ "/runtime-appengine-api.jar");
5672

57-
assertThat(System.getProperty("classpath.runtime-shared")).isEqualTo("/tmp/runtime-shared.jar");
73+
assertThat(System.getProperty("classpath.runtime-shared"))
74+
.isEqualTo(runtimeLocation + "/runtime-shared.jar");
5875
assertThat(System.getProperty("classpath.connector-j"))
59-
.isEqualTo("/tmp/jdbc-mysql-connector.jar");
60-
assertThat(System.getProperty("classpath.api-map")).isEqualTo("1.0=/tmp/appengine-api.jar");
76+
.isEqualTo(runtimeLocation + "/jdbc-mysql-connector.jar");
77+
78+
assertThat(cpu.getApiJarForVersion("1.0").getAbsolutePath())
79+
.isEqualTo(runtimeLocation + "/appengine-api.jar");
6180
}
6281

6382
@Test
6483
public void verifyJava11PropertiesAreConfigured() throws Exception {
65-
System.setProperty("use.java11", "true");
84+
// we do not call createJava8Environment() so expect java11+
6685
ClassPathUtils cpu = new ClassPathUtils();
67-
assertThat(cpu.getConnectorJUrls()).hasLength(1);
86+
assertThat(cpu.getConnectorJUrls()).hasLength(0);
6887
assertThat(System.getProperty("classpath.runtime-impl"))
6988
.isEqualTo(
70-
"/tmp/runtime-impl11.jar"
71-
+ PATH_SEPARATOR
72-
+ "/tmp/runtime-impl-third-party.jar"
89+
runtimeLocation
90+
+ "/runtime-impl.jar"
7391
+ PATH_SEPARATOR
74-
+ "/tmp/runtime-appengine-api.jar");
92+
+ runtimeLocation
93+
+ "/appengine-api-1.0-sdk.jar");
7594

76-
assertThat(System.getProperty("classpath.runtime-shared")).isEqualTo("/tmp/runtime-shared.jar");
77-
assertThat(System.getProperty("classpath.connector-j"))
78-
.isEqualTo("/tmp/jdbc-mysql-connector.jar");
79-
assertThat(System.getProperty("classpath.api-map")).isEqualTo("1.0=/tmp/appengine-api.jar");
95+
assertThat(System.getProperty("classpath.runtime-shared"))
96+
.isEqualTo(runtimeLocation + "/runtime-shared.jar");
97+
assertThat(System.getProperty("classpath.connector-j")).isNull();
98+
99+
assertThat(cpu.getApiJarForVersion("1.0").getAbsolutePath())
100+
.isEqualTo(runtimeLocation + "/appengine-api-1.0-sdk.jar");
80101
}
81102

82103
@Test
83104
public void verifyJetty93PropertiesAreConfigured() throws Exception {
105+
createJava8Environment();
84106
System.setProperty("use.jetty93", "true");
85107
ClassPathUtils cpu = new ClassPathUtils();
86108
assertThat(cpu.getConnectorJUrls()).hasLength(1);
87109
assertThat(System.getProperty("classpath.runtime-impl"))
88110
.isEqualTo(
89-
"/tmp/runtime-impl.jar"
111+
runtimeLocation
112+
+ "/runtime-impl.jar"
90113
+ PATH_SEPARATOR
91-
+ "/tmp/frozen_debugger.jar"
114+
+ runtimeLocation
115+
+ "/frozen_debugger.jar"
92116
+ PATH_SEPARATOR
93-
+ "/tmp/runtime-impl-third-party.jar"
117+
+ runtimeLocation
118+
+ "/runtime-impl-third-party.jar"
94119
+ PATH_SEPARATOR
95-
+ "/tmp/runtime-appengine-api.jar");
120+
+ runtimeLocation
121+
+ "/runtime-appengine-api.jar");
96122

97-
assertThat(System.getProperty("classpath.runtime-shared")).isEqualTo("/tmp/runtime-shared.jar");
123+
assertThat(System.getProperty("classpath.runtime-shared"))
124+
.isEqualTo(runtimeLocation + "/runtime-shared.jar");
98125
assertThat(System.getProperty("classpath.connector-j"))
99-
.isEqualTo("/tmp/jdbc-mysql-connector.jar");
100-
assertThat(System.getProperty("classpath.api-map")).isEqualTo("1.0=/tmp/appengine-api.jar");
126+
.isEqualTo(runtimeLocation + "/jdbc-mysql-connector.jar");
127+
128+
assertThat(cpu.getApiJarForVersion("1.0").getAbsolutePath())
129+
.isEqualTo(runtimeLocation + "/appengine-api.jar");
101130
}
102131

103132
@Test
104133
public void verifyJetty93WinsOverJetty94PropertiesAreConfigured() throws Exception {
134+
createJava8Environment();
105135
// Set both of them and verify that 9.3 is winning:
106136
System.setProperty("use.jetty93", "true");
107137
System.setProperty("use.jetty94", "true");
@@ -112,99 +142,128 @@ public void verifyJetty93WinsOverJetty94PropertiesAreConfigured() throws Excepti
112142
assertThat(Boolean.getBoolean("use.jetty94")).isFalse();
113143
assertThat(System.getProperty("classpath.runtime-impl"))
114144
.isEqualTo(
115-
"/tmp/runtime-impl.jar"
145+
runtimeLocation
146+
+ "/runtime-impl.jar"
116147
+ PATH_SEPARATOR
117-
+ "/tmp/frozen_debugger.jar"
148+
+ runtimeLocation
149+
+ "/frozen_debugger.jar"
118150
+ PATH_SEPARATOR
119-
+ "/tmp/runtime-impl-third-party.jar"
151+
+ runtimeLocation
152+
+ "/runtime-impl-third-party.jar"
120153
+ PATH_SEPARATOR
121-
+ "/tmp/runtime-appengine-api.jar");
154+
+ runtimeLocation
155+
+ "/runtime-appengine-api.jar");
122156

123-
assertThat(System.getProperty("classpath.runtime-shared")).isEqualTo("/tmp/runtime-shared.jar");
157+
assertThat(System.getProperty("classpath.runtime-shared"))
158+
.isEqualTo(runtimeLocation + "/runtime-shared.jar");
124159
assertThat(System.getProperty("classpath.connector-j"))
125-
.isEqualTo("/tmp/jdbc-mysql-connector.jar");
126-
assertThat(System.getProperty("classpath.api-map")).isEqualTo("1.0=/tmp/appengine-api.jar");
160+
.isEqualTo(runtimeLocation + "/jdbc-mysql-connector.jar");
161+
162+
assertThat(cpu.getApiJarForVersion("1.0").getAbsolutePath())
163+
.isEqualTo(runtimeLocation + "/appengine-api.jar");
127164
}
128165

129166
@Test
130167
public void verifyJetty94PropertiesAreConfigured() throws Exception {
131168

169+
createJava8Environment();
132170
System.setProperty("use.jetty94", "true");
133171
ClassPathUtils cpu = new ClassPathUtils();
134172
assertThat(cpu.getConnectorJUrls()).hasLength(1);
135173
assertThat(System.getProperty("classpath.runtime-impl"))
136174
.isEqualTo(
137-
"/tmp/runtime-impl.jar"
175+
runtimeLocation
176+
+ "/runtime-impl.jar"
138177
+ PATH_SEPARATOR
139-
+ "/tmp/runtime-impl-jetty94.jar"
178+
+ runtimeLocation
179+
+ "/runtime-impl-jetty94.jar"
140180
+ PATH_SEPARATOR
141-
+ "/tmp/frozen_debugger.jar"
181+
+ runtimeLocation
182+
+ "/frozen_debugger.jar"
142183
+ PATH_SEPARATOR
143-
+ "/tmp/runtime-impl-third-party-jetty94.jar"
184+
+ runtimeLocation
185+
+ "/runtime-impl-third-party-jetty94.jar"
144186
+ PATH_SEPARATOR
145-
+ "/tmp/appengine-api-1.0-sdk.jar"
187+
+ runtimeLocation
188+
+ "/appengine-api-1.0-sdk.jar"
146189
+ PATH_SEPARATOR
147-
+ "/tmp/runtime-appengine-api.jar");
190+
+ runtimeLocation
191+
+ "/runtime-appengine-api.jar");
148192

149-
assertThat(System.getProperty("classpath.runtime-shared")).isEqualTo("/tmp/runtime-shared.jar");
193+
assertThat(System.getProperty("classpath.runtime-shared"))
194+
.isEqualTo(runtimeLocation + "/runtime-shared.jar");
150195
assertThat(System.getProperty("classpath.connector-j"))
151-
.isEqualTo("/tmp/jdbc-mysql-connector.jar");
152-
assertThat(System.getProperty("classpath.api-map")).isEqualTo("1.0=/tmp/appengine-api.jar");
196+
.isEqualTo(runtimeLocation + "/jdbc-mysql-connector.jar");
197+
198+
assertThat(cpu.getApiJarForVersion("1.0").getAbsolutePath())
199+
.isEqualTo(runtimeLocation + "/appengine-api.jar");
153200
}
154201

155202
@Test
156203
public void verifyMavenJarsPropertiesAreConfigured() throws Exception {
204+
createJava8Environment();
157205
System.setProperty("use.jetty94", "true");
158206
System.setProperty("use.mavenjars", "true");
159207

160208
ClassPathUtils cpu = new ClassPathUtils(new File("/my_app_root"));
161209
assertThat(cpu.getConnectorJUrls()).hasLength(1);
162210
assertThat(System.getProperty("classpath.runtime-impl"))
163211
.isEqualTo(
164-
"/tmp/jars/runtime-impl.jar"
212+
runtimeLocation
213+
+ "/jars/runtime-impl.jar"
165214
+ PATH_SEPARATOR
166-
+ "/tmp/jars/appengine-api-1.0-sdk.jar"
215+
+ runtimeLocation
216+
+ "/jars/appengine-api-1.0-sdk.jar"
167217
+ PATH_SEPARATOR
168-
+ "/tmp/frozen_debugger.jar");
218+
+ runtimeLocation
219+
+ "/frozen_debugger.jar");
169220

170221
assertThat(System.getProperty("classpath.runtime-shared"))
171-
.isEqualTo("/tmp/jars/runtime-shared.jar");
222+
.isEqualTo(runtimeLocation + "/jars/runtime-shared.jar");
172223
assertThat(System.getProperty("classpath.connector-j"))
173-
.isEqualTo("/tmp/jdbc-mysql-connector.jar");
174-
assertThat(System.getProperty("classpath.api-map"))
175-
.isEqualTo("1.0=/tmp/jars/appengine-api-1.0-sdk.jar");
224+
.isEqualTo(runtimeLocation + "/jdbc-mysql-connector.jar");
225+
226+
assertThat(cpu.getApiJarForVersion("1.0").getAbsolutePath())
227+
.isEqualTo("/my_app_root" + runtimeLocation + "/jars/appengine-api-1.0-sdk.jar");
176228
assertThat(System.getProperty("classpath.appengine-api-legacy"))
177-
.isEqualTo("/tmp/jars/appengine-api-legacy.jar");
229+
.isEqualTo(runtimeLocation + "/jars/appengine-api-legacy.jar");
178230

179231
assertThat(cpu.getAppengineApiLegacyJar().getAbsolutePath())
180-
.isEqualTo("/my_app_root/tmp/jars/appengine-api-legacy.jar");
232+
.isEqualTo("/my_app_root" + runtimeLocation + "/jars/appengine-api-legacy.jar");
181233
assertThat(cpu.getApiJarForVersion("1.0").getAbsolutePath())
182-
.isEqualTo("/my_app_root/tmp/jars/appengine-api-1.0-sdk.jar");
183-
234+
.isEqualTo("/my_app_root" + runtimeLocation + "/jars/appengine-api-1.0-sdk.jar");
184235
}
185236

186237
@Test
187238
public void verifyJetty93WinsOverMavenPropertiesAreConfigured() throws Exception {
239+
createJava8Environment();
188240
// Set both of them and verify that 9.3 is winning:
189241
System.setProperty("use.jetty93", "true");
190242
System.setProperty("use.mavenjars", "true");
191243
ClassPathUtils cpu = new ClassPathUtils();
192244
assertThat(cpu.getConnectorJUrls()).hasLength(1);
193245
assertThat(System.getProperty("classpath.runtime-impl"))
194246
.isEqualTo(
195-
"/tmp/runtime-impl.jar"
247+
runtimeLocation
248+
+ "/runtime-impl.jar"
196249
+ PATH_SEPARATOR
197-
+ "/tmp/frozen_debugger.jar"
250+
+ runtimeLocation
251+
+ "/frozen_debugger.jar"
198252
+ PATH_SEPARATOR
199-
+ "/tmp/runtime-impl-third-party.jar"
253+
+ runtimeLocation
254+
+ "/runtime-impl-third-party.jar"
200255
+ PATH_SEPARATOR
201-
+ "/tmp/runtime-appengine-api.jar");
256+
+ runtimeLocation
257+
+ "/runtime-appengine-api.jar");
202258

203-
assertThat(System.getProperty("classpath.runtime-shared")).isEqualTo("/tmp/runtime-shared.jar");
259+
assertThat(System.getProperty("classpath.runtime-shared"))
260+
.isEqualTo(runtimeLocation + "/runtime-shared.jar");
204261
assertThat(System.getProperty("classpath.connector-j"))
205-
.isEqualTo("/tmp/jdbc-mysql-connector.jar");
206-
assertThat(System.getProperty("classpath.api-map")).isEqualTo("1.0=/tmp/appengine-api.jar");
207-
assertThat(System.getProperty("classpath.appengine-api-legacy"))
208-
.isNull();
262+
.isEqualTo(runtimeLocation + "/jdbc-mysql-connector.jar");
263+
264+
assertThat(cpu.getApiJarForVersion("1.0").getAbsolutePath())
265+
.isEqualTo(runtimeLocation + "/appengine-api.jar");
266+
267+
assertThat(System.getProperty("classpath.appengine-api-legacy")).isNull();
209268
}
210269
}

runtime/main/src/main/java/com/google/apphosting/runtime/JavaRuntimeMain.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,6 @@ public class JavaRuntimeMain {
4040
private static final Logger logger = Logger.getLogger(JavaRuntimeMain.class.getName());
4141
private static final String PROPERTIES_LOCATION = "WEB-INF/appengine_optional.properties";
4242

43-
/**
44-
* This property will be used in ClassPathUtils processing to determine the correct classpath for
45-
* th JDBC driver
46-
*/
47-
private static final String DO_NOT_USE_BUNDLED_JDBC_DRIVER = "gae.do_not_use_bundled_jdbc_driver";
48-
49-
private static final String DO_NOT_USE_BUNDLED_CONSCRYPT = "gae.do_not_use_bundled_conscrypt";
5043

5144
/** This property will be used in ClassPathUtils processing to determine the correct classpath. */
5245
private static final String USE_JETTY93 = "use.jetty93";
@@ -152,8 +145,6 @@ void processOptionalProperties(String[] args) {
152145
USE_JETTY93,
153146
USE_JETTY94,
154147
USE_MAVEN_JARS,
155-
DO_NOT_USE_BUNDLED_JDBC_DRIVER,
156-
DO_NOT_USE_BUNDLED_CONSCRYPT,
157148
DISABLE_API_CALL_LOGGING_IN_APIPROXY,
158149
ALLOW_NON_RESIDENT_SESSION_ACCESS
159150
}) {

runtime/main/src/main/java/com/google/apphosting/runtime/JavaRuntimeMainWithDefaults.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ private static List<String> getRuntimeFlags() {
160160
"--use_clone_controller_for_deadlines=true",
161161
"--use_env_vars_from_app_info=true",
162162
"--use_jetty_http_proxy=true",
163-
"--use_mavenJars=" + useMavenJars(),
164163
"--wait_for_daemon_request_threads=false",
165164
"--log_json_to_var_log=true");
166165
}

0 commit comments

Comments
 (0)