1 | |
package org.jbehave.core.io.rest.mojo; |
2 | |
|
3 | |
import org.apache.maven.plugin.MojoExecutionException; |
4 | |
import org.apache.maven.plugin.MojoFailureException; |
5 | |
import org.jbehave.core.io.ResourceLoader; |
6 | |
import org.jbehave.core.io.rest.ResourceImporter; |
7 | |
import org.jbehave.core.io.rest.ResourceIndexer; |
8 | |
import org.jbehave.core.io.rest.filesystem.ImportToFilesystem; |
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | 1 | public class ImportToFilesystemMojo extends AbstractFilesystemMojo { |
17 | |
|
18 | |
public void execute() throws MojoExecutionException, MojoFailureException { |
19 | |
try { |
20 | 1 | getLog().info( |
21 | |
"Importing to filesystem resources from REST root URI " |
22 | |
+ restRootURI); |
23 | 1 | ResourceImporter importer = createImporter(); |
24 | 1 | importer.importResources(restRootURI); |
25 | 0 | } catch (Exception e) { |
26 | 0 | String message = "Failed to import to filesystem resources from REST root URI " |
27 | |
+ restRootURI; |
28 | 0 | getLog().warn(message); |
29 | 0 | throw new MojoExecutionException(message, e); |
30 | 1 | } |
31 | 1 | } |
32 | |
|
33 | |
private ResourceImporter createImporter() { |
34 | 1 | ResourceIndexer indexer = newResourceIndexer(); |
35 | 1 | ResourceLoader loader = newResourceLoader(); |
36 | 1 | getLog().info( |
37 | |
"Creating importer to filesystem using REST provider " |
38 | |
+ restProvider + " with resourcesPath " + resourcesPath |
39 | |
+ " and resourcesExt " + resourcesExt); |
40 | 1 | return new ImportToFilesystem(indexer, loader, resourcesPath, resourcesExt); |
41 | |
} |
42 | |
|
43 | |
} |