Skip to content

Commit

Permalink
Merge branch '2.4-develop' into magento-indexer-mftf-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
konarshankar07 authored Apr 4, 2020
2 parents 5cb6457 + 339618f commit 972812d
Show file tree
Hide file tree
Showing 1,250 changed files with 6,252 additions and 19,799 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
</annotations>

<!-- Logging in Magento admin -->
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
</test>
</tests>
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<group value="mtf_migrated"/>
</annotations>
<before>
<actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/>
<actionGroup ref="AdminLoginActionGroup" stepKey="LoginAsAdmin"/>
</before>
<after>
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<group value="mtf_migrated"/>
</annotations>
<before>
<actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/>
<actionGroup ref="AdminLoginActionGroup" stepKey="LoginAsAdmin"/>
</before>
<after>
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

declare(strict_types=1);

namespace Magento\AsynchronousOperations\Api;

use Magento\AsynchronousOperations\Api\Data\OperationInterface;

/**
* Interface for saving multiple operations
*
* @api
*/
interface SaveMultipleOperationsInterface
{
/**
* Save Operations for Bulk
*
* @param OperationInterface[] $operations
* @return void
*/
public function execute(array $operations): void;
}
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ public function scheduleBulk($bulkUuid, array $operations, $description, $userId
$bulkSummary->setUserId($userId);
$bulkSummary->setUserType($userType);
$bulkSummary->setOperationCount((int)$bulkSummary->getOperationCount() + count($operations));

$this->entityManager->save($bulkSummary);

$connection->commit();
Expand Down
12 changes: 11 additions & 1 deletion app/code/Magento/AsynchronousOperations/Model/MassSchedule.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use Magento\Framework\Bulk\BulkManagementInterface;
use Magento\Framework\DataObject\IdentityGeneratorInterface;
use Magento\Framework\Encryption\Encryptor;
use Magento\AsynchronousOperations\Api\SaveMultipleOperationsInterface;
use Magento\Framework\Exception\BulkException;
use Magento\Framework\Exception\LocalizedException;
use Psr\Log\LoggerInterface;
Expand Down Expand Up @@ -67,6 +68,11 @@ class MassSchedule
*/
private $encryptor;

/**
* @var SaveMultipleOperationsInterface
*/
private $saveMultipleOperations;

/**
* Initialize dependencies.
*
Expand All @@ -78,6 +84,7 @@ class MassSchedule
* @param OperationRepositoryInterface $operationRepository
* @param UserContextInterface $userContext
* @param Encryptor $encryptor
* @param SaveMultipleOperationsInterface $saveMultipleOperations
*/
public function __construct(
IdentityGeneratorInterface $identityService,
Expand All @@ -87,7 +94,8 @@ public function __construct(
LoggerInterface $logger,
OperationRepositoryInterface $operationRepository,
UserContextInterface $userContext,
Encryptor $encryptor
Encryptor $encryptor,
SaveMultipleOperationsInterface $saveMultipleOperations
) {
$this->identityService = $identityService;
$this->itemStatusInterfaceFactory = $itemStatusInterfaceFactory;
Expand All @@ -97,6 +105,7 @@ public function __construct(
$this->operationRepository = $operationRepository;
$this->userContext = $userContext;
$this->encryptor = $encryptor;
$this->saveMultipleOperations = $saveMultipleOperations;
}

/**
Expand Down Expand Up @@ -159,6 +168,7 @@ public function publishMass($topicName, array $entitiesArray, $groupId = null, $
}
}

$this->saveMultipleOperations->execute($operations);
if (!$this->bulkManagement->scheduleBulk($groupId, $operations, $bulkDescription, $userId)) {
throw new LocalizedException(
__('Something went wrong while processing the request.')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use Magento\Framework\EntityManager\EntityManager;

/**
* Class OperationManagement
* Class for managing Bulk Operations
*/
class OperationManagement implements \Magento\Framework\Bulk\OperationManagementInterface
{
Expand Down Expand Up @@ -45,7 +45,7 @@ public function __construct(
$this->operationFactory = $operationFactory;
$this->logger = $logger;
}

/**
* @inheritDoc
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,21 @@
namespace Magento\AsynchronousOperations\Model\ResourceModel;

/**
* Class Operation
* Resource class for Bulk Operations
*/
class Operation extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
{

public const TABLE_NAME = "magento_operation";
public const TABLE_PRIMARY_KEY = "id";

/**
* Initialize banner sales rule resource model
*
* @return void
*/
protected function _construct()
{
$this->_init('magento_operation', 'id');
$this->_init(self::TABLE_NAME, self::TABLE_PRIMARY_KEY);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function createByTopic($topicName, $entityParams, $groupId)

/** @var OperationInterface $operation */
$operation = $this->operationFactory->create($data);
return $this->entityManager->save($operation);
return $operation;
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

declare(strict_types=1);

namespace Magento\AsynchronousOperations\Model;

use Magento\AsynchronousOperations\Api\SaveMultipleOperationsInterface;
use Magento\AsynchronousOperations\Model\ResourceModel\Operation as OperationResource;
use Magento\Framework\Exception\CouldNotSaveException;

/**
* Implementation for saving multiple operations
*/
class SaveMultipleOperations implements SaveMultipleOperationsInterface
{

/**
* @var OperationResource
*/
private $operationResource;

/**
* BulkSummary constructor.
*
* @param OperationResource $operationResource
*/
public function __construct(
OperationResource $operationResource
) {
$this->operationResource = $operationResource;
}

/**
* @inheritDoc
*/
public function execute(array $operations): void
{
try {
$operationsToInsert = array_map(function ($operation) {
return $operation->getData();
}, $operations);

$connection = $this->operationResource->getConnection();
$connection->insertMultiple(
$this->operationResource->getTable(OperationResource::TABLE_NAME),
$operationsToInsert
);
} catch (\Exception $exception) {
throw new CouldNotSaveException(__($exception->getMessage()));
}
}
}
1 change: 1 addition & 0 deletions app/code/Magento/AsynchronousOperations/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="Magento\AsynchronousOperations\Api\Data\BulkSummaryInterface" type="Magento\AsynchronousOperations\Model\BulkSummary" />
<preference for="Magento\AsynchronousOperations\Api\SaveMultipleOperationsInterface" type="Magento\AsynchronousOperations\Model\SaveMultipleOperations" />
<preference for="Magento\AsynchronousOperations\Api\Data\OperationInterface" type="Magento\AsynchronousOperations\Model\Operation" />
<preference for="Magento\AsynchronousOperations\Api\Data\OperationListInterface" type="Magento\AsynchronousOperations\Model\OperationList" />
<preference for="Magento\Framework\Bulk\BulkManagementInterface" type="Magento\AsynchronousOperations\Model\BulkManagement" />
Expand Down
1 change: 0 additions & 1 deletion app/code/Magento/Backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ Before disabling or uninstalling this module, note that the following modules de
- Magento_ReleaseNotification
- Magento_Search
- Magento_Security
- Magento_Signifyd
- Magento_Swatches
- Magento_Ui
- Magento_User
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminClickLogoActionGroup">
<click selector="{{AdminMenuSection.logo}}" stepKey="clickLogoInAdmin"/>
<waitForPageLoad stepKey="waitForAdminDashboardPageLoaded"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminNavigateToSetupWizardPageActionGroup">
<annotations>
<description>Open Setup Wizard Page.</description>
</annotations>
<amOnPage url="{{AdminSetupWizardPage.url}}" stepKey="navigateToSetupWizardPage"/>
<waitForPageLoad stepKey="waitForSetupWizardPageLoaded"/>
</actionGroup>
</actionGroups>
12 changes: 12 additions & 0 deletions app/code/Magento/Backend/Test/Mftf/Page/AdminSetupWizardPage.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd">
<page name="AdminSetupWizardPage" url="admin/backendapp/redirect/app/setup/" area="admin" module="Magento_Backend"/>
</pages>
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
<section name="AdminMenuSection">
<element name="logo" type="button" selector=".menu-wrapper a.logo"/>
<element name="catalog" type="button" selector="#menu-magento-catalog-catalog"/>
<element name="catalogProducts" type="button" selector="#nav li[data-ui-id='menu-magento-catalog-catalog-products']"/>
<element name="customers" type="button" selector="#menu-magento-customer-customer"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
</annotations>
<before>

<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>

</before>
<after>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<group value="mtf_migrated"/>
</annotations>
<before>
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
</before>

<!-- Go to the general configuration and make sure the locale dropdown is available and enabled -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<group value="mtf_migrated"/>
</annotations>
<before>
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
</before>

<!-- Go to the general configuration and make sure the locale dropdown is disabled -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<group value="mtf_migrated"/>
</annotations>
<before>
<actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/>
<actionGroup ref="AdminLoginActionGroup" stepKey="LoginAsAdmin"/>
</before>
<after>
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<group value="mtf_migrated"/>
</annotations>
<before>
<actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/>
<actionGroup ref="AdminLoginActionGroup" stepKey="LoginAsAdmin"/>
</before>
<after>
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
</after>
<!-- Login as admin -->
<comment userInput="Login as admin" stepKey="adminLogin"/>
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
<!-- Grab quantity value -->
<comment userInput="Grab quantity value from dashboard" stepKey="grabQuantityFromDashboard"/>
<grabTextFrom selector="{{AdminDashboardSection.dashboardTotals('Quantity')}}" stepKey="grabStartQuantity"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<magentoCLI command="config:set {{ChangeAdminSecuritySessionLifetimeConfigData.path}} {{ChangeAdminSecuritySessionLifetimeConfigData.value}}" stepKey="changeCookieLifetime"/>

<!-- 2. Wait for session to expire. -->
<actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/>
<actionGroup ref="AdminLoginActionGroup" stepKey="LoginAsAdmin"/>
<wait time="60" stepKey="waitForSessionLifetime"/>
<reloadPage stepKey="reloadPage"/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
</after>
<!-- 1. Login to Admin. -->
<actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/>
<actionGroup ref="AdminLoginActionGroup" stepKey="LoginAsAdmin"/>

<!-- 2. Create customer if needed. -->
<createData entity="Simple_US_Customer" stepKey="createCustomer"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<magentoCLI command="config:set {{EmptyCookieDomainForMainWebsiteConfigData.path}} --scope={{EmptyCookieDomainForMainWebsiteConfigData.scope}} --scope-code={{EmptyCookieDomainForMainWebsiteConfigData.scope_code}} {{EmptyCookieDomainForMainWebsiteConfigData.value}}" stepKey="changeDomainForMainWebsiteAfterTestComplete"/>
<magentoCLI command="cache:flush config" stepKey="flushCacheAfterTestComplete"/>
</after>
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
<actionGroup ref="AssertAdminDashboardPageIsVisibleActionGroup" stepKey="seeDashboardPage"/>
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/>
</test>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<before>
<magentoCLI command="config:set {{MinifyJavaScriptFilesEnableConfigData.path}} {{MinifyJavaScriptFilesEnableConfigData.value}}" stepKey="enableJsMinification"/>
<magentoCLI command="cache:clean config" stepKey="cleanCache"/>
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
</before>
<after>
<magentoCLI command="config:set {{MinifyJavaScriptFilesDisableConfigData.path}} {{MinifyJavaScriptFilesDisableConfigData.value}}" stepKey="disableJsMinification"/>
Expand Down
Loading

0 comments on commit 972812d

Please sign in to comment.