Skip to content
Snippets Groups Projects
Commit 924835cf authored by Thomas Gehrmann [InvitedE]'s avatar Thomas Gehrmann [InvitedE]
Browse files

Merge branch 'master' into 122-osdu-dd-delivery-m16

parents 3c77b9f7 b29fbf84
Branches
Tags
1 merge request!443OSDU Data Definition M16 deliverables
Pipeline #165974 failed
......@@ -112,14 +112,12 @@ public class MessageBusImpl implements IMessageBus {
String data = new Gson().toJson(Collections.singletonList(schemaPubSubMsg));
Map<String, String> attributes = new HashMap<>();
attributes.put(DpsHeaders.ACCOUNT_ID, this.tenantInfo.getName());
attributes.put(DpsHeaders.DATA_PARTITION_ID,
this.headers.getPartitionIdWithFallbackToAccountId());
this.headers.addCorrelationIdIfMissing();
attributes.put(DpsHeaders.CORRELATION_ID, this.headers.getCorrelationId());
attributes.put(SchemaConstants.SERVICE_NAME, SchemaConstants.SCHEMA);
Map<String, String> headersMap = headers.getHeaders();
headersMap.put(DpsHeaders.ACCOUNT_ID, this.tenantInfo.getName());
headersMap.remove(DpsHeaders.AUTHORIZATION);
Map<String, String> attributes = new HashMap<>(headersMap);
return OqmMessage.builder()
.data(data)
.attributes(attributes)
......
......@@ -17,6 +17,13 @@
package org.opengroup.osdu.schema.impl.messagebus;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import java.util.HashMap;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
......@@ -32,9 +39,6 @@ import org.opengroup.osdu.schema.configuration.EventMessagingPropertiesConfig;
import org.opengroup.osdu.schema.destination.provider.impl.OqmDestinationProvider;
import org.opengroup.osdu.schema.logging.AuditLogger;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.*;
@RunWith(MockitoJUnitRunner.class)
public class MessageBusImplTest {
......@@ -84,9 +88,10 @@ public class MessageBusImplTest {
public void should_publishEventMessage_WhenFlagIsTrue() {
when(this.eventMessagingPropertiesConfig.isMessagingEnabled()).thenReturn(true);
when(this.tenantInfo.getName()).thenReturn(TENANT_NAME);
when(this.headers.getPartitionIdWithFallbackToAccountId()).thenReturn(DATA_PARTITION_ID);
doNothing().when(this.headers).addCorrelationIdIfMissing();
when(this.headers.getCorrelationId()).thenReturn(CORRELATION_ID);
HashMap<String, String> headersMap = new HashMap<>();
headersMap.put(DpsHeaders.DATA_PARTITION_ID, DATA_PARTITION_ID);
headersMap.put(DpsHeaders.CORRELATION_ID, CORRELATION_ID);
when(this.headers.getHeaders()).thenReturn(headersMap);
this.sut.publishMessage(SCHEMA_ID, EVENT_TYPE);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment