Java 类org.joda.time.YearMonth 实例源码

项目:nomulus    文件:IcannReportingStagerTest.java   
private IcannReportingStager createStager() {
  IcannReportingStager action = new IcannReportingStager();
  ActivityReportingQueryBuilder activityBuilder = new ActivityReportingQueryBuilder();
  activityBuilder.projectId = "test-project";
  activityBuilder.yearMonth = new YearMonth(2017, 6);
  action.activityQueryBuilder = activityBuilder;
  TransactionsReportingQueryBuilder transactionsBuilder = new TransactionsReportingQueryBuilder();
  transactionsBuilder.projectId = "test-project";
  transactionsBuilder.yearMonth = new YearMonth(2017, 6);
  action.transactionsQueryBuilder = transactionsBuilder;
  action.reportingBucket = "test-bucket";
  action.yearMonth = new YearMonth(2017, 6);
  action.subdir = "icann/monthly/2017-06";
  action.bigquery = bigquery;
  action.gcsUtils = new GcsUtils(gcsService, 1024);
  return action;
}
项目:nomulus    文件:GenerateInvoicesActionTest.java   
@Before
public void setUp() throws IOException {
  dataflow = mock(Dataflow.class);
  projects = mock(Projects.class);
  templates = mock(Templates.class);
  launch = mock(Launch.class);
  when(dataflow.projects()).thenReturn(projects);
  when(projects.templates()).thenReturn(templates);
  when(templates.launch(any(String.class), any(LaunchTemplateParameters.class)))
      .thenReturn(launch);
  when(launch.setGcsPath(any(String.class))).thenReturn(launch);

  response = new FakeResponse();
  Job job = new Job();
  job.setId("12345");
  when(launch.execute()).thenReturn(new LaunchTemplateResponse().setJob(job));

  action = new GenerateInvoicesAction(
      "test-project", "gs://test-project-beam", new YearMonth(2017, 10), dataflow, response);
}
项目:gma-android    文件:ColumnsListFragment.java   
public static ColumnsListFragment newInstance(@ValueType final int type, @NonNull final String guid,
                                              @NonNull final String ministryId, @NonNull final Mcc mcc,
                                              @NonNull final YearMonth period, final boolean favoritesOnly) {
    final ColumnsListFragment fragment = new ColumnsListFragment();

    final Bundle args = new Bundle();
    args.putInt(ARG_TYPE, type);
    args.putString(ARG_GUID, guid);
    args.putString(ARG_MINISTRY_ID, ministryId);
    args.putString(ARG_MCC, mcc.toString());
    args.putString(ARG_PERIOD, period.toString());
    args.putBoolean(ARG_FAVORITES_ONLY, favoritesOnly);
    fragment.setArguments(args);

    return fragment;
}
项目:gma-android    文件:MeasurementsPagerFragment.java   
@NonNull
public static MeasurementsPagerFragment newInstance(@ValueType final int type, @NonNull final String guid,
                                                    @NonNull final String ministryId,
                                                    @NonNull final Ministry.Mcc mcc,
                                                    @NonNull final YearMonth period,
                                                    @NonNull final MeasurementType.Column column,
                                                    final boolean favoritesOnly) {
    final MeasurementsPagerFragment fragment = new MeasurementsPagerFragment();

    final Bundle args = new Bundle();
    args.putInt(ARG_TYPE, type);
    args.putString(ARG_GUID, guid);
    args.putString(ARG_MINISTRY_ID, ministryId);
    args.putString(ARG_MCC, mcc.toString());
    args.putString(ARG_PERIOD, period.toString());
    args.putString(ARG_COLUMN, column.toString());
    args.putBoolean(ARG_FAVORITES_ONLY, favoritesOnly);
    fragment.setArguments(args);

    return fragment;
}
项目:gma-android    文件:MeasurementDetailsFragment.java   
@NonNull
public static MeasurementDetailsFragment newInstance(@NonNull final String guid, @NonNull final String ministryId,
                                                     @NonNull final Ministry.Mcc mcc,
                                                     @NonNull final String permLink,
                                                     @NonNull final YearMonth period) {
    final MeasurementDetailsFragment fragment = new MeasurementDetailsFragment();

    final Bundle args = new Bundle();
    args.putString(ARG_GUID, guid);
    args.putString(ARG_MINISTRY_ID, ministryId);
    args.putString(ARG_MCC, mcc.toString());
    args.putString(ARG_PERMLINK, permLink);
    args.putString(ARG_PERIOD, period.toString());
    fragment.setArguments(args);

    return fragment;
}
项目:gma-android    文件:MeasurementDetailsFragment.java   
@Override
public void onCreate(@Nullable final Bundle savedState) {
    super.onCreate(savedState);
    setHasOptionsMenu(true);

    // process arguments
    final Bundle args = this.getArguments();
    mGuid = args.getString(ARG_GUID);
    mMinistryId = args.getString(ARG_MINISTRY_ID);
    mMcc = Ministry.Mcc.fromRaw(args.getString(ARG_MCC));
    mPermLink = args.getString(ARG_PERMLINK);
    mPeriod = YearMonth.parse(args.getString(ARG_PERIOD));

    // start an initial data sync
    syncData(false);
}
项目:gma-android    文件:MeasurementDetailsLoader.java   
public MeasurementDetailsLoader(@NonNull final Context context, @Nullable final Bundle args) {
    super(context);
    mDao = GmaDao.getInstance(context);

    if (args != null) {
        mGuid = args.getString(ARG_GUID);
        mMinistryId = BundleCompat.getString(args, ARG_MINISTRY_ID, Ministry.INVALID_ID);
        mMcc = Mcc.fromRaw(args.getString(ARG_MCC));
        mPermLink = args.getString(ARG_PERMLINK);
        final String rawPeriod = args.getString(ARG_PERIOD);
        mPeriod = rawPeriod != null ? YearMonth.parse(rawPeriod) : YearMonth.now();

        addIntentFilter(
                BroadcastUtils.updateMeasurementDetailsFilter(mMinistryId, mMcc, mPeriod, mGuid, mPermLink));
    } else {
        mGuid = null;
        mMinistryId = Ministry.INVALID_ID;
        mMcc = Mcc.UNKNOWN;
        mPermLink = null;
        mPeriod = YearMonth.now();
    }
}
项目:gma-android    文件:MeasurementDetailsActivity.java   
@Override
protected void onCreate(@Nullable final Bundle savedState) {
    super.onCreate(savedState);
    setContentView(R.layout.activity_measurement_details);

    mGoogleAnalytics = GoogleAnalyticsManager.getInstance(this);

    final Intent intent = this.getIntent();
    mGuid = intent.getStringExtra(EXTRA_GUID);
    mMinistryId = intent.getStringExtra(EXTRA_MINISTRY_ID);
    mMcc = Ministry.Mcc.fromRaw(intent.getStringExtra(EXTRA_MCC));
    mPermLink = intent.getStringExtra(EXTRA_PERMLINK);
    mPeriod = YearMonth.parse(intent.getStringExtra(EXTRA_PERIOD));

    createDetailsFragmentsIfNeeded();
}
项目:gma-android    文件:MeasurementsActivity.java   
private void onChangePeriod(@NonNull YearMonth period) {
    // don't allow navigating into the future
    if (period.isAfter(NOW)) {
        period = NOW;
    }

    // check if the period is changing
    final boolean changing = !mPeriod.isEqual(period);

    // update period
    mPeriod = period;

    if (changing) {
        // start a data sync
        syncAdjacentPeriods(false);

        // update Period views
        updateViews();

        // reload the measurement columns fragment for the current period
        loadMeasurementColumnsFragmentIfNeeded();
    }
}
项目:gma-android    文件:MeasurementSyncTasks.java   
@NonNull
private static List<MeasurementValue> getDirtyMeasurements(@NonNull final GmaDao dao,
                                                           @NonNull final Assignment assignment,
                                                           @NonNull final Mcc mcc,
                                                           @NonNull final YearMonth period) {
    final List<MeasurementValue> dirty = new ArrayList<>();
    if (assignment.can(UPDATE_PERSONAL_MEASUREMENTS)) {
        dirty.addAll(dao.get(PersonalMeasurement.class, Contract.PersonalMeasurement.SQL_WHERE_DIRTY + " AND " +
                                     Contract.PersonalMeasurement.SQL_WHERE_GUID_MINISTRY_MCC_PERIOD,
                             bindValues(assignment.getGuid(), assignment.getMinistryId(), mcc, period)));
    }
    if (assignment.can(UPDATE_MINISTRY_MEASUREMENTS)) {
        dirty.addAll(dao.get(MinistryMeasurement.class, Contract.MinistryMeasurement.SQL_WHERE_DIRTY + " AND " +
                                     Contract.MinistryMeasurement.SQL_WHERE_MINISTRY_MCC_PERIOD,
                             bindValues(assignment.getMinistryId(), mcc, period)));
    }
    return dirty;
}
项目:gma-android    文件:Measurement.java   
@NonNull
public static Measurement fromJson(@NonNull final JSONObject json, @NonNull final String guid,
                                   @NonNull final String ministryId, @NonNull final Ministry.Mcc mcc,
                                   @NonNull final YearMonth period) throws JSONException {
    final Measurement measurement = new Measurement();

    measurement.type = MeasurementType.fromJson(json, ministryId);
    if (json.has(MinistryMeasurement.JSON_VALUE)) {
        measurement.ministryMeasurement = MinistryMeasurement.fromJson(json, ministryId, mcc, period);
    }
    if (json.has(PersonalMeasurement.JSON_VALUE)) {
        measurement.personalMeasurement = PersonalMeasurement.fromJson(json, guid, ministryId, mcc, period);
    }

    return measurement;
}
项目:omise-java    文件:TokenResourceTest.java   
@Test
public void testCreate() throws IOException, OmiseException {
    Token token = resource().create(new Token.Create().card(new Card.Create()
            .name("JOHN DOE")
            .number("4242424242424242")
            .expiration(YearMonth.now().withPeriodAdded(Period.years(1), 1))
            .securityCode("123")
            .city("Bangkok")
            .postalCode("10240"))
    );

    assertRequested("POST", "/tokens", 200);
    assertVaultRequest();

    assertEquals(TOKEN_ID, token.getId());
    assertFalse(token.isLiveMode());
    assertEquals("card_test_4yq6tuucl9h4erukfl0", token.getCard().getId());
}
项目:bandwidth-on-demand    文件:AbstractReportController.java   
@RequestMapping(value = "/{selectedYearMonth}", method = RequestMethod.GET)
public String index(@PathVariable final String selectedYearMonth, Model model) {

  YearMonth yearMonth = parseYearMonth(selectedYearMonth);
  ReportIntervalView selectedInterval = new ReportIntervalView(yearMonth.toInterval());

  List<ReportIntervalView> intervals = determineReportIntervals(AMOUNT_OF_REPORT_PERIODS);
  if (!intervals.contains(selectedInterval)) {
    intervals.add(selectedInterval);
  }

  model.addAttribute("intervalList", intervals);
  model.addAttribute("baseReportIntervalUrl", getPageUrl());
  model.addAttribute("selectedInterval", selectedInterval);
  model.addAttribute("report", determineReport(selectedInterval.getInterval()));
  model.addAttribute("graphUrlPart",  "graph/" + selectedInterval.getId());

  return getPageUrl();
}
项目:bandwidth-on-demand    文件:AbstractReportController.java   
@RequestMapping(value = "/data/{selectedYearMonth}", method = RequestMethod.GET)
@ResponseBody
public String graphData(HttpServletResponse response, @PathVariable String selectedYearMonth) {
  response.setContentType("text/plain;charset=ISO-8859-1");

  StringBuffer responseBuffer = new StringBuffer("Month,Create,Create_f,Cancel,Cancel_f,NSI,NSI_f").append("\n");

  YearMonth yearMonth = parseYearMonth(selectedYearMonth);

  for (int i = MONTHS_IN_GRAPH; i > 0; i--) {
    final YearMonth month = yearMonth.minusMonths(i - 1);
    ReservationReportView report = determineReport(month.toInterval());
    addReport(responseBuffer, report, month.toString("MMM"));
  }

  return responseBuffer.toString();
}
项目:bandwidth-on-demand    文件:VersReportingService.java   
@VisibleForTesting
protected void sendReports(YearMonth period) {
  logger.info(String.format("Sending reports to VERS for '%s'", period.toString("yyyy-MM")));

  Map<Optional<String>, ReservationReportView> reportViews = getAllReservationReportViews(period);

  for (Entry<Optional<String>, ReservationReportView> reservationReportViewEntry : reportViews.entrySet()) {
    Optional<String> institute = reservationReportViewEntry.getKey();
    ReservationReportView reportView = reservationReportViewEntry.getValue();

    Collection<ErInsertReportDocument> reports = createAllReports(period, institute, reportView);

    logger.info(String.format("Sending %d reports for institute '%s'", reports.size(), institute.orElse("Null/Not set")));

    submitReports(reports);
  }
}
项目:bandwidth-on-demand    文件:VersReportingService.java   
Collection<ErInsertReportDocument> createRequestsCancelSucceededPki(YearMonth previousMonth,
    Optional<String> institute, ReservationReportView reportView) {

  final String pkiName = "Reservations cancelled";

  List<ErInsertReportDocument> reports = new ArrayList<>();

  reports.add(
      getVersRequest(
          pkiName, reportView.getAmountRequestsCancelSucceeded(), previousMonth, institute, "Succeeded"));

  reports.add(
      getVersRequest(
          pkiName, reportView.getAmountRequestsCancelFailed(), previousMonth, institute, "Failed"));

  return reports;
}
项目:bandwidth-on-demand    文件:VersReportingService.java   
Collection<ErInsertReportDocument> createRequestsModifiedSucceededPki(YearMonth previousMonth,
    Optional<String> institute, ReservationReportView reportView) {

  final String pkiName = "Reservations modified";

  List<ErInsertReportDocument> reports = new ArrayList<>();

  reports.add(
      getVersRequest(
          pkiName, reportView.getAmountRequestsModifiedSucceeded(), previousMonth, institute, "Succeeded"));

  reports.add(
      getVersRequest(
          pkiName, reportView.getAmountRequestsModifiedFailed(), previousMonth, institute, "Failed"));

  return reports;
}
项目:bandwidth-on-demand    文件:VersReportingService.java   
Collection<ErInsertReportDocument> createRunningReservationsSucceededPki(YearMonth previousMonth,
    Optional<String> institute, ReservationReportView reportView) {

  final String pkiName = "Reservations created";

  List<ErInsertReportDocument> reports = new ArrayList<>();

  reports.add(
      getVersRequest(
          pkiName, reportView.getAmountRequestsCreatedSucceeded(), previousMonth, institute, "Succeeded"));

  reports.add(
      getVersRequest(
          pkiName, reportView.getAmountRequestsCreatedFailed(), previousMonth, institute, "Failed"));

  return reports;
}
项目:bandwidth-on-demand    文件:VersReportingService.java   
Collection<ErInsertReportDocument> createReservationsProtectionTypePki(YearMonth period,
    Optional<String> institute, ReservationReportView reservationReportView) {

  final String pkiName = "Reservation protection type";

  List<ErInsertReportDocument> reports = new ArrayList<>();

  reports.add(
      getVersRequest(
          pkiName, reservationReportView.getAmountReservationsProtected(), period, institute, "Protected"));

  reports.add(
      getVersRequest(
          pkiName, reservationReportView.getAmountReservationsUnprotected(), period, institute, "Unprotected"));

  reports.add(
      getVersRequest(
          pkiName, reservationReportView.getAmountReservationsRedundant(), period, institute, "Redundant"));

  return reports;
}
项目:bandwidth-on-demand    文件:VersReportingService.java   
protected Map<Optional<String>, ReservationReportView> getAllReservationReportViews(YearMonth period) {
  Map<Optional<String>, ReservationReportView> reportViews = new HashMap<>();

  Collection<PhysicalResourceGroup> prgWithPorts = physicalResourceGroupService.findAllWithPorts();

  for (PhysicalResourceGroup physicalResourceGroup : prgWithPorts) {
    Optional<String> orgName = Optional.of(physicalResourceGroup.getOrganization().getShortName());
    ReservationReportView report = reportingService.determineReportForAdmin(period.toInterval(), BodRole
        .createManager(physicalResourceGroup));

    reportViews.put(orgName, report);
  }

  reportViews.put(Optional.empty(), reportingService.determineReportForNoc(period.toInterval()));

  return reportViews;
}
项目:bandwidth-on-demand    文件:VersReportingService.java   
protected ErInsertReportDocument getVersRequest(
    String type, long value, YearMonth period,
    Optional<String> instituteShortName, String instance) {

  InsertReportInput insertReportInput = InsertReportInput.Factory.newInstance();
  insertReportInput.setNormComp("=");
  insertReportInput.setNormValue(Long.toString(value));
  insertReportInput.setDepartmentList(DEPARTMENT_NETWERK_DIENSTEN);
  insertReportInput.setIsKPI(true);
  insertReportInput.setValue(Long.toString(value));
  insertReportInput.setPeriod(period.toString("yyyy-MM"));
  insertReportInput.setType(type);
  insertReportInput.setInstance(instance);

  if (instituteShortName.isPresent()) {
    insertReportInput.setOrganisation(instituteShortName.get());
    insertReportInput.setIsHidden(false);
  } else {
    insertReportInput.setIsHidden(true);
  }

  ErInsertReportDocument versRequest = ErInsertReportDocument.Factory.newInstance();
  versRequest.setErInsertReport(getErInsertReport(insertReportInput));

  return versRequest;
}
项目:bandwidth-on-demand    文件:AbstractReportControllerTest.java   
@Test
public void shouldHaveIntervalsUtilNow() {
  final List<ReportIntervalView> intervals = subject
      .determineReportIntervals(TestReportController.AMOUNT_OF_REPORT_PERIODS);

  assertThat(intervals, hasSize(TestReportController.AMOUNT_OF_REPORT_PERIODS));

  DateTime firstDay;
  for (int i = 0; i < TestReportController.AMOUNT_OF_REPORT_PERIODS; i++) {
    firstDay = YearMonth.now().toLocalDate(1).toDateTimeAtStartOfDay().minusMonths(i);

    assertThat("Month start: " + i, intervals.get(i).getInterval().getStart(), is(firstDay));
    assertThat("Month end: " + i, intervals.get(i).getInterval().getEnd(), is(firstDay.plusMonths(1)));

    assertThat("Month id: " + i, String.valueOf(intervals.get(i).getId()), is(String.valueOf(firstDay.getYear())
        + (firstDay.getMonthOfYear() < 10 ? "0" : "") + String.valueOf(firstDay.getMonthOfYear())));
  }
}
项目:bandwidth-on-demand    文件:VersReportingServiceTest.java   
@Test
public void createVersReportForInstitution() {
  YearMonth period = new YearMonth(2009, 2);
  long reportValue = 10L;
  String reportType = "Reservation modified";
  String reportInstance = "Failed";

  ErInsertReportDocument versRequest = subject.getVersRequest(reportType, reportValue, period, Optional.of("RUG"), reportInstance);

  ErInsertReport insertReport = versRequest.getErInsertReport();

  assertThat(insertReport.getUsername(), is(VERS_USERNAME));
  assertThat(insertReport.getPassword(), is(VERS_USER_PASSWORD));

  InsertReportInput reportInput = insertReport.getParameters();

  assertThat(reportInput.getIsHidden(), is(false));
  assertThat(reportInput.getOrganisation(), is("RUG"));
  assertThat(reportInput.getPeriod(), is("2009-02"));
  assertThat(reportInput.getNormComp(), is("="));
  assertThat(reportInput.getNormValue(), is("" + reportValue));
  assertThat(reportInput.getDepartmentList(), is("NWD"));
  assertThat(reportInput.getValue(), is("" + reportValue));
  assertThat(reportInput.getInstance(), is(reportInstance));
  assertThat(reportInput.getType(), is(reportType));
}
项目:bandwidth-on-demand    文件:VersReportingServiceTestIntegration.java   
@Test
@Ignore("Only for testing uploading a real report, don't do it every run")
public void insertReporting() throws Exception {
  YearMonth period = new YearMonth(2006, 3);
  Organization organization = new OrganizationFactory().setShortName("RUG").setName("Rijks Universiteit Groningen").create();
  PhysicalResourceGroup group = new PhysicalResourceGroupFactory().setOrganization(organization).create();
  ReservationReportView adminReport = new ReservationReportView(period.toInterval().getStart(), period.toInterval().getEnd());
  adminReport.setAmountRunningReservationsFailed(1);
  adminReport.setAmountRequestsCreatedSucceeded(5);
  adminReport.setAmountRunningReservationsStillRunning(4);

  ReservationReportView nocReport = new ReservationReportView(period.toInterval().getStart(), period.toInterval().getEnd());
  nocReport.setAmountRunningReservationsFailed(2);
  nocReport.setAmountRequestsCreatedSucceeded(10);
  nocReport.setAmountRunningReservationsStillRunning(8);

  when(physicalResourceGroupServiceMock.findAllWithPorts()).thenReturn(Lists.newArrayList(group));
  when(reportingServiceMock.determineReportForAdmin(eq(period.toInterval()), any(BodRole.class))).thenReturn(adminReport);
  when(reportingServiceMock.determineReportForNoc(period.toInterval())).thenReturn(nocReport);

  subject.sendReports(period);
}
项目:SaaSMetrics4J    文件:MiniReport.java   
public static String miniReport(Contracts contracts, BillingReportPrinter printer, int year, int monthStart, int months) throws Exception {
  StringBuffer sb = new StringBuffer();
  Contracts contAll = contracts.getView(AccountFilter.PAID_CONTRACT);
  Contracts contCont = contracts.getView(AccountFilter.CONTRACT);
  YearMonth ym = (new YearMonth()).minusMonths(1);

  sb.append(printer.line() + "ALL (CONTRACTS + PROJECTS)\n\n");
  sb.append(Reporting.displayLastMRR(contAll, year, monthStart, months, ym) + "\n");

  sb.append(printer.line() + "CONTRACTS only (projects removed):\n\n");
  sb.append(Reporting.displayLastMRR(contCont, year, monthStart, months, ym) + "\n");

  sb.append(printer.line());
  return sb.toString();

}
项目:nomulus    文件:IcannHttpReporter.java   
private String makeUrl(String filename) {
  // Filename is in the format tld-reportType-yearMonth.csv
  String tld = getTld(filename);
  // Remove the tld- prefix and csv suffix
  String remainder = filename.substring(tld.length() + 1, filename.length() - 4);
  List<String> elements = Splitter.on('-').splitToList(remainder);
  ReportType reportType = ReportType.valueOf(Ascii.toUpperCase(elements.get(0)));
  // Re-add hyphen between year and month, because ICANN is inconsistent between filename and URL
  String yearMonth =
      YearMonth.parse(elements.get(1), DateTimeFormat.forPattern("yyyyMM")).toString("yyyy-MM");
  return String.format("%s/%s/%s", getUrlPrefix(reportType), tld, yearMonth);
}
项目:nomulus    文件:IcannReportingModule.java   
/** Provides the subdirectory to store/upload reports to, defaults to icann/monthly/yearMonth. */
@Provides
@ReportingSubdir
static String provideSubdir(
    @Parameter(PARAM_SUBDIR) Optional<String> subdirOptional, YearMonth yearMonth) {
  String subdir =
      subdirOptional.orElse(
          String.format(
              "%s/%s", DEFAULT_SUBDIR, DateTimeFormat.forPattern("yyyy-MM").print(yearMonth)));
  if (subdir.startsWith("/") || subdir.endsWith("/")) {
    throw new BadRequestException(
        String.format("subdir must not start or end with a \"/\", got %s instead.", subdir));
  }
  return subdir;
}
项目:nomulus    文件:BackendModule.java   
/** Extracts an optional YearMonth in yyyy-MM format from the request. */
@Provides
@Parameter(PARAM_YEAR_MONTH)
static Optional<YearMonth> provideYearMonthOptional(HttpServletRequest req) {
  DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM");
  Optional<String> optionalYearMonthStr = extractOptionalParameter(req, PARAM_YEAR_MONTH);
  try {
    return optionalYearMonthStr.map(s -> YearMonth.parse(s, formatter));
  } catch (IllegalArgumentException e) {
    throw new BadRequestException(
        String.format(
            "yearMonth must be in yyyy-MM format, got %s instead",
            optionalYearMonthStr.orElse("UNSPECIFIED YEARMONTH")));
  }
}
项目:nomulus    文件:GenerateInvoicesAction.java   
@Inject
GenerateInvoicesAction(
    @Config("projectId") String projectId,
    @Config("apacheBeamBucketUrl") String beamBucketUrl,
    YearMonth yearMonth,
    Dataflow dataflow,
    Response response) {
  this.projectId = projectId;
  this.beamBucketUrl = beamBucketUrl;
  this.yearMonth = yearMonth;
  this.dataflow = dataflow;
  this.response = response;
}
项目:nomulus    文件:BillingEmailUtils.java   
@Inject
BillingEmailUtils(
    SendEmailService emailService,
    YearMonth yearMonth,
    @Config("alertSenderEmailAddress") String alertSenderAddress,
    @Config("invoiceEmailRecipients") ImmutableList<String> invoiceEmailRecipients,
    @Config("apacheBeamBucketUrl") String beamBucketUrl) {
  this.emailService = emailService;
  this.yearMonth = yearMonth;
  this.alertSenderAddress = alertSenderAddress;
  this.invoiceEmailRecipients = invoiceEmailRecipients;
  this.beamBucketUrl = beamBucketUrl;
}
项目:nomulus    文件:IcannReportingStagingActionTest.java   
private IcannReportingStagingAction createAction(ImmutableList<ReportType> reportingMode) {
  IcannReportingStagingAction action = new IcannReportingStagingAction();
  action.yearMonth = new YearMonth(2017, 6);
  action.subdir = "default/dir";
  action.reportTypes = reportingMode;
  action.response = response;
  action.stager = stager;
  action.retrier = new Retrier(new FakeSleeper(new FakeClock()), 3);
  action.emailUtils = emailUtils;
  return action;
}
项目:nomulus    文件:IcannReportingModuleTest.java   
@Test
public void testInvalidSubdir_throwsException() {
  BadRequestException thrown =
      expectThrows(
          BadRequestException.class,
          () ->
              IcannReportingModule.provideSubdir(Optional.of("/whoops"), new YearMonth(2017, 6)));
  assertThat(thrown)
      .hasMessageThat()
      .contains("subdir must not start or end with a \"/\", got /whoops instead.");
}
项目:gma-android    文件:ColumnsListFragment.java   
@Override
@SuppressWarnings("ResourceType")
public void onCreate(final Bundle savedState) {
    super.onCreate(savedState);

    // process arguments
    final Bundle args = this.getArguments();
    mType = args.getInt(ARG_TYPE, mType);
    mGuid = args.getString(ARG_GUID);
    mMinistryId = BundleCompat.getString(args, ARG_MINISTRY_ID, Ministry.INVALID_ID);
    mMcc = Mcc.fromRaw(args.getString(ARG_MCC));
    mPeriod = YearMonth.parse(args.getString(ARG_PERIOD));
    mFavoritesOnly = args.getBoolean(ARG_FAVORITES_ONLY, false);
}
项目:gma-android    文件:MeasurementsPagerFragment.java   
@Override
@SuppressWarnings("ResourceType")
public void onCreate(@Nullable final Bundle savedState) {
    super.onCreate(savedState);

    // process arguments
    final Bundle args = this.getArguments();
    mType = args.getInt(ARG_TYPE, TYPE_NONE);
    mGuid = args.getString(ARG_GUID);
    mMinistryId = BundleCompat.getString(args, ARG_MINISTRY_ID, Ministry.INVALID_ID);
    mMcc = Ministry.Mcc.fromRaw(args.getString(ARG_MCC));
    mPeriod = YearMonth.parse(args.getString(ARG_PERIOD));
    mColumn = MeasurementType.Column.fromRaw(args.getString(ARG_COLUMN));
    mFavoritesOnly = args.getBoolean(ARG_FAVORITES_ONLY, false);
}
项目:gma-android    文件:MeasurementDetailsFragment.java   
@Nullable
@Override
public Entry apply(@Nullable final Map.Entry<YearMonth, Integer> input) {
    if (input != null) {
        return new Entry(input.getValue(), mPeriods.indexOf(input.getKey()));
    }
    return null;
}
项目:gma-android    文件:MeasurementPagerAdapter.java   
public MeasurementPagerAdapter(@NonNull final Context context, @ValueType final int type,
                               @NonNull final String guid, @NonNull final String ministryId, @NonNull final Mcc mcc,
                               @NonNull final YearMonth period) {
    mContext = context;
    mDao = GmaDao.getInstance(context);

    mType = type;
    mGuid = guid;
    mMinistryId = ministryId;
    mMcc = mcc;
    mPeriod = period;
}
项目:gma-android    文件:GoogleAnalyticsManager.java   
public void sendMeasurementDetailsScreen(@NonNull final String guid, @NonNull final String ministryId,
                                         @NonNull final Mcc mcc, @NonNull final String permLink,
                                         @NonNull final YearMonth period) {
    mTracker.setScreenName(SCREEN_NAME_MEASUREMENT_DETAILS);
    mTracker.send(screen(guid, ministryId, mcc).setCustomDimension(DIMEN_PERM_LINK, permLink)
                          .setCustomDimension(DIMEN_PERIOD, period.toString()).build());
}
项目:gma-android    文件:MeasurementDetailsActivity.java   
public static void start(@NonNull final Context context, @NonNull final String guid,
                         @NonNull final String ministryId, @NonNull final Ministry.Mcc mcc,
                         @NonNull final String permLink, @NonNull final YearMonth period) {
    final Intent intent = new Intent(context, MeasurementDetailsActivity.class);
    populateIntent(intent, guid, ministryId, mcc, permLink, period);
    context.startActivity(intent);
}
项目:gma-android    文件:MeasurementDetailsActivity.java   
public static void populateIntent(@NonNull final Intent intent, @NonNull final String guid,
                                  @NonNull final String ministryId, @NonNull final Ministry.Mcc mcc,
                                  @NonNull final String permLink, @NonNull final YearMonth period) {
    intent.putExtra(EXTRA_GUID, guid);
    intent.putExtra(EXTRA_MINISTRY_ID, ministryId);
    intent.putExtra(EXTRA_MCC, mcc.toString());
    intent.putExtra(EXTRA_PERMLINK, permLink);
    intent.putExtra(EXTRA_PERIOD, period.toString());
}