Merged HEAD-BUG-FIX (5.1/Cloud) to HEAD (5.1/Cloud)

90799: Reverse Merge HEAD-BUG-FIX (5.0/Cloud)
      << Test was using old api that has been removed >>
      90760: Merged V4.2-BUG-FIX (4.2.5) to HEAD-BUG-FIX (5.0/Cloud)
         90379: Merged DEV (4.2.4) to V4.2-BUG-FIX (4.2.4)
            90266: MNT-9342: Calling custom actions having properties declared as « multiple » from WebServices does not work.
            Added JUnit test to simulate the issue.
         90438: MNT-9342: Calling custom actions having properties declared as « multiple » from WebServices does not work.
         Fixed merge mistake for the test in r90379.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@94721 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2015-01-31 11:02:23 +00:00
parent 1168654d1e
commit 1f11c927f3
4 changed files with 0 additions and 168 deletions

View File

@@ -68,7 +68,6 @@ public class RemoteApi01TestSuite extends TestSuite
suite.addTest(new JUnit4TestAdapter(org.alfresco.repo.webdav.LockMethodTest.class));
suite.addTest(new JUnit4TestAdapter(org.alfresco.repo.webdav.WebDAVHelperIntegrationTest.class));
suite.addTest(new JUnit4TestAdapter(org.alfresco.repo.webdav.WebDAVMethodTest.class));
suite.addTestSuite(org.alfresco.repo.webservice.action.ActionWebServiceTest.class);
}
static void tests4(TestSuite suite) //

View File

@@ -1,93 +0,0 @@
/*
* Copyright (C) 2005-2014 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.webservice.action;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.security.authentication.AuthenticationComponent;
import org.alfresco.repo.webservice.types.NamedValue;
import org.alfresco.repo.webservice.types.ParentReference;
import org.alfresco.repo.webservice.types.Predicate;
import org.alfresco.repo.webservice.types.Reference;
import org.alfresco.repo.webservice.types.Store;
import org.alfresco.util.BaseSpringTest;
/**
* Test for ActionWebService class.
*
* @author alex.mukha
* @since 4.2.4
*/
public class ActionWebServiceTest extends BaseSpringTest
{
private AuthenticationComponent authenticationComponent;
private ActionWebService actionWebService;
private static String PARAM_PATH = "param-path";
private static String PARAM_CONTENT = "param-content";
@Override
protected String[] getConfigLocations()
{
return new String[] { "classpath:org/alfresco/repo/webservice/action/action-test.xml" };
}
@SuppressWarnings("deprecation")
@Override
protected void onSetUpInTransaction() throws Exception
{
this.actionWebService = (ActionWebService) this.applicationContext.getBean("actionWebService");
this.authenticationComponent = (AuthenticationComponent) this.applicationContext.getBean("authenticationComponent");
this.authenticationComponent.setSystemUserAsCurrentUser();
}
@SuppressWarnings("deprecation")
@Override
protected void onTearDownInTransaction() throws Exception
{
authenticationComponent.clearCurrentSecurityContext();
super.onTearDownInTransaction();
}
/**
* Test for MNT-9342
*/
public void testActionMultipleProperties() throws Exception
{
Store storeRef = new Store("workspace", "SpacesStore");
ParentReference companyHomeParent = new ParentReference(storeRef, null, "/app:company_home", ContentModel.ASSOC_CONTAINS.toString(), null);
Predicate predicate = new Predicate(new Reference[] { companyHomeParent }, null, null);
String[] paramPath = { "path1", "path2", "path4" };
String[] paramContent = { "content1", "content2", "content3" };
// Create the action to create the document
NamedValue[] parameters = new NamedValue[] { new NamedValue(PARAM_PATH, true, null, paramPath), new NamedValue(PARAM_CONTENT, true, null, paramContent) };
Action newAction1 = new Action();
newAction1.setActionName("create-doc-action-test");
newAction1.setTitle("Create Document");
newAction1.setDescription("This will create the document an content");
newAction1.setParameters(parameters);
ActionExecutionResult[] results = null;
// An exception will be thrown here if the number of parameters passed to action executer will not match
results = actionWebService.executeActions(predicate, new Action[] { newAction1 });
assertNotNull(results);
}
}

View File

@@ -1,62 +0,0 @@
/*
* Copyright (C) 2005-2014 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.webservice.action;
import java.util.ArrayList;
import java.util.List;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.repo.action.ParameterDefinitionImpl;
import org.alfresco.repo.action.executer.ActionExecuterAbstractBase;
import org.alfresco.service.cmr.action.ParameterDefinition;
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
import org.alfresco.service.cmr.repository.NodeRef;
/**
* Test action executer for {@link ActionWebServiceTest#testActionMultipleProperties()}
*
* @author alex.mukha
* @since 4.2.4
*/
public class TestMultiplePropertiesActionExecutor extends ActionExecuterAbstractBase
{
private static String PARAM_PATH = "param-path";
private static String PARAM_CONTENT = "param-content";
@SuppressWarnings("unchecked")
@Override
protected void executeImpl(org.alfresco.service.cmr.action.Action action, NodeRef actionedUponNodeRef)
{
if (((ArrayList<String>) action.getParameterValues().get(PARAM_PATH)).size() != 3)
{
throw new AlfrescoRuntimeException("There should be 3 parameters!");
}
if (((ArrayList<String>) action.getParameterValues().get(PARAM_CONTENT)).size() != 3)
{
throw new AlfrescoRuntimeException("There should be 3 parameters!");
}
}
@Override
protected void addParameterDefinitions(List<ParameterDefinition> paramList)
{
paramList.add(new ParameterDefinitionImpl(PARAM_PATH, DataTypeDefinition.TEXT, true, "Path of the file to create", true));
paramList.add(new ParameterDefinitionImpl(PARAM_CONTENT, DataTypeDefinition.TEXT, true, "String representation of the content", true));
}
}

View File

@@ -1,12 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans>
<import resource="classpath:alfresco/application-context.xml" />
<import resource="classpath:alfresco/web-services-application-context.xml" />
<bean id="create-doc-action-test"
class="org.alfresco.repo.webservice.action.TestMultiplePropertiesActionExecutor"
parent="action-executer">
</bean>
</beans>