def setUp(self): call([os.environ['CAIRIS_CFG_DIR'] + "/initdb.sh"]) cairis.core.BorgFactory.initialise() f = open(os.environ['CAIRIS_SRC'] + '/test/processes.json') d = json.load(f) f.close() iCodes = d['codes'] i = CodeParameters(iCodes[0]["theName"], iCodes[0]["theType"], iCodes[0]["theDescription"], iCodes[0]["theInclusionCriteria"], iCodes[0]["theExample"]) b = Borg() b.dbProxy.addCode(i) i = CodeParameters(iCodes[1]["theName"], iCodes[1]["theType"], iCodes[1]["theDescription"], iCodes[1]["theInclusionCriteria"], iCodes[1]["theExample"]) b.dbProxy.addCode(i) iEnvironments = d['environments'] iep1 = EnvironmentParameters(iEnvironments[0]["theName"], iEnvironments[0]["theShortCode"], iEnvironments[0]["theDescription"]) b.dbProxy.addEnvironment(iep1) iRoles = d['roles'] irp = RoleParameters(iRoles[0]["theName"], iRoles[0]["theType"], iRoles[0]["theShortCode"], iRoles[0]["theDescription"], []) b.dbProxy.addRole(irp) iPersonas = d['personas'] ipp = PersonaParameters( iPersonas[0]["theName"], iPersonas[0]["theActivities"], iPersonas[0]["theAttitudes"], iPersonas[0]["theAptitudes"], iPersonas[0]["theMotivations"], iPersonas[0]["theSkills"], iPersonas[0]["theIntrinsic"], iPersonas[0]["theContextual"], "", "0", iPersonas[0]["thePersonaType"], [], [ PersonaEnvironmentProperties( iPersonas[0]["theEnvironmentProperties"][0]["theName"], (iPersonas[0]["theEnvironmentProperties"][0] ["theDirectFlag"] == "True"), iPersonas[0] ["theEnvironmentProperties"][0]["theNarrative"], iPersonas[0]["theEnvironmentProperties"][0]["theRole"]) ], []) b.dbProxy.addPersona(ipp) self.iCN = d['code_networks']
def endElement(self, name): if name == 'internal_document': p = InternalDocumentParameters(self.theName, self.theDescription, self.theContent, [], []) self.theInternalDocuments.append(p) self.resetInternalDocumentAttributes() elif name == 'code': p = CodeParameters(self.theName, self.theType, self.theDescription, self.theInclusionCriteria, self.theExample) self.theCodes.append(p) self.resetCodeAttributes() elif name == 'memo': p = MemoParameters(self.theName, self.theDescription) self.theMemos.append(p) self.resetMemoAttributes() elif name == 'implied_process': p = ImpliedProcessParameters(self.theName, self.theDescription, self.thePersona, self.theProcessNetwork, self.theSpecification, self.theChannels) self.theProcesses.append(p) self.resetProcessAttributes() elif name == 'quotation': self.theQuotations.append( (self.theType, self.theCode, self.theArtifactType, self.theArtifactName, self.theEnvironment, self.theSection, self.theStartIndex, self.theEndIndex, self.theLabel, self.theSynopsis)) self.resetQuotationAttributes() elif name == 'implied_characteristic': p = ImpliedCharacteristicParameters( self.thePersona, self.theFromCode, self.theToCode, self.theRelationshipType, self.theImpliedCharacteristicName, self.theImpliedCharacteristicQualifier, self.theFromLabels, self.theToLabels, self.theImpliedCharacteristicType) self.theImpliedCharacteristics.append(p) self.resetImpliedCharacteristicAttributes() elif name == 'description': self.inDescription = 0 elif name == 'inclusion_criteria': self.inInclusionCriteria = 0 elif name == 'example': self.inExample = 0 elif name == 'specification': self.inSpecification = 0 elif name == 'content': self.inContent = 0 elif name == 'label': self.inLabel = 0 elif name == 'synopsis': self.inSynopsis = 0
def testAddUpdateCode(self): i = CodeParameters(self.iCodes[0]["theName"], self.iCodes[0]["theType"],self.iCodes[0]["theDescription"], self.iCodes[0]["theInclusionCriteria"], self.iCodes[0]["theExample"]) b = Borg() b.dbProxy.addCode(i) ocs = b.dbProxy.getCodes() o = ocs[self.iCodes[0]["theName"]] self.assertEqual(i.name(), o.name()) self.assertEqual(i.type(), o.type()) self.assertEqual(i.description(),o.description()) self.assertEqual(i.inclusionCriteria(),o.inclusionCriteria()) self.assertEqual(i.example(),o.example()) o.theDescription = 'Updated description' b.dbProxy.updateCode(o) ocs2 = b.dbProxy.getCodes(o.id()) o2 = ocs2[self.iCodes[0]["theName"]] self.assertEqual(i.name(), o2.name()) self.assertEqual(i.type(), o2.type()) self.assertEqual('Updated description',o2.description()) self.assertEqual(i.inclusionCriteria(),o2.inclusionCriteria()) self.assertEqual(i.example(),o2.example()) b.dbProxy.deleteCode(o.id())
def parameters(self): parameters = CodeParameters(self.theName,self.theType,self.theDescription,self.theInclusionCriteria,self.theExample) parameters.setId(self.theId) return parameters
def parameters(self): parameters = CodeParameters(self.theName, self.theType, self.theDescription, self.theInclusionCriteria, self.theExample) parameters.setId(self.theId) return parameters
def setUp(self): call([os.environ['CAIRIS_CFG_DIR'] + "/initdb.sh"]) cairis.core.BorgFactory.initialise() f = open(os.environ['CAIRIS_SRC'] + '/test/processes.json') d = json.load(f) f.close() b = Borg() iIntDocs = d['internaldocuments'] i = InternalDocumentParameters(iIntDocs[0]["theName"], iIntDocs[0]["theDescription"], iIntDocs[0]["theContent"], [], []) b.dbProxy.addInternalDocument(i) iCodes = d['codes'] i = CodeParameters(iCodes[0]["theName"], iCodes[0]["theType"], iCodes[0]["theDescription"], iCodes[0]["theInclusionCriteria"], iCodes[0]["theExample"]) b.dbProxy.addCode(i) i = CodeParameters(iCodes[1]["theName"], iCodes[1]["theType"], iCodes[1]["theDescription"], iCodes[1]["theInclusionCriteria"], iCodes[1]["theExample"]) b.dbProxy.addCode(i) iQs = d['quotations'] i = (iQs[0]["theType"], iQs[0]["theCode"], iQs[0]["theArtifactType"], iQs[0]["theArtifactName"], iQs[0]["theEnvironment"], iQs[0]["theSection"], iQs[0]["theStartIdx"], iQs[0]["theEndIdx"], iQs[0]["theLabel"], iQs[0]["theSynopsis"]) b.dbProxy.addQuotation(i) i = (iQs[2]['theType'], iQs[2]["theCode"], iQs[2]["theArtifactType"], iQs[2]["theArtifactName"], iQs[2]["theEnvironment"], iQs[2]["theSection"], iQs[2]["theStartIdx"], iQs[2]["theEndIdx"], iQs[2]["theLabel"], iQs[2]["theSynopsis"]) b.dbProxy.addQuotation(i) iEnvironments = d['environments'] iep1 = EnvironmentParameters(iEnvironments[0]["theName"], iEnvironments[0]["theShortCode"], iEnvironments[0]["theDescription"]) b.dbProxy.addEnvironment(iep1) iRoles = d['roles'] irp = RoleParameters(iRoles[0]["theName"], iRoles[0]["theType"], iRoles[0]["theShortCode"], iRoles[0]["theDescription"], []) b.dbProxy.addRole(irp) iPersonas = d['personas'] ipp = PersonaParameters( iPersonas[0]["theName"], iPersonas[0]["theActivities"], iPersonas[0]["theAttitudes"], iPersonas[0]["theAptitudes"], iPersonas[0]["theMotivations"], iPersonas[0]["theSkills"], iPersonas[0]["theIntrinsic"], iPersonas[0]["theContextual"], "", "0", iPersonas[0]["thePersonaType"], [], [ PersonaEnvironmentProperties( iPersonas[0]["theEnvironmentProperties"][0]["theName"], (iPersonas[0]["theEnvironmentProperties"][0] ["theDirectFlag"] == "True"), iPersonas[0] ["theEnvironmentProperties"][0]["theNarrative"], iPersonas[0]["theEnvironmentProperties"][0]["theRole"]) ], []) b.dbProxy.addPersona(ipp) self.iCN = d['code_networks'] b.dbProxy.addCodeRelationship(self.iCN[0]["thePersonaName"], self.iCN[0]["theFromCode"], self.iCN[0]["theToCode"], self.iCN[0]["theRshipType"])
def testAddUpdateCode(self): i = CodeParameters(self.iCodes[0]["theName"], self.iCodes[0]["theType"], self.iCodes[0]["theDescription"], self.iCodes[0]["theInclusionCriteria"], self.iCodes[0]["theExample"]) b = Borg() b.dbProxy.addCode(i) ocs = b.dbProxy.getCodes() o = ocs[self.iCodes[0]["theName"]] self.assertEqual(i.name(), o.name()) self.assertEqual(i.type(), o.type()) self.assertEqual(i.description(), o.description()) self.assertEqual(i.inclusionCriteria(), o.inclusionCriteria()) self.assertEqual(i.example(), o.example()) o.theDescription = 'Updated description' b.dbProxy.updateCode(o) ocs2 = b.dbProxy.getCodes(o.id()) o2 = ocs2[self.iCodes[0]["theName"]] self.assertEqual(i.name(), o2.name()) self.assertEqual(i.type(), o2.type()) self.assertEqual('Updated description', o2.description()) self.assertEqual(i.inclusionCriteria(), o2.inclusionCriteria()) self.assertEqual(i.example(), o2.example()) b.dbProxy.deleteCode(o.id())