Search in sources :

Example 6 with MockServer

use of org.apache.knox.test.mock.MockServer in project knox by apache.

the class GatewayPortMappingFailTest method setup.

/**
 * Creates a deployment of a gateway instance that all test methods will share.  This method also creates a
 * registry of sorts for all of the services that will be used by the test methods.
 * The createTopology method is used to create the topology file that would normally be read from disk.
 * The driver.setupGateway invocation is where the creation of GATEWAY_HOME occurs.
 * <p/>
 * This would normally be done once for this suite but the failure tests start affecting each other depending
 * on the state the last 'active' url
 *
 * @throws Exception Thrown if any failure occurs.
 */
@BeforeClass
public static void setup() throws Exception {
    LOG_ENTER();
    eeriePort = GatewayPortMappingFuncTest.getAvailablePort(1240, 49151);
    ConcurrentHashMap<String, Integer> topologyPortMapping = new ConcurrentHashMap<String, Integer>();
    topologyPortMapping.put("eerie", eeriePort);
    masterServer = new MockServer("master", true);
    GatewayTestConfig config = new GatewayTestConfig();
    config.setGatewayPath("gateway");
    config.setTopologyPortMapping(topologyPortMapping);
    driver.setResourceBase(WebHdfsHaFuncTest.class);
    driver.setupLdap(0);
    driver.setupService("WEBHDFS", "http://vm.local:50070/webhdfs", "/eerie/webhdfs", USE_MOCK_SERVICES);
    driver.setupGateway(config, "eerie", GatewayPortMappingFuncTest.createTopology("WEBHDFS", driver.getLdapUrl(), masterServer.getPort()), USE_GATEWAY);
    LOG_EXIT();
}
Also used : MockServer(org.apache.knox.test.mock.MockServer) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) BeforeClass(org.junit.BeforeClass)

Aggregations

MockServer (org.apache.knox.test.mock.MockServer)6 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)3 File (java.io.File)2 Properties (java.util.Properties)2 ReleaseTest (org.apache.knox.test.category.ReleaseTest)2 Before (org.junit.Before)2 BeforeClass (org.junit.BeforeClass)2 Test (org.junit.Test)2 HttpHost (org.apache.http.HttpHost)1 AuthScope (org.apache.http.auth.AuthScope)1 UsernamePasswordCredentials (org.apache.http.auth.UsernamePasswordCredentials)1 AuthCache (org.apache.http.client.AuthCache)1 CredentialsProvider (org.apache.http.client.CredentialsProvider)1 CloseableHttpResponse (org.apache.http.client.methods.CloseableHttpResponse)1 HttpPut (org.apache.http.client.methods.HttpPut)1 HttpClientContext (org.apache.http.client.protocol.HttpClientContext)1 BasicScheme (org.apache.http.impl.auth.BasicScheme)1 BasicAuthCache (org.apache.http.impl.client.BasicAuthCache)1 BasicCredentialsProvider (org.apache.http.impl.client.BasicCredentialsProvider)1 CloseableHttpClient (org.apache.http.impl.client.CloseableHttpClient)1