Exemple #1
0
 def existingGoalParameters(self):
   goalName = self.decorator.getText("goalNameCtrl")
   modifiedProperties = self.environmentProperties()
   goalEnvProperties = self.dbProxy.goalEnvironmentProperties(self.theGoalId)
   for idx,p in enumerate(goalEnvProperties):
     if (p.name() == self.theEnvironmentName):
       goalEnvProperties[idx] = modifiedProperties
   parameters = GoalParameters(goalName,'None',[],goalEnvProperties) 
   parameters.setId(self.theGoalId)
   return parameters
Exemple #2
0
  def testGoal(self):
    b = Borg()
    igep1 = GoalEnvironmentProperties(self.iGoals[0]["theEnvironmentProperties"][0],self.iGoals[0]["theEnvironmentProperties"][1],self.iGoals[0]["theEnvironmentProperties"][2],self.iGoals[0]["theEnvironmentProperties"][3],self.iGoals[0]["theEnvironmentProperties"][4],self.iGoals[0]["theEnvironmentProperties"][5],self.iGoals[0]["theEnvironmentProperties"][6],[],[],[self.iGoals[0]["theEnvironmentProperties"][7]],[])
    igp1 = GoalParameters(self.iGoals[0]["theName"],self.iGoals[0]["theOriginator"],[],[igep1])
    b.dbProxy.addGoal(igp1)
    oGoals = b.dbProxy.getGoals()
    og = oGoals[self.iGoals[0]["theName"]]
    self.assertEqual(igp1.name(), og.name())
    self.assertEqual(igp1.originator(), og.originator())

    b.dbProxy.deleteGoal(og.id())
Exemple #3
0
 def update_object(self, goal, name, pathValues = []):
   params = GoalParameters(goalName=goal.theName,goalOrig=goal.theOriginator,tags=goal.theTags,properties=goal.theEnvironmentProperties)
   try:
     goalId = self.db_proxy.getDimensionId(name,'goal')
     params.setId(goalId)
     self.db_proxy.updateGoal(params)
   except ObjectNotFound as ex:
     self.close()
     raise ObjectNotFoundHTTPError(ex)
   except DatabaseProxyException as ex:
     self.close()
     raise ARMHTTPError(ex)
Exemple #4
0
    def update_goal(self, goal, name):
        old_goal = self.get_goal_by_name(name, simplify=False)
        id = old_goal.theId

        params = GoalParameters(goalName=goal.theName,
                                goalOrig=goal.theOriginator,
                                tags=goal.theTags,
                                properties=goal.theEnvironmentProperties)
        params.setId(id)

        try:
            self.db_proxy.updateGoal(params)
        except DatabaseProxyException as ex:
            self.close()
            raise ARMHTTPError(ex)
Exemple #5
0
    def add(self,
            idx=-1,
            goalName="",
            envName="",
            newDefinition="",
            newCategory="Maintain",
            newPriority="Low",
            newFitCriterion="None",
            newIssue="None",
            newOriginator=""):
        envName = self.envCombo.GetValue()
        parentGoalName = self.goalCombo.GetValue()

        ep = GoalEnvironmentProperties(
            envName, '', newDefinition, newCategory, newPriority,
            newFitCriterion, newIssue,
            [(parentGoalName, 'goal', 'and', 'No', 'None')])
        g = Goal(-1, goalName, newOriginator, [], [ep])
        gp = GoalParameters(goalName, newOriginator, [], [ep])
        g.setId(self.dbProxy.addGoal(gp))
        if (idx != -1):
            self.goals.insert(idx, g)
        else:
            self.goals.append(g)
        return g
Exemple #6
0
  def update_goal(self, goal, name):
    old_goal = self.get_goal_by_name(name, simplify=False)
    id = old_goal.theId

    params = GoalParameters(
            goalName=goal.theName,
            goalOrig=goal.theOriginator,
            tags=goal.theTags,
            properties=goal.theEnvironmentProperties)
    params.setId(id)

    try:
      self.db_proxy.updateGoal(params)
    except DatabaseProxyException as ex:
      self.close()
      raise ARMHTTPError(ex)
Exemple #7
0
  def update_goal(self, goal, name):
    params = GoalParameters(
            goalName=goal.theName,
            goalOrig=goal.theOriginator,
            tags=goal.theTags,
            properties=goal.theEnvironmentProperties)

    try:
      goalId = self.db_proxy.getDimensionId(name,'goal')
      params.setId(goalId)
      self.db_proxy.updateGoal(params)
    except ObjectNotFound as ex:
      self.close()
      raise ObjectNotFoundHTTPError(ex)
    except DatabaseProxyException as ex:
      self.close()
      raise ARMHTTPError(ex)
Exemple #8
0
 def parameters(self):
     properties = GoalEnvironmentProperties(
         self.theEnvironmentName, '', self.theGoalDefinition,
         self.theGoalCategory, self.theGoalPriority,
         self.theGoalFitCriterion, self.theGoalIssues, self.theAssociations,
         self.theSubAssociations, self.theConcerns,
         self.theConcernAssociations)
     parameters = GoalParameters(self.theGoalName, self.theGoalOriginator,
                                 [], [properties])
     return parameters
Exemple #9
0
 def add_object(self, goal, pathValues = []):
   goalParams = GoalParameters(goalName=goal.theName,goalOrig=goal.theOriginator,tags=goal.theTags,properties=goal.theEnvironmentProperties)
   try:
     if not self.check_existing_goal(goal.theName):
       self.db_proxy.addGoal(goalParams)
     else:
       self.close()
       raise CairisHTTPError(status_code=http.client.BAD_REQUEST,status="Object exists",message="An object with the name " + goal.theName + " already exists.")
   except DatabaseProxyException as ex:
     self.close()
     raise ARMHTTPError(ex)
Exemple #10
0
 def getEnvironmentGoals(self, goalName, envName):
     goalRows = self.responseList('call getEnvironmentGoals(:goal,:env)', {
         'goal': goalName,
         'env': envName
     }, 'MySQL error getting goals')
     oals = []
     for goalId, goalName, goalOrig in goalRows:
         environmentProperties = self.goalEnvironmentProperties(goalId)
         parameters = GoalParameters(goalName, goalOrig, [],
                                     self.goalEnvironmentProperties(goalId))
         goal = cairis.core.ObjectFactory.build(goalId, parameters)
         goals.append(goal)
     return goals
Exemple #11
0
    def add_goal(self, goal):
        goalParams = GoalParameters(goalName=goal.theName,
                                    goalOrig=goal.theOriginator,
                                    tags=goal.theTags,
                                    properties=goal.theEnvironmentProperties)

        if not self.check_existing_goal(goal.theName):
            goal_id = self.db_proxy.addGoal(goalParams)
        else:
            self.close()
            raise OverwriteNotAllowedHTTPError('The provided goal name')

        return goal_id
Exemple #12
0
 def add_goal(self, goal):
     goalParams = GoalParameters(goalName=goal.theName,
                                 goalOrig=goal.theOriginator,
                                 tags=goal.theTags,
                                 properties=goal.theEnvironmentProperties)
     try:
         if not self.check_existing_goal(goal.theName):
             self.db_proxy.addGoal(goalParams)
         else:
             self.close()
             raise OverwriteNotAllowedHTTPError('The provided goal name')
     except DatabaseProxyException as ex:
         self.close()
         raise ARMHTTPError(ex)
    def setUp(self):
        call([os.environ['CAIRIS_CFG_DIR'] + "/initdb.sh"])
        cairis.core.BorgFactory.initialise()
        f = open(os.environ['CAIRIS_SRC'] + '/test/policy_statements.json')
        d = json.load(f)
        f.close()
        ienvs = d['environments']
        iep1 = EnvironmentParameters(ienvs[0]["theName"],
                                     ienvs[0]["theShortCode"],
                                     ienvs[0]["theDescription"])
        b = Borg()
        b.dbProxy.addEnvironment(iep1)
        iassets = d['assets']
        iaeps1 = AssetEnvironmentProperties(
            iassets[0]["theEnvironmentProperties"][0][0],
            iassets[0]["theEnvironmentProperties"][0][1],
            iassets[0]["theEnvironmentProperties"][0][2])
        iap1 = AssetParameters(iassets[0]["theName"],
                               iassets[0]["theShortCode"],
                               iassets[0]["theDescription"],
                               iassets[0]["theSignificance"],
                               iassets[0]["theType"], "0", "N/A", [], [],
                               [iaeps1])
        b.dbProxy.addAsset(iap1)
        iaeps1 = AssetEnvironmentProperties(
            iassets[1]["theEnvironmentProperties"][0][0],
            iassets[1]["theEnvironmentProperties"][0][1],
            iassets[1]["theEnvironmentProperties"][0][2])
        iap2 = AssetParameters(iassets[1]["theName"],
                               iassets[1]["theShortCode"],
                               iassets[1]["theDescription"],
                               iassets[1]["theSignificance"],
                               iassets[1]["theType"], "0", "N/A", [], [],
                               [iaeps1])
        b.dbProxy.addAsset(iap2)
        self.iGoals = d['goals']

        igep1d = GoalEnvironmentProperties(
            self.iGoals[0]["theEnvironmentProperties"][0]["theName"],
            self.iGoals[0]["theEnvironmentProperties"][0]["theLabel"],
            self.iGoals[0]["theEnvironmentProperties"][0]["theDefinition"],
            self.iGoals[0]["theEnvironmentProperties"][0]["theCategory"],
            self.iGoals[0]["theEnvironmentProperties"][0]["thePriority"],
            self.iGoals[0]["theEnvironmentProperties"][0]["theFitCriterion"],
            self.iGoals[0]["theEnvironmentProperties"][0]["theIssue"], [], [],
            self.iGoals[0]["theEnvironmentProperties"][0]["theConcerns"], [])
        igp1 = GoalParameters(self.iGoals[0]["theName"],
                              self.iGoals[0]["theOriginator"], [], [igep1d])
        b.dbProxy.addGoal(igp1)
        self.iPs = d['policy_statements']
 def endElement(self, name):
     if name == 'domainproperty':
         p = DomainPropertyParameters(unescape(self.theName),
                                      unescape(self.theDefinition),
                                      self.theType,
                                      unescape(self.theOriginator),
                                      self.theTags)
         self.theDomainProperties.append(p)
         self.resetDomainPropertyAttributes()
     elif name == 'goal_environment':
         p = GoalEnvironmentProperties(self.theEnvironmentName, '',
                                       unescape(self.theDefinition),
                                       self.theCategory, self.thePriority,
                                       unescape(self.theFitCriterion),
                                       unescape(self.theIssue), [], [],
                                       self.theConcerns,
                                       self.theConcernAssociations)
         self.theEnvironmentProperties.append(p)
         self.resetGoalEnvironmentAttributes()
     elif name == 'obstacle_environment':
         p = ObstacleEnvironmentProperties(self.theEnvironmentName, '',
                                           unescape(self.theDefinition),
                                           self.theCategory, [], [],
                                           self.theConcerns)
         p.theProbability = self.theProbability
         p.theProbabilityRationale = unescape(self.theRationale)
         self.theEnvironmentProperties.append(p)
         self.resetObstacleEnvironmentAttributes()
     elif name == 'goal':
         p = GoalParameters(unescape(self.theName),
                            unescape(self.theOriginator), self.theTags,
                            self.theEnvironmentProperties)
         self.theGoals.append(p)
         self.resetGoalAttributes()
     elif name == 'obstacle':
         p = ObstacleParameters(unescape(self.theName),
                                unescape(self.theOriginator), self.theTags,
                                self.theEnvironmentProperties)
         self.theObstacles.append(p)
         self.resetObstacleAttributes()
     elif name == 'requirement':
         reqId = self.dbProxy.newId()
         r = cairis.core.RequirementFactory.build(
             reqId, self.theLabel, unescape(self.theName),
             unescape(self.theDescription), self.thePriority,
             unescape(self.theRationale), unescape(self.theFitCriterion),
             unescape(self.theOriginator), self.theType, self.theReference)
         self.theRequirements.append(
             (r, self.theReference, self.theReferenceType))
         self.resetRequirementAttributes()
     elif name == 'exception':
         self.theCurrentStep.addException(
             (self.theExcName, self.theExcType.lower(), self.theExcValue,
              self.theExcCat, unescape(self.theDefinition)))
     elif name == 'step':
         self.theCurrentStep.setTags(self.theTags)
         self.theSteps.append(self.theCurrentStep)
         self.theCurrentStep = None
     elif name == 'usecase_environment':
         vProperty, vRationale = self.theCognitiveAttribute['vigilance']
         saProperty, saRationale = self.theCognitiveAttribute[
             'situation awareness']
         sProperty, sRationale = self.theCognitiveAttribute['stress']
         wProperty, wRationale = self.theCognitiveAttribute['workload']
         raProperty, raRationale = self.theCognitiveAttribute[
             'risk awareness']
         p = UseCaseEnvironmentProperties(
             self.theEnvironmentName, unescape(self.thePreconditions),
             self.theSteps, unescape(self.thePostconditions),
             [vProperty, saProperty, sProperty, wProperty, raProperty],
             [vRationale, saRationale, sRationale, wRationale, raRationale])
         self.theEnvironmentProperties.append(p)
         self.resetUseCaseEnvironmentAttributes()
     elif name == 'usecase':
         p = UseCaseParameters(self.theName, self.theAuthor,
                               unescape(self.theCode), self.theActors,
                               unescape(self.theDescription), self.theTags,
                               self.theEnvironmentProperties)
         self.theUseCases.append(p)
         self.resetUseCaseAttributes()
     elif name == 'countermeasure':
         p = CountermeasureParameters(self.theName,
                                      unescape(self.theDescription),
                                      self.theType, self.theTags,
                                      self.theEnvironmentProperties)
         self.theCountermeasures.append(p)
         self.resetCountermeasureAttributes()
     elif name == 'mitigating_property':
         self.theSpDict[self.thePropertyName] = (self.thePropertyValue,
                                                 unescape(
                                                     self.theDescription))
         self.resetMitigatingPropertyAttributes()
     elif name == 'countermeasure_environment':
         cProperty, cRationale = self.theSpDict['confidentiality']
         iProperty, iRationale = self.theSpDict['integrity']
         avProperty, avRationale = self.theSpDict['availability']
         acProperty, acRationale = self.theSpDict['accountability']
         anProperty, anRationale = self.theSpDict['anonymity']
         panProperty, panRationale = self.theSpDict['pseudonymity']
         unlProperty, unlRationale = self.theSpDict['unlinkability']
         unoProperty, unoRationale = self.theSpDict['unobservability']
         p = CountermeasureEnvironmentProperties(
             self.theEnvironmentName, self.theCmRequirements,
             self.theTargets, [
                 cProperty, iProperty, avProperty, acProperty, anProperty,
                 panProperty, unlProperty, unoProperty
             ], [
                 cRationale, iRationale, avRationale, acRationale,
                 anRationale, panRationale, unlRationale, unoRationale
             ], self.theCost, self.theCmRoles, self.theTaskPersonas)
         self.theEnvironmentProperties.append(p)
         self.resetCountermeasureEnvironmentAttributes()
     elif (name == 'target'):
         self.theTargets.append(
             Target(self.theTargetName, self.theTargetEffectiveness,
                    unescape(self.theRationale)))
         self.theTargetResponses = []
     elif (name == 'description'):
         self.inDescription = 0
     elif (name == 'definition'):
         self.inDefinition = 0
     elif name == 'fit_criterion':
         self.inFitCriterion = 0
     elif name == 'issue':
         self.inIssue = 0
     elif name == 'rationale':
         self.inRationale = 0
     elif name == 'originator':
         self.inOriginator = 0
     elif name == 'preconditions':
         self.inPreconditions = 0
     elif name == 'postconditions':
         self.inPostconditions = 0
