ProjectManager { public void postScheduleEvent(final Project project, final azkaban.spi.EventType type, final User user, final Schedule schedule, final String errorMessage) { final Map<String, Object> eventData = new HashMap<>(); addEventDataFromProject(project, eventData); eventData.put("modifiedBy", user.getUserId()); eventData.put("flowName", schedule.getFlowName()); eventData.put("firstScheduledExecutionTime", schedule.getFirstSchedTime()); eventData.put("lastScheduledExecutionTime", schedule.getEndSchedTime()); eventData.put("timezone", schedule.getTimezone().toString()); eventData.put("cronExpression", schedule.getCronExpression()); setProjectEventStatus(errorMessage, eventData); project.fireEventListeners(ProjectEvent.create(project, type, eventData)); } @Inject  ProjectManager(final AzkabanProjectLoader azkabanProjectLoader,
      final ProjectLoader loader,
      final ProjectStorageManager projectStorageManager,
      final Props props, final ProjectCache cache); boolean hasFlowTrigger(final Project project, final Flow flow); Props getProps(); List<Project> getUserProjects(final User user); List<Project> getGroupProjects(final User user); List<Project> getUserProjectsByRegex(final User user, final String regexPattern); List<Project> getProjects(); List<Project> getProjectsByRegex(final String regexPattern); Boolean isActiveProject(final int id); Project getProject(final String name); Project getProject(final int id); Project createProject(final String projectName, final String description,
      final User creator); synchronized Project purgeProject(final Project project, final User deleter); synchronized Project removeProject(final Project project, final User deleter); void updateProjectDescription(final Project project, final String description,
      final User modifier); List<ProjectLogEvent> getProjectEventLogs(final Project project,
      final int results, final int skip); Props getPropertiesFromFlowFile(final Flow flow, final String jobName, final String
      flowFileName, final int flowVersion); Props getProperties(final Project project, final Flow flow, final String jobName,
      final String source); Props getJobOverrideProperty(final Project project, final Flow flow, final String jobName,
      final String source); void setJobOverrideProperty(final Project project, final Flow flow, final Props prop,
      final String jobName, final String source, final User modifier); void updateProjectSetting(final Project project); void addProjectProxyUser(final Project project, final String proxyName,
      final User modifier); void removeProjectProxyUser(final Project project, final String proxyName,
      final User modifier); void updateProjectPermission(final Project project, final String name,
      final Permission perm, final boolean group, final User modifier); void removeProjectPermission(final Project project, final String name,
      final boolean group, final User modifier); ProjectFileHandler getProjectFileHandler(final Project project, final int version); Map<String, ValidationReport> uploadProject(final Project project,
      final File archive, final String fileType, final User uploader, final Props additionalProps,
      final String uploaderIPAddr); void updateFlow(final Project project, final Flow flow); void postProjectEvent(final Project project, final EventType type, final String user,
      final String message); boolean loadProjectWhiteList(); void setProjectEventStatus(final String errorMessage, final Map<String, Object> eventData); void postScheduleEvent(final Project project, final azkaban.spi.EventType type, final User user, final Schedule schedule, final String errorMessage);  }
@Test public void testScheduleEvent() { final User user = new User("testUser2"); project.addListener((event) -> { ProjectEvent projectEvent = (ProjectEvent) event; Assert.assertEquals("Event metadata not created as expected.", "testUser2", projectEvent.getEventData().get("modifiedBy")); Assert.assertEquals("Event metadata not created as expected.", flowName, projectEvent.getEventData().get("flowName")); Assert.assertEquals("Event metadata not created as expected.", firstSchedTime.getMillis(), projectEvent.getEventData().get("firstScheduledExecutionTime")); Assert.assertEquals("Event metadata not created as expected.", endSchedTime, projectEvent.getEventData().get("lastScheduledExecutionTime")); Assert.assertEquals("Event metadata not created as expected.", timezone.toString(), projectEvent.getEventData().get("timezone")); Assert.assertEquals("Event metadata not created as expected.", cronExpression, projectEvent.getEventData().get("cronExpression")); Assert.assertEquals("Event metadata not created as expected.", "SUCCESS", projectEvent.getEventData().get("projectEventStatus")); Assert.assertEquals("Event metadata not created as expected.", "null", projectEvent.getEventData().get("errorMessage")); }); final Schedule schedule = new Schedule(0, project.getId(), project.getName(), flowName, "schedule", firstSchedTime.getMillis(), endSchedTime, timezone, null, DateTime.now().getMillis(), firstSchedTime.getMillis(), firstSchedTime.getMillis(), user.getUserId(), null, cronExpression); manager.postScheduleEvent(project, azkaban.spi.EventType.SCHEDULE_CREATED, user, schedule, null); }