Dataset Viewer
Auto-converted to Parquet Duplicate
commit
stringclasses
20 values
type
stringclasses
21 values
description
stringlengths
127
412
old_signature
stringlengths
20
206
new_signature
stringlengths
20
232
old_name
stringlengths
4
36
new_name
stringlengths
4
36
old_arguments
stringlengths
0
153
new_arguments
stringlengths
0
190
old_return_type
stringlengths
4
35
new_return_type
stringlengths
4
37
old_implementation
stringlengths
14
1.65k
new_implementation
stringlengths
14
1.45k
68a34701d11f840878f0580749e73bbb7a9c0d81
Remove Parameter
Remove Parameter pathVariables : PathVariables in method public reserveCredit(cm CommandMessage<TestCommand>, pathVariables PathVariables) : Message from class io.eventuate.tram.commands.consumer.CommandDispatcherTest.CommandDispatcherTestTarget
public reserveCredit(cm CommandMessage<TestCommand>, pathVariables PathVariables) : Message
public reserveCredit(cm CommandMessage<TestCommand>) : Message
reserveCredit
reserveCredit
cm CommandMessage<TestCommand>, pathVariables PathVariables
cm CommandMessage<TestCommand>
Message
Message
String customerId = pathVariables.getString("customerId"); System.out.println("customerId=" + customerId); System.out.println("cm=" + cm); return MessageBuilder .withPayload(JSonMapper.toJson(new Success())) .build();
return MessageBuilder .withPayload(JSonMapper.toJson(new Success())) .build();
68a34701d11f840878f0580749e73bbb7a9c0d81
Move Code
Move Code from public shouldDispatchCommand() : void to public setup() : void in class io.eventuate.tram.commands.consumer.CommandDispatcherTest
public shouldDispatchCommand() : void
public setup() : void
shouldDispatchCommand
setup
void
void
String commandDispatcherId = "fooId"; CommandDispatcherTestTarget target = spy(new CommandDispatcherTestTarget()); ChannelMapping channelMapping = mock(ChannelMapping.class); MessageConsumer messageConsumer = mock(MessageConsumer.class); MessageProducer messageProducer = mock(MessageProducer.class); CommandNameMapping commandNameMapping = mock(CommandNameMapping.class); String externalName = "extTestCommand"; when(commandNameMapping.commandToExternalCommandType(any(TestCommand.class))).thenReturn(externalName); when(commandNameMapping.externalCommandTypeToCommandClassName(externalName)).thenReturn(TestCommand.class.getName()); CommandDispatcher dispatcher = new CommandDispatcher(commandDispatcherId, defineCommandHandlers(target), messageConsumer, messageProducer, commandNameMapping); String customerId = "customer0"; String resource = "/customers/" + customerId; Command command = new TestCommand(); String replyTo = "replyTo-xxx"; String channel = "myChannel"; Message message = makeMessage(commandNameMapping, channel, resource, command, replyTo, singletonMap(Message.ID, "999")); dispatcher.messageHandler(message); verify(target).reserveCredit(any(CommandMessage.class), any(PathVariables.class)); verify(messageProducer).send(any(), any()); verifyNoMoreInteractions(messageProducer, target); verify(commandNameMapping).commandToExternalCommandType(command); verify(commandNameMapping).externalCommandTypeToCommandClassName(externalName); verifyNoMoreInteractions(commandNameMapping);
when(commandNameMapping.commandToExternalCommandType(any(TestCommand.class))).thenReturn(externalCommandName); when(commandNameMapping.externalCommandTypeToCommandClassName(externalCommandName)).thenReturn(TestCommand.class.getName()); when(commandNameMapping.commandToExternalCommandType(any(TestNotification.class))).thenReturn(externalNotificationName); when(commandNameMapping.externalCommandTypeToCommandClassName(externalNotificationName)).thenReturn(TestNotification.class.getName()); dispatcher = new CommandDispatcher(commandDispatcherId, defineCommandHandlers(target), messageConsumer, messageProducer, commandNameMapping);
68a34701d11f840878f0580749e73bbb7a9c0d81
Extract And Move Method
Extract And Move Method public makeMessage(commandNameMapping CommandNameMapping, channel String, command Command, replyTo String, headers Map<String,String>) : Message extracted from public shouldDispatchCommand() : void in class io.eventuate.tram.commands.consumer.CommandDispatcherTest & moved to class io.eventuate.tram.commands.producer.CommandMessageFactory
public shouldDispatchCommand() : void
public makeMessage(commandNameMapping CommandNameMapping, channel String, command Command, replyTo String, headers Map<String,String>) : Message
shouldDispatchCommand
makeMessage
commandNameMapping CommandNameMapping, channel String, command Command, replyTo String, headers Map<String,String>
void
Message
String commandDispatcherId = "fooId"; CommandDispatcherTestTarget target = spy(new CommandDispatcherTestTarget()); ChannelMapping channelMapping = mock(ChannelMapping.class); MessageConsumer messageConsumer = mock(MessageConsumer.class); MessageProducer messageProducer = mock(MessageProducer.class); CommandNameMapping commandNameMapping = mock(CommandNameMapping.class); String externalName = "extTestCommand"; when(commandNameMapping.commandToExternalCommandType(any(TestCommand.class))).thenReturn(externalName); when(commandNameMapping.externalCommandTypeToCommandClassName(externalName)).thenReturn(TestCommand.class.getName()); CommandDispatcher dispatcher = new CommandDispatcher(commandDispatcherId, defineCommandHandlers(target), messageConsumer, messageProducer, commandNameMapping); String customerId = "customer0"; String resource = "/customers/" + customerId; Command command = new TestCommand(); String replyTo = "replyTo-xxx"; String channel = "myChannel"; Message message = makeMessage(commandNameMapping, channel, resource, command, replyTo, singletonMap(Message.ID, "999")); dispatcher.messageHandler(message); verify(target).reserveCredit(any(CommandMessage.class), any(PathVariables.class)); verify(messageProducer).send(any(), any()); verifyNoMoreInteractions(messageProducer, target); verify(commandNameMapping).commandToExternalCommandType(command); verify(commandNameMapping).externalCommandTypeToCommandClassName(externalName); verifyNoMoreInteractions(commandNameMapping);
return makeMessage(commandNameMapping, channel, null, command, replyTo, headers);
68a34701d11f840878f0580749e73bbb7a9c0d81
Move And Inline Method
Move And Inline Method public startingWith(smh MessageHandlerDecorator) : MessageHandlerDecoratorChainBuilder moved from class io.eventuate.tram.consumer.common.MessageHandlerDecoratorChainBuilder to class io.eventuate.tram.consumer.common.DecoratedMessageHandlerFactory & inlined to public decorate(mh MessageHandler) : Consumer<SubscriberIdAndMessage>
public startingWith(smh MessageHandlerDecorator) : MessageHandlerDecoratorChainBuilder
public decorate(mh MessageHandler) : Consumer<SubscriberIdAndMessage>
startingWith
decorate
smh MessageHandlerDecorator
mh MessageHandler
MessageHandlerDecoratorChainBuilder
Consumer<SubscriberIdAndMessage>
MessageHandlerDecoratorChainBuilder b = new MessageHandlerDecoratorChainBuilder(); b.add(smh); return b;
MessageHandlerDecoratorChainBuilder builder = new MessageHandlerDecoratorChainBuilder(); for (MessageHandlerDecorator mhd : decorators) builder = builder.andThen(mhd); MessageHandlerDecoratorChain chain = builder.andFinally((smh) -> { String subscriberId = smh.getSubscriberId(); Message message = smh.getMessage(); try { logger.trace("Invoking handler {} {}", subscriberId, message.getId()); mh.accept(smh.getMessage()); logger.trace("handled message {} {}", subscriberId, message.getId()); } catch (Exception e) { logger.error("Got exception {} {}", subscriberId, message.getId()); logger.error("Got exception ", e); throw e; } }); return chain::invokeNext;
6d921ba66ff48dc9a293314ef366d571a7922600
Add Parameter
Add Parameter commandReplyToken : CommandReplyToken in method protected invoke(commandHandler CommandHandler, cm CommandMessage, pathVars Map<String,String>, commandReplyToken CommandReplyToken) : List<Message> from class io.eventuate.tram.commands.consumer.CommandDispatcher
protected invoke(commandHandler CommandHandler, cm CommandMessage, pathVars Map<String,String>) : List<Message>
protected invoke(commandHandler CommandHandler, cm CommandMessage, pathVars Map<String,String>, commandReplyToken CommandReplyToken) : List<Message>
invoke
invoke
commandHandler CommandHandler, cm CommandMessage, pathVars Map<String,String>
commandHandler CommandHandler, cm CommandMessage, pathVars Map<String,String>, commandReplyToken CommandReplyToken
List<Message>
List<Message>
return commandHandler.invokeMethod(cm, pathVars);
return commandHandler.invokeMethod(new CommandHandlerArgs(cm, new PathVariables(pathVars), commandReplyToken));
6d921ba66ff48dc9a293314ef366d571a7922600
Rename Method
Rename Method public onMessageReturningMessages(commandClass Class<C>, handler BiFunction<CommandMessage<C>,PathVariables,List<Message>>) : CommandHandlersBuilder renamed to public onComplexMessage(commandClass Class<C>, handler BiConsumer<CommandMessage<C>,CommandReplyToken>) : CommandHandlersBuilder in class io.eventuate.tram.commands.consumer.CommandHandlersBuilder
public onMessageReturningMessages(commandClass Class<C>, handler BiFunction<CommandMessage<C>,PathVariables,List<Message>>) : CommandHandlersBuilder
public onComplexMessage(commandClass Class<C>, handler BiConsumer<CommandMessage<C>,CommandReplyToken>) : CommandHandlersBuilder
onMessageReturningMessages
onComplexMessage
commandClass Class<C>, handler BiFunction<CommandMessage<C>,PathVariables,List<Message>>
commandClass Class<C>, handler BiConsumer<CommandMessage<C>,CommandReplyToken>
CommandHandlersBuilder
CommandHandlersBuilder
this.handlers.add(new CommandHandler(channel, resource, commandClass, handler)); return this;
this.handlers.add(new CommandHandler(channel, resource, commandClass, makeFn(handler))); return this;
6d921ba66ff48dc9a293314ef366d571a7922600
Merge Variable
Merge Variable [c : null, pv : null] to args : null in method public onMessage(commandClass Class<C>, handler Function<CommandMessage<C>,Message>) : CommandHandlersBuilder from class io.eventuate.tram.commands.consumer.CommandHandlersBuilder
public onMessage(commandClass Class<C>, handler BiFunction<CommandMessage<C>,PathVariables,Message>) : CommandHandlersBuilder
public onMessage(commandClass Class<C>, handler Function<CommandMessage<C>,Message>) : CommandHandlersBuilder
onMessage
onMessage
commandClass Class<C>, handler BiFunction<CommandMessage<C>,PathVariables,Message>
commandClass Class<C>, handler Function<CommandMessage<C>,Message>
CommandHandlersBuilder
CommandHandlersBuilder
this.handlers.add(new CommandHandler(channel, resource, commandClass, (c, pv) -> Collections.singletonList(handler.apply(c, pv)))); return this;
this.handlers.add(new CommandHandler(channel, resource, commandClass, args -> Collections.singletonList(handler.apply(args.getCommandMessage())))); return this;
6d921ba66ff48dc9a293314ef366d571a7922600
Remove Parameter
Remove Parameter target : CommandDispatcherTestTarget in method public defineCommandHandlers(target CommandDispatcherTestTarget) : CommandHandlers from class io.eventuate.tram.commands.NotificationTests
public defineCommandHandlers(target CommandDispatcherTestTarget) : CommandHandlers
public defineCommandHandlers() : CommandHandlers
defineCommandHandlers
defineCommandHandlers
target CommandDispatcherTestTarget
CommandHandlers
CommandHandlers
return CommandHandlersBuilder .fromChannel(channel) .onMessage(TestNotification.class, target::handleNotification) .build();
return CommandHandlersBuilder .fromChannel(channel) .onMessage(NotificationTests.TestNotification.class, target::handleNotification) .build();
6d921ba66ff48dc9a293314ef366d571a7922600
Add Method Annotation
Add Method Annotation @Override in method public defineCommandHandlers() : CommandHandlers from class io.eventuate.tram.commands.NotificationTests
public defineCommandHandlers(target CommandDispatcherTestTarget) : CommandHandlers
public defineCommandHandlers() : CommandHandlers
defineCommandHandlers
defineCommandHandlers
target CommandDispatcherTestTarget
CommandHandlers
CommandHandlers
return CommandHandlersBuilder .fromChannel(channel) .onMessage(TestNotification.class, target::handleNotification) .build();
return CommandHandlersBuilder .fromChannel(channel) .onMessage(NotificationTests.TestNotification.class, target::handleNotification) .build();
6d921ba66ff48dc9a293314ef366d571a7922600
Add Parameter
Add Parameter commandReplyProducer : CommandReplyProducer in method public commandDispatcherFactory(messageConsumer MessageConsumer, messageProducer MessageProducer, commandNameMapping CommandNameMapping, commandReplyProducer CommandReplyProducer) : CommandDispatcherFactory from class io.eventuate.tram.micronaut.commands.consumer.TramCommandConsumerFactory
public commandDispatcherFactory(messageConsumer MessageConsumer, messageProducer MessageProducer, commandNameMapping CommandNameMapping) : CommandDispatcherFactory
public commandDispatcherFactory(messageConsumer MessageConsumer, messageProducer MessageProducer, commandNameMapping CommandNameMapping, commandReplyProducer CommandReplyProducer) : CommandDispatcherFactory
commandDispatcherFactory
commandDispatcherFactory
messageConsumer MessageConsumer, messageProducer MessageProducer, commandNameMapping CommandNameMapping
messageConsumer MessageConsumer, messageProducer MessageProducer, commandNameMapping CommandNameMapping, commandReplyProducer CommandReplyProducer
CommandDispatcherFactory
CommandDispatcherFactory
return new CommandDispatcherFactory(messageConsumer, messageProducer, commandNameMapping);
return new CommandDispatcherFactory(messageConsumer, messageProducer, commandNameMapping, commandReplyProducer);
6d921ba66ff48dc9a293314ef366d571a7922600
Add Parameter
Add Parameter commandReplyToken : CommandReplyToken in method protected invoke(m ReactiveCommandHandler, cm CommandMessage<?>, commandHandlerParams CommandHandlerParams, commandReplyToken CommandReplyToken) : Publisher<Message> from class io.eventuate.tram.reactive.commands.consumer.ReactiveCommandDispatcher
protected invoke(m ReactiveCommandHandler, cm CommandMessage<?>, commandHandlerParams CommandHandlerParams) : Publisher<Message>
protected invoke(m ReactiveCommandHandler, cm CommandMessage<?>, commandHandlerParams CommandHandlerParams, commandReplyToken CommandReplyToken) : Publisher<Message>
invoke
invoke
m ReactiveCommandHandler, cm CommandMessage<?>, commandHandlerParams CommandHandlerParams
m ReactiveCommandHandler, cm CommandMessage<?>, commandHandlerParams CommandHandlerParams, commandReplyToken CommandReplyToken
Publisher<Message>
Publisher<Message>
return m.invokeMethod(cm, commandHandlerParams.getPathVars());
return m.invokeMethod(new CommandHandlerArgs(cm, new PathVariables(commandHandlerParams.getPathVars()), commandReplyToken));
6d921ba66ff48dc9a293314ef366d571a7922600
Add Parameter
Add Parameter commandReplyToken : CommandReplyToken in method protected invoke(m ReactiveCommandHandler, cm CommandMessage, commandHandlerParams CommandHandlerParams, commandReplyToken CommandReplyToken) : Publisher<Message> from class io.eventuate.tram.reactive.commands.consumer.ReactiveCommandDispatcherTest.testAlternativeHandlerInvocation.new ReactiveCommandDispatcher
protected invoke(m ReactiveCommandHandler, cm CommandMessage, commandHandlerParams CommandHandlerParams) : Publisher<Message>
protected invoke(m ReactiveCommandHandler, cm CommandMessage, commandHandlerParams CommandHandlerParams, commandReplyToken CommandReplyToken) : Publisher<Message>
invoke
invoke
m ReactiveCommandHandler, cm CommandMessage, commandHandlerParams CommandHandlerParams
m ReactiveCommandHandler, cm CommandMessage, commandHandlerParams CommandHandlerParams, commandReplyToken CommandReplyToken
Publisher<Message>
Publisher<Message>
return alternativeCommandHandler.invokeMethod(cm, commandHandlerParams.getPathVars());
return alternativeCommandHandler.invokeMethod(new CommandHandlerArgs<>(cm, new PathVariables(commandHandlerParams.getPathVars()), commandReplyToken));
6d921ba66ff48dc9a293314ef366d571a7922600
Add Parameter
Add Parameter commandReplyProducer : CommandReplyProducer in method public commandDispatcherFactory(messageConsumer MessageConsumer, messageProducer MessageProducer, commandNameMapping CommandNameMapping, commandReplyProducer CommandReplyProducer) : CommandDispatcherFactory from class io.eventuate.tram.spring.commands.consumer.TramCommandConsumerConfiguration
public commandDispatcherFactory(messageConsumer MessageConsumer, messageProducer MessageProducer, commandNameMapping CommandNameMapping) : CommandDispatcherFactory
public commandDispatcherFactory(messageConsumer MessageConsumer, messageProducer MessageProducer, commandNameMapping CommandNameMapping, commandReplyProducer CommandReplyProducer) : CommandDispatcherFactory
commandDispatcherFactory
commandDispatcherFactory
messageConsumer MessageConsumer, messageProducer MessageProducer, commandNameMapping CommandNameMapping
messageConsumer MessageConsumer, messageProducer MessageProducer, commandNameMapping CommandNameMapping, commandReplyProducer CommandReplyProducer
CommandDispatcherFactory
CommandDispatcherFactory
return new CommandDispatcherFactory(messageConsumer, messageProducer, commandNameMapping);
return new CommandDispatcherFactory(messageConsumer, messageProducer, commandNameMapping, commandReplyProducer);
6d921ba66ff48dc9a293314ef366d571a7922600
Pull Up Method
Pull Up Method public setup() : void from class io.eventuate.tram.commands.NotificationTests to public setup() : void from class io.eventuate.tram.commands.AbstractCommandDispatchingTests
public setup() : void
public setup() : void
setup
setup
void
void
InMemoryMessageConsumer inMemoryMessageConsumer = new InMemoryMessageConsumer(); EventuateTransactionSynchronizationManager eventuateTransactionSynchronizationManager = mock(EventuateTransactionSynchronizationManager.class); when(eventuateTransactionSynchronizationManager.isTransactionActive()).thenReturn(false); ChannelMapping channelMapping = new DefaultChannelMapping.DefaultChannelMappingBuilder().build(); MessageProducer messageProducer = new MessageProducerImpl(new MessageInterceptor[0], channelMapping, new InMemoryMessageProducer(inMemoryMessageConsumer, eventuateTransactionSynchronizationManager)); DefaultCommandNameMapping commandNameMapping = new DefaultCommandNameMapping(); commandProducer = new CommandProducerImpl(messageProducer, commandNameMapping); CommandHandlers commandHandlers = defineCommandHandlers(target); MessageConsumer messageConsumer = new MessageConsumerImpl(channelMapping, inMemoryMessageConsumer, new DecoratedMessageHandlerFactory(Collections.emptyList())); CommandDispatcher commandDispatcher = new CommandDispatcher("subscriberId", commandHandlers, messageConsumer, messageProducer, commandNameMapping); commandDispatcher.initialize();
InMemoryMessageConsumer inMemoryMessageConsumer = new InMemoryMessageConsumer(); EventuateTransactionSynchronizationManager eventuateTransactionSynchronizationManager = mock(EventuateTransactionSynchronizationManager.class); when(eventuateTransactionSynchronizationManager.isTransactionActive()).thenReturn(false); ChannelMapping channelMapping = new DefaultChannelMapping.DefaultChannelMappingBuilder().build(); MessageProducer messageProducer = new MessageProducerImpl(new MessageInterceptor[0], channelMapping, new InMemoryMessageProducer(inMemoryMessageConsumer, eventuateTransactionSynchronizationManager)); messageConsumer = new MessageConsumerImpl(channelMapping, inMemoryMessageConsumer, new DecoratedMessageHandlerFactory(Collections.emptyList())); DefaultCommandNameMapping commandNameMapping = new DefaultCommandNameMapping(); commandProducer = new CommandProducerImpl(messageProducer, commandNameMapping); CommandHandlers commandHandlers = defineCommandHandlers(); commandReplyProducer = new CommandReplyProducer(messageProducer); CommandDispatcherFactory commandDispatcherFactory = new CommandDispatcherFactory(messageConsumer, messageProducer, commandNameMapping, commandReplyProducer); CommandDispatcher commandDispatcher = commandDispatcherFactory.make("subscriberId", commandHandlers); commandDispatcher.initialize();
6d921ba66ff48dc9a293314ef366d571a7922600
Move Method
Move Method private sendReplies(correlationHeaders Map<String,String>, replies List<Message>, defaultReplyChannel Optional<String>) : void from class io.eventuate.tram.commands.consumer.CommandDispatcher to public sendReplies(commandReplyToken CommandReplyToken, replies List<Message>) : List<Message> from class io.eventuate.tram.commands.consumer.CommandReplyProducer
private sendReplies(correlationHeaders Map<String,String>, replies List<Message>, defaultReplyChannel Optional<String>) : void
public sendReplies(commandReplyToken CommandReplyToken, replies List<Message>) : List<Message>
sendReplies
sendReplies
correlationHeaders Map<String,String>, replies List<Message>, defaultReplyChannel Optional<String>
commandReplyToken CommandReplyToken, replies List<Message>
void
List<Message>
if (!defaultReplyChannel.isPresent()) { if (!replies.isEmpty()) { throw new RuntimeException("Replies to send but not replyTo channel"); } return; } if (replies.isEmpty()) logger.trace("Null replies - not publishing"); String replyChannel = defaultReplyChannel.get(); for (Message reply : replies) { messageProducer.send(replyChannel, MessageBuilder .withMessage(reply) .withExtraHeaders("", correlationHeaders) .build()); }
if (commandReplyToken.getReplyChannel() == null) { if (!replies.isEmpty()) { throw new RuntimeException("Replies to send but not replyTo channel"); } return Collections.emptyList(); } if (replies.isEmpty()) logger.trace("Null replies - not publishing"); String replyChannel = commandReplyToken.getReplyChannel(); List<Message> results = new ArrayList<>(replies.size()); for (Message reply : replies) { Message message = MessageBuilder .withMessage(reply) .withExtraHeaders("", commandReplyToken.getReplyHeaders()) .build(); messageProducer.send(replyChannel, message); results.add(message); } return results;
6d921ba66ff48dc9a293314ef366d571a7922600
Change Return Type
Change Return Type void to List<Message> in method public sendReplies(commandReplyToken CommandReplyToken, replies List<Message>) : List<Message> from class io.eventuate.tram.commands.consumer.CommandReplyProducer
private sendReplies(correlationHeaders Map<String,String>, replies List<Message>, defaultReplyChannel Optional<String>) : void
public sendReplies(commandReplyToken CommandReplyToken, replies List<Message>) : List<Message>
sendReplies
sendReplies
correlationHeaders Map<String,String>, replies List<Message>, defaultReplyChannel Optional<String>
commandReplyToken CommandReplyToken, replies List<Message>
void
List<Message>
if (!defaultReplyChannel.isPresent()) { if (!replies.isEmpty()) { throw new RuntimeException("Replies to send but not replyTo channel"); } return; } if (replies.isEmpty()) logger.trace("Null replies - not publishing"); String replyChannel = defaultReplyChannel.get(); for (Message reply : replies) { messageProducer.send(replyChannel, MessageBuilder .withMessage(reply) .withExtraHeaders("", correlationHeaders) .build()); }
if (commandReplyToken.getReplyChannel() == null) { if (!replies.isEmpty()) { throw new RuntimeException("Replies to send but not replyTo channel"); } return Collections.emptyList(); } if (replies.isEmpty()) logger.trace("Null replies - not publishing"); String replyChannel = commandReplyToken.getReplyChannel(); List<Message> results = new ArrayList<>(replies.size()); for (Message reply : replies) { Message message = MessageBuilder .withMessage(reply) .withExtraHeaders("", commandReplyToken.getReplyHeaders()) .build(); messageProducer.send(replyChannel, message); results.add(message); } return results;
6d921ba66ff48dc9a293314ef366d571a7922600
Add Parameter
Add Parameter commandReplyToken : CommandReplyToken in method public sendReplies(commandReplyToken CommandReplyToken, replies List<Message>) : List<Message> from class io.eventuate.tram.commands.consumer.CommandReplyProducer
private sendReplies(correlationHeaders Map<String,String>, replies List<Message>, defaultReplyChannel Optional<String>) : void
public sendReplies(commandReplyToken CommandReplyToken, replies List<Message>) : List<Message>
sendReplies
sendReplies
correlationHeaders Map<String,String>, replies List<Message>, defaultReplyChannel Optional<String>
commandReplyToken CommandReplyToken, replies List<Message>
void
List<Message>
if (!defaultReplyChannel.isPresent()) { if (!replies.isEmpty()) { throw new RuntimeException("Replies to send but not replyTo channel"); } return; } if (replies.isEmpty()) logger.trace("Null replies - not publishing"); String replyChannel = defaultReplyChannel.get(); for (Message reply : replies) { messageProducer.send(replyChannel, MessageBuilder .withMessage(reply) .withExtraHeaders("", correlationHeaders) .build()); }
if (commandReplyToken.getReplyChannel() == null) { if (!replies.isEmpty()) { throw new RuntimeException("Replies to send but not replyTo channel"); } return Collections.emptyList(); } if (replies.isEmpty()) logger.trace("Null replies - not publishing"); String replyChannel = commandReplyToken.getReplyChannel(); List<Message> results = new ArrayList<>(replies.size()); for (Message reply : replies) { Message message = MessageBuilder .withMessage(reply) .withExtraHeaders("", commandReplyToken.getReplyHeaders()) .build(); messageProducer.send(replyChannel, message); results.add(message); } return results;
6d921ba66ff48dc9a293314ef366d571a7922600
Remove Parameter
Remove Parameter correlationHeaders : Map<String,String> in method private sendReplies(correlationHeaders Map<String,String>, replies List<Message>, defaultReplyChannel Optional<String>) : void from class io.eventuate.tram.commands.consumer.CommandDispatcher
private sendReplies(correlationHeaders Map<String,String>, replies List<Message>, defaultReplyChannel Optional<String>) : void
public sendReplies(commandReplyToken CommandReplyToken, replies List<Message>) : List<Message>
sendReplies
sendReplies
correlationHeaders Map<String,String>, replies List<Message>, defaultReplyChannel Optional<String>
commandReplyToken CommandReplyToken, replies List<Message>
void
List<Message>
if (!defaultReplyChannel.isPresent()) { if (!replies.isEmpty()) { throw new RuntimeException("Replies to send but not replyTo channel"); } return; } if (replies.isEmpty()) logger.trace("Null replies - not publishing"); String replyChannel = defaultReplyChannel.get(); for (Message reply : replies) { messageProducer.send(replyChannel, MessageBuilder .withMessage(reply) .withExtraHeaders("", correlationHeaders) .build()); }
if (commandReplyToken.getReplyChannel() == null) { if (!replies.isEmpty()) { throw new RuntimeException("Replies to send but not replyTo channel"); } return Collections.emptyList(); } if (replies.isEmpty()) logger.trace("Null replies - not publishing"); String replyChannel = commandReplyToken.getReplyChannel(); List<Message> results = new ArrayList<>(replies.size()); for (Message reply : replies) { Message message = MessageBuilder .withMessage(reply) .withExtraHeaders("", commandReplyToken.getReplyHeaders()) .build(); messageProducer.send(replyChannel, message); results.add(message); } return results;
6d921ba66ff48dc9a293314ef366d571a7922600
Remove Parameter
Remove Parameter defaultReplyChannel : Optional<String> in method private sendReplies(correlationHeaders Map<String,String>, replies List<Message>, defaultReplyChannel Optional<String>) : void from class io.eventuate.tram.commands.consumer.CommandDispatcher
private sendReplies(correlationHeaders Map<String,String>, replies List<Message>, defaultReplyChannel Optional<String>) : void
public sendReplies(commandReplyToken CommandReplyToken, replies List<Message>) : List<Message>
sendReplies
sendReplies
correlationHeaders Map<String,String>, replies List<Message>, defaultReplyChannel Optional<String>
commandReplyToken CommandReplyToken, replies List<Message>
void
List<Message>
if (!defaultReplyChannel.isPresent()) { if (!replies.isEmpty()) { throw new RuntimeException("Replies to send but not replyTo channel"); } return; } if (replies.isEmpty()) logger.trace("Null replies - not publishing"); String replyChannel = defaultReplyChannel.get(); for (Message reply : replies) { messageProducer.send(replyChannel, MessageBuilder .withMessage(reply) .withExtraHeaders("", correlationHeaders) .build()); }
if (commandReplyToken.getReplyChannel() == null) { if (!replies.isEmpty()) { throw new RuntimeException("Replies to send but not replyTo channel"); } return Collections.emptyList(); } if (replies.isEmpty()) logger.trace("Null replies - not publishing"); String replyChannel = commandReplyToken.getReplyChannel(); List<Message> results = new ArrayList<>(replies.size()); for (Message reply : replies) { Message message = MessageBuilder .withMessage(reply) .withExtraHeaders("", commandReplyToken.getReplyHeaders()) .build(); messageProducer.send(replyChannel, message); results.add(message); } return results;
6d921ba66ff48dc9a293314ef366d571a7922600
Change Method Access Modifier
Change Method Access Modifier private to public in method public sendReplies(commandReplyToken CommandReplyToken, replies List<Message>) : List<Message> from class io.eventuate.tram.commands.consumer.CommandReplyProducer
private sendReplies(correlationHeaders Map<String,String>, replies List<Message>, defaultReplyChannel Optional<String>) : void
public sendReplies(commandReplyToken CommandReplyToken, replies List<Message>) : List<Message>
sendReplies
sendReplies
correlationHeaders Map<String,String>, replies List<Message>, defaultReplyChannel Optional<String>
commandReplyToken CommandReplyToken, replies List<Message>
void
List<Message>
if (!defaultReplyChannel.isPresent()) { if (!replies.isEmpty()) { throw new RuntimeException("Replies to send but not replyTo channel"); } return; } if (replies.isEmpty()) logger.trace("Null replies - not publishing"); String replyChannel = defaultReplyChannel.get(); for (Message reply : replies) { messageProducer.send(replyChannel, MessageBuilder .withMessage(reply) .withExtraHeaders("", correlationHeaders) .build()); }
if (commandReplyToken.getReplyChannel() == null) { if (!replies.isEmpty()) { throw new RuntimeException("Replies to send but not replyTo channel"); } return Collections.emptyList(); } if (replies.isEmpty()) logger.trace("Null replies - not publishing"); String replyChannel = commandReplyToken.getReplyChannel(); List<Message> results = new ArrayList<>(replies.size()); for (Message reply : replies) { Message message = MessageBuilder .withMessage(reply) .withExtraHeaders("", commandReplyToken.getReplyHeaders()) .build(); messageProducer.send(replyChannel, message); results.add(message); } return results;
6d921ba66ff48dc9a293314ef366d571a7922600
Extract Class
Extract Class io.eventuate.tram.commands.consumer.CommandReplyProducer from class io.eventuate.tram.commands.consumer.CommandDispatcher
private sendReplies(correlationHeaders Map<String,String>, replies List<Message>, defaultReplyChannel Optional<String>) : void
public sendReplies(commandReplyToken CommandReplyToken, replies List<Message>) : List<Message>
sendReplies
sendReplies
correlationHeaders Map<String,String>, replies List<Message>, defaultReplyChannel Optional<String>
commandReplyToken CommandReplyToken, replies List<Message>
void
List<Message>
if (!defaultReplyChannel.isPresent()) { if (!replies.isEmpty()) { throw new RuntimeException("Replies to send but not replyTo channel"); } return; } if (replies.isEmpty()) logger.trace("Null replies - not publishing"); String replyChannel = defaultReplyChannel.get(); for (Message reply : replies) { messageProducer.send(replyChannel, MessageBuilder .withMessage(reply) .withExtraHeaders("", correlationHeaders) .build()); }
if (commandReplyToken.getReplyChannel() == null) { if (!replies.isEmpty()) { throw new RuntimeException("Replies to send but not replyTo channel"); } return Collections.emptyList(); } if (replies.isEmpty()) logger.trace("Null replies - not publishing"); String replyChannel = commandReplyToken.getReplyChannel(); List<Message> results = new ArrayList<>(replies.size()); for (Message reply : replies) { Message message = MessageBuilder .withMessage(reply) .withExtraHeaders("", commandReplyToken.getReplyHeaders()) .build(); messageProducer.send(replyChannel, message); results.add(message); } return results;
dce2bb50318a892bc96b9f6a41ee3f5cada7d2e8
Add Parameter
Add Parameter commandReplyToken : CommandReplyToken in method private handleException(commandHandler CommandHandler, cause Throwable, commandReplyToken CommandReplyToken) : void from class io.eventuate.tram.commands.consumer.CommandDispatcher
private handleException(commandHandlerParams CommandHandlerParams, commandHandler CommandHandler, cause Throwable, defaultReplyChannel Optional<String>) : void
private handleException(commandHandler CommandHandler, cause Throwable, commandReplyToken CommandReplyToken) : void
handleException
handleException
commandHandlerParams CommandHandlerParams, commandHandler CommandHandler, cause Throwable, defaultReplyChannel Optional<String>
commandHandler CommandHandler, cause Throwable, commandReplyToken CommandReplyToken
void
void
Optional<CommandExceptionHandler> m = commandHandlers.findExceptionHandler(commandHandler, cause); logger.info("Handler for {} is {}", cause.getClass(), m); List<Message> replies = m .map(handler -> handler.invoke(cause)) .orElseGet(() -> singletonList(MessageBuilder.withPayload(JSonMapper.toJson(new Failure())).build())); commandReplyProducer.sendReplies(new CommandReplyToken(commandHandlerParams.getCorrelationHeaders(), defaultReplyChannel.orElse(null)), replies);
Optional<CommandExceptionHandler> m = commandHandlers.findExceptionHandler(commandHandler, cause); logger.info("Handler for {} is {}", cause.getClass(), m); List<Message> replies = m .map(handler -> handler.invoke(cause)) .orElseGet(() -> singletonList(MessageBuilder.withPayload(JSonMapper.toJson(new Failure())).build())); commandReplyProducer.sendReplies(commandReplyToken, replies);
dce2bb50318a892bc96b9f6a41ee3f5cada7d2e8
Remove Parameter
Remove Parameter commandHandlerParams : CommandHandlerParams in method private handleException(commandHandlerParams CommandHandlerParams, commandHandler CommandHandler, cause Throwable, defaultReplyChannel Optional<String>) : void from class io.eventuate.tram.commands.consumer.CommandDispatcher
private handleException(commandHandlerParams CommandHandlerParams, commandHandler CommandHandler, cause Throwable, defaultReplyChannel Optional<String>) : void
private handleException(commandHandler CommandHandler, cause Throwable, commandReplyToken CommandReplyToken) : void
handleException
handleException
commandHandlerParams CommandHandlerParams, commandHandler CommandHandler, cause Throwable, defaultReplyChannel Optional<String>
commandHandler CommandHandler, cause Throwable, commandReplyToken CommandReplyToken
void
void
Optional<CommandExceptionHandler> m = commandHandlers.findExceptionHandler(commandHandler, cause); logger.info("Handler for {} is {}", cause.getClass(), m); List<Message> replies = m .map(handler -> handler.invoke(cause)) .orElseGet(() -> singletonList(MessageBuilder.withPayload(JSonMapper.toJson(new Failure())).build())); commandReplyProducer.sendReplies(new CommandReplyToken(commandHandlerParams.getCorrelationHeaders(), defaultReplyChannel.orElse(null)), replies);
Optional<CommandExceptionHandler> m = commandHandlers.findExceptionHandler(commandHandler, cause); logger.info("Handler for {} is {}", cause.getClass(), m); List<Message> replies = m .map(handler -> handler.invoke(cause)) .orElseGet(() -> singletonList(MessageBuilder.withPayload(JSonMapper.toJson(new Failure())).build())); commandReplyProducer.sendReplies(commandReplyToken, replies);
dce2bb50318a892bc96b9f6a41ee3f5cada7d2e8
Remove Parameter
Remove Parameter defaultReplyChannel : Optional<String> in method private handleException(commandHandlerParams CommandHandlerParams, commandHandler CommandHandler, cause Throwable, defaultReplyChannel Optional<String>) : void from class io.eventuate.tram.commands.consumer.CommandDispatcher
private handleException(commandHandlerParams CommandHandlerParams, commandHandler CommandHandler, cause Throwable, defaultReplyChannel Optional<String>) : void
private handleException(commandHandler CommandHandler, cause Throwable, commandReplyToken CommandReplyToken) : void
handleException
handleException
commandHandlerParams CommandHandlerParams, commandHandler CommandHandler, cause Throwable, defaultReplyChannel Optional<String>
commandHandler CommandHandler, cause Throwable, commandReplyToken CommandReplyToken
void
void
Optional<CommandExceptionHandler> m = commandHandlers.findExceptionHandler(commandHandler, cause); logger.info("Handler for {} is {}", cause.getClass(), m); List<Message> replies = m .map(handler -> handler.invoke(cause)) .orElseGet(() -> singletonList(MessageBuilder.withPayload(JSonMapper.toJson(new Failure())).build())); commandReplyProducer.sendReplies(new CommandReplyToken(commandHandlerParams.getCorrelationHeaders(), defaultReplyChannel.orElse(null)), replies);
Optional<CommandExceptionHandler> m = commandHandlers.findExceptionHandler(commandHandler, cause); logger.info("Handler for {} is {}", cause.getClass(), m); List<Message> replies = m .map(handler -> handler.invoke(cause)) .orElseGet(() -> singletonList(MessageBuilder.withPayload(JSonMapper.toJson(new Failure())).build())); commandReplyProducer.sendReplies(commandReplyToken, replies);
dce2bb50318a892bc96b9f6a41ee3f5cada7d2e8
Remove Parameter
Remove Parameter messageProducer : MessageProducer in method public commandDispatcherFactory(messageConsumer MessageConsumer, messageProducer MessageProducer, commandNameMapping CommandNameMapping, commandReplyProducer CommandReplyProducer) : CommandDispatcherFactory from class io.eventuate.tram.micronaut.commands.consumer.TramCommandConsumerFactory
public commandDispatcherFactory(messageConsumer MessageConsumer, messageProducer MessageProducer, commandNameMapping CommandNameMapping, commandReplyProducer CommandReplyProducer) : CommandDispatcherFactory
public commandDispatcherFactory(messageConsumer MessageConsumer, commandNameMapping CommandNameMapping, commandReplyProducer CommandReplyProducer) : CommandDispatcherFactory
commandDispatcherFactory
commandDispatcherFactory
messageConsumer MessageConsumer, messageProducer MessageProducer, commandNameMapping CommandNameMapping, commandReplyProducer CommandReplyProducer
messageConsumer MessageConsumer, commandNameMapping CommandNameMapping, commandReplyProducer CommandReplyProducer
CommandDispatcherFactory
CommandDispatcherFactory
return new CommandDispatcherFactory(messageConsumer, messageProducer, commandNameMapping, commandReplyProducer);
return new CommandDispatcherFactory(messageConsumer, commandNameMapping, commandReplyProducer);
dce2bb50318a892bc96b9f6a41ee3f5cada7d2e8
Add Parameter
Add Parameter commandReplyToken : CommandReplyToken in method private handleException(reactiveCommandHandler ReactiveCommandHandler, cause Throwable, commandReplyToken CommandReplyToken) : Flux<Message> from class io.eventuate.tram.reactive.commands.consumer.ReactiveCommandDispatcher
private handleException(commandHandlerParams CommandHandlerParams, reactiveCommandHandler ReactiveCommandHandler, cause Throwable, defaultReplyChannel Optional<String>) : Flux<Message>
private handleException(reactiveCommandHandler ReactiveCommandHandler, cause Throwable, commandReplyToken CommandReplyToken) : Flux<Message>
handleException
handleException
commandHandlerParams CommandHandlerParams, reactiveCommandHandler ReactiveCommandHandler, cause Throwable, defaultReplyChannel Optional<String>
reactiveCommandHandler ReactiveCommandHandler, cause Throwable, commandReplyToken CommandReplyToken
Flux<Message>
Flux<Message>
Optional<ReactiveCommandExceptionHandler> exceptionHandler = commandHandlers.findExceptionHandler(reactiveCommandHandler, cause); logger.info("Handler for {} is {}", cause.getClass(), exceptionHandler); Flux<Message> replies = exceptionHandler .map(eh -> Flux.from(eh.invoke(cause))) .orElse(Flux.fromIterable(singletonList(MessageBuilder.withPayload(JSonMapper.toJson(new Failure())).build()))); return sendReplies(commandHandlerParams.getCorrelationHeaders(), replies, defaultReplyChannel);
Optional<ReactiveCommandExceptionHandler> exceptionHandler = commandHandlers.findExceptionHandler(reactiveCommandHandler, cause); logger.info("Handler for {} is {}", cause.getClass(), exceptionHandler); Flux<Message> replies = exceptionHandler .map(eh -> Flux.from(eh.invoke(cause))) .orElse(Flux.fromIterable(singletonList(MessageBuilder.withPayload(JSonMapper.toJson(new Failure())).build()))); return commandReplyProducer.sendReplies(commandReplyToken, replies);
dce2bb50318a892bc96b9f6a41ee3f5cada7d2e8
Remove Parameter
Remove Parameter commandHandlerParams : CommandHandlerParams in method private handleException(commandHandlerParams CommandHandlerParams, reactiveCommandHandler ReactiveCommandHandler, cause Throwable, defaultReplyChannel Optional<String>) : Flux<Message> from class io.eventuate.tram.reactive.commands.consumer.ReactiveCommandDispatcher
private handleException(commandHandlerParams CommandHandlerParams, reactiveCommandHandler ReactiveCommandHandler, cause Throwable, defaultReplyChannel Optional<String>) : Flux<Message>
private handleException(reactiveCommandHandler ReactiveCommandHandler, cause Throwable, commandReplyToken CommandReplyToken) : Flux<Message>
handleException
handleException
commandHandlerParams CommandHandlerParams, reactiveCommandHandler ReactiveCommandHandler, cause Throwable, defaultReplyChannel Optional<String>
reactiveCommandHandler ReactiveCommandHandler, cause Throwable, commandReplyToken CommandReplyToken
Flux<Message>
Flux<Message>
Optional<ReactiveCommandExceptionHandler> exceptionHandler = commandHandlers.findExceptionHandler(reactiveCommandHandler, cause); logger.info("Handler for {} is {}", cause.getClass(), exceptionHandler); Flux<Message> replies = exceptionHandler .map(eh -> Flux.from(eh.invoke(cause))) .orElse(Flux.fromIterable(singletonList(MessageBuilder.withPayload(JSonMapper.toJson(new Failure())).build()))); return sendReplies(commandHandlerParams.getCorrelationHeaders(), replies, defaultReplyChannel);
Optional<ReactiveCommandExceptionHandler> exceptionHandler = commandHandlers.findExceptionHandler(reactiveCommandHandler, cause); logger.info("Handler for {} is {}", cause.getClass(), exceptionHandler); Flux<Message> replies = exceptionHandler .map(eh -> Flux.from(eh.invoke(cause))) .orElse(Flux.fromIterable(singletonList(MessageBuilder.withPayload(JSonMapper.toJson(new Failure())).build()))); return commandReplyProducer.sendReplies(commandReplyToken, replies);
dce2bb50318a892bc96b9f6a41ee3f5cada7d2e8
Remove Parameter
Remove Parameter defaultReplyChannel : Optional<String> in method private handleException(commandHandlerParams CommandHandlerParams, reactiveCommandHandler ReactiveCommandHandler, cause Throwable, defaultReplyChannel Optional<String>) : Flux<Message> from class io.eventuate.tram.reactive.commands.consumer.ReactiveCommandDispatcher
private handleException(commandHandlerParams CommandHandlerParams, reactiveCommandHandler ReactiveCommandHandler, cause Throwable, defaultReplyChannel Optional<String>) : Flux<Message>
private handleException(reactiveCommandHandler ReactiveCommandHandler, cause Throwable, commandReplyToken CommandReplyToken) : Flux<Message>
handleException
handleException
commandHandlerParams CommandHandlerParams, reactiveCommandHandler ReactiveCommandHandler, cause Throwable, defaultReplyChannel Optional<String>
reactiveCommandHandler ReactiveCommandHandler, cause Throwable, commandReplyToken CommandReplyToken
Flux<Message>
Flux<Message>
Optional<ReactiveCommandExceptionHandler> exceptionHandler = commandHandlers.findExceptionHandler(reactiveCommandHandler, cause); logger.info("Handler for {} is {}", cause.getClass(), exceptionHandler); Flux<Message> replies = exceptionHandler .map(eh -> Flux.from(eh.invoke(cause))) .orElse(Flux.fromIterable(singletonList(MessageBuilder.withPayload(JSonMapper.toJson(new Failure())).build()))); return sendReplies(commandHandlerParams.getCorrelationHeaders(), replies, defaultReplyChannel);
Optional<ReactiveCommandExceptionHandler> exceptionHandler = commandHandlers.findExceptionHandler(reactiveCommandHandler, cause); logger.info("Handler for {} is {}", cause.getClass(), exceptionHandler); Flux<Message> replies = exceptionHandler .map(eh -> Flux.from(eh.invoke(cause))) .orElse(Flux.fromIterable(singletonList(MessageBuilder.withPayload(JSonMapper.toJson(new Failure())).build()))); return commandReplyProducer.sendReplies(commandReplyToken, replies);
dce2bb50318a892bc96b9f6a41ee3f5cada7d2e8
Remove Parameter
Remove Parameter target : CommandDispatcherTestTarget in method public defineCommandHandlers(target CommandDispatcherTestTarget) : ReactiveCommandHandlers from class io.eventuate.tram.reactive.commands.ReactiveNotificationTests
public defineCommandHandlers(target CommandDispatcherTestTarget) : ReactiveCommandHandlers
public defineCommandHandlers() : ReactiveCommandHandlers
defineCommandHandlers
defineCommandHandlers
target CommandDispatcherTestTarget
ReactiveCommandHandlers
ReactiveCommandHandlers
return ReactiveCommandHandlersBuilder .fromChannel(channel) .onNotification(TestNotification.class, target::handleNotification) .build();
return ReactiveCommandHandlersBuilder .fromChannel(channel) .onNotification(TestNotification.class, target::handleNotification) .build();
dce2bb50318a892bc96b9f6a41ee3f5cada7d2e8
Remove Parameter
Remove Parameter messageProducer : MessageProducer in method public commandDispatcherFactory(messageConsumer MessageConsumer, messageProducer MessageProducer, commandNameMapping CommandNameMapping, commandReplyProducer CommandReplyProducer) : CommandDispatcherFactory from class io.eventuate.tram.spring.commands.consumer.TramCommandConsumerConfiguration
public commandDispatcherFactory(messageConsumer MessageConsumer, messageProducer MessageProducer, commandNameMapping CommandNameMapping, commandReplyProducer CommandReplyProducer) : CommandDispatcherFactory
public commandDispatcherFactory(messageConsumer MessageConsumer, commandNameMapping CommandNameMapping, commandReplyProducer CommandReplyProducer) : CommandDispatcherFactory
commandDispatcherFactory
commandDispatcherFactory
messageConsumer MessageConsumer, messageProducer MessageProducer, commandNameMapping CommandNameMapping, commandReplyProducer CommandReplyProducer
messageConsumer MessageConsumer, commandNameMapping CommandNameMapping, commandReplyProducer CommandReplyProducer
CommandDispatcherFactory
CommandDispatcherFactory
return new CommandDispatcherFactory(messageConsumer, messageProducer, commandNameMapping, commandReplyProducer);
return new CommandDispatcherFactory(messageConsumer, commandNameMapping, commandReplyProducer);
dce2bb50318a892bc96b9f6a41ee3f5cada7d2e8
Pull Up Method
Pull Up Method public setup() : void from class io.eventuate.tram.reactive.commands.ReactiveNotificationTests to public setup() : void from class io.eventuate.tram.reactive.commands.ReactiveAbstractCommandDispatchingTests
public setup() : void
public setup() : void
setup
setup
void
void
ReactiveInMemoryMessageConsumer inMemoryMessageConsumer = new ReactiveInMemoryMessageConsumer(); ChannelMapping channelMapping = new DefaultChannelMapping.DefaultChannelMappingBuilder().build(); ReactiveMessageProducer messageProducer = new ReactiveMessageProducer(new MessageInterceptor[0], channelMapping, new ReactiveInMemoryMessageProducer(inMemoryMessageConsumer)); DefaultCommandNameMapping commandNameMapping = new DefaultCommandNameMapping(); commandProducer = new ReactiveCommandProducerImpl(messageProducer, commandNameMapping); ReactiveCommandHandlers commandHandlers = defineCommandHandlers(target); ReactiveMessageConsumer messageConsumer = new ReactiveMessageConsumerImpl(channelMapping, inMemoryMessageConsumer, new DecoratedReactiveMessageHandlerFactory(Collections.emptyList())); ReactiveCommandDispatcher commandDispatcher = new ReactiveCommandDispatcher("subscriberId", commandHandlers, messageConsumer, messageProducer); commandDispatcher.initialize();
ReactiveInMemoryMessageConsumer inMemoryMessageConsumer = new ReactiveInMemoryMessageConsumer(); ChannelMapping channelMapping = new DefaultChannelMapping.DefaultChannelMappingBuilder().build(); ReactiveMessageProducer messageProducer = new ReactiveMessageProducer(new MessageInterceptor[0], channelMapping, new ReactiveInMemoryMessageProducer(inMemoryMessageConsumer)); DefaultCommandNameMapping commandNameMapping = new DefaultCommandNameMapping(); commandProducer = new ReactiveCommandProducerImpl(messageProducer, commandNameMapping); ReactiveCommandHandlers commandHandlers = defineCommandHandlers(); messageConsumer = new ReactiveMessageConsumerImpl(channelMapping, inMemoryMessageConsumer, new DecoratedReactiveMessageHandlerFactory(Collections.emptyList())); commandReplyProducer = new ReactiveCommandReplyProducer(messageProducer); ReactiveCommandDispatcher commandDispatcher = new ReactiveCommandDispatcher("subscriberId", commandHandlers, messageConsumer, commandReplyProducer); commandDispatcher.initialize();
dce2bb50318a892bc96b9f6a41ee3f5cada7d2e8
Move Method
Move Method private sendReplies(correlationHeaders Map<String,String>, replies Flux<Message>, defaultReplyChannel Optional<String>) : Flux<Message> from class io.eventuate.tram.reactive.commands.consumer.ReactiveCommandDispatcher to public sendReplies(commandReplyToken CommandReplyToken, replies Flux<Message>) : Flux<Message> from class io.eventuate.tram.reactive.commands.consumer.ReactiveCommandReplyProducer
private sendReplies(correlationHeaders Map<String,String>, replies Flux<Message>, defaultReplyChannel Optional<String>) : Flux<Message>
public sendReplies(commandReplyToken CommandReplyToken, replies Flux<Message>) : Flux<Message>
sendReplies
sendReplies
correlationHeaders Map<String,String>, replies Flux<Message>, defaultReplyChannel Optional<String>
commandReplyToken CommandReplyToken, replies Flux<Message>
Flux<Message>
Flux<Message>
return replies .flatMap(reply -> { Message transformedReply = MessageBuilder .withMessage(reply) .withExtraHeaders("", correlationHeaders) .build(); return messageProducer.send(destination(defaultReplyChannel), transformedReply); });
return replies .flatMap(reply -> { Message transformedReply = MessageBuilder .withMessage(reply) .withExtraHeaders("", commandReplyToken.getReplyHeaders()) .build(); return messageProducer.send(commandReplyToken.getReplyChannel(), transformedReply); });
dce2bb50318a892bc96b9f6a41ee3f5cada7d2e8
Add Parameter
Add Parameter commandReplyToken : CommandReplyToken in method public sendReplies(commandReplyToken CommandReplyToken, replies Flux<Message>) : Flux<Message> from class io.eventuate.tram.reactive.commands.consumer.ReactiveCommandReplyProducer
private sendReplies(correlationHeaders Map<String,String>, replies Flux<Message>, defaultReplyChannel Optional<String>) : Flux<Message>
public sendReplies(commandReplyToken CommandReplyToken, replies Flux<Message>) : Flux<Message>
sendReplies
sendReplies
correlationHeaders Map<String,String>, replies Flux<Message>, defaultReplyChannel Optional<String>
commandReplyToken CommandReplyToken, replies Flux<Message>
Flux<Message>
Flux<Message>
return replies .flatMap(reply -> { Message transformedReply = MessageBuilder .withMessage(reply) .withExtraHeaders("", correlationHeaders) .build(); return messageProducer.send(destination(defaultReplyChannel), transformedReply); });
return replies .flatMap(reply -> { Message transformedReply = MessageBuilder .withMessage(reply) .withExtraHeaders("", commandReplyToken.getReplyHeaders()) .build(); return messageProducer.send(commandReplyToken.getReplyChannel(), transformedReply); });
dce2bb50318a892bc96b9f6a41ee3f5cada7d2e8
Remove Parameter
Remove Parameter correlationHeaders : Map<String,String> in method private sendReplies(correlationHeaders Map<String,String>, replies Flux<Message>, defaultReplyChannel Optional<String>) : Flux<Message> from class io.eventuate.tram.reactive.commands.consumer.ReactiveCommandDispatcher
private sendReplies(correlationHeaders Map<String,String>, replies Flux<Message>, defaultReplyChannel Optional<String>) : Flux<Message>
public sendReplies(commandReplyToken CommandReplyToken, replies Flux<Message>) : Flux<Message>
sendReplies
sendReplies
correlationHeaders Map<String,String>, replies Flux<Message>, defaultReplyChannel Optional<String>
commandReplyToken CommandReplyToken, replies Flux<Message>
Flux<Message>
Flux<Message>
return replies .flatMap(reply -> { Message transformedReply = MessageBuilder .withMessage(reply) .withExtraHeaders("", correlationHeaders) .build(); return messageProducer.send(destination(defaultReplyChannel), transformedReply); });
return replies .flatMap(reply -> { Message transformedReply = MessageBuilder .withMessage(reply) .withExtraHeaders("", commandReplyToken.getReplyHeaders()) .build(); return messageProducer.send(commandReplyToken.getReplyChannel(), transformedReply); });
dce2bb50318a892bc96b9f6a41ee3f5cada7d2e8
Remove Parameter
Remove Parameter defaultReplyChannel : Optional<String> in method private sendReplies(correlationHeaders Map<String,String>, replies Flux<Message>, defaultReplyChannel Optional<String>) : Flux<Message> from class io.eventuate.tram.reactive.commands.consumer.ReactiveCommandDispatcher
private sendReplies(correlationHeaders Map<String,String>, replies Flux<Message>, defaultReplyChannel Optional<String>) : Flux<Message>
public sendReplies(commandReplyToken CommandReplyToken, replies Flux<Message>) : Flux<Message>
sendReplies
sendReplies
correlationHeaders Map<String,String>, replies Flux<Message>, defaultReplyChannel Optional<String>
commandReplyToken CommandReplyToken, replies Flux<Message>
Flux<Message>
Flux<Message>
return replies .flatMap(reply -> { Message transformedReply = MessageBuilder .withMessage(reply) .withExtraHeaders("", correlationHeaders) .build(); return messageProducer.send(destination(defaultReplyChannel), transformedReply); });
return replies .flatMap(reply -> { Message transformedReply = MessageBuilder .withMessage(reply) .withExtraHeaders("", commandReplyToken.getReplyHeaders()) .build(); return messageProducer.send(commandReplyToken.getReplyChannel(), transformedReply); });
dce2bb50318a892bc96b9f6a41ee3f5cada7d2e8
Change Method Access Modifier
Change Method Access Modifier private to public in method public sendReplies(commandReplyToken CommandReplyToken, replies Flux<Message>) : Flux<Message> from class io.eventuate.tram.reactive.commands.consumer.ReactiveCommandReplyProducer
private sendReplies(correlationHeaders Map<String,String>, replies Flux<Message>, defaultReplyChannel Optional<String>) : Flux<Message>
public sendReplies(commandReplyToken CommandReplyToken, replies Flux<Message>) : Flux<Message>
sendReplies
sendReplies
correlationHeaders Map<String,String>, replies Flux<Message>, defaultReplyChannel Optional<String>
commandReplyToken CommandReplyToken, replies Flux<Message>
Flux<Message>
Flux<Message>
return replies .flatMap(reply -> { Message transformedReply = MessageBuilder .withMessage(reply) .withExtraHeaders("", correlationHeaders) .build(); return messageProducer.send(destination(defaultReplyChannel), transformedReply); });
return replies .flatMap(reply -> { Message transformedReply = MessageBuilder .withMessage(reply) .withExtraHeaders("", commandReplyToken.getReplyHeaders()) .build(); return messageProducer.send(commandReplyToken.getReplyChannel(), transformedReply); });
dce2bb50318a892bc96b9f6a41ee3f5cada7d2e8
Extract Class
Extract Class io.eventuate.tram.reactive.commands.consumer.ReactiveCommandReplyProducer from class io.eventuate.tram.reactive.commands.consumer.ReactiveCommandDispatcher
private sendReplies(correlationHeaders Map<String,String>, replies Flux<Message>, defaultReplyChannel Optional<String>) : Flux<Message>
public sendReplies(commandReplyToken CommandReplyToken, replies Flux<Message>) : Flux<Message>
sendReplies
sendReplies
correlationHeaders Map<String,String>, replies Flux<Message>, defaultReplyChannel Optional<String>
commandReplyToken CommandReplyToken, replies Flux<Message>
Flux<Message>
Flux<Message>
return replies .flatMap(reply -> { Message transformedReply = MessageBuilder .withMessage(reply) .withExtraHeaders("", correlationHeaders) .build(); return messageProducer.send(destination(defaultReplyChannel), transformedReply); });
return replies .flatMap(reply -> { Message transformedReply = MessageBuilder .withMessage(reply) .withExtraHeaders("", commandReplyToken.getReplyHeaders()) .build(); return messageProducer.send(commandReplyToken.getReplyChannel(), transformedReply); });
704439a2e73783805aaf3b6d3d29ac6e3b054a7f
Rename Method
Rename Method public getCommandReplyInfo() : CommandReplyToken renamed to public getCommandReplyToken() : CommandReplyToken in class io.eventuate.tram.commands.consumer.CommandHandlerArgs
public getCommandReplyInfo() : CommandReplyToken
public getCommandReplyToken() : CommandReplyToken
getCommandReplyInfo
getCommandReplyToken
CommandReplyToken
CommandReplyToken
return commandReplyToken;
return commandReplyToken;
790555c42e7b8dc75050ba777ccaae303bda1e77
Change Return Type
Change Return Type InMemoryMessagingFactory to InMemoryMessaging in method public make() : InMemoryMessaging from class io.eventuate.tram.inmemory.InMemoryMessaging
public make() : InMemoryMessagingFactory
public make() : InMemoryMessaging
make
make
InMemoryMessagingFactory
InMemoryMessaging
InMemoryMessageConsumer inMemoryMessageConsumer = new InMemoryMessageConsumer(); EventuateTransactionSynchronizationManager eventuateTransactionSynchronizationManager = new EventuateTransactionSynchronizationManager() { @Override public boolean isTransactionActive() { return false; } @Override public void executeAfterTransaction(Runnable runnable) { throw new UnsupportedOperationException(); } }; ChannelMapping channelMapping = new DefaultChannelMapping.DefaultChannelMappingBuilder().build(); MessageProducer messageProducer = new MessageProducerImpl(new MessageInterceptor[0], channelMapping, new InMemoryMessageProducer(inMemoryMessageConsumer, eventuateTransactionSynchronizationManager)); MessageConsumer messageConsumer = new MessageConsumerImpl(channelMapping, inMemoryMessageConsumer, new DecoratedMessageHandlerFactory(Collections.emptyList())); return new InMemoryMessagingFactory(messageProducer, messageConsumer);
InMemoryMessageConsumer inMemoryMessageConsumer = new InMemoryMessageConsumer(); EventuateTransactionSynchronizationManager eventuateTransactionSynchronizationManager = new EventuateTransactionSynchronizationManager() { @Override public boolean isTransactionActive() { return false; } @Override public void executeAfterTransaction(Runnable runnable) { throw new UnsupportedOperationException(); } }; ChannelMapping channelMapping = new DefaultChannelMapping.DefaultChannelMappingBuilder().build(); MessageProducer messageProducer = new MessageProducerImpl(new MessageInterceptor[0], channelMapping, new InMemoryMessageProducer(inMemoryMessageConsumer, eventuateTransactionSynchronizationManager)); MessageConsumer messageConsumer = new MessageConsumerImpl(channelMapping, inMemoryMessageConsumer, new DecoratedMessageHandlerFactory(Collections.emptyList())); return new InMemoryMessaging(messageProducer, messageConsumer);
790555c42e7b8dc75050ba777ccaae303bda1e77
Change Return Type
Change Return Type InMemoryCommandsFactory to InMemoryCommands in method public make(commandHandlers CommandHandlers, inMemoryMessaging InMemoryMessaging) : InMemoryCommands from class io.eventuate.tram.commands.InMemoryCommands
public make(commandHandlers CommandHandlers, inMemoryMessagingFactory InMemoryMessagingFactory) : InMemoryCommandsFactory
public make(commandHandlers CommandHandlers, inMemoryMessaging InMemoryMessaging) : InMemoryCommands
make
make
commandHandlers CommandHandlers, inMemoryMessagingFactory InMemoryMessagingFactory
commandHandlers CommandHandlers, inMemoryMessaging InMemoryMessaging
InMemoryCommandsFactory
InMemoryCommands
DefaultCommandNameMapping commandNameMapping = new DefaultCommandNameMapping(); CommandProducer commandProducer = new CommandProducerImpl(inMemoryMessagingFactory.messageProducer, commandNameMapping); CommandReplyProducer commandReplyProducer = new CommandReplyProducer(inMemoryMessagingFactory.messageProducer); CommandDispatcherFactory commandDispatcherFactory = new CommandDispatcherFactory(inMemoryMessagingFactory.messageConsumer, commandNameMapping, commandReplyProducer); CommandDispatcher commandDispatcher = commandDispatcherFactory.make("subscriberId", commandHandlers); commandDispatcher.initialize(); return new InMemoryCommandsFactory(commandProducer, commandReplyProducer);
DefaultCommandNameMapping commandNameMapping = new DefaultCommandNameMapping(); CommandProducer commandProducer = new CommandProducerImpl(inMemoryMessaging.messageProducer, commandNameMapping); CommandReplyProducer commandReplyProducer = new CommandReplyProducer(inMemoryMessaging.messageProducer); CommandDispatcherFactory commandDispatcherFactory = new CommandDispatcherFactory(inMemoryMessaging.messageConsumer, commandNameMapping, commandReplyProducer); CommandDispatcher commandDispatcher = commandDispatcherFactory.make("subscriberId", commandHandlers); commandDispatcher.initialize(); return new InMemoryCommands(commandProducer, commandReplyProducer);
859c9da5f9c3e1ac6ee28a9750dc55d7e20bf599
Move Method
Move Method public commandReplyProducer(messageProducer MessageProducer) : CommandReplyProducer from class io.eventuate.tram.spring.commands.consumer.TramCommandConsumerConfiguration to public commandReplyProducer(messageProducer MessageProducer) : CommandReplyProducer from class io.eventuate.tram.spring.commands.consumer.TramCommandReplyProducerConfiguration
public commandReplyProducer(messageProducer MessageProducer) : CommandReplyProducer
public commandReplyProducer(messageProducer MessageProducer) : CommandReplyProducer
commandReplyProducer
commandReplyProducer
messageProducer MessageProducer
messageProducer MessageProducer
CommandReplyProducer
CommandReplyProducer
return new CommandReplyProducer(messageProducer);
return new CommandReplyProducer(messageProducer);
dcd18bb484876de5b5ee8014a7e3e3c68723af5b
Rename Method
Rename Method public eventuateTramMessageVerifier() : MessageVerifier renamed to public newEventuateTramMessageVerifier() : EventuateTramMessageVerifier in class io.eventuate.tram.spring.cloudcontractsupport.EventuateContractVerifierConfiguration
public eventuateTramMessageVerifier() : MessageVerifier
public newEventuateTramMessageVerifier() : EventuateTramMessageVerifier
eventuateTramMessageVerifier
newEventuateTramMessageVerifier
MessageVerifier
EventuateTramMessageVerifier
return new EventuateTramMessageVerifier();
return new EventuateTramMessageVerifier();
dcd18bb484876de5b5ee8014a7e3e3c68723af5b
Rename Method
Rename Method public eventuateContractVerifierMessaging(exchange MessageVerifier<Message>) : ContractVerifierMessaging<Message> renamed to public contractVerifierEventuateMessaging(exchange MessageVerifier<Message>) : ContractVerifierMessaging<Message> in class io.eventuate.tram.spring.cloudcontractsupport.EventuateContractVerifierConfiguration
public eventuateContractVerifierMessaging(exchange MessageVerifier<Message>) : ContractVerifierMessaging<Message>
public contractVerifierEventuateMessaging(exchange MessageVerifier<Message>) : ContractVerifierMessaging<Message>
eventuateContractVerifierMessaging
contractVerifierEventuateMessaging
exchange MessageVerifier<Message>
exchange MessageVerifier<Message>
ContractVerifierMessaging<Message>
ContractVerifierMessaging<Message>
return new EventuateContractVerifierMessaging(exchange);
return new ContractVerifierEventuateMessaging(exchange);
dcd18bb484876de5b5ee8014a7e3e3c68723af5b
Change Return Type
Change Return Type MessageVerifier to EventuateTramMessageVerifier in method public newEventuateTramMessageVerifier() : EventuateTramMessageVerifier from class io.eventuate.tram.spring.cloudcontractsupport.EventuateContractVerifierConfiguration
public eventuateTramMessageVerifier() : MessageVerifier
public newEventuateTramMessageVerifier() : EventuateTramMessageVerifier
eventuateTramMessageVerifier
newEventuateTramMessageVerifier
MessageVerifier
EventuateTramMessageVerifier
return new EventuateTramMessageVerifier();
return new EventuateTramMessageVerifier();
dcd18bb484876de5b5ee8014a7e3e3c68723af5b
Add Parameter
Add Parameter contract : YamlContract in method public receive(destination String, timeout long, timeUnit TimeUnit, contract YamlContract) : Message from class io.eventuate.tram.spring.cloudcontractsupport.EventuateTramMessageVerifier
public receive(destination String, timeout long, timeUnit TimeUnit) : Message
public receive(destination String, timeout long, timeUnit TimeUnit, contract YamlContract) : Message
receive
receive
destination String, timeout long, timeUnit TimeUnit
destination String, timeout long, timeUnit TimeUnit, contract YamlContract
Message
Message
Message m; try { m = getForDestination(destination).poll(timeout, timeUnit); } catch (InterruptedException e) { throw new RuntimeException(e); } if (m == null) return null; return m;
Message m; try { m = getForDestination(destination).poll(timeout, timeUnit); } catch (InterruptedException e) { throw new RuntimeException(e); } return m;
dcd18bb484876de5b5ee8014a7e3e3c68723af5b
Add Parameter
Add Parameter contract : YamlContract in method public receive(destination String, contract YamlContract) : Message from class io.eventuate.tram.spring.cloudcontractsupport.EventuateTramMessageVerifier
public receive(destination String) : Message
public receive(destination String, contract YamlContract) : Message
receive
receive
destination String
destination String, contract YamlContract
Message
Message
return receive(destination, 5, TimeUnit.SECONDS);
return receive(destination, 5, TimeUnit.SECONDS);
dcd18bb484876de5b5ee8014a7e3e3c68723af5b
Add Parameter
Add Parameter contract : YamlContract in method public send(payload T, headers Map<String,Object>, destination String, contract YamlContract) : void from class io.eventuate.tram.spring.cloudcontractsupport.EventuateTramMessageVerifier
public send(payload T, headers Map<String,Object>, destination String) : void
public send(payload T, headers Map<String,Object>, destination String, contract YamlContract) : void
send
send
payload T, headers Map<String,Object>, destination String
payload T, headers Map<String,Object>, destination String, contract YamlContract
void
void
String p = (String) payload; MessageBuilder mb = MessageBuilder.withPayload(p); headers.forEach((key, value) -> { mb.withHeader(key, (String) value); }); messageProducer.send(destination, mb.build());
MessageBuilder messageBuilder = MessageBuilder.withPayload(payload.toString()); headers.forEach((name, value) -> messageBuilder.withHeader(name, value.toString())); messageProducer.send(destination, messageBuilder.build());
dcd18bb484876de5b5ee8014a7e3e3c68723af5b
Rename Method
Rename Method private process(message Message, groovyDsl Contract) : Optional<Message> renamed to private makeReply(message Message, groovyDsl Contract) : Message in class io.eventuate.tram.spring.cloudcontractsupport.EventuateTramRoutesConfigurer
private process(message Message, groovyDsl Contract) : Optional<Message>
private makeReply(message Message, groovyDsl Contract) : Message
process
makeReply
message Message, groovyDsl Contract
message Message, groovyDsl Contract
Optional<Message>
Message
MessageBuilder messageBuilder = MessageBuilder .withPayload(BodyExtractor .extractStubValueFrom(groovyDsl.getOutputMessage().getBody())); if (groovyDsl.getOutputMessage().getHeaders() != null) { for (Header entry : groovyDsl.getOutputMessage().getHeaders().getEntries()) { messageBuilder.withHeader(entry.getName(), entry.getClientValue().toString()); } } messageBuilder.withExtraHeaders("", correlationHeaders(message.getHeaders())); return Optional.of(messageBuilder.build());
MessageBuilder messageBuilder = MessageBuilder .withPayload(BodyExtractor .extractStubValueFrom(groovyDsl.getOutputMessage().getBody())); if (groovyDsl.getOutputMessage().getHeaders() != null) { for (Header entry : groovyDsl.getOutputMessage().getHeaders().getEntries()) { messageBuilder.withHeader(entry.getName(), entry.getClientValue().toString()); } } messageBuilder.withExtraHeaders("", correlationHeaders(message.getHeaders())); return messageBuilder.build();
dcd18bb484876de5b5ee8014a7e3e3c68723af5b
Extract Method
Extract Method private isCommandMessageContract(contract Contract) : boolean extracted from public initialize() : void in class io.eventuate.tram.spring.cloudcontractsupport.EventuateTramRoutesConfigurer
public initialize() : void
private isCommandMessageContract(contract Contract) : boolean
initialize
isCommandMessageContract
contract Contract
void
boolean
Map<StubConfiguration, Collection<Contract>> contracts = batchStubRunner .getContracts(); for (Collection<Contract> list : contracts.values()) { for (Contract it : list) { if (it.getInput() != null && it.getInput().getMessageFrom() != null && it.getOutputMessage() != null && it.getOutputMessage().getSentTo() != null) { String inputClientValue = it.getInput().getMessageFrom().getClientValue(); String outputClientValue = it.getOutputMessage().getSentTo().getClientValue(); messageConsumer.subscribe("Route-" + it.getLabel() + System.currentTimeMillis() + "." + idCounter++, Collections.singleton(inputClientValue), (message) -> { if (satisfies(message, it)) { process(message, it).ifPresent(m -> messageProducer.send(outputClientValue, m)); } }); // from(inputClientValue) // .filter(new StubRunnerCamelPredicate(it)) // .process(new StubRunnerCamelProcessor(it)) // .to(outputClientValue); } } }
return contract.getInput() != null && contract.getInput().getMessageFrom() != null && contract.getOutputMessage() != null && contract.getOutputMessage().getSentTo() != null;
dcd18bb484876de5b5ee8014a7e3e3c68723af5b
Extract Method
Extract Method private bodyMatches(message Message, groovyDsl Contract) : boolean extracted from private satisfies(message Message, groovyDsl Contract) : boolean in class io.eventuate.tram.spring.cloudcontractsupport.EventuateTramRoutesConfigurer
private satisfies(message Message, groovyDsl Contract) : boolean
private bodyMatches(message Message, groovyDsl Contract) : boolean
satisfies
bodyMatches
message Message, groovyDsl Contract
message Message, groovyDsl Contract
boolean
boolean
if (!headersMatch(message, groovyDsl)) { logger.info("Headers don't match {} {} ", groovyDsl.getLabel(), message); return false; } BodyMatchers matchers = groovyDsl.getInput().getBodyMatchers(); Object dslBody = MapConverter.getStubSideValues(groovyDsl.getInput().getMessageBody()); Object matchingInputMessage = JsonToJsonPathsConverter .removeMatchingJsonPaths(dslBody, matchers); JsonPaths jsonPaths = JsonToJsonPathsConverter .transformToJsonPathWithStubsSideValuesAndNoArraySizeCheck( matchingInputMessage); DocumentContext parsedJson = JsonPath.parse(message.getPayload()); boolean matches = true; for (MethodBufferingJsonVerifiable path : jsonPaths) { matches &= matchesJsonPath(parsedJson, path.jsonPath()); } logger.info("jsonPaths match {} {} {} ", groovyDsl.getLabel(), matches, message); if (matchers != null && matchers.hasMatchers()) { for (BodyMatcher matcher : matchers.jsonPathMatchers()) { String jsonPath = JsonToJsonPathsConverter.convertJsonPathAndRegexToAJsonPath(matcher, dslBody); matches &= matchesJsonPath(parsedJson, jsonPath); } } logger.info("matchers {} {} {} ", groovyDsl.getLabel(), matches, message); return matches;
DocumentContext parsedJson = JsonPath.parse(message.getPayload()); BodyMatchers matchers = groovyDsl.getInput().getBodyMatchers(); Object dslBody = MapConverter.getStubSideValues(groovyDsl.getInput().getMessageBody()); Object matchingInputMessage = JsonToJsonPathsConverter.removeMatchingJsonPaths(dslBody, matchers); JsonPaths jsonPaths = JsonToJsonPathsConverter.transformToJsonPathWithStubsSideValuesAndNoArraySizeCheck(matchingInputMessage); boolean matches = true; for (MethodBufferingJsonVerifiable path : jsonPaths) { matches &= matchesJsonPath(parsedJson, path.jsonPath()); } logger.info("jsonPaths match {} {} {} ", groovyDsl.getLabel(), matches, message); if (matches && matchers != null && matchers.hasMatchers()) { for (BodyMatcher matcher : matchers.matchers()) { String jsonPath = JsonToJsonPathsConverter.convertJsonPathAndRegexToAJsonPath(matcher, dslBody); matches &= matchesJsonPath(parsedJson, jsonPath); } } logger.info("matchers {} {} {} ", groovyDsl.getLabel(), matches, message); return matches;
dcd18bb484876de5b5ee8014a7e3e3c68723af5b
Change Return Type
Change Return Type Optional<Message> to Message in method private makeReply(message Message, groovyDsl Contract) : Message from class io.eventuate.tram.spring.cloudcontractsupport.EventuateTramRoutesConfigurer
private process(message Message, groovyDsl Contract) : Optional<Message>
private makeReply(message Message, groovyDsl Contract) : Message
process
makeReply
message Message, groovyDsl Contract
message Message, groovyDsl Contract
Optional<Message>
Message
MessageBuilder messageBuilder = MessageBuilder .withPayload(BodyExtractor .extractStubValueFrom(groovyDsl.getOutputMessage().getBody())); if (groovyDsl.getOutputMessage().getHeaders() != null) { for (Header entry : groovyDsl.getOutputMessage().getHeaders().getEntries()) { messageBuilder.withHeader(entry.getName(), entry.getClientValue().toString()); } } messageBuilder.withExtraHeaders("", correlationHeaders(message.getHeaders())); return Optional.of(messageBuilder.build());
MessageBuilder messageBuilder = MessageBuilder .withPayload(BodyExtractor .extractStubValueFrom(groovyDsl.getOutputMessage().getBody())); if (groovyDsl.getOutputMessage().getHeaders() != null) { for (Header entry : groovyDsl.getOutputMessage().getHeaders().getEntries()) { messageBuilder.withHeader(entry.getName(), entry.getClientValue().toString()); } } messageBuilder.withExtraHeaders("", correlationHeaders(message.getHeaders())); return messageBuilder.build();
a16cd2a4fd56c3607d19f6effa258cdfdd21271b
Remove Method Annotation
Remove Method Annotation @PostConstruct in method public subscribe() : void from class io.eventuate.tram.commands.db.broker.integrationtests.MyReplyConsumer
public subscribe() : void
public subscribe() : void
subscribe
subscribe
void
void
messageConsumer.subscribe(getClass().getName(), singleton(channelMapping.transform(replyChannel)), this::handler);
messageConsumer.subscribe(getClass().getName(), singleton(channelMapping.transform(replyChannel)), this::handler);
a16cd2a4fd56c3607d19f6effa258cdfdd21271b
Modify Method Annotation
Modify Method Annotation @Bean to @Bean(initMethod = "subscribe") in method public myReplyConsumer(messageConsumer MessageConsumer) : MyReplyConsumer from class io.eventuate.tram.commands.db.broker.integrationtests.TramCommandsDBBrokerIntegrationTestConfiguration
public myReplyConsumer(messageConsumer MessageConsumer) : MyReplyConsumer
public myReplyConsumer(messageConsumer MessageConsumer) : MyReplyConsumer
myReplyConsumer
myReplyConsumer
messageConsumer MessageConsumer
messageConsumer MessageConsumer
MyReplyConsumer
MyReplyConsumer
return new MyReplyConsumer(messageConsumer, "ReplyTo");
return new MyReplyConsumer(messageConsumer, "ReplyTo");
a16cd2a4fd56c3607d19f6effa258cdfdd21271b
Remove Method Annotation
Remove Method Annotation @PostConstruct in method public initialize() : void from class io.eventuate.tram.commands.consumer.CommandDispatcher
public initialize() : void
public initialize() : void
initialize
initialize
void
void
messageConsumer.subscribe(commandDispatcherId, commandHandlers.getChannels(), this::messageHandler);
messageConsumer.subscribe(commandDispatcherId, commandHandlers.getChannels(), this::messageHandler);
a16cd2a4fd56c3607d19f6effa258cdfdd21271b
Remove Method Annotation
Remove Method Annotation @PostConstruct in method public initialize() : void from class io.eventuate.tram.events.subscriber.DomainEventDispatcher
public initialize() : void
public initialize() : void
initialize
initialize
void
void
logger.info("Initializing domain event dispatcher"); messageConsumer.subscribe(eventDispatcherId, domainEventHandlers.getAggregateTypesAndEvents(), this::messageHandler); logger.info("Initialized domain event dispatcher");
logger.info("Initializing domain event dispatcher"); messageConsumer.subscribe(eventDispatcherId, domainEventHandlers.getAggregateTypesAndEvents(), this::messageHandler); logger.info("Initialized domain event dispatcher");
a16cd2a4fd56c3607d19f6effa258cdfdd21271b
Remove Method Annotation
Remove Method Annotation @PostConstruct in method public initialize() : void from class io.eventuate.tram.reactive.commands.consumer.ReactiveCommandDispatcher
public initialize() : void
public initialize() : void
initialize
initialize
void
void
messageConsumer.subscribe(commandDispatcherId, commandHandlers.getChannels(), this::messageHandler);
messageConsumer.subscribe(commandDispatcherId, commandHandlers.getChannels(), this::messageHandler);
a16cd2a4fd56c3607d19f6effa258cdfdd21271b
Remove Method Annotation
Remove Method Annotation @PostConstruct in method public initialize() : void from class io.eventuate.tram.reactive.events.subscriber.ReactiveDomainEventDispatcher
public initialize() : void
public initialize() : void
initialize
initialize
void
void
logger.info("Initializing reactive domain event dispatcher"); messageConsumer.subscribe(eventDispatcherId, domainEventHandlers.getAggregateTypesAndEvents(), this::messageHandler); logger.info("Initialized reactive domain event dispatcher");
logger.info("Initializing reactive domain event dispatcher"); messageConsumer.subscribe(eventDispatcherId, domainEventHandlers.getAggregateTypesAndEvents(), this::messageHandler); logger.info("Initialized reactive domain event dispatcher");
a16cd2a4fd56c3607d19f6effa258cdfdd21271b
Remove Method Annotation
Remove Method Annotation @PostConstruct in method public initialize() : void from class io.eventuate.tram.spring.cloudcontractsupport.EventuateTramRoutesConfigurer
public initialize() : void
public initialize() : void
initialize
initialize
void
void
for (Collection<Contract> contracts : batchStubRunner.getContracts().values()) { for (Contract contract : contracts) { if (isCommandMessageContract(contract)) { String commandChannel = contract.getInput().getMessageFrom().getClientValue(); String replyToChannel = contract.getOutputMessage().getSentTo().getClientValue(); messageConsumer.subscribe("Route-" + contract.getLabel() + System.currentTimeMillis() + "." + idCounter++, Collections.singleton(commandChannel), message -> { if (satisfies(message, contract)) { messageProducer.send(replyToChannel, makeReply(message, contract)); } }); } } }
for (Collection<Contract> contracts : batchStubRunner.getContracts().values()) { for (Contract contract : contracts) { if (isCommandMessageContract(contract)) { String commandChannel = contract.getInput().getMessageFrom().getClientValue(); String replyToChannel = contract.getOutputMessage().getSentTo().getClientValue(); messageConsumer.subscribe("Route-" + contract.getLabel() + System.currentTimeMillis() + "." + idCounter++, Collections.singleton(commandChannel), message -> { if (satisfies(message, contract)) { messageProducer.send(replyToChannel, makeReply(message, contract)); } }); } } }
19e4fae928a65398cf9d74b69c386f52181670fa
Extract Method
Extract Method private findMessagesSentToChannel(channel String) : List<Message> extracted from public assertCommandReplyMessageSent(channel String) : void in class io.eventuate.tram.spring.testing.outbox.commands.CommandOutboxTestSupport
public assertCommandReplyMessageSent(channel String) : void
private findMessagesSentToChannel(channel String) : List<Message>
assertCommandReplyMessageSent
findMessagesSentToChannel
channel String
channel String
void
List<Message>
List<Message> messages = jdbcTemplate.query("select headers,payload from message where destination = ?", (rs, rowNum) -> { String headers = rs.getString("headers"); String payload = rs.getString("payload"); return MessageBuilder.withPayload(payload).withExtraHeaders("", JSonMapper.fromJson(headers, Map.class)).build(); }, channel); assertThat(messages) .hasSize(1) .allMatch(reply -> CommandReplyOutcome.SUCCESS.name().equals(reply.getRequiredHeader(ReplyMessageHeaders.REPLY_OUTCOME)));
return jdbcTemplate.query("select headers,payload from message where destination = ?", (rs, rowNum) -> { String headers = rs.getString("headers"); String payload = rs.getString("payload"); return MessageBuilder.withPayload(payload).withExtraHeaders("", JSonMapper.fromJson(headers, Map.class)).build(); }, channel);
9c9677c62eecc19ba6a50f9865477dfa36ddc40f
Remove Thrown Exception Type
Remove Thrown Exception Type InterruptedException in method public assertMessageReceived(channel String) : AssertableMessage from class io.eventuate.tram.spring.testing.messaging.consumer.AssertableMessageConsumer
public assertMessageReceived(channel String) : AssertableMessage
public assertMessageReceived(channel String) : AssertableMessage
assertMessageReceived
assertMessageReceived
channel String
channel String
AssertableMessage
AssertableMessage
BlockingQueue<Message> queue = getMessageBlockingQueue(channel); Message m = queue.poll(10, TimeUnit.SECONDS); assertNotNull(m); return new AssertableMessage(m);
BlockingQueue<Message> queue = getMessageBlockingQueue(channel); Message m; try { m = queue.poll(10, TimeUnit.SECONDS); } catch (InterruptedException e) { throw new RuntimeException(e); } assertNotNull(m); return new AssertableMessage(m);
63f28ff47a78ba06071ebf33ee705e2928152b7c
Add Parameter
Add Parameter subscriberMapping : SubscriberMapping in method public messageConsumer(messageConsumerImplementation MessageConsumerImplementation, channelMapping ChannelMapping, decoratedMessageHandlerFactory DecoratedMessageHandlerFactory, subscriberMapping SubscriberMapping) : MessageConsumer from class io.eventuate.tram.micronaut.consumer.common.TramConsumerCommonFactory
public messageConsumer(messageConsumerImplementation MessageConsumerImplementation, channelMapping ChannelMapping, decoratedMessageHandlerFactory DecoratedMessageHandlerFactory) : MessageConsumer
public messageConsumer(messageConsumerImplementation MessageConsumerImplementation, channelMapping ChannelMapping, decoratedMessageHandlerFactory DecoratedMessageHandlerFactory, subscriberMapping SubscriberMapping) : MessageConsumer
messageConsumer
messageConsumer
messageConsumerImplementation MessageConsumerImplementation, channelMapping ChannelMapping, decoratedMessageHandlerFactory DecoratedMessageHandlerFactory
messageConsumerImplementation MessageConsumerImplementation, channelMapping ChannelMapping, decoratedMessageHandlerFactory DecoratedMessageHandlerFactory, subscriberMapping SubscriberMapping
MessageConsumer
MessageConsumer
return new MessageConsumerImpl(channelMapping, messageConsumerImplementation, decoratedMessageHandlerFactory);
return new MessageConsumerImpl(channelMapping, messageConsumerImplementation, decoratedMessageHandlerFactory, subscriberMapping);
63f28ff47a78ba06071ebf33ee705e2928152b7c
Add Parameter
Add Parameter subscriberMapping : SubscriberMapping in method public messageConsumer(messageConsumerImplementation MessageConsumerImplementation, channelMapping ChannelMapping, decoratedMessageHandlerFactory DecoratedMessageHandlerFactory, subscriberMapping SubscriberMapping) : MessageConsumer from class io.eventuate.tram.spring.consumer.common.TramConsumerCommonConfiguration
public messageConsumer(messageConsumerImplementation MessageConsumerImplementation, channelMapping ChannelMapping, decoratedMessageHandlerFactory DecoratedMessageHandlerFactory) : MessageConsumer
public messageConsumer(messageConsumerImplementation MessageConsumerImplementation, channelMapping ChannelMapping, decoratedMessageHandlerFactory DecoratedMessageHandlerFactory, subscriberMapping SubscriberMapping) : MessageConsumer
messageConsumer
messageConsumer
messageConsumerImplementation MessageConsumerImplementation, channelMapping ChannelMapping, decoratedMessageHandlerFactory DecoratedMessageHandlerFactory
messageConsumerImplementation MessageConsumerImplementation, channelMapping ChannelMapping, decoratedMessageHandlerFactory DecoratedMessageHandlerFactory, subscriberMapping SubscriberMapping
MessageConsumer
MessageConsumer
return new MessageConsumerImpl(channelMapping, messageConsumerImplementation, decoratedMessageHandlerFactory);
return new MessageConsumerImpl(channelMapping, messageConsumerImplementation, decoratedMessageHandlerFactory, subscriberMapping);
2c72be420ea0d16731d37b60530d174365bb1c76
Add Parameter
Add Parameter templatedMessageTableCreator : TemplatedMessageTableCreator in method public v1005__myMigration(templatedMessageTableCreator TemplatedMessageTableCreator, outboxPartitioningSpec OutboxPartitioningSpec) : V1005__MyMigration from class io.eventuate.tram.spring.flyway.EventuateTramFlywayMigrationConfiguration
public v1005__myMigration(outboxPartitioningSpec OutboxPartitioningSpec) : V1005__MyMigration
public v1005__myMigration(templatedMessageTableCreator TemplatedMessageTableCreator, outboxPartitioningSpec OutboxPartitioningSpec) : V1005__MyMigration
v1005__myMigration
v1005__myMigration
outboxPartitioningSpec OutboxPartitioningSpec
templatedMessageTableCreator TemplatedMessageTableCreator, outboxPartitioningSpec OutboxPartitioningSpec
V1005__MyMigration
V1005__MyMigration
return new V1005__MyMigration(outboxPartitioningSpec);
return new V1005__MyMigration(templatedMessageTableCreator, outboxPartitioningSpec);
aaec9041cf5c07c1c82c56a1d384d131716c23c4
Extract Method
Extract Method public commandHandlersFromBean(bean Object) : List<CommandHandlerInfo> extracted from public postProcessAfterInitialization(bean Object, beanName String) : Object in class io.eventuate.tram.spring.commands.consumer.EventuateCommandHandlerBeanPostProcessor
public postProcessAfterInitialization(bean Object, beanName String) : Object
public commandHandlersFromBean(bean Object) : List<CommandHandlerInfo>
postProcessAfterInitialization
commandHandlersFromBean
bean Object, beanName String
bean Object
Object
List<CommandHandlerInfo>
Class<?> targetClass = AopUtils.getTargetClass(bean); Map<Method, EventuateCommandHandler> annotatedMethods = MethodIntrospector.selectMethods(targetClass, (MethodIntrospector.MetadataLookup<EventuateCommandHandler>) method -> method.getAnnotation(EventuateCommandHandler.class)); annotatedMethods.forEach((method, eventuateCommandHandler) -> eventuateCommandDispatcher.registerHandlerMethod(bean, eventuateCommandHandler, method)); return bean;
Class<?> targetClass = AopUtils.getTargetClass(bean); Map<Method, EventuateCommandHandler> annotatedMethods = MethodIntrospector.selectMethods(targetClass, (MethodIntrospector.MetadataLookup<EventuateCommandHandler>) method -> method.getAnnotation(EventuateCommandHandler.class)); return annotatedMethods.entrySet().stream() .map( entry -> new CommandHandlerInfo(bean, entry.getValue(), entry.getKey())) .collect(Collectors.toList());
aaec9041cf5c07c1c82c56a1d384d131716c23c4
Merge Parameter
Merge Parameter [method : Method, eventuateDomainEventHandler : EventuateDomainEventHandler] to eventHandler : EventuateDomainEventHandlerInfo in method public registerHandlerMethod(eventHandler EventuateDomainEventHandlerInfo) : void from class io.eventuate.tram.spring.events.subscriber.EventuateDomainEventDispatcher
public registerHandlerMethod(bean Object, eventuateDomainEventHandler EventuateDomainEventHandler, method Method) : void
public registerHandlerMethod(eventHandler EventuateDomainEventHandlerInfo) : void
registerHandlerMethod
registerHandlerMethod
bean Object, eventuateDomainEventHandler EventuateDomainEventHandler, method Method
eventHandler EventuateDomainEventHandlerInfo
void
void
logger.info("Registering event handler method: {}", method); EventuateDomainEventHandlerMethodValidator.validateEventHandlerMethod(method, eventuateDomainEventHandler); eventHandlers.add(new EventuateDomainEventHandlerInfo(bean, eventuateDomainEventHandler, method));
logger.info("Registering event handler method: {}", eventHandler); EventuateDomainEventHandlerMethodValidator.validateEventHandlerMethod(eventHandler.getMethod(), eventHandler.getEventuateDomainEventHandler()); eventHandlers.add(eventHandler);
aaec9041cf5c07c1c82c56a1d384d131716c23c4
Extract Method
Extract Method public eventHandlersFromBean(bean Object) : List<EventuateDomainEventHandlerInfo> extracted from public postProcessAfterInitialization(bean Object, beanName String) : Object in class io.eventuate.tram.spring.events.subscriber.EventuateDomainEventHandlerBeanPostProcessor
public postProcessAfterInitialization(bean Object, beanName String) : Object
public eventHandlersFromBean(bean Object) : List<EventuateDomainEventHandlerInfo>
postProcessAfterInitialization
eventHandlersFromBean
bean Object, beanName String
bean Object
Object
List<EventuateDomainEventHandlerInfo>
Class<?> targetClass = AopUtils.getTargetClass(bean); Map<Method, EventuateDomainEventHandler> annotatedMethods = MethodIntrospector.selectMethods(targetClass, (MethodIntrospector.MetadataLookup<EventuateDomainEventHandler>) method -> method.getAnnotation(EventuateDomainEventHandler.class)); annotatedMethods.forEach((method, eventuateDomainEventHandler) -> { EventuateDomainEventHandlerMethodValidator.validateEventHandlerMethod(method, eventuateDomainEventHandler); eventuateDomainEventDispatcher.registerHandlerMethod(bean, eventuateDomainEventHandler, method); }); return bean;
Class<?> targetClass = AopUtils.getTargetClass(bean); Map<Method, EventuateDomainEventHandler> annotatedMethods = MethodIntrospector.selectMethods(targetClass, (MethodIntrospector.MetadataLookup<EventuateDomainEventHandler>) method -> method.getAnnotation(EventuateDomainEventHandler.class)); return annotatedMethods.entrySet().stream() .map( entry -> new EventuateDomainEventHandlerInfo(bean, entry.getValue(), entry.getKey())) .collect(Collectors.toList());
a60799c7face3a0b4dfecc62eccaa0aee4bf373b
Rename Method
Rename Method public extractCommandClass(method Method) : Class<? extends Command> renamed to public extractTypeParameter(method Method) : Class<?> in class io.eventuate.tram.common.TypeParameterExtractor
public extractCommandClass(method Method) : Class<? extends Command>
public extractTypeParameter(method Method) : Class<?>
extractCommandClass
extractTypeParameter
method Method
method Method
Class<? extends Command>
Class<?>
Type[] parameterTypes = method.getGenericParameterTypes(); if (parameterTypes.length == 0) { throw new IllegalArgumentException("Method must have at least one parameter"); } Type firstParam = parameterTypes[0]; if (!(firstParam instanceof ParameterizedType)) { throw new IllegalArgumentException("First parameter must be a generic type"); } ParameterizedType parameterizedType = (ParameterizedType) firstParam; Type[] typeArguments = parameterizedType.getActualTypeArguments(); if (typeArguments.length == 0) { throw new IllegalArgumentException("First parameter must have a type argument"); } Type typeArg = typeArguments[0]; if (!(typeArg instanceof Class<?>)) { throw new IllegalArgumentException("Type argument must be a class"); } Class<?> commandType = (Class<?>) typeArg; if (!Command.class.isAssignableFrom(commandType)) { throw new IllegalArgumentException("Command type must implement Command interface"); } @SuppressWarnings("unchecked") Class<? extends Command> result = (Class<? extends Command>) commandType; return result;
Type[] parameterTypes = method.getGenericParameterTypes(); if (parameterTypes.length == 0) { throw new IllegalArgumentException("Method must have at least one parameter"); } Type firstParam = parameterTypes[0]; if (!(firstParam instanceof ParameterizedType)) { throw new IllegalArgumentException("First parameter must be a generic type"); } ParameterizedType parameterizedType = (ParameterizedType) firstParam; Type[] typeArguments = parameterizedType.getActualTypeArguments(); if (typeArguments.length == 0) { throw new IllegalArgumentException("First parameter must have a type argument"); } Type typeArg = typeArguments[0]; if (!(typeArg instanceof Class<?>)) { throw new IllegalArgumentException("Type argument must be a class"); } return (Class<?>) typeArg;
a60799c7face3a0b4dfecc62eccaa0aee4bf373b
Change Return Type
Change Return Type Class<? extends Command> to Class<?> in method public extractTypeParameter(method Method) : Class<?> from class io.eventuate.tram.common.TypeParameterExtractor
public extractCommandClass(method Method) : Class<? extends Command>
public extractTypeParameter(method Method) : Class<?>
extractCommandClass
extractTypeParameter
method Method
method Method
Class<? extends Command>
Class<?>
Type[] parameterTypes = method.getGenericParameterTypes(); if (parameterTypes.length == 0) { throw new IllegalArgumentException("Method must have at least one parameter"); } Type firstParam = parameterTypes[0]; if (!(firstParam instanceof ParameterizedType)) { throw new IllegalArgumentException("First parameter must be a generic type"); } ParameterizedType parameterizedType = (ParameterizedType) firstParam; Type[] typeArguments = parameterizedType.getActualTypeArguments(); if (typeArguments.length == 0) { throw new IllegalArgumentException("First parameter must have a type argument"); } Type typeArg = typeArguments[0]; if (!(typeArg instanceof Class<?>)) { throw new IllegalArgumentException("Type argument must be a class"); } Class<?> commandType = (Class<?>) typeArg; if (!Command.class.isAssignableFrom(commandType)) { throw new IllegalArgumentException("Command type must implement Command interface"); } @SuppressWarnings("unchecked") Class<? extends Command> result = (Class<? extends Command>) commandType; return result;
Type[] parameterTypes = method.getGenericParameterTypes(); if (parameterTypes.length == 0) { throw new IllegalArgumentException("Method must have at least one parameter"); } Type firstParam = parameterTypes[0]; if (!(firstParam instanceof ParameterizedType)) { throw new IllegalArgumentException("First parameter must be a generic type"); } ParameterizedType parameterizedType = (ParameterizedType) firstParam; Type[] typeArguments = parameterizedType.getActualTypeArguments(); if (typeArguments.length == 0) { throw new IllegalArgumentException("First parameter must have a type argument"); } Type typeArg = typeArguments[0]; if (!(typeArg instanceof Class<?>)) { throw new IllegalArgumentException("Type argument must be a class"); } return (Class<?>) typeArg;
a60799c7face3a0b4dfecc62eccaa0aee4bf373b
Rename Method
Rename Method public shouldExtractCommandClass() : void renamed to public shouldExtractTypeParameter() : void in class io.eventuate.tram.common.test.TypeParameterExtractorTest
public shouldExtractCommandClass() : void
public shouldExtractTypeParameter() : void
shouldExtractCommandClass
shouldExtractTypeParameter
void
void
Method method = getClass().getMethod("handleCommand", CommandMessage.class); Class<? extends Command> commandClass = CommandClassExtractor.extractCommandClass(method); assertEquals(ReserveCreditCommand.class, commandClass);
Method method = getClass().getMethod("handleCommand", CommandMessage.class); Class<?> commandClass = TypeParameterExtractor.extractTypeParameter(method); assertEquals(ReserveCreditCommand.class, commandClass);
a60799c7face3a0b4dfecc62eccaa0aee4bf373b
Modify Method Annotation
Modify Method Annotation @Test to @Test(expected = IllegalArgumentException.class) in method public shouldFailForMethodWithoutParameters() : void from class io.eventuate.tram.common.test.TypeParameterExtractorTest
public shouldFailForMethodWithoutParameters() : void
public shouldFailForMethodWithoutParameters() : void
shouldFailForMethodWithoutParameters
shouldFailForMethodWithoutParameters
void
void
Method method = getClass().getMethod("handleCommandWithoutGenericType", String.class); assertThrows(IllegalArgumentException.class, () -> CommandClassExtractor.extractCommandClass(method));
Method method = getClass().getMethod("handleCommandWithoutGenericType", String.class); TypeParameterExtractor.extractTypeParameter(method);
19dd280412108ad8a758fb39041e6683aed2958f
Rename Method
Rename Method public getEventuateCommandHandler() : EventuateCommandHandler renamed to public getSubscriberId() : String in class io.eventuate.tram.spring.commands.consumer.CommandHandlerInfo
public getEventuateCommandHandler() : EventuateCommandHandler
public getSubscriberId() : String
getEventuateCommandHandler
getSubscriberId
EventuateCommandHandler
String
return eventuateCommandHandler;
return subscriberId;
19dd280412108ad8a758fb39041e6683aed2958f
Change Return Type
Change Return Type EventuateCommandHandler to String in method public getSubscriberId() : String from class io.eventuate.tram.spring.commands.consumer.CommandHandlerInfo
public getEventuateCommandHandler() : EventuateCommandHandler
public getSubscriberId() : String
getEventuateCommandHandler
getSubscriberId
EventuateCommandHandler
String
return eventuateCommandHandler;
return subscriberId;
b9316590d2abcb792d051f6c3054702a995c8df3
Add Method Annotation
Add Method Annotation @Before in method public setUp() : void from class io.eventuate.tram.spring.events.subscriber.EventuateDomainEventDispatcherTest
public setUp() : void
public setUp() : void
setUp
setUp
void
void
domainEventDispatcherFactory = mock(DomainEventDispatcherFactory.class); dispatcher = new EventuateDomainEventDispatcher(domainEventDispatcherFactory);
domainEventDispatcherFactory = mock(DomainEventDispatcherFactory.class); dispatcher = new EventuateDomainEventDispatcher(domainEventDispatcherFactory);
b9316590d2abcb792d051f6c3054702a995c8df3
Remove Method Annotation
Remove Method Annotation @BeforeEach in method public setUp() : void from class io.eventuate.tram.spring.events.subscriber.EventuateDomainEventDispatcherTest
public setUp() : void
public setUp() : void
setUp
setUp
void
void
domainEventDispatcherFactory = mock(DomainEventDispatcherFactory.class); dispatcher = new EventuateDomainEventDispatcher(domainEventDispatcherFactory);
domainEventDispatcherFactory = mock(DomainEventDispatcherFactory.class); dispatcher = new EventuateDomainEventDispatcher(domainEventDispatcherFactory);
b9316590d2abcb792d051f6c3054702a995c8df3
Move Method
Move Method private extractEventClass(method Method) : Class<? extends DomainEvent> from class io.eventuate.tram.spring.events.subscriber.EventuateDomainEventDispatcher to private extractEventClass(method Method) : Class<? extends DomainEvent> from class io.eventuate.tram.spring.events.subscriber.EventuateDomainEventHandlerInfo
private extractEventClass(method Method) : Class<? extends DomainEvent>
private extractEventClass(method Method) : Class<? extends DomainEvent>
extractEventClass
extractEventClass
method Method
method Method
Class<? extends DomainEvent>
Class<? extends DomainEvent>
Type[] parameterTypes = method.getGenericParameterTypes(); if (parameterTypes.length != 1 || !(parameterTypes[0] instanceof ParameterizedType)) { throw new RuntimeException("Event handler method must have exactly one parameter of type DomainEventEnvelope<T extends DomainEvent>"); } ParameterizedType parameterType = (ParameterizedType) parameterTypes[0]; if (!DomainEventEnvelope.class.equals(parameterType.getRawType())) { throw new RuntimeException("Event handler method parameter must be of type DomainEventEnvelope<T extends DomainEvent>"); } Type[] typeArguments = parameterType.getActualTypeArguments(); if (typeArguments.length != 1 || !(typeArguments[0] instanceof Class)) { throw new RuntimeException("Invalid event type parameter"); } Class<?> eventClass = (Class<?>) typeArguments[0]; if (!DomainEvent.class.isAssignableFrom(eventClass)) { throw new RuntimeException("Event type must extend DomainEvent"); } return (Class<? extends DomainEvent>) eventClass;
if (method.getParameterCount() != 1) { throw new IllegalArgumentException("Event handler method must have exactly one parameter"); } Type parameterType = method.getGenericParameterTypes()[0]; if (!(parameterType instanceof ParameterizedType)) { throw new IllegalArgumentException("Event handler method parameter must be parameterized DomainEventEnvelope"); } Type eventType = ((ParameterizedType) parameterType).getActualTypeArguments()[0]; if (!(eventType instanceof Class)) { throw new IllegalArgumentException("Event type parameter must be a class"); } Class<?> eventClass = (Class<?>) eventType; if (!DomainEvent.class.isAssignableFrom(eventClass)) { throw new IllegalArgumentException("Event type must implement DomainEvent"); } return (Class<? extends DomainEvent>) eventClass;
7ca075de0fd91ffffb2cbd386dcd42ef12b87dd2
Add Method Annotation
Add Method Annotation @ConditionalOnMissingBean(CommandProducer.class) in method public commandProducer(messageProducer MessageProducer, channelMapping ChannelMapping, commandNameMapping CommandNameMapping) : CommandProducer from class io.eventuate.tram.spring.commands.producer.TramCommandProducerConfiguration
public commandProducer(messageProducer MessageProducer, channelMapping ChannelMapping, commandNameMapping CommandNameMapping) : CommandProducer
public commandProducer(messageProducer MessageProducer, channelMapping ChannelMapping, commandNameMapping CommandNameMapping) : CommandProducer
commandProducer
commandProducer
messageProducer MessageProducer, channelMapping ChannelMapping, commandNameMapping CommandNameMapping
messageProducer MessageProducer, channelMapping ChannelMapping, commandNameMapping CommandNameMapping
CommandProducer
CommandProducer
return new CommandProducerImpl(messageProducer, commandNameMapping);
return new CommandProducerImpl(messageProducer, commandNameMapping);
9f25bf3cd4c3e79f84ea6d9dcdc39af3577ba6fc
Split Parameter
Split Parameter eventuateDomainEventHandler : EventuateDomainEventHandler to [subscriberId : String, channel : String] in method public make(target Object, subscriberId String, channel String, method Method) : EventuateDomainEventHandlerInfo from class io.eventuate.tram.spring.events.subscriber.EventuateDomainEventHandlerInfo
public make(target Object, eventuateDomainEventHandler EventuateDomainEventHandler, method Method) : EventuateDomainEventHandlerInfo
public make(target Object, subscriberId String, channel String, method Method) : EventuateDomainEventHandlerInfo
make
make
target Object, eventuateDomainEventHandler EventuateDomainEventHandler, method Method
target Object, subscriberId String, channel String, method Method
EventuateDomainEventHandlerInfo
EventuateDomainEventHandlerInfo
if (target == null) { throw new IllegalArgumentException("target cannot be null"); } if (eventuateDomainEventHandler == null) { throw new IllegalArgumentException("eventuateDomainEventHandler cannot be null"); } if (method == null) { throw new IllegalArgumentException("method cannot be null"); } Class<? extends DomainEvent> eventClass = extractEventClass(method); return new EventuateDomainEventHandlerInfo(target, eventuateDomainEventHandler, method, eventClass);
if (target == null) { throw new EventuateDomainEventHandlerValidationException("target cannot be null"); } if (subscriberId == null || subscriberId.trim().isEmpty()) { throw new EventuateDomainEventHandlerValidationException("subscriberId cannot be null or empty"); } if (channel == null || channel.trim().isEmpty()) { throw new EventuateDomainEventHandlerValidationException("channel cannot be null or empty"); } if (method == null) { throw new EventuateDomainEventHandlerValidationException("method cannot be null"); } Class<? extends DomainEvent> eventClass = extractEventClass(method); return new EventuateDomainEventHandlerInfo(target, subscriberId, channel, method, eventClass);
9f25bf3cd4c3e79f84ea6d9dcdc39af3577ba6fc
Rename Method
Rename Method private validateAnnotationAttributes(annotation EventuateDomainEventHandler) : void renamed to private validateHandlerAttributes(subscriberId String, channel String) : void in class io.eventuate.tram.spring.events.subscriber.EventuateDomainEventHandlerMethodValidator
private validateAnnotationAttributes(annotation EventuateDomainEventHandler) : void
private validateHandlerAttributes(subscriberId String, channel String) : void
validateAnnotationAttributes
validateHandlerAttributes
annotation EventuateDomainEventHandler
subscriberId String, channel String
void
void
if (annotation.subscriberId().trim().isEmpty()) { throw new EventuateDomainEventHandlerValidationException("subscriberId must not be empty"); } if (annotation.channel().trim().isEmpty()) { throw new EventuateDomainEventHandlerValidationException("channel must not be empty"); }
if (subscriberId == null || subscriberId.trim().isEmpty()) { throw new EventuateDomainEventHandlerValidationException("subscriberId must not be empty"); } if (channel == null || channel.trim().isEmpty()) { throw new EventuateDomainEventHandlerValidationException("channel must not be empty"); }
9f25bf3cd4c3e79f84ea6d9dcdc39af3577ba6fc
Add Parameter
Add Parameter subscriberId : String in method private validateHandlerAttributes(subscriberId String, channel String) : void from class io.eventuate.tram.spring.events.subscriber.EventuateDomainEventHandlerMethodValidator
private validateAnnotationAttributes(annotation EventuateDomainEventHandler) : void
private validateHandlerAttributes(subscriberId String, channel String) : void
validateAnnotationAttributes
validateHandlerAttributes
annotation EventuateDomainEventHandler
subscriberId String, channel String
void
void
if (annotation.subscriberId().trim().isEmpty()) { throw new EventuateDomainEventHandlerValidationException("subscriberId must not be empty"); } if (annotation.channel().trim().isEmpty()) { throw new EventuateDomainEventHandlerValidationException("channel must not be empty"); }
if (subscriberId == null || subscriberId.trim().isEmpty()) { throw new EventuateDomainEventHandlerValidationException("subscriberId must not be empty"); } if (channel == null || channel.trim().isEmpty()) { throw new EventuateDomainEventHandlerValidationException("channel must not be empty"); }
9f25bf3cd4c3e79f84ea6d9dcdc39af3577ba6fc
Add Parameter
Add Parameter channel : String in method private validateHandlerAttributes(subscriberId String, channel String) : void from class io.eventuate.tram.spring.events.subscriber.EventuateDomainEventHandlerMethodValidator
private validateAnnotationAttributes(annotation EventuateDomainEventHandler) : void
private validateHandlerAttributes(subscriberId String, channel String) : void
validateAnnotationAttributes
validateHandlerAttributes
annotation EventuateDomainEventHandler
subscriberId String, channel String
void
void
if (annotation.subscriberId().trim().isEmpty()) { throw new EventuateDomainEventHandlerValidationException("subscriberId must not be empty"); } if (annotation.channel().trim().isEmpty()) { throw new EventuateDomainEventHandlerValidationException("channel must not be empty"); }
if (subscriberId == null || subscriberId.trim().isEmpty()) { throw new EventuateDomainEventHandlerValidationException("subscriberId must not be empty"); } if (channel == null || channel.trim().isEmpty()) { throw new EventuateDomainEventHandlerValidationException("channel must not be empty"); }
9f25bf3cd4c3e79f84ea6d9dcdc39af3577ba6fc
Remove Parameter
Remove Parameter annotation : EventuateDomainEventHandler in method private validateAnnotationAttributes(annotation EventuateDomainEventHandler) : void from class io.eventuate.tram.spring.events.subscriber.EventuateDomainEventHandlerMethodValidator
private validateAnnotationAttributes(annotation EventuateDomainEventHandler) : void
private validateHandlerAttributes(subscriberId String, channel String) : void
validateAnnotationAttributes
validateHandlerAttributes
annotation EventuateDomainEventHandler
subscriberId String, channel String
void
void
if (annotation.subscriberId().trim().isEmpty()) { throw new EventuateDomainEventHandlerValidationException("subscriberId must not be empty"); } if (annotation.channel().trim().isEmpty()) { throw new EventuateDomainEventHandlerValidationException("channel must not be empty"); }
if (subscriberId == null || subscriberId.trim().isEmpty()) { throw new EventuateDomainEventHandlerValidationException("subscriberId must not be empty"); } if (channel == null || channel.trim().isEmpty()) { throw new EventuateDomainEventHandlerValidationException("channel must not be empty"); }
9f25bf3cd4c3e79f84ea6d9dcdc39af3577ba6fc
Merge Variable
Merge Variable [method : Method, annotation : EventuateDomainEventHandler] to info : EventuateDomainEventHandlerInfo in method public shouldValidateCorrectHandler() : void from class io.eventuate.tram.spring.events.subscriber.EventuateDomainEventHandlerMethodValidatorTest
public shouldValidateCorrectHandler() : void
public shouldValidateCorrectHandler() : void
shouldValidateCorrectHandler
shouldValidateCorrectHandler
void
void
Method method = ValidHandler.class.getMethod("handleEvent", DomainEventEnvelope.class); EventuateDomainEventHandler annotation = mock(EventuateDomainEventHandler.class); when(annotation.subscriberId()).thenReturn("test"); when(annotation.channel()).thenReturn("test"); try { EventuateDomainEventHandlerMethodValidator.validateEventHandlerMethod(method, annotation); } catch (Exception e) { fail("Should not throw exception: " + e.getMessage()); }
Method method = ValidHandler.class.getMethod("handleEvent", DomainEventEnvelope.class); ValidHandler handler = new ValidHandler(); EventuateDomainEventHandlerInfo info = EventuateDomainEventHandlerInfo.make(handler, "test", "test", method); try { EventuateDomainEventHandlerMethodValidator.validateEventHandlerMethod(info); } catch (Exception e) { fail("Should not throw exception: " + e.getMessage()); }
9f25bf3cd4c3e79f84ea6d9dcdc39af3577ba6fc
Change Thrown Exception Type
Change Thrown Exception Type NoSuchMethodException to Exception in method public shouldValidateCorrectHandler() : void from class io.eventuate.tram.spring.events.subscriber.EventuateDomainEventHandlerMethodValidatorTest
public shouldValidateCorrectHandler() : void
public shouldValidateCorrectHandler() : void
shouldValidateCorrectHandler
shouldValidateCorrectHandler
void
void
Method method = ValidHandler.class.getMethod("handleEvent", DomainEventEnvelope.class); EventuateDomainEventHandler annotation = mock(EventuateDomainEventHandler.class); when(annotation.subscriberId()).thenReturn("test"); when(annotation.channel()).thenReturn("test"); try { EventuateDomainEventHandlerMethodValidator.validateEventHandlerMethod(method, annotation); } catch (Exception e) { fail("Should not throw exception: " + e.getMessage()); }
Method method = ValidHandler.class.getMethod("handleEvent", DomainEventEnvelope.class); ValidHandler handler = new ValidHandler(); EventuateDomainEventHandlerInfo info = EventuateDomainEventHandlerInfo.make(handler, "test", "test", method); try { EventuateDomainEventHandlerMethodValidator.validateEventHandlerMethod(info); } catch (Exception e) { fail("Should not throw exception: " + e.getMessage()); }
9f25bf3cd4c3e79f84ea6d9dcdc39af3577ba6fc
Merge Variable
Merge Variable [method : Method, annotation : EventuateDomainEventHandler] to info : EventuateDomainEventHandlerInfo in method public shouldRejectNonPublicHandler() : void from class io.eventuate.tram.spring.events.subscriber.EventuateDomainEventHandlerMethodValidatorTest
public shouldRejectNonPublicHandler() : void
public shouldRejectNonPublicHandler() : void
shouldRejectNonPublicHandler
shouldRejectNonPublicHandler
void
void
Method method = NonPublicHandler.class.getDeclaredMethod("handleEvent", DomainEventEnvelope.class); EventuateDomainEventHandler annotation = mock(EventuateDomainEventHandler.class); when(annotation.subscriberId()).thenReturn("test"); when(annotation.channel()).thenReturn("test"); EventuateDomainEventHandlerMethodValidator.validateEventHandlerMethod(method, annotation);
Method method = NonPublicHandler.class.getDeclaredMethod("handleEvent", DomainEventEnvelope.class); NonPublicHandler handler = new NonPublicHandler(); EventuateDomainEventHandlerInfo info = EventuateDomainEventHandlerInfo.make(handler, "test", "test", method); EventuateDomainEventHandlerMethodValidator.validateEventHandlerMethod(info);
9f25bf3cd4c3e79f84ea6d9dcdc39af3577ba6fc
Change Thrown Exception Type
Change Thrown Exception Type NoSuchMethodException to Exception in method public shouldRejectNonPublicHandler() : void from class io.eventuate.tram.spring.events.subscriber.EventuateDomainEventHandlerMethodValidatorTest
public shouldRejectNonPublicHandler() : void
public shouldRejectNonPublicHandler() : void
shouldRejectNonPublicHandler
shouldRejectNonPublicHandler
void
void
Method method = NonPublicHandler.class.getDeclaredMethod("handleEvent", DomainEventEnvelope.class); EventuateDomainEventHandler annotation = mock(EventuateDomainEventHandler.class); when(annotation.subscriberId()).thenReturn("test"); when(annotation.channel()).thenReturn("test"); EventuateDomainEventHandlerMethodValidator.validateEventHandlerMethod(method, annotation);
Method method = NonPublicHandler.class.getDeclaredMethod("handleEvent", DomainEventEnvelope.class); NonPublicHandler handler = new NonPublicHandler(); EventuateDomainEventHandlerInfo info = EventuateDomainEventHandlerInfo.make(handler, "test", "test", method); EventuateDomainEventHandlerMethodValidator.validateEventHandlerMethod(info);
9f25bf3cd4c3e79f84ea6d9dcdc39af3577ba6fc
Merge Variable
Merge Variable [method : Method, annotation : EventuateDomainEventHandler] to info : EventuateDomainEventHandlerInfo in method public shouldRejectWrongParameterType() : void from class io.eventuate.tram.spring.events.subscriber.EventuateDomainEventHandlerMethodValidatorTest
public shouldRejectWrongParameterType() : void
public shouldRejectWrongParameterType() : void
shouldRejectWrongParameterType
shouldRejectWrongParameterType
void
void
Method method = WrongParameterTypeHandler.class.getMethod("handleEvent", TestEvent.class); EventuateDomainEventHandler annotation = mock(EventuateDomainEventHandler.class); when(annotation.subscriberId()).thenReturn("test"); when(annotation.channel()).thenReturn("test"); EventuateDomainEventHandlerMethodValidator.validateEventHandlerMethod(method, annotation);
Method method = WrongParameterTypeHandler.class.getMethod("handleEvent", TestEvent.class); WrongParameterTypeHandler handler = new WrongParameterTypeHandler(); EventuateDomainEventHandlerInfo info = EventuateDomainEventHandlerInfo.make(handler, "test", "test", method); EventuateDomainEventHandlerMethodValidator.validateEventHandlerMethod(info);
9f25bf3cd4c3e79f84ea6d9dcdc39af3577ba6fc
Change Thrown Exception Type
Change Thrown Exception Type NoSuchMethodException to Exception in method public shouldRejectWrongParameterType() : void from class io.eventuate.tram.spring.events.subscriber.EventuateDomainEventHandlerMethodValidatorTest
public shouldRejectWrongParameterType() : void
public shouldRejectWrongParameterType() : void
shouldRejectWrongParameterType
shouldRejectWrongParameterType
void
void
Method method = WrongParameterTypeHandler.class.getMethod("handleEvent", TestEvent.class); EventuateDomainEventHandler annotation = mock(EventuateDomainEventHandler.class); when(annotation.subscriberId()).thenReturn("test"); when(annotation.channel()).thenReturn("test"); EventuateDomainEventHandlerMethodValidator.validateEventHandlerMethod(method, annotation);
Method method = WrongParameterTypeHandler.class.getMethod("handleEvent", TestEvent.class); WrongParameterTypeHandler handler = new WrongParameterTypeHandler(); EventuateDomainEventHandlerInfo info = EventuateDomainEventHandlerInfo.make(handler, "test", "test", method); EventuateDomainEventHandlerMethodValidator.validateEventHandlerMethod(info);
9f25bf3cd4c3e79f84ea6d9dcdc39af3577ba6fc
Merge Variable
Merge Variable [method : Method, annotation : EventuateDomainEventHandler] to info : EventuateDomainEventHandlerInfo in method public shouldRejectRawType() : void from class io.eventuate.tram.spring.events.subscriber.EventuateDomainEventHandlerMethodValidatorTest
public shouldRejectRawType() : void
public shouldRejectRawType() : void
shouldRejectRawType
shouldRejectRawType
void
void
Method method = RawTypeHandler.class.getMethod("handleEvent", DomainEventEnvelope.class); EventuateDomainEventHandler annotation = mock(EventuateDomainEventHandler.class); when(annotation.subscriberId()).thenReturn("test"); when(annotation.channel()).thenReturn("test"); EventuateDomainEventHandlerMethodValidator.validateEventHandlerMethod(method, annotation);
Method method = RawTypeHandler.class.getMethod("handleEvent", DomainEventEnvelope.class); RawTypeHandler handler = new RawTypeHandler(); EventuateDomainEventHandlerInfo info = EventuateDomainEventHandlerInfo.make(handler, "test", "test", method); EventuateDomainEventHandlerMethodValidator.validateEventHandlerMethod(info);
9f25bf3cd4c3e79f84ea6d9dcdc39af3577ba6fc
Change Thrown Exception Type
Change Thrown Exception Type NoSuchMethodException to Exception in method public shouldRejectRawType() : void from class io.eventuate.tram.spring.events.subscriber.EventuateDomainEventHandlerMethodValidatorTest
public shouldRejectRawType() : void
public shouldRejectRawType() : void
shouldRejectRawType
shouldRejectRawType
void
void
Method method = RawTypeHandler.class.getMethod("handleEvent", DomainEventEnvelope.class); EventuateDomainEventHandler annotation = mock(EventuateDomainEventHandler.class); when(annotation.subscriberId()).thenReturn("test"); when(annotation.channel()).thenReturn("test"); EventuateDomainEventHandlerMethodValidator.validateEventHandlerMethod(method, annotation);
Method method = RawTypeHandler.class.getMethod("handleEvent", DomainEventEnvelope.class); RawTypeHandler handler = new RawTypeHandler(); EventuateDomainEventHandlerInfo info = EventuateDomainEventHandlerInfo.make(handler, "test", "test", method); EventuateDomainEventHandlerMethodValidator.validateEventHandlerMethod(info);
9f25bf3cd4c3e79f84ea6d9dcdc39af3577ba6fc
Merge Variable
Merge Variable [method : Method, annotation : EventuateDomainEventHandler] to info : EventuateDomainEventHandlerInfo in method public shouldRejectEmptySubscriberId() : void from class io.eventuate.tram.spring.events.subscriber.EventuateDomainEventHandlerMethodValidatorTest
public shouldRejectEmptySubscriberId() : void
public shouldRejectEmptySubscriberId() : void
shouldRejectEmptySubscriberId
shouldRejectEmptySubscriberId
void
void
Method method = ValidHandler.class.getMethod("handleEvent", DomainEventEnvelope.class); EventuateDomainEventHandler annotation = mock(EventuateDomainEventHandler.class); when(annotation.subscriberId()).thenReturn(""); when(annotation.channel()).thenReturn("test"); EventuateDomainEventHandlerMethodValidator.validateEventHandlerMethod(method, annotation);
Method method = ValidHandler.class.getMethod("handleEvent", DomainEventEnvelope.class); ValidHandler handler = new ValidHandler(); EventuateDomainEventHandlerInfo info = EventuateDomainEventHandlerInfo.make(handler, "", "test", method); EventuateDomainEventHandlerMethodValidator.validateEventHandlerMethod(info);
9f25bf3cd4c3e79f84ea6d9dcdc39af3577ba6fc
Change Thrown Exception Type
Change Thrown Exception Type NoSuchMethodException to Exception in method public shouldRejectEmptySubscriberId() : void from class io.eventuate.tram.spring.events.subscriber.EventuateDomainEventHandlerMethodValidatorTest
public shouldRejectEmptySubscriberId() : void
public shouldRejectEmptySubscriberId() : void
shouldRejectEmptySubscriberId
shouldRejectEmptySubscriberId
void
void
Method method = ValidHandler.class.getMethod("handleEvent", DomainEventEnvelope.class); EventuateDomainEventHandler annotation = mock(EventuateDomainEventHandler.class); when(annotation.subscriberId()).thenReturn(""); when(annotation.channel()).thenReturn("test"); EventuateDomainEventHandlerMethodValidator.validateEventHandlerMethod(method, annotation);
Method method = ValidHandler.class.getMethod("handleEvent", DomainEventEnvelope.class); ValidHandler handler = new ValidHandler(); EventuateDomainEventHandlerInfo info = EventuateDomainEventHandlerInfo.make(handler, "", "test", method); EventuateDomainEventHandlerMethodValidator.validateEventHandlerMethod(info);
9f25bf3cd4c3e79f84ea6d9dcdc39af3577ba6fc
Merge Variable
Merge Variable [method : Method, annotation : EventuateDomainEventHandler] to info : EventuateDomainEventHandlerInfo in method public shouldRejectEmptyChannel() : void from class io.eventuate.tram.spring.events.subscriber.EventuateDomainEventHandlerMethodValidatorTest
public shouldRejectEmptyChannel() : void
public shouldRejectEmptyChannel() : void
shouldRejectEmptyChannel
shouldRejectEmptyChannel
void
void
Method method = ValidHandler.class.getMethod("handleEvent", DomainEventEnvelope.class); EventuateDomainEventHandler annotation = mock(EventuateDomainEventHandler.class); when(annotation.subscriberId()).thenReturn("test"); when(annotation.channel()).thenReturn(""); EventuateDomainEventHandlerMethodValidator.validateEventHandlerMethod(method, annotation);
Method method = ValidHandler.class.getMethod("handleEvent", DomainEventEnvelope.class); ValidHandler handler = new ValidHandler(); EventuateDomainEventHandlerInfo info = EventuateDomainEventHandlerInfo.make(handler, "test", "", method); EventuateDomainEventHandlerMethodValidator.validateEventHandlerMethod(info);
9f25bf3cd4c3e79f84ea6d9dcdc39af3577ba6fc
Change Thrown Exception Type
Change Thrown Exception Type NoSuchMethodException to Exception in method public shouldRejectEmptyChannel() : void from class io.eventuate.tram.spring.events.subscriber.EventuateDomainEventHandlerMethodValidatorTest
public shouldRejectEmptyChannel() : void
public shouldRejectEmptyChannel() : void
shouldRejectEmptyChannel
shouldRejectEmptyChannel
void
void
Method method = ValidHandler.class.getMethod("handleEvent", DomainEventEnvelope.class); EventuateDomainEventHandler annotation = mock(EventuateDomainEventHandler.class); when(annotation.subscriberId()).thenReturn("test"); when(annotation.channel()).thenReturn(""); EventuateDomainEventHandlerMethodValidator.validateEventHandlerMethod(method, annotation);
Method method = ValidHandler.class.getMethod("handleEvent", DomainEventEnvelope.class); ValidHandler handler = new ValidHandler(); EventuateDomainEventHandlerInfo info = EventuateDomainEventHandlerInfo.make(handler, "test", "", method); EventuateDomainEventHandlerMethodValidator.validateEventHandlerMethod(info);
c1b5be1d9c70fa2f05791df5500fa074fc348c93
Add Method Annotation
Add Method Annotation @BeforeEach in method public createCustomDB() : void from class io.eventuate.tram.commands.db.broker.integrationtests.TramCommandsDBBrokerIntegrationCustomDBTest
public createCustomDB() : void
public createCustomDB() : void
createCustomDB
createCustomDB
void
void
customDBCreator.create();
customDBCreator.create();
c1b5be1d9c70fa2f05791df5500fa074fc348c93
Remove Method Annotation
Remove Method Annotation @Before in method public createCustomDB() : void from class io.eventuate.tram.commands.db.broker.integrationtests.TramCommandsDBBrokerIntegrationCustomDBTest
public createCustomDB() : void
public createCustomDB() : void
createCustomDB
createCustomDB
void
void
customDBCreator.create();
customDBCreator.create();
c1b5be1d9c70fa2f05791df5500fa074fc348c93
Add Method Annotation
Add Method Annotation @BeforeEach in method public setup() : void from class io.eventuate.tram.commands.AbstractCommandDispatchingTests
public setup() : void
public setup() : void
setup
setup
void
void
CommandHandlers commandHandlers = defineCommandHandlers(); inMemoryCommands = InMemoryCommands.make(commandHandlers, inMemoryMessaging);
CommandHandlers commandHandlers = defineCommandHandlers(); inMemoryCommands = InMemoryCommands.make(commandHandlers, inMemoryMessaging);
c1b5be1d9c70fa2f05791df5500fa074fc348c93
Remove Method Annotation
Remove Method Annotation @Before in method public setup() : void from class io.eventuate.tram.commands.AbstractCommandDispatchingTests
public setup() : void
public setup() : void
setup
setup
void
void
CommandHandlers commandHandlers = defineCommandHandlers(); inMemoryCommands = InMemoryCommands.make(commandHandlers, inMemoryMessaging);
CommandHandlers commandHandlers = defineCommandHandlers(); inMemoryCommands = InMemoryCommands.make(commandHandlers, inMemoryMessaging);
c1b5be1d9c70fa2f05791df5500fa074fc348c93
Add Method Annotation
Add Method Annotation @BeforeEach in method public setup() : void from class io.eventuate.tram.commands.CommandDispatchingTests
public setup() : void
public setup() : void
setup
setup
void
void
super.setup(); testMessageConsumer = TestMessageConsumer.subscribeTo(inMemoryMessaging.messageConsumer, replyTo);
super.setup(); testMessageConsumer = TestMessageConsumer.subscribeTo(inMemoryMessaging.messageConsumer, replyTo);
c1b5be1d9c70fa2f05791df5500fa074fc348c93
Add Method Annotation
Add Method Annotation @BeforeEach in method public setup() : void from class io.eventuate.tram.commands.consumer.CommandDispatcherTest
public setup() : void
public setup() : void
setup
setup
void
void
when(commandNameMapping.commandToExternalCommandType(any(TestCommand.class))).thenReturn(externalCommandName); when(commandNameMapping.externalCommandTypeToCommandClassName(externalCommandName)).thenReturn(TestCommand.class.getName()); when(commandNameMapping.commandToExternalCommandType(any(TestNotification.class))).thenReturn(externalNotificationName); when(commandNameMapping.externalCommandTypeToCommandClassName(externalNotificationName)).thenReturn(TestNotification.class.getName()); dispatcher = new CommandDispatcher(commandDispatcherId, defineCommandHandlers(target), messageConsumer, commandNameMapping, new CommandReplyProducer(messageProducer));
when(commandNameMapping.commandToExternalCommandType(any(TestCommand.class))).thenReturn(externalCommandName); when(commandNameMapping.externalCommandTypeToCommandClassName(externalCommandName)).thenReturn(TestCommand.class.getName()); when(commandNameMapping.commandToExternalCommandType(any(TestNotification.class))).thenReturn(externalNotificationName); when(commandNameMapping.externalCommandTypeToCommandClassName(externalNotificationName)).thenReturn(TestNotification.class.getName()); dispatcher = new CommandDispatcher(commandDispatcherId, defineCommandHandlers(target), messageConsumer, commandNameMapping, new CommandReplyProducer(messageProducer));
c1b5be1d9c70fa2f05791df5500fa074fc348c93
Remove Method Annotation
Remove Method Annotation @Before in method public setup() : void from class io.eventuate.tram.commands.consumer.CommandDispatcherTest
public setup() : void
public setup() : void
setup
setup
void
void
when(commandNameMapping.commandToExternalCommandType(any(TestCommand.class))).thenReturn(externalCommandName); when(commandNameMapping.externalCommandTypeToCommandClassName(externalCommandName)).thenReturn(TestCommand.class.getName()); when(commandNameMapping.commandToExternalCommandType(any(TestNotification.class))).thenReturn(externalNotificationName); when(commandNameMapping.externalCommandTypeToCommandClassName(externalNotificationName)).thenReturn(TestNotification.class.getName()); dispatcher = new CommandDispatcher(commandDispatcherId, defineCommandHandlers(target), messageConsumer, commandNameMapping, new CommandReplyProducer(messageProducer));
when(commandNameMapping.commandToExternalCommandType(any(TestCommand.class))).thenReturn(externalCommandName); when(commandNameMapping.externalCommandTypeToCommandClassName(externalCommandName)).thenReturn(TestCommand.class.getName()); when(commandNameMapping.commandToExternalCommandType(any(TestNotification.class))).thenReturn(externalNotificationName); when(commandNameMapping.externalCommandTypeToCommandClassName(externalNotificationName)).thenReturn(TestNotification.class.getName()); dispatcher = new CommandDispatcher(commandDispatcherId, defineCommandHandlers(target), messageConsumer, commandNameMapping, new CommandReplyProducer(messageProducer));
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
9