-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Change to be able to sync test #473
Conversation
Front-end summary Node 18
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #473 +/- ##
=============================================
+ Coverage 15.98% 16.21% +0.23%
- Complexity 749 756 +7
=============================================
Files 75 75
Lines 2659 2701 +42
=============================================
+ Hits 425 438 +13
- Misses 2234 2263 +29 ☔ View full report in Codecov by Sentry. |
ba283de
to
97c5049
Compare
97c5049
to
6a06ac0
Compare
6171fae
to
8cc0cee
Compare
e5cc8e3
to
654b4c8
Compare
654b4c8
to
6760bf2
Compare
@@ -38,7 +38,7 @@ class DeliveryMetadataListener extends ConfigurableService | |||
|
|||
public const SERVICE_ID = 'taoDeliveryRdf/DeliveryMetadataListener'; | |||
|
|||
public const OPTION_MAX_TRIES = 'max_tries'; | |||
public const FILE_SYSTEM_ID = 'dataStore'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: Is it required to have this constant public if it is only used here in this class?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
MetaDataDeliverySyncTask::INCLUDE_METADATA_PARAM_NAME => true, | ||
MetaDataDeliverySyncTask::MAX_TRIES_PARAM_NAME => $this->getOption('max_tries', 10), | ||
MetaDataDeliverySyncTask::FILE_SYSTEM_ID_PARAM_NAME => self::FILE_SYSTEM_ID, | ||
MetaDataDeliverySyncTask::IS_REMOVE_PARAM_NAME => false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: As I understood this param is responsible for marking tests as deleted in the data storage, so would it be better to call isDelete
? This way its intent would be much more clear.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
$report = new Report(Report::TYPE_SUCCESS); | ||
|
||
if ($params['count'] < $params[DeliveryMetadataListener::OPTION_MAX_TRIES]) { | ||
$params['count'] = $params['count'] ?? 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: seems like we have constants for all params except count
do you think we should introduce one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
@@ -44,30 +44,48 @@ class MetaDataDeliverySyncTask extends AbstractAction implements JsonSerializabl | |||
{ | |||
use OntologyAwareTrait; | |||
|
|||
public const INCLUDE_DELIVERY_METADATA_PARAM_NAME = 'includeMetadata'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
chore: does it make sense to rename the class to match it's new purpose as it is now processing not only deliveries but also tests, what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my opinion better would be to have separate classes and reuse common logic. What if we would introduce couple of more entities? How that would look like?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Separate task has been created for test processing
if (!isset($params['deliveryMetaData'], $params['testMetaData'], $params['testUri'], $params['itemMetaData'])) { | ||
$compiler = $this->getMetaDataCompiler(); | ||
$compiler = $this->getMetaDataCompiler(); | ||
if ($params[self::INCLUDE_DELIVERY_METADATA_PARAM_NAME]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me it is surprising that same parameter can have both delivery or test id, and that test will be treated as delivery. I think this way it could be confusing, better not mix it up. If it is a test triggering this task, then it is compiled 2 times?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, this is a design smell to me too. It looks like it would be better to have separate events/params.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it could be more explicit that its test package being compiled and uploaded
@@ -99,25 +125,28 @@ private function persistArchive(string $deliveryId, array $params): void | |||
* @throws common_exception_Error | |||
* @throws common_exception_NotFound | |||
*/ | |||
private function moveExportedZipTest(string $folder, string $deliveryId, array $params): void | |||
private function moveExportedZipTest(string $folder, string $deliveryOrTestId, array $params): void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: I would rename deliveryOrTestId
to entityId
in this context it does not look to be important to know that it can hold testId
or deliveryId
.
P.S. seems to be the case in majority of methods, so please check everywhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replaced to resourceId
in this case
f5c3201
to
0a7abf7
Compare
0a7abf7
to
5580df0
Compare
|
||
private function getResourceJsonMetadataCompiler(): ResourceMetadataCompilerInterface | ||
{ | ||
return $this->getServiceManager()->getContainer()->get(ResourceJsonMetadataCompiler::SERVICE_ID); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably could do $this->getServiceLocator()->get(ResourceJsonMetadataCompiler::SERVICE_ID);
$testUri = $this->getTestUri($deliveryResource); | ||
} | ||
|
||
$test = $this->getResource($resourceId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method still is a bit confusing to me, since both delivery or test can arrive here as $resourceId
. In order for test metadata to be correct in case $resourceId
comes from delivery I believe this should be updated:
$test = $this->getResource($resourceId); | |
$test = $this->getResource($testUri); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed, thanks for the great catch!
Version
There are 0 BREAKING CHANGE, 7 features, 3 fixes |
Ticket - https://oat-sa.atlassian.net/browse/REL-1538
Related ticket - https://github.com/oat-sa/extension-tao-deliver-connect/pull/189