From 1f11c927f317d2c64aec7832ac7fa154d513d3b1 Mon Sep 17 00:00:00 2001 From: Alan Davis Date: Sat, 31 Jan 2015 11:02:23 +0000 Subject: [PATCH] =?UTF-8?q?Merged=20HEAD-BUG-FIX=20(5.1/Cloud)=20to=20HEAD?= =?UTF-8?q?=20(5.1/Cloud)=20=20=20=2090799:=20Reverse=20Merge=20HEAD-BUG-F?= =?UTF-8?q?IX=20(5.0/Cloud)=20=20=20=20=20=20=20<<=20Test=20was=20using=20?= =?UTF-8?q?old=20api=20that=20has=20been=20removed=20>>=20=20=20=20=20=20?= =?UTF-8?q?=2090760:=20Merged=20V4.2-BUG-FIX=20(4.2.5)=20to=20HEAD-BUG-FIX?= =?UTF-8?q?=20(5.0/Cloud)=20=20=20=20=20=20=20=20=20=2090379:=20Merged=20D?= =?UTF-8?q?EV=20(4.2.4)=20to=20V4.2-BUG-FIX=20(4.2.4)=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=2090266:=20MNT-9342:=20Calling=20custom=20actio?= =?UTF-8?q?ns=20having=20properties=20declared=20as=20=C2=AB=20multiple=20?= =?UTF-8?q?=C2=BB=20from=20WebServices=20does=20not=20work.=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20Added=20JUnit=20test=20to=20simulate=20?= =?UTF-8?q?the=20issue.=20=20=20=20=20=20=20=20=20=2090438:=20MNT-9342:=20?= =?UTF-8?q?Calling=20custom=20actions=20having=20properties=20declared=20a?= =?UTF-8?q?s=20=C2=AB=20multiple=20=C2=BB=20from=20WebServices=20does=20no?= =?UTF-8?q?t=20work.=20=20=20=20=20=20=20=20=20=20Fixed=20merge=20mistake?= =?UTF-8?q?=20for=20the=20test=20in=20r90379.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@94721 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../org/alfresco/RemoteApi01TestSuite.java | 1 - .../action/ActionWebServiceTest.java | 93 ------------------- .../TestMultiplePropertiesActionExecutor.java | 62 ------------- .../repo/webservice/action/action-test.xml | 12 --- 4 files changed, 168 deletions(-) delete mode 100644 source/test-java/org/alfresco/repo/webservice/action/ActionWebServiceTest.java delete mode 100644 source/test-java/org/alfresco/repo/webservice/action/TestMultiplePropertiesActionExecutor.java delete mode 100644 source/test-resources/org/alfresco/repo/webservice/action/action-test.xml diff --git a/source/test-java/org/alfresco/RemoteApi01TestSuite.java b/source/test-java/org/alfresco/RemoteApi01TestSuite.java index 25f82aabcc..642670e5c5 100644 --- a/source/test-java/org/alfresco/RemoteApi01TestSuite.java +++ b/source/test-java/org/alfresco/RemoteApi01TestSuite.java @@ -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) // diff --git a/source/test-java/org/alfresco/repo/webservice/action/ActionWebServiceTest.java b/source/test-java/org/alfresco/repo/webservice/action/ActionWebServiceTest.java deleted file mode 100644 index d5f6489b98..0000000000 --- a/source/test-java/org/alfresco/repo/webservice/action/ActionWebServiceTest.java +++ /dev/null @@ -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 . - */ -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); - } -} diff --git a/source/test-java/org/alfresco/repo/webservice/action/TestMultiplePropertiesActionExecutor.java b/source/test-java/org/alfresco/repo/webservice/action/TestMultiplePropertiesActionExecutor.java deleted file mode 100644 index c65432a2b2..0000000000 --- a/source/test-java/org/alfresco/repo/webservice/action/TestMultiplePropertiesActionExecutor.java +++ /dev/null @@ -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 . - */ -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) action.getParameterValues().get(PARAM_PATH)).size() != 3) - { - throw new AlfrescoRuntimeException("There should be 3 parameters!"); - } - if (((ArrayList) action.getParameterValues().get(PARAM_CONTENT)).size() != 3) - { - throw new AlfrescoRuntimeException("There should be 3 parameters!"); - } - } - - @Override - protected void addParameterDefinitions(List 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)); - } -} diff --git a/source/test-resources/org/alfresco/repo/webservice/action/action-test.xml b/source/test-resources/org/alfresco/repo/webservice/action/action-test.xml deleted file mode 100644 index 0dbe28b7de..0000000000 --- a/source/test-resources/org/alfresco/repo/webservice/action/action-test.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - -