Skip to content
Snippets Groups Projects
Commit e17b0479 authored by OZGCloud's avatar OZGCloud
Browse files

Merge pull request 'OZG-2500 workaround crash on find commands' (#54) from...

Merge pull request 'OZG-2500 workaround crash on find commands' (#54) from OZG-2500-FixCrashOnFindCOmmands into master

Reviewed-on: https://git.ozg-sh.de/mgm/pluto/pulls/54
parents 4c51ef99 68e14162
Branches
Tags
No related merge requests found
......@@ -92,7 +92,8 @@ class CommandRepository {
}
private Query buildCommandsQuery(String vorgangId, Collection<CommandStatus> status, Optional<Order> commandOrder) {
var result = query(where(PersistedCommand.FIELD_VORGANG_ID).is(vorgangId));
// TODO OZG-2750
var result = query(where(PersistedCommand.FIELD_VORGANG_ID).is(vorgangId).and("_class").is("de.itvsh.ozg.pluto.command.PersistedCommand"));
if (!status.isEmpty()) {
result.addCriteria(new Criteria(MONGODB_STATUS).in(status));
......
package de.itvsh.ozg.pluto.command;
import static org.assertj.core.api.Assertions.*;
import java.util.Collections;
import java.util.Optional;
import java.util.UUID;
import org.bson.Document;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
......@@ -14,6 +13,8 @@ import org.junit.jupiter.params.provider.EnumSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoOperations;
import static org.assertj.core.api.Assertions.*;
import de.itvsh.kop.common.test.DataITCase;
import de.itvsh.ozg.pluto.vorgang.VorgangTestFactory;
......@@ -157,5 +158,18 @@ class CommandRepositoryITCase {
assertThat(commands).hasSize(1);
}
@Test
void shouldExcludeCommands() {
var doc = new Document();
doc.put("_class", "de.itvsh.ozg.pluto.command.Command");
doc.put("vorgangId", VorgangTestFactory.ID);
mongoOperations.insert(doc, "command");
repository.save(CommandTestFactory.create());
var commands = repository.findCommands(VorgangTestFactory.ID, Collections.emptyList(), Optional.empty());
assertThat(commands).hasSize(1);
}
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment