Beispiel #1
0
 def _resolve_project(self):
     projects = [(x, y) for x, y in self.find_all(kind='project')]
     if len(projects) == 0:
         raise mustard.MustardError('No project defined')
     elif len(projects) > 1:
         raise mustard.MustardError(
             '%s project nodes found: %r' %
             (len(projects), [x for x, y in projects]))
     else:
         self.project = projects[0][1]
Beispiel #2
0
 def _resolve_parent_work_item(self, path, item):
     ref = item.parent[0]
     if ref in self.elements:
         item.parent = (ref, self.elements[ref])
         if item.parent[1].kind != 'work-item':
             raise mustard.MustardError(
                 '%s is referencing %s (kind: %s) as its parent, but '
                 'work items may only have work items as their parent' %
                 (path, ref, item.parent[1].kind))
         self.elements[ref].work_items[path] = item
Beispiel #3
0
 def _resolve_parent_requirement(self, path, requirement):
     ref = requirement.parent[0]
     if ref in self.elements:
         requirement.parent = (ref, self.elements[ref])
         if requirement.parent[1].kind != 'requirement':
             raise mustard.MustardError(
                 '%s is listing %s (kind: %s) as its parent, but '
                 'requirements may only have requirements as parents' %
                 (path, ref, requirement.parent[1].kind))
         self.elements[ref].subrequirements[path] = requirement
Beispiel #4
0
 def __init__(self, data):
     mustard.elementfactory.Element.__init__(self, data)
     self.kind = 'project'
     self.copyright = data.get('copyright', None)
     self.predefined_filters = data.get('predefined-filters', [])
     self.sort_by = data.get('sort-by', 'location')
     if self.sort_by not in valid_sort_by:
         raise mustard.MustardError(
             "Unknown sort-by (%s) in project node. "
             "Possible sort-by options are: %s" %
             (self.sort_by, ", ".join(valid_sort_by)))
Beispiel #5
0
 def _resolve_parent_component(self, path, element):
     ref = element.parent[0]
     if ref in self.elements:
         if self.elements[ref].kind != 'component':
             raise mustard.MustardError(
                 '%s (kind: %s) has %s (kind: %s) as a parent, but may '
                 'only be parented to a component.' %
                 (path, element.kind, ref, self.elements[ref].kind))
         if element.kind == 'component':
             self.elements[ref].components[path] = element
         elif element.kind == 'interface':
             self.elements[ref].interfaces[path] = element
         elif element.kind == 'integration-strategy':
             if hasattr(self.elements[ref], 'integration_strategy') and \
                     self.elements[ref].integration_strategy[1] is not None:
                 raise mustard.MustardError(
                     '%s is attempting to be the integration strategy for '
                     '%s which already has %s as its integration strategy.'
                     % (path, ref,
                        self.elements[ref].integration_strategy[0]))
             self.elements[ref].integration_strategy = (path, element)
         element.parent = (ref, self.elements[ref])
Beispiel #6
0
 def _resolve_criterion_parent(self, path, element):
     ref = element.parent[0]
     if ref in self.elements:
         if self.elements[ref].kind == 'requirement':
             self.elements[ref].mapped_to[path] = element
         else:
             if not hasattr(self.elements[ref], 'verificationcriteria'):
                 raise mustard.MustardError(
                     '%s incorrectly refers to %s (kind: %s) which '
                     'cannot have verification criteria' %
                     (path, ref, self.elements[ref].kind))
             self.elements[ref].verificationcriteria[path] = element
         element.parent = (ref, self.elements[ref])