mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Introduce Mockito unit tests into Share AMP project
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@91731 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -335,7 +335,8 @@ public abstract class CopyMoveLinkFileToBaseAction extends RMActionExecuterAbstr
|
|||||||
{
|
{
|
||||||
NodeRef child = null;
|
NodeRef child = null;
|
||||||
List<ChildAssociationRef> children = getNodeService().getChildAssocs(parent);
|
List<ChildAssociationRef> children = getNodeService().getChildAssocs(parent);
|
||||||
for (ChildAssociationRef childAssoc : children) {
|
for (ChildAssociationRef childAssoc : children)
|
||||||
|
{
|
||||||
NodeRef childNodeRef = childAssoc.getChildRef();
|
NodeRef childNodeRef = childAssoc.getChildRef();
|
||||||
String existingChildName = (String)getNodeService().getProperty(childNodeRef, ContentModel.PROP_NAME);
|
String existingChildName = (String)getNodeService().getProperty(childNodeRef, ContentModel.PROP_NAME);
|
||||||
if(existingChildName.equals(childName))
|
if(existingChildName.equals(childName))
|
||||||
|
@@ -831,7 +831,8 @@ public class RecordsManagementAdminServiceImpl extends RecordsManagementAdminBas
|
|||||||
M2Property targetProperty = findProperty(propQName, deserializedModel);
|
M2Property targetProperty = findProperty(propQName, deserializedModel);
|
||||||
|
|
||||||
// Need to count backwards to remove constraints
|
// Need to count backwards to remove constraints
|
||||||
for (int i = targetProperty.getConstraints().size() - 1; i >= 0; i--) {
|
for (int i = targetProperty.getConstraints().size() - 1; i >= 0; i--)
|
||||||
|
{
|
||||||
String ref = targetProperty.getConstraints().get(i).getRef();
|
String ref = targetProperty.getConstraints().get(i).getRef();
|
||||||
targetProperty.removeConstraintRef(ref);
|
targetProperty.removeConstraintRef(ref);
|
||||||
}
|
}
|
||||||
|
@@ -221,7 +221,8 @@ public class DateParameterProcessor extends ParameterProcessor implements Parame
|
|||||||
String namePrefix = this.getName() + ".";
|
String namePrefix = this.getName() + ".";
|
||||||
if(StringUtils.isBlank(substitutionFragment) || this.getName().toLowerCase().contains(substitutionFragment.toLowerCase()))
|
if(StringUtils.isBlank(substitutionFragment) || this.getName().toLowerCase().contains(substitutionFragment.toLowerCase()))
|
||||||
{
|
{
|
||||||
for(String field: ALL_FIELDS_FOR_SUBSTITUTION_QUERY) {
|
for(String field: ALL_FIELDS_FOR_SUBSTITUTION_QUERY)
|
||||||
|
{
|
||||||
suggestions.add(namePrefix + field);
|
suggestions.add(namePrefix + field);
|
||||||
if(suggestions.size() >= maximumNumberSuggestions)
|
if(suggestions.size() >= maximumNumberSuggestions)
|
||||||
{
|
{
|
||||||
@@ -231,7 +232,8 @@ public class DateParameterProcessor extends ParameterProcessor implements Parame
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for(String field: ALL_FIELDS_FOR_SUBSTITUTION_QUERY) {
|
for(String field: ALL_FIELDS_FOR_SUBSTITUTION_QUERY)
|
||||||
|
{
|
||||||
String prefixFieldName = namePrefix + field;
|
String prefixFieldName = namePrefix + field;
|
||||||
if(prefixFieldName.toLowerCase().contains(substitutionFragment.toLowerCase()))
|
if(prefixFieldName.toLowerCase().contains(substitutionFragment.toLowerCase()))
|
||||||
{
|
{
|
||||||
|
@@ -163,7 +163,8 @@ public class RmSubstitutionSuggestionsGet extends DeclarativeWebScript
|
|||||||
* @param fragment
|
* @param fragment
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private List<String> getSubPathSuggestions(WebScriptRequest req, final String path, final String fragment, boolean unfiled) {
|
private List<String> getSubPathSuggestions(WebScriptRequest req, final String path, final String fragment, boolean unfiled)
|
||||||
|
{
|
||||||
List<String> pathSuggestions = new ArrayList<String>();
|
List<String> pathSuggestions = new ArrayList<String>();
|
||||||
if((path != null) && path.startsWith("/") && (fragment != null))
|
if((path != null) && path.startsWith("/") && (fragment != null))
|
||||||
{
|
{
|
||||||
@@ -177,7 +178,8 @@ public class RmSubstitutionSuggestionsGet extends DeclarativeWebScript
|
|||||||
{
|
{
|
||||||
boolean foundThisPathFragment = false;
|
boolean foundThisPathFragment = false;
|
||||||
List<ChildAssociationRef> children = nodeService.getChildAssocs(currentNode);
|
List<ChildAssociationRef> children = nodeService.getChildAssocs(currentNode);
|
||||||
for (ChildAssociationRef childAssoc : children) {
|
for (ChildAssociationRef childAssoc : children)
|
||||||
|
{
|
||||||
NodeRef childNodeRef = childAssoc.getChildRef();
|
NodeRef childNodeRef = childAssoc.getChildRef();
|
||||||
String fileName = (String) nodeService.getProperty(childNodeRef, ContentModel.PROP_NAME);
|
String fileName = (String) nodeService.getProperty(childNodeRef, ContentModel.PROP_NAME);
|
||||||
if(fileName.equals(pathFragment) && isNodeRefAppropriateForPathSuggestion(childNodeRef, unfiled))
|
if(fileName.equals(pathFragment) && isNodeRefAppropriateForPathSuggestion(childNodeRef, unfiled))
|
||||||
@@ -199,7 +201,8 @@ public class RmSubstitutionSuggestionsGet extends DeclarativeWebScript
|
|||||||
{
|
{
|
||||||
String lowerCaseFragment = fragment.toLowerCase();
|
String lowerCaseFragment = fragment.toLowerCase();
|
||||||
List<ChildAssociationRef> children = nodeService.getChildAssocs(currentNode);
|
List<ChildAssociationRef> children = nodeService.getChildAssocs(currentNode);
|
||||||
for (ChildAssociationRef childAssoc : children) {
|
for (ChildAssociationRef childAssoc : children)
|
||||||
|
{
|
||||||
NodeRef childNodeRef = childAssoc.getChildRef();
|
NodeRef childNodeRef = childAssoc.getChildRef();
|
||||||
String fileName = (String) nodeService.getProperty(childNodeRef, ContentModel.PROP_NAME);
|
String fileName = (String) nodeService.getProperty(childNodeRef, ContentModel.PROP_NAME);
|
||||||
if((fragment.isEmpty() || fileName.toLowerCase().startsWith(lowerCaseFragment)) && isNodeRefAppropriateForPathSuggestion(childNodeRef, unfiled))
|
if((fragment.isEmpty() || fileName.toLowerCase().startsWith(lowerCaseFragment)) && isNodeRefAppropriateForPathSuggestion(childNodeRef, unfiled))
|
||||||
|
@@ -426,10 +426,6 @@ public class RmRestApiTest extends BaseRMWebScriptTestCase implements RecordsMan
|
|||||||
JSONArray customRefsObj = (JSONArray)dataObj.get("customReferences");
|
JSONArray customRefsObj = (JSONArray)dataObj.get("customReferences");
|
||||||
assertNotNull("JSON 'customReferences' object was null", customRefsObj);
|
assertNotNull("JSON 'customReferences' object was null", customRefsObj);
|
||||||
|
|
||||||
// for (int i = 0; i < customRefsObj.length(); i++) {
|
|
||||||
// System.out.println(customRefsObj.getString(i));
|
|
||||||
// }
|
|
||||||
|
|
||||||
assertTrue("There should be at least two custom references. Found " + customRefsObj, customRefsObj.length() >= 2);
|
assertTrue("There should be at least two custom references. Found " + customRefsObj, customRefsObj.length() >= 2);
|
||||||
|
|
||||||
// GET a specific custom reference definition.
|
// GET a specific custom reference definition.
|
||||||
|
Reference in New Issue
Block a user