|
|
@ -71,6 +71,7 @@ public class PolarisAutoServiceRegistrationTest {
|
|
|
|
@BeforeEach
|
|
|
|
@BeforeEach
|
|
|
|
void setUp() {
|
|
|
|
void setUp() {
|
|
|
|
doNothing().when(serviceRegistry).register(nullable(PolarisRegistration.class));
|
|
|
|
doNothing().when(serviceRegistry).register(nullable(PolarisRegistration.class));
|
|
|
|
|
|
|
|
doNothing().when(serviceRegistry).deregister(nullable(PolarisRegistration.class));
|
|
|
|
|
|
|
|
|
|
|
|
polarisAutoServiceRegistration =
|
|
|
|
polarisAutoServiceRegistration =
|
|
|
|
new PolarisAutoServiceRegistration(serviceRegistry, autoServiceRegistrationProperties, registration,
|
|
|
|
new PolarisAutoServiceRegistration(serviceRegistry, autoServiceRegistrationProperties, registration,
|
|
|
@ -111,6 +112,32 @@ public class PolarisAutoServiceRegistrationTest {
|
|
|
|
}).doesNotThrowAnyException();
|
|
|
|
}).doesNotThrowAnyException();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
|
|
|
public void testDeregister() {
|
|
|
|
|
|
|
|
doReturn(false).when(registration).isRegisterEnabled();
|
|
|
|
|
|
|
|
assertThatCode(() -> {
|
|
|
|
|
|
|
|
polarisAutoServiceRegistration.registerManagement();
|
|
|
|
|
|
|
|
}).doesNotThrowAnyException();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
doReturn(true).when(registration).isRegisterEnabled();
|
|
|
|
|
|
|
|
assertThatCode(() -> {
|
|
|
|
|
|
|
|
polarisAutoServiceRegistration.deregister();
|
|
|
|
|
|
|
|
}).doesNotThrowAnyException();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
|
|
|
public void testDeregisterManagement() {
|
|
|
|
|
|
|
|
doReturn(false).when(registration).isRegisterEnabled();
|
|
|
|
|
|
|
|
assertThatCode(() -> {
|
|
|
|
|
|
|
|
polarisAutoServiceRegistration.registerManagement();
|
|
|
|
|
|
|
|
}).doesNotThrowAnyException();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
doReturn(true).when(registration).isRegisterEnabled();
|
|
|
|
|
|
|
|
assertThatCode(() -> {
|
|
|
|
|
|
|
|
polarisAutoServiceRegistration.deregisterManagement();
|
|
|
|
|
|
|
|
}).doesNotThrowAnyException();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void testGetAppName() {
|
|
|
|
public void testGetAppName() {
|
|
|
|
doReturn("application").when(environment).getProperty(anyString(), anyString());
|
|
|
|
doReturn("application").when(environment).getProperty(anyString(), anyString());
|
|
|
|