dsl

Best way to do Karate match using “==” and “contains” using generic script

孤者浪人 提交于 2019-12-24 14:02:39
问题 This question is resulting from a previous question here Lets says our implemented server v1 and v2 response looks as follows * def v1Response = { id: "1", name: "awesome" } * def v2Response = { id: "2", name: "awesome", value: "karate" } Similarly we define the client schema for v1 and v2 like as follows * def v1Schema = { id: "#string", name: "#string } * def v2Schema = { id: "#string", name: "#string, value: "#string" } From the above given data, all I want is to test following three cases

Does the callonce function executes the feature again if i use use in this function multiple times in different features?

百般思念 提交于 2019-12-24 11:58:05
问题 I have multiple feature files in my project. One of the feature file creates tokens. I want to call this feature only once at the start of the test and then use the tokens in the other feature without executing the token feature again and again. Can someone please help me with this ? 回答1: Look at callSingle() in karate-config.js and please refer the docs: https://github.com/intuit/karate#hooks var result = karate.callSingle('classpath:tokens.feature'); 来源: https://stackoverflow.com/questions

Groovy DSL with Java

依然范特西╮ 提交于 2019-12-24 07:04:30
问题 It has been a couple of days since I started with Groovy. But with all the reading and surfing, I haven't quite been able to figure out how to accomplish what I have in mind. So, please excuse me as a beginner. Would be much grateful for your help, as always. What I want to achieve is this : I have a Java class, say ServiceClass that has some methods ( getMethod() , postMethod() etc) to make some REST GET/POST requests (on its own, it works fine). Now, I want to expose a DSL so that the end

Spring integration - how to check a directory for files, without polling?

纵然是瞬间 提交于 2019-12-24 03:31:08
问题 Is there a way in spring integration, (either using int-file:inbound-channel-adapter or any other means) to simply check a directory for file (preferably pattern match) without polling and if file exists, fetch it and process further and if it doesn't, simply quit (i can use routers for conditional redirects) .. the thing i'm trying to achieve is to control the flow based on a simple once-off file check instead of polling the directory like a file-watcher. OR will I have to do it in Java,

e.data.GetData is always null

情到浓时终转凉″ 提交于 2019-12-24 00:25:00
问题 I am working with Visual Studio 2010, developing an Extension I need to drag and drop from a WPF TreeView in a Toolwindow onto a DSL Diagram but when I call e.data.GetData I can not get a value and want to know what I am doing wrong private void OnDragDrop(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(typeof(SqlServerTable))) { try { SqlServerTable table = (SqlServerTable)e.Data.GetData(typeof(SqlServerTable)); MessageBox.Show(table.Name); } catch (Exception ex) { MessageBox

Using C# as my DSL — is this possible, if so, how?

对着背影说爱祢 提交于 2019-12-24 00:14:59
问题 Is it possible to use C# as a DSL in which the C# source code is edited by the end user in a TextBox, compiled while the application is running, then called by the already-running application? I ask because in the next few months I will be needing to implement a simple math-crunching DSL (similar to somthing Rachel Lim blogged about at http://rachel53461.wordpress.com/2011/08/20/the-math-converter/ I am focused on the math-processing aspect of her code, not the XAML/Converter aspect). I would

Infix format for Nemerle macro

孤街浪徒 提交于 2019-12-23 22:37:51
问题 Say I need some very special multiplication operator. It may be implemented in following macro: macro @<<!(op1, op2) { <[ ( $op1 * $op2 ) ]> } And I can use it like def val = 2 <<! 3 And its work. But what I really want is some 'english'-like operator for the DSL Im developing now: macro @multiply(op1, op2) { <[ ( $op1 * $op2 ) ]> } and if I try to use it like def val = 2 multiply 3 compiler fails with 'expected ;' error What is the problem? How can I implement this infix-format macro? 回答1:

Use groovy category in groovy shell

不羁的心 提交于 2019-12-23 12:23:25
问题 I am working under some DSL using Groovy categories and I would like to find a way to use my DSL with groovy shell without explicitly writing use(MyCategory){ myObject.doSomething() } for each command. For example, suppose I have the following toy category: class MyCategory { static Integer plus(Integer integer, String string){ return integer + Integer.valueOf(string) } } Then, I can use this category in groovysh in the following way: groovy> use(MyCategory){ 2 + '3' } //gives 5 So, is there

ANTLR java test file can't create object of tree grammar

爷,独闯天下 提交于 2019-12-23 04:34:45
问题 I am creating a parser using ANTLR 3.x that targets java. I have written both parser grammar (for creating Abstract Syntax Tree, AST) and Tree Grammar (for performing operations on AST). Finally, to test both grammar files, I have written a test file in Java. Have a look at the below code, protocol grammar grammar protocol; options { language = Java; output = AST; } tokens{ //imaginary tokens PROT; INITIALP; PROC; TRANSITIONS; } @header { import twoprocess.Configuration; package com.javadude

ANTLR java test file can't create object of tree grammar

你离开我真会死。 提交于 2019-12-23 04:34:10
问题 I am creating a parser using ANTLR 3.x that targets java. I have written both parser grammar (for creating Abstract Syntax Tree, AST) and Tree Grammar (for performing operations on AST). Finally, to test both grammar files, I have written a test file in Java. Have a look at the below code, protocol grammar grammar protocol; options { language = Java; output = AST; } tokens{ //imaginary tokens PROT; INITIALP; PROC; TRANSITIONS; } @header { import twoprocess.Configuration; package com.javadude