blob: 8bc8b29fb4c43c1e732c0d278ac3e2dc5a36a42f (
plain) (
blame)
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
|
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.api.integration.athens.mock;
import com.yahoo.component.AbstractComponent;
import com.yahoo.vespa.hosted.controller.api.integration.athens.NToken;
import com.yahoo.vespa.hosted.controller.api.integration.athens.ZmsClient;
import com.yahoo.vespa.hosted.controller.api.integration.athens.ZmsClientFactory;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* @author bjorncs
*/
public class ZmsClientFactoryMock extends AbstractComponent implements ZmsClientFactory {
private static final Logger log = Logger.getLogger(ZmsClientFactoryMock.class.getName());
private final AthensDbMock athens;
public ZmsClientFactoryMock() {
this(new AthensDbMock());
}
ZmsClientFactoryMock(AthensDbMock athens) {
this.athens = athens;
}
public AthensDbMock getSetup() {
return athens;
}
@Override
public ZmsClient createClientWithServicePrincipal() {
log("createClientWithServicePrincipal()");
return new ZmsClientMock(athens);
}
@Override
public ZmsClient createClientWithAuthorizedServiceToken(NToken authorizedServiceToken) {
log("createClientWithAuthorizedServiceToken(authorizedServiceToken='%s')", authorizedServiceToken);
return new ZmsClientMock(athens);
}
private static void log(String format, Object... args) {
log.log(Level.INFO, String.format(format, args));
}
}
|