Skip to content
This repository has been archived by the owner on Mar 27, 2024. It is now read-only.

feat: Framework Init - base template with Outbound transport config #88

Merged
merged 1 commit into from
Aug 14, 2019

Conversation

rolsonquadras
Copy link
Contributor

  • Add New(opts) function which takes in the options to configuration
  • Support outbound transport configuration

Closes #78

Signed-off-by: Rolson Quadras [email protected]

@codecov-io
Copy link

codecov-io commented Aug 12, 2019

Codecov Report

Merging #88 into master will increase coverage by 0.47%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #88      +/-   ##
==========================================
+ Coverage   91.91%   92.39%   +0.47%     
==========================================
  Files          19       23       +4     
  Lines         668      710      +42     
==========================================
+ Hits          614      656      +42     
  Misses         30       30              
  Partials       24       24
Impacted Files Coverage Δ
pkg/framework/aries/default.go 100% <100%> (ø)
...ework/aries/factory/transport/transport_factory.go 100% <100%> (ø)
pkg/framework/aries/framework.go 100% <100%> (ø)
pkg/didcomm/protocol/exchange/exchange.go 87.87% <100%> (+0.78%) ⬆️
pkg/framework/context/context.go 100% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b74857f...2002cc4. Read the comment docs.

@troyronda troyronda added the enhancement New feature or request label Aug 12, 2019
@rolsonquadras rolsonquadras force-pushed the issue-78 branch 3 times, most recently from e7224c2 to 2265127 Compare August 13, 2019 13:55
@rolsonquadras rolsonquadras force-pushed the issue-78 branch 2 times, most recently from 10f3e05 to f4a9ffc Compare August 13, 2019 19:54
require.Error(t, exClient.SendExchangeRequest(req, ""))
}

type mockTransportProviderFactory struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

can we move all mocks to common pkg if possible?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@troyronda @Baha-sk @fqutishat thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

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

What is meant by “all mocks”? I generally think mocks should be near its real implementation.

// New initializes the Aries framework based on the set of options provided.
func New(opts ...Option) (*Aries, error) {
// get the default framework options
defOpts := defFrameworkOpts()
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a thought.
Not sure about having default factory settings as opts, if someone passes custom opts then we may have duplicate opts. It may work here in this case due to order of opts. Need proper test cases to see if overriding actually works (I can see in one of the test you passed mock transport factory), just to be at safe side we shouldn't pass default settings as opts.

Instead at line number 28, initialize Aries struct with default opts.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was done based on comments.

Copy link
Contributor

@sudeshrshetty sudeshrshetty Aug 14, 2019

Choose a reason for hiding this comment

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

Fine for me if order of opts are intact.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes order of opts needs to be kept intact.

pkg/didcomm/protocol/exchange/exchange.go Show resolved Hide resolved
pkg/didcomm/protocol/exchange/exchange.go Outdated Show resolved Hide resolved
pkg/didcomm/protocol/exchange/exchange.go Outdated Show resolved Hide resolved
frameworkOpts := &Aries{}

// generate framework configs from options
for _, option := range append(defOpts, opts...) {
Copy link
Contributor

Choose a reason for hiding this comment

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

defOpts has default and append opts to it may duplicate options, this can lead to unexpected behaviour

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The second opts(user opts) will overwrite the defOpts.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes - second opt can override.

The other way around this type of problem seems to be to force framework users to pass the default option, rather than implicitly include as the first option. This has its own negative trade-off, of course.

Copy link
Contributor

@troyronda troyronda Aug 14, 2019

Choose a reason for hiding this comment

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

Perhaps we could also introduce a functional argument like WithoutDefaults(). Created #110.

pkg/didcomm/protocol/exchange/exchange.go Outdated Show resolved Hide resolved
pkg/didcomm/protocol/exchange/exchange.go Outdated Show resolved Hide resolved
frameworkOpts := &Aries{}

// generate framework configs from options
for _, option := range append(defOpts, opts...) {
Copy link
Contributor

@troyronda troyronda Aug 14, 2019

Choose a reason for hiding this comment

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

Perhaps we could also introduce a functional argument like WithoutDefaults(). Created #110.

- Add New(opts) function which takes in the options to configuration
- Support outbound transport configuration

Signed-off-by: Rolson Quadras <[email protected]>
@troyronda
Copy link
Contributor

troyronda commented Aug 14, 2019

BTW: I am wondering if we should have this package directly under pkg (since it is effectively the default entry point for developers). The argument for being under framework is also good - i.e., it is a framework :). Something to think about anyways (#114).

@troyronda troyronda merged commit 295e217 into hyperledger-archives:master Aug 14, 2019
@rolsonquadras rolsonquadras deleted the issue-78 branch August 14, 2019 21:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Development

Successfully merging this pull request may close these issues.

Framework Init - base template with Outbound transport config
8 participants