use of org.apache.bookkeeper.versioning.LongVersion in project bookkeeper by apache.
the class TestZKLogStreamMetadataStoreUtils method testProcessLogMetadatasNoAllocatorPath.
@SuppressWarnings("unchecked")
@Test(timeout = 60000)
public void testProcessLogMetadatasNoAllocatorPath() throws Exception {
String rootPath = "/test-missing-version";
URI uri = DLMTestUtil.createDLMURI(2181, rootPath);
String logName = "test-log";
String logIdentifier = "<default>";
Versioned<byte[]> maxTxnIdData = new Versioned<byte[]>(DLUtils.serializeTransactionId(1L), new LongVersion(1));
Versioned<byte[]> logSegmentsData = new Versioned<byte[]>(DLUtils.serializeLogSegmentSequenceNumber(1L), new LongVersion(1));
List<Versioned<byte[]>> metadatas = Lists.newArrayList(new Versioned<byte[]>(null, null), new Versioned<byte[]>(null, null), maxTxnIdData, new Versioned<byte[]>(intToBytes(LogMetadata.LAYOUT_VERSION), null), new Versioned<byte[]>(new byte[0], new LongVersion(1)), new Versioned<byte[]>(new byte[0], new LongVersion(1)), logSegmentsData);
LogMetadataForWriter metadata = processLogMetadatas(uri, logName, logIdentifier, metadatas, false);
assertTrue(maxTxnIdData == metadata.getMaxTxIdData());
assertTrue(logSegmentsData == metadata.getMaxLSSNData());
assertNull(metadata.getAllocationData().getValue());
assertNull(metadata.getAllocationData().getVersion());
}
use of org.apache.bookkeeper.versioning.LongVersion in project bookkeeper by apache.
the class TestZKLogStreamMetadataStoreUtils method testProcessLogMetadatasMissingReadLockPath.
@SuppressWarnings("unchecked")
@Test(timeout = 60000, expected = UnexpectedException.class)
public void testProcessLogMetadatasMissingReadLockPath() throws Exception {
String rootPath = "/test-missing-version";
URI uri = DLMTestUtil.createDLMURI(2181, rootPath);
String logName = "test-log";
String logIdentifier = "<default>";
List<Versioned<byte[]>> metadatas = Lists.newArrayList(new Versioned<byte[]>(null, null), new Versioned<byte[]>(null, null), new Versioned<byte[]>(DLUtils.serializeTransactionId(1L), new LongVersion(1)), new Versioned<byte[]>(intToBytes(LogMetadata.LAYOUT_VERSION), null), new Versioned<byte[]>(new byte[0], new LongVersion(1)), new Versioned<byte[]>(null, null));
processLogMetadatas(uri, logName, logIdentifier, metadatas, false);
}
use of org.apache.bookkeeper.versioning.LongVersion in project bookkeeper by apache.
the class TestZKLogStreamMetadataStoreUtils method testProcessLogMetadatasMissingVersion.
@SuppressWarnings("unchecked")
@Test(timeout = 60000, expected = UnexpectedException.class)
public void testProcessLogMetadatasMissingVersion() throws Exception {
String rootPath = "/test-missing-version";
URI uri = DLMTestUtil.createDLMURI(2181, rootPath);
String logName = "test-log";
String logIdentifier = "<default>";
List<Versioned<byte[]>> metadatas = Lists.newArrayList(new Versioned<byte[]>(null, null), new Versioned<byte[]>(null, null), new Versioned<byte[]>(DLUtils.serializeTransactionId(1L), new LongVersion(1)), new Versioned<byte[]>(null, null));
processLogMetadatas(uri, logName, logIdentifier, metadatas, false);
}
use of org.apache.bookkeeper.versioning.LongVersion in project bookkeeper by apache.
the class TestZKLogStreamMetadataStoreUtils method testProcessLogMetadatasAllocatorPath.
@SuppressWarnings("unchecked")
@Test(timeout = 60000)
public void testProcessLogMetadatasAllocatorPath() throws Exception {
String rootPath = "/test-missing-version";
URI uri = DLMTestUtil.createDLMURI(2181, rootPath);
String logName = "test-log";
String logIdentifier = "<default>";
Versioned<byte[]> maxTxnIdData = new Versioned<byte[]>(DLUtils.serializeTransactionId(1L), new LongVersion(1));
Versioned<byte[]> logSegmentsData = new Versioned<byte[]>(DLUtils.serializeLogSegmentSequenceNumber(1L), new LongVersion(1));
Versioned<byte[]> allocationData = new Versioned<byte[]>(DLUtils.logSegmentId2Bytes(1L), new LongVersion(1));
List<Versioned<byte[]>> metadatas = Lists.newArrayList(new Versioned<byte[]>(null, null), new Versioned<byte[]>(null, null), maxTxnIdData, new Versioned<byte[]>(intToBytes(LogMetadata.LAYOUT_VERSION), null), new Versioned<byte[]>(new byte[0], new LongVersion(1)), new Versioned<byte[]>(new byte[0], new LongVersion(1)), logSegmentsData, allocationData);
LogMetadataForWriter metadata = processLogMetadatas(uri, logName, logIdentifier, metadatas, true);
assertTrue(maxTxnIdData == metadata.getMaxTxIdData());
assertTrue(logSegmentsData == metadata.getMaxLSSNData());
assertTrue(allocationData == metadata.getAllocationData());
}
use of org.apache.bookkeeper.versioning.LongVersion in project bookkeeper by apache.
the class TestZKLogStreamMetadataStoreUtils method testProcessLogMetadatasMissingLogSegmentsPath.
@SuppressWarnings("unchecked")
@Test(timeout = 60000, expected = UnexpectedException.class)
public void testProcessLogMetadatasMissingLogSegmentsPath() throws Exception {
String rootPath = "/test-missing-version";
URI uri = DLMTestUtil.createDLMURI(2181, rootPath);
String logName = "test-log";
String logIdentifier = "<default>";
List<Versioned<byte[]>> metadatas = Lists.newArrayList(new Versioned<byte[]>(null, null), new Versioned<byte[]>(null, null), new Versioned<byte[]>(DLUtils.serializeTransactionId(1L), new LongVersion(1)), new Versioned<byte[]>(intToBytes(LogMetadata.LAYOUT_VERSION), null), new Versioned<byte[]>(new byte[0], new LongVersion(1)), new Versioned<byte[]>(new byte[0], new LongVersion(1)), new Versioned<byte[]>(null, null));
processLogMetadatas(uri, logName, logIdentifier, metadatas, false);
}
Aggregations