Search in sources :

Example 1 with IncludeIn

use of com.querydsl.core.testutil.IncludeIn 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;
}
Also used : IncludeIn(com.querydsl.core.testutil.IncludeIn) ExcludeIn(com.querydsl.core.testutil.ExcludeIn)

Example 2 with IncludeIn

use of com.querydsl.core.testutil.IncludeIn in project querydsl by querydsl.

the class InsertBase method replace.

@Test
@IncludeIn(MYSQL)
@SkipForQuoted
public void replace() {
    SQLInsertClause clause = mysqlReplace(survey);
    clause.columns(survey.id, survey.name).values(3, "Hello");
    assertEquals("replace into SURVEY (ID, NAME) values (?, ?)", clause.toString());
    clause.execute();
}
Also used : SQLInsertClause(com.querydsl.sql.dml.SQLInsertClause) Test(org.junit.Test) IncludeIn(com.querydsl.core.testutil.IncludeIn)

Example 3 with IncludeIn

use of com.querydsl.core.testutil.IncludeIn in project querydsl by querydsl.

the class MergeBase method mergeBatch.

@Test
@IncludeIn(H2)
public void mergeBatch() {
    SQLMergeClause merge = merge(survey).keys(survey.id).set(survey.id, 5).set(survey.name, "5").addBatch();
    assertEquals(1, merge.getBatchCount());
    assertFalse(merge.isEmpty());
    merge.keys(survey.id).set(survey.id, 6).set(survey.name, "6").addBatch();
    assertEquals(2, merge.getBatchCount());
    assertEquals(2, merge.execute());
    assertEquals(1L, query().from(survey).where(survey.name.eq("5")).fetchCount());
    assertEquals(1L, query().from(survey).where(survey.name.eq("6")).fetchCount());
}
Also used : SQLMergeClause(com.querydsl.sql.dml.SQLMergeClause) Test(org.junit.Test) IncludeIn(com.querydsl.core.testutil.IncludeIn)

Example 4 with IncludeIn

use of com.querydsl.core.testutil.IncludeIn in project querydsl by querydsl.

the class MergeBase method merge_with_templateExpression_in_batch.

@Test
@IncludeIn(H2)
public void merge_with_templateExpression_in_batch() {
    SQLMergeClause merge = merge(survey).keys(survey.id).set(survey.id, 5).set(survey.name, Expressions.stringTemplate("'5'")).addBatch();
    assertEquals(1, merge.execute());
}
Also used : SQLMergeClause(com.querydsl.sql.dml.SQLMergeClause) Test(org.junit.Test) IncludeIn(com.querydsl.core.testutil.IncludeIn)

Example 5 with IncludeIn

use of com.querydsl.core.testutil.IncludeIn in project querydsl by querydsl.

the class MergeBase method mergeBatch_with_subquery.

@Test
@IncludeIn(H2)
public void mergeBatch_with_subquery() {
    SQLMergeClause merge = merge(survey).keys(survey.id).columns(survey.id, survey.name).select(query().from(survey2).select(survey2.id.add(20), survey2.name)).addBatch();
    merge(survey).keys(survey.id).columns(survey.id, survey.name).select(query().from(survey2).select(survey2.id.add(40), survey2.name)).addBatch();
    assertEquals(1, merge.execute());
}
Also used : SQLMergeClause(com.querydsl.sql.dml.SQLMergeClause) Test(org.junit.Test) IncludeIn(com.querydsl.core.testutil.IncludeIn)

Aggregations

IncludeIn (com.querydsl.core.testutil.IncludeIn)11 Test (org.junit.Test)9 SQLMergeClause (com.querydsl.sql.dml.SQLMergeClause)4 ExcludeIn (com.querydsl.core.testutil.ExcludeIn)2 SQLInsertClause (com.querydsl.sql.dml.SQLInsertClause)2 QEmployee (com.querydsl.sql.domain.QEmployee)1 QSurvey (com.querydsl.sql.domain.QSurvey)1 UUID (java.util.UUID)1