Exemple #15
0
    def testGoal(self):
        b = Borg()
        igep1d = GoalEnvironmentProperties(
            self.iGoals[0]["theEnvironmentProperties"][0]["theName"],
            self.iGoals[0]["theEnvironmentProperties"][0]["theLabel"],
            self.iGoals[0]["theEnvironmentProperties"][0]["theDefinition"],
            self.iGoals[0]["theEnvironmentProperties"][0]["theCategory"],
            self.iGoals[0]["theEnvironmentProperties"][0]["thePriority"],
            self.iGoals[0]["theEnvironmentProperties"][0]["theFitCriterion"],
            self.iGoals[0]["theEnvironmentProperties"][0]["theIssue"], [], [],
            self.iGoals[0]["theEnvironmentProperties"][0]["theConcerns"], [])
        igep1n = GoalEnvironmentProperties(
            self.iGoals[0]["theEnvironmentProperties"][1]["theName"],
            self.iGoals[0]["theEnvironmentProperties"][1]["theLabel"],
            self.iGoals[0]["theEnvironmentProperties"][1]["theDefinition"],
            self.iGoals[0]["theEnvironmentProperties"][1]["theCategory"],
            self.iGoals[0]["theEnvironmentProperties"][1]["thePriority"],
            self.iGoals[0]["theEnvironmentProperties"][1]["theFitCriterion"],
            self.iGoals[0]["theEnvironmentProperties"][1]["theIssue"], [], [],
            self.iGoals[0]["theEnvironmentProperties"][1]["theConcerns"], [])

        igep2d = GoalEnvironmentProperties(
            self.iGoals[1]["theEnvironmentProperties"][0]["theName"],
            self.iGoals[1]["theEnvironmentProperties"][0]["theLabel"],
            self.iGoals[1]["theEnvironmentProperties"][0]["theDefinition"],
            self.iGoals[1]["theEnvironmentProperties"][0]["theCategory"],
            self.iGoals[1]["theEnvironmentProperties"][0]["thePriority"],
            self.iGoals[1]["theEnvironmentProperties"][0]["theFitCriterion"],
            self.iGoals[1]["theEnvironmentProperties"][0]["theIssue"], [], [],
            self.iGoals[1]["theEnvironmentProperties"][0]["theConcerns"], [])
        igep2n = GoalEnvironmentProperties(
            self.iGoals[1]["theEnvironmentProperties"][1]["theName"],
            self.iGoals[1]["theEnvironmentProperties"][1]["theLabel"],
            self.iGoals[1]["theEnvironmentProperties"][1]["theDefinition"],
            self.iGoals[1]["theEnvironmentProperties"][1]["theCategory"],
            self.iGoals[1]["theEnvironmentProperties"][1]["thePriority"],
            self.iGoals[1]["theEnvironmentProperties"][1]["theFitCriterion"],
            self.iGoals[1]["theEnvironmentProperties"][1]["theIssue"], [], [],
            self.iGoals[1]["theEnvironmentProperties"][1]["theConcerns"], [])

        igep3d = GoalEnvironmentProperties(
            self.iGoals[2]["theEnvironmentProperties"][0]["theName"],
            self.iGoals[2]["theEnvironmentProperties"][0]["theLabel"],
            self.iGoals[2]["theEnvironmentProperties"][0]["theDefinition"],
            self.iGoals[2]["theEnvironmentProperties"][0]["theCategory"],
            self.iGoals[2]["theEnvironmentProperties"][0]["thePriority"],
            self.iGoals[2]["theEnvironmentProperties"][0]["theFitCriterion"],
            self.iGoals[2]["theEnvironmentProperties"][0]["theIssue"], [], [],
            self.iGoals[2]["theEnvironmentProperties"][0]["theConcerns"], [])
        igep3n = GoalEnvironmentProperties(
            self.iGoals[2]["theEnvironmentProperties"][1]["theName"],
            self.iGoals[2]["theEnvironmentProperties"][1]["theLabel"],
            self.iGoals[2]["theEnvironmentProperties"][1]["theDefinition"],
            self.iGoals[2]["theEnvironmentProperties"][1]["theCategory"],
            self.iGoals[2]["theEnvironmentProperties"][1]["thePriority"],
            self.iGoals[2]["theEnvironmentProperties"][1]["theFitCriterion"],
            self.iGoals[2]["theEnvironmentProperties"][1]["theIssue"], [], [],
            self.iGoals[2]["theEnvironmentProperties"][1]["theConcerns"], [])
        igp1 = GoalParameters(self.iGoals[0]["theName"],
                              self.iGoals[0]["theOriginator"], [],
                              [igep1d, igep1n])
        igp2 = GoalParameters(self.iGoals[1]["theName"],
                              self.iGoals[1]["theOriginator"], [],
                              [igep2d, igep2n])
        igp3 = GoalParameters(self.iGoals[2]["theName"],
                              self.iGoals[2]["theOriginator"], [],
                              [igep3d, igep2n])
        b.dbProxy.addGoal(igp1)
        b.dbProxy.addGoal(igp2)
        b.dbProxy.addGoal(igp3)
        b.dbProxy.relabelGoals(igep1d.name())
        oGoals = b.dbProxy.getGoals()
        og1 = oGoals[self.iGoals[0]["theName"]]
        og2 = oGoals[self.iGoals[1]["theName"]]
        og3 = oGoals[self.iGoals[2]["theName"]]
        self.assertEqual(igp1.name(), og1.name())
        self.assertEqual(igp1.originator(), og1.originator())
        ogep1 = og1.environmentProperty(igep1d.name())
        ogep2 = og2.environmentProperty(igep1d.name())
        self.assertEqual(og1.refinements('Day'), False)

        self.assertEqual(igep1d.label(), ogep1.label())
        self.assertEqual(igep1d.definition(), ogep1.definition())
        self.assertEqual(
            igep1d.definition() + ' [Day].  ' + igep1d.definition() +
            ' [Night].  ', og1.definition('', 'Maximise'))
        self.assertEqual(igep1d.category(), ogep1.category())
        self.assertEqual(
            igep1d.category() + ' [Day].  ' + igep1d.category() +
            ' [Night].  ', og1.category('', 'Maximise'))
        self.assertEqual(igep1d.priority(), ogep1.priority())
        self.assertEqual(
            igep1d.priority() + ' [Day].  ' + igep1d.priority() +
            ' [Night].  ', og1.priority('', 'Maximise'))
        self.assertEqual(igep1d.fitCriterion(), ogep1.fitCriterion())
        self.assertEqual(
            igep1d.fitCriterion() + ' [Day].  ' + igep1d.fitCriterion() +
            ' [Night].  ', og1.fitCriterion('', 'Maximise'))
        self.assertEqual(igep1d.issue(), ogep1.issue())
        self.assertEqual(
            igep1d.issue() + ' [Day].  ' + igep1d.issue() + ' [Night].  ',
            og1.issue('', 'Maximise'))
        self.assertEqual(igep1d.goalRefinements(), ogep1.goalRefinements())
        self.assertEqual(igep1d.subGoalRefinements(),
                         ogep1.subGoalRefinements())
        self.assertEqual(igep1d.concerns(), ogep1.concerns())
        self.assertEqual(igep1d.concernAssociations(),
                         ogep1.concernAssociations())

        envName = self.iGoals[0]["theEnvironmentProperties"][0]['theName']
        self.assertEqual(igep1d.label(), og1.label(envName))
        self.assertEqual(igep1d.definition(), og1.definition(envName, ''))
        self.assertEqual(igep1d.category(), og1.category(envName, ''))
        self.assertEqual(igep1d.priority(), og1.priority(envName, ''))
        self.assertEqual(igep1d.fitCriterion(), og1.fitCriterion(envName, ''))
        self.assertEqual(igep1d.issue(), og1.issue(envName, ''))

        self.assertEqual(igep2d.label(), ogep2.label())
        self.assertEqual(igep2d.definition(), ogep2.definition())
        self.assertEqual(igep2d.category(), ogep2.category())
        self.assertEqual(igep2d.priority(), ogep2.priority())
        self.assertEqual(igep2d.fitCriterion(), ogep2.fitCriterion())
        self.assertEqual(igep2d.issue(), ogep2.issue())
        self.assertEqual(igep2d.goalRefinements(), ogep2.goalRefinements())
        self.assertEqual(igep2d.subGoalRefinements(),
                         ogep2.subGoalRefinements())
        self.assertEqual(igep2d.concerns(), ogep2.concerns())
        self.assertEqual(igep2d.concernAssociations(),
                         ogep2.concernAssociations())

        igop1 = GoalAssociationParameters(igep1d.name(),
                                          igp1.name(), 'goal', 'and',
                                          igp2.name(), 'goal', 0, 'None')
        igop2 = GoalAssociationParameters(igep1d.name(),
                                          igp1.name(), 'goal', 'and',
                                          igp3.name(), 'goal', 0, 'None')

        b.dbProxy.addGoalAssociation(igop1)
        b.dbProxy.addGoalAssociation(igop2)

        ogops = b.dbProxy.getGoalAssociations()
        ogop1 = ogops[igep1d.name() + '/' + igp1.name() + '/' + igp2.name() +
                      '/and']
        ogop2 = ogops[igep2d.name() + '/' + igp1.name() + '/' + igp3.name() +
                      '/and']

        self.assertEqual(igop1.environment(), ogop1.environment())
        self.assertEqual(igop1.goal(), ogop1.goal())
        self.assertEqual(igop1.goalDimension(), ogop1.goalDimension())
        self.assertEqual(igop1.type(), ogop1.type())
        self.assertEqual(igop1.subGoal(), ogop1.subGoal())
        self.assertEqual(igop1.subGoalDimension(), ogop1.subGoalDimension())
        self.assertEqual(igop1.alternative(), ogop1.alternative())
        self.assertEqual(igop1.rationale(), ogop1.rationale())

        self.assertEqual(igop2.environment(), ogop2.environment())
        self.assertEqual(igop2.goal(), ogop2.goal())
        self.assertEqual(igop2.goalDimension(), ogop2.goalDimension())
        self.assertEqual(igop2.type(), ogop2.type())
        self.assertEqual(igop2.subGoal(), ogop2.subGoal())
        self.assertEqual(igop2.subGoalDimension(), ogop2.subGoalDimension())
        self.assertEqual(igop2.alternative(), ogop2.alternative())
        self.assertEqual(igop2.rationale(), ogop2.rationale())

        b.dbProxy.deleteGoalAssociation(ogop1.id(), ogop1.goal(),
                                        ogop1.subGoal())
        b.dbProxy.deleteGoalAssociation(ogop2.id(), ogop2.goal(),
                                        ogop2.subGoal())

        b.dbProxy.deleteGoal(og1.id())
        b.dbProxy.deleteGoal(og2.id())
        b.dbProxy.deleteGoal(og3.id())
