Java Code Examples for java.time.OffsetDateTime#plusMinutes()

The following examples show how to use java.time.OffsetDateTime#plusMinutes() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NotificationManagerTestITAlert.java    From blackduck-alert with Apache License 2.0 6 votes vote down vote up
@Test
public void testDeleteNotificationList() {
    OffsetDateTime time = DateUtils.createCurrentDateTimestamp();
    OffsetDateTime startDate = time.minusHours(1);
    OffsetDateTime endDate = time.plusHours(1);
    OffsetDateTime createdAt = time.minusHours(3);
    AlertNotificationModel entity = createNotificationModel(createdAt);
    notificationManager.saveAllNotifications(List.of(entity));
    OffsetDateTime createdAtInRange = time.plusMinutes(1);
    AlertNotificationModel entityToFind1 = createNotificationModel(createdAtInRange);
    createdAtInRange = time.plusMinutes(5);
    AlertNotificationModel entityToFind2 = createNotificationModel(createdAtInRange);
    OffsetDateTime createdAtLater = time.plusHours(3);
    entity = createNotificationModel(createdAtLater);
    notificationManager.saveAllNotifications(List.of(entity));
    notificationManager.saveAllNotifications(List.of(entityToFind1));
    notificationManager.saveAllNotifications(List.of(entityToFind2));

    List<AlertNotificationModel> foundList = notificationManager.findByCreatedAtBetween(startDate, endDate);
    assertEquals(4, notificationContentRepository.count());

    notificationManager.deleteNotificationList(foundList);

    assertEquals(2, notificationContentRepository.count());
}
 
Example 2
Source File: NotificationManagerTestITAlert.java    From blackduck-alert with Apache License 2.0 6 votes vote down vote up
@Test
public void findByCreatedAtBetween() {
    OffsetDateTime time = DateUtils.createCurrentDateTimestamp();
    OffsetDateTime startDate = time.minusHours(1);
    OffsetDateTime endDate = time.plusHours(1);
    OffsetDateTime createdAt = time.minusHours(3);
    AlertNotificationModel entity = createNotificationModel(createdAt);
    notificationManager.saveAllNotifications(List.of(entity));
    createdAt = time.plusMinutes(1);
    AlertNotificationModel entityToFind1 = createNotificationModel(createdAt);
    createdAt = time.plusMinutes(5);
    AlertNotificationModel entityToFind2 = createNotificationModel(createdAt);
    createdAt = time.plusHours(3);
    entity = createNotificationModel(createdAt);
    notificationManager.saveAllNotifications(List.of(entity));
    notificationManager.saveAllNotifications(List.of(entityToFind1));
    notificationManager.saveAllNotifications(List.of(entityToFind2));

    List<AlertNotificationModel> foundList = notificationManager.findByCreatedAtBetween(startDate, endDate);

    assertEquals(2, foundList.size());
    assertNotificationModel(entityToFind1, foundList.get(0));
    assertNotificationModel(entityToFind2, foundList.get(1));
}
 
Example 3
Source File: UpdateCheckerTest.java    From blackduck-alert with Apache License 2.0 5 votes vote down vote up
@ParameterizedTest
@ValueSource(strings = { SUFFIX_SNAPSHOT, SUFFIX_SIGQA_1 })
public void testAlertIsOlderBothSnapshot(String versionSuffix) {
    UpdateChecker updateChecker = getEmptyUpdateChecker();

    OffsetDateTime alertTime = DateUtils.createCurrentDateTimestamp();
    OffsetDateTime dockerTagDate = alertTime.plusMinutes(80);

    UpdateModel updateModel = updateChecker.getUpdateModel("1.0.0-" + versionSuffix, formatDate(alertTime, DOCKER_DATE_FORMAT), "1.0.0-" + versionSuffix, formatDate(dockerTagDate, DOCKER_DATE_FORMAT), null);

    assertTrue(updateModel.getUpdatable());
}
 
