-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Fix #1216: Modify Paging of Activations
- Loading branch information
Showing
19 changed files
with
161 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,13 +18,12 @@ | |
package io.getlime.security.powerauth.app.server; | ||
|
||
import com.wultra.security.powerauth.client.model.request.CreateApplicationRequest; | ||
import io.getlime.security.powerauth.app.server.service.exceptions.GenericServiceException; | ||
import io.getlime.security.powerauth.app.server.service.PowerAuthService; | ||
import io.getlime.security.powerauth.app.server.service.exceptions.GenericServiceException; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.test.context.junit.jupiter.SpringExtension; | ||
import org.springframework.test.context.ActiveProfiles; | ||
|
||
import java.util.UUID; | ||
|
||
|
@@ -37,8 +36,8 @@ | |
* @author Lukas Lukovsky, [email protected] | ||
*/ | ||
@SpringBootTest | ||
@ExtendWith(SpringExtension.class) | ||
public class CreateApplicationTest { | ||
@ActiveProfiles("test") | ||
class CreateApplicationTest { | ||
|
||
private PowerAuthService powerAuthService; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,13 +22,12 @@ | |
import com.wultra.security.powerauth.client.model.response.CreateApplicationResponse; | ||
import com.wultra.security.powerauth.client.model.response.GetApplicationDetailResponse; | ||
import io.getlime.security.powerauth.app.server.database.model.entity.ApplicationEntity; | ||
import io.getlime.security.powerauth.app.server.service.exceptions.GenericServiceException; | ||
import io.getlime.security.powerauth.app.server.service.PowerAuthService; | ||
import io.getlime.security.powerauth.app.server.service.exceptions.GenericServiceException; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.test.context.junit.jupiter.SpringExtension; | ||
import org.springframework.test.context.ActiveProfiles; | ||
|
||
import java.util.Collections; | ||
|
||
|
@@ -41,8 +40,8 @@ | |
* @author Lukas Lukovsky, [email protected] | ||
*/ | ||
@SpringBootTest | ||
@ExtendWith(SpringExtension.class) | ||
public class GetApplicationDetailTest { | ||
@ActiveProfiles("test") | ||
class GetApplicationDetailTest { | ||
|
||
private PowerAuthService powerAuthService; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,14 +18,13 @@ | |
package io.getlime.security.powerauth.app.server; | ||
|
||
import io.getlime.security.powerauth.app.server.converter.RecoveryPrivateKeyConverter; | ||
import io.getlime.security.powerauth.app.server.database.model.enumeration.EncryptionMode; | ||
import io.getlime.security.powerauth.app.server.database.model.RecoveryPrivateKey; | ||
import io.getlime.security.powerauth.app.server.database.model.enumeration.EncryptionMode; | ||
import io.getlime.security.powerauth.app.server.service.exceptions.GenericServiceException; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.test.context.junit.jupiter.SpringExtension; | ||
import org.springframework.test.context.ActiveProfiles; | ||
|
||
import java.util.Base64; | ||
|
||
|
@@ -38,8 +37,8 @@ | |
* @author Roman Strobl, [email protected] | ||
*/ | ||
@SpringBootTest | ||
@ExtendWith(SpringExtension.class) | ||
public class RecoveryPrivateKeyConverterTest { | ||
@ActiveProfiles("test") | ||
class RecoveryPrivateKeyConverterTest { | ||
|
||
private static final String RECOVERY_PRIVATE_KEY_PLAIN = "ALwHHv90Ixaor+8CkBThDQP/8UUm59Bvdod5u7z97zGm"; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,14 +18,13 @@ | |
package io.getlime.security.powerauth.app.server; | ||
|
||
import io.getlime.security.powerauth.app.server.converter.ServerPrivateKeyConverter; | ||
import io.getlime.security.powerauth.app.server.database.model.enumeration.EncryptionMode; | ||
import io.getlime.security.powerauth.app.server.database.model.ServerPrivateKey; | ||
import io.getlime.security.powerauth.app.server.database.model.enumeration.EncryptionMode; | ||
import io.getlime.security.powerauth.app.server.service.exceptions.GenericServiceException; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.test.context.junit.jupiter.SpringExtension; | ||
import org.springframework.test.context.ActiveProfiles; | ||
|
||
import java.util.Base64; | ||
|
||
|
@@ -38,8 +37,8 @@ | |
* @author Roman Strobl, [email protected] | ||
*/ | ||
@SpringBootTest | ||
@ExtendWith(SpringExtension.class) | ||
public class ServerPrivateKeyConverterTest { | ||
@ActiveProfiles("test") | ||
class ServerPrivateKeyConverterTest { | ||
|
||
private static final String SERVER_PRIVATE_KEY_PLAIN = "YAJ1A/QtTTB33R3Xnx3q7+QFuth6cRagtCMGTytV9VE="; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
.../src/test/java/io/getlime/security/powerauth/app/server/service/PowerAuthServiceTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
* PowerAuth Server and related software components | ||
* Copyright (C) 2023 Wultra s.r.o. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published | ||
* by the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package io.getlime.security.powerauth.app.server.service; | ||
|
||
import com.wultra.security.powerauth.client.model.entity.Activation; | ||
import com.wultra.security.powerauth.client.model.request.GetActivationListForUserRequest; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.test.context.ActiveProfiles; | ||
import org.springframework.test.context.jdbc.Sql; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
import java.util.Date; | ||
import java.util.List; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
/** | ||
* Test for {@link PowerAuthService}. | ||
* | ||
* @author Lubos Racansky, [email protected] | ||
*/ | ||
@SpringBootTest | ||
@Transactional | ||
@ActiveProfiles("test") | ||
class PowerAuthServiceTest { | ||
|
||
@Autowired | ||
private PowerAuthService tested; | ||
|
||
@Test | ||
@Sql | ||
void testGetActivationListForUser() throws Exception { | ||
final GetActivationListForUserRequest request = new GetActivationListForUserRequest(); | ||
request.setUserId("user1"); | ||
|
||
final List<Activation> result = tested.getActivationListForUser(request).getActivations(); | ||
|
||
assertEquals(3, result.size()); | ||
|
||
final List<String> expectedIdOrder = List.of("e43a5dec-afea-4a10-a80b-b2183399f16b", "47cf47b3-c72d-4859-a5f4-51da6d6ad6a3", "0d34cfc4-af98-4eb8-aba5-58f766bd2967"); | ||
final List<String> actualIdOrder = result.stream().map(Activation::getActivationId).toList(); | ||
assertEquals(expectedIdOrder, actualIdOrder); | ||
|
||
final Date timestampCreated1 = result.get(0).getTimestampCreated(); | ||
final Date timestampCreated2 = result.get(1).getTimestampCreated(); | ||
final Date timestampCreated3 = result.get(2).getTimestampCreated(); | ||
assertEquals(1, timestampCreated1.compareTo(timestampCreated2)); | ||
assertEquals(1, timestampCreated2.compareTo(timestampCreated3)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,7 @@ | |
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.test.context.ActiveProfiles; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
|
@@ -33,6 +34,7 @@ | |
* @author Jan Pesek, [email protected] | ||
*/ | ||
@SpringBootTest | ||
@ActiveProfiles("test") | ||
class OperationTemplateServiceBehaviorTest { | ||
|
||
@Autowired | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.