    1   package org.apache.turbine.services.mimetype;
    2
    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  import java.util.Locale;
    23
    24  import org.apache.fulcrum.mimetype.MimeTypeService;
    25  import org.apache.turbine.services.ServiceManager;
    26  import org.apache.turbine.services.TurbineServices;
    27  import org.apache.turbine.test.BaseTestCase;
    28  import org.apache.turbine.util.TurbineConfig;
    29
    30  /**
    31   * Unit test for Accessing the Fulcrum Mimetype component within Turbine.
    32   *
    33   * @author <a href="mailto:epugh@upstate.com">Eric Pugh</a>
    34   * @author <a href="mailto:sgoeschl@apache.org">Siegfried Goeschl</a>
    35   * @version $Id: FulcrumMimetypeComponentTest.java 615328 2008-01-25 20:25:05Z tv $
    36   */
    37  public class FulcrumMimetypeComponentTest extends BaseTestCase
    38  {
    39      private static TurbineConfig tc = null;
    40      public FulcrumMimetypeComponentTest(String name) throws Exception
    41      {
    42          super(name);
    43      }
    44      public void testComponent() throws Exception
    45      {
    46          ServiceManager serviceManager = TurbineServices.getInstance();
    47          MimeTypeService mimeTypeService = (MimeTypeService) serviceManager.getService(MimeTypeService.class.getName());
    48
    49          Locale locale = new Locale("en", "US");
    50          String s = mimeTypeService.getCharSet(locale);
    51          assertEquals("ISO-8859-1", s);
    52      }
    53
    54      public void setUp() throws Exception
    55      {
    56          tc =
    57              new TurbineConfig(
    58                  ".",
    59                  "/conf/test/TestFulcrumComponents.properties");
    60          tc.initialize();
    61      }
    62      public void tearDown() throws Exception
    63      {
    64          if (tc != null)
    65          {
    66              tc.dispose();
    67          }
    68      }
    69  }