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


Java TestXMLSearchableAttributeFloat.SEARCH_STORAGE_KEY属性代码示例

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


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

示例1: testFloatRanges

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

    String searchAttributeFloatKey = TestXMLSearchableAttributeFloat.SEARCH_STORAGE_KEY;
    BigDecimal searchAttributeFloatValue = TestXMLSearchableAttributeFloat.SEARCH_STORAGE_VALUE;

    BigDecimal floatValueToUse = null;
    // test lower bound only
    floatValueToUse = searchAttributeFloatValue; // lower bound == value
    // NOTE: original test asserted 0 results, mysql actually does match the value
    assertRangeSearchResults(docType, userId, searchAttributeFloatKey, floatValueToUse.toString(), null, false, 1);

    floatValueToUse = searchAttributeFloatValue.subtract(BigDecimal.ONE); // lowerbound < value
    assertRangeSearchResults(docType, userId, searchAttributeFloatKey, floatValueToUse.toString(), null, false, 1);

    floatValueToUse = searchAttributeFloatValue.add(BigDecimal.ONE); // lowerbound > value
    assertRangeSearchResults(docType, userId, searchAttributeFloatKey, floatValueToUse.toString(), null, false, 0);

    // test upper bound only
    floatValueToUse = searchAttributeFloatValue; // upperbound == value (does not match float)
    // NOTE: another case where original test had 0 results, but in fact we see a float match
    assertRangeSearchResults(docType, userId, searchAttributeFloatKey, null, floatValueToUse.toString(), true, 1);

    floatValueToUse = searchAttributeFloatValue.subtract(BigDecimal.ONE); // upperbound < value
    assertRangeSearchResults(docType, userId, searchAttributeFloatKey, null, floatValueToUse.toString(), true, 0);

    floatValueToUse = searchAttributeFloatValue.add(BigDecimal.ONE); // upperbound > value
    assertRangeSearchResults(docType, userId, searchAttributeFloatKey, null, floatValueToUse.toString(), true, 1);

    // test both bounds
    // upper == lower == value
    // NOTE: original case had 0 results, now seeing 1 result
    // search generator invokes criteria which calls addNumericRangeCriteria when produces: (EXT1.VAL BETWEEN 123456.3456 AND 123456.3456)
    assertRangeSearchResults(docType, userId, searchAttributeFloatKey, searchAttributeFloatValue.toString(), searchAttributeFloatValue.toString(), true, 1);

    // upper and lower > value
    assertRangeSearchResults(docType, userId, searchAttributeFloatKey,
                             searchAttributeFloatValue.add(new BigDecimal(2)).toString(),
                             searchAttributeFloatValue.add(new BigDecimal(4)).toString(), true, 0);

    // upper and lower < value
    assertRangeSearchResults(docType, userId, searchAttributeFloatKey,
                             searchAttributeFloatValue.subtract(new BigDecimal(4)).toString(),
                             searchAttributeFloatValue.subtract(new BigDecimal(2)).toString(), true, 0);

    // lower < value, upper > value
    assertRangeSearchResults(docType, userId, searchAttributeFloatKey,
                             searchAttributeFloatValue.subtract(new BigDecimal(2)).toString(),
                             searchAttributeFloatValue.add(new BigDecimal(2)).toString(), true, 1);

    // upper < lower
    assertRangeSearchResults(docType, userId, searchAttributeFloatKey,
                             searchAttributeFloatValue.add(new BigDecimal(2)).toString(),
                             searchAttributeFloatValue.subtract(new BigDecimal(2)).toString(), true, EXPECT_EXCEPTION);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:57,代码来源:StandardGenericXMLSearchableAttributeRangesTest.java


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