mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Merged DEV/SWIFT to HEAD
27600: ALF-8522: MyBatis: Performance: ensure <association> elements are properly keyed 27608: RINF 09 / RINF 10: DB-based paged query for get children (DocLib & CMIS) - update FileFolder paging API - update GetChildren canned query sorting (to return sort props prior to batched pre-load) 27614: RINF 09 / RINF 10: DB-based paged query for get children (DocLib & CMIS) - add missing file (and fix my SmartSVN ignore unversioned list ;-) - follow-on to r27608 27621: RINF 11: Extended generalized CannedQueryDAO to support common selects - MyBatis resultset termination included - RINF 11: Integrate existing CannedQueryDAO (ALF-8417) - RINF 11: Canned queries (ALF-7167) 27623: RINF 09 / RINF 10: DB-based paged query for get children (DocLib & CMIS) - if total count not requested then can cut-off permission checks (based on max items) and instead set "hasMore" flag (if applicable) - now used by Share DocLib folder tree listing (on LHS) - see ALF-6570 27636: RINF 09 / RINF 10: DB-based getChildren - improvements to treenode (push down sort by name, get subfolders with max 1, remove redundant max check) - re: ALF-6570 - add default child assoc sort (if no sort requested) - minor tweak to getChildren CQ trace logging 27641: RINF 11: Extended generalized CannedQueryDAO - add temporary MyBatis workarounds for ResultHandler-based queries --> support unlimited queries for nested results maps (MyBatis #129) --> clear cache to return results on subsequent calls (MyBatis #58 ...) 27642: RINF 16: Ordered associations: Added NodeService.setAssociations - All reordering, deleting and adding node by NodeService impl. - ALF-7405 (ALF-7404 RINF 16: Peer association enhancements) 27643: ALF-8183 SVC 01: I18N List of values constraint. Added ListOfValuesConstraint.getDisplayLabel(constraintAllowableValue) method which uses the usual I18NUtil methods to retrieve a localised display-label for the LoV constraint values. These can be added to resource bundles in the usual way using a key as follows: listconstraint.test_list1.ABC=ABC display where "listconstraint." is a fixed prefix. "test_list1" is the shortform QName for the constraint with colon replaced by underscore. "ABC" is one of the allowed values for the named constraint. The test case changes & the associated model & property changes should make things clear. 27644: Test cases for ChannelService.createChannel and ChannelService.getChannels 27645: ALF-8183. I18N LIST constraint. This check-in ensures that requests for a LIST.value display label for: a non-existent value returns null an unlocalised value returns the allowableValue String from the model (backwards compatibility). 27651: Fixing compile errors caused by moving NodeLocator classes. 27652: RINF 09 / RINF 10: DB-based getChildren CQ - replace direct use of "sqlSessionTemplate" with "cannedQueryDAO"(RINF 11) 27657: RINF 09: GetChildren CQ - temp fix for cm:modified (when qname does not exist) - TODO review 27666: Support for ALF-8594: RSOLR 039: SOLR sorting - sorting for all single valued types 27671: Ignore virtual tomcat build 27673: Projects core, datamodel and solr now explicitly list their library dependencies and no longer include the 3rd party project 27681: Added pub:channelInfo aspect tows:webasset and ws:section. Also ws:website now extends pub:DeliveryChannel. Added new behaviours to section and website to ensure the channel info is populated. 27682: Added example SOLR config dir and instructions on how to set up - simple dev set up only subject to lots of change 27685: Cleanup: Removed non-javadoc; Removed unused methods; Added @override 27689: Update SOLR test instance dependencies 27692: ALF-8183 SVC 01: I18N Lost of values constraint. Added code to the FormService's PropertyFieldProcessor so that the allowedValues for a ListOfValuesConstraint have both the allowed value and its localised display label, if there is one. Added English property values for the bpm:allowedStatus constraint and also for the LIST constraint in the FDK. 27693: WCM-QS ML work - Have the webscript return more details on the node and its parents, and begin to use this in the UI to allow you to create as well as manage translations 27695: Workaround/fix for ALF-5747. Incompatibilities with OpenOffice 3.3 It looks like OOo 3.3.0 shipped with a missing component. The ConfigurationRegistry, which is used to remotely query the OOo version, was not implemented in 3.3.0 and therefore gives an ugly (and unavoidable) exception on OOo startup. There's not much we can do here, beyond getting users to upgrade their OOo install. I've added a catch clause that detects this problem and emits a slightly friendlier warning to the log. 27720: ALF-8532: WPUB: F148: Foundation API: Request that a node be published to the live environment 27727: Removed duplicates 27734: WCM-QS ML Updates to handle marking a node as an initial translation, and a start on creating translations 27735: Fixed generics warning 27736: Added PermissionService.getReaders(List<Long> aclIds) - Support for ALF-8335: RSOLR 013: DAOs and remote APIs for ACL changesets (ALF-7072) - Also cleaned up empty javadoc 27739: Implemented NodeFilters and NodeFinders for AbstractChannelType and ChannelServiceImpl. 27741: RINF 09: GetChildren CQ - fix sorting - with unit tests (for default Share DocLib fields) - partial ALF-8638 - ALF-8584 (follow-on for r27657) 27746: Start on linking the WCM-QS ML ui and the forms service for creating the translation 27747: Added --INCLUDE: directive to SQL scripts to allow importing of DB-specific snippets - ALF-8498: SVC 06: Property holding comment count for a node 27748: Web scripts for ACLs and ACL readers - Unit tests at all levels (Webscripts, Service and DAO) - Tweaks to the DB queries to support index-based sorting - Support for ALF-8335: RSOLR 013: DAOs and remote APIs for ACL changesets (ALF-7072) 27753: Fixed enum naming 27754: Undo changes to ChannelServiceImplIntegratedTest made in 27739 that broke the build 27762: Part I: ALF-7992: RSOLR 024: Locale support for query: SOLR - restructure and split localisation from generic query parsing - Lucene impl migrated and tested - No SOLR impl yet - Fix CMIS QueyTest - Fix references for LuceneQueryParser mostly to AbstractLuceneQueryParser 27763: Initial implementation of ALF-8498. SVC 06: Property holding comment count for a node. This check-in adds a rollup property to hold the commentCount (fm:commentCount under fm:discussable). It adds registered behaviours for fm:post deletion/creation that will decrement/increment the commentCount for the discussable ancestor node. I've also added a new test class to test this rollup property. There was no existing test class at this level and indeed there is no CommentService or DiscussionService. Instead the REST API of comment.put.desc.xml uses the ScriptNodeService to create the correct node structure. Therefore the test code has had to do the same thing. 27766: Slight reimpl of ALF-8498. Moved the rollup property onto its own aspect. So now we have fm:discussable, as before, for generic discussions and posts (including Explorer comments). And we have fm:commentsRollup which is only for rolling up Share comments. 27777: WCM QS ML Forms config and related tweaks to support having newly created nodes made multilingual where required 27781: Add repository project dependency for test context and debug - fixes model issue with SOLRAPIClientTest 27782: SOLR - move back to dynamic catch all field which seems to be working -> simpler build and model management 27810: ALF-8405 SiteAspect needs to handle child types of Site as well as Site itself 27821: ALF-7070: Fixed SOLRSerializer to handle residual properties (not in dictionary) 27828: RINF 11: Canned Queries (CQ) - update API post review . - add underlying pageRequest/pageResult for single page (or max items if skip is 0) - add hasMoreItems (ALF-8470) and update unit tests - return total count range - accurate count (if lower=upper), approximation (lower<upper) or more than (lower known, upper unknown) - update option to request total count with max (if cutoff/trimmed then returns unknown upper count) 27829: RINF 09: GetChildren CQ - paging support for FileFolderService list - update impl wrt CQ API changes (follow-on to r27828) - add factory method to return CQ with common params & update FileFolderService - update CMIS getChildren (AlrescoCmisService) - update scripting layer (ScriptNode, ScriptPagingNodes) - update Share DocLib (including doclist & treenode) - ALF-8641 - add proto (UI subject to review) to demo Share DocLib requesting max total count (eg. "Showing items 1 - 50 of 1000++") 27837: Moving the pdfbox, fontbox, jempbox libs from 1.3.1 to 1.5.0, which adds various bugfixes. 27838: Web scripts for ACLs and ACL readers - Simplification of paging API for ACLs - Support for ALF-8335: RSOLR 013: DAOs and remote APIs for ACL changesets (ALF-7072) 27839: SOLR ACL tracking client code and tests - Support for ALF-8335: RSOLR 013: ACL changesets client APIs (ALF-8463) 27844: Build fix. Making SiteServiceImplTest more tolerant of preexisting sites. 27845: Build fix. Making SiteServiceTest more tolerant of preexisting sites in databse. 27846: Build fix relating to ALF-8183. An extra test constraint requires an increment to a assertion expectedValue in this test. 27849: ALF-8532: WPUB: F148: Foundation API: Request that a node be published to the live environment - Added more necessary interfaces and framework code 27850: RINF 09: GetChildren CQ - update sorting unit test + fixes - nulls sort 'low' - fix multi sort props 27858: ALF-8532: WPUB: F148: Foundation API: Request that a node be published to the live environment - Initial cut of persisting publishing events (not tested yet) 27861: WCM QS ML webscript work - fix some issues, and start on webscript unit test Also updates a failing test with details of why it's failing (switch from JSON to XML some time ago) 27864: Fix context minimal tests - web publishing context is already included from the high level context, and shouldn't be in the core one 27867: ALF-8184: SVC 02: Encode and decode of forms itemId should be done in the REST layer and not in each individual form processor. 27868: Sample Adobe Illustrator files from Linton, for use in testing future metadata/transformer support 27869: Fixed ChannelServiceImplTest failures. 27870: Created JBPM process definition to publish scheduled Publishing Events. 27872: Sample Adobe Illustrator 3 file (PS not PDF based) from Linton, for use in testing future metadata/transformer support 27874: OpenCMIS update 27875: Change the Tika auto transformer to register aliases of mime types, as well as the canonical ones, for when Alfresco uses the alias 27876: RINF 11: Permission checking in canned queries (ALF-8419) 27877: RINF 39: Optimise GetChildren CQ for unsorted maxItems (ALF-8576) 27878: RINF 09: Update FileFolderService - all list methods should use GetChildren CQ (ALF-8733) 27882: ALF-8532: WPUB: F148: Foundation API: Request that a node be published to the live environment - Unit test for the publishing package serializer/deserializer 27885: Change order of publishing context so it comes after transfer service context. 27886: Fix for ALF-7992: RSOLR 024: Locale support for query: SOLR - d:mltext, d:text. d:content - phrase, term, prefix, wild, ranges, fuzzy etc - localised tokenisation - consistent tokenisation for cross language support ( phrase, term, prefix, wild, ranges, fuzzy etc) - CMIS related stuff to be tested later 27897: Minor tweak to prevent repeated gets of the default locale when writing properties 27900: WCM QS ML webscript tests 27905: Fixed PostgreSQL HeartbeatTest: WorkflowDeployer was checking for read-only server too late 27906: Remove unused imports 27907: Used common SQL snippets for DB2 node inserts. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@28319 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
125
source/java/org/alfresco/repo/web/scripts/solr/AclsGet.java
Normal file
125
source/java/org/alfresco/repo/web/scripts/solr/AclsGet.java
Normal file
@@ -0,0 +1,125 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2011 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.repo.web.scripts.solr;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.repo.solr.Acl;
|
||||
import org.alfresco.repo.solr.SOLRTrackingComponent;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.springframework.extensions.surf.util.Content;
|
||||
import org.springframework.extensions.webscripts.DeclarativeWebScript;
|
||||
import org.springframework.extensions.webscripts.Status;
|
||||
import org.springframework.extensions.webscripts.WebScriptException;
|
||||
import org.springframework.extensions.webscripts.WebScriptRequest;
|
||||
|
||||
/**
|
||||
* Support for SOLR: Track ACLs
|
||||
*
|
||||
* @since 4.0
|
||||
*/
|
||||
public class AclsGet extends DeclarativeWebScript
|
||||
{
|
||||
protected static final Log logger = LogFactory.getLog(AclsGet.class);
|
||||
|
||||
private SOLRTrackingComponent solrTrackingComponent;
|
||||
|
||||
public void setSolrTrackingComponent(SOLRTrackingComponent solrTrackingComponent)
|
||||
{
|
||||
this.solrTrackingComponent = solrTrackingComponent;
|
||||
}
|
||||
|
||||
protected Map<String, Object> executeImpl(WebScriptRequest req, Status status)
|
||||
{
|
||||
try
|
||||
{
|
||||
Map<String, Object> model = buildModel(req);
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Result: \n\tRequest: " + req + "\n\tModel: " + model);
|
||||
}
|
||||
return model;
|
||||
}
|
||||
catch(IOException e)
|
||||
{
|
||||
throw new WebScriptException("IO exception parsing request", e);
|
||||
}
|
||||
catch(JSONException e)
|
||||
{
|
||||
throw new WebScriptException("Invalid JSON", e);
|
||||
}
|
||||
}
|
||||
|
||||
private Map<String, Object> buildModel(WebScriptRequest req) throws JSONException, IOException
|
||||
{
|
||||
List<Long> aclChangeSetIds = null;
|
||||
|
||||
Content content = req.getContent();
|
||||
if (content == null)
|
||||
{
|
||||
throw new WebScriptException("Request content is empty");
|
||||
}
|
||||
JSONObject o = new JSONObject(content.getContent());
|
||||
JSONArray aclChangeSetIdsJSON = o.has("aclChangeSetIds") ? o.getJSONArray("aclChangeSetIds") : null;
|
||||
if (aclChangeSetIdsJSON == null)
|
||||
{
|
||||
throw new WebScriptException(
|
||||
Status.STATUS_BAD_REQUEST,
|
||||
"Parameter 'aclChangeSetIds' not provided in request content.");
|
||||
}
|
||||
else if (aclChangeSetIdsJSON.length() == 0 || aclChangeSetIdsJSON.length() > 512)
|
||||
{
|
||||
throw new WebScriptException(
|
||||
Status.STATUS_BAD_REQUEST,
|
||||
"Parameter 'aclChangeSetIds' must hold from 1 to 512 IDs.");
|
||||
}
|
||||
aclChangeSetIds = new ArrayList<Long>(aclChangeSetIdsJSON.length());
|
||||
for (int i = 0; i < aclChangeSetIdsJSON.length(); i++)
|
||||
{
|
||||
aclChangeSetIds.add(aclChangeSetIdsJSON.getLong(i));
|
||||
}
|
||||
|
||||
String fromIdParam = req.getParameter("fromId");
|
||||
String maxResultsParam = req.getParameter("maxResults");
|
||||
|
||||
Long fromId = (fromIdParam == null ? null : Long.valueOf(fromIdParam));
|
||||
int maxResults = (maxResultsParam == null ? 1024 : Integer.valueOf(maxResultsParam));
|
||||
|
||||
// Request according to the paging query style required
|
||||
List<Acl> acls = solrTrackingComponent.getAcls(aclChangeSetIds, fromId, maxResults);
|
||||
|
||||
Map<String, Object> model = new HashMap<String, Object>(1, 1.0f);
|
||||
model.put("acls", acls);
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Result: \n\tRequest: " + req + "\n\tModel: " + model);
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
}
|
@@ -0,0 +1,119 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2011 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.repo.web.scripts.solr;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.repo.solr.AclReaders;
|
||||
import org.alfresco.repo.solr.SOLRTrackingComponent;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.springframework.extensions.surf.util.Content;
|
||||
import org.springframework.extensions.webscripts.DeclarativeWebScript;
|
||||
import org.springframework.extensions.webscripts.Status;
|
||||
import org.springframework.extensions.webscripts.WebScriptException;
|
||||
import org.springframework.extensions.webscripts.WebScriptRequest;
|
||||
|
||||
/**
|
||||
* Support for SOLR: Track ACLs
|
||||
*
|
||||
* @since 4.0
|
||||
*/
|
||||
public class AclsReadersGet extends DeclarativeWebScript
|
||||
{
|
||||
protected static final Log logger = LogFactory.getLog(AclsReadersGet.class);
|
||||
|
||||
private SOLRTrackingComponent solrTrackingComponent;
|
||||
|
||||
public void setSolrTrackingComponent(SOLRTrackingComponent solrTrackingComponent)
|
||||
{
|
||||
this.solrTrackingComponent = solrTrackingComponent;
|
||||
}
|
||||
|
||||
protected Map<String, Object> executeImpl(WebScriptRequest req, Status status)
|
||||
{
|
||||
try
|
||||
{
|
||||
Map<String, Object> model = buildModel(req);
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Result: \n\tRequest: " + req + "\n\tModel: " + model);
|
||||
}
|
||||
return model;
|
||||
}
|
||||
catch(IOException e)
|
||||
{
|
||||
throw new WebScriptException("IO exception parsing request", e);
|
||||
}
|
||||
catch(JSONException e)
|
||||
{
|
||||
throw new WebScriptException("Invalid JSON", e);
|
||||
}
|
||||
}
|
||||
|
||||
private Map<String, Object> buildModel(WebScriptRequest req) throws JSONException, IOException
|
||||
{
|
||||
List<Long> aclIds = null;
|
||||
|
||||
Content content = req.getContent();
|
||||
if (content == null)
|
||||
{
|
||||
throw new WebScriptException("Request content is empty");
|
||||
}
|
||||
JSONObject o = new JSONObject(content.getContent());
|
||||
JSONArray aclIdsJSON = o.has("aclIds") ? o.getJSONArray("aclIds") : null;
|
||||
if (aclIdsJSON == null)
|
||||
{
|
||||
throw new WebScriptException(
|
||||
Status.STATUS_BAD_REQUEST,
|
||||
"Parameter 'aclIds' not provided in request content.");
|
||||
}
|
||||
else if (aclIdsJSON.length() == 0 || aclIdsJSON.length() > 512)
|
||||
{
|
||||
throw new WebScriptException(
|
||||
Status.STATUS_BAD_REQUEST,
|
||||
"Parameter 'aclIds' must hold from 1 to 512 IDs.");
|
||||
}
|
||||
aclIds = new ArrayList<Long>(aclIdsJSON.length());
|
||||
for (int i = 0; i < aclIdsJSON.length(); i++)
|
||||
{
|
||||
aclIds.add(aclIdsJSON.getLong(i));
|
||||
}
|
||||
|
||||
// Request according to the paging query style required
|
||||
List<AclReaders> aclsReaders = solrTrackingComponent.getAclsReaders(aclIds);
|
||||
|
||||
Map<String, Object> model = new HashMap<String, Object>(1, 1.0f);
|
||||
model.put("aclsReaders", aclsReaders);
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Result: \n\tRequest: " + req + "\n\tModel: " + model);
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
}
|
@@ -180,19 +180,20 @@ public class NodesGet extends DeclarativeWebScript
|
||||
|
||||
/**
|
||||
* Callback for DAO get nodes query
|
||||
*
|
||||
*/
|
||||
private static class WebNodeQueryCallback implements NodeQueryCallback
|
||||
{
|
||||
private ArrayList<Node> nodes;
|
||||
|
||||
public WebNodeQueryCallback(int count) {
|
||||
public WebNodeQueryCallback(int count)
|
||||
{
|
||||
super();
|
||||
nodes = new ArrayList<Node>(count == 0 || count == Integer.MAX_VALUE ? 100 : count);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleNode(Node node) {
|
||||
public boolean handleNode(Node node)
|
||||
{
|
||||
nodes.add(node);
|
||||
|
||||
// continue - get next node
|
||||
@@ -204,5 +205,4 @@ public class NodesGet extends DeclarativeWebScript
|
||||
return nodes;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -41,6 +41,7 @@ import org.alfresco.service.cmr.repository.Path;
|
||||
import org.alfresco.service.cmr.repository.Path.AttributeElement;
|
||||
import org.alfresco.service.cmr.repository.Path.ChildAssocElement;
|
||||
import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter;
|
||||
import org.alfresco.service.cmr.repository.datatype.TypeConversionException;
|
||||
import org.alfresco.service.cmr.repository.datatype.TypeConverter;
|
||||
import org.alfresco.service.cmr.repository.datatype.TypeConverter.Converter;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
@@ -92,16 +93,24 @@ import org.json.JSONObject;
|
||||
this.namespaceService = namespaceService;
|
||||
}
|
||||
|
||||
public String serializeToString(Serializable value)
|
||||
{
|
||||
if (value != null && typeConverter.INSTANCE.getConverter(value.getClass(), String.class) == null)
|
||||
{
|
||||
// There is no converter
|
||||
return value.toString();
|
||||
}
|
||||
else
|
||||
{
|
||||
return typeConverter.INSTANCE.convert(String.class, value);
|
||||
}
|
||||
}
|
||||
|
||||
public <T> T serializeValue(Class<T> targetClass, Object value) throws JSONException
|
||||
{
|
||||
return typeConverter.INSTANCE.convert(targetClass, value);
|
||||
}
|
||||
|
||||
public String serializeToString(Serializable value)
|
||||
{
|
||||
return typeConverter.INSTANCE.convert(String.class, value);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public PropertyValue serialize(QName propName, Serializable value) throws IOException, JSONException
|
||||
{
|
||||
@@ -111,13 +120,12 @@ import org.json.JSONObject;
|
||||
}
|
||||
|
||||
PropertyDefinition propertyDef = dictionaryService.getProperty(propName);
|
||||
if(propertyDef == null)
|
||||
if (propertyDef == null)
|
||||
{
|
||||
throw new IllegalArgumentException("Could not find property definition for property " + propName);
|
||||
// Treat it as text
|
||||
return new PropertyValue(true, serializeToString(value));
|
||||
}
|
||||
|
||||
boolean isMulti = propertyDef.isMultiValued();
|
||||
if(isMulti)
|
||||
else if (propertyDef.isMultiValued())
|
||||
{
|
||||
if(!(value instanceof Collection))
|
||||
{
|
||||
@@ -129,7 +137,7 @@ import org.json.JSONObject;
|
||||
JSONArray body = new JSONArray();
|
||||
for(Serializable o : c)
|
||||
{
|
||||
body.put(serializeValue(String.class, o));
|
||||
body.put(serializeToString(o));
|
||||
}
|
||||
|
||||
return new PropertyValue(false, body.toString());
|
||||
@@ -151,7 +159,7 @@ import org.json.JSONObject;
|
||||
{
|
||||
encodeString = true;
|
||||
}
|
||||
return new PropertyValue(encodeString, serializeValue(String.class, value));
|
||||
return new PropertyValue(encodeString, serializeToString(value));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -26,17 +26,21 @@ import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.domain.node.NodeDAO;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.repo.solr.Acl;
|
||||
import org.alfresco.repo.solr.AclChangeSet;
|
||||
import org.alfresco.repo.solr.AclReaders;
|
||||
import org.alfresco.repo.solr.SOLRTrackingComponent;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.repo.web.scripts.BaseWebScriptTest;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.model.FileFolderService;
|
||||
import org.alfresco.service.cmr.model.FileInfo;
|
||||
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.Path;
|
||||
@@ -61,19 +65,15 @@ import org.springframework.extensions.webscripts.TestWebScriptServer.Response;
|
||||
*
|
||||
* @since 4.0
|
||||
*/
|
||||
// TODO check txn ids are correct - how to get txn ids?
|
||||
// TODO create a node in txn1 and delete it in txn2 - only the delete in txn2 appears. Will SOLR not then see this as deletion of a non-existent node?
|
||||
// TODO test getTxns: combinations of fromTxnId, fromCommitTime, maxResults
|
||||
// TODO move/duplicate tests to SOLRDAO tests
|
||||
public class SOLRWebScriptTest extends BaseWebScriptTest
|
||||
{
|
||||
protected static final Log logger = LogFactory.getLog(SOLRWebScriptTest.class);
|
||||
|
||||
private ApplicationContext ctx;
|
||||
private SOLRTrackingComponent solrTrackingComponent;
|
||||
private NodeDAO nodeDAO;
|
||||
private TransactionService transactionService;
|
||||
private NodeService nodeService;
|
||||
private ContentService contentService;
|
||||
private FileFolderService fileFolderService;
|
||||
private RetryingTransactionHelper txnHelper;
|
||||
private NamespaceService namespaceService;
|
||||
@@ -81,33 +81,8 @@ public class SOLRWebScriptTest extends BaseWebScriptTest
|
||||
private String admin;
|
||||
|
||||
private StoreRef storeRef;
|
||||
private StoreRef storeRef1;
|
||||
private NodeRef rootNodeRef;
|
||||
private NodeRef rootNodeRef1;
|
||||
|
||||
private NodeRef container1;
|
||||
private NodeRef container2;
|
||||
private NodeRef container3;
|
||||
private NodeRef container4;
|
||||
private NodeRef container5;
|
||||
private NodeRef content1;
|
||||
private NodeRef content2;
|
||||
private NodeRef content3;
|
||||
|
||||
private long container1NodeID;
|
||||
private long container2NodeID;
|
||||
private long container3NodeID;
|
||||
private long container4NodeID;
|
||||
private long container5NodeID;
|
||||
private long content1NodeID;
|
||||
private long content2NodeID;
|
||||
private long content3NodeID;
|
||||
private long content4NodeID;
|
||||
private long content5NodeID;
|
||||
|
||||
private JSONObject firstNode;
|
||||
private JSONObject secondNode;
|
||||
private JSONObject thirdNode;
|
||||
|
||||
private ArrayList<NodeRef> contents = new ArrayList<NodeRef>(100);
|
||||
private List<Long> nodeIDs = new ArrayList<Long>(100);
|
||||
@@ -121,11 +96,11 @@ public class SOLRWebScriptTest extends BaseWebScriptTest
|
||||
ServiceRegistry serviceRegistry = (ServiceRegistry) ctx.getBean(ServiceRegistry.SERVICE_REGISTRY);
|
||||
transactionService = serviceRegistry.getTransactionService();
|
||||
nodeService = serviceRegistry.getNodeService();
|
||||
contentService = serviceRegistry.getContentService();
|
||||
fileFolderService = serviceRegistry.getFileFolderService();
|
||||
namespaceService = serviceRegistry.getNamespaceService();
|
||||
txnHelper = transactionService.getRetryingTransactionHelper();
|
||||
nodeDAO = (NodeDAO)ctx.getBean("nodeDAO");
|
||||
solrTrackingComponent = (SOLRTrackingComponent) ctx.getBean("solrTrackingComponent");
|
||||
|
||||
admin = AuthenticationUtil.getAdminUserName();
|
||||
|
||||
@@ -133,9 +108,6 @@ public class SOLRWebScriptTest extends BaseWebScriptTest
|
||||
|
||||
storeRef = nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, getName() + ".1." + System.currentTimeMillis());
|
||||
rootNodeRef = nodeService.getRootNode(storeRef);
|
||||
|
||||
storeRef1 = nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, getName() + ".2." + System.currentTimeMillis());
|
||||
rootNodeRef1 = nodeService.getRootNode(storeRef1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -160,7 +132,7 @@ public class SOLRWebScriptTest extends BaseWebScriptTest
|
||||
|
||||
JSONArray transactions = json.getJSONArray("transactions");
|
||||
|
||||
System.out.println("Got " + transactions.length() + " txns in " + (endTime - startTime) + " ms");
|
||||
logger.debug("Got " + transactions.length() + " txns in " + (endTime - startTime) + " ms");
|
||||
|
||||
return transactions;
|
||||
}
|
||||
@@ -181,7 +153,119 @@ public class SOLRWebScriptTest extends BaseWebScriptTest
|
||||
|
||||
JSONArray aclChangeSets = json.getJSONArray("aclChangeSets");
|
||||
|
||||
System.out.println("Got " + aclChangeSets.length() + " txns in " + (endTime - startTime) + " ms");
|
||||
logger.debug("Got " + aclChangeSets.length() + " txns in " + (endTime - startTime) + " ms");
|
||||
}
|
||||
|
||||
public void testAclsGet() throws Exception
|
||||
{
|
||||
List<AclChangeSet> aclChangeSets = solrTrackingComponent.getAclChangeSets(null, null, 100);
|
||||
if (aclChangeSets.size() == 0)
|
||||
{
|
||||
return; // Can't test, but very unlikely
|
||||
}
|
||||
// Build JSON using these
|
||||
JSONObject json = new JSONObject();
|
||||
JSONArray aclChangeSetIdsJSON = new JSONArray();
|
||||
int count = 0;
|
||||
List<Long> aclChangeSetIds = new ArrayList<Long>();
|
||||
for (AclChangeSet aclChangeSet : aclChangeSets)
|
||||
{
|
||||
if (count >= 512)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (aclChangeSet.getAclCount() == 0)
|
||||
{
|
||||
continue; // No ACLs
|
||||
}
|
||||
Long aclChangeSetId = aclChangeSet.getId();
|
||||
aclChangeSetIdsJSON.put(aclChangeSetId);
|
||||
aclChangeSetIds.add(aclChangeSetId);
|
||||
count++;
|
||||
}
|
||||
json.put("aclChangeSetIds", aclChangeSetIdsJSON);
|
||||
|
||||
String url = "/api/solr/acls";
|
||||
TestWebScriptServer.PostRequest req = new TestWebScriptServer.PostRequest(url, json.toString(), "application/json");
|
||||
Response response = sendRequest(req, Status.STATUS_OK, admin);
|
||||
if(logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug(response.getContentAsString());
|
||||
}
|
||||
json = new JSONObject(response.getContentAsString());
|
||||
JSONArray acls = json.getJSONArray("acls");
|
||||
|
||||
// Check
|
||||
List<Acl> aclsCheck = solrTrackingComponent.getAcls(aclChangeSetIds, null, 512);
|
||||
assertEquals("Script and API returned different number of results", aclsCheck.size(), acls.length());
|
||||
}
|
||||
|
||||
public void testAclReadersGet() throws Exception
|
||||
{
|
||||
List<AclChangeSet> aclChangeSets = solrTrackingComponent.getAclChangeSets(null, null, 1024);
|
||||
List<Long> aclChangeSetIds = new ArrayList<Long>(50);
|
||||
for (AclChangeSet aclChangeSet : aclChangeSets)
|
||||
{
|
||||
if (aclChangeSet.getAclCount() > 0)
|
||||
{
|
||||
aclChangeSetIds.add(aclChangeSet.getId());
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (aclChangeSetIds.size() == 0)
|
||||
{
|
||||
// No ACLs; not likely
|
||||
}
|
||||
List<Acl> acls = solrTrackingComponent.getAcls(aclChangeSetIds, null, 1024);
|
||||
List<Long> aclIds = new ArrayList<Long>(acls.size());
|
||||
JSONObject json = new JSONObject();
|
||||
JSONArray aclIdsJSON = new JSONArray();
|
||||
for (Acl acl : acls)
|
||||
{
|
||||
Long aclId = acl.getId();
|
||||
aclIds.add(aclId);
|
||||
aclIdsJSON.put(aclId);
|
||||
}
|
||||
json.put("aclIds", aclIdsJSON);
|
||||
|
||||
// Now get the readers
|
||||
List<AclReaders> aclsReaders = solrTrackingComponent.getAclsReaders(aclIds);
|
||||
assertEquals("Should have same number of ACLs as supplied", aclIds.size(), aclsReaders.size());
|
||||
assertTrue("Must have *some* ACLs here", aclIds.size() > 0);
|
||||
Map<Long, Set<String>> readersByAclId = new HashMap<Long, Set<String>>();
|
||||
for (AclReaders aclReaders : aclsReaders)
|
||||
{
|
||||
readersByAclId.put(aclReaders.getAclId(), aclReaders.getReaders());
|
||||
}
|
||||
|
||||
// Now query using the webscript
|
||||
String url = "/api/solr/aclsReaders";
|
||||
TestWebScriptServer.PostRequest req = new TestWebScriptServer.PostRequest(url, json.toString(), "application/json");
|
||||
Response response = sendRequest(req, Status.STATUS_OK, admin);
|
||||
if(logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug(response.getContentAsString());
|
||||
}
|
||||
json = new JSONObject(response.getContentAsString());
|
||||
JSONArray aclsReadersJSON = json.getJSONArray("aclsReaders");
|
||||
// Check
|
||||
assertEquals("Script and API returned different number of results", readersByAclId.size(), aclsReadersJSON.length());
|
||||
|
||||
// Iterate of the JSON and ensure that the list of ACL readers is correct
|
||||
for (int i = 0; i < aclsReadersJSON.length(); i++)
|
||||
{
|
||||
// Choose an ACL and check the readers
|
||||
JSONObject aclReadersJSON = aclsReadersJSON.getJSONObject(i);
|
||||
Long aclIdJSON = aclReadersJSON.getLong("aclId");
|
||||
Set<String> readersCheck = readersByAclId.get(aclIdJSON);
|
||||
JSONArray readersJSON = aclReadersJSON.getJSONArray("readers");
|
||||
assertEquals("Readers list for ACL " + aclIdJSON + " is wrong. ", readersCheck.size(), readersJSON.length());
|
||||
for (int j = 0; j < readersJSON.length(); j++)
|
||||
{
|
||||
String readerJSON = readersJSON.getString(j);
|
||||
assertTrue("Found reader not in check set: " + readerJSON, readersCheck.contains(readerJSON));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private JSONArray getNodes(GetNodesParameters parameters, int maxResults, int expectedNumNodes) throws Exception
|
||||
@@ -253,7 +337,7 @@ public class SOLRWebScriptTest extends BaseWebScriptTest
|
||||
{
|
||||
logger.debug(response.getContentAsString());
|
||||
}
|
||||
//System.out.println("getNodes: " + response.getContentAsString());
|
||||
//logger.debug("getNodes: " + response.getContentAsString());
|
||||
JSONObject jsonResponse = new JSONObject(response.getContentAsString());
|
||||
jsonResponse.write(new PrintWriter(System.out));
|
||||
|
||||
@@ -261,129 +345,13 @@ public class SOLRWebScriptTest extends BaseWebScriptTest
|
||||
|
||||
//assertEquals("Node count is incorrect", nodes.length(), json.getInt("count"));
|
||||
|
||||
System.out.println("Got " + nodes.length() + " nodes in " + (endTime - startTime) + " ms");
|
||||
logger.debug("Got " + nodes.length() + " nodes in " + (endTime - startTime) + " ms");
|
||||
|
||||
assertEquals("Number of returned node meta data results is incorrect", expectedNumNodes, nodes.length());
|
||||
|
||||
return nodes;
|
||||
}
|
||||
|
||||
private void buildTransactions1()
|
||||
{
|
||||
txnHelper.doInTransaction(new RetryingTransactionCallback<Void>()
|
||||
{
|
||||
public Void execute() throws Throwable
|
||||
{
|
||||
PropertyMap props = new PropertyMap();
|
||||
props.put(ContentModel.PROP_NAME, "Container1");
|
||||
container1 = nodeService.createNode(
|
||||
rootNodeRef,
|
||||
ContentModel.ASSOC_CHILDREN,
|
||||
ContentModel.ASSOC_CHILDREN,
|
||||
ContentModel.TYPE_FOLDER,
|
||||
props).getChildRef();
|
||||
|
||||
System.out.println("container1 = " + container1);
|
||||
|
||||
FileInfo content1Info = fileFolderService.create(container1, "Content1", ContentModel.TYPE_CONTENT);
|
||||
content1 = content1Info.getNodeRef();
|
||||
|
||||
container1NodeID = getNodeID(container1);
|
||||
content1NodeID = getNodeID(content1);
|
||||
|
||||
if(logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("content1 = " + content1);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
txnHelper.doInTransaction(new RetryingTransactionCallback<Void>()
|
||||
{
|
||||
public Void execute() throws Throwable
|
||||
{
|
||||
FileInfo content2Info = fileFolderService.create(container1, "Content2", ContentModel.TYPE_CONTENT);
|
||||
content2 = content2Info.getNodeRef();
|
||||
content2NodeID = getNodeID(content2);
|
||||
|
||||
if(logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("content2 = " + content2);
|
||||
}
|
||||
|
||||
nodeService.addAspect(content1, ContentModel.ASPECT_TEMPORARY, null);
|
||||
fileFolderService.delete(content1);
|
||||
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void buildTransactions2()
|
||||
{
|
||||
txnHelper.doInTransaction(new RetryingTransactionCallback<Void>()
|
||||
{
|
||||
public Void execute() throws Throwable
|
||||
{
|
||||
PropertyMap props = new PropertyMap();
|
||||
props.put(ContentModel.PROP_NAME, "Container2");
|
||||
container2 = nodeService.createNode(
|
||||
rootNodeRef,
|
||||
ContentModel.ASSOC_CHILDREN,
|
||||
ContentModel.ASSOC_CHILDREN,
|
||||
ContentModel.TYPE_FOLDER,
|
||||
props).getChildRef();
|
||||
container2NodeID = getNodeID(container2);
|
||||
if(logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("container2 = " + container2);
|
||||
}
|
||||
|
||||
FileInfo content1Info = fileFolderService.create(container2, "Content1", ContentModel.TYPE_CONTENT);
|
||||
content1 = content1Info.getNodeRef();
|
||||
content1NodeID = getNodeID(content1);
|
||||
|
||||
if(logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("content1 = " + content1);
|
||||
}
|
||||
|
||||
FileInfo content2Info = fileFolderService.create(container2, "Content2", ContentModel.TYPE_CONTENT);
|
||||
content2 = content2Info.getNodeRef();
|
||||
content2NodeID = getNodeID(content2);
|
||||
if(logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("content2 = " + content2);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
txnHelper.doInTransaction(new RetryingTransactionCallback<Void>()
|
||||
{
|
||||
public Void execute() throws Throwable
|
||||
{
|
||||
FileInfo content3Info = fileFolderService.create(container2, "Content3", ContentModel.TYPE_CONTENT);
|
||||
content3 = content3Info.getNodeRef();
|
||||
content3NodeID = getNodeID(content3);
|
||||
if(logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("content3 = " + content3);
|
||||
}
|
||||
|
||||
nodeService.addAspect(content1, ContentModel.ASPECT_TEMPORARY, null);
|
||||
fileFolderService.delete(content1);
|
||||
|
||||
nodeService.setProperty(content3, ContentModel.PROP_NAME, "Content 3 New Name");
|
||||
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private List<Long> getTransactionIds(JSONArray transactions) throws JSONException
|
||||
{
|
||||
List<Long> txnIds = new ArrayList<Long>(transactions.length());
|
||||
@@ -398,18 +366,20 @@ public class SOLRWebScriptTest extends BaseWebScriptTest
|
||||
return txnIds;
|
||||
}
|
||||
|
||||
public static String join(Collection s, String delimiter) {
|
||||
public static String join(Collection<Object> s, String delimiter)
|
||||
{
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
Iterator iter = s.iterator();
|
||||
while (iter.hasNext()) {
|
||||
Iterator<Object> iter = s.iterator();
|
||||
while (iter.hasNext())
|
||||
{
|
||||
buffer.append(iter.next());
|
||||
if (iter.hasNext()) {
|
||||
if (iter.hasNext())
|
||||
{
|
||||
buffer.append(delimiter);
|
||||
}
|
||||
}
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
|
||||
private void buildTransactions3()
|
||||
{
|
||||
@@ -425,7 +395,6 @@ public class SOLRWebScriptTest extends BaseWebScriptTest
|
||||
ContentModel.ASSOC_CHILDREN,
|
||||
ContentModel.TYPE_FOLDER,
|
||||
props).getChildRef();
|
||||
container3NodeID = getNodeID(container3);
|
||||
if(logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("container3 = " + container3);
|
||||
@@ -449,79 +418,6 @@ public class SOLRWebScriptTest extends BaseWebScriptTest
|
||||
});
|
||||
}
|
||||
|
||||
private void buildTransactions4()
|
||||
{
|
||||
txnHelper.doInTransaction(new RetryingTransactionCallback<Void>()
|
||||
{
|
||||
public Void execute() throws Throwable
|
||||
{
|
||||
PropertyMap props = new PropertyMap();
|
||||
props.put(ContentModel.PROP_NAME, "Container4");
|
||||
container4 = nodeService.createNode(
|
||||
rootNodeRef,
|
||||
ContentModel.ASSOC_CHILDREN,
|
||||
ContentModel.ASSOC_CHILDREN,
|
||||
ContentModel.TYPE_FOLDER,
|
||||
props).getChildRef();
|
||||
container4NodeID = getNodeID(container4);
|
||||
if(logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("container4 = " + container4);
|
||||
}
|
||||
|
||||
for(int i = 0; i < 100; i++)
|
||||
{
|
||||
FileInfo content1Info = fileFolderService.create(container4, "Content" + i, ContentModel.TYPE_CONTENT);
|
||||
NodeRef nodeRef = content1Info.getNodeRef();
|
||||
contents.add(nodeRef);
|
||||
nodeIDs.add(getNodeID(nodeRef));
|
||||
|
||||
if(i % 2 == 1)
|
||||
{
|
||||
nodeService.addAspect(nodeRef, ContentModel.ASPECT_TEMPORARY, null);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
txnHelper.doInTransaction(new RetryingTransactionCallback<Void>()
|
||||
{
|
||||
public Void execute() throws Throwable
|
||||
{
|
||||
PropertyMap props = new PropertyMap();
|
||||
props.put(ContentModel.PROP_NAME, "Container5");
|
||||
container5 = nodeService.createNode(
|
||||
rootNodeRef1,
|
||||
ContentModel.ASSOC_CHILDREN,
|
||||
ContentModel.ASSOC_CHILDREN,
|
||||
ContentModel.TYPE_FOLDER,
|
||||
props).getChildRef();
|
||||
container5NodeID = getNodeID(container5);
|
||||
if(logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("container5 = " + container5);
|
||||
}
|
||||
|
||||
for(int i = 0; i < 100; i++)
|
||||
{
|
||||
FileInfo content1Info = fileFolderService.create(container5, "Content" + i, ContentModel.TYPE_CONTENT);
|
||||
NodeRef nodeRef = content1Info.getNodeRef();
|
||||
contents.add(nodeRef);
|
||||
nodeIDs.add(getNodeID(nodeRef));
|
||||
|
||||
if(i % 2 == 1)
|
||||
{
|
||||
nodeService.addAspect(nodeRef, ContentModel.ASPECT_TEMPORARY, null);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private NodeRef container6;
|
||||
|
||||
private void buildTransactions5()
|
||||
@@ -584,7 +480,7 @@ public class SOLRWebScriptTest extends BaseWebScriptTest
|
||||
|
||||
JSONArray nodes = jsonResponse.getJSONArray("nodes");
|
||||
|
||||
System.out.println("Got metadata for " + nodes.length() + " nodes in " + (endTime - startTime) + " ms");
|
||||
logger.debug("Got metadata for " + nodes.length() + " nodes in " + (endTime - startTime) + " ms");
|
||||
|
||||
assertEquals("Number of returned nodes is incorrect", numMetaDataNodes, nodes.length());
|
||||
|
||||
@@ -605,7 +501,6 @@ public class SOLRWebScriptTest extends BaseWebScriptTest
|
||||
ContentModel.ASSOC_CHILDREN,
|
||||
ContentModel.TYPE_FOLDER,
|
||||
props).getChildRef();
|
||||
long container6NodeID = getNodeID(container6);
|
||||
if(logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("container6 = " + container6);
|
||||
@@ -628,406 +523,6 @@ public class SOLRWebScriptTest extends BaseWebScriptTest
|
||||
});
|
||||
}
|
||||
|
||||
/* public void testGetTransactions1() throws Exception
|
||||
{
|
||||
long fromCommitTime = System.currentTimeMillis();
|
||||
|
||||
buildTransactions1();
|
||||
|
||||
String url = "/api/solr/transactions?fromCommitTime=" + fromCommitTime;
|
||||
TestWebScriptServer.GetRequest req = new TestWebScriptServer.GetRequest(url);
|
||||
Response response = sendRequest(req, Status.STATUS_OK, admin);
|
||||
|
||||
// assertEquals("Expected application/json content type", "application/json[;charset=UTF-8]", response.getContentType());
|
||||
|
||||
// System.out.println(response.getContentAsString());
|
||||
JSONObject json = new JSONObject(response.getContentAsString());
|
||||
|
||||
JSONArray transactions = json.getJSONArray("transactions");
|
||||
assertEquals("Number of transactions is incorrect", 2, transactions.length());
|
||||
|
||||
int[] updates = new int[] {1, 1};
|
||||
int[] deletes = new int[] {0, 1};
|
||||
//StringBuilder txnIds = new StringBuilder();
|
||||
int numTxns = transactions.length();
|
||||
List<Long> transactionIds = getTransactionIds(transactions);
|
||||
for(int i = 0; i < numTxns; i++)
|
||||
{
|
||||
JSONObject txn = transactions.getJSONObject(i);
|
||||
assertEquals("Number of deletes is incorrect", deletes[i], txn.getLong("deletes"));
|
||||
assertEquals("Number of updates is incorrect", updates[i], txn.getLong("updates"));
|
||||
|
||||
// txnIds.append(txn.getString("id"));
|
||||
// if(i < (numTxns - 1))
|
||||
// {
|
||||
// txnIds.append(",");
|
||||
// }
|
||||
}
|
||||
|
||||
// get all nodes at once
|
||||
if(logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("txnIds = " + transactions.toString());
|
||||
}
|
||||
|
||||
GetNodesParameters parameters = new GetNodesParameters();
|
||||
parameters.setTransactionIds(transactionIds);
|
||||
JSONArray nodes = getNodes(parameters, 0, 3);
|
||||
if(logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("nodes:");
|
||||
logger.debug(nodes.toString(3));
|
||||
}
|
||||
|
||||
JSONObject lastNode = nodes.getJSONObject(2);
|
||||
assertTrue("nodeID is missing", lastNode.has("id"));
|
||||
Long fromNodeId = lastNode.getLong("id");
|
||||
if(logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("fromNodeId = " + fromNodeId);
|
||||
}
|
||||
assertNotNull("Unexpected null fromNodeId", fromNodeId);
|
||||
|
||||
firstNode = nodes.getJSONObject(0);
|
||||
secondNode = nodes.getJSONObject(1);
|
||||
//assertEquals("Expected transaction ids to be the same", firstNode.getLong("txnID") == secondNode.getLong("txnID"));
|
||||
assertEquals("Expected node update", "u", firstNode.getString("status"));
|
||||
assertEquals("Expected node deleted", "d", secondNode.getString("status"));
|
||||
assertEquals("Node id is incorrect", container1NodeID, firstNode.getLong("id"));
|
||||
assertEquals("Node id is incorrect", content1NodeID, secondNode.getLong("id"));
|
||||
|
||||
// get first 2 nodes
|
||||
parameters = new GetNodesParameters();
|
||||
parameters.setTransactionIds(transactionIds);
|
||||
nodes = getNodes(parameters, 2, 2);
|
||||
if(logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("nodes:");
|
||||
logger.debug(nodes.toString(3));
|
||||
}
|
||||
|
||||
lastNode = nodes.getJSONObject(1);
|
||||
assertTrue("nodeID is missing", lastNode.has("id"));
|
||||
fromNodeId = lastNode.getLong("id");
|
||||
if(logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("fromNodeId = " + fromNodeId);
|
||||
}
|
||||
assertNotNull("Unexpected null fromNodeId", fromNodeId);
|
||||
|
||||
// get 4 nodes starting with fromNodeId, should return only 2 nodes (including fromNodeId)
|
||||
parameters = new GetNodesParameters();
|
||||
parameters.setTransactionIds(transactionIds);
|
||||
parameters.setFromNodeId(fromNodeId);
|
||||
nodes = getNodes(parameters, 4, 2);
|
||||
if(logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("nodes:");
|
||||
logger.debug(nodes.toString(3));
|
||||
}
|
||||
|
||||
firstNode = nodes.getJSONObject(0);
|
||||
secondNode = nodes.getJSONObject(1);
|
||||
assertEquals("Expected node deleted", "d", firstNode.getString("status"));
|
||||
assertEquals("Expected node updated", "u", secondNode.getString("status"));
|
||||
assertEquals("Node id is incorrect", content1NodeID, firstNode.getLong("id"));
|
||||
assertEquals("Node id is incorrect", content2NodeID, secondNode.getLong("id"));
|
||||
|
||||
// get 0 (all) nodes starting with fromNodeId, should return 2 nodes
|
||||
parameters = new GetNodesParameters();
|
||||
parameters.setTransactionIds(transactionIds);
|
||||
parameters.setFromNodeId(fromNodeId);
|
||||
nodes = getNodes(parameters, 0, 2);
|
||||
if(logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("nodes:");
|
||||
logger.debug(nodes.toString(3));
|
||||
}
|
||||
|
||||
// get 2 nodes ending with toNodeId, should return 2 nodes
|
||||
long toNodeId = content2NodeID;
|
||||
parameters = new GetNodesParameters();
|
||||
parameters.setTransactionIds(transactionIds);
|
||||
parameters.setToNodeId(toNodeId);
|
||||
nodes = getNodes(parameters, 2, 2);
|
||||
if(logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("nodes:");
|
||||
logger.debug(nodes.toString(3));
|
||||
}
|
||||
|
||||
firstNode = nodes.getJSONObject(0);
|
||||
secondNode = nodes.getJSONObject(1);
|
||||
assertEquals("Expected node deleted", "u", firstNode.getString("status"));
|
||||
assertEquals("Node id is incorrect", container1NodeID, firstNode.getLong("id"));
|
||||
assertEquals("Expected node updated", "d", secondNode.getString("status"));
|
||||
assertEquals("Node id is incorrect", content1NodeID, secondNode.getLong("id"));
|
||||
|
||||
// get 1 node ending with toNodeId, should return 1 nodes
|
||||
toNodeId = content2NodeID;
|
||||
parameters = new GetNodesParameters();
|
||||
parameters.setTransactionIds(transactionIds);
|
||||
parameters.setToNodeId(toNodeId);
|
||||
nodes = getNodes(parameters, 1, 1);
|
||||
if(logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("nodes:");
|
||||
logger.debug(nodes.toString(3));
|
||||
}
|
||||
|
||||
firstNode = nodes.getJSONObject(0);
|
||||
assertEquals("Expected node updated", "u", firstNode.getString("status"));
|
||||
assertEquals("Node id is incorrect", container1NodeID, firstNode.getLong("id"));
|
||||
|
||||
// get 3 nodes ending with toNodeId, should return 3 nodes
|
||||
toNodeId = content2NodeID;
|
||||
parameters = new GetNodesParameters();
|
||||
parameters.setTransactionIds(transactionIds);
|
||||
parameters.setToNodeId(toNodeId);
|
||||
nodes = getNodes(parameters, 3, 3);
|
||||
if(logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("nodes:");
|
||||
logger.debug(nodes.toString(3));
|
||||
}
|
||||
|
||||
firstNode = nodes.getJSONObject(0);
|
||||
assertEquals("Expected node updated", "u", firstNode.getString("status"));
|
||||
assertEquals("Node id is incorrect", container1NodeID, firstNode.getLong("id"));
|
||||
|
||||
secondNode = nodes.getJSONObject(1);
|
||||
assertEquals("Expected node deleted", "d", secondNode.getString("status"));
|
||||
assertEquals("Node id is incorrect", content1NodeID, secondNode.getLong("id"));
|
||||
|
||||
thirdNode = nodes.getJSONObject(2);
|
||||
assertEquals("Expected node updated", "u", thirdNode.getString("status"));
|
||||
assertEquals("Node id is incorrect", content2NodeID, thirdNode.getLong("id"));
|
||||
}
|
||||
|
||||
public void testGetNodesStoreName() throws Exception
|
||||
{
|
||||
long fromCommitTime = System.currentTimeMillis();
|
||||
|
||||
buildTransactions4();
|
||||
|
||||
String url = "/api/solr/transactions?fromCommitTime=" + fromCommitTime;
|
||||
TestWebScriptServer.GetRequest req = new TestWebScriptServer.GetRequest(url);
|
||||
Response response = sendRequest(req, Status.STATUS_OK, admin);
|
||||
|
||||
if(logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug(response.getContentAsString());
|
||||
}
|
||||
JSONObject json = new JSONObject(response.getContentAsString());
|
||||
|
||||
JSONArray transactions = json.getJSONArray("transactions");
|
||||
assertEquals("Number of transactions is incorrect", 2, transactions.length());
|
||||
|
||||
// first txn has 2 updates rather than three because content1 is deleted in txn 2 and therefore
|
||||
// "belongs" to that txn (because txn2 was the last to alter the node)
|
||||
|
||||
List<Long> transactionIds = getTransactionIds(transactions);
|
||||
|
||||
// exact store name
|
||||
GetNodesParameters parameters = new GetNodesParameters();
|
||||
parameters.setTransactionIds(transactionIds);
|
||||
parameters.setStoreProtocol(storeRef.getProtocol());
|
||||
parameters.setStoreIdentifier(storeRef.getIdentifier());
|
||||
JSONArray nodes = getNodes(parameters, 0, 101);
|
||||
|
||||
nodes = getNodes(parameters, 50, 50);
|
||||
|
||||
// store protocol
|
||||
parameters = new GetNodesParameters();
|
||||
parameters.setTransactionIds(transactionIds);
|
||||
parameters.setStoreProtocol(storeRef.getProtocol());
|
||||
nodes = getNodes(parameters, 0, 202);
|
||||
|
||||
// store identifier
|
||||
parameters = new GetNodesParameters();
|
||||
parameters.setTransactionIds(transactionIds);
|
||||
parameters.setStoreIdentifier(storeRef.getIdentifier());
|
||||
nodes = getNodes(parameters, 0, 101);
|
||||
}
|
||||
|
||||
public void testGetTransactions2() throws Exception
|
||||
{
|
||||
long fromCommitTime = System.currentTimeMillis();
|
||||
|
||||
buildTransactions2();
|
||||
|
||||
String url = "/api/solr/transactions?fromCommitTime=" + fromCommitTime;
|
||||
TestWebScriptServer.GetRequest req = new TestWebScriptServer.GetRequest(url);
|
||||
Response response = sendRequest(req, Status.STATUS_OK, admin);
|
||||
|
||||
if(logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("txns =");
|
||||
logger.debug(response.getContentAsString());
|
||||
}
|
||||
JSONObject json = new JSONObject(response.getContentAsString());
|
||||
|
||||
JSONArray transactions = json.getJSONArray("transactions");
|
||||
assertEquals("Number of transactions is incorrect", 2, transactions.length());
|
||||
|
||||
// first txn has 2 updates rather than three because content1 is deleted in txn 2 and therefore
|
||||
// "belongs" to that txn (because txn2 was the last to alter the node)
|
||||
int[] updates = new int[] {2, 1};
|
||||
int[] deletes = new int[] {0, 1};
|
||||
StringBuilder txnIds = new StringBuilder();
|
||||
int numTxns = transactions.length();
|
||||
for(int i = 0; i < numTxns; i++)
|
||||
{
|
||||
JSONObject txn = transactions.getJSONObject(i);
|
||||
assertEquals("Number of deletes is incorrect", deletes[i], txn.getLong("deletes"));
|
||||
assertEquals("Number of updates is incorrect", updates[i], txn.getLong("updates"));
|
||||
|
||||
txnIds.append(txn.getString("id"));
|
||||
if(i < (numTxns - 1))
|
||||
{
|
||||
txnIds.append(",");
|
||||
}
|
||||
}
|
||||
|
||||
// get all nodes at once
|
||||
if(logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("txnIds = " + txnIds.toString());
|
||||
}
|
||||
|
||||
List<Long> transactionIds = getTransactionIds(transactions);
|
||||
|
||||
// get all nodes in the txns
|
||||
GetNodesParameters parameters = new GetNodesParameters();
|
||||
parameters.setTransactionIds(transactionIds);
|
||||
JSONArray nodes = getNodes(parameters, 0, 4);
|
||||
JSONObject lastNode = nodes.getJSONObject(nodes.length() - 1);
|
||||
Long fromNodeId = lastNode.getLong("id");
|
||||
assertNotNull("Unexpected null fromNodeId", fromNodeId);
|
||||
|
||||
// get first 2 nodes
|
||||
parameters = new GetNodesParameters();
|
||||
parameters.setTransactionIds(transactionIds);
|
||||
nodes = getNodes(parameters, 2, 2);
|
||||
if(logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("nodes:");
|
||||
logger.debug(nodes.toString(3));
|
||||
}
|
||||
|
||||
firstNode = nodes.getJSONObject(0);
|
||||
assertTrue("nodeID is missing", firstNode.has("id"));
|
||||
secondNode = nodes.getJSONObject(1);
|
||||
assertTrue("nodeID is missing", secondNode.has("id"));
|
||||
fromNodeId = secondNode.getLong("id");
|
||||
if(logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("fromNodeId = " + fromNodeId);
|
||||
}
|
||||
assertNotNull("Unexpected null nodeID", fromNodeId);
|
||||
|
||||
//assertEquals("Expected transaction ids to be the same", firstNode.getLong("txnID"), secondNode.getLong("txnID"));
|
||||
assertEquals("Expected node update", "u", firstNode.getString("status"));
|
||||
assertEquals("Expected node delete", "d", secondNode.getString("status"));
|
||||
assertEquals("Incorrect node id", container2NodeID, firstNode.getLong("id"));
|
||||
assertEquals("Incorrect node id", content1NodeID, secondNode.getLong("id"));
|
||||
|
||||
// get 10 nodes (including fromNodeId) starting with fromNodeId, should return only 3 nodes
|
||||
parameters = new GetNodesParameters();
|
||||
parameters.setTransactionIds(transactionIds);
|
||||
parameters.setFromNodeId(fromNodeId);
|
||||
nodes = getNodes(parameters, 10, 3);
|
||||
|
||||
firstNode = nodes.getJSONObject(0);
|
||||
assertTrue("nodeID is missing", firstNode.has("id"));
|
||||
secondNode = nodes.getJSONObject(1);
|
||||
assertTrue("nodeID is missing", secondNode.has("id"));
|
||||
thirdNode = nodes.getJSONObject(2);
|
||||
assertTrue("nodeID is missing", thirdNode.has("id"));
|
||||
|
||||
assertEquals("Expected node delete", "d", firstNode.getString("status"));
|
||||
assertEquals("Expected node update", "u", secondNode.getString("status"));
|
||||
assertEquals("Expected node update", "u", thirdNode.getString("status"));
|
||||
assertEquals("Incorrect node id", content1NodeID, firstNode.getLong("id"));
|
||||
assertEquals("Incorrect node id", content2NodeID, secondNode.getLong("id"));
|
||||
assertEquals("Incorrect node id", content3NodeID, thirdNode.getLong("id"));
|
||||
|
||||
// test with from and to node ids
|
||||
parameters = new GetNodesParameters();
|
||||
parameters.setTransactionIds(transactionIds);
|
||||
parameters.setFromNodeId(container2NodeID);
|
||||
parameters.setToNodeId(content3NodeID);
|
||||
nodes = getNodes(parameters, 2, 2);
|
||||
|
||||
firstNode = nodes.getJSONObject(0);
|
||||
assertTrue("nodeID is missing", firstNode.has("id"));
|
||||
secondNode = nodes.getJSONObject(1);
|
||||
assertTrue("nodeID is missing", secondNode.has("id"));
|
||||
assertEquals("Incorrect node id", container2NodeID, firstNode.getLong("id"));
|
||||
assertEquals("Incorrect node id", content1NodeID, secondNode.getLong("id"));
|
||||
|
||||
// test right truncation
|
||||
parameters = new GetNodesParameters();
|
||||
parameters.setTransactionIds(transactionIds);
|
||||
parameters.setToNodeId(content3NodeID);
|
||||
nodes = getNodes(parameters, 2, 2);
|
||||
|
||||
firstNode = nodes.getJSONObject(0);
|
||||
assertTrue("nodeID is missing", firstNode.has("id"));
|
||||
secondNode = nodes.getJSONObject(1);
|
||||
assertTrue("nodeID is missing", secondNode.has("id"));
|
||||
assertEquals("Incorrect node id", container2NodeID, firstNode.getLong("id"));
|
||||
assertEquals("Incorrect node id", content1NodeID, secondNode.getLong("id"));
|
||||
|
||||
// test left truncation, specifying from node only
|
||||
parameters = new GetNodesParameters();
|
||||
parameters.setTransactionIds(transactionIds);
|
||||
parameters.setFromNodeId(container2NodeID);
|
||||
nodes = getNodes(parameters, 2, 2);
|
||||
|
||||
firstNode = nodes.getJSONObject(0);
|
||||
assertTrue("nodeID is missing", firstNode.has("id"));
|
||||
secondNode = nodes.getJSONObject(1);
|
||||
assertTrue("nodeID is missing", secondNode.has("id"));
|
||||
assertEquals("Incorrect node id", container2NodeID, firstNode.getLong("id"));
|
||||
assertEquals("Incorrect node id", content1NodeID, secondNode.getLong("id"));
|
||||
}
|
||||
|
||||
public void testGetNodesExcludeAspects() throws Exception
|
||||
{
|
||||
long fromCommitTime = System.currentTimeMillis();
|
||||
|
||||
buildTransactions3();
|
||||
|
||||
String url = "/api/solr/transactions?fromCommitTime=" + fromCommitTime;
|
||||
TestWebScriptServer.GetRequest req = new TestWebScriptServer.GetRequest(url);
|
||||
Response response = sendRequest(req, Status.STATUS_OK, admin);
|
||||
|
||||
if(logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("txns = ");
|
||||
logger.debug(response.getContentAsString());
|
||||
}
|
||||
JSONObject json = new JSONObject(response.getContentAsString());
|
||||
|
||||
JSONArray transactions = json.getJSONArray("transactions");
|
||||
assertEquals("Number of transactions is incorrect", 1, transactions.length());
|
||||
|
||||
// first txn has 2 updates rather than three because content1 is deleted in txn 2 and therefore
|
||||
// "belongs" to that txn (because txn2 was the last to alter the node)
|
||||
|
||||
List<Long> transactionIds = getTransactionIds(transactions);
|
||||
|
||||
Set<QName> excludeAspects = new HashSet<QName>(1);
|
||||
excludeAspects.add(ContentModel.ASPECT_TEMPORARY);
|
||||
|
||||
// get all nodes, exclude nodes with temporary aspect
|
||||
GetNodesParameters parameters = new GetNodesParameters();
|
||||
parameters.setTransactionIds(transactionIds);
|
||||
parameters.setExcludeAspects(excludeAspects);
|
||||
JSONArray nodes = getNodes(parameters, 0, 51);
|
||||
}*/
|
||||
|
||||
public void testNodeMetaData() throws Exception
|
||||
{
|
||||
long fromCommitTime = System.currentTimeMillis();
|
||||
@@ -1064,7 +559,6 @@ public class SOLRWebScriptTest extends BaseWebScriptTest
|
||||
JSONObject properties = node.getJSONObject("properties");
|
||||
Map<QName, String> propertyMap = getPropertyMap(properties);
|
||||
|
||||
// assertEquals("Incorrect number of aspects", 1, aspects.length());
|
||||
assertTrue("Expected author aspect", containsAspect(aspects, ContentModel.ASPECT_AUTHOR));
|
||||
assertTrue("Expected author property", containsProperty(propertyMap, ContentModel.PROP_AUTHOR, "steve"));
|
||||
|
||||
@@ -1104,6 +598,7 @@ public class SOLRWebScriptTest extends BaseWebScriptTest
|
||||
}
|
||||
|
||||
// make sure caches are warm - time last call
|
||||
@SuppressWarnings("unused")
|
||||
JSONArray nodesMetaData = getNodesMetaData(nodeIds, 0, 2001);
|
||||
nodesMetaData = getNodesMetaData(nodeIds, 0, 2001);
|
||||
|
||||
@@ -1176,63 +671,9 @@ public class SOLRWebScriptTest extends BaseWebScriptTest
|
||||
|
||||
String value = propertyMap.get(propName);
|
||||
return (value == null ? false : value.equals(propValue));
|
||||
// boolean success = false;
|
||||
// for(int i = 0; i < propertiesArray.length(); i++)
|
||||
// {
|
||||
// JSONObject prop = propertiesArray.getJSONObject(i);
|
||||
// prop.keys();
|
||||
// String qName = prop.getString("name");
|
||||
// String value = prop.getString("value");
|
||||
// if(qName.equals(QName.createQName(qName)))
|
||||
// {
|
||||
// success |= (propValue == null ? true : value.equals(propValue));
|
||||
// }
|
||||
// if(success)
|
||||
// {
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return success;
|
||||
}
|
||||
|
||||
/* private void buildTransactions3()
|
||||
{
|
||||
txnHelper.doInTransaction(new RetryingTransactionCallback<Void>()
|
||||
{
|
||||
public Void execute() throws Throwable
|
||||
{
|
||||
PropertyMap props = new PropertyMap();
|
||||
props.put(ContentModel.PROP_NAME, "Container1");
|
||||
container3 = nodeService.createNode(
|
||||
rootNodeRef,
|
||||
ContentModel.ASSOC_CHILDREN,
|
||||
ContentModel.ASSOC_CHILDREN,
|
||||
ContentModel.TYPE_FOLDER,
|
||||
props).getChildRef();
|
||||
|
||||
System.out.println("container1 = " + container1);
|
||||
|
||||
FileInfo content1Info = fileFolderService.create(container3, "Content1", ContentModel.TYPE_CONTENT);
|
||||
content1 = content1Info.getNodeRef();
|
||||
|
||||
container3NodeID = getNodeID(container3);
|
||||
content1NodeID = getNodeID(content1);
|
||||
|
||||
ContentWriter writer = contentService.getWriter(content1Info.getNodeRef(), ContentModel.PROP_CONTENT, true);
|
||||
writer.putContent("test content");
|
||||
|
||||
if(logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("content1 = " + content1);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void testGetContent() throws Exception
|
||||
public void DISABLED_testGetContent() throws Exception
|
||||
{
|
||||
long nodeId = -1l;
|
||||
String propertyName = ContentModel.PROP_CONTENT.toString();
|
||||
@@ -1242,14 +683,12 @@ public class SOLRWebScriptTest extends BaseWebScriptTest
|
||||
String url = "/api/solr/content?nodeId=" + nodeId + "&propertyName=" + propertyName;
|
||||
TestWebScriptServer.GetRequest req = new TestWebScriptServer.GetRequest(url);
|
||||
Response response = sendRequest(req, Status.STATUS_OK, admin);
|
||||
if(logger.isDebugEnabled())
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("content1 = " + response.getContentAsString());
|
||||
}
|
||||
|
||||
assertEquals("Content length is incorrect", "test content".length(), response.getContentLength());
|
||||
|
||||
}*/
|
||||
}
|
||||
|
||||
private long getNodeID(NodeRef nodeRef)
|
||||
{
|
||||
|
Reference in New Issue
Block a user