[MRM-1747] upgrade to last modello.

git-svn-id: https://svn.apache.org/repos/asf/archiva/redback/redback-core/trunk@1446826 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2013-02-16 00:41:41 +00:00
parent 490f1f5656
commit b2c48de92e
10 changed files with 127 additions and 33 deletions

View File

@ -669,7 +669,11 @@
<plugin>
<groupId>org.codehaus.modello</groupId>
<artifactId>modello-maven-plugin</artifactId>
<version>1.0-alpha-15</version>
<version>1.7-SNAPSHOT</version>
<configuration>
<!-- cause issue with datamanagement module -->
<useJava5>false</useJava5>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>

View File

@ -110,18 +110,39 @@
<configuration>
<version>1.0.1</version>
<packageWithVersion>false</packageWithVersion>
<model>src/main/mdo/keys.mdo</model>
<models>
<model>src/main/mdo/keys.mdo</model>
</models>
</configuration>
<executions>
<execution>
<id>modello-java</id>
<goals>
<goal>java</goal>
<goal>jpox-metadata-class</goal>
<goal>stax-reader</goal>
<goal>stax-writer</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.archiva.redback.components.modello</groupId>
<artifactId>jpox-modello-maven-plugin</artifactId>
<version>1.0-SNAPSHOT</version>
<configuration>
<version>1.0.1</version>
<packageWithVersion>false</packageWithVersion>
<models>
<model>src/main/mdo/keys.mdo</model>
</models>
</configuration>
<executions>
<execution>
<id>modello-jpox</id>
<goals>
<goal>jpox-metadata-class</goal>
</goals>
</execution>
<execution>
<id>jpox-jdo-mapping</id>
<goals>

View File

@ -73,12 +73,12 @@
<version>1.0.0+</version>
<type>String</type>
</field>
<field>
<field xml.format="long">
<name>dateCreated</name>
<version>1.0.0+</version>
<type>Date</type>
</field>
<field>
<field xml.format="long">
<name>dateExpires</name>
<version>1.0.0+</version>
<type>Date</type>

View File

@ -30,4 +30,30 @@ public abstract class AbstractRole
{
return ( getChildRoleNames() != null ) && !getChildRoleNames().isEmpty();
}
/**
* Method equals.
*
* @param other
* @return boolean
*/
public boolean equals( Object other )
{
if ( this == other )
{
return true;
}
if ( !( other instanceof AbstractRole ) )
{
return false;
}
AbstractRole that = (AbstractRole) other;
boolean result = true;
result = result && ( getName() == null ? that.getName() == null : getName().equals( that.getName() ) );
return result;
}
}

View File

@ -103,15 +103,15 @@
<configuration>
<version>1.0.1</version>
<packageWithVersion>false</packageWithVersion>
<model>src/main/mdo/rbac-jdo.mdo</model>
<models>
<model>src/main/mdo/rbac-jdo.mdo</model>
</models>
</configuration>
<executions>
<execution>
<id>modello-java</id>
<goals>
<goal>java</goal>
<goal>jpox-metadata-class</goal>
<goal>jpox-jdo-mapping</goal>
<!-- TODO: Move these to plexus-security-authorization-rbac-model -->
<goal>stax-reader</goal>
<goal>stax-writer</goal>
@ -119,6 +119,27 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.archiva.redback.components.modello</groupId>
<artifactId>jpox-modello-maven-plugin</artifactId>
<version>1.0-SNAPSHOT</version>
<configuration>
<version>1.0.1</version>
<packageWithVersion>false</packageWithVersion>
<models>
<model>src/main/mdo/rbac-jdo.mdo</model>
</models>
</configuration>
<executions>
<execution>
<id>modello-jpox</id>
<goals>
<goal>jpox-metadata-class</goal>
<goal>jpox-jdo-mapping</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jpox-maven-plugin</artifactId>

View File

@ -80,8 +80,7 @@
</class>
<class jpox.stashable="true"
jpox.table="ROLES"
jpox.not-persisted-fields="modelEncoding">
jpox.table="ROLES">
<name>JdoRole</name>
<version>1.0.0+</version>
<interfaces>
@ -155,8 +154,7 @@
</class>
<class jpox.stashable="true"
jpox.table="PERMISSIONS"
jpox.not-persisted-fields="modelEncoding">
jpox.table="PERMISSIONS">
<name>JdoPermission</name>
<version>1.0.0+</version>
<interfaces>
@ -212,8 +210,7 @@
</class>
<class jpox.stashable="true"
jpox.table="OPERATIONS"
jpox.not-persisted-fields="modelEncoding">
jpox.table="OPERATIONS">
<name>JdoOperation</name>
<version>1.0.0+</version>
<interfaces>
@ -251,8 +248,7 @@
</class>
<class jpox.stashable="true"
jpox.table="RESOURCES"
jpox.not-persisted-fields="modelEncoding">
jpox.table="RESOURCES">
<name>JdoResource</name>
<version>1.0.0+</version>
<description>
@ -292,8 +288,7 @@
</class>
<class jpox.stashable="true"
jpox.table="USER_ASSIGNMENTS"
jpox.not-persisted-fields="modelEncoding">
jpox.table="USER_ASSIGNMENTS">
<name>JdoUserAssignment</name>
<description>binding of a principal to a role</description>
<version>1.0.0+</version>
@ -308,7 +303,7 @@
<type>String</type>
<identifier>true</identifier>
</field>
<field jpox.column="LAST_UPDATED">
<field jpox.column="LAST_UPDATED" xml.format="long">
<name>timestamp</name>
<version>1.0.0+</version>
<type>Date</type>

View File

@ -32,6 +32,7 @@ import javax.xml.stream.XMLStreamException;
import junit.framework.TestCase;
import org.apache.archiva.redback.rbac.Operation;
import org.apache.archiva.redback.rbac.Permission;
import org.apache.archiva.redback.rbac.Resource;
import org.apache.archiva.redback.rbac.jdo.io.stax.RbacJdoModelStaxReader;
import org.apache.archiva.redback.rbac.jdo.io.stax.RbacJdoModelStaxWriter;
@ -155,13 +156,13 @@ public class RbacJdoModelStaxTest
assertEquals( expectedAssignment.getRoleNames(), assignment.getRoleNames() );
}
private void assertPermissions( List<JdoPermission> expectedPermissions, List<JdoPermission> permissions )
private void assertPermissions( List<Permission> expectedPermissions, List<Permission> permissions )
{
assertEquals( expectedPermissions.size(), permissions.size() );
for ( JdoPermission permission : permissions )
for ( Permission permission : permissions )
{
boolean found = false;
for ( JdoPermission expectedPermission : expectedPermissions )
for ( Permission expectedPermission : expectedPermissions )
{
if ( expectedPermission.getName().equals( permission.getName() ) )
{
@ -177,7 +178,7 @@ public class RbacJdoModelStaxTest
}
}
private void assertPermission( JdoPermission expectedPermission, JdoPermission permission )
private void assertPermission( Permission expectedPermission, Permission permission )
{
assertEquals( expectedPermission.getDescription(), permission.getDescription() );
assertOperation( expectedPermission.getOperation(), permission.getOperation() );

View File

@ -260,7 +260,8 @@ public abstract class AbstractRbacManagerTestCase
Role actualAdmin = rbacManager.getRole( adminRole.getName() );
Role actualDevel = rbacManager.getRole( develRole.getName() );
assertEquals( adminRole, actualAdmin );
assertEquals( adminRole.getName(), actualAdmin.getName() );
assertEquals( adminRole.getChildRoleNames(), actualAdmin.getChildRoleNames() );
assertEquals( develRole, actualDevel );
/* Assert some event tracker stuff */
@ -287,7 +288,8 @@ public abstract class AbstractRbacManagerTestCase
Role actualRole = rbacManager.getRole( rolename );
assertEquals( testRole, actualRole );
assertEquals( testRole.getName(), actualRole.getName() );
assertEquals( testRole.getChildRoleNames(), actualRole.getChildRoleNames() );
assertEquals( 1, rbacManager.getAllRoles().size() );
assertEquals( 0, rbacManager.getAllPermissions().size() );
@ -329,7 +331,8 @@ public abstract class AbstractRbacManagerTestCase
Role actualAdmin = manager.getRole( adminRole.getName() );
Role actualDevel = manager.getRole( develRole.getName() );
assertEquals( adminRole, actualAdmin );
assertEquals( adminRole.getName(), actualAdmin.getName() );
assertEquals( adminRole.getChildRoleNames(), actualAdmin.getChildRoleNames() );
assertEquals( develRole, actualDevel );
// Now add a child role.
@ -360,7 +363,8 @@ public abstract class AbstractRbacManagerTestCase
Role actualAdmin = manager.getRole( adminRole.getName() );
Role actualDevel = manager.getRole( develRole.getName() );
assertEquals( adminRole, actualAdmin );
assertEquals( adminRole.getName(), actualAdmin.getName() );
assertEquals( adminRole.getChildRoleNames(), actualAdmin.getChildRoleNames() );
assertEquals( develRole, actualDevel );
// Now do a child role.
@ -769,7 +773,8 @@ public abstract class AbstractRbacManagerTestCase
Role actualAdmin = rbacManager.getRole( adminRole.getName() );
Role actualDevel = rbacManager.getRole( develRole.getName() );
assertEquals( adminRole, actualAdmin );
assertEquals( adminRole.getName(), actualAdmin.getName() );
assertEquals( adminRole.getChildRoleNames(), actualAdmin.getChildRoleNames() );
assertEquals( develRole, actualDevel );
// Attempt to remove perm now.

View File

@ -116,18 +116,39 @@
<configuration>
<version>1.0.1</version>
<packageWithVersion>false</packageWithVersion>
<model>src/main/mdo/user.mdo</model>
<models>
<model>src/main/mdo/user.mdo</model>
</models>
</configuration>
<executions>
<execution>
<id>modello-java</id>
<goals>
<goal>java</goal>
<goal>jpox-metadata-class</goal>
<goal>stax-reader</goal>
<goal>stax-writer</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.archiva.redback.components.modello</groupId>
<artifactId>jpox-modello-maven-plugin</artifactId>
<version>1.0-SNAPSHOT</version>
<configuration>
<version>1.0.1</version>
<packageWithVersion>false</packageWithVersion>
<models>
<model>src/main/mdo/user.mdo</model>
</models>
</configuration>
<executions>
<execution>
<id>modello-jpox</id>
<goals>
<goal>jpox-metadata-class</goal>
</goals>
</execution>
<execution>
<id>jpox-jdo-mapping</id>
<goals>

View File

@ -83,12 +83,12 @@
<type>String</type>
<identifier>true</identifier>
</field>
<field>
<field xml.format="long">
<name>lastPasswordChange</name>
<version>1.0.0+</version>
<type>Date</type>
</field>
<field>
<field xml.format="long">
<name>lastLoginDate</name>
<version>1.0.0+</version>
<type>Date</type>
@ -134,7 +134,7 @@
<multiplicity>*</multiplicity>
</association>
</field>
<field>
<field xml.format="long">
<name>accountCreationDate</name>
<version>1.0.0+</version>
<type>Date</type>