From 2add792524d77fc26a68c50dae0f64410aa8507c Mon Sep 17 00:00:00 2001 From: Martin Stockhammer Date: Fri, 30 Dec 2016 15:33:17 +0100 Subject: [PATCH] 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. --- pom.xml | 18 +- .../resources/META-INF/persistence-hsqldb.xml | 5 +- .../main/resources/META-INF/persistence.xml | 8 +- .../redback/config-defaults.properties | 2 +- redback-data-management/pom.xml | 10 +- .../management/JdoDataManagementTool.java | 307 ------------------ .../management/DataManagementTest.java | 22 +- .../src/test/resources/spring-context.xml | 19 -- .../integration/mail/MailGeneratorTest.java | 40 +-- .../src/test/resources/spring-context.xml | 14 - .../redback-rest-services/pom.xml | 4 + .../rest/services/DefaultLoginService.java | 4 +- .../services/FakeCreateAdminServiceImpl.java | 4 +- .../src/test/resources/security.properties | 2 +- redback-keys/redback-keys-providers/pom.xml | 3 +- .../redback-keys-cached/pom.xml | 6 +- .../redback/keys/cached/CachedKeyManager.java | 2 +- .../src/test/resources/spring-context.xml | 44 ++- redback-rbac/redback-rbac-providers/pom.xml | 3 +- .../redback-rbac-cached/pom.xml | 4 - .../rbac/cached/CachedRbacManager.java | 2 +- .../src/test/resources/spring-context.xml | 13 - .../redback/rbac/jpa/JpaRbacManager.java | 22 +- .../redback/rbac/jpa/JpaRbacManagerTest.java | 1 - .../redback-rbac-ldap/pom.xml | 4 - .../src/test/resources/spring-context.xml | 14 - .../src/test/resources/spring-context.xml | 13 - .../redback-rbac-role-manager/pom.xml | 9 - .../redback/role/JpoxRoleManagerTest.java | 36 +- .../test/resources/jpox-spring-context.xml | 31 +- .../src/test/resources/spring-context.xml | 13 - .../src/test/resources/spring-context.xml | 12 - redback-users/redback-users-providers/pom.xml | 1 - .../redback-users-cached/pom.xml | 4 - 34 files changed, 113 insertions(+), 583 deletions(-) delete mode 100644 redback-data-management/src/main/java/org/apache/archiva/redback/management/JdoDataManagementTool.java diff --git a/pom.xml b/pom.xml index 18cce4f1..c2b68e49 100644 --- a/pom.xml +++ b/pom.xml @@ -146,11 +146,6 @@ redback-policy ${project.version} - - org.apache.archiva.redback - redback-common-jdo - ${project.version} - org.apache.archiva.redback redback-common-ldap @@ -183,7 +178,7 @@ org.apache.archiva.redback - redback-keys-jdo + redback-keys-jpa ${project.version} @@ -216,11 +211,6 @@ redback-users-api ${project.version} - - org.apache.archiva.redback - redback-users-jdo - ${project.version} - org.apache.archiva.redback redback-users-jpa @@ -276,11 +266,6 @@ redback-rbac-cached ${project.version} - - org.apache.archiva.redback - redback-rbac-jdo - ${project.version} - org.apache.archiva.redback redback-rbac-jpa @@ -831,6 +816,7 @@ build-number.txt .idea/** + **/*.iml .project .classpath diff --git a/redback-common/redback-common-jpa/src/main/resources/META-INF/persistence-hsqldb.xml b/redback-common/redback-common-jpa/src/main/resources/META-INF/persistence-hsqldb.xml index 82da347e..54255d98 100644 --- a/redback-common/redback-common-jpa/src/main/resources/META-INF/persistence-hsqldb.xml +++ b/redback-common/redback-common-jpa/src/main/resources/META-INF/persistence-hsqldb.xml @@ -32,10 +32,13 @@ - + + + + diff --git a/redback-common/redback-common-jpa/src/main/resources/META-INF/persistence.xml b/redback-common/redback-common-jpa/src/main/resources/META-INF/persistence.xml index 602cd977..8ea770a1 100644 --- a/redback-common/redback-common-jpa/src/main/resources/META-INF/persistence.xml +++ b/redback-common/redback-common-jpa/src/main/resources/META-INF/persistence.xml @@ -20,7 +20,7 @@ org.apache.openjpa.persistence.PersistenceProviderImpl - java:comp/env/jdbc/redbackjpa + java:comp/env/jdbc/users org.apache.archiva.redback.users.jpa.model.JpaUser org.apache.archiva.redback.rbac.jpa.model.JpaOperation org.apache.archiva.redback.rbac.jpa.model.JpaResource @@ -31,10 +31,10 @@ - - - + + diff --git a/redback-configuration/src/main/resources/org/apache/archiva/redback/config-defaults.properties b/redback-configuration/src/main/resources/org/apache/archiva/redback/config-defaults.properties index 402aaf97..78ff0473 100644 --- a/redback-configuration/src/main/resources/org/apache/archiva/redback/config-defaults.properties +++ b/redback-configuration/src/main/resources/org/apache/archiva/redback/config-defaults.properties @@ -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 diff --git a/redback-data-management/pom.xml b/redback-data-management/pom.xml index c232c3a5..a882f785 100644 --- a/redback-data-management/pom.xml +++ b/redback-data-management/pom.xml @@ -35,15 +35,15 @@ org.apache.archiva.redback - redback-rbac-jdo + redback-users-api org.apache.archiva.redback - redback-keys-jdo + redback-rbac-model org.apache.archiva.redback - redback-users-jdo + redback-keys-api org.springframework @@ -88,6 +88,10 @@ jul-to-slf4j test + + org.hsqldb + hsqldb + diff --git a/redback-data-management/src/main/java/org/apache/archiva/redback/management/JdoDataManagementTool.java b/redback-data-management/src/main/java/org/apache/archiva/redback/management/JdoDataManagementTool.java deleted file mode 100644 index 7b625b70..00000000 --- a/redback-data-management/src/main/java/org/apache/archiva/redback/management/JdoDataManagementTool.java +++ /dev/null @@ -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 permissionMap = new HashMap(); - Map resources = new HashMap(); - Map operations = new HashMap(); - for ( Role role : (List) 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 permissions = new ArrayList(); - 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) 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) 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) 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 ) ); - } -} diff --git a/redback-data-management/src/test/java/org/apache/archiva/redback/management/DataManagementTest.java b/redback-data-management/src/test/java/org/apache/archiva/redback/management/DataManagementTest.java index 461337a5..3a781829 100644 --- a/redback-data-management/src/test/java/org/apache/archiva/redback/management/DataManagementTest.java +++ b/redback-data-management/src/test/java/org/apache/archiva/redback/management/DataManagementTest.java @@ -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 diff --git a/redback-data-management/src/test/resources/spring-context.xml b/redback-data-management/src/test/resources/spring-context.xml index 54b5521f..6bf30d57 100644 --- a/redback-data-management/src/test/resources/spring-context.xml +++ b/redback-data-management/src/test/resources/spring-context.xml @@ -28,25 +28,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - JDK_DEFAULT_TIMEZONE - true - - - + 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"> @@ -60,4 +46,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/redback-rbac/redback-rbac-providers/pom.xml b/redback-rbac/redback-rbac-providers/pom.xml index a94d451d..81afcadd 100644 --- a/redback-rbac/redback-rbac-providers/pom.xml +++ b/redback-rbac/redback-rbac-providers/pom.xml @@ -28,10 +28,9 @@ Redback :: RBAC Providers pom - redback-rbac-jdo + redback-rbac-jpa redback-rbac-memory redback-rbac-cached redback-rbac-ldap - redback-rbac-jpa diff --git a/redback-rbac/redback-rbac-providers/redback-rbac-cached/pom.xml b/redback-rbac/redback-rbac-providers/redback-rbac-cached/pom.xml index bb25053c..921bcb70 100644 --- a/redback-rbac/redback-rbac-providers/redback-rbac-cached/pom.xml +++ b/redback-rbac/redback-rbac-providers/redback-rbac-cached/pom.xml @@ -64,10 +64,6 @@ javax.annotation jsr250-api - - org.apache.archiva.redback - redback-rbac-jdo - org.apache.archiva.redback redback-rbac-jpa diff --git a/redback-rbac/redback-rbac-providers/redback-rbac-cached/src/main/java/org/apache/archiva/redback/rbac/cached/CachedRbacManager.java b/redback-rbac/redback-rbac-providers/redback-rbac-cached/src/main/java/org/apache/archiva/redback/rbac/cached/CachedRbacManager.java index b69b0e81..61c62eee 100644 --- a/redback-rbac/redback-rbac-providers/redback-rbac-cached/src/main/java/org/apache/archiva/redback/rbac/cached/CachedRbacManager.java +++ b/redback-rbac/redback-rbac-providers/redback-rbac-cached/src/main/java/org/apache/archiva/redback/rbac/cached/CachedRbacManager.java @@ -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 diff --git a/redback-rbac/redback-rbac-providers/redback-rbac-cached/src/test/resources/spring-context.xml b/redback-rbac/redback-rbac-providers/redback-rbac-cached/src/test/resources/spring-context.xml index 71c14e2f..cde60702 100755 --- a/redback-rbac/redback-rbac-providers/redback-rbac-cached/src/test/resources/spring-context.xml +++ b/redback-rbac/redback-rbac-providers/redback-rbac-cached/src/test/resources/spring-context.xml @@ -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"> - - - - - - - - - JDK_DEFAULT_TIMEZONE - true - - - diff --git a/redback-rbac/redback-rbac-providers/redback-rbac-jpa/src/main/java/org/apache/archiva/redback/rbac/jpa/JpaRbacManager.java b/redback-rbac/redback-rbac-providers/redback-rbac-jpa/src/main/java/org/apache/archiva/redback/rbac/jpa/JpaRbacManager.java index ea219e99..09d3bc79 100644 --- a/redback-rbac/redback-rbac-providers/redback-rbac-jpa/src/main/java/org/apache/archiva/redback/rbac/jpa/JpaRbacManager.java +++ b/redback-rbac/redback-rbac-providers/redback-rbac-jpa/src/main/java/org/apache/archiva/redback/rbac/jpa/JpaRbacManager.java @@ -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> getAssignedPermissionMap(String principal) throws RbacManagerException { + return super.getAssignedPermissionMap(principal); + } + + @Transactional + @Override + public Map 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 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 diff --git a/redback-rbac/redback-rbac-providers/redback-rbac-jpa/src/test/java/org/apache/archiva/redback/rbac/jpa/JpaRbacManagerTest.java b/redback-rbac/redback-rbac-providers/redback-rbac-jpa/src/test/java/org/apache/archiva/redback/rbac/jpa/JpaRbacManagerTest.java index cfc34f46..082d1ea8 100644 --- a/redback-rbac/redback-rbac-providers/redback-rbac-jpa/src/test/java/org/apache/archiva/redback/rbac/jpa/JpaRbacManagerTest.java +++ b/redback-rbac/redback-rbac-providers/redback-rbac-jpa/src/test/java/org/apache/archiva/redback/rbac/jpa/JpaRbacManagerTest.java @@ -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; diff --git a/redback-rbac/redback-rbac-providers/redback-rbac-ldap/pom.xml b/redback-rbac/redback-rbac-providers/redback-rbac-ldap/pom.xml index 7f2afc33..fd100f5a 100644 --- a/redback-rbac/redback-rbac-providers/redback-rbac-ldap/pom.xml +++ b/redback-rbac/redback-rbac-providers/redback-rbac-ldap/pom.xml @@ -72,10 +72,6 @@ org.apache.archiva.redback redback-users-ldap - - org.apache.archiva.redback - redback-rbac-jdo - org.apache.archiva.redback redback-rbac-cached diff --git a/redback-rbac/redback-rbac-providers/redback-rbac-ldap/src/test/resources/spring-context.xml b/redback-rbac/redback-rbac-providers/redback-rbac-ldap/src/test/resources/spring-context.xml index beae9e07..b92edd4a 100755 --- a/redback-rbac/redback-rbac-providers/redback-rbac-ldap/src/test/resources/spring-context.xml +++ b/redback-rbac/redback-rbac-providers/redback-rbac-ldap/src/test/resources/spring-context.xml @@ -63,20 +63,6 @@ - - - - - - - - - JDK_DEFAULT_TIMEZONE - true - - - - diff --git a/redback-rbac/redback-rbac-providers/redback-rbac-memory/src/test/resources/spring-context.xml b/redback-rbac/redback-rbac-providers/redback-rbac-memory/src/test/resources/spring-context.xml index cec014ea..781d2b31 100755 --- a/redback-rbac/redback-rbac-providers/redback-rbac-memory/src/test/resources/spring-context.xml +++ b/redback-rbac/redback-rbac-providers/redback-rbac-memory/src/test/resources/spring-context.xml @@ -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"> - - - - - - - - - JDK_DEFAULT_TIMEZONE - true - - - diff --git a/redback-rbac/redback-rbac-role-manager/pom.xml b/redback-rbac/redback-rbac-role-manager/pom.xml index 6930efaa..9586536f 100644 --- a/redback-rbac/redback-rbac-role-manager/pom.xml +++ b/redback-rbac/redback-rbac-role-manager/pom.xml @@ -62,19 +62,10 @@ org.apache.archiva.redback test - - redback-rbac-jdo - org.apache.archiva.redback - test - org.apache.archiva.redback redback-rbac-model - - org.apache.archiva.redback - redback-common-jdo - org.apache.archiva.redback redback-rbac-cached diff --git a/redback-rbac/redback-rbac-role-manager/src/test/java/org/apache/archiva/redback/role/JpoxRoleManagerTest.java b/redback-rbac/redback-rbac-role-manager/src/test/java/org/apache/archiva/redback/role/JpoxRoleManagerTest.java index 53a84cab..3ebbe025 100644 --- a/redback-rbac/redback-rbac-role-manager/src/test/java/org/apache/archiva/redback/role/JpoxRoleManagerTest.java +++ b/redback-rbac/redback-rbac-role-manager/src/test/java/org/apache/archiva/redback/role/JpoxRoleManagerTest.java @@ -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 ); + } + } \ No newline at end of file diff --git a/redback-rbac/redback-rbac-role-manager/src/test/resources/jpox-spring-context.xml b/redback-rbac/redback-rbac-role-manager/src/test/resources/jpox-spring-context.xml index c674a02d..72609b4d 100644 --- a/redback-rbac/redback-rbac-role-manager/src/test/resources/jpox-spring-context.xml +++ b/redback-rbac/redback-rbac-role-manager/src/test/resources/jpox-spring-context.xml @@ -26,13 +26,13 @@ - + - + @@ -41,35 +41,10 @@ - + - - - - - - - - - - - - - - - JDK_DEFAULT_TIMEZONE - READ_UNCOMMITTED - READ_UNCOMMITTED - true - true - true - true - - - - diff --git a/redback-rbac/redback-rbac-role-manager/src/test/resources/spring-context.xml b/redback-rbac/redback-rbac-role-manager/src/test/resources/spring-context.xml index 9ba16d9b..7f866502 100755 --- a/redback-rbac/redback-rbac-role-manager/src/test/resources/spring-context.xml +++ b/redback-rbac/redback-rbac-role-manager/src/test/resources/spring-context.xml @@ -25,19 +25,6 @@ default-lazy-init="false"> - - - - - - - - - JDK_DEFAULT_TIMEZONE - true - - - diff --git a/redback-system/src/test/resources/spring-context.xml b/redback-system/src/test/resources/spring-context.xml index 2b4f86e8..348c365a 100644 --- a/redback-system/src/test/resources/spring-context.xml +++ b/redback-system/src/test/resources/spring-context.xml @@ -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"> - - - - - - - - - JDK_DEFAULT_TIMEZONE - - - diff --git a/redback-users/redback-users-providers/pom.xml b/redback-users/redback-users-providers/pom.xml index 1172f625..6bc7fff5 100644 --- a/redback-users/redback-users-providers/pom.xml +++ b/redback-users/redback-users-providers/pom.xml @@ -36,7 +36,6 @@ redback-users-cached redback-users-memory - redback-users-jdo redback-users-ldap redback-users-configurable redback-users-jpa diff --git a/redback-users/redback-users-providers/redback-users-cached/pom.xml b/redback-users/redback-users-providers/redback-users-cached/pom.xml index b64fe22e..52d28862 100644 --- a/redback-users/redback-users-providers/redback-users-cached/pom.xml +++ b/redback-users/redback-users-providers/redback-users-cached/pom.xml @@ -56,10 +56,6 @@ javax.annotation jsr250-api - - org.apache.archiva.redback - redback-users-jdo - org.apache.archiva.redback redback-users-jpa