Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge develop to master #886

Open
wants to merge 32 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
5d67820
Fix #856: Set develop version to 1.9.0-SNAPSHOT
banterCZ Jul 26, 2024
54c174a
Merge pull request #864 from wultra/issues/856-version-1.9.0-SNAPSHOT
banterCZ Jul 26, 2024
96073e0
Bump net.logstash.logback:logstash-logback-encoder from 7.4 to 8.0
dependabot[bot] Jul 29, 2024
486b9f8
Fix #866: Javadoc error
banterCZ Aug 2, 2024
eb53e2a
Merge pull request #865 from wultra/dependabot/maven/net.logstash.log…
dependabot[bot] Aug 20, 2024
98703d8
Fix #868: Add missing SQL migration script for 1.7.0
banterCZ Aug 22, 2024
8cef4cc
Merge pull request #869 from wultra/issues/868-sql-migration-1.7.0
banterCZ Aug 22, 2024
079a88b
Bump org.springframework.boot:spring-boot-starter-parent
dependabot[bot] Aug 26, 2024
e30d433
Merge pull request #867 from wultra/issues/866-javadoc
banterCZ Sep 2, 2024
1f7a355
Merge pull request #872 from wultra/dependabot/maven/org.springframew…
dependabot[bot] Sep 2, 2024
44f7514
Fix #875: Unable to compile after adding support for temporary keys
banterCZ Sep 3, 2024
c1e33a1
Merge pull request #876 from wultra/issues/875-temporary-keys
banterCZ Sep 3, 2024
6c2d075
Bump io.swagger.core.v3:swagger-annotations-jakarta
dependabot[bot] Sep 3, 2024
c1b7b71
Bump com.google.api-client:google-api-client from 2.6.0 to 2.7.0
dependabot[bot] Sep 3, 2024
b6c583f
Merge pull request #873 from wultra/dependabot/maven/io.swagger.core.…
dependabot[bot] Sep 3, 2024
865c33e
Merge pull request #874 from wultra/dependabot/maven/com.google.api-c…
dependabot[bot] Sep 3, 2024
d0a6bf2
Bump org.springframework.boot:spring-boot-starter-parent
dependabot[bot] Sep 23, 2024
f639479
Merge pull request #878 from wultra/dependabot/maven/org.springframew…
dependabot[bot] Sep 23, 2024
8d4c9aa
Bump io.swagger.core.v3:swagger-annotations-jakarta
dependabot[bot] Sep 30, 2024
36b4725
Merge pull request #879 from wultra/dependabot/maven/io.swagger.core.…
dependabot[bot] Sep 30, 2024
485aaa2
Fix #841: Add warning when push notification cannot be sent (#880)
banterCZ Oct 1, 2024
f92072c
Add migration instructions from 1.8.x to 1.9.x
banterCZ Oct 2, 2024
a7b559d
Merge pull request #881 from wultra/issues/migration-instructions
banterCZ Oct 2, 2024
239e73b
Bump io.swagger.core.v3:swagger-annotations-jakarta
dependabot[bot] Oct 7, 2024
4a2c023
Bump wultra-core.version from 1.11.0-SNAPSHOT to 1.11.0
dependabot[bot] Oct 7, 2024
4abe24f
Merge pull request #882 from wultra/dependabot/maven/io.swagger.core.…
dependabot[bot] Oct 7, 2024
f4768bf
Merge pull request #883 from wultra/dependabot/maven/wultra-core.vers…
dependabot[bot] Oct 7, 2024
71b2e81
Fix #890: Add liquibase tag 1.8.0
banterCZ Oct 10, 2024
0a80a5a
Merge pull request #891 from wultra/issues/890-liquibase-tag
banterCZ Oct 10, 2024
a1528d8
Bump io.getlime.security:powerauth-java-crypto
dependabot[bot] Oct 14, 2024
efef6c6
Merge pull request #897 from wultra/dependabot/maven/io.getlime.secur…
dependabot[bot] Oct 14, 2024
1d97c3c
Fix #884: clearing the cache of the push client works only on one nod…
banterCZ Oct 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/Migration-Instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

