本文整理了Java中org.apache.storm.utils.Utils.isValidConf()
方法的一些代码示例,展示了Utils.isValidConf()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.isValidConf()
方法的具体详情如下:
包路径:org.apache.storm.utils.Utils
类名称:Utils
方法名:isValidConf
暂无
代码示例来源:origin: apache/storm
@SuppressWarnings("unchecked")
public static boolean isValidConf(Map<String, Object> topoConfIn) {
Map<String, Object> origTopoConf = normalizeConf(topoConfIn);
try {
Map<String, Object> deserTopoConf = normalizeConf(
(Map<String, Object>) JSONValue.parseWithException(JSONValue.toJSONString(topoConfIn)));
return isValidConf(origTopoConf, deserTopoConf);
} catch (ParseException e) {
LOG.error("Json serialized config could not be deserialized", e);
}
return false;
}
代码示例来源:origin: apache/storm
@Override
public LocalTopology submitTopologyWithOpts(String topologyName, Map<String, Object> conf, StormTopology topology,
SubmitOptions submitOpts)
throws TException {
if (!Utils.isValidConf(conf)) {
throw new IllegalArgumentException("Topology conf is not json-serializable");
}
getNimbus().submitTopologyWithOpts(topologyName, null, JSONValue.toJSONString(conf), Utils.addVersions(topology), submitOpts);
return new LocalTopology(topologyName, topology);
}
代码示例来源:origin: apache/storm
@Test
public void testValidity() {
Map<String, Object> conf = new HashMap<String, Object>();
conf.put(Config.TOPOLOGY_DEBUG, true);
conf.put("q", "asasdasd");
conf.put("aaa", new Integer("123"));
conf.put("bbb", new Long("456"));
List<Object> testList = new ArrayList<Object>();
testList.add(1);
testList.add(2);
testList.add(new Integer("3"));
testList.add(new Long("4"));
testList.add(new Float("3"));
testList.add(new Double("4"));
testList.add(ImmutableList.of("asdf", 3));
conf.put("eee", testList);
Assert.assertTrue(Utils.isValidConf(conf));
}
代码示例来源:origin: apache/storm
@Test
public void testNonValidConfigChar() {
Map<String, Object> conf = new HashMap<String, Object>();
conf.put("q", ImmutableList.of("asdf", 'c'));
Assert.assertFalse(Utils.isValidConf(conf));
}
代码示例来源:origin: apache/storm
@Override
public LocalTopology submitTopology(String topologyName, Map<String, Object> conf, StormTopology topology)
throws TException {
if (!Utils.isValidConf(conf)) {
throw new IllegalArgumentException("Topology conf is not json-serializable");
}
getNimbus().submitTopology(topologyName, null, JSONValue.toJSONString(conf), Utils.addVersions(topology));
ISubmitterHook hook = (ISubmitterHook) Utils.getConfiguredClass(conf, Config.STORM_TOPOLOGY_SUBMISSION_NOTIFIER_PLUGIN);
if (hook != null) {
TopologyInfo topologyInfo = Utils.getTopologyInfo(topologyName, null, conf);
try {
hook.notify(topologyInfo, conf, topology);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
}
return new LocalTopology(topologyName, topology);
}
代码示例来源:origin: apache/storm
@Test
public void testNonValidConfigRandomObject() {
Map<String, Object> conf = new HashMap<String, Object>();
conf.put("q", ImmutableList.of("asdf", new TestConfigValidate()));
Assert.assertFalse(Utils.isValidConf(conf));
}
代码示例来源:origin: apache/storm
@Test
public void testIsValidConfEmpty() {
Map<String, Object> map0 = ImmutableMap.of();
Assert.assertTrue(Utils.isValidConf(map0, map0));
}
代码示例来源:origin: apache/storm
@Test
public void testIsValidConfPrimitiveNotEqual() {
Map<String, Object> map4 = ImmutableMap.of("k0", 2L);
Map<String, Object> map5 = ImmutableMap.of("k0", 3L);
Assert.assertFalse(Utils.isValidConf(map4, map5));
}
代码示例来源:origin: apache/storm
@Test
public void testIsValidConfEmptyNotEqual() {
Map<String, Object> map0 = ImmutableMap.of();
Map<String, Object> map5 = ImmutableMap.of("k0", 3L);
Assert.assertFalse(Utils.isValidConf(map0, map5));
}
代码示例来源:origin: apache/storm
ProgressListener progressListener, String asUser)
throws AlreadyAliveException, InvalidTopologyException, AuthorizationException, IllegalArgumentException {
if (!Utils.isValidConf(topoConf)) {
throw new IllegalArgumentException("Storm conf is not valid. Must be json-serializable");
代码示例来源:origin: apache/storm
@Test
public void testIsValidConfIdentical() {
Map<String, Object> map1 = ImmutableMap.of("k0", ImmutableList.of(1L, 2L), "k1", ImmutableSet.of('s', 'f'),
"k2", "as");
Assert.assertTrue(Utils.isValidConf(map1, map1));
}
代码示例来源:origin: apache/storm
@Test
public void testIsValidConfEqual() {
Map<String, Object> map1 = ImmutableMap.of("k0", ImmutableList.of(1L, 2L), "k1", ImmutableSet.of('s', 'f'),
"k2", "as");
Map<String, Object> map2 = ImmutableMap.of("k0", ImmutableList.of(1L, 2L), "k1", ImmutableSet.of('s', 'f'),
"k2", "as");
Assert.assertTrue(Utils.isValidConf(map1, map2)); // test deep equal
}
代码示例来源:origin: apache/storm
@Test
public void testIsValidConfNotEqual() {
Map<String, Object> map1 = ImmutableMap.of("k0", ImmutableList.of(1L, 2L), "k1", ImmutableSet.of('s', 'f'),
"k2", "as");
Map<String, Object> map3 = ImmutableMap.of("k0", ImmutableList.of(1L, 2L), "k1", ImmutableSet.of('s', 't'),
"k2", "as");
Assert.assertFalse(Utils.isValidConf(map1, map3));
}
代码示例来源:origin: org.apache.flink/flink-storm
public static void submitTopology(final String name, final Map stormConf, final FlinkTopology topology)
throws AlreadyAliveException, InvalidTopologyException {
if (!Utils.isValidConf(stormConf)) {
throw new IllegalArgumentException("Storm conf is not valid. Must be json-serializable");
代码示例来源:origin: org.apache.storm/storm-core
if(!Utils.isValidConf(stormConf)) {
throw new IllegalArgumentException("Storm conf is not valid. Must be json-serializable");
内容来源于网络,如有侵权,请联系作者删除!