Search in sources :

Example 6 with GreetingServiceImpl

use of io.scalecube.services.sut.GreetingServiceImpl in project scalecube by scalecube.

the class ServiceRemoteTest method test_services_contribute_to_cluster_metadata.

@Test
public void test_services_contribute_to_cluster_metadata() {
    Map<String, String> tags = new HashMap<>();
    tags.put("HOSTNAME", "host1");
    Microservices ms = Microservices.builder().discovery(serviceEndpoint -> new ScalecubeServiceDiscovery().transport(cfg -> cfg.transportFactory(new WebsocketTransportFactory())).options(opts -> opts.metadata(serviceEndpoint))).transport(RSocketServiceTransport::new).tags(tags).services(new GreetingServiceImpl()).startAwait();
    assertTrue(ms.serviceEndpoint().tags().containsKey("HOSTNAME"));
}
Also used : Assertions.assertThrows(org.junit.jupiter.api.Assertions.assertThrows) Sinks(reactor.core.publisher.Sinks) StepVerifier(reactor.test.StepVerifier) CoarseGrainedServiceImpl(io.scalecube.services.sut.CoarseGrainedServiceImpl) TimeoutException(java.util.concurrent.TimeoutException) Hooks(reactor.core.publisher.Hooks) GreetingResponse(io.scalecube.services.sut.GreetingResponse) HashMap(java.util.HashMap) Disabled(org.junit.jupiter.api.Disabled) AfterAll(org.junit.jupiter.api.AfterAll) BeforeAll(org.junit.jupiter.api.BeforeAll) CoarseGrainedService(io.scalecube.services.sut.CoarseGrainedService) Duration(java.time.Duration) Map(java.util.Map) WebsocketTransportFactory(io.scalecube.transport.netty.websocket.WebsocketTransportFactory) GreetingRequest(io.scalecube.services.sut.GreetingRequest) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) Address(io.scalecube.net.Address) ScalecubeServiceDiscovery(io.scalecube.services.discovery.ScalecubeServiceDiscovery) EmptyGreetingResponse(io.scalecube.services.sut.EmptyGreetingResponse) InternalServiceException(io.scalecube.services.exceptions.InternalServiceException) Publisher(org.reactivestreams.Publisher) Mono(reactor.core.publisher.Mono) ServiceDiscovery(io.scalecube.services.discovery.api.ServiceDiscovery) RSocketServiceTransport(io.scalecube.services.transport.rsocket.RSocketServiceTransport) Test(org.junit.jupiter.api.Test) Flux(reactor.core.publisher.Flux) FAIL_FAST(reactor.core.publisher.Sinks.EmitFailureHandler.FAIL_FAST) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) GreetingService(io.scalecube.services.sut.GreetingService) EmptyGreetingRequest(io.scalecube.services.sut.EmptyGreetingRequest) GreetingServiceImpl(io.scalecube.services.sut.GreetingServiceImpl) ServiceMessage(io.scalecube.services.api.ServiceMessage) ScalecubeServiceDiscovery(io.scalecube.services.discovery.ScalecubeServiceDiscovery) HashMap(java.util.HashMap) WebsocketTransportFactory(io.scalecube.transport.netty.websocket.WebsocketTransportFactory) GreetingServiceImpl(io.scalecube.services.sut.GreetingServiceImpl) Test(org.junit.jupiter.api.Test)

Aggregations

Address (io.scalecube.net.Address)6 ScalecubeServiceDiscovery (io.scalecube.services.discovery.ScalecubeServiceDiscovery)6 GreetingServiceImpl (io.scalecube.services.sut.GreetingServiceImpl)6 RSocketServiceTransport (io.scalecube.services.transport.rsocket.RSocketServiceTransport)6 WebsocketTransportFactory (io.scalecube.transport.netty.websocket.WebsocketTransportFactory)6 Duration (java.time.Duration)5 Assertions.assertEquals (org.junit.jupiter.api.Assertions.assertEquals)5 Mono (reactor.core.publisher.Mono)5 StepVerifier (reactor.test.StepVerifier)4 JacksonMetadataCodec (io.scalecube.cluster.codec.jackson.JacksonMetadataCodec)3 JdkMetadataCodec (io.scalecube.cluster.metadata.JdkMetadataCodec)3 MetadataCodec (io.scalecube.cluster.metadata.MetadataCodec)3 ServiceMessage (io.scalecube.services.api.ServiceMessage)3 ServiceDiscoveryEvent (io.scalecube.services.discovery.api.ServiceDiscoveryEvent)3 ENDPOINT_ADDED (io.scalecube.services.discovery.api.ServiceDiscoveryEvent.Type.ENDPOINT_ADDED)3 ENDPOINT_LEAVING (io.scalecube.services.discovery.api.ServiceDiscoveryEvent.Type.ENDPOINT_LEAVING)3 ENDPOINT_REMOVED (io.scalecube.services.discovery.api.ServiceDiscoveryEvent.Type.ENDPOINT_REMOVED)3 ServiceDiscoveryFactory (io.scalecube.services.discovery.api.ServiceDiscoveryFactory)3 AnnotationService (io.scalecube.services.sut.AnnotationService)3 AnnotationServiceImpl (io.scalecube.services.sut.AnnotationServiceImpl)3