generated from cortinico/kotlin-gradle-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
99 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
plugins { | ||
java | ||
// id("ru.rudikov.avroschema-wizard-plugin") | ||
id("ru.rudikov.avroschema-wizard-plugin") | ||
} | ||
|
||
avroWizardConfig { | ||
subjectToSchema = mapOf("my-topic" to "Schema") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,4 +56,3 @@ tasks { | |
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 0 additions & 45 deletions
45
...build/plugin/src/test/java/com/ncorti/kotlin/gradle/template/plugin/TemplatePluginTest.kt
This file was deleted.
Oops, something went wrong.
67 changes: 67 additions & 0 deletions
67
plugin-build/plugin/src/test/java/ru/rudikov/plugin/AvroSchemaWizardPluginTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package ru.rudikov.plugin | ||
|
||
import org.gradle.testfixtures.ProjectBuilder | ||
import org.junit.Assert.assertEquals | ||
import org.junit.Assert.assertNotNull | ||
import org.junit.Test | ||
|
||
class AvroSchemaWizardPluginTest { | ||
@Test | ||
fun `plugin is applied correctly to the project`() { | ||
val project = ProjectBuilder.builder().build() | ||
project.pluginManager.apply(PLUGIN_ID) | ||
|
||
assert(project.tasks.getByName(REGISTER_TASK_NAME) is RegisterTask) | ||
} | ||
|
||
@Test | ||
fun `extension avroWizardConfig is created correctly`() { | ||
val project = ProjectBuilder.builder().build() | ||
project.pluginManager.apply(PLUGIN_ID) | ||
|
||
assertNotNull(project.extensions.getByName(EXTENSION_NAME)) | ||
} | ||
|
||
@Test | ||
fun `parameters are passed correctly from extension to task`() { | ||
val project = ProjectBuilder.builder().build() | ||
project.pluginManager.apply(PLUGIN_ID) | ||
|
||
val schemaRegistryUrl = "some_url" | ||
val searchAvroFilesPaths = setOf("some_path") | ||
val subjectToSchema = mapOf("some_subject" to "some_schema") | ||
|
||
(project.extensions.getByName(EXTENSION_NAME) as AvroWizardExtension).apply { | ||
this.schemaRegistryUrl.set(schemaRegistryUrl) | ||
this.searchAvroFilesPaths.set(searchAvroFilesPaths) | ||
this.subjectToSchema.set(subjectToSchema) | ||
} | ||
|
||
val task = project.tasks.getByName(REGISTER_TASK_NAME) as RegisterTask | ||
|
||
assertEquals(schemaRegistryUrl, task.schemaRegistryUrl.get()) | ||
assertEquals(searchAvroFilesPaths, task.searchAvroFilesPaths.get()) | ||
assertEquals(subjectToSchema, task.subjectToSchema.get()) | ||
} | ||
|
||
@Test | ||
fun `parameters by default are passed correctly from extension to task`() { | ||
val project = ProjectBuilder.builder().build() | ||
project.pluginManager.apply(PLUGIN_ID) | ||
|
||
val subjectToSchema = mapOf("some_subject" to "some_schema") | ||
|
||
(project.extensions.getByName(EXTENSION_NAME) as AvroWizardExtension).apply { | ||
this.subjectToSchema.set(subjectToSchema) | ||
} | ||
|
||
val task = project.tasks.getByName(REGISTER_TASK_NAME) as RegisterTask | ||
|
||
assertEquals(DEFAULT_SCHEMA_REGISTRY_URL, task.schemaRegistryUrl.get()) | ||
assertEquals(setOf(project.layout.buildDirectory.get().asFile.absolutePath), task.searchAvroFilesPaths.get()) | ||
} | ||
|
||
companion object { | ||
private const val PLUGIN_ID = "ru.rudikov.avroschema-wizard-plugin" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters