-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathConfigServiceManagerTest.java
More file actions
58 lines (51 loc) · 2.42 KB
/
ConfigServiceManagerTest.java
File metadata and controls
58 lines (51 loc) · 2.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package com.uid2.operator;
import com.uid2.operator.service.ConfigServiceManager;
import com.uid2.operator.service.IConfigService;
import io.vertx.core.Vertx;
import io.vertx.core.json.JsonObject;
import io.vertx.junit5.VertxExtension;
import io.vertx.junit5.VertxTestContext;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import static com.uid2.operator.Const.Config.*;
import static org.junit.jupiter.api.Assertions.*;
import static com.uid2.operator.service.UIDOperatorService.*;
import static org.mockito.Mockito.*;
@ExtendWith(VertxExtension.class)
public class ConfigServiceManagerTest {
private JsonObject bootstrapConfig;
private JsonObject staticConfig;
private ConfigServiceManager configServiceManager;
@BeforeEach
void setUp(Vertx vertx) {
bootstrapConfig = new JsonObject()
.put(IDENTITY_TOKEN_EXPIRES_AFTER_SECONDS, 3600)
.put(REFRESH_TOKEN_EXPIRES_AFTER_SECONDS, 7200)
.put(REFRESH_IDENTITY_TOKEN_AFTER_SECONDS, 1800)
.put(MaxBidstreamLifetimeSecondsProp, 7200);
staticConfig = bootstrapConfig.copy()
.put(MaxBidstreamLifetimeSecondsProp, 7201);
IConfigService dynamicConfigService = mock(IConfigService.class);
when(dynamicConfigService.getConfig()).thenReturn(bootstrapConfig);
IConfigService staticConfigService = mock(IConfigService.class);
when(staticConfigService.getConfig()).thenReturn(staticConfig);
// configServiceManager = new ConfigServiceManager(vertx, dynamicConfigService, staticConfigService, true);
}
// @Test
// void testRemoteFeatureFlag(VertxTestContext testContext) {
// IConfigService delegatingConfigService = configServiceManager.getDelegatingConfigService();
//
// configServiceManager.updateConfigService(true)
// .compose(updateToDynamic -> {
// testContext.verify(() -> assertEquals(bootstrapConfig, delegatingConfigService.getConfig()));
//
// return configServiceManager.updateConfigService(false);
// })
// .onSuccess(updateToStatic -> testContext.verify(() -> {
// assertEquals(staticConfig, delegatingConfigService.getConfig());
// testContext.completeNow();
// }))
// .onFailure(testContext::failNow);
// }
}