use of de.codecentric.boot.admin.server.domain.values.InstanceId in project spring-boot-admin by codecentric.
the class InstanceRegistrationUpdatedEventMixinTest method verifySerializeWithoutRegistration.
@Test
public void verifySerializeWithoutRegistration() throws IOException {
InstanceId id = InstanceId.of("test123");
Instant timestamp = Instant.ofEpochSecond(1587751031).truncatedTo(ChronoUnit.SECONDS);
InstanceRegistrationUpdatedEvent event = new InstanceRegistrationUpdatedEvent(id, 12345678L, timestamp, null);
JsonContent<InstanceRegistrationUpdatedEvent> jsonContent = jsonTester.write(event);
assertThat(jsonContent).extractingJsonPathStringValue("$.instance").isEqualTo("test123");
assertThat(jsonContent).extractingJsonPathNumberValue("$.version").isEqualTo(12345678);
assertThat(jsonContent).extractingJsonPathNumberValue("$.timestamp").isEqualTo(1587751031.000000000);
assertThat(jsonContent).extractingJsonPathStringValue("$.type").isEqualTo("REGISTRATION_UPDATED");
assertThat(jsonContent).extractingJsonPathMapValue("$.registration").isNull();
}
use of de.codecentric.boot.admin.server.domain.values.InstanceId in project spring-boot-admin by codecentric.
the class JdkPerInstanceCookieStoreTest method different_handler_should_be_used_for_different_instance_id.
@Test
void different_handler_should_be_used_for_different_instance_id() throws IOException {
InstanceId INSTANCE_ID2 = InstanceId.of("j");
CookieHandler cookieHandler2 = mock(CookieHandler.class);
when(store.createCookieHandler(INSTANCE_ID2)).thenReturn(cookieHandler2);
MultiValueMap<String, String> storeMap = new LinkedMultiValueMap<>();
final URI uri = URI.create("http://localhost/test");
store.get(INSTANCE_ID, uri, storeMap);
store.get(INSTANCE_ID2, uri, storeMap);
verify(cookieHandler).get(uri, storeMap);
verify(cookieHandler2).get(uri, storeMap);
}
Aggregations