Best JavaScript code snippet using pact-foundation-pact
ETL_APACHE_ACCESS.js
Source:ETL_APACHE_ACCESS.js
1/*2 * Copyright 2012-2016 the Flamingo Community.3 *4 * Licensed under the Apache License, Version 2.0 (the "License");5 * you may not use this file except in compliance with the License.6 * You may obtain a copy of the License at7 *8 * http://www.apache.org/licenses/LICENSE-2.09 *10 * Unless required by applicable law or agreed to in writing, software11 * distributed under the License is distributed on an "AS IS" BASIS,12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13 * See the License for the specific language governing permissions and14 * limitations under the License.15 */16/**17 * ETL Apache Access Log18 * @cli hadoop jar flamingo2-mapreduce-hadoop2-2.0.5-job.jar apache_access --input <IN> --output <OUT> --printMismatch true --outputDelimiter ','19 * @extend Flamingo.view.workflowdesigner.property._NODE_ETL20 * @author <a href="mailto:haneul.kim@cloudine.co.kr">Haneul, Kim</a>21 * @see <a href="http://hadoop.apache.org/docs/stable/hadoop-mapreduce-client/hadoop-mapreduce-client-core/MapReduceTutorial.html" target="_blank">Apache Hadoop MapReduce Tutorial</a>22 */23Ext.ns('Flamingo.view.workflowdesigner.property.etl');24Ext.define('Flamingo.view.workflowdesigner.property.etl.ETL_APACHE_ACCESS', {25 extend: 'Flamingo.view.workflowdesigner.property._NODE_ETL',26 alias: 'widget.ETL_APACHE_ACCESS',27 width: 450,28 height: 320,29 items: [30 {31 title: 'Parameter',32 xtype: 'form',33 border: false,34 autoScroll: true,35 defaults: {36 labelWidth: 12037 },38 layout: {39 type: 'vbox',40 align: 'stretch'41 },42 items: [43 {44 xtype: 'checkboxfield',45 name: 'printMismatch',46 inputValue: true,47 fieldLabel: 'Non-matching rows',48 boxLabel: 'Print non-matching rows'49 },50 {51 xtype: 'fieldcontainer',52 fieldLabel: 'Delimiter',53 layout: 'hbox',54 items: [55 {56 xtype: 'fieldcontainer',57 layout: 'hbox',58 items: [59 {60 xtype: 'combo',61 name: 'delimiter',62 value: ',',63 flex: 1,64 forceSelection: true,65 multiSelect: false,66 editable: false,67 readOnly: this.readOnly,68 displayField: 'name',69 valueField: 'value',70 mode: 'local',71 queryMode: 'local',72 triggerAction: 'all',73 tpl: '<tpl for="."><div class="x-boundlist-item" data-qtip="{description}">{name}</div></tpl>',74 store: Ext.create('Ext.data.Store', {75 fields: ['name', 'value', 'description'],76 data: [77 {78 name: 'Double Colon',79 value: '::',80 description: '::'81 },82 {83 name: 'Comma',84 value: ',',85 description: ','86 },87 {88 name: 'Pipe',89 value: '|',90 description: '|'91 },92 {93 name: 'Tab',94 value: '\u0009',95 description: '\\t'96 },97 {98 name: 'Blank',99 value: '\u0020',100 description: ' '101 },102 {103 name: 'User Defined',104 value: 'CUSTOM',105 description: 'User Defined'106 }107 ]108 }),109 listeners: {110 change: function (combo, newValue, oldValue, eOpts) {111 // 콤보 ê°ì ë°ë¼ ê´ë ¨ textfield 를 enable | disable ì²ë¦¬íë¤.112 var customValueField = combo.nextSibling('textfield');113 if (newValue === 'CUSTOM') {114 customValueField.enable();115 customValueField.isValid();116 } else {117 customValueField.disable();118 if (newValue) {119 customValueField.setValue(newValue);120 } else {121 customValueField.setValue(',');122 }123 }124 }125 }126 },127 {128 xtype: 'textfield',129 name: 'delimiterValue',130 flex: 1,131 disabled: true,132 readOnly: this.readOnly,133 allowBlank: false,134 value: ','135 }136 ]137 }138 ]139 }140 ]141 },142 {143 title: 'MapReduce',144 xtype: 'form',145 border: false,146 autoScroll: true,147 defaults: {148 labelWidth: 100149 },150 layout: {151 type: 'vbox',152 align: 'stretch'153 },154 items: [155 {156 xtype: 'textfield',157 name: 'jar',158 fieldLabel: 'JAR Path',159 value: ETL.JAR,160 disabledCls: 'disabled-plain',161 readOnly: true162 },163 {164 xtype: 'textfield',165 name: 'driver',166 fieldLabel: 'Driver',167 value: 'apache_access',168 disabledCls: 'disabled-plain',169 readOnly: true170 }171 ]172 },173 {174 title: 'I/O Path',175 xtype: 'form',176 border: false,177 autoScroll: true,178 defaults: {179 labelWidth: 100180 },181 layout: {182 type: 'vbox',183 align: 'stretch'184 },185 items: [186 {187 xtype: '_inputGrid',188 title: 'Input Path',189 flex: 1190 },191 {192 xtype: 'fieldcontainer',193 fieldLabel: 'Output path',194 defaults: {195 hideLabel: true,196 margin: "5 0 0 0" // Same as CSS ordering (top, right, bottom, left)197 },198 layout: 'hbox',199 items: [200 {201 xtype: '_browserField',202 name: 'output',203 allowBlank: false,204 readOnly: false,205 flex: 1206 }207 ]208 }209 ]210 },211 {212 title: 'Hadoop Configuration',213 xtype: 'form',214 border: false,215 autoScroll: true,216 defaults: {217 labelWidth: 100218 },219 layout: {220 type: 'vbox',221 align: 'stretch'222 },223 items: [224 {225 xtype: 'displayfield',226 height: 20,227 value: 'Enter a key and a value of Configuration.set () method used in Hadoop Mapreduce.'228 },229 {230 xtype: '_keyValueGrid',231 flex: 1232 }233 ]234 }235 ],236 /**237 * UI ì»´í¬ëí¸ì Key를 íí°ë§íë¤.238 *239 * ex) ë¤ìê³¼ ê°ì´ íí°ë¥¼ ì¤ì í ì ìë¤.240 * propFilters: {241 * // ì¶ê°í íë¼í¼í°242 * add : [243 * {'test1': '1'},244 * {'test2': '2'}245 * ],246 *247 * // ë³ê²½í íë¼í¼í°248 * modify: [249 * {'delimiterType': 'delimiterType2'},250 * {'config': 'config2'}251 * ],252 *253 * // ìì í íë¼í¼í°254 * remove: ['script', 'metadata']255 * }256 */257 propFilters: {258 add: [],259 modify: [],260 remove: ['config']261 },262 /**263 * MapReduceì 커맨ë ë¼ì¸ íë¼ë¯¸í°ë¥¼ ìëì¼ë¡ ì¤ì íë¤.264 * 커맨ë ë¼ì¸ íë¼ë¯¸í°ë Flamingo2 Workflow Engineìì props.mapreduce를 Keyë¡ êº¼ë´ì´ 구ì±íë¤.265 *266 * @param props UI ììì 구ì±í ì»´í¬ëí¸ì Key Valueê°267 */268 afterPropertySet: function (props) {269 props.mapreduce = {270 driver: props.driver || '',271 jar: props.jar || '',272 confKey: props.hadoopKeys || '',273 confValue: props.hadoopValues || '',274 params: []275 };276 if (props.input) {277 props.mapreduce.params.push("--input", props.input);278 }279 if (props.output) {280 props.mapreduce.params.push("--output", props.output);281 }282 props.mapreduce.params.push("--printMismatch", props.printMismatch);283 props.mapreduce.params.push("--outputDelimiter", '\'' + (props.delimiter === 'CUSTOM' ? props.delimiterValue : props.delimiter) + '\'');284 this.callParent(arguments);285 }...
simple.js
Source:simple.js
1"use strict";2const categories = require('./categories.js');3const oneoffs = require('./oneoffs.js');4class CategoryMatcher {5 constructor(name, mainPattern, patterns,printMismatch) {6 this.name = name;7 this.mainPattern = mainPattern;8 this.patterns = patterns;9 this.printMismatch = printMismatch;10 }11 tryMatch(transaction) {12 let details = transaction.details;13 if (this.mainPattern.test(details)) {14 for (let [pat, cat] of this.patterns) {15 if (!cat) {16 console.log(pat + " has incorrect category");17 }18 if (pat.test(details)) {19 return cat;20 }21 }22 if (this.printMismatch && oneoffs.tryMatch(transaction) == categories.UNCLEAR) {23 console.log('---- unmatched ' + this.name + ' ---');24 console.log(transaction.details);25 }26 }27 return categories.UNCLEAR;28 }29}30module.exports = { 31 patterns : [32 new CategoryMatcher("Pinautomaten", /^BEA\s*NR:/, [33 [/[0-9] C EST BON ALMERE/, categories.ETEN_VERS],34 [/[0-9] DE ENKHUIZER NOTENK/, categories.ETEN_VERS],35 [/[0-9] SLAGERIJ AHMED PAPA/, categories.ETEN_VERS],36 [/[0-9] MINI.*SUPERMARKT.*POORT/, categories.ETEN_VERS], // oude naam Ahmed37 [/[0-9] CCV\*B\.V\.D\. SCHUUR-KOOP/, categories.ETEN_VERS], // Stoepje broodkraam38 [/[0-9] CCV\*SMULLENDE STEVEN/, categories.ETEN_VERS], // andere broodkraam39 [/[0-9] CCV\*V\.O\.F\. ROBIN EN KE/, categories.ETEN_VERS],40 [/[0-9] KAASHANDEL/, categories.ETEN_VERS],41 [/[0-9] CCV\*POELIERSBEDRIJF/, categories.ETEN_VERS],42 [/[0-9] DE KAAZZAAK/, categories.ETEN_VERS],43 [/[0-9] DE ENHUIZER WORSTEN/, categories.ETEN_VERS],44 [/[0-9] ALBERT HEIJN [0-9]+ [A-Z]+/, categories.SUPERMARKT],45 [/[0-9] DEEN [A-Z]+[0-9]+ [A-Z]+/, categories.SUPERMARKT],46 [/[0-9] JUMBO [A-Z ]+/, categories.SUPERMARKT],47 [/[0-9] ALDI [0-9]+ [A-Z ]+/, categories.SUPERMARKT],48 [/[0-9] [0-9]+ LIDL [A-Z ]+/, categories.SUPERMARKT],49 [/[0-9] GEMBIRA ALMERE/, categories.SUPERMARKT], // TOKO in centrum50 [/[0-9] APOTHEEK VIZIER ALMERE/, categories.APOTHEEK],51 [/[0-9] DROG.ZWANENKAMP VOF/, categories.DROGIST],52 [/[0-9] DROGISTERIJ/, categories.DROGIST],53 [/[0-9] KRUIDVAT [0-9]+ [A-Z]+/, categories.DROGIST],54 [/[0-9] ETOS [0-9]+ [A-Z]+/, categories.DROGIST],55 [/[0-9][ A-Z]* HEMA [A-Z]+[ 0-9]*/, categories.BABY],56 [/[0-9] TOYSXL\. FIL\./, categories.BABY],57 [/[0-9] SEPAY\-BABY\&BORST BV/, categories.BABY],58 [/[0-9] FLEVOZIEKENHUIS /, categories.BABY],59 [/[0-9] EAZY HAIR/, categories.KAPPER],60 [/[0-9] STEPS NEDERLAND/, categories.KLEDING],61 [/[0-9] RAP\* BEELINE RETAIL/, categories.KLEDING],62 [/[0-9] MANFIELD /, categories.KLEDING],63 [/[0-9] VM [A-Z]+/, categories.KLEDING], // Vero Moda64 [/[0-9] H\&M [0-9]+/, categories.KLEDING],65 [/[0-9] HUNKEMOLLER [0-9]+/, categories.KLEDING],66 [/[0-9] SACHA FIL-[0-9]+/, categories.KLEDING],67 [/BENZINESTA/, categories.TANKEN],68 [/TANKSTA/, categories.TANKEN],69 [/ BENZINE /, categories.TANKEN],70 [/ FIREZONE /, categories.TANKEN],71 [/ SB TANK /, categories.TANKEN],72 [/ AVIA /, categories.TANKEN],73 [/ SHELL /, categories.TANKEN],74 [/ BP EXPRESS /, categories.TANKEN],75 [/ TAMOIL /, categories.TANKEN],76 [/ AUTORADAM /, categories.TANKEN],77 [/HOSPITAALGARAGE/, categories.PARKEREN],78 [/SCHIPPERGARAGE AL/, categories.PARKEREN],79 [/ PARKING/, categories.PARKEREN],80 [/ P6 UITGAANSCENTRUM /, categories.PARKEREN],81 [/ UMC UTRECHT UTRECHT/, categories.PARKEREN],82 [/ MERCURE HOTEL AMER/, categories.PARKEREN],83 [/WASSTRAAT/, categories.WASSTRAAT],84 [/[0-9] NS\-[A-Z ]+ [0-9]+ [A-Z]+/, categories.OPENBAAR_VERVOER],85 [/[0-9] SPAR SCIENCEPARK AMSTERD/, categories.ETEN_WERK],86 [/[0-9] 2536 STICHTING CWI.*,PAS[0-9]+/, categories.ETEN_WERK],87 [/[0-9] ANTONI VAN LEEUWENHK/, categories.ETEN_WERK],88 [/[0-9] STRANDPAVILJOEN ALOH/, categories.UIT_ETEN],89 [/[0-9] CHIANG MAI /, categories.UIT_ETEN],90 [/[0-9] CM THAI FOOD 2 GO /, categories.UIT_ETEN],91 [/[0-9] HEILIG BOONTJE C /, categories.UIT_ETEN],92 [/[0-9] UITSPANNING DE OASE VOGE/, categories.UIT_ETEN],93 [/[0-9] BOBBIE BEER/, categories.UIT_ETEN],94 [/[0-9] CCV\*NELIS IJSSALON/, categories.UIT_ETEN],95 [/[0-9][A-Z ]* STARBUCKS /, categories.UIT_ETEN],96 [/[0-9] BRAM LADAGE/, categories.UIT_ETEN],97 [/[0-9] CCV\*POLDER HORECA/, categories.UIT_ETEN],98 [/[0-9] CCV\*IJSPRESSI/, categories.UIT_ETEN],99 [/[0-9] TANTE TRUUS /, categories.UIT_ETEN],100 [/[0-9] PARNASSIA AAN ZEE/, categories.UIT_ETEN],101 [/[0-9] GRANDFETARIA/, categories.UIT_ETEN],102 [/LUNCHTIJD /, categories.UIT_ETEN],103 [/BAKKER BORSCH /, categories.UIT_ETEN],104 [/DE VELDKEUKEN /, categories.UIT_ETEN],105 [/[0-9] CCV\*WATERNET ZANDVOORT/, categories.UITJES],106 [/[0-9] JUMPER ALMERE/, categories.KAT],107 [/[0-9] DIERENZIEKENHUIS/, categories.KAT],108 [/[0-9] IKEA [A-Z]+/, categories.HUIS],109 [/[0-9] LOODS 5 [A-Z]+/, categories.HUIS],110 [/[0-9] BLOKKER [0-9 ]*[A-Z]+/, categories.HUIS],111 [/[0-9] GAMMA [A-Z]+/, categories.HUIS],112 [/DAILY STYLE, ALMERE/, categories.HUIS],113 [/RIAS STYLE/, categories.HOBBY],114 [/ BRUNA[ .][A-Z]+/, categories.HOBBY],115 [/ JENNY S TABAKSWINKEL /, categories.HOBBY],116 [/ BEVER /, categories.HOBBY],117 [/ STUMPEL /, categories.CADEAU],118 [/ BLOEMEN /, categories.CADEAU],119 [/JENIFFERSBLOEMEN/, categories.CADEAU],120 [/[0-9] SPORTEXPL/, categories.SPORT],121 [/[0-9] UNIVERSUM AMSTERDAM/, categories.SPORT],122 [/[0-9] PINDIRECT [A-Z]+[0-9]+/, categories.UNKNOWN],123 ], true),124 new CategoryMatcher("Incasso", /SEPA INCASSO/, [125 [/TLS BV INZ\. OV-CHIPKAART/, categories.OPENBAAR_VERVOER],126 [/NS GROEP IZ NS REIZIGERS/, categories.OPENBAAR_VERVOER],127 [/STICHTING BEWAARDER ACHM/, categories.HUUR_HUIS],128 [/XS4ALL INTERNET B\.V\./, categories.INTERNET],129 [/YOUFONE NEDERLAND BV/, categories.MOBIEL],130 [/GEMEENTE ALMERE/, categories.BELASTING_GEMEENTE],131 [/NUON KLANTENSERVICE/, categories.ENERGIE],132 [/GBLT INCASSO/, categories.WATER],133 [/VITENS/, categories.WATER],134 [/BROEKHUIS ASSURANTIE/, categories.AUTOVERZEKERING],135 [/KIEMER/, categories.ZORGVERZEKERING],136 [/ANWB VERZEKEREN/, categories.REISVERZEKERING],137 [/BELASTINGDIENST[\s\S]*[0-9A-Z]+-[0-9A-Z]+-[0-9A-Z]+/, categories.WEGENBELASTING],138 [/\/CHILD CARE KINDEROPVANG BV/, categories.OPVANG],139 [/\/MARIT VAN OOSTVEEN MOM I/, categories.SPORT],140 ], true),141 new CategoryMatcher("Overboeking", /(\/TRTP\/SEPA OVERBOEKING|^SEPA [A-Z ]*OVERB[A-Z]*)/, [142 [/SOCIALE VERZEKERINGSBANK/, categories.BABY],143 [/M M J LANDMAN/, categories.OVERBOEKING_FAMILIE],144 [/ L LANDMAN/, categories.OVERBOEKING_FAMILIE],145 [/MW LM VAN HOUDT/, categories.OVERBOEKING_FAMILIE],146 [/ZAKGELD/, categories.OVERBOEKING_INTERN],147 [/(REMI\/SPAREN|OMSCHRIJVING: SPAREN)/, categories.OVERBOEKING_INTERN],148 [/[0-9]+9364[\s\S]*DAVY LANDMAN/, categories.OVERBOEKING_INTERN],149 [/[0-9]+9474[\s\S]*DAVY LANDMAN/, categories.OVERBOEKING_INTERN],150 [/ST CENTR WISK INFORM[\s\S]*SALARIS/, categories.SALARIS],151 [/STICHTING ANTONI VAN LEEUW/, categories.SALARIS],152 [/NED VER VOOR ONCOLOGIE/, categories.WERK],153 [/ANTONI VAN LEEUWENHOEK ZIEKENHUIS[\s\S]*SALARIS/, categories.SALARIS],154 [/ESPRIT RETAIL B\.V\./, categories.KLEDING],155 [/BOL.COM/, categories.SUPERMARKT],156 [/CHILD CARE KINDEROPVANG/, categories.OPVANG],157 [/APOTHEEK /, categories.APOTHEEK],158 [/KIEMER/, categories.ZORGVERZEKERING],159 [/ KADO /, categories.CADEAU],160 ], true),161 new CategoryMatcher("iDEAL", /(\/TRTP\/IDEAL|^SEPA IDEAL)/, [162 [/ALIPAY SINGAPORE/, categories.ALIEXPRESS],163 [/HEMA BV/, categories.BABY],164 [/BABY EN BORST BV/, categories.BABY],165 [/INTERTOYS/, categories.BABY],166 [/ESPRIT RET/, categories.KLEDING],167 [/THE STING/, categories.KLEDING],168 [/BOL\.COM/, categories.SUPERMARKT],169 [/DE GROENE VROUW/, categories.HOBBY],170 [/WEBPRINT/, categories.HUIS],171 [/ OV-CHIPKAART/, categories.OPENBAAR_VERVOER],172 [/NS GROEP IZ NS REIZIGERS/, categories.OPENBAAR_VERVOER],173 [/WEHKAMP FINANCE/, categories.HUIS],174 [/DROGINET/, categories.DROGIST],175 [/KRUIDVAT/, categories.DROGIST],176 [/CUTE COTTON/, categories.HOBBY],177 [/ECHTSTUDIO/, categories.HOBBY],178 [/CAMERANU\.NL/, categories.CADEAU],179 [/ZALANDO NL/, categories.KLEDING],180 ], true),181 new CategoryMatcher("Acceptgiro", /ACCEPTGIROBETALING/, [182 [/BELASTINGDIENST/, categories.BELASTINGDIENST],183 [/FAMED BV/, categories.TANDARTS],184 ], true),185 ]...
display.ts
Source:display.ts
...54 return mismatches.filter((m) => m.type !== 'request-mismatch');55 }56 return mismatches;57}58export function printMismatch(m: Mismatch): string {59 switch (m.type) {60 case 'MethodMismatch':61 return `Expected ${m.expected}, got: ${m.actual}`;62 default:63 return m.mismatch;64 }65}66export function generateMockServerError(67 mismatches: MatchingResult[],68 indent: string69): string {70 return [71 'Mock server failed with the following mismatches:',72 ...mismatches.map((mismatch, i) => {73 if (mismatch.type === 'request-mismatch') {74 return `\n${indent}${i}) The following request was incorrect: \n75 ${indent}${mismatch.method} ${mismatch.path}76 ${mismatch.mismatches77 ?.map(78 (d, j) =>79 `\n${indent}${indent}${indent} 1.${j} ${printMismatch(d)}`80 )81 .join('')}`;82 }83 if (mismatch.type === 'request-not-found') {84 return `\n${indent}${i}) The following request was not expected: ${displayRequest(85 (mismatch as MatchingResultRequestNotFound).request,86 `${indent} `87 )}`;88 }89 if (mismatch.type === 'missing-request') {90 return `\n${indent}${i}) The following request was expected but not received: ${displayRequest(91 (mismatch as MatchingResultMissingRequest).request,92 `${indent} `93 )}`;...
Using AI Code Generation
1var pact = require('pact-foundation-pact-node');2var path = require('path');3var opts = {4 pactUrls: [path.resolve(__dirname, '../pacts/test.json')],5};6pact.printMismatch(opts)7 .then(function () {8 console.log('done');9 })10 .catch(function (err) {11 console.log(err);12 });
Using AI Code Generation
1var pact = require('pact-foundation/pact-node');2pact.printMismatch({3});4var pact = require('pact-foundation/pact-node');5pact.printMismatch({6});7var pact = require('pact-foundation/pact-node');8pact.printMismatch({9});10var pact = require('pact-foundation/pact-node');11pact.printMismatch({12});13var pact = require('pact-foundation/pact-node');14pact.printMismatch({15});16var pact = require('pact-foundation/pact-node');17pact.printMismatch({
Using AI Code Generation
1const printMismatch = require('pact-foundation-pact-node').printMismatch;2const mismatch = {3 "expected": {4 "body": {5 }6 },7 "actual": {8 "body": {9 }10 }11};12printMismatch(mismatch);13const printMismatch = require('pact-node').printMismatch;14const mismatch = {15 "expected": {16 "body": {17 }18 },19 "actual": {20 "body": {21 }22 }23};24printMismatch(mismatch);
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!