diff --git a/plugin/src/functionalTest/groovy/io/noumenal/FunctionalTest.groovy b/plugin/src/functionalTest/groovy/io/noumenal/FunctionalTest.groovy index ade73f2..28ed000 100644 --- a/plugin/src/functionalTest/groovy/io/noumenal/FunctionalTest.groovy +++ b/plugin/src/functionalTest/groovy/io/noumenal/FunctionalTest.groovy @@ -25,7 +25,7 @@ class FunctionalTest extends Specification { private File projectDir @Shared - File buildFile, settingsFile + File buildFile, settingsFile, javaFile @Shared String account = System.getProperty("account"), @@ -41,15 +41,46 @@ class FunctionalTest extends Specification { |plugins { | id('io.noumenal.gradle.snowflake') |} + |java { + | toolchain { + | languageVersion = JavaLanguageVersion.of(11) + | } + |} |snowflake { | groupId = 'io.noumenal' | artifactId = 'test-gradle-snowflake' | role = 'devops' | database = 'devops' | schema = 'gradle' + | applications { + | add_numbers { + | inputs = ["a integer", "b integer"] + | returns = "string" + | handler = "AddNumbers.addNum" + | } + | } |} |version='0.1.0' |""".stripMargin()) + javaFile = new File("${projectDir}/src/main/java", 'AddNumbers.java') + javaFile.parentFile.mkdirs() + javaFile.write(""" + |public class AddNumbers + |{ + | public String addNum(int num1, int num2) { + | try { + | int sum = num1 + num2; + | return ("Sum is: " + sum); + | } catch (Exception e) { + | return e.toString(); + | } + | } + | + | public static void main(String[] args){ + | System.out.println("Hello World"); + | } + |} + |""".stripMargin()) } // helper method @@ -105,7 +136,7 @@ class FunctionalTest extends Specification { taskName = 'snowflakePublish' when: - result = executeSingleTask(taskName, ['--jar', 'build/libs/unit-test-0.1.0-all.jar','-Psnowflake.stage=upload', '-Si']) + result = executeSingleTask(taskName, ['--jar', 'build/libs/unit-test-0.1.0-all.jar', '-Psnowflake.stage=upload', '-Si']) then: !result.tasks.collect { it.outcome }.contains('FAILURE') diff --git a/plugin/src/main/groovy/io/noumenal/SnowflakePublish.groovy b/plugin/src/main/groovy/io/noumenal/SnowflakePublish.groovy index dcffa0d..a01c96b 100644 --- a/plugin/src/main/groovy/io/noumenal/SnowflakePublish.groovy +++ b/plugin/src/main/groovy/io/noumenal/SnowflakePublish.groovy @@ -210,7 +210,10 @@ class SnowflakePublish extends DefaultTask { AUTO_COMPRESS: 'false', PARALLEL : '4' ] - PutResult[] putResults = session.file().put(jar, "$stage/libs", options) + PutResult[] pr = session.file().put(jar, "$stage/libs", options) + pr.each { + log.warn "File ${it.sourceFileName}: ${it.status}" + } } else { // ensure that the stage and the publishUrl are aligned Statement statement = session.jdbcConnection().createStatement() @@ -227,7 +230,8 @@ class SnowflakePublish extends DefaultTask { // automatically create application spec objects output.write("Snowflake Application:\n\n") project."$PLUGIN".applications.each { ApplicationContainer app -> - String createText = app.getCreate(extension.publishUrl ? getImports(session) : "@$stage/libs/$jar") + File jarFile = project.file(jar) + String createText = app.getCreate(extension.publishUrl ? getImports(session) : "'@$stage/libs/${jarFile.name}'") String message = "Deploying ==> \n$createText" log.warn message output.append("$message\n")