本文整理汇总了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();
}