This is an automated email from the ASF dual-hosted git repository.
martin_s pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/archiva-redback-core.git
The following commit(s) were added to refs/heads/master by this push:
new f88a365 Removing assertj dependency
f88a365 is described below
commit f88a365bc8f43dbd6b37209d7975127caded002a
Author: Martin Stockhammer <[email protected]>
AuthorDate: Sun Jul 12 11:30:15 2020 +0200
Removing assertj dependency
---
pom.xml | 9 +++++
.../rest/api/services/v2/PasswordService.java | 2 +-
.../redback-rest/redback-rest-services/pom.xml | 11 +++---
.../interceptors/PermissionsInterceptor.java | 2 +-
.../rest/services/LdapGroupMappingServiceTest.java | 45 ++++++++++++----------
.../redback/rest/services/UserServiceTest.java | 21 +++++-----
.../redback/rest/services/v2/GroupServiceTest.java | 45 ++++++++++++----------
7 files changed, 77 insertions(+), 58 deletions(-)
diff --git a/pom.xml b/pom.xml
index 981de3d..7ab21ef 100644
--- a/pom.xml
+++ b/pom.xml
@@ -827,6 +827,15 @@
<version>${jjwt.version}</version>
<scope>runtime</scope>
</dependency>
+
+ <dependency>
+ <groupId>io.rest-assured</groupId>
+ <artifactId>rest-assured</artifactId>
+ <version>${rest-assured.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+
</dependencies>
</dependencyManagement>
diff --git
a/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/services/v2/PasswordService.java
b/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/services/v2/PasswordService.java
index 57e51c9..7982f3d 100644
---
a/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/services/v2/PasswordService.java
+++
b/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/services/v2/PasswordService.java
@@ -32,7 +32,7 @@ import javax.ws.rs.core.MediaType;
* @author Olivier Lamy
* @since 1.4
*/
-@Path( "/passwordService/" )
+@Path( "/password/" )
public interface PasswordService
{
diff --git a/redback-integrations/redback-rest/redback-rest-services/pom.xml
b/redback-integrations/redback-rest/redback-rest-services/pom.xml
index 9d67f5b..5d872b4 100644
--- a/redback-integrations/redback-rest/redback-rest-services/pom.xml
+++ b/redback-integrations/redback-rest/redback-rest-services/pom.xml
@@ -330,12 +330,6 @@
</dependency>
<dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-core</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
<groupId>org.apache.archiva.components</groupId>
<artifactId>archiva-components-spring-apacheds</artifactId>
<scope>test</scope>
@@ -352,6 +346,11 @@
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>io.rest-assured</groupId>
+ <artifactId>rest-assured</artifactId>
+ <scope>test</scope>
+ </dependency>
diff --git
a/redback-integrations/redback-rest/redback-rest-services/src/main/java/org/apache/archiva/redback/rest/services/interceptors/PermissionsInterceptor.java
b/redback-integrations/redback-rest/redback-rest-services/src/main/java/org/apache/archiva/redback/rest/services/interceptors/PermissionsInterceptor.java
index 64d11d0..f4c79d7 100644
---
a/redback-integrations/redback-rest/redback-rest-services/src/main/java/org/apache/archiva/redback/rest/services/interceptors/PermissionsInterceptor.java
+++
b/redback-integrations/redback-rest/redback-rest-services/src/main/java/org/apache/archiva/redback/rest/services/interceptors/PermissionsInterceptor.java
@@ -69,7 +69,7 @@ public class PermissionsInterceptor
@Context
private ResourceInfo resourceInfo;
- private final Logger log = LoggerFactory.getLogger( getClass() );
+ private static final Logger log = LoggerFactory.getLogger(
PermissionsInterceptor.class );
public void filter( ContainerRequestContext containerRequestContext )
{
diff --git
a/redback-integrations/redback-rest/redback-rest-services/src/test/java/org/apache/archiva/redback/rest/services/LdapGroupMappingServiceTest.java
b/redback-integrations/redback-rest/redback-rest-services/src/test/java/org/apache/archiva/redback/rest/services/LdapGroupMappingServiceTest.java
index 84aa74b..a4c4ed4 100644
---
a/redback-integrations/redback-rest/redback-rest-services/src/test/java/org/apache/archiva/redback/rest/services/LdapGroupMappingServiceTest.java
+++
b/redback-integrations/redback-rest/redback-rest-services/src/test/java/org/apache/archiva/redback/rest/services/LdapGroupMappingServiceTest.java
@@ -22,7 +22,6 @@ import org.apache.archiva.components.apacheds.ApacheDs;
import org.apache.archiva.redback.rest.api.model.LdapGroupMapping;
import org.apache.archiva.redback.rest.api.services.LdapGroupMappingService;
import org.apache.commons.lang3.StringUtils;
-import org.assertj.core.api.Condition;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.annotation.DirtiesContext;
@@ -37,9 +36,9 @@ import javax.naming.directory.BasicAttributes;
import javax.naming.directory.DirContext;
import javax.naming.directory.InitialDirContext;
import java.util.Arrays;
+import java.util.Collection;
import java.util.List;
-import static org.assertj.core.api.Assertions.assertThat;
/**
* @author Olivier Lamy
@@ -166,7 +165,12 @@ public class LdapGroupMappingServiceTest
List<String> allGroups = service.getLdapGroups().getStrings();
- assertThat( allGroups ).isNotNull().isNotEmpty().hasSize( 3
).containsAll( groups );
+ assertNotNull( allGroups );
+ assertTrue( allGroups.size( ) > 0 );
+ assertEquals( 3, allGroups.size( ) );
+ for (String group : groups) {
+ assertTrue( allGroups.contains( group ) );
+ }
}
catch ( Exception e )
{
@@ -185,7 +189,8 @@ public class LdapGroupMappingServiceTest
List<LdapGroupMapping> mappings = service.getLdapGroupMappings();
- assertThat( mappings ).isNotNull().isNotEmpty().hasSize( 3 );
+ assertNotNull( mappings );
+ assertEquals( 3, mappings.size() );
}
catch ( Exception e )
{
@@ -204,7 +209,8 @@ public class LdapGroupMappingServiceTest
List<LdapGroupMapping> mappings = service.getLdapGroupMappings();
- assertThat( mappings ).isNotNull().isNotEmpty().hasSize( 3 );
+ assertNotNull( mappings );
+ assertEquals( 3, mappings.size( ) );
LdapGroupMapping ldapGroupMapping = new LdapGroupMapping( "ldap
group", Arrays.asList( "redback role" ) );
@@ -212,28 +218,25 @@ public class LdapGroupMappingServiceTest
mappings = service.getLdapGroupMappings();
- assertThat( mappings ).isNotNull().isNotEmpty().hasSize( 4 ).are(
- new Condition<LdapGroupMapping>()
- {
- @Override
- public boolean matches( LdapGroupMapping mapping )
- {
- if ( StringUtils.equals( "ldap group",
mapping.getGroup() ) )
- {
- assertThat( mapping.getRoleNames()
).isNotNull().isNotEmpty().containsOnly(
- "redback role" );
- return true;
- }
-
- return true;
+ assertNotNull( mappings );
+ assertEquals( 4, mappings.size( ) );
+ for (LdapGroupMapping mapping : mappings) {
+ if (StringUtils.equals( "ldap group", mapping.getGroup( ) ) ) {
+ Collection<String> names = mapping.getRoleNames( );
+ assertNotNull( names );
+ assertTrue( names.size( ) > 0 );
+ for (String name : names) {
+ assertEquals( "redback role", name );
}
- } );
+ }
+ }
service.removeLdapGroupMapping( "ldap group" );
mappings = service.getLdapGroupMappings();
- assertThat( mappings ).isNotNull().isNotEmpty().hasSize( 3 );
+ assertNotNull( mappings );
+ assertEquals( 3, mappings.size( ) );
}
catch ( Exception e )
{
diff --git
a/redback-integrations/redback-rest/redback-rest-services/src/test/java/org/apache/archiva/redback/rest/services/UserServiceTest.java
b/redback-integrations/redback-rest/redback-rest-services/src/test/java/org/apache/archiva/redback/rest/services/UserServiceTest.java
index f0ca82e..555004e 100644
---
a/redback-integrations/redback-rest/redback-rest-services/src/test/java/org/apache/archiva/redback/rest/services/UserServiceTest.java
+++
b/redback-integrations/redback-rest/redback-rest-services/src/test/java/org/apache/archiva/redback/rest/services/UserServiceTest.java
@@ -41,8 +41,6 @@ import java.util.Collection;
import java.util.Collections;
import java.util.List;
-import static org.assertj.core.api.Assertions.assertThat;
-
/**
* @author Olivier Lamy
@@ -164,8 +162,10 @@ public class UserServiceTest
log.info( "messageContent: {}", messageContent );
- assertThat( messageContent ).contains( "Use the following URL to
validate your account." ).contains(
- "http://wine.fr/bordeaux" ).containsIgnoringCase( "toto" );
+ assertNotNull( messageContent );
+ assertTrue( messageContent.contains( "Use the following URL to
validate your account." ) );
+ assertTrue( messageContent.contains( "http://wine.fr/bordeaux" ) );
+ assertTrue( messageContent.contains( "toto" ) );
assertTrue( service.validateUserFromKey( key ).isSuccess() );
@@ -222,9 +222,10 @@ public class UserServiceTest
String messageContent = emailMessages.get( 0 ).getText();
log.info( "messageContent: {}", messageContent );
-
- assertThat( messageContent ).contains( "Use the following URL to
validate your account." ).contains(
- "http://localhost:" + getServerPort() ).containsIgnoringCase(
"toto" );
+ assertNotNull( messageContent );
+ assertTrue( messageContent.contains( "Use the following URL to
validate your account." ));
+ assertTrue(messageContent.contains("http://localhost:" +
getServerPort() ));
+ assertTrue( messageContent.toLowerCase( ).contains( "toto" ) );
assertTrue( service.validateUserFromKey( key ).isSuccess() );
@@ -304,8 +305,10 @@ public class UserServiceTest
String messageContent = emailMessages.get( 1 ).getText();
- assertThat( messageContent ).contains( "Password Reset"
).contains( "Username: toto" ).contains(
- "http://foo.fr/bar" );
+ assertNotNull( messageContent );
+ assertTrue( messageContent.contains( "Password Reset" ));
+ assertTrue(messageContent.contains( "Username: toto" ));
+ assertTrue( messageContent.contains( "http://foo.fr/bar" ) );
}
diff --git
a/redback-integrations/redback-rest/redback-rest-services/src/test/java/org/apache/archiva/redback/rest/services/v2/GroupServiceTest.java
b/redback-integrations/redback-rest/redback-rest-services/src/test/java/org/apache/archiva/redback/rest/services/v2/GroupServiceTest.java
index 70e412d..c67f397 100644
---
a/redback-integrations/redback-rest/redback-rest-services/src/test/java/org/apache/archiva/redback/rest/services/v2/GroupServiceTest.java
+++
b/redback-integrations/redback-rest/redback-rest-services/src/test/java/org/apache/archiva/redback/rest/services/v2/GroupServiceTest.java
@@ -25,7 +25,6 @@ import
org.apache.archiva.redback.rest.api.services.v2.GroupService;
import org.apache.commons.lang3.StringUtils;
import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
import org.apache.cxf.jaxrs.client.WebClient;
-import org.assertj.core.api.Condition;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
@@ -46,11 +45,13 @@ import javax.naming.directory.DirContext;
import javax.naming.directory.InitialDirContext;
import javax.ws.rs.core.MediaType;
import java.util.Arrays;
+import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
-import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.Assert.*;
+
/**
* @author Olivier Lamy
@@ -295,7 +296,11 @@ public class GroupServiceTest
List<String> allGroups = service.getGroups( Integer.valueOf( 0 ),
Integer.valueOf( Integer.MAX_VALUE ) ).getData( ).stream( ).map( group ->
group.getName( ) ).collect( Collectors.toList( ) );
- assertThat( allGroups ).isNotNull( ).isNotEmpty( ).hasSize( 3
).containsAll( groups );
+ assertNotNull( allGroups );
+ assertEquals( 3, allGroups.size( ) );
+ for (String group : groups) {
+ assertTrue( allGroups.contains( group ) );
+ }
}
catch ( Exception e )
{
@@ -316,7 +321,8 @@ public class GroupServiceTest
List<GroupMapping> mappings = service.getGroupMappings( );
- assertThat( mappings ).isNotNull( ).isNotEmpty( ).hasSize( 3 );
+ assertNotNull( mappings );
+ assertEquals( 3, mappings.size( ) );
}
catch ( Exception e )
{
@@ -337,7 +343,8 @@ public class GroupServiceTest
List<GroupMapping> mappings = service.getGroupMappings( );
- assertThat( mappings ).isNotNull( ).isNotEmpty( ).hasSize( 3 );
+ assertNotNull( mappings );
+ assertEquals( 3, mappings.size( ) );
GroupMapping groupMapping = new GroupMapping( "ldap group",
Arrays.asList( "redback role" ) );
@@ -345,28 +352,26 @@ public class GroupServiceTest
mappings = service.getGroupMappings( );
- assertThat( mappings ).isNotNull( ).isNotEmpty( ).hasSize( 4 ).are(
- new Condition<GroupMapping>( )
+ assertNotNull( mappings );
+ assertEquals( 4, mappings.size( ) );
+ for (GroupMapping mapping : mappings) {
+ if ( StringUtils.equals( "ldap group", mapping.getGroup( ) ) )
{
- @Override
- public boolean matches( GroupMapping mapping )
- {
- if ( StringUtils.equals( "ldap group",
mapping.getGroup( ) ) )
- {
- assertThat( mapping.getRoleNames( ) ).isNotNull(
).isNotEmpty( ).containsOnly(
- "redback role" );
- return true;
- }
-
- return true;
+ Collection<String> names = mapping.getRoleNames( );
+ assertNotNull( names );
+ assertTrue( names.size( ) > 0 );
+ for (String name : names) {
+ assertEquals( "redback role", name );
}
- } );
+ }
+ }
service.removeGroupMapping( "ldap group" );
mappings = service.getGroupMappings( );
- assertThat( mappings ).isNotNull( ).isNotEmpty( ).hasSize( 3 );
+ assertNotNull( mappings );
+ assertEquals( 3, mappings.size( ) );
}
catch ( Exception e )
{