File tree Expand file tree Collapse file tree 2 files changed +47
-0
lines changed
testData/actions/generation/generator/QueueConsumerGenerator/generateConsumerXmlFile
tests/com/magento/idea/magento2plugin/actions/generation/generator Expand file tree Collapse file tree 2 files changed +47
-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/consumer.xsd" >
4
+ <consumer name =" consumer.name" queue =" queue.name" consumerInstance =" Foo\Bar\Model\Consumer" connection =" amqp"
5
+ maxMessages =" 100" />
6
+ </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 .QueueConsumerData ;
7
+ import com .magento .idea .magento2plugin .magento .files .QueueConsumerXml ;
8
+
9
+ public class QueueConsumerGeneratorTest extends BaseGeneratorTestCase {
10
+ private static final String CONSUMER_NAME = "consumer.name" ;
11
+ private static final String QUEUE_NAME = "queue.name" ;
12
+ private static final String CONSUMER_TYPE = "Foo\\ Bar\\ Model\\ Consumer" ;
13
+ private static final String MAX_MESSAGES = "100" ;
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_consumer.xml file.
20
+ */
21
+ public void testGenerateConsumerXmlFile () {
22
+ final String filePath = this .getFixturePath (QueueConsumerXml .fileName );
23
+ final PsiFile expectedFile = myFixture .configureByFile (filePath );
24
+ final Project project = myFixture .getProject ();
25
+ final QueueConsumerGenerator consumerGenerator = new QueueConsumerGenerator (
26
+ project ,
27
+ new QueueConsumerData (
28
+ CONSUMER_NAME ,
29
+ QUEUE_NAME ,
30
+ CONSUMER_TYPE ,
31
+ MAX_MESSAGES ,
32
+ CONNECTION_NAME ,
33
+ MODULE_NAME
34
+ )
35
+ );
36
+
37
+ final PsiFile file = consumerGenerator .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