You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@turbine.apache.org by tv...@apache.org on 2007/07/05 13:40:54 UTC

svn commit: r553461 - in /turbine/fulcrum/trunk/yaafi/contrib: ./ java/ test/ test/org/ test/org/apache/ test/org/apache/fulcrum/ test/org/apache/fulcrum/yaafi/ test/org/apache/fulcrum/yaafi/framework/ test/org/apache/fulcrum/yaafi/framework/configurat...

Author: tv
Date: Thu Jul  5 04:40:53 2007
New Revision: 553461

URL: http://svn.apache.org/viewvc?view=rev&rev=553461
Log:
Added Properties Resolver based on Commons Configuration

Added:
    turbine/fulcrum/trunk/yaafi/contrib/java/
    turbine/fulcrum/trunk/yaafi/contrib/project.xml   (with props)
    turbine/fulcrum/trunk/yaafi/contrib/test/
    turbine/fulcrum/trunk/yaafi/contrib/test/org/
    turbine/fulcrum/trunk/yaafi/contrib/test/org/apache/
    turbine/fulcrum/trunk/yaafi/contrib/test/org/apache/fulcrum/
    turbine/fulcrum/trunk/yaafi/contrib/test/org/apache/fulcrum/yaafi/
    turbine/fulcrum/trunk/yaafi/contrib/test/org/apache/fulcrum/yaafi/framework/
    turbine/fulcrum/trunk/yaafi/contrib/test/org/apache/fulcrum/yaafi/framework/configuration/
    turbine/fulcrum/trunk/yaafi/contrib/test/org/apache/fulcrum/yaafi/framework/configuration/C4PResolverTest.java   (with props)
    turbine/fulcrum/trunk/yaafi/contrib/test/org/apache/fulcrum/yaafi/framework/configuration/TestComponent.java   (with props)
    turbine/fulcrum/trunk/yaafi/contrib/test/org/apache/fulcrum/yaafi/framework/configuration/TestComponentImpl.java   (with props)

Added: turbine/fulcrum/trunk/yaafi/contrib/project.xml
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/yaafi/contrib/project.xml?view=auto&rev=553461
==============================================================================
--- turbine/fulcrum/trunk/yaafi/contrib/project.xml (added)
+++ turbine/fulcrum/trunk/yaafi/contrib/project.xml Thu Jul  5 04:40:53 2007
@@ -0,0 +1,69 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you 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.
+-->
+<project>
+  <extend>${basedir}/../project.xml</extend>
+  <id>fulcrum-yaafi-c4presolver</id>
+  <name>Fulcrum's YAAFI Properties Resolver for Commons Configuration</name>
+
+  <dependencies>
+    <dependency>
+      <groupId>fulcrum</groupId>
+      <artifactId>fulcrum-yaafi</artifactId>
+      <version>${pom.currentVersion}</version>
+      <url>http://turbine.apache.org/fulcrum/yaafi/</url>
+    </dependency>
+    <dependency>
+      <groupId>commons-collections</groupId>
+      <artifactId>commons-collections</artifactId>
+      <version>3.2</version>
+      <url>http://jakarta.apache.org/commons/collections/</url>
+    </dependency>
+    <dependency>
+      <groupId>commons-configuration</groupId>
+      <artifactId>commons-configuration</artifactId>
+      <version>1.4</version>
+      <url>http://jakarta.apache.org/commons/configuration/</url>
+    </dependency>
+    <dependency>
+      <groupId>commons-lang</groupId>
+      <artifactId>commons-lang</artifactId>
+      <version>2.3</version>
+      <url>http://jakarta.apache.org/commons/lang/</url>
+    </dependency>
+    <dependency>
+      <groupId>commons-logging</groupId>
+      <artifactId>commons-logging</artifactId>
+      <version>1.1</version>
+      <url>http://jakarta.apache.org/commons/logging/</url>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <sourceDirectory>${basedir}/java</sourceDirectory>
+    <unitTestSourceDirectory>${basedir}/test</unitTestSourceDirectory>
+    <unitTest>
+      <includes>
+        <include>**/*Test.java</include>
+      </includes>
+    </unitTest>
+  </build>
+
+</project>
+

Propchange: turbine/fulcrum/trunk/yaafi/contrib/project.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: turbine/fulcrum/trunk/yaafi/contrib/test/org/apache/fulcrum/yaafi/framework/configuration/C4PResolverTest.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/yaafi/contrib/test/org/apache/fulcrum/yaafi/framework/configuration/C4PResolverTest.java?view=auto&rev=553461
==============================================================================
--- turbine/fulcrum/trunk/yaafi/contrib/test/org/apache/fulcrum/yaafi/framework/configuration/C4PResolverTest.java (added)
+++ turbine/fulcrum/trunk/yaafi/contrib/test/org/apache/fulcrum/yaafi/framework/configuration/C4PResolverTest.java Thu Jul  5 04:40:53 2007
@@ -0,0 +1,65 @@
+package org.apache.fulcrum.yaafi.framework.configuration;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 junit.framework.TestCase;
+
+import org.apache.fulcrum.yaafi.framework.container.ServiceContainer;
+import org.apache.fulcrum.yaafi.framework.factory.ServiceContainerConfiguration;
+import org.apache.fulcrum.yaafi.framework.factory.ServiceContainerFactory;
+
+/**
+ * A test for the CommonsConfigurationCCPResolver
+ *
+ * @author <a href="mailto:tv@apache.org">Thomas Vandahl</a>
+ *
+ */
+public class C4PResolverTest extends TestCase
+{
+    ServiceContainer container;
+    TestComponent tc;
+
+    /**
+     * @param testName
+     */
+    public C4PResolverTest(String testName)
+    {
+        super(testName);
+    }
+
+    /**
+     * @see junit.framework.TestCase#setUp()
+     */
+    protected void setUp() throws Exception
+    {
+        super.setUp();
+        ServiceContainerConfiguration config = new ServiceContainerConfiguration();
+        config.loadContainerConfiguration( "./test/TestYaafiContainerConfig.xml" );
+        this.container = ServiceContainerFactory.create( config );
+        tc = (TestComponent)container.lookup(TestComponent.ROLE);
+    }
+
+    public void testTestComponent()
+    {
+        assertNotNull("TestComponent should not be null", tc);
+        assertEquals(tc.getFoo(), "yaafi-test");
+        assertEquals(tc.getFooBar(), "yaafi-test1");
+    }
+}

