code
stringlengths
23
201k
docstring
stringlengths
17
96.2k
func_name
stringlengths
0
235
language
stringclasses
1 value
repo
stringlengths
8
72
path
stringlengths
11
317
url
stringlengths
57
377
license
stringclasses
7 values
@Test public void testJobTypeManagerJobSetupWithJobComponentDependency() { final JobTypeManager manager = new JobTypeManager(this.testPluginDirPath, null, this.getClass().getClassLoader(), this.clusterRouter, null); Props jobProps = new Props(); jobProps.put("type", "anothertestjob"); jobProp...
Unit test of JobTypeManager's setup for jobs with 'job.dependency.components' specified.
testJobTypeManagerJobSetupWithJobComponentDependency
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/jobtype/JobTypeManagerWithDynamicClusterTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/jobtype/JobTypeManagerWithDynamicClusterTest.java
Apache-2.0
@Test public void testJobTypeManagerJobSetupWithoutJobtypeComponentDependency() { final JobTypeManager manager = new JobTypeManager(this.testPluginDirPath, null, this.getClass().getClassLoader(), this.clusterRouter, null); Props jobProps = new Props(); jobProps.put("type", "testjob"); jobProp...
Unit test of JobTypeManager's setup for jobs that depend on only a subset of components of the default cluster.
testJobTypeManagerJobSetupWithoutJobtypeComponentDependency
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/jobtype/JobTypeManagerWithDynamicClusterTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/jobtype/JobTypeManagerWithDynamicClusterTest.java
Apache-2.0
@Test (expected = JobTypeManagerException.class) public void testJobTypeManagerJobSetupWithUnknownClusterComponents() { final JobTypeManager manager = new JobTypeManager(this.testPluginDirPath, null, this.getClass().getClassLoader(), this.clusterRouter, null); final Props jobProps = new Props(); ...
Unit test of JobTypeManager's setup for jobs that depend on only a subset of components of the default cluster.
testJobTypeManagerJobSetupWithUnknownClusterComponents
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/jobtype/JobTypeManagerWithDynamicClusterTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/jobtype/JobTypeManagerWithDynamicClusterTest.java
Apache-2.0
@Test public void testJobTypeManagerJobSetupWithoutAnyComponentDependency() { final JobTypeManager manager = new JobTypeManager(this.testPluginDirPath, null, this.getClass().getClassLoader(), this.clusterRouter, null); Props jobProps = new Props(); jobProps.put("type", "testjob"); jobProps.pu...
Unit test of JobTypeManager's setup for jobs that depend on no components of the default cluster.
testJobTypeManagerJobSetupWithoutAnyComponentDependency
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/jobtype/JobTypeManagerWithDynamicClusterTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/jobtype/JobTypeManagerWithDynamicClusterTest.java
Apache-2.0
@Test public void testJobParamsPrecedenceOverClusterParams() { final JobTypeManager manager = new JobTypeManager(this.testPluginDirPath, null, this.getClass().getClassLoader(), this.clusterRouter, null); Props jobProps = new Props(); jobProps.put("type", "testjob"); jobProps.put(PIG_HOME, "/u...
Unit test of JobTypeManager's setup for jobs that depend on no components of the default cluster.
testJobParamsPrecedenceOverClusterParams
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/jobtype/JobTypeManagerWithDynamicClusterTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/jobtype/JobTypeManagerWithDynamicClusterTest.java
Apache-2.0
@Test public void testJobRunnerObservesClusterSpecificParams() { final JobTypeManager manager = new JobTypeManager(this.testPluginDirPath, null, this.getClass().getClassLoader(), this.clusterRouter, null); Props jobProps = new Props(); jobProps.put("type", "anothertestjob"); manager.createJo...
Verify that cluster-specific params can be observed by JobRunner through the passed-in parameter, `jobParams` to JobTypeManager.createJobParams() call.
testJobRunnerObservesClusterSpecificParams
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/jobtype/JobTypeManagerWithDynamicClusterTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/jobtype/JobTypeManagerWithDynamicClusterTest.java
Apache-2.0
@Test public void testPluginLoadPropsOverrideByClusterSpecificParams() { final JobTypeManager manager = new JobTypeManager(this.testPluginDirPath, null, this.getClass().getClassLoader(), this.clusterRouter, null); Props jobProps = new Props(); jobProps.put("type", "testjob"); jobProps.put(PIG...
Verify that overidden plugin load props are indeed overridden.
testPluginLoadPropsOverrideByClusterSpecificParams
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/jobtype/JobTypeManagerWithDynamicClusterTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/jobtype/JobTypeManagerWithDynamicClusterTest.java
Apache-2.0
@Test public void testPluginLoadPropsOverrideByClusterSpecificParamsNegative() { final Props jobProps = new Props(); jobProps.put("type", "testjob"); jobProps.put(PIG_HOME, "/user/pig/path"); jobProps.put(CommonJobProperties.JOB_CLUSTER_COMPONENTS_DEPENDENCIES, "hadoop"); // Create JobTypeManage...
Verify that overidden plugin load props and ignores if a property is missing.
testPluginLoadPropsOverrideByClusterSpecificParamsNegative
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/jobtype/JobTypeManagerWithDynamicClusterTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/jobtype/JobTypeManagerWithDynamicClusterTest.java
Apache-2.0
@Override public Props process(Props jobProps) { jobProps.put(INJECTED_ADDITION_PROP, INJECTED_ADDITION_PROP); return jobProps; }
A test implementation of {@link JobPropsProcessor} that injects a new property into jobs.
process
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/jobtype/TestJobPropsProcessor.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/jobtype/TestJobPropsProcessor.java
Apache-2.0
@Override public void uploadLogFile(final int execId, final String name, final int attempt, final File... files) throws ExecutorManagerException { for (final File file : files) { try { final String logs = FileUtils.readFileToString(file, "UTF-8"); LOGGER.info("Uploaded log for ["...
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutionsLogLoader). Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
uploadLogFile
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/logs/MockExecutionLogsLoader.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/logs/MockExecutionLogsLoader.java
Apache-2.0
@Override public LogData fetchLogs(final int execId, final String name, final int attempt, final int startByte, final int endByte, final long flowStartTime, final long flowEndTime) throws ExecutorManagerException { // TODO Auto-generated method stub return null; }
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutionsLogLoader). Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
fetchLogs
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/logs/MockExecutionLogsLoader.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/logs/MockExecutionLogsLoader.java
Apache-2.0
@Override public int removeExecutionLogsByTime(final long millis, final int recordCleanupLimit) throws ExecutorManagerException { // TODO Auto-generated method stub return 0; }
Used in unit tests to mock the "DB layer" (the real implementation is JdbcExecutionsLogLoader). Captures status updates of jobs and flows (in memory) so that they can be checked in tests.
removeExecutionLogsByTime
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/logs/MockExecutionLogsLoader.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/logs/MockExecutionLogsLoader.java
Apache-2.0
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((this.metricManager == null) ? 0 : this.metricManager.hashCode()); result = prime * result + ((this.name == null) ? 0 : this.name.hashCode()); result = prime * result + ((this.type == null) ? 0 : thi...
Dummy Metric to test Azkaban Metrics
hashCode
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/metric/FakeMetric.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/metric/FakeMetric.java
Apache-2.0
@Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof FakeMetric)) { return false; } final FakeMetric other = (FakeMetric) obj; if (this.metricManager == null) { if (other.me...
Dummy Metric to test Azkaban Metrics
equals
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/metric/FakeMetric.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/metric/FakeMetric.java
Apache-2.0
@Test public void managerStatusTest() { assertNotNull("Singleton Failed to instantiate", this.manager); assertTrue("Failed to enable metric manager", MetricReportManager.isAvailable()); this.manager.disableManager(); assertFalse("Failed to disable metric manager", MetricReportManager.isAvailable()); ...
Test enable disable and status methods
managerStatusTest
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/metric/MetricManagerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/metric/MetricManagerTest.java
Apache-2.0
@Test public void managerMetricMaintenanceTest() { assertEquals("Failed to add metric", this.manager.getAllMetrics().size(), 1); assertTrue("Failed to add metric", this.manager.getAllMetrics().contains(this.metric)); assertEquals("Failed to get metric by Name", this.manager.getMetricFromName("FakeMetric")...
Test adding and accessing metric methods
managerMetricMaintenanceTest
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/metric/MetricManagerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/metric/MetricManagerTest.java
Apache-2.0
@Test public void testParseStartupDependencies() throws Exception { Set<Dependency> finalDependencies = new HashSet<>(); try { // Get a raw json which contains null along with other valid dependencies String rawJson = getRawJSONDepsNullAndABC(); finalDependencies = parseStartupDependencies(r...
Test parsing of startup dependencies functionality. Even if json containing startup dependencies for a project contains a 'null' in the list, parseStartupDependencies should check for it and remove it from the final set of dependencies. @throws Exception
testParseStartupDependencies
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/project/ThinArchiveUtilsTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/project/ThinArchiveUtilsTest.java
Apache-2.0
@Test public void testWriteStartupDependencies() throws Exception { // Pass Set containing null and valid dependencies to writeStartupDependencies() writeStartupDependencies(startupDepsJsonFile, depSetABCAndNull); // Read the file that was written above to check if contains null String rawJson = File...
Test writing of startup dependencies to file. When Set of dependencies containing 'null' along with valid Dependency objects is passed to writeStartupDependencies(), the method should filter out null before writing the dependencies to the file. After writing to file, the test reads the file to check if any null is pr...
testWriteStartupDependencies
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/project/ThinArchiveUtilsTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/project/ThinArchiveUtilsTest.java
Apache-2.0
@Test public void testAddWarnLevelInfoMsg() { final ValidationReport report = new ValidationReport(); final String msg = "test warn level info message."; report.addWarnLevelInfoMsg(msg); for (final String info : report.getInfoMsgs()) { assertEquals("Info message added through addWarnLevelInfoMsg...
Test adding messages to {@link ValidationReport}
testAddWarnLevelInfoMsg
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/project/validator/ValidationReportTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/project/validator/ValidationReportTest.java
Apache-2.0
@Test public void testAddErrorLevelInfoMsg() { final ValidationReport report = new ValidationReport(); final String msg = "test error level error message."; report.addErrorLevelInfoMsg(msg); for (final String info : report.getInfoMsgs()) { assertEquals("Info message added through addErrorLevelIn...
Test adding messages to {@link ValidationReport}
testAddErrorLevelInfoMsg
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/project/validator/ValidationReportTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/project/validator/ValidationReportTest.java
Apache-2.0
@Test public void testAddMsgs() { final ValidationReport report = new ValidationReport(); final Set<String> msgs = new HashSet<>(); msgs.add("test msg 1."); msgs.add("test msg 2."); report.addWarningMsgs(msgs); assertEquals("Level of severity is not warn.", report.getStatus(), Validati...
Test adding messages to {@link ValidationReport}
testAddMsgs
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/project/validator/ValidationReportTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/project/validator/ValidationReportTest.java
Apache-2.0
@Test public void testAddModifiedRemovedFiles() { final ValidationReport report = new ValidationReport(); File a = new File("/a.txt"); File b = new File("/b.txt"); File c = new File("/c.txt"); File d = new File("/d.txt"); File e = new File("/e.txt"); final Set<File> removedFiles = new Has...
Test adding messages to {@link ValidationReport}
testAddModifiedRemovedFiles
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/project/validator/ValidationReportTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/project/validator/ValidationReportTest.java
Apache-2.0
@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.getValid...
Test that no validator directory exists when there is no xml configuration.
testNoValidatorsDir
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/project/validator/XmlValidatorManagerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/project/validator/XmlValidatorManagerTest.java
Apache-2.0
@Test(expected = ValidatorManagerException.class) public void testValidatorDoesNotExist() { final Props props = new Props(this.baseProps); final URL validatorUrl = Resources.getResource("project/testValidators"); final URL configUrl = Resources.getResource("test-conf/azkaban-validators-test1.xml"); pr...
Test that if the xml config file specifies a validator classname that does not exist, XmlValidatorManager should throw an exception.
testValidatorDoesNotExist
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/project/validator/XmlValidatorManagerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/project/validator/XmlValidatorManagerTest.java
Apache-2.0
@Test public void testLoadValidators() { final Props props = new Props(this.baseProps); final URL validatorUrl = Resources.getResource("project/testValidators"); final URL configUrl = Resources.getResource("test-conf/azkaban-validators-test2.xml"); props.put(ValidatorConfigs.VALIDATOR_PLUGIN_DIR, vali...
Test that if the xml config file is properly set, XmlValidatorManager loads the validator specified in the xml file. The TestValidator class specified in the xml configuration file is located with the jar file inside test resource directory project/testValidators.
testLoadValidators
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/project/validator/XmlValidatorManagerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/project/validator/XmlValidatorManagerTest.java
Apache-2.0
@Test public void testValidateProjectValidator() throws Exception { final Project project = mock(Project.class); final File projectDir = mock(File.class); final Props props = new Props(); final ProjectValidator mockValidator = mock(ProjectValidator.class); final XmlValidatorManager manager = new ...
Test that if the xml config file is properly set, XmlValidatorManager loads the validator specified in the xml file. The TestValidator class specified in the xml configuration file is located with the jar file inside test resource directory project/testValidators.
testValidateProjectValidator
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/project/validator/XmlValidatorManagerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/project/validator/XmlValidatorManagerTest.java
Apache-2.0
@Test public void testGetCacheKeyProjectValidatorCacheable() throws Exception { final Project project = mock(Project.class); final File projectDir = mock(File.class); final Props props = new Props(); final ProjectValidatorCacheable mockValidatorCacheable = mock(ProjectValidatorCacheable.class); f...
Test that if the xml config file is properly set, XmlValidatorManager loads the validator specified in the xml file. The TestValidator class specified in the xml configuration file is located with the jar file inside test resource directory project/testValidators.
testGetCacheKeyProjectValidatorCacheable
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/project/validator/XmlValidatorManagerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/project/validator/XmlValidatorManagerTest.java
Apache-2.0
@Before public void setup() throws Exception { timeStamp = System.currentTimeMillis(); }
Simple Auto Ramp Policy will be divided to 5 stages stage 1: 5% stage 2: 20% stage 3: 50% stage 4: 75% stage 5: 100%
setup
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/ramppolicy/SimpleAutoRampPolicyTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/ramppolicy/SimpleAutoRampPolicyTest.java
Apache-2.0
@Test public void Test_DisabledRamp() throws Exception { Props sysProps = new Props(); Props privateProps = new Props(); RampPolicy policy = new SimpleAutoRampPolicy(sysProps, privateProps); Project project = new Project(1, PROJECT_ID); Flow flow = new Flow(FLOW_ID); ExecutableFlow executable...
Simple Auto Ramp Policy will be divided to 5 stages stage 1: 5% stage 2: 20% stage 3: 50% stage 4: 75% stage 5: 100%
Test_DisabledRamp
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/ramppolicy/SimpleAutoRampPolicyTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/ramppolicy/SimpleAutoRampPolicyTest.java
Apache-2.0
@Test public void Test_PausedRamp() throws Exception { Props sysProps = new Props(); Props privateProps = new Props(); RampPolicy policy = new SimpleAutoRampPolicy(sysProps, privateProps); Project project = new Project(1, PROJECT_ID); Flow flow = new Flow(FLOW_ID); ExecutableFlow executableFl...
Simple Auto Ramp Policy will be divided to 5 stages stage 1: 5% stage 2: 20% stage 3: 50% stage 4: 75% stage 5: 100%
Test_PausedRamp
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/ramppolicy/SimpleAutoRampPolicyTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/ramppolicy/SimpleAutoRampPolicyTest.java
Apache-2.0
@Test public void Test_ZeroPercentRamp() throws Exception { Props sysProps = new Props(); Props privateProps = new Props(); RampPolicy policy = new SimpleAutoRampPolicy(sysProps, privateProps); Project project = new Project(1, PROJECT_ID); Flow flow = new Flow(FLOW_ID); ExecutableFlow executa...
Simple Auto Ramp Policy will be divided to 5 stages stage 1: 5% stage 2: 20% stage 3: 50% stage 4: 75% stage 5: 100%
Test_ZeroPercentRamp
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/ramppolicy/SimpleAutoRampPolicyTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/ramppolicy/SimpleAutoRampPolicyTest.java
Apache-2.0
@Test public void Test_FullRamp() throws Exception { Props sysProps = new Props(); Props privateProps = new Props(); RampPolicy policy = new SimpleAutoRampPolicy(sysProps, privateProps); Project project = new Project(1, PROJECT_ID); Flow flow = new Flow(FLOW_ID); ExecutableFlow executableFlow...
Simple Auto Ramp Policy will be divided to 5 stages stage 1: 5% stage 2: 20% stage 3: 50% stage 4: 75% stage 5: 100%
Test_FullRamp
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/ramppolicy/SimpleAutoRampPolicyTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/ramppolicy/SimpleAutoRampPolicyTest.java
Apache-2.0
@Test public void Test_OverflowStageRamp() throws Exception { Props sysProps = new Props(); Props privateProps = new Props(); RampPolicy policy = new SimpleAutoRampPolicy(sysProps, privateProps); Project project = new Project(1, PROJECT_ID); Flow flow = new Flow(FLOW_ID); ExecutableFlow execu...
Simple Auto Ramp Policy will be divided to 5 stages stage 1: 5% stage 2: 20% stage 3: 50% stage 4: 75% stage 5: 100%
Test_OverflowStageRamp
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/ramppolicy/SimpleAutoRampPolicyTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/ramppolicy/SimpleAutoRampPolicyTest.java
Apache-2.0
@Test public void Test_NegativeStageRamp() throws Exception { Props sysProps = new Props(); Props privateProps = new Props(); RampPolicy policy = new SimpleAutoRampPolicy(sysProps, privateProps); Project project = new Project(1, PROJECT_ID); Flow flow = new Flow(FLOW_ID); ExecutableFlow execu...
Simple Auto Ramp Policy will be divided to 5 stages stage 1: 5% stage 2: 20% stage 3: 50% stage 4: 75% stage 5: 100%
Test_NegativeStageRamp
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/ramppolicy/SimpleAutoRampPolicyTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/ramppolicy/SimpleAutoRampPolicyTest.java
Apache-2.0
@Test public void Test_StageRampWithoutRampModification() throws Exception { Props sysProps = new Props(); Props privateProps = new Props(); RampPolicy policy = new SimpleAutoRampPolicy(sysProps, privateProps); Map<Integer, String> projects = new HashMap(); projects.put(1, "spark-startkit"); // i...
Simple Auto Ramp Policy will be divided to 5 stages stage 1: 5% stage 2: 20% stage 3: 50% stage 4: 75% stage 5: 100%
Test_StageRampWithoutRampModification
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/ramppolicy/SimpleAutoRampPolicyTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/ramppolicy/SimpleAutoRampPolicyTest.java
Apache-2.0
@Test public void Test_StageRampWithRampModification() throws Exception { Props sysProps = new Props(); Props privateProps = new Props(); RampPolicy policy = new SimpleAutoRampPolicy(sysProps, privateProps); Map<Integer, String> projects = new HashMap(); projects.put(1, "spark-startkit"); // in 5...
Simple Auto Ramp Policy will be divided to 5 stages stage 1: 5% stage 2: 20% stage 3: 50% stage 4: 75% stage 5: 100%
Test_StageRampWithRampModification
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/ramppolicy/SimpleAutoRampPolicyTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/ramppolicy/SimpleAutoRampPolicyTest.java
Apache-2.0
private void compare(SlaOption option1, SlaOption option2) { assertThat(option1.getType()).isEqualTo(option2.getType()); assertThat(option1.getDuration()).isEqualTo(option2.getDuration()); assertThat(option1.getFlowName()).isEqualTo(option2.getFlowName()); assertThat(option1.getJobName()).isEqualTo(opti...
Compare if two {@link SlaOption} are the same
compare
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/sla/SlaOptionTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/sla/SlaOptionTest.java
Apache-2.0
@Test public void testNoCleanupCase1() throws Exception { final StorageCleaner storageCleaner = new StorageCleaner(new Props(), this.storage, this.databaseOperator); assertFalse(storageCleaner.isCleanupPermitted()); }
test default behavior. By default no artifacts should be cleaned up.
testNoCleanupCase1
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/storage/StorageCleanerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/storage/StorageCleanerTest.java
Apache-2.0
@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(...
test default behavior. By default no artifacts should be cleaned up.
testNoCleanupCase2
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/storage/StorageCleanerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/storage/StorageCleanerTest.java
Apache-2.0
@Test public void testCleanup() throws Exception { final Props props = new Props(); props.put(AZKABAN_STORAGE_ARTIFACT_MAX_RETENTION, 1); final StorageCleaner storageCleaner = new StorageCleaner(props, this.storage, this.databaseOperator); assertTrue(storageCleaner.isCleanupPermitted()); ...
test default behavior. By default no artifacts should be cleaned up.
testCleanup
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/storage/StorageCleanerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/storage/StorageCleanerTest.java
Apache-2.0
@Test public void periodTimerTest() { // get a new timechecker, start from now, repeat every minute. should // evaluate to false now, and true a minute later. final long baseTimeInMilliSeconds = 1000; final ReadablePeriod period = TimeUtils.parsePeriodString("10s"); DateTimeUtils.setCurrentMilli...
This test manipulates global states (time) in org.joda.time.DateTimeUtils . Thus this test can run in parallel with tests that do the same.
periodTimerTest
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/trigger/builtin/BasicTimeCheckerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/trigger/builtin/BasicTimeCheckerTest.java
Apache-2.0
@Test public void testPSTtoPDTunderUTC() { // Use a Date that is before the date in cron expression (i.e. Before March 8 2020) final DateTime pastTime = new DateTime(2020, 1, 1, 00, 00, 0, DateTimeZone.UTC); // Cron expression for 10:30 am UTC on March 8 2020 final String cronExpression = "0 30 10 8...
Test when PST-->PDT happens in 2020. -8:00 -> -7:00 See details why confusion happens during this change: https://en.wikipedia.org/wiki/Pacific_Time_Zone This test demonstrates that if the cron is under UTC settings, When daylight saving change occurs, 2:30 will be changed to 3:30 at that day.
testPSTtoPDTunderUTC
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/trigger/builtin/BasicTimeCheckerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/trigger/builtin/BasicTimeCheckerTest.java
Apache-2.0
@Test public void testPSTtoPDTdst2() { // Use a Date that is before the date in cron expression (i.e. Before March 8 2020) final DateTime pastTime = new DateTime(2020, 1, 1, 00, 00, 0, DateTimeZone.UTC); final String cronExpression = "0 30 2 8,9 3 ? 2020"; final BasicTimeChecker timeChecker = ...
Test when PST-->PDT happens in 2020. -8:00 -> -7:00 See details why confusion happens during this change: https://en.wikipedia.org/wiki/Pacific_Time_Zone This test demonstrates that 2:30 AM will not happen during the daylight saving day on Cron settings under PDT/PST. Since we let the cron triggered both at March 8th,...
testPSTtoPDTdst2
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/trigger/builtin/BasicTimeCheckerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/trigger/builtin/BasicTimeCheckerTest.java
Apache-2.0
@Test public void testPDTtoPSTdst1() { // Use a Date that is before the date in cron expression (i.e. Before Nov 1 2020) final DateTime pastTime = new DateTime(2020, 1, 1, 00, 00, 0, DateTimeZone.UTC); // 9:00 UTC == 1:00 PST (difference is 8 hours) final String cronExpression = "0 0 1 4,5 11 ? 2029...
Test when PDT-->PST happens in 2020. -7:00 -> -8:00 See details why confusion happens during this change: https://en.wikipedia.org/wiki/Pacific_Time_Zone This test cronDayLightPacificWinter1 is in order to compare against the cronDayLightPacificWinter2. In this Test, we let job run at 1:00 at Nov.1st, 2020. We know t...
testPDTtoPSTdst1
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/trigger/builtin/BasicTimeCheckerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/trigger/builtin/BasicTimeCheckerTest.java
Apache-2.0
@Test public void testPDTtoPSTdst2() { // Use a Date that is before the date in cron expression (i.e. Before Nov 1 2020) final DateTime pastTime = new DateTime(2020, 1, 1, 00, 00, 0, DateTimeZone.UTC); // 7:59 UTC == 0:59 PDT (difference is 7 hours) final String cronExpression = "0 59 0 4,5 11 ? 202...
Test when PDT-->PST happens in 2020. -7:00 -> -8:00 See details why confusion happens during this change: https://en.wikipedia.org/wiki/Pacific_Time_Zone This test cronDayLightPacificWinter2 is in order to be compared against the cronDayLightPacificWinter1. In this Test, we let job run at 0:59 at Nov.1st, 2020. it sh...
testPDTtoPSTdst2
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/trigger/builtin/BasicTimeCheckerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/trigger/builtin/BasicTimeCheckerTest.java
Apache-2.0
@Test public void testPDTtoPSTdst3() { // Use a Date that is before the date in cron expression (i.e. Before Nov 1 2020) final DateTime pastTime = new DateTime(2020, 1, 1, 00, 00, 0, DateTimeZone.UTC); // 9:30 UTC == 1:30 PST (difference is 8 hours) final String cronExpression = "0 30 1 4,5 11 ? 202...
Test when PDT-->PST happens in 2020. -7:00 -> -8:00 See details why confusion happens during this change: https://en.wikipedia.org/wiki/Pacific_Time_Zone This test is a supplement to cronDayLightPacificWinter1. Still, we let job run at 1:30 at Nov.1st, 2020. We know that we will have two 1:30 at that day. The test sh...
testPDTtoPSTdst3
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/trigger/builtin/BasicTimeCheckerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/trigger/builtin/BasicTimeCheckerTest.java
Apache-2.0
@Test public void testMissedScheduleExpiredTrigger() { // first check date is 2022/01/01 00:00 final DateTime pastTime = new DateTime(2022, 1, 1, 00, 00, 0, DateTimeZone.UTC); // trigger every 10 minute at first hour(00:00:00 ~ 00:59:59) of 2022/01/01 final String cronExpression = "0 0/10 0 1 JAN ? 20...
Test when PDT-->PST happens in 2020. -7:00 -> -8:00 See details why confusion happens during this change: https://en.wikipedia.org/wiki/Pacific_Time_Zone This test is a supplement to cronDayLightPacificWinter1. Still, we let job run at 1:30 at Nov.1st, 2020. We know that we will have two 1:30 at that day. The test sh...
testMissedScheduleExpiredTrigger
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/trigger/builtin/BasicTimeCheckerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/trigger/builtin/BasicTimeCheckerTest.java
Apache-2.0
@Test public void testMissedScheduleRecoverFromDB() { final DateTime now = DateTime.now(); // first check time was 1s ago final DateTime firstCheck = now.minusSeconds(1); // trigger every 30 minute final String cronExpression = "0 */30 * ? * * *"; final Date nextValidTime = Utils.parseCronExpr...
Test when PDT-->PST happens in 2020. -7:00 -> -8:00 See details why confusion happens during this change: https://en.wikipedia.org/wiki/Pacific_Time_Zone This test is a supplement to cronDayLightPacificWinter1. Still, we let job run at 1:30 at Nov.1st, 2020. We know that we will have two 1:30 at that day. The test sh...
testMissedScheduleRecoverFromDB
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/trigger/builtin/BasicTimeCheckerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/trigger/builtin/BasicTimeCheckerTest.java
Apache-2.0
@Test public void testMissedScheduleOnReset() { final DateTime now = DateTime.now(); // first check time was 1s ago final DateTime firstCheck = now.minusSeconds(1); // trigger every 30 minute final String cronExpression = "0 */30 * ? * * *"; final Date nextValidTime = Utils.parseCronExpression...
Test when PDT-->PST happens in 2020. -7:00 -> -8:00 See details why confusion happens during this change: https://en.wikipedia.org/wiki/Pacific_Time_Zone This test is a supplement to cronDayLightPacificWinter1. Still, we let job run at 1:30 at Nov.1st, 2020. We know that we will have two 1:30 at that day. The test sh...
testMissedScheduleOnReset
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/trigger/builtin/BasicTimeCheckerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/trigger/builtin/BasicTimeCheckerTest.java
Apache-2.0
@Test public void testUploadProjectFlag() throws Exception { final Permission permission = new Permission(); permission.addPermission(new Type[]{Type.UPLOADPROJECTS}); final int flags = permission.toFlags(); final Permission permission2 = new Permission(flags); assertThat(permission2.isPermission...
Verify that the binary bit for UPLOADPROJECTS is not turned on by setting the other permissions.
testUploadProjectFlag
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/user/PermissionTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/user/PermissionTest.java
Apache-2.0
@Test public void testFilePropNotSet() throws Exception { final Props props = new Props(this.baseProps); // Should throw try { final XmlUserManager manager = new XmlUserManager(props, () -> this.fileWatcher); } catch (final UndefinedPropertyException e) { return; } fail("XmlUserM...
Testing for when the xml path isn't set in properties.
testFilePropNotSet
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/user/XmlUserManagerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/user/XmlUserManagerTest.java
Apache-2.0
@Test public void testDoNotExist() throws Exception { final Props props = new Props(this.baseProps); props.put(XmlUserManager.XML_FILE_PARAM, "unit/test-conf/doNotExist.xml"); try { final UserManager manager = new XmlUserManager(props, () -> this.fileWatcher); } catch (final RuntimeException e)...
Testing for when the xml path doesn't exist.
testDoNotExist
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/user/XmlUserManagerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/user/XmlUserManagerTest.java
Apache-2.0
private Path getFilePath(final String testName) throws IOException { final URL configURL = Resources.getResource("test-conf/azkaban-users-test1.xml"); final String origPathStr = configURL.getPath(); // Create a new directory and copy the file in it. final Path workDir = temporaryFolder.newFolder().toPa...
Testing for when the xml path doesn't exist.
getFilePath
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/user/XmlUserManagerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/user/XmlUserManagerTest.java
Apache-2.0
@Test public void testAutoReload() throws Exception { final Props props = new Props(this.baseProps); final Path filePath = getFilePath("testAutoReload"); props.put(XmlUserManager.XML_FILE_PARAM, filePath.toString()); final CountDownLatch managerLoaded = setupMocks(filePath); final UserManager ma...
Test auto reload of user XML
testAutoReload
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/user/XmlUserManagerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/user/XmlUserManagerTest.java
Apache-2.0
@Test public void testAutoReloadFail() throws Exception { final Props props = new Props(this.baseProps); final Path filePath = getFilePath("testAutoReloadFail"); props.put(XmlUserManager.XML_FILE_PARAM, filePath.toString()); final CountDownLatch managerLoaded = setupMocks(filePath); final UserMa...
Negative test auto reload of user XML
testAutoReloadFail
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/user/XmlUserManagerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/user/XmlUserManagerTest.java
Apache-2.0
@Ignore @Test public void testBasicLoad() throws Exception { final Props props = new Props(this.baseProps); props.put(XmlUserManager.XML_FILE_PARAM, "unit/test-conf/azkaban-users-test1.xml"); UserManager manager = null; try { manager = new XmlUserManager(props, () -> this.fileWatcher)...
Negative test auto reload of user XML
testBasicLoad
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/user/XmlUserManagerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/user/XmlUserManagerTest.java
Apache-2.0
private CountDownLatch setupMocks(final Path filePath) throws IOException, InterruptedException { // mock registering the parent folder, but only if registered with the right args Mockito.doReturn(this.watchKey).when(this.fileWatcher).register( Paths.get(filePath.getParent().toString())); Mockito.d...
Negative test auto reload of user XML
setupMocks
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/user/XmlUserManagerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/user/XmlUserManagerTest.java
Apache-2.0
private void checkUser(final User user, final String rolesStr, final String groupsStr) { // Validating roles final HashSet<String> roleSet = new HashSet<>(user.getRoles()); if (rolesStr.isEmpty()) { if (!roleSet.isEmpty()) { String outputRoleStr = ""; for (final String role : roleSet) ...
Negative test auto reload of user XML
checkUser
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/user/XmlUserManagerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/user/XmlUserManagerTest.java
Apache-2.0
@Test public void testEncodingToUFT8() { assertTrue(ExternalLinkUtils.encodeToUTF8(" ").equals("%20")); assertTrue(ExternalLinkUtils.encodeToUTF8("+").equals("%2B")); assertTrue(ExternalLinkUtils.encodeToUTF8("/").equals("%2F")); assertTrue(ExternalLinkUtils.encodeToUTF8(":").equals("%3A")); asser...
Test validates that when we encode URLs to UTF-8, it does not give us incorrect encodings.
testEncodingToUFT8
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/utils/ExternalLinkUtilsTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/utils/ExternalLinkUtilsTest.java
Apache-2.0
@Test public void testParseExternalLinks() { final Map<String, Object> params = new HashMap<>(); params.put("level", ExternalLinkScope.FLOW.getName()); params.put("topic", "topic1"); final String flowLevelExternalLinkTopics = StrSubstitutor.replace(ConfigurationKeys.AZKABAN_SERVER_EXTERNAL_ANA...
Test validates that when we encode URLs to UTF-8, it does not give us incorrect encodings.
testParseExternalLinks
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/utils/ExternalLinkUtilsTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/utils/ExternalLinkUtilsTest.java
Apache-2.0
@Test public void testBuildExternalLinkUrl() { final HttpServletRequest mockRequest = mock(HttpServletRequest.class); when(mockRequest.getRequestURL()).thenReturn(new StringBuffer("http://localhost:8081/executor")); when(mockRequest.getQueryString()).thenReturn("execid=1"); when(mockRequest.getServerN...
Test validates that when we encode URLs to UTF-8, it does not give us incorrect encodings.
testBuildExternalLinkUrl
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/utils/ExternalLinkUtilsTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/utils/ExternalLinkUtilsTest.java
Apache-2.0
@Before public void beforeTest() { this.layout.setConversionPattern("%m"); }
Test output of PatternLayoutEscapedTest It should be appending stack traces, escaping new lines, quotes, tabs and backslashes This is necessary when we are logging these messages out as JSON objects
beforeTest
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/utils/PatternLayoutEscapedTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/utils/PatternLayoutEscapedTest.java
Apache-2.0
@Test public void testWithException() { try { throw new Exception("This is an exception"); } catch (final Exception e) { final LoggingEvent event = createEventWithException("There was an exception", e); // Stack trace might change if the codebase changes, but this prefix should always remain...
Test output of PatternLayoutEscapedTest It should be appending stack traces, escaping new lines, quotes, tabs and backslashes This is necessary when we are logging these messages out as JSON objects
testWithException
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/utils/PatternLayoutEscapedTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/utils/PatternLayoutEscapedTest.java
Apache-2.0
@Test public void testNewLine() { final LoggingEvent event = createMessageEvent("This message contains \n new lines"); assertTrue(this.layout.format(event).equals("This message contains \\n new lines")); }
Test output of PatternLayoutEscapedTest It should be appending stack traces, escaping new lines, quotes, tabs and backslashes This is necessary when we are logging these messages out as JSON objects
testNewLine
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/utils/PatternLayoutEscapedTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/utils/PatternLayoutEscapedTest.java
Apache-2.0
@Test public void testQuote() { final LoggingEvent event = createMessageEvent("This message contains \" quotes"); assertTrue(this.layout.format(event).equals("This message contains \\\" quotes")); }
Test output of PatternLayoutEscapedTest It should be appending stack traces, escaping new lines, quotes, tabs and backslashes This is necessary when we are logging these messages out as JSON objects
testQuote
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/utils/PatternLayoutEscapedTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/utils/PatternLayoutEscapedTest.java
Apache-2.0
@Test public void testTab() { final LoggingEvent event = createMessageEvent("This message contains a tab \t"); assertTrue(this.layout.format(event).equals("This message contains a tab \\t")); }
Test output of PatternLayoutEscapedTest It should be appending stack traces, escaping new lines, quotes, tabs and backslashes This is necessary when we are logging these messages out as JSON objects
testTab
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/utils/PatternLayoutEscapedTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/utils/PatternLayoutEscapedTest.java
Apache-2.0
@Test public void testBackSlash() { final LoggingEvent event = createMessageEvent("This message contains a backslash \\"); assertTrue(this.layout.format(event).equals("This message contains a backslash \\\\")); }
Test output of PatternLayoutEscapedTest It should be appending stack traces, escaping new lines, quotes, tabs and backslashes This is necessary when we are logging these messages out as JSON objects
testBackSlash
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/utils/PatternLayoutEscapedTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/utils/PatternLayoutEscapedTest.java
Apache-2.0
private LoggingEvent createMessageEvent(final String message) { return createEventWithException(message, null); }
Test output of PatternLayoutEscapedTest It should be appending stack traces, escaping new lines, quotes, tabs and backslashes This is necessary when we are logging these messages out as JSON objects
createMessageEvent
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/utils/PatternLayoutEscapedTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/utils/PatternLayoutEscapedTest.java
Apache-2.0
private LoggingEvent createEventWithException(final String message, final Exception e) { return new LoggingEvent(this.getClass().getCanonicalName(), this.logger, 0, Level.toLevel("INFO"), message, e); }
Test output of PatternLayoutEscapedTest It should be appending stack traces, escaping new lines, quotes, tabs and backslashes This is necessary when we are logging these messages out as JSON objects
createEventWithException
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/utils/PatternLayoutEscapedTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/utils/PatternLayoutEscapedTest.java
Apache-2.0
public static User getTestUser() { return new User("testUser"); }
Commonly used utils method for unit/integration tests
getTestUser
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/utils/TestUtils.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/utils/TestUtils.java
Apache-2.0
public static ExecutableFlow createTestExecutableFlow(final String projectName, final String flowName, final DispatchMethod dispatchMethod) throws IOException { final File jsonFlowFile = ExecutionsTestUtil.getFlowFile(projectName, flowName + ".flow"); final HashMap<String, Object> flowObj = (HashM...
Commonly used utils method for unit/integration tests
createTestExecutableFlow
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/utils/TestUtils.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/utils/TestUtils.java
Apache-2.0
public static ExecutableFlow createTestExecutableFlowFromYaml(final String projectName, final String flowName) throws IOException { final Project project = new Project(11, projectName); final DirectoryYamlFlowLoader loader = new DirectoryYamlFlowLoader(new Props()); loader.loadProjectFlow(project, Ex...
Commonly used utils method for unit/integration tests
createTestExecutableFlowFromYaml
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/utils/TestUtils.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/utils/TestUtils.java
Apache-2.0
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; }
Commonly used utils method for unit/integration tests
createTestXmlUserManager
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/utils/TestUtils.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/utils/TestUtils.java
Apache-2.0
public static String readResource(final String name, final Object parent) throws IOException { try (final InputStream is = parent.getClass().getResourceAsStream(name)) { return IOUtils.toString(is, Charsets.UTF_8).trim(); } }
Reads a resource into a String @param name Relative path to the resource (relative to the parent object's package) @param parent Instance of the class to use in finding the resource. The resource is looked up in the same package where the class of the parent object is in. @return Resource content as a String @throws I...
readResource
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/utils/TestUtils.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/utils/TestUtils.java
Apache-2.0
public static Project getEmbeddedTestProject(){ 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; proj...
Reads a resource into a String @param name Relative path to the resource (relative to the parent object's package) @param parent Instance of the class to use in finding the resource. The resource is looked up in the same package where the class of the parent object is in. @return Resource content as a String @throws I...
getEmbeddedTestProject
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/utils/TestUtils.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/utils/TestUtils.java
Apache-2.0
public static ExecutableFlow getEmbeddedTestExecutionFlow(){ Project project = getEmbeddedTestProject(); Flow flow = FlowUtils.getFlow(project, "jobe"); return new ExecutableFlow(project, flow); }
Reads a resource into a String @param name Relative path to the resource (relative to the parent object's package) @param parent Instance of the class to use in finding the resource. The resource is looked up in the same package where the class of the parent object is in. @return Resource content as a String @throws I...
getEmbeddedTestExecutionFlow
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/utils/TestUtils.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/utils/TestUtils.java
Apache-2.0
@Test public void testNegativePort() { Assert.assertFalse(Utils.isValidPort(-1)); Assert.assertFalse(Utils.isValidPort(-10)); }
Test class for azkaban.utils.Utils
testNegativePort
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/utils/UtilsTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/utils/UtilsTest.java
Apache-2.0
@Test public void testZeroPort() { Assert.assertFalse(Utils.isValidPort(0)); }
Test class for azkaban.utils.Utils
testZeroPort
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/utils/UtilsTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/utils/UtilsTest.java
Apache-2.0
@Test public void testOverflowPort() { Assert.assertFalse(Utils.isValidPort(70000)); Assert.assertFalse(Utils.isValidPort(65536)); }
Test class for azkaban.utils.Utils
testOverflowPort
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/utils/UtilsTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/utils/UtilsTest.java
Apache-2.0
@Test public void testValidPort() { Assert.assertTrue(Utils.isValidPort(1023)); Assert.assertTrue(Utils.isValidPort(10000)); Assert.assertTrue(Utils.isValidPort(3030)); Assert.assertTrue(Utils.isValidPort(1045)); }
Test class for azkaban.utils.Utils
testValidPort
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/utils/UtilsTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/utils/UtilsTest.java
Apache-2.0
@Test public void testValidCronExpressionV() { final DateTimeZone timezone = DateTimeZone.getDefault(); final int year = Calendar.getInstance().get(Calendar.YEAR); Assert.assertTrue(Utils.isCronExpressionValid("0 0 3 ? * *", timezone)); Assert.assertTrue(Utils.isCronExpressionValid("0 0 3 ? * * " + y...
Test class for azkaban.utils.Utils
testValidCronExpressionV
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/utils/UtilsTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/utils/UtilsTest.java
Apache-2.0
@Test public void testInvalidCronExpression() { final DateTimeZone timezone = DateTimeZone.getDefault(); Assert.assertFalse(Utils.isCronExpressionValid("0 0 3 * * *", timezone)); Assert.assertFalse(Utils.isCronExpressionValid("0 66 * ? * *", timezone)); Assert.assertFalse(Utils.isCronExpressionValid(...
Test class for azkaban.utils.Utils
testInvalidCronExpression
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/utils/UtilsTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/utils/UtilsTest.java
Apache-2.0
public <T> T query(final String baseQuery, final ResultSetHandler<T> resultHandler, final Object... params) throws SQLException { try { return this.queryRunner.query(baseQuery, resultHandler, params); } catch (final SQLException ex) { // todo kunkun-tang: Retry logics should be implement...
Executes the given Azkaban related SELECT SQL operations. it will call {@link AzkabanDataSource#getConnection()} inside queryrunner.query. @param baseQuery The SQL query statement to execute. @param resultHandler The handler used to create the result object @param params Initialize the PreparedStatement's IN parameter...
query
java
azkaban/azkaban
azkaban-db/src/main/java/azkaban/db/DatabaseOperator.java
https://github.com/azkaban/azkaban/blob/master/azkaban-db/src/main/java/azkaban/db/DatabaseOperator.java
Apache-2.0
public int update(final String updateClause, final Object... params) throws SQLException { int retryCount = 0; SQLException exception; String errorMsg = "Update failed: Reached maximum number of retries: " + AzDBUtil.MAX_RETRIES_ON_DEADLOCK; do { try { return this.queryRunner.updat...
Executes the given AZ related INSERT, UPDATE, or DELETE SQL statement. it will call {@link AzkabanDataSource#getConnection()} inside queryrunner.update. @param updateClause sql statements to execute @param params Initialize the PreparedStatement's IN parameters @return The number of rows updated.
update
java
azkaban/azkaban
azkaban-db/src/main/java/azkaban/db/DatabaseOperator.java
https://github.com/azkaban/azkaban/blob/master/azkaban-db/src/main/java/azkaban/db/DatabaseOperator.java
Apache-2.0
public int[] batch(final String sqlCommand, final Object[]... params) throws SQLException { try { return this.queryRunner.batch(sqlCommand, params); } catch (final SQLException ex) { logger.error("batch operation failed", ex); if (this.dbMetrics != null) { this.dbMetrics.markDBFailUpda...
Execute a batch operation @param sqlCommand sqlCommand template @param params parameters @return result
batch
java
azkaban/azkaban
azkaban-db/src/main/java/azkaban/db/DatabaseOperator.java
https://github.com/azkaban/azkaban/blob/master/azkaban-db/src/main/java/azkaban/db/DatabaseOperator.java
Apache-2.0
public AzkabanDataSource getDataSource() { return (AzkabanDataSource) this.queryRunner.getDataSource(); }
@return datasource wrapped in the database operator.
getDataSource
java
azkaban/azkaban
azkaban-db/src/main/java/azkaban/db/DatabaseOperator.java
https://github.com/azkaban/azkaban/blob/master/azkaban-db/src/main/java/azkaban/db/DatabaseOperator.java
Apache-2.0
public void updateDatabase() throws SQLException, IOException { final Set<String> tables = collectAllTables(); createTables(tables); }
Creates DB tables. The input to this class is a folder path, which includes all create table sql scripts. The script's name should follow: create.[table_name].sql in order to be identified. This class is used for unit test only for now. <p>Todo kunkun-tang: We need to fix some reliability issues if we rely on this cla...
updateDatabase
java
azkaban/azkaban
azkaban-db/src/main/java/azkaban/db/DatabaseSetup.java
https://github.com/azkaban/azkaban/blob/master/azkaban-db/src/main/java/azkaban/db/DatabaseSetup.java
Apache-2.0
private Set<String> collectAllTables() { final Set<String> tables = new HashSet<>(); final File directory = new File(this.scriptPath); final File[] createScripts = directory.listFiles(new PrefixSuffixFileFilter( CREATE_SCRIPT_PREFIX, SQL_SCRIPT_SUFFIX)); if (createScripts != null) { ...
Creates DB tables. The input to this class is a folder path, which includes all create table sql scripts. The script's name should follow: create.[table_name].sql in order to be identified. This class is used for unit test only for now. <p>Todo kunkun-tang: We need to fix some reliability issues if we rely on this cla...
collectAllTables
java
azkaban/azkaban
azkaban-db/src/main/java/azkaban/db/DatabaseSetup.java
https://github.com/azkaban/azkaban/blob/master/azkaban-db/src/main/java/azkaban/db/DatabaseSetup.java
Apache-2.0
private void createTables(final Set<String> tables) throws SQLException, IOException { final Connection conn = this.dataSource.getConnection(); conn.setAutoCommit(false); try { for (final String table : tables) { runTableScripts(conn, table); } } finally { conn.close(); } ...
Creates DB tables. The input to this class is a folder path, which includes all create table sql scripts. The script's name should follow: create.[table_name].sql in order to be identified. This class is used for unit test only for now. <p>Todo kunkun-tang: We need to fix some reliability issues if we rely on this cla...
createTables
java
azkaban/azkaban
azkaban-db/src/main/java/azkaban/db/DatabaseSetup.java
https://github.com/azkaban/azkaban/blob/master/azkaban-db/src/main/java/azkaban/db/DatabaseSetup.java
Apache-2.0
private void runTableScripts(final Connection conn, final String table) throws IOException, SQLException { logger.info("Creating new table " + table); final String dbSpecificScript = "create." + table + ".sql"; final File script = new File(this.scriptPath, dbSpecificScript); BufferedInputStream b...
Creates DB tables. The input to this class is a folder path, which includes all create table sql scripts. The script's name should follow: create.[table_name].sql in order to be identified. This class is used for unit test only for now. <p>Todo kunkun-tang: We need to fix some reliability issues if we rely on this cla...
runTableScripts
java
azkaban/azkaban
azkaban-db/src/main/java/azkaban/db/DatabaseSetup.java
https://github.com/azkaban/azkaban/blob/master/azkaban-db/src/main/java/azkaban/db/DatabaseSetup.java
Apache-2.0
@Override public boolean accept(final File pathname) { if (!pathname.isFile() || pathname.isHidden()) { return false; } final String name = pathname.getName(); final int length = name.length(); return this.suffix.length() <= length && this.prefix.length() <= length && name ...
Creates DB tables. The input to this class is a folder path, which includes all create table sql scripts. The script's name should follow: create.[table_name].sql in order to be identified. This class is used for unit test only for now. <p>Todo kunkun-tang: We need to fix some reliability issues if we rely on this cla...
accept
java
azkaban/azkaban
azkaban-db/src/main/java/azkaban/db/DatabaseSetup.java
https://github.com/azkaban/azkaban/blob/master/azkaban-db/src/main/java/azkaban/db/DatabaseSetup.java
Apache-2.0
public long getLastInsertId() throws SQLException { // A default connection: autocommit = true. long num = -1; try { num = ((Number) this.queryRunner .query(this.conn, "SELECT LAST_INSERT_ID();", new ScalarHandler<>(1))) .longValue(); } catch (final SQLException ex) { log...
returns the last id from a previous insert statement. Note that last insert and this operation should use the same connection. @return the last inserted id in mysql per connection.
getLastInsertId
java
azkaban/azkaban
azkaban-db/src/main/java/azkaban/db/DatabaseTransOperator.java
https://github.com/azkaban/azkaban/blob/master/azkaban-db/src/main/java/azkaban/db/DatabaseTransOperator.java
Apache-2.0
public <T> T query(final String querySql, final ResultSetHandler<T> resultHandler, final Object... params) throws SQLException { try { return this.queryRunner.query(this.conn, querySql, resultHandler, params); } catch (final SQLException ex) { //RETRY Logic should be implemented here if ...
@param querySql @param resultHandler @param params @param <T> @return @throws SQLException
query
java
azkaban/azkaban
azkaban-db/src/main/java/azkaban/db/DatabaseTransOperator.java
https://github.com/azkaban/azkaban/blob/master/azkaban-db/src/main/java/azkaban/db/DatabaseTransOperator.java
Apache-2.0
public int update(final String updateClause, final Object... params) throws SQLException { try { return this.queryRunner.update(this.conn, updateClause, params); } catch (final SQLException ex) { //RETRY Logic should be implemented here if needed. throw ex; } finally { // Note: CAN N...
@param updateClause @param params @return @throws SQLException
update
java
azkaban/azkaban
azkaban-db/src/main/java/azkaban/db/DatabaseTransOperator.java
https://github.com/azkaban/azkaban/blob/master/azkaban-db/src/main/java/azkaban/db/DatabaseTransOperator.java
Apache-2.0
public Connection getConnection() { return this.conn; }
@return the JDBC connection associated with this operator.
getConnection
java
azkaban/azkaban
azkaban-db/src/main/java/azkaban/db/DatabaseTransOperator.java
https://github.com/azkaban/azkaban/blob/master/azkaban-db/src/main/java/azkaban/db/DatabaseTransOperator.java
Apache-2.0
void markDBConnection() { /* * This method should be Thread Safe. * Two reasons that we don't make this function call synchronized: * 1). drop wizard metrics deals with concurrency internally; * 2). mark is basically a math addition operation, which should not cause race condition issue. *...
Mark the occurrence of an DB query event.
markDBConnection
java
azkaban/azkaban
azkaban-db/src/main/java/azkaban/db/DBMetrics.java
https://github.com/azkaban/azkaban/blob/master/azkaban-db/src/main/java/azkaban/db/DBMetrics.java
Apache-2.0
public static EncodingType fromInteger(final int x) { switch (x) { case 1: return PLAIN; case 2: return GZIP; default: return PLAIN; } }
Used for when we store text data. Plain uses UTF8 encoding.
fromInteger
java
azkaban/azkaban
azkaban-db/src/main/java/azkaban/db/EncodingType.java
https://github.com/azkaban/azkaban/blob/master/azkaban-db/src/main/java/azkaban/db/EncodingType.java
Apache-2.0
public int getNumVal() { return this.numVal; }
Used for when we store text data. Plain uses UTF8 encoding.
getNumVal
java
azkaban/azkaban
azkaban-db/src/main/java/azkaban/db/EncodingType.java
https://github.com/azkaban/azkaban/blob/master/azkaban-db/src/main/java/azkaban/db/EncodingType.java
Apache-2.0
@Override public Connection getConnection() throws SQLException { this.dbMetrics.markDBConnection(); final long startMs = System.currentTimeMillis(); Connection connection = null; int retryAttempt = 1; while (retryAttempt < AzDBUtil.MAX_DB_RETRY_COUNT) { try { /** * when DB...
This method overrides {@link BasicDataSource#getConnection()}, in order to have retry logics. We don't make the call synchronized in order to guarantee normal cases performance.
getConnection
java
azkaban/azkaban
azkaban-db/src/main/java/azkaban/db/MySQLDataSource.java
https://github.com/azkaban/azkaban/blob/master/azkaban-db/src/main/java/azkaban/db/MySQLDataSource.java
Apache-2.0
private boolean isReadOnly(final Connection conn) throws SQLException { final Statement stmt = conn.createStatement(); final ResultSet rs = stmt.executeQuery("SELECT @@global.read_only"); if (rs.next()) { final int value = rs.getInt(1); return value != 0; } throw new SQLException("can no...
When database is completed down, DB connection fails to be fetched immediately. So we need to sleep 15 seconds for retry.
isReadOnly
java
azkaban/azkaban
azkaban-db/src/main/java/azkaban/db/MySQLDataSource.java
https://github.com/azkaban/azkaban/blob/master/azkaban-db/src/main/java/azkaban/db/MySQLDataSource.java
Apache-2.0