Example 4
Source File: UpdateCheckerTest.java    From blackduck-alert with Apache License 2.0 5 votes vote down vote up
@ParameterizedTest
@ValueSource(strings = { SUFFIX_SNAPSHOT, SUFFIX_SIGQA_1 })
public void testAlertIsOlderButCloseBothSnapshot(String versionSuffix) {
    UpdateChecker updateChecker = getEmptyUpdateChecker();

    OffsetDateTime alertTime = DateUtils.createCurrentDateTimestamp();
    OffsetDateTime dockerTagDate = alertTime.plusMinutes(20);

    UpdateModel updateModel = updateChecker.getUpdateModel("1.0.0-" + versionSuffix, formatDate(alertTime, DOCKER_DATE_FORMAT), "1.0.0-" + versionSuffix, formatDate(dockerTagDate, DOCKER_DATE_FORMAT), null);

    assertFalse(updateModel.getUpdatable());
}
 
Example 5
Source File: UpdateCheckerTest.java    From blackduck-alert with Apache License 2.0 5 votes vote down vote up
@ParameterizedTest
@ValueSource(strings = { SUFFIX_SNAPSHOT, SUFFIX_SIGQA_1 })
public void testAlertIsOlderSnapshot(String versionSuffix) {
    UpdateChecker updateChecker = getEmptyUpdateChecker();

    OffsetDateTime alertTime = DateUtils.createCurrentDateTimestamp();
    OffsetDateTime dockerTagDate = alertTime.plusMinutes(80);

    UpdateModel updateModel = updateChecker.getUpdateModel("1.0.0-" + versionSuffix, formatDate(alertTime, DOCKER_DATE_FORMAT), "1.0.0", formatDate(dockerTagDate, DOCKER_DATE_FORMAT), null);

    assertTrue(updateModel.getUpdatable());
}
 
Example 6
Source File: UpdateCheckerTest.java    From blackduck-alert with Apache License 2.0 5 votes vote down vote up
@ParameterizedTest
@ValueSource(strings = { SUFFIX_SNAPSHOT, SUFFIX_SIGQA_1 })
public void testAlertIsOlderButCloseSnapshot(String versionSuffix) {
    UpdateChecker updateChecker = getEmptyUpdateChecker();

    OffsetDateTime alertTime = DateUtils.createCurrentDateTimestamp();
    OffsetDateTime dockerTagDate = alertTime.plusMinutes(20);

    UpdateModel updateModel = updateChecker.getUpdateModel("1.0.0-" + versionSuffix, formatDate(alertTime, DOCKER_DATE_FORMAT), "1.0.0", formatDate(dockerTagDate, DOCKER_DATE_FORMAT), null);

    assertTrue(updateModel.getUpdatable());
}
 
Example 7
Source File: DateRangeTest.java    From blackduck-alert with Apache License 2.0 5 votes vote down vote up
@Test
public void testGetTimes() {
    OffsetDateTime start = DateUtils.createCurrentDateTimestamp();
    OffsetDateTime end = start.plusMinutes(5);
    DateRange dateRange = DateRange.of(start, end);

    assertEquals(start, dateRange.getStart());
    assertEquals(end, dateRange.getEnd());
}
 
Example 8
Source File: TCKOffsetDateTime.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
@Test
public void test_plusMinutes() {
    OffsetDateTime base = OffsetDateTime.of(2008, 6, 30, 11, 30, 59, 0, OFFSET_PONE);
    OffsetDateTime test = base.plusMinutes(30);
    assertEquals(test, OffsetDateTime.of(2008, 6, 30, 12, 0, 59, 0, OFFSET_PONE));
}
 
Example 9
Source File: TCKOffsetDateTime.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
@Test
public void test_plusMinutes() {
    OffsetDateTime base = OffsetDateTime.of(2008, 6, 30, 11, 30, 59, 0, OFFSET_PONE);
    OffsetDateTime test = base.plusMinutes(30);
    assertEquals(test, OffsetDateTime.of(2008, 6, 30, 12, 0, 59, 0, OFFSET_PONE));
}
 
Example 10
Source File: TCKOffsetDateTime.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
@Test
public void test_plusMinutes() {
    OffsetDateTime base = OffsetDateTime.of(2008, 6, 30, 11, 30, 59, 0, OFFSET_PONE);
    OffsetDateTime test = base.plusMinutes(30);
    assertEquals(test, OffsetDateTime.of(2008, 6, 30, 12, 0, 59, 0, OFFSET_PONE));
}
 
