Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
pipeline {
agent { label 'Node14' }
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"
}
}
}
}
}
}
}
}
61 changes: 61 additions & 0 deletions build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>

<!-- How to execute : %DLC%\ant\bin\ant -lib %DLC%\pct\PCT.jar -DDLC=%DLC% clean build -->
<project name="DataDigger" >
<taskdef resource="PCT.properties" />
<taskdef name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask" />

<target name="clean">
<delete dir="target" />
</target>

<target name="init">
<mkdir dir="target/build" />
<mkdir dir="target/db" />
<PCTVersion />
<ProgressVersion dlcHome="${DLC}" fullVersion="dlc.version.full" />
<echo message="${dlc.version.full}" />
<sports2000 destDir="target/db" dlcHome="${DLC}" />
</target>

<target name="build" depends="init">
<PCTCompile destdir="target/build" graphicalMode="true" dlcHome="${DLC}" cpinternal="utf-8" cpstream="utf-8" listing="true" relativePaths="true" xmlXref="true" keepXref="true" requireFullKeywords="false" requireFullNames="true" requireFieldQualifiers="true">
<fileset dir="." includes="*.p,*.w,*.cls" />
<DbConnection dbDir="target/db" dbName="sports2000" readOnly="true" />
<propath>
<pathelement location="." />
</propath>
</PCTCompile>
</target>

<target name="test">
<mkdir dir="profiler" />
<ABLUnit dlcHome="${DLC}">
<fileset dir="." includes="test/*.p" />
<DbConnection dbDir="target/db" dbName="sports2000" readOnly="true" />
<Profiler enabled="true" coverage="true" outputDir="profiler" />
<propath>
<pathelement path="." />
</propath>
</ABLUnit>
<xmltask source="results.xml" dest="sonar.xml">
<rename path="//testsuites" to="testExecutions" />
<attr path="//testExecutions" attr="version" value="1" />
<rename path="//testsuite" to="file" />
<rename path="//file/@name" to="path" />
<rename path="//testcase" to="testCase" />
<remove path="//testCase/@time" />
<attr path="//testCase" attr="duration" value="0" />
</xmltask>
</target>

<target name="dist">
<zip destFile="target/DataDigger.zip">
<fileset dir="target/build" includes="*.r" />
<fileset dir="." includes="*.wrx" />
<fileset dir="." includes="*.bat,*.ini,*.txt,image/*" />
</zip>
<touch file="empty_schema.df" />
</target>

</project>
14 changes: 14 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -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
26 changes: 26 additions & 0 deletions test/DDTest.p
Original file line number Diff line number Diff line change
@@ -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.