PersistenceExtensions { public static ZonedDateTime lastUpdate(Item item) { return lastUpdate(item, getDefaultServiceId()); } @Activate  PersistenceExtensions(@Reference PersistenceServiceRegistry registry); static void persist(Item item, String serviceId); static void persist(Item item); static HistoricItem historicState(Item item, ZonedDateTime timestamp); static HistoricItem historicState(Item item, ZonedDateTime timestamp, String serviceId); static Boolean changedSince(Item item, ZonedDateTime timestamp); static Boolean changedSince(Item item, ZonedDateTime timestamp, String serviceId); static Boolean updatedSince(Item item, ZonedDateTime timestamp); static Boolean updatedSince(Item item, ZonedDateTime timestamp, String serviceId); static HistoricItem maximumSince(Item item, ZonedDateTime timestamp); static HistoricItem maximumSince(final Item item, ZonedDateTime timestamp, String serviceId); static HistoricItem minimumSince(Item item, ZonedDateTime timestamp); static HistoricItem minimumSince(final Item item, ZonedDateTime timestamp, String serviceId); static DecimalType varianceSince(Item item, ZonedDateTime timestamp); static DecimalType varianceSince(Item item, ZonedDateTime timestamp, String serviceId); static DecimalType deviationSince(Item item, ZonedDateTime timestamp); static DecimalType deviationSince(Item item, ZonedDateTime timestamp, String serviceId); static DecimalType averageSince(Item item, ZonedDateTime timestamp); static DecimalType averageSince(Item item, ZonedDateTime timestamp, String serviceId); static DecimalType sumSince(Item item, ZonedDateTime timestamp); static DecimalType sumSince(Item item, ZonedDateTime timestamp, String serviceId); static ZonedDateTime lastUpdate(Item item); static ZonedDateTime lastUpdate(Item item, String serviceId); static DecimalType deltaSince(Item item, ZonedDateTime timestamp); static DecimalType deltaSince(Item item, ZonedDateTime timestamp, String serviceId); static DecimalType evolutionRate(Item item, ZonedDateTime timestamp); static DecimalType evolutionRate(Item item, ZonedDateTime timestamp, String serviceId); static HistoricItem previousState(Item item); static HistoricItem previousState(Item item, boolean skipEqual); static HistoricItem previousState(Item item, boolean skipEqual, String serviceId);  }
@Test public void testLastUpdate() { item.setState(new DecimalType(2005)); ZonedDateTime lastUpdate = PersistenceExtensions.lastUpdate(item, TestPersistenceService.ID); assertNotNull(lastUpdate); assertEquals(ZonedDateTime.of(2012, 1, 1, 0, 0, 0, 0, ZoneId.systemDefault()), lastUpdate); lastUpdate = PersistenceExtensions.lastUpdate(item); assertNull(lastUpdate); }