Exemple #16
0
 def newGoalParameters(self):
   goalName = self.decorator.getText("goalNameCtrl")
   envProperties = self.environmentProperties()
   parameters = GoalParameters(goalName,'None',[],[envProperties]) 
   parameters.setId(self.theGoalId)
   return parameters
Exemple #17
0
  def testGoal(self):
    b = Borg()
    igep1 = GoalEnvironmentProperties(self.iGoals[0]["theEnvironmentProperties"][0],self.iGoals[0]["theEnvironmentProperties"][1],self.iGoals[0]["theEnvironmentProperties"][2],self.iGoals[0]["theEnvironmentProperties"][3],self.iGoals[0]["theEnvironmentProperties"][4],self.iGoals[0]["theEnvironmentProperties"][5],self.iGoals[0]["theEnvironmentProperties"][6],[],[],[self.iGoals[0]["theEnvironmentProperties"][7]],[])
    igep2 = GoalEnvironmentProperties(self.iGoals[1]["theEnvironmentProperties"][0],self.iGoals[1]["theEnvironmentProperties"][1],self.iGoals[1]["theEnvironmentProperties"][2],self.iGoals[1]["theEnvironmentProperties"][3],self.iGoals[1]["theEnvironmentProperties"][4],self.iGoals[1]["theEnvironmentProperties"][5],self.iGoals[1]["theEnvironmentProperties"][6],[],[],[self.iGoals[1]["theEnvironmentProperties"][7]],[])
    igep3 = GoalEnvironmentProperties(self.iGoals[2]["theEnvironmentProperties"][0],self.iGoals[2]["theEnvironmentProperties"][1],self.iGoals[2]["theEnvironmentProperties"][2],self.iGoals[2]["theEnvironmentProperties"][3],self.iGoals[2]["theEnvironmentProperties"][4],self.iGoals[2]["theEnvironmentProperties"][5],self.iGoals[2]["theEnvironmentProperties"][6],[],[],[self.iGoals[2]["theEnvironmentProperties"][7]],[])

    igp1 = GoalParameters(self.iGoals[0]["theName"],self.iGoals[0]["theOriginator"],[],[igep1])
    igp2 = GoalParameters(self.iGoals[1]["theName"],self.iGoals[1]["theOriginator"],[],[igep2])
    igp3 = GoalParameters(self.iGoals[2]["theName"],self.iGoals[2]["theOriginator"],[],[igep3])
    b.dbProxy.addGoal(igp1)
    b.dbProxy.addGoal(igp2)
    b.dbProxy.addGoal(igp3)
    b.dbProxy.relabelGoals(igep1.name())
    oGoals = b.dbProxy.getGoals()
    og1 = oGoals[self.iGoals[0]["theName"]]
    og2 = oGoals[self.iGoals[1]["theName"]]
    og3 = oGoals[self.iGoals[2]["theName"]]
    self.assertEqual(igp1.name(), og1.name())
    self.assertEqual(igp1.originator(), og1.originator())
    ogep1 = og1.environmentProperty(igep1.name())
    ogep2 = og2.environmentProperty(igep1.name())

    self.assertEqual(igep1.label(), ogep1.label())
    self.assertEqual(igep1.definition(), ogep1.definition())
    self.assertEqual(igep1.category(), ogep1.category())
    self.assertEqual(igep1.priority(), ogep1.priority())
    self.assertEqual(igep1.fitCriterion(), ogep1.fitCriterion())
    self.assertEqual(igep1.issue(), ogep1.issue())
    self.assertEqual(igep1.goalRefinements(), ogep1.goalRefinements())
    self.assertEqual(igep1.subGoalRefinements(), ogep1.subGoalRefinements())
    self.assertEqual(igep1.concerns(), ogep1.concerns())
    self.assertEqual(igep1.concernAssociations(), ogep1.concernAssociations())

    envName = self.iGoals[0]["theEnvironmentProperties"][0]
    self.assertEqual(igep1.label(), og1.label(envName))
    self.assertEqual(igep1.definition(), og1.definition(envName,''))
    self.assertEqual(igep1.category(), og1.category(envName,''))
    self.assertEqual(igep1.priority(), og1.priority(envName,''))
    self.assertEqual(igep1.fitCriterion(), og1.fitCriterion(envName,''))
    self.assertEqual(igep1.issue(), og1.issue(envName,''))

    self.assertEqual(igep2.label(), ogep2.label())
    self.assertEqual(igep2.definition(), ogep2.definition())
    self.assertEqual(igep2.category(), ogep2.category())
    self.assertEqual(igep2.priority(), ogep2.priority())
    self.assertEqual(igep2.fitCriterion(), ogep2.fitCriterion())
    self.assertEqual(igep2.issue(), ogep2.issue())
    self.assertEqual(igep2.goalRefinements(), ogep2.goalRefinements())
    self.assertEqual(igep2.subGoalRefinements(), ogep2.subGoalRefinements())
    self.assertEqual(igep2.concerns(), ogep2.concerns())
    self.assertEqual(igep2.concernAssociations(), ogep2.concernAssociations())



    igop1 = GoalAssociationParameters(igep1.name(),igp1.name(),'goal','and',igp2.name(),'goal',0,'None')
    igop2 = GoalAssociationParameters(igep1.name(),igp1.name(),'goal','and',igp3.name(),'goal',0,'None')

    b.dbProxy.addGoalAssociation(igop1)
    b.dbProxy.addGoalAssociation(igop2)

    ogops = b.dbProxy.getGoalAssociations()
    ogop1 = ogops[igep1.name() + '/' + igp1.name() + '/' + igp2.name() + '/and']
    ogop2 = ogops[igep2.name() + '/' + igp1.name() + '/' + igp3.name() + '/and']

    self.assertEqual(igop1.environment(), ogop1.environment())
    self.assertEqual(igop1.goal(), ogop1.goal())
    self.assertEqual(igop1.goalDimension(), ogop1.goalDimension())
    self.assertEqual(igop1.type(), ogop1.type())
    self.assertEqual(igop1.subGoal(), ogop1.subGoal())
    self.assertEqual(igop1.subGoalDimension(), ogop1.subGoalDimension())
    self.assertEqual(igop1.alternative(), ogop1.alternative())
    self.assertEqual(igop1.rationale(), ogop1.rationale())

    self.assertEqual(igop2.environment(), ogop2.environment())
    self.assertEqual(igop2.goal(), ogop2.goal())
    self.assertEqual(igop2.goalDimension(), ogop2.goalDimension())
    self.assertEqual(igop2.type(), ogop2.type())
    self.assertEqual(igop2.subGoal(), ogop2.subGoal())
    self.assertEqual(igop2.subGoalDimension(), ogop2.subGoalDimension())
    self.assertEqual(igop2.alternative(), ogop2.alternative())
    self.assertEqual(igop2.rationale(), ogop2.rationale())

    b.dbProxy.deleteGoalAssociation(ogop1.id(),ogop1.goal(),ogop1.subGoal())
    b.dbProxy.deleteGoalAssociation(ogop2.id(),ogop2.goal(),ogop2.subGoal())

    b.dbProxy.deleteGoal(og1.id())
    b.dbProxy.deleteGoal(og2.id())
    b.dbProxy.deleteGoal(og3.id())