This page contains PowerAuth Push Server migration instructions.

- [PowerAuth Push Server 1.9.0](./PowerAuth-Push-Server-1.9.0.md)
- [PowerAuth Push Server 1.8.0](./PowerAuth-Push-Server-1.8.0.md)
- [PowerAuth Push Server 1.7.0](./PowerAuth-Push-Server-1.7.0.md)
- [PowerAuth Push Server 1.6.0](./PowerAuth-Push-Server-1.6.0.md)
Expand Down
8 changes: 8 additions & 0 deletions docs/PowerAuth-Push-Server-1.7.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ This guide contains instructions for migration from PowerAuth Push Server versio

## Database Changes

For convenience, you can use liquibase for your database migration.

If you prefer to make manual DB schema changes, please use the following SQL scripts:

- [PostgreSQL script](./sql/postgresql/migration_1.6.0_1.7.0.sql)
- [Oracle script](./sql/oracle/migration_1.6.0_1.7.0.sql)
- [MSSQL script](./sql/mssql/migration_1.6.0_1.7.0.sql)


### Huawei Mobile Services

Expand Down
5 changes: 5 additions & 0 deletions docs/PowerAuth-Push-Server-1.9.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Migration from 1.8.x to 1.9.x

This guide contains instructions for migration from PowerAuth Push Server version `1.8.x` to version `1.9.x`.

No migration steps nor database changes are required.
19 changes: 19 additions & 0 deletions docs/sql/mssql/migration_1.6.0_1.7.0.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
-- Changeset powerauth-push-server/1.7.x/20240119-push_app_credentials-hms.xml::1::Lubos Racansky
-- Add hms_project_id, hms_client_id, and hms_client_secret columns to push_app_credentials
ALTER TABLE push_app_credentials ADD hms_project_id varchar(255);
GO

ALTER TABLE push_app_credentials ADD hms_client_id varchar(255);
GO

ALTER TABLE push_app_credentials ADD hms_client_secret varchar(255);
GO

IF EXISTS( SELECT extended_properties.value FROM sys.extended_properties WHERE major_id = OBJECT_ID('dbo.push_app_credentials') AND name = N'MS_DESCRIPTION' AND minor_id = ( SELECT column_id FROM sys.columns WHERE name = 'hms_project_id' AND object_id = OBJECT_ID('dbo.push_app_credentials')) ) BEGIN EXEC sys.sp_updateextendedproperty @name = N'MS_Description' , @value = N'Project ID defined in Huawei AppGallery Connect.' , @level0type = N'SCHEMA' , @level0name = N'dbo' , @level1type = N'TABLE' , @level1name = N'push_app_credentials' , @level2type = N'COLUMN' , @level2name = N'hms_project_id' END ELSE BEGIN EXEC sys.sp_addextendedproperty @name = N'MS_Description' , @value = N'Project ID defined in Huawei AppGallery Connect.' , @level0type = N'SCHEMA' , @level0name = N'dbo' , @level1type = N'TABLE' , @level1name = N'push_app_credentials' , @level2type = N'COLUMN' , @level2name = N'hms_project_id' END;
GO

IF EXISTS( SELECT extended_properties.value FROM sys.extended_properties WHERE major_id = OBJECT_ID('dbo.push_app_credentials') AND name = N'MS_DESCRIPTION' AND minor_id = ( SELECT column_id FROM sys.columns WHERE name = 'hms_client_id' AND object_id = OBJECT_ID('dbo.push_app_credentials')) ) BEGIN EXEC sys.sp_updateextendedproperty @name = N'MS_Description' , @value = N'Huawei OAuth 2.0 Client ID.' , @level0type = N'SCHEMA' , @level0name = N'dbo' , @level1type = N'TABLE' , @level1name = N'push_app_credentials' , @level2type = N'COLUMN' , @level2name = N'hms_client_id' END ELSE BEGIN EXEC sys.sp_addextendedproperty @name = N'MS_Description' , @value = N'Huawei OAuth 2.0 Client ID.' , @level0type = N'SCHEMA' , @level0name = N'dbo' , @level1type = N'TABLE' , @level1name = N'push_app_credentials' , @level2type = N'COLUMN' , @level2name = N'hms_client_id' END;
GO

