Skip to content

Commit

Permalink
Polling projections are not registered anymore (#140)
Browse files Browse the repository at this point in the history
* Polling projections are not registered anymore

* Adjust the test

* Adjust the test

---------

Co-authored-by: Dariusz Gafka <[email protected]>
  • Loading branch information
unixslayer and dgafka authored Jun 5, 2023
1 parent 80920b4 commit bfe7874
Showing 1 changed file with 40 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

declare(strict_types=1);

namespace Test\Ecotone\EventSourcing\Integration;

use Ecotone\Lite\EcotoneLite;
use Ecotone\Messaging\Config\ServiceConfiguration;
use Ecotone\Messaging\Endpoint\ExecutionPollingMetadata;
use Ecotone\Messaging\Endpoint\PollingMetadata;
use PHPUnit\Framework\TestCase;
use Test\Ecotone\EventSourcing\Fixture\Basket\BasketEventConverter;
use Test\Ecotone\EventSourcing\Fixture\Basket\Command\AddProduct;
use Test\Ecotone\EventSourcing\Fixture\Basket\Command\CreateBasket;
use Test\Ecotone\EventSourcing\Fixture\BasketListProjection\BasketList;
use Test\Ecotone\EventSourcing\Fixture\BasketListProjection\BasketListConfiguration;

final class PollingProjectionTest extends TestCase
{
public function test_running_polling_projection(): void
{
$ecotoneLite = EcotoneLite::bootstrapFlowTestingWithEventStore(
classesToResolve: [BasketListConfiguration::class, BasketList::class],
containerOrAvailableServices: [new BasketList(), new BasketEventConverter()],
configuration: ServiceConfiguration::createWithDefaults()
->withNamespaces(['Test\Ecotone\EventSourcing\Fixture\Basket']),
pathToRootCatalog: __DIR__ . '/../../'
);

$ecotoneLite->sendCommand(new CreateBasket('1000'));
$ecotoneLite->run(BasketList::PROJECTION_NAME, ExecutionPollingMetadata::createWithTestingSetup(maxExecutionTimeInMilliseconds: 1000));

self::assertEquals(['1000' => []], $ecotoneLite->sendQueryWithRouting('getALlBaskets'));

$ecotoneLite->sendCommand(new AddProduct('1000', 'milk'));
$ecotoneLite->run(BasketList::PROJECTION_NAME, ExecutionPollingMetadata::createWithTestingSetup(maxExecutionTimeInMilliseconds: 1000));

self::assertEquals(['1000' => ['milk']], $ecotoneLite->sendQueryWithRouting('getALlBaskets'));
}
}

0 comments on commit bfe7874

Please sign in to comment.