Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/10 gateway extension test #12

Merged
merged 15 commits into from
Jan 29, 2020

Conversation

sandjelkovic
Copy link
Member

This PR will resolve #10

  • Added gateway tests.
  • Added Mockk as mocking library
  • Refactored visibility of Gateway extensions to allow them to be visible.
  • Created and extracted CombiningCommandCallback for easier testability

Copy link
Member

@smcvb smcvb left a comment

Choose a reason for hiding this comment

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

Massive bunch of documentation arguments. Think those should be resolved prior to my approval. Conceptually, I do not see any issues with the provided code, hence I am not being harsh we a "request changes".

Comment on lines 2 to 18
* #%L
* Axon Framework - Kotlin Extension
* %%
* Copyright (C) 2019 AxonIQ
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
Copy link
Member

Choose a reason for hiding this comment

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

Are the #, % and L characters intended in the copyright notice?

Copy link
Member Author

Choose a reason for hiding this comment

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

For now, I updated all of the headers manually.
The license headers with these characters were generated by the license-maven-plugin configured here and here

Created #14 to look into this in more detail.

import org.axonframework.messaging.MetaData

/**
* Implementation of the [CommandCallback] that is appropriate for dedicated [onError] and [onSuccess] callbacks
Copy link
Member

Choose a reason for hiding this comment

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

Do we want to point out the authors of a class for this extension?

import org.axonframework.messaging.MetaData

/**
* Implementation of the [CommandCallback] that is appropriate for dedicated [onError] and [onSuccess] callbacks
Copy link
Member

Choose a reason for hiding this comment

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

Do we have a milestone/version plan for this extension? Or, differently put, wouldn't a @since tag (or KotlinDocs equivalent) be in place?

Copy link
Member Author

Choose a reason for hiding this comment

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

Created #18 to handle this topic

import org.axonframework.commandhandling.CommandMessage
import org.axonframework.commandhandling.gateway.CommandGateway
import org.axonframework.messaging.MetaData
import java.util.concurrent.TimeUnit

/**
* Extension for command gateway.
* Callback-style send with dedicated on-success and on-error functions (defaults do nothing)
Copy link
Member

Choose a reason for hiding this comment

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

This is still an extension function of the CommandGateway it's send(C, CommandCallback<? super C, ? super R>), right? I think the documentation should specify that, as well as linking to the original method's documentation with the bracket ([CommandGateway.send] notation.

private val exceptionalCommandResultMessage = GenericCommandResultMessage.asCommandResultMessage<String>(CommandDispatchException("Exception message"))
private val metaData = MetaData.with("key", "value")

@Test
Copy link
Member

Choose a reason for hiding this comment

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

Should've told you earlier (so sorry for this), but the framework has moved to JUnit 5 entirely at the moment and the majority of the Kafka Extension has been adjusted. Might be beneficial take this stance for the Kotlin extension too.


}

private class ExampleQuery(val value: Number)
Copy link
Member

Choose a reason for hiding this comment

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

Super nit: shouldn't this be a data class too?

Comment on lines 1 to 19
/*-
* #%L
* Axon Framework - Kotlin Extension
* %%
* Copyright (C) 2019 AxonIQ
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
Copy link
Member

Choose a reason for hiding this comment

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

Are the #, % and L characters intended in the copyright notice?

import org.axonframework.messaging.responsetypes.ResponseType
import java.util.*

internal fun <T> MockKVerificationScope.responseTypeOfMatcher(clazz: Class<T>) = match { type: ResponseType<T> -> type.expectedResponseType == clazz }
Copy link
Member

Choose a reason for hiding this comment

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

I think these methods deserve some documentation.

Copy link
Member

@smcvb smcvb left a comment

Choose a reason for hiding this comment

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

Looks good to me 👍

@@ -19,43 +19,28 @@
*/
package org.axonframework.extensions.kotlin

import org.axonframework.commandhandling.CommandCallback
import org.axonframework.commandhandling.CommandMessage
import org.axonframework.commandhandling.gateway.CommandGateway
import org.axonframework.messaging.MetaData
import java.util.concurrent.TimeUnit

Copy link
Member

Choose a reason for hiding this comment

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

I am trusting in your expertise here @sandjelkovic. Thus, removing it should be fine then.

@sandjelkovic sandjelkovic merged commit e2c67a7 into master Jan 29, 2020
@sandjelkovic sandjelkovic deleted the feature/10-gateway-extension-test branch August 7, 2020 09:12
@smcvb smcvb added this to the Release 0.1.0 milestone Aug 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Gateway extensions tests
3 participants