DefaultSyncContext implements SyncContext { private boolean isExpired(@NotNull Authorizable authorizable) throws RepositoryException { long expTime = (authorizable.isGroup()) ? config.group().getExpirationTime() : config.user().getExpirationTime(); return isExpired(authorizable, expTime, "Properties"); } DefaultSyncContext(@NotNull DefaultSyncConfig config, @NotNull ExternalIdentityProvider idp, @NotNull UserManager userManager, @NotNull ValueFactory valueFactory); @Nullable static DefaultSyncedIdentity createSyncedIdentity(@Nullable Authorizable auth); @Nullable static ExternalIdentityRef getIdentityRef(@Nullable Authorizable auth); static String joinPaths(String... paths); @Override void close(); @Override boolean isKeepMissing(); @NotNull @Override SyncContext setKeepMissing(boolean keepMissing); @Override boolean isForceUserSync(); @NotNull @Override SyncContext setForceUserSync(boolean forceUserSync); @Override boolean isForceGroupSync(); @Override @NotNull SyncContext setForceGroupSync(boolean forceGroupSync); @NotNull @Override SyncResult sync(@NotNull ExternalIdentity identity); @NotNull @Override SyncResult sync(@NotNull String id); static final String REP_EXTERNAL_ID; static final String REP_LAST_SYNCED; }
@Test public void testIsExpiredLocalGroup() throws Exception { Group gr = createTestGroup(); assertTrue(syncCtx.isExpired(gr, syncConfig.group().getExpirationTime(), "any")); }
@Test public void testIsExpiredEmptyLastSyncedProperty() throws Exception { Group gr = createTestGroup(); gr.setProperty(DefaultSyncContext.REP_LAST_SYNCED, new Value[0]); assertTrue(syncCtx.isExpired(gr, syncConfig.group().getExpirationTime(), "any")); }