continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From car...@apache.org
Subject svn commit: r433476 - in /maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src: main/java/org/apache/maven/continuum/security/acegi/acl/ test/java/org/apache/maven/continuum/security/acegi/acl/ test/resources/org/apa...
Date Tue, 22 Aug 2006 02:42:23 GMT
Author: carlos
Date: Mon Aug 21 19:42:23 2006
New Revision: 433476

URL: http://svn.apache.org/viewvc?rev=433476&view=rev
Log:
Add Aclinitializer test for plexus and minor fixes

Added:
    maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/test/java/org/apache/maven/continuum/security/acegi/acl/AclInitializerPlexusTest.java
  (with props)
    maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/test/resources/org/apache/maven/continuum/security/acegi/acl/AclInitializerPlexusTest.xml
  (with props)
Modified:
    maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/main/java/org/apache/maven/continuum/security/acegi/acl/AclInitializer.java
    maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/test/java/org/apache/maven/continuum/security/acegi/acl/AclInitializerTest.java

Modified: maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/main/java/org/apache/maven/continuum/security/acegi/acl/AclInitializer.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/main/java/org/apache/maven/continuum/security/acegi/acl/AclInitializer.java?rev=433476&r1=433475&r2=433476&view=diff
==============================================================================
--- maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/main/java/org/apache/maven/continuum/security/acegi/acl/AclInitializer.java
(original)
+++ maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/main/java/org/apache/maven/continuum/security/acegi/acl/AclInitializer.java
Mon Aug 21 19:42:23 2006
@@ -36,6 +36,7 @@
     extends AbstractLogEnabled
     implements Initializable
 {
+    public static final String ROLE = AclInitializer.class.getName();
 
     private JdbcExtendedDaoImpl dao;
 
@@ -64,6 +65,12 @@
     public void initialize()
         throws InitializationException
     {
+
+        if ( getSqlMojo().getPassword() == null )
+        {
+            getSqlMojo().setPassword( "" );
+        }
+
         try
         {
             getSqlMojo().execute();
@@ -78,6 +85,9 @@
         {
             /* tables were created, insert default values */
             getLogger().info( "Initializing ACL database" );
+
+            /* execute Spring initialization callback */
+            getDao().afterPropertiesSet();
 
             /* admin can do anything with project number 1 */
             SimpleAclEntry aclEntry = new SimpleAclEntry();

Added: maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/test/java/org/apache/maven/continuum/security/acegi/acl/AclInitializerPlexusTest.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/test/java/org/apache/maven/continuum/security/acegi/acl/AclInitializerPlexusTest.java?rev=433476&view=auto
==============================================================================
--- maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/test/java/org/apache/maven/continuum/security/acegi/acl/AclInitializerPlexusTest.java
(added)
+++ maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/test/java/org/apache/maven/continuum/security/acegi/acl/AclInitializerPlexusTest.java
Mon Aug 21 19:42:23 2006
@@ -0,0 +1,55 @@
+package org.apache.maven.continuum.security.acegi.acl;
+
+/*
+ * Copyright 2006 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 javax.sql.DataSource;
+
+import org.acegisecurity.acl.basic.jdbc.JdbcExtendedDaoImpl;
+import org.apache.commons.dbcp.BasicDataSource;
+import org.codehaus.mojo.sql.SqlExecMojo;
+import org.codehaus.plexus.PlexusTestCase;
+import org.codehaus.plexus.logging.Logger;
+import org.codehaus.plexus.logging.console.ConsoleLogger;
+
+/**
+ * Test for {@link AclInitializer} using Plexus to inject dependencies
+ * 
+ * @author <a href="mailto:carlos@apache.org">Carlos Sanchez</a>
+ * @version $Id$
+ */
+public class AclInitializerPlexusTest
+    extends PlexusTestCase
+{
+
+    private AclInitializer initializer;
+
+    protected void setUp()
+        throws Exception
+    {
+        super.setUp();
+        initializer = (AclInitializer) super.lookup( AclInitializer.ROLE );
+    }
+
+    public void testInitialize()
+        throws Exception
+    {
+        initializer.initialize();
+        initializer.initialize();
+    }
+}

Propchange: maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/test/java/org/apache/maven/continuum/security/acegi/acl/AclInitializerPlexusTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/test/java/org/apache/maven/continuum/security/acegi/acl/AclInitializerPlexusTest.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Modified: maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/test/java/org/apache/maven/continuum/security/acegi/acl/AclInitializerTest.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/test/java/org/apache/maven/continuum/security/acegi/acl/AclInitializerTest.java?rev=433476&r1=433475&r2=433476&view=diff
==============================================================================
--- maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/test/java/org/apache/maven/continuum/security/acegi/acl/AclInitializerTest.java
(original)
+++ maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/test/java/org/apache/maven/continuum/security/acegi/acl/AclInitializerTest.java
Mon Aug 21 19:42:23 2006
@@ -62,8 +62,6 @@
         JdbcExtendedDaoImpl dao = new JdbcExtendedDaoImpl();
         dao.setDataSource( getDataSource() );
         initializer.setDao( dao );
-
-        dao.afterPropertiesSet();
     }
 
     public void testInitialize()

Added: maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/test/resources/org/apache/maven/continuum/security/acegi/acl/AclInitializerPlexusTest.xml
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/test/resources/org/apache/maven/continuum/security/acegi/acl/AclInitializerPlexusTest.xml?rev=433476&view=auto
==============================================================================
--- maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/test/resources/org/apache/maven/continuum/security/acegi/acl/AclInitializerPlexusTest.xml
(added)
+++ maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/test/resources/org/apache/maven/continuum/security/acegi/acl/AclInitializerPlexusTest.xml
Mon Aug 21 19:42:23 2006
@@ -0,0 +1,59 @@
+<plexus>
+
+  <components>
+
+    <component>
+      <role>org.apache.maven.continuum.security.acegi.acl.AclInitializer</role>
+      <implementation>org.apache.maven.continuum.security.acegi.acl.AclInitializer</implementation>
+      <requirements>
+        <requirement>
+          <role>org.codehaus.mojo.sql.SqlExecMojo</role>
+          <field-name>sqlMojo</field-name>
+        </requirement>
+        <requirement>
+          <role>org.acegisecurity.acl.basic.BasicAclDao</role>
+          <field-name>dao</field-name>
+        </requirement>
+      </requirements>
+    </component>
+
+    <component>
+      <role>javax.sql.DataSource</role>
+      <implementation>org.apache.commons.dbcp.BasicDataSource</implementation>
+      <configuration>
+        <driverClassName>org.apache.derby.jdbc.EmbeddedDriver</driverClassName>
+        <url>jdbc:derby:${plexus.home}/database;create=true</url>
+        <username>sa</username>
+      </configuration>
+    </component>
+
+    <component>
+      <role>org.acegisecurity.acl.basic.BasicAclDao</role>
+      <implementation>org.acegisecurity.acl.basic.jdbc.JdbcExtendedDaoImpl</implementation>
+      <component-composer>setter</component-composer>
+      <requirements>
+        <requirement>
+          <role>javax.sql.DataSource</role>
+          <field-name>dataSource</field-name>
+        </requirement>
+      </requirements>
+    </component>
+
+    <component>
+      <role>org.codehaus.mojo.sql.SqlExecMojo</role>
+      <implementation>org.codehaus.mojo.sql.SqlExecMojo</implementation>
+      <configuration>
+        <username>sa</username>
+        <password></password>
+        <driver>org.apache.derby.jdbc.EmbeddedDriver</driver>
+        <url>jdbc:derby:${plexus.home}/database;create=true</url>
+        <onError>continue</onError>
+        <srcFiles>
+          <file>src/main/resources/org/apache/maven/continuum/security/acegi/acl/acegi-acl-derby.sql</file>
+        </srcFiles>
+      </configuration>
+    </component>
+
+  </components>
+
+</plexus>

Propchange: maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/test/resources/org/apache/maven/continuum/security/acegi/acl/AclInitializerPlexusTest.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/test/resources/org/apache/maven/continuum/security/acegi/acl/AclInitializerPlexusTest.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"



Mime
View raw message