File tree Expand file tree Collapse file tree 4 files changed +34
-14
lines changed
main/java/com/optimizely/ab
test/java/com/optimizely/ab Expand file tree Collapse file tree 4 files changed +34
-14
lines changed Original file line number Diff line number Diff line change 50
50
notifications :
51
51
email : false
52
52
53
- - stage : ' Lint markdown files'
54
- os : linux
55
- language : generic
56
- before_install : skip
57
- install :
58
- - npm i -g markdown-spellcheck
59
- before_script :
60
- - wget --quiet https://raw.githubusercontent.com/optimizely/mdspell-config/master/.spelling
61
- script :
62
- - mdspell -a -n -r --en-us '**/*.md'
63
- after_success : skip
64
-
65
53
- stage : ' Integration tests'
66
54
addons :
67
55
srcclr : true
Original file line number Diff line number Diff line change @@ -171,6 +171,7 @@ The following builder methods can be used to custom configure the `HttpProjectCo
171
171
| ` withPollingInterval(Long, TimeUnit) ` | 5 minutes| Fixed delay between fetches for the datafile.|
172
172
| ` withBlockingTimeout(Long, TimeUnit) ` | 10 seconds| Maximum time to wait for initial bootstrapping.|
173
173
| ` withSdkKey(String) ` | null| Optimizely project SDK key. Required unless source URL is overridden.|
174
+ | ` withDatafileAccessToken(String) ` | null| Token for authenticated datafile access.|
174
175
175
176
### Advanced configuration
176
177
The following properties can be set to override the default configuration.
@@ -182,6 +183,7 @@ The following properties can be set to override the default configuration.
182
183
| ** http.project.config.manager.blocking.duration** | 10| Maximum time to wait for initial bootstrapping|
183
184
| ** http.project.config.manager.blocking.unit** | SECONDS| Time unit corresponding to blocking duration|
184
185
| ** http.project.config.manager.sdk.key** | null| Optimizely project SDK key|
186
+ | ** http.project.config.manager.datafile.auth.token** | null| Token for authenticated datafile access|
185
187
186
188
## Update Config Notifications
187
189
A notification signal will be triggered whenever a _ new_ datafile is fetched. To subscribe to these notifications you can
Original file line number Diff line number Diff line change 1
1
/**
2
2
*
3
- * Copyright 2019, Optimizely
3
+ * Copyright 2019-2020 , Optimizely
4
4
*
5
5
* Licensed under the Apache License, Version 2.0 (the "License");
6
6
* you may not use this file except in compliance with the License.
42
42
* <li>{@link OptimizelyFactory#setBlockingTimeout}</li>
43
43
* <li>{@link OptimizelyFactory#setPollingInterval}</li>
44
44
* <li>{@link OptimizelyFactory#setSdkKey}</li>
45
+ * <li>{@link OptimizelyFactory#setDatafileAccessToken}</li>
45
46
* </ul>
46
47
*
47
48
*/
@@ -144,6 +145,19 @@ public static void setSdkKey(String sdkKey) {
144
145
PropertyUtils .set (HttpProjectConfigManager .CONFIG_SDK_KEY , sdkKey );
145
146
}
146
147
148
+ /**
149
+ * Convenience method for setting the Datafile Access Token on System properties.
150
+ * {@link HttpProjectConfigManager.Builder#withDatafileAccessToken(String)}
151
+ */
152
+ public static void setDatafileAccessToken (String datafileAccessToken ) {
153
+ if (datafileAccessToken == null ) {
154
+ logger .warn ("Datafile Access Token cannot be null. Reverting to default configuration." );
155
+ return ;
156
+ }
157
+
158
+ PropertyUtils .set (HttpProjectConfigManager .CONFIG_DATAFILE_AUTH_TOKEN , datafileAccessToken );
159
+ }
160
+
147
161
/**
148
162
* Returns a new Optimizely instance based on preset configuration.
149
163
* EventHandler - {@link AsyncEventHandler}
Original file line number Diff line number Diff line change 1
1
/**
2
2
*
3
- * Copyright 2019, Optimizely
3
+ * Copyright 2019-2020 , Optimizely
4
4
*
5
5
* Licensed under the Apache License, Version 2.0 (the "License");
6
6
* you may not use this file except in compliance with the License.
@@ -170,6 +170,22 @@ public void setInvalidSdkKey() {
170
170
assertEquals (expected , PropertyUtils .get (HttpProjectConfigManager .CONFIG_SDK_KEY ));
171
171
}
172
172
173
+ @ Test
174
+ public void setDatafileAccessToken () {
175
+ String expected = "datafile-access-token" ;
176
+ OptimizelyFactory .setDatafileAccessToken (expected );
177
+
178
+ assertEquals (expected , PropertyUtils .get (HttpProjectConfigManager .CONFIG_DATAFILE_AUTH_TOKEN ));
179
+ }
180
+
181
+ @ Test
182
+ public void setInvalidDatafileAccessToken () {
183
+ String expected = "datafile-access-token" ;
184
+ OptimizelyFactory .setDatafileAccessToken (expected );
185
+ OptimizelyFactory .setDatafileAccessToken (null );
186
+ assertEquals (expected , PropertyUtils .get (HttpProjectConfigManager .CONFIG_DATAFILE_AUTH_TOKEN ));
187
+ }
188
+
173
189
@ Test
174
190
public void newDefaultInstanceInvalid () {
175
191
optimizely = OptimizelyFactory .newDefaultInstance ();
You can’t perform that action at this time.
0 commit comments