-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from RedPillAnalytics/develop
Corrected script-generation logic.
- Loading branch information
Showing
7 changed files
with
276 additions
and
138 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
import groovy.util.logging.Slf4j | ||
import org.gradle.testkit.runner.GradleRunner | ||
import spock.lang.Ignore | ||
import spock.lang.Shared | ||
import spock.lang.Specification | ||
import spock.lang.Title | ||
|
||
@Slf4j | ||
@Title("Execute :tasks") | ||
class ExecuteTest extends Specification { | ||
|
||
@Shared | ||
File projectDir, buildDir, buildFile, resourcesDir | ||
|
||
@Shared | ||
String taskName | ||
|
||
@Shared | ||
def result, taskList | ||
|
||
def setupSpec() { | ||
|
||
projectDir = new File("${System.getProperty("projectDir")}/execute-test") | ||
buildDir = new File(projectDir, 'build') | ||
buildFile = new File(projectDir, 'build.gradle') | ||
taskList = ['pipelineExecute'] | ||
|
||
resourcesDir = new File('src/test/resources') | ||
|
||
copySource() | ||
|
||
buildFile.write(""" | ||
|plugins { | ||
| id 'com.redpillanalytics.gradle-confluent' | ||
|} | ||
| | ||
|archivesBaseName = 'test' | ||
|group = 'com.redpillanalytics' | ||
|version = '1.0.0' | ||
""".stripMargin()) | ||
} | ||
|
||
def setup() { | ||
|
||
copySource() | ||
} | ||
|
||
def copySource() { | ||
|
||
new AntBuilder().copy(todir: projectDir) { | ||
fileset(dir: resourcesDir) | ||
} | ||
} | ||
|
||
// helper method | ||
def executeSingleTask(String taskName, List otherArgs, Boolean logOutput = true) { | ||
|
||
otherArgs.add(0, taskName) | ||
|
||
log.warn "runner arguments: ${otherArgs.toString()}" | ||
|
||
// execute the Gradle test build | ||
result = GradleRunner.create() | ||
.withProjectDir(projectDir) | ||
.withArguments(otherArgs) | ||
.withPluginClasspath() | ||
.build() | ||
|
||
// log the results | ||
if (logOutput) log.warn result.getOutput() | ||
|
||
return result | ||
|
||
} | ||
|
||
@Ignore | ||
def "Execute :pipelineExecute task with default values"() { | ||
|
||
given: | ||
taskName = 'pipelineExecute' | ||
result = executeSingleTask(taskName, ['-Si','--rerun-tasks']) | ||
|
||
expect: | ||
result.task(":${taskName}").outcome.name() != 'FAILED' | ||
|
||
} | ||
} |
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 was deleted.
Oops, something went wrong.
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
31 changes: 31 additions & 0 deletions
31
src/main/groovy/com/redpillanalytics/gradle/tasks/ExecutePipelineTask.groovy
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,31 @@ | ||
package com.redpillanalytics.gradle.tasks | ||
|
||
import com.redpillanalytics.KsqlRest | ||
import groovy.util.logging.Slf4j | ||
import org.gradle.api.tasks.Internal | ||
import org.gradle.api.tasks.TaskAction | ||
|
||
/** | ||
* Use the KSQL RESTful API to execute all pipelines in a particular directory. Note: not functioning yet. | ||
*/ | ||
@Slf4j | ||
class ExecutePipelineTask extends PipelineTask { | ||
|
||
/** | ||
* The KsqlRest Object for interacting with the KSQL REST Server. | ||
*/ | ||
@Internal | ||
KsqlRest rest = new KsqlRest() | ||
|
||
/** | ||
* The main Gradle Task method. | ||
*/ | ||
@TaskAction | ||
def executePipelines() { | ||
|
||
|
||
//rest.execKsql(getDropSql(pipelines)) | ||
|
||
rest.execKsql(pipelineSql) | ||
} | ||
} |
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
Oops, something went wrong.