Skip to content

Commit

Permalink
Reading a shadow triggers refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
semancik committed Apr 17, 2017
1 parent c682bd4 commit 107dc29
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
Expand Up @@ -1002,7 +1002,7 @@ public void refreshShadow(PrismObject<ShadowType> shadow, ProvisioningOperationO

try {

getShadowCache(Mode.RECON).refreshShadow(shadow, options, task, result);
getShadowCache(Mode.RECON).refreshShadow(shadow, task, result);

refreshShadowLegacy(shadow, options, task, result);

Expand Down
Expand Up @@ -208,6 +208,8 @@ public PrismObject<ShadowType> getShadow(String oid, PrismObject<ShadowType> rep
throw new UnsupportedOperationException("Resource does not support 'read' operation");
}

refreshShadow(repositoryShadow, task, parentResult);

if (canReturnCached(options, repositoryShadow, resource)) {
applyDefinition(repositoryShadow, parentResult);
futurizeShadow(repositoryShadow, options);
Expand Down Expand Up @@ -663,7 +665,7 @@ public void deleteShadow(PrismObject<ShadowType> shadow, ProvisioningOperationOp
AvailabilityStatusType.UP, parentResult);
}

public void refreshShadow(PrismObject<ShadowType> shadow, ProvisioningOperationOptions options, Task task, OperationResult parentResult) throws ObjectNotFoundException, SchemaException, CommunicationException, ConfigurationException, ObjectAlreadyExistsException {
public void refreshShadow(PrismObject<ShadowType> shadow, Task task, OperationResult parentResult) throws ObjectNotFoundException, SchemaException, CommunicationException, ConfigurationException {
ShadowType shadowType = shadow.asObjectable();
List<PendingOperationType> pendingOperations = shadowType.getPendingOperation();
if (pendingOperations.isEmpty()) {
Expand Down
Expand Up @@ -1048,10 +1048,11 @@ public void test122ModifyAccountWillChangePasswordAndEnable() throws Exception {
/**
* Disable case is closed. The account should be disabled. But there is still the other
* delta pending.
* Do NOT explicitly refresh the shadow in this case. Just reading it should cause the refresh.
*/
@Test
public void test124CloseDisableCaseAndRefreshAccountWill() throws Exception {
final String TEST_NAME = "test114CloseCaseAndRefreshAccountWill";
public void test124CloseDisableCaseAndReadAccountWill() throws Exception {
final String TEST_NAME = "test124CloseDisableCaseAndReadAccountWill";
displayTestTile(TEST_NAME);
// GIVEN
Task task = createTask(TEST_NAME);
Expand All @@ -1067,7 +1068,8 @@ public void test124CloseDisableCaseAndRefreshAccountWill() throws Exception {

// WHEN
displayWhen(TEST_NAME);
provisioningService.refreshShadow(shadowBefore, null, task, result);
PrismObject<ShadowType> shadowProvisioning = provisioningService.getObject(ShadowType.class,
ACCOUNT_WILL_OID, null, task, result);

// THEN
displayThen(TEST_NAME);
Expand Down Expand Up @@ -1096,9 +1098,6 @@ public void test124CloseDisableCaseAndRefreshAccountWill() throws Exception {
assertAttribute(shadowRepo, ATTR_FULLNAME_QNAME, ACCOUNT_WILL_FULLNAME_PIRATE);

syncServiceMock.assertNoNotifyChange();

PrismObject<ShadowType> shadowProvisioning = provisioningService.getObject(ShadowType.class,
ACCOUNT_WILL_OID, null, task, result);

display("Provisioning shadow", shadowProvisioning);
ShadowType shadowTypeProvisioning = shadowProvisioning.asObjectable();
Expand Down

0 comments on commit 107dc29

Please sign in to comment.