當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。