]> git.basschouten.com Git - openhab-addons.git/blob
0cb7101ee1ff7e4bf81bc75e103f8c0f318f8d62
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
7  * This program and the accompanying materials are made available under the
8  * terms of the Eclipse Public License 2.0 which is available at
9  * http://www.eclipse.org/legal/epl-2.0
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.io.hueemulation.internal.rest.mocks;
14
15 import java.util.Collection;
16 import java.util.Map;
17 import java.util.TreeMap;
18
19 import org.eclipse.jdt.annotation.NonNull;
20 import org.eclipse.jdt.annotation.Nullable;
21 import org.openhab.core.storage.Storage;
22 import org.openhab.io.hueemulation.internal.dto.HueUserAuthWithSecrets;
23
24 /**
25  * @author David Graeff - Initial contribution
26  */
27 public class DummyUsersStorage implements Storage<HueUserAuthWithSecrets> {
28     Map<String, HueUserAuthWithSecrets> users = new TreeMap<>();
29
30     public DummyUsersStorage() {
31         users.put("testuser", new HueUserAuthWithSecrets("appname", "devicename", "testuser", "clientkey"));
32     }
33
34     @Override
35     public @Nullable HueUserAuthWithSecrets put(String key, @Nullable HueUserAuthWithSecrets value) {
36         return users.put(key, value);
37     }
38
39     @Override
40     public @Nullable HueUserAuthWithSecrets remove(String key) {
41         return users.remove(key);
42     }
43
44     @Override
45     public boolean containsKey(String key) {
46         return users.containsKey(key);
47     }
48
49     @Override
50     public @Nullable HueUserAuthWithSecrets get(String key) {
51         return users.get(key);
52     }
53
54     @Override
55     public Collection<@NonNull String> getKeys() {
56         return users.keySet();
57     }
58
59     @Override
60     public Collection<@Nullable HueUserAuthWithSecrets> getValues() {
61         return users.values();
62     }
63 }