use of org.apache.knox.gateway.GatewayTestConfig in project knox by apache.
the class DeploymentFactoryFuncTest method testInvalidGenericProviderDeploymentContributor.
@Test(timeout = LONG_TIMEOUT)
public void testInvalidGenericProviderDeploymentContributor() throws ParserConfigurationException, SAXException, IOException, TransformerException {
LOG_ENTER();
GatewayConfig config = new GatewayTestConfig();
File targetDir = new File(System.getProperty("user.dir"), "target");
File gatewayDir = new File(targetDir, "gateway-home-" + UUID.randomUUID());
gatewayDir.mkdirs();
((GatewayTestConfig) config).setGatewayHomeDir(gatewayDir.getAbsolutePath());
File deployDir = new File(config.getGatewayDeploymentDir());
deployDir.mkdirs();
DefaultGatewayServices srvcs = new DefaultGatewayServices();
Map<String, String> options = new HashMap<>();
options.put("persist-master", "false");
options.put("master", "password");
try {
DeploymentFactory.setGatewayServices(srvcs);
srvcs.init(config, options);
} catch (ServiceLifecycleException e) {
// I18N not required.
e.printStackTrace();
}
Topology topology = new Topology();
topology.setName("test-cluster");
Service service = new Service();
service.setRole("WEBHDFS");
service.addUrl("http://localhost:50070/test-service-url");
topology.addService(service);
Provider provider = new Provider();
provider.setRole("authentication");
provider.setName("generic");
provider.setEnabled(true);
// = new ProviderParam();
Param param;
// Missing filter param.
// param.setName( "filter" );
// param.setValue( "org.opensource.ExistingFilter" );
// provider.addParam( param );
param = new Param();
param.setName("test-param-name");
param.setValue("test-param-value");
provider.addParam(param);
topology.addProvider(provider);
Enumeration<Appender> appenders = NoOpAppender.setUp();
try {
DeploymentFactory.createDeployment(config, topology);
fail("Should have throws IllegalArgumentException");
} catch (DeploymentException e) {
// Expected.
} finally {
NoOpAppender.tearDown(appenders);
}
LOG_EXIT();
}
Aggregations