Set JPA as default and only database backend
Remove JDO dependencies and set the JPA implementations as only implementation for database backend providers. Uses the same database as JDO before.
This commit is contained in:
parent
96b6771e7f
commit
2add792524
18
pom.xml
18
pom.xml
|
@ -146,11 +146,6 @@
|
|||
<artifactId>redback-policy</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.archiva.redback</groupId>
|
||||
<artifactId>redback-common-jdo</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.archiva.redback</groupId>
|
||||
<artifactId>redback-common-ldap</artifactId>
|
||||
|
@ -183,7 +178,7 @@
|
|||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.archiva.redback</groupId>
|
||||
<artifactId>redback-keys-jdo</artifactId>
|
||||
<artifactId>redback-keys-jpa</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -216,11 +211,6 @@
|
|||
<artifactId>redback-users-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.archiva.redback</groupId>
|
||||
<artifactId>redback-users-jdo</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.archiva.redback</groupId>
|
||||
<artifactId>redback-users-jpa</artifactId>
|
||||
|
@ -276,11 +266,6 @@
|
|||
<artifactId>redback-rbac-cached</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.archiva.redback</groupId>
|
||||
<artifactId>redback-rbac-jdo</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.archiva.redback</groupId>
|
||||
<artifactId>redback-rbac-jpa</artifactId>
|
||||
|
@ -831,6 +816,7 @@
|
|||
<exclude>build-number.txt</exclude>
|
||||
<!-- IntelliJ IDEA files -->
|
||||
<exclude>.idea/**</exclude>
|
||||
<exclude>**/*.iml</exclude>
|
||||
<!-- Eclipse files -->
|
||||
<exclude>.project</exclude>
|
||||
<exclude>.classpath</exclude>
|
||||
|
|
|
@ -32,10 +32,13 @@
|
|||
<property name="openjpa.ConnectionDriverName" value="org.hsqldb.jdbcDriver"/>
|
||||
<property name="openjpa.ConnectionUserName" value="sa"/>
|
||||
<property name="openjpa.ConnectionPassword" value=""/>
|
||||
<property name="openjpa.Log" value="DefaultLevel=WARN, Tool=INFO"/>
|
||||
<property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>
|
||||
<property name="openjpa.jdbc.SchemaFactory" value="native(ForeignKeys=true)" />
|
||||
<property name="openjpa.jdbc.MappingDefaults"
|
||||
value="ForeignKeyDeleteAction=restrict,JoinForeignKeyDeleteAction=restrict"/>
|
||||
<property name="openjpa.Log" value="DefaultLevel=TRACE, Runtime=TRACE, Tool=INFO, SQL=TRACE"/>
|
||||
<property name="openjpa.jdbc.DBDictionary" value="(disableSchemaFactoryColumnTypeErrors=true,BitTypeName=CHAR(1),BooleanTypeName=CHAR(1),BooleanRepresentation=STRING_YN)"/>
|
||||
|
||||
</properties>
|
||||
</persistence-unit>
|
||||
</persistence>
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0">
|
||||
<persistence-unit name="redback-jpa">
|
||||
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
|
||||
<non-jta-data-source>java:comp/env/jdbc/redbackjpa</non-jta-data-source>
|
||||
<non-jta-data-source>java:comp/env/jdbc/users</non-jta-data-source>
|
||||
<class>org.apache.archiva.redback.users.jpa.model.JpaUser</class>
|
||||
<class>org.apache.archiva.redback.rbac.jpa.model.JpaOperation</class>
|
||||
<class>org.apache.archiva.redback.rbac.jpa.model.JpaResource</class>
|
||||
|
@ -31,10 +31,10 @@
|
|||
<properties>
|
||||
<property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>
|
||||
<property name="openjpa.jdbc.SchemaFactory" value="native(ForeignKeys=true)" />
|
||||
<property name="openjpa.jdbc.MappingDefaults"
|
||||
<property name="openjpa.jdbc.MappingDefaults"
|
||||
value="ForeignKeyDeleteAction=restrict,JoinForeignKeyDeleteAction=restrict"/>
|
||||
<property name="openjpa.Log" value="DefaultLevel=TRACE, Runtime=TRACE, Tool=INFO, SQL=TRACE"/>
|
||||
<property name="openjpa.jdbc.DBDictionary" value="(disableSchemaFactoryColumnTypeErrors=true,BitTypeName=CHAR(1),BooleanTypeName=CHAR(1),BooleanRepresentation=STRING_YN)"/>
|
||||
<property name="openjpa.Log" value="DefaultLevel=TRACE, Runtime=TRACE, Tool=INFO, SQL=TRACE"/>
|
||||
<property name="openjpa.jdbc.DBDictionary" value="(disableSchemaFactoryColumnTypeErrors=true,BitTypeName=CHAR(1),BooleanTypeName=CHAR(1),BooleanRepresentation=STRING_YN)"/>
|
||||
</properties>
|
||||
</persistence-unit>
|
||||
</persistence>
|
||||
|
|
|
@ -130,7 +130,7 @@ ldap.bind.authenticator.enabled=false
|
|||
#ldap.config.authentication.method=
|
||||
|
||||
# config parameter for the ConfigurableUserManager
|
||||
user.manager.impl=jdo
|
||||
user.manager.impl=jpa
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -35,15 +35,15 @@
|
|||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.archiva.redback</groupId>
|
||||
<artifactId>redback-rbac-jdo</artifactId>
|
||||
<artifactId>redback-users-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.archiva.redback</groupId>
|
||||
<artifactId>redback-keys-jdo</artifactId>
|
||||
<artifactId>redback-rbac-model</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.archiva.redback</groupId>
|
||||
<artifactId>redback-users-jdo</artifactId>
|
||||
<artifactId>redback-keys-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
|
@ -88,6 +88,10 @@
|
|||
<artifactId>jul-to-slf4j</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hsqldb</groupId>
|
||||
<artifactId>hsqldb</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
@ -1,307 +0,0 @@
|
|||
package org.apache.archiva.redback.management;
|
||||
|
||||
/*
|
||||
* 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 java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.Writer;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.xml.stream.XMLStreamException;
|
||||
|
||||
import org.apache.archiva.redback.keys.AuthenticationKey;
|
||||
import org.apache.archiva.redback.keys.KeyManager;
|
||||
import org.apache.archiva.redback.keys.jdo.AuthenticationKeyDatabase;
|
||||
import org.apache.archiva.redback.keys.jdo.io.stax.RedbackKeyManagementJdoStaxReader;
|
||||
import org.apache.archiva.redback.keys.jdo.io.stax.RedbackKeyManagementJdoStaxWriter;
|
||||
import org.apache.archiva.redback.rbac.Operation;
|
||||
import org.apache.archiva.redback.rbac.Permission;
|
||||
import org.apache.archiva.redback.rbac.RbacManagerException;
|
||||
import org.apache.archiva.redback.rbac.Role;
|
||||
import org.apache.archiva.redback.rbac.jdo.RbacDatabase;
|
||||
import org.apache.archiva.redback.rbac.jdo.io.stax.RbacJdoModelStaxReader;
|
||||
import org.apache.archiva.redback.rbac.jdo.io.stax.RbacJdoModelStaxWriter;
|
||||
import org.apache.archiva.redback.users.UserManager;
|
||||
import org.apache.archiva.redback.keys.KeyManagerException;
|
||||
import org.apache.archiva.redback.rbac.RBACManager;
|
||||
import org.apache.archiva.redback.rbac.Resource;
|
||||
import org.apache.archiva.redback.rbac.UserAssignment;
|
||||
import org.apache.archiva.redback.users.User;
|
||||
import org.apache.archiva.redback.users.UserManagerException;
|
||||
import org.apache.archiva.redback.users.jdo.UserDatabase;
|
||||
import org.apache.archiva.redback.users.jdo.io.stax.UsersManagementStaxReader;
|
||||
import org.apache.archiva.redback.users.jdo.io.stax.UsersManagementStaxWriter;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* JDO implementation of the data management tool.
|
||||
*
|
||||
* TODO do we really need JDO specifics here? Could optimize by going straight to JDOFactory
|
||||
* TODO check whether this current method logs everything unnecessarily.
|
||||
*/
|
||||
@Service("dataManagementTool#jdo")
|
||||
public class JdoDataManagementTool
|
||||
implements DataManagementTool
|
||||
{
|
||||
private static final String USERS_XML_NAME = "users.xml";
|
||||
|
||||
private static final String KEYS_XML_NAME = "keys.xml";
|
||||
|
||||
private static final String RBAC_XML_NAME = "rbac.xml";
|
||||
|
||||
public void backupRBACDatabase( RBACManager manager, File backupDirectory )
|
||||
throws RbacManagerException, IOException, XMLStreamException
|
||||
{
|
||||
RbacDatabase database = new RbacDatabase();
|
||||
database.setRoles( manager.getAllRoles() );
|
||||
database.setUserAssignments( manager.getAllUserAssignments() );
|
||||
database.setPermissions( manager.getAllPermissions() );
|
||||
database.setOperations( manager.getAllOperations() );
|
||||
database.setResources( manager.getAllResources() );
|
||||
|
||||
RbacJdoModelStaxWriter writer = new RbacJdoModelStaxWriter();
|
||||
Writer fileWriter = createWriter( backupDirectory, RBAC_XML_NAME, database.getModelEncoding() );
|
||||
try
|
||||
{
|
||||
writer.write( fileWriter, database );
|
||||
}
|
||||
finally
|
||||
{
|
||||
IOUtils.closeQuietly( fileWriter );
|
||||
}
|
||||
}
|
||||
|
||||
public void backupUserDatabase( UserManager manager, File backupDirectory )
|
||||
throws IOException, XMLStreamException, UserManagerException
|
||||
{
|
||||
UserDatabase database = new UserDatabase();
|
||||
database.setUsers( manager.getUsers() );
|
||||
|
||||
UsersManagementStaxWriter writer = new UsersManagementStaxWriter();
|
||||
Writer fileWriter = createWriter( backupDirectory, USERS_XML_NAME, database.getModelEncoding() );
|
||||
try
|
||||
{
|
||||
writer.write( fileWriter, database );
|
||||
}
|
||||
finally
|
||||
{
|
||||
IOUtils.closeQuietly( fileWriter );
|
||||
}
|
||||
}
|
||||
|
||||
public void backupKeyDatabase( KeyManager manager, File backupDirectory )
|
||||
throws IOException, XMLStreamException
|
||||
{
|
||||
try
|
||||
{
|
||||
manager.removeExpiredKeys();
|
||||
}
|
||||
catch ( KeyManagerException e )
|
||||
{
|
||||
throw new IOException( "Error removing expired keys" );
|
||||
}
|
||||
|
||||
AuthenticationKeyDatabase database = new AuthenticationKeyDatabase();
|
||||
database.setKeys( manager.getAllKeys() );
|
||||
|
||||
RedbackKeyManagementJdoStaxWriter writer = new RedbackKeyManagementJdoStaxWriter();
|
||||
Writer fileWriter = createWriter( backupDirectory, KEYS_XML_NAME, database.getModelEncoding() );
|
||||
try
|
||||
{
|
||||
writer.write( fileWriter, database );
|
||||
}
|
||||
finally
|
||||
{
|
||||
IOUtils.closeQuietly( fileWriter );
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void restoreRBACDatabase( RBACManager manager, File backupDirectory )
|
||||
throws IOException, XMLStreamException, RbacManagerException
|
||||
{
|
||||
RbacJdoModelStaxReader reader = new RbacJdoModelStaxReader();
|
||||
|
||||
FileReader fileReader = new FileReader( new File( backupDirectory, RBAC_XML_NAME ) );
|
||||
|
||||
RbacDatabase database;
|
||||
try
|
||||
{
|
||||
database = reader.read( fileReader );
|
||||
}
|
||||
finally
|
||||
{
|
||||
IOUtils.closeQuietly( fileReader );
|
||||
}
|
||||
|
||||
Map<String, Permission> permissionMap = new HashMap<String, Permission>();
|
||||
Map<String, Resource> resources = new HashMap<String, Resource>();
|
||||
Map<String, Operation> operations = new HashMap<String, Operation>();
|
||||
for ( Role role : (List<Role>) database.getRoles() )
|
||||
{
|
||||
// TODO: this could be generally useful and put into saveRole itself as long as the performance penalty isn't too harsh.
|
||||
// Currently it always saves everything where it could pull pack the existing permissions, etc if they exist
|
||||
List<Permission> permissions = new ArrayList<Permission>();
|
||||
for ( Permission permission : role.getPermissions() )
|
||||
{
|
||||
if ( permissionMap.containsKey( permission.getName() ) )
|
||||
{
|
||||
permission = permissionMap.get( permission.getName() );
|
||||
}
|
||||
else if ( manager.permissionExists( permission ) )
|
||||
{
|
||||
permission = manager.getPermission( permission.getName() );
|
||||
permissionMap.put( permission.getName(), permission );
|
||||
}
|
||||
else
|
||||
{
|
||||
Operation operation = permission.getOperation();
|
||||
if ( operations.containsKey( operation.getName() ) )
|
||||
{
|
||||
operation = operations.get( operation.getName() );
|
||||
}
|
||||
else if ( manager.operationExists( operation ) )
|
||||
{
|
||||
operation = manager.getOperation( operation.getName() );
|
||||
operations.put( operation.getName(), operation );
|
||||
}
|
||||
else
|
||||
{
|
||||
operation = manager.saveOperation( operation );
|
||||
operations.put( operation.getName(), operation );
|
||||
}
|
||||
permission.setOperation( operation );
|
||||
|
||||
Resource resource = permission.getResource();
|
||||
if ( resources.containsKey( resource.getIdentifier() ) )
|
||||
{
|
||||
resource = resources.get( resource.getIdentifier() );
|
||||
}
|
||||
else if ( manager.resourceExists( resource ) )
|
||||
{
|
||||
resource = manager.getResource( resource.getIdentifier() );
|
||||
resources.put( resource.getIdentifier(), resource );
|
||||
}
|
||||
else
|
||||
{
|
||||
resource = manager.saveResource( resource );
|
||||
resources.put( resource.getIdentifier(), resource );
|
||||
}
|
||||
permission.setResource( resource );
|
||||
|
||||
permission = manager.savePermission( permission );
|
||||
permissionMap.put( permission.getName(), permission );
|
||||
}
|
||||
permissions.add( permission );
|
||||
}
|
||||
role.setPermissions( permissions );
|
||||
|
||||
manager.saveRole( role );
|
||||
}
|
||||
|
||||
for ( UserAssignment userAssignment : (List<UserAssignment>) database.getUserAssignments() )
|
||||
{
|
||||
manager.saveUserAssignment( userAssignment );
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void restoreUsersDatabase( UserManager manager, File backupDirectory )
|
||||
throws IOException, XMLStreamException, UserManagerException
|
||||
{
|
||||
UsersManagementStaxReader reader = new UsersManagementStaxReader();
|
||||
|
||||
FileReader fileReader = new FileReader( new File( backupDirectory, USERS_XML_NAME ) );
|
||||
|
||||
UserDatabase database;
|
||||
try
|
||||
{
|
||||
database = reader.read( fileReader );
|
||||
}
|
||||
finally
|
||||
{
|
||||
IOUtils.closeQuietly( fileReader );
|
||||
}
|
||||
|
||||
for ( User user : (List<User>) database.getUsers() )
|
||||
{
|
||||
manager.addUserUnchecked( user );
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void restoreKeysDatabase( KeyManager manager, File backupDirectory )
|
||||
throws IOException, XMLStreamException
|
||||
{
|
||||
RedbackKeyManagementJdoStaxReader reader = new RedbackKeyManagementJdoStaxReader();
|
||||
|
||||
FileReader fileReader = new FileReader( new File( backupDirectory, KEYS_XML_NAME ) );
|
||||
|
||||
AuthenticationKeyDatabase database;
|
||||
try
|
||||
{
|
||||
database = reader.read( fileReader );
|
||||
}
|
||||
finally
|
||||
{
|
||||
IOUtils.closeQuietly( fileReader );
|
||||
}
|
||||
|
||||
for ( AuthenticationKey key : (List<AuthenticationKey>) database.getKeys() )
|
||||
{
|
||||
manager.addKey( key );
|
||||
}
|
||||
}
|
||||
|
||||
public void eraseRBACDatabase( RBACManager manager )
|
||||
{
|
||||
manager.eraseDatabase();
|
||||
}
|
||||
|
||||
public void eraseUsersDatabase( UserManager manager )
|
||||
{
|
||||
manager.eraseDatabase();
|
||||
}
|
||||
|
||||
public void eraseKeysDatabase( KeyManager manager )
|
||||
{
|
||||
manager.eraseDatabase();
|
||||
}
|
||||
|
||||
private Writer createWriter( File directory, String file, String encoding )
|
||||
throws FileNotFoundException
|
||||
{
|
||||
File f = new File( directory, file );
|
||||
File parentFile = f.getParentFile();
|
||||
parentFile.mkdirs();
|
||||
|
||||
FileOutputStream out = new FileOutputStream( f );
|
||||
return new OutputStreamWriter( out, Charset.forName( encoding ) );
|
||||
}
|
||||
}
|
|
@ -20,24 +20,24 @@ package org.apache.archiva.redback.management;
|
|||
*/
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.archiva.redback.common.jdo.UserConfigurableJdoFactory;
|
||||
import org.apache.archiva.redback.keys.AuthenticationKey;
|
||||
import org.apache.archiva.redback.keys.KeyManager;
|
||||
import org.apache.archiva.redback.keys.KeyManagerException;
|
||||
import org.apache.archiva.redback.rbac.Permission;
|
||||
import org.apache.archiva.redback.rbac.RBACManager;
|
||||
import org.apache.archiva.redback.rbac.RbacManagerException;
|
||||
import org.apache.archiva.redback.rbac.Role;
|
||||
import org.apache.archiva.redback.rbac.UserAssignment;
|
||||
import org.apache.archiva.redback.tests.utils.RBACDefaults;
|
||||
import org.apache.archiva.redback.users.User;
|
||||
import org.apache.archiva.redback.users.UserManager;
|
||||
import org.apache.archiva.redback.users.UserManagerException;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang.SystemUtils;
|
||||
import org.apache.archiva.redback.keys.KeyManagerException;
|
||||
import org.apache.archiva.redback.rbac.RbacManagerException;
|
||||
import org.apache.archiva.redback.tests.utils.RBACDefaults;
|
||||
import org.apache.archiva.redback.users.User;
|
||||
import org.custommonkey.xmlunit.XMLAssert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
|
@ -57,6 +57,8 @@ import java.util.List;
|
|||
import java.util.Locale;
|
||||
|
||||
|
||||
// @TODO: Investigate how to implement export with JPA
|
||||
@Ignore("Currently no JPA implementation")
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" })
|
||||
public class DataManagementTest
|
||||
|
@ -68,20 +70,16 @@ public class DataManagementTest
|
|||
private File targetDirectory;
|
||||
|
||||
@Inject
|
||||
@Named(value = "jdoFactory#users")
|
||||
UserConfigurableJdoFactory jdoFactory;
|
||||
|
||||
@Inject
|
||||
@Named(value = "userManager#jdo")
|
||||
@Named(value = "userManager#jpa")
|
||||
UserManager userManager;
|
||||
|
||||
@Inject
|
||||
@Named(value = "keyManager#jdo")
|
||||
@Named(value = "keyManager#jpa")
|
||||
KeyManager keyManager;
|
||||
|
||||
|
||||
@Inject
|
||||
@Named(value = "rbacManager#jdo")
|
||||
@Named(value = "rbacManager#jpa")
|
||||
RBACManager rbacManager;
|
||||
|
||||
@Before
|
||||
|
|
|
@ -28,25 +28,6 @@
|
|||
|
||||
<context:property-placeholder system-properties-mode="OVERRIDE"/>
|
||||
|
||||
<bean name="jdoFactory#users" class="org.apache.archiva.redback.common.jdo.UserConfigurableJdoFactory">
|
||||
<constructor-arg>
|
||||
<ref bean="userConfiguration#default"/>
|
||||
</constructor-arg>
|
||||
<!--
|
||||
<property name="config" ref="userConfiguration#default"/>
|
||||
-->
|
||||
<!--
|
||||
<property name="driverName" value="org.apache.derby.jdbc.EmbeddedDriver"/>
|
||||
<property name="url" value="jdbc:derby:memory:users-test" />
|
||||
-->
|
||||
<property name="driverName" value="org.hsqldb.jdbcDriver"/>
|
||||
<property name="url" value="" />
|
||||
|
||||
|
||||
<property name="userName" value="sa"/>
|
||||
<property name="password" value=""/>
|
||||
</bean>
|
||||
|
||||
<alias name="userConfiguration#redback" alias="userConfiguration#default"/>
|
||||
|
||||
<!--
|
||||
|
|
|
@ -21,12 +21,10 @@ package org.apache.archiva.redback.integration.mail;
|
|||
|
||||
import junit.framework.TestCase;
|
||||
import net.sf.ehcache.CacheManager;
|
||||
import org.apache.archiva.redback.components.jdo.DefaultConfigurableJdoFactory;
|
||||
import org.apache.archiva.redback.keys.AuthenticationKey;
|
||||
import org.apache.archiva.redback.keys.KeyManager;
|
||||
import org.apache.archiva.redback.policy.UserSecurityPolicy;
|
||||
import org.apache.archiva.redback.keys.KeyManagerException;
|
||||
import org.jpox.SchemaTool;
|
||||
import org.apache.archiva.redback.policy.UserSecurityPolicy;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
@ -37,11 +35,6 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
|||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import javax.jdo.PersistenceManager;
|
||||
import javax.jdo.PersistenceManagerFactory;
|
||||
import java.net.URL;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* Test the Mailer class.
|
||||
|
@ -67,9 +60,7 @@ public class MailGeneratorTest
|
|||
@Named(value = "keyManager#memory")
|
||||
private KeyManager keyManager;
|
||||
|
||||
@Inject
|
||||
@Named(value = "jdoFactory#users")
|
||||
DefaultConfigurableJdoFactory jdoFactory;
|
||||
|
||||
|
||||
private Logger log = LoggerFactory.getLogger( getClass() );
|
||||
|
||||
|
@ -80,33 +71,6 @@ public class MailGeneratorTest
|
|||
CacheManager.getInstance().clearAll();
|
||||
super.setUp();
|
||||
|
||||
jdoFactory.setPassword( "" );
|
||||
|
||||
jdoFactory.setProperty( "org.jpox.transactionIsolation", "READ_COMMITTED" ); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
jdoFactory.setProperty( "org.jpox.poid.transactionIsolation", "READ_COMMITTED" ); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
jdoFactory.setProperty( "org.jpox.autoCreateSchema", "true" ); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
Properties properties = jdoFactory.getProperties();
|
||||
|
||||
for ( Entry<Object, Object> entry : properties.entrySet() )
|
||||
{
|
||||
System.setProperty( (String) entry.getKey(), (String) entry.getValue() );
|
||||
}
|
||||
|
||||
SchemaTool.createSchemaTables( new URL[] { getClass()
|
||||
.getResource( "/org/apache/archiva/redback/keys/jdo/package.jdo" ) }, new URL[] {}, null, false, null ); //$NON-NLS-1$
|
||||
|
||||
log.info( "jdoFactory driverName {} " , jdoFactory.getDriverName() );
|
||||
|
||||
PersistenceManagerFactory pmf = jdoFactory.getPersistenceManagerFactory();
|
||||
|
||||
assertNotNull( pmf );
|
||||
|
||||
PersistenceManager pm = pmf.getPersistenceManager();
|
||||
|
||||
pm.close();
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -28,20 +28,6 @@
|
|||
|
||||
<context:property-placeholder system-properties-mode="OVERRIDE"/>
|
||||
|
||||
<bean name="jdoFactory#users" class="org.apache.archiva.redback.components.jdo.DefaultConfigurableJdoFactory">
|
||||
<property name="driverName" value="org.hsqldb.jdbcDriver"/>
|
||||
<property name="url" value="jdbc:hsqldb:mem:redback-users-tests" />
|
||||
<property name="userName" value="sa"/>
|
||||
<property name="password" value=""/>
|
||||
<property name="persistenceManagerFactoryClass" value="org.jpox.PersistenceManagerFactoryImpl"/>
|
||||
<property name="otherProperties">
|
||||
<props>
|
||||
<prop key="org.jpox.rdbms.dateTimezone">JDK_DEFAULT_TIMEZONE</prop>
|
||||
<prop key="org.jpox.autoCreateTables">true</prop>
|
||||
</props>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean name="userConfiguration#custom-url" class="org.apache.archiva.redback.configuration.DefaultUserConfiguration">
|
||||
<property name="configs">
|
||||
<list>
|
||||
|
|
|
@ -73,6 +73,10 @@
|
|||
<groupId>org.apache.archiva.redback</groupId>
|
||||
<artifactId>redback-keys-memory</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.archiva.redback</groupId>
|
||||
<artifactId>redback-keys-jpa</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.jaxrs</groupId>
|
||||
<artifactId>jackson-jaxrs-json-provider</artifactId>
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.apache.archiva.redback.authentication.PasswordBasedAuthenticationData
|
|||
import org.apache.archiva.redback.integration.filter.authentication.HttpAuthenticator;
|
||||
import org.apache.archiva.redback.keys.AuthenticationKey;
|
||||
import org.apache.archiva.redback.keys.KeyManager;
|
||||
import org.apache.archiva.redback.keys.jdo.JdoAuthenticationKey;
|
||||
import org.apache.archiva.redback.keys.jpa.model.JpaAuthenticationKey;
|
||||
import org.apache.archiva.redback.keys.memory.MemoryAuthenticationKey;
|
||||
import org.apache.archiva.redback.keys.memory.MemoryKeyManager;
|
||||
import org.apache.archiva.redback.policy.AccountLockedException;
|
||||
|
@ -96,7 +96,7 @@ public class DefaultLoginService
|
|||
}
|
||||
else
|
||||
{
|
||||
key = new JdoAuthenticationKey();
|
||||
key = new JpaAuthenticationKey();
|
||||
}
|
||||
|
||||
key.setKey( providedKey );
|
||||
|
|
|
@ -36,11 +36,11 @@ public class FakeCreateAdminServiceImpl
|
|||
implements FakeCreateAdminService
|
||||
{
|
||||
@Inject
|
||||
@Named( value = "rbacManager#jdo" )
|
||||
@Named( value = "rbacManager#jpa" )
|
||||
private RBACManager rbacManager;
|
||||
|
||||
@Inject
|
||||
@Named( value = "userManager#jdo" )
|
||||
@Named( value = "userManager#jpa" )
|
||||
private UserManager userManager;
|
||||
|
||||
@Inject
|
||||
|
|
|
@ -16,4 +16,4 @@
|
|||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
user.manager.impl=jdo
|
||||
user.manager.impl=jpa
|
|
@ -28,9 +28,8 @@
|
|||
<name>Redback :: Key Management Providers</name>
|
||||
<packaging>pom</packaging>
|
||||
<modules>
|
||||
<module>redback-keys-jdo</module>
|
||||
<module>redback-keys-jpa</module>
|
||||
<module>redback-keys-memory</module>
|
||||
<module>redback-keys-cached</module>
|
||||
<module>redback-keys-jpa</module>
|
||||
</modules>
|
||||
</project>
|
||||
|
|
|
@ -44,13 +44,17 @@
|
|||
<groupId>org.apache.archiva.redback.components.cache</groupId>
|
||||
<artifactId>spring-cache-ehcache</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.archiva.redback</groupId>
|
||||
<artifactId>redback-configuration</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.sf.ehcache</groupId>
|
||||
<artifactId>ehcache</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.archiva.redback</groupId>
|
||||
<artifactId>redback-keys-jdo</artifactId>
|
||||
<artifactId>redback-keys-jpa</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
|
|
|
@ -43,7 +43,7 @@ public class CachedKeyManager
|
|||
implements KeyManager
|
||||
{
|
||||
@Inject
|
||||
@Named(value = "keyManager#jdo")
|
||||
@Named(value = "keyManager#jpa")
|
||||
private KeyManager keyImpl;
|
||||
|
||||
@Inject
|
||||
|
|
|
@ -20,25 +20,11 @@
|
|||
-->
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
||||
http://www.springframework.org/schema/context
|
||||
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
|
||||
|
||||
<bean name="jdoFactory#users" class="org.apache.archiva.redback.components.jdo.DefaultConfigurableJdoFactory">
|
||||
<property name="driverName" value="org.hsqldb.jdbcDriver"/>
|
||||
<property name="url" value="jdbc:hsqldb:mem:redback-users-tests" />
|
||||
<property name="userName" value="sa"/>
|
||||
<property name="password" value=""/>
|
||||
<property name="persistenceManagerFactoryClass" value="org.jpox.PersistenceManagerFactoryImpl"/>
|
||||
<property name="otherProperties">
|
||||
<props>
|
||||
<prop key="org.jpox.rdbms.dateTimezone">JDK_DEFAULT_TIMEZONE</prop>
|
||||
<prop key="org.jpox.autoCreateTables">true</prop>
|
||||
</props>
|
||||
</property>
|
||||
</bean>
|
||||
http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">
|
||||
|
||||
<bean name="userConfiguration#default" class="org.apache.archiva.redback.configuration.DefaultUserConfiguration">
|
||||
<property name="registry" ref="test-conf"/>
|
||||
|
@ -60,4 +46,30 @@
|
|||
<property name="timeToLiveSeconds" value="14400"/>
|
||||
</bean>
|
||||
|
||||
<bean name="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
|
||||
<property name="jpaVendorAdapter" >
|
||||
<bean class="org.springframework.orm.jpa.vendor.OpenJpaVendorAdapter" />
|
||||
</property>
|
||||
<property name="persistenceXmlLocation" value="classpath:META-INF/persistence-hsqldb.xml" />
|
||||
<property name="jpaPropertyMap">
|
||||
<map>
|
||||
<entry key="openjpa.ConnectionURL" value="jdbc:hsqldb:mem:redback_database" />
|
||||
<entry key="openjpa.ConnectionDriverName" value="org.hsqldb.jdbcDriver" />
|
||||
<entry key="openjpa.ConnectionUserName" value="sa" />
|
||||
<entry key="openjpa.ConnectionPassword" value="" />
|
||||
<entry key="openjpa.Log" value="DefaultLevel=TRACE, Runtime=TRACE, Tool=INFO, SQL=TRACE" />
|
||||
<entry key="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)" />
|
||||
<entry key="openjpa.jdbc.MappingDefaults"
|
||||
value="ForeignKeyDeleteAction=restrict,JoinForeignKeyDeleteAction=restrict"/>
|
||||
</map>
|
||||
</property>
|
||||
|
||||
</bean>
|
||||
|
||||
<bean name="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager" >
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory" />
|
||||
</bean>
|
||||
|
||||
<tx:annotation-driven />
|
||||
|
||||
</beans>
|
|
@ -28,10 +28,9 @@
|
|||
<name>Redback :: RBAC Providers</name>
|
||||
<packaging>pom</packaging>
|
||||
<modules>
|
||||
<module>redback-rbac-jdo</module>
|
||||
<module>redback-rbac-jpa</module>
|
||||
<module>redback-rbac-memory</module>
|
||||
<module>redback-rbac-cached</module>
|
||||
<module>redback-rbac-ldap</module>
|
||||
<module>redback-rbac-jpa</module>
|
||||
</modules>
|
||||
</project>
|
||||
|
|
|
@ -64,10 +64,6 @@
|
|||
<groupId>javax.annotation</groupId>
|
||||
<artifactId>jsr250-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.archiva.redback</groupId>
|
||||
<artifactId>redback-rbac-jdo</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.archiva.redback</groupId>
|
||||
<artifactId>redback-rbac-jpa</artifactId>
|
||||
|
|
|
@ -54,7 +54,7 @@ public class CachedRbacManager
|
|||
private Logger log = LoggerFactory.getLogger( getClass() );
|
||||
|
||||
@Inject
|
||||
@Named( value = "rbacManager#jdo" )
|
||||
@Named( value = "rbacManager#jpa" )
|
||||
private RBACManager rbacImpl;
|
||||
|
||||
@Inject
|
||||
|
|
|
@ -24,19 +24,6 @@
|
|||
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd"
|
||||
default-lazy-init="false">
|
||||
|
||||
<bean name="jdoFactory#users" class="org.apache.archiva.redback.components.jdo.DefaultConfigurableJdoFactory">
|
||||
<property name="driverName" value="org.hsqldb.jdbcDriver"/>
|
||||
<property name="url" value="jdbc:hsqldb:mem:redback-users-tests" />
|
||||
<property name="userName" value="sa"/>
|
||||
<property name="password" value=""/>
|
||||
<property name="persistenceManagerFactoryClass" value="org.jpox.PersistenceManagerFactoryImpl"/>
|
||||
<property name="otherProperties">
|
||||
<props>
|
||||
<prop key="org.jpox.rdbms.dateTimezone">JDK_DEFAULT_TIMEZONE</prop>
|
||||
<prop key="org.jpox.autoCreateTables">true</prop>
|
||||
</props>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean name="userConfiguration#default" class="org.apache.archiva.redback.configuration.DefaultUserConfiguration">
|
||||
<property name="registry" ref="test-conf"/>
|
||||
|
|
|
@ -31,6 +31,7 @@ import javax.persistence.*;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
/**
|
||||
|
@ -73,6 +74,18 @@ public class JpaRbacManager extends AbstractRBACManager {
|
|||
return mergedRole;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public Map<String, List<Permission>> getAssignedPermissionMap(String principal) throws RbacManagerException {
|
||||
return super.getAssignedPermissionMap(principal);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public Map<String, Role> getChildRoles(Role role) throws RbacManagerException {
|
||||
return super.getChildRoles(role);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public void addChildRole(Role role, Role childRole) throws RbacObjectInvalidException, RbacManagerException {
|
||||
|
@ -105,7 +118,14 @@ public class JpaRbacManager extends AbstractRBACManager {
|
|||
final EntityManager em = getEm();
|
||||
TypedQuery<JpaRole> q = em.createQuery("SELECT r FROM JpaRole r WHERE r.name = :rolename", JpaRole.class);
|
||||
q.setParameter("rolename",roleName);
|
||||
return q.getSingleResult();
|
||||
Role role;
|
||||
try {
|
||||
role = q.getSingleResult();
|
||||
} catch (NoResultException ex) {
|
||||
log.warn("Role {0} not found", roleName);
|
||||
throw new RbacObjectNotFoundException("Role not found "+roleName);
|
||||
}
|
||||
return role;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -19,7 +19,6 @@ package org.apache.archiva.redback.rbac.jpa;
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.archiva.redback.common.jdo.test.StoreManagerDebug;
|
||||
import org.apache.archiva.redback.rbac.RBACManager;
|
||||
import org.apache.archiva.redback.rbac.RbacManagerException;
|
||||
import org.apache.archiva.redback.tests.AbstractRbacManagerTestCase;
|
||||
|
|
|
@ -72,10 +72,6 @@
|
|||
<groupId>org.apache.archiva.redback</groupId>
|
||||
<artifactId>redback-users-ldap</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.archiva.redback</groupId>
|
||||
<artifactId>redback-rbac-jdo</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.archiva.redback</groupId>
|
||||
<artifactId>redback-rbac-cached</artifactId>
|
||||
|
|
|
@ -63,20 +63,6 @@
|
|||
|
||||
<alias name="ldapRoleMapper#test" alias="ldapRoleMapper#default"/>
|
||||
|
||||
<bean name="jdoFactory#users" class="org.apache.archiva.redback.components.jdo.DefaultConfigurableJdoFactory">
|
||||
<property name="driverName" value="org.hsqldb.jdbcDriver"/>
|
||||
<property name="url" value="jdbc:hsqldb:mem:redback-users-tests" />
|
||||
<property name="userName" value="sa"/>
|
||||
<property name="password" value=""/>
|
||||
<property name="persistenceManagerFactoryClass" value="org.jpox.PersistenceManagerFactoryImpl"/>
|
||||
<property name="otherProperties">
|
||||
<props>
|
||||
<prop key="org.jpox.rdbms.dateTimezone">JDK_DEFAULT_TIMEZONE</prop>
|
||||
<prop key="org.jpox.autoCreateTables">true</prop>
|
||||
</props>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean name="userConfiguration#default" class="org.apache.archiva.redback.configuration.DefaultUserConfiguration">
|
||||
<property name="registry" ref="test-conf"/>
|
||||
</bean>
|
||||
|
|
|
@ -23,19 +23,6 @@
|
|||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">
|
||||
|
||||
<bean name="jdoFactory#users" class="org.apache.archiva.redback.components.jdo.DefaultConfigurableJdoFactory">
|
||||
<property name="driverName" value="org.hsqldb.jdbcDriver"/>
|
||||
<property name="url" value="jdbc:hsqldb:mem:redback-users-tests" />
|
||||
<property name="userName" value="sa"/>
|
||||
<property name="password" value=""/>
|
||||
<property name="persistenceManagerFactoryClass" value="org.jpox.PersistenceManagerFactoryImpl"/>
|
||||
<property name="otherProperties">
|
||||
<props>
|
||||
<prop key="org.jpox.rdbms.dateTimezone">JDK_DEFAULT_TIMEZONE</prop>
|
||||
<prop key="org.jpox.autoCreateTables">true</prop>
|
||||
</props>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean name="userConfiguration#default" class="org.apache.archiva.redback.configuration.DefaultUserConfiguration">
|
||||
<property name="registry" ref="test-conf"/>
|
||||
|
|
|
@ -62,19 +62,10 @@
|
|||
<groupId>org.apache.archiva.redback</groupId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<artifactId>redback-rbac-jdo</artifactId>
|
||||
<groupId>org.apache.archiva.redback</groupId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.archiva.redback</groupId>
|
||||
<artifactId>redback-rbac-model</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.archiva.redback</groupId>
|
||||
<artifactId>redback-common-jdo</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.archiva.redback</groupId>
|
||||
<artifactId>redback-rbac-cached</artifactId>
|
||||
|
|
|
@ -19,8 +19,7 @@ package org.apache.archiva.redback.role;
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.archiva.redback.rbac.jdo.JdoRbacManager;
|
||||
import org.apache.archiva.redback.components.jdo.DefaultConfigurableJdoFactory;
|
||||
import org.apache.archiva.redback.rbac.RBACManager;
|
||||
import org.junit.Before;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
|
@ -28,8 +27,6 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
|||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import javax.jdo.PersistenceManager;
|
||||
import javax.jdo.PersistenceManagerFactory;
|
||||
|
||||
/**
|
||||
* RoleManagerTest:
|
||||
|
@ -41,38 +38,31 @@ import javax.jdo.PersistenceManagerFactory;
|
|||
public class JpoxRoleManagerTest
|
||||
extends AbstractRoleManagerTest
|
||||
{
|
||||
@Inject
|
||||
@Named( value = "jdoFactory#users" )
|
||||
DefaultConfigurableJdoFactory jdoFactory;
|
||||
|
||||
@Inject
|
||||
@Named( value = "rbacManager#jdo" )
|
||||
JdoRbacManager rbacManagerJdo;
|
||||
|
||||
@Inject @Named(value = "roleManager#jpox")
|
||||
DefaultRoleManager roleManagerInjected;
|
||||
|
||||
@Inject
|
||||
@Named(value = "rbacManager#jpa")
|
||||
RBACManager rbacManager;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new RbacStore which contains no data.
|
||||
*/
|
||||
@Before
|
||||
public void setUp()
|
||||
throws Exception
|
||||
throws Exception
|
||||
{
|
||||
|
||||
super.setUp();
|
||||
|
||||
PersistenceManagerFactory pmf = jdoFactory.getPersistenceManagerFactory();
|
||||
|
||||
assertNotNull( pmf );
|
||||
|
||||
PersistenceManager pm = pmf.getPersistenceManager();
|
||||
|
||||
pm.close();
|
||||
|
||||
setRbacManager( rbacManagerJdo );
|
||||
|
||||
// rbacManager.setEntityManager(emf.createEntityManager());
|
||||
super.setRbacManager(rbacManager);
|
||||
assertNotNull(rbacManager);
|
||||
setRoleManager( roleManagerInjected );
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -26,13 +26,13 @@
|
|||
|
||||
|
||||
<bean name="roleModelProcessor" class="org.apache.archiva.redback.role.processor.DefaultRoleModelProcessor">
|
||||
<property name="rbacManager" ref="rbacManager#jdo"/>
|
||||
<property name="rbacManager" ref="rbacManager#jpa"/>
|
||||
</bean>
|
||||
|
||||
<alias name="roleModelProcessor" alias="roleModelProcessor#jpox"/>
|
||||
|
||||
<bean name="roleTemplateProcessor" class="org.apache.archiva.redback.role.template.DefaultRoleTemplateProcessor">
|
||||
<property name="rbacManager" ref="rbacManager#jdo"/>
|
||||
<property name="rbacManager" ref="rbacManager#jpa"/>
|
||||
</bean>
|
||||
|
||||
<alias name="roleTemplateProcessor" alias="roleTemplateProcessor#jpox"/>
|
||||
|
@ -41,35 +41,10 @@
|
|||
<property name="modelValidator" ref="roleModelValidator"/>
|
||||
<property name="modelProcessor" ref="roleModelProcessor#jpox"/>
|
||||
<property name="templateProcessor" ref="roleTemplateProcessor#jpox"/>
|
||||
<property name="rbacManager" ref="rbacManager#jdo"/>
|
||||
<property name="rbacManager" ref="rbacManager#jpa"/>
|
||||
</bean>
|
||||
<alias name="roleManager" alias="roleManager#jpox"/>
|
||||
|
||||
|
||||
<bean name="rbacManager#jdo" class="org.apache.archiva.redback.rbac.jdo.JdoRbacManager">
|
||||
<property name="jdo" ref="jdoTool"/>
|
||||
<property name="enableCache" value="false"/>
|
||||
</bean>
|
||||
|
||||
<bean name="jdoFactory#users" class="org.apache.archiva.redback.components.jdo.DefaultConfigurableJdoFactory">
|
||||
<property name="driverName" value="org.hsqldb.jdbcDriver"/>
|
||||
<property name="url" value="jdbc:hsqldb:mem:redback-jpox-role-manager-test" />
|
||||
<property name="userName" value="sa"/>
|
||||
<property name="password" value=""/>
|
||||
<property name="persistenceManagerFactoryClass" value="org.jpox.PersistenceManagerFactoryImpl"/>
|
||||
<property name="otherProperties">
|
||||
<props>
|
||||
<prop key="org.jpox.rdbms.dateTimezone">JDK_DEFAULT_TIMEZONE</prop>
|
||||
<prop key="org.jpox.transactionIsolation">READ_UNCOMMITTED</prop>
|
||||
<prop key="org.jpox.poid.transactionIsolation">READ_UNCOMMITTED</prop>
|
||||
<prop key="org.jpox.autoCreateTables">true</prop>
|
||||
<prop key="org.jpox.autoCreateSchema">true</prop>
|
||||
<prop key="javax.jdo.option.RetainValues">true</prop>
|
||||
<prop key="javax.jdo.option.RestoreValues">true</prop>
|
||||
</props>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean name="userConfiguration#default" class="org.apache.archiva.redback.configuration.DefaultUserConfiguration">
|
||||
<property name="registry" ref="test-conf"/>
|
||||
</bean>
|
||||
|
|
|
@ -25,19 +25,6 @@
|
|||
default-lazy-init="false">
|
||||
|
||||
|
||||
<bean name="jdoFactory#users" class="org.apache.archiva.redback.components.jdo.DefaultConfigurableJdoFactory">
|
||||
<property name="driverName" value="org.hsqldb.jdbcDriver"/>
|
||||
<property name="url" value="jdbc:hsqldb:mem:redback-users-tests" />
|
||||
<property name="userName" value="sa"/>
|
||||
<property name="password" value=""/>
|
||||
<property name="persistenceManagerFactoryClass" value="org.jpox.PersistenceManagerFactoryImpl"/>
|
||||
<property name="otherProperties">
|
||||
<props>
|
||||
<prop key="org.jpox.rdbms.dateTimezone">JDK_DEFAULT_TIMEZONE</prop>
|
||||
<prop key="org.jpox.autoCreateTables">true</prop>
|
||||
</props>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean name="userConfiguration#default" class="org.apache.archiva.redback.configuration.DefaultUserConfiguration">
|
||||
<property name="registry" ref="test-conf"/>
|
||||
|
|
|
@ -23,18 +23,6 @@
|
|||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">
|
||||
|
||||
<bean name="jdoFactory#users" class="org.apache.archiva.redback.components.jdo.DefaultConfigurableJdoFactory">
|
||||
<property name="driverName" value="org.hsqldb.jdbcDriver"/>
|
||||
<property name="url" value="jdbc:hsqldb:mem:redback-users-tests" />
|
||||
<property name="userName" value="sa"/>
|
||||
<property name="password" value=""/>
|
||||
<property name="persistenceManagerFactoryClass" value="org.jpox.PersistenceManagerFactoryImpl"/>
|
||||
<property name="otherProperties">
|
||||
<props>
|
||||
<prop key="org.jpox.rdbms.dateTimezone">JDK_DEFAULT_TIMEZONE</prop>
|
||||
</props>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean name="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
|
||||
<property name="jpaVendorAdapter" >
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
<modules>
|
||||
<module>redback-users-cached</module>
|
||||
<module>redback-users-memory</module>
|
||||
<module>redback-users-jdo</module>
|
||||
<module>redback-users-ldap</module>
|
||||
<module>redback-users-configurable</module>
|
||||
<module>redback-users-jpa</module>
|
||||
|
|
|
@ -56,10 +56,6 @@
|
|||
<groupId>javax.annotation</groupId>
|
||||
<artifactId>jsr250-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.archiva.redback</groupId>
|
||||
<artifactId>redback-users-jdo</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.archiva.redback</groupId>
|
||||
<artifactId>redback-users-jpa</artifactId>
|
||||
|
|
Loading…
Reference in New Issue