/* ===================================================================
 * ImportRecipeMLTest.java
 * 
 * Created Feb 14, 2005 4:15:19 PM
 * 
 * Copyright (c) 2005 Matt Magoffin (spamsqr@msqr.us)
 * 
 * This program is free software; you can redistribute it and/or 
 * modify it under the terms of the GNU General Public License as 
 * published by the Free Software Foundation; either version 2 of 
 * the License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful, 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
 * General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License 
 * along with this program; if not, write to the Free Software 
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 
 * 02111-1307 USA
 * ===================================================================
 * $Id: ImportRecipeMLTest.java 30 2009-05-04 01:53:34Z msqr $
 * ===================================================================
 */

package magoffin.matt.ieat.biz.test;

import java.io.InputStream;

import magoffin.matt.ieat.biz.RecipeIOBiz;
import magoffin.matt.ieat.domain.Recipe;
import magoffin.matt.ieat.test.AbstractSpringEnabledTest;

/**
 * Test case for importing a RecipeML recipe.
 * 
 * @author Matt Magoffin (spamsqr@msqr.us)
 * @version $Revision: 30 $ $Date: 2009-05-04 13:53:34 +1200 (Mon, 04 May 2009) $
 */
public class ImportRecipeMLTest extends AbstractSpringEnabledTest {

	/**
	 * Test able to load recipe ML.
	 * @throws Exception if any error occurs
	 */
    public void testImportHoaxRecipeML() throws Exception {
        InputStream hoaxIn = this.getClass().getClassLoader().getResourceAsStream(
                "magoffin/matt/ieat/biz/test/data/recipeml/hoax.xml");
        assertTrue("hoax XML resource should not be null",hoaxIn != null);
        
        RecipeIOBiz rioBiz = getRecipeIOBiz();
        Recipe hoaxRecipe = rioBiz.createFromRecipeML(hoaxIn);
        
        assertTrue("Imported RecipeML Recipe should not be null",hoaxRecipe != null);
    }
    
    /**
     * @return the RecipeIOBiz
     */
	protected RecipeIOBiz getRecipeIOBiz() {
		return (RecipeIOBiz)getContext().getBean("recipeIOBiz");
	}

}
