24
24
25
25
public class TestContext {
26
26
27
+ private static final String AZURE_CLIENT_ID = "AZURE_CLIENT_ID" ;
28
+ private static final String AZURE_AUTHORITY = "AZURE_AUTHORITY" ;
29
+ private static final String AZURE_CLIENT_SECRET = "AZURE_CLIENT_SECRET" ;
30
+ private static final String AZURE_PRIVATE_KEY = "AZURE_PRIVATE_KEY" ;
31
+ private static final String AZURE_CERT = "AZURE_CERT" ;
32
+ private static final String AZURE_REDIS_SCOPES = "AZURE_REDIS_SCOPES" ;
27
33
private static final String localContext = "./src/test/resources/local.context" ;
28
34
private String clientId ;
29
35
private String authority ;
@@ -39,23 +45,25 @@ private TestContext() {
39
45
try {
40
46
Properties properties = new Properties ();
41
47
properties .load (Files .newBufferedReader (Paths .get (localContext )));
42
- this .clientId = properties .getProperty ("CLIENT_ID" );
43
- this .authority = properties .getProperty ("AUTHORITY" );
44
- this .clientSecret = properties .getProperty ("CLIENT_SECRET" );
45
- this .privateKey = getPrivateKey (properties .getProperty ("PRIVATE_KEY" ));
46
- this .cert = getCert (properties .getProperty ("CERT" ));
47
- String redisScopesProp = properties .getProperty ("REDIS_SCOPES" );
48
+ this .clientId = properties .getProperty (AZURE_CLIENT_ID );
49
+ this .authority = properties .getProperty (AZURE_AUTHORITY );
50
+ this .clientSecret = properties .getProperty (AZURE_CLIENT_SECRET );
51
+ this .privateKey = getPrivateKey (properties .getProperty (AZURE_PRIVATE_KEY ));
52
+ this .cert = getCert (properties .getProperty (AZURE_CERT ));
53
+ String redisScopesProp = properties .getProperty (AZURE_REDIS_SCOPES );
48
54
if (redisScopesProp != null && !redisScopesProp .isEmpty ()) {
49
55
this .redisScopes = new HashSet <>(Arrays .asList (redisScopesProp .split (";" )));
50
56
}
51
57
} catch (IOException e ) {
52
58
throw new RuntimeException ("Failed to load local.context" , e );
53
59
}
54
60
} else {
55
- this .clientId = System .getenv ("CLIENT_ID" );
56
- this .authority = System .getenv ("AUTHORITY" );
57
- this .clientSecret = System .getenv ("CLIENT_SECRET" );
58
- String redisScopesEnv = System .getenv ("REDIS_SCOPES" );
61
+ this .clientId = System .getenv (AZURE_CLIENT_ID );
62
+ this .authority = System .getenv (AZURE_AUTHORITY );
63
+ this .clientSecret = System .getenv (AZURE_CLIENT_SECRET );
64
+ this .privateKey = getPrivateKey (System .getenv (AZURE_PRIVATE_KEY ));
65
+ this .cert = getCert (System .getenv (AZURE_CERT ));
66
+ String redisScopesEnv = System .getenv (AZURE_REDIS_SCOPES );
59
67
if (redisScopesEnv != null && !redisScopesEnv .isEmpty ()) {
60
68
this .redisScopes = new HashSet <>(Arrays .asList (redisScopesEnv .split (";" )));
61
69
}
0 commit comments