Author: mcconnell Date: Thu Jun 10 07:11:27 2004 New Revision: 21010 Added: avalon/trunk/runtime/test/components/ avalon/trunk/runtime/test/components/build.properties (contents, props changed) avalon/trunk/runtime/test/components/build.xml (contents, props changed) avalon/trunk/runtime/test/components/src/ avalon/trunk/runtime/test/components/src/main/ avalon/trunk/runtime/test/components/src/main/org/ avalon/trunk/runtime/test/components/src/main/org/apache/ avalon/trunk/runtime/test/components/src/main/org/apache/avalon/ avalon/trunk/runtime/test/components/src/main/org/apache/avalon/test/ avalon/trunk/runtime/test/components/src/main/org/apache/avalon/test/components/ avalon/trunk/runtime/test/components/src/main/org/apache/avalon/test/components/AnotherTestComponent.java (contents, props changed) avalon/trunk/runtime/test/components/src/main/org/apache/avalon/test/components/AnotherTestService.java (contents, props changed) avalon/trunk/runtime/test/components/src/main/org/apache/avalon/test/components/TestComponent.java (contents, props changed) avalon/trunk/runtime/test/components/src/main/org/apache/avalon/test/components/TestService.java (contents, props changed) Log: add the test components used in the activation package
Added: avalon/trunk/runtime/test/components/build.properties ============================================================================== --- (empty file) +++ avalon/trunk/runtime/test/components/build.properties Thu Jun 10 07:11:27 2004 @@ -0,0 +1,2 @@ +project.name = avalon-test-components +project.home = ../../../central/system Added: avalon/trunk/runtime/test/components/build.xml ============================================================================== --- (empty file) +++ avalon/trunk/runtime/test/components/build.xml Thu Jun 10 07:11:27 2004 @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<project name="avalon-test-components" default="dist" basedir="." + xmlns:x="antlib:org.apache.avalon.tools" + xmlns:m="plugin:avalon/meta/avalon-meta-tools" > + + <property file="build.properties"/> + <import file="${project.home}/build/standard.xml"/> + + <target name="build" depends="standard.build"> + <m:meta destDir="${basedir}/target/classes"> + <fileset dir="${basedir}/src/main"> + <include name="**/*.java"/> + </fileset> + </m:meta> + </target> + +</project> Added: avalon/trunk/runtime/test/components/src/main/org/apache/avalon/test/components/AnotherTestComponent.java ============================================================================== --- (empty file) +++ avalon/trunk/runtime/test/components/src/main/org/apache/avalon/test/components/AnotherTestComponent.java Thu Jun 10 07:11:27 2004 @@ -0,0 +1,61 @@ +/* + * Copyright 2004 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. + */ + +package org.apache.avalon.test.components; + +import org.apache.avalon.framework.logger.AbstractLogEnabled; +import org.apache.avalon.framework.service.Serviceable; +import org.apache.avalon.framework.service.ServiceException; +import org.apache.avalon.framework.service.ServiceManager; + +/** + * This is a component that can be tested relative a set of + * assigned permissions. + * + * @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a> + * @avalon.component name="anothertest" lifestyle="singleton" + * @avalon.service + * type="org.apache.avalon.test.components.AnotherTestService" + */ +public class AnotherTestComponent extends AbstractLogEnabled + implements AnotherTestService, Serviceable +{ + private TestService m_TestService; + + /** + * Service from the container. + * + * @avalon.dependency + * type="org.apache.avalon.test.components.TestService" + * key="TestService" + */ + public void service( ServiceManager man ) + throws ServiceException + { + m_TestService = (TestService) man.lookup( "TestService" ); + } + + public String getJavaVersion() + { + return m_TestService.getJavaVersion(); + } + + public void setJavaVersion( String newVersion ) + { + m_TestService.setJavaVersion( newVersion ); + } +} Added: avalon/trunk/runtime/test/components/src/main/org/apache/avalon/test/components/AnotherTestService.java ============================================================================== --- (empty file) +++ avalon/trunk/runtime/test/components/src/main/org/apache/avalon/test/components/AnotherTestService.java Thu Jun 10 07:11:27 2004 @@ -0,0 +1,44 @@ +/* + * Copyright 2004 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. + */ + +package org.apache.avalon.test.components; + +import java.io.File; + +import org.apache.avalon.framework.logger.AbstractLogEnabled; +import org.apache.avalon.framework.context.Contextualizable; +import org.apache.avalon.framework.context.ContextException; +import org.apache.avalon.framework.context.Context; + +/** + * This is a component that can be tested relative a set of + * assigned permissions. + * + * @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a> + */ +public interface AnotherTestService +{ + /** + * Returns the version of the Java Virtual Machine. + */ + String getJavaVersion(); + + /** + * Sets the version of the Java Virtual Machine. + */ + void setJavaVersion( String newVer ); +} Added: avalon/trunk/runtime/test/components/src/main/org/apache/avalon/test/components/TestComponent.java ============================================================================== --- (empty file) +++ avalon/trunk/runtime/test/components/src/main/org/apache/avalon/test/components/TestComponent.java Thu Jun 10 07:11:27 2004 @@ -0,0 +1,96 @@ +/* + * Copyright 2004 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. + */ + +package org.apache.avalon.test.components; + +import java.io.File; + +import org.apache.avalon.framework.logger.AbstractLogEnabled; +import org.apache.avalon.framework.context.Contextualizable; +import org.apache.avalon.framework.context.ContextException; +import org.apache.avalon.framework.context.Context; + +/** + * This is a component that can be tested relative a set of + * assigned permissions. + * + * @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a> + * @avalon.component name="test" lifestyle="singleton" + * @avalon.service type="org.apache.avalon.test.components.TestService" + * @avalon.security.permission class="java.io.FilePermission" + * name="urn:avalon:home" + * actions="read,write" + */ +public class TestComponent extends AbstractLogEnabled + implements Contextualizable, TestService +{ + //---------------------------------------------------------------------- + // state + //---------------------------------------------------------------------- + + private File m_home; + + //---------------------------------------------------------------------- + // Contextualizable + //---------------------------------------------------------------------- + + /** + * @avalon.entry type="java.io.File" key="urn:avalon:home" + */ + public void contextualize( Context context ) throws ContextException + { + m_home = (File) context.get( "urn:avalon:home" ); + } + + //---------------------------------------------------------------------- + // TestService + //---------------------------------------------------------------------- + + /** + * Does something trivial. + */ + public void createDirectory() + { + m_home.mkdirs(); + } + + /** + * Does something trivial. + */ + public void deleteDirectory() + { + m_home.delete(); + } + + /** + * @avalon.security.permission class="java.util.PropertyPermission" + * name="java.version" actions="read" + */ + public String getJavaVersion() + { + return System.getProperty( "java.version" ); + } + + /** + * @avalon.security.permission class="java.util.PropertyPermission" + * name="java.version" actions="write" + */ + public void setJavaVersion( String newVer ) + { + System.setProperty( "java.version", newVer ); + } +} Added: avalon/trunk/runtime/test/components/src/main/org/apache/avalon/test/components/TestService.java ============================================================================== --- (empty file) +++ avalon/trunk/runtime/test/components/src/main/org/apache/avalon/test/components/TestService.java Thu Jun 10 07:11:27 2004 @@ -0,0 +1,54 @@ +/* + * Copyright 2004 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. + */ + +package org.apache.avalon.test.components; + +import java.io.File; + +import org.apache.avalon.framework.logger.AbstractLogEnabled; +import org.apache.avalon.framework.context.Contextualizable; +import org.apache.avalon.framework.context.ContextException; +import org.apache.avalon.framework.context.Context; + +/** + * This is a component that can be tested relative a set of + * assigned permissions. + * + * @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a> + */ +public interface TestService +{ + /** + * Create a test directory + */ + void createDirectory(); + + /** + * Delete a test directory + */ + void deleteDirectory(); + + /** + * Returns the version of the Java Virtual Machine. + **/ + String getJavaVersion(); + + /** + * Sets the version of the Java Virtual Machine. + **/ + void setJavaVersion( String newVer ); +} --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]