Compare commits

...

8 Commits

Author SHA1 Message Date
Sheldan
d2c17cb1fc [maven-release-plugin] prepare release abstracto-application-1.2.2 2021-03-24 14:30:07 +01:00
Sheldan
9de7a59295 [AB-210] fixing some issues in which futures were not completed, when lists were empty
fixing async issue with caching reactions
adding a few more log statements to caching
2021-03-24 14:17:00 +01:00
Sheldan
f9d0e5fa00 [AB-208] fixing order of top starboard posts for individual members 2021-03-24 11:08:56 +01:00
Sheldan
ef421961ca [AB-211] fixing lovecalc having optional parameters 2021-03-24 11:03:51 +01:00
Sheldan
fe8519489c [maven-release-plugin] prepare for next development iteration 2021-03-23 22:19:14 +01:00
Sheldan
72c73b8b34 [maven-release-plugin] prepare release abstracto-application-1.2.1 2021-03-23 22:19:08 +01:00
Sheldan
2b3b0f42c4 [AB-207] fixing command being disabled, if its part of a channel group, but the given channel is not part of that channel group
fixing null pointer in channel group created listener
fixing connection string in config deploy tool
2021-03-23 22:08:08 +01:00
Sheldan
92b8e1dd8b [maven-release-plugin] prepare for next development iteration 2021-03-22 21:46:09 +01:00
59 changed files with 197 additions and 73 deletions

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>assignable-roles</artifactId>
<version>1.2</version>
<version>1.2.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>assignable-roles</artifactId>
<version>1.2</version>
<version>1.2.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>assignable-roles-int</artifactId>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>abstracto-modules</artifactId>
<version>1.2</version>
<version>1.2.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>entertainment</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.2</version>
<version>1.2.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -49,8 +49,8 @@ public class LoveCalc extends AbstractConditionableCommand {
@Override
public CommandConfiguration getConfiguration() {
List<Parameter> parameters = new ArrayList<>();
parameters.add(Parameter.builder().name("firstSubject").type(String.class).templated(true).optional(true).build());
parameters.add(Parameter.builder().name("secondSubject").type(String.class).templated(true).optional(true).build());
parameters.add(Parameter.builder().name("firstSubject").type(String.class).templated(true).build());
parameters.add(Parameter.builder().name("secondSubject").type(String.class).templated(true).build());
HelpInfo helpInfo = HelpInfo.builder().templated(true).build();
return CommandConfiguration.builder()
.name("loveCalc")

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>entertainment</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.2</version>
<version>1.2.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>abstracto-modules</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.2</version>
<version>1.2.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>experience-tracking</artifactId>
<version>1.2</version>
<version>1.2.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>experience-tracking</artifactId>
<version>1.2</version>
<version>1.2.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>abstracto-modules</artifactId>
<version>1.2</version>
<version>1.2.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>link-embed</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.2</version>
<version>1.2.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>link-embed</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.2</version>
<version>1.2.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>abstracto-modules</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.2</version>
<version>1.2.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>moderation</artifactId>
<version>1.2</version>
<version>1.2.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>moderation</artifactId>
<version>1.2</version>
<version>1.2.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>abstracto-modules</artifactId>
<version>1.2</version>
<version>1.2.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>modmail</artifactId>
<version>1.2</version>
<version>1.2.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>modmail</artifactId>
<version>1.2</version>
<version>1.2.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>abstracto-modules</artifactId>
<version>1.2</version>
<version>1.2.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto</groupId>
<artifactId>abstracto-application</artifactId>
<version>1.2</version>
<version>1.2.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>abstracto-modules</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.2</version>
<version>1.2.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>remind</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.2</version>
<version>1.2.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>remind</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.2</version>
<version>1.2.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>abstracto-modules</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.2</version>
<version>1.2.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>repost-detection</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.2</version>
<version>1.2.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>repost-detection</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.2</version>
<version>1.2.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>abstracto-modules</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.2</version>
<version>1.2.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>starboard</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.2</version>
<version>1.2.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -32,6 +32,7 @@ import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
@@ -223,7 +224,7 @@ public class StarboardServiceBean implements StarboardService {
Long receivedStars = starboardPostManagementService.retrieveReceivedStarsOfUserInServer(member.getGuild().getIdLong(), member.getIdLong());
Long givenStars = starboardPostManagementService.retrieveGivenStarsOfUserInServer(member.getGuild().getIdLong(), member.getIdLong());
List<StarboardPost> topPosts = starboardPostManagementService.retrieveTopPostsForUserInServer(member.getGuild().getIdLong(), member.getIdLong(), count);
List<StarStatsPost> starStatsPosts = topPosts.stream().map(this::fromStarboardPost).collect(Collectors.toList());
List<StarStatsPost> starStatsPosts = topPosts.stream().map(this::fromStarboardPost).sorted(Comparator.comparingInt(StarStatsPost::getStarCount).reversed()).collect(Collectors.toList());
List<String> emotes = new ArrayList<>();
for (int i = 1; i < count + 1; i++) {
emotes.add(getStarboardRankingEmote(member.getGuild().getIdLong(), i));

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>starboard</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.2</version>
<version>1.2.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>abstracto-modules</artifactId>
<version>1.2</version>
<version>1.2.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>statistic</artifactId>
<version>1.2</version>
<version>1.2.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>statistic</artifactId>
<version>1.2</version>
<version>1.2.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>abstracto-modules</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.2</version>
<version>1.2.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>suggestion</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.2</version>
<version>1.2.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>suggestion</artifactId>
<groupId>dev.sheldan.abstracto.modules</groupId>
<version>1.2</version>
<version>1.2.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>abstracto-modules</artifactId>
<version>1.2</version>
<version>1.2.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>utility</artifactId>
<version>1.2</version>
<version>1.2.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>utility</artifactId>
<version>1.2</version>
<version>1.2.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto</groupId>
<artifactId>abstracto-application</artifactId>
<version>1.2</version>
<version>1.2.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto.core</groupId>
<artifactId>core</artifactId>
<version>1.2</version>
<version>1.2.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>

View File

@@ -33,9 +33,13 @@ public class ChannelGroupCommandServiceBean implements ChannelGroupCommandServic
return false;
}
}
// empty -> no groups, command enabled
// not empty -> has groups, command is disabled in all
return allChannelGroupsOfCommand.isEmpty();
/*
if we are here this means either:
the command has no channel groups assigned -> enabled
the command has one or more channel group and is enabled in these ones -> enabled
the command has a channel group with channels (and it might be enabled/disabled, does not matter), but the given channel is not part of that group -> ok
*/
return true;
}
@Override

View File

@@ -25,6 +25,7 @@ public class AsyncChannelGroupCreatedListenerManager {
@TransactionalEventListener
public void executeListener(ChannelGroupCreatedListenerModel createdGroup){
if(listener == null) return;
listener.forEach(asyncChannelGroupCreatedListener ->
listenerService.executeListener(asyncChannelGroupCreatedListener, createdGroup, channelGroupCreatedExecutor)
);

View File

@@ -4,7 +4,6 @@ import dev.sheldan.abstracto.core.metric.OkHttpMetrics;
import lombok.extern.slf4j.Slf4j;
import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.JDABuilder;
import net.dv8tion.jda.api.requests.GatewayIntent;
import net.dv8tion.jda.api.utils.MemberCachePolicy;
import net.dv8tion.jda.internal.utils.IOUtil;
import okhttp3.OkHttpClient;
@@ -26,7 +25,7 @@ public class BotServiceBean implements BotService {
@Override
public void login() throws LoginException {
JDABuilder builder = JDABuilder.create(System.getenv("TOKEN"), GatewayIntent.GUILD_MEMBERS, GUILD_VOICE_STATES,
JDABuilder builder = JDABuilder.create(System.getenv("TOKEN"), GUILD_VOICE_STATES,
GUILD_EMOJIS, GUILD_MEMBERS, GUILD_MESSAGE_REACTIONS, GUILD_MESSAGES,
GUILD_MESSAGE_REACTIONS, DIRECT_MESSAGE_REACTIONS, DIRECT_MESSAGES, GUILD_PRESENCES);

View File

@@ -86,6 +86,7 @@ public class CacheEntityServiceBean implements CacheEntityService {
}
List<MessageEmbed.Field> fields = embed.getFields();
if(!fields.isEmpty()) {
log.trace("Caching {} fields.", fields.size());
List<CachedEmbedField> cachedEmbedFields = new ArrayList<>();
fields.forEach(field -> {
CachedEmbedField build = CachedEmbedField
@@ -159,16 +160,27 @@ public class CacheEntityServiceBean implements CacheEntityService {
List<ServerUser> aUsers = new ArrayList<>();
users.forEachAsync(user -> {
log.trace("Loading user {} for reaction.", user.getIdLong());
concreteSelf.loadUser(reaction, aUsers, user);
return false;
}).thenAccept(o -> future.complete(builder.build()))
.exceptionally(throwable -> {
log.error("Failed to load reaction users.", throwable);
return null;
});
builder.users(aUsers);
builder.self(reaction.isSelf());
builder.emote(getCachedEmoteFromEmote(reaction.getReactionEmote(), reaction.getGuild()));
}).thenAccept(o -> {
log.trace("Users have been loaded. Completing future.");
builder.users(aUsers);
builder.self(reaction.isSelf());
builder.emote(getCachedEmoteFromEmote(reaction.getReactionEmote(), reaction.getGuild()));
future.complete(builder.build());
})
.exceptionally(throwable -> {
log.error("Failed to load reaction users.", throwable);
return null;
});
if(users.isEmpty()) {
log.trace("Reaction had no users. Completing future anyway.");
builder.users(aUsers);
builder.self(reaction.isSelf());
builder.emote(getCachedEmoteFromEmote(reaction.getReactionEmote(), reaction.getGuild()));
future.complete(builder.build());
}
return future;
}
@@ -183,22 +195,25 @@ public class CacheEntityServiceBean implements CacheEntityService {
public CompletableFuture<CachedMessage> buildCachedMessageFromMessage(Message message) {
CompletableFuture<CachedMessage> future = new CompletableFuture<>();
List<CachedAttachment> attachments = new ArrayList<>();
log.trace("Caching {} attachments.", message.getAttachments().size());
message.getAttachments().forEach(attachment ->
attachments.add(getCachedAttachment(attachment))
);
log.trace("Caching {} embeds.", message.getEmbeds().size());
List<CachedEmbed> embeds = new ArrayList<>();
message.getEmbeds().forEach(embed ->
embeds.add(getCachedEmbedFromEmbed(embed))
);
log.trace("Caching {} emotes.", message.getEmbeds().size());
List<CachedEmote> emotes = new ArrayList<>();
if(message.isFromGuild()) {
message.getEmotesBag().forEach(emote -> emotes.add(getCachedEmoteFromEmote(emote, message.getGuild())));
}
List<CompletableFuture<CachedReactions>> futures = new ArrayList<>();
log.trace("Caching {} reactions.", message.getReactions().size());
message.getReactions().forEach(messageReaction -> futures.add(getCachedReactionFromReaction(messageReaction)));
CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).thenAccept(aVoid ->
{
CachedAuthor cachedAuthor = CachedAuthor.builder().authorId(message.getAuthor().getIdLong()).isBot(message.getAuthor().isBot()).build();
@@ -222,6 +237,23 @@ public class CacheEntityServiceBean implements CacheEntityService {
log.error("Failed to load reactions for message {}. ", message.getId(), throwable);
return null;
});
if(message.getReactions().isEmpty()) {
CachedAuthor cachedAuthor = CachedAuthor.builder().authorId(message.getAuthor().getIdLong()).isBot(message.getAuthor().isBot()).build();
CachedMessage.CachedMessageBuilder builder = CachedMessage.builder()
.author(cachedAuthor)
.messageId(message.getIdLong())
.channelId(message.getChannel().getIdLong())
.content(message.getContentRaw())
.embeds(embeds)
.emotes(emotes)
.timeCreated(Instant.from(message.getTimeCreated()))
.attachments(attachments);
if(message.isFromGuild()) {
builder.serverId(message.getGuild().getIdLong());
}
future.complete(builder
.build());
}
return future;
}

View File

@@ -42,7 +42,7 @@ public class MessageCacheBean implements MessageCache {
@Override
@CachePut(key = "#message.id")
public CompletableFuture<CachedMessage> putMessageInCache(Message message) {
log.trace("Adding message {} to cache", message.getId());
log.info("Adding message {} to cache.", message.getId());
return cacheEntityService.buildCachedMessageFromMessage(message);
}
@@ -50,26 +50,27 @@ public class MessageCacheBean implements MessageCache {
@Override
@CachePut(key = "#message.messageId.toString()")
public CompletableFuture<CachedMessage> putMessageInCache(CachedMessage message) {
log.trace("Adding cached message to cache");
log.info("Adding cached message {} to cache.", message.getMessageId());
return CompletableFuture.completedFuture(message);
}
@Override
@Cacheable(key = "#message.id")
public CompletableFuture<CachedMessage> getMessageFromCache(Message message) {
log.trace("Retrieving message {}", message.getId());
log.trace("Retrieving message {}.", message.getId());
return getMessageFromCache(message.getGuild().getIdLong(), message.getChannel().getIdLong(), message.getIdLong());
}
@Override
@Cacheable(key = "#messageId.toString()")
public CompletableFuture<CachedMessage> getMessageFromCache(Long guildId, Long textChannelId, Long messageId) {
log.trace("Retrieving message {} with parameters.", messageId);
log.info("Retrieving message {}.", messageId);
return concreteSelf.loadMessage(guildId, textChannelId, messageId);
}
@Override
public CompletableFuture<CachedMessage> loadMessage(Long guildId, Long textChannelId, Long messageId) {
log.info("Loading message {} from channel {} in server {}.", messageId, textChannelId, guildId);
CompletableFuture<CachedMessage> future = new CompletableFuture<>();
Optional<Guild> guildOptional = guildService.getGuildByIdOptional(guildId);
if(guildOptional.isPresent()) {

View File

@@ -0,0 +1,86 @@
package dev.sheldan.abstracto.core.command.service;
import dev.sheldan.abstracto.core.command.models.database.ACommand;
import dev.sheldan.abstracto.core.command.service.management.ChannelGroupCommandManagementService;
import dev.sheldan.abstracto.core.models.database.AChannel;
import dev.sheldan.abstracto.core.models.database.AChannelGroup;
import dev.sheldan.abstracto.core.models.database.AChannelGroupCommand;
import dev.sheldan.abstracto.core.service.management.ChannelManagementService;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.ArrayList;
import java.util.Arrays;
import static org.mockito.Mockito.when;
@RunWith(MockitoJUnitRunner.class)
public class ChannelGroupCommandServiceBeanTest {
@InjectMocks
private ChannelGroupCommandServiceBean testUnit;
@Mock
private ChannelGroupCommandManagementService channelGroupCommandService;
@Mock
private ChannelManagementService channelManagementService;
@Mock
private ACommand command;
@Mock
private AChannel channel;
@Mock
private AChannel secondChannel;
@Mock
private AChannelGroupCommand channelGroupCommand;
@Mock
private AChannelGroup channelGroup;
private static final Long CHANNEL_ID = 4L;
private static final Long CHANNEL_ID_2 = 2L;
@Test
public void testNoChannelGroup() {
when(channelGroupCommandService.getAllGroupCommandsForCommand(command)).thenReturn(new ArrayList<>());
Assert.assertTrue(testUnit.isCommandEnabled(command, channel));
}
@Test
public void testOneDisabledChannelGroup() {
when(channelGroupCommandService.getAllGroupCommandsForCommand(command)).thenReturn(Arrays.asList(channelGroupCommand));
when(channelGroupCommand.getGroup()).thenReturn(channelGroup);
when(channelGroup.getChannels()).thenReturn(Arrays.asList(channel));
when(channelGroupCommand.getEnabled()).thenReturn(false);
Assert.assertFalse(testUnit.isCommandEnabled(command, channel));
}
@Test
public void testOneEnabledChannelGroup() {
when(channelGroupCommandService.getAllGroupCommandsForCommand(command)).thenReturn(Arrays.asList(channelGroupCommand));
when(channelGroupCommand.getGroup()).thenReturn(channelGroup);
when(channelGroup.getChannels()).thenReturn(Arrays.asList(channel));
when(channelGroupCommand.getEnabled()).thenReturn(true);
Assert.assertTrue(testUnit.isCommandEnabled(command, channel));
}
@Test
public void testDisabledInOneGroupChannelIsNotPartOf() {
when(channelGroupCommandService.getAllGroupCommandsForCommand(command)).thenReturn(Arrays.asList(channelGroupCommand));
when(channelGroupCommand.getGroup()).thenReturn(channelGroup);
when(channelGroup.getChannels()).thenReturn(Arrays.asList(secondChannel));
when(channel.getId()).thenReturn(CHANNEL_ID);
when(secondChannel.getId()).thenReturn(CHANNEL_ID_2);
Assert.assertTrue(testUnit.isCommandEnabled(command, channel));
}
}

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto.core</groupId>
<artifactId>core</artifactId>
<version>1.2</version>
<version>1.2.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>core</artifactId>
<groupId>dev.sheldan.abstracto.core</groupId>
<version>1.2</version>
<version>1.2.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>core</artifactId>
<groupId>dev.sheldan.abstracto.core</groupId>
<version>1.2</version>
<version>1.2.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto</groupId>
<artifactId>abstracto-application</artifactId>
<version>1.2</version>
<version>1.2.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto</groupId>
<artifactId>abstracto-application</artifactId>
<version>1.2</version>
<version>1.2.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>coverage</artifactId>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>abstracto-application</artifactId>
<groupId>dev.sheldan.abstracto</groupId>
<version>1.2</version>
<version>1.2.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto</groupId>
<artifactId>abstracto-application</artifactId>
<version>1.2</version>
<version>1.2.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -5,7 +5,7 @@ from sqlalchemy.sql import text
def deploy_template_folder(db_config, folder):
engine = db.create_engine('postgres://%s:%s@%s:%s/%s' % (db_config.user, db_config.password, db_config.host, db_config.port, db_config.database))
engine = db.create_engine('postgresql://%s:%s@%s:%s/%s' % (db_config.user, db_config.password, db_config.host, db_config.port, db_config.database))
if not os.path.isdir(folder):
print("Given path was not a folder. Exiting.")

View File

@@ -11,7 +11,7 @@
<groupId>dev.sheldan.abstracto</groupId>
<artifactId>abstracto-application</artifactId>
<version>1.2</version>
<version>1.2.2</version>
<packaging>pom</packaging>
<modules>
@@ -35,7 +35,7 @@
<scm>
<url>https://maven.pkg.github.com/Sheldan/abstracto</url>
<developerConnection>scm:git:git@github.com:Sheldan/abstracto.git</developerConnection>
<tag>abstracto-application-1.2</tag>
<tag>abstracto-application-1.2.2</tag>
</scm>
<repositories>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto</groupId>
<artifactId>abstracto-application</artifactId>
<version>1.2</version>
<version>1.2.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto.scheduling</groupId>
<artifactId>scheduling</artifactId>
<version>1.2</version>
<version>1.2.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.abstracto.scheduling</groupId>
<artifactId>scheduling</artifactId>
<version>1.2</version>
<version>1.2.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>