本文整理匯總了Java中com.jivesoftware.os.jive.utils.ordered.id.ConstantWriterIdProvider類的典型用法代碼示例。如果您正苦於以下問題:Java ConstantWriterIdProvider類的具體用法?Java ConstantWriterIdProvider怎麽用?Java ConstantWriterIdProvider使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ConstantWriterIdProvider類屬於com.jivesoftware.os.jive.utils.ordered.id包,在下文中一共展示了ConstantWriterIdProvider類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: buildInvertedIndex
import com.jivesoftware.os.jive.utils.ordered.id.ConstantWriterIdProvider; //導入依賴的package包/類
private <BM extends IBM, IBM> MiruInvertedIndex<BM, IBM> buildInvertedIndex(boolean atomized, MiruBitmaps<BM, IBM> bitmaps) throws Exception {
return new LabInvertedIndex<>(
new OrderIdProviderImpl(new ConstantWriterIdProvider(1), new SnowflakeIdPacker(), new JiveEpochTimestampProvider()),
bitmaps,
new TrackError() {
@Override
public void error(String reason) {
}
@Override
public void reset() {
}
},
"test",
0,
atomized,
new byte[] { 0 },
IndexTestUtil.buildValueIndex("bitmap"),
new byte[] { 0 },
IndexTestUtil.buildValueIndex("term"),
new Object());
}
示例2: testJsonEventCreateUpdate
import com.jivesoftware.os.jive.utils.ordered.id.ConstantWriterIdProvider; //導入依賴的package包/類
@Test
public void testJsonEventCreateUpdate() throws Exception {
//create jsonevent
IdProviderImpl idProvider = new IdProviderImpl(new OrderIdProviderImpl(new ConstantWriterIdProvider(100)));
Event event = EventBuilder.create(idProvider, EventBuilderTest.class.getSimpleName(), tenantId, actorId).build();
Assert.assertEquals(event.getObjectId().getClassName(), EventBuilderTest.class.getSimpleName(), "compare class name");
//update existing jsonevent
ObjectId objectId = new ObjectId(EventBuilderTest.class.getSimpleName(), new Id(100));
Event event2 = EventBuilder.update(objectId, tenantId, actorId).build();
Assert.assertEquals(event2.getObjectId().getClassName(), EventBuilderTest.class.getSimpleName(), "compare class name");
//update new jsonevent
ObjectId objectId3 = new ObjectId("myClass", new Id(100));
Event event3 = EventBuilder.update(objectId3, tenantId, actorId).build();
Assert.assertEquals(event3.getObjectId().getClassName(), "myClass", "compare class name");
}
示例3: testClear
import com.jivesoftware.os.jive.utils.ordered.id.ConstantWriterIdProvider; //導入依賴的package包/類
@Test
public void testClear() throws Exception {
JsonEventConventions jec = new JsonEventConventions();
IdProviderImpl idProvider = new IdProviderImpl(new OrderIdProviderImpl(new ConstantWriterIdProvider(100)));
EventBuilder eventBuilder = EventBuilder.create(idProvider, EventBuilderTest.class.getSimpleName(), tenantId, actorId);
eventBuilder.set("key", "value");
Event has = eventBuilder.build();
ObjectNode hasNode = jec.getInstanceNode(has.toJson(), EventBuilderTest.class.getSimpleName());
Assert.assertTrue(hasNode.has("key"));
eventBuilder.clear("key");
Event hasNot = eventBuilder.build();
ObjectNode hasNotNode = jec.getInstanceNode(hasNot.toJson(), EventBuilderTest.class.getSimpleName());
Assert.assertFalse(hasNotNode.has("key"));
}
示例4: diskBackedEventualConsistencyTest
import com.jivesoftware.os.jive.utils.ordered.id.ConstantWriterIdProvider; //導入依賴的package包/類
@Test
public void diskBackedEventualConsistencyTest() throws Exception {
File walDir = Files.createTempDir();
IoStats ioStats = new IoStats();
RowIOProvider binaryRowIOProvider = new BinaryRowIOProvider(4096, 64, false);
WALIndexProvider<MemoryWALIndex> indexProvider = new MemoryWALIndexProvider("memory");
VersionedPartitionName versionedPartitionName = new VersionedPartitionName(new PartitionName(false, "ring".getBytes(), "booya".getBytes()),
VersionedPartitionName.STATIC_VERSION);
BinaryWALTx binaryWALTx = new BinaryWALTx("booya", binaryRowIOProvider, primaryRowMarshaller, 4096, 64);
OrderIdProviderImpl idProvider = new OrderIdProviderImpl(new ConstantWriterIdProvider(1));
testEventualConsistency(ioStats, walDir, versionedPartitionName, idProvider, binaryWALTx, indexProvider);
}
示例5: testJsonEventSet
import com.jivesoftware.os.jive.utils.ordered.id.ConstantWriterIdProvider; //導入依賴的package包/類
@Test (dataProviderClass = JsonEventTestDataProvider.class, dataProvider = "createJsonData")
public void testJsonEventSet(String key, Object value) throws Exception {
//create jsonEvent
IdProviderImpl idProvider = new IdProviderImpl(new OrderIdProviderImpl(new ConstantWriterIdProvider(100)));
Event event = EventBuilder.create(idProvider, EventBuilderTest.class.getSimpleName(), tenantId, actorId)
.set(key, value)
.build();
Assert.assertEquals(event.getObjectId().getClassName(), EventBuilderTest.class.getSimpleName(), "compare class name");
//better to check the result: do that later when get time
System.out.println("updated jsonEvent:" + event.toString());
}
示例6: testJsonEventSetBadData
import com.jivesoftware.os.jive.utils.ordered.id.ConstantWriterIdProvider; //導入依賴的package包/類
@Test (dataProviderClass = JsonEventTestDataProvider.class, dataProvider = "createBadJsonData",
expectedExceptions = RuntimeException.class)
public void testJsonEventSetBadData(String key, Object value) throws Exception {
//create jsonEvent
IdProviderImpl idProvider = new IdProviderImpl(new OrderIdProviderImpl(new ConstantWriterIdProvider(100)));
Event event = EventBuilder.create(idProvider, EventBuilderTest.class.getSimpleName(), tenantId, actorId)
.set(key, value)
.build();
}