View Javadoc

1   /**
2    * Copyright 2006-2012 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
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   * Unit test for simple SqlExecMojo.
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  }