1   package org.apache.fulcrum.yaafi.baseservice;
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  
23  import java.io.File;
24  
25  import org.apache.fulcrum.yaafi.testcontainer.BaseUnitTest;
26  
27  /**
28   * Test suite for the project
29   *
30   * @author <a href="mailto:siegfried.goeschl@it20one.at">Siegfried Goeschl</a>
31   */
32  
33  public class DerivedServiceTest extends BaseUnitTest
34  {
35      /**
36       * Constructor
37       * @param name the name of the test case
38       */
39      public DerivedServiceTest( String name )
40      {
41          super(name);
42      }
43  
44      /**
45       * Lookup the service and invoke the test() method
46       * @throws Exception invocation failed
47       */
48      public void testDerivedService() throws Exception
49      {
50          DerivedService derivedService = (DerivedService) this.lookup(
51              DerivedService.class.getName()
52              );
53  
54          // invoke the test() method on the service
55  
56          derivedService.test();
57  
58          // determine absolute paths and files
59  
60          String fileName = "./src/test/TestRoleConfig.xml";
61          String absolutePath = derivedService.createAbsolutePath(fileName);
62          File absoluteFile = derivedService.createAbsoluteFile(fileName);
63  
64          assertTrue(absoluteFile.isAbsolute());
65          assertTrue(absoluteFile.exists());
66          assertTrue(new File(absolutePath).isAbsolute());
67          assertTrue(new File(absolutePath).exists());
68      }
69  }