1 package com
.google
.appengine
.api
.datastore
;
3 import com
.google
.common
.collect
.ImmutableMap
;
8 * Proxy around System.getenv() to enable testing and prevent errors in
9 * situations where the security manager does not allow access to environment
14 private static ImmutableMap
<String
, String
> envOverride
;
17 * Updates to {@code envOverride} made after calling this method will not be
18 * reflected in calls to {@link #getenv(String)}.
20 static synchronized void setEnvOverrideForTest(Map
<String
, String
> envOverride
) {
21 EnvProxy
.envOverride
= ImmutableMap
.copyOf(envOverride
);
24 static synchronized void clearEnvOverrideForTest() {
28 static String
getenv(String name
) {
29 synchronized (EnvProxy
.class) {
30 if (envOverride
!= null) {
31 return envOverride
.get(name
);
35 return System
.getenv(name
);
36 } catch (SecurityException e
) {