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 5050 notifications :
5151 email : false
5252
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-
6553 - stage : ' Integration tests'
6654 addons :
6755 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
171171| ` withPollingInterval(Long, TimeUnit) ` | 5 minutes| Fixed delay between fetches for the datafile.|
172172| ` withBlockingTimeout(Long, TimeUnit) ` | 10 seconds| Maximum time to wait for initial bootstrapping.|
173173| ` withSdkKey(String) ` | null| Optimizely project SDK key. Required unless source URL is overridden.|
174+ | ` withDatafileAccessToken(String) ` | null| Token for authenticated datafile access.|
174175
175176### Advanced configuration
176177The 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.
182183| ** http.project.config.manager.blocking.duration** | 10| Maximum time to wait for initial bootstrapping|
183184| ** http.project.config.manager.blocking.unit** | SECONDS| Time unit corresponding to blocking duration|
184185| ** 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|
185187
186188## Update Config Notifications
187189A 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 11/**
22 *
3- * Copyright 2019, Optimizely
3+ * Copyright 2019-2020 , Optimizely
44 *
55 * Licensed under the Apache License, Version 2.0 (the "License");
66 * you may not use this file except in compliance with the License.
4242 * <li>{@link OptimizelyFactory#setBlockingTimeout}</li>
4343 * <li>{@link OptimizelyFactory#setPollingInterval}</li>
4444 * <li>{@link OptimizelyFactory#setSdkKey}</li>
45+ * <li>{@link OptimizelyFactory#setDatafileAccessToken}</li>
4546 * </ul>
4647 *
4748 */
@@ -144,6 +145,19 @@ public static void setSdkKey(String sdkKey) {
144145 PropertyUtils .set (HttpProjectConfigManager .CONFIG_SDK_KEY , sdkKey );
145146 }
146147
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+
147161 /**
148162 * Returns a new Optimizely instance based on preset configuration.
149163 * EventHandler - {@link AsyncEventHandler}
Original file line number Diff line number Diff line change 11/**
22 *
3- * Copyright 2019, Optimizely
3+ * Copyright 2019-2020 , Optimizely
44 *
55 * Licensed under the Apache License, Version 2.0 (the "License");
66 * you may not use this file except in compliance with the License.
@@ -170,6 +170,22 @@ public void setInvalidSdkKey() {
170170 assertEquals (expected , PropertyUtils .get (HttpProjectConfigManager .CONFIG_SDK_KEY ));
171171 }
172172
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+
173189 @ Test
174190 public void newDefaultInstanceInvalid () {
175191 optimizely = OptimizelyFactory .newDefaultInstance ();
You can’t perform that action at this time.
0 commit comments