Skip to content

Commit

Permalink
Merge pull request #1 from aashikam/check
Browse files Browse the repository at this point in the history
Fix compiler plugin test failure
  • Loading branch information
DaAlbrecht authored Sep 27, 2024
2 parents a6ab6b8 + 263d42a commit b633f4a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public class PluginConstants {
public static final String MESSAGE_CONTENT_TYPE = "contentType";
public static final String MESSAGE_CONTENT_ENCODING = "contentEncoding";
public static final String MESSAGE_CORRELATION_ID = "correlationId";
public static final String MESSAGE_HEADERS = "headers";

// return types error or nil
public static final String ERROR = "error";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
import static io.ballerina.stdlib.rabbitmq.plugin.PluginConstants.MESSAGE_CORRELATION_ID;
import static io.ballerina.stdlib.rabbitmq.plugin.PluginConstants.MESSAGE_DELIVERY_TAG;
import static io.ballerina.stdlib.rabbitmq.plugin.PluginConstants.MESSAGE_EXCHANGE;
import static io.ballerina.stdlib.rabbitmq.plugin.PluginConstants.MESSAGE_HEADERS;
import static io.ballerina.stdlib.rabbitmq.plugin.PluginConstants.MESSAGE_PROPERTIES;
import static io.ballerina.stdlib.rabbitmq.plugin.PluginConstants.MESSAGE_REPLY_TO;
import static io.ballerina.stdlib.rabbitmq.plugin.PluginConstants.MESSAGE_ROUTING_KEY;
Expand Down Expand Up @@ -403,10 +404,11 @@ private boolean validatePropertiesField(TypeSymbol propertiesTypeSymbol) {
propertiesRecordSymbol = (RecordTypeSymbol) propertiesTypeSymbol;
}
Map<String, RecordFieldSymbol> propertiesFieldDescriptors = propertiesRecordSymbol.fieldDescriptors();
if (propertiesFieldDescriptors.size() != 4 || !propertiesFieldDescriptors.containsKey(MESSAGE_REPLY_TO) ||
if (propertiesFieldDescriptors.size() != 5 || !propertiesFieldDescriptors.containsKey(MESSAGE_REPLY_TO) ||
!propertiesFieldDescriptors.containsKey(MESSAGE_CONTENT_TYPE) ||
!propertiesFieldDescriptors.containsKey(MESSAGE_CONTENT_ENCODING) ||
!propertiesFieldDescriptors.containsKey(MESSAGE_CORRELATION_ID)) {
!propertiesFieldDescriptors.containsKey(MESSAGE_CORRELATION_ID) ||
!propertiesFieldDescriptors.containsKey(MESSAGE_HEADERS)) {
return false;
}
if (propertiesFieldDescriptors.get(MESSAGE_REPLY_TO).typeDescriptor().typeKind() != STRING) {
Expand All @@ -421,6 +423,9 @@ private boolean validatePropertiesField(TypeSymbol propertiesTypeSymbol) {
if (propertiesFieldDescriptors.get(MESSAGE_CORRELATION_ID).typeDescriptor().typeKind() != STRING) {
return false;
}
if (propertiesFieldDescriptors.get(MESSAGE_HEADERS).typeDescriptor().typeKind() != MAP) {
return false;
}
return true;
}

Expand Down

0 comments on commit b633f4a

Please sign in to comment.