Propchange: turbine/fulcrum/trunk/yaafi/contrib/test/org/apache/fulcrum/yaafi/framework/configuration/C4PResolverTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: turbine/fulcrum/trunk/yaafi/contrib/test/org/apache/fulcrum/yaafi/framework/configuration/TestComponent.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/yaafi/contrib/test/org/apache/fulcrum/yaafi/framework/configuration/TestComponent.java?view=auto&rev=553461
==============================================================================
--- turbine/fulcrum/trunk/yaafi/contrib/test/org/apache/fulcrum/yaafi/framework/configuration/TestComponent.java (added)
+++ turbine/fulcrum/trunk/yaafi/contrib/test/org/apache/fulcrum/yaafi/framework/configuration/TestComponent.java Thu Jul  5 04:40:53 2007
@@ -0,0 +1,41 @@
+package org.apache.fulcrum.yaafi.framework.configuration;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 used to test the configuration resolver
+ *
+ * @author <a href="mailto:tv@apache.org">Thomas Vandahl</a>
+ */
+public interface TestComponent
+{
+    /** the role name of the service */
+    static final String ROLE = "org.apache.fulcrum.yaafi.framework.configuration.TestComponent";
+
+    /**
+     * @return Returns the foo.
+     */
+    String getFoo();
+
+    /**
+     * @return Returns the foo.
+     */
+    String getFooBar();
+}

Propchange: turbine/fulcrum/trunk/yaafi/contrib/test/org/apache/fulcrum/yaafi/framework/configuration/TestComponent.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: turbine/fulcrum/trunk/yaafi/contrib/test/org/apache/fulcrum/yaafi/framework/configuration/TestComponentImpl.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/yaafi/contrib/test/org/apache/fulcrum/yaafi/framework/configuration/TestComponentImpl.java?view=auto&rev=553461
==============================================================================
--- turbine/fulcrum/trunk/yaafi/contrib/test/org/apache/fulcrum/yaafi/framework/configuration/TestComponentImpl.java (added)
+++ turbine/fulcrum/trunk/yaafi/contrib/test/org/apache/fulcrum/yaafi/framework/configuration/TestComponentImpl.java Thu Jul  5 04:40:53 2007
@@ -0,0 +1,60 @@
+package org.apache.fulcrum.yaafi.framework.configuration;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 org.apache.avalon.framework.configuration.Configurable;
+import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.avalon.framework.configuration.ConfigurationException;
+import org.apache.avalon.framework.logger.AbstractLogEnabled;
+
+/**
+ * Implementation of the test component.
+ *
+ * @author <a href="mailto:tv@apache.org">Thomas Vandahl</a>
+ */
+public class TestComponentImpl
+        extends AbstractLogEnabled
+        implements TestComponent, Configurable
+{
+    public String foo;
+    public String foobar;
+
+    public void configure(Configuration configuration) throws ConfigurationException
+    {
+        this.foo = configuration.getChild("FOO").getValue("FOO Not Found?!");
+        this.foobar = configuration.getChild("FOOBAR").getValue("FOOBAR Not Found?!");
+    }
+
+    /**
+     * @return Returns the foo.
+     */
+    public String getFoo()
+    {
+        return foo;
+    }
+
+    /**
+     * @return Returns the bar.
+     */
+    public String getFooBar()
+    {
+        return foobar;
+    }
+}

Propchange: turbine/fulcrum/trunk/yaafi/contrib/test/org/apache/fulcrum/yaafi/framework/configuration/TestComponentImpl.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain