Project Tiles has retired. For details please refer to its Attic page.
TestAlternateTilesContainerFactory xref
View Javadoc

1   /*
2    * $Id: TestAlternateTilesContainerFactory.java 1297705 2012-03-06 20:44:30Z nlebas $
3    *
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   * http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  package org.apache.tiles.test.alt;
23  
24  import java.util.ArrayList;
25  import java.util.List;
26  
27  import org.apache.tiles.definition.dao.BaseLocaleUrlDefinitionDAO;
28  import org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO;
29  import org.apache.tiles.locale.LocaleResolver;
30  import org.apache.tiles.request.ApplicationContext;
31  import org.apache.tiles.request.ApplicationResource;
32  import org.apache.tiles.test.factory.TestTilesContainerFactory;
33  
34  /**
35   * Test alternate Tiles container factory to customize Tiles behaviour.
36   *
37   * @version $Rev: 1297705 $ $Date: 2012-03-07 07:44:30 +1100 (Wed, 07 Mar 2012) $
38   */
39  public class TestAlternateTilesContainerFactory extends TestTilesContainerFactory {
40  
41      /**
42       * The number of URLs to load..
43       */
44      private static final int URL_COUNT = 3;
45  
46      /** {@inheritDoc} */
47      @Override
48      protected List<ApplicationResource> getSources(ApplicationContext applicationContext) {
49          List<ApplicationResource> urls = new ArrayList<ApplicationResource>(URL_COUNT);
50          urls.add(applicationContext.getResource("classpath:/org/apache/tiles/test/alt/defs/tiles-alt-defs.xml"));
51          urls.add(applicationContext.getResource("classpath:/org/apache/tiles/test/alt/defs/tiles-alt-freemarker-defs.xml"));
52          urls.add(applicationContext.getResource("classpath:/org/apache/tiles/test/alt/defs/tiles-alt-velocity-defs.xml"));
53          return urls;
54      }
55  
56      /** {@inheritDoc} */
57      @Override
58      protected BaseLocaleUrlDefinitionDAO instantiateLocaleDefinitionDao(
59              ApplicationContext applicationContext,
60              LocaleResolver resolver) {
61          return new CachingLocaleUrlDefinitionDAO(applicationContext);
62      }
63  }