当前位置: 首页>>代码示例>>Java>>正文


Java TestXMLSearchableAttributeLong.SEARCH_STORAGE_KEY属性代码示例

本文整理汇总了Java中org.kuali.rice.kew.docsearch.TestXMLSearchableAttributeLong.SEARCH_STORAGE_KEY属性的典型用法代码示例。如果您正苦于以下问题:Java TestXMLSearchableAttributeLong.SEARCH_STORAGE_KEY属性的具体用法?Java TestXMLSearchableAttributeLong.SEARCH_STORAGE_KEY怎么用?Java TestXMLSearchableAttributeLong.SEARCH_STORAGE_KEY使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.kuali.rice.kew.docsearch.TestXMLSearchableAttributeLong的用法示例。


在下文中一共展示了TestXMLSearchableAttributeLong.SEARCH_STORAGE_KEY属性的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testLongRanges

@Test public void testLongRanges() throws Exception {
    WorkflowDocument doc = setUpSearchableDoc();
    String userId = doc.getInitiatorPrincipalId();
    String docType = doc.getDocumentTypeName();

    String searchAttributeLongKey = TestXMLSearchableAttributeLong.SEARCH_STORAGE_KEY;
    Long searchAttributeLongValue = TestXMLSearchableAttributeLong.SEARCH_STORAGE_VALUE.longValue();
    Long longValueToUse = null;

    // test lower bound only
    longValueToUse = searchAttributeLongValue; // lowerbound == value
    assertRangeSearchResults(docType, userId, searchAttributeLongKey, longValueToUse.toString(), null, false, 1);

    longValueToUse = Long.valueOf(searchAttributeLongValue.longValue() - 1); // lowerbound below value
    assertRangeSearchResults(docType, userId, searchAttributeLongKey, longValueToUse.toString(), null, false, 1);

    longValueToUse = Long.valueOf(searchAttributeLongValue.longValue() + 1); // lowerbound is above value
    assertRangeSearchResults(docType, userId, searchAttributeLongKey, longValueToUse.toString(), null, false, 0);

    // test upper bound only
    longValueToUse = searchAttributeLongValue; // upper bound == value
    assertRangeSearchResults(docType, userId, searchAttributeLongKey, null, longValueToUse.toString(), true, 1);

    longValueToUse = Long.valueOf(searchAttributeLongValue.longValue() - 1); // upper bound < value
    assertRangeSearchResults(docType, userId, searchAttributeLongKey, null, longValueToUse.toString(), true, 0);

    longValueToUse = Long.valueOf(searchAttributeLongValue.longValue() + 1); // upper bound > value
    assertRangeSearchResults(docType, userId, searchAttributeLongKey, null, longValueToUse.toString(), true, 1);

    // test both bounds
    // lowerbound == upperbound == value
    assertRangeSearchResults(docType, userId, searchAttributeLongKey,
                             Long.valueOf(searchAttributeLongValue.longValue()).toString(),
                             Long.valueOf(searchAttributeLongValue.longValue()).toString(), true, 1);

    // lower and upper bound > value
    assertRangeSearchResults(docType, userId, searchAttributeLongKey,
                             Long.valueOf(searchAttributeLongValue.longValue() + 2).toString(),
                             Long.valueOf(searchAttributeLongValue.longValue() + 4).toString(), true, 0);

    // lower and upper bound < value, but lower > upper
    assertRangeSearchResults(docType, userId, searchAttributeLongKey,
                             Long.valueOf(searchAttributeLongValue.longValue() - 2).toString(),
                             Long.valueOf(searchAttributeLongValue.longValue() - 4).toString(), true, EXPECT_EXCEPTION);
    // lower and upper bound < value, lower < upper
    assertRangeSearchResults(docType, userId, searchAttributeLongKey,
                             Long.valueOf(searchAttributeLongValue.longValue() - 4).toString(),
                             Long.valueOf(searchAttributeLongValue.longValue() - 2).toString(), true, 0);

    // lower bound < value, upper bound > value
    assertRangeSearchResults(docType, userId, searchAttributeLongKey,
                             Long.valueOf(searchAttributeLongValue.longValue() - 2).toString(),
                             Long.valueOf(searchAttributeLongValue.longValue() + 2).toString(), true, 1);

    // upper < lower
    assertRangeSearchResults(docType, userId, searchAttributeLongKey,
                             Long.valueOf(searchAttributeLongValue.longValue() + 2).toString(),
                             Long.valueOf(searchAttributeLongValue.longValue() - 2).toString(), true, EXPECT_EXCEPTION);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:59,代码来源:StandardGenericXMLSearchableAttributeRangesTest.java


注:本文中的org.kuali.rice.kew.docsearch.TestXMLSearchableAttributeLong.SEARCH_STORAGE_KEY属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。