use of org.apache.servicecomb.registry.lightweight.store.InstanceStore in project incubator-servicecomb-java-chassis by apache.
the class StoreServiceTest method should_process_as_heartbeat_when_nothing_changed.
@Test
void should_process_as_heartbeat_when_nothing_changed() {
should_register_microservice_and_instance_when_both_not_exist();
InstanceStore instanceStore = store.findInstanceStore(self.getInstanceId());
assertThat(instanceStore.getLastHeartBeat()).isEqualTo(0);
ticker.setValues(1L);
should_register_microservice_and_instance_when_both_not_exist();
assertThat(instanceStore.getLastHeartBeat()).isEqualTo(1);
}
use of org.apache.servicecomb.registry.lightweight.store.InstanceStore in project incubator-servicecomb-java-chassis by apache.
the class StoreServiceTest method should_register_microservice_and_instance_when_both_not_exist.
@Test
void should_register_microservice_and_instance_when_both_not_exist() {
RegisterRequest request = self.buildRegisterRequest();
InstanceStore instanceStore = service.register(request);
assertThat(store.findMicroserviceStore(self.getServiceId()).getMicroservice()).isSameAs(self.getMicroservice());
assertThat(instanceStore.getInstance()).isSameAs(self.getInstance());
assertThat(self.getInstance().getStatus()).isEqualTo(MicroserviceInstanceStatus.UP);
}
use of org.apache.servicecomb.registry.lightweight.store.InstanceStore in project incubator-servicecomb-java-chassis by apache.
the class StoreServiceTest method should_allow_update_instance_status.
@Test
void should_allow_update_instance_status() {
should_register_microservice_and_instance_when_both_not_exist();
RegisterRequest request = self.buildRegisterRequest().setStatus(MicroserviceInstanceStatus.TESTING);
ticker.setValues(1L);
InstanceStore instanceStore = service.register(request);
assertThat(self.getInstance().getStatus()).isEqualTo(MicroserviceInstanceStatus.TESTING);
assertThat(instanceStore.getLastHeartBeat()).isEqualTo(1);
}
Aggregations