Skip to content

Commit 70242ab

Browse files
authored
Merge pull request #9 from nextflow-io/8-update-plugin-to-nextflow-22.08.0-edge
feature: upgrade nextflow version to 22.08
2 parents 8bbf450 + 5f59131 commit 70242ab

File tree

5 files changed

+52
-18
lines changed

5 files changed

+52
-18
lines changed

Diff for: plugins/nf-sqldb/build.gradle

+8-2
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,12 @@ sourceSets {
5454
test.resources.srcDirs = []
5555
}
5656

57+
ext{
58+
nextflowVersion = '22.08.1-edge'
59+
}
5760

5861
dependencies {
59-
compileOnly 'io.nextflow:nextflow:22.04.0'
62+
compileOnly "io.nextflow:nextflow:$nextflowVersion"
6063
compileOnly 'org.slf4j:slf4j-api:1.7.10'
6164
compileOnly 'org.pf4j:pf4j:3.4.1'
6265

@@ -69,7 +72,7 @@ dependencies {
6972
api 'org.duckdb:duckdb_jdbc:0.3.0'
7073
api files('src/dist/lib/AthenaJDBC42_2.0.25.1001.jar')
7174

72-
testImplementation 'io.nextflow:nextflow:22.06.0-edge'
75+
testImplementation "io.nextflow:nextflow:$nextflowVersion"
7376
testImplementation "org.codehaus.groovy:groovy:3.0.10"
7477
testImplementation "org.codehaus.groovy:groovy-nio:3.0.10"
7578
testImplementation ("org.codehaus.groovy:groovy-test:3.0.10") { exclude group: 'org.codehaus.groovy' }
@@ -78,6 +81,9 @@ dependencies {
7881
testImplementation ("org.spockframework:spock-core:2.1-groovy-3.0") { exclude group: 'org.codehaus.groovy'; exclude group: 'net.bytebuddy' }
7982
testImplementation ('org.spockframework:spock-junit4:2.1-groovy-3.0') { exclude group: 'org.codehaus.groovy'; exclude group: 'net.bytebuddy' }
8083
testImplementation ('com.google.jimfs:jimfs:1.1')
84+
85+
testImplementation(testFixtures("io.nextflow:nextflow:$nextflowVersion"))
86+
testImplementation(testFixtures("io.nextflow:nf-commons:$nextflowVersion"))
8187
}
8288

8389
test {

Diff for: plugins/nf-sqldb/src/main/nextflow/sql/ChannelSqlExtension.groovy

+2-4
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,8 @@ import nextflow.Channel
2727
import nextflow.NF
2828
import nextflow.Session
2929
import nextflow.extension.CH
30-
import nextflow.extension.ChannelExtensionPoint
3130
import nextflow.extension.DataflowHelper
32-
import nextflow.plugin.Scoped
31+
import nextflow.plugin.extension.PluginExtensionPoint
3332
import nextflow.sql.config.SqlConfig
3433
import nextflow.sql.config.SqlDataSource
3534
import nextflow.util.CheckHelper
@@ -40,8 +39,7 @@ import nextflow.util.CheckHelper
4039
*/
4140
@Slf4j
4241
@CompileStatic
43-
@Scoped('sql')
44-
class ChannelSqlExtension extends ChannelExtensionPoint {
42+
class ChannelSqlExtension extends PluginExtensionPoint {
4543

4644
private static final Map QUERY_PARAMS = [
4745
db: CharSequence,

Diff for: plugins/nf-sqldb/src/main/nextflow/sql/InsertHandler.groovy

+1-1
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ class InsertHandler implements Closeable {
208208
final metaData = conn.getMetaData()
209209
final resultSet = metaData.getColumns(null, null, tableName, null);
210210

211-
final result = []
211+
final result = [] as List<String>
212212
while (resultSet.next()){
213213
result.add( resultSet.getString("COLUMN_NAME") )
214214
}

Diff for: plugins/nf-sqldb/src/resources/META-INF/MANIFEST.MF

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ Plugin-Class: nextflow.sql.SqlPlugin
33
Plugin-Id: nf-sqldb
44
Plugin-Provider: Seqera Labs
55
Plugin-Version: 0.4.1
6-
Plugin-Requires: >=21.08.0-edge
6+
Plugin-Requires: >=22.08.1-edge

Diff for: plugins/nf-sqldb/src/test/nextflow/sql/SqlDslTest.groovy

+40-10
Original file line numberDiff line numberDiff line change
@@ -19,28 +19,54 @@ package nextflow.sql
1919

2020
import groovy.sql.Sql
2121
import nextflow.Channel
22-
import nextflow.extension.ChannelExtensionProvider
22+
import nextflow.plugin.Plugins
23+
import nextflow.plugin.TestPluginDescriptorFinder
24+
import nextflow.plugin.TestPluginManager
25+
import nextflow.plugin.extension.PluginExtensionProvider
26+
import org.pf4j.PluginDescriptorFinder
27+
import spock.lang.Shared
2328
import spock.lang.Timeout
24-
import test.BaseSpec
29+
import test.Dsl2Spec
2530
import test.MockScriptRunner
2631

32+
import java.nio.file.Path
33+
2734
/**
2835
*
2936
* @author Paolo Di Tommaso <[email protected]>
3037
*/
3138
@Timeout(10)
32-
class SqlDslTest extends BaseSpec {
33-
34-
def setup () {
35-
new ChannelExtensionProvider()
36-
.install()
37-
.loadPluginExtensionMethods(new ChannelSqlExtension(), ['fromQuery':'fromQuery', sqlInsert:'sqlInsert'])
39+
class SqlDslTest extends Dsl2Spec {
40+
41+
@Shared String pluginsMode
42+
43+
def setup() {
44+
// reset previous instances
45+
PluginExtensionProvider.reset()
46+
// this need to be set *before* the plugin manager class is created
47+
pluginsMode = System.getProperty('pf4j.mode')
48+
System.setProperty('pf4j.mode', 'dev')
49+
// the plugin root should
50+
def root = Path.of('.').toAbsolutePath().normalize()
51+
def manager = new TestPluginManager(root){
52+
@Override
53+
protected PluginDescriptorFinder createPluginDescriptorFinder() {
54+
return new TestPluginDescriptorFinder(){
55+
@Override
56+
protected Path getManifestPath(Path pluginPath) {
57+
return pluginPath.resolve('build/resources/main/META-INF/MANIFEST.MF')
58+
}
59+
}
60+
}
61+
}
62+
Plugins.init(root, 'dev', manager)
3863
}
3964

4065
def cleanup() {
41-
ChannelExtensionProvider.reset()
66+
Plugins.stop()
67+
PluginExtensionProvider.reset()
68+
pluginsMode ? System.setProperty('pf4j.mode',pluginsMode) : System.clearProperty('pf4j.mode')
4269
}
43-
4470
def 'should perform a query and create a channel' () {
4571
given:
4672
def JDBC_URL = 'jdbc:h2:mem:test_' + Random.newInstance().nextInt(1_000_000)
@@ -55,6 +81,7 @@ class SqlDslTest extends BaseSpec {
5581

5682
when:
5783
def SCRIPT = '''
84+
include { fromQuery; sqlInsert } from 'plugin/nf-sqldb'
5885
def table = 'FOO'
5986
def sql = "select * from $table"
6087
channel.fromQuery(sql, db: "test")
@@ -80,6 +107,7 @@ class SqlDslTest extends BaseSpec {
80107

81108
when:
82109
def SCRIPT = '''
110+
include { fromQuery; sqlInsert } from 'plugin/nf-sqldb'
83111
channel
84112
.of(100,200,300)
85113
.sqlInsert(into:"FOO", columns:'id', db:"ds1")
@@ -110,6 +138,7 @@ class SqlDslTest extends BaseSpec {
110138

111139
when:
112140
def SCRIPT = '''
141+
include { fromQuery; sqlInsert } from 'plugin/nf-sqldb'
113142
channel
114143
.of(100,200,300,400,500)
115144
.sqlInsert(into:'FOO', columns:'id', db:'ds1', batchSize: 2)
@@ -145,6 +174,7 @@ class SqlDslTest extends BaseSpec {
145174

146175
when:
147176
def SCRIPT = '''
177+
include { fromQuery; sqlInsert } from 'plugin/nf-sqldb'
148178
def table = 'FOO'
149179
def sql = "select * from $table"
150180
channel.fromQuery(sql, db: "test", emitColumns:true)

0 commit comments

Comments
 (0)