Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/9.0' into feature/4228-overhaul-…
Browse files Browse the repository at this point in the history
…nodetypemanager
  • Loading branch information
mhsdesign committed May 14, 2024
2 parents fb4284c + fe8f4b2 commit 3af6cdb
Show file tree
Hide file tree
Showing 441 changed files with 15,485 additions and 8,073 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@
use Behat\Gherkin\Node\TableNode;
use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Exception\InvalidArgumentException;
use Neos\ContentGraph\DoctrineDbalAdapter\DoctrineDbalContentGraphProjectionFactory;
use Neos\ContentGraph\DoctrineDbalAdapter\ContentGraphTableNames;
use Neos\ContentGraph\DoctrineDbalAdapter\DoctrineDbalProjectionIntegrityViolationDetectionRunnerFactory;
use Neos\ContentGraph\DoctrineDbalAdapter\Domain\Repository\NodeFactory;
use Neos\ContentGraph\DoctrineDbalAdapter\Tests\Behavior\Features\Bootstrap\Helpers\TestingNodeAggregateId;
use Neos\ContentRepository\Core\DimensionSpace\DimensionSpacePoint;
use Neos\ContentRepository\Core\DimensionSpace\OriginDimensionSpacePoint;
use Neos\ContentRepository\Core\Feature\SubtreeTagging\Dto\SubtreeTag;
use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId;
use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId;
Expand Down Expand Up @@ -52,9 +53,9 @@ trait ProjectionIntegrityViolationDetectionTrait
*/
abstract private function getObject(string $className): object;

