This repository has been archived by the owner on Mar 9, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Resource config files from jonnyw package and update set binary p…
…ath in testcase
- Loading branch information
Showing
26 changed files
with
830 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
parameters: | ||
|
||
############################# | ||
### CONFIGURATION OPTIONS ### | ||
############################# | ||
|
||
phantomjs.cache_dir: /tmp | ||
phantomjs.procedure_dir: "%phantomjs.resource_dir%/procedures" | ||
phantomjs.procedure_extension: proc | ||
phantomjs.validator_dir: "%phantomjs.resource_dir%/validators" | ||
phantomjs.validator_engine: "esprima-2.0.0.js" | ||
|
||
############## | ||
### ENGINE ### | ||
############## | ||
|
||
phantomjs.engine.class: JonnyW\PhantomJs\Engine | ||
|
||
################## | ||
### PROCEDURES ### | ||
################## | ||
|
||
phantomjs.procedure.procedure_loader.class: JonnyW\PhantomJs\Procedure\ProcedureLoader | ||
phantomjs.procedure.chain_loader.class: JonnyW\PhantomJs\Procedure\ChainProcedureLoader | ||
phantomjs.procedure.procedure_factory.class: JonnyW\PhantomJs\Procedure\ProcedureFactory | ||
phantomjs.procedure.procedure_loader_factory.class: JonnyW\PhantomJs\Procedure\ProcedureLoaderFactory | ||
phantomjs.procedure.procedure_validator.class: JonnyW\PhantomJs\Procedure\ProcedureValidator | ||
phantomjs.procedure.procedure_compiler.class: JonnyW\PhantomJs\Procedure\ProcedureCompiler | ||
|
||
############ | ||
### HTTP ### | ||
############ | ||
|
||
phantomjs.http.message_factory.class: JonnyW\PhantomJs\Http\MessageFactory | ||
|
||
################ | ||
### PARSING #### | ||
################ | ||
|
||
phantomjs.parser.json_parser.class: JonnyW\PhantomJs\Parser\JsonParser | ||
|
||
################### | ||
### VALIDATION #### | ||
################### | ||
|
||
phantomjs.validator.esprima.class: JonnyW\PhantomJs\Validator\Esprima | ||
|
||
################## | ||
### TEMPLATES #### | ||
################## | ||
|
||
phantomjs.template.template_renderer.class: JonnyW\PhantomJs\Template\TemplateRenderer | ||
phantomjs.twig.environment.class: Twig_Environment | ||
phantomjs.twig.lexer.class: Twig_Lexer | ||
phantomjs.twig.array_loader.class: Twig_Loader_Array | ||
|
||
################## | ||
### RESOURCES #### | ||
################## | ||
|
||
phantomjs.cache.file_cache.class: JonnyW\PhantomJs\Cache\FileCache | ||
phantomjs.loader.file_locator.class: Symfony\Component\Config\FileLocator |
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 |
---|---|---|
@@ -0,0 +1,170 @@ | ||
services: | ||
|
||
############## | ||
### ENGINE ### | ||
############## | ||
|
||
engine: | ||
alias: phantomjs.engine | ||
|
||
phantomjs.engine: | ||
class: "%phantomjs.engine.class%" | ||
|
||
################## | ||
### PROCEDURES ### | ||
################## | ||
|
||
procedure_loader: | ||
alias: phantomjs.procedure.chain_loader | ||
|
||
procedure_validator: | ||
alias: phantomjs.procedure.procedure_validator | ||
|
||
procedure_compiler: | ||
alias: phantomjs.procedure.procedure_compiler | ||
|
||
procedure_loader_factory: | ||
alias: phantomjs.procedure.procedure_loader_factory | ||
|
||
phantomjs.procedure.file_locator: | ||
class: "%phantomjs.loader.file_locator.class%" | ||
arguments: | ||
- "%phantomjs.procedure_dir%" | ||
public: false | ||
|
||
phantomjs.procedure.procedure_loader: | ||
class: "%phantomjs.procedure.procedure_loader.class%" | ||
arguments: | ||
- "@phantomjs.procedure.procedure_factory" | ||
- "@phantomjs.procedure.file_locator" | ||
public: false | ||
|
||
phantomjs.procedure.chain_loader: | ||
class: "%phantomjs.procedure.chain_loader.class%" | ||
arguments: | ||
- [ "@phantomjs.procedure.procedure_loader" ] | ||
public: false | ||
|
||
phantomjs.procedure.procedure_factory: | ||
class: "%phantomjs.procedure.procedure_factory.class%" | ||
arguments: | ||
- "@engine" | ||
- "@phantomjs.parser.json_parser" | ||
- "@phantomjs.cache.file_cache" | ||
- "@phantomjs.template.template_renderer" | ||
public: false | ||
|
||
phantomjs.procedure.procedure_loader_factory: | ||
class: "%phantomjs.procedure.procedure_loader_factory.class%" | ||
arguments: | ||
- "@phantomjs.procedure.procedure_factory" | ||
public: false | ||
|
||
phantomjs.procedure.procedure_compiler: | ||
class: "%phantomjs.procedure.procedure_compiler.class%" | ||
arguments: | ||
- "@procedure_loader" | ||
- "@procedure_validator" | ||
- "@phantomjs.cache.file_cache" | ||
- "@phantomjs.procedure.template_renderer" | ||
public: false | ||
|
||
phantomjs.procedure.procedure_validator: | ||
class: "%phantomjs.procedure.procedure_validator.class%" | ||
arguments: | ||
- "@procedure_loader" | ||
- "@validator" | ||
public: false | ||
|
||
############ | ||
### HTTP ### | ||
############ | ||
|
||
message_factory: | ||
alias: phantomjs.http.message_factory | ||
|
||
phantomjs.http.message_factory: | ||
class: "%phantomjs.http.message_factory.class%" | ||
public: false | ||
|
||
################ | ||
### PARSING #### | ||
################ | ||
|
||
phantomjs.parser.json_parser: | ||
class: "%phantomjs.parser.json_parser.class%" | ||
public: false | ||
|
||
################### | ||
### VALIDATION #### | ||
################### | ||
|
||
validator: | ||
alias: phantomjs.validator.esprima | ||
|
||
phantomjs.validator.file_locator: | ||
class: "%phantomjs.loader.file_locator.class%" | ||
arguments: | ||
- "%phantomjs.validator_dir%" | ||
public: false | ||
|
||
phantomjs.validator.esprima: | ||
class: "%phantomjs.validator.esprima.class%" | ||
arguments: | ||
- "@phantomjs.validator.file_locator" | ||
- "%phantomjs.validator_engine%" | ||
public: false | ||
|
||
################## | ||
### TEMPLATES #### | ||
################## | ||
|
||
phantomjs.template.template_renderer: | ||
class: "%phantomjs.template.template_renderer.class%" | ||
arguments: | ||
- "@phantomjs.twig.environment" | ||
public: false | ||
|
||
phantomjs.twig.environment: | ||
class: "%phantomjs.twig.environment.class%" | ||
arguments: | ||
- "@phantomjs.twig.array_loader" | ||
public: false | ||
|
||
phantomjs.twig.array_loader: | ||
class: "%phantomjs.twig.array_loader.class%" | ||
arguments: | ||
- [] | ||
public: false | ||
|
||
phantomjs.procedure.template_renderer: | ||
class: "%phantomjs.template.template_renderer.class%" | ||
arguments: | ||
- "@phantomjs.procedure.twig.environment" | ||
public: false | ||
|
||
phantomjs.procedure.twig.environment: | ||
class: "%phantomjs.twig.environment.class%" | ||
arguments: | ||
- "@phantomjs.twig.array_loader" | ||
public: false | ||
calls: | ||
- [ "setLexer", [ "@phantomjs.procedure.twig.lexer" ] ] | ||
|
||
phantomjs.procedure.twig.lexer: | ||
class: "%phantomjs.twig.lexer.class%" | ||
arguments: | ||
- "@phantomjs.procedure.twig.environment" | ||
- { tag_variable: [ "[[", "]]" ], tag_comment: [ "[#", "#]" ], tag_block: [ "[%", "%]" ], interpolation: [ "#[", "]" ] } | ||
public: false | ||
|
||
################## | ||
### RESOURCES #### | ||
################## | ||
|
||
phantomjs.cache.file_cache: | ||
class: "%phantomjs.cache.file_cache.class%" | ||
arguments: | ||
- "%phantomjs.cache_dir%" | ||
- "%phantomjs.procedure_extension%" | ||
public: false |
Empty file.
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 |
---|---|---|
@@ -0,0 +1,101 @@ | ||
|
||
[% autoescape false %] | ||
{% autoescape false %} | ||
|
||
/** | ||
* Set up page and script parameters | ||
*/ | ||
var page = require('webpage').create(), | ||
system = require('system'), | ||
response = {}, | ||
debug = [], | ||
logs = [], | ||
procedure = {}; | ||
|
||
/** | ||
* Global variables | ||
*/ | ||
[[ engine.load('global_variables') ]] | ||
|
||
/** | ||
* Define width & height of capture | ||
*/ | ||
[[ engine.load('page_clip_rect') ]] | ||
|
||
/** | ||
* Define paper size. | ||
*/ | ||
[[ engine.load('page_paper_size') ]] | ||
|
||
/** | ||
* Define viewport size. | ||
*/ | ||
[[ engine.load('page_viewport_size') ]] | ||
|
||
/** | ||
* Define custom headers. | ||
*/ | ||
[[ engine.load('page_custom_headers') ]] | ||
|
||
/** | ||
* Page settings | ||
*/ | ||
[[ engine.load('page_settings') ]] | ||
|
||
/** | ||
* Page cookies | ||
*/ | ||
[[ engine.load('page_cookies') ]] | ||
|
||
/** | ||
* On resource timeout | ||
*/ | ||
page.onResourceTimeout = function (error) { | ||
[[ engine.load('page_on_resource_timeout') ]] | ||
}; | ||
|
||
/** | ||
* On resource requested | ||
*/ | ||
page.onResourceRequested = function (resource, networkRequest) { | ||
[[ engine.load('page_on_resource_requested') ]] | ||
}; | ||
|
||
/** | ||
* On resource received | ||
*/ | ||
page.onResourceReceived = function (resource) { | ||
[[ engine.load('page_on_resource_received') ]] | ||
}; | ||
|
||
/** | ||
* Handle page errors | ||
*/ | ||
page.onError = function (msg, trace) { | ||
[[ engine.load('page_on_error') ]] | ||
}; | ||
|
||
/** | ||
* Handle global errors | ||
*/ | ||
phantom.onError = function(msg, trace) { | ||
[[ engine.load('phantom_on_error') ]] | ||
}; | ||
|
||
/** | ||
* Open page | ||
*/ | ||
page.open ('{{ input.getUrl() }}', '{{ input.getMethod() }}', '{{ input.getBody() }}', function (status) { | ||
[[ engine.load('page_body_styles') ]] | ||
[[ engine.load('page_open') ]] | ||
}); | ||
|
||
/** | ||
* Execute procedure | ||
*/ | ||
procedure.execute = function (status) { | ||
[[ engine.load( 'procedure_' ~ procedure_type ) ]] | ||
}; | ||
|
||
{% endautoescape %} | ||
[% endautoescape %] |
Oops, something went wrong.