use of org.apache.knox.gateway.config.impl.GatewayConfigImpl in project knox by apache.
the class KnoxCLITest method testDeleteOfNonExistAliasFromDefaultCluster.
@Test
public void testDeleteOfNonExistAliasFromDefaultCluster() throws Exception {
KnoxCLI cli = new KnoxCLI();
cli.setConf(new GatewayConfigImpl());
try {
int rc = 0;
outContent.reset();
String[] args1 = { "create-alias", "alias1", "--value", "testvalue1", "--master", "master" };
cli.run(args1);
// Delete invalid alias from the cluster
outContent.reset();
String[] args2 = { "delete-alias", "alias2", "--master", "master" };
rc = cli.run(args2);
assertEquals(0, rc);
assertTrue(outContent.toString().contains("No such alias exists in the cluster."));
} finally {
outContent.reset();
String[] args1 = { "delete-alias", "alias1", "--master", "master" };
cli.run(args1);
}
}
use of org.apache.knox.gateway.config.impl.GatewayConfigImpl in project knox by apache.
the class GatewayServer method main.
public static void main(String[] args) {
try {
configureLogging();
logSysProps();
CommandLine cmd = GatewayCommandLine.parse(args);
if (cmd.hasOption(GatewayCommandLine.HELP_LONG)) {
GatewayCommandLine.printHelp();
} else if (cmd.hasOption(GatewayCommandLine.VERSION_LONG)) {
printVersion();
} else if (cmd.hasOption(GatewayCommandLine.REDEPLOY_LONG)) {
redeployTopologies(cmd.getOptionValue(GatewayCommandLine.REDEPLOY_LONG));
} else {
buildProperties = loadBuildProperties();
services = instantiateGatewayServices();
if (services == null) {
log.failedToInstantiateGatewayServices();
}
GatewayConfig config = new GatewayConfigImpl();
if (config.isHadoopKerberosSecured()) {
configureKerberosSecurity(config);
}
Map<String, String> options = new HashMap<>();
options.put(GatewayCommandLine.PERSIST_LONG, Boolean.toString(cmd.hasOption(GatewayCommandLine.PERSIST_LONG)));
services.init(config, options);
if (!cmd.hasOption(GatewayCommandLine.NOSTART_LONG)) {
startGateway(config, services);
}
}
} catch (ParseException e) {
log.failedToParseCommandLine(e);
GatewayCommandLine.printHelp();
} catch (Exception e) {
log.failedToStartGateway(e);
// Make sure the process exits.
System.exit(1);
}
}
use of org.apache.knox.gateway.config.impl.GatewayConfigImpl in project knox by apache.
the class KnoxCLI method getGatewayConfig.
private GatewayConfig getGatewayConfig() {
GatewayConfig result;
Configuration conf = getConf();
if (conf != null && conf instanceof GatewayConfig) {
result = (GatewayConfig) conf;
} else {
result = new GatewayConfigImpl();
}
return result;
}
use of org.apache.knox.gateway.config.impl.GatewayConfigImpl in project knox by apache.
the class KnoxCLI method main.
/**
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {
PropertyConfigurator.configure(System.getProperty("log4j.configuration"));
int res = ToolRunner.run(new GatewayConfigImpl(), new KnoxCLI(), args);
System.exit(res);
}
use of org.apache.knox.gateway.config.impl.GatewayConfigImpl in project knox by apache.
the class DefaultMetricsServiceTest method lifecycle.
@Test
public void lifecycle() throws Exception {
DefaultMetricsService service = new DefaultMetricsService();
service.init(new GatewayConfigImpl(), null);
Assert.assertNotNull(service.getContext());
Assert.assertNotNull(service.getMetricRegistry());
Assert.assertNotNull(service.getMetricsReporters());
Assert.assertNotNull(service.getInstrumentationProviders());
service.start();
Assert.assertNotNull(service.getContext().getMetricsService());
MetricRegistry metricRegistry = (MetricRegistry) service.getContext().getProperty(DefaultMetricsService.METRICS_REGISTRY);
Assert.assertNotNull(metricRegistry);
service.stop();
}
Aggregations