diff --git a/src/main/kotlin/com/asyncapi/plugin/idea/_core/AsyncAPISpecificationRecognizer.kt b/src/main/kotlin/com/asyncapi/plugin/idea/_core/AsyncAPISpecificationRecognizer.kt index 0a11859..73757cd 100644 --- a/src/main/kotlin/com/asyncapi/plugin/idea/_core/AsyncAPISpecificationRecognizer.kt +++ b/src/main/kotlin/com/asyncapi/plugin/idea/_core/AsyncAPISpecificationRecognizer.kt @@ -46,7 +46,7 @@ class AsyncAPISpecificationRecognizer { fun isSupported(version: String?): Boolean { return when (version) { - "2.0.0", "2.1.0", "2.2.0", "2.3.0", "2.4.0", "2.5.0", "2.6.0" -> true + "2.0.0", "2.1.0", "2.2.0", "2.3.0", "2.4.0", "2.5.0", "2.6.0", "3.0.0" -> true else -> false } } diff --git a/src/test/kotlin/com/asyncapi/plugin/idea/completion/AbstractAsyncAPISpecificationCompletionContributorTest.kt b/src/test/kotlin/com/asyncapi/plugin/idea/completion/v2/AbstractAsyncAPISpecificationCompletionContributorTest.kt similarity index 98% rename from src/test/kotlin/com/asyncapi/plugin/idea/completion/AbstractAsyncAPISpecificationCompletionContributorTest.kt rename to src/test/kotlin/com/asyncapi/plugin/idea/completion/v2/AbstractAsyncAPISpecificationCompletionContributorTest.kt index 5747832..b90f56c 100644 --- a/src/test/kotlin/com/asyncapi/plugin/idea/completion/AbstractAsyncAPISpecificationCompletionContributorTest.kt +++ b/src/test/kotlin/com/asyncapi/plugin/idea/completion/v2/AbstractAsyncAPISpecificationCompletionContributorTest.kt @@ -1,4 +1,4 @@ -package com.asyncapi.plugin.idea.completion +package com.asyncapi.plugin.idea.completion.v2 import com.intellij.codeInsight.completion.CompletionType import com.intellij.testFramework.fixtures.BasePlatformTestCase diff --git a/src/test/kotlin/com/asyncapi/plugin/idea/completion/v2_0_0/AsyncAPISpecificationCompletionContributorJsonTest.kt b/src/test/kotlin/com/asyncapi/plugin/idea/completion/v2/_0_0/AsyncAPISpecificationCompletionContributorJsonTest.kt similarity index 59% rename from src/test/kotlin/com/asyncapi/plugin/idea/completion/v2_0_0/AsyncAPISpecificationCompletionContributorJsonTest.kt rename to src/test/kotlin/com/asyncapi/plugin/idea/completion/v2/_0_0/AsyncAPISpecificationCompletionContributorJsonTest.kt index 3640ffd..b081b36 100644 --- a/src/test/kotlin/com/asyncapi/plugin/idea/completion/v2_0_0/AsyncAPISpecificationCompletionContributorJsonTest.kt +++ b/src/test/kotlin/com/asyncapi/plugin/idea/completion/v2/_0_0/AsyncAPISpecificationCompletionContributorJsonTest.kt @@ -1,6 +1,6 @@ -package com.asyncapi.plugin.idea.completion.v2_0_0 +package com.asyncapi.plugin.idea.completion.v2._0_0 -import com.asyncapi.plugin.idea.completion.AbstractAsyncAPISpecificationCompletionContributorTest +import com.asyncapi.plugin.idea.completion.v2.AbstractAsyncAPISpecificationCompletionContributorTest class AsyncAPISpecificationCompletionContributorJsonTest: AbstractAsyncAPISpecificationCompletionContributorTest() { diff --git a/src/test/kotlin/com/asyncapi/plugin/idea/completion/v2_0_0/AsyncAPISpecificationCompletionContributorYamlTest.kt b/src/test/kotlin/com/asyncapi/plugin/idea/completion/v2/_0_0/AsyncAPISpecificationCompletionContributorYamlTest.kt similarity index 78% rename from src/test/kotlin/com/asyncapi/plugin/idea/completion/v2_0_0/AsyncAPISpecificationCompletionContributorYamlTest.kt rename to src/test/kotlin/com/asyncapi/plugin/idea/completion/v2/_0_0/AsyncAPISpecificationCompletionContributorYamlTest.kt index 01e8b79..30b2f42 100644 --- a/src/test/kotlin/com/asyncapi/plugin/idea/completion/v2_0_0/AsyncAPISpecificationCompletionContributorYamlTest.kt +++ b/src/test/kotlin/com/asyncapi/plugin/idea/completion/v2/_0_0/AsyncAPISpecificationCompletionContributorYamlTest.kt @@ -1,6 +1,6 @@ -package com.asyncapi.plugin.idea.completion.v2_0_0 +package com.asyncapi.plugin.idea.completion.v2._0_0 -import com.asyncapi.plugin.idea.completion.AbstractAsyncAPISpecificationCompletionContributorTest +import com.asyncapi.plugin.idea.completion.v2.AbstractAsyncAPISpecificationCompletionContributorTest class AsyncAPISpecificationCompletionContributorYamlTest: AbstractAsyncAPISpecificationCompletionContributorTest() { diff --git a/src/test/kotlin/com/asyncapi/plugin/idea/completion/v2_1_0/AsyncAPISpecificationCompletionContributorJsonTest.kt b/src/test/kotlin/com/asyncapi/plugin/idea/completion/v2/_1_0/AsyncAPISpecificationCompletionContributorJsonTest.kt similarity index 59% rename from src/test/kotlin/com/asyncapi/plugin/idea/completion/v2_1_0/AsyncAPISpecificationCompletionContributorJsonTest.kt rename to src/test/kotlin/com/asyncapi/plugin/idea/completion/v2/_1_0/AsyncAPISpecificationCompletionContributorJsonTest.kt index b6ff0ec..511ad69 100644 --- a/src/test/kotlin/com/asyncapi/plugin/idea/completion/v2_1_0/AsyncAPISpecificationCompletionContributorJsonTest.kt +++ b/src/test/kotlin/com/asyncapi/plugin/idea/completion/v2/_1_0/AsyncAPISpecificationCompletionContributorJsonTest.kt @@ -1,6 +1,6 @@ -package com.asyncapi.plugin.idea.completion.v2_1_0 +package com.asyncapi.plugin.idea.completion.v2._1_0 -import com.asyncapi.plugin.idea.completion.AbstractAsyncAPISpecificationCompletionContributorTest +import com.asyncapi.plugin.idea.completion.v2.AbstractAsyncAPISpecificationCompletionContributorTest class AsyncAPISpecificationCompletionContributorJsonTest: AbstractAsyncAPISpecificationCompletionContributorTest() { diff --git a/src/test/kotlin/com/asyncapi/plugin/idea/completion/v2_1_0/AsyncAPISpecificationCompletionContributorYamlTest.kt b/src/test/kotlin/com/asyncapi/plugin/idea/completion/v2/_1_0/AsyncAPISpecificationCompletionContributorYamlTest.kt similarity index 78% rename from src/test/kotlin/com/asyncapi/plugin/idea/completion/v2_1_0/AsyncAPISpecificationCompletionContributorYamlTest.kt rename to src/test/kotlin/com/asyncapi/plugin/idea/completion/v2/_1_0/AsyncAPISpecificationCompletionContributorYamlTest.kt index 4f2b23b..9da3e79 100644 --- a/src/test/kotlin/com/asyncapi/plugin/idea/completion/v2_1_0/AsyncAPISpecificationCompletionContributorYamlTest.kt +++ b/src/test/kotlin/com/asyncapi/plugin/idea/completion/v2/_1_0/AsyncAPISpecificationCompletionContributorYamlTest.kt @@ -1,6 +1,6 @@ -package com.asyncapi.plugin.idea.completion.v2_1_0 +package com.asyncapi.plugin.idea.completion.v2._1_0 -import com.asyncapi.plugin.idea.completion.AbstractAsyncAPISpecificationCompletionContributorTest +import com.asyncapi.plugin.idea.completion.v2.AbstractAsyncAPISpecificationCompletionContributorTest class AsyncAPISpecificationCompletionContributorYamlTest: AbstractAsyncAPISpecificationCompletionContributorTest() { diff --git a/src/test/kotlin/com/asyncapi/plugin/idea/completion/v2_2_0/AsyncAPISpecificationCompletionContributorJsonTest.kt b/src/test/kotlin/com/asyncapi/plugin/idea/completion/v2/_2_0/AsyncAPISpecificationCompletionContributorJsonTest.kt similarity index 59% rename from src/test/kotlin/com/asyncapi/plugin/idea/completion/v2_2_0/AsyncAPISpecificationCompletionContributorJsonTest.kt rename to src/test/kotlin/com/asyncapi/plugin/idea/completion/v2/_2_0/AsyncAPISpecificationCompletionContributorJsonTest.kt index a3c8635..194ccf2 100644 --- a/src/test/kotlin/com/asyncapi/plugin/idea/completion/v2_2_0/AsyncAPISpecificationCompletionContributorJsonTest.kt +++ b/src/test/kotlin/com/asyncapi/plugin/idea/completion/v2/_2_0/AsyncAPISpecificationCompletionContributorJsonTest.kt @@ -1,6 +1,6 @@ -package com.asyncapi.plugin.idea.completion.v2_2_0 +package com.asyncapi.plugin.idea.completion.v2._2_0 -import com.asyncapi.plugin.idea.completion.AbstractAsyncAPISpecificationCompletionContributorTest +import com.asyncapi.plugin.idea.completion.v2.AbstractAsyncAPISpecificationCompletionContributorTest class AsyncAPISpecificationCompletionContributorJsonTest: AbstractAsyncAPISpecificationCompletionContributorTest() { diff --git a/src/test/kotlin/com/asyncapi/plugin/idea/completion/v2_2_0/AsyncAPISpecificationCompletionContributorYamlTest.kt b/src/test/kotlin/com/asyncapi/plugin/idea/completion/v2/_2_0/AsyncAPISpecificationCompletionContributorYamlTest.kt similarity index 78% rename from src/test/kotlin/com/asyncapi/plugin/idea/completion/v2_2_0/AsyncAPISpecificationCompletionContributorYamlTest.kt rename to src/test/kotlin/com/asyncapi/plugin/idea/completion/v2/_2_0/AsyncAPISpecificationCompletionContributorYamlTest.kt index b2a40b5..847949f 100644 --- a/src/test/kotlin/com/asyncapi/plugin/idea/completion/v2_2_0/AsyncAPISpecificationCompletionContributorYamlTest.kt +++ b/src/test/kotlin/com/asyncapi/plugin/idea/completion/v2/_2_0/AsyncAPISpecificationCompletionContributorYamlTest.kt @@ -1,6 +1,6 @@ -package com.asyncapi.plugin.idea.completion.v2_2_0 +package com.asyncapi.plugin.idea.completion.v2._2_0 -import com.asyncapi.plugin.idea.completion.AbstractAsyncAPISpecificationCompletionContributorTest +import com.asyncapi.plugin.idea.completion.v2.AbstractAsyncAPISpecificationCompletionContributorTest class AsyncAPISpecificationCompletionContributorYamlTest: AbstractAsyncAPISpecificationCompletionContributorTest() { diff --git a/src/test/kotlin/com/asyncapi/plugin/idea/completion/v2_3_0/AsyncAPISpecificationCompletionContributorJsonTest.kt b/src/test/kotlin/com/asyncapi/plugin/idea/completion/v2/_3_0/AsyncAPISpecificationCompletionContributorJsonTest.kt similarity index 59% rename from src/test/kotlin/com/asyncapi/plugin/idea/completion/v2_3_0/AsyncAPISpecificationCompletionContributorJsonTest.kt rename to src/test/kotlin/com/asyncapi/plugin/idea/completion/v2/_3_0/AsyncAPISpecificationCompletionContributorJsonTest.kt index 57237be..d51f4f1 100644 --- a/src/test/kotlin/com/asyncapi/plugin/idea/completion/v2_3_0/AsyncAPISpecificationCompletionContributorJsonTest.kt +++ b/src/test/kotlin/com/asyncapi/plugin/idea/completion/v2/_3_0/AsyncAPISpecificationCompletionContributorJsonTest.kt @@ -1,6 +1,6 @@ -package com.asyncapi.plugin.idea.completion.v2_3_0 +package com.asyncapi.plugin.idea.completion.v2._3_0 -import com.asyncapi.plugin.idea.completion.AbstractAsyncAPISpecificationCompletionContributorTest +import com.asyncapi.plugin.idea.completion.v2.AbstractAsyncAPISpecificationCompletionContributorTest class AsyncAPISpecificationCompletionContributorJsonTest: AbstractAsyncAPISpecificationCompletionContributorTest() { diff --git a/src/test/kotlin/com/asyncapi/plugin/idea/completion/v2_3_0/AsyncAPISpecificationCompletionContributorYamlTest.kt b/src/test/kotlin/com/asyncapi/plugin/idea/completion/v2/_3_0/AsyncAPISpecificationCompletionContributorYamlTest.kt similarity index 78% rename from src/test/kotlin/com/asyncapi/plugin/idea/completion/v2_3_0/AsyncAPISpecificationCompletionContributorYamlTest.kt rename to src/test/kotlin/com/asyncapi/plugin/idea/completion/v2/_3_0/AsyncAPISpecificationCompletionContributorYamlTest.kt index c686408..90d66e3 100644 --- a/src/test/kotlin/com/asyncapi/plugin/idea/completion/v2_3_0/AsyncAPISpecificationCompletionContributorYamlTest.kt +++ b/src/test/kotlin/com/asyncapi/plugin/idea/completion/v2/_3_0/AsyncAPISpecificationCompletionContributorYamlTest.kt @@ -1,6 +1,6 @@ -package com.asyncapi.plugin.idea.completion.v2_3_0 +package com.asyncapi.plugin.idea.completion.v2._3_0 -import com.asyncapi.plugin.idea.completion.AbstractAsyncAPISpecificationCompletionContributorTest +import com.asyncapi.plugin.idea.completion.v2.AbstractAsyncAPISpecificationCompletionContributorTest class AsyncAPISpecificationCompletionContributorYamlTest: AbstractAsyncAPISpecificationCompletionContributorTest() { diff --git a/src/test/kotlin/com/asyncapi/plugin/idea/completion/v2_4_0/AsyncAPISpecificationCompletionContributorJsonTest.kt b/src/test/kotlin/com/asyncapi/plugin/idea/completion/v2/_4_0/AsyncAPISpecificationCompletionContributorJsonTest.kt similarity index 59% rename from src/test/kotlin/com/asyncapi/plugin/idea/completion/v2_4_0/AsyncAPISpecificationCompletionContributorJsonTest.kt rename to src/test/kotlin/com/asyncapi/plugin/idea/completion/v2/_4_0/AsyncAPISpecificationCompletionContributorJsonTest.kt index 78b9c8e..1e95ddf 100644 --- a/src/test/kotlin/com/asyncapi/plugin/idea/completion/v2_4_0/AsyncAPISpecificationCompletionContributorJsonTest.kt +++ b/src/test/kotlin/com/asyncapi/plugin/idea/completion/v2/_4_0/AsyncAPISpecificationCompletionContributorJsonTest.kt @@ -1,6 +1,6 @@ -package com.asyncapi.plugin.idea.completion.v2_4_0 +package com.asyncapi.plugin.idea.completion.v2._4_0 -import com.asyncapi.plugin.idea.completion.AbstractAsyncAPISpecificationCompletionContributorTest +import com.asyncapi.plugin.idea.completion.v2.AbstractAsyncAPISpecificationCompletionContributorTest class AsyncAPISpecificationCompletionContributorJsonTest: AbstractAsyncAPISpecificationCompletionContributorTest() { diff --git a/src/test/kotlin/com/asyncapi/plugin/idea/completion/v2_4_0/AsyncAPISpecificationCompletionContributorYamlTest.kt b/src/test/kotlin/com/asyncapi/plugin/idea/completion/v2/_4_0/AsyncAPISpecificationCompletionContributorYamlTest.kt similarity index 78% rename from src/test/kotlin/com/asyncapi/plugin/idea/completion/v2_4_0/AsyncAPISpecificationCompletionContributorYamlTest.kt rename to src/test/kotlin/com/asyncapi/plugin/idea/completion/v2/_4_0/AsyncAPISpecificationCompletionContributorYamlTest.kt index d799bdc..a205a51 100644 --- a/src/test/kotlin/com/asyncapi/plugin/idea/completion/v2_4_0/AsyncAPISpecificationCompletionContributorYamlTest.kt +++ b/src/test/kotlin/com/asyncapi/plugin/idea/completion/v2/_4_0/AsyncAPISpecificationCompletionContributorYamlTest.kt @@ -1,6 +1,6 @@ -package com.asyncapi.plugin.idea.completion.v2_4_0 +package com.asyncapi.plugin.idea.completion.v2._4_0 -import com.asyncapi.plugin.idea.completion.AbstractAsyncAPISpecificationCompletionContributorTest +import com.asyncapi.plugin.idea.completion.v2.AbstractAsyncAPISpecificationCompletionContributorTest class AsyncAPISpecificationCompletionContributorYamlTest: AbstractAsyncAPISpecificationCompletionContributorTest() { diff --git a/src/test/kotlin/com/asyncapi/plugin/idea/completion/v2_5_0/AsyncAPISpecificationCompletionContributorJsonTest.kt b/src/test/kotlin/com/asyncapi/plugin/idea/completion/v2/_5_0/AsyncAPISpecificationCompletionContributorJsonTest.kt similarity index 59% rename from src/test/kotlin/com/asyncapi/plugin/idea/completion/v2_5_0/AsyncAPISpecificationCompletionContributorJsonTest.kt rename to src/test/kotlin/com/asyncapi/plugin/idea/completion/v2/_5_0/AsyncAPISpecificationCompletionContributorJsonTest.kt index 0176b61..56482b1 100644 --- a/src/test/kotlin/com/asyncapi/plugin/idea/completion/v2_5_0/AsyncAPISpecificationCompletionContributorJsonTest.kt +++ b/src/test/kotlin/com/asyncapi/plugin/idea/completion/v2/_5_0/AsyncAPISpecificationCompletionContributorJsonTest.kt @@ -1,6 +1,6 @@ -package com.asyncapi.plugin.idea.completion.v2_5_0 +package com.asyncapi.plugin.idea.completion.v2._5_0 -import com.asyncapi.plugin.idea.completion.AbstractAsyncAPISpecificationCompletionContributorTest +import com.asyncapi.plugin.idea.completion.v2.AbstractAsyncAPISpecificationCompletionContributorTest class AsyncAPISpecificationCompletionContributorJsonTest: AbstractAsyncAPISpecificationCompletionContributorTest() { diff --git a/src/test/kotlin/com/asyncapi/plugin/idea/completion/v2_5_0/AsyncAPISpecificationCompletionContributorYamlTest.kt b/src/test/kotlin/com/asyncapi/plugin/idea/completion/v2/_5_0/AsyncAPISpecificationCompletionContributorYamlTest.kt similarity index 78% rename from src/test/kotlin/com/asyncapi/plugin/idea/completion/v2_5_0/AsyncAPISpecificationCompletionContributorYamlTest.kt rename to src/test/kotlin/com/asyncapi/plugin/idea/completion/v2/_5_0/AsyncAPISpecificationCompletionContributorYamlTest.kt index d639f90..a63c025 100644 --- a/src/test/kotlin/com/asyncapi/plugin/idea/completion/v2_5_0/AsyncAPISpecificationCompletionContributorYamlTest.kt +++ b/src/test/kotlin/com/asyncapi/plugin/idea/completion/v2/_5_0/AsyncAPISpecificationCompletionContributorYamlTest.kt @@ -1,6 +1,6 @@ -package com.asyncapi.plugin.idea.completion.v2_5_0 +package com.asyncapi.plugin.idea.completion.v2._5_0 -import com.asyncapi.plugin.idea.completion.AbstractAsyncAPISpecificationCompletionContributorTest +import com.asyncapi.plugin.idea.completion.v2.AbstractAsyncAPISpecificationCompletionContributorTest class AsyncAPISpecificationCompletionContributorYamlTest: AbstractAsyncAPISpecificationCompletionContributorTest() { diff --git a/src/test/kotlin/com/asyncapi/plugin/idea/completion/v2_6_0/AsyncAPISpecificationCompletionContributorJsonTest.kt b/src/test/kotlin/com/asyncapi/plugin/idea/completion/v2/_6_0/AsyncAPISpecificationCompletionContributorJsonTest.kt similarity index 59% rename from src/test/kotlin/com/asyncapi/plugin/idea/completion/v2_6_0/AsyncAPISpecificationCompletionContributorJsonTest.kt rename to src/test/kotlin/com/asyncapi/plugin/idea/completion/v2/_6_0/AsyncAPISpecificationCompletionContributorJsonTest.kt index 221c108..c6570f7 100644 --- a/src/test/kotlin/com/asyncapi/plugin/idea/completion/v2_6_0/AsyncAPISpecificationCompletionContributorJsonTest.kt +++ b/src/test/kotlin/com/asyncapi/plugin/idea/completion/v2/_6_0/AsyncAPISpecificationCompletionContributorJsonTest.kt @@ -1,6 +1,6 @@ -package com.asyncapi.plugin.idea.completion.v2_6_0 +package com.asyncapi.plugin.idea.completion.v2._6_0 -import com.asyncapi.plugin.idea.completion.AbstractAsyncAPISpecificationCompletionContributorTest +import com.asyncapi.plugin.idea.completion.v2.AbstractAsyncAPISpecificationCompletionContributorTest class AsyncAPISpecificationCompletionContributorJsonTest: AbstractAsyncAPISpecificationCompletionContributorTest() { diff --git a/src/test/kotlin/com/asyncapi/plugin/idea/completion/v2_6_0/AsyncAPISpecificationCompletionContributorYamlTest.kt b/src/test/kotlin/com/asyncapi/plugin/idea/completion/v2/_6_0/AsyncAPISpecificationCompletionContributorYamlTest.kt similarity index 78% rename from src/test/kotlin/com/asyncapi/plugin/idea/completion/v2_6_0/AsyncAPISpecificationCompletionContributorYamlTest.kt rename to src/test/kotlin/com/asyncapi/plugin/idea/completion/v2/_6_0/AsyncAPISpecificationCompletionContributorYamlTest.kt index 21f77b0..f110fdd 100644 --- a/src/test/kotlin/com/asyncapi/plugin/idea/completion/v2_6_0/AsyncAPISpecificationCompletionContributorYamlTest.kt +++ b/src/test/kotlin/com/asyncapi/plugin/idea/completion/v2/_6_0/AsyncAPISpecificationCompletionContributorYamlTest.kt @@ -1,6 +1,6 @@ -package com.asyncapi.plugin.idea.completion.v2_6_0 +package com.asyncapi.plugin.idea.completion.v2._6_0 -import com.asyncapi.plugin.idea.completion.AbstractAsyncAPISpecificationCompletionContributorTest +import com.asyncapi.plugin.idea.completion.v2.AbstractAsyncAPISpecificationCompletionContributorTest class AsyncAPISpecificationCompletionContributorYamlTest: AbstractAsyncAPISpecificationCompletionContributorTest() { diff --git a/src/test/kotlin/com/asyncapi/plugin/idea/completion/v3/AbstractAsyncAPISpecificationCompletionContributorTest.kt b/src/test/kotlin/com/asyncapi/plugin/idea/completion/v3/AbstractAsyncAPISpecificationCompletionContributorTest.kt new file mode 100644 index 0000000..90ae7e6 --- /dev/null +++ b/src/test/kotlin/com/asyncapi/plugin/idea/completion/v3/AbstractAsyncAPISpecificationCompletionContributorTest.kt @@ -0,0 +1,114 @@ +package com.asyncapi.plugin.idea.completion.v3 + +import com.intellij.codeInsight.completion.CompletionType +import com.intellij.testFramework.fixtures.BasePlatformTestCase +import junit.framework.TestCase + +/** + * @author Pavel Bodiachevskii + * @since 2.4.0 + */ +abstract class AbstractAsyncAPISpecificationCompletionContributorTest: BasePlatformTestCase() { + + abstract fun fileExtension(): String + + abstract fun asyncAPIVersion(): String + + override fun getTestDataPath(): String = "src/test/testData/${fileExtension()}/completion/${asyncAPIVersion()}" + + protected open val `$ - c` = listOf( + "\"channels\"", + "\"components\"", + "\"defaultContentType\"", + ) + + protected open val `$ - components - messages - UserSignedUp - p` = listOf( + "\"contentType\"", + "\"deprecated\"", + "\"description\"", + "\"examples\"" + ) + + protected open val `$ - info - i` = listOf( + "\"description\"", + "\"license\"", + "\"termsOfService\"", + "\"title\"", + "\"version\"" + ) + + fun `test $ - (double quote)c(double quote)`() { + configureMyFixture("\"c\".${fileExtension()}") + + /* + TODO: to research why completion returns more variants only in tests. In IDEA everything is ok: + expected: ["channels", "components", "defaultContentType", "externalDocs"] + actual: ["channels", "components", "defaultContentType", "externalDocs", "id", "info", "servers", "tags"] + */ + TestCase.assertTrue((myFixture.lookupElementStrings ?: emptyList()).containsAll(`$ - c`)) + } + + fun `test $ - c`() { + configureMyFixture("c.${fileExtension()}") + + TestCase.assertEquals(`$ - c`.sorted(), (myFixture.lookupElementStrings?.sorted() ?: emptyList())) + } + + fun `test $ - components - messages - UserSignedUp - (double quote)p(double quote)`() { + configureMyFixture("components -> messages -> UserSignedUp -> \"p\".${fileExtension()}") + + /* + TODO: to research why completion returns more variants only in tests. In IDEA everything is ok: + expected: ["contentType", "deprecated", "description", "examples"] + actual: ["$ref", "bindings", "contentType", "correlationId", "deprecated", "description", "examples", "externalDocs", "headers", "name", "oneOf", "schemaFormat", "summary", "tags", "title", "traits"] + */ + TestCase.assertTrue( + (myFixture.lookupElementStrings ?: emptyList()) + .containsAll(`$ - components - messages - UserSignedUp - p`) + ) + } + + fun `test $ - components - messages - UserSignedUp - (double quote)p`() { + configureMyFixture("components -> messages -> UserSignedUp -> \"p.${fileExtension()}") + + TestCase.assertEquals( + `$ - components - messages - UserSignedUp - p`.sorted().map { it.replace("\"", "") }, + (myFixture.lookupElementStrings?.sorted() ?: emptyList()) + ) + } + + fun `test $ - components - messages - UserSignedUp - p`() { + configureMyFixture("components -> messages -> UserSignedUp -> p.${fileExtension()}") + + TestCase.assertEquals( + `$ - components - messages - UserSignedUp - p`.sorted(), + (myFixture.lookupElementStrings?.sorted() ?: emptyList()) + ) + } + + fun `test $ - info - (double quote)i(double quote)`() { + configureMyFixture("info -> \"i\".${fileExtension()}") + + /* + TODO: to research why completion returns more variants only in tests. In IDEA everything is ok: + expected: ["description", "license", "termsOfService", "title", "version"] + actual: ["contact", "description", "license", "termsOfService", "title", "version"] + */ + TestCase.assertTrue( + (myFixture.lookupElementStrings ?: emptyList()) + .containsAll(`$ - info - i`) + ) + } + + fun `test $ - info - i`() { + configureMyFixture("info -> i.${fileExtension()}") + + TestCase.assertEquals(`$ - info - i`.sorted(), (myFixture.lookupElementStrings?.sorted() ?: emptyList())) + } + + private fun configureMyFixture(fileName: String) { + myFixture.configureByFile(fileName) + myFixture.complete(CompletionType.BASIC, 1) + } + +} \ No newline at end of file diff --git a/src/test/kotlin/com/asyncapi/plugin/idea/completion/v3/_0_0/AsyncAPISpecificationCompletionContributorJsonTest.kt b/src/test/kotlin/com/asyncapi/plugin/idea/completion/v3/_0_0/AsyncAPISpecificationCompletionContributorJsonTest.kt new file mode 100644 index 0000000..bee8943 --- /dev/null +++ b/src/test/kotlin/com/asyncapi/plugin/idea/completion/v3/_0_0/AsyncAPISpecificationCompletionContributorJsonTest.kt @@ -0,0 +1,15 @@ +package com.asyncapi.plugin.idea.completion.v3._0_0 + +import com.asyncapi.plugin.idea.completion.v3.AbstractAsyncAPISpecificationCompletionContributorTest + +/** + * @author Pavel Bodiachevskii + * @since 2.4.0 + */ +class AsyncAPISpecificationCompletionContributorJsonTest: AbstractAsyncAPISpecificationCompletionContributorTest() { + + override fun fileExtension(): String = "json" + + override fun asyncAPIVersion(): String = "3.0.0" + +} \ No newline at end of file diff --git a/src/test/kotlin/com/asyncapi/plugin/idea/completion/v3/_0_0/AsyncAPISpecificationCompletionContributorYamlTest.kt b/src/test/kotlin/com/asyncapi/plugin/idea/completion/v3/_0_0/AsyncAPISpecificationCompletionContributorYamlTest.kt new file mode 100644 index 0000000..10e663d --- /dev/null +++ b/src/test/kotlin/com/asyncapi/plugin/idea/completion/v3/_0_0/AsyncAPISpecificationCompletionContributorYamlTest.kt @@ -0,0 +1,17 @@ +package com.asyncapi.plugin.idea.completion.v3._0_0 + +import com.asyncapi.plugin.idea.completion.v3.AbstractAsyncAPISpecificationCompletionContributorTest + +class AsyncAPISpecificationCompletionContributorYamlTest: AbstractAsyncAPISpecificationCompletionContributorTest() { + + override fun fileExtension(): String = "yaml" + + override fun asyncAPIVersion(): String = "3.0.0" + + override val `$ - c` = super.`$ - c`.sorted().map { it.replace("\"", "") } + + override val `$ - components - messages - UserSignedUp - p` = super.`$ - components - messages - UserSignedUp - p`.sorted().map { it.replace("\"", "") } + + override val `$ - info - i` = super.`$ - info - i`.sorted().map { it.replace("\"", "") } + +} \ No newline at end of file diff --git "a/src/test/testData/json/completion/3.0.0/\"c\".json" "b/src/test/testData/json/completion/3.0.0/\"c\".json" new file mode 100644 index 0000000..1fc4339 --- /dev/null +++ "b/src/test/testData/json/completion/3.0.0/\"c\".json" @@ -0,0 +1,4 @@ +{ + "asyncapi": "3.0.0", + "c" +} \ No newline at end of file diff --git a/src/test/testData/json/completion/3.0.0/c.json b/src/test/testData/json/completion/3.0.0/c.json new file mode 100644 index 0000000..ee1e150 --- /dev/null +++ b/src/test/testData/json/completion/3.0.0/c.json @@ -0,0 +1,4 @@ +{ + "asyncapi": "3.0.0", + c +} \ No newline at end of file diff --git "a/src/test/testData/json/completion/3.0.0/components -> messages -> UserSignedUp -> \"p\".json" "b/src/test/testData/json/completion/3.0.0/components -> messages -> UserSignedUp -> \"p\".json" new file mode 100644 index 0000000..3a17281 --- /dev/null +++ "b/src/test/testData/json/completion/3.0.0/components -> messages -> UserSignedUp -> \"p\".json" @@ -0,0 +1,47 @@ +{ + "asyncapi": "3.0.0", + "info": { + "title": "Account Service", + "version": "1.0.0", + "description": "This service is in charge of processing user signups :rocket:" + }, + "channels": { + "userSignedup": { + "address": "user/signedup", + "messages": { + "userSignedupMessage": { + "$ref": "#/components/messages/UserSignedUp" + } + } + } + }, + "operations": { + "processUserSignups": { + "action": "receive", + "channel": { + "$ref": "#/channels/userSignedup" + } + } + }, + "components": { + "messages": { + "UserSignedUp": { + "p" + "payload": { + "type": "object", + "properties": { + "displayName": { + "type": "string", + "description": "Name of the user" + }, + "email": { + "type": "string", + "format": "email", + "description": "Email of the user" + } + } + } + } + } + } +} \ No newline at end of file diff --git "a/src/test/testData/json/completion/3.0.0/components -> messages -> UserSignedUp -> \"p.json" "b/src/test/testData/json/completion/3.0.0/components -> messages -> UserSignedUp -> \"p.json" new file mode 100644 index 0000000..6e32217 --- /dev/null +++ "b/src/test/testData/json/completion/3.0.0/components -> messages -> UserSignedUp -> \"p.json" @@ -0,0 +1,47 @@ +{ + "asyncapi": "3.0.0", + "info": { + "title": "Account Service", + "version": "1.0.0", + "description": "This service is in charge of processing user signups :rocket:" + }, + "channels": { + "userSignedup": { + "address": "user/signedup", + "messages": { + "userSignedupMessage": { + "$ref": "#/components/messages/UserSignedUp" + } + } + } + }, + "operations": { + "processUserSignups": { + "action": "receive", + "channel": { + "$ref": "#/channels/userSignedup" + } + } + }, + "components": { + "messages": { + "UserSignedUp": { + "p + "payload": { + "type": "object", + "properties": { + "displayName": { + "type": "string", + "description": "Name of the user" + }, + "email": { + "type": "string", + "format": "email", + "description": "Email of the user" + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/test/testData/json/completion/3.0.0/components -> messages -> UserSignedUp -> p.json b/src/test/testData/json/completion/3.0.0/components -> messages -> UserSignedUp -> p.json new file mode 100644 index 0000000..38bd19d --- /dev/null +++ b/src/test/testData/json/completion/3.0.0/components -> messages -> UserSignedUp -> p.json @@ -0,0 +1,47 @@ +{ + "asyncapi": "3.0.0", + "info": { + "title": "Account Service", + "version": "1.0.0", + "description": "This service is in charge of processing user signups :rocket:" + }, + "channels": { + "userSignedup": { + "address": "user/signedup", + "messages": { + "userSignedupMessage": { + "$ref": "#/components/messages/UserSignedUp" + } + } + } + }, + "operations": { + "processUserSignups": { + "action": "receive", + "channel": { + "$ref": "#/channels/userSignedup" + } + } + }, + "components": { + "messages": { + "UserSignedUp": { + p + "payload": { + "type": "object", + "properties": { + "displayName": { + "type": "string", + "description": "Name of the user" + }, + "email": { + "type": "string", + "format": "email", + "description": "Email of the user" + } + } + } + } + } + } +} \ No newline at end of file diff --git "a/src/test/testData/json/completion/3.0.0/info -> \"i\".json" "b/src/test/testData/json/completion/3.0.0/info -> \"i\".json" new file mode 100644 index 0000000..4f53782 --- /dev/null +++ "b/src/test/testData/json/completion/3.0.0/info -> \"i\".json" @@ -0,0 +1,6 @@ +{ + "asyncapi": "3.0.0", + "info": { + "i" + } +} \ No newline at end of file diff --git a/src/test/testData/json/completion/3.0.0/info -> i.json b/src/test/testData/json/completion/3.0.0/info -> i.json new file mode 100644 index 0000000..9eb272c --- /dev/null +++ b/src/test/testData/json/completion/3.0.0/info -> i.json @@ -0,0 +1,6 @@ +{ + "asyncapi": "3.0.0", + "info": { + i + } +} \ No newline at end of file diff --git "a/src/test/testData/yaml/completion/3.0.0/\"c\".yaml" "b/src/test/testData/yaml/completion/3.0.0/\"c\".yaml" new file mode 100644 index 0000000..1060024 --- /dev/null +++ "b/src/test/testData/yaml/completion/3.0.0/\"c\".yaml" @@ -0,0 +1,3 @@ +--- +asyncapi: 3.0.0 +"c" \ No newline at end of file diff --git a/src/test/testData/yaml/completion/3.0.0/c.yaml b/src/test/testData/yaml/completion/3.0.0/c.yaml new file mode 100644 index 0000000..0a535f6 --- /dev/null +++ b/src/test/testData/yaml/completion/3.0.0/c.yaml @@ -0,0 +1,3 @@ +--- +asyncapi: 3.0.0 +c \ No newline at end of file diff --git "a/src/test/testData/yaml/completion/3.0.0/components -> messages -> UserSignedUp -> \"p\".yaml" "b/src/test/testData/yaml/completion/3.0.0/components -> messages -> UserSignedUp -> \"p\".yaml" new file mode 100644 index 0000000..0159a27 --- /dev/null +++ "b/src/test/testData/yaml/completion/3.0.0/components -> messages -> UserSignedUp -> \"p\".yaml" @@ -0,0 +1,31 @@ +--- +asyncapi: 3.0.0 +info: + title: Account Service + version: 1.0.0 + description: "This service is in charge of processing user signups :rocket:" +channels: + userSignedup: + address: "user/signedup" + messages: + userSignedupMessage: + $ref: "#/components/messages/UserSignedUp" +operations: + processUserSignups: + action: "receive" + channel: + $ref: "#/channels/userSignedup" +components: + messages: + UserSignedUp: + "p" + payload: + type: object + properties: + displayName: + type: string + description: Name of the user + email: + type: string + format: email + description: Email of the user \ No newline at end of file diff --git "a/src/test/testData/yaml/completion/3.0.0/components -> messages -> UserSignedUp -> \"p.yaml" "b/src/test/testData/yaml/completion/3.0.0/components -> messages -> UserSignedUp -> \"p.yaml" new file mode 100644 index 0000000..65f38bd --- /dev/null +++ "b/src/test/testData/yaml/completion/3.0.0/components -> messages -> UserSignedUp -> \"p.yaml" @@ -0,0 +1,31 @@ +--- +asyncapi: 3.0.0 +info: + title: Account Service + version: 1.0.0 + description: "This service is in charge of processing user signups :rocket:" +channels: + userSignedup: + address: "user/signedup" + messages: + userSignedupMessage: + $ref: "#/components/messages/UserSignedUp" +operations: + processUserSignups: + action: "receive" + channel: + $ref: "#/channels/userSignedup" +components: + messages: + UserSignedUp: + "p + payload: + type: object + properties: + displayName: + type: string + description: Name of the user + email: + type: string + format: email + description: Email of the user \ No newline at end of file diff --git a/src/test/testData/yaml/completion/3.0.0/components -> messages -> UserSignedUp -> p.yaml b/src/test/testData/yaml/completion/3.0.0/components -> messages -> UserSignedUp -> p.yaml new file mode 100644 index 0000000..fff789b --- /dev/null +++ b/src/test/testData/yaml/completion/3.0.0/components -> messages -> UserSignedUp -> p.yaml @@ -0,0 +1,31 @@ +--- +asyncapi: 3.0.0 +info: + title: Account Service + version: 1.0.0 + description: "This service is in charge of processing user signups :rocket:" +channels: + userSignedup: + address: "user/signedup" + messages: + userSignedupMessage: + $ref: "#/components/messages/UserSignedUp" +operations: + processUserSignups: + action: "receive" + channel: + $ref: "#/channels/userSignedup" +components: + messages: + UserSignedUp: + p + payload: + type: object + properties: + displayName: + type: string + description: Name of the user + email: + type: string + format: email + description: Email of the user \ No newline at end of file diff --git "a/src/test/testData/yaml/completion/3.0.0/info -> \"i\".yaml" "b/src/test/testData/yaml/completion/3.0.0/info -> \"i\".yaml" new file mode 100644 index 0000000..be4b890 --- /dev/null +++ "b/src/test/testData/yaml/completion/3.0.0/info -> \"i\".yaml" @@ -0,0 +1,4 @@ +--- +asyncapi: 3.0.0 +info: + "i" \ No newline at end of file diff --git a/src/test/testData/yaml/completion/3.0.0/info -> i.yaml b/src/test/testData/yaml/completion/3.0.0/info -> i.yaml new file mode 100644 index 0000000..5cd62dd --- /dev/null +++ b/src/test/testData/yaml/completion/3.0.0/info -> i.yaml @@ -0,0 +1,4 @@ +--- +asyncapi: 3.0.0 +info: + i \ No newline at end of file