From e0c3d788f297fc7a410330aa6afc7923473cf78b Mon Sep 17 00:00:00 2001 From: ThisuraThejith Date: Tue, 1 Aug 2017 07:14:12 +0530 Subject: [PATCH] integrated TOIF into apache-fineract --- fineract-provider/build.gradle | 6 +++ .../toif/housekeeping/housekeeping.txt | 36 ++++++++++++++++++ fineract-provider/toif/toifscan.py | 38 +++++++++++++++++++ 3 files changed, 80 insertions(+) create mode 100644 fineract-provider/toif/housekeeping/housekeeping.txt create mode 100644 fineract-provider/toif/toifscan.py diff --git a/fineract-provider/build.gradle b/fineract-provider/build.gradle index 771fcde58da..21310832c72 100644 --- a/fineract-provider/build.gradle +++ b/fineract-provider/build.gradle @@ -106,6 +106,7 @@ rat { '**/.git/**', '**/.gitignore', '**/.gitkeep', + '**/toif/**', '**/*.iml', //Notice files '**/NOTICE_RELEASE', @@ -350,6 +351,11 @@ task integrationTest(type:Test){ classpath = project.sourceSets.integrationTest.runtimeClasspath } +task toif(type:Exec) { + workingDir 'toif' + commandLine 'python', 'toifscan.py' + args buildDir +} import groovy.sql.Sql diff --git a/fineract-provider/toif/housekeeping/housekeeping.txt b/fineract-provider/toif/housekeeping/housekeeping.txt new file mode 100644 index 00000000000..8cd4499fe3e --- /dev/null +++ b/fineract-provider/toif/housekeeping/housekeeping.txt @@ -0,0 +1,36 @@ +########################### +# Facts +########################### + +TOIFSegmentIsRelatedToProject=project1 +TOIFSegmentIsProducedByOrganization=org1 +TOIFSegmentIsOwnedByOrganization=org1 +TOIFSegmentIsGeneratedByPerson=person1 +TOIFSegmentIsSupervisedByPerson=person1 + +PersonIsInvolvedInProjectAsRole=person1;project1;role1 +OrganizationIsInvolvedInProjectAsRole=org1;project1;role2 +OrganizationIsPartOfOrganizationAsRole=org1;org2;role2 +PersonIsEmployedByOrganizationAsRole=person1;org1;role1 + +########################### +# Entities +########################### + +SegmentDescription=Segment. + +#projectId=name;description +project1=apache-fineract;Apache Fineract:A Platform for Microfinance. + +#personId=name;email;phone +person1=mifos-developer;dev@fineract.apache.org;555-1234 + +#organizationId=name;description;address;phone;email +org1=mifos;Fineract initial organization;mifos-developer;555-5555;mifos-developer@lists.sourceforge.net + +#organizationId=name;description;address;phone;email +org2=apache;Fineract new organization;blah;555-5555;dev@fineract.apache.org + +#roleId=name;description +role1=Software Developer;Developer on the TOIF Adaptors project +role2=company;employer diff --git a/fineract-provider/toif/toifscan.py b/fineract-provider/toif/toifscan.py new file mode 100644 index 00000000000..194cbd2d9bc --- /dev/null +++ b/fineract-provider/toif/toifscan.py @@ -0,0 +1,38 @@ +import subprocess +import os +import shlex +import sys + +buildDir = sys.argv[1] +HOUSE_KEEPING = "housekeeping/housekeeping.txt" +OUTPUT_DIR = "../build/reports/toif" +SUB_PROCESS = [] + +def prepareAdaptors(inFilePath): + + commonArgs = ["--housekeeping", HOUSE_KEEPING, "--outputdirectory", OUTPUT_DIR, "--inputfile", inFilePath] + + fb_cmd = ["toif", "--adaptor","Findbugs"] + fb_cmd.extend( commonArgs ) + print fb_cmd + p = subprocess.Popen( fb_cmd, shell=False) + SUB_PROCESS.append( p ) + + jl_cmd = ["toif", "--adaptor", "Jlint"] + jl_cmd.extend(commonArgs) + print jl_cmd + p = subprocess.Popen(jl_cmd, shell=False) + SUB_PROCESS.append(p) + +def scanBuildDir(): + for root, dirnames, filenames in os.walk(buildDir): + for inFile in filenames: + if inFile.endswith(".class"): + inFilePath = os.path.join(root, inFile) + print 'infile is ', inFilePath + prepareAdaptors(inFilePath) + for p in SUB_PROCESS: + p.wait() + +if __name__ == '__main__': + scanBuildDir() \ No newline at end of file