Skip to content

Commit

Permalink
Merge pull request #5385 from mhsdesign/bugfix/publish-only-across-al…
Browse files Browse the repository at this point in the history
…l-dimensions

BUGFIX: Simplify PartialPublish & Discard (for now) to NOT select dimensions and have custom events
  • Loading branch information
mhsdesign authored Dec 12, 2024
2 parents ffe4faa + fa58f0c commit 088edbd
Show file tree
Hide file tree
Showing 57 changed files with 257 additions and 702 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@
use Neos\ContentRepository\Core\Feature\WorkspaceModification\Event\WorkspaceBaseWorkspaceWasChanged;
use Neos\ContentRepository\Core\Feature\WorkspaceModification\Event\WorkspaceWasRemoved;
use Neos\ContentRepository\Core\Feature\WorkspacePublication\Event\WorkspaceWasDiscarded;
use Neos\ContentRepository\Core\Feature\WorkspacePublication\Event\WorkspaceWasPartiallyDiscarded;
use Neos\ContentRepository\Core\Feature\WorkspacePublication\Event\WorkspaceWasPartiallyPublished;
use Neos\ContentRepository\Core\Feature\WorkspacePublication\Event\WorkspaceWasPublished;
use Neos\ContentRepository\Core\Feature\WorkspaceRebase\Event\WorkspaceRebaseFailed;
use Neos\ContentRepository\Core\Feature\WorkspaceRebase\Event\WorkspaceWasRebased;
Expand Down Expand Up @@ -196,8 +194,6 @@ public function canHandle(EventInterface $event): bool
WorkspaceRebaseFailed::class,
WorkspaceWasCreated::class,
WorkspaceWasDiscarded::class,
WorkspaceWasPartiallyDiscarded::class,
WorkspaceWasPartiallyPublished::class,
WorkspaceWasPublished::class,
WorkspaceWasRebased::class,
WorkspaceWasRemoved::class,
Expand Down Expand Up @@ -233,8 +229,6 @@ public function apply(EventInterface $event, EventEnvelope $eventEnvelope): void
WorkspaceRebaseFailed::class => $this->whenWorkspaceRebaseFailed($event),
WorkspaceWasCreated::class => $this->whenWorkspaceWasCreated($event),
WorkspaceWasDiscarded::class => $this->whenWorkspaceWasDiscarded($event),
WorkspaceWasPartiallyDiscarded::class => $this->whenWorkspaceWasPartiallyDiscarded($event),
WorkspaceWasPartiallyPublished::class => $this->whenWorkspaceWasPartiallyPublished($event),
WorkspaceWasPublished::class => $this->whenWorkspaceWasPublished($event),
WorkspaceWasRebased::class => $this->whenWorkspaceWasRebased($event),
WorkspaceWasRemoved::class => $this->whenWorkspaceWasRemoved($event),
Expand Down Expand Up @@ -774,16 +768,6 @@ private function whenWorkspaceWasDiscarded(WorkspaceWasDiscarded $event): void
$this->updateWorkspaceContentStreamId($event->workspaceName, $event->newContentStreamId);
}

private function whenWorkspaceWasPartiallyDiscarded(WorkspaceWasPartiallyDiscarded $event): void
{
$this->updateWorkspaceContentStreamId($event->workspaceName, $event->newContentStreamId);
}

private function whenWorkspaceWasPartiallyPublished(WorkspaceWasPartiallyPublished $event): void
{
$this->updateWorkspaceContentStreamId($event->sourceWorkspaceName, $event->newSourceContentStreamId);
}

