use of com.querydsl.core.testutil.ExcludeIn in project querydsl by querydsl.
the class TargetRule method isExecuted.
private boolean isExecuted(Description description, Target target) {
ExcludeIn ex = description.getAnnotation(ExcludeIn.class);
// excluded in given targets
if (ex != null && Arrays.asList(ex.value()).contains(target)) {
return false;
}
// included only in given targets
IncludeIn in = description.getAnnotation(IncludeIn.class);
if (in != null && !Arrays.asList(in.value()).contains(target)) {
return false;
}
return true;
}
use of com.querydsl.core.testutil.ExcludeIn in project querydsl by querydsl.
the class SelectBase method date_diff.
@Test
@ExcludeIn({ DB2, SQLITE, TERADATA })
public void date_diff() {
QEmployee employee2 = new QEmployee("employee2");
SQLQuery<?> query = query().from(employee).orderBy(employee.id.asc());
SQLQuery<?> query2 = query().from(employee, employee2).orderBy(employee.id.asc(), employee2.id.desc());
List<DatePart> dps = Lists.newArrayList();
add(dps, DatePart.year);
add(dps, DatePart.month);
add(dps, DatePart.week);
add(dps, DatePart.day);
add(dps, DatePart.hour, HSQLDB);
add(dps, DatePart.minute, HSQLDB);
add(dps, DatePart.second, HSQLDB);
LocalDate localDate = new LocalDate(1970, 1, 10);
Date date = new Date(localDate.toDateMidnight().getMillis());
for (DatePart dp : dps) {
int diff1 = query.select(SQLExpressions.datediff(dp, date, employee.datefield)).fetchFirst();
int diff2 = query.select(SQLExpressions.datediff(dp, employee.datefield, date)).fetchFirst();
int diff3 = query2.select(SQLExpressions.datediff(dp, employee.datefield, employee2.datefield)).fetchFirst();
assertEquals(diff1, -diff2);
}
}
use of com.querydsl.core.testutil.ExcludeIn in project querydsl by querydsl.
the class MergeBase method merge_with_keys.
@Test
@ExcludeIn({ H2, CUBRID, SQLSERVER })
public void merge_with_keys() throws SQLException {
ResultSet rs = merge(survey).keys(survey.id).set(survey.id, 7).set(survey.name, "Hello World").executeWithKeys();
assertTrue(rs.next());
assertTrue(rs.getObject(1) != null);
rs.close();
}
use of com.querydsl.core.testutil.ExcludeIn in project querydsl by querydsl.
the class UnionBase method union_multiple_columns3.
@SuppressWarnings("unchecked")
@Test
@ExcludeIn(DERBY)
public void union_multiple_columns3() throws SQLException {
SubQueryExpression<Tuple> sq1 = query().from(employee).select(employee.firstname, employee.lastname);
SubQueryExpression<Tuple> sq2 = query().from(employee).select(employee.firstname, employee.lastname);
SQLQuery<?> query = query();
query.union(sq1, sq2);
List<Tuple> list = query.select(employee.lastname, employee.firstname).fetch();
assertFalse(list.isEmpty());
for (Tuple row : list) {
System.out.println(row.get(0, String.class) + " " + row.get(1, String.class));
}
}
use of com.querydsl.core.testutil.ExcludeIn in project querydsl by querydsl.
the class SpatialBase method point_distance.
@Test
@ExcludeIn(MYSQL)
public void point_distance() {
QShapes shapes1 = QShapes.shapes;
QShapes shapes2 = new QShapes("shapes2");
for (Tuple tuple : query().from(shapes1, shapes2).where(shapes1.id.loe(5), shapes2.id.loe(5)).select(shapes1.geometry.asPoint(), shapes2.geometry.asPoint(), shapes1.geometry.distance(shapes2.geometry)).fetch()) {
Point point1 = tuple.get(shapes1.geometry.asPoint());
Point point2 = tuple.get(shapes2.geometry.asPoint());
Double distance = tuple.get(shapes1.geometry.distance(shapes2.geometry));
assertEquals(point1.distance(point2), distance, 0.0001);
}
}
Aggregations