protected function getTableNamePrefix(): string
private function tableNames(): ContentGraphTableNames
{
return DoctrineDbalContentGraphProjectionFactory::graphProjectionTableNamePrefix(
return ContentGraphTableNames::create(
$this->currentContentRepository->id
);
}
Expand All @@ -80,7 +81,7 @@ public function iRemoveTheFollowingSubtreeTag(TableNode $payloadTable): void
throw new \RuntimeException(sprintf('Failed to remove subtree tag "%s" because that tag is not set', $subtreeTagToRemove->value), 1708618267);
}
$this->dbalClient->getConnection()->update(
$this->getTableNamePrefix() . '_hierarchyrelation',
$this->tableNames()->hierarchyRelation(),
[
'subtreetags' => json_encode($subtreeTags->without($subtreeTagToRemove), JSON_THROW_ON_ERROR | JSON_FORCE_OBJECT),
],
Expand All @@ -97,7 +98,7 @@ public function iAddTheFollowingHierarchyRelation(TableNode $payloadTable): void
$dataset = $this->transformPayloadTableToDataset($payloadTable);
$record = $this->transformDatasetToHierarchyRelationRecord($dataset);
$this->dbalClient->getConnection()->insert(
$this->getTableNamePrefix() . '_hierarchyrelation',
$this->tableNames()->hierarchyRelation(),
$record
);
}
Expand All @@ -114,7 +115,7 @@ public function iChangeTheFollowingHierarchyRelationsDimensionSpacePointHash(Tab
unset($record['position']);

$this->dbalClient->getConnection()->update(
$this->getTableNamePrefix() . '_hierarchyrelation',
$this->tableNames()->hierarchyRelation(),
[
'dimensionspacepointhash' => $dataset['newDimensionSpacePointHash']
],
Expand All @@ -123,22 +124,35 @@ public function iChangeTheFollowingHierarchyRelationsDimensionSpacePointHash(Tab
}

/**
* @When /^I change the following hierarchy relation's name:$/
* @When /^I change the following node's name:$/
* @param TableNode $payloadTable
* @throws DBALException
*/
public function iChangeTheFollowingHierarchyRelationsEdgeName(TableNode $payloadTable): void
public function iChangeTheFollowingNodesName(TableNode $payloadTable): void
{
$dataset = $this->transformPayloadTableToDataset($payloadTable);
$record = $this->transformDatasetToHierarchyRelationRecord($dataset);
unset($record['position']);

$relationAnchorPoint = $this->dbalClient->getConnection()->executeQuery(
'SELECT n.relationanchorpoint FROM ' . $this->tableNames()->node() . ' n
JOIN ' . $this->tableNames()->hierarchyRelation() . ' h ON h.childnodeanchor = n.relationanchorpoint
WHERE h.contentstreamid = :contentStreamId
AND n.nodeaggregateId = :nodeAggregateId
AND n.origindimensionspacepointhash = :originDimensionSpacePointHash',
[
'contentStreamId' => $dataset['contentStreamId'],
'nodeAggregateId' => $dataset['nodeAggregateId'],
'originDimensionSpacePointHash' => OriginDimensionSpacePoint::fromArray($dataset['originDimensionSpacePoint'])->hash,
]
)->fetchOne();

$this->dbalClient->getConnection()->update(
$this->getTableNamePrefix() . '_hierarchyrelation',
$this->tableNames()->node(),
[
'name' => $dataset['newName']
],
$record
[
'relationanchorpoint' => $relationAnchorPoint
]
);
}

Expand All @@ -158,7 +172,7 @@ public function iSetTheFollowingPosition(TableNode $payloadTable): void
];

$this->dbalClient->getConnection()->update(
$this->getTableNamePrefix() . '_hierarchyrelation',
$this->tableNames()->hierarchyRelation(),
[
'position' => $dataset['newPosition']
],
Expand All @@ -176,7 +190,7 @@ public function iDetachTheFollowingReferenceRelationFromItsSource(TableNode $pay
$dataset = $this->transformPayloadTableToDataset($payloadTable);

$this->dbalClient->getConnection()->update(
$this->getTableNamePrefix() . '_referencerelation',
$this->tableNames()->referenceRelation(),
[
'nodeanchorpoint' => 7777777
],
Expand All @@ -194,7 +208,7 @@ public function iSetTheFollowingReferencePosition(TableNode $payloadTable): void
$dataset = $this->transformPayloadTableToDataset($payloadTable);

$this->dbalClient->getConnection()->update(
$this->getTableNamePrefix() . '_referencerelation',
$this->tableNames()->referenceRelation(),
[
'position' => $dataset['newPosition']
],
Expand Down Expand Up @@ -265,8 +279,8 @@ private function findHierarchyRelationByIds(
): array {
$nodeRecord = $this->dbalClient->getConnection()->executeQuery(
'SELECT h.*
FROM ' . $this->getTableNamePrefix() . '_node n
INNER JOIN ' . $this->getTableNamePrefix() . '_hierarchyrelation h
FROM ' . $this->tableNames()->node() . ' n
INNER JOIN ' . $this->tableNames()->hierarchyRelation() . ' h
ON n.relationanchorpoint = h.childnodeanchor
WHERE n.nodeaggregateid = :nodeAggregateId
AND h.contentstreamid = :contentStreamId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Feature: Run integrity violation detection regarding hierarchy relations and nod
| workspaceDescription | "The live workspace" |
| newContentStreamId | "cs-identifier" |
And the graph projection is fully up to date
And I am in the active content stream of workspace "live" and dimension space point {}
And I am in workspace "live" and dimension space point {}
And the command CreateRootNodeAggregateWithNode is executed with payload:
| Key | Value |
| nodeAggregateId | "lady-eleonode-rootford" |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Feature: Run integrity violation detection regarding parent relations
| workspaceDescription | "The live workspace" |
| newContentStreamId | "cs-identifier" |
And the graph projection is fully up to date
And I am in the active content stream of workspace "live" and dimension space point {"language":"de"}
And I am in workspace "live" and dimension space point {"language":"de"}
And the command CreateRootNodeAggregateWithNode is executed with payload:
| Key | Value |
| nodeAggregateId | "lady-eleonode-rootford" |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Feature: Run integrity violation detection regarding reference relations
| workspaceDescription | "The live workspace" |
| newContentStreamId | "cs-identifier" |
And the graph projection is fully up to date
And I am in the active content stream of workspace "live" and dimension space point {"language":"de"}
And I am in workspace "live" and dimension space point {"language":"de"}
And the command CreateRootNodeAggregateWithNode is executed with payload:
| Key | Value |
| nodeAggregateId | "lady-eleonode-rootford" |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Feature: Run integrity violation detection regarding sibling sorting
| workspaceDescription | "The live workspace" |
| newContentStreamId | "cs-identifier" |
And the graph projection is fully up to date
And I am in the active content stream of workspace "live" and dimension space point {"language":"de"}
And I am in workspace "live" and dimension space point {"language":"de"}
And the command CreateRootNodeAggregateWithNode is executed with payload:
| Key | Value |
| nodeAggregateId | "lady-eleonode-rootford" |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Feature: Run integrity violation detection regarding subtree tag inheritance
| workspaceDescription | "The live workspace" |
| newContentStreamId | "cs-identifier" |
And the graph projection is fully up to date
And I am in the active content stream of workspace "live" and dimension space point {"language":"de"}
And I am in workspace "live" and dimension space point {"language":"de"}
And the command CreateRootNodeAggregateWithNode is executed with payload:
| Key | Value |
| nodeAggregateId | "lady-eleonode-rootford" |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,48 +14,47 @@ Feature: Run projection integrity violation detection regarding naming of tether
And using identifier "default", I define a content repository
And I am in content repository "default"
And the command CreateRootWorkspace is executed with payload:
| Key | Value |
| workspaceName | "live" |
| workspaceTitle | "Live" |
| workspaceDescription | "The live workspace" |
| newContentStreamId | "cs-identifier" |
| Key | Value |
| workspaceName | "live" |
| workspaceTitle | "Live" |
| workspaceDescription | "The live workspace" |
| newContentStreamId | "cs-identifier" |
And the graph projection is fully up to date
And I am in the active content stream of workspace "live" and dimension space point {"language":"de"}
And I am in workspace "live" and dimension space point {"language":"de"}
And the command CreateRootNodeAggregateWithNode is executed with payload:
| Key | Value |
| nodeAggregateId | "lady-eleonode-rootford" |
| nodeTypeName | "Neos.ContentRepository:Root" |
| Key | Value |
| nodeAggregateId | "lady-eleonode-rootford" |
| nodeTypeName | "Neos.ContentRepository:Root" |
And the event NodeAggregateWithNodeWasCreated was published with payload:
| Key | Value |
| contentStreamId | "cs-identifier" |
| nodeAggregateId | "sir-david-nodenborough" |
| nodeTypeName | "Neos.ContentRepository.Testing:Document" |
| originDimensionSpacePoint | {"language":"de"} |
| coveredDimensionSpacePoints | [{"language":"de"}] |
| parentNodeAggregateId | "lady-eleonode-rootford" |
| nodeName | "document" |
| nodeAggregateClassification | "regular" |
| Key | Value |
| contentStreamId | "cs-identifier" |
| nodeAggregateId | "sir-david-nodenborough" |
| nodeTypeName | "Neos.ContentRepository.Testing:Document" |
| originDimensionSpacePoint | {"language":"de"} |
| coveredDimensionSpacePoints | [{"language":"de"}] |
| parentNodeAggregateId | "lady-eleonode-rootford" |
| nodeName | "document" |
| nodeAggregateClassification | "regular" |
And the graph projection is fully up to date

Scenario: Create node variants of different type
Scenario: Remove tethered node's name
When the event NodeAggregateWithNodeWasCreated was published with payload:
| Key | Value |
| contentStreamId | "cs-identifier" |
| nodeAggregateId | "nodewyn-tetherton" |
| nodeTypeName | "Neos.ContentRepository.Testing:Document" |
| originDimensionSpacePoint | {"language":"de"} |
| coveredDimensionSpacePoints | [{"language":"de"}] |
| parentNodeAggregateId | "sir-david-nodenborough" |
| nodeName | "to-be-hacked-to-null" |
| nodeAggregateClassification | "tethered" |
| Key | Value |
| contentStreamId | "cs-identifier" |
| nodeAggregateId | "nodewyn-tetherton" |
| nodeTypeName | "Neos.ContentRepository.Testing:Document" |
| originDimensionSpacePoint | {"language":"de"} |
| coveredDimensionSpacePoints | [{"language":"de"}] |
| parentNodeAggregateId | "sir-david-nodenborough" |
| nodeName | "to-be-hacked-to-null" |
| nodeAggregateClassification | "tethered" |
And the graph projection is fully up to date
And I change the following hierarchy relation's name:
| Key | Value |
| contentStreamId | "cs-identifier" |
| dimensionSpacePoint | {"language":"de"} |
| parentNodeAggregateId | "sir-david-nodenborough" |
| childNodeAggregateId | "nodewyn-tetherton" |
| newName | null |
And I change the following node's name:
| Key | Value |
| contentStreamId | "cs-identifier" |
| originDimensionSpacePoint | {"language":"de"} |
| nodeAggregateId | "nodewyn-tetherton" |
| newName | null |
And I run integrity violation detection
Then I expect the integrity violation detection result to contain exactly 1 errors
And I expect integrity violation detection result error number 1 to have code 1597923103
Loading

0 comments on commit 3af6cdb

Please sign in to comment.