JdbcRevocableTokenProvisioning implements RevocableTokenProvisioning, SystemDeletable { @Override public int deleteByIdentityZone(String zoneId) { return template.update(DELETE_BY_ZONE_QUERY, zoneId); } JdbcRevocableTokenProvisioning(JdbcTemplate jdbcTemplate,
                                          LimitSqlAdapter limitSqlAdapter,
                                          TimeService timeService); @Override List<RevocableToken> retrieveAll(String zoneId); RevocableToken retrieve(String id, boolean checkExpired, String zoneId); @Override RevocableToken retrieve(String id, String zoneId); @Override int deleteRefreshTokensForClientAndUserId(String clientId, String userId, String zoneId); @Override RevocableToken create(RevocableToken t, String zoneId); @Override RevocableToken update(String id, RevocableToken t, String zoneId); @Override RevocableToken delete(String id, int version, String zoneId); @Override int deleteByIdentityZone(String zoneId); @Override int deleteByClient(String clientId, String zoneId); @Override int deleteByUser(String userId, String zoneId); @Override Logger getLogger(); @Override List<RevocableToken> getUserTokens(String userId, String zoneId); @Override List<RevocableToken> getUserTokens(String userId, String clientId, String zoneId); @Override List<RevocableToken> getClientTokens(String clientId, String zoneId); void setMaxExpirationRuntime(long maxExpirationRuntime); void setTimeService(TimeService timeService);  }
@Test void deleteByIdentityZone() { IdentityZone zone = MultitenancyFixture.identityZone("test-zone", "test-zone"); IdentityZoneHolder.set(zone); jdbcRevocableTokenProvisioning.create(revocableToken, IdentityZoneHolder.get().getId()); jdbcRevocableTokenProvisioning.retrieve(revocableToken.getTokenId(), IdentityZoneHolder.get().getId()); EntityDeletedEvent<IdentityZone> zoneDeleted = new EntityDeletedEvent<>(zone, null, IdentityZoneHolder.getCurrentZoneId()); jdbcRevocableTokenProvisioning.onApplicationEvent(zoneDeleted); assertThrows(EmptyResultDataAccessException.class, () -> jdbcRevocableTokenProvisioning.retrieve(revocableToken.getTokenId(), IdentityZoneHolder.get().getId())); }