@Test public void handleApiEvent_remove() { Api api = new ApiDefinitionBuilder() .name("my-api") .proxy(new ProxyDefinitionBuilder().contextPath("/team").build()) .build(); Event<ApiEvent, Api> evt = new SimpleEvent<>(ApiEvent.UNDEPLOY, api); reactor.onEvent(evt); verify(reactor).removeHandler(api); verify(reactor, never()).createHandler(api); }
@Test public void handleApiEvent_update_stopped() { Api api = new ApiDefinitionBuilder() .name("my-api") .proxy(new ProxyDefinitionBuilder().contextPath("/team").build()) .enabled(false) .build(); Event<ApiEvent, Api> evt = new SimpleEvent<>(ApiEvent.UPDATE, api); reactor.onEvent(evt); verify(reactor).removeHandler(api); verify(reactor).createHandler(api); verify(handlerFactory, never()).create(api); }
@Test public void handleApiEvent_create_started() { Api api = new ApiDefinitionBuilder() .name("my-api") .proxy( new ProxyDefinitionBuilder() .contextPath("/team") .target("http://localhost:8083") .build()) .build(); Event<ApiEvent, Api> evt = new SimpleEvent<>(ApiEvent.DEPLOY, api); reactor.onEvent(evt); verify(reactor).createHandler(api); verify(handlerFactory).create(api); verify(reactor, never()).removeHandler(api); }