private function whenWorkspaceWasPublished(WorkspaceWasPublished $event): void
{
$this->updateWorkspaceContentStreamId($event->sourceWorkspaceName, $event->newSourceContentStreamId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Feature: Workspace discarding - complex chained functionality
When the command DiscardIndividualNodesFromWorkspace is executed with payload and exceptions are caught:
| Key | Value |
| workspaceName | "user-ws" |
| nodesToDiscard | [{"workspaceName": "user-ws", "dimensionSpacePoint": {"language": "en"}, "nodeAggregateId": "sir-david-nodenborough"}, {"workspaceName": "user-ws", "dimensionSpacePoint": {"language": "en"}, "nodeAggregateId": "sir-david-nodenborough"}] |
| nodesToDiscard | ["sir-david-nodenborough", "sir-david-nodenborough"] |
| newContentStreamId | "user-cs-id-rebased" |
Then the last command should have thrown the PartialWorkspaceRebaseFailed exception with:
| SequenceNumber | Event | Exception |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,18 @@ Feature: Discard individual nodes (basics)
When the command DiscardIndividualNodesFromWorkspace is executed with payload:
| Key | Value |
| workspaceName | "user-test" |
| nodesToDiscard | [{"workspaceName": "user-test", "dimensionSpacePoint": {}, "nodeAggregateId": "sir-nodeward-nodington-iii"}] |
| nodesToDiscard | ["sir-nodeward-nodington-iii"] |
| newContentStreamId | "user-cs-identifier-new" |
Then I expect the content stream "user-cs-identifier" to not exist
Then I expect exactly 2 events to be published on stream with prefix "Workspace:user-test"
And event at index 1 is of type "WorkspaceWasDiscarded" with payload:
| Key | Expected |
| workspaceName | "user-test" |
| newContentStreamId | "user-cs-identifier-new" |
| previousContentStreamId | "user-cs-identifier" |
| partial | true |
When I am in workspace "user-test" and dimension space point {}
Then I expect node aggregate identifier "sir-david-nodenborough" to lead to node user-cs-identifier-new;sir-david-nodenborough;{}
And I expect this node to have the following properties:
Expand All @@ -126,7 +134,7 @@ Feature: Discard individual nodes (basics)
When the command DiscardIndividualNodesFromWorkspace is executed with payload:
| Key | Value |
| workspaceName | "user-test" |
| nodesToDiscard | [{"dimensionSpacePoint": {}, "nodeAggregateId": "non-existing-node"}, {"dimensionSpacePoint": {}, "nodeAggregateId": "sir-unchanged"}] |
| nodesToDiscard | ["non-existing-node", "sir-unchanged"] |
| newContentStreamId | "user-cs-identifier-new-two" |
# all nodes are still on the original user cs
Expand Down Expand Up @@ -156,16 +164,16 @@ Feature: Discard individual nodes (basics)
When the command DiscardIndividualNodesFromWorkspace is executed with payload:
| Key | Value |
| workspaceName | "user-test" |
| nodesToDiscard | [{"workspaceName": "user-test", "dimensionSpacePoint": {}, "nodeAggregateId": "sir-david-nodenborough"}, {"workspaceName": "user-test", "dimensionSpacePoint": {}, "nodeAggregateId": "nody-mc-nodeface"}, {"workspaceName": "user-test", "dimensionSpacePoint": {}, "nodeAggregateId": "sir-nodeward-nodington-iii"}] |
| nodesToDiscard | ["sir-david-nodenborough", "nody-mc-nodeface", "sir-nodeward-nodington-iii"] |
| newContentStreamId | "user-cs-identifier-new" |
# when discarding all nodes we expect a full discard via WorkspaceWasDiscarded
Then I expect exactly 2 events to be published on stream with prefix "Workspace:user-test"
And event at index 1 is of type "WorkspaceWasDiscarded" with payload:
| Key | Expected |
| workspaceName | "user-test" |
| newContentStreamId | "user-cs-identifier-new" |
| previousContentStreamId | "user-cs-identifier" |
| partial | false |
When I am in workspace "user-test" and dimension space point {}
Then I expect node aggregate identifier "sir-david-nodenborough" to lead to node user-cs-identifier-new;sir-david-nodenborough;{}
Expand All @@ -186,7 +194,7 @@ Feature: Discard individual nodes (basics)
When the command DiscardIndividualNodesFromWorkspace is executed with payload:
| Key | Value |
| workspaceName | "user-test" |
| nodesToDiscard | [{"workspaceName": "user-test", "dimensionSpacePoint": {}, "nodeAggregateId": "sir-nodeward-nodington-iii"}] |
| nodesToDiscard | ["sir-nodeward-nodington-iii"] |
# live WS does not change because of a discard
When I am in workspace "live" and dimension space point {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,19 @@ Feature: Workspace based content publishing
When the command PublishWorkspace is executed with payload:
| Key | Value |
| workspaceName | "user-test" |
| newContentStreamId | "user-cs-new" |

Then I expect the content stream "user-cs-identifier" to not exist

Then I expect exactly 2 events to be published on stream with prefix "Workspace:user-test"
And event at index 1 is of type "WorkspaceWasPublished" with payload:
| Key | Expected |
| sourceWorkspaceName | "user-test" |
| targetWorkspaceName | "live" |
| newSourceContentStreamId | "user-cs-new" |
| previousSourceContentStreamId | "user-cs-identifier" |
| partial | false |

When I am in workspace "live" and dimension space point {}
Then I expect node aggregate identifier "nody-mc-nodeface" to lead to node cs-identifier;nody-mc-nodeface;{}
And I expect this node to have the following properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ Feature: Workspace publication - complex chained functionality
When the command PublishIndividualNodesFromWorkspace is executed with payload and exceptions are caught:
| Key | Value |
| workspaceName | "user-ws" |
| nodesToPublish | [{"dimensionSpacePoint": {"language": "de"}, "nodeAggregateId": "sir-nodebelig"}] |
| nodesToPublish | ["sir-nodebelig"] |
| newContentStreamId | "user-cs-id-rebased" |
Then the last command should have thrown the WorkspaceRebaseFailed exception with:
| SequenceNumber | Event | Exception |
Expand All @@ -108,7 +108,7 @@ Feature: Workspace publication - complex chained functionality
When the command PublishIndividualNodesFromWorkspace is executed with payload and exceptions are caught:
| Key | Value |
| workspaceName | "user-ws" |
| nodesToPublish | [{"workspaceName": "user-ws", "dimensionSpacePoint": {"language": "en"}, "nodeAggregateId": "nody-mc-nodeface"}] |
| nodesToPublish | ["nody-mc-nodeface"] |
| newContentStreamId | "user-cs-id-rebased" |
Then the last command should have thrown the PartialWorkspaceRebaseFailed exception with:
| SequenceNumber | Event | Exception |
Expand Down Expand Up @@ -144,7 +144,7 @@ Feature: Workspace publication - complex chained functionality
When the command PublishIndividualNodesFromWorkspace is executed with payload and exceptions are caught:
| Key | Value |
| workspaceName | "user-ws" |
| nodesToPublish | [{"dimensionSpacePoint": {"language": "de"}, "nodeAggregateId": "sir-david-nodenborough"}] |
| nodesToPublish | ["sir-david-nodenborough"] |
| newContentStreamId | "user-cs-id-rebased" |
Then the last command should have thrown the PartialWorkspaceRebaseFailed exception with:
| SequenceNumber | Event | Exception |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,18 @@ Feature: Individual node publication
| nody-mc-nodeface | Neos.ContentRepository.Testing:Content | $child2Id | nody | {} |
When the command PublishIndividualNodesFromWorkspace is executed with payload:
| Key | Value |
| nodesToPublish | [{"workspaceName": "user-test", "dimensionSpacePoint": {}, "nodeAggregateId": "sir-david-nodenborough"}] |
| nodesToPublish | ["sir-david-nodenborough"] |
| contentStreamIdForRemainingPart | "user-cs-identifier-remaining" |

Then I expect exactly 2 events to be published on stream with prefix "Workspace:user-test"
And event at index 1 is of type "WorkspaceWasPublished" with payload:
| Key | Expected |
| sourceWorkspaceName | "user-test" |
| targetWorkspaceName | "live" |
| newSourceContentStreamId | "user-cs-identifier-remaining" |
| previousSourceContentStreamId | "user-cs-identifier" |
| partial | true |

And I am in workspace "live"

Then I expect a node identified by cs-identifier;sir-david-nodenborough;{} to exist in the content graph
Expand All @@ -79,7 +88,7 @@ Feature: Individual node publication
When the command PublishIndividualNodesFromWorkspace is executed with payload:
| Key | Value |
| workspaceName | "user-test" |
| nodesToPublish | [{"dimensionSpacePoint": {}, "nodeAggregateId": "non-existing"}] |
| nodesToPublish | ["non-existing"] |
| contentStreamIdForRemainingPart | "user-cs-new" |
Then workspaces user-test has status OUTDATED

Expand Down
Loading

0 comments on commit 088edbd

Please sign in to comment.