ACS-4005: Removing duplicate RestTest class.

This commit is contained in:
mpichura
2022-12-05 14:29:19 +01:00
parent 85349293c4
commit 7cd154ef86
12 changed files with 245 additions and 316 deletions

View File

@@ -1,89 +0,0 @@
package org.alfresco.rest;
import java.lang.reflect.Method;
import org.alfresco.dataprep.WorkflowService;
import org.alfresco.rest.core.RestProperties;
import org.alfresco.rest.core.RestWrapper;
import org.alfresco.rest.rules.RulesTestsUtils;
import org.alfresco.utility.LogFactory;
import org.alfresco.utility.TasProperties;
import org.alfresco.utility.data.DataContent;
import org.alfresco.utility.data.DataGroup;
import org.alfresco.utility.data.DataLink;
import org.alfresco.utility.data.DataSite;
import org.alfresco.utility.data.DataUserAIS;
import org.alfresco.utility.data.DataWorkflow;
import org.alfresco.utility.model.SiteModel;
import org.alfresco.utility.network.ServerHealth;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.BeforeSuite;
@ContextConfiguration("classpath:alfresco-restapi-context.xml")
public abstract class RestTest extends AbstractTestNGSpringContextTests
{
private static Logger LOG = LogFactory.getLogger();
@Autowired
protected RestProperties restProperties;
@Autowired
protected TasProperties properties;
@Autowired
protected ServerHealth serverHealth;
@Autowired
protected RestWrapper restClient;
@Autowired
protected DataUserAIS dataUser;
@Autowired
protected DataSite dataSite;
@Autowired
protected DataContent dataContent;
@Autowired
protected DataGroup dataGroup;
@Autowired
protected DataWorkflow dataWorkflow;
@Autowired
protected DataLink dataLink;
@Autowired
protected WorkflowService workflow;
@Autowired
protected RulesTestsUtils rulesUtils;
protected SiteModel testSite;
@BeforeSuite(alwaysRun = true)
public void checkServerHealth() throws Exception
{
super.springTestContextPrepareTestInstance();
serverHealth.assertServerIsOnline();
testSite = dataSite.createPublicRandomSite();
}
@BeforeMethod(alwaysRun=true)
public void showStartTestInfo(Method method)
{
LOG.info(String.format("*** STARTING Test: [%s] ***",method.getName()));
}
@AfterMethod(alwaysRun=true)
public void showEndTestInfo(Method method)
{
LOG.info(String.format("*** ENDING Test: [%s] ***", method.getName()));
}
}

View File

@@ -26,7 +26,6 @@
package org.alfresco.rest.rules;
import static java.util.stream.Collectors.toList;
import static org.alfresco.rest.actions.access.AccessRestrictionUtil.ERROR_MESSAGE_ACCESS_RESTRICTED;
import static org.alfresco.rest.actions.access.AccessRestrictionUtil.MAIL_ACTION;
import static org.alfresco.rest.rules.RulesTestsUtils.CHECKIN_ACTION;
@@ -58,11 +57,9 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.IntStream;
import javax.json.Json;
import javax.json.JsonObject;
import org.alfresco.rest.RestTest;
import org.alfresco.rest.model.RestActionBodyExecTemplateModel;
import org.alfresco.rest.model.RestActionConstraintModel;
import org.alfresco.rest.model.RestCompositeConditionDefinitionModel;
@@ -83,7 +80,7 @@ import org.testng.annotations.Test;
* Tests for POST /nodes/{nodeId}/rule-sets/{ruleSetId}/rules.
*/
@Test(groups = {TestGroup.RULES})
public class CreateRulesTests extends RestTest
public class CreateRulesTests extends RulesRestTest
{
private UserModel user;
private SiteModel site;

View File

@@ -26,7 +26,6 @@
package org.alfresco.rest.rules;
import static java.util.stream.Collectors.toList;
import static org.alfresco.utility.constants.UserRole.SiteCollaborator;
import static org.alfresco.utility.constants.UserRole.SiteContributor;
import static org.alfresco.utility.constants.UserRole.SiteManager;
@@ -41,7 +40,6 @@ import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.alfresco.rest.RestTest;
import org.alfresco.rest.model.RestRuleModel;
import org.alfresco.rest.model.RestRuleModelsCollection;
import org.alfresco.utility.model.FolderModel;
@@ -56,7 +54,7 @@ import org.testng.annotations.Test;
* Tests for DELETE /nodes/{nodeId}/rule-sets/{ruleSetId}/rules/{ruleId}.
*/
@Test(groups = {TestGroup.RULES})
public class DeleteRulesTests extends RestTest
public class DeleteRulesTests extends RulesRestTest
{
private static final String FAKE_NODE_REF = "fake-node-id";

View File

@@ -36,7 +36,6 @@ import java.util.List;
import java.util.Map;
import org.alfresco.dataprep.CMISUtil;
import org.alfresco.rest.RestTest;
import org.alfresco.rest.model.RestActionBodyExecTemplateModel;
import org.alfresco.rest.model.RestNodeModel;
import org.alfresco.rest.model.RestRuleExecutionModel;
@@ -56,7 +55,7 @@ import org.testng.annotations.Test;
* Tests for POST /nodes/{nodeId}/rule-executions.
*/
@Test(groups = { TestGroup.RULES})
public class ExecuteRulesTests extends RestTest
public class ExecuteRulesTests extends RulesRestTest
{
private UserModel user;

View File

@@ -32,7 +32,6 @@ import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import org.alfresco.rest.RestTest;
import org.alfresco.rest.model.RestRuleModel;
import org.alfresco.rest.model.RestRuleModelsCollection;
import org.alfresco.rest.model.RestRuleSetLinkModel;
@@ -49,7 +48,7 @@ import org.testng.annotations.Test;
* Tests for GET /nodes/{nodeId}/rule-sets/{ruleSetId}/rules with rule inheritance.
*/
@Test(groups = {TestGroup.RULES})
public class GetInheritedRulesTests extends RestTest
public class GetInheritedRulesTests extends RulesRestTest
{
private UserModel user;
private SiteModel site;

View File

@@ -36,8 +36,6 @@ import static org.springframework.http.HttpStatus.OK;
import java.util.List;
import com.google.common.collect.ImmutableMap;
import org.alfresco.rest.RestTest;
import org.alfresco.rest.model.RestRuleModel;
import org.alfresco.rest.model.RestRuleSetLinkModel;
import org.alfresco.rest.model.RestRuleSetModel;
@@ -57,7 +55,7 @@ import org.testng.annotations.Test;
* Tests for GET /nodes/{nodeId}/rule-sets and /nodes/{nodeId}/rule-sets/{ruleSetId}.
*/
@Test (groups = { TestGroup.RULES })
public class GetRuleSetsTests extends RestTest
public class GetRuleSetsTests extends RulesRestTest
{
private UserModel user;
private SiteModel site;

View File

@@ -26,7 +26,6 @@
package org.alfresco.rest.rules;
import static java.util.stream.Collectors.toList;
import static org.alfresco.utility.constants.UserRole.SiteCollaborator;
import static org.alfresco.utility.report.log.Step.STEP;
import static org.junit.Assert.assertTrue;
@@ -39,7 +38,6 @@ import java.util.List;
import java.util.stream.IntStream;
import java.util.stream.Stream;
import org.alfresco.rest.RestTest;
import org.alfresco.rest.model.RestRuleModel;
import org.alfresco.rest.model.RestRuleModelsCollection;
import org.alfresco.utility.model.FolderModel;
@@ -53,7 +51,7 @@ import org.testng.annotations.Test;
* Tests for GET /nodes/{nodeId}/rule-sets/{ruleSetId}/rules and GET /nodes/{nodeId}/rule-sets/{ruleSetId}/rules/{ruleId}.
*/
@Test(groups = {TestGroup.RULES})
public class GetRulesTests extends RestTest
public class GetRulesTests extends RulesRestTest
{
private UserModel user;
private SiteModel site;

View File

@@ -26,7 +26,6 @@
package org.alfresco.rest.rules;
import static java.util.stream.Collectors.toList;
import static org.alfresco.utility.report.log.Step.STEP;
import static org.springframework.http.HttpStatus.FORBIDDEN;
import static org.springframework.http.HttpStatus.OK;
@@ -35,8 +34,6 @@ import java.util.List;
import java.util.stream.IntStream;
import com.google.common.collect.Lists;
import org.alfresco.rest.RestTest;
import org.alfresco.rest.model.RestRuleModel;
import org.alfresco.rest.model.RestRuleSetModel;
import org.alfresco.utility.constants.UserRole;
@@ -48,7 +45,7 @@ import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@Test (groups = { TestGroup.RULES })
public class ReorderRules extends RestTest
public class ReorderRulesTests extends RulesRestTest
{
private UserModel user;
private SiteModel site;

View File

@@ -35,7 +35,6 @@ import static org.springframework.http.HttpStatus.NO_CONTENT;
import static org.springframework.http.HttpStatus.OK;
import org.alfresco.dataprep.CMISUtil;
import org.alfresco.rest.RestTest;
import org.alfresco.rest.model.RestRuleModel;
import org.alfresco.rest.model.RestRuleModelsCollection;
import org.alfresco.rest.model.RestRuleSetLinkModel;
@@ -53,7 +52,7 @@ import org.testng.annotations.Test;
* Tests for /nodes/{nodeId}/rule-set-links.
*/
@Test(groups = {TestGroup.RULES})
public class RuleSetLinksTests extends RestTest
public class RuleSetLinksTests extends RulesRestTest
{
private UserModel user;
private SiteModel site;

View File

@@ -0,0 +1,36 @@
/*
* #%L
* Alfresco Remote API
* %%
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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/>.
* #L%
*/
package org.alfresco.rest.rules;
import org.alfresco.rest.RestTest;
import org.springframework.beans.factory.annotation.Autowired;
public class RulesRestTest extends RestTest
{
@Autowired
protected RulesTestsUtils rulesUtils;
}

View File

@@ -33,7 +33,6 @@ import static org.springframework.http.HttpStatus.FORBIDDEN;
import static org.springframework.http.HttpStatus.NOT_FOUND;
import static org.springframework.http.HttpStatus.OK;
import org.alfresco.rest.RestTest;
import org.alfresco.rest.model.RestRuleSettingsModel;
import org.alfresco.utility.model.FolderModel;
import org.alfresco.utility.model.SiteModel;
@@ -46,7 +45,7 @@ import org.testng.annotations.Test;
* Tests for GET and PUT /nodes/{nodeId}/rule-settings/{ruleSettingKey}.
*/
@Test (groups = { TestGroup.RULES })
public class SetInheritanceTests extends RestTest
public class SetInheritanceTests extends RulesRestTest
{
private UserModel siteOwner;
private SiteModel site;

View File

@@ -48,8 +48,6 @@ import java.util.List;
import java.util.Map;
import com.google.common.collect.ImmutableMap;
import org.alfresco.rest.RestTest;
import org.alfresco.rest.model.RestActionBodyExecTemplateModel;
import org.alfresco.rest.model.RestCompositeConditionDefinitionModel;
import org.alfresco.rest.model.RestRuleModel;
@@ -64,7 +62,7 @@ import org.testng.annotations.Test;
* Tests for PUT /nodes/{nodeId}/rule-sets/{ruleSetId}/rules.
*/
@Test (groups = { TestGroup.RULES })
public class UpdateRulesTests extends RestTest
public class UpdateRulesTests extends RulesRestTest
{
private UserModel user;
private SiteModel site;