@Test public void testUrlBuilder() { StreamConfiguration et = new StreamConfiguration().eventTypeName("et"); assertEquals(baseUrl()+ "/event-types/et/events", StreamResourceSupport.buildStreamUrl(client.baseURI(), et)); StreamConfiguration s1 = new StreamConfiguration().subscriptionId("s1"); assertEquals(baseUrl()+ "/subscriptions/s1/events", StreamResourceSupport.buildStreamUrl(client.baseURI(), s1)); StreamConfiguration et1 = new StreamConfiguration() .eventTypeName("et1") .streamKeepAliveLimit(100) .streamLimit(101) .streamTimeout(102, TimeUnit.SECONDS) .batchFlushTimeout(104, TimeUnit.SECONDS) .batchLimit(105) .maxUncommittedEvents(103) ; assertEquals(baseUrl() + "/event-types/et1/events?" + "stream_keep_alive_limit=100" + "&stream_limit=101" + "&batch_limit=105" + "&batch_flush_timeout=104" + "&stream_timeout=102", StreamResourceSupport.buildStreamUrl(client.baseURI(), et1)); StreamConfiguration s2 = new StreamConfiguration() .subscriptionId("s2") .streamKeepAliveLimit(100) .streamLimit(101) .streamTimeout(102, TimeUnit.SECONDS) .batchFlushTimeout(104, TimeUnit.SECONDS) .batchLimit(105) .maxUncommittedEvents(103); assertEquals(baseUrl()+ "/subscriptions/s2/events?" + "stream_keep_alive_limit=100" + "&stream_limit=101&batch_limit=105" + "&batch_flush_timeout=104" + "&max_uncommitted_events=103" + "&stream_timeout=102", StreamResourceSupport.buildStreamUrl(client.baseURI(), s2)); }
static String buildStreamUrl(URI baseUri, StreamConfiguration sc) { UriBuilder uriBuilder = UriBuilder.builder(baseUri); if (sc.isSubscriptionStream()) { uriBuilder.path(PATH_SUBS).path(sc.subscriptionId()).path(PATH_EVENTS); uriBuilder = applySubscriptionQueryParamsTo(uriBuilder, sc); } else { uriBuilder.path(PATH_EVENT_TYPES).path(sc.eventTypeName()).path(PATH_EVENTS); uriBuilder = applyParamsTo(uriBuilder, sc); } return uriBuilder.buildString(); }
StreamResourceSupport { static String buildStreamUrl(URI baseUri, StreamConfiguration sc) { UriBuilder uriBuilder = UriBuilder.builder(baseUri); if (sc.isSubscriptionStream()) { uriBuilder.path(PATH_SUBS).path(sc.subscriptionId()).path(PATH_EVENTS); uriBuilder = applySubscriptionQueryParamsTo(uriBuilder, sc); } else { uriBuilder.path(PATH_EVENT_TYPES).path(sc.eventTypeName()).path(PATH_EVENTS); uriBuilder = applyParamsTo(uriBuilder, sc); } return uriBuilder.buildString(); } }
StreamResourceSupport { static String buildStreamUrl(URI baseUri, StreamConfiguration sc) { UriBuilder uriBuilder = UriBuilder.builder(baseUri); if (sc.isSubscriptionStream()) { uriBuilder.path(PATH_SUBS).path(sc.subscriptionId()).path(PATH_EVENTS); uriBuilder = applySubscriptionQueryParamsTo(uriBuilder, sc); } else { uriBuilder.path(PATH_EVENT_TYPES).path(sc.eventTypeName()).path(PATH_EVENTS); uriBuilder = applyParamsTo(uriBuilder, sc); } return uriBuilder.buildString(); }  }
StreamResourceSupport { static String buildStreamUrl(URI baseUri, StreamConfiguration sc) { UriBuilder uriBuilder = UriBuilder.builder(baseUri); if (sc.isSubscriptionStream()) { uriBuilder.path(PATH_SUBS).path(sc.subscriptionId()).path(PATH_EVENTS); uriBuilder = applySubscriptionQueryParamsTo(uriBuilder, sc); } else { uriBuilder.path(PATH_EVENT_TYPES).path(sc.eventTypeName()).path(PATH_EVENTS); uriBuilder = applyParamsTo(uriBuilder, sc); } return uriBuilder.buildString(); }   }
StreamResourceSupport { static String buildStreamUrl(URI baseUri, StreamConfiguration sc) { UriBuilder uriBuilder = UriBuilder.builder(baseUri); if (sc.isSubscriptionStream()) { uriBuilder.path(PATH_SUBS).path(sc.subscriptionId()).path(PATH_EVENTS); uriBuilder = applySubscriptionQueryParamsTo(uriBuilder, sc); } else { uriBuilder.path(PATH_EVENT_TYPES).path(sc.eventTypeName()).path(PATH_EVENTS); uriBuilder = applyParamsTo(uriBuilder, sc); } return uriBuilder.buildString(); }   static final String X_NAKADI_STREAM_ID; static final String SUBSCRIPTION_ID; }