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

Added custom ApplicationSetting so apps can add their on configuration values #29

Closed
wants to merge 1 commit into from

Conversation

lenny-goodell
Copy link
Member

No description provided.

edgexSdk.LoggingClient.Error("ApplicationName application settings not found")
}
} else {
edgexSdk.LoggingClient.Error("No application settings not found")
Copy link
Member

Choose a reason for hiding this comment

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

Should this return?

Copy link
Member Author

@lenny-goodell lenny-goodell Mar 11, 2019

Choose a reason for hiding this comment

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

For the example I didn't think it was necessary to return so that the example will still run.

Copy link
Member Author

Choose a reason for hiding this comment

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

Adding exit... ;-)

if ok {
edgexSdk.LoggingClient.Info(fmt.Sprintf("%s now running...", appName))
} else {
edgexSdk.LoggingClient.Error("ApplicationName application settings not found")
Copy link
Member

Choose a reason for hiding this comment

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

Should this return?

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 the example I didn't think it was necessary to return so that the example will still run.

Copy link
Member Author

Choose a reason for hiding this comment

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

Adding exit

if ok {
edgexSdk.LoggingClient.Info(fmt.Sprintf("%s now running...", appName))
} else {
edgexSdk.LoggingClient.Error("ApplicationName application settings not found")
Copy link
Member

Choose a reason for hiding this comment

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

Should this return?

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 the example I didn't think it was necessary to return so that the example will still run.

Copy link
Member Author

Choose a reason for hiding this comment

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

Adding exit

edgexSdk.LoggingClient.Error("ApplicationName application settings not found")
}
} else {
edgexSdk.LoggingClient.Error("No application settings not found")
Copy link
Member

Choose a reason for hiding this comment

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

Should this return?

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 the example I didn't think it was necessary to return so that the example will still run.

Copy link
Member Author

Choose a reason for hiding this comment

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

Adding exit

sdk := AppFunctionsSDK {}

sdk.configDir = "../../examples/simple-filter-xml/res"
err := sdk.initializeConfiguration()
Copy link
Member

@tsconn23 tsconn23 Mar 11, 2019

Choose a reason for hiding this comment

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

Not sure I'm fond of a unit test relying on the file system...

Copy link
Member Author

Choose a reason for hiding this comment

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

No much choice here since it needs to load the toml file.

Copy link
Member

Choose a reason for hiding this comment

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

Is this something that really needs to be unit tested? It's bootstrapping logic, not business logic. It's like unit testing a DI container. Is there going to be a mock RegistryClient added too then to cover if sdk.useRegistry {?

Copy link
Member Author

Choose a reason for hiding this comment

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

The purpose was to validate that the new custom section in the toml file was un-marshed as expected. So useRegistry is out of scope.

Copy link
Member Author

Choose a reason for hiding this comment

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

BTW, the test is for sdk.ApplicationSettings(). Calling initilizeConfiguration() is part of the test setup.

Copy link
Member Author

@lenny-goodell lenny-goodell Mar 12, 2019

Choose a reason for hiding this comment

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

@tsconn23 , FYI, the device-sdk-go is doing similar load from local file for their test.
https://github.com/edgexfoundry/device-sdk-go/blob/master/internal/config/loader_test.go#L113
I choose to not create a local test toml file since the one in the example has what is needed.

edgexSdk.LoggingClient.Error("ApplicationName application settings not found")
}
} else {
edgexSdk.LoggingClient.Error("No application settings not found")
Copy link
Member

Choose a reason for hiding this comment

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

Double negative :) "No Application settings not found"?

@lenny-goodell
Copy link
Member Author

recheck

@lenny-goodell
Copy link
Member Author

recheck

1 similar comment
@lenny-goodell
Copy link
Member Author

recheck

…n values

Signed-off-by: lenny-intel <leonard.goodell@intel.com>
@lenny-goodell lenny-goodell reopened this Mar 15, 2019
@lenny-goodell
Copy link
Member Author

Closing PR due to issues and will re-create.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants