@Test (expected = UnknownDeltaException.class) public void testLoadCheckpointFile_withUpgradeMarker() throws Exception { byte[] upgradeMarkerBytes = IndexSyncService.INDEX_UPGRADE_MARKER.getBytes(); try (DataOutputStream outputStream = new DataOutputStream(new FileOutputStream(nexusLsn))) { outputStream.write(upgradeMarkerBytes); } underTest.loadCheckpoint(); }
@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; }