mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Merged V2.9 to HEAD
8960: Stop tests running if image transformer not available 8991: Fix AR-2099 8993: Fix AR-2099 - fix test fallout git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@9031 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -35,7 +35,6 @@ import org.alfresco.service.cmr.dictionary.AssociationDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.ClassDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||
import org.alfresco.service.cmr.dictionary.InvalidTypeException;
|
||||
import org.alfresco.service.cmr.dictionary.ModelDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.PropertyDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.TypeDefinition;
|
||||
@@ -199,12 +198,12 @@ public class DictionaryComponent implements DictionaryService, TenantDeployer
|
||||
ClassDefinition classDef = getClass(className);
|
||||
if (classDef == null)
|
||||
{
|
||||
throw new InvalidTypeException(className);
|
||||
return false;
|
||||
}
|
||||
ClassDefinition ofClassDef = getClass(ofClassName);
|
||||
if (ofClassDef == null)
|
||||
{
|
||||
throw new InvalidTypeException(ofClassName);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Only check if both ends are either a type or an aspect
|
||||
|
@@ -44,7 +44,6 @@ import org.alfresco.service.cmr.dictionary.Constraint;
|
||||
import org.alfresco.service.cmr.dictionary.ConstraintDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||
import org.alfresco.service.cmr.dictionary.InvalidTypeException;
|
||||
import org.alfresco.service.cmr.dictionary.ModelDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.PropertyDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.TypeDefinition;
|
||||
@@ -311,19 +310,15 @@ public class DictionaryDAOTest extends TestCase
|
||||
QName referenceable = QName.createQName(TEST_URL, "referenceable");
|
||||
|
||||
// Test invalid args
|
||||
try
|
||||
{
|
||||
service.isSubClass(invalid, referenceable);
|
||||
fail("Failed to catch invalid class parameter");
|
||||
}
|
||||
catch(InvalidTypeException e) {}
|
||||
|
||||
try
|
||||
{
|
||||
service.isSubClass(referenceable, invalid);
|
||||
fail("Failed to catch invalid class parameter");
|
||||
}
|
||||
catch(InvalidTypeException e) {}
|
||||
boolean testI1 = service.isSubClass(invalid, referenceable);
|
||||
|
||||
assertFalse(testI1);
|
||||
|
||||
boolean testI2 = service.isSubClass(referenceable, invalid);
|
||||
assertFalse(testI2);
|
||||
|
||||
boolean testI3 = service.isSubClass(invalid, invalid);
|
||||
assertFalse(testI3);
|
||||
|
||||
// Test various flavours of subclassof
|
||||
boolean test1 = service.isSubClass(file, referenceable); // type vs aspect
|
||||
|
@@ -43,7 +43,6 @@ import org.alfresco.service.cmr.repository.ContentService;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.repository.StoreRef;
|
||||
import org.alfresco.service.cmr.search.ResultSet;
|
||||
import org.alfresco.service.cmr.search.SearchService;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.service.transaction.TransactionService;
|
||||
@@ -236,28 +235,31 @@ public class DictionaryRepositoryBootstrap extends AbstractLifecycleBean impleme
|
||||
continue; // skip this location
|
||||
}
|
||||
|
||||
if (repositoryLocation.getQueryLanguage().equals(SearchService.LANGUAGE_LUCENE))
|
||||
if (repositoryLocation.getQueryLanguage().equals(SearchService.LANGUAGE_XPATH))
|
||||
{
|
||||
ResultSet rs = searchService.query(storeRef,
|
||||
SearchService.LANGUAGE_LUCENE,
|
||||
repositoryLocation.getLuceneQueryStatement(ContentModel.TYPE_DICTIONARY_MODEL.getPrefixedQName(namespaceService)));
|
||||
if (rs.length() > 0)
|
||||
{
|
||||
for (NodeRef dictionaryModel : rs.getNodeRefs())
|
||||
NodeRef rootNode = nodeService.getRootNode(storeRef);
|
||||
|
||||
List<NodeRef> nodeRefs = searchService.selectNodes(rootNode,
|
||||
repositoryLocation.getXPathQueryStatement(ContentModel.TYPE_DICTIONARY_MODEL.getPrefixedQName(namespaceService)),
|
||||
null,
|
||||
namespaceService,
|
||||
false);
|
||||
|
||||
for (NodeRef dictionaryModel : nodeRefs)
|
||||
{
|
||||
// Ignore if the node is a working copy or if its inactive
|
||||
if (nodeService.hasAspect(dictionaryModel, ContentModel.ASPECT_WORKING_COPY) == false)
|
||||
{
|
||||
// Ignore if the node is a working copy or if its inactive
|
||||
if (nodeService.hasAspect(dictionaryModel, ContentModel.ASPECT_WORKING_COPY) == false)
|
||||
Boolean isActive = (Boolean)nodeService.getProperty(dictionaryModel, ContentModel.PROP_MODEL_ACTIVE);
|
||||
|
||||
if ((isActive != null) && (isActive.booleanValue() == true))
|
||||
{
|
||||
Boolean isActive = (Boolean)nodeService.getProperty(dictionaryModel, ContentModel.PROP_MODEL_ACTIVE);
|
||||
if ((isActive != null) && (isActive.booleanValue() == true))
|
||||
M2Model model = createM2Model(dictionaryModel);
|
||||
if (model != null)
|
||||
{
|
||||
M2Model model = createM2Model(dictionaryModel);
|
||||
if (model != null)
|
||||
for (M2Namespace namespace : model.getNamespaces())
|
||||
{
|
||||
for (M2Namespace namespace : model.getNamespaces())
|
||||
{
|
||||
modelMap.put(namespace.getUri(), model);
|
||||
}
|
||||
modelMap.put(namespace.getUri(), model);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -287,7 +289,6 @@ public class DictionaryRepositoryBootstrap extends AbstractLifecycleBean impleme
|
||||
for (RepositoryLocation repositoryLocation : this.repositoryMessagesLocations)
|
||||
{
|
||||
StoreRef storeRef = repositoryLocation.getStoreRef();
|
||||
String path = repositoryLocation.getPath();
|
||||
|
||||
if (! nodeService.exists(storeRef))
|
||||
{
|
||||
@@ -295,34 +296,28 @@ public class DictionaryRepositoryBootstrap extends AbstractLifecycleBean impleme
|
||||
continue; // skip this location
|
||||
}
|
||||
|
||||
if (repositoryLocation.getQueryLanguage().equals(SearchService.LANGUAGE_LUCENE))
|
||||
if (repositoryLocation.getQueryLanguage().equals(SearchService.LANGUAGE_XPATH))
|
||||
{
|
||||
ResultSet rs = searchService.query(storeRef,
|
||||
SearchService.LANGUAGE_LUCENE,
|
||||
repositoryLocation.getLuceneQueryStatement(ContentModel.TYPE_CONTENT.getPrefixedQName(namespaceService)));
|
||||
if (rs.length() > 0)
|
||||
{
|
||||
List<String> resourceBundleBaseNames = new ArrayList<String>();
|
||||
for (NodeRef messageResource : rs.getNodeRefs())
|
||||
{
|
||||
String resourceName = (String) nodeService.getProperty(
|
||||
messageResource, ContentModel.PROP_NAME);
|
||||
|
||||
String bundleBaseName = messageService.getBaseBundleName(resourceName);
|
||||
|
||||
if (!resourceBundleBaseNames.contains(bundleBaseName))
|
||||
{
|
||||
resourceBundleBaseNames.add(bundleBaseName);
|
||||
}
|
||||
}
|
||||
NodeRef rootNode = nodeService.getRootNode(storeRef);
|
||||
|
||||
List<NodeRef> nodeRefs = searchService.selectNodes(rootNode,
|
||||
repositoryLocation.getXPathQueryStatement(ContentModel.TYPE_CONTENT.getPrefixedQName(namespaceService)),
|
||||
null,
|
||||
namespaceService,
|
||||
false);
|
||||
|
||||
List<String> resourceBundleBaseNames = new ArrayList<String>();
|
||||
|
||||
for (NodeRef messageResource : nodeRefs)
|
||||
{
|
||||
String resourceName = (String) nodeService.getProperty(
|
||||
messageResource, ContentModel.PROP_NAME);
|
||||
|
||||
// Only need to register resource bundle names
|
||||
for (String resourceBundleBaseName : resourceBundleBaseNames)
|
||||
String bundleBaseName = messageService.getBaseBundleName(resourceName);
|
||||
|
||||
if (!resourceBundleBaseNames.contains(bundleBaseName))
|
||||
{
|
||||
logger.info("Register bundle: " + resourceBundleBaseName);
|
||||
|
||||
messageService.registerResourceBundle(storeRef.toString() + path + "/cm:" + resourceBundleBaseName);
|
||||
|
||||
resourceBundleBaseNames.add(bundleBaseName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -110,7 +110,7 @@ public class DictionaryRepositoryBootstrapTest extends BaseAlfrescoSpringTest
|
||||
RepositoryLocation location = new RepositoryLocation();
|
||||
location.setStoreProtocol(this.storeRef.getProtocol());
|
||||
location.setStoreId(this.storeRef.getIdentifier());
|
||||
location.setQueryLanguage(SearchService.LANGUAGE_LUCENE);
|
||||
location.setQueryLanguage(SearchService.LANGUAGE_XPATH);
|
||||
// NOTE: we are not setting the path for now .. in doing so we are searching the whole dictionary
|
||||
|
||||
List<RepositoryLocation> locations = new ArrayList<RepositoryLocation>();
|
||||
|
Reference in New Issue
Block a user