-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgrade nextflow version to 22.08 (#6)
Signed-off-by: Jorge Aguilera <[email protected]>
- Loading branch information
1 parent
c567bfa
commit 535346e
Showing
4 changed files
with
76 additions
and
14 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
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,27 +1,60 @@ | ||
package nextflow.hello | ||
|
||
import nextflow.Channel | ||
import nextflow.extension.ChannelExtensionDelegate | ||
import nextflow.plugin.Plugins | ||
import spock.lang.Specification | ||
import nextflow.plugin.TestPluginDescriptorFinder | ||
import nextflow.plugin.TestPluginManager | ||
import nextflow.plugin.extension.PluginExtensionProvider | ||
import org.pf4j.PluginDescriptorFinder | ||
import spock.lang.Shared | ||
import spock.lang.Timeout | ||
import test.Dsl2Spec | ||
|
||
import java.nio.file.Path | ||
|
||
|
||
/** | ||
* @author : jorge <[email protected]> | ||
* | ||
*/ | ||
@Timeout(10) | ||
class HelloDslTest extends Specification{ | ||
class HelloDslTest extends Dsl2Spec{ | ||
|
||
@Shared String pluginsMode | ||
|
||
def setup() { | ||
// reset previous instances | ||
PluginExtensionProvider.reset() | ||
// this need to be set *before* the plugin manager class is created | ||
pluginsMode = System.getProperty('pf4j.mode') | ||
System.setProperty('pf4j.mode', 'dev') | ||
// the plugin root should | ||
def root = Path.of('.').toAbsolutePath().normalize() | ||
def manager = new TestPluginManager(root){ | ||
@Override | ||
protected PluginDescriptorFinder createPluginDescriptorFinder() { | ||
return new TestPluginDescriptorFinder(){ | ||
@Override | ||
protected Path getManifestPath(Path pluginPath) { | ||
return pluginPath.resolve('build/resources/main/META-INF/MANIFEST.MF') | ||
} | ||
} | ||
} | ||
} | ||
Plugins.init(root, 'dev', manager) | ||
} | ||
|
||
def setup () { | ||
ChannelExtensionDelegate.reloadExtensionPoints() | ||
def cleanup() { | ||
Plugins.stop() | ||
PluginExtensionProvider.reset() | ||
pluginsMode ? System.setProperty('pf4j.mode',pluginsMode) : System.clearProperty('pf4j.mode') | ||
} | ||
|
||
def 'should perform a hi and create a channel' () { | ||
when: | ||
def SCRIPT = ''' | ||
channel.hello.reverse('hi!') | ||
include {reverse} from 'plugin/nf-hello' | ||
channel.reverse('hi!') | ||
''' | ||
and: | ||
def result = new MockScriptRunner([:]).setScript(SCRIPT).execute() | ||
|
@@ -33,6 +66,7 @@ class HelloDslTest extends Specification{ | |
def 'should store a goodbye' () { | ||
when: | ||
def SCRIPT = ''' | ||
include {goodbye} from 'plugin/nf-hello' | ||
channel | ||
.of('Bye bye folks') | ||
.goodbye() | ||
|
@@ -46,4 +80,19 @@ class HelloDslTest extends Specification{ | |
and: | ||
HelloExtension.goodbyeMessage == 'Bye bye folks'.toUpperCase() | ||
} | ||
|
||
def 'can use an imported function' () { | ||
when: | ||
def SCRIPT = ''' | ||
include {randomString} from 'plugin/nf-hello' | ||
channel | ||
.of( randomString(20) ) | ||
''' | ||
and: | ||
def result = new MockScriptRunner([:]).setScript(SCRIPT).execute() | ||
then: | ||
result.val.size() == 20 | ||
result.val == Channel.STOP | ||
} | ||
|
||
} |