use of com.serotonin.m2m2.vo.role.RoleVO in project ma-core-public by MangoAutomation.
the class MySQLDatabaseTest method test1AutoIncrement.
@Test
public void test1AutoIncrement() throws SQLException {
DSLContext context = Common.getBean(DatabaseProxy.class).getContext();
Roles r = Roles.ROLES;
context.insertInto(r, r.id, r.xid, r.name).values(10, "xid", "name").execute();
context.insertInto(r, r.xid, r.name).values("test", "test").execute();
RoleVO role = Common.getBean(RoleDao.class).getByXid("test");
assertEquals(11, role.getId());
}
use of com.serotonin.m2m2.vo.role.RoleVO in project ma-core-public by MangoAutomation.
the class PostgresDatabaseTest method test1AutoIncrement.
@Test
public void test1AutoIncrement() throws SQLException {
DSLContext context = Common.getBean(DatabaseProxy.class).getContext();
Roles r = Roles.ROLES;
context.insertInto(r, r.id, r.xid, r.name).values(10, "xid", "name").execute();
context.insertInto(r, r.xid, r.name).values("test", "test").execute();
RoleVO role = Common.getBean(RoleDao.class).getByXid("test");
assertNotEquals(11, role.getId());
assertEquals(4, role.getId());
String sequence = r.getName() + "_" + r.id.getName() + "_seq";
context.alterSequence(sequence).restartWith(20).execute();
context.insertInto(r, r.xid, r.name).values("test2", "test2").execute();
role = Common.getBean(RoleDao.class).getByXid("test2");
assertEquals(20, role.getId());
}
Aggregations