diff --git a/.gitignore b/.gitignore index 8453fff..6f3ecb9 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,5 @@ nbproject .idea dist compiled -.awcache \ No newline at end of file +.awcache +/test-report.xml diff --git a/README.md b/README.md index 16b6ee7..4a80221 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ NPM: https://www.npmjs.com/package/jenkins-api-ts-typings Jenkins: https://www.andreistraut.info/jenkins/view/Jenkins%20TS%20Typings/ -This library offers a set of classes to use when working with Jenkins JSON API. Jenkins Job, Build, User, View, Changeset and Node / Computer are supported +This library offers a set of classes to use when working with Jenkins JSON API. Jenkins Job, Build, Actions, User, View, Changeset and Node / Computer are supported ## Installation and usage diff --git a/package.json b/package.json index 0210ad5..4ca11cb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jenkins-api-ts-typings", - "version": "0.4.0", + "version": "0.5.0", "description": "Jenkins JSON API TypeScript Typings", "keywords": [ "jenkins", diff --git a/src/JenkinsBuild.ts b/src/JenkinsBuild.ts index fc7c1b4..0c63047 100644 --- a/src/JenkinsBuild.ts +++ b/src/JenkinsBuild.ts @@ -2,6 +2,7 @@ import { IJenkinsBuild } from './jenkins-api-ts-typings' import { IJenkinsChangeSet } from './jenkins-api-ts-typings' +import { IJenkinsAction } from './jenkins-api-ts-typings' export class JenkinsBuild implements IJenkinsBuild { jsonData: JSON; @@ -26,7 +27,7 @@ import { IJenkinsChangeSet } from './jenkins-api-ts-typings' mavenVersionUsed: string; changeSets: Array; - actions: Array; + actions: Array; artifacts: Array; mavenArtifacts: Array; executor: Array; @@ -49,90 +50,7 @@ import { IJenkinsChangeSet } from './jenkins-api-ts-typings' let data:JSON = JSON.parse(json); this.jsonData = data; - if(data.hasOwnProperty("number")) { - this.number = (data as any)["number"]; - } - - if(data.hasOwnProperty("url")) { - this.url = (data as any)["url"]; - } - - if(data.hasOwnProperty("displayName")) { - this.displayName = (data as any)["displayName"]; - } - - if(data.hasOwnProperty("fullDisplayName")) { - this.fullDisplayName = (data as any)["fullDisplayName"]; - } - - if(data.hasOwnProperty("description")) { - this.description = (data as any)["description"]; - } - - if(data.hasOwnProperty("_class")) { - this._class = (data as any)["_class"]; - } - - if(data.hasOwnProperty("building")) { - this.building = (data as any)["building"]; - } - - if(data.hasOwnProperty("duration")) { - this.duration = (data as any)["duration"]; - } - - if(data.hasOwnProperty("estimatedDuration")) { - this.estimatedDuration = (data as any)["estimatedDuration"]; - } - - if(data.hasOwnProperty("id")) { - this.id = (data as any)["id"]; - } - - if(data.hasOwnProperty("keepLog")) { - this.keepLog = (data as any)["keepLog"]; - } - - if(data.hasOwnProperty("queueId")) { - this.queueId = (data as any)["queueId"]; - } - - if(data.hasOwnProperty("result")) { - this.result = (data as any)["result"]; - } - - if(data.hasOwnProperty("timestamp")) { - this.timestamp = (data as any)["timestamp"]; - this.date = new Date((data as any)["timestamp"]); - } - - if(data.hasOwnProperty("builtOn")) { - this.builtOn = (data as any)["builtOn"]; - } - - if(data.hasOwnProperty("actions")) { - this.actions = (data as any)["actions"]; - } - - if(data.hasOwnProperty("artifacts")) { - this.artifacts = (data as any)["artifacts"]; - } - - if(data.hasOwnProperty("executor")) { - this.executor = (data as any)["executor"]; - } - - if(data.hasOwnProperty("culprits")) { - this.culprits = (data as any)["culprits"]; - } - - if(data.hasOwnProperty("mavenVersionUsed")) { - this.mavenVersionUsed = (data as any)["mavenVersionUsed"]; - } - - if(data.hasOwnProperty("mavenArtifacts")) { - this.mavenArtifacts = (data as any)["mavenArtifacts"]; - } + this.fromJson(data); } public fromJson(data: JSON): void { @@ -199,10 +117,6 @@ import { IJenkinsChangeSet } from './jenkins-api-ts-typings' this.builtOn = (data as any)["builtOn"]; } - if(data.hasOwnProperty("actions")) { - this.actions = (data as any)["actions"]; - } - if(data.hasOwnProperty("artifacts")) { this.artifacts = (data as any)["artifacts"]; } diff --git a/src/jenkins-api-ts-typings.ts b/src/jenkins-api-ts-typings.ts index 63cb239..41db142 100644 --- a/src/jenkins-api-ts-typings.ts +++ b/src/jenkins-api-ts-typings.ts @@ -119,7 +119,7 @@ export interface IJenkinsJob extends IJenkinsObject { builtOn: string; changeSets: Array; - actions: Array; + actions: Array; artifacts: Array; executor: Array; culprits: Array; diff --git a/test-report.xml b/test-report.xml deleted file mode 100644 index 866e6ba..0000000 --- a/test-report.xml +++ /dev/null @@ -1,879 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/test/JenkinsBuild.test.ts b/test/JenkinsBuild.test.ts index 174a731..1f40e51 100644 --- a/test/JenkinsBuild.test.ts +++ b/test/JenkinsBuild.test.ts @@ -36,20 +36,6 @@ describe("Test JenkinsBuild", () => { expect(build._class).toBe(jsonObject['_class']); }); - it("works if actions property is correctly parsed (fromJsonString)", () => { - let jsonObject = require(resourceLocation); - let build:IJenkinsBuild = getBuildUsingFromJsonString(resourceLocation); - - expect(build.actions).toEqual(jsonObject['actions']); - }); - - it("works if actions property is correctly parsed", () => { - let jsonObject = require(resourceLocation); - let build:IJenkinsBuild = getBuildUsingFromJson(resourceLocation); - - expect(build.actions).toEqual(jsonObject['actions']); - }); - it("works if artifacts property is correctly parsed (fromJsonString)", () => { let jsonObject = require(resourceLocation); let build:IJenkinsBuild = getBuildUsingFromJsonString(resourceLocation); @@ -680,7 +666,6 @@ describe("Test JenkinsBuild", () => { expect(build.builtOn).toBe(jsonObject['builtOn']); expect(build.mavenVersionUsed).toBe(jsonObject['mavenVersionUsed']); - expect(build.actions).toEqual(jsonObject['actions']); expect(build.artifacts).toEqual(jsonObject['artifacts']); expect(build.mavenArtifacts).toEqual(jsonObject['mavenArtifacts']); expect(build.executor).toEqual(jsonObject['executor']); @@ -709,7 +694,6 @@ describe("Test JenkinsBuild", () => { expect(build.builtOn).toBe(jsonObject['builtOn']); expect(build.mavenVersionUsed).toBe(jsonObject['mavenVersionUsed']); - expect(build.actions).toEqual(jsonObject['actions']); expect(build.artifacts).toEqual(jsonObject['artifacts']); expect(build.mavenArtifacts).toEqual(jsonObject['mavenArtifacts']); expect(build.executor).toEqual(jsonObject['executor']);