1   package org.apache.turbine.services.security.torque;
2   
3   /*
4    * Copyright 2001-2005 The Apache Software Foundation.
5    *
6    * Licensed under the Apache License, Version 2.0 (the "License")
7    * you may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    *
10   *     http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  
19  import junit.framework.Test;
20  import junit.framework.TestSuite;
21  
22  import org.apache.turbine.Turbine;
23  import org.apache.turbine.services.security.SecurityService;
24  import org.apache.turbine.services.security.TurbineSecurity;
25  
26  import org.apache.turbine.test.HsqlDB;
27  
28  import org.apache.turbine.test.BaseTurbineTest;
29  
30  public class TestTorqueSecurity
31          extends BaseTurbineTest
32  {
33      public static final String DATA_SOURCE="turbine";
34  
35      private HsqlDB hsqlDB = null;
36  
37      public TestTorqueSecurity(String name)
38              throws Exception
39      {
40          super(name, "conf/test/TurbineResources.properties");
41          hsqlDB = new HsqlDB("jdbc:hsqldb:.", Turbine.getRealPath("conf/test/create-db.sql"));
42      }
43  
44      public static Test suite()
45      {
46          return new TestSuite(TestTorqueSecurity.class);
47      }
48  
49      public void testInit()
50      {
51          SecurityService ss = TurbineSecurity.getService();
52  
53          assertEquals("No Torque Security Service", ss.getClass(), TorqueSecurityService.class);
54          assertEquals("No Torque User Manager", ss.getUserManager().getClass(), TorqueUserManager.class);
55          assertTrue("Service failed to initialize", ss.getInit());
56      }
57  }