Search in sources :

Example 1 with TarFiles

use of org.apache.jackrabbit.oak.segment.file.tar.TarFiles in project jackrabbit-oak by apache.

the class UpgradeIT method checkSegmentVersion.

private void checkSegmentVersion(@Nonnull SegmentVersion version) throws IOException {
    try (TarFiles tarFiles = TarFiles.builder().withDirectory(fileStoreHome.getRoot()).withTarRecovery((_1, _2, _3) -> fail("Unexpected recovery")).withIOMonitor(new IOMonitorAdapter()).withReadOnly().build()) {
        for (SegmentData segmentData : getSegments(tarFiles)) {
            SegmentVersion actualVersion = SegmentVersion.fromByte(segmentData.getVersion());
            assertEquals(format("Segment version mismatch. Expected %s, found %s", version, actualVersion), version, actualVersion);
        }
    }
}
Also used : IOMonitorAdapter(org.apache.jackrabbit.oak.segment.spi.monitor.IOMonitorAdapter) Iterables.transform(com.google.common.collect.Iterables.transform) SegmentVersion(org.apache.jackrabbit.oak.segment.SegmentVersion) OS_NAME(com.google.common.base.StandardSystemProperty.OS_NAME) MINUTES(java.util.concurrent.TimeUnit.MINUTES) FileStoreBuilder.fileStoreBuilder(org.apache.jackrabbit.oak.segment.file.FileStoreBuilder.fileStoreBuilder) TarFiles(org.apache.jackrabbit.oak.segment.file.tar.TarFiles) SegmentData(org.apache.jackrabbit.oak.segment.data.SegmentData) Compact(org.apache.jackrabbit.oak.segment.tool.Compact) Assert.fail(org.junit.Assert.fail) Nonnull(javax.annotation.Nonnull) Before(org.junit.Before) InvalidFileStoreVersionException(org.apache.jackrabbit.oak.segment.file.InvalidFileStoreVersionException) Assert.assertTrue(org.junit.Assert.assertTrue) IOException(java.io.IOException) Test(org.junit.Test) String.format(java.lang.String.format) File(java.io.File) Rule(org.junit.Rule) LocalManifestFile(org.apache.jackrabbit.oak.segment.file.LocalManifestFile) ManifestChecker.newManifestChecker(org.apache.jackrabbit.oak.segment.file.ManifestChecker.newManifestChecker) V_12(org.apache.jackrabbit.oak.segment.SegmentVersion.V_12) V_13(org.apache.jackrabbit.oak.segment.SegmentVersion.V_13) Assert.assertEquals(org.junit.Assert.assertEquals) TemporaryFolder(org.junit.rules.TemporaryFolder) SegmentData.newSegmentData(org.apache.jackrabbit.oak.segment.data.SegmentData.newSegmentData) TarFiles(org.apache.jackrabbit.oak.segment.file.tar.TarFiles) SegmentData(org.apache.jackrabbit.oak.segment.data.SegmentData) SegmentData.newSegmentData(org.apache.jackrabbit.oak.segment.data.SegmentData.newSegmentData) IOMonitorAdapter(org.apache.jackrabbit.oak.segment.spi.monitor.IOMonitorAdapter) SegmentVersion(org.apache.jackrabbit.oak.segment.SegmentVersion)

Aggregations

OS_NAME (com.google.common.base.StandardSystemProperty.OS_NAME)1 Iterables.transform (com.google.common.collect.Iterables.transform)1 File (java.io.File)1 IOException (java.io.IOException)1 String.format (java.lang.String.format)1 MINUTES (java.util.concurrent.TimeUnit.MINUTES)1 Nonnull (javax.annotation.Nonnull)1 SegmentVersion (org.apache.jackrabbit.oak.segment.SegmentVersion)1 V_12 (org.apache.jackrabbit.oak.segment.SegmentVersion.V_12)1 V_13 (org.apache.jackrabbit.oak.segment.SegmentVersion.V_13)1 SegmentData (org.apache.jackrabbit.oak.segment.data.SegmentData)1 SegmentData.newSegmentData (org.apache.jackrabbit.oak.segment.data.SegmentData.newSegmentData)1 FileStoreBuilder.fileStoreBuilder (org.apache.jackrabbit.oak.segment.file.FileStoreBuilder.fileStoreBuilder)1 InvalidFileStoreVersionException (org.apache.jackrabbit.oak.segment.file.InvalidFileStoreVersionException)1 LocalManifestFile (org.apache.jackrabbit.oak.segment.file.LocalManifestFile)1 ManifestChecker.newManifestChecker (org.apache.jackrabbit.oak.segment.file.ManifestChecker.newManifestChecker)1 TarFiles (org.apache.jackrabbit.oak.segment.file.tar.TarFiles)1 IOMonitorAdapter (org.apache.jackrabbit.oak.segment.spi.monitor.IOMonitorAdapter)1 Compact (org.apache.jackrabbit.oak.segment.tool.Compact)1 Assert.assertEquals (org.junit.Assert.assertEquals)1