use of com.torodb.core.d2r.ReservedIdGenerator.DocPartRidGenerator in project torodb by torodb.
the class ReservedIdGeneratorImplTest method whenTableRefDoesntExistsCallsToFactory.
@Test
public void whenTableRefDoesntExistsCallsToFactory() {
ReservedIdInfoFactory factory = new MockedReservedIdInfoFactory();
factory.startAsync();
factory.awaitRunning();
TableRefFactory tableRefFactory = new TableRefFactoryImpl();
ReservedIdInfoFactory reservedIdInfoFactory = Mockito.spy(factory);
ReservedIdGeneratorImpl container = new ReservedIdGeneratorImpl(reservedIdInfoFactory, new ThreadFactoryBuilder().build());
DocPartRidGenerator docPartRidGenerator = container.getDocPartRidGenerator("myDB", "myCollection");
int nextRid = docPartRidGenerator.nextRid(tableRefFactory.createRoot());
Mockito.verify(reservedIdInfoFactory).create("myDB", "myCollection", tableRefFactory.createRoot());
assertEquals(1, nextRid);
}
Aggregations