@Test public void testLoadCheckpointFile_withoutUpgradeMarker() throws Exception { try (DataOutputStream outputStream = new DataOutputStream(new FileOutputStream(nexusLsn))) { new OLogSequenceNumber(MARKER_SEGMENT, MARKER_POSITION).toStream(outputStream); } OLogSequenceNumber oLogSequenceNumber = underTest.loadCheckpoint(); assertThat(oLogSequenceNumber.getPosition(), is(MARKER_POSITION)); assertThat(oLogSequenceNumber.getSegment(), is(MARKER_SEGMENT)); }
@VisibleForTesting OLogSequenceNumber loadCheckpoint() throws IOException { try (InputStream in = new FileInputStream(checkpointFile)) { byte[] nexusLsnBytes = ByteStreams.toByteArray(in); if (Arrays.equals(nexusLsnBytes, INDEX_UPGRADE_MARKER.getBytes(StandardCharsets.UTF_8))) { throw new UnknownDeltaException("Index upgrade indicator found in Elasticsearch marker file"); } return new OLogSequenceNumber(ByteStreams.newDataInput(nexusLsnBytes)); } }
IndexSyncService extends LifecycleSupport { @VisibleForTesting OLogSequenceNumber loadCheckpoint() throws IOException { try (InputStream in = new FileInputStream(checkpointFile)) { byte[] nexusLsnBytes = ByteStreams.toByteArray(in); if (Arrays.equals(nexusLsnBytes, INDEX_UPGRADE_MARKER.getBytes(StandardCharsets.UTF_8))) { throw new UnknownDeltaException("Index upgrade indicator found in Elasticsearch marker file"); } return new OLogSequenceNumber(ByteStreams.newDataInput(nexusLsnBytes)); } } }
IndexSyncService extends LifecycleSupport { @VisibleForTesting OLogSequenceNumber loadCheckpoint() throws IOException { try (InputStream in = new FileInputStream(checkpointFile)) { byte[] nexusLsnBytes = ByteStreams.toByteArray(in); if (Arrays.equals(nexusLsnBytes, INDEX_UPGRADE_MARKER.getBytes(StandardCharsets.UTF_8))) { throw new UnknownDeltaException("Index upgrade indicator found in Elasticsearch marker file"); } return new OLogSequenceNumber(ByteStreams.newDataInput(nexusLsnBytes)); } } @Inject  IndexSyncService(@Named(COMPONENT) final Provider<DatabaseInstance> componentDatabase,
                          final ComponentEntityAdapter componentEntityAdapter,
                          final AssetEntityAdapter assetEntityAdapter,
                          final ApplicationDirectories directories,
                          final NodeAccess nodeAccess,
                          final IndexRequestProcessor indexRequestProcessor,
                          final IndexRebuildManager indexRebuildManager); }
IndexSyncService extends LifecycleSupport { @VisibleForTesting OLogSequenceNumber loadCheckpoint() throws IOException { try (InputStream in = new FileInputStream(checkpointFile)) { byte[] nexusLsnBytes = ByteStreams.toByteArray(in); if (Arrays.equals(nexusLsnBytes, INDEX_UPGRADE_MARKER.getBytes(StandardCharsets.UTF_8))) { throw new UnknownDeltaException("Index upgrade indicator found in Elasticsearch marker file"); } return new OLogSequenceNumber(ByteStreams.newDataInput(nexusLsnBytes)); } } @Inject  IndexSyncService(@Named(COMPONENT) final Provider<DatabaseInstance> componentDatabase,
                          final ComponentEntityAdapter componentEntityAdapter,
                          final AssetEntityAdapter assetEntityAdapter,
                          final ApplicationDirectories directories,
                          final NodeAccess nodeAccess,
                          final IndexRequestProcessor indexRequestProcessor,
                          final IndexRebuildManager indexRebuildManager);  }
IndexSyncService extends LifecycleSupport { @VisibleForTesting OLogSequenceNumber loadCheckpoint() throws IOException { try (InputStream in = new FileInputStream(checkpointFile)) { byte[] nexusLsnBytes = ByteStreams.toByteArray(in); if (Arrays.equals(nexusLsnBytes, INDEX_UPGRADE_MARKER.getBytes(StandardCharsets.UTF_8))) { throw new UnknownDeltaException("Index upgrade indicator found in Elasticsearch marker file"); } return new OLogSequenceNumber(ByteStreams.newDataInput(nexusLsnBytes)); } } @Inject  IndexSyncService(@Named(COMPONENT) final Provider<DatabaseInstance> componentDatabase,
                          final ComponentEntityAdapter componentEntityAdapter,
                          final AssetEntityAdapter assetEntityAdapter,
                          final ApplicationDirectories directories,
                          final NodeAccess nodeAccess,
                          final IndexRequestProcessor indexRequestProcessor,
                          final IndexRebuildManager indexRebuildManager);  static final String INDEX_UPGRADE_MARKER; }