Example usage for org.hibernate.criterion InExpression toString

List of usage examples for org.hibernate.criterion InExpression toString

Introduction

In this page you can find the example usage for org.hibernate.criterion InExpression toString.

Prototype

@Override
    public String toString() 

Source Link

Usage

From source file:org.candlepin.model.CPRestrictionsTest.java

License:Open Source License

@Test
public void testInSimple() {
    List<String> items = new LinkedList<>();
    String expected = "swift in (";
    int i = 0;/*from  w w  w  .  j av a 2  s . co  m*/

    int inBlockSize = config.getInt(DatabaseConfigFactory.IN_OPERATOR_BLOCK_SIZE);
    for (; i < inBlockSize - 1; i++) {
        expected += i + ", ";
        items.add("" + i);
    }

    expected += i + ")";
    items.add("" + i);
    Criterion crit = CPRestrictions.in("swift", items);
    InExpression ie = (InExpression) crit;
    assertEquals(expected, ie.toString());
}

From source file:org.candlepin.model.CPRestrictionsTest.java

License:Open Source License

@Test
public void testInSimpleAsArray() {
    List<String> items = new LinkedList<>();
    String expected = "swift in (";
    int i = 0;/* www.ja  va  2  s .c om*/

    int inBlockSize = config.getInt(DatabaseConfigFactory.IN_OPERATOR_BLOCK_SIZE);
    for (; i < inBlockSize - 1; i++) {
        expected += i + ", ";
        items.add("" + i);
    }

    expected += i + ")";
    items.add("" + i);
    Criterion crit = CPRestrictions.in("swift", items.toArray());
    InExpression ie = (InExpression) crit;
    assertEquals(expected, ie.toString());
}

From source file:org.candlepin.model.PoolCuratorTest.java

License:Open Source License

@Test
public void buildInCriteriaTestSimple() {
    List<String> items = new ArrayList<String>();
    String expected = "swift in (";
    int i = 0;//from   ww  w. j av  a 2 s  . com
    for (; i < AbstractHibernateCurator.IN_OPERATOR_BLOCK_SIZE - 1; i++) {
        expected += i + ", ";
        items.add("" + i);
    }
    expected += i + ")";
    items.add("" + i);
    Criterion crit = poolCurator.unboundedInCriterion("swift", items);
    InExpression ie = (InExpression) crit;
    assertEquals(expected, ie.toString());
}