43 lines
1.3 KiB
Java
43 lines
1.3 KiB
Java
package com.cygnus.client;
|
|
|
|
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
|
|
import static org.junit.jupiter.api.Assertions.assertThrows;
|
|
|
|
import java.net.URI;
|
|
import java.time.Duration;
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
class CloudClientPropertiesTest {
|
|
|
|
@Test
|
|
void configurationRequiresMachineCredentials() {
|
|
CloudClientProperties properties = properties("", "", "");
|
|
|
|
assertThrows(IllegalStateException.class, properties::validate);
|
|
}
|
|
|
|
@Test
|
|
void configurationAcceptsCompleteMachineIdentity() {
|
|
CloudClientProperties properties =
|
|
properties("customer-a", "site-01", "signed-assertion");
|
|
|
|
assertDoesNotThrow(properties::validate);
|
|
}
|
|
|
|
private CloudClientProperties properties(
|
|
String clientId,
|
|
String installationId,
|
|
String assertion) {
|
|
return new CloudClientProperties(
|
|
URI.create("https://cloud.example.test"),
|
|
URI.create("https://identity.example.test/oauth2/token"),
|
|
clientId,
|
|
installationId,
|
|
assertion,
|
|
"login-key-01",
|
|
"file:./login-public.pem",
|
|
Duration.ofSeconds(10),
|
|
Duration.ofSeconds(30));
|
|
}
|
|
}
|