本文整理了Java中azkaban.utils.Props.put()
方法的一些代码示例,展示了Props.put()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Props.put()
方法的具体详情如下:
包路径:azkaban.utils.Props
类名称:Props
方法名:put
[英]Put Double. Stores as String.
[中]放两个。存储为字符串。
代码示例来源:origin: azkaban/azkaban
private static void updateDerivedConfigs(final Props azkabanSettings) {
final boolean isSslEnabled = azkabanSettings.getBoolean("jetty.use.ssl", true);
final int port = isSslEnabled
? azkabanSettings.getInt("jetty.ssl.port", DEFAULT_SSL_PORT_NUMBER)
: azkabanSettings.getInt("jetty.port", DEFAULT_PORT_NUMBER);
// setting stats configuration for connectors
final String hostname = azkabanSettings.getString("jetty.hostname", "localhost");
azkabanSettings.put("server.hostname", hostname);
azkabanSettings.put("server.port", port);
azkabanSettings.put("server.useSSL", String.valueOf(isSslEnabled));
}
代码示例来源:origin: azkaban/azkaban
public static Props createMailProperties() {
final Props props = new Props();
props.put("job.failure.email", receiveAddr);
props.put("server.port", "114");
props.put("jetty.use.ssl", "false");
props.put("server.useSSL", "false");
props.put("jetty.port", "8786");
return props;
}
代码示例来源:origin: azkaban/azkaban
private static Props getH2Props(final String dbDir, final String sqlScriptsDir) {
final Props props = new Props();
props.put("database.type", "h2");
props.put("h2.path", dbDir);
props.put("database.sql.scripts.dir", sqlScriptsDir);
return props;
}
代码示例来源:origin: azkaban/azkaban
@Test
public void testJavaJob() throws Exception {
// initialize the Props
this.props.put(JavaProcessJob.JAVA_CLASS,
"azkaban.jobExecutor.WordCountLocal");
this.props.put("input", inputFile);
this.props.put("output", outputFile);
this.props.put("classpath", classPaths);
this.job.run();
}
代码示例来源:origin: azkaban/azkaban
@Test
public void testMultipleUnixCommands() throws Exception {
// Initialize the Props
this.props.put(ProcessJob.COMMAND, "pwd");
this.props.put("command.1", "date");
this.props.put("command.2", "whoami");
this.job.run();
}
代码示例来源:origin: azkaban/azkaban
/**
* this job should fail because it sets user.to.proxy = root which is black listed
*/
@Test(expected = RuntimeException.class)
public void testOneUnixCommandWithRootUser() throws Exception {
// Initialize the Props
this.props.removeLocal(CommonJobProperties.SUBMIT_USER);
this.props.put(JobProperties.USER_TO_PROXY, "root");
this.props.put("execute.as.user", "true");
this.props.put(ProcessJob.COMMAND, "ls -al");
this.job.run();
}
代码示例来源:origin: azkaban/azkaban
/**
* this job should fail because it sets user.to.proxy = azkaban which is black listed
*/
@Test(expected = RuntimeException.class)
public void testOneUnixCommandWithAzkabanUser() throws Exception {
// Initialize the Props
this.props.removeLocal(CommonJobProperties.SUBMIT_USER);
this.props.put(JobProperties.USER_TO_PROXY, "azkaban");
this.props.put("execute.as.user", "true");
this.props.put(ProcessJob.COMMAND, "ls -al");
this.job.run();
}
代码示例来源:origin: azkaban/azkaban
private ExecutorManager createMultiExecutorManagerInstance() throws Exception {
this.props.put(Constants.ConfigurationKeys.USE_MULTIPLE_EXECUTORS, "true");
this.props.put(Constants.ConfigurationKeys.QUEUEPROCESSING_ENABLED, "false");
this.loader.addExecutor("localhost", 12345);
this.loader.addExecutor("localhost", 12346);
return createExecutorManager();
}
代码示例来源:origin: azkaban/azkaban
/**
* this job should run fine if the props contain user.to.proxy
*/
@Test
public void testOneUnixCommandWithProxyUserInsteadOfSubmitUser() throws Exception {
// Initialize the Props
this.props.removeLocal(CommonJobProperties.SUBMIT_USER);
this.props.put(JobProperties.USER_TO_PROXY, "test_user");
this.props.put(ProcessJob.COMMAND, "ls -al");
this.job.run();
}
代码示例来源:origin: azkaban/azkaban
@Test
public void testLocalExecutorScenario() {
this.props.put(ConfigurationKeys.EXECUTOR_PORT, 12345);
final Throwable thrown = catchThrowable(() -> createExecutorManager());
assertThat(thrown).isInstanceOf(IllegalArgumentException.class);
assertThat(thrown.getMessage()).isEqualTo(
"azkaban.use.multiple.executors must be true. Single executor mode is not supported any more.");
}
代码示例来源:origin: azkaban/azkaban
@Test
public void testOneUnixCommand() throws Exception {
// Initialize the Props
this.props.put(ProcessJob.COMMAND, "ls -al");
this.job.run();
}
代码示例来源:origin: azkaban/azkaban
@Before
public void setup() {
this.serverProps = new Props();
this.serverProps
.put(MAX_CALLBACK_COUNT_PROPERTY_KEY, DEFAULT_MAX_CALLBACK_COUNT);
}
代码示例来源:origin: azkaban/azkaban
/**
* Make sure that URLs for analyzers and logviewers are fetched correctly by setting it manually
* and then fetching them
*/
@Test
public void testFetchURL() {
this.azkProps.put(Constants.ConfigurationKeys.AZKABAN_SERVER_EXTERNAL_TOPIC_URL
.replace("${topic}", "someTopic"), "This is a link");
assertTrue(
ExternalLinkUtils.getURLForTopic("someTopic", this.azkProps).equals("This is a link"));
}
}
代码示例来源:origin: azkaban/azkaban
@Before
public void setUp() {
// Empty server configuration
this.azkProps = new Props();
// Job configuration consisting of only an exec id and job id
this.jobProps = new Props();
this.jobProps.put(Constants.FlowProperties.AZKABAN_FLOW_EXEC_ID, 1);
this.jobId = "Some + job";
this.mockRequest = mock(HttpServletRequest.class);
}
代码示例来源:origin: azkaban/azkaban
@Test
public void testFailedUnixCommand() throws Exception {
// Initialize the Props
this.props.put(ProcessJob.COMMAND, "xls -al");
try {
this.job.run();
} catch (final RuntimeException e) {
Assert.assertTrue(true);
e.printStackTrace();
}
}
代码示例来源:origin: azkaban/azkaban
@Before
public void setUp() throws Exception {
final Props props = new Props();
props.put(PROJECT_TEMP_DIR, this.TEMP_DIR.getRoot().getAbsolutePath());
this.storageManager = mock(StorageManager.class);
this.projectLoader = mock(ProjectLoader.class);
this.executorLoader = mock(ExecutorLoader.class);
this.azkabanProjectLoader = new AzkabanProjectLoader(props, this.projectLoader,
this.storageManager, new FlowLoaderFactory(props), this.executorLoader);
}
代码示例来源:origin: azkaban/azkaban
/**
* this job should fail because there is no user.to.proxy and no CommonJobProperties.SUBMIT_USER
*/
@Test(expected = RuntimeException.class)
public void testOneUnixCommandWithNoUser() throws Exception {
// Initialize the Props
this.props.removeLocal(CommonJobProperties.SUBMIT_USER);
this.props.put(ProcessJob.COMMAND, "ls -al");
this.job.run();
}
代码示例来源:origin: azkaban/azkaban
public static UserManager createTestXmlUserManager() {
final Props props = new Props();
props.put(XmlUserManager.XML_FILE_PARAM, ExecutionsTestUtil.getDataRootDir()
+ "azkaban-users.xml");
final UserManager manager = new XmlUserManager(props);
return manager;
}
代码示例来源:origin: azkaban/azkaban
@Test
public void testNoCleanupCase2() throws Exception {
final Props props = new Props();
props.put(AZKABAN_STORAGE_ARTIFACT_MAX_RETENTION, 10);
final StorageCleaner storageCleaner = new StorageCleaner(props, this.storage,
this.databaseOperator);
assertTrue(storageCleaner.isCleanupPermitted());
storageCleaner.cleanupProjectArtifacts(TEST_PROJECT_ID);
verify(this.storage, never()).delete(anyString());
}
代码示例来源:origin: azkaban/azkaban
@Test
public void testMultipleExecutorScenario() throws Exception {
this.props.put(Constants.ConfigurationKeys.USE_MULTIPLE_EXECUTORS, "true");
final Executor executor1 = this.loader.addExecutor("localhost", 12345);
final Executor executor2 = this.loader.addExecutor("localhost", 12346);
final ExecutorManager manager = createExecutorManager();
final Set<Executor> activeExecutors =
new HashSet(manager.getAllActiveExecutors());
Assert.assertArrayEquals(activeExecutors.toArray(), new Executor[]{
executor1, executor2});
}
内容来源于网络,如有侵权,请联系作者删除!