/** * Returns a copy of only the local values of this props */ public Props local() { return new Props(null, this._current); }
public Props getProps() { final Props props = new Props(null, this.getConfig()); props.put(Constants.NODE_TYPE, this.getType()); return props; }
@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); }
public static void main(final String[] args) throws Exception { final String propsFile = System.getenv(ProcessJob.JOB_PROP_ENV); System.out.println("propsFile: " + propsFile); final Props prop = new Props(null, propsFile); final WordCountLocal instance = new WordCountLocal("", prop); instance.run(); }
@Test public void testCreateDirectoryFlowLoader() { final FlowLoaderFactory loaderFactory = new FlowLoaderFactory(new Props(null)); final File projectDir = ExecutionsTestUtil.getFlowDir(FLOW_10_TEST_DIRECTORY); final FlowLoader loader = loaderFactory.createFlowLoader(projectDir); assertThat(loader instanceof DirectoryFlowLoader).isTrue(); }
@Test public void testCreateDirectoryYamlFlowLoader() { final FlowLoaderFactory loaderFactory = new FlowLoaderFactory(new Props(null)); final File projectDir = ExecutionsTestUtil.getFlowDir(FLOW_20_TEST_DIRECTORY); final FlowLoader loader = loaderFactory.createFlowLoader(projectDir); assertThat(loader instanceof DirectoryYamlFlowLoader).isTrue(); }
@Before public void setUp() throws Exception { this.props = new Props(); this.storageManager = mock(StorageManager.class); this.projectLoader = mock(ProjectLoader.class); this.executorLoader = mock(ExecutorLoader.class); this.azkabanProjectLoader = new AzkabanProjectLoader(this.props, this.projectLoader, this.storageManager, mock(FlowLoaderFactory.class), executorLoader); this.manager = new ProjectManager(this.azkabanProjectLoader, this.projectLoader, this.storageManager, this.props); }
@Test public void testInvalidSyntax() throws Exception { final Props propsGrandParent = new Props(); final Props propsParent = new Props(propsGrandParent); final Props props = new Props(propsParent); propsParent.put("my", "name"); props.put("res1", "$(my)"); final Props resolved = PropsUtils.resolveProps(props); Assert.assertEquals("$(my)", resolved.get("res1")); }
@Test public void testDuplicateProjectYamlFilesException() { final FlowLoaderFactory loaderFactory = new FlowLoaderFactory(new Props(null)); final File projectDir = ExecutionsTestUtil.getFlowDir(DUPLICATE_PROJECT_DIRECTORY); assertThatThrownBy(() -> loaderFactory.createFlowLoader(projectDir)) .isInstanceOf(ProjectManagerException.class) .hasMessageContaining( "Duplicate project YAML files found in the project directory. Only one is allowed."); }
@Before public void setup() { this.serverProps = new Props(); this.serverProps .put(MAX_CALLBACK_COUNT_PROPERTY_KEY, DEFAULT_MAX_CALLBACK_COUNT); }
@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); }
/** * Test that no validator directory exists when there is no xml configuration. */ @Test public void testNoValidatorsDir() { final Props props = new Props(this.baseProps); final XmlValidatorManager manager = new XmlValidatorManager(props); assertEquals( "XmlValidatorManager should contain 0 validator when no xml configuration " + "file is present.", manager.getValidatorsInfo().size(), 0); }
@Test public void oneGetJobCallback() { final Props jobProps = new Props(); jobProps.put("job.notification." + JobCallbackStatusEnum.FAILURE.name().toLowerCase() + ".1.url", "http://www.linkedin.com"); final Set<String> errors = new HashSet<>(); Assert.assertEquals(1, JobCallbackValidator.validate("bogusJob", this.serverProps, jobProps, errors)); Assert.assertEquals(0, errors.size()); }
@Test public void testLoadInvalidFlowYamlFileWithDuplicateNodeNames() { final DirectoryYamlFlowLoader loader = new DirectoryYamlFlowLoader(new Props()); loader.loadProjectFlow(this.project, ExecutionsTestUtil.getFlowDir(DUPLICATE_NODENAME_YAML_DIR)); checkFlowLoaderProperties(loader, 1, 0, 0); assertThat(loader.getErrors()).containsExactly( "Failed to validate nodeBean for " + DUPLICATE_NODENAME_FLOW_FILE + ". Duplicate nodes found or dependency undefined."); }
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; }
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; }
private Project getEmbeddedTestProject() throws Exception { final DirectoryFlowLoader loader = new DirectoryFlowLoader(new Props()); final Project project = new Project(11, "myTestProject"); loader.loadProjectFlow(project, ExecutionsTestUtil.getFlowDir("embedded")); assert loader.getErrors().size() == 0; project.setFlows(loader.getFlowMap()); project.setVersion(123); return project; }
@Before public void setUp() throws Exception { this.project = new Project(11, "myTestProject"); final DirectoryFlowLoader loader = new DirectoryFlowLoader(new Props()); loader.loadProjectFlow(this.project, ExecutionsTestUtil.getFlowDir("embedded")); Assert.assertEquals(0, loader.getErrors().size()); this.project.setFlows(loader.getFlowMap()); this.project.setVersion(123); }
@Before public void setUp() throws Exception { this.project = new Project(11, "myTestProject"); this.props = new Props(); final DirectoryFlowLoader loader = new DirectoryFlowLoader(this.props); loader.loadProjectFlow(this.project, ExecutionsTestUtil.getFlowDir("embedded")); Assert.assertEquals(0, loader.getErrors().size()); this.project.setFlows(loader.getFlowMap()); this.project.setVersion(123); }
private static Props getMySQLProps(final String sqlScriptsDir) { final Props props = new Props(); props.put("database.type", "mysql"); props.put("mysql.port", "3306"); props.put("mysql.host", "localhost"); props.put("mysql.database", "azkabanunittest"); props.put("mysql.user", "root"); props.put("database.sql.scripts.dir", sqlScriptsDir); props.put("mysql.password", ""); props.put("mysql.numconnections", 10); return props; }