Skip to content
This repository was archived by the owner on May 8, 2026. It is now read-only.
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
@@ -1,5 +1,41 @@
package com.dke.data.agrirouter.api.service.messaging.http;

import com.dke.data.agrirouter.api.dto.onboard.OnboardingResponse;
import com.dke.data.agrirouter.api.messaging.HttpAsyncMessageSendingResult;
import com.dke.data.agrirouter.api.service.parameters.ListEndpointsParameters;

public interface ListEndpointsService extends MessagingService<ListEndpointsParameters> {}
public interface ListEndpointsService extends MessagingService<ListEndpointsParameters> {

/**
* List all endpoints with a route to the dedicated endpoint.
*
* @param onboardingResponse The onboard response for the endpoint.
* @return The message ID.
*/
String listAllWithExistingRoute(OnboardingResponse onboardingResponse);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this is only the requesting function and does not directly return the endpoint list, a name that starts with request would be more accurate.

requestAllWithExistingRoute() or requestAllEndpointsWithExistingRoute()
requestAll() or requestAllEndpoints()

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since 'request' is based on the HTTP terminology. I would like to stay with the current name. Resolve the conversation if this is fine.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, what about queue? ;-)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to keep the same name for both of the services and therefore, stick with the current name.


/**
* List all endpoints for the account, even those that do not have a route.
*
* @param onboardingResponse The onboard response for the endpoint.
* @return The message ID.
*/
String listAll(OnboardingResponse onboardingResponse);

/**
* List all endpoints with a route to the dedicated endpoint.
*
* @param onboardingResponse The onboard response for the endpoint.
* @return The message ID.
*/
HttpAsyncMessageSendingResult listAllWithExistingRouteAsync(
OnboardingResponse onboardingResponse);

/**
* List all endpoints for the account, even those that do not have a route.
*
* @param onboardingResponse The onboard response for the endpoint.
* @return The message ID.
*/
HttpAsyncMessageSendingResult listAllAsync(OnboardingResponse onboardingResponse);
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,41 @@
package com.dke.data.agrirouter.api.service.messaging.mqtt;

import com.dke.data.agrirouter.api.dto.onboard.OnboardingResponse;
import com.dke.data.agrirouter.api.messaging.MqttAsyncMessageSendingResult;
import com.dke.data.agrirouter.api.service.parameters.ListEndpointsParameters;

public interface ListEndpointsService extends MessagingService<ListEndpointsParameters> {}
public interface ListEndpointsService extends MessagingService<ListEndpointsParameters> {

/**
* List all endpoints with a route to the dedicated endpoint.
*
* @param onboardingResponse The onboard response for the endpoint.
* @return The message ID.
*/
String listAllWithExistingRoute(OnboardingResponse onboardingResponse);

/**
* List all endpoints for the account, even those that do not have a route.
*
* @param onboardingResponse The onboard response for the endpoint.
* @return The message ID.
*/
String listAll(OnboardingResponse onboardingResponse);

/**
* List all endpoints with a route to the dedicated endpoint.
*
* @param onboardingResponse The onboard response for the endpoint.
* @return The message ID.
*/
MqttAsyncMessageSendingResult listAllWithExistingRouteAsync(
OnboardingResponse onboardingResponse);

/**
* List all endpoints for the account, even those that do not have a route.
*
* @param onboardingResponse The onboard response for the endpoint.
* @return The message ID.
*/
MqttAsyncMessageSendingResult listAllAsync(OnboardingResponse onboardingResponse);
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ public List<MessageParameterTuple> chunkAndEncode(
messageHeaderParameters.validate();
payloadParameters.validate();

if (messageHeaderParameters.getTechnicalMessageType().needsBase64EncodingAndHasToBeChunkedIfNecessary()) {
if (messageHeaderParameters
.getTechnicalMessageType()
.needsBase64EncodingAndHasToBeChunkedIfNecessary()) {
if (payloadParameters.shouldBeChunked()) {
getNativeLogger()
.debug(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package com.dke.data.agrirouter.impl.messaging.mqtt;

import agrirouter.request.payload.account.Endpoints;
import com.dke.data.agrirouter.api.dto.encoding.EncodedMessage;
import com.dke.data.agrirouter.api.dto.onboard.OnboardingResponse;
import com.dke.data.agrirouter.api.enums.SystemMessageType;
import com.dke.data.agrirouter.api.exception.CouldNotSendMqttMessageException;
import com.dke.data.agrirouter.api.messaging.MqttAsyncMessageSendingResult;
import com.dke.data.agrirouter.api.service.messaging.encoding.EncodeMessageService;
Expand Down Expand Up @@ -61,4 +64,45 @@ public MqttAsyncMessageSendingResult sendAsync(ListEndpointsParameters parameter
public EncodeMessageService getEncodeMessageService() {
return this.encodeMessageService;
}

@Override
public String listAllWithExistingRoute(OnboardingResponse onboardingResponse) {
ListEndpointsParameters listEndpointsParameters = new ListEndpointsParameters();
listEndpointsParameters.setDirection(Endpoints.ListEndpointsQuery.Direction.SEND_RECEIVE);
listEndpointsParameters.setTechnicalMessageType(SystemMessageType.EMPTY);
listEndpointsParameters.setOnboardingResponse(onboardingResponse);
listEndpointsParameters.setUnfilteredList(false);
return send(listEndpointsParameters);
}

@Override
public String listAll(OnboardingResponse onboardingResponse) {
ListEndpointsParameters listEndpointsParameters = new ListEndpointsParameters();
listEndpointsParameters.setDirection(Endpoints.ListEndpointsQuery.Direction.SEND_RECEIVE);
listEndpointsParameters.setTechnicalMessageType(SystemMessageType.EMPTY);
listEndpointsParameters.setOnboardingResponse(onboardingResponse);
listEndpointsParameters.setUnfilteredList(true);
return send(listEndpointsParameters);
}

@Override
public MqttAsyncMessageSendingResult listAllWithExistingRouteAsync(
OnboardingResponse onboardingResponse) {
ListEndpointsParameters listEndpointsParameters = new ListEndpointsParameters();
listEndpointsParameters.setDirection(Endpoints.ListEndpointsQuery.Direction.SEND_RECEIVE);
listEndpointsParameters.setTechnicalMessageType(SystemMessageType.EMPTY);
listEndpointsParameters.setOnboardingResponse(onboardingResponse);
listEndpointsParameters.setUnfilteredList(false);
return sendAsync(listEndpointsParameters);
}

@Override
public MqttAsyncMessageSendingResult listAllAsync(OnboardingResponse onboardingResponse) {
ListEndpointsParameters listEndpointsParameters = new ListEndpointsParameters();
listEndpointsParameters.setDirection(Endpoints.ListEndpointsQuery.Direction.SEND_RECEIVE);
listEndpointsParameters.setTechnicalMessageType(SystemMessageType.EMPTY);
listEndpointsParameters.setOnboardingResponse(onboardingResponse);
listEndpointsParameters.setUnfilteredList(true);
return sendAsync(listEndpointsParameters);
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package com.dke.data.agrirouter.impl.messaging.rest;

import agrirouter.request.payload.account.Endpoints;
import com.dke.data.agrirouter.api.dto.encoding.EncodedMessage;
import com.dke.data.agrirouter.api.dto.onboard.OnboardingResponse;
import com.dke.data.agrirouter.api.enums.SystemMessageType;
import com.dke.data.agrirouter.api.env.Environment;
import com.dke.data.agrirouter.api.messaging.HttpAsyncMessageSendingResult;
import com.dke.data.agrirouter.api.messaging.MessageSendingResponse;
Expand Down Expand Up @@ -54,4 +57,45 @@ public HttpAsyncMessageSendingResult sendAsync(ListEndpointsParameters parameter
public EncodeMessageService getEncodeMessageService() {
return this.encodeMessageService;
}

@Override
public String listAllWithExistingRoute(OnboardingResponse onboardingResponse) {
ListEndpointsParameters listEndpointsParameters = new ListEndpointsParameters();
listEndpointsParameters.setDirection(Endpoints.ListEndpointsQuery.Direction.SEND_RECEIVE);
listEndpointsParameters.setTechnicalMessageType(SystemMessageType.EMPTY);
listEndpointsParameters.setOnboardingResponse(onboardingResponse);
listEndpointsParameters.setUnfilteredList(false);
return send(listEndpointsParameters);
}

@Override
public String listAll(OnboardingResponse onboardingResponse) {
ListEndpointsParameters listEndpointsParameters = new ListEndpointsParameters();
listEndpointsParameters.setDirection(Endpoints.ListEndpointsQuery.Direction.SEND_RECEIVE);
listEndpointsParameters.setTechnicalMessageType(SystemMessageType.EMPTY);
listEndpointsParameters.setOnboardingResponse(onboardingResponse);
listEndpointsParameters.setUnfilteredList(true);
return send(listEndpointsParameters);
}

@Override
public HttpAsyncMessageSendingResult listAllWithExistingRouteAsync(
OnboardingResponse onboardingResponse) {
ListEndpointsParameters listEndpointsParameters = new ListEndpointsParameters();
listEndpointsParameters.setDirection(Endpoints.ListEndpointsQuery.Direction.SEND_RECEIVE);
listEndpointsParameters.setTechnicalMessageType(SystemMessageType.EMPTY);
listEndpointsParameters.setOnboardingResponse(onboardingResponse);
listEndpointsParameters.setUnfilteredList(false);
return sendAsync(listEndpointsParameters);
}

@Override
public HttpAsyncMessageSendingResult listAllAsync(OnboardingResponse onboardingResponse) {
ListEndpointsParameters listEndpointsParameters = new ListEndpointsParameters();
listEndpointsParameters.setDirection(Endpoints.ListEndpointsQuery.Direction.SEND_RECEIVE);
listEndpointsParameters.setTechnicalMessageType(SystemMessageType.EMPTY);
listEndpointsParameters.setOnboardingResponse(onboardingResponse);
listEndpointsParameters.setUnfilteredList(true);
return sendAsync(listEndpointsParameters);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,29 @@
import java.nio.file.Paths;
import java.util.Base64;

/**
* Generic content reader for the testcases.
*/
/** Generic content reader for the testcases. */
public class ContentReader {

private static final String FOLDER = "./message-content/";
private static final String FOLDER = "./message-content/";

public static String readBase64EncodedMessageContent(Identifier identifier) throws Throwable {
Path path = Paths.get(FOLDER.concat(identifier.getFileName()));
final byte[] rawData = Files.readAllBytes(path);
return new String(Base64.getEncoder().encode(rawData));
}

public enum Identifier {
BIG_TASK_DATA("big_taskdata.zip"),
SMALL_TASK_DATA("small_taskdata.zip");
public static String readBase64EncodedMessageContent(Identifier identifier) throws Throwable {
Path path = Paths.get(FOLDER.concat(identifier.getFileName()));
final byte[] rawData = Files.readAllBytes(path);
return new String(Base64.getEncoder().encode(rawData));
}

private final String fileName;
public enum Identifier {
BIG_TASK_DATA("big_taskdata.zip"),
SMALL_TASK_DATA("small_taskdata.zip");

Identifier(String fileName) {
this.fileName = fileName;
}
private final String fileName;

public String getFileName() {
return fileName;
}
Identifier(String fileName) {
this.fileName = fileName;
}

public String getFileName() {
return fileName;
}
}
}
Loading