Search in sources :

Example 41 with GatewayConfigImpl

use of org.apache.knox.gateway.config.impl.GatewayConfigImpl in project knox by apache.

the class GatewayGlobalConfigTest method testForDefaultDataDir.

@Test
public void testForDefaultDataDir() {
    String homeDirName = getHomeDirName("conf-site/conf/gateway-site.xml");
    System.setProperty(GatewayConfigImpl.GATEWAY_HOME_VAR, homeDirName);
    System.clearProperty(GatewayConfigImpl.GATEWAY_DATA_HOME_VAR);
    GatewayConfig config = new GatewayConfigImpl();
    assertTrue((homeDirName + File.separator + "data").equalsIgnoreCase(config.getGatewayDataDir()));
}
Also used : GatewayConfigImpl(org.apache.knox.gateway.config.impl.GatewayConfigImpl) GatewayConfig(org.apache.knox.gateway.config.GatewayConfig) Test(org.junit.Test)

Example 42 with GatewayConfigImpl

use of org.apache.knox.gateway.config.impl.GatewayConfigImpl in project knox by apache.

the class GatewayGlobalConfigTest method testDefaultTopologyName.

@Test(timeout = TestUtils.SHORT_TIMEOUT)
public void testDefaultTopologyName() {
    GatewayConfig config = new GatewayConfigImpl();
    assertThat(config.getDefaultTopologyName(), is(nullValue()));
    ((GatewayConfigImpl) config).set("default.app.topology.name", "test-topo-name");
    assertThat(config.getDefaultTopologyName(), is("test-topo-name"));
}
Also used : GatewayConfigImpl(org.apache.knox.gateway.config.impl.GatewayConfigImpl) GatewayConfig(org.apache.knox.gateway.config.GatewayConfig) Test(org.junit.Test)

Example 43 with GatewayConfigImpl

use of org.apache.knox.gateway.config.impl.GatewayConfigImpl in project knox by apache.

the class GatewayGlobalConfigTest method testDefaultCompressGzipMimeTypes.

/**
 * Test for the default Mime Types for Gzip compression.
 *
 * @since 0.12
 */
@Test
public void testDefaultCompressGzipMimeTypes() {
    final List<String> expected = Arrays.asList("text/javascript", "text/html", "text/plain", "text/xml", "text/css", "application/javascript", "application/x-javascript");
    String homeDirName = getHomeDirName("conf-site/conf/gateway-site.xml");
    System.setProperty(GatewayConfigImpl.GATEWAY_HOME_VAR, homeDirName);
    System.setProperty(GatewayConfigImpl.GATEWAY_DATA_HOME_VAR, homeDirName);
    GatewayConfig config = new GatewayConfigImpl();
    assertTrue("Default MIME Types for Gzip compression failed to match", config.getMimeTypesToCompress().containsAll(expected));
}
Also used : GatewayConfigImpl(org.apache.knox.gateway.config.impl.GatewayConfigImpl) GatewayConfig(org.apache.knox.gateway.config.GatewayConfig) Test(org.junit.Test)

Example 44 with GatewayConfigImpl

use of org.apache.knox.gateway.config.impl.GatewayConfigImpl in project knox by apache.

the class GatewayGlobalConfigTest method testDemoConfig.

@Test
public void testDemoConfig() {
    System.setProperty(GatewayConfigImpl.GATEWAY_HOME_VAR, getHomeDirName("conf-demo/conf/gateway-default.xml"));
    GatewayConfig config = new GatewayConfigImpl();
    assertThat(config.getGatewayPort(), is(8888));
    assertTrue(config.getExcludedSSLProtocols().get(0).equals("SSLv3"));
// assertThat( config.getShiroConfigFile(), is( "full-shiro.ini") );
}
Also used : GatewayConfigImpl(org.apache.knox.gateway.config.impl.GatewayConfigImpl) GatewayConfig(org.apache.knox.gateway.config.GatewayConfig) Test(org.junit.Test)

Example 45 with GatewayConfigImpl

use of org.apache.knox.gateway.config.impl.GatewayConfigImpl in project knox by apache.

the class DeploymentFactoryTest method testEmptyTopology.

@Test(timeout = TestUtils.MEDIUM_TIMEOUT)
public void testEmptyTopology() throws IOException, SAXException, ParserConfigurationException, TransformerException {
    GatewayConfig config = new GatewayConfigImpl();
    Topology topology = new Topology();
    topology.setName("test-topology");
    EnterpriseArchive archive = DeploymentFactory.createDeployment(config, topology);
    Document xml = XmlUtils.readXml(archive.get("/META-INF/topology.xml").getAsset().openStream());
    assertThat(xml, hasXPath("/topology/gateway"));
    assertThat(xml, hasXPath("/topology/name", equalTo("test-topology")));
}
Also used : EnterpriseArchive(org.jboss.shrinkwrap.api.spec.EnterpriseArchive) Topology(org.apache.knox.gateway.topology.Topology) Document(org.w3c.dom.Document) GatewayConfigImpl(org.apache.knox.gateway.config.impl.GatewayConfigImpl) GatewayConfig(org.apache.knox.gateway.config.GatewayConfig) Test(org.junit.Test)

Aggregations

GatewayConfigImpl (org.apache.knox.gateway.config.impl.GatewayConfigImpl)45 Test (org.junit.Test)42 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)20 GatewayConfig (org.apache.knox.gateway.config.GatewayConfig)19 File (java.io.File)13 Configuration (org.apache.hadoop.conf.Configuration)10 MasterService (org.apache.knox.gateway.services.security.MasterService)3 HttpClientBuilder (org.apache.http.impl.client.HttpClientBuilder)2 InstrumentationProvider (org.apache.knox.gateway.services.metrics.InstrumentationProvider)2 MetricRegistry (com.codahale.metrics.MetricRegistry)1 IOException (java.io.IOException)1 URISyntaxException (java.net.URISyntaxException)1 UnknownHostException (java.net.UnknownHostException)1 KeyStoreException (java.security.KeyStoreException)1 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)1 CertificateException (java.security.cert.CertificateException)1 HashMap (java.util.HashMap)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)1 TransformerException (javax.xml.transform.TransformerException)1