IF EXISTS( SELECT extended_properties.value FROM sys.extended_properties WHERE major_id = OBJECT_ID('dbo.push_app_credentials') AND name = N'MS_DESCRIPTION' AND minor_id = ( SELECT column_id FROM sys.columns WHERE name = 'hms_client_secret' AND object_id = OBJECT_ID('dbo.push_app_credentials')) ) BEGIN EXEC sys.sp_updateextendedproperty @name = N'MS_Description' , @value = N'Huawei OAuth 2.0 Client Secret.' , @level0type = N'SCHEMA' , @level0name = N'dbo' , @level1type = N'TABLE' , @level1name = N'push_app_credentials' , @level2type = N'COLUMN' , @level2name = N'hms_client_secret' END ELSE BEGIN EXEC sys.sp_addextendedproperty @name = N'MS_Description' , @value = N'Huawei OAuth 2.0 Client Secret.' , @level0type = N'SCHEMA' , @level0name = N'dbo' , @level1type = N'TABLE' , @level1name = N'push_app_credentials' , @level2type = N'COLUMN' , @level2name = N'hms_client_secret' END;
GO
13 changes: 13 additions & 0 deletions docs/sql/oracle/migration_1.6.0_1.7.0.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
-- Changeset powerauth-push-server/1.7.x/20240119-push_app_credentials-hms.xml::1::Lubos Racansky
-- Add hms_project_id, hms_client_id, and hms_client_secret columns to push_app_credentials
ALTER TABLE push_app_credentials ADD hms_project_id VARCHAR2(255);

ALTER TABLE push_app_credentials ADD hms_client_id VARCHAR2(255);

ALTER TABLE push_app_credentials ADD hms_client_secret VARCHAR2(255);

COMMENT ON COLUMN push_app_credentials.hms_project_id IS 'Project ID defined in Huawei AppGallery Connect.';

COMMENT ON COLUMN push_app_credentials.hms_client_id IS 'Huawei OAuth 2.0 Client ID.';

COMMENT ON COLUMN push_app_credentials.hms_client_secret IS 'Huawei OAuth 2.0 Client Secret.';
13 changes: 13 additions & 0 deletions docs/sql/postgresql/migration_1.6.0_1.7.0.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
-- Changeset powerauth-push-server/1.7.x/20240119-push_app_credentials-hms.xml::1::Lubos Racansky
-- Add hms_project_id, hms_client_id, and hms_client_secret columns to push_app_credentials
ALTER TABLE push_app_credentials ADD hms_project_id VARCHAR(255);

ALTER TABLE push_app_credentials ADD hms_client_id VARCHAR(255);

ALTER TABLE push_app_credentials ADD hms_client_secret VARCHAR(255);

COMMENT ON COLUMN push_app_credentials.hms_project_id IS 'Project ID defined in Huawei AppGallery Connect.';

COMMENT ON COLUMN push_app_credentials.hms_client_id IS 'Huawei OAuth 2.0 Client ID.';

COMMENT ON COLUMN push_app_credentials.hms_client_secret IS 'Huawei OAuth 2.0 Client Secret.';
48 changes: 37 additions & 11 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@

<groupId>io.getlime.security</groupId>
<artifactId>powerauth-push-server-parent</artifactId>
<version>1.8.0</version>
<version>1.9.0-SNAPSHOT</version>
<packaging>pom</packaging>

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.3.2</version>
<version>3.3.4</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

Expand Down Expand Up @@ -69,22 +69,20 @@

