use assertj as fest-assert is not maintained anymore

git-svn-id: https://svn.apache.org/repos/asf/archiva/redback/redback-core/trunk@1581245 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2014-03-25 05:59:39 +00:00
parent 2f3c9fec7f
commit 4cb59feb27
8 changed files with 44 additions and 45 deletions

View File

@ -662,9 +662,9 @@
<version>1.3</version>
</dependency>
<dependency>
<groupId>org.easytesting</groupId>
<artifactId>fest-assert-core</artifactId>
<version>2.0M9</version>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>1.6.0</version>
</dependency>
</dependencies>
</dependencyManagement>

View File

@ -63,8 +63,8 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.easytesting</groupId>
<artifactId>fest-assert-core</artifactId>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>

View File

@ -25,7 +25,7 @@ import org.apache.archiva.redback.common.ldap.connection.LdapConnectionFactory;
import org.apache.archiva.redback.components.apacheds.ApacheDs;
import org.apache.archiva.redback.policy.PasswordEncoder;
import org.apache.archiva.redback.policy.encoders.SHA1PasswordEncoder;
import org.fest.assertions.api.Assertions;
import static org.assertj.core.api.Assertions.assertThat;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@ -298,7 +298,7 @@ public class TestLdapRoleMapper
log.info( "allGroups: {}", allGroups );
Assertions.assertThat( allGroups ).isNotNull().isNotEmpty().contains( "archiva-admin",
assertThat( allGroups ).isNotNull().isNotEmpty().contains( "archiva-admin",
"internal-repo-manager" );
}
@ -310,11 +310,11 @@ public class TestLdapRoleMapper
log.info( "users for archiva-admin: {}", users );
Assertions.assertThat( users ).isNotNull().isNotEmpty().hasSize( 2 ).contains( "admin", "user.7" );
assertThat( users ).isNotNull().isNotEmpty().hasSize( 2 ).contains( "admin", "user.7" );
users = ldapRoleMapper.getGroupsMember( "internal-repo-observer", getDirContext() );
Assertions.assertThat( users ).isNotNull().isNotEmpty().hasSize( 3 ).contains( "admin", "user.7", "user.8" );
assertThat( users ).isNotNull().isNotEmpty().hasSize( 3 ).contains( "admin", "user.7", "user.8" );
}
@Test
@ -325,17 +325,17 @@ public class TestLdapRoleMapper
log.info( "groups for admin: {}", groups );
Assertions.assertThat( groups ).isNotNull().isNotEmpty().hasSize( 3 ).contains( "archiva-admin",
assertThat( groups ).isNotNull().isNotEmpty().hasSize( 3 ).contains( "archiva-admin",
"internal-repo-manager",
"internal-repo-observer" );
groups = ldapRoleMapper.getGroups( "user.8", getDirContext() );
Assertions.assertThat( groups ).isNotNull().isNotEmpty().hasSize( 1 ).contains( "internal-repo-observer" );
assertThat( groups ).isNotNull().isNotEmpty().hasSize( 1 ).contains( "internal-repo-observer" );
groups = ldapRoleMapper.getGroups( "user.7", getDirContext() );
Assertions.assertThat( groups ).isNotNull().isNotEmpty().hasSize( 2 ).contains( "archiva-admin",
assertThat( groups ).isNotNull().isNotEmpty().hasSize( 2 ).contains( "archiva-admin",
"internal-repo-observer" );
}
@ -347,7 +347,7 @@ public class TestLdapRoleMapper
log.info( "roles for admin: {}", roles );
Assertions.assertThat( roles ).isNotNull().isNotEmpty().hasSize( 3 ).contains( "Archiva System Administrator",
assertThat( roles ).isNotNull().isNotEmpty().hasSize( 3 ).contains( "Archiva System Administrator",
"Internal Repo Manager",
"Internal Repo Observer" );
@ -355,14 +355,14 @@ public class TestLdapRoleMapper
log.info( "roles for user.7: {}", roles );
Assertions.assertThat( roles ).isNotNull().isNotEmpty().hasSize( 2 ).contains( "Archiva System Administrator",
assertThat( roles ).isNotNull().isNotEmpty().hasSize( 2 ).contains( "Archiva System Administrator",
"Internal Repo Observer" );
roles = ldapRoleMapper.getRoles( "user.8", getDirContext(), roleNames );
log.info( "roles for user.8: {}", roles );
Assertions.assertThat( roles ).isNotNull().isNotEmpty().hasSize( 1 ).contains( "Internal Repo Observer" );
assertThat( roles ).isNotNull().isNotEmpty().hasSize( 1 ).contains( "Internal Repo Observer" );
}

View File

@ -183,8 +183,8 @@
</dependency>
<dependency>
<groupId>org.easytesting</groupId>
<artifactId>fest-assert-core</artifactId>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>

View File

@ -21,10 +21,8 @@ package org.apache.archiva.redback.rest.services;
import org.apache.archiva.redback.components.apacheds.ApacheDs;
import org.apache.archiva.redback.rest.api.model.LdapGroupMapping;
import org.apache.archiva.redback.rest.api.services.LdapGroupMappingService;
import org.apache.archiva.redback.rest.api.services.RedbackServiceException;
import org.apache.commons.lang.StringUtils;
import org.fest.assertions.api.Assertions;
import org.fest.assertions.core.Condition;
import org.assertj.core.api.Condition;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.annotation.DirtiesContext;
@ -40,7 +38,8 @@ import javax.naming.directory.DirContext;
import javax.naming.directory.InitialDirContext;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import static org.assertj.core.api.Assertions.assertThat;
/**
* @author Olivier Lamy
@ -167,7 +166,7 @@ public class LdapGroupMappingServiceTest
List<String> allGroups = service.getLdapGroups().getStrings();
Assertions.assertThat( allGroups ).isNotNull().isNotEmpty().hasSize( 3 ).containsAll( groups );
assertThat( allGroups ).isNotNull().isNotEmpty().hasSize( 3 ).containsAll( groups );
}
catch ( Exception e )
{
@ -186,7 +185,7 @@ public class LdapGroupMappingServiceTest
List<LdapGroupMapping> mappings = service.getLdapGroupMappings();
Assertions.assertThat( mappings ).isNotNull().isNotEmpty().hasSize( 3 );
assertThat( mappings ).isNotNull().isNotEmpty().hasSize( 3 );
}
catch ( Exception e )
{
@ -205,7 +204,7 @@ public class LdapGroupMappingServiceTest
List<LdapGroupMapping> mappings = service.getLdapGroupMappings();
Assertions.assertThat( mappings ).isNotNull().isNotEmpty().hasSize( 3 );
assertThat( mappings ).isNotNull().isNotEmpty().hasSize( 3 );
LdapGroupMapping ldapGroupMapping = new LdapGroupMapping( "ldap group", Arrays.asList( "redback role" ) );
@ -213,7 +212,7 @@ public class LdapGroupMappingServiceTest
mappings = service.getLdapGroupMappings();
Assertions.assertThat( mappings ).isNotNull().isNotEmpty().hasSize( 4 ).are(
assertThat( mappings ).isNotNull().isNotEmpty().hasSize( 4 ).are(
new Condition<LdapGroupMapping>()
{
@Override
@ -221,7 +220,7 @@ public class LdapGroupMappingServiceTest
{
if ( StringUtils.equals( "ldap group", mapping.getGroup() ) )
{
Assertions.assertThat( mapping.getRoleNames() ).isNotNull().isNotEmpty().containsOnly(
assertThat( mapping.getRoleNames() ).isNotNull().isNotEmpty().containsOnly(
"redback role" );
return true;
}
@ -234,7 +233,7 @@ public class LdapGroupMappingServiceTest
mappings = service.getLdapGroupMappings();
Assertions.assertThat( mappings ).isNotNull().isNotEmpty().hasSize( 3 );
assertThat( mappings ).isNotNull().isNotEmpty().hasSize( 3 );
}
catch ( Exception e )
{

View File

@ -31,7 +31,7 @@ import org.apache.archiva.redback.rest.services.mock.ServicesAssert;
import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
import org.apache.cxf.jaxrs.client.ServerWebApplicationException;
import org.apache.cxf.jaxrs.client.WebClient;
import org.fest.assertions.api.Assertions;
import static org.assertj.core.api.Assertions.assertThat;
import org.junit.Test;
import javax.ws.rs.core.MediaType;
@ -152,7 +152,7 @@ public class UserServiceTest
log.info( "messageContent: {}", messageContent );
Assertions.assertThat( messageContent ).contains( "Use the following URL to validate your account." ).contains(
assertThat( messageContent ).contains( "Use the following URL to validate your account." ).contains(
"http://wine.fr/bordeaux" ).containsIgnoringCase( "toto" );
assertTrue( service.validateUserFromKey( key ) );
@ -211,7 +211,7 @@ public class UserServiceTest
log.info( "messageContent: {}", messageContent );
Assertions.assertThat( messageContent ).contains( "Use the following URL to validate your account." ).contains(
assertThat( messageContent ).contains( "Use the following URL to validate your account." ).contains(
"http://localhost:" + port ).containsIgnoringCase( "toto" );
assertTrue( service.validateUserFromKey( key ) );
@ -292,7 +292,7 @@ public class UserServiceTest
String messageContent = emailMessages.get( 1 ).getText();
Assertions.assertThat( messageContent ).contains( "Password Reset" ).contains( "Username: toto" ).contains(
assertThat( messageContent ).contains( "Password Reset" ).contains( "Username: toto" ).contains(
"http://foo.fr/bar" );

View File

@ -48,8 +48,8 @@
<artifactId>spring-test</artifactId>
</dependency>
<dependency>
<groupId>org.easytesting</groupId>
<artifactId>fest-assert-core</artifactId>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -26,7 +26,7 @@ import org.apache.archiva.redback.rbac.UserAssignment;
import org.apache.archiva.redback.rbac.Permission;
import org.apache.archiva.redback.rbac.RbacPermanentException;
import org.apache.archiva.redback.tests.utils.RBACDefaults;
import org.fest.assertions.api.Assertions;
import static org.assertj.core.api.Assertions.assertThat;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
@ -467,7 +467,7 @@ public abstract class AbstractRbacManagerTestCase
Set<Permission> assignedPermissions = manager.getAssignedPermissions( adminPrincipal );
Assertions.assertThat( assignedPermissions ).isNotNull().isNotEmpty().hasSize( 1 );
assertThat( assignedPermissions ).isNotNull().isNotEmpty().hasSize( 1 );
/* Assert some event tracker stuff */
assertEventTracker( 1, 0, 1, 0, true, true );
@ -679,18 +679,18 @@ public abstract class AbstractRbacManagerTestCase
assignment.addRoleName( adminRole.getName() );
assignment = manager.saveUserAssignment( assignment );
Assertions.assertThat( assignment.getRoleNames() ).isNotNull().isNotEmpty().hasSize( 3 );
Assertions.assertThat( manager.getAllUserAssignments() ).isNotNull().isNotEmpty().hasSize(
assertThat( assignment.getRoleNames() ).isNotNull().isNotEmpty().hasSize( 3 );
assertThat( manager.getAllUserAssignments() ).isNotNull().isNotEmpty().hasSize(
incAssignements( 1 ) );
Assertions.assertThat( manager.getAllRoles() ).isNotNull().isNotEmpty().hasSize( 3 );
assertThat( manager.getAllRoles() ).isNotNull().isNotEmpty().hasSize( 3 );
afterSetup();
// Get the List of Assigned Roles for user bob.
Collection<Role> assignedRoles = manager.getAssignedRoles( username );
Assertions.assertThat( assignedRoles ).isNotNull().isNotEmpty().hasSize( 3 );
assertThat( assignedRoles ).isNotNull().isNotEmpty().hasSize( 3 );
}
/**
@ -717,8 +717,8 @@ public abstract class AbstractRbacManagerTestCase
Role added = manager.saveRole( getDeveloperRole() );
String roleName = added.getName();
Assertions.assertThat( manager.getAllRoles() ).isNotNull().isNotEmpty().hasSize( 3 );
Assertions.assertThat( manager.getAllPermissions() ).isNotNull().isNotEmpty().hasSize( 3 );
assertThat( manager.getAllRoles() ).isNotNull().isNotEmpty().hasSize( 3 );
assertThat( manager.getAllPermissions() ).isNotNull().isNotEmpty().hasSize( 3 );
// Setup User / Assignment with 1 role.
String username = "bob";
@ -727,15 +727,15 @@ public abstract class AbstractRbacManagerTestCase
assignment.addRoleName( roleName );
manager.saveUserAssignment( assignment );
Assertions.assertThat( manager.getAllUserAssignments() ).isNotNull().isNotEmpty().hasSize(
assertThat( manager.getAllUserAssignments() ).isNotNull().isNotEmpty().hasSize(
incAssignements( 1 ) );
Assertions.assertThat( manager.getAllRoles() ).isNotNull().isNotEmpty().hasSize( 3 );
Assertions.assertThat( manager.getAllPermissions() ).isNotNull().isNotEmpty().hasSize( 3 );
assertThat( manager.getAllRoles() ).isNotNull().isNotEmpty().hasSize( 3 );
assertThat( manager.getAllPermissions() ).isNotNull().isNotEmpty().hasSize( 3 );
// Get the List of Assigned Roles for user bob.
Collection<Permission> assignedPermissions = manager.getAssignedPermissions( username );
Assertions.assertThat( assignedPermissions ).isNotNull().isNotEmpty().hasSize( 1 );
assertThat( assignedPermissions ).isNotNull().isNotEmpty().hasSize( 1 );
}
public Role getChildRole( RBACManager manager, Role role, String expectedChildRoleName, int childRoleCount )