本文整理汇总了Java中org.kuali.rice.kew.docsearch.TestXMLSearchableAttributeLong类的典型用法代码示例。如果您正苦于以下问题:Java TestXMLSearchableAttributeLong类的具体用法?Java TestXMLSearchableAttributeLong怎么用?Java TestXMLSearchableAttributeLong使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TestXMLSearchableAttributeLong类属于org.kuali.rice.kew.docsearch包,在下文中一共展示了TestXMLSearchableAttributeLong类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUpSearchableDoc
import org.kuali.rice.kew.docsearch.TestXMLSearchableAttributeLong; //导入依赖的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: testXMLStandardSearchableAttributeWithInvalidValue
import org.kuali.rice.kew.docsearch.TestXMLSearchableAttributeLong; //导入依赖的package包/类
@Test public void testXMLStandardSearchableAttributeWithInvalidValue() throws Exception {
String documentTypeName = "SearchDocTypeStandardSearchDataType";
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 value in what should be a long searchable attribute
WorkflowAttributeDefinition.Builder longXMLDef = WorkflowAttributeDefinition.Builder.create("XMLSearchableAttributeStdLong");
longXMLDef.addPropertyDefinition(TestXMLSearchableAttributeLong.SEARCH_STORAGE_KEY, "123x23");
workflowDocument.addSearchableDefinition(longXMLDef.build());
workflowDocument.setTitle("Routing style");
try {
workflowDocument.route("routing this document.");
fail("Document should be unroutable with invalid searchable attribute value");
} catch (Exception e) {
e.printStackTrace();
}
/*
* The call to TestUtilities below is needed because when exception routing spawns a new thread (see
* TestExceptionRoutingServiceImpl class) the next test will begin before the exception thread is complete and
* cause errors. This was originally discovered because the test method
* testXMLStandardSearchableAttributesWithDataType() would run and get errors loading xml data for workgroups
* perhaps because the exception thread was keeping the cache around and now allowing it to be cleared?
*/
TestUtilities.waitForExceptionRouting();
}
示例3: testValidateUserSearchRangeInputs
import org.kuali.rice.kew.docsearch.TestXMLSearchableAttributeLong; //导入依赖的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.");
}
示例4: testLongRanges
import org.kuali.rice.kew.docsearch.TestXMLSearchableAttributeLong; //导入依赖的package包/类
@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);
}
示例5: testDocumentSearchAttributeWildcardingDisallow
import org.kuali.rice.kew.docsearch.TestXMLSearchableAttributeLong; //导入依赖的package包/类
@Test public void testDocumentSearchAttributeWildcardingDisallow() throws Exception {
DocumentSearchService docSearchService = (DocumentSearchService) KEWServiceLocator.getService(KEWServiceLocator.DOCUMENT_SEARCH_SERVICE);
String documentTypeName = "SearchDocTypeStandardSearchDataType";
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.
*/
WorkflowAttributeDefinition.Builder longXMLDef = WorkflowAttributeDefinition.Builder.create("XMLSearchableAttributeStdLong");
longXMLDef.addPropertyDefinition(TestXMLSearchableAttributeLong.SEARCH_STORAGE_KEY, TestXMLSearchableAttributeLong.SEARCH_STORAGE_VALUE.toString());
workflowDocument.addSearchableDefinition(longXMLDef.build());
workflowDocument.setTitle("Routing style");
workflowDocument.route("routing this document.");
Person user = KimApiServiceLocator.getPersonService().getPersonByPrincipalName(userNetworkId);
String validSearchValue = TestXMLSearchableAttributeLong.SEARCH_STORAGE_VALUE.toString();
DocumentSearchCriteria.Builder criteria = null;
DocumentSearchResults results = null;
criteria = DocumentSearchCriteria.Builder.create();
criteria.setDocumentTypeName(documentTypeName);
addSearchableAttribute(criteria, TestXMLSearchableAttributeLong.SEARCH_STORAGE_KEY, validSearchValue);
results = docSearchService.lookupDocuments(user.getPrincipalId(), criteria.build());
assertEquals("Search results should have one document.", 1, results.getSearchResults().size());
criteria = DocumentSearchCriteria.Builder.create();
criteria.setDocumentTypeName(documentTypeName);
addSearchableAttribute(criteria, TestXMLSearchableAttributeLong.SEARCH_STORAGE_KEY,
"*" + validSearchValue.substring(2));
if ((new SearchableAttributeLongValue()).allowsWildcards()) {
results = docSearchService.lookupDocuments(user.getPrincipalId(), criteria.build());
assertEquals("Search results should be empty using wildcard '*' value.", 0, results.getSearchResults().size());
} else {
try {
docSearchService.lookupDocuments(user.getPrincipalId(), criteria.build());
fail("Search results should be throwing a validation exception for use of the character '*' without allowing wildcards");
} catch (WorkflowServiceErrorException wsee) {}
}
criteria = DocumentSearchCriteria.Builder.create();
criteria.setDocumentTypeName(documentTypeName);
addSearchableAttribute(criteria, TestXMLSearchableAttributeLong.SEARCH_STORAGE_KEY, validSearchValue.substring(
0, (validSearchValue.length() - 2)));
results = docSearchService.lookupDocuments(user.getPrincipalId(), criteria.build());
assertEquals("Search results should be empty trying to use assumed ending wildcard.", 0, results.getSearchResults().size());
}
示例6: testValidateUserSearchInputs
import org.kuali.rice.kew.docsearch.TestXMLSearchableAttributeLong; //导入依赖的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."));
}