本文整理汇总了Golang中github.com/opencontrol/compliance-masonry/models/components/versions/base.Component.GetResponsibleRole方法的典型用法代码示例。如果您正苦于以下问题:Golang Component.GetResponsibleRole方法的具体用法?Golang Component.GetResponsibleRole怎么用?Golang Component.GetResponsibleRole使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/opencontrol/compliance-masonry/models/components/versions/base.Component
的用法示例。
在下文中一共展示了Component.GetResponsibleRole方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: testSet
func testSet(example base.Component, actual base.Component, t *testing.T) {
// Check that the key was loaded
if example.GetKey() != actual.GetKey() {
t.Errorf("Expected %s, Actual: %s", example.GetKey(), actual.GetKey())
}
// Check that the name was loaded
if example.GetName() != actual.GetName() {
t.Errorf("Expected %s, Actual: %s", example.GetName(), actual.GetName())
}
// Check that the schema version was loaded
if example.GetVersion().NE(actual.GetVersion()) {
t.Errorf("Expected %f, Actual: %f", example.GetVersion(), actual.GetVersion())
}
// Check that the references were loaded
if example.GetReferences().Len() != actual.GetReferences().Len() {
t.Errorf("Expected %d, Actual: %d", example.GetReferences().Len(), actual.GetReferences().Len())
}
// Check that the satisfies data was loaded
if len(example.GetAllSatisfies()) != len(actual.GetAllSatisfies()) {
t.Errorf("Expected %d, Actual: %d", len(example.GetAllSatisfies()), len(actual.GetAllSatisfies()))
}
// Check Narratives and Parameters.
for idx, _ := range actual.GetAllSatisfies() {
assert.Equal(t, (example.GetAllSatisfies())[idx].GetNarratives(), (actual.GetAllSatisfies())[idx].GetNarratives())
assert.Equal(t, (example.GetAllSatisfies())[idx].GetParameters(), (actual.GetAllSatisfies())[idx].GetParameters())
}
// Check the responsible role.
assert.Equal(t, example.GetResponsibleRole(), actual.GetResponsibleRole())
// Check that the verifications were loaded
if example.GetVerifications().Len() != actual.GetVerifications().Len() {
t.Errorf("Expected %d, Actual: %d", example.GetVerifications().Len(), actual.GetVerifications())
}
}
示例2: getResponsibleRoleInfo
// getResponsibleRoleInfo will just print the responsible role if it exists.
func getResponsibleRoleInfo(text string, component base.Component) string {
// Add the component name.
text = fmt.Sprintf("%s%s: ", text, component.GetName())
// Print out the component name and the responsible for that component.
if component.GetResponsibleRole() != "" {
return fmt.Sprintf("%s%s\n", text, component.GetResponsibleRole())
}
// Else, print warning indicating there was no info.
return fmt.Sprintf("%s%s\n", text, constants.WarningNoInformationAvailable)
}
示例3: getResponsibleRole
func (openControl *OpenControlGitBook) getResponsibleRole(text string, component base.Component) string {
if component.GetResponsibleRole() != "" {
text = fmt.Sprintf("%s\n##### Responsible Role: %s\n", text, component.GetResponsibleRole())
}
return text
}