blob: 1336eef22be3e0655cd64d063d8aa0ec17ef9c10 (
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
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.api.integration.organization;
import com.yahoo.vespa.hosted.controller.api.identifiers.PropertyId;
import java.net.URI;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.function.Supplier;
/**
* @author olaa
*/
public class MockContactRetriever implements ContactRetriever{
private final Map<PropertyId, Supplier<Contact>> contacts = new HashMap<>();
@Override
public Contact getContact(Optional<PropertyId> propertyId) {
return contacts.getOrDefault(propertyId.get(), this::contact).get();
}
public void addContact(PropertyId propertyId, Supplier<Contact> contact) {
contacts.put(propertyId, contact);
}
public void addContact(PropertyId propertyId, Contact contact) {
contacts.put(propertyId, () -> contact);
}
public Contact contact() {
return new Contact(URI.create("contacts.tld"), URI.create("properties.tld"), URI.create("issues.tld"), Collections.emptyList(), "queue", Optional.of("component"));
}
}
|