Add interfaces for workspace, other yamls.#212
Conversation
Current coverage is 88.40% (diff: 82.83%)@@ master #212 diff @@
==========================================
Files 26 31 +5
Lines 888 923 +35
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
- Hits 822 816 -6
- Misses 52 91 +39
- Partials 14 16 +2
|
Having the interfaces for each type in it's own package was fine when it is the only one imported via it's "base" package. However, when you import all of them as in workspace, you have to start aliasing the package names and that's just sloppy.
|
@afeld yeppp.. I did it again. this is a mega elephant patch. A lot of it is moving files around though. Details above. This PR was one of those that started off one way then turned 90 degrees to something else so it was hard to break it up. Now that it's done, I can do that now. Let me know and I'll start to break this up later. Not a huge priority now so I'll get to it later probably. |
| import ( | ||
| "testing" | ||
| "github.com/opencontrol/compliance-masonry/lib/mocks" | ||
| commonMocks"github.com/opencontrol/compliance-masonry/lib/common/mocks" |
|
A few pieces of general feedback:
Sorry for the slow turnaround on the review, by the way!
If it's not hard, that would be good! |
Yeah, I agree. There are some things like |
|
@jcscottiii Are you planning to rebase this one (sooner or later) or should we just close it? |
|
Bump! |
|
Let's close this. The other recent PRs have been just parts of this one. On Mon, Oct 3, 2016, 5:50 PM Aidan Feldman notifications@github.com wrote:
|
To enable inter-operability between different versions of different things like standards and certifications (opencontrol.yaml and component.yaml already has it) and easy mocking, this patch introduces the use of more interfaces. Also, this patch introduces workspace interface which enables for external plugins to easily test by just using the interface to mock instead of worrying about fixtures.
Major Additions:
Certifications,Control,Standard,Workspaceto thecommonpackageComponent,Satisfies, andSectionto thecommonpackageComponent,Satisfies,Certifications,Control,Section,Standard,WorkspaceStandardto it's own package for future versioning and loading by versions.libpackage.Certificationto it's own package for future versioning and loading by versions.libpackageOther changes:
StandardsandComponentsand their methods private.Actual logic changes:
GetImplementationStatusesreturned an empty array. It should return the implementation status if it's there.For future PR:
verificationstocommonpackage.workspaceto also be added tocommonwithout creating a circular dependency chain.Excerpt from
lib/README.md:Lib Package
This package (and the sub packages) are the only packages that should be imported by external projects. This lib package is very helpful for those writing plugins to extend the functionality of Masonry.
WorkspaceWorkspace is the starting point for all the information available to plugins. For those using Go plugins, using the interface methods are all you need. It represents all the information collected into the
opencontrolsfolder after running thegetcommand.YAML files
The yaml files are represented by:
ComponentsCertificationsStandardsResult Data
Justificationsis a data structure that is not represented in yaml but rather a post-processed map of data to help quickly getting component data for a particular control name - standard name combination.Plugin Developer Guide
Developers should not have to worry about loading real data / workspaces for their unit tests (they should for integration tests).
There is an example of developing your Go plugin and tests in
exampleplugin/example.goandexampleplugin/example_test.gorespectively.