Package org.sonatype.nexus.rest.model

Examples of org.sonatype.nexus.rest.model.ScheduledServiceMonthlyResource


  private static ScheduledServiceMonthlyResource scheduledTask;

  @Override
  public ScheduledServiceMonthlyResource getTaskScheduled() {
    if (scheduledTask == null) {
      scheduledTask = new ScheduledServiceMonthlyResource();
      scheduledTask.setEnabled(true);
      scheduledTask.setId(null);
      scheduledTask.setName("taskMonthly");
      scheduledTask.setSchedule("monthly");
      // A future date
View Full Code Here


      }
      else if (SCHEDULE_TYPE_WEEKLY.equals(schedule)) {
        return new ScheduledServiceWeeklyResource();
      }
      else if (SCHEDULE_TYPE_MONTHLY.equals(schedule)) {
        return new ScheduledServiceMonthlyResource();
      }
      else if (SCHEDULE_TYPE_ADVANCED.equals(schedule)) {
        return new ScheduledServiceAdvancedResource();
      }
      else {
View Full Code Here

      res.setStartDate(formatDate(taskSchedule.getStartDate()));
      res.setRecurringTime(formatTime(taskSchedule.getStartDate()));
      res.setRecurringDay(formatRecurringDayOfWeek(taskSchedule.getDaysToRun()));
    }
    else if (MonthlySchedule.class.isAssignableFrom(task.getSchedule().getClass())) {
      resource = new ScheduledServiceMonthlyResource();

      MonthlySchedule taskSchedule = (MonthlySchedule) task.getSchedule();
      ScheduledServiceMonthlyResource res = (ScheduledServiceMonthlyResource) resource;

      res.setStartDate(formatDate(taskSchedule.getStartDate()));
      res.setRecurringTime(formatTime(taskSchedule.getStartDate()));
      res.setRecurringDay(formatRecurringDayOfMonth(taskSchedule.getDaysToRun()));
    }
    else if (CronSchedule.class.isAssignableFrom(task.getSchedule().getClass())) {
      resource = new ScheduledServiceAdvancedResource();

      CronSchedule taskSchedule = (CronSchedule) task.getSchedule();
      ScheduledServiceAdvancedResource res = (ScheduledServiceAdvancedResource) resource;

      res.setCronCommand(taskSchedule.getCronString());
    }

    if (resource != null) {
      resource.setId(task.getId());
      resource.setEnabled(task.isEnabled());
View Full Code Here

    this.validateXmlHasNoPackageNames(resourceResponse);
  }

  @Test
  public void testScheduledServiceMonthlyResource() {
    ScheduledServiceMonthlyResource resource = new ScheduledServiceMonthlyResource();
    resource.setId("Id");
    resource.setSchedule("monthly");
    resource.setTypeId("TypeId");
    resource.setAlertEmail("foo@bar.org");
    resource.setName("Name");
    resource.setEnabled(true);
    resource.setRecurringTime("recurringTime");
    resource.addRecurringDay("recurringDay1");
    resource.addRecurringDay("recurringDay2");

    ScheduledServicePropertyResource prop1 = new ScheduledServicePropertyResource();
    prop1.setKey("id1");
    prop1.setValue("value1");
    resource.addProperty(prop1);

    ScheduledServicePropertyResource prop2 = new ScheduledServicePropertyResource();
    prop2.setKey("id2");
    prop2.setValue("value2");
    resource.addProperty(prop2);

    ScheduledServiceResourceResponse resourceResponse = new ScheduledServiceResourceResponse();
    resourceResponse.setData(resource);

    this.marshalUnmarchalThenCompare(resourceResponse);
View Full Code Here

TOP

Related Classes of org.sonatype.nexus.rest.model.ScheduledServiceMonthlyResource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.