use of org.seasar.doma.internal.jdbc.mock.MockConfig in project doma by domaframework.
the class CommentContextTest method getMessage_empty.
@Test
void getMessage_empty() {
CommentContext context = new CommentContext("class", "method", new MockConfig(), null, null);
assertFalse(context.getMessage().isPresent());
}
use of org.seasar.doma.internal.jdbc.mock.MockConfig in project doma by domaframework.
the class CommentContextTest method getMessage.
@Test
void getMessage() {
CommentContext context = new CommentContext("class", "method", new MockConfig(), null, "hello");
assertEquals("hello", context.getMessage().get());
}
use of org.seasar.doma.internal.jdbc.mock.MockConfig in project doma by domaframework.
the class StandardPagingTransformerTest method testOffsetLimit_forNode.
@Test
public void testOffsetLimit_forNode() {
String expected = "select * from ( select temp_.*, row_number() over( order by temp_.name1, temp_.name2, temp_.id ) as doma_rownumber_ from ( select emp.id from emp ) as temp_ ) as temp2_ where doma_rownumber_ > 5 and doma_rownumber_ <= 15";
StandardPagingTransformer transformer = new StandardPagingTransformer(5, 10);
SqlParser parser = new SqlParser("select emp.id from emp order by /*%for e: values*/emp.name/*#e*/, /*%end*/emp.id");
SqlNode sqlNode = transformer.transform(parser.parse());
ExpressionEvaluator evaluator = new ExpressionEvaluator();
evaluator.add("values", new Value(List.class, Arrays.asList(1, 2)));
NodePreparedSqlBuilder sqlBuilder = new NodePreparedSqlBuilder(new MockConfig(), SqlKind.SELECT, "dummyPath", evaluator, SqlLogType.FORMATTED);
PreparedSql sql = sqlBuilder.build(sqlNode, Function.identity());
assertEquals(expected, sql.getRawSql());
}
use of org.seasar.doma.internal.jdbc.mock.MockConfig in project doma by domaframework.
the class StandardPagingTransformerTest method testOffsetLimit.
@Test
public void testOffsetLimit() {
String expected = "select * from ( select temp_.*, row_number() over( order by temp_.id ) as doma_rownumber_ from ( select emp.id from emp ) as temp_ ) as temp2_ where doma_rownumber_ > 5 and doma_rownumber_ <= 15";
StandardPagingTransformer transformer = new StandardPagingTransformer(5, 10);
SqlParser parser = new SqlParser("select emp.id from emp order by emp.id");
SqlNode sqlNode = transformer.transform(parser.parse());
NodePreparedSqlBuilder sqlBuilder = new NodePreparedSqlBuilder(new MockConfig(), SqlKind.SELECT, "dummyPath");
PreparedSql sql = sqlBuilder.build(sqlNode, Function.identity());
assertEquals(expected, sql.getRawSql());
}
use of org.seasar.doma.internal.jdbc.mock.MockConfig in project doma by domaframework.
the class NativeSqlSelectTest method forUpdate_mssql_nowait.
@Test
void forUpdate_mssql_nowait() {
NativeSql nativeSql = new NativeSql(new MockConfig() {
@Override
public Dialect getDialect() {
return new MssqlDialect();
}
});
Emp_ e = new Emp_();
Buildable<?> stmt = nativeSql.from(e).where(c -> c.eq(e.id, 1)).forUpdate(ForUpdateOption.noWait()).select(e.id);
Sql<?> sql = stmt.asSql();
assertEquals("select t0_.ID from EMP t0_ with (updlock, rowlock, nowait) where t0_.ID = 1", sql.getFormattedSql());
}
Aggregations