Example 11
Source File: TCKOffsetDateTime.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
@Test
public void test_plusMinutes() {
    OffsetDateTime base = OffsetDateTime.of(2008, 6, 30, 11, 30, 59, 0, OFFSET_PONE);
    OffsetDateTime test = base.plusMinutes(30);
    assertEquals(test, OffsetDateTime.of(2008, 6, 30, 12, 0, 59, 0, OFFSET_PONE));
}
 
Example 12
Source File: TCKOffsetDateTime.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@Test
public void test_plusMinutes() {
    OffsetDateTime base = OffsetDateTime.of(2008, 6, 30, 11, 30, 59, 0, OFFSET_PONE);
    OffsetDateTime test = base.plusMinutes(30);
    assertEquals(test, OffsetDateTime.of(2008, 6, 30, 12, 0, 59, 0, OFFSET_PONE));
}
 
Example 13
Source File: TestOffsetDateTime.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
@Test
public void test_plusMinutes_zero() {
    OffsetDateTime base = OffsetDateTime.of(LocalDate.of(2008, 6, 30), LocalTime.of(11, 30, 59), OFFSET_PONE);
    OffsetDateTime test = base.plusMinutes(0);
    assertSame(test, base);
}
 
Example 14
Source File: TCKOffsetDateTime.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
@Test
public void test_plusMinutes() {
    OffsetDateTime base = OffsetDateTime.of(2008, 6, 30, 11, 30, 59, 0, OFFSET_PONE);
    OffsetDateTime test = base.plusMinutes(30);
    assertEquals(test, OffsetDateTime.of(2008, 6, 30, 12, 0, 59, 0, OFFSET_PONE));
}
 
Example 15
Source File: TestOffsetDateTime.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
@Test
public void test_plusMinutes_zero() {
    OffsetDateTime base = OffsetDateTime.of(LocalDate.of(2008, 6, 30), LocalTime.of(11, 30, 59), OFFSET_PONE);
    OffsetDateTime test = base.plusMinutes(0);
    assertSame(test, base);
}
 
Example 16
Source File: TestOffsetDateTime.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@Test
public void test_plusMinutes_zero() {
    OffsetDateTime base = OffsetDateTime.of(LocalDate.of(2008, 6, 30), LocalTime.of(11, 30, 59), OFFSET_PONE);
    OffsetDateTime test = base.plusMinutes(0);
    assertSame(test, base);
}
 
Example 17
Source File: TestOffsetDateTime.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
@Test
public void test_plusMinutes_zero() {
    OffsetDateTime base = OffsetDateTime.of(LocalDate.of(2008, 6, 30), LocalTime.of(11, 30, 59), OFFSET_PONE);
    OffsetDateTime test = base.plusMinutes(0);
    assertSame(test, base);
}
 
Example 18
Source File: TestOffsetDateTime.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
@Test
public void test_plusMinutes_zero() {
    OffsetDateTime base = OffsetDateTime.of(LocalDate.of(2008, 6, 30), LocalTime.of(11, 30, 59), OFFSET_PONE);
    OffsetDateTime test = base.plusMinutes(0);
    assertSame(test, base);
}
 
Example 19
Source File: TCKOffsetDateTime.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
@Test
public void test_plusMinutes() {
    OffsetDateTime base = OffsetDateTime.of(2008, 6, 30, 11, 30, 59, 0, OFFSET_PONE);
    OffsetDateTime test = base.plusMinutes(30);
    assertEquals(test, OffsetDateTime.of(2008, 6, 30, 12, 0, 59, 0, OFFSET_PONE));
}
 
Example 20
Source File: TestOffsetDateTime.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
@Test
public void test_plusMinutes_zero() {
    OffsetDateTime base = OffsetDateTime.of(LocalDate.of(2008, 6, 30), LocalTime.of(11, 30, 59), OFFSET_PONE);
    OffsetDateTime test = base.plusMinutes(0);
    assertSame(test, base);
}