mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
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:
@@ -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);
|
||||
}
|
||||
|
@@ -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();
|
||||
@@ -94,7 +94,27 @@ 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;
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -23,25 +23,26 @@
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
package org.alfresco.rest.api.tests;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.alfresco.repo.web.util.JettyComponent;
|
||||
import org.alfresco.rest.api.tests.RepoService.TestNetwork;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
|
||||
public interface TestFixture
|
||||
{
|
||||
public final static int PORT = 8081;
|
||||
public final static String CONTEXT_PATH = "/alfresco";
|
||||
public final static String PUBLIC_API_SERVLET_NAME = "api";
|
||||
|
||||
ApplicationContext getApplicationContext();
|
||||
RepoService getRepoService();
|
||||
Iterator<TestNetwork> getNetworksIt();
|
||||
TestNetwork getRandomNetwork();
|
||||
Iterator<TestNetwork> networksIterator();
|
||||
JettyComponent getJettyComponent();
|
||||
TestNetwork getNetwork(String name);
|
||||
}
|
||||
package org.alfresco.rest.api.tests;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.alfresco.repo.web.util.JettyComponent;
|
||||
import org.alfresco.rest.api.tests.RepoService.TestNetwork;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
|
||||
public interface TestFixture
|
||||
{
|
||||
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";
|
||||
|
||||
ApplicationContext getApplicationContext();
|
||||
RepoService getRepoService();
|
||||
Iterator<TestNetwork> getNetworksIt();
|
||||
TestNetwork getRandomNetwork();
|
||||
Iterator<TestNetwork> networksIterator();
|
||||
JettyComponent getJettyComponent();
|
||||
TestNetwork getNetwork(String name);
|
||||
}
|
||||
|
@@ -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;
|
||||
@@ -93,10 +94,10 @@ public class PublicApiHttpClient
|
||||
private static final String PUBLICAPI_CMIS_URL = "{0}://{1}:{2}{3}{4}{5}/{6}/cmis/versions/{7}/{8}";
|
||||
private static final String PUBLICAPI_CMIS_URL_SUFFIX = "{0}/{1}/cmis/versions/{2}/{3}";
|
||||
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;
|
||||
|
Reference in New Issue
Block a user