File tree Expand file tree Collapse file tree 2 files changed +48
-0
lines changed
testData/actions/generation/generator/QueueTopologyGenerator/generateTopologyXmlFile
tests/com/magento/idea/magento2plugin/actions/generation/generator Expand file tree Collapse file tree 2 files changed +48
-0
lines changed Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" ?>
2+ <config xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
3+ xsi : noNamespaceSchemaLocation =" urn:magento:framework-message-queue:etc/topology.xsd" >
4+ <exchange name =" exchange-name" type =" topic" connection =" amqp" >
5+ <binding id =" bindingId" topic =" topic.name" destinationType =" queue" destination =" queue.name" />
6+ </exchange >
7+ </config >
Original file line number Diff line number Diff line change 1+ package com .magento .idea .magento2plugin .actions .generation .generator ;
2+
3+ import com .intellij .openapi .project .Project ;
4+ import com .intellij .psi .PsiFile ;
5+ import com .magento .idea .magento2plugin .actions .generation .NewMessageQueueAction ;
6+ import com .magento .idea .magento2plugin .actions .generation .data .QueueTopologyData ;
7+ import com .magento .idea .magento2plugin .magento .files .QueueTopologyXml ;
8+
9+ public class QueueTopologyGeneratorTest extends BaseGeneratorTestCase {
10+ private static final String EXCHANGE_NAME = "exchange-name" ;
11+ private static final String BINDING_ID = "bindingId" ;
12+ private static final String BINDING_TOPIC = "topic.name" ;
13+ private static final String BINDING_QUEUE = "queue.name" ;
14+ private static final String CONNECTION_NAME = "amqp" ;
15+ private static final String MODULE_NAME = "Foo_Bar" ;
16+ private static final String EXPECTED_DIRECTORY = "src/app/code/Foo/Bar/etc" ;
17+
18+ /**
19+ * Tests for generation of queue_topology.xml file.
20+ */
21+ public void testGenerateTopologyXmlFile () {
22+ final String filePath = this .getFixturePath (QueueTopologyXml .fileName );
23+ final PsiFile expectedFile = myFixture .configureByFile (filePath );
24+ final Project project = myFixture .getProject ();
25+ final QueueTopologyGenerator topologyGenerator = new QueueTopologyGenerator (
26+ project ,
27+ new QueueTopologyData (
28+ EXCHANGE_NAME ,
29+ CONNECTION_NAME ,
30+ BINDING_ID ,
31+ BINDING_TOPIC ,
32+ BINDING_QUEUE ,
33+ MODULE_NAME
34+ )
35+ );
36+
37+ final PsiFile file = topologyGenerator .generate (NewMessageQueueAction .ACTION_NAME );
38+
39+ assertGeneratedFileIsCorrect (expectedFile , EXPECTED_DIRECTORY , file );
40+ }
41+ }
You can’t perform that action at this time.
0 commit comments