ESHttpEventStore extends AbstractReadableEventStore implements IESHttpEventStore { static Long currentVersion(final HttpResponse response) { final Header header = response.getFirstHeader("CurrentVersion"); if (header == null) { return null; } final String versionStr = header.getValue(); if (versionStr == null) { return null; } return Long.valueOf(versionStr); } @Deprecated  ESHttpEventStore(@NotNull final ThreadFactory threadFactory, @NotNull final URL url, @NotNull final ESEnvelopeType envelopeType,
            @NotNull final SerializerRegistry serRegistry, @NotNull final DeserializerRegistry desRegistry); @Deprecated  ESHttpEventStore(@NotNull final ThreadFactory threadFactory, @NotNull final URL url, @NotNull final ESEnvelopeType envelopeType,
            @NotNull final SerializerRegistry serRegistry, @NotNull final DeserializerRegistry desRegistry,
            final CredentialsProvider credentialsProvider); private  ESHttpEventStore(@NotNull final ThreadFactory threadFactory, @NotNull final URL url, @NotNull final ESEnvelopeType envelopeType,
            @NotNull final SerializerRegistry serRegistry, @NotNull final DeserializerRegistry desRegistry,
            final CredentialsProvider credentialsProvider, final TenantId tenantId); @Override ESHttpEventStore open(); @Override void close(); @Override final boolean isSupportsCreateStream(); @Override final void createStream(final StreamId streamId); @Override final long appendToStream(final StreamId streamId, final CommonEvent... events); @Override final long appendToStream(final StreamId streamId, final long expectedVersion, final CommonEvent... events); @Override final long appendToStream(final StreamId streamId, final List<CommonEvent> events); @Override long appendToStream(final StreamId streamId, final long expectedVersion, final List<CommonEvent> commonEvents); @Override void deleteStream(final StreamId streamId, final long expectedVersion, final boolean hardDelete); @Override void deleteStream(final StreamId streamId, final boolean hardDelete); @Override StreamEventsSlice readEventsForward(final StreamId streamId, final long start, final int count); @Override StreamEventsSlice readEventsBackward(final StreamId streamId, final long start, final int count); @Override CommonEvent readEvent(final StreamId streamId, final long eventNumber); @Override final boolean streamExists(final StreamId streamId); @Override final StreamState streamState(final StreamId streamId); @Override boolean projectionExists(final StreamId projectionId); @Override final void enableProjection(final StreamId projectionId); @Override final void disableProjection(final StreamId projectionId); @Override final void createProjection(final StreamId projectionId, final boolean enable, final TypeName... eventType); @Override final void createProjection(final StreamId projectionId, final boolean enable, final List<TypeName> eventTypes); @Override final void deleteProjection(final StreamId projectionId);  }
@Test public void testCurrentVersion() { final BasicStatusLine statusline = new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 400, "Wrong expected EventNumber"); final HttpResponse validResponse = new BasicHttpResponse(statusline); validResponse.addHeader("CurrentVersion", "4"); assertThat(ESHttpEventStore.currentVersion(validResponse)).isEqualTo(Long.valueOf(4)); assertThat(ESHttpEventStore.currentVersion(new BasicHttpResponse(statusline))).isNull(); final HttpResponse invalidResponse = new BasicHttpResponse(statusline); invalidResponse.addHeader("CurrentVersion", null); assertThat(ESHttpEventStore.currentVersion(invalidResponse)).isNull(); }