Exemple #18
0
  def testGoal(self):
    b = Borg()
    igep1d = GoalEnvironmentProperties(self.iGoals[0]["theEnvironmentProperties"][0]["theName"],self.iGoals[0]["theEnvironmentProperties"][0]["theLabel"],self.iGoals[0]["theEnvironmentProperties"][0]["theDefinition"],self.iGoals[0]["theEnvironmentProperties"][0]["theCategory"],self.iGoals[0]["theEnvironmentProperties"][0]["thePriority"],self.iGoals[0]["theEnvironmentProperties"][0]["theFitCriterion"],self.iGoals[0]["theEnvironmentProperties"][0]["theIssue"],[],[],self.iGoals[0]["theEnvironmentProperties"][0]["theConcerns"],[])
    igep1n = GoalEnvironmentProperties(self.iGoals[0]["theEnvironmentProperties"][1]["theName"],self.iGoals[0]["theEnvironmentProperties"][1]["theLabel"],self.iGoals[0]["theEnvironmentProperties"][1]["theDefinition"],self.iGoals[0]["theEnvironmentProperties"][1]["theCategory"],self.iGoals[0]["theEnvironmentProperties"][1]["thePriority"],self.iGoals[0]["theEnvironmentProperties"][1]["theFitCriterion"],self.iGoals[0]["theEnvironmentProperties"][1]["theIssue"],[],[],self.iGoals[0]["theEnvironmentProperties"][1]["theConcerns"],[])

    igep2d = GoalEnvironmentProperties(self.iGoals[1]["theEnvironmentProperties"][0]["theName"],self.iGoals[1]["theEnvironmentProperties"][0]["theLabel"],self.iGoals[1]["theEnvironmentProperties"][0]["theDefinition"],self.iGoals[1]["theEnvironmentProperties"][0]["theCategory"],self.iGoals[1]["theEnvironmentProperties"][0]["thePriority"],self.iGoals[1]["theEnvironmentProperties"][0]["theFitCriterion"],self.iGoals[1]["theEnvironmentProperties"][0]["theIssue"],[],[],self.iGoals[1]["theEnvironmentProperties"][0]["theConcerns"],[])
    igep2n = GoalEnvironmentProperties(self.iGoals[1]["theEnvironmentProperties"][1]["theName"],self.iGoals[1]["theEnvironmentProperties"][1]["theLabel"],self.iGoals[1]["theEnvironmentProperties"][1]["theDefinition"],self.iGoals[1]["theEnvironmentProperties"][1]["theCategory"],self.iGoals[1]["theEnvironmentProperties"][1]["thePriority"],self.iGoals[1]["theEnvironmentProperties"][1]["theFitCriterion"],self.iGoals[1]["theEnvironmentProperties"][1]["theIssue"],[],[],self.iGoals[1]["theEnvironmentProperties"][1]["theConcerns"],[])

    igep3d = GoalEnvironmentProperties(self.iGoals[2]["theEnvironmentProperties"][0]["theName"],self.iGoals[2]["theEnvironmentProperties"][0]["theLabel"],self.iGoals[2]["theEnvironmentProperties"][0]["theDefinition"],self.iGoals[2]["theEnvironmentProperties"][0]["theCategory"],self.iGoals[2]["theEnvironmentProperties"][0]["thePriority"],self.iGoals[2]["theEnvironmentProperties"][0]["theFitCriterion"],self.iGoals[2]["theEnvironmentProperties"][0]["theIssue"],[],[],self.iGoals[2]["theEnvironmentProperties"][0]["theConcerns"],[])
    igep3n = GoalEnvironmentProperties(self.iGoals[2]["theEnvironmentProperties"][1]["theName"],self.iGoals[2]["theEnvironmentProperties"][1]["theLabel"],self.iGoals[2]["theEnvironmentProperties"][1]["theDefinition"],self.iGoals[2]["theEnvironmentProperties"][1]["theCategory"],self.iGoals[2]["theEnvironmentProperties"][1]["thePriority"],self.iGoals[2]["theEnvironmentProperties"][1]["theFitCriterion"],self.iGoals[2]["theEnvironmentProperties"][1]["theIssue"],[],[],self.iGoals[2]["theEnvironmentProperties"][1]["theConcerns"],[])
    igp1 = GoalParameters(self.iGoals[0]["theName"],self.iGoals[0]["theOriginator"],[],[igep1d,igep1n])
    igp2 = GoalParameters(self.iGoals[1]["theName"],self.iGoals[1]["theOriginator"],[],[igep2d,igep2n])
    igp3 = GoalParameters(self.iGoals[2]["theName"],self.iGoals[2]["theOriginator"],[],[igep3d,igep2n])
    b.dbProxy.addGoal(igp1)
    b.dbProxy.addGoal(igp2)
    b.dbProxy.addGoal(igp3)
    b.dbProxy.relabelGoals(igep1d.name())
    oGoals = b.dbProxy.getGoals()
    og1 = oGoals[self.iGoals[0]["theName"]]
    og2 = oGoals[self.iGoals[1]["theName"]]
    og3 = oGoals[self.iGoals[2]["theName"]]
    self.assertEqual(igp1.name(), og1.name())
    self.assertEqual(igp1.originator(), og1.originator())
    ogep1 = og1.environmentProperty(igep1d.name())
    ogep2 = og2.environmentProperty(igep1d.name())
    self.assertEqual(og1.refinements('Day'),False)

    self.assertEqual(igep1d.label(), ogep1.label())
    self.assertEqual(igep1d.definition(), ogep1.definition())
    self.assertEqual(igep1d.definition() + ' [Day].  ' + igep1d.definition() + ' [Night].  ', og1.definition('','Maximise'))
    self.assertEqual(igep1d.category(), ogep1.category())
    self.assertEqual(igep1d.category() + ' [Day].  ' + igep1d.category() + ' [Night].  ', og1.category('','Maximise'))
    self.assertEqual(igep1d.priority(), ogep1.priority())
    self.assertEqual(igep1d.priority() + ' [Day].  ' + igep1d.priority() + ' [Night].  ', og1.priority('','Maximise'))
    self.assertEqual(igep1d.fitCriterion(), ogep1.fitCriterion())
    self.assertEqual(igep1d.fitCriterion() + ' [Day].  ' + igep1d.fitCriterion() + ' [Night].  ', og1.fitCriterion('','Maximise'))
    self.assertEqual(igep1d.issue(), ogep1.issue())
    self.assertEqual(igep1d.issue() + ' [Day].  ' + igep1d.issue() + ' [Night].  ', og1.issue('','Maximise'))
    self.assertEqual(igep1d.goalRefinements(), ogep1.goalRefinements())
    self.assertEqual(igep1d.subGoalRefinements(), ogep1.subGoalRefinements())
    self.assertEqual(igep1d.concerns(), ogep1.concerns())
    self.assertEqual(igep1d.concernAssociations(), ogep1.concernAssociations())

    envName = self.iGoals[0]["theEnvironmentProperties"][0]['theName']
    self.assertEqual(igep1d.label(), og1.label(envName))
    self.assertEqual(igep1d.definition(), og1.definition(envName,''))
    self.assertEqual(igep1d.category(), og1.category(envName,''))
    self.assertEqual(igep1d.priority(), og1.priority(envName,''))
    self.assertEqual(igep1d.fitCriterion(), og1.fitCriterion(envName,''))
    self.assertEqual(igep1d.issue(), og1.issue(envName,''))

    self.assertEqual(igep2d.label(), ogep2.label())
    self.assertEqual(igep2d.definition(), ogep2.definition())
    self.assertEqual(igep2d.category(), ogep2.category())
    self.assertEqual(igep2d.priority(), ogep2.priority())
    self.assertEqual(igep2d.fitCriterion(), ogep2.fitCriterion())
    self.assertEqual(igep2d.issue(), ogep2.issue())
    self.assertEqual(igep2d.goalRefinements(), ogep2.goalRefinements())
    self.assertEqual(igep2d.subGoalRefinements(), ogep2.subGoalRefinements())
    self.assertEqual(igep2d.concerns(), ogep2.concerns())
    self.assertEqual(igep2d.concernAssociations(), ogep2.concernAssociations())



    igop1 = GoalAssociationParameters(igep1d.name(),igp1.name(),'goal','and',igp2.name(),'goal',0,'None')
    igop2 = GoalAssociationParameters(igep1d.name(),igp1.name(),'goal','and',igp3.name(),'goal',0,'None')

    b.dbProxy.addGoalAssociation(igop1)
    b.dbProxy.addGoalAssociation(igop2)

    ogops = b.dbProxy.getGoalAssociations()
    ogop1 = ogops[igep1d.name() + '/' + igp1.name() + '/' + igp2.name() + '/and']
    ogop2 = ogops[igep2d.name() + '/' + igp1.name() + '/' + igp3.name() + '/and']

    self.assertEqual(igop1.environment(), ogop1.environment())
    self.assertEqual(igop1.goal(), ogop1.goal())
    self.assertEqual(igop1.goalDimension(), ogop1.goalDimension())
    self.assertEqual(igop1.type(), ogop1.type())
    self.assertEqual(igop1.subGoal(), ogop1.subGoal())
    self.assertEqual(igop1.subGoalDimension(), ogop1.subGoalDimension())
    self.assertEqual(igop1.alternative(), ogop1.alternative())
    self.assertEqual(igop1.rationale(), ogop1.rationale())

    self.assertEqual(igop2.environment(), ogop2.environment())
    self.assertEqual(igop2.goal(), ogop2.goal())
    self.assertEqual(igop2.goalDimension(), ogop2.goalDimension())
    self.assertEqual(igop2.type(), ogop2.type())
    self.assertEqual(igop2.subGoal(), ogop2.subGoal())
    self.assertEqual(igop2.subGoalDimension(), ogop2.subGoalDimension())
    self.assertEqual(igop2.alternative(), ogop2.alternative())
    self.assertEqual(igop2.rationale(), ogop2.rationale())

    b.dbProxy.deleteGoalAssociation(ogop1.id(),ogop1.goal(),ogop1.subGoal())
    b.dbProxy.deleteGoalAssociation(ogop2.id(),ogop2.goal(),ogop2.subGoal())

    b.dbProxy.deleteGoal(og1.id())
    b.dbProxy.deleteGoal(og2.id())
    b.dbProxy.deleteGoal(og3.id())
