本文整理了Java中org.apache.storm.utils.Utils.readStormConfig()
方法的一些代码示例,展示了Utils.readStormConfig()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.readStormConfig()
方法的具体详情如下:
包路径:org.apache.storm.utils.Utils
类名称:Utils
方法名:readStormConfig
暂无
代码示例来源:origin: apache/storm
/**
* Uses Storm config as returned by {@code Utils.readStormConfig()}
* @param blobKey key of PMML model in Blobstore
*/
public ModelRunnerFromBlobStore(String blobKey, ModelOutputs modelOutputs) {
this(blobKey, modelOutputs, Utils.readStormConfig());
}
代码示例来源:origin: apache/storm
/**
* Constructor.
* @param conf the configuration for storm.
*/
public HttpForwardingMetricsServer(Map<String, Object> conf) {
this.conf = Utils.readStormConfig();
if (conf != null) {
this.conf.putAll(conf);
}
}
代码示例来源:origin: apache/storm
/**
* Returns PMML model from Blobstore. Uses Storm config as returned by {@code Utils.readStormConfig()}
* @param blobKey key of PMML model in Blobstore
*/
public static InputStream getPmmlModelBlob(String blobKey) {
return getPmmlModelBlob(blobKey, Utils.readStormConfig());
}
代码示例来源:origin: apache/storm
public static File getLogMetaDataFile(String fname) {
String[] subStrings = fname.split(Pattern.quote(FILE_SEPARATOR)); // TODO: does this work well on windows?
String id = subStrings[0];
Integer port = Integer.parseInt(subStrings[1]);
return getLogMetaDataFile(Utils.readStormConfig(), id, port);
}
代码示例来源:origin: apache/storm
public static void main(String[] args) {
Map<String, Object> conf = Utils.readStormConfig();
System.exit(HealthChecker.healthCheck(conf));
}
代码示例来源:origin: apache/storm
/**
* Creates a new {@link PMML} object representing the PMML model uploaded to the Blobstore with key specified as argument.
* Uses Storm config as returned by {@code Utils.readStormConfig()} to get the Blobstore client
*/
public static PMML newPmml(String blobKey) throws JAXBException, SAXException, IOException {
return newPmml(blobKey, Utils.readStormConfig());
}
代码示例来源:origin: apache/storm
public Map<String, Object> readStormConfigImpl() {
Map<String, Object> conf = Utils.readStormConfig();
ConfigValidation.validateFields(conf);
return conf;
}
代码示例来源:origin: apache/storm
/**
* Creates a new {@link Evaluator} object representing the PMML model uploaded to the Blobstore using the blob key specified as argument.
* Uses Storm config as returned by {@code Utils.readStormConfig()} to get the Blobstore client
*/
public static Evaluator newEvaluator(String blobKey) throws IOException, JAXBException, SAXException {
Objects.requireNonNull(blobKey);
return newEvaluator(blobKey, Utils.readStormConfig());
}
代码示例来源:origin: apache/storm
public static ModelOutputs toDefaultStream(String blobKey) {
return toDefaultStream(blobKey, Utils.readStormConfig());
}
代码示例来源:origin: apache/storm
public static void prepare() {
Config conf = new Config();
conf.putAll(Utils.readStormConfig());
store = Utils.getClientBlobStore(conf);
}
代码示例来源:origin: apache/storm
private LocalFsBlobStore initLocalFs() {
LocalFsBlobStore store = new LocalFsBlobStore();
Map<String, Object> conf = Utils.readStormConfig();
conf.put(Config.STORM_LOCAL_DIR, baseFile.getAbsolutePath());
conf.put(Config.STORM_PRINCIPAL_TO_LOCAL_PLUGIN, "org.apache.storm.security.auth.DefaultPrincipalToLocal");
this.conf = conf;
store.prepare(conf, null, null, null);
return store;
}
代码示例来源:origin: apache/storm
@Test
public void defaultYamlTest() throws InvocationTargetException, NoSuchMethodException, NoSuchFieldException, InstantiationException,
IllegalAccessException {
Map<String, Object> conf = Utils.readStormConfig();
ConfigValidation.validateFields(conf);
}
代码示例来源:origin: apache/storm
@Test(expected = KeyNotFoundException.class)
public void testKeyNotFoundException() throws Exception {
Map<String, Object> conf = Utils.readStormConfig();
String key1 = "key1";
conf.put(Config.STORM_LOCAL_DIR, "target");
LocalFsBlobStore bs = new LocalFsBlobStore();
LocalFsBlobStore spy = spy(bs);
Mockito.doReturn(true).when(spy).checkForBlobOrDownload(key1);
Mockito.doNothing().when(spy).checkForBlobUpdate(key1);
spy.prepare(conf, null, null, null);
spy.getBlob(key1, null);
}
代码示例来源:origin: apache/storm
/**
* allow cluster admin.
*/
@Test
public void testAuthorizedLogUserAllowClusterAdmin() {
Map<String, Object> stormConf = Utils.readStormConfig();
Map<String, Object> conf = new HashMap<>(stormConf);
conf.put(NIMBUS_ADMINS, Collections.singletonList("alice"));
ResourceAuthorizer authorizer = spy(new ResourceAuthorizer(conf));
doReturn(new ResourceAuthorizer.LogUserGroupWhitelist(Collections.emptySet(), Collections.emptySet()))
.when(authorizer).getLogUserGroupWhitelist(anyString());
doReturn(Collections.emptySet()).when(authorizer).getUserGroups(anyString());
assertTrue(authorizer.isAuthorizedLogUser("alice", "non-blank-fname"));
verifyStubMethodsAreCalledProperly(authorizer);
}
代码示例来源:origin: apache/storm
/**
* allow whitelisted topology user.
*/
@Test
public void testAuthorizedLogUserAllowWhitelistedTopologyUser() {
Map<String, Object> stormConf = Utils.readStormConfig();
Map<String, Object> conf = new HashMap<>(stormConf);
ResourceAuthorizer authorizer = spy(new ResourceAuthorizer(conf));
doReturn(new ResourceAuthorizer.LogUserGroupWhitelist(Collections.singleton("alice"), Collections.emptySet()))
.when(authorizer).getLogUserGroupWhitelist(anyString());
doReturn(Collections.emptySet()).when(authorizer).getUserGroups(anyString());
assertTrue(authorizer.isAuthorizedLogUser("alice", "non-blank-fname"));
verifyStubMethodsAreCalledProperly(authorizer);
}
代码示例来源:origin: apache/storm
@Test
public void authorizationFailsWhenFilterConfigured() {
Map<String, Object> stormConf = Utils.readStormConfig();
Map<String, Object> conf = new HashMap<>(stormConf);
ResourceAuthorizer authorizer = spy(new ResourceAuthorizer(conf));
Mockito.when(authorizer.isAuthorizedLogUser(anyString(), anyString())).thenReturn(false);
boolean authorized = authorizer.isUserAllowedToAccessFile("bob", "anyfile");
assertTrue(authorized); // no filter configured, allow anyone
conf.put(DaemonConfig.LOGVIEWER_FILTER, "someFilter");
authorized = authorizer.isUserAllowedToAccessFile("bob", "anyfile");
assertFalse(authorized); // filter configured, should fail all users
}
}
代码示例来源:origin: apache/storm
public static void main(String[] args) throws Exception {
Map<String, Object> conf = Utils.readStormConfig();
try (Supervisor supervisor = new Supervisor(conf, null, new StandaloneSupervisor(), new StormMetricsRegistry())) {
supervisor.shutdownAllWorkers(null, null);
}
}
}
代码示例来源:origin: apache/storm
private LogviewerLogSearchHandler getStubbedSearchHandler() {
Map<String, Object> stormConf = Utils.readStormConfig();
LogviewerLogSearchHandler handler = new LogviewerLogSearchHandler(stormConf, topoPath, null,
new ResourceAuthorizer(stormConf), new StormMetricsRegistry());
handler = spy(handler);
doReturn(logFiles).when(handler).logsForPort(any(), any());
doAnswer(invocationOnMock -> {
Object[] arguments = invocationOnMock.getArguments();
int fileOffset = (Integer) arguments[2];
String search = (String) arguments[4];
return new LogviewerLogSearchHandler.Matched(fileOffset, search, Collections.emptyList(), METRIC_SCANNED_FILES);
}).when(handler).findNMatches(any(), anyInt(), anyInt(), anyInt(), any());
return handler;
}
}
代码示例来源:origin: apache/storm
private static LogviewerLogSearchHandler getSearchHandlerWithPort(int port) {
Map<String, Object> stormConf = Utils.readStormConfig();
stormConf.put(DaemonConfig.LOGVIEWER_PORT, port);
return new LogviewerLogSearchHandler(stormConf, null, null,
new ResourceAuthorizer(stormConf), new StormMetricsRegistry());
}
代码示例来源:origin: apache/storm
private static LogviewerLogSearchHandler getSearchHandler() {
Map<String, Object> stormConf = Utils.readStormConfig();
return new LogviewerLogSearchHandler(stormConf, null, null,
new ResourceAuthorizer(stormConf), new StormMetricsRegistry());
}
内容来源于网络,如有侵权,请联系作者删除!