This repository has been archived by the owner on Mar 19, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #437 from atomist/project-name
Project name
- Loading branch information
Showing
15 changed files
with
350 additions
and
317 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
src/main/typescript/node_modules/@atomist/rug/test/project/Core.ts
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
95 changes: 47 additions & 48 deletions
95
src/test/resources/com/atomist/rug/test/gherkin/handler/command/CommandHandlers.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,80 +1,79 @@ | ||
import {HandleCommand, Instruction, Response, HandlerContext, Plan, Message} from '@atomist/rug/operations/Handlers' | ||
import {CommandHandler, Secrets, Parameter, Tags, Intent} from '@atomist/rug/operations/Decorators' | ||
import { HandleCommand, Instruction, Response, HandlerContext, Plan, Message } from '@atomist/rug/operations/Handlers' | ||
import { CommandHandler, Secrets, Parameter, Tags, Intent } from '@atomist/rug/operations/Decorators' | ||
|
||
import * as node from "./Nodes" | ||
|
||
@CommandHandler("ReturnsEmptyPlanCommandHandler","Return empty plan") | ||
@CommandHandler("ReturnsEmptyPlanCommandHandler", "Return empty plan") | ||
@Tags("kitty", "youtube", "slack") | ||
@Intent("show me kitties","cats please") | ||
@Intent("show me kitties", "cats please") | ||
@Secrets("atomist/user_token", "atomist/showmethemoney") | ||
class ReturnsEmptyPlanCommandHandler implements HandleCommand { | ||
|
||
handle(ctx: HandlerContext) : Plan { | ||
|
||
let result = new Plan() | ||
//result.add({instruction: {kind: "execute", name: "ExampleFunction", parameters: {thingy: "woot"}}}) | ||
return result; | ||
} | ||
handle(ctx: HandlerContext): Plan { | ||
let result = new Plan(); | ||
// result.add({instruction: {kind: "execute", name: "ExampleFunction", parameters: {thingy: "woot"}}}); | ||
return result; | ||
} | ||
} | ||
|
||
export let command1 = new ReturnsEmptyPlanCommandHandler(); | ||
export const command1 = new ReturnsEmptyPlanCommandHandler(); | ||
|
||
|
||
@CommandHandler("ReturnsOneMessageCommandHandler","Returns one message") | ||
@CommandHandler("ReturnsOneMessageCommandHandler", "Returns one message") | ||
@Tags("kitty", "youtube", "slack") | ||
@Secrets("atomist/user_token", "atomist/showmethemoney") | ||
class ReturnsOneMessageCommandHandler implements HandleCommand { | ||
|
||
handle(ctx: HandlerContext) : Plan { | ||
let result = new Plan() | ||
if (ctx.teamId() == null) | ||
throw new Error("Cannot get at team id") | ||
handle(ctx: HandlerContext): Plan { | ||
let result = new Plan() | ||
if (ctx.teamId() == null) | ||
throw new Error("Cannot get at team id") | ||
|
||
result.add(new Message("woot").withCorrelationId("dude")) | ||
console.log(`The constructed plan messages were ${result.messages()},size=${result.messages().length}`) | ||
return result; | ||
} | ||
result.add(new Message("woot").withCorrelationId("dude")) | ||
// console.log(`The constructed plan messages were ${result.messages()},size=${result.messages().length}`) | ||
return result; | ||
} | ||
} | ||
export let command2 = new ReturnsOneMessageCommandHandler(); | ||
export const command2 = new ReturnsOneMessageCommandHandler(); | ||
|
||
|
||
@CommandHandler("RunsPathExpressionCommandHandler","Returns one message") | ||
@CommandHandler("RunsPathExpressionCommandHandler", "Returns one message") | ||
@Tags("path_expression") | ||
class RunsPathExpressionCommandHandler implements HandleCommand { | ||
|
||
handle(ctx: HandlerContext) : Plan { | ||
let result = new Plan() | ||
const eng = ctx.pathExpressionEngine() | ||
handle(ctx: HandlerContext): Plan { | ||
let result = new Plan() | ||
const eng = ctx.pathExpressionEngine() | ||
|
||
const findPerson = "/Commit/Person()[@name='Ebony']" | ||
const findPerson = "/Commit/Person()[@name='Ebony']" | ||
|
||
eng.with<node.Person>(ctx.contextRoot(), findPerson, peep => { | ||
throw new Error(`Shouldn't have found a person but found ${peep}`) | ||
}) | ||
result.add(new Message("woot").withCorrelationId("dude")) | ||
console.log(`The constructed plan messages were ${result.messages()},size=${result.messages().length}`) | ||
return result; | ||
} | ||
eng.with<node.Person>(ctx.contextRoot(), findPerson, peep => { | ||
throw new Error(`Shouldn't have found a person but found ${peep}`) | ||
}) | ||
result.add(new Message("woot").withCorrelationId("dude")) | ||
// console.log(`The constructed plan messages were ${result.messages()},size=${result.messages().length}`) | ||
return result; | ||
} | ||
} | ||
|
||
export let command3 = new RunsPathExpressionCommandHandler(); | ||
export const command3 = new RunsPathExpressionCommandHandler(); | ||
|
||
|
||
@CommandHandler("RunsMatchingPathExpressionCommandHandler","Returns one message") | ||
@CommandHandler("RunsMatchingPathExpressionCommandHandler", "Returns one message") | ||
@Tags("path_expression") | ||
class RunsMatchingPathExpressionCommandHandler implements HandleCommand { | ||
|
||
handle(ctx: HandlerContext) : Plan { | ||
let result = new Plan() | ||
const eng = ctx.pathExpressionEngine() | ||
|
||
const findPerson = "/Commit/Person()[@name='Ebony']" | ||
eng.with<node.Person>(ctx.contextRoot(), findPerson, peep => { | ||
console.log(`Adding message with person name=${peep.name()},obj=${peep}`) | ||
result.add(new Message(peep.name()).withCorrelationId("dude")) | ||
}) | ||
console.log(`The constructed plan messages were ${result.messages()},size=${result.messages().length}`) | ||
return result; | ||
} | ||
handle(ctx: HandlerContext): Plan { | ||
let result = new Plan() | ||
const eng = ctx.pathExpressionEngine() | ||
|
||
const findPerson = "/Commit/Person()[@name='Ebony']" | ||
eng.with<node.Person>(ctx.contextRoot(), findPerson, peep => { | ||
// console.log(`Adding message with person name=${peep.name()},obj=${peep}`) | ||
result.add(new Message(peep.name()).withCorrelationId("dude")) | ||
}) | ||
// console.log(`The constructed plan messages were ${result.messages()},size=${result.messages().length}`) | ||
return result; | ||
} | ||
} | ||
export const command4 = new RunsMatchingPathExpressionCommandHandler(); | ||
export const command4 = new RunsMatchingPathExpressionCommandHandler(); |
18 changes: 9 additions & 9 deletions
18
...test/resources/com/atomist/rug/test/gherkin/handler/command/SingleMessageFeature1Steps.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
import {Given,When,Then, HandlerScenarioWorld} from "@atomist/rug/test/handler/Core" | ||
import { Given, When, Then, HandlerScenarioWorld } from "@atomist/rug/test/handler/Core" | ||
|
||
Given("a sleepy country", f => { | ||
//console.log("Given invoked for handler") | ||
}) | ||
// console.log("Given invoked for handler"); | ||
}); | ||
When("a visionary leader enters", world => { | ||
let handler = world.commandHandler("ReturnsOneMessageCommandHandler") | ||
world.invokeHandler(handler, {}) | ||
}) | ||
let handler = world.commandHandler("ReturnsOneMessageCommandHandler"); | ||
world.invokeHandler(handler, {}); | ||
}); | ||
Then("excitement ensues", world => { | ||
console.log("The plan message were " + world.plan().messages()) | ||
return world.plan().messages().length == 1 | ||
}) | ||
// console.log("The plan message were " + world.plan().messages()) | ||
return world.plan().messages().length == 1; | ||
}); |
Oops, something went wrong.