mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Support 'alf_prop_string_value'
- Simple ID-string table - Non-unique and case-sensitive, but with re-use of entries as far as possible git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@15430 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -118,4 +118,54 @@ public class PropertyValueDAOTest extends TestCase
|
||||
};
|
||||
txnHelper.doInTransaction(noHitCallback, false);
|
||||
}
|
||||
|
||||
public void testPropertyStringValue() throws Exception
|
||||
{
|
||||
final String stringValue = "One Two Three";
|
||||
final String stringValueUpper = stringValue.toUpperCase();
|
||||
final String stringValueLower = stringValue.toLowerCase();
|
||||
RetryingTransactionCallback<Pair<Long, String>> createStringCallback = new RetryingTransactionCallback<Pair<Long, String>>()
|
||||
{
|
||||
public Pair<Long, String> execute() throws Throwable
|
||||
{
|
||||
// Get the classes
|
||||
return propertyValueDAO.getOrCreatePropertyStringValue(stringValue);
|
||||
}
|
||||
};
|
||||
final Pair<Long, String> stringEntityPair = txnHelper.doInTransaction(createStringCallback, false);
|
||||
assertNotNull(stringEntityPair);
|
||||
assertNotNull(stringEntityPair.getFirst());
|
||||
assertEquals(stringValue, stringEntityPair.getSecond());
|
||||
|
||||
// Check that the uppercase and lowercase strings don't have entries
|
||||
RetryingTransactionCallback<Void> getClassCallback = new RetryingTransactionCallback<Void>()
|
||||
{
|
||||
public Void execute() throws Throwable
|
||||
{
|
||||
Pair<Long, String> checkPair1 = propertyValueDAO.getPropertyStringValue(stringValue);
|
||||
assertNotNull(checkPair1);
|
||||
assertEquals(stringValue, checkPair1.getSecond());
|
||||
Pair<Long, String> checkPair2 = propertyValueDAO.getPropertyStringValue(stringValueUpper);
|
||||
assertNull(checkPair2);
|
||||
Pair<Long, String> checkPair3 = propertyValueDAO.getPropertyStringValue(stringValueLower);
|
||||
assertNull(checkPair3);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
txnHelper.doInTransaction(getClassCallback, true);
|
||||
|
||||
RetryingTransactionCallback<Pair<Long, String>> createStringUpperCallback = new RetryingTransactionCallback<Pair<Long, String>>()
|
||||
{
|
||||
public Pair<Long, String> execute() throws Throwable
|
||||
{
|
||||
// Get the classes
|
||||
return propertyValueDAO.getOrCreatePropertyStringValue(stringValueUpper);
|
||||
}
|
||||
};
|
||||
final Pair<Long, String> stringUpperEntityPair = txnHelper.doInTransaction(createStringUpperCallback, false);
|
||||
assertNotNull(stringUpperEntityPair);
|
||||
assertNotNull(stringUpperEntityPair.getFirst());
|
||||
assertEquals(stringValueUpper, stringUpperEntityPair.getSecond());
|
||||
assertNotSame("String IDs were not different", stringEntityPair.getFirst(), stringUpperEntityPair.getFirst());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user