|
|
@ -5,6 +5,7 @@ namespace Drupal\Tests\islandora\Kernel; |
|
|
|
use Stomp\Exception\StompException; |
|
|
|
use Stomp\Exception\StompException; |
|
|
|
use Stomp\StatefulStomp; |
|
|
|
use Stomp\StatefulStomp; |
|
|
|
use Drupal\islandora\Plugin\RulesAction\Broadcaster; |
|
|
|
use Drupal\islandora\Plugin\RulesAction\Broadcaster; |
|
|
|
|
|
|
|
use Drupal\jwt\Authentication\Provider\JwtAuth; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Broadcaster tests. |
|
|
|
* Broadcaster tests. |
|
|
@ -87,6 +88,10 @@ class BroadcasterTest extends IslandoraKernelTestBase { |
|
|
|
strcmp($headers['IslandoraBroadcastRecipients'], 'activemq:queue:foo,activemq:queue:bar') == 0, |
|
|
|
strcmp($headers['IslandoraBroadcastRecipients'], 'activemq:queue:foo,activemq:queue:bar') == 0, |
|
|
|
"IslandoraBroadcastRecipients header must be a comma separated list of endpoints" |
|
|
|
"IslandoraBroadcastRecipients header must be a comma separated list of endpoints" |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
$this->assertTrue( |
|
|
|
|
|
|
|
strcmp($headers['Authorization'], 'Bearer some_token') == 0, |
|
|
|
|
|
|
|
"Authorization header must be set" |
|
|
|
|
|
|
|
); |
|
|
|
$stomp->unsubscribe(); |
|
|
|
$stomp->unsubscribe(); |
|
|
|
} |
|
|
|
} |
|
|
|
catch (StompException $e) { |
|
|
|
catch (StompException $e) { |
|
|
@ -106,10 +111,14 @@ class BroadcasterTest extends IslandoraKernelTestBase { |
|
|
|
protected function createBroadcaster(StatefulStomp $stomp) { |
|
|
|
protected function createBroadcaster(StatefulStomp $stomp) { |
|
|
|
// Pull the plugin definition out of the plugin system. |
|
|
|
// Pull the plugin definition out of the plugin system. |
|
|
|
$actionManager = $this->container->get('plugin.manager.rules_action'); |
|
|
|
$actionManager = $this->container->get('plugin.manager.rules_action'); |
|
|
|
$jwt = $this->container->get('jwt.authentication.jwt'); |
|
|
|
|
|
|
|
$definitions = $actionManager->getDefinitions(); |
|
|
|
$definitions = $actionManager->getDefinitions(); |
|
|
|
$pluginDefinition = $definitions['islandora_broadcast']; |
|
|
|
$pluginDefinition = $definitions['islandora_broadcast']; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Mock a JWT generator. |
|
|
|
|
|
|
|
$prophecy = $this->prophesize(JwtAuth::class); |
|
|
|
|
|
|
|
$prophecy->generateToken()->willReturn("some_token"); |
|
|
|
|
|
|
|
$jwt = $prophecy->reveal(); |
|
|
|
|
|
|
|
|
|
|
|
$action = new Broadcaster( |
|
|
|
$action = new Broadcaster( |
|
|
|
[], |
|
|
|
[], |
|
|
|
'islandora_broadcast', |
|
|
|
'islandora_broadcast', |
|
|
|