Exemple #19
0
    def testGoal(self):
        b = Borg()
        igep1 = GoalEnvironmentProperties(
            self.iGoals[0]["theEnvironmentProperties"][0],
            self.iGoals[0]["theEnvironmentProperties"][1],
            self.iGoals[0]["theEnvironmentProperties"][2],
            self.iGoals[0]["theEnvironmentProperties"][3],
            self.iGoals[0]["theEnvironmentProperties"][4],
            self.iGoals[0]["theEnvironmentProperties"][5],
            self.iGoals[0]["theEnvironmentProperties"][6], [], [],
            [self.iGoals[0]["theEnvironmentProperties"][7]], [])
        igep2 = GoalEnvironmentProperties(
            self.iGoals[1]["theEnvironmentProperties"][0],
            self.iGoals[1]["theEnvironmentProperties"][1],
            self.iGoals[1]["theEnvironmentProperties"][2],
            self.iGoals[1]["theEnvironmentProperties"][3],
            self.iGoals[1]["theEnvironmentProperties"][4],
            self.iGoals[1]["theEnvironmentProperties"][5],
            self.iGoals[1]["theEnvironmentProperties"][6], [], [],
            [self.iGoals[1]["theEnvironmentProperties"][7]], [])
        igep3 = GoalEnvironmentProperties(
            self.iGoals[2]["theEnvironmentProperties"][0],
            self.iGoals[2]["theEnvironmentProperties"][1],
            self.iGoals[2]["theEnvironmentProperties"][2],
            self.iGoals[2]["theEnvironmentProperties"][3],
            self.iGoals[2]["theEnvironmentProperties"][4],
            self.iGoals[2]["theEnvironmentProperties"][5],
            self.iGoals[2]["theEnvironmentProperties"][6], [], [],
            [self.iGoals[2]["theEnvironmentProperties"][7]], [])

        igp1 = GoalParameters(self.iGoals[0]["theName"],
                              self.iGoals[0]["theOriginator"], [], [igep1])
        igp2 = GoalParameters(self.iGoals[1]["theName"],
                              self.iGoals[1]["theOriginator"], [], [igep2])
        igp3 = GoalParameters(self.iGoals[2]["theName"],
                              self.iGoals[2]["theOriginator"], [], [igep3])
        b.dbProxy.addGoal(igp1)
        b.dbProxy.addGoal(igp2)
        b.dbProxy.addGoal(igp3)
        b.dbProxy.relabelGoals(igep1.name())
        oGoals = b.dbProxy.getGoals()
        og1 = oGoals[self.iGoals[0]["theName"]]
        og2 = oGoals[self.iGoals[1]["theName"]]
        og3 = oGoals[self.iGoals[2]["theName"]]
        self.assertEqual(igp1.name(), og1.name())
        self.assertEqual(igp1.originator(), og1.originator())
        ogep1 = og1.environmentProperty(igep1.name())
        ogep2 = og2.environmentProperty(igep1.name())

        self.assertEqual(igep1.label(), ogep1.label())
        self.assertEqual(igep1.definition(), ogep1.definition())
        self.assertEqual(igep1.category(), ogep1.category())
        self.assertEqual(igep1.priority(), ogep1.priority())
        self.assertEqual(igep1.fitCriterion(), ogep1.fitCriterion())
        self.assertEqual(igep1.issue(), ogep1.issue())
        self.assertEqual(igep1.goalRefinements(), ogep1.goalRefinements())
        self.assertEqual(igep1.subGoalRefinements(),
                         ogep1.subGoalRefinements())
        self.assertEqual(igep1.concerns(), ogep1.concerns())
        self.assertEqual(igep1.concernAssociations(),
                         ogep1.concernAssociations())

        envName = self.iGoals[0]["theEnvironmentProperties"][0]
        self.assertEqual(igep1.label(), og1.label(envName))
        self.assertEqual(igep1.definition(), og1.definition(envName, ''))
        self.assertEqual(igep1.category(), og1.category(envName, ''))
        self.assertEqual(igep1.priority(), og1.priority(envName, ''))
        self.assertEqual(igep1.fitCriterion(), og1.fitCriterion(envName, ''))
        self.assertEqual(igep1.issue(), og1.issue(envName, ''))

        self.assertEqual(igep2.label(), ogep2.label())
        self.assertEqual(igep2.definition(), ogep2.definition())
        self.assertEqual(igep2.category(), ogep2.category())
        self.assertEqual(igep2.priority(), ogep2.priority())
        self.assertEqual(igep2.fitCriterion(), ogep2.fitCriterion())
        self.assertEqual(igep2.issue(), ogep2.issue())
        self.assertEqual(igep2.goalRefinements(), ogep2.goalRefinements())
        self.assertEqual(igep2.subGoalRefinements(),
                         ogep2.subGoalRefinements())
        self.assertEqual(igep2.concerns(), ogep2.concerns())
        self.assertEqual(igep2.concernAssociations(),
                         ogep2.concernAssociations())

        igop1 = GoalAssociationParameters(igep1.name(),
                                          igp1.name(), 'goal', 'and',
                                          igp2.name(), 'goal', 0, 'None')
        igop2 = GoalAssociationParameters(igep1.name(),
                                          igp1.name(), 'goal', 'and',
                                          igp3.name(), 'goal', 0, 'None')

        b.dbProxy.addGoalAssociation(igop1)
        b.dbProxy.addGoalAssociation(igop2)

        ogops = b.dbProxy.getGoalAssociations()
        ogop1 = ogops[igep1.name() + '/' + igp1.name() + '/' + igp2.name() +
                      '/and']
        ogop2 = ogops[igep2.name() + '/' + igp1.name() + '/' + igp3.name() +
                      '/and']

        self.assertEqual(igop1.environment(), ogop1.environment())
        self.assertEqual(igop1.goal(), ogop1.goal())
        self.assertEqual(igop1.goalDimension(), ogop1.goalDimension())
        self.assertEqual(igop1.type(), ogop1.type())
        self.assertEqual(igop1.subGoal(), ogop1.subGoal())
        self.assertEqual(igop1.subGoalDimension(), ogop1.subGoalDimension())
        self.assertEqual(igop1.alternative(), ogop1.alternative())
        self.assertEqual(igop1.rationale(), ogop1.rationale())

        self.assertEqual(igop2.environment(), ogop2.environment())
        self.assertEqual(igop2.goal(), ogop2.goal())
        self.assertEqual(igop2.goalDimension(), ogop2.goalDimension())
        self.assertEqual(igop2.type(), ogop2.type())
        self.assertEqual(igop2.subGoal(), ogop2.subGoal())
        self.assertEqual(igop2.subGoalDimension(), ogop2.subGoalDimension())
        self.assertEqual(igop2.alternative(), ogop2.alternative())
        self.assertEqual(igop2.rationale(), ogop2.rationale())

        b.dbProxy.deleteGoalAssociation(ogop1.id(), ogop1.goal(),
                                        ogop1.subGoal())
        b.dbProxy.deleteGoalAssociation(ogop2.id(), ogop2.goal(),
                                        ogop2.subGoal())

        b.dbProxy.deleteGoal(og1.id())
        b.dbProxy.deleteGoal(og2.id())
        b.dbProxy.deleteGoal(og3.id())
