1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.codehaus.mojo.sql;
17
18 import org.apache.maven.plugin.MojoExecutionException;
19 import org.junit.Test;
20 import org.springframework.core.io.Resource;
21
22
23
24
25 public class SqlExecMojoTest {
26 private SqlExecMojo mojo = new SqlExecMojo();
27
28 @Test
29 public void test1() throws MojoExecutionException {
30 try {
31 mojo.setResourceListingLocation("classpath:locations.listing");
32 Resource[] resources = mojo.getResources(null, mojo.getResourceListingLocation());
33 System.out.println(resources.length);
34 for (Resource resource : resources) {
35 System.out.println(resource.getDescription());
36 }
37 } catch (Exception e) {
38 e.printStackTrace();
39 }
40 }
41
42 @Test
43 public void test2() throws MojoExecutionException {
44 try {
45 mojo.setResourceListingLocation("classpath:locations.listing");
46 String[] locations = new String[] { "classpath:a.properties" };
47 Resource[] resources = mojo.getResources(locations, mojo.getResourceListingLocation());
48 System.out.println(resources.length);
49 for (Resource resource : resources) {
50 System.out.println(resource.getDescription());
51 }
52 } catch (Exception e) {
53 e.printStackTrace();
54 }
55 }
56
57 }