001 /** 002 * Copyright 2006-2012 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 package org.codehaus.mojo.sql; 017 018 import org.apache.maven.plugin.MojoExecutionException; 019 import org.junit.Test; 020 import org.springframework.core.io.Resource; 021 022 /** 023 * Unit test for simple SqlExecMojo. 024 */ 025 public class SqlExecMojoTest { 026 private SqlExecMojo mojo = new SqlExecMojo(); 027 028 @Test 029 public void test1() throws MojoExecutionException { 030 try { 031 mojo.setResourceListingLocation("classpath:locations.listing"); 032 Resource[] resources = mojo.getResources(null, mojo.getResourceListingLocation()); 033 System.out.println(resources.length); 034 for (Resource resource : resources) { 035 System.out.println(resource.getDescription()); 036 } 037 } catch (Exception e) { 038 e.printStackTrace(); 039 } 040 } 041 042 @Test 043 public void test2() throws MojoExecutionException { 044 try { 045 mojo.setResourceListingLocation("classpath:locations.listing"); 046 String[] locations = new String[] { "classpath:a.properties" }; 047 Resource[] resources = mojo.getResources(locations, mojo.getResourceListingLocation()); 048 System.out.println(resources.length); 049 for (Resource resource : resources) { 050 System.out.println(resource.getDescription()); 051 } 052 } catch (Exception e) { 053 e.printStackTrace(); 054 } 055 } 056 057 }