RED-10260: add quoteChar to component mapping
This commit is contained in:
parent
01005cc436
commit
a4d04bddf2
@ -52,7 +52,7 @@ dependencies {
|
|||||||
|
|
||||||
implementation("com.iqser.red.commons:dictionary-merge-commons:1.5.0")
|
implementation("com.iqser.red.commons:dictionary-merge-commons:1.5.0")
|
||||||
implementation("com.iqser.red.commons:storage-commons:2.50.0")
|
implementation("com.iqser.red.commons:storage-commons:2.50.0")
|
||||||
implementation("com.knecon.fforesight:tenant-commons:0.30.0")
|
implementation("com.knecon.fforesight:tenant-commons:0.31.0")
|
||||||
implementation("com.knecon.fforesight:keycloak-commons:0.30.0") {
|
implementation("com.knecon.fforesight:keycloak-commons:0.30.0") {
|
||||||
exclude(group = "com.knecon.fforesight", module = "tenant-commons")
|
exclude(group = "com.knecon.fforesight", module = "tenant-commons")
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,12 +0,0 @@
|
|||||||
package com.iqser.red.service.redaction.v1.server.configuraton;
|
|
||||||
|
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
|
|
||||||
import com.knecon.fforesight.tenantcommons.queue.TenantMessagingConfiguration;
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
@ConditionalOnProperty(prefix = "redaction-service", name = "priorityMode", havingValue = "true")
|
|
||||||
public class PriorityTenantMessagingConfigurationImpl extends TenantMessagingConfiguration {
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,12 +0,0 @@
|
|||||||
package com.iqser.red.service.redaction.v1.server.configuraton;
|
|
||||||
|
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
|
|
||||||
import com.knecon.fforesight.tenantcommons.queue.TenantMessagingConfiguration;
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
@ConditionalOnProperty(prefix = "redaction-service", name = "priorityMode", havingValue = "false")
|
|
||||||
public class TenantMessagingConfigurationImpl extends TenantMessagingConfiguration {
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,68 +0,0 @@
|
|||||||
package com.iqser.red.service.redaction.v1.server.queue;
|
|
||||||
|
|
||||||
import static com.iqser.red.service.redaction.v1.model.QueueNames.*;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
|
||||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
|
||||||
import org.springframework.boot.context.event.ApplicationReadyEvent;
|
|
||||||
import org.springframework.context.event.EventListener;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import com.knecon.fforesight.tenantcommons.TenantProvider;
|
|
||||||
import com.knecon.fforesight.tenantcommons.model.TenantCreatedEvent;
|
|
||||||
import com.knecon.fforesight.tenantcommons.model.TenantQueueConfiguration;
|
|
||||||
import com.knecon.fforesight.tenantcommons.model.TenantResponse;
|
|
||||||
import com.knecon.fforesight.tenantcommons.queue.RabbitQueueFromExchangeService;
|
|
||||||
import com.knecon.fforesight.tenantcommons.queue.TenantExchangeMessageReceiver;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
@ConditionalOnProperty(prefix = "redaction-service", name = "priorityMode", havingValue = "true")
|
|
||||||
public class PriorityTenantExchangeMessageReceiverImpl extends TenantExchangeMessageReceiver {
|
|
||||||
|
|
||||||
public PriorityTenantExchangeMessageReceiverImpl(RabbitQueueFromExchangeService rabbitQueueService, TenantProvider tenantProvider) {
|
|
||||||
|
|
||||||
super(rabbitQueueService, tenantProvider);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Set<TenantQueueConfiguration> getTenantQueueConfigs() {
|
|
||||||
|
|
||||||
return Set.of(TenantQueueConfiguration.builder()
|
|
||||||
.listenerId(PriorityMessageReceiver.REDACTION_PRIORITY_REQUEST_LISTENER_ID)
|
|
||||||
.exchangeName(REDACTION_PRIORITY_REQUEST_EXCHANGE)
|
|
||||||
.queuePrefix(REDACTION_PRIORITY_REQUEST_QUEUE_PREFIX)
|
|
||||||
.dlqName(REDACTION_DLQ)
|
|
||||||
.arguments(Map.of("x-max-priority", 2))
|
|
||||||
.build());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@EventListener(ApplicationReadyEvent.class)
|
|
||||||
public void onApplicationReady() {
|
|
||||||
|
|
||||||
System.out.println("application ready invoked");
|
|
||||||
super.initializeQueues();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@RabbitHandler
|
|
||||||
@RabbitListener(queues = "#{priorityTenantMessagingConfigurationImpl.getTenantCreatedQueueName()}")
|
|
||||||
public void reactToTenantCreation(TenantCreatedEvent tenantCreatedEvent) {
|
|
||||||
|
|
||||||
super.reactToTenantCreation(tenantCreatedEvent);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@RabbitHandler
|
|
||||||
@RabbitListener(queues = "#{priorityTenantMessagingConfigurationImpl.getTenantDeletedQueueName()}")
|
|
||||||
public void reactToTenantDeletion(TenantResponse tenantResponse) {
|
|
||||||
|
|
||||||
super.reactToTenantDeletion(tenantResponse);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,68 +0,0 @@
|
|||||||
package com.iqser.red.service.redaction.v1.server.queue;
|
|
||||||
|
|
||||||
import static com.iqser.red.service.redaction.v1.model.QueueNames.*;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
|
||||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
|
||||||
import org.springframework.boot.context.event.ApplicationReadyEvent;
|
|
||||||
import org.springframework.context.event.EventListener;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import com.knecon.fforesight.tenantcommons.TenantProvider;
|
|
||||||
import com.knecon.fforesight.tenantcommons.model.TenantCreatedEvent;
|
|
||||||
import com.knecon.fforesight.tenantcommons.model.TenantQueueConfiguration;
|
|
||||||
import com.knecon.fforesight.tenantcommons.model.TenantResponse;
|
|
||||||
import com.knecon.fforesight.tenantcommons.queue.RabbitQueueFromExchangeService;
|
|
||||||
import com.knecon.fforesight.tenantcommons.queue.TenantExchangeMessageReceiver;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
@ConditionalOnProperty(prefix = "redaction-service", name = "priorityMode", havingValue = "false")
|
|
||||||
public class TenantExchangeMessageReceiverImpl extends TenantExchangeMessageReceiver {
|
|
||||||
|
|
||||||
public TenantExchangeMessageReceiverImpl(RabbitQueueFromExchangeService rabbitQueueService, TenantProvider tenantProvider) {
|
|
||||||
|
|
||||||
super(rabbitQueueService, tenantProvider);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Set<TenantQueueConfiguration> getTenantQueueConfigs() {
|
|
||||||
|
|
||||||
return Set.of(TenantQueueConfiguration.builder()
|
|
||||||
.listenerId(MessageReceiver.REDACTION_REQUEST_LISTENER_ID)
|
|
||||||
.exchangeName(REDACTION_REQUEST_EXCHANGE)
|
|
||||||
.queuePrefix(REDACTION_REQUEST_QUEUE_PREFIX)
|
|
||||||
.dlqName(REDACTION_DLQ)
|
|
||||||
.arguments(Map.of("x-max-priority", 2))
|
|
||||||
.build());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@EventListener(ApplicationReadyEvent.class)
|
|
||||||
public void onApplicationReady() {
|
|
||||||
|
|
||||||
System.out.println("application ready invoked");
|
|
||||||
super.initializeQueues();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@RabbitHandler
|
|
||||||
@RabbitListener(queues = "#{tenantMessagingConfigurationImpl.getTenantCreatedQueueName()}")
|
|
||||||
public void reactToTenantCreation(TenantCreatedEvent tenantCreatedEvent) {
|
|
||||||
|
|
||||||
super.reactToTenantCreation(tenantCreatedEvent);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@RabbitHandler
|
|
||||||
@RabbitListener(queues = "#{tenantMessagingConfigurationImpl.getTenantDeletedQueueName()}")
|
|
||||||
public void reactToTenantDeletion(TenantResponse tenantResponse) {
|
|
||||||
|
|
||||||
super.reactToTenantDeletion(tenantResponse);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -0,0 +1,49 @@
|
|||||||
|
package com.iqser.red.service.redaction.v1.server.queue;
|
||||||
|
|
||||||
|
import static com.iqser.red.service.redaction.v1.model.QueueNames.REDACTION_DLQ;
|
||||||
|
import static com.iqser.red.service.redaction.v1.model.QueueNames.REDACTION_PRIORITY_REQUEST_EXCHANGE;
|
||||||
|
import static com.iqser.red.service.redaction.v1.model.QueueNames.REDACTION_PRIORITY_REQUEST_QUEUE_PREFIX;
|
||||||
|
import static com.iqser.red.service.redaction.v1.model.QueueNames.REDACTION_REQUEST_EXCHANGE;
|
||||||
|
import static com.iqser.red.service.redaction.v1.model.QueueNames.REDACTION_REQUEST_QUEUE_PREFIX;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
import com.knecon.fforesight.tenantcommons.model.TenantQueueConfiguration;
|
||||||
|
import com.knecon.fforesight.tenantcommons.model.TenantQueueProvider;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class TenantQueueProviderConfig {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
@ConditionalOnProperty(prefix = "redaction-service", name = "priorityMode", havingValue = "true")
|
||||||
|
protected TenantQueueProvider getTenantPriorityQueueConfigs() {
|
||||||
|
|
||||||
|
return new TenantQueueProvider(Set.of(TenantQueueConfiguration.builder()
|
||||||
|
.listenerId(PriorityMessageReceiver.REDACTION_PRIORITY_REQUEST_LISTENER_ID)
|
||||||
|
.exchangeName(REDACTION_PRIORITY_REQUEST_EXCHANGE)
|
||||||
|
.queuePrefix(REDACTION_PRIORITY_REQUEST_QUEUE_PREFIX)
|
||||||
|
.dlqName(REDACTION_DLQ)
|
||||||
|
.arguments(Map.of("x-max-priority", 2))
|
||||||
|
.build()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
@ConditionalOnProperty(prefix = "redaction-service", name = "priorityMode", havingValue = "false", matchIfMissing = true)
|
||||||
|
protected Set<TenantQueueConfiguration> getTenantQueueConfigs() {
|
||||||
|
|
||||||
|
return Set.of(TenantQueueConfiguration.builder()
|
||||||
|
.listenerId(MessageReceiver.REDACTION_REQUEST_LISTENER_ID)
|
||||||
|
.exchangeName(REDACTION_REQUEST_EXCHANGE)
|
||||||
|
.queuePrefix(REDACTION_REQUEST_QUEUE_PREFIX)
|
||||||
|
.dlqName(REDACTION_DLQ)
|
||||||
|
.arguments(Map.of("x-max-priority", 2))
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -7,7 +7,6 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.entitylog.Engine;
|
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.entitylog.Engine;
|
||||||
import com.iqser.red.service.redaction.v1.server.model.dictionary.Dictionary;
|
import com.iqser.red.service.redaction.v1.server.model.dictionary.Dictionary;
|
||||||
import com.iqser.red.service.redaction.v1.server.model.dictionary.DictionaryModel;
|
|
||||||
import com.iqser.red.service.redaction.v1.server.model.dictionary.SearchImplementation;
|
import com.iqser.red.service.redaction.v1.server.model.dictionary.SearchImplementation;
|
||||||
import com.iqser.red.service.redaction.v1.server.model.document.entity.EntityType;
|
import com.iqser.red.service.redaction.v1.server.model.document.entity.EntityType;
|
||||||
import com.iqser.red.service.redaction.v1.server.model.document.nodes.SemanticNode;
|
import com.iqser.red.service.redaction.v1.server.model.document.nodes.SemanticNode;
|
||||||
@ -40,25 +39,17 @@ public class DictionarySearchService {
|
|||||||
public void addDictionaryEntities(Dictionary dictionary, SemanticNode node) {
|
public void addDictionaryEntities(Dictionary dictionary, SemanticNode node) {
|
||||||
|
|
||||||
dictionary.getDictionaryModels()
|
dictionary.getDictionaryModels()
|
||||||
.stream()
|
|
||||||
.parallel()
|
|
||||||
.forEach(model -> {
|
.forEach(model -> {
|
||||||
synchronized (node) {
|
|
||||||
bySearchImplementationAsDictionary(model.getEntriesSearch(),
|
bySearchImplementationAsDictionary(model.getEntriesSearch(),
|
||||||
model.getType(),
|
model.getType(),
|
||||||
model.isHint() ? EntityType.HINT : EntityType.ENTITY,
|
model.isHint() ? EntityType.HINT : EntityType.ENTITY,
|
||||||
node,
|
node,
|
||||||
model.isDossierDictionary());
|
model.isDossierDictionary());
|
||||||
bySearchImplementationAsDictionary(model.getFalsePositiveSearch(), model.getType(), EntityType.FALSE_POSITIVE, node, model.isDossierDictionary());
|
bySearchImplementationAsDictionary(model.getFalsePositiveSearch(), model.getType(), EntityType.FALSE_POSITIVE, node, model.isDossierDictionary());
|
||||||
bySearchImplementationAsDictionary(model.getFalseRecommendationsSearch(),
|
bySearchImplementationAsDictionary(model.getFalseRecommendationsSearch(), model.getType(), EntityType.FALSE_RECOMMENDATION, node, model.isDossierDictionary());
|
||||||
model.getType(),
|
|
||||||
EntityType.FALSE_RECOMMENDATION,
|
|
||||||
node,
|
|
||||||
model.isDossierDictionary());
|
|
||||||
if (model.isDossierDictionary()) {
|
if (model.isDossierDictionary()) {
|
||||||
bySearchImplementationAsDictionary(model.getDeletionEntriesSearch(), model.getType(), EntityType.DICTIONARY_REMOVAL, node, model.isDossierDictionary());
|
bySearchImplementationAsDictionary(model.getDeletionEntriesSearch(), model.getType(), EntityType.DICTIONARY_REMOVAL, node, model.isDossierDictionary());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import static com.iqser.red.service.redaction.v1.server.testcontainers.MongoDBTe
|
|||||||
import static com.iqser.red.service.redaction.v1.server.testcontainers.MongoDBTestContainer.MONGO_USERNAME;
|
import static com.iqser.red.service.redaction.v1.server.testcontainers.MongoDBTestContainer.MONGO_USERNAME;
|
||||||
import static com.knecon.fforesight.tenantcommons.model.TenantResponse.builder;
|
import static com.knecon.fforesight.tenantcommons.model.TenantResponse.builder;
|
||||||
import static org.mockito.ArgumentMatchers.any;
|
import static org.mockito.ArgumentMatchers.any;
|
||||||
|
import static org.mockito.Mockito.mock;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -30,12 +31,18 @@ import org.junit.jupiter.api.BeforeEach;
|
|||||||
import org.mockito.stubbing.Answer;
|
import org.mockito.stubbing.Answer;
|
||||||
import org.springframework.amqp.rabbit.core.RabbitAdmin;
|
import org.springframework.amqp.rabbit.core.RabbitAdmin;
|
||||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||||
|
import org.springframework.amqp.rabbit.listener.MessageListenerContainer;
|
||||||
import org.springframework.amqp.rabbit.listener.RabbitListenerEndpointRegistry;
|
import org.springframework.amqp.rabbit.listener.RabbitListenerEndpointRegistry;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||||
|
import org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration;
|
||||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||||
import org.springframework.boot.test.util.TestPropertyValues;
|
import org.springframework.boot.test.util.TestPropertyValues;
|
||||||
import org.springframework.context.ApplicationContextInitializer;
|
import org.springframework.context.ApplicationContextInitializer;
|
||||||
import org.springframework.context.ConfigurableApplicationContext;
|
import org.springframework.context.ConfigurableApplicationContext;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.context.annotation.Import;
|
||||||
import org.springframework.core.io.ClassPathResource;
|
import org.springframework.core.io.ClassPathResource;
|
||||||
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
|
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
|
||||||
import org.springframework.test.context.ContextConfiguration;
|
import org.springframework.test.context.ContextConfiguration;
|
||||||
@ -85,6 +92,7 @@ import lombok.SneakyThrows;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
@ContextConfiguration(initializers = {AbstractRedactionIntegrationTest.Initializer.class})
|
@ContextConfiguration(initializers = {AbstractRedactionIntegrationTest.Initializer.class})
|
||||||
|
@Import(AbstractRedactionIntegrationTest.TestConfiguration.class)
|
||||||
public abstract class AbstractRedactionIntegrationTest {
|
public abstract class AbstractRedactionIntegrationTest {
|
||||||
|
|
||||||
protected static final String VERTEBRATE_INDICATOR = "vertebrate";
|
protected static final String VERTEBRATE_INDICATOR = "vertebrate";
|
||||||
@ -172,9 +180,6 @@ public abstract class AbstractRedactionIntegrationTest {
|
|||||||
@MockBean
|
@MockBean
|
||||||
protected RabbitAdmin rabbitAdmin;
|
protected RabbitAdmin rabbitAdmin;
|
||||||
|
|
||||||
@MockBean
|
|
||||||
protected RabbitListenerEndpointRegistry rabbitListenerEndpointRegistry;
|
|
||||||
|
|
||||||
@MockBean
|
@MockBean
|
||||||
protected LegalBasisClient legalBasisClient;
|
protected LegalBasisClient legalBasisClient;
|
||||||
|
|
||||||
@ -739,4 +744,20 @@ public abstract class AbstractRedactionIntegrationTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
@EnableAutoConfiguration(exclude = {RabbitAutoConfiguration.class})
|
||||||
|
public static class TestConfiguration {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public RabbitListenerEndpointRegistry rabbitListenerEndpointRegistry() {
|
||||||
|
|
||||||
|
var mock = mock(RabbitListenerEndpointRegistry.class);
|
||||||
|
when(mock.getListenerContainer(any())).thenReturn(mock(MessageListenerContainer.class));
|
||||||
|
|
||||||
|
return mock;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user