Skip to content

Commit

Permalink
Fixed issue when upgrading symphony bdk that spring resolver more imp…
Browse files Browse the repository at this point in the history
…ortant than chatvariable, test failed
  • Loading branch information
robmoffat committed Mar 15, 2023
1 parent ea4c06d commit a25fe81
Show file tree
Hide file tree
Showing 2 changed files with 98 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.finos.springbot.workflow.content.UnorderedList;
import org.finos.springbot.workflow.content.Word;
import org.finos.springbot.workflow.history.AllHistory;
import org.finos.springbot.workflow.java.mapping.ChatHandlerExecutor;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.beans.factory.annotation.Autowired;
Expand All @@ -32,33 +33,46 @@ public class ResolverConfig {
*/
@Bean
public WorkflowResolverFactory springBeanResolver() {
return action -> {
return new WorkflowResolver() {
return new WorkflowResolverFactory() {

@Override
public int getOrder() {
return LOW_PRIORITY;
}

@Override
public boolean canResolve(MethodParameter mp) {
try {
Class<?> c = mp.getParameterType();
context.getBean(c);
return true;
} catch (NoSuchBeanDefinitionException e) {
return false;
@Override
public WorkflowResolver createResolver(ChatHandlerExecutor che) {
return new WorkflowResolver() {

@Override
public boolean canResolve(MethodParameter mp) {
try {
Class<?> c = mp.getParameterType();
context.getBean(c);
return true;
} catch (NoSuchBeanDefinitionException e) {
return false;
}
}
}

@Override
public Optional<Object> resolve(MethodParameter mp) {
try {

Class<?> c = mp.getParameterType();
Object bean = context.getBean(c);
return Optional.of(bean);
} catch (NoSuchBeanDefinitionException e) {
return Optional.empty();
@Override
public Optional<Object> resolve(MethodParameter mp) {
try {

Class<?> c = mp.getParameterType();
Object bean = context.getBean(c);
return Optional.of(bean);
} catch (NoSuchBeanDefinitionException e) {
return Optional.empty();
}
}
}
};


};
}
};


}

@Bean
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
class V4MessageSent {
message: class V4Message {
messageId: null
parentMessageId: null
timestamp: null
message: <messageML>/optionals zib zab zob <span class="entity" data-entity-id="1">@gaurav</span> pingu</messageML>
sharedMessage: null
data: {
"1" : {
"type" : "com.symphony.user.mention",
"version" : "1.0",
"id" : [ {
"type" : "com.symphony.user.userId",
"version" : "1.0",
"value" : "123"
}, {
"type" : "com.symphony.user.displayName",
"version" : "1.0",
"value" : "gaurav"
}, {
"type" : "com.symphony.user.emailAddress",
"version" : "1.0",
"value" : "gaurav@example.com"
} ]
},
"2" : {
"type" : "org.symphonyoss.taxonomy.hashtag",
"version" : "1.0",
"value" : "SomeTopic",
"name" : "SomeTopic"
}
}
attachments: null
user: class V4User {
userId: 765
firstName: null
lastName: null
displayName: Robert Moffat
email: rob@example.com
username: Robert Moffat
}
stream: class V4Stream {
streamId: abc123
streamType: ROOM
roomName: null
members: null
external: null
crossPod: null
}
externalRecipients: null
diagnostic: null
userAgent: null
originalFormat: null
disclaimer: null
sid: null
replacing: null
replacedBy: null
initialTimestamp: null
initialMessageId: null
silent: null
}
}

0 comments on commit a25fe81

Please sign in to comment.