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 |
|---|---|---|---|---|---|---|---|
@Override
protected void handleGet(final HttpServletRequest req, final HttpServletResponse resp,
final Session session) throws ServletException, IOException {
if (hasParam(req, ConnectorParams.ACTION_PARAM)) {
handleAJAXAction(req, resp, session);
} else {
handleStatePageLoad(req, resp, sess... | User facing servlet for Azkaban default metric display | handleGet | java | azkaban/azkaban | azkaban-web-server/src/main/java/azkaban/webapp/servlet/StatsServlet.java | https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/servlet/StatsServlet.java | Apache-2.0 |
private void handleAJAXAction(final HttpServletRequest req, final HttpServletResponse resp,
final Session session) throws ServletException, IOException {
final HashMap<String, Object> ret = new HashMap<>();
final int executorId = getIntParam(req, ConnectorParams.EXECUTOR_ID_PARAM);
final String action... | User facing servlet for Azkaban default metric display | handleAJAXAction | java | azkaban/azkaban | azkaban-web-server/src/main/java/azkaban/webapp/servlet/StatsServlet.java | https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/servlet/StatsServlet.java | Apache-2.0 |
private void handleGetAllMetricName(final int executorId, final HttpServletRequest req,
final HashMap<String, Object> ret) throws IOException {
final Map<String, Object> result;
try {
result =
this.execManagerAdapter.callExecutorStats(executorId,
ConnectorParams.STATS_GET_ALL... | Get all metrics tracked by the given executor | handleGetAllMetricName | java | azkaban/azkaban | azkaban-web-server/src/main/java/azkaban/webapp/servlet/StatsServlet.java | https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/servlet/StatsServlet.java | Apache-2.0 |
private void handleChangeConfigurationRequest(final int executorId, final String actionName,
final HttpServletRequest req, final HashMap<String, Object> ret)
throws ServletException, IOException {
try {
final Map<String, Object> result =
this.execManagerAdapter.callExecutorStats(executor... | Generic method to facilitate actionName action using Azkaban exec server
@param actionName Name of the action | handleChangeConfigurationRequest | java | azkaban/azkaban | azkaban-web-server/src/main/java/azkaban/webapp/servlet/StatsServlet.java | https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/servlet/StatsServlet.java | Apache-2.0 |
private void handleGetMetricHistory(final int executorId, final HttpServletRequest req,
final HashMap<String, Object> ret, final User user) throws IOException, ServletException {
try {
final Map<String, Object> result =
this.execManagerAdapter.callExecutorStats(executorId,
Connec... | Get metric snapshots for a metric and date specification | handleGetMetricHistory | java | azkaban/azkaban | azkaban-web-server/src/main/java/azkaban/webapp/servlet/StatsServlet.java | https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/servlet/StatsServlet.java | Apache-2.0 |
private void handleStatePageLoad(final HttpServletRequest req, final HttpServletResponse resp,
final Session session) throws ServletException {
final Page page = newPage(req, resp, session, "azkaban/webapp/servlet/velocity/statsPage.vm");
try {
final Collection<Executor> executors = this.execManage... | Get metric snapshots for a metric and date specification | handleStatePageLoad | java | azkaban/azkaban | azkaban-web-server/src/main/java/azkaban/webapp/servlet/StatsServlet.java | https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/servlet/StatsServlet.java | Apache-2.0 |
@Override
protected void handlePost(final HttpServletRequest req, final HttpServletResponse resp,
final Session session) throws ServletException, IOException {
} | Get metric snapshots for a metric and date specification | handlePost | java | azkaban/azkaban | azkaban-web-server/src/main/java/azkaban/webapp/servlet/StatsServlet.java | https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/servlet/StatsServlet.java | Apache-2.0 |
public static String getRealClientIpAddr(final Map<String, String> httpHeaders,
final String remoteAddr) {
// If some upstream device added an X-Forwarded-For header
// use it for the client ip
// This will support scenarios where load balancers or gateways
// front the Azkaban web server and a c... | Gets the actual client IP address on a best effort basis as user could be sitting
behind a VPN. Get the IP by inspecting the X-Forwarded-For HTTP header or using the
provided 'remote IP address' from the low level TCP connection from the client.
If multiple IP addresses are provided in the X-Forwarded-For header then ... | getRealClientIpAddr | java | azkaban/azkaban | azkaban-web-server/src/main/java/azkaban/webapp/servlet/WebUtils.java | https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/servlet/WebUtils.java | Apache-2.0 |
public static String getRealClientIpAddr(final HttpServletRequest req) {
// If some upstream device added an X-Forwarded-For header
// use it for the client ip
// This will support scenarios where load balancers or gateways
// front the Azkaban web server and a changing Ip address invalidates
// th... | Gets the actual client IP address on a best effort basis as user could be sitting
behind a VPN. Get the IP by inspecting the X-Forwarded-For HTTP header or using the
provided 'remote IP address' from the low level TCP connection from the client.
If multiple IP addresses are provided in the X-Forwarded-For header then ... | getRealClientIpAddr | java | azkaban/azkaban | azkaban-web-server/src/main/java/azkaban/webapp/servlet/WebUtils.java | https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/servlet/WebUtils.java | Apache-2.0 |
public static void reportLoginEvent(final EventType eventType, final String username,
final String ip, final boolean isSuccess, final String message) {
if (azkabanEventReporter != null) {
final Map<String, String> metadata = new HashMap<>();
metadata.put("azkabanHost",
AzkabanWebServer.... | Report login/logout events via {@link AzkabanEventReporter}, if configured.
@param eventType login or logout
@param username if known
@param ip address of originating host
@param isSuccess AKA outcome
@param message AKA reason | reportLoginEvent | java | azkaban/azkaban | azkaban-web-server/src/main/java/azkaban/webapp/servlet/WebUtils.java | https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/servlet/WebUtils.java | Apache-2.0 |
public static void reportLoginEvent(final EventType eventType, final String username, final String ip) {
reportLoginEvent(eventType, username, ip, true, null);
} | Report login/logout events via {@link AzkabanEventReporter}, if configured.
@param eventType login or logout
@param username if known
@param ip address of originating host
@param isSuccess AKA outcome
@param message AKA reason | reportLoginEvent | java | azkaban/azkaban | azkaban-web-server/src/main/java/azkaban/webapp/servlet/WebUtils.java | https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/main/java/azkaban/webapp/servlet/WebUtils.java | Apache-2.0 |
public static void assertStringEqualFileContent(final String expectedFilePath,
final String actual)
throws IOException {
final String expected = new String(Files.readAllBytes(Paths.get(expectedFilePath)),
StandardCharsets.UTF_8);
assertThat(actual).isEqualToIgnoringWhitespace(expected);
} | Assert the given string equals the given file's content.
The white space differences are ignored.
@param expectedFilePath the expected file path
@param actual the actual string
@throws IOException the io exception | assertStringEqualFileContent | java | azkaban/azkaban | azkaban-web-server/src/test/java/azkaban/fixture/FileAssertion.java | https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/test/java/azkaban/fixture/FileAssertion.java | Apache-2.0 |
public static String surroundWithHtmlTag(final String content) {
return "<html>\n" + content + "</html>\n";
} | Return the html based content surrounded with the HTML tag.
This is useful to compare a fragment of HTML content with a proper expected HTML file so that
the expected file can be viewed more easily with a browser.
@param content the content
@return string | surroundWithHtmlTag | java | azkaban/azkaban | azkaban-web-server/src/test/java/azkaban/fixture/FileAssertion.java | https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/test/java/azkaban/fixture/FileAssertion.java | Apache-2.0 |
public static Project getMockProject() {
final Project project = new Project(1, "test_project");
project.setDescription("My project description");
project.setLastModifiedUser("last_modified_user_name");
project.setUploadLock(true);
project.addFeatureFlags(FeatureFlag.ENABLE_PROJECT_ADHOC_UPLOAD, fal... | Get mock project project.
@return a mock project for testing | getMockProject | java | azkaban/azkaban | azkaban-web-server/src/test/java/azkaban/fixture/MockProject.java | https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/test/java/azkaban/fixture/MockProject.java | Apache-2.0 |
public static VelocityContext getInstance() {
final VelocityContext context = new VelocityContext();
context.put("esc", new EscapeTool());
context.put("TimeUtils", TimeUtils.class);
return context;
} | Gets an instance of the velocity context
Add the utility instances that are commonly used in many templates.
@return the instance | getInstance | java | azkaban/azkaban | azkaban-web-server/src/test/java/azkaban/fixture/VelocityContextTestUtil.java | https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/test/java/azkaban/fixture/VelocityContextTestUtil.java | Apache-2.0 |
public static String renderTemplate(final String templateName, final VelocityContext context) {
final StringWriter stringWriter = new StringWriter();
final VelocityEngine engine = new VelocityEngine();
engine.init("src/test/resources/velocity.properties");
engine.mergeTemplate(TEMPLATE_BASE_DIR + templ... | Render a template and return the result
@param templateName the template name only without the .vm extension
@param context the context
@return string | renderTemplate | java | azkaban/azkaban | azkaban-web-server/src/test/java/azkaban/fixture/VelocityTemplateTestUtil.java | https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/test/java/azkaban/fixture/VelocityTemplateTestUtil.java | Apache-2.0 |
public static boolean ignoreCaseContains(final String source, final String target) {
final String sourceNoSpace = source.replaceAll("\\s+", "");
final String targetNoSpace = target.replaceAll("\\s+", "");
return sourceNoSpace.contains(targetNoSpace);
} | @param source the rendered template as a String
@param target the String fragment within the template
@return - boolean | ignoreCaseContains | java | azkaban/azkaban | azkaban-web-server/src/test/java/azkaban/fixture/VelocityTemplateTestUtil.java | https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/test/java/azkaban/fixture/VelocityTemplateTestUtil.java | Apache-2.0 |
public static void assertStringEqualFileContent(final String expectedFileName,
final String actual)
throws IOException {
final String expectedFilePath = EXPECTED_FILE_DIR + expectedFileName;
FileAssertion.assertStringEqualFileContent(expectedFilePath, actual);
} | Assert the string equals file content in this project's expected file directory.
@param expectedFileName the expected file name
@param actual the actual
@throws IOException the io exception | assertStringEqualFileContent | java | azkaban/azkaban | azkaban-web-server/src/test/java/azkaban/fixture/WebFileAssertion.java | https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/test/java/azkaban/fixture/WebFileAssertion.java | Apache-2.0 |
@Override
public DependencyInstanceContext run(final DependencyInstanceConfig config,
final DependencyInstanceRuntimeProps runtimeProps,
final DependencyInstanceCallback callback) {
return new FakeDependencyInstanceContext1(config, runtimeProps, callback);
} | todo chengren311:
test-dependency-plugin.jar in resource folder is generated from
@see azkaban.flowtrigger.testplugin.FakeDependencyCheck1
@see azkaban.flowtrigger.testplugin.FakeDependencyCheck2
@see azkaban.flowtrigger.testplugin.FakeDependencyInstanceContext1
@see azkaban.flowtrigger.testplugin.FakeDependencyInstan... | run | java | azkaban/azkaban | azkaban-web-server/src/test/java/azkaban/flowtrigger/testplugin/FakeDependencyCheck1.java | https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/test/java/azkaban/flowtrigger/testplugin/FakeDependencyCheck1.java | Apache-2.0 |
@Override
public void shutdown() {
} | todo chengren311:
test-dependency-plugin.jar in resource folder is generated from
@see azkaban.flowtrigger.testplugin.FakeDependencyCheck1
@see azkaban.flowtrigger.testplugin.FakeDependencyCheck2
@see azkaban.flowtrigger.testplugin.FakeDependencyInstanceContext1
@see azkaban.flowtrigger.testplugin.FakeDependencyInstan... | shutdown | java | azkaban/azkaban | azkaban-web-server/src/test/java/azkaban/flowtrigger/testplugin/FakeDependencyCheck1.java | https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/test/java/azkaban/flowtrigger/testplugin/FakeDependencyCheck1.java | Apache-2.0 |
@Override
public String toString() {
return this.config.toString();
} | todo chengren311:
test-dependency-plugin.jar in resource folder is generated from
@see azkaban.flowtrigger.testplugin.FakeDependencyCheck1
@see azkaban.flowtrigger.testplugin.FakeDependencyCheck2
@see azkaban.flowtrigger.testplugin.FakeDependencyInstanceContext1
@see azkaban.flowtrigger.testplugin.FakeDependencyInstan... | toString | java | azkaban/azkaban | azkaban-web-server/src/test/java/azkaban/flowtrigger/testplugin/FakeDependencyCheck1.java | https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/test/java/azkaban/flowtrigger/testplugin/FakeDependencyCheck1.java | Apache-2.0 |
@Override
public void init(final DependencyPluginConfig config) {
this.config = config;
} | todo chengren311:
test-dependency-plugin.jar in resource folder is generated from
@see azkaban.flowtrigger.testplugin.FakeDependencyCheck1
@see azkaban.flowtrigger.testplugin.FakeDependencyCheck2
@see azkaban.flowtrigger.testplugin.FakeDependencyInstanceContext1
@see azkaban.flowtrigger.testplugin.FakeDependencyInstan... | init | java | azkaban/azkaban | azkaban-web-server/src/test/java/azkaban/flowtrigger/testplugin/FakeDependencyCheck1.java | https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/test/java/azkaban/flowtrigger/testplugin/FakeDependencyCheck1.java | Apache-2.0 |
public void testValidVersionInternal(final String version) {
final ImageVersionDTO dto = new ImageVersionDTO();
dto.setName("testImageType");
List<String> validationErrors = new ArrayList<>();
dto.setVersion(version);
boolean result = ValidatorUtils.validateObject(dto, validationErrors, BaseDTO.Vali... | Common code for valid versions
@param version the image version | testValidVersionInternal | java | azkaban/azkaban | azkaban-web-server/src/test/java/azkaban/imagemgmt/dto/ImageVersionDTOTest.java | https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/test/java/azkaban/imagemgmt/dto/ImageVersionDTOTest.java | Apache-2.0 |
public void testInvalidVersionInternal(final String version) {
final ImageVersionDTO dto = new ImageVersionDTO();
dto.setName("testImageType");
List<String> validationErrors = new ArrayList<>();
dto.setVersion(version);
boolean result = ValidatorUtils.validateObject(dto, validationErrors, BaseDTO.Va... | Common code for invalid image versions
@param version the image version | testInvalidVersionInternal | java | azkaban/azkaban | azkaban-web-server/src/test/java/azkaban/imagemgmt/dto/ImageVersionDTOTest.java | https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/test/java/azkaban/imagemgmt/dto/ImageVersionDTOTest.java | Apache-2.0 |
@Test
public void testValidMajorVersion() {
testValidVersionInternal("1");
} | Common code for invalid image versions
@param version the image version | testValidMajorVersion | java | azkaban/azkaban | azkaban-web-server/src/test/java/azkaban/imagemgmt/dto/ImageVersionDTOTest.java | https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/test/java/azkaban/imagemgmt/dto/ImageVersionDTOTest.java | Apache-2.0 |
@Test
public void testValidMinorVersion() {
testValidVersionInternal("1.2");
} | Common code for invalid image versions
@param version the image version | testValidMinorVersion | java | azkaban/azkaban | azkaban-web-server/src/test/java/azkaban/imagemgmt/dto/ImageVersionDTOTest.java | https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/test/java/azkaban/imagemgmt/dto/ImageVersionDTOTest.java | Apache-2.0 |
@Test
public void testValidPatchVersion() {
testValidVersionInternal("1.2.3");
} | Common code for invalid image versions
@param version the image version | testValidPatchVersion | java | azkaban/azkaban | azkaban-web-server/src/test/java/azkaban/imagemgmt/dto/ImageVersionDTOTest.java | https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/test/java/azkaban/imagemgmt/dto/ImageVersionDTOTest.java | Apache-2.0 |
@Test
public void testValidHotfixVersion() {
testValidVersionInternal("1.2.3.4");
} | Common code for invalid image versions
@param version the image version | testValidHotfixVersion | java | azkaban/azkaban | azkaban-web-server/src/test/java/azkaban/imagemgmt/dto/ImageVersionDTOTest.java | https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/test/java/azkaban/imagemgmt/dto/ImageVersionDTOTest.java | Apache-2.0 |
@Test
public void testInvalidVersions() {
// Valid looking version but have more than 4 values. eg, 1.2.3.4.5
testInvalidVersionInternal("1.2.3.4.5");
// Invalid format of version
testInvalidVersionInternal("1.2.");
} | Common code for invalid image versions
@param version the image version | testInvalidVersions | java | azkaban/azkaban | azkaban-web-server/src/test/java/azkaban/imagemgmt/dto/ImageVersionDTOTest.java | https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/test/java/azkaban/imagemgmt/dto/ImageVersionDTOTest.java | Apache-2.0 |
@Test
public void testWarnedDeploy() {
final ProjectManagerResource resource = new ProjectManagerResource();
final Map<String, ValidationReport> reports = new LinkedHashMap<>();
for (int i = 0; i < 3; i++) {
addMockWarning(reports, "Test warn level info message.");
}
// We expect that no exc... | Test response to deploy with either warn or error reports. If a report has any errors, a
RestLiServiceException should be thrown. Warnings should not elicit an exception. If an exception
does get raised, it should carry an HTTP 400 status | testWarnedDeploy | java | azkaban/azkaban | azkaban-web-server/src/test/java/azkaban/restli/DeployProjectTest.java | https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/test/java/azkaban/restli/DeployProjectTest.java | Apache-2.0 |
@Test
public void testErrorDeploy() {
final ProjectManagerResource resource = new ProjectManagerResource();
final Map<String, ValidationReport> reports = new LinkedHashMap<>();
for (int i = 0; i < 3; i++) {
addMockError(reports, "Test error level info message.");
}
// We expect that a RestLi... | Test response to deploy with either warn or error reports. If a report has any errors, a
RestLiServiceException should be thrown. Warnings should not elicit an exception. If an exception
does get raised, it should carry an HTTP 400 status | testErrorDeploy | java | azkaban/azkaban | azkaban-web-server/src/test/java/azkaban/restli/DeployProjectTest.java | https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/test/java/azkaban/restli/DeployProjectTest.java | Apache-2.0 |
@Test
public void testWarnErrorDeploy() {
final ProjectManagerResource resource = new ProjectManagerResource();
final Map<String, ValidationReport> reports = new LinkedHashMap<>();
for (int i = 0; i < 7; i++) {
// If i is even, make an error report, otherwise make a warning report
if (i % 2 ==... | Test response to deploy with either warn or error reports. If a report has any errors, a
RestLiServiceException should be thrown. Warnings should not elicit an exception. If an exception
does get raised, it should carry an HTTP 400 status | testWarnErrorDeploy | java | azkaban/azkaban | azkaban-web-server/src/test/java/azkaban/restli/DeployProjectTest.java | https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/test/java/azkaban/restli/DeployProjectTest.java | Apache-2.0 |
@Test
public void testErrorMessageDeploy() {
final ProjectManagerResource resource = new ProjectManagerResource();
final Map<String, ValidationReport> reports = new LinkedHashMap<>();
addMockError(reports, "This should show up.");
// We expect that a RestLiServiceException is thrown given a
// r... | Test that an error message is attached to the exception on an error | testErrorMessageDeploy | java | azkaban/azkaban | azkaban-web-server/src/test/java/azkaban/restli/DeployProjectTest.java | https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/test/java/azkaban/restli/DeployProjectTest.java | Apache-2.0 |
private void addMockWarning(final Map<String, ValidationReport> reports, final String msg) {
final Set<String> warnMsgs = new HashSet<>();
final ValidationReport warnRpt = new ValidationReport();
warnMsgs.add(msg);
warnRpt.addWarningMsgs(warnMsgs);
reports.put("Warn", warnRpt);
} | Test that an error message is attached to the exception on an error | addMockWarning | java | azkaban/azkaban | azkaban-web-server/src/test/java/azkaban/restli/DeployProjectTest.java | https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/test/java/azkaban/restli/DeployProjectTest.java | Apache-2.0 |
private void addMockError(final Map<String, ValidationReport> reports, final String msg) {
final Set<String> errorMsgs = new HashSet<>();
final ValidationReport errorRpt = new ValidationReport();
errorMsgs.add(msg);
errorRpt.addErrorMsgs(errorMsgs);
reports.put("Error", errorRpt);
} | Test that an error message is attached to the exception on an error | addMockError | java | azkaban/azkaban | azkaban-web-server/src/test/java/azkaban/restli/DeployProjectTest.java | https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/test/java/azkaban/restli/DeployProjectTest.java | Apache-2.0 |
@BeforeClass
public static void setUpQuartz() throws Exception {
dbOperator = AzDBTestUtility.initQuartzDB();
final String quartzPropsPath =
new File("../azkaban-web-server/src/test/resources/quartz.test.properties")
.getCanonicalPath();
final Props props = new Props(null, quartzPropsP... | Use H2-in-mem database to directly test Quartz. | setUpQuartz | java | azkaban/azkaban | azkaban-web-server/src/test/java/azkaban/scheduler/QuartzSchedulerTest.java | https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/test/java/azkaban/scheduler/QuartzSchedulerTest.java | Apache-2.0 |
@AfterClass
public static void destroyQuartz() {
try {
scheduler.shutdown();
dbOperator.update("DROP ALL OBJECTS");
dbOperator.update("SHUTDOWN");
} catch (final Exception e) {
e.printStackTrace();
}
} | Use H2-in-mem database to directly test Quartz. | destroyQuartz | java | azkaban/azkaban | azkaban-web-server/src/test/java/azkaban/scheduler/QuartzSchedulerTest.java | https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/test/java/azkaban/scheduler/QuartzSchedulerTest.java | Apache-2.0 |
@Before
public void init() {
SampleQuartzJob.COUNT_EXECUTION = 0;
} | Use H2-in-mem database to directly test Quartz. | init | java | azkaban/azkaban | azkaban-web-server/src/test/java/azkaban/scheduler/QuartzSchedulerTest.java | https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/test/java/azkaban/scheduler/QuartzSchedulerTest.java | Apache-2.0 |
@After
public void cleanup() throws SchedulerException {
scheduler.cleanup();
} | Use H2-in-mem database to directly test Quartz. | cleanup | java | azkaban/azkaban | azkaban-web-server/src/test/java/azkaban/scheduler/QuartzSchedulerTest.java | https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/test/java/azkaban/scheduler/QuartzSchedulerTest.java | Apache-2.0 |
@Test
public void testCreateScheduleAndRun() throws Exception {
scheduler.scheduleJobIfAbsent("* * * * * ?", createJobDescription());
assertThat(scheduler.ifJobExist("SampleJob", "SampleService")).isEqualTo(true);
TestUtils.await().untilAsserted(() -> assertThat(SampleQuartzJob.COUNT_EXECUTION)
.i... | Use H2-in-mem database to directly test Quartz. | testCreateScheduleAndRun | java | azkaban/azkaban | azkaban-web-server/src/test/java/azkaban/scheduler/QuartzSchedulerTest.java | https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/test/java/azkaban/scheduler/QuartzSchedulerTest.java | Apache-2.0 |
@Test
public void testSchedulingDuplicateJob() throws Exception {
scheduler.scheduleJobIfAbsent("* * * * * ?", createJobDescription());
assertThat(scheduler.scheduleJobIfAbsent("0 5 * * * ?", createJobDescription())).isFalse();
} | Use H2-in-mem database to directly test Quartz. | testSchedulingDuplicateJob | java | azkaban/azkaban | azkaban-web-server/src/test/java/azkaban/scheduler/QuartzSchedulerTest.java | https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/test/java/azkaban/scheduler/QuartzSchedulerTest.java | Apache-2.0 |
@Test
public void testInvalidCron() {
assertThatThrownBy(
() -> scheduler.scheduleJobIfAbsent("0 5 * * * *", createJobDescription()))
.isInstanceOf(SchedulerException.class)
.hasMessageContaining("The cron expression string");
} | Use H2-in-mem database to directly test Quartz. | testInvalidCron | java | azkaban/azkaban | azkaban-web-server/src/test/java/azkaban/scheduler/QuartzSchedulerTest.java | https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/test/java/azkaban/scheduler/QuartzSchedulerTest.java | Apache-2.0 |
@Test
public void testUnschedule() throws Exception {
scheduler.scheduleJobIfAbsent("* * * * * ?", createJobDescription());
assertThat(scheduler.ifJobExist("SampleJob", "SampleService")).isEqualTo(true);
assertThat(scheduler.unscheduleJob("SampleJob", "SampleService")).isTrue();
assertThat(scheduler.i... | Use H2-in-mem database to directly test Quartz. | testUnschedule | java | azkaban/azkaban | azkaban-web-server/src/test/java/azkaban/scheduler/QuartzSchedulerTest.java | https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/test/java/azkaban/scheduler/QuartzSchedulerTest.java | Apache-2.0 |
@Test
public void testPauseSchedule() throws Exception {
assertThat(scheduler.pauseJobIfPresent("SampleJob", "SampleService")).isFalse();
scheduler.scheduleJobIfAbsent("* * * * * ?", createJobDescription());
assertThat(scheduler.pauseJobIfPresent("SampleJob", "SampleService")).isTrue();
assertThat(sch... | Use H2-in-mem database to directly test Quartz. | testPauseSchedule | java | azkaban/azkaban | azkaban-web-server/src/test/java/azkaban/scheduler/QuartzSchedulerTest.java | https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/test/java/azkaban/scheduler/QuartzSchedulerTest.java | Apache-2.0 |
private QuartzJobDescription createJobDescription() {
return new QuartzJobDescription<>(SampleQuartzJob.class, "SampleJob", "SampleService");
} | Use H2-in-mem database to directly test Quartz. | createJobDescription | java | azkaban/azkaban | azkaban-web-server/src/test/java/azkaban/scheduler/QuartzSchedulerTest.java | https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/test/java/azkaban/scheduler/QuartzSchedulerTest.java | Apache-2.0 |
@Test
public void testExternalAnalyzerButton() throws Exception {
final VelocityContext context = VelocityContextTestUtil.getInstance();
ExternalLink externalLink1 = new ExternalLink( "topic1", "Label1",
"http://topic1.linkedin.com/", true);
context.put("externalAnalyzers", Arrays.asLi... | Test aims to check that the external analyzer button is displayed in the page.
@throws Exception the exception | testExternalAnalyzerButton | java | azkaban/azkaban | azkaban-web-server/src/test/java/azkaban/webapp/servlet/ExecutionFlowViewTest.java | https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/test/java/azkaban/webapp/servlet/ExecutionFlowViewTest.java | Apache-2.0 |
@Test
public void postAjaxExecuteFlowWithInvalidSlaSettings() throws Exception {
mockTestProjectAndFlow();
mockSubmitExecution();
this.req.addParameter("ajax", "executeFlow");
this.req.addParameter("project", "testProject");
this.req.addParameter("flow", "testFlow");
this.req.addParameter("sla... | When SLA options can't be parsed, API is expected to return 200 OK with JSON that has "error". | postAjaxExecuteFlowWithInvalidSlaSettings | java | azkaban/azkaban | azkaban-web-server/src/test/java/azkaban/webapp/servlet/ExecutorServletTest.java | https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/test/java/azkaban/webapp/servlet/ExecutorServletTest.java | Apache-2.0 |
@Test
public void postAjaxExecuteFlowWithMissingProjectParameter() throws Exception {
this.req.addParameter("ajax", "executeFlow");
try {
this.executorServlet.handlePost(this.req, this.res, this.session);
fail("Expected exception was not thrown");
} catch (final ServletException e) {
ass... | When executeFlow is called without project param, API is expected to raise an exception. | postAjaxExecuteFlowWithMissingProjectParameter | java | azkaban/azkaban | azkaban-web-server/src/test/java/azkaban/webapp/servlet/ExecutorServletTest.java | https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/test/java/azkaban/webapp/servlet/ExecutorServletTest.java | Apache-2.0 |
@Test
public void postAjaxFlowInfoErrorFetching() throws Exception {
this.req.addParameter("ajax", "flowInfo");
this.req.addParameter("execid", "123");
this.executorServlet.handlePost(this.req, this.res, this.session);
assertEquals(200, this.res.getStatus());
assertEquals("Cannot find execution ... | When execution is not found, API is expected to return 200 OK with JSON that has "error". | postAjaxFlowInfoErrorFetching | java | azkaban/azkaban | azkaban-web-server/src/test/java/azkaban/webapp/servlet/ExecutorServletTest.java | https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/test/java/azkaban/webapp/servlet/ExecutorServletTest.java | Apache-2.0 |
@Test
public void testPostAjaxUpdateContainerProperty() throws Exception {
ContainerizedDispatchManager containerizedDispatchManager = new ContainerizedDispatchManager(
new Props(), null, null, null, null, null,
null, null, null, null, new DummyEventListener(),
new DummyContainerizationMet... | When execution is not found, API is expected to return 200 OK with JSON that has "error". | testPostAjaxUpdateContainerProperty | java | azkaban/azkaban | azkaban-web-server/src/test/java/azkaban/webapp/servlet/ExecutorServletTest.java | https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/test/java/azkaban/webapp/servlet/ExecutorServletTest.java | Apache-2.0 |
@Test
public void testPostAjaxUpdateGeneralProperty() throws Exception {
AbstractExecutorManagerAdapter abstractExecutorManagerAdapter =
mock(AbstractExecutorManagerAdapter.class);
Mockito.doCallRealMethod().when(abstractExecutorManagerAdapter).enableOfflineLogsLoader(anyBoolean());
Mockito.doCall... | When execution is not found, API is expected to return 200 OK with JSON that has "error". | testPostAjaxUpdateGeneralProperty | java | azkaban/azkaban | azkaban-web-server/src/test/java/azkaban/webapp/servlet/ExecutorServletTest.java | https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/test/java/azkaban/webapp/servlet/ExecutorServletTest.java | Apache-2.0 |
@Test
public void testPostAjaxUpdateContainerizedImplProperty() throws Exception {
AtomicInteger vpaRampup = new AtomicInteger(0);
AtomicBoolean vpaEnabled = new AtomicBoolean(true);
ContainerizedImpl containerizedImpl = mock(ContainerizedImpl.class);
Mockito.when(containerizedImpl.getVPARampUp()).the... | When execution is not found, API is expected to return 200 OK with JSON that has "error". | testPostAjaxUpdateContainerizedImplProperty | java | azkaban/azkaban | azkaban-web-server/src/test/java/azkaban/webapp/servlet/ExecutorServletTest.java | https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/test/java/azkaban/webapp/servlet/ExecutorServletTest.java | Apache-2.0 |
@Test
public void testLoginRevealingCredentialsShouldThrowFailure() throws Exception {
final String clientIp = "127.0.0.1:10000";
final String sessionId = "111";
final String queryString = "action=login&username=azkaban&password=azkaban";
final String[] mockCredentials = {"azkaban"};
final HashMa... | Simulates users passing username/password via URI where it would be logged by Azkaban Web
Server | testLoginRevealingCredentialsShouldThrowFailure | java | azkaban/azkaban | azkaban-web-server/src/test/java/azkaban/webapp/servlet/LoginAbstractAzkabanServletTest.java | https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/test/java/azkaban/webapp/servlet/LoginAbstractAzkabanServletTest.java | Apache-2.0 |
@Test
public void testUploadButtonIsPresent() {
final VelocityContext context = VelocityContextTestUtil.getInstance();
context.put("hideUploadProjectButton", false);
final String result =
VelocityTemplateTestUtil.renderTemplate("projectpageheader", context);
assertThat(VelocityTemplateTestUti... | Test validates the enable/disable feature of the 'Upload' button | testUploadButtonIsPresent | java | azkaban/azkaban | azkaban-web-server/src/test/java/azkaban/webapp/servlet/ProjectPageHeaderTest.java | https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/test/java/azkaban/webapp/servlet/ProjectPageHeaderTest.java | Apache-2.0 |
@Test
public void testUploadButtonIsNotPresent() {
final VelocityContext context = VelocityContextTestUtil.getInstance();
context.put("hideUploadProjectButton", true);
final String result =
VelocityTemplateTestUtil.renderTemplate("projectpageheader", context);
assertThat(VelocityTemplateTestU... | Test validates the enable/disable feature of the 'Upload' button | testUploadButtonIsNotPresent | java | azkaban/azkaban | azkaban-web-server/src/test/java/azkaban/webapp/servlet/ProjectPageHeaderTest.java | https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/test/java/azkaban/webapp/servlet/ProjectPageHeaderTest.java | Apache-2.0 |
@Test
public void testProjectSideBarView()
throws Exception {
final VelocityContext context = VelocityContextTestUtil.getInstance();
final Project project = MockProject.getMockProject();
// Intentionally tries to inject a Javascript.
project.setDescription("<script>window.alert(\"hacked\")</sc... | Test project side bar view.
The project description should be HTML encoded to avoid cross site scripting issues.
@throws Exception the exception | testProjectSideBarView | java | azkaban/azkaban | azkaban-web-server/src/test/java/azkaban/webapp/servlet/ProjectSideBarViewTest.java | https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/test/java/azkaban/webapp/servlet/ProjectSideBarViewTest.java | Apache-2.0 |
@Test
public void testWhenNoXForwardedForHeaderUseClientIp() {
final String clientIp = "127.0.0.1:10000";
final Map<String, String> headers = new HashMap<>();
final String ip = WebUtils.getRealClientIpAddr(headers, clientIp);
assertEquals(ip, "127.0.0.1");
} | Test class for azkaban.webapp.servlet.WebUtils | testWhenNoXForwardedForHeaderUseClientIp | java | azkaban/azkaban | azkaban-web-server/src/test/java/azkaban/webapp/servlet/WebUtilsTest.java | https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/test/java/azkaban/webapp/servlet/WebUtilsTest.java | Apache-2.0 |
@Test
public void testWhenClientIpNoPort() {
final String clientIp = "192.168.1.1";
final Map<String, String> headers = new HashMap<>();
final String ip = WebUtils.getRealClientIpAddr(headers, clientIp);
assertEquals(ip, "192.168.1.1");
} | Test class for azkaban.webapp.servlet.WebUtils | testWhenClientIpNoPort | java | azkaban/azkaban | azkaban-web-server/src/test/java/azkaban/webapp/servlet/WebUtilsTest.java | https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/test/java/azkaban/webapp/servlet/WebUtilsTest.java | Apache-2.0 |
@Test
public void testWhenXForwardedForHeaderUseHeader() {
final String clientIp = "127.0.0.1:10000";
final String upstreamIp = "192.168.1.1:10000";
final Map<String, String> headers = new HashMap<>();
headers.put("X-Forwarded-For", upstreamIp);
final String ip = WebUtils.getRealClientIpAddr(he... | Test class for azkaban.webapp.servlet.WebUtils | testWhenXForwardedForHeaderUseHeader | java | azkaban/azkaban | azkaban-web-server/src/test/java/azkaban/webapp/servlet/WebUtilsTest.java | https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/test/java/azkaban/webapp/servlet/WebUtilsTest.java | Apache-2.0 |
@Test
public void testWhenXForwardedForHeaderMultipleUpstreamsUseHeader() {
final String clientIp = "127.0.0.1:10000";
final String upstreamIp = "192.168.1.1:10000";
final Map<String, String> headers = new HashMap<>();
headers.put("X-Forwarded-For", upstreamIp + ",127.0.0.1,55.55.55.55");
final... | Test class for azkaban.webapp.servlet.WebUtils | testWhenXForwardedForHeaderMultipleUpstreamsUseHeader | java | azkaban/azkaban | azkaban-web-server/src/test/java/azkaban/webapp/servlet/WebUtilsTest.java | https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/test/java/azkaban/webapp/servlet/WebUtilsTest.java | Apache-2.0 |
@Test
@Ignore // will fail right now
public void testIPv6NoPort() {
final String clientIp = "fe80::aede:48ff:.55805";
// or ::1, or fe80::1cc4:170d:463d:99d1%en0, or http://[fe80::1ff:fe23:4567:890a%25eth0]:443/
final Map<String, String> headers = new HashMap<>();
final String ip = WebUtils.getRea... | Test class for azkaban.webapp.servlet.WebUtils | testIPv6NoPort | java | azkaban/azkaban | azkaban-web-server/src/test/java/azkaban/webapp/servlet/WebUtilsTest.java | https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/test/java/azkaban/webapp/servlet/WebUtilsTest.java | Apache-2.0 |
@Test
public void testReportLoginEvent() {
// can't really test much without a way to inject a mock of AzkabanEventReporter into
// WebUtils, but let's at least invoke it anyway:
WebUtils.reportLoginEvent(EventType.USER_LOGIN, "itsme", "127.0.0.1");
} | Test class for azkaban.webapp.servlet.WebUtils | testReportLoginEvent | java | azkaban/azkaban | azkaban-web-server/src/test/java/azkaban/webapp/servlet/WebUtilsTest.java | https://github.com/azkaban/azkaban/blob/master/azkaban-web-server/src/test/java/azkaban/webapp/servlet/WebUtilsTest.java | Apache-2.0 |
@Before
public void setup() throws Exception {
// So log4j doesn't complain
BasicConfigurator.configure();
this.localCacheFolder = TEMP_DIR.newFolder("dependencies");
this.chttpRootURI = URI.create("chttp://www.example.com:9000/repo/");
this.cacheRootURI = URI.create("file://" + localCacheFolder.... | These tests use CachedHttpFileSystem with a mocked HTTP backend and a real Hadoop LocalFileSystem for caching. | setup | java | azkaban/azkaban | cached-http-filesystem/src/test/java/azkaban/cachedhttpfilesystem/CachedHttpFileSystemTest.java | https://github.com/azkaban/azkaban/blob/master/cached-http-filesystem/src/test/java/azkaban/cachedhttpfilesystem/CachedHttpFileSystemTest.java | Apache-2.0 |
private static void configureMockResponseFromHttpOrigin(CachedHttpFileSystem fs, URI originAbsoluteJarURI)
throws Exception {
// Intercept the internal method call to request a file from a HTTP URL and return our own input stream
// instead.
doReturn(stringToFSDataInputStream(JAR_CONTENT))
.wh... | These tests use CachedHttpFileSystem with a mocked HTTP backend and a real Hadoop LocalFileSystem for caching. | configureMockResponseFromHttpOrigin | java | azkaban/azkaban | cached-http-filesystem/src/test/java/azkaban/cachedhttpfilesystem/CachedHttpFileSystemTest.java | https://github.com/azkaban/azkaban/blob/master/cached-http-filesystem/src/test/java/azkaban/cachedhttpfilesystem/CachedHttpFileSystemTest.java | Apache-2.0 |
private static FSDataInputStream stringToFSDataInputStream(String str) {
return new FSDataInputStream(new CachedHttpFileSystem.HttpDataInputStream(IOUtils.toInputStream(str)));
} | These tests use CachedHttpFileSystem with a mocked HTTP backend and a real Hadoop LocalFileSystem for caching. | stringToFSDataInputStream | java | azkaban/azkaban | cached-http-filesystem/src/test/java/azkaban/cachedhttpfilesystem/CachedHttpFileSystemTest.java | https://github.com/azkaban/azkaban/blob/master/cached-http-filesystem/src/test/java/azkaban/cachedhttpfilesystem/CachedHttpFileSystemTest.java | Apache-2.0 |
private void assertInputStreamIsJarContent(InputStream inp) throws Exception {
// Ensure the InputStream resolves to the content of our sample jar.
assertEquals(JAR_CONTENT, IOUtils.toString(inp));
} | These tests use CachedHttpFileSystem with a mocked HTTP backend and a real Hadoop LocalFileSystem for caching. | assertInputStreamIsJarContent | java | azkaban/azkaban | cached-http-filesystem/src/test/java/azkaban/cachedhttpfilesystem/CachedHttpFileSystemTest.java | https://github.com/azkaban/azkaban/blob/master/cached-http-filesystem/src/test/java/azkaban/cachedhttpfilesystem/CachedHttpFileSystemTest.java | Apache-2.0 |
@Test
public void testCachingDisabled() throws Exception {
Configuration conf = new Configuration(false);
// Stop FileSystem.get() from returning cached instances of CachedHttpFileSystem, it messes with our tests.
// we need to create a new object each time.
conf.setBoolean("fs.chttp.impl.disable.cach... | These tests use CachedHttpFileSystem with a mocked HTTP backend and a real Hadoop LocalFileSystem for caching. | testCachingDisabled | java | azkaban/azkaban | cached-http-filesystem/src/test/java/azkaban/cachedhttpfilesystem/CachedHttpFileSystemTest.java | https://github.com/azkaban/azkaban/blob/master/cached-http-filesystem/src/test/java/azkaban/cachedhttpfilesystem/CachedHttpFileSystemTest.java | Apache-2.0 |
@Test(expected = IOException.class)
public void testInvalidUriPath() throws Exception {
// This URI cannot be relativized against chttp://www.example.com:9000/repo/
this.cachedHttpFileSystem.open(new Path("chttp://www.wrongurl.com/some.jar"), 0);
} | These tests use CachedHttpFileSystem with a mocked HTTP backend and a real Hadoop LocalFileSystem for caching. | testInvalidUriPath | java | azkaban/azkaban | cached-http-filesystem/src/test/java/azkaban/cachedhttpfilesystem/CachedHttpFileSystemTest.java | https://github.com/azkaban/azkaban/blob/master/cached-http-filesystem/src/test/java/azkaban/cachedhttpfilesystem/CachedHttpFileSystemTest.java | Apache-2.0 |
@Test(expected = IOException.class)
public void testInvalidUriScheme() throws Exception {
// This URI cannot be relativized against chttp://www.example.com:9000/repo/ (wrong scheme)
this.cachedHttpFileSystem.open(new Path("http://www.wrongurl.com/repo/some.jar"), 0);
} | These tests use CachedHttpFileSystem with a mocked HTTP backend and a real Hadoop LocalFileSystem for caching. | testInvalidUriScheme | java | azkaban/azkaban | cached-http-filesystem/src/test/java/azkaban/cachedhttpfilesystem/CachedHttpFileSystemTest.java | https://github.com/azkaban/azkaban/blob/master/cached-http-filesystem/src/test/java/azkaban/cachedhttpfilesystem/CachedHttpFileSystemTest.java | Apache-2.0 |
@Test
public void testCacheMissThenHit() throws Exception {
// This should be a cache miss, and populate the cache
assertInputStreamIsJarContent(this.cachedHttpFileSystem.open(new Path(this.chttpAbsoluteJarURI)));
// Because this was a cache miss, we expect the file queried from origin once.
verify(t... | These tests use CachedHttpFileSystem with a mocked HTTP backend and a real Hadoop LocalFileSystem for caching. | testCacheMissThenHit | java | azkaban/azkaban | cached-http-filesystem/src/test/java/azkaban/cachedhttpfilesystem/CachedHttpFileSystemTest.java | https://github.com/azkaban/azkaban/blob/master/cached-http-filesystem/src/test/java/azkaban/cachedhttpfilesystem/CachedHttpFileSystemTest.java | Apache-2.0 |
@Test
public void testCacheMissFailPersist() throws Exception {
// Test the scenario where we don't find the object in the cache, but we fail to persist the object into the cache.
// We should still get back an FSDataInputStream for the object from the origin.
// This is a little brittle, but we have to ... | These tests use CachedHttpFileSystem with a mocked HTTP backend and a real Hadoop LocalFileSystem for caching. | testCacheMissFailPersist | java | azkaban/azkaban | cached-http-filesystem/src/test/java/azkaban/cachedhttpfilesystem/CachedHttpFileSystemTest.java | https://github.com/azkaban/azkaban/blob/master/cached-http-filesystem/src/test/java/azkaban/cachedhttpfilesystem/CachedHttpFileSystemTest.java | Apache-2.0 |
@Test
public void testCacheMissRaceCondition() throws Exception {
// Test the scenario where we don't find the object in the cache, we download from origin, write to tmp file
// but when we attempt to rename the tmp file, the rename fails because another process already persisted
// this file to cache.
... | These tests use CachedHttpFileSystem with a mocked HTTP backend and a real Hadoop LocalFileSystem for caching. | testCacheMissRaceCondition | java | azkaban/azkaban | cached-http-filesystem/src/test/java/azkaban/cachedhttpfilesystem/CachedHttpFileSystemTest.java | https://github.com/azkaban/azkaban/blob/master/cached-http-filesystem/src/test/java/azkaban/cachedhttpfilesystem/CachedHttpFileSystemTest.java | Apache-2.0 |
public static ConditionFactory await() {
return Awaitility.await().atMost(10L, TimeUnit.SECONDS)
.pollInterval(10L, TimeUnit.MILLISECONDS);
} | Wait for 10 seconds, max. Poll every 10ms. | await | java | azkaban/azkaban | test/src/main/java/azkaban/test/TestUtils.java | https://github.com/azkaban/azkaban/blob/master/test/src/main/java/azkaban/test/TestUtils.java | Apache-2.0 |
public static Set getDepSetABCAndNull() {
return new HashSet(
Arrays.asList(getDepA(), getDepB(), getDepC(), null));
} | Create and return a Set<Dependency> that contains valid objects and a null.
@return Set<Dependency> containing valid objects and null | getDepSetABCAndNull | java | azkaban/azkaban | test/src/main/java/azkaban/test/executions/ThinArchiveTestUtils.java | https://github.com/azkaban/azkaban/blob/master/test/src/main/java/azkaban/test/executions/ThinArchiveTestUtils.java | Apache-2.0 |
public static String getRawJSONDepA() {
return "{" +
" \"dependencies\": [" +
depAJSONBlock() +
" ]" +
"}";
} | Create and return a Set<Dependency> that contains valid objects and a null.
@return Set<Dependency> containing valid objects and null | getRawJSONDepA | java | azkaban/azkaban | test/src/main/java/azkaban/test/executions/ThinArchiveTestUtils.java | https://github.com/azkaban/azkaban/blob/master/test/src/main/java/azkaban/test/executions/ThinArchiveTestUtils.java | Apache-2.0 |
public static String getRawJSONDepB() {
return "{" +
" \"dependencies\": [" +
depBJSONBlock() +
" ]" +
"}";
} | Create and return a Set<Dependency> that contains valid objects and a null.
@return Set<Dependency> containing valid objects and null | getRawJSONDepB | java | azkaban/azkaban | test/src/main/java/azkaban/test/executions/ThinArchiveTestUtils.java | https://github.com/azkaban/azkaban/blob/master/test/src/main/java/azkaban/test/executions/ThinArchiveTestUtils.java | Apache-2.0 |
public static String getRawJSONDepC() {
return "{" +
" \"dependencies\": [" +
depCJSONBlock() +
" ]" +
"}";
} | Create and return a Set<Dependency> that contains valid objects and a null.
@return Set<Dependency> containing valid objects and null | getRawJSONDepC | java | azkaban/azkaban | test/src/main/java/azkaban/test/executions/ThinArchiveTestUtils.java | https://github.com/azkaban/azkaban/blob/master/test/src/main/java/azkaban/test/executions/ThinArchiveTestUtils.java | Apache-2.0 |
public static String getRawJSONDepsAB() {
return "{" +
" \"dependencies\": [" +
depAJSONBlock() + "," +
depBJSONBlock() +
" ]" +
"}";
} | Create and return a Set<Dependency> that contains valid objects and a null.
@return Set<Dependency> containing valid objects and null | getRawJSONDepsAB | java | azkaban/azkaban | test/src/main/java/azkaban/test/executions/ThinArchiveTestUtils.java | https://github.com/azkaban/azkaban/blob/master/test/src/main/java/azkaban/test/executions/ThinArchiveTestUtils.java | Apache-2.0 |
public static String getRawJSONDepsABC() {
return "{" +
" \"dependencies\": [" +
depAJSONBlock() + "," +
depBJSONBlock() + "," +
depCJSONBlock() +
" ]" +
"}";
} | Create and return a Set<Dependency> that contains valid objects and a null.
@return Set<Dependency> containing valid objects and null | getRawJSONDepsABC | java | azkaban/azkaban | test/src/main/java/azkaban/test/executions/ThinArchiveTestUtils.java | https://github.com/azkaban/azkaban/blob/master/test/src/main/java/azkaban/test/executions/ThinArchiveTestUtils.java | Apache-2.0 |
public static String getRawJSONDepsNullAndABC() {
return "{" +
" \"dependencies\": [" +
"null," +
depAJSONBlock() + "," +
depBJSONBlock() + "," +
depCJSONBlock() +
" ]" +
"}";
} | Create a string of valid raw json that adds a null to the list of valid dependencies.
@return raw json string containing valid dependencies and a null. | getRawJSONDepsNullAndABC | java | azkaban/azkaban | test/src/main/java/azkaban/test/executions/ThinArchiveTestUtils.java | https://github.com/azkaban/azkaban/blob/master/test/src/main/java/azkaban/test/executions/ThinArchiveTestUtils.java | Apache-2.0 |
private static String depAJSONBlock() {
return "{" +
" \"sha1\": \"131bd316a77423e6b80d93262b576c139c72b4c3\"," +
" \"file\": \"aaaa.jar\"," +
" \"destination\": \"lib\"," +
" \"type\": \"jar\"," +
" \"ivyCoordinates\": \"com.linkedin.test:testeraaaa:1.0.1\"" +... | Create a string of valid raw json that adds a null to the list of valid dependencies.
@return raw json string containing valid dependencies and a null. | depAJSONBlock | java | azkaban/azkaban | test/src/main/java/azkaban/test/executions/ThinArchiveTestUtils.java | https://github.com/azkaban/azkaban/blob/master/test/src/main/java/azkaban/test/executions/ThinArchiveTestUtils.java | Apache-2.0 |
private static String depBJSONBlock() {
return "{" +
" \"sha1\": \"9461919846e1e7c8fc74fee95aa6ac74993be71e\"," +
" \"file\": \"bbbb.jar\"," +
" \"destination\": \"dep_b_folder\"," +
" \"type\": \"jar\"," +
" \"ivyCoordinates\": \"com.linkedin.test:testerbbbb:1... | Create a string of valid raw json that adds a null to the list of valid dependencies.
@return raw json string containing valid dependencies and a null. | depBJSONBlock | java | azkaban/azkaban | test/src/main/java/azkaban/test/executions/ThinArchiveTestUtils.java | https://github.com/azkaban/azkaban/blob/master/test/src/main/java/azkaban/test/executions/ThinArchiveTestUtils.java | Apache-2.0 |
private static String depCJSONBlock() {
return "{" +
" \"sha1\": \"f873f39163f5b43dbf1fee63cbce284074896221\"," +
" \"file\": \"cccc.jar\"," +
" \"destination\": \"dep_c_folder\"," +
" \"type\": \"jar\"," +
" \"ivyCoordinates\": \"com.linkedin.test:testercccc:1... | Create a string of valid raw json that adds a null to the list of valid dependencies.
@return raw json string containing valid dependencies and a null. | depCJSONBlock | java | azkaban/azkaban | test/src/main/java/azkaban/test/executions/ThinArchiveTestUtils.java | https://github.com/azkaban/azkaban/blob/master/test/src/main/java/azkaban/test/executions/ThinArchiveTestUtils.java | Apache-2.0 |
public static String getDepAPath() {
return "com/linkedin/test/testeraaaa/1.0.1/aaaa.jar";
} | Create a string of valid raw json that adds a null to the list of valid dependencies.
@return raw json string containing valid dependencies and a null. | getDepAPath | java | azkaban/azkaban | test/src/main/java/azkaban/test/executions/ThinArchiveTestUtils.java | https://github.com/azkaban/azkaban/blob/master/test/src/main/java/azkaban/test/executions/ThinArchiveTestUtils.java | Apache-2.0 |
public static Dependency getDepA() {
try {
return new Dependency(
"aaaa.jar",
"lib",
"jar",
"com.linkedin.test:testeraaaa:1.0.1",
"131bd316a77423e6b80d93262b576c139c72b4c3");
} catch (Exception e) {
// This will never happen
throw new RuntimeEx... | Create a string of valid raw json that adds a null to the list of valid dependencies.
@return raw json string containing valid dependencies and a null. | getDepA | java | azkaban/azkaban | test/src/main/java/azkaban/test/executions/ThinArchiveTestUtils.java | https://github.com/azkaban/azkaban/blob/master/test/src/main/java/azkaban/test/executions/ThinArchiveTestUtils.java | Apache-2.0 |
public static String getDepBPath() {
return "com/linkedin/test/testerbbbb/1.0.1/bbbb.jar";
} | Create a string of valid raw json that adds a null to the list of valid dependencies.
@return raw json string containing valid dependencies and a null. | getDepBPath | java | azkaban/azkaban | test/src/main/java/azkaban/test/executions/ThinArchiveTestUtils.java | https://github.com/azkaban/azkaban/blob/master/test/src/main/java/azkaban/test/executions/ThinArchiveTestUtils.java | Apache-2.0 |
public static Dependency getDepB() {
try {
return new Dependency(
"bbbb.jar",
"dep_b_folder",
"jar",
"com.linkedin.test:testerbbbb:1.0.1",
"9461919846e1e7c8fc74fee95aa6ac74993be71e");
} catch (Exception e) {
// This will never happen
throw new RuntimeExc... | Create a string of valid raw json that adds a null to the list of valid dependencies.
@return raw json string containing valid dependencies and a null. | getDepB | java | azkaban/azkaban | test/src/main/java/azkaban/test/executions/ThinArchiveTestUtils.java | https://github.com/azkaban/azkaban/blob/master/test/src/main/java/azkaban/test/executions/ThinArchiveTestUtils.java | Apache-2.0 |
public static String getDepCPath() {
return "com/linkedin/test/testercccc/1.0.1/cccc.jar";
} | Create a string of valid raw json that adds a null to the list of valid dependencies.
@return raw json string containing valid dependencies and a null. | getDepCPath | java | azkaban/azkaban | test/src/main/java/azkaban/test/executions/ThinArchiveTestUtils.java | https://github.com/azkaban/azkaban/blob/master/test/src/main/java/azkaban/test/executions/ThinArchiveTestUtils.java | Apache-2.0 |
public static Dependency getDepC() {
try {
return new Dependency(
"cccc.jar",
"dep_c_folder",
"jar",
"com.linkedin.test:testercccc:1.0.1",
"f873f39163f5b43dbf1fee63cbce284074896221");
} catch (Exception e) {
// This will never happen
throw new ... | Create a string of valid raw json that adds a null to the list of valid dependencies.
@return raw json string containing valid dependencies and a null. | getDepC | java | azkaban/azkaban | test/src/main/java/azkaban/test/executions/ThinArchiveTestUtils.java | https://github.com/azkaban/azkaban/blob/master/test/src/main/java/azkaban/test/executions/ThinArchiveTestUtils.java | Apache-2.0 |
public synchronized static void lpush(String key, String... strings) {
try {
Jedis jedis = RedisUtil.getJedis();
jedis.lpush(key, strings);
jedis.close();
} catch (Exception e) {
LOGGER.error("lpush error : " + e);
}
} | lrem
@param key
@param count
@param value | lpush | java | shuzheng/zheng | zheng-common/src/main/java/com/zheng/common/util/RedisUtil.java | https://github.com/shuzheng/zheng/blob/master/zheng-common/src/main/java/com/zheng/common/util/RedisUtil.java | MIT |
public synchronized static void lrem(String key, long count, String value) {
try {
Jedis jedis = RedisUtil.getJedis();
jedis.lrem(key, count, value);
jedis.close();
} catch (Exception e) {
LOGGER.error("lpush error : " + e);
}
} | sadd
@param key
@param value
@param seconds | lrem | java | shuzheng/zheng | zheng-common/src/main/java/com/zheng/common/util/RedisUtil.java | https://github.com/shuzheng/zheng/blob/master/zheng-common/src/main/java/com/zheng/common/util/RedisUtil.java | MIT |
public static Test suite()
{
return new TestSuite( AppTest.class );
} | @return the suite of tests being tested | suite | java | shuzheng/zheng | zheng-demo/zheng-demo-rpc-service/src/test/java/com/zheng/AppTest.java | https://github.com/shuzheng/zheng/blob/master/zheng-demo/zheng-demo-rpc-service/src/test/java/com/zheng/AppTest.java | MIT |
public static Test suite()
{
return new TestSuite( AppTest.class );
} | @return the suite of tests being tested | suite | java | shuzheng/zheng | zheng-pay/zheng-pay-sdk/src/test/java/com/zheng/pay/sdk/AppTest.java | https://github.com/shuzheng/zheng/blob/master/zheng-pay/zheng-pay-sdk/src/test/java/com/zheng/pay/sdk/AppTest.java | MIT |
public static Test suite()
{
return new TestSuite( AppTest.class );
} | @return the suite of tests being tested | suite | java | shuzheng/zheng | zheng-wechat/zheng-wechat-mp/zheng-wechat-mp-service/src/test/java/com/zheng/wechat/mp/service/AppTest.java | https://github.com/shuzheng/zheng/blob/master/zheng-wechat/zheng-wechat-mp/zheng-wechat-mp-service/src/test/java/com/zheng/wechat/mp/service/AppTest.java | MIT |
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("ccy.focuslayoutmanagerproject", appContext.getPackageName());
} | Instrumented test, which will execute on an Android device.
@see <a href="http://d.android.com/tools/testing">Testing documentation</a> | useAppContext | java | CCY0122/FocusLayoutManager | app/src/androidTest/java/ccy/focuslayoutmanagerproject/ExampleInstrumentedTest.java | https://github.com/CCY0122/FocusLayoutManager/blob/master/app/src/androidTest/java/ccy/focuslayoutmanagerproject/ExampleInstrumentedTest.java | Apache-2.0 |
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
} | Example local unit test, which will execute on the development machine (host).
@see <a href="http://d.android.com/tools/testing">Testing documentation</a> | addition_isCorrect | java | CCY0122/FocusLayoutManager | app/src/test/java/ccy/focuslayoutmanagerproject/ExampleUnitTest.java | https://github.com/CCY0122/FocusLayoutManager/blob/master/app/src/test/java/ccy/focuslayoutmanagerproject/ExampleUnitTest.java | Apache-2.0 |
@Test
public void testDuration(){
assertEquals(getDuration(10f),100+20);
assertEquals(getDuration(50f),100+100);
assertEquals(getDuration(100f),300);
assertEquals(getDuration(150f),300 + 150);
assertEquals(getDuration(200f),300 + 300);
} | Example local unit test, which will execute on the development machine (host).
@see <a href="http://d.android.com/tools/testing">Testing documentation</a> | testDuration | java | CCY0122/FocusLayoutManager | app/src/test/java/ccy/focuslayoutmanagerproject/ExampleUnitTest.java | https://github.com/CCY0122/FocusLayoutManager/blob/master/app/src/test/java/ccy/focuslayoutmanagerproject/ExampleUnitTest.java | Apache-2.0 |
public long getDuration(float distance){
float onceCompleteScrollLength = 100;
long minDuration = 100;
long maxDuration = 300;
long duration;
float distanceFraction = (Math.abs(distance) / (onceCompleteScrollLength));
if(distance <= onceCompleteScrollLength){
... | Example local unit test, which will execute on the development machine (host).
@see <a href="http://d.android.com/tools/testing">Testing documentation</a> | getDuration | java | CCY0122/FocusLayoutManager | app/src/test/java/ccy/focuslayoutmanagerproject/ExampleUnitTest.java | https://github.com/CCY0122/FocusLayoutManager/blob/master/app/src/test/java/ccy/focuslayoutmanagerproject/ExampleUnitTest.java | Apache-2.0 |
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("ccy.focuslayoutmanager.test", appContext.getPackageName());
} | Instrumented test, which will execute on an Android device.
@see <a href="http://d.android.com/tools/testing">Testing documentation</a> | useAppContext | java | CCY0122/FocusLayoutManager | focuslayoutmanager/src/androidTest/java/ccy/focuslayoutmanager/ExampleInstrumentedTest.java | https://github.com/CCY0122/FocusLayoutManager/blob/master/focuslayoutmanager/src/androidTest/java/ccy/focuslayoutmanager/ExampleInstrumentedTest.java | Apache-2.0 |
@Override
public void onDetachedFromWindow(RecyclerView view, RecyclerView.Recycler recycler) {
cancelAnimator();
super.onDetachedFromWindow(view, recycler);
} | @param recycler
@param state
@param delta | onDetachedFromWindow | java | CCY0122/FocusLayoutManager | focuslayoutmanager/src/main/java/ccy/focuslayoutmanager/FocusLayoutManager.java | https://github.com/CCY0122/FocusLayoutManager/blob/master/focuslayoutmanager/src/main/java/ccy/focuslayoutmanager/FocusLayoutManager.java | Apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.