mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Explicitly set locale for the index tests.
Correctly find the locale if set on the thread locale via I18utils git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5719 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -41,6 +41,7 @@ import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.alfresco.i18n.I18NUtil;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.content.MimetypeMap;
|
||||
import org.alfresco.repo.content.transform.ContentTransformer;
|
||||
@@ -801,7 +802,7 @@ public class ADMLuceneIndexerImpl extends AbstractLuceneIndexerImpl<NodeRef> imp
|
||||
}
|
||||
if (locale == null)
|
||||
{
|
||||
locale = Locale.getDefault();
|
||||
locale = I18NUtil.getLocale();
|
||||
}
|
||||
doc.add(new Field(attributeName + ".locale", locale.toString().toLowerCase(), Field.Store.NO,
|
||||
Field.Index.UN_TOKENIZED, Field.TermVector.NO));
|
||||
@@ -977,7 +978,7 @@ public class ADMLuceneIndexerImpl extends AbstractLuceneIndexerImpl<NodeRef> imp
|
||||
|
||||
if (locale == null)
|
||||
{
|
||||
locale = Locale.getDefault();
|
||||
locale = I18NUtil.getLocale();
|
||||
}
|
||||
if (tokenise)
|
||||
{
|
||||
|
@@ -44,6 +44,7 @@ import javax.transaction.UserTransaction;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.alfresco.i18n.I18NUtil;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.dictionary.DictionaryDAO;
|
||||
import org.alfresco.repo.dictionary.DictionaryNamespaceComponent;
|
||||
@@ -208,6 +209,8 @@ public class ADMLuceneTest extends TestCase
|
||||
|
||||
namespaceDao = (NamespaceDAOImpl) ctx.getBean("namespaceDAO");
|
||||
|
||||
I18NUtil.setLocale(Locale.UK);
|
||||
|
||||
this.authenticationComponent = (AuthenticationComponent) ctx.getBean("authenticationComponent");
|
||||
|
||||
queryRegisterComponent.loadQueryCollection("testQueryRegister.xml");
|
||||
@@ -216,6 +219,8 @@ public class ADMLuceneTest extends TestCase
|
||||
|
||||
testTX = transactionService.getUserTransaction();
|
||||
testTX.begin();
|
||||
|
||||
|
||||
this.authenticationComponent.setSystemUserAsCurrentUser();
|
||||
|
||||
// load in the test model
|
||||
@@ -311,7 +316,7 @@ public class ADMLuceneTest extends TestCase
|
||||
// - andit has to go in type d:any as d:content is not allowed to be multivalued
|
||||
|
||||
ArrayList<Serializable> contentValues = new ArrayList<Serializable>();
|
||||
contentValues.add(new ContentData(null, "text/plain", 0L, "UTF-16"));
|
||||
contentValues.add(new ContentData(null, "text/plain", 0L, "UTF-16", Locale.CHINESE ));
|
||||
testProperties.put(QName.createQName(TEST_NAMESPACE, "content-many-ista"), contentValues);
|
||||
|
||||
|
||||
@@ -376,7 +381,7 @@ public class ADMLuceneTest extends TestCase
|
||||
getOrderProperties()).getChildRef();
|
||||
|
||||
Map<QName, Serializable> properties = new HashMap<QName, Serializable>();
|
||||
properties.put(ContentModel.PROP_CONTENT, new ContentData(null, "text/plain", 0L, "UTF-8"));
|
||||
properties.put(ContentModel.PROP_CONTENT, new ContentData(null, "text/plain", 0L, "UTF-8", Locale.CHINESE ));
|
||||
n14 = nodeService.createNode(n13, ASSOC_TYPE_QNAME, QName.createQName("{namespace}fourteen"),
|
||||
ContentModel.TYPE_CONTENT, properties).getChildRef();
|
||||
// nodeService.addAspect(n14, DictionaryBootstrap.ASPECT_QNAME_CONTENT,
|
||||
|
@@ -40,6 +40,7 @@ import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.alfresco.i18n.I18NUtil;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.model.WCMModel;
|
||||
import org.alfresco.repo.avm.AVMDAOs;
|
||||
@@ -639,7 +640,7 @@ public class AVMLuceneIndexerImpl extends AbstractLuceneIndexerImpl<String> impl
|
||||
// No default locale in AVM
|
||||
if (locale == null)
|
||||
{
|
||||
locale = Locale.getDefault();
|
||||
locale = I18NUtil.getLocale();
|
||||
}
|
||||
doc.add(new Field(attributeName + ".locale", locale.toString().toLowerCase(), Field.Store.NO,
|
||||
Field.Index.UN_TOKENIZED, Field.TermVector.NO));
|
||||
@@ -806,7 +807,7 @@ public class AVMLuceneIndexerImpl extends AbstractLuceneIndexerImpl<String> impl
|
||||
|
||||
if (locale == null)
|
||||
{
|
||||
locale = Locale.getDefault();
|
||||
locale = I18NUtil.getLocale();
|
||||
}
|
||||
if (tokenise)
|
||||
{
|
||||
|
Reference in New Issue
Block a user