本文整理汇总了Java中org.kuali.rice.kew.docsearch.TestXMLSearchableAttributeFloat类的典型用法代码示例。如果您正苦于以下问题:Java TestXMLSearchableAttributeFloat类的具体用法?Java TestXMLSearchableAttributeFloat怎么用?Java TestXMLSearchableAttributeFloat使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TestXMLSearchableAttributeFloat类属于org.kuali.rice.kew.docsearch包,在下文中一共展示了TestXMLSearchableAttributeFloat类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUpSearchableDoc
import org.kuali.rice.kew.docsearch.TestXMLSearchableAttributeFloat; //导入依赖的package包/类
/**
* Sets up a doc for searching with ranged queries
*/
protected WorkflowDocument setUpSearchableDoc() {
String documentTypeName = "SearchDocTypeRangeSearchDataType";
DocumentType docType = ((DocumentTypeService)KEWServiceLocator.getService(KEWServiceLocator.DOCUMENT_TYPE_SERVICE)).findByName(documentTypeName);
String userNetworkId = "rkirkend";
WorkflowDocument workflowDocument = WorkflowDocumentFactory.createDocument(getPrincipalIdForName(userNetworkId), documentTypeName);
/*
* Below we are using the keys and values from the custom searchable attribute classes' static constants but
* this is only for convenience as those should always be valid values to test for.
*/
// adding string searchable attribute
WorkflowAttributeDefinition.Builder stringXMLDef = WorkflowAttributeDefinition.Builder.create("XMLSearchableAttributeStringRange");
stringXMLDef.addPropertyDefinition(TestXMLSearchableAttributeString.SEARCH_STORAGE_KEY, TestXMLSearchableAttributeString.SEARCH_STORAGE_VALUE);
workflowDocument.addSearchableDefinition(stringXMLDef.build());
// adding long searchable attribute
WorkflowAttributeDefinition.Builder longXMLDef = WorkflowAttributeDefinition.Builder.create("XMLSearchableAttributeStdLongRangeInclusive");
longXMLDef.addPropertyDefinition(TestXMLSearchableAttributeLong.SEARCH_STORAGE_KEY, TestXMLSearchableAttributeLong.SEARCH_STORAGE_VALUE.toString());
workflowDocument.addSearchableDefinition(longXMLDef.build());
// adding float searchable attribute
WorkflowAttributeDefinition.Builder floatXMLDef = WorkflowAttributeDefinition.Builder.create("XMLSearchableAttributeStdFloatRangeInclusive");
floatXMLDef.addPropertyDefinition(TestXMLSearchableAttributeFloat.SEARCH_STORAGE_KEY, TestXMLSearchableAttributeFloat.SEARCH_STORAGE_VALUE.toString());
workflowDocument.addSearchableDefinition(floatXMLDef.build());
// adding string searchable attribute
WorkflowAttributeDefinition.Builder dateXMLDef = WorkflowAttributeDefinition.Builder.create("XMLSearchableAttributeStdDateTimeRangeInclusive");
dateXMLDef.addPropertyDefinition(TestXMLSearchableAttributeDateTime.SEARCH_STORAGE_KEY, DocumentSearchInternalUtils
.getDisplayValueWithDateOnly(TestXMLSearchableAttributeDateTime.SEARCH_STORAGE_VALUE));
workflowDocument.addSearchableDefinition(dateXMLDef.build());
workflowDocument.setTitle("Routing style");
workflowDocument.route("routing this document.");
return WorkflowDocumentFactory.loadDocument(getPrincipalIdForName(userNetworkId), workflowDocument.getDocumentId());
}
示例2: testValidateUserSearchRangeInputs
import org.kuali.rice.kew.docsearch.TestXMLSearchableAttributeFloat; //导入依赖的package包/类
@Test public void testValidateUserSearchRangeInputs() {
// <searchDefinition rangeSearch="true"/>
StandardGenericXMLSearchableAttribute searchAttribute = getAttribute("XMLSearchableAttributeStringRange");
ExtensionDefinition ed = createExtensionDefinition("XMLSearchableAttributeStringRange");
RemotableAttributeError error = assertDocumentSearchCriteriaValidation(searchAttribute, ed, TestXMLSearchableAttributeString.SEARCH_STORAGE_KEY, ">= jack", null);
assertDocumentSearchCriteriaValidation(searchAttribute, ed, TestXMLSearchableAttributeString.SEARCH_STORAGE_KEY, "<= jack.jack", "differ on upper bound inclusivity");
assertDocumentSearchCriteriaValidation(searchAttribute, ed, TestXMLSearchableAttributeString.SEARCH_STORAGE_KEY, "< jack.jack", "Invalid first name");
assertDocumentSearchCriteriaValidation(searchAttribute, ed, TestXMLSearchableAttributeString.SEARCH_STORAGE_KEY, ">= jack*jack", null);
// TODO: * gets stripped from value
// <searchDefinition dataType="long" rangeSearch="true"/>
searchAttribute = getAttribute("XMLSearchableAttributeStdLongRange");
ed = createExtensionDefinition("XMLSearchableAttributeStdLongRange");
assertDocumentSearchCriteriaValidation(searchAttribute, ed, TestXMLSearchableAttributeLong.SEARCH_STORAGE_KEY, "<= " + TestXMLSearchableAttributeLong.SEARCH_STORAGE_VALUE.toString(), "differ on upper bound inclusivity");
assertDocumentSearchCriteriaValidation(searchAttribute, ed, TestXMLSearchableAttributeLong.SEARCH_STORAGE_KEY, "< " + TestXMLSearchableAttributeLong.SEARCH_STORAGE_VALUE.toString(), null);
assertDocumentSearchCriteriaValidation(searchAttribute, ed, TestXMLSearchableAttributeLong.SEARCH_STORAGE_KEY, ">= " + TestXMLSearchableAttributeLong.SEARCH_STORAGE_VALUE.toString() + ".33","does not conform to standard validation for field type.");
assertDocumentSearchCriteriaValidation(searchAttribute, ed, TestXMLSearchableAttributeLong.SEARCH_STORAGE_KEY, "<= jack*jack", "differ on upper bound inclusivity");
assertDocumentSearchCriteriaValidation(searchAttribute, ed, TestXMLSearchableAttributeLong.SEARCH_STORAGE_KEY, "< jack*jack", "does not conform to standard validation for field type.");
// <searchDefinition dataType="float">
// <rangeDefinition inclusive="false">
// <lower label="starting"/>
// <upper label="ending"/>
// </rangeDefinition>
// </searchDefinition>
searchAttribute = getAttribute("XMLSearchableAttributeStdFloatRange");
ed = createExtensionDefinition("XMLSearchableAttributeStdFloatRange");
assertDocumentSearchCriteriaValidation(searchAttribute, ed, TestXMLSearchableAttributeFloat.SEARCH_STORAGE_KEY, ">= " + TestXMLSearchableAttributeFloat.SEARCH_STORAGE_VALUE.toString(), "differ on lower bound inclusivity");
assertDocumentSearchCriteriaValidation(searchAttribute, ed, TestXMLSearchableAttributeFloat.SEARCH_STORAGE_KEY, "> " + TestXMLSearchableAttributeFloat.SEARCH_STORAGE_VALUE.toString(), null);
assertDocumentSearchCriteriaValidation(searchAttribute, ed, TestXMLSearchableAttributeFloat.SEARCH_STORAGE_KEY, "<= " + TestXMLSearchableAttributeFloat.SEARCH_STORAGE_VALUE.toString() + "a", "differ on upper bound inclusivity");
assertDocumentSearchCriteriaValidation(searchAttribute, ed, TestXMLSearchableAttributeFloat.SEARCH_STORAGE_KEY, "< " + TestXMLSearchableAttributeFloat.SEARCH_STORAGE_VALUE.toString() + "a", "does not conform to standard validation for field type.");
assertDocumentSearchCriteriaValidation(searchAttribute, ed, TestXMLSearchableAttributeFloat.SEARCH_STORAGE_KEY, ">= " + TestXMLSearchableAttributeFloat.SEARCH_STORAGE_VALUE.toString() + "*", "differ on lower bound inclusivity");
assertDocumentSearchCriteriaValidation(searchAttribute, ed, TestXMLSearchableAttributeFloat.SEARCH_STORAGE_KEY, "> " + TestXMLSearchableAttributeFloat.SEARCH_STORAGE_VALUE.toString() + "*", "does not conform to standard validation for field type.");
// <searchDefinition dataType="datetime" datePicker="false">
// <rangeDefinition inclusive="false">
// <lower/>
// <upper inclusive="true" datePicker="true"/>
// </rangeDefinition>
// </searchDefinition>
searchAttribute = getAttribute("XMLSearchableAttributeStdDateTimeRange");
ed = createExtensionDefinition("XMLSearchableAttributeStdDateTimeRange");
assertDocumentSearchCriteriaValidation(searchAttribute, ed, TestXMLSearchableAttributeDateTime.SEARCH_STORAGE_KEY, "<= " + DocumentSearchInternalUtils.getDisplayValueWithDateOnly(TestXMLSearchableAttributeDateTime.SEARCH_STORAGE_VALUE), null);
assertDocumentSearchCriteriaValidation(searchAttribute, ed, TestXMLSearchableAttributeDateTime.SEARCH_STORAGE_KEY, ">= 001/5/08", "differ on lower bound inclusivity");
assertDocumentSearchCriteriaValidation(searchAttribute, ed, TestXMLSearchableAttributeDateTime.SEARCH_STORAGE_KEY, "> 001/5/08", null);
error = assertDocumentSearchCriteriaValidation(searchAttribute, ed, TestXMLSearchableAttributeDateTime.SEARCH_STORAGE_KEY, ">= 41/5/08", "differ on lower bound inclusivity");
error = assertDocumentSearchCriteriaValidation(searchAttribute, ed, TestXMLSearchableAttributeDateTime.SEARCH_STORAGE_KEY, "> 41/5/08", "does not conform to standard validation for field type.");
error = assertDocumentSearchCriteriaValidation(searchAttribute, ed, TestXMLSearchableAttributeDateTime.SEARCH_STORAGE_KEY, "<= 01/02/20*", "does not conform to standard validation for field type.");
}
示例3: testFloatRanges
import org.kuali.rice.kew.docsearch.TestXMLSearchableAttributeFloat; //导入依赖的package包/类
@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);
}
示例4: testValidateUserSearchInputs
import org.kuali.rice.kew.docsearch.TestXMLSearchableAttributeFloat; //导入依赖的package包/类
@Test public void testValidateUserSearchInputs() {
String documentTypeName = "SearchDocType";
StandardGenericXMLSearchableAttribute searchAttribute = getAttribute("XMLSearchableAttribute");
ExtensionDefinition ed = createExtensionDefinition("XMLSearchableAttribute");
assertDocumentSearchCriteriaValidation(searchAttribute, ed, TestXMLSearchableAttributeString.SEARCH_STORAGE_KEY, "jack", false);
assertDocumentSearchCriteriaValidation(searchAttribute, ed, TestXMLSearchableAttributeString.SEARCH_STORAGE_KEY, "jack.jack", true);
// NOTE: the original intent of this particular test is unclear. it currently passes since the wildcard character is stripped
assertDocumentSearchCriteriaValidation(searchAttribute, ed, TestXMLSearchableAttributeString.SEARCH_STORAGE_KEY, "jack*jack", false);
searchAttribute = getAttribute("XMLSearchableAttributeStdLong");
ed = createExtensionDefinition("XMLSearchableAttributeStdLong");
assertDocumentSearchCriteriaValidation(searchAttribute, ed, TestXMLSearchableAttributeLong.SEARCH_STORAGE_KEY, TestXMLSearchableAttributeLong.SEARCH_STORAGE_VALUE.toString(), false);
RemotableAttributeError error = assertDocumentSearchCriteriaValidation(searchAttribute, ed, TestXMLSearchableAttributeLong.SEARCH_STORAGE_KEY, TestXMLSearchableAttributeLong.SEARCH_STORAGE_VALUE.toString() + ".33", true);
assertTrue("Validation error is incorrect", error.getMessage().endsWith("does not conform to standard validation for field type."));
error = assertDocumentSearchCriteriaValidation(searchAttribute, ed, TestXMLSearchableAttributeLong.SEARCH_STORAGE_KEY, TestXMLSearchableAttributeLong.SEARCH_STORAGE_VALUE.toString() + "jack*jack", true);
assertTrue("Validation error is incorrect", error.getMessage().endsWith("does not conform to standard validation for field type."));
searchAttribute = getAttribute("XMLSearchableAttributeStdFloat");
ed = createExtensionDefinition("XMLSearchableAttributeStdFloat");
assertDocumentSearchCriteriaValidation(searchAttribute, ed, TestXMLSearchableAttributeFloat.SEARCH_STORAGE_KEY, TestXMLSearchableAttributeFloat.SEARCH_STORAGE_VALUE.toString(), false);
error = assertDocumentSearchCriteriaValidation(searchAttribute, ed, TestXMLSearchableAttributeFloat.SEARCH_STORAGE_KEY, TestXMLSearchableAttributeFloat.SEARCH_STORAGE_VALUE.toString() + "a", true);
assertTrue("Validation error is incorrect", error.getMessage().endsWith("does not conform to standard validation for field type."));
error = assertDocumentSearchCriteriaValidation(searchAttribute, ed, TestXMLSearchableAttributeFloat.SEARCH_STORAGE_KEY, TestXMLSearchableAttributeFloat.SEARCH_STORAGE_VALUE.toString() + "*", true);
assertTrue("Validation error is incorrect", error.getMessage().endsWith("does not conform to standard validation for field type."));
searchAttribute = getAttribute("XMLSearchableAttributeStdCurrency");
ed = createExtensionDefinition("XMLSearchableAttributeStdCurrency");
String key = "testCurrencyKey";
Float value = Float.valueOf("5486.25");
assertDocumentSearchCriteriaValidation(searchAttribute, ed, key, value.toString(), false);
error = assertDocumentSearchCriteriaValidation(searchAttribute, ed, key, value.toString() + "a", true);
assertTrue("Validation error is incorrect", error.getMessage().endsWith("does not conform to standard validation for field type."));
error = assertDocumentSearchCriteriaValidation(searchAttribute, ed, key, value.toString() + "*", true);
assertTrue("Validation error is incorrect", error.getMessage().endsWith("does not conform to standard validation for field type."));
searchAttribute = getAttribute("XMLSearchableAttributeStdDateTime");
ed = createExtensionDefinition("XMLSearchableAttributeStdDateTime");
assertDocumentSearchCriteriaValidation(searchAttribute, ed, TestXMLSearchableAttributeDateTime.SEARCH_STORAGE_KEY, DocumentSearchInternalUtils.getDisplayValueWithDateOnly(TestXMLSearchableAttributeDateTime.SEARCH_STORAGE_VALUE), false);
assertDocumentSearchCriteriaValidation(searchAttribute, ed, TestXMLSearchableAttributeDateTime.SEARCH_STORAGE_KEY, "001/5/08", false);
error = assertDocumentSearchCriteriaValidation(searchAttribute, ed, TestXMLSearchableAttributeDateTime.SEARCH_STORAGE_KEY, "41/5/08", true);
assertTrue("Validation error is incorrect", error.getMessage().endsWith("does not conform to standard validation for field type."));
error = assertDocumentSearchCriteriaValidation(searchAttribute, ed, TestXMLSearchableAttributeDateTime.SEARCH_STORAGE_KEY, "01/02/20*", true);
assertTrue("Validation error is incorrect", error.getMessage().endsWith("does not conform to standard validation for field type."));
}