Exemple #20
0
 def parameters(self):
   parameters = GoalParameters(self.theGoalName,self.theGoalOriginator,self.theTags,self.theEnvironmentProperties)
   parameters.setId(self.theGoalId)
   return parameters
Exemple #21
0
 def parameters(self):
     parameters = GoalParameters(self.theGoalName, self.theGoalOriginator,
                                 [], self.theEnvironmentProperties)
     parameters.setId(self.theGoalId)
     return parameters
Exemple #22
0
 def endElement(self, name):
     if name == 'domainproperty':
         p = DomainPropertyParameters(self.theName, self.theDescription,
                                      self.theType, self.theOriginator,
                                      self.theTags)
         self.theDomainProperties.append(p)
         self.resetDomainPropertyAttributes()
     elif name == 'goal_environment':
         p = GoalEnvironmentProperties(self.theEnvironmentName, '',
                                       self.theDescription,
                                       self.theCategory, self.thePriority,
                                       self.theFitCriterion, self.theIssue,
                                       [], [], self.theConcerns,
                                       self.theConcernAssociations)
         self.theEnvironmentProperties.append(p)
         self.resetGoalEnvironmentAttributes()
     elif name == 'obstacle_environment':
         p = ObstacleEnvironmentProperties(self.theEnvironmentName, '',
                                           self.theDescription,
                                           self.theCategory, [], [],
                                           self.theConcerns)
         self.theEnvironmentProperties.append(p)
         self.resetObstacleEnvironmentAttributes()
     elif name == 'goal':
         p = GoalParameters(self.theName, self.theOriginator, self.theTags,
                            self.theEnvironmentProperties)
         self.theGoals.append(p)
         self.resetGoalAttributes()
     elif name == 'obstacle':
         p = ObstacleParameters(self.theName, self.theOriginator,
                                self.theTags, self.theEnvironmentProperties)
         self.theObstacles.append(p)
         self.resetObstacleAttributes()
     elif name == 'requirement':
         reqId = self.dbProxy.newId()
         r = cairis.core.RequirementFactory.build(
             reqId, self.theLabel, self.theName, self.theDescription,
             self.thePriority, self.theRationale, self.theFitCriterion,
             self.theOriginator, self.theType, self.theReference)
         self.theRequirements.append(
             (r, self.theReference, self.theReferenceType))
         self.resetRequirementAttributes()
     elif name == 'countermeasure':
         p = CountermeasureParameters(self.theName, self.theDescription,
                                      self.theType, self.theTags,
                                      self.theEnvironmentProperties)
         self.theCountermeasures.append(p)
         self.resetCountermeasureAttributes()
     elif name == 'mitigating_property':
         self.theSpDict[self.thePropertyName] = (self.thePropertyValue,
                                                 self.theDescription)
         self.resetMitigatingPropertyAttributes()
     elif name == 'countermeasure_environment':
         cProperty, cRationale = self.theSpDict['confidentiality']
         iProperty, iRationale = self.theSpDict['integrity']
         avProperty, avRationale = self.theSpDict['availability']
         acProperty, acRationale = self.theSpDict['accountability']
         anProperty, anRationale = self.theSpDict['anonymity']
         panProperty, panRationale = self.theSpDict['pseudonymity']
         unlProperty, unlRationale = self.theSpDict['unlinkability']
         unoProperty, unoRationale = self.theSpDict['unobservability']
         p = CountermeasureEnvironmentProperties(
             self.theEnvironmentName, self.theCmRequirements,
             self.theTargets, [
                 cProperty, iProperty, avProperty, acProperty, anProperty,
                 panProperty, unlProperty, unoProperty
             ], [
                 cRationale, iRationale, avRationale, acRationale,
                 anRationale, panRationale, unlRationale, unoRationale
             ], self.theCost, self.theCmRoles, self.theTaskPersonas)
         self.theEnvironmentProperties.append(p)
         self.resetCountermeasureEnvironmentAttributes()
     elif (name == 'target'):
         self.theTargets.append(
             Target(self.theTargetName, self.theTargetEffectiveness,
                    self.theRationale))
         self.theTargetResponses = []
     elif (name == 'description'):
         self.inDescription = 0
     elif (name == 'definition'):
         self.inDescription = 0
     elif name == 'fit_criterion':
         self.inFitCriterion = 0
     elif name == 'issue':
         self.inIssue = 0
     elif name == 'rationale':
         self.inRationale = 0
     elif name == 'originator':
         self.inOriginator = 0