1/*2 * $Id: TestAlternateTilesContainerFactory.java 831448 2009-10-30 20:39:52Z apetrelli $3 *4 * Licensed to the Apache Software Foundation (ASF) under one5 * or more contributor license agreements. See the NOTICE file6 * distributed with this work for additional information7 * regarding copyright ownership. The ASF licenses this file8 * to you under the Apache License, Version 2.0 (the9 * "License"); you may not use this file except in compliance10 * with the License. You may obtain a copy of the License at11 *12 * http://www.apache.org/licenses/LICENSE-2.013 *14 * Unless required by applicable law or agreed to in writing,15 * software distributed under the License is distributed on an16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY17 * KIND, either express or implied. See the License for the18 * specific language governing permissions and limitations19 * under the License.20 */2122package org.apache.tiles.test.alt;
2324import java.io.IOException;
25import java.net.URL;
26import java.util.ArrayList;
27import java.util.List;
2829import org.apache.tiles.TilesApplicationContext;
30import org.apache.tiles.context.TilesRequestContextFactory;
31import org.apache.tiles.definition.DefinitionsFactoryException;
32import org.apache.tiles.definition.dao.BaseLocaleUrlDefinitionDAO;
33import org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO;
34import org.apache.tiles.locale.LocaleResolver;
35import org.apache.tiles.test.factory.TestTilesContainerFactory;
3637/***38 * Test alternate Tiles container factory to customize Tiles behaviour.39 *40 * @version $Rev: 831448 $ $Date: 2009-10-30 21:39:52 +0100 (ven, 30 ott 2009) $41 */42publicclassTestAlternateTilesContainerFactoryextends TestTilesContainerFactory {
4344/***45 * The number of URLs to load..46 */47privatestaticfinalint URL_COUNT = 3;
4849/*** {@inheritDoc} */50 @Override
51protected List<URL> getSourceURLs(TilesApplicationContext applicationContext,
52 TilesRequestContextFactory contextFactory) {
53 List<URL> urls = new ArrayList<URL>(URL_COUNT);
54try {
55 urls.add(applicationContext.getResource("classpath:/org/apache/tiles/test/alt/defs/tiles-alt-defs.xml"));
56 urls.add(applicationContext.getResource("classpath:/org/apache/tiles/test/alt/defs/tiles-alt-freemarker-defs.xml"));
57 urls.add(applicationContext.getResource("classpath:/org/apache/tiles/test/alt/defs/tiles-alt-velocity-defs.xml"));
58 } catch (IOException e) {
59thrownew DefinitionsFactoryException(
60"Cannot load definition URLs", e);
61 }
62return urls;
63 }
6465/*** {@inheritDoc} */66 @Override
67protected BaseLocaleUrlDefinitionDAO instantiateLocaleDefinitionDao(
68 TilesApplicationContext applicationContext,
69 TilesRequestContextFactory contextFactory, LocaleResolver resolver) {
70returnnew CachingLocaleUrlDefinitionDAO();
71 }
72 }