<properties>
<!-- Wultra Dependencies -->
<wultra-core.version>1.10.0</wultra-core.version>
<powerauth.version>1.8.0</powerauth.version>
<powerauth-crypto.version>1.8.0</powerauth-crypto.version>
<powerauth-restful-integration.version>1.8.0</powerauth-restful-integration.version>
<wultra-core.version>1.11.0</wultra-core.version>
<powerauth.version>1.9.0-SNAPSHOT</powerauth.version>
<powerauth-crypto.version>1.9.0-SNAPSHOT</powerauth-crypto.version>
<powerauth-restful-integration.version>1.9.0-SNAPSHOT</powerauth-restful-integration.version>

<!-- Library Versions -->
<pushy.version>0.15.4</pushy.version>
<google-api-client.version>2.6.0</google-api-client.version>
<google-api-client.version>2.7.0</google-api-client.version>
<firebase-admin.version>9.3.0</firebase-admin.version>
<logstash.version>7.4</logstash.version>
<logstash.version>8.0</logstash.version>

<!-- Documentation Dependencies -->
<springdoc-openapi-starter-webmvc-ui.version>2.6.0</springdoc-openapi-starter-webmvc-ui.version>
<swagger-annotations-jakarta.version>2.2.22</swagger-annotations-jakarta.version>

<maven-javadoc-plugin.version>3.5.0</maven-javadoc-plugin.version>
<swagger-annotations-jakarta.version>2.2.25</swagger-annotations-jakarta.version>
</properties>

<dependencyManagement>
Expand Down Expand Up @@ -161,10 +159,38 @@
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.projectlombok</groupId>
<artifactId>lombok-maven-plugin</artifactId>
<version>1.18.20.0</version>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</dependency>
</dependencies>
<configuration>
<outputDirectory>${project.build.directory}/delombok</outputDirectory>
<sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>
<addOutputDirectory>false</addOutputDirectory>
</configuration>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>delombok</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<sourcepath>${project.build.directory}/delombok</sourcepath>
<failOnError>false</failOnError>
</configuration>
<executions>
Expand Down
2 changes: 1 addition & 1 deletion powerauth-push-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<parent>
<artifactId>powerauth-push-server-parent</artifactId>
<groupId>io.getlime.security</groupId>
<version>1.8.0</version>
<version>1.9.0-SNAPSHOT</version>
</parent>

<dependencies>
Expand Down
2 changes: 1 addition & 1 deletion powerauth-push-model/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<parent>
<artifactId>powerauth-push-server-parent</artifactId>
<groupId>io.getlime.security</groupId>
<version>1.8.0</version>
<version>1.9.0-SNAPSHOT</version>
</parent>

<dependencies>
Expand Down
2 changes: 1 addition & 1 deletion powerauth-push-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<parent>
<groupId>io.getlime.security</groupId>
<artifactId>powerauth-push-server-parent</artifactId>
<version>1.8.0</version>
<version>1.9.0-SNAPSHOT</version>
</parent>

<dependencyManagement>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,16 +261,24 @@ private AppCredentialsEntity getAppCredentials(String appId) throws PushServerEx
}

// Return list of devices related to given user or activation ID (if present). List of devices is related to particular application as well.
private List<PushDeviceRegistrationEntity> getPushDevices(Long id, String userId, String activationId) throws PushServerException {
private List<PushDeviceRegistrationEntity> getPushDevices(Long appCredentialsId, String userId, String activationId) throws PushServerException {
if (userId == null || userId.isEmpty()) {
logger.error("No userId was specified");
throw new PushServerException("No userId was specified");
}

final List<PushDeviceRegistrationEntity> devices;
if (activationId != null) { // in case the message should go to the specific device
return pushDeviceRepository.findByUserIdAndAppCredentialsIdAndActivationId(userId, id, activationId);
devices = pushDeviceRepository.findByUserIdAndAppCredentialsIdAndActivationId(userId, appCredentialsId, activationId);
} else {
return pushDeviceRepository.findByUserIdAndAppCredentialsId(userId, id);
devices = pushDeviceRepository.findByUserIdAndAppCredentialsId(userId, appCredentialsId);
}

if (devices.isEmpty()) {
logger.warn("No device found for userId={}, appCredentialsId={}, activationId={}", userId, appCredentialsId, activationId);
}

return devices;
}

// Prepare and cache APNS, FCM, and HMS clients for provided app
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public String createActivation(String userId) throws Exception {
byte[] applicationSecretBytes = applicationSecret.getBytes(StandardCharsets.UTF_8);

final String protocolVersion = "3.1";
final EncryptorParameters encryptorParameters = new EncryptorParameters(protocolVersion, applicationKey, null);
final EncryptorParameters encryptorParameters = new EncryptorParameters(protocolVersion, applicationKey, null, null);
final ClientEncryptorSecrets encryptorSecrets = new ClientEncryptorSecrets(masterPK, applicationSecretBytes);
final ClientEncryptor clientEncryptor = encryptorFactory.getClientEncryptor(EncryptorId.ACTIVATION_LAYER_2, encryptorParameters, encryptorSecrets);
final ByteArrayOutputStream baosL2 = new ByteArrayOutputStream();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ public ObjectResponse<GetApplicationDetailResponse> getApplicationDetail() {
public ObjectResponse<GetActivationStatusResponse> getActivationStatus(@RequestBody ObjectRequest<GetActivationStatusRequest> request) {
final GetActivationStatusResponse response = new GetActivationStatusResponse();
response.setActivationId(request.getRequestObject().getActivationId());
response.setUserId(PushServerTestClientFactory.TEST_USER_ID);

if (blockedActivations.contains(request.getRequestObject().getActivationId())) {
response.setActivationStatus(ActivationStatus.BLOCKED);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,63 +164,69 @@ void updateDeviceStatusTest() throws Exception {
}

@Test
@SuppressWarnings("unchecked") //known parameters of HashMap
void sendPushMessageTest() throws Exception {
boolean result = pushServerClient.createDevice(powerAuthTestClient.getApplicationId(), MOCK_PUSH_TOKEN, MobilePlatform.ANDROID, powerAuthTestClient.getActivationId());
final boolean result = pushServerClient.createDevice(powerAuthTestClient.getApplicationId(), MOCK_PUSH_TOKEN, MobilePlatform.ANDROID, powerAuthTestClient.getActivationId());
assertTrue(result);
PushMessage pushMessage = new PushMessage();
PushMessageAttributes attributes = new PushMessageAttributes();
PushMessageBody pushMessageBody = new PushMessageBody();

final PushMessageAttributes attributes = new PushMessageAttributes();
attributes.setSilent(false);
attributes.setPersonal(true);

final PushMessageBody pushMessageBody = new PushMessageBody();
pushMessageBody.setTitle("Balance update");
pushMessageBody.setBody("Your balance is now $745.00");
pushMessageBody.setBadge(3);
pushMessageBody.setSound("riff.wav");
pushMessageBody.setCategory("balance-update");
pushMessageBody.setCollapseKey("balance-update");
pushMessageBody.setValidUntil(Instant.now());
pushMessageBody.setExtras((Map<String, Object>) new HashMap<String, Object>().put("_comment", "Any custom data."));
attributes.setSilent(false);
attributes.setPersonal(true);
pushMessage.setUserId("Test_User");
pushMessageBody.setExtras(Map.of("_comment", "Any custom data."));

final PushMessage pushMessage = new PushMessage();
pushMessage.setUserId(PushServerTestClientFactory.TEST_USER_ID);
pushMessage.setActivationId(powerAuthTestClient.getActivationId());
pushMessage.setAttributes(attributes);
pushMessage.setBody(pushMessageBody);
pushMessage.setAttributes(attributes);
ObjectResponse<PushMessageSendResult> actual = pushServerClient.sendPushMessage(powerAuthTestClient.getApplicationId(), Mode.SYNCHRONOUS, pushMessage);

final ObjectResponse<PushMessageSendResult> actual = pushServerClient.sendPushMessage(powerAuthTestClient.getApplicationId(), Mode.SYNCHRONOUS, pushMessage);
assertEquals("OK", actual.getStatus());
List<PushDeviceRegistrationEntity> devices = pushDeviceRepository.findByAppCredentialsAppIdAndPushToken(powerAuthTestClient.getApplicationId(), MOCK_PUSH_TOKEN);

final List<PushDeviceRegistrationEntity> devices = pushDeviceRepository.findByAppCredentialsAppIdAndPushToken(powerAuthTestClient.getApplicationId(), MOCK_PUSH_TOKEN);
pushDeviceRepository.deleteAll(devices);
}


@Test
@SuppressWarnings("unchecked") //known parameters of HashMap
void sendPushMessageBatchTest() throws Exception {
boolean result = pushServerClient.createDevice(powerAuthTestClient.getApplicationId(), MOCK_PUSH_TOKEN, MobilePlatform.ANDROID, powerAuthTestClient.getActivationId());
assertTrue(result);
List<PushMessage> batch = new ArrayList<>();
PushMessage pushMessage = new PushMessage();
PushMessageAttributes attributes = new PushMessageAttributes();
PushMessageBody pushMessageBody = new PushMessageBody();

final PushMessageBody pushMessageBody = new PushMessageBody();
pushMessageBody.setTitle("Balance update");
pushMessageBody.setBody("Your balance is now $745.00");
pushMessageBody.setBadge(3);
pushMessageBody.setSound("riff.wav");
pushMessageBody.setCategory("balance-update");
pushMessageBody.setCollapseKey("balance-update");
pushMessageBody.setValidUntil(Instant.now());
pushMessageBody.setExtras((Map<String, Object>) new HashMap<String, Object>().put("_comment", "Any custom data."));
pushMessageBody.setExtras(Map.of("_comment", "Any custom data."));

final PushMessageAttributes attributes = new PushMessageAttributes();
attributes.setSilent(false);
attributes.setPersonal(true);
pushMessage.setUserId("Test_User");

final PushMessage pushMessage = new PushMessage();
pushMessage.setUserId(PushServerTestClientFactory.TEST_USER_ID);
pushMessage.setActivationId(powerAuthTestClient.getActivationId());
pushMessage.setAttributes(attributes);
pushMessage.setBody(pushMessageBody);
pushMessage.setAttributes(attributes);
batch.add(pushMessage);
ObjectResponse<PushMessageSendResult> actual = pushServerClient.sendPushMessageBatch(powerAuthTestClient.getApplicationId(), Mode.SYNCHRONOUS, batch);

final List<PushMessage> batch = List.of(pushMessage);

final ObjectResponse<PushMessageSendResult> actual = pushServerClient.sendPushMessageBatch(powerAuthTestClient.getApplicationId(), Mode.SYNCHRONOUS, batch);
assertEquals("OK", actual.getStatus());
List<PushDeviceRegistrationEntity> devices = pushDeviceRepository.findByAppCredentialsAppIdAndPushToken(powerAuthTestClient.getApplicationId(), MOCK_PUSH_TOKEN);

final List<PushDeviceRegistrationEntity> devices = pushDeviceRepository.findByAppCredentialsAppIdAndPushToken(powerAuthTestClient.getApplicationId(), MOCK_PUSH_TOKEN);
pushDeviceRepository.deleteAll(devices);
}

Expand Down Expand Up @@ -289,14 +295,18 @@ void deleteUsersFromCampaignTest() throws Exception {

@Test
void sendTestingCampaignTest() throws Exception {
boolean actual = pushServerClient.sendTestCampaign(1L, "Test_User");
boolean result = pushServerClient.createDevice(powerAuthTestClient.getApplicationId(), MOCK_PUSH_TOKEN, MobilePlatform.ANDROID, powerAuthTestClient.getActivationId());
assertTrue(result);

final Long campaignId = createCampaign().getResponseObject().getId();
boolean actual = pushServerClient.sendTestCampaign(campaignId, PushServerTestClientFactory.TEST_USER_ID);
assertTrue(actual);
}

@Test
void sendCampaignTest() throws Exception {
createCampaign();
boolean result = pushServerClient.sendCampaign(1L);
final Long campaignId = createCampaign().getResponseObject().getId();
boolean result = pushServerClient.sendCampaign(campaignId);
assertTrue(result);
}

Expand Down
Loading