Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import static io.meeds.gamification.utils.Utils.ANNOUNCEMENT_ID_NOTIFICATION_PARAM;
import static io.meeds.gamification.utils.Utils.getIdentityById;

import java.io.Writer;
import java.util.Date;
import java.util.Locale;

Expand Down Expand Up @@ -163,9 +162,4 @@ protected MessageInfo makeMessage(NotificationContext ctx) { // NOSONAR
return messageInfo.end();
}

@Override
protected boolean makeDigest(NotificationContext ctx, Writer writer) {
return false;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import static io.meeds.gamification.utils.Utils.RULE_CREATOR_NOTIFICATION_PARAM;
import static io.meeds.gamification.utils.Utils.getUserIdentity;

import java.io.Writer;
import java.util.Date;
import java.util.Locale;

Expand Down Expand Up @@ -151,9 +150,4 @@ protected MessageInfo makeMessage(NotificationContext ctx) { // NOSONAR
return messageInfo.end();
}

@Override
protected boolean makeDigest(NotificationContext ctx, Writer writer) {
return false;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import static io.meeds.gamification.plugin.RuleTranslationPlugin.RULE_TITLE_FIELD_NAME;
import static io.meeds.gamification.utils.Utils.*;

import java.io.Writer;
import java.util.Date;
import java.util.Locale;

Expand Down Expand Up @@ -136,9 +135,4 @@ protected MessageInfo makeMessage(NotificationContext ctx) { // NOSONAR
return messageInfo.end();
}

@Override
protected boolean makeDigest(NotificationContext ctx, Writer writer) {
return false;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import static io.meeds.gamification.utils.Utils.REALIZATION_ID_NOTIFICATION_PARAM;
import static io.meeds.gamification.utils.Utils.getIdentityById;

import java.io.Writer;
import java.util.Date;
import java.util.Locale;

Expand Down Expand Up @@ -137,9 +136,4 @@ protected MessageInfo makeMessage(NotificationContext ctx) { // NOSONAR
return messageInfo.end();
}

@Override
protected boolean makeDigest(NotificationContext ctx, Writer writer) {
return false;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -125,18 +125,19 @@ public void tearDown() {

/**
* It will be invoked after make Activity, Relationship and New User also.
* Makes the notification message and retrieve from MockNotificationService
* Makes the notification message and retrieves it from the instant store of
* MockNotificationService (the legacy digest store is gone, eXIP 7.3.0.22)
*
* @return
*/
protected NotificationInfo getNotificationInfo(String username) {
List<NotificationInfo> list = notificationService.storeDigest(username);
List<NotificationInfo> list = notificationService.storeInstantly(username);
assertFalse(list.isEmpty());
return list.get(0);
}

protected List<NotificationInfo> getNotificationInfos(String username) {
return notificationService.storeDigest(username);
return notificationService.storeInstantly(username);
}

/**
Expand Down Expand Up @@ -170,33 +171,6 @@ protected void assertDigest(Writer writer, String includedString) {
assertEquals(includedString, writer.toString().replaceAll("\\<.*>", ""));
}

/**
* Asserts the number of notification what made by the plugins.
*
* @param number
*/
protected void assertMadeMailDigestNotifications(int number) {
UserSetting setting = userSettingService.get(rootIdentity.getRemoteId());
if (setting.isInDaily(getPlugin().getKey().getId())) {
assertEquals(number, notificationService.sizeOfStoredDigest());
}
}

/**
* Asserts the number of notification what made by the plugins.
*
* @param number
*/
protected List<NotificationInfo> assertMadeMailDigestNotifications(String username, int number) {
UserSetting setting = userSettingService.get(username);
List<NotificationInfo> got = notificationService.storeDigest(username);
if (setting.isActive(MailChannel.ID, getPlugin().getKey().getId())) {
got = notificationService.storeInstantly(username);
assertEquals(number, got.size());
}
return got;
}

/**
* Asserts the number of web's notifications what made by the plugins.
*
Expand Down Expand Up @@ -261,38 +235,6 @@ protected void setInstantlySettings(String userId, List<String> settings) {
userSettingService.save(userSetting);
}

/**
* Make Daily setting
*
* @param userId
* @param settings
*/
protected void setDailySetting(String userId, List<String> settings) {
UserSetting userSetting = userSettingService.get(userId);

if (userSetting == null) {
userSetting = UserSetting.getInstance();
userSetting.setUserId(userId);
}
userSetting.setChannelActive(MailChannel.ID);

userSetting.setDailyPlugins(settings);
userSettingService.save(userSetting);
}

protected void setWeeklySetting(String userId, List<String> settings) {
UserSetting userSetting = userSettingService.get(userId);

if (userSetting == null) {
userSetting = UserSetting.getInstance();
userSetting.setUserId(userId);
}
userSetting.setChannelActive(MailChannel.ID);

userSetting.setWeeklyPlugins(settings);
userSettingService.save(userSetting);
}

protected AbstractTemplateBuilder getTemplateBuilder(NotificationContext ctx) {
AbstractChannel channel = ctx.getChannelManager().getChannel(ChannelKey.key(MailChannel.ID));
assertNotNull(channel);
Expand All @@ -309,13 +251,5 @@ protected MessageInfo buildMessageInfo(NotificationContext ctx) {
return massage;
}

protected void buildDigest(NotificationContext ctx, Writer writer) {
AbstractTemplateBuilder templateBuilder = getTemplateBuilder();
if (templateBuilder == null) {
templateBuilder = getTemplateBuilder(ctx);
}
templateBuilder.buildDigest(ctx, writer);
}

public abstract AbstractTemplateBuilder getTemplateBuilder();
}
Loading