diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..b37b439 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,37 @@ +pipeline { + agent { label 'Node01' } + options { + buildDiscarder(logRotator(numToKeepStr:'5')) + timeout(time: 10, unit: 'MINUTES') + skipDefaultCheckout() + } + stages { + stage ('Build') { + steps { + checkout([ $class: 'GitSCM', branches: scm.branches, extensions: scm.extensions + [[$class: 'CleanCheckout']], userRemoteConfigs: scm.userRemoteConfigs ]) + withEnv(["DLC=${tool name: 'OpenEdge-12.1', type: 'openedge'}", "JAVA_HOME=${tool name: 'JDK8', type: 'jdk'}"]) { + bat "%DLC%\\ant\\bin\\ant -DDLC=%DLC% -lib %DLC%\\pct\\pct.jar build test dist" + } + junit 'results.xml' + stash name: 'windows-build', includes: 'target/DataDigger.zip' + archiveArtifacts artifacts: 'target/DataDigger.zip' + } + } + + stage ('Code analysis') { + steps { + script { + withEnv(["PATH+SCAN=${tool name: 'SQScanner4', type: 'hudson.plugins.sonar.SonarRunnerInstallation'}/bin", "DLC=${tool name: 'OpenEdge-12.1', type: 'openedge'}"]) { + withSonarQubeEnv('RSSW') { + if (("master" == env.BRANCH_NAME) || ("develop" == env.BRANCH_NAME) || ("develop02" == env.BRANCH_NAME)) { + bat "sonar-scanner -Dsonar.oe.dlc=%DLC% -Dsonar.branch.name=%BRANCH_NAME%" + } else { + bat "sonar-scanner -Dsonar.oe.dlc=%DLC% -Dsonar.branch.name=%BRANCH_NAME% -Dsonar.branch.target=develop02" + } + } + } + } + } + } + } +} diff --git a/build.xml b/build.xml new file mode 100644 index 0000000..9ebc112 --- /dev/null +++ b/build.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..708e58c --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,14 @@ +sonar.projectKey=patrickTingen:DataDigger +sonar.projectName=DataDigger +sonar.projectVersion=1.0 +sonar.projectDescription=DataDigger +sonar.sources=. +sonar.sourceEncoding=utf-8 +sonar.inclusions=*.i,*.p,*.w,*.cls +sonar.tests=test +sonar.oe.binaries=target/build +sonar.oe.propath=. +sonar.oe.propath.dlc=true +sonar.oe.databases=empty_schema.df:dictdb +sonar.oe.coverage.profiler.dirs=profiler +sonar.testExecutionReportPaths=sonar.xml diff --git a/test/DDTest.p b/test/DDTest.p new file mode 100644 index 0000000..ae909bf --- /dev/null +++ b/test/DDTest.p @@ -0,0 +1,26 @@ +ROUTINE-LEVEL ON ERROR UNDO, THROW. + +USING OpenEdge.Core.Assert. + +{ DataDigger.i } + +@Test. +PROCEDURE TestCreateFolder: + DEFINE VARIABLE lib AS HANDLE NO-UNDO. + RUN dataDiggerLib.p PERSISTENT SET lib. + RUN getTables IN lib (INPUT TABLE ttTableFilter, OUTPUT TABLE ttTable). + + DEFINE VARIABLE cErr AS CHARACTER NO-UNDO. + RUN createFolder IN lib (INPUT '.\dir1\dir2\dir3'). + + FILE-INFO:FILE-NAME = "dir1". + Assert:IsTrue(INDEX(FILE-INFO:FILE-TYPE, "D") GT 0). + FILE-INFO:FILE-NAME = "dir1/dir2". + Assert:IsTrue(INDEX(FILE-INFO:FILE-TYPE, "D") GT 0). + FILE-INFO:FILE-NAME = "dir1/dir2/dirss3". + Assert:IsTrue(INDEX(FILE-INFO:FILE-TYPE, "D") GT 0). + + DELETE PROCEDURE lib. + +END PROCEDURE. +