You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by sg...@apache.org on 2005/05/09 14:00:40 UTC
cvs commit: jakarta-turbine-fulcrum/yaafi/src/test/org/apache/fulcrum/yaafi/baseservice DerivedService.java DerivedServiceImpl.java DerivedServiceTest.java
sgoeschl 2005/05/09 05:00:40
Added: yaafi/src/test/org/apache/fulcrum/yaafi/baseservice
DerivedService.java DerivedServiceImpl.java
DerivedServiceTest.java
Log:
Tests for the BaseService implementation
Revision Changes Path
1.1 jakarta-turbine-fulcrum/yaafi/src/test/org/apache/fulcrum/yaafi/baseservice/DerivedService.java
Index: DerivedService.java
===================================================================
package org.apache.fulcrum.yaafi.baseservice;
import java.io.File;
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* This is a simple component that is only used to test the avalon component
* service.
*
* @author <a href="mailto:quintonm@bellsouth.net">Quinton McCombs</a>
*/
public interface DerivedService
{
void test() throws Exception;
String createAbsolutePath(String fileName);
File createAbsoluteFile(String fileName);
}
1.1 jakarta-turbine-fulcrum/yaafi/src/test/org/apache/fulcrum/yaafi/baseservice/DerivedServiceImpl.java
Index: DerivedServiceImpl.java
===================================================================
package org.apache.fulcrum.yaafi.baseservice;
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import java.io.File;
import org.apache.fulcrum.yaafi.service.baseservice.BaseServiceImpl;
/**
* Implementation of the test component.
*
* @author <a href="mailto:quintonm@bellsouth.net">Quinton McCombs</a>
*/
public class DerivedServiceImpl
extends BaseServiceImpl
implements DerivedService
{
/**
* @see org.apache.fulcrum.yaafi.baseservice.DerivedService#test()
*/
public void test() throws Exception
{
this.getLogger().debug(this.toString());
}
/**
* @see org.apache.fulcrum.yaafi.service.baseservice.BaseServiceImpl#createAbsoluteFile(java.lang.String)
*/
public File createAbsoluteFile(String fileName)
{
return super.createAbsoluteFile( fileName );
}
/**
* @see org.apache.fulcrum.yaafi.service.baseservice.BaseServiceImpl#createAbsolutePath(java.lang.String)
*/
public String createAbsolutePath(String fileName)
{
return super.createAbsolutePath( fileName );
}
}
1.1 jakarta-turbine-fulcrum/yaafi/src/test/org/apache/fulcrum/yaafi/baseservice/DerivedServiceTest.java
Index: DerivedServiceTest.java
===================================================================
package org.apache.fulcrum.yaafi.baseservice;
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import java.io.File;
import org.apache.fulcrum.yaafi.testcontainer.BaseUnitTest;
/**
* Test suite for the project
*
* @author <a href="mailto:siegfried.goeschl@it20one.at">Siegfried Goeschl</a>
*/
public class DerivedServiceTest extends BaseUnitTest
{
/**
* Constructor
* @param name the name of the test case
*/
public DerivedServiceTest( String name )
{
super(name);
}
/**
* Lookup the service and invoke the test() method
* @throws Exception invocation failed
*/
public void testDerivedService() throws Exception
{
DerivedService derivedService = (DerivedService) this.lookup(
DerivedService.class.getName()
);
// invoke the test() method on the service
derivedService.test();
// determine absolute paths and files
String fileName = "./src/test/TestRoleConfig.xml";
String absolutePath = derivedService.createAbsolutePath(fileName);
File absoluteFile = derivedService.createAbsoluteFile(fileName);
assertTrue(absoluteFile.isAbsolute());
assertTrue(absoluteFile.exists());
assertTrue(new File(absolutePath).isAbsolute());
assertTrue(new File(absolutePath).exists());
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org