Skip to content

Commit

Permalink
Fix a bug in DummyResource
Browse files Browse the repository at this point in the history
(Introduced recently while extending it with associations.)

This fixes TestSyncStoryUsingLiveSync.
  • Loading branch information
mederly committed Mar 26, 2024
1 parent 13e9e76 commit 000fe55
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -694,21 +694,21 @@ private synchronized <T extends DummyObject> String addObject(ObjectStore<T> sto

Class<? extends DummyObject> type = objectToAdd.getClass();

// This is "resource-generated" attribute, used to simulate resources which - by default - generate attributes
// which we need to sync. Intentionally before "setResource" to avoid spurious sync deltas.
if (generateDefaultValues) {
objectToAdd.addAttributeValue(DummyAccount.ATTR_INTERNAL_ID, new Random().nextInt());
}

objectToAdd.setResource(this);

String normalizedName = objectToAdd.getNormalizedName();
String normalizedName = objectToAdd.getNormalizedName(); // requires the object being on the resource already
if (normalizedName != null && forbiddenNames != null && forbiddenNames.contains(normalizedName)) {
throw new ObjectAlreadyExistsException(normalizedName + " is forbidden to use as an object name");
}

checkOrGenerateObjectId(objectToAdd);

// This is "resource-generated" attribute, used to simulate resources which - by default - generate attributes
// which we need to sync.
if (generateDefaultValues) {
objectToAdd.addAttributeValue(DummyAccount.ATTR_INTERNAL_ID, new Random().nextInt());
}

updateNormalizedHierarchicalName(objectToAdd);
hierarchySupport.checkHasContainingOrg(objectToAdd.getName());

Expand Down

0 comments on commit 000fe55

Please sign in to comment.