Merged 5.2.N (5.2.2) to HEAD (5.2)

133650 jvonka: REPO-908: V1 REST API - minor test fwk improvement
   - change default port from 8081 to 8765 (to avoid clash with Share, if already running in local dev env)


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@137313 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Andrei Rebegea
2017-06-14 16:46:35 +00:00
parent c20b524add
commit d8dd6a77d0
5 changed files with 56 additions and 34 deletions

View File

@@ -95,7 +95,7 @@ public abstract class AbstractTestApi
};
AuthenticationDetailsProvider authenticationDetailsProvider = new UserAuthenticationDetailsProviderImpl(userDataService, "admin", "admin");
AuthenticatedHttp authenticatedHttp = new AuthenticatedHttp(httpClientProvider, authenticationDetailsProvider);
this.httpClient = new PublicApiHttpClient("localhost", TestFixture.PORT, TestFixture.CONTEXT_PATH,
this.httpClient = new PublicApiHttpClient(TestFixture.HOST, TestFixture.PORT, TestFixture.CONTEXT_PATH,
TestFixture.PUBLIC_API_SERVLET_NAME, authenticatedHttp);
this.publicApiClient = new PublicApiClient(httpClient, userDataService);
}

View File

@@ -54,12 +54,12 @@ public abstract class AbstractTestFixture implements TestFixture
protected TreeMap<String, TestNetwork> networks = new TreeMap<String, TestNetwork>();
protected TreeMap<String, SiteInformation> sites = new TreeMap<String, SiteInformation>();
protected String[] configLocations;
protected final String[] classLocations;
protected int port = 8081;
protected String contextPath = "/alfresco";
protected String servletName = "api";
protected String hostname = "localhost";
private String[] configLocations;
private final String[] classLocations;
private int port = PORT;
private String contextPath = CONTEXT_PATH;
private String servletName = PUBLIC_API_SERVLET_NAME;
protected JettyComponent jetty;
protected boolean cleanup;
protected Random random = new Random();
@@ -95,6 +95,26 @@ public abstract class AbstractTestFixture implements TestFixture
return port;
}
public String getContextPath()
{
return contextPath;
}
public String getServletName()
{
return servletName;
}
public String[] getConfigLocations()
{
return configLocations;
}
public String[] getClassLocations()
{
return classLocations;
}
protected abstract JettyComponent makeJettyComponent();
protected abstract void populateTestData();
protected abstract RepoService makeRepoService() throws Exception;

View File

@@ -68,7 +68,7 @@ public class EnterprisePublicApiTestFixture extends EnterpriseTestFixture
@Override
protected JettyComponent makeJettyComponent()
{
JettyComponent jettyComponent = new EnterpriseJettyComponent(port, contextPath, configLocations, classLocations);
JettyComponent jettyComponent = new EnterpriseJettyComponent(getPort(), getContextPath(), getConfigLocations(), getClassLocations());
return jettyComponent;
}

View File

@@ -33,7 +33,8 @@ import org.springframework.context.ApplicationContext;
public interface TestFixture
{
public final static int PORT = 8081;
public final static String HOST = "localhost";
public final static int PORT = 8765;
public final static String CONTEXT_PATH = "/alfresco";
public final static String PUBLIC_API_SERVLET_NAME = "api";

View File

@@ -43,6 +43,7 @@ import org.alfresco.opencmis.CMISDispatcherRegistry.Binding;
import org.alfresco.repo.tenant.TenantService;
import org.alfresco.repo.tenant.TenantUtil;
import org.alfresco.repo.web.scripts.BaseWebScriptTest.PatchMethod;
import org.alfresco.rest.api.tests.TestFixture;
import org.alfresco.rest.api.tests.client.AuthenticatedHttp.HttpRequestCallback;
import org.alfresco.rest.framework.Api;
import org.alfresco.rest.framework.Api.SCOPE;
@@ -95,8 +96,8 @@ public class PublicApiHttpClient
private static final String ATOM_PUB_URL = "{0}://{1}:{2}{3}cmisatom";
private String scheme = "http";
private String host = "localhost";
private int port = 8081;
private String host = TestFixture.HOST;
private int port = TestFixture.PORT;
private String contextPath;
private String servletName;