use of com.hortonworks.streamline.common.Config in project streamline by hortonworks.
the class EmailServiceRegistrarTest method testRegister.
@Test
public void testRegister() throws Exception {
Cluster cluster = getTestCluster(1L);
EmailServiceRegistrar registrar = initializeServiceRegistrar();
Config config = new Config();
config.setAny("host", "host");
config.setAny("port", 1111);
config.setAny("ssl", true);
config.setAny("starttls", true);
config.setAny("protocol", "smtp");
config.setAny("auth", true);
registrar.register(cluster, config, Collections.emptyList());
Service emailService = environmentService.getServiceByName(cluster.getId(), Constants.Email.SERVICE_NAME);
assertNotNull(emailService);
ServiceConfiguration propertiesConf = environmentService.getServiceConfigurationByName(emailService.getId(), Constants.Email.CONF_TYPE_PROPERTIES);
assertNotNull(propertiesConf);
}
use of com.hortonworks.streamline.common.Config in project streamline by hortonworks.
the class StormTopologyActionsImpl method createYamlFile.
private String createYamlFile(TopologyLayout topology, boolean deploy) throws Exception {
Map<String, Object> yamlMap;
File f;
OutputStreamWriter fileWriter = null;
try {
f = new File(this.getFilePath(topology));
if (f.exists()) {
if (!f.delete()) {
throw new Exception("Unable to delete old storm " + "artifact for topology id " + topology.getId());
}
}
yamlMap = new LinkedHashMap<>();
yamlMap.put(StormTopologyLayoutConstants.YAML_KEY_NAME, generateStormTopologyName(topology));
TopologyDag topologyDag = topology.getTopologyDag();
LOG.debug("Initial Topology config {}", topology.getConfig());
StormTopologyFluxGenerator fluxGenerator = new StormTopologyFluxGenerator(topology, conf, getExtraJarsLocation(topology));
topologyDag.traverse(fluxGenerator);
for (Map.Entry<String, Map<String, Object>> entry : fluxGenerator.getYamlKeysAndComponents()) {
addComponentToCollection(yamlMap, entry.getValue(), entry.getKey());
}
Config topologyConfig = fluxGenerator.getTopologyConfig();
putAutoTokenDelegationConfig(topologyConfig, topologyDag);
registerEventLogger(topologyConfig);
Map<String, Object> properties = topologyConfig.getProperties();
if (!deploy) {
LOG.debug("Disabling topology event logger for test mode...");
properties.put("topology.eventlogger.executors", 0);
}
LOG.debug("Final Topology properties {}", properties);
addTopologyConfig(yamlMap, properties);
DumperOptions options = new DumperOptions();
options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
options.setSplitLines(false);
// options.setDefaultScalarStyle(DumperOptions.ScalarStyle.PLAIN);
Yaml yaml = new Yaml(options);
fileWriter = new OutputStreamWriter(new FileOutputStream(f), "UTF-8");
yaml.dump(yamlMap, fileWriter);
return f.getAbsolutePath();
} finally {
if (fileWriter != null) {
fileWriter.close();
}
}
}
use of com.hortonworks.streamline.common.Config in project streamline by hortonworks.
the class TopologyTestHelper method createStreamlineSink.
public static StreamlineSink createStreamlineSink(String id) {
StreamlineSink sink = new StreamlineSink();
sink.setId(id);
sink.setName("testSink_" + id);
sink.setConfig(new Config());
sink.setTransformationClass("dummyTransformation");
return sink;
}
use of com.hortonworks.streamline.common.Config in project streamline by hortonworks.
the class TopologyTestHelper method createStreamlineSource.
public static StreamlineSource createStreamlineSource(String id) {
Stream stream = createDefaultStream();
StreamlineSource source = new StreamlineSource(Sets.newHashSet(stream));
source.setId(id);
source.setName("testSource_" + id);
source.setConfig(new Config());
source.setTransformationClass("dummyTransformation");
return source;
}
use of com.hortonworks.streamline.common.Config in project streamline by hortonworks.
the class TestTopologyDagCreatingVisitor method visit.
@Override
public void visit(StreamlineSink sink) {
String id = sink.getId();
String sinkName = sink.getName();
if (!testRunSinksForEachSink.containsKey(sinkName)) {
throw new IllegalStateException("Not all sinks have corresponding TestRunSink instance. sink name: " + sinkName);
}
Config config = new Config(sink.getConfig());
TestRunSink testRunSink = testRunSinksForEachSink.get(sinkName);
testRunSink.setId(id);
testRunSink.setName(sinkName);
testRunSink.setConfig(config);
testRunSink.setTransformationClass(TestRunSinkBoltFluxComponent.class.getName());
testTopologyDag.add(testRunSink);
sinkToReplacedTestSinkMap.put(sinkName, testRunSink);
copyEdges(sink);
}
Aggregations