1 /* Copyright 2009, Sebastian Prehn 2 * 3 * This file is part of Servlet Utilities 4 * 5 * Servlet Utilities is free software: you can redistribute it and/or modify 6 * it under the terms of the Lesser GNU General Public License as published by 7 * the Free Software Foundation, either version 3 of the License, or 8 * (at your option) any later version. 9 * 10 * Servlet Utilities is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the Lesser GNU General Public License 16 * along with Servlet Utilities. If not, see <http://www.gnu.org/licenses/>. 17 * 18 * Versioning: 19 * $LastChangedDate$ 20 * $LastChangedRevision$ 21 */ 22 package org.jcr_blog.persistence; 23 24 import java.io.File; 25 import javax.enterprise.context.ApplicationScoped; 26 import javax.enterprise.inject.Disposes; 27 import javax.enterprise.inject.Produces; 28 import javax.inject.Named; 29 import org.apache.commons.io.FileUtils; 30 import org.apache.jackrabbit.core.TransientRepository; 31 32 /** 33 * 34 * @author Sebastian Prehn <sebastian.prehn@planetswebdesign.de> 35 */ 36 public class RepositoryProviderMock { 37 38 @Produces 39 @Named 40 @ApplicationScoped 41 public TransientRepository getRepository() { 42 return new TransientRepository("src/test/resources/repository.xml", "target/repository"); 43 } 44 45 public void cleanup(@Disposes final TransientRepository repository) { 46 repository.shutdown(); 47 FileUtils.deleteQuietly(new File("target/repository")); 48 } 49 }