本文整理汇总了Java中org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer.nextIntValue方法的典型用法代码示例。如果您正苦于以下问题:Java DataFieldMaxValueIncrementer.nextIntValue方法的具体用法?Java DataFieldMaxValueIncrementer.nextIntValue怎么用?Java DataFieldMaxValueIncrementer.nextIntValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer
的用法示例。
在下文中一共展示了DataFieldMaxValueIncrementer.nextIntValue方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testGetIncrementer_nextValues
import org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer; //导入方法依赖的package包/类
/**
* Tests that the incrementer returned from the factory returns the proper next int, long, and String values.
*/
@Test
public void testGetIncrementer_nextValues() {
DataFieldMaxValueIncrementer incrementer = (DataFieldMaxValueIncrementer) context.getBean(TEST_INCREMENTER);
assertNotNull(incrementer);
// now that we have our incrementer, let's get the next value
int nextIntValue = incrementer.nextIntValue();
assertTrue("nextIntValue should be greater than 0", nextIntValue > 0);
// do it again, should be 1 larger!
int nextNextIntValue = incrementer.nextIntValue();
assertEquals("Next value should be one higher", nextIntValue + 1, nextNextIntValue);
// try getting the next value as a long
long nextLongValue = incrementer.nextLongValue();
assertEquals(nextNextIntValue + 1, nextLongValue);
// try getting it as a String now
String nextStringValue = incrementer.nextStringValue();
assertEquals(nextLongValue + 1, Long.parseLong(nextStringValue));
}
示例2: testGetIncrementer_nextValues
import org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer; //导入方法依赖的package包/类
/**
* Tests that the incrementer returned from the factory returns the proper next int, long, and String values.
*/
@Test
public void testGetIncrementer_nextValues() {
DataSource dataSource = TestHarnessServiceLocator.getDataSource();
DataFieldMaxValueIncrementer incrementer =
MaxValueIncrementerFactory.getIncrementer(dataSource, ARBITRARY_SEQUENCE);
assertNotNull(incrementer);
// now that we have our incrementer, let's get the next value
int nextIntValue = incrementer.nextIntValue();
assertTrue("nextIntValue should be greater than 0", nextIntValue > 0);
// do it again, should be 1 larger!
int nextNextIntValue = incrementer.nextIntValue();
assertEquals("Next value should be one higher", nextIntValue + 1, nextNextIntValue);
// try getting the next value as a long
long nextLongValue = incrementer.nextLongValue();
assertEquals(nextNextIntValue + 1, nextLongValue);
// try getting it as a String now
String nextStringValue = incrementer.nextStringValue();
assertEquals(nextLongValue + 1, Long.parseLong(nextStringValue));
}
示例3: testGetIncrementer_CaseInsensitive
import org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer; //导入方法依赖的package包/类
/**
* Tests that the sequence name is case insensitive. We will do this by using the same sequence name as the
* previous test, but changing the case to all lowercase.
*/
@Test
public void testGetIncrementer_CaseInsensitive() {
DataFieldMaxValueIncrementer incrementer = (DataFieldMaxValueIncrementer) context.getBean(TEST_INCREMENTER);
assertNotNull(incrementer);
// now that we have our incrementer, let's get the next value
int nextIntValue = incrementer.nextIntValue();
assertTrue("nextIntValue should be greater than 0", nextIntValue > 0);
}
示例4: testGetIncrementer_CaseInsensitive
import org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer; //导入方法依赖的package包/类
/**
* Tests that the sequence name is case insensitive. We will do this by using the same sequence name as the
* previous test, but changing the case to all lowercase.
*/
@Test
public void testGetIncrementer_CaseInsensitive() {
DataSource dataSource = TestHarnessServiceLocator.getDataSource();
DataFieldMaxValueIncrementer incrementer =
MaxValueIncrementerFactory.getIncrementer(dataSource, ARBITRARY_SEQUENCE.toLowerCase());
assertNotNull(incrementer);
// now that we have our incrementer, let's get the next value
int nextIntValue = incrementer.nextIntValue();
assertTrue("nextIntValue should be greater than 0", nextIntValue > 0);
}