├── tutorial ├── data │ ├── dir │ │ └── index.yaml │ ├── empty.yaml │ ├── index.yaml │ ├── test__2.yaml │ ├── enum.yaml │ ├── __common.yaml │ ├── common │ │ ├── common_pc.yaml │ │ └── common_sp.yaml │ ├── statics.yaml │ ├── nest.yaml │ └── error.json ├── jade4j │ ├── static │ │ └── .gitkeep │ ├── routing.groovy │ ├── template.yaml │ ├── template │ │ ├── common │ │ │ └── header.jade │ │ └── test.jade │ ├── data.groovy │ ├── function │ │ └── math.groovy │ └── project.yaml ├── json │ ├── ajax.groovy │ ├── ajax │ │ ├── api │ │ │ ├── array.yaml │ │ │ ├── additional.yaml │ │ │ ├── custom_response.yaml │ │ │ ├── test.yaml │ │ │ ├── test__2.yaml │ │ │ ├── test__post.yaml │ │ │ ├── test__delete.yaml │ │ │ └── test__post__2.yaml │ │ └── common │ │ │ └── common.yaml │ └── project.yaml ├── messagepack │ ├── data │ │ ├── array.yaml │ │ ├── array_mix.yaml │ │ └── nest.yaml │ ├── project.yaml │ └── project_compact.yaml ├── handlebars │ ├── template │ │ ├── common │ │ │ ├── testembedded.hbs │ │ │ ├── footer.hbs │ │ │ ├── base.hbs │ │ │ ├── testparts.hbs │ │ │ └── header.hbs │ │ └── test.hbs │ ├── routing.groovy │ ├── static │ │ └── img │ │ │ └── sample.jpg │ ├── data.groovy │ ├── function │ │ └── staticUrl.groovy │ ├── template.yaml │ └── project.yaml ├── thymeleaf │ ├── routing.groovy │ ├── data.groovy │ ├── template │ │ ├── common │ │ │ └── header.html │ │ └── test.html │ ├── function │ │ └── helper.groovy │ ├── project.yaml │ └── template.yaml ├── velocity │ ├── routing.groovy │ ├── template │ │ ├── common │ │ │ ├── include.vm │ │ │ └── header.vm │ │ └── VM_global_library.vm │ ├── data.groovy │ ├── project.yaml │ └── velocity.properties ├── groovytemplates │ ├── routing.groovy │ ├── template.yaml │ ├── data.groovy │ └── project.yaml ├── static │ ├── expect │ │ ├── empty.html │ │ ├── with_common │ │ │ └── now.html │ │ ├── statics.html │ │ ├── builtin.html │ │ ├── builtin_variables.html │ │ ├── enum.html │ │ └── custom_list.html │ └── img │ │ └── sample.jpg ├── protobuf │ ├── data │ │ ├── enum.yaml │ │ ├── nest2.yaml │ │ ├── test.yaml │ │ ├── _test.yaml │ │ ├── simple__optional.yaml │ │ └── nest1.yaml │ ├── protobuf │ │ ├── schema │ │ │ ├── job.proto │ │ │ ├── various_nest.proto │ │ │ └── user.proto │ │ └── api │ │ │ ├── nest1.proto │ │ │ ├── enum.proto │ │ │ ├── nest2.proto │ │ │ └── test.proto │ └── project.yaml └── freemarker │ ├── data.groovy │ ├── function │ └── staticUrl.groovy │ ├── variable.groovy │ ├── project.yaml │ ├── tag │ └── span.groovy │ └── template.yaml ├── aeromock-cli ├── src │ ├── test │ │ ├── java │ │ │ └── .gitkeep │ │ ├── resources │ │ │ └── test │ │ │ │ ├── data │ │ │ │ └── test.yaml │ │ │ │ ├── template │ │ │ │ └── text.tmpl │ │ │ │ └── project.yaml │ │ └── scala │ │ │ └── jp │ │ │ └── co │ │ │ └── cyberagent │ │ │ └── aeromock │ │ │ └── cli │ │ │ ├── TestTemplateService.scala │ │ │ └── CliJobSelectorSpec.scala │ └── main │ │ ├── resources │ │ └── .gitkeep │ │ ├── scala │ │ └── jp │ │ │ └── co │ │ │ └── cyberagent │ │ │ └── aeromock │ │ │ └── cli │ │ │ ├── AeromockCliModule.scala │ │ │ ├── validation │ │ │ └── package.scala │ │ │ ├── job │ │ │ └── CliJobs.scala │ │ │ └── CliJob.scala │ │ └── java │ │ └── jp │ │ └── co │ │ └── cyberagent │ │ └── aeromock │ │ └── cli │ │ └── Job.java └── Build.sbt ├── aeromock-jade4j ├── test │ ├── ajax │ │ └── .gitkeep │ ├── static │ │ └── .gitkeep │ ├── routing.groovy │ ├── template.yaml │ ├── template │ │ ├── common │ │ │ └── header.jade │ │ └── test.jade │ ├── ajax.groovy │ ├── data.groovy │ ├── function │ │ └── math.groovy │ ├── template.groovy │ ├── project.yaml │ └── data │ │ └── test.yaml ├── Build.sbt └── src │ ├── main │ └── scala │ │ └── jp │ │ └── co │ │ └── cyberagent │ │ └── aeromock │ │ └── template │ │ └── jade4j │ │ ├── Jade4jBootstrap.scala │ │ ├── Jade4jConfigDetailDef.scala │ │ ├── Jade4jConfig.scala │ │ └── Jade4jConfigDef.scala │ └── test │ └── scala │ └── jp │ └── co │ └── cyberagent │ └── aeromock │ ├── template │ └── jade4j │ │ ├── Jade4jBootstrapSpec.scala │ │ └── Jade4jTemplateServiceSpec.scala │ └── core │ └── bootstrap │ └── BootstrapManagerJade4jSpec.scala ├── aeromock-thymeleaf ├── test │ ├── ajax │ │ └── .gitkeep │ ├── static │ │ └── .gitkeep │ ├── routing.groovy │ ├── ajax.groovy │ ├── data.groovy │ ├── template │ │ ├── common │ │ │ └── header.html │ │ └── test.html │ ├── function │ │ └── helper.groovy │ ├── template.groovy │ ├── template.yaml │ └── project.yaml ├── Build.sbt └── src │ ├── main │ └── scala │ │ └── jp │ │ └── co │ │ └── cyberagent │ │ └── aeromock │ │ └── template │ │ └── thymeleaf │ │ ├── ThymeleafBootstrap.scala │ │ ├── ThymeleafConfig.scala │ │ ├── ThymeleafDetailDef.scala │ │ └── DynamicUtilityObject.scala │ └── test │ └── scala │ └── jp │ └── co │ └── cyberagent │ └── aeromock │ ├── template │ └── thymeleaf │ │ ├── ThymeleafBootstrapSpec.scala │ │ └── ThymeleafTemplateServiceSpec.scala │ └── core │ └── bootstrap │ └── BootstrapManagerThymeleafSpec.scala ├── aeromock-velocity ├── test │ ├── ajax │ │ └── .gitkeep │ ├── static │ │ └── .gitkeep │ ├── routing.groovy │ ├── template │ │ ├── common │ │ │ ├── include.vm │ │ │ └── header.vm │ │ └── VM_global_library.vm │ ├── ajax.groovy │ ├── data.groovy │ ├── velocity.properties │ └── project.yaml ├── Build.sbt └── src │ ├── main │ └── scala │ │ └── jp │ │ └── co │ │ └── cyberagent │ │ └── aeromock │ │ └── template │ │ └── velocity │ │ ├── VelocityConfigDetailDef.scala │ │ ├── VelocityConfig.scala │ │ ├── VelocityBootstrap.scala │ │ ├── VelocityConfigDef.scala │ │ └── VelocityConfigurationInitializer.scala │ └── test │ └── scala │ └── jp │ └── co │ └── cyberagent │ └── aeromock │ ├── template │ └── velocity │ │ ├── VelocityBootstrapSpec.scala │ │ └── VelocityTemplateServiceSpec.scala │ └── core │ └── bootstrap │ └── BootstrapManagerVelocitySpec.scala ├── aeromock-freemarker ├── src │ ├── test │ │ ├── java │ │ │ └── .gitkeep │ │ ├── resources │ │ │ └── .gitkeep │ │ └── scala │ │ │ └── jp │ │ │ └── co │ │ │ └── cyberagent │ │ │ └── aeromock │ │ │ ├── template │ │ │ └── freemarker │ │ │ │ ├── FreemarkerBootstrap.scala │ │ │ │ └── FreemarkerTemplateServiceSpec.scala │ │ │ └── core │ │ │ └── bootstrap │ │ │ └── BootstrapManagerFreemarkerSpec.scala │ └── main │ │ └── scala │ │ └── jp │ │ └── co │ │ └── cyberagent │ │ └── aeromock │ │ └── template │ │ └── freemarker │ │ ├── directive │ │ ├── AeromockNestedTemplateModel.scala │ │ ├── AeromockCustomDirective.scala │ │ └── AeromockScriptDirective.scala │ │ ├── BuiltinMockVariableHelper.scala │ │ ├── FreemarkerBootstrap.scala │ │ └── method │ │ └── AeromockCustomMethod.scala ├── test │ ├── data │ │ ├── empty.yaml │ │ ├── empty__2.yaml │ │ ├── index.yaml │ │ ├── dir │ │ │ └── index.yaml │ │ ├── empty__xx.yaml │ │ ├── empty__a_1_b_2.yaml │ │ ├── enum.yaml │ │ ├── with_common │ │ │ └── now.yaml │ │ ├── __common.yaml │ │ ├── builtin_variables.yaml │ │ ├── custom_response.yaml │ │ ├── statics.yaml │ │ ├── builtin.yaml │ │ ├── nest.yaml │ │ ├── __enum.yaml │ │ ├── __enum2.yaml │ │ ├── error.json │ │ ├── custom_list__2.yaml │ │ ├── data.yaml │ │ ├── with_property.yaml │ │ ├── data_proxy.yaml │ │ ├── method.yaml │ │ └── custom_list.yaml │ ├── template.groovy │ ├── ajax │ │ ├── __common2.yaml │ │ ├── __common.yaml │ │ ├── additional.yaml │ │ ├── nuko__2.json │ │ ├── array.yaml │ │ ├── nuko__3.yaml │ │ ├── nuko.yaml │ │ ├── neko.json │ │ └── array__2.json │ ├── routing.groovy │ ├── template │ │ ├── empty.ftl │ │ ├── custom_response.ftl │ │ ├── dir │ │ │ └── index.ftl │ │ ├── common │ │ │ └── footer.ftl │ │ ├── with_common │ │ │ └── now.ftl │ │ ├── index.ftl │ │ ├── statics.ftl │ │ ├── builtin.ftl │ │ ├── with_property.ftl │ │ ├── builtin_variables.ftl │ │ ├── enum.ftl │ │ ├── method.ftl │ │ └── data.ftl │ ├── static │ │ ├── expect │ │ │ ├── empty.html │ │ │ ├── with_common │ │ │ │ └── now.html │ │ │ ├── statics.html │ │ │ ├── builtin.html │ │ │ ├── builtin_variables.html │ │ │ ├── enum.html │ │ │ └── custom_list.html │ │ └── img │ │ │ └── sample.jpg │ ├── variable.groovy │ ├── data.groovy │ ├── function │ │ └── staticUrl.groovy │ ├── ajax.groovy │ ├── tag │ │ └── span.groovy │ ├── project.yaml │ └── template.yaml └── Build.sbt ├── aeromock-groovy-template ├── test │ ├── ajax │ │ └── .gitkeep │ ├── static │ │ └── .gitkeep │ ├── template.groovy │ ├── routing.groovy │ ├── template.yaml │ ├── ajax.groovy │ ├── data.groovy │ └── project.yaml ├── Build.sbt └── src │ ├── main │ └── scala │ │ └── jp │ │ └── co │ │ └── cyberagent │ │ └── aeromock │ │ └── template │ │ └── groovytemplate │ │ ├── GroovyTemplateDefailDef.scala │ │ ├── GroovyTemplateConfig.scala │ │ ├── GroovyTemplateBootstrap.scala │ │ ├── TemplateEngineFactory.scala │ │ └── GroovyTemplateConfigDef.scala │ └── test │ └── scala │ └── jp │ └── co │ └── cyberagent │ └── aeromock │ ├── template │ └── groovytemplate │ │ ├── GroovyTemplateBootstrapSpec.scala │ │ └── GroovyTemplateServiceSpec.scala │ └── core │ └── bootstrap │ └── BootstrapManagerGroovyTemplatesSpec.scala ├── aeromock-report ├── .gitattributes ├── app │ ├── scripts │ │ ├── components │ │ │ └── components.js │ │ └── aeromock-report.js │ ├── styles │ │ ├── aeromock-report.sass │ │ └── components │ │ │ └── components.sass │ ├── index.html │ ├── demo.html │ └── aeromock-report.html ├── .bowerrc ├── .gitignore ├── .editorconfig ├── bower.json ├── .jshintrc └── package.json ├── project ├── build.properties ├── Version.scala └── plugin.sbt ├── aeromock-server ├── src │ ├── test │ │ ├── resources │ │ │ ├── pathtest │ │ │ │ ├── dummy.txt │ │ │ │ └── getChildren │ │ │ │ │ ├── file1.txt │ │ │ │ │ └── file2.txt │ │ │ ├── checksum-test.txt │ │ │ ├── data │ │ │ │ ├── yaml.yaml │ │ │ │ ├── DataFileReaderFactory │ │ │ │ │ ├── data.json │ │ │ │ │ ├── data.yaml │ │ │ │ │ └── data.yml │ │ │ │ ├── DataFileService │ │ │ │ │ └── data │ │ │ │ │ │ ├── other.yaml │ │ │ │ │ │ ├── path1.yaml │ │ │ │ │ │ ├── path1__3.txt │ │ │ │ │ │ ├── duplicated.json │ │ │ │ │ │ ├── duplicated.yaml │ │ │ │ │ │ ├── other__post.yaml │ │ │ │ │ │ ├── path1 │ │ │ │ │ │ ├── other.yaml │ │ │ │ │ │ ├── path2.yaml │ │ │ │ │ │ ├── path2__2.yaml │ │ │ │ │ │ ├── path2__3.txt │ │ │ │ │ │ ├── path2__4.json │ │ │ │ │ │ ├── path2__post.yaml │ │ │ │ │ │ ├── path2__put.yaml │ │ │ │ │ │ ├── path2__xx.yaml │ │ │ │ │ │ ├── path2.dot │ │ │ │ │ │ │ ├── path3.yaml │ │ │ │ │ │ │ ├── path3__2.yaml │ │ │ │ │ │ │ └── path3__4.json │ │ │ │ │ │ ├── path2__delete.yaml │ │ │ │ │ │ └── path2__post__2.yaml │ │ │ │ │ │ ├── path1__2.yaml │ │ │ │ │ │ ├── path1__4.json │ │ │ │ │ │ ├── path1__post.yaml │ │ │ │ │ │ ├── path1__put.yaml │ │ │ │ │ │ ├── path1__xx.yaml │ │ │ │ │ │ ├── duplicated__2.json │ │ │ │ │ │ ├── duplicated__2.yaml │ │ │ │ │ │ ├── duplicated__post.json │ │ │ │ │ │ ├── duplicated__post.yaml │ │ │ │ │ │ ├── path1__delete.yaml │ │ │ │ │ │ └── path1__post__2.yaml │ │ │ │ ├── CommonDataHelper │ │ │ │ │ ├── empty.groovy │ │ │ │ │ ├── ajax │ │ │ │ │ │ ├── __common1.yaml │ │ │ │ │ │ └── __common2.yaml │ │ │ │ │ ├── illegal_return_value.groovy │ │ │ │ │ ├── use_string.groovy │ │ │ │ │ ├── execution_error.groovy │ │ │ │ │ └── use_gstring.groovy │ │ │ │ └── json.json │ │ │ └── script │ │ │ │ ├── script1.groovy │ │ │ │ ├── use_cache.groovy │ │ │ │ ├── binding.groovy │ │ │ │ └── execute_error.groovy │ │ └── scala │ │ │ └── jp │ │ │ └── co │ │ │ └── cyberagent │ │ │ └── aeromock │ │ │ ├── data │ │ │ ├── AllowedDataTypeSpec.scala │ │ │ └── DataFileReaderFactorySpec.scala │ │ │ ├── test │ │ │ └── RequestScope.scala │ │ │ ├── helper │ │ │ ├── StringContextHelperSpec.scala │ │ │ └── SystemHelperSpec.scala │ │ │ └── core │ │ │ └── http │ │ │ └── ParsedRequestSpec.scala │ └── main │ │ ├── resources │ │ ├── .gitignore │ │ └── logback.xml │ │ ├── scala │ │ └── jp │ │ │ └── co │ │ │ └── cyberagent │ │ │ └── aeromock │ │ │ ├── proxy │ │ │ ├── ProxyParameter.scala │ │ │ └── DynamicProxy.scala │ │ │ ├── config │ │ │ ├── TemplateConfig.scala │ │ │ ├── UserConfig.scala │ │ │ ├── template_def.scala │ │ │ ├── ServerOption.scala │ │ │ └── MessageManager.scala │ │ │ ├── data │ │ │ ├── DataFileReader.scala │ │ │ ├── AllowedDataType.scala │ │ │ ├── DataFileReaderFactory.scala │ │ │ └── JsonDataFileReader.scala │ │ │ ├── server │ │ │ ├── package.scala │ │ │ ├── http │ │ │ │ ├── dto.scala │ │ │ │ ├── UserStaticFileHttpRequestProcessor.scala │ │ │ │ ├── AeromockApiHttpRequestProcessor.scala │ │ │ │ ├── HttpRequestProcessor.scala │ │ │ │ ├── TemplateHttpRequestProcessor.scala │ │ │ │ └── ServerExceptionHandler.scala │ │ │ ├── AccessLog.scala │ │ │ ├── AeromockServerInitializer.scala │ │ │ └── AeromockServer.scala │ │ │ ├── core │ │ │ ├── bootstrap │ │ │ │ └── Bootstrap.scala │ │ │ ├── http │ │ │ │ ├── HttpRequestContainer.scala │ │ │ │ └── Rest.scala │ │ │ ├── el │ │ │ │ └── VariableHelper.scala │ │ │ ├── ObjectCache.scala │ │ │ ├── Validations.scala │ │ │ └── script │ │ │ │ └── GroovyDirectiveScriptRunner.scala │ │ │ ├── util │ │ │ ├── DummyWriter.scala │ │ │ └── ResourceUtil.scala │ │ │ ├── api │ │ │ └── AeromockApi.scala │ │ │ ├── AeromockTestModule.scala │ │ │ ├── Aeromock.scala │ │ │ ├── AeromockInfo.scala │ │ │ └── protobuf │ │ │ ├── ProtoFieldLabel.scala │ │ │ └── ParsedProto.scala │ │ └── java │ │ └── jp │ │ └── co │ │ └── cyberagent │ │ └── aeromock │ │ └── core │ │ └── annotation │ │ └── TemplateIdentifier.java └── Build.sbt ├── aeromock-dsl ├── gradle.properties ├── testscripts │ └── routing │ │ ├── routing_empty.groovy │ │ ├── routing_localhost.groovy │ │ └── routing_virtualhost.groovy ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── .gitignore └── src │ └── main │ └── groovy │ └── jp │ └── co │ └── cyberagent │ └── aeromock │ └── dsl │ ├── exception │ ├── AeromockBadGrammarException.groovy │ └── AeromockPatternSyntaxException.groovy │ └── routing │ └── RoutingDsl.groovy ├── aeromock-handlebars-java ├── test │ ├── template.groovy │ ├── template │ │ ├── common │ │ │ ├── testembedded.hbs │ │ │ ├── footer.hbs │ │ │ ├── base.hbs │ │ │ ├── testparts.hbs │ │ │ └── header.hbs │ │ └── test.hbs │ ├── routing.groovy │ ├── ajax.groovy │ ├── static │ │ └── img │ │ │ └── sample.jpg │ ├── data.groovy │ ├── function │ │ └── staticUrl.groovy │ ├── template.yaml │ ├── project.yaml │ └── data │ │ └── test.yaml ├── Build.sbt └── src │ ├── main │ └── scala │ │ └── jp │ │ └── co │ │ └── cyberagent │ │ └── aeromock │ │ └── template │ │ └── handlebars │ │ ├── HandlebarsBootstrap.scala │ │ └── helper │ │ └── DynamicHelperMethod.scala │ └── test │ └── scala │ └── jp │ └── co │ └── cyberagent │ └── aeromock │ ├── template │ └── handlebars │ │ ├── HandlebarsBootstrapSpec.scala │ │ └── HandlebarsTemplateServiceSpec.scala │ └── core │ └── bootstrap │ └── BootstrapManagerHandlebarsSpec.scala ├── aeromock-view ├── .bowerrc ├── .gitignore ├── .travis.yml ├── favicon.ico ├── img │ └── aeromock.png ├── bower.json ├── .editorconfig ├── src │ └── .jshintrc ├── .jshintrc ├── package.json └── test │ └── .jshintrc ├── .sbtopts ├── modules.txt ├── versions.txt ├── aeromock-spec-support ├── Build.sbt └── src │ └── main │ └── scala │ └── jp │ └── co │ └── cyberagent │ └── aeromock │ └── test │ └── package.scala ├── .gitignore ├── .editorconfig └── LICENSE /tutorial/data/dir/index.yaml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tutorial/data/empty.yaml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tutorial/data/index.yaml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tutorial/data/test__2.yaml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tutorial/jade4j/static/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /aeromock-cli/src/test/java/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /aeromock-jade4j/test/ajax/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /aeromock-jade4j/test/static/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /aeromock-thymeleaf/test/ajax/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /aeromock-velocity/test/ajax/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /aeromock-velocity/test/static/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /aeromock-cli/src/main/resources/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /aeromock-freemarker/src/test/java/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /aeromock-freemarker/test/data/empty.yaml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /aeromock-freemarker/test/data/empty__2.yaml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /aeromock-freemarker/test/data/index.yaml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /aeromock-groovy-template/test/ajax/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /aeromock-thymeleaf/test/static/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /aeromock-freemarker/src/test/resources/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /aeromock-freemarker/test/data/dir/index.yaml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /aeromock-freemarker/test/data/empty__xx.yaml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /aeromock-groovy-template/test/static/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /aeromock-groovy-template/test/template.groovy: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /aeromock-report/.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | -------------------------------------------------------------------------------- /project/build.properties: -------------------------------------------------------------------------------- 1 | sbt.version=0.13.7 2 | -------------------------------------------------------------------------------- /aeromock-cli/src/test/resources/test/data/test.yaml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /aeromock-freemarker/test/data/empty__a_1_b_2.yaml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /aeromock-server/src/test/resources/pathtest/dummy.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tutorial/data/enum.yaml: -------------------------------------------------------------------------------- 1 | # __enumを参照するので敢えて未定義 2 | -------------------------------------------------------------------------------- /aeromock-cli/src/test/resources/test/template/text.tmpl: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /aeromock-dsl/gradle.properties: -------------------------------------------------------------------------------- 1 | version=0.2.6-SNAPSHOT 2 | -------------------------------------------------------------------------------- /aeromock-server/src/main/resources/.gitignore: -------------------------------------------------------------------------------- 1 | public/ 2 | -------------------------------------------------------------------------------- /tutorial/json/ajax.groovy: -------------------------------------------------------------------------------- 1 | return ["common/common"] 2 | -------------------------------------------------------------------------------- /aeromock-freemarker/test/template.groovy: -------------------------------------------------------------------------------- 1 | println(configuration) -------------------------------------------------------------------------------- /aeromock-server/src/test/resources/checksum-test.txt: -------------------------------------------------------------------------------- 1 | test 2 | -------------------------------------------------------------------------------- /tutorial/json/ajax/api/array.yaml: -------------------------------------------------------------------------------- 1 | - element1 2 | - element2 3 | -------------------------------------------------------------------------------- /aeromock-freemarker/test/data/enum.yaml: -------------------------------------------------------------------------------- 1 | # __enumを参照するので敢えて未定義 2 | -------------------------------------------------------------------------------- /aeromock-handlebars-java/test/template.groovy: -------------------------------------------------------------------------------- 1 | println(handlebars) -------------------------------------------------------------------------------- /aeromock-server/src/test/resources/data/yaml.yaml: -------------------------------------------------------------------------------- 1 | - aaa 2 | - bbb -------------------------------------------------------------------------------- /aeromock-server/src/test/resources/pathtest/getChildren/file1.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /aeromock-server/src/test/resources/pathtest/getChildren/file2.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /aeromock-view/.bowerrc: -------------------------------------------------------------------------------- 1 | { 2 | "directory": "components" 3 | } 4 | -------------------------------------------------------------------------------- /tutorial/messagepack/data/array.yaml: -------------------------------------------------------------------------------- 1 | - 100 2 | - 200 3 | - 300 4 | -------------------------------------------------------------------------------- /aeromock-dsl/testscripts/routing/routing_empty.groovy: -------------------------------------------------------------------------------- 1 | routing { 2 | } 3 | -------------------------------------------------------------------------------- /aeromock-freemarker/test/data/with_common/now.yaml: -------------------------------------------------------------------------------- 1 | # commonで定義するので敢えて空 -------------------------------------------------------------------------------- /aeromock-report/app/scripts/components/components.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | -------------------------------------------------------------------------------- /aeromock-server/src/test/resources/data/DataFileReaderFactory/data.json: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /aeromock-server/src/test/resources/data/DataFileReaderFactory/data.yaml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /aeromock-server/src/test/resources/data/DataFileReaderFactory/data.yml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /aeromock-server/src/test/resources/data/DataFileService/data/other.yaml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /aeromock-server/src/test/resources/data/DataFileService/data/path1.yaml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /aeromock-server/src/test/resources/data/DataFileService/data/path1__3.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /aeromock-view/.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules/ 2 | /components/ 3 | dist 4 | -------------------------------------------------------------------------------- /aeromock-server/src/test/resources/data/CommonDataHelper/empty.groovy: -------------------------------------------------------------------------------- 1 | return [] -------------------------------------------------------------------------------- /aeromock-server/src/test/resources/data/DataFileService/data/duplicated.json: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /aeromock-server/src/test/resources/data/DataFileService/data/duplicated.yaml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /aeromock-server/src/test/resources/data/DataFileService/data/other__post.yaml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /aeromock-server/src/test/resources/data/DataFileService/data/path1/other.yaml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /aeromock-server/src/test/resources/data/DataFileService/data/path1/path2.yaml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /aeromock-server/src/test/resources/data/DataFileService/data/path1__2.yaml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /aeromock-server/src/test/resources/data/DataFileService/data/path1__4.json: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /aeromock-server/src/test/resources/data/DataFileService/data/path1__post.yaml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /aeromock-server/src/test/resources/data/DataFileService/data/path1__put.yaml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /aeromock-server/src/test/resources/data/DataFileService/data/path1__xx.yaml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /aeromock-report/.bowerrc: -------------------------------------------------------------------------------- 1 | { 2 | "directory": "./lib/.bower_components" 3 | } 4 | -------------------------------------------------------------------------------- /aeromock-report/app/styles/aeromock-report.sass: -------------------------------------------------------------------------------- 1 | @import "components/components" 2 | -------------------------------------------------------------------------------- /aeromock-server/src/test/resources/data/DataFileService/data/duplicated__2.json: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /aeromock-server/src/test/resources/data/DataFileService/data/duplicated__2.yaml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /aeromock-server/src/test/resources/data/DataFileService/data/duplicated__post.json: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /aeromock-server/src/test/resources/data/DataFileService/data/duplicated__post.yaml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /aeromock-server/src/test/resources/data/DataFileService/data/path1/path2__2.yaml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /aeromock-server/src/test/resources/data/DataFileService/data/path1/path2__3.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /aeromock-server/src/test/resources/data/DataFileService/data/path1/path2__4.json: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /aeromock-server/src/test/resources/data/DataFileService/data/path1/path2__post.yaml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /aeromock-server/src/test/resources/data/DataFileService/data/path1/path2__put.yaml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /aeromock-server/src/test/resources/data/DataFileService/data/path1/path2__xx.yaml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /aeromock-server/src/test/resources/data/DataFileService/data/path1__delete.yaml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /aeromock-server/src/test/resources/data/DataFileService/data/path1__post__2.yaml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /aeromock-server/src/test/resources/script/script1.groovy: -------------------------------------------------------------------------------- 1 | return "script1!!" 2 | -------------------------------------------------------------------------------- /aeromock-server/src/test/resources/script/use_cache.groovy: -------------------------------------------------------------------------------- 1 | return "use cache" 2 | -------------------------------------------------------------------------------- /tutorial/data/__common.yaml: -------------------------------------------------------------------------------- 1 | hostname: ${HOST} 2 | __now: 2014-03-31T06:30:00+09:00 -------------------------------------------------------------------------------- /aeromock-server/src/test/resources/data/DataFileService/data/path1/path2.dot/path3.yaml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /aeromock-server/src/test/resources/data/DataFileService/data/path1/path2__delete.yaml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /aeromock-server/src/test/resources/data/DataFileService/data/path1/path2__post__2.yaml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /project/Version.scala: -------------------------------------------------------------------------------- 1 | object Version { 2 | val aeromock = "0.2.6-SNAPSHOT" 3 | } 4 | -------------------------------------------------------------------------------- /tutorial/handlebars/template/common/testembedded.hbs: -------------------------------------------------------------------------------- 1 |
2 | embedded 3 |
-------------------------------------------------------------------------------- /tutorial/jade4j/routing.groovy: -------------------------------------------------------------------------------- 1 | routing { 2 | server "localhost", { 3 | } 4 | } -------------------------------------------------------------------------------- /tutorial/thymeleaf/routing.groovy: -------------------------------------------------------------------------------- 1 | routing { 2 | server "localhost", { 3 | } 4 | } -------------------------------------------------------------------------------- /tutorial/velocity/routing.groovy: -------------------------------------------------------------------------------- 1 | routing { 2 | server "localhost", { 3 | } 4 | } -------------------------------------------------------------------------------- /aeromock-jade4j/test/routing.groovy: -------------------------------------------------------------------------------- 1 | routing { 2 | server "localhost", { 3 | } 4 | } -------------------------------------------------------------------------------- /aeromock-server/src/test/resources/data/CommonDataHelper/ajax/__common1.yaml: -------------------------------------------------------------------------------- 1 | prop1: prop1Value -------------------------------------------------------------------------------- /aeromock-server/src/test/resources/data/CommonDataHelper/ajax/__common2.yaml: -------------------------------------------------------------------------------- 1 | prop2: prop2Value -------------------------------------------------------------------------------- /aeromock-server/src/test/resources/data/DataFileService/data/path1/path2.dot/path3__2.yaml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /aeromock-server/src/test/resources/data/DataFileService/data/path1/path2.dot/path3__4.json: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /aeromock-server/src/test/resources/script/binding.groovy: -------------------------------------------------------------------------------- 1 | return PARAM1 + "_" + PARAM2 2 | -------------------------------------------------------------------------------- /aeromock-thymeleaf/test/routing.groovy: -------------------------------------------------------------------------------- 1 | routing { 2 | server "localhost", { 3 | } 4 | } -------------------------------------------------------------------------------- /aeromock-velocity/test/routing.groovy: -------------------------------------------------------------------------------- 1 | routing { 2 | server "localhost", { 3 | } 4 | } -------------------------------------------------------------------------------- /aeromock-view/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - '0.10' 4 | - '0.8' 5 | -------------------------------------------------------------------------------- /tutorial/handlebars/routing.groovy: -------------------------------------------------------------------------------- 1 | routing { 2 | server "localhost", { 3 | } 4 | } -------------------------------------------------------------------------------- /tutorial/json/project.yaml: -------------------------------------------------------------------------------- 1 | ajax: 2 | root: ./ajax 3 | jsonp_callback_name: callback 4 | -------------------------------------------------------------------------------- /aeromock-freemarker/test/ajax/__common2.yaml: -------------------------------------------------------------------------------- 1 | hostname: "localhost" 2 | common_name: "__common2" -------------------------------------------------------------------------------- /aeromock-freemarker/test/data/__common.yaml: -------------------------------------------------------------------------------- 1 | hostname: ${HOST} 2 | __now: 2014-03-31T06:30:00+09:00 -------------------------------------------------------------------------------- /aeromock-freemarker/test/routing.groovy: -------------------------------------------------------------------------------- 1 | routing { 2 | server "localhost", { 3 | } 4 | } -------------------------------------------------------------------------------- /aeromock-handlebars-java/test/template/common/testembedded.hbs: -------------------------------------------------------------------------------- 1 |
2 | embedded 3 |
-------------------------------------------------------------------------------- /aeromock-server/src/test/resources/data/CommonDataHelper/illegal_return_value.groovy: -------------------------------------------------------------------------------- 1 | return 111 -------------------------------------------------------------------------------- /aeromock-server/src/test/resources/data/json.json: -------------------------------------------------------------------------------- 1 | { 2 | "id":11111, 3 | "name":"neko" 4 | } -------------------------------------------------------------------------------- /tutorial/groovytemplates/routing.groovy: -------------------------------------------------------------------------------- 1 | routing { 2 | server "localhost", { 3 | } 4 | } -------------------------------------------------------------------------------- /tutorial/groovytemplates/template.yaml: -------------------------------------------------------------------------------- 1 | groovyTemplate: 2 | extension: .html 3 | mode: gstring -------------------------------------------------------------------------------- /aeromock-freemarker/test/data/builtin_variables.yaml: -------------------------------------------------------------------------------- 1 | __now: 2014-03-31T12:00:00+09:00 2 | hoge: fuga -------------------------------------------------------------------------------- /aeromock-groovy-template/test/routing.groovy: -------------------------------------------------------------------------------- 1 | routing { 2 | server "localhost", { 3 | } 4 | } -------------------------------------------------------------------------------- /aeromock-groovy-template/test/template.yaml: -------------------------------------------------------------------------------- 1 | groovyTemplate: 2 | extension: .html 3 | mode: gstring -------------------------------------------------------------------------------- /aeromock-handlebars-java/test/routing.groovy: -------------------------------------------------------------------------------- 1 | routing { 2 | server "localhost", { 3 | } 4 | } -------------------------------------------------------------------------------- /aeromock-server/src/test/resources/script/execute_error.groovy: -------------------------------------------------------------------------------- 1 | throw new AssertionError("error") 2 | -------------------------------------------------------------------------------- /tutorial/static/expect/empty.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | empty 5 | 6 | -------------------------------------------------------------------------------- /tutorial/velocity/template/common/include.vm: -------------------------------------------------------------------------------- 1 |

include

2 |

this area is include.vm

3 | -------------------------------------------------------------------------------- /aeromock-handlebars-java/test/template/common/footer.hbs: -------------------------------------------------------------------------------- 1 |

フッター

2 | 3 | -------------------------------------------------------------------------------- /aeromock-velocity/test/template/common/include.vm: -------------------------------------------------------------------------------- 1 |

includeのテスト

2 |

this area is include.vm

-------------------------------------------------------------------------------- /aeromock-view/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ca-archived/aeromock/HEAD/aeromock-view/favicon.ico -------------------------------------------------------------------------------- /tutorial/jade4j/template.yaml: -------------------------------------------------------------------------------- 1 | jade4j: 2 | extension: .jade 3 | mode: HTML 4 | prettyPrint: true 5 | -------------------------------------------------------------------------------- /aeromock-freemarker/test/template/empty.ftl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | empty 5 | 6 | -------------------------------------------------------------------------------- /aeromock-jade4j/test/template.yaml: -------------------------------------------------------------------------------- 1 | jade4j: 2 | extension: .jade 3 | mode: HTML 4 | prettyPrint: true 5 | -------------------------------------------------------------------------------- /tutorial/data/common/common_pc.yaml: -------------------------------------------------------------------------------- 1 | commonProp: commonPropValuePc 2 | commonHash: 3 | prop1: prop1ValuePc 4 | -------------------------------------------------------------------------------- /tutorial/data/common/common_sp.yaml: -------------------------------------------------------------------------------- 1 | commonProp: commonPropValueSp 2 | commonHash: 3 | prop1: prop1ValueSp 4 | -------------------------------------------------------------------------------- /tutorial/json/ajax/common/common.yaml: -------------------------------------------------------------------------------- 1 | commonProp: commonPropValue 2 | commonHash: 3 | prop1: prop1Value 4 | -------------------------------------------------------------------------------- /aeromock-freemarker/test/static/expect/empty.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | empty 5 | 6 | -------------------------------------------------------------------------------- /aeromock-view/img/aeromock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ca-archived/aeromock/HEAD/aeromock-view/img/aeromock.png -------------------------------------------------------------------------------- /tutorial/static/img/sample.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ca-archived/aeromock/HEAD/tutorial/static/img/sample.jpg -------------------------------------------------------------------------------- /aeromock-freemarker/test/template/custom_response.ftl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | index 5 | 6 | -------------------------------------------------------------------------------- /aeromock-freemarker/test/template/dir/index.ftl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | /dir/index 5 | 6 | -------------------------------------------------------------------------------- /aeromock-report/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | lib/.bower_components 3 | .sass-cache 4 | _vulcanized 5 | _dist 6 | _tmp 7 | -------------------------------------------------------------------------------- /tutorial/data/statics.yaml: -------------------------------------------------------------------------------- 1 | statics: 2 | Mock: 3 | __methods: 4 | - name: execute 5 | value: mockvalue -------------------------------------------------------------------------------- /.sbtopts: -------------------------------------------------------------------------------- 1 | -Xmx2048M 2 | -Xss1024M 3 | -XX:MaxPermSize=1024M 4 | -XX:+CMSClassUnloadingEnabled 5 | -XX:+UseCodeCacheFlushing 6 | -------------------------------------------------------------------------------- /aeromock-freemarker/test/ajax/__common.yaml: -------------------------------------------------------------------------------- 1 | hostname: "${HOST}" 2 | common_name: "__common" 3 | object: 4 | property1: value1 -------------------------------------------------------------------------------- /aeromock-freemarker/test/template/common/footer.ftl: -------------------------------------------------------------------------------- 1 |
2 | 3 |

this host is ${hostname}

-------------------------------------------------------------------------------- /aeromock-freemarker/test/template/with_common/now.ftl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ${.now} 5 | 6 | -------------------------------------------------------------------------------- /tutorial/jade4j/template/common/header.jade: -------------------------------------------------------------------------------- 1 | title #{title} 2 | script 3 | :testfilter 4 | sayHello -> alert "hello world." -------------------------------------------------------------------------------- /tutorial/static/expect/with_common/now.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 2014-03-31 06:30:00 5 | 6 | -------------------------------------------------------------------------------- /aeromock-jade4j/test/template/common/header.jade: -------------------------------------------------------------------------------- 1 | title #{title} 2 | script 3 | :testfilter 4 | sayHello -> alert "hello world." -------------------------------------------------------------------------------- /aeromock-server/src/test/resources/data/CommonDataHelper/use_string.groovy: -------------------------------------------------------------------------------- 1 | package data.CommonDataHelper 2 | 3 | return ["__common1"] -------------------------------------------------------------------------------- /tutorial/handlebars/template/common/footer.hbs: -------------------------------------------------------------------------------- 1 |

footer

2 |
3 |

This area is common/footer.hbs

4 |
5 | -------------------------------------------------------------------------------- /tutorial/json/ajax/api/additional.yaml: -------------------------------------------------------------------------------- 1 | title: additional.yaml 2 | commonHash: 3 | __additional: true 4 | prop2: prop2Value 5 | -------------------------------------------------------------------------------- /aeromock-freemarker/test/data/custom_response.yaml: -------------------------------------------------------------------------------- 1 | key: hoge 2 | __response: 3 | code: 400 4 | headers: 5 | Server: Nekotan Server -------------------------------------------------------------------------------- /aeromock-freemarker/test/data/statics.yaml: -------------------------------------------------------------------------------- 1 | statics: 2 | Mock: 3 | __methods: 4 | - name: execute 5 | value: mockvalue -------------------------------------------------------------------------------- /tutorial/handlebars/static/img/sample.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ca-archived/aeromock/HEAD/tutorial/handlebars/static/img/sample.jpg -------------------------------------------------------------------------------- /aeromock-freemarker/test/static/expect/with_common/now.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 2014-03-31 06:30:00 5 | 6 | -------------------------------------------------------------------------------- /aeromock-server/src/test/resources/data/CommonDataHelper/execution_error.groovy: -------------------------------------------------------------------------------- 1 | throw new RuntimeException("error!!") 2 | return ["__common1"] -------------------------------------------------------------------------------- /aeromock-dsl/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ca-archived/aeromock/HEAD/aeromock-dsl/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /aeromock-freemarker/test/data/builtin.yaml: -------------------------------------------------------------------------------- 1 | httpServletRequest: 2 | __methods: 3 | - name: getRequestURI 4 | value: "/path1/path2/path3" -------------------------------------------------------------------------------- /aeromock-freemarker/test/static/img/sample.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ca-archived/aeromock/HEAD/aeromock-freemarker/test/static/img/sample.jpg -------------------------------------------------------------------------------- /aeromock-dsl/testscripts/routing/routing_localhost.groovy: -------------------------------------------------------------------------------- 1 | routing { 2 | server "localhost", { 3 | rewrite(/^\/hoge$/, '/hoge/hoge') 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /aeromock-freemarker/test/variable.groovy: -------------------------------------------------------------------------------- 1 | return [ 2 | "PARAM1": [ 3 | "key1": "value1", 4 | "key2": "value2", 5 | ] 6 | ] 7 | -------------------------------------------------------------------------------- /aeromock-jade4j/test/ajax.groovy: -------------------------------------------------------------------------------- 1 | if (USER_AGENT =~ /(Android|iPhone|Mac)?/ ) { 2 | return ["__common"] 3 | } else { 4 | return ["__common2"] 5 | } -------------------------------------------------------------------------------- /aeromock-thymeleaf/test/ajax.groovy: -------------------------------------------------------------------------------- 1 | if (USER_AGENT =~ /(Android|iPhone|Mac)?/ ) { 2 | return ["__common"] 3 | } else { 4 | return ["__common2"] 5 | } -------------------------------------------------------------------------------- /aeromock-velocity/test/ajax.groovy: -------------------------------------------------------------------------------- 1 | if (USER_AGENT =~ /(Android|iPhone|Mac)?/ ) { 2 | return ["__common"] 3 | } else { 4 | return ["__common2"] 5 | } -------------------------------------------------------------------------------- /modules.txt: -------------------------------------------------------------------------------- 1 | aeromock-freemarker 2 | aeromock-handlebars-java 3 | aeromock-jade4j 4 | aeromock-velocity 5 | aeromock-groovy-template 6 | aeromock-thymeleaf -------------------------------------------------------------------------------- /tutorial/data/nest.yaml: -------------------------------------------------------------------------------- 1 | hoge: 2 | __methods: 3 | - name: execute 4 | value: "nekosan" 5 | neko: "nuko" 6 | fuga: 7 | piyo: 123 8 | -------------------------------------------------------------------------------- /tutorial/handlebars/template/common/base.hbs: -------------------------------------------------------------------------------- 1 | {{#block "content"}} 2 |

content

3 |
4 | {{body}} 5 |
6 | {{/block}} -------------------------------------------------------------------------------- /tutorial/velocity/template/common/header.vm: -------------------------------------------------------------------------------- 1 | 2 | ${title} 3 | 5 | -------------------------------------------------------------------------------- /aeromock-groovy-template/test/ajax.groovy: -------------------------------------------------------------------------------- 1 | if (USER_AGENT =~ /(Android|iPhone|Mac)?/ ) { 2 | return ["__common"] 3 | } else { 4 | return ["__common2"] 5 | } -------------------------------------------------------------------------------- /aeromock-handlebars-java/test/ajax.groovy: -------------------------------------------------------------------------------- 1 | if (USER_AGENT =~ /(Android|iPhone|Mac)?/ ) { 2 | return ["__common"] 3 | } else { 4 | return ["__common2"] 5 | } -------------------------------------------------------------------------------- /aeromock-handlebars-java/test/static/img/sample.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ca-archived/aeromock/HEAD/aeromock-handlebars-java/test/static/img/sample.jpg -------------------------------------------------------------------------------- /aeromock-velocity/test/template/common/header.vm: -------------------------------------------------------------------------------- 1 | 2 | ${title} 3 | 5 | -------------------------------------------------------------------------------- /tutorial/protobuf/data/enum.yaml: -------------------------------------------------------------------------------- 1 | __type: WithEnumResponse 2 | prop1: 100 3 | prop2: KEY2 4 | enumList: 5 | - KEY1 6 | - KEY3 7 | enumEmptyList: [] 8 | -------------------------------------------------------------------------------- /aeromock-handlebars-java/test/template/common/base.hbs: -------------------------------------------------------------------------------- 1 | {{#block "content"}} 2 |

content

3 |
4 | {{body}} 5 |
6 | {{/block}} -------------------------------------------------------------------------------- /aeromock-server/src/test/resources/data/CommonDataHelper/use_gstring.groovy: -------------------------------------------------------------------------------- 1 | package data.CommonDataHelper 2 | 3 | def index = 1 4 | return ["__common${index}"] -------------------------------------------------------------------------------- /tutorial/jade4j/data.groovy: -------------------------------------------------------------------------------- 1 | if (USER_AGENT =~ /(iPhone|Android)/ ) { 2 | return ["common/common_sp"] 3 | } else { 4 | return ["common/common_pc"] 5 | } 6 | -------------------------------------------------------------------------------- /aeromock-freemarker/test/data/nest.yaml: -------------------------------------------------------------------------------- 1 | hoge: 2 | __methods: 3 | - name: execute 4 | value: "nekosan" 5 | neko: "nuko" 6 | fuga: 7 | piyo: 123 8 | -------------------------------------------------------------------------------- /aeromock-jade4j/test/data.groovy: -------------------------------------------------------------------------------- 1 | if (REQUEST_URI.startsWith("/with_common")) { 2 | return ["__common", "__enum"] 3 | } else { 4 | return ["__enum"] 5 | } 6 | -------------------------------------------------------------------------------- /aeromock-thymeleaf/test/data.groovy: -------------------------------------------------------------------------------- 1 | if (REQUEST_URI.startsWith("/with_common")) { 2 | return ["__common", "__enum"] 3 | } else { 4 | return ["__enum"] 5 | } 6 | -------------------------------------------------------------------------------- /aeromock-velocity/test/data.groovy: -------------------------------------------------------------------------------- 1 | if (REQUEST_URI.startsWith("/with_common")) { 2 | return ["__common", "__enum"] 3 | } else { 4 | return ["__enum"] 5 | } 6 | -------------------------------------------------------------------------------- /tutorial/freemarker/data.groovy: -------------------------------------------------------------------------------- 1 | if (USER_AGENT =~ /(iPhone|Android)/ ) { 2 | return ["common/common_sp"] 3 | } else { 4 | return ["common/common_pc"] 5 | } 6 | -------------------------------------------------------------------------------- /tutorial/handlebars/data.groovy: -------------------------------------------------------------------------------- 1 | if (USER_AGENT =~ /(iPhone|Android)/ ) { 2 | return ["common/common_sp"] 3 | } else { 4 | return ["common/common_pc"] 5 | } 6 | -------------------------------------------------------------------------------- /tutorial/protobuf/protobuf/schema/job.proto: -------------------------------------------------------------------------------- 1 | package protobuf.schema; 2 | 3 | message Job { 4 | required uint32 id = 1; 5 | required string name = 2; 6 | } 7 | -------------------------------------------------------------------------------- /tutorial/static/expect/statics.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | -------------------------------------------------------------------------------- /tutorial/thymeleaf/data.groovy: -------------------------------------------------------------------------------- 1 | if (USER_AGENT =~ /(iPhone|Android)/ ) { 2 | return ["common/common_sp"] 3 | } else { 4 | return ["common/common_pc"] 5 | } 6 | -------------------------------------------------------------------------------- /tutorial/velocity/data.groovy: -------------------------------------------------------------------------------- 1 | if (USER_AGENT =~ /(iPhone|Android)/ ) { 2 | return ["common/common_sp"] 3 | } else { 4 | return ["common/common_pc"] 5 | } 6 | -------------------------------------------------------------------------------- /tutorial/groovytemplates/data.groovy: -------------------------------------------------------------------------------- 1 | if (USER_AGENT =~ /(iPhone|Android)/ ) { 2 | return ["common/common_sp"] 3 | } else { 4 | return ["common/common_pc"] 5 | } 6 | -------------------------------------------------------------------------------- /tutorial/velocity/template/VM_global_library.vm: -------------------------------------------------------------------------------- 1 | #macro(testMacro $values) 2 | 7 | #end -------------------------------------------------------------------------------- /aeromock-freemarker/test/template/index.ftl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ${staticUrl('/img/sample.jpg')}
5 | <@span>content 6 | 7 | 8 | -------------------------------------------------------------------------------- /aeromock-groovy-template/test/data.groovy: -------------------------------------------------------------------------------- 1 | if (REQUEST_URI.startsWith("/with_common")) { 2 | return ["__common", "__enum"] 3 | } else { 4 | return ["__enum"] 5 | } 6 | -------------------------------------------------------------------------------- /aeromock-handlebars-java/test/data.groovy: -------------------------------------------------------------------------------- 1 | if (REQUEST_URI.startsWith("/with_common")) { 2 | return ["__common", "__enum"] 3 | } else { 4 | return ["__enum"] 5 | } 6 | -------------------------------------------------------------------------------- /aeromock-velocity/test/template/VM_global_library.vm: -------------------------------------------------------------------------------- 1 | #macro(testMacro $values) 2 | 7 | #end -------------------------------------------------------------------------------- /tutorial/messagepack/project.yaml: -------------------------------------------------------------------------------- 1 | messagepack: 2 | root: ./data 3 | mode: json 4 | 5 | static: 6 | root: ../static 7 | 8 | ajax: 9 | root: ../json/ajax 10 | -------------------------------------------------------------------------------- /aeromock-freemarker/test/static/expect/statics.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | -------------------------------------------------------------------------------- /aeromock-groovy-template/Build.sbt: -------------------------------------------------------------------------------- 1 | name := "aeromock-groovy-template" 2 | 3 | description := "Aeromock Groovy Templates module." 4 | 5 | libraryDependencies ++= Seq( 6 | ) 7 | 8 | -------------------------------------------------------------------------------- /tutorial/freemarker/function/staticUrl.groovy: -------------------------------------------------------------------------------- 1 | if (arguments.isEmpty()) { 2 | throw new RuntimeException("Argument required") 3 | } 4 | 5 | return "http://$HOST${arguments[0]}" 6 | -------------------------------------------------------------------------------- /tutorial/freemarker/variable.groovy: -------------------------------------------------------------------------------- 1 | return [ 2 | custom_prop1: "custom_prop1_value", 3 | custom_propmap: [ 4 | id: 100, 5 | value: "test" 6 | ] 7 | ] 8 | -------------------------------------------------------------------------------- /versions.txt: -------------------------------------------------------------------------------- 1 | 0.2.5 2 | 0.2.4 3 | 0.2.3 4 | 0.2.2 5 | 0.2.1 6 | 0.2.0 7 | 0.2.0-RC3 8 | 0.2.0-RC2 9 | 0.2.0-RC1 10 | 0.1.4 11 | 0.1.3 12 | 0.1.2 13 | 0.1.1 14 | 0.1.0 15 | -------------------------------------------------------------------------------- /tutorial/jade4j/function/math.groovy: -------------------------------------------------------------------------------- 1 | class MathHelper { 2 | 3 | long round(double number) { 4 | return Math.round(number) 5 | } 6 | 7 | } 8 | 9 | return new MathHelper() -------------------------------------------------------------------------------- /tutorial/messagepack/project_compact.yaml: -------------------------------------------------------------------------------- 1 | messagepack: 2 | root: ./data 3 | mode: compact 4 | 5 | static: 6 | root: ../static 7 | 8 | ajax: 9 | root: ../json/ajax 10 | -------------------------------------------------------------------------------- /aeromock-freemarker/test/data.groovy: -------------------------------------------------------------------------------- 1 | if (REQUEST_URI.startsWith("/with_common")) { 2 | return ["__common", "__enum", "__enum2"] 3 | } else { 4 | return ["__enum", "__enum2"] 5 | } 6 | -------------------------------------------------------------------------------- /aeromock-jade4j/test/function/math.groovy: -------------------------------------------------------------------------------- 1 | class MathHelper { 2 | 3 | long round(double number) { 4 | return Math.round(number) 5 | } 6 | 7 | } 8 | 9 | return new MathHelper() -------------------------------------------------------------------------------- /aeromock-server/src/main/scala/jp/co/cyberagent/aeromock/proxy/ProxyParameter.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.proxy 2 | 3 | class ProxyParameter(val jsonObject: Boolean = true) 4 | -------------------------------------------------------------------------------- /aeromock-freemarker/test/function/staticUrl.groovy: -------------------------------------------------------------------------------- 1 | if (arguments.isEmpty()) { 2 | throw new RuntimeException("Argument required") 3 | } 4 | 5 | return "http://localhost:3183${arguments[0]}" 6 | -------------------------------------------------------------------------------- /aeromock-freemarker/test/template/statics.ftl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | -------------------------------------------------------------------------------- /aeromock-jade4j/Build.sbt: -------------------------------------------------------------------------------- 1 | name := "aeromock-jade4j" 2 | 3 | description := "Aeromock Jade4j module." 4 | 5 | libraryDependencies ++= Seq( 6 | "de.neuland-bfi" % "jade4j" % "0.4.0" 7 | ) 8 | 9 | -------------------------------------------------------------------------------- /tutorial/static/expect/builtin.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | -------------------------------------------------------------------------------- /tutorial/messagepack/data/array_mix.yaml: -------------------------------------------------------------------------------- 1 | - 100 2 | - null 3 | - 200.2 4 | - true 5 | - false 6 | - -300 7 | - arrayvalue1 8 | - prop1: prop1value 9 | prop2: prop2value 10 | - 999999999999 11 | -------------------------------------------------------------------------------- /aeromock-cli/Build.sbt: -------------------------------------------------------------------------------- 1 | name := "aeromock-cli" 2 | 3 | description := "Aeromock Command line interface module." 4 | 5 | libraryDependencies ++= Seq( 6 | "org.scalaj" %% "scalaj-http" % "1.1.4" 7 | ) 8 | -------------------------------------------------------------------------------- /tutorial/handlebars/function/staticUrl.groovy: -------------------------------------------------------------------------------- 1 | if (argument == null || argument.length() == 0) { 2 | throw new IllegalArgumentException("Argument required") 3 | } 4 | return "http://${HOST}${argument}" 5 | -------------------------------------------------------------------------------- /aeromock-freemarker/Build.sbt: -------------------------------------------------------------------------------- 1 | name := "aeromock-freemarker" 2 | 3 | description := "Aeromock Freemarker module." 4 | 5 | libraryDependencies ++= Seq( 6 | "org.freemarker" % "freemarker" % "2.3.20" 7 | ) 8 | -------------------------------------------------------------------------------- /aeromock-freemarker/test/static/expect/builtin.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | -------------------------------------------------------------------------------- /aeromock-thymeleaf/Build.sbt: -------------------------------------------------------------------------------- 1 | name := "aeromock-thymeleaf" 2 | 3 | description := "Aeromock Thymeleaf module." 4 | 5 | libraryDependencies ++= Seq( 6 | "org.thymeleaf" % "thymeleaf" % "2.1.3.RELEASE" 7 | ) 8 | -------------------------------------------------------------------------------- /aeromock-velocity/Build.sbt: -------------------------------------------------------------------------------- 1 | name := "aeromock-velocity" 2 | 3 | description := "Aeromock Velocity module." 4 | 5 | libraryDependencies ++= Seq( 6 | "org.apache.velocity" % "velocity" % "1.7" 7 | ) 8 | 9 | -------------------------------------------------------------------------------- /tutorial/json/ajax/api/custom_response.yaml: -------------------------------------------------------------------------------- 1 | title: custom_response.yaml 2 | __response: 3 | code: 400 4 | headers: 5 | X-Aeromock-Header1: aeromock-header1 6 | X-Aeromock-Header2: aeromock-header2 7 | -------------------------------------------------------------------------------- /aeromock-handlebars-java/test/function/staticUrl.groovy: -------------------------------------------------------------------------------- 1 | if (argument == null || argument.length() == 0) { 2 | throw new IllegalArgumentException("Argument required") 3 | } 4 | return "http://${HOST}${argument}" 5 | -------------------------------------------------------------------------------- /aeromock-server/src/main/scala/jp/co/cyberagent/aeromock/config/TemplateConfig.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.config 2 | 3 | /** 4 | * 5 | * @author stormcat24 6 | */ 7 | trait TemplateConfig { 8 | } 9 | -------------------------------------------------------------------------------- /tutorial/protobuf/project.yaml: -------------------------------------------------------------------------------- 1 | protobuf: 2 | root: ./protobuf 3 | apiPrefix: /api 4 | 5 | data: 6 | root: ./data 7 | 8 | static: 9 | root: ../static 10 | 11 | ajax: 12 | root: ../json/ajax 13 | -------------------------------------------------------------------------------- /aeromock-freemarker/test/ajax/additional.yaml: -------------------------------------------------------------------------------- 1 | common_name: "xxx" 2 | object: 3 | __additional: true 4 | property2: ${HOST} 5 | neko: 6 | property1: neko 7 | __methods: 8 | - name: execute 9 | value: nekotan -------------------------------------------------------------------------------- /aeromock-freemarker/test/data/__enum.yaml: -------------------------------------------------------------------------------- 1 | enums: 2 | jp.co.cyberagent.aeromock.test.enums.TestType: 3 | NEKO1: 4 | key: neko1 5 | value: ねこ1 6 | NEKO2: 7 | key: neko2 8 | value: ねこ2 9 | -------------------------------------------------------------------------------- /aeromock-view/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "aeromock-view", 3 | "version": "0.1.0", 4 | "dependencies": {}, 5 | "devDependencies": { 6 | "handlebars": "~1.3.0", 7 | "flat-ui": "2.1.3" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /aeromock-cli/src/test/resources/test/project.yaml: -------------------------------------------------------------------------------- 1 | # テンプレート関連 2 | template: 3 | root: ./template 4 | serviceClass: jp.co.cyberagent.aeromock.cli.TestTemplateService 5 | contexts: [] 6 | 7 | data: 8 | root: ./data 9 | -------------------------------------------------------------------------------- /aeromock-dsl/.gitignore: -------------------------------------------------------------------------------- 1 | # Gradle 2 | .gradle/ 3 | 4 | # eclipse 5 | .project 6 | .classpath 7 | .settings/ 8 | 9 | # IDEA 10 | .idea/ 11 | *.iml 12 | 13 | # compiled files 14 | *.class 15 | /bin 16 | /build 17 | /out 18 | -------------------------------------------------------------------------------- /aeromock-freemarker/test/ajax.groovy: -------------------------------------------------------------------------------- 1 | println("PARAMETERS = $PARAMETERS") 2 | println("FORM_DATA = $FORM_DATA") 3 | if (USER_AGENT =~ /(Android|iPhone|Mac)?/ ) { 4 | return ["__common"] 5 | } else { 6 | return ["__common2"] 7 | } -------------------------------------------------------------------------------- /aeromock-handlebars-java/Build.sbt: -------------------------------------------------------------------------------- 1 | name := "aeromock-handlebars-java" 2 | 3 | description := "Aeromock Handlebars.java module." 4 | 5 | libraryDependencies ++= Seq( 6 | "com.github.jknack" % "handlebars" % "1.3.1" 7 | ) 8 | 9 | -------------------------------------------------------------------------------- /aeromock-report/app/styles/components/components.sass: -------------------------------------------------------------------------------- 1 | // we need to have css in our css file 2 | // when built with uncss (gulp-uncss) 3 | // otherwise it raises Css not found error 4 | .dummy-to-make-uncss-work 5 | color: #000 6 | -------------------------------------------------------------------------------- /tutorial/protobuf/data/nest2.yaml: -------------------------------------------------------------------------------- 1 | __type: Nest2Response 2 | id: 100 3 | inner: 4 | id: 1000 5 | name: innerName 6 | innerList: 7 | - id: 1001 8 | name: innerName1 9 | - id: 1002 10 | name: innerName2 11 | -------------------------------------------------------------------------------- /tutorial/protobuf/data/test.yaml: -------------------------------------------------------------------------------- 1 | __type: TestResponse 2 | prop1: 100 3 | prop2: prop2value 4 | prop3: 11111111111 5 | prop4: 6 | - "1111" 7 | - "2222" 8 | - "3333" 9 | prop5: 10 | id: 1000 11 | name: testuser 12 | -------------------------------------------------------------------------------- /tutorial/data/error.json: -------------------------------------------------------------------------------- 1 | { 2 | "message": "ねこねこ1", 3 | "countries": [ 4 | "Japan", 5 | "USA" 6 | ], 7 | "nuko": { 8 | "id" : 1 9 | "name" : "aaaaa" 10 | "roles": ["neko1", "neko2"] 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /tutorial/handlebars/template.yaml: -------------------------------------------------------------------------------- 1 | handlebars: 2 | suffix: .hbs 3 | prettyPrint: true 4 | stringParams: false 5 | infiniteLoops: false 6 | deletePartialAfterMerge: false 7 | startDelimiter: "{{" 8 | endDelimiter: "}}" 9 | -------------------------------------------------------------------------------- /aeromock-handlebars-java/test/template.yaml: -------------------------------------------------------------------------------- 1 | handlebars: 2 | suffix: .hbs 3 | prettyPrint: true 4 | stringParams: false 5 | infiniteLoops: false 6 | deletePartialAfterMerge: false 7 | startDelimiter: {{ 8 | endDelimiter: }} 9 | -------------------------------------------------------------------------------- /aeromock-server/src/main/scala/jp/co/cyberagent/aeromock/proxy/DynamicProxy.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.proxy 2 | 3 | /** 4 | * Marker trait of dynamic proxy. 5 | * @author stormcat24 6 | */ 7 | trait DynamicProxy { 8 | } 9 | -------------------------------------------------------------------------------- /tutorial/json/ajax/api/test.yaml: -------------------------------------------------------------------------------- 1 | title: test.yaml 2 | hash: 3 | hashArray: 4 | - 5 | id: 1 6 | name: name1 7 | - 8 | id: 2 9 | name: name2 10 | intArray: 11 | - 1 12 | - 2 13 | method: GET 14 | -------------------------------------------------------------------------------- /tutorial/protobuf/protobuf/schema/various_nest.proto: -------------------------------------------------------------------------------- 1 | package protobuf.schema; 2 | 3 | message VariousNest { 4 | required string textTagSize1 = 1; 5 | required string textTagSize2 = 16; 6 | required string textTagSize3 = 2048; 7 | } 8 | -------------------------------------------------------------------------------- /tutorial/json/ajax/api/test__2.yaml: -------------------------------------------------------------------------------- 1 | title: test__2.yaml 2 | hash: 3 | hashArray: 4 | - 5 | id: 1 6 | name: name1 7 | - 8 | id: 2 9 | name: name2 10 | intArray: 11 | - 1 12 | - 2 13 | method: GET 14 | -------------------------------------------------------------------------------- /tutorial/thymeleaf/template/common/header.html: -------------------------------------------------------------------------------- 1 | 2 |
3 | title 4 | 6 |
7 | 8 | -------------------------------------------------------------------------------- /tutorial/json/ajax/api/test__post.yaml: -------------------------------------------------------------------------------- 1 | title: test__post.yaml 2 | hash: 3 | hashArray: 4 | - 5 | id: 1 6 | name: name1 7 | - 8 | id: 2 9 | name: name2 10 | intArray: 11 | - 1 12 | - 2 13 | method: POST 14 | -------------------------------------------------------------------------------- /aeromock-freemarker/test/data/__enum2.yaml: -------------------------------------------------------------------------------- 1 | enums: 2 | __additional: true 3 | jp.co.cyberagent.aeromock.test.enums.TestType2: 4 | NUKO1: 5 | key: neko1 6 | value: ぬこ1 7 | NUKO2: 8 | key: neko2 9 | value: ぬこ2 10 | -------------------------------------------------------------------------------- /aeromock-freemarker/test/data/error.json: -------------------------------------------------------------------------------- 1 | { 2 | "message": "ねこねこ1", 3 | "countries": [ 4 | "Japan", 5 | "USA" 6 | ], 7 | "nuko": { 8 | "id" : 1 9 | "name" : "aaaaa" 10 | "roles": ["neko1", "neko2"] 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /tutorial/json/ajax/api/test__delete.yaml: -------------------------------------------------------------------------------- 1 | title: test__delete.yaml 2 | hash: 3 | hashArray: 4 | - 5 | id: 1 6 | name: name1 7 | - 8 | id: 2 9 | name: name2 10 | intArray: 11 | - 1 12 | - 2 13 | method: DELETE 14 | -------------------------------------------------------------------------------- /tutorial/json/ajax/api/test__post__2.yaml: -------------------------------------------------------------------------------- 1 | title: test__post__2.yaml 2 | hash: 3 | hashArray: 4 | - 5 | id: 1 6 | name: name1 7 | - 8 | id: 2 9 | name: name2 10 | intArray: 11 | - 1 12 | - 2 13 | method: POST 14 | -------------------------------------------------------------------------------- /tutorial/handlebars/template/common/testparts.hbs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
AAABBB
{{parts.property1}}{{parts.property2}}
-------------------------------------------------------------------------------- /aeromock-server/src/main/scala/jp/co/cyberagent/aeromock/config/UserConfig.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.config 2 | 3 | import java.nio.file.Path 4 | import java.util.Locale 5 | 6 | case class UserConfig(projectConfigPath: Path, language: Option[Locale]) 7 | -------------------------------------------------------------------------------- /tutorial/handlebars/template/common/header.hbs: -------------------------------------------------------------------------------- 1 | 2 | {{title}} 3 | 6 | 7 | {{embedded "common/testembedded"}} 8 | -------------------------------------------------------------------------------- /aeromock-handlebars-java/test/template/common/testparts.hbs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
AAABBB
{{parts.property1}}{{parts.property2}}
-------------------------------------------------------------------------------- /aeromock-thymeleaf/test/template/common/header.html: -------------------------------------------------------------------------------- 1 | 2 |
3 | title 4 | 7 |
8 | 9 | -------------------------------------------------------------------------------- /aeromock-handlebars-java/test/template/common/header.hbs: -------------------------------------------------------------------------------- 1 | 2 | {{title}} 3 | 6 | 7 | {{embedded "common/testembedded"}} 8 | -------------------------------------------------------------------------------- /tutorial/velocity/project.yaml: -------------------------------------------------------------------------------- 1 | template: 2 | root: ./template 3 | serviceClass: jp.co.cyberagent.aeromock.template.velocity.VelocityTemplateService 4 | 5 | data: 6 | root: ../data 7 | 8 | static: 9 | root: ../static 10 | 11 | ajax: 12 | root: ../json/ajax 13 | -------------------------------------------------------------------------------- /tutorial/groovytemplates/project.yaml: -------------------------------------------------------------------------------- 1 | template: 2 | root: ./template 3 | serviceClass: jp.co.cyberagent.aeromock.template.groovytemplate.GroovyTemplateService 4 | 5 | data: 6 | root: ../data 7 | 8 | static: 9 | root: ../static 10 | 11 | ajax: 12 | root: ../json/ajax 13 | -------------------------------------------------------------------------------- /aeromock-velocity/test/velocity.properties: -------------------------------------------------------------------------------- 1 | # ---------------------------------------------------------------------------- 2 | # T E M P L A T E E N C O D I N G 3 | # ---------------------------------------------------------------------------- 4 | 5 | input.encoding=UTF-8 6 | output.encoding=UTF-8 -------------------------------------------------------------------------------- /tutorial/velocity/velocity.properties: -------------------------------------------------------------------------------- 1 | # ---------------------------------------------------------------------------- 2 | # T E M P L A T E E N C O D I N G 3 | # ---------------------------------------------------------------------------- 4 | 5 | input.encoding=UTF-8 6 | output.encoding=UTF-8 7 | -------------------------------------------------------------------------------- /aeromock-dsl/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Aug 12 15:15:23 JST 2014 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-1.10-bin.zip 7 | -------------------------------------------------------------------------------- /aeromock-spec-support/Build.sbt: -------------------------------------------------------------------------------- 1 | name := "aeromock-spec-support" 2 | 3 | description := "Aeromock Spec support" 4 | 5 | libraryDependencies ++= Seq( 6 | "org.scaldi" %% "scaldi" % scaldiVersion, 7 | "io.netty" % "netty-all" % nettyVersion, 8 | "org.specs2" %% "specs2" % "2.4.2" 9 | ) 10 | -------------------------------------------------------------------------------- /aeromock-view/.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | 12 | [*.md] 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /aeromock-freemarker/test/template/builtin.ftl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | <#assign url = httpServletRequest.getRequestURI() /> 5 | 9 | 10 | -------------------------------------------------------------------------------- /aeromock-freemarker/test/data/custom_list__2.yaml: -------------------------------------------------------------------------------- 1 | list: 2 | __methods: 3 | - name: size 4 | value: dummy 5 | - name: execute 6 | value: dummy 7 | property1: dummy 8 | objectList: 9 | - property1: dummy 10 | property2: dummy 11 | __methods: 12 | - name: getNeko 13 | value: dummy 14 | -------------------------------------------------------------------------------- /tutorial/thymeleaf/function/helper.groovy: -------------------------------------------------------------------------------- 1 | class HelperUtilityObject { 2 | 3 | long round(double number) { 4 | return Math.round(number) 5 | } 6 | 7 | String hello(String message) { 8 | return "Hello!! $message" 9 | } 10 | 11 | } 12 | return new HelperUtilityObject() 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # SBT 2 | target/ 3 | .cache 4 | 5 | # eclipse 6 | .project 7 | .classpath 8 | .settings/ 9 | 10 | # IDEA 11 | .idea/ 12 | .settings/ 13 | *.iml 14 | out/ 15 | 16 | # JS 17 | bower_components/ 18 | 19 | # Others 20 | .DS_Store 21 | *.pyc 22 | venv 23 | 24 | # test report 25 | aeromock_report/ 26 | -------------------------------------------------------------------------------- /aeromock-thymeleaf/test/function/helper.groovy: -------------------------------------------------------------------------------- 1 | class HelperUtilityObject { 2 | 3 | long round(double number) { 4 | return Math.round(number) 5 | } 6 | 7 | String hello(String message) { 8 | return "Hello!! $message" 9 | } 10 | 11 | } 12 | return new HelperUtilityObject() 13 | -------------------------------------------------------------------------------- /tutorial/jade4j/project.yaml: -------------------------------------------------------------------------------- 1 | template: 2 | root: ./template 3 | serviceClass: jp.co.cyberagent.aeromock.template.jade4j.Jade4jTemplateService 4 | 5 | data: 6 | root: ../data 7 | 8 | static: 9 | root: ../static 10 | 11 | ajax: 12 | root: ../json/ajax 13 | 14 | function: 15 | root: ./function 16 | -------------------------------------------------------------------------------- /tutorial/handlebars/project.yaml: -------------------------------------------------------------------------------- 1 | template: 2 | root: ./template 3 | serviceClass: jp.co.cyberagent.aeromock.template.handlebars.HandlebarsTemplateService 4 | 5 | data: 6 | root: ../data 7 | 8 | static: 9 | root: ../static 10 | 11 | ajax: 12 | root: ../json/ajax 13 | 14 | function: 15 | root: ./function 16 | -------------------------------------------------------------------------------- /tutorial/thymeleaf/project.yaml: -------------------------------------------------------------------------------- 1 | template: 2 | root: ./template 3 | serviceClass: jp.co.cyberagent.aeromock.template.thymeleaf.ThymeleafTemplateService 4 | 5 | data: 6 | root: ../data 7 | 8 | static: 9 | root: ../static 10 | 11 | ajax: 12 | root: ../json/ajax 13 | 14 | function: 15 | root: ./function 16 | -------------------------------------------------------------------------------- /aeromock-cli/src/main/scala/jp/co/cyberagent/aeromock/cli/AeromockCliModule.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.cli 2 | 3 | import scaldi.Module 4 | 5 | /** 6 | * 7 | * @author stormcat24 8 | */ 9 | class AeromockCliModule extends Module { 10 | 11 | bind [CliJobSelector] toProvider new CliJobSelector 12 | } 13 | -------------------------------------------------------------------------------- /aeromock-freemarker/test/ajax/nuko__2.json: -------------------------------------------------------------------------------- 1 | { 2 | "message": "ねこねこ2", 3 | "countries": [ 4 | "Japan", 5 | "USA", 6 | "Canada" 7 | ], 8 | "nuko": { 9 | "id" : 1 10 | "name" : "aaaaa" 11 | "roles": ["neko1", "neko2", "neko3", "neko4", "neko5"] 12 | }, 13 | "uri": "${REQUEST_URI}" 14 | } 15 | -------------------------------------------------------------------------------- /aeromock-view/src/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "curly": true, 3 | "eqeqeq": true, 4 | "immed": true, 5 | "latedef": true, 6 | "newcap": true, 7 | "noarg": true, 8 | "sub": true, 9 | "undef": true, 10 | "unused": true, 11 | "boss": true, 12 | "eqnull": true, 13 | "browser": true, 14 | "predef": ["jQuery"] 15 | } 16 | -------------------------------------------------------------------------------- /tutorial/protobuf/protobuf/api/nest1.proto: -------------------------------------------------------------------------------- 1 | package protobuf.api; 2 | 3 | import "schema/user.proto"; 4 | 5 | message Nest1Request { 6 | required string text = 1; 7 | } 8 | 9 | message Nest1Response { 10 | required uint32 id = 1; 11 | required schema.User mainUser = 2; 12 | repeated schema.User otherUsers = 3; 13 | } 14 | -------------------------------------------------------------------------------- /aeromock-velocity/src/main/scala/jp/co/cyberagent/aeromock/template/velocity/VelocityConfigDetailDef.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.template.velocity 2 | 3 | import scala.beans.BeanProperty 4 | 5 | /** 6 | * 7 | * @author stormcat24 8 | */ 9 | class VelocityConfigDetailDef { 10 | @BeanProperty var extension: String = null 11 | } 12 | -------------------------------------------------------------------------------- /aeromock-server/src/main/scala/jp/co/cyberagent/aeromock/config/template_def.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.config.definition 2 | 3 | import jp.co.cyberagent.aeromock.config.TemplateConfig 4 | 5 | import scalaz._ 6 | 7 | trait SpecifiedTemplateDef[T <: TemplateConfig] { 8 | 9 | def toValue: ValidationNel[String, Option[T]] 10 | 11 | } 12 | -------------------------------------------------------------------------------- /aeromock-thymeleaf/test/template.groovy: -------------------------------------------------------------------------------- 1 | import de.neuland.jade4j.filter.Filter 2 | configuration.setFilter("testfilter", new TestScriptFilter()) 3 | 4 | class TestScriptFilter implements Filter { 5 | 6 | @Override 7 | String convert(String source, Map attributes, Map model) { 8 | return source 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /tutorial/freemarker/project.yaml: -------------------------------------------------------------------------------- 1 | template: 2 | root: ./template 3 | serviceClass: jp.co.cyberagent.aeromock.template.freemarker.FreemarkerTemplateService 4 | 5 | data: 6 | root: ../data 7 | 8 | static: 9 | root: ../static 10 | 11 | ajax: 12 | root: ../json/ajax 13 | 14 | tag: 15 | root: ./tag 16 | 17 | function: 18 | root: ./function 19 | 20 | -------------------------------------------------------------------------------- /tutorial/thymeleaf/template.yaml: -------------------------------------------------------------------------------- 1 | thymeleaf: 2 | suffix: .html 3 | characterEncoding: UTF-8 4 | templateAliases: 5 | footer: /common/footer 6 | templateMode: HTML5 7 | legacyHtml5TemplateModePatterns: [] 8 | validXhtmlTemplateModePatterns: [] 9 | validXmlTemplateModePatterns: [] 10 | xhtmlTemplateModePatterns: [] 11 | xmlTemplateModePatterns: [] 12 | -------------------------------------------------------------------------------- /aeromock-thymeleaf/test/template.yaml: -------------------------------------------------------------------------------- 1 | thymeleaf: 2 | suffix: .html 3 | characterEncoding: UTF-8 4 | templateAliases: 5 | footer: /common/footer 6 | templateMode: HTML5 7 | legacyHtml5TemplateModePatterns: [] 8 | validXhtmlTemplateModePatterns: [] 9 | validXmlTemplateModePatterns: [] 10 | xhtmlTemplateModePatterns: [] 11 | xmlTemplateModePatterns: [] 12 | -------------------------------------------------------------------------------- /tutorial/protobuf/data/_test.yaml: -------------------------------------------------------------------------------- 1 | id: 1000 2 | user1: 3 | id: 1 4 | name: hoge1 5 | description: hoge1 hogehoge 6 | status: 7 | age: 20 8 | job: 9 | id: 100 10 | name: job100 11 | user2: 12 | id: 2 13 | name: hoge2 14 | description: hoge2 hogehoge 15 | status: 16 | age: 20 17 | job: 18 | id: 200 19 | name: job200 20 | -------------------------------------------------------------------------------- /aeromock-cli/src/main/scala/jp/co/cyberagent/aeromock/cli/validation/package.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.cli 2 | 3 | /** 4 | * 5 | * @author stormcat24 6 | */ 7 | package object validation { 8 | 9 | case class TestSummary(totalTemplates: Int, numSuccess: Int, numFailed: Int, numSkip: Int) { 10 | 11 | def passed = numFailed <= 0 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /aeromock-server/src/main/scala/jp/co/cyberagent/aeromock/data/DataFileReader.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.data 2 | 3 | import java.nio.file.Path 4 | 5 | 6 | trait DataFileReader { 7 | 8 | def readFile[T >: Iterable[_]](file: Path, charset: String = "UTF-8"): T 9 | 10 | def deserialize[T](file: Path, `class`: Class[T], charset: String = "UTF-8"): T 11 | } 12 | -------------------------------------------------------------------------------- /aeromock-jade4j/test/template.groovy: -------------------------------------------------------------------------------- 1 | import de.neuland.jade4j.filter.Filter 2 | configuration.setFilter("testfilter", new TestScriptFilter()) 3 | 4 | class TestScriptFilter implements Filter { 5 | 6 | @Override 7 | String convert(String source, Map attributes, Map model) { 8 | println("nekoneko") 9 | return source 10 | } 11 | } -------------------------------------------------------------------------------- /aeromock-velocity/src/main/scala/jp/co/cyberagent/aeromock/template/velocity/VelocityConfig.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.template.velocity 2 | 3 | import jp.co.cyberagent.aeromock.config.TemplateConfig 4 | 5 | /** 6 | * Configuration of class for Velocity. 7 | * @author stormcat24 8 | */ 9 | case class VelocityConfig( 10 | extension: Option[String]) extends TemplateConfig 11 | -------------------------------------------------------------------------------- /tutorial/protobuf/protobuf/api/enum.proto: -------------------------------------------------------------------------------- 1 | package protobuf.api; 2 | 3 | message WithEnumResponse { 4 | 5 | enum TestEnum { 6 | KEY1 = 100; 7 | KEY2 = 101; 8 | KEY3 = 102; 9 | } 10 | 11 | required int32 prop1 = 1; 12 | required TestEnum prop2 = 2 [default = KEY2]; 13 | repeated TestEnum enumList = 3; 14 | repeated TestEnum enumEmptyList = 4; 15 | } 16 | -------------------------------------------------------------------------------- /aeromock-freemarker/test/ajax/array.yaml: -------------------------------------------------------------------------------- 1 | - key: neko1 2 | value: 3 | name: neko1 4 | age: 10 5 | color: brown 6 | builtin: ${REQUEST_URI} 7 | - key: neko2 8 | value: 9 | name: neko2 10 | age: 12 11 | color: black 12 | builtin: ${REQUEST_URI} 13 | - key: neko3 14 | value: 15 | name: neko3 16 | age: 5 17 | color: silver 18 | builtin: ${REQUEST_URI} -------------------------------------------------------------------------------- /tutorial/protobuf/protobuf/api/nest2.proto: -------------------------------------------------------------------------------- 1 | package protobuf.api; 2 | 3 | message Nest2Request { 4 | required string text = 1; 5 | } 6 | 7 | message Nest2Response { 8 | message Nest2Inner { 9 | required int32 id = 10; 10 | required string name = 20; 11 | } 12 | 13 | required uint32 id = 1; 14 | required Nest2Inner inner = 2; 15 | repeated Nest2Inner innerList = 3; 16 | } 17 | -------------------------------------------------------------------------------- /aeromock-server/src/main/scala/jp/co/cyberagent/aeromock/server/package.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock 2 | 3 | import java.nio.file.Path 4 | 5 | import io.netty.handler.codec.http.HttpMethod 6 | 7 | /** 8 | * 9 | * @author stormcat24 10 | */ 11 | package object server { 12 | 13 | case class DataFile(id: Option[String], path: Path, method: HttpMethod = HttpMethod.GET) 14 | 15 | } 16 | -------------------------------------------------------------------------------- /aeromock-freemarker/test/data/data.yaml: -------------------------------------------------------------------------------- 1 | propString: strinvalue 2 | propInt: 1 3 | propBoolean: true 4 | propLong: 999999999999999999 5 | propDouble: 11111.9 6 | map: 7 | propSimple: propSimpleValue 8 | propList: 9 | - 11111 10 | - 22222 11 | - 33333 12 | propMap: 13 | childSimple: childSimpleValue 14 | childList: 15 | - child11111 16 | - child22222 17 | - child33333 -------------------------------------------------------------------------------- /aeromock-freemarker/src/main/scala/jp/co/cyberagent/aeromock/template/freemarker/directive/AeromockNestedTemplateModel.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.template.freemarker.directive 2 | 3 | import freemarker.template.SimpleHash 4 | 5 | class AeromockNestedTemplateModel(directiveName: String) extends SimpleHash with AeromockCustomDirective { 6 | 7 | override def getDirevtiveName(): String = directiveName 8 | } 9 | -------------------------------------------------------------------------------- /aeromock-groovy-template/src/main/scala/jp/co/cyberagent/aeromock/template/groovytemplate/GroovyTemplateDefailDef.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.template.groovytemplate 2 | 3 | import scala.beans.BeanProperty 4 | 5 | /** 6 | * 7 | * @author stormcat24 8 | */ 9 | class GroovyTemplateDefailDef { 10 | @BeanProperty var extension: String = null 11 | @BeanProperty var mode: String = null 12 | } 13 | -------------------------------------------------------------------------------- /project/plugin.sbt: -------------------------------------------------------------------------------- 1 | resolvers ++= Seq( 2 | "sonatype releases" at "http://oss.sonatype.org/content/repositories/releases", 3 | "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/" 4 | ) 5 | 6 | addSbtPlugin("org.scoverage" % "sbt-scoverage" % "0.99.7.1") 7 | 8 | addSbtPlugin("org.scoverage" %% "sbt-coveralls" % "0.99.0") 9 | 10 | addSbtPlugin("com.typesafe.sbt" % "sbt-pgp" % "0.8.3") 11 | -------------------------------------------------------------------------------- /aeromock-report/.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig helps developers define and maintain consistent 2 | # coding styles between different editors and IDEs 3 | # http://editorconfig.org 4 | 5 | root = true 6 | 7 | [*] 8 | indent_style = space 9 | indent_size = 2 10 | end_of_line = lf 11 | charset = utf-8 12 | trim_trailing_whitespace = true 13 | insert_final_newline = true 14 | 15 | [*.md] 16 | trim_trailing_whitespace = false 17 | -------------------------------------------------------------------------------- /tutorial/protobuf/data/simple__optional.yaml: -------------------------------------------------------------------------------- 1 | __type: SimpleResponse 2 | int32Value: 10011 3 | int64Value: 11011 4 | uint32Value: 12011 5 | uint64Value: 13011 6 | sint32Value: 14011 7 | sint64Value: 15011 8 | fixed32Value: 16011 9 | fixed64Value: 17011 10 | sfixed32Value: 18011 11 | sfixed64Value: 19011 12 | floatValue: 200.11 13 | doubleValue: 210.11 14 | boolValue: true 15 | stringValue: stringValue 16 | bytesValue: bytesValue 17 | -------------------------------------------------------------------------------- /tutorial/freemarker/tag/span.groovy: -------------------------------------------------------------------------------- 1 | _writer.write("""""") 12 | if (_body != null) { 13 | // render inner body. 14 | _body.render(_writer) 15 | } 16 | _writer.write("""""") 17 | -------------------------------------------------------------------------------- /aeromock-freemarker/test/tag/span.groovy: -------------------------------------------------------------------------------- 1 | _writer.write("""""") 12 | if (_body != null) { 13 | // render inner body. 14 | _body.render(_writer) 15 | } 16 | _writer.write("""""") 17 | -------------------------------------------------------------------------------- /aeromock-jade4j/src/main/scala/jp/co/cyberagent/aeromock/template/jade4j/Jade4jBootstrap.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.template.jade4j 2 | 3 | import jp.co.cyberagent.aeromock.core.bootstrap.Bootstrap 4 | 5 | /** 6 | * 7 | * @author stormcat24 8 | */ 9 | class Jade4jBootstrap extends Bootstrap { 10 | 11 | /** 12 | * @inheritdoc 13 | */ 14 | override def process(): Unit = { 15 | // nothing to do. 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /aeromock-freemarker/src/main/scala/jp/co/cyberagent/aeromock/template/freemarker/directive/AeromockCustomDirective.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.template.freemarker.directive 2 | 3 | import freemarker.template.TemplateModel 4 | 5 | /** 6 | * Trait of dynamic custom directive. 7 | * @author stormcat24 8 | * 9 | */ 10 | trait AeromockCustomDirective extends TemplateModel { 11 | 12 | def getDirevtiveName(): String 13 | 14 | } 15 | -------------------------------------------------------------------------------- /aeromock-jade4j/src/main/scala/jp/co/cyberagent/aeromock/template/jade4j/Jade4jConfigDetailDef.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.template.jade4j 2 | 3 | import scala.beans.BeanProperty 4 | 5 | /** 6 | * 7 | * @author stormcat24 8 | */ 9 | class Jade4jConfigDetailDef { 10 | 11 | @BeanProperty var extension: String = null 12 | @BeanProperty var mode: String = null 13 | @BeanProperty var prettyPrint: String = null 14 | 15 | } 16 | -------------------------------------------------------------------------------- /aeromock-server/src/main/scala/jp/co/cyberagent/aeromock/data/AllowedDataType.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.data 2 | 3 | 4 | sealed abstract class AllowedDataType(val extensions: Seq[String]) 5 | 6 | object AllowedDataType { 7 | 8 | case object JSON extends AllowedDataType(Seq("json")) 9 | case object YAML extends AllowedDataType(Seq("yaml", "yml")) 10 | 11 | val extensions = Seq(JSON, YAML).flatMap(_.extensions) 12 | } 13 | -------------------------------------------------------------------------------- /aeromock-report/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "aeromock-report", 3 | "description": "Awesome stuff, the modular and interoperable way", 4 | "version": "0.0.0", 5 | "dependencies": { 6 | "platform": "Polymer/platform#~0.3.3", 7 | "polymer": "Polymer/polymer#~0.3.3", 8 | "materialize": "~0.95.2" 9 | }, 10 | "devDependencies": { 11 | "closure-compiler": "http://dl.google.com/closure-compiler/compiler-latest.zip" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /aeromock-server/src/main/scala/jp/co/cyberagent/aeromock/server/http/dto.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.server.http 2 | 3 | import io.netty.handler.codec.http.HttpResponseStatus 4 | 5 | case class RenderResult[A](content: A, response: Option[CustomResponse], debug: Boolean) 6 | 7 | case class CustomResponse(code: Int, headers: Map[String, String]) { 8 | def getResponseStatus: HttpResponseStatus = HttpResponseStatus.valueOf(code) 9 | } 10 | -------------------------------------------------------------------------------- /aeromock-thymeleaf/src/main/scala/jp/co/cyberagent/aeromock/template/thymeleaf/ThymeleafBootstrap.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.template.thymeleaf 2 | 3 | import jp.co.cyberagent.aeromock.core.bootstrap.Bootstrap 4 | 5 | /** 6 | * 7 | * @author stormcat24 8 | */ 9 | class ThymeleafBootstrap extends Bootstrap { 10 | 11 | /** 12 | * @inheritdoc 13 | */ 14 | def process(): Unit = { 15 | // nothing to do. 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /aeromock-groovy-template/src/main/scala/jp/co/cyberagent/aeromock/template/groovytemplate/GroovyTemplateConfig.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.template.groovytemplate 2 | 3 | import jp.co.cyberagent.aeromock.config.TemplateConfig 4 | 5 | /** 6 | * Configuration of class for groovy template. 7 | * @author stormcat24 8 | */ 9 | case class GroovyTemplateConfig( 10 | extension: Option[String], 11 | mode: Option[String] 12 | ) extends TemplateConfig 13 | -------------------------------------------------------------------------------- /aeromock-handlebars-java/src/main/scala/jp/co/cyberagent/aeromock/template/handlebars/HandlebarsBootstrap.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.template.handlebars 2 | 3 | import jp.co.cyberagent.aeromock.core.bootstrap.Bootstrap 4 | 5 | /** 6 | * 7 | * @author stormcat24 8 | */ 9 | class HandlebarsBootstrap extends Bootstrap { 10 | 11 | /** 12 | * @inheritdoc 13 | */ 14 | override def process(): Unit = { 15 | // nothing to do. 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /aeromock-view/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "node": true, 3 | "browser": true, 4 | "esnext": true, 5 | "bitwise": true, 6 | "camelcase": true, 7 | "curly": true, 8 | "eqeqeq": true, 9 | "immed": true, 10 | "indent": 2, 11 | "latedef": true, 12 | "newcap": true, 13 | "noarg": true, 14 | "quotmark": "single", 15 | "regexp": true, 16 | "undef": true, 17 | "unused": true, 18 | "strict": true, 19 | "trailing": true, 20 | "smarttabs": true 21 | } 22 | -------------------------------------------------------------------------------- /aeromock-server/src/main/scala/jp/co/cyberagent/aeromock/core/bootstrap/Bootstrap.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.core.bootstrap 2 | 3 | import javassist.{LoaderClassPath, ClassPool} 4 | 5 | /** 6 | * Bootstrap trait 7 | */ 8 | trait Bootstrap { 9 | 10 | val pool = new ClassPool() 11 | pool.appendClassPath(new LoaderClassPath(this.getClass().getClassLoader())) 12 | 13 | /** 14 | * run bootstrap process 15 | */ 16 | def process(): Unit 17 | 18 | } 19 | -------------------------------------------------------------------------------- /aeromock-groovy-template/src/main/scala/jp/co/cyberagent/aeromock/template/groovytemplate/GroovyTemplateBootstrap.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.template.groovytemplate 2 | 3 | import jp.co.cyberagent.aeromock.core.bootstrap.Bootstrap 4 | 5 | /** 6 | * 7 | * @author stormcat24 8 | */ 9 | class GroovyTemplateBootstrap extends Bootstrap { 10 | 11 | /** 12 | * @inheritdoc 13 | */ 14 | override def process(): Unit = { 15 | // nothing to do. 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /aeromock-freemarker/test/ajax/nuko__3.yaml: -------------------------------------------------------------------------------- 1 | message: "ねこねこ3" 2 | #aaaa 3 | countries: 4 | - "Japan" 5 | - "USA" 6 | - "Canada" 7 | - "China" 8 | - "India" 9 | nuko: 10 | id: 3 11 | name: "ccccc" 12 | type: 13 | color: "white" 14 | array: 15 | - "ccccc" 16 | - "ddddd" 17 | array: 18 | - type: "neko" 19 | name: "neko1" 20 | array: 21 | - 1 22 | - 2 23 | - 3 24 | - type: "neko" 25 | name: "neko2" 26 | array: 27 | - 4 28 | - 5 29 | - 6 30 | -------------------------------------------------------------------------------- /aeromock-jade4j/src/main/scala/jp/co/cyberagent/aeromock/template/jade4j/Jade4jConfig.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.template.jade4j 2 | 3 | import de.neuland.jade4j.Jade4J 4 | import jp.co.cyberagent.aeromock.config.TemplateConfig 5 | 6 | /** 7 | * Configuration of class for jade4j. 8 | * @author stormcat24 9 | */ 10 | case class Jade4jConfig( 11 | extension: Option[String], 12 | mode: Option[Jade4J.Mode], 13 | prettyPrint: Option[Boolean] 14 | ) extends TemplateConfig 15 | -------------------------------------------------------------------------------- /aeromock-server/src/test/scala/jp/co/cyberagent/aeromock/data/AllowedDataTypeSpec.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.data 2 | 3 | import org.specs2.mutable.{Tables, Specification} 4 | 5 | /** 6 | * 7 | * @author stormcat24 8 | */ 9 | class AllowedDataTypeSpec extends Specification with Tables { 10 | 11 | "AllowedDataType" should { 12 | 13 | "extensions" in { 14 | 15 | AllowedDataType.extensions must contain(allOf("json", "yaml", "yml")) 16 | } 17 | 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /tutorial/messagepack/data/nest.yaml: -------------------------------------------------------------------------------- 1 | id: 100 2 | mainUser: 3 | id: 1 4 | name: メインユーザー 5 | status: 6 | age: 50 7 | job: 8 | id: 100 9 | name: programmer 10 | description: null 11 | otherUsers: 12 | - id: 11 13 | name: 他のユーザー11 14 | status: 15 | age: 21 16 | job: 17 | id: 101 18 | name: designer 19 | - id: 12 20 | name: 他のユーザー12 21 | status: 22 | age: 25 23 | job: 24 | id: 102 25 | name: illustrator 26 | -------------------------------------------------------------------------------- /tutorial/protobuf/data/nest1.yaml: -------------------------------------------------------------------------------- 1 | __type: Nest1Response 2 | id: 100 3 | mainUser: 4 | id: 1 5 | name: メインユーザー 6 | status: 7 | age: 50 8 | job: 9 | id: 100 10 | name: programmer 11 | otherUsers: 12 | - id: 11 13 | name: 他のユーザー11 14 | status: 15 | age: 21 16 | job: 17 | id: 101 18 | name: designer 19 | - id: 12 20 | name: 他のユーザー12 21 | status: 22 | age: 25 23 | job: 24 | id: 102 25 | name: illustrator 26 | -------------------------------------------------------------------------------- /aeromock-report/app/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /aeromock-dsl/src/main/groovy/jp/co/cyberagent/aeromock/dsl/exception/AeromockBadGrammarException.groovy: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.dsl.exception 2 | 3 | /** 4 | * Exception when syntax error of aeromock-dsl 5 | * @author stormcat24 6 | */ 7 | class AeromockBadGrammarException extends RuntimeException { 8 | 9 | /** 10 | * Constructor 11 | * @param message error message 12 | */ 13 | AeromockBadGrammarException(String message) { 14 | super(message) 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /aeromock-report/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "node": true, 3 | "browser": true, 4 | "esnext": true, 5 | "bitwise": true, 6 | "camelcase": true, 7 | "curly": true, 8 | "eqeqeq": true, 9 | "immed": true, 10 | "indent": 2, 11 | "latedef": true, 12 | "newcap": true, 13 | "noarg": true, 14 | "quotmark": "single", 15 | "regexp": true, 16 | "undef": true, 17 | "unused": true, 18 | "strict": true, 19 | "trailing": true, 20 | "smarttabs": true, 21 | "white": true, 22 | "jquery": true 23 | } 24 | -------------------------------------------------------------------------------- /aeromock-server/src/main/scala/jp/co/cyberagent/aeromock/core/http/HttpRequestContainer.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.core.http 2 | 3 | import io.netty.handler.codec.http.FullHttpRequest 4 | 5 | case class HttpRequestContainer( 6 | original: FullHttpRequest, 7 | rewrited: Option[FullHttpRequest] 8 | ) { 9 | 10 | 11 | def finalizedRequest: FullHttpRequest = { 12 | rewrited match { 13 | case Some(request) => request 14 | case None => original 15 | } 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /aeromock-view/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "aeromock-view", 3 | "version": "0.1.0", 4 | "description": "Aeromock View", 5 | "devDependencies": { 6 | "grunt": "~0.4.2", 7 | "grunt-notify": "~0.2.17", 8 | "matchdep": "~0.3.0", 9 | "grunt-este-watch": "~0.1.15", 10 | "grunt-contrib-jshint": "~0.8.0", 11 | "grunt-contrib-copy": "~0.5.0" 12 | }, 13 | "scripts": { 14 | "build": "grunt build" 15 | }, 16 | "engines": { 17 | "node": ">=0.10.17", 18 | "npm": ">=1.3.8" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /aeromock-cli/src/main/scala/jp/co/cyberagent/aeromock/cli/job/CliJobs.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.cli.job 2 | 3 | import jp.co.cyberagent.aeromock.cli.Job 4 | 5 | /** 6 | * Job definition object. 7 | * @author stormcat24 8 | */ 9 | object CliJobs { 10 | 11 | val jobs = Seq( 12 | classOf[ValidationJob] 13 | ) 14 | 15 | lazy val availableJobs = { 16 | jobs.collect { 17 | case job if job.getAnnotation(classOf[Job]) != null => (job.getAnnotation(classOf[Job]), job) 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /aeromock-jade4j/test/project.yaml: -------------------------------------------------------------------------------- 1 | # テンプレート関連 2 | template: 3 | root: ./template 4 | serviceClass: jp.co.cyberagent.aeromock.template.jade4j.Jade4jTemplateService 5 | 6 | # データファイル関連 7 | data: 8 | root: ./data 9 | 10 | # 静的ファイル関連 11 | static: 12 | root: ./static 13 | 14 | # Ajaxデータファイル関連 15 | ajax: 16 | root: ./ajax 17 | 18 | # ファンクションのルートディレクトリ 19 | function: 20 | root: ./function 21 | 22 | # ネーミング関連 23 | #naming: 24 | # dataPrefix: __ 25 | # dataidQuery: id 26 | 27 | # テスト関連 28 | test: 29 | reportRoot: ./aeromock_report 30 | -------------------------------------------------------------------------------- /aeromock-velocity/test/project.yaml: -------------------------------------------------------------------------------- 1 | # テンプレート関連 2 | template: 3 | root: ./template 4 | serviceClass: jp.co.cyberagent.aeromock.template.velocity.VelocityTemplateService 5 | 6 | # データファイル関連 7 | data: 8 | root: ./data 9 | 10 | # 静的ファイル関連 11 | static: 12 | root: ./static 13 | 14 | # Ajaxデータファイル関連 15 | ajax: 16 | root: ./ajax 17 | 18 | # ファンクションのルートディレクトリ 19 | function: 20 | root: ./function 21 | 22 | # ネーミング関連 23 | #naming: 24 | # dataPrefix: __ 25 | # dataidQuery: id 26 | 27 | # テスト関連 28 | test: 29 | reportRoot: ./aeromock_report 30 | -------------------------------------------------------------------------------- /tutorial/protobuf/protobuf/schema/user.proto: -------------------------------------------------------------------------------- 1 | package protobuf.schema; 2 | 3 | import "schema/job.proto"; 4 | option java_outer_classname = "UserOuterClass"; 5 | 6 | message TestUser { 7 | required uint32 id = 1; 8 | required string name = 2; 9 | } 10 | 11 | message User { 12 | required uint32 id = 1; 13 | required string name = 2; 14 | optional string description = 3; 15 | required UserStatus status = 4; 16 | } 17 | 18 | message UserStatus { 19 | required uint32 age = 1; 20 | required schema.Job job = 2; 21 | } 22 | -------------------------------------------------------------------------------- /aeromock-thymeleaf/test/project.yaml: -------------------------------------------------------------------------------- 1 | # テンプレート関連 2 | template: 3 | root: ./template 4 | serviceClass: jp.co.cyberagent.aeromock.template.thymeleaf.ThymeleafTemplateService 5 | 6 | # データファイル関連 7 | data: 8 | root: ./data 9 | 10 | # 静的ファイル関連 11 | static: 12 | root: ./static 13 | 14 | # Ajaxデータファイル関連 15 | ajax: 16 | root: ./ajax 17 | 18 | # ファンクションのルートディレクトリ 19 | function: 20 | root: ./function 21 | 22 | # ネーミング関連 23 | #naming: 24 | # dataPrefix: __ 25 | # dataidQuery: id 26 | 27 | # テスト関連 28 | test: 29 | reportRoot: ./aeromock_report 30 | -------------------------------------------------------------------------------- /aeromock-freemarker/test/project.yaml: -------------------------------------------------------------------------------- 1 | # テンプレート関連 2 | template: 3 | root: ./template 4 | serviceClass: jp.co.cyberagent.aeromock.template.freemarker.FreemarkerTemplateService 5 | contexts: [] 6 | 7 | # データファイル関連 8 | data: 9 | root: ./data 10 | 11 | # 静的ファイル関連 12 | static: 13 | root: ./static 14 | 15 | # Ajaxデータファイル関連 16 | ajax: 17 | root: ./ajax 18 | 19 | # カスタムタグ関連 20 | tag: 21 | root: ./tag 22 | 23 | # ファンクションのルートディレクトリ 24 | function: 25 | root: ./function 26 | 27 | # ネーミング関連 28 | #naming: 29 | # dataPrefix: __ 30 | # dataidQuery: id 31 | -------------------------------------------------------------------------------- /aeromock-groovy-template/test/project.yaml: -------------------------------------------------------------------------------- 1 | # テンプレート関連 2 | template: 3 | root: ./template 4 | serviceClass: jp.co.cyberagent.aeromock.template.groovytemplate.GroovyTemplateService 5 | 6 | # データファイル関連 7 | data: 8 | root: ./data 9 | 10 | # 静的ファイル関連 11 | static: 12 | root: ./static 13 | 14 | # Ajaxデータファイル関連 15 | ajax: 16 | root: ./ajax 17 | 18 | # ファンクションのルートディレクトリ 19 | function: 20 | root: ./function 21 | 22 | # ネーミング関連 23 | #naming: 24 | # dataPrefix: __ 25 | # dataidQuery: id 26 | 27 | # テスト関連 28 | test: 29 | reportRoot: ./aeromock_report 30 | -------------------------------------------------------------------------------- /aeromock-handlebars-java/test/project.yaml: -------------------------------------------------------------------------------- 1 | # テンプレート関連 2 | template: 3 | root: ./template 4 | serviceClass: jp.co.cyberagent.aeromock.template.handlebars.HandlebarsTemplateService 5 | 6 | # データファイル関連 7 | data: 8 | root: ./data 9 | 10 | # 静的ファイル関連 11 | static: 12 | root: ./static 13 | 14 | # Ajaxデータファイル関連 15 | ajax: 16 | root: ./ajax 17 | 18 | # ファンクションのルートディレクトリ 19 | function: 20 | root: ./function 21 | 22 | # ネーミング関連 23 | #naming: 24 | # dataPrefix: __ 25 | # dataidQuery: id 26 | 27 | # テスト関連 28 | test: 29 | reportRoot: ./aeromock_report 30 | -------------------------------------------------------------------------------- /aeromock-server/src/main/scala/jp/co/cyberagent/aeromock/util/DummyWriter.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.util 2 | 3 | import java.io.Writer 4 | 5 | /** 6 | * Dummy writer object. 7 | * @author stormcat24 8 | */ 9 | object DummyWriter extends Writer { 10 | 11 | /** 12 | * @inheritdoc 13 | */ 14 | override def write(cbuf: Array[Char], off: Int, len: Int): Unit = {} 15 | 16 | /** 17 | * @inheritdoc 18 | */ 19 | override def flush(): Unit = {} 20 | 21 | /** 22 | * @inheritdoc 23 | */ 24 | override def close(): Unit = {} 25 | } 26 | -------------------------------------------------------------------------------- /aeromock-freemarker/test/ajax/nuko.yaml: -------------------------------------------------------------------------------- 1 | message: "ぬこ" 2 | countries: 3 | - "Japan" 4 | - "USA" 5 | - "Canada" 6 | - "China" 7 | - "India" 8 | nuko: 9 | id: 3 10 | name: "ccccc" 11 | type: 12 | color: "white" 13 | array: 14 | - "ccccc" 15 | - "ddddd" 16 | array: 17 | - type: "neko" 18 | name: "neko1" 19 | array: 20 | - 1 21 | - 2 22 | - 3 23 | - type: "neko" 24 | name: "neko2" 25 | array: 26 | - 4 27 | - 5 28 | - 6 29 | __response: 30 | code: 405 31 | headers: 32 | X-Aeromock-Test1: test1 33 | X-Aeromock-Test2: test2 -------------------------------------------------------------------------------- /aeromock-report/app/demo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | aeromock-report Demo 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

Here is an example of a `aeromock-report`:

15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /tutorial/static/expect/builtin_variables.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
    6 |
  • .template_name = builtin_variables.ftl
  • 7 |
  • .globals.hoge = fuga
  • 8 |
  • .locals.localValue = local!
  • 9 |
  • .data_model.hoge = fuga
  • 10 |
  • .lang = ja
  • 11 |
  • .locale = ja_JP
  • 12 |
  • .version = 2.3.20
  • 13 |
  • .vars.hoge = fuga
  • 14 |
  • .vars.neko = nuko
  • 15 |
  • .output_encoding = UTF-8
  • 16 |
  • .url_escaping_charset = UTF-8
  • 17 |
  • .now = 2014-03-31 12:00:00
  • 18 |
19 | 20 | 21 | -------------------------------------------------------------------------------- /aeromock-freemarker/test/static/expect/builtin_variables.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
    6 |
  • .template_name = builtin_variables.ftl
  • 7 |
  • .globals.hoge = fuga
  • 8 |
  • .locals.localValue = local!
  • 9 |
  • .data_model.hoge = fuga
  • 10 |
  • .lang = ja
  • 11 |
  • .locale = ja_JP
  • 12 |
  • .version = 2.3.20
  • 13 |
  • .vars.hoge = fuga
  • 14 |
  • .vars.neko = nuko
  • 15 |
  • .output_encoding = UTF-8
  • 16 |
  • .url_escaping_charset = UTF-8
  • 17 |
  • .now = 2014-03-31 12:00:00
  • 18 |
19 | 20 | 21 | -------------------------------------------------------------------------------- /aeromock-jade4j/src/test/scala/jp/co/cyberagent/aeromock/template/jade4j/Jade4jBootstrapSpec.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.template.jade4j 2 | 3 | import jp.co.cyberagent.aeromock.test.SpecSupport 4 | import jp.co.cyberagent.aeromock.helper._ 5 | import org.specs2.mutable.{Tables, Specification} 6 | 7 | /** 8 | * 9 | * @author stormcat24 10 | */ 11 | class Jade4jBootstrapSpec extends Specification with Tables with SpecSupport { 12 | 13 | "Jade4jBootstrap" should { 14 | "process" in { 15 | trye(new Jade4jBootstrap().process) must beRight() 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /aeromock-freemarker/test/ajax/neko.json: -------------------------------------------------------------------------------- 1 | { 2 | "message": "ねこねこ1", 3 | "countries": [ 4 | "Japan", 5 | "USA" 6 | ], 7 | "nuko": { 8 | "id" : 1 9 | "name" : "aaaaa", 10 | "type": { 11 | "color": "black" 12 | "array": ["aaaa", "bbb"] 13 | } 14 | "roles": ["neko1", "neko2"] 15 | }, 16 | "array": [ 17 | { 18 | "type": "neko", 19 | "name": "neko1", 20 | "array": [1,2,3] 21 | }, 22 | { 23 | "type": "neko", 24 | "name": "neko2", 25 | "array": [4,5,6] 26 | } 27 | ], 28 | "uri": "${REQUEST_URI}" 29 | } 30 | -------------------------------------------------------------------------------- /aeromock-server/src/main/scala/jp/co/cyberagent/aeromock/core/el/VariableHelper.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.core.el 2 | 3 | /** 4 | * Helper of variables. 5 | * @author stormcat24 6 | */ 7 | class VariableHelper(val variableMap: Map[String, Any]) { 8 | 9 | val context = new ELContext(variableMap) 10 | 11 | val variableConversion = (value: Any) => { 12 | value match { 13 | case s: String => context.eval(s) 14 | case _ => value 15 | } 16 | } 17 | 18 | val variableConversionTuple = (entry: (Any, Any)) => (entry._1, variableConversion(entry._2)) 19 | 20 | } 21 | -------------------------------------------------------------------------------- /aeromock-thymeleaf/src/test/scala/jp/co/cyberagent/aeromock/template/thymeleaf/ThymeleafBootstrapSpec.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.template.thymeleaf 2 | 3 | import jp.co.cyberagent.aeromock.test.SpecSupport 4 | import jp.co.cyberagent.aeromock.helper._ 5 | import org.specs2.mutable.{Tables, Specification} 6 | 7 | /** 8 | * 9 | * @author stormcat24 10 | */ 11 | class ThymeleafBootstrapSpec extends Specification with Tables with SpecSupport { 12 | 13 | "ThymeleafBootstrap" should { 14 | "process" in { 15 | trye(new ThymeleafBootstrap().process) must beRight() 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /aeromock-handlebars-java/src/test/scala/jp/co/cyberagent/aeromock/template/handlebars/HandlebarsBootstrapSpec.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.template.handlebars 2 | 3 | import jp.co.cyberagent.aeromock.test.SpecSupport 4 | import jp.co.cyberagent.aeromock.helper._ 5 | import org.specs2.mutable.{Specification, Tables} 6 | 7 | /** 8 | * 9 | * @author stormcat24 10 | */ 11 | class HandlebarsBootstrapSpec extends Specification with Tables with SpecSupport { 12 | 13 | "HandlebarsBootstrap" should { 14 | "process" in { 15 | trye(new HandlebarsBootstrap().process) must beRight() 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /aeromock-view/test/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "curly": true, 3 | "eqeqeq": true, 4 | "immed": true, 5 | "latedef": true, 6 | "newcap": true, 7 | "noarg": true, 8 | "sub": true, 9 | "undef": true, 10 | "unused": true, 11 | "boss": true, 12 | "eqnull": true, 13 | "browser": true, 14 | "predef": [ 15 | "jQuery", 16 | "QUnit", 17 | "module", 18 | "test", 19 | "asyncTest", 20 | "expect", 21 | "start", 22 | "stop", 23 | "ok", 24 | "equal", 25 | "notEqual", 26 | "deepEqual", 27 | "notDeepEqual", 28 | "strictEqual", 29 | "notStrictEqual", 30 | "throws" 31 | ] 32 | } -------------------------------------------------------------------------------- /aeromock-velocity/src/test/scala/jp/co/cyberagent/aeromock/template/velocity/VelocityBootstrapSpec.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.template.velocity 2 | 3 | import jp.co.cyberagent.aeromock.test.SpecSupport 4 | import jp.co.cyberagent.aeromock.helper._ 5 | import org.specs2.mutable.{Specification, Tables} 6 | 7 | /** 8 | * 9 | * @author stormcat24 10 | */ 11 | class VelocityBootstrapSpec extends Specification with Tables with SpecSupport { 12 | 13 | "VelocityBootstrap" should { 14 | "process" in { 15 | trye(new VelocityBootstrap().process) 16 | // TODO to be right 17 | true 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /aeromock-freemarker/test/data/with_property.yaml: -------------------------------------------------------------------------------- 1 | instance: 2 | neko: "nukonuko" 3 | # nest: 4 | # nukonuko: "aaaa" 5 | __methods: 6 | - name: getHoge 7 | value: "222" 8 | - name: getChild 9 | value: 10 | id: 1500 11 | name: "dongdeng" 12 | __methods: 13 | - name: execute 14 | value: 5000 15 | - name: tehepero 16 | value: "てへぺろ" 17 | nekotan: 18 | __methods: 19 | - name: getColors 20 | value: 21 | - "red" 22 | - "brown" 23 | - "silver" 24 | raidwarBean: 25 | iRaidwarUser: 26 | alert: 1000 27 | 28 | -------------------------------------------------------------------------------- /aeromock-server/src/main/scala/jp/co/cyberagent/aeromock/data/DataFileReaderFactory.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.data 2 | 3 | import java.nio.file.Path 4 | import jp.co.cyberagent.aeromock.helper._ 5 | 6 | /** 7 | * Factory object of [[DataFileReader]] 8 | * @author stormcat24 9 | */ 10 | object DataFileReaderFactory { 11 | 12 | def create(file: Path): Option[DataFileReader] = { 13 | Option(file).filter(_.exists).map { 14 | case f if file.hasExtension("json") => new JsonDataFileReader 15 | case f if file.hasExtension("yaml") || file.hasExtension("yml") => new YamlDataFileReader 16 | } 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /aeromock-freemarker/src/test/scala/jp/co/cyberagent/aeromock/template/freemarker/FreemarkerBootstrap.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.template.freemarker 2 | 3 | import jp.co.cyberagent.aeromock.test.SpecSupport 4 | import jp.co.cyberagent.aeromock.helper._ 5 | import org.specs2.mutable.{Tables, Specification} 6 | 7 | /** 8 | * 9 | * @author stormcat24 10 | */ 11 | class FreemarkerBootstrapSpec extends Specification with Tables with SpecSupport { 12 | 13 | "FreemarkerBootstrap" should { 14 | "process" in { 15 | trye(new FreemarkerBootstrap().process()) 16 | // TODO to be right 17 | true 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /aeromock-groovy-template/src/test/scala/jp/co/cyberagent/aeromock/template/groovytemplate/GroovyTemplateBootstrapSpec.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.template.groovytemplate 2 | 3 | import jp.co.cyberagent.aeromock.test.SpecSupport 4 | import jp.co.cyberagent.aeromock.helper._ 5 | import org.specs2.mutable.{Tables, Specification} 6 | 7 | /** 8 | * 9 | * @author stormcat24 10 | */ 11 | class GroovyTemplateBootstrapSpec extends Specification with Tables with SpecSupport { 12 | 13 | "GroovyTemplateBootstrap" should { 14 | "process" in { 15 | trye(new GroovyTemplateBootstrap().process) must beRight() 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /aeromock-jade4j/src/test/scala/jp/co/cyberagent/aeromock/core/bootstrap/BootstrapManagerJade4jSpec.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.core.bootstrap 2 | 3 | import jp.co.cyberagent.aeromock.test.SpecSupport 4 | import org.specs2.mutable.{Tables, Specification} 5 | 6 | /** 7 | * 8 | * @author stormcat24 9 | */ 10 | class BootstrapManagerJade4jSpec extends Specification with Tables with SpecSupport { 11 | 12 | "BootstrapManager" should { 13 | "delegete" in { 14 | BootstrapManager.delegate.collectFirst { 15 | case (EnabledMode.JADE4j, either) => either 16 | } must beSome(beRight()) 17 | } 18 | } 19 | } 20 | 21 | -------------------------------------------------------------------------------- /aeromock-thymeleaf/src/test/scala/jp/co/cyberagent/aeromock/core/bootstrap/BootstrapManagerThymeleafSpec.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.core.bootstrap 2 | 3 | import jp.co.cyberagent.aeromock.test.SpecSupport 4 | import org.specs2.mutable.{Tables, Specification} 5 | 6 | /** 7 | * 8 | * @author stormcat24 9 | */ 10 | class BootstrapManagerThymeleafSpec extends Specification with Tables with SpecSupport { 11 | 12 | "BootstrapManager" should { 13 | "delegete" in { 14 | BootstrapManager.delegate.collectFirst { 15 | case (EnabledMode.THYMELEAF, either) => either 16 | } must beSome(beRight()) 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /aeromock-freemarker/src/main/scala/jp/co/cyberagent/aeromock/template/freemarker/BuiltinMockVariableHelper.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.template.freemarker 2 | 3 | import java.util.Date 4 | 5 | import jp.co.cyberagent.aeromock.core.http.VariableManager 6 | 7 | /** 8 | * 9 | * @author stormcat24 10 | */ 11 | object BuiltinMockVariableHelper { 12 | 13 | 14 | // proxy内から呼び出されるので、signature変更の際は注意 15 | def getMockCurrentTime(realTime: Date): Date = { 16 | require(realTime != null) 17 | 18 | VariableManager.getDataMap.get("__now") match { 19 | case now: Date => now 20 | case _ => realTime 21 | } 22 | 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /aeromock-handlebars-java/src/test/scala/jp/co/cyberagent/aeromock/core/bootstrap/BootstrapManagerHandlebarsSpec.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.core.bootstrap 2 | 3 | import jp.co.cyberagent.aeromock.test.SpecSupport 4 | import org.specs2.mutable.{Tables, Specification} 5 | 6 | /** 7 | * 8 | * @author stormcat24 9 | */ 10 | class BootstrapManagerHandlebarsSpec extends Specification with Tables with SpecSupport { 11 | 12 | "BootstrapManager" should { 13 | "delegete" in { 14 | BootstrapManager.delegate.collectFirst { 15 | case (EnabledMode.HANDLEBARS, either) => either 16 | } must beSome(beRight()) 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /aeromock-freemarker/test/template/with_property.ftl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | <#assign hoge = instance.getHoge() > 6 | <#assign neko = instance.neko > 7 | <#assign execute = instance.getChild().execute() > 8 | <#assign tehepero = instance.getChild().tehepero() > 9 | <#assign id = instance.getChild().id > 10 | <#assign name = instance.getChild().name > 11 | <#assign alert = raidwarBean.iRaidwarUser.alert > 12 |
    13 |
  • ${hoge}
  • 14 |
  • ${neko}
  • 15 |
  • ${execute}
  • 16 |
  • ${tehepero}
  • 17 |
  • ${id}
  • 18 |
  • ${name}
  • 19 |
  • ${alert}
  • 20 |
21 | <#include "/common/footer.ftl"> 22 | 23 | -------------------------------------------------------------------------------- /aeromock-velocity/src/test/scala/jp/co/cyberagent/aeromock/core/bootstrap/BootstrapManagerVelocitySpec.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.core.bootstrap 2 | 3 | import jp.co.cyberagent.aeromock.test.SpecSupport 4 | import org.specs2.mutable.{Tables, Specification} 5 | 6 | /** 7 | * 8 | * @author stormcat24 9 | */ 10 | class BootstrapManagerVelocitySpec extends Specification with Tables with SpecSupport { 11 | 12 | "BootstrapManager" should { 13 | "delegete" in { 14 | BootstrapManager.delegate.collectFirst { 15 | case (EnabledMode.VELOCITY, either) => either 16 | } must beSome 17 | // TODO to be right 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /aeromock-groovy-template/src/test/scala/jp/co/cyberagent/aeromock/core/bootstrap/BootstrapManagerGroovyTemplatesSpec.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.core.bootstrap 2 | 3 | import jp.co.cyberagent.aeromock.test.SpecSupport 4 | import org.specs2.mutable.{Tables, Specification} 5 | 6 | /** 7 | * 8 | * @author stormcat24 9 | */ 10 | class BootstrapManagerGroovyTemplatesSpec extends Specification with Tables with SpecSupport { 11 | 12 | "BootstrapManager" should { 13 | "delegete" in { 14 | BootstrapManager.delegate.collectFirst { 15 | case (EnabledMode.GROOVY_TEMPLATE, either) => either 16 | } must beSome(beRight()) 17 | } 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /aeromock-cli/src/main/scala/jp/co/cyberagent/aeromock/cli/CliJob.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.cli 2 | 3 | import jp.co.cyberagent.aeromock.cli.option.JobOperation 4 | import jp.co.cyberagent.aeromock.config.Project 5 | import jp.co.cyberagent.aeromock.template.TemplateService 6 | import org.slf4j.LoggerFactory 7 | import scaldi.Injectable 8 | 9 | /** 10 | * Base job trait. 11 | * @author stormcat24 12 | */ 13 | trait CliJob extends AnyRef with Injectable { 14 | 15 | val command: JobOperation 16 | 17 | val log = LoggerFactory.getLogger(this.getClass()) 18 | 19 | /** 20 | * execute job. 21 | * @return return code 22 | */ 23 | def execute(): Int 24 | 25 | } 26 | -------------------------------------------------------------------------------- /aeromock-server/src/main/scala/jp/co/cyberagent/aeromock/core/ObjectCache.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.core 2 | 3 | import scala.reflect.ClassTag 4 | 5 | /** 6 | * 7 | * @author stormcat24 8 | */ 9 | object ObjectCache { 10 | 11 | val cache = new java.util.concurrent.ConcurrentHashMap[CacheKey[_], AnyRef]() 12 | 13 | def store(key: CacheKey[_], value: AnyRef) { 14 | cache.put(key, value) 15 | } 16 | 17 | def get[ValueType](key: CacheKey[ValueType])(implicit tag: ClassTag[ValueType]): Option[ValueType] = { 18 | Option(cache.get(key)).map(_.asInstanceOf[ValueType]) 19 | } 20 | 21 | } 22 | 23 | case class CacheKey[ValueType](target: String, checkSum: String) 24 | -------------------------------------------------------------------------------- /tutorial/protobuf/protobuf/api/test.proto: -------------------------------------------------------------------------------- 1 | package protobuf.api; 2 | 3 | import "schema/user.proto"; 4 | 5 | message TestRequest { 6 | required int32 prop1 = 1; 7 | required string prop2 = 2; 8 | } 9 | 10 | message TestResponse { 11 | required int32 prop1 = 1; 12 | required string prop2 = 2; 13 | required int64 prop3 = 3; 14 | repeated string prop4 = 4; 15 | required schema.TestUser prop5 = 5; 16 | optional int64 prop6 = 6 [default = 1]; 17 | } 18 | 19 | //message TestResponse { 20 | // required int32 id = 1; 21 | // optional string description = 2 [default = "hogehoge"]; 22 | // required schema.User user1 = 4; 23 | // required schema.User user2 = 8; 24 | //} 25 | -------------------------------------------------------------------------------- /aeromock-dsl/src/main/groovy/jp/co/cyberagent/aeromock/dsl/exception/AeromockPatternSyntaxException.groovy: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.dsl.exception 2 | 3 | import java.util.regex.PatternSyntaxException; 4 | 5 | /** 6 | * Exception when regular expression error. 7 | *

Wrap {@link PatternSyntaxException}.

8 | * @author stormcat24 9 | * 10 | */ 11 | class AeromockPatternSyntaxException extends RuntimeException { 12 | 13 | /** 14 | * Constructor 15 | * @param message error message 16 | * @param e {@link PatternSyntaxException} 17 | */ 18 | AeromockPatternSyntaxException(String message, PatternSyntaxException e) { 19 | super(message, e) 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /aeromock-server/Build.sbt: -------------------------------------------------------------------------------- 1 | name := "aeromock-server" 2 | 3 | description := "Aeromock server daemon." 4 | 5 | libraryDependencies ++= Seq( 6 | "io.netty" % "netty-all" % nettyVersion, 7 | "org.json4s" %% "json4s-native" % "3.2.11", 8 | "org.yaml" % "snakeyaml" % "1.15", 9 | "joda-time" % "joda-time" % "2.3", 10 | "org.joda" % "joda-convert" % "1.6", 11 | "org.javassist" % "javassist" % "3.18.2-GA", 12 | "org.apache.commons" % "commons-lang3" % "3.1", 13 | "args4j" % "args4j" % "2.0.29", 14 | "org.glassfish" % "javax.el" % "3.0.0", 15 | "com.google.protobuf" % "protobuf-java" % "2.6.1", 16 | "com.squareup" % "protoparser" % "3.1.5", 17 | "org.msgpack" %% "msgpack-scala" % "0.6.11" 18 | ) 19 | -------------------------------------------------------------------------------- /aeromock-server/src/main/scala/jp/co/cyberagent/aeromock/server/http/UserStaticFileHttpRequestProcessor.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.server.http 2 | 3 | import java.nio.file.Path 4 | import jp.co.cyberagent.aeromock.config.Project 5 | import jp.co.cyberagent.aeromock.helper._ 6 | import jp.co.cyberagent.aeromock.core.http.ParsedRequest 7 | import scaldi.Injector 8 | 9 | class UserStaticFileHttpRequestProcessor(implicit inj: Injector) extends StaticFileHttpRequestProcessor { 10 | 11 | override val project = inject[Project] 12 | 13 | override protected def getStaticFile(project: Project, parsedRequest: ParsedRequest): Path = { 14 | project._static.root / parsedRequest.url 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | end_of_line = lf 5 | charset = utf-8 6 | insert_final_newline = true 7 | trim_trailing_whitespace = true 8 | 9 | [*.java] 10 | indent_style = space 11 | indent_size = 4 12 | 13 | [*.groovy] 14 | indent_style = space 15 | indent_size = 4 16 | 17 | [*.scala] 18 | indent_style = space 19 | indent_size = 2 20 | 21 | [*.xml] 22 | indent_style = tab 23 | indent_size = 4 24 | 25 | [*.html] 26 | indent_style = tab 27 | indent_size = 4 28 | 29 | [*.ftl] 30 | indent_style = tab 31 | indent_size = 4 32 | 33 | [*.hbs] 34 | indent_style = tab 35 | indent_size = 4 36 | 37 | [*.jade] 38 | indent_style = tab 39 | indent_size = 4 40 | 41 | [*.vm] 42 | indent_style = tab 43 | indent_size = 4 -------------------------------------------------------------------------------- /aeromock-freemarker/test/ajax/array__2.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "key": "neko1", 4 | "value": { 5 | "name": "neko1", 6 | "age": 10, 7 | "color": "brown", 8 | "builtin": "${REQUEST_URI}" 9 | } 10 | }, 11 | { 12 | "key": "neko2", 13 | "value": { 14 | "name": "neko2", 15 | "age": 12, 16 | "color": "black", 17 | "builtin": "${REQUEST_URI}" 18 | } 19 | }, 20 | { 21 | "key": "neko3", 22 | "value": { 23 | "name": "neko3", 24 | "age": 5, 25 | "color": "silver", 26 | "builtin": "${REQUEST_URI}" 27 | } 28 | } 29 | ] -------------------------------------------------------------------------------- /aeromock-cli/src/main/java/jp/co/cyberagent/aeromock/cli/Job.java: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.cli; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * Annotation to mark Job class. 10 | * @author stormcat24 11 | */ 12 | @Retention(RetentionPolicy.RUNTIME) 13 | @Target(ElementType.TYPE) 14 | public @interface Job { 15 | 16 | /** 17 | * Return job name. {@code name} is unique id to identify job. 18 | * @return job name 19 | */ 20 | String name(); 21 | 22 | /** 23 | * @return description of job 24 | */ 25 | String description(); 26 | 27 | } 28 | -------------------------------------------------------------------------------- /aeromock-server/src/test/scala/jp/co/cyberagent/aeromock/test/RequestScope.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.test 2 | 3 | import jp.co.cyberagent.aeromock.core.http.VariableManager 4 | import org.specs2.specification.{After, Before, Scope} 5 | 6 | /** 7 | * 8 | * @author stormcat24 9 | */ 10 | object RequestScope extends Scope with Before { 11 | 12 | override def before = { 13 | VariableManager.initializeRequestMap(Map( 14 | "USER_AGENT" -> "test", 15 | "REQUEST_URI" -> "/test", 16 | "HOST" -> "localhost:3183", 17 | "QUERY_STRING" -> "", 18 | "REMOTE_HOST" -> "localhost" 19 | )) 20 | VariableManager.initializeOriginalVariableMap(new java.util.HashMap[String, AnyRef]()) 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /aeromock-freemarker/src/test/scala/jp/co/cyberagent/aeromock/core/bootstrap/BootstrapManagerFreemarkerSpec.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.core 2 | 3 | import jp.co.cyberagent.aeromock.test.SpecSupport 4 | import jp.co.cyberagent.aeromock.core.bootstrap.{BootstrapManager, EnabledMode} 5 | import org.specs2.mutable.{Specification, Tables} 6 | 7 | /** 8 | * 9 | * @author stormcat24 10 | */ 11 | class BootstrapManagerFreemarkerSpec extends Specification with Tables with SpecSupport { 12 | 13 | "BootstrapManager" should { 14 | "delegete" in { 15 | BootstrapManager.delegate.collectFirst { 16 | case (EnabledMode.FREEMARKER, either) => either 17 | } must beSome 18 | // TODO to be right 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /aeromock-jade4j/test/template/test.jade: -------------------------------------------------------------------------------- 1 | !!! 5 2 | html 3 | head 4 | include common/header 5 | body 6 | h4 ビルトイン項目確認 7 | ul 8 | li REQUEST_URI = #{requestUri} 9 | li QUERY_STRING = #{queryString} 10 | li HOST = #{host} 11 | li REMOTE_HOST = #{remoteHost} 12 | 13 | h4 シンプルネスト 14 | ul 15 | li nest.level1 = #{nest.level1} 16 | li nest.property1 = #{nest.property1} 17 | li nest.child.level2 = #{nest.child.level2} 18 | li nest.child.property2 = #{nest.child.property2} 19 | 20 | h4 シンプルリスト 21 | ul 22 | for value in simpleList 23 | li #{value} 24 | 25 | h4 ネストリスト 26 | ul 27 | for value in nestList 28 | li #{value} 29 | 30 | p= math.round(1.44) -------------------------------------------------------------------------------- /aeromock-freemarker/test/template.yaml: -------------------------------------------------------------------------------- 1 | freemarker: 2 | # aeromock additional setting 3 | autoEscape: false 4 | 5 | # freemarker settings 6 | autoFlush: false 7 | objectWrapper: BEANS_WRAPPER 8 | autoIncludes: [] 9 | booleanFormat: "true,false" 10 | classicCompatible: false 11 | #dateFormat: 12 | dateTimeFormat: "yyyy-MM-dd HH:mm:ss" 13 | defaultEncoding: "UTF-8" 14 | localizedLookup: true 15 | numberFormat: "###" 16 | outputEncoding: "UTF-8" 17 | strictBeanModels: false 18 | strictSyntaxMode: true 19 | tagSyntax: 0 20 | # AUTO_DETECT_TAG_SYNTAX = 0 21 | # ANGLE_BRACKET_TAG_SYNTAX = 1 22 | # SQUARE_BRACKET_TAG_SYNTAX = 2 23 | #templateUpdateDelay: 5000 24 | # timeFormat: "HH:mm:ss" 25 | urlEscapingCharset: "UTF-8" 26 | whitespaceStripping: true 27 | -------------------------------------------------------------------------------- /aeromock-report/app/aeromock-report.html: -------------------------------------------------------------------------------- 1 | 13 | 14 | 15 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /aeromock-server/src/main/scala/jp/co/cyberagent/aeromock/core/Validations.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.core 2 | 3 | import scala.reflect.ClassTag 4 | import scalaz.Scalaz._ 5 | import scalaz.Validation 6 | import scalaz.Validation._ 7 | import org.apache.commons.lang3.StringUtils 8 | 9 | object Validations { 10 | 11 | def cast[S: ClassTag](value: Any): Validation[Throwable, S] = { 12 | val t = implicitly[ClassTag[S]].runtimeClass.asInstanceOf[Class[S]] 13 | fromTryCatch(t.cast(value)) 14 | } 15 | 16 | def blank(value: String): Validation[Throwable, String] = { 17 | 18 | if (StringUtils.isBlank(value)) { 19 | new IllegalArgumentException("must be not blank").failure[String] 20 | } else { 21 | value.success[Throwable] 22 | } 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /aeromock-thymeleaf/src/main/scala/jp/co/cyberagent/aeromock/template/thymeleaf/ThymeleafConfig.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.template.thymeleaf 2 | 3 | import jp.co.cyberagent.aeromock.config.TemplateConfig 4 | 5 | /** 6 | * Configuration of class for thymeleaf. 7 | * @author stormcat24 8 | */ 9 | case class ThymeleafConfig( 10 | suffix: Option[String], 11 | characterEncoding: Option[String], 12 | templateAliases: Option[Map[String, String]], 13 | templateMode: Option[String], 14 | legacyHtml5TemplateModePatterns: Option[List[String]], 15 | validXhtmlTemplateModePatterns: Option[List[String]], 16 | validXmlTemplateModePatterns: Option[List[String]], 17 | xhtmlTemplateModePatterns: Option[List[String]], 18 | xmlTemplateModePatterns: Option[List[String]] 19 | ) extends TemplateConfig 20 | -------------------------------------------------------------------------------- /tutorial/static/expect/enum.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
    5 |
  • enums["jp.co.cyberagent.aeromock.test.enums.TestType"].NEKO1.key = neko1
  • 6 |
  • enums["jp.co.cyberagent.aeromock.test.enums.TestType"].NEKO1.value = ねこ1
  • 7 |
  • enums["jp.co.cyberagent.aeromock.test.enums.TestType"].NEKO2.key = neko2
  • 8 |
  • enums["jp.co.cyberagent.aeromock.test.enums.TestType"].NEKO2.value = ねこ2
  • 9 |
  • enums["jp.co.cyberagent.aeromock.test.enums.TestType2"].NUKO1.key = neko1
  • 10 |
  • enums["jp.co.cyberagent.aeromock.test.enums.TestType2"].NUKO1.value = ぬこ1
  • 11 |
  • enums["jp.co.cyberagent.aeromock.test.enums.TestType2"].NUKO2.key = neko2
  • 12 |
  • enums["jp.co.cyberagent.aeromock.test.enums.TestType2"].NUKO2.value = ぬこ2
  • 13 |
14 | 15 | 16 | -------------------------------------------------------------------------------- /aeromock-jade4j/test/data/test.yaml: -------------------------------------------------------------------------------- 1 | title: headertitle! 2 | requestUri: ${REQUEST_URI} 3 | queryString: ${QUERY_STRING} 4 | host: ${HOST} 5 | remoteHost: ${REMOTE_HOST} 6 | nest: 7 | level1: ${REQUEST_URI}_level1 8 | property1: hoge1 9 | child: 10 | level2: ${REQUEST_URI}_level2 11 | property2: hoge2 12 | simpleList: 13 | - "${REQUEST_URI}" 14 | - element2 15 | - "${HOST}" 16 | - element4 17 | - 5 18 | nestList: 19 | - "${REQUEST_URI}" 20 | - level1: ${REQUEST_URI}_level1_1 21 | property1: hoge2_1 22 | child: 23 | level2: ${REQUEST_URI}_level2_1 24 | property2: hoge2_1 25 | - level1: ${REQUEST_URI}_level1_2 26 | property1: hoge2_2 27 | child: 28 | level2: ${REQUEST_URI}_level2_2 29 | property2: hoge2_2 30 | parts: 31 | property1: value1 32 | property2: value2 -------------------------------------------------------------------------------- /aeromock-spec-support/src/main/scala/jp/co/cyberagent/aeromock/test/package.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock 2 | 3 | import java.nio.file.{Path, Paths} 4 | 5 | import io.netty.handler.codec.http.{DefaultFullHttpRequest, FullHttpRequest, HttpMethod, HttpVersion} 6 | import scaldi.Injectable 7 | 8 | 9 | /** 10 | * 11 | * @author stormcat24 12 | */ 13 | package object test { 14 | 15 | trait SpecSupport extends AnyRef with Injectable { 16 | def getResourcePath(path: String): Path = { 17 | val url = Thread.currentThread().getContextClassLoader.getResource(path) 18 | Paths.get(url.getPath) 19 | } 20 | 21 | def request(uri: String, method: HttpMethod = HttpMethod.GET): FullHttpRequest = { 22 | new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, method, uri) 23 | } 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /aeromock-freemarker/test/static/expect/enum.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
    5 |
  • enums["jp.co.cyberagent.aeromock.test.enums.TestType"].NEKO1.key = neko1
  • 6 |
  • enums["jp.co.cyberagent.aeromock.test.enums.TestType"].NEKO1.value = ねこ1
  • 7 |
  • enums["jp.co.cyberagent.aeromock.test.enums.TestType"].NEKO2.key = neko2
  • 8 |
  • enums["jp.co.cyberagent.aeromock.test.enums.TestType"].NEKO2.value = ねこ2
  • 9 |
  • enums["jp.co.cyberagent.aeromock.test.enums.TestType2"].NUKO1.key = neko1
  • 10 |
  • enums["jp.co.cyberagent.aeromock.test.enums.TestType2"].NUKO1.value = ぬこ1
  • 11 |
  • enums["jp.co.cyberagent.aeromock.test.enums.TestType2"].NUKO2.key = neko2
  • 12 |
  • enums["jp.co.cyberagent.aeromock.test.enums.TestType2"].NUKO2.value = ぬこ2
  • 13 |
14 | 15 | 16 | -------------------------------------------------------------------------------- /aeromock-handlebars-java/test/data/test.yaml: -------------------------------------------------------------------------------- 1 | title: headertitle! 2 | requestUri: ${REQUEST_URI} 3 | queryString: ${QUERY_STRING} 4 | host: ${HOST} 5 | remoteHost: ${REMOTE_HOST} 6 | nest: 7 | level1: ${REQUEST_URI}_level1 8 | property1: hoge1 9 | child: 10 | level2: ${REQUEST_URI}_level2 11 | property2: hoge2 12 | simpleList: 13 | - "${REQUEST_URI}" 14 | - element2 15 | - "${HOST}" 16 | - element4 17 | - 5 18 | nestList: 19 | - "${REQUEST_URI}" 20 | - level1: ${REQUEST_URI}_level1_1 21 | property1: hoge2_1 22 | child: 23 | level2: ${REQUEST_URI}_level2_1 24 | property2: hoge2_1 25 | - level1: ${REQUEST_URI}_level1_2 26 | property1: hoge2_2 27 | child: 28 | level2: ${REQUEST_URI}_level2_2 29 | property2: hoge2_2 30 | parts: 31 | property1: value1 32 | property2: value2 -------------------------------------------------------------------------------- /aeromock-dsl/src/main/groovy/jp/co/cyberagent/aeromock/dsl/routing/RoutingDsl.groovy: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.dsl.routing 2 | 3 | /** 4 | * Implementation of {@code routing} directive. 5 | * @author stormcat24 6 | */ 7 | class RoutingDsl { 8 | 9 | def call(Closure closure) { 10 | closure.setDelegate(this) 11 | closure.setResolveStrategy(Closure.DELEGATE_FIRST) 12 | closure.call() 13 | return _requestUri 14 | } 15 | 16 | def _requestUri 17 | 18 | def methodMissing(String methodName, args) { 19 | 20 | if (methodName == "server") { 21 | ServerDsl server = new ServerDsl(args) 22 | String result = server.execute() 23 | if (result != null) { 24 | _requestUri = result 25 | } 26 | } 27 | 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /aeromock-cli/src/test/scala/jp/co/cyberagent/aeromock/cli/TestTemplateService.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.cli 2 | 3 | import jp.co.cyberagent.aeromock.core.annotation.TemplateIdentifier 4 | import jp.co.cyberagent.aeromock.core.http.ParsedRequest 5 | import jp.co.cyberagent.aeromock.data.InstanceProjection 6 | import jp.co.cyberagent.aeromock.template.TemplateService 7 | import scaldi.Injector 8 | 9 | 10 | /** 11 | * 12 | * @author stormcat24 13 | */ 14 | @TemplateIdentifier(name = "test", configType = classOf[Void], specialConfig = true) 15 | class TestTemplateService(implicit val inj: Injector) extends TemplateService { 16 | override protected def renderHtml(request: ParsedRequest, projection: InstanceProjection): String = "test" 17 | 18 | /** 19 | * @return extension 20 | */ 21 | override def extension: String = ".tmpl" 22 | } 23 | -------------------------------------------------------------------------------- /aeromock-groovy-template/src/main/scala/jp/co/cyberagent/aeromock/template/groovytemplate/TemplateEngineFactory.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.template.groovytemplate 2 | 3 | import groovy.text._ 4 | 5 | /** 6 | * Factory object to create [[groovy.text.TemplateEngine]]. 7 | * @author stormcat24 8 | */ 9 | object TemplateEngineFactory { 10 | 11 | /** 12 | * Create [[groovy.text.TemplateEngine]]. 13 | * @param modeType mode of template engine 14 | * @return [[groovy.text.TemplateEngine]] 15 | */ 16 | def create(modeType: Option[String]): TemplateEngine = { 17 | modeType match { 18 | case Some("simple") => new SimpleTemplateEngine() 19 | case Some("gstring") => new GStringTemplateEngine() 20 | case Some("xml") => new XmlTemplateEngine() 21 | case _ => new SimpleTemplateEngine() 22 | } 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /aeromock-freemarker/test/template/builtin_variables.ftl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
    5 |
  • .template_name = ${.template_name}
  • 6 |
  • .globals.hoge = ${.globals.hoge}
  • 7 | <#macro m> 8 | <#local localValue = "local!" /> 9 |
  • .locals.localValue = ${.locals.localValue}
  • 10 | 11 | <@m/> 12 |
  • .data_model.hoge = ${.data_model.hoge}
  • 13 |
  • .lang = ${.lang}
  • 14 |
  • .locale = ${.locale}
  • 15 |
  • .version = ${.version}
  • 16 |
  • .vars.hoge = ${.vars.hoge}
  • 17 | <#assign neko = "nuko" /> 18 |
  • .vars.neko = ${.vars.neko}
  • 19 | <#attempt> 20 | <#assign value = Integer.parseInt("hoge") /> 21 | <#recover> 22 | 23 |
  • .output_encoding = ${.output_encoding}
  • 24 |
  • .url_escaping_charset = ${.url_escaping_charset}
  • 25 |
  • .now = ${.now}
  • 26 |
27 | 28 | -------------------------------------------------------------------------------- /aeromock-server/src/main/scala/jp/co/cyberagent/aeromock/api/AeromockApi.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.api 2 | 3 | import io.netty.handler.codec.http.HttpMethod 4 | import io.netty.handler.codec.http.HttpMethod._ 5 | import jp.co.cyberagent.aeromock.api.controller.{AeromockApiController, DataCreateController} 6 | import jp.co.cyberagent.aeromock.core.http.ParsedRequest 7 | import scaldi.{Injectable, Injector} 8 | 9 | sealed abstract class AeromockApi( 10 | val endpoint: String, 11 | val method: HttpMethod, 12 | val controller: AeromockApiController) { 13 | } 14 | 15 | object AeromockApi extends Injectable { 16 | 17 | def fetchController(request: ParsedRequest)(implicit inj: Injector): Option[AeromockApiController] = { 18 | request match { 19 | case ParsedRequest(_, _, _, GET) => Some(inject[DataCreateController]) 20 | case _ => None 21 | } 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /aeromock-dsl/testscripts/routing/routing_virtualhost.groovy: -------------------------------------------------------------------------------- 1 | routing { 2 | server "vhost1.local", { 3 | rewrite(/^\/hoge$/, '/hoge/vhost1') 4 | 5 | rewrite(/^\/fuga\/(.+)$/, '/fuga/vhost1/$1') 6 | 7 | rewrite(/^\/closure\/(.+)\/(.+)/, { _ -> 8 | "/closure/vhost1/hoge-${_._1}/fuga-${_._2}" 9 | }) 10 | 11 | condition QUERY_STRING, /^param1=(.+)¶m2=(.+)$/, { _ -> 12 | rewrite(/(.*)/, { __ -> 13 | "${__._1}/${_._1}/${_._2}" 14 | }) 15 | } 16 | } 17 | 18 | server "vhost2.local", { 19 | rewrite(/^\/hoge$/, '/hoge/vhost2') 20 | 21 | rewrite(/^\/fuga\/(.+)$/, '/fuga/vhost2/$1') 22 | 23 | rewrite(/^\/closure\/(.+)\/(.+)/, { _ -> 24 | "/closure/vhost2/hoge-${_._1}/fuga-${_._2}" 25 | }) 26 | 27 | condition QUERY_STRING, /^param1=(.+)¶m2=(.+)$/, { _ -> 28 | rewrite(/(.*)/, { __ -> 29 | "${__._1}/${_._1}/${_._2}" 30 | }) 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /aeromock-freemarker/src/main/scala/jp/co/cyberagent/aeromock/template/freemarker/FreemarkerBootstrap.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.template.freemarker 2 | 3 | import jp.co.cyberagent.aeromock.core.bootstrap.Bootstrap 4 | import freemarker.log.Logger 5 | 6 | class FreemarkerBootstrap extends Bootstrap { 7 | 8 | val SIMPLE_DATE = "freemarker.template.SimpleDate" 9 | 10 | override def process(): Unit = { 11 | 12 | Logger.selectLoggerLibrary(Logger.LIBRARY_NONE) 13 | 14 | val simpleDateCtClass = pool.get(SIMPLE_DATE) 15 | if (!simpleDateCtClass.isFrozen()) { 16 | val getAsDateMethod = simpleDateCtClass.getDeclaredMethod("getAsDate") 17 | getAsDateMethod.insertAfter("return jp.co.cyberagent.aeromock.template.freemarker.BuiltinMockVariableHelper.getMockCurrentTime(date);"); 18 | // load changed class. 19 | simpleDateCtClass.toClass() 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /aeromock-server/src/main/scala/jp/co/cyberagent/aeromock/config/ServerOption.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.config 2 | 3 | import java.nio.file.{Path, Paths} 4 | 5 | import jp.co.cyberagent.aeromock.helper._ 6 | 7 | import scalaz.Scalaz._ 8 | 9 | class ServerOptionDef { 10 | 11 | type Args4jOption = org.kohsuke.args4j.Option 12 | 13 | @Args4jOption(name = "-p", usage = "listen port") 14 | var port: String = null 15 | 16 | @Args4jOption(name = "-c", usage = "path of config file") 17 | var configFile: String = null 18 | 19 | } 20 | 21 | class ServerOption(val port: Option[Int], val configFile: Option[Path]) 22 | 23 | object ServerOption { 24 | 25 | def apply(bean: ServerOptionDef): ServerOption = { 26 | new ServerOption( 27 | Option(bean.port).flatMap(_.parseInt.toOption), 28 | Option(bean.configFile).map(p => Paths.get(p).withHomeDirectory()) 29 | ) 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /aeromock-velocity/src/main/scala/jp/co/cyberagent/aeromock/template/velocity/VelocityBootstrap.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.template.velocity 2 | 3 | import jp.co.cyberagent.aeromock.core.bootstrap.Bootstrap 4 | 5 | /** 6 | * Bootstrap of Velocity 7 | * @author stormcat24 8 | */ 9 | class VelocityBootstrap extends Bootstrap { 10 | 11 | val RUNTIME_INSTANCE = "org.apache.velocity.runtime.RuntimeInstance" 12 | 13 | /** 14 | * @inheritdoc 15 | */ 16 | override def process(): Unit = { 17 | val runtimeInstanceCtClass = pool.get(RUNTIME_INSTANCE) 18 | if (!runtimeInstanceCtClass.isFrozen) { 19 | val initMethod = runtimeInstanceCtClass.getDeclaredMethod("init") 20 | 21 | // [note] assign 'false' to 'initialized' forcely to reload configuration. 22 | initMethod.insertBefore("""initialized = false;"""); 23 | runtimeInstanceCtClass.toClass 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /tutorial/freemarker/template.yaml: -------------------------------------------------------------------------------- 1 | freemarker: 2 | # aeromock additional setting 3 | autoEscape: false 4 | 5 | # freemarker settings 6 | autoFlush: false 7 | objectWrapper: BEANS_WRAPPER 8 | autoIncludes: [] 9 | booleanFormat: "true,false" 10 | classicCompatible: false 11 | #dateFormat: 12 | dateTimeFormat: "yyyy-MM-dd HH:mm:ss" 13 | defaultEncoding: "UTF-8" 14 | localizedLookup: true 15 | numberFormat: "###" 16 | outputEncoding: "UTF-8" 17 | strictBeanModels: false 18 | strictSyntaxMode: true 19 | tagSyntax: 0 20 | # AUTO_DETECT_TAG_SYNTAX = 0 21 | # ANGLE_BRACKET_TAG_SYNTAX = 1 22 | # SQUARE_BRACKET_TAG_SYNTAX = 2 23 | #templateUpdateDelay: 5000 24 | # timeFormat: "HH:mm:ss" 25 | urlEscapingCharset: "UTF-8" 26 | whitespaceStripping: true 27 | # BIGDECIMAL_ENGINE(default)|CONSERVATIVE_ENGINE 28 | arithmeticEngine: 29 | autoImports: 30 | spring: common/spring.ftl 31 | -------------------------------------------------------------------------------- /aeromock-server/src/main/scala/jp/co/cyberagent/aeromock/config/MessageManager.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.config 2 | 3 | import java.util.ResourceBundle 4 | 5 | import jp.co.cyberagent.aeromock.AeromockException 6 | 7 | /** 8 | * Multi language message manager. 9 | * @author stormcat24 10 | */ 11 | object MessageManager { 12 | 13 | def getMessage(key: Class[_ <: AeromockException], args: AnyRef*): String = getMessageRaw(key.getName, args:_*) 14 | def getMessage(key: String, args: AnyRef*): String = getMessageRaw(key, args:_*) 15 | 16 | private def getMessageRaw(key: String, args: AnyRef*): String = { 17 | val bundle = ResourceBundle.getBundle("messages.message") 18 | 19 | Option(bundle.getString(key)) match { 20 | case None => null 21 | case Some(template) => args.zipWithIndex.foldLeft(template)((s, arg) => s.replace(s"{${arg._2}}", arg._1.toString)) 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /aeromock-server/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | System.out 7 | 8 | %d{yyyy-MM-dd HH:mm:ss}\t%-5level\t%logger{36}#%method\t%message%n 9 | 10 | 11 | 12 | 13 | System.out 14 | 15 | %d{yyyy-MM-dd HH:mm:ss}\taccess\t%message%n 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /aeromock-thymeleaf/src/main/scala/jp/co/cyberagent/aeromock/template/thymeleaf/ThymeleafDetailDef.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.template.thymeleaf 2 | 3 | import scala.beans.BeanProperty 4 | 5 | /** 6 | * 7 | * @author stormcat24 8 | */ 9 | class ThymeleafDetailDef { 10 | @BeanProperty var suffix: String = null 11 | @BeanProperty var characterEncoding: String = null 12 | @BeanProperty var templateAliases: java.util.Map[String, String] = null 13 | @BeanProperty var templateMode: String = null 14 | @BeanProperty var legacyHtml5TemplateModePatterns: java.util.List[String] = null 15 | @BeanProperty var validXhtmlTemplateModePatterns: java.util.List[String] = null 16 | @BeanProperty var validXmlTemplateModePatterns: java.util.List[String] = null 17 | @BeanProperty var xhtmlTemplateModePatterns: java.util.List[String] = null 18 | @BeanProperty var xmlTemplateModePatterns: java.util.List[String] = null 19 | 20 | } 21 | -------------------------------------------------------------------------------- /tutorial/jade4j/template/test.jade: -------------------------------------------------------------------------------- 1 | !!! 5 2 | html 3 | head 4 | include common/header 5 | body 6 | h4 use Aeromock builtin variables 7 | ul 8 | li REQUEST_URI = #{requestUri} 9 | li QUERY_STRING = #{queryString} 10 | li HOST = #{host} 11 | li REMOTE_HOST = #{remoteHost} 12 | 13 | h4 simple nest 14 | ul 15 | li nest.level1 = #{nest.level1} 16 | li nest.property1 = #{nest.property1} 17 | li nest.child.level2 = #{nest.child.level2} 18 | li nest.child.property2 = #{nest.child.property2} 19 | 20 | h4 simple list 21 | ul 22 | for value in simpleList 23 | li #{value} 24 | 25 | h4 nest list 26 | ul 27 | for value in nestList 28 | li #{value} 29 | 30 | h4 common data 31 | ul 32 | li commonProp = #{commonProp} 33 | li commonHash.prop1 = #{commonHash.prop1} 34 | 35 | h4 helper 36 | p math.round(1.44) = #{math.round(1.44)} 37 | -------------------------------------------------------------------------------- /aeromock-server/src/test/scala/jp/co/cyberagent/aeromock/data/DataFileReaderFactorySpec.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.data 2 | 3 | import java.nio.file.Paths 4 | 5 | import jp.co.cyberagent.aeromock.test.SpecSupport 6 | import org.specs2.mutable.{Tables, Specification} 7 | import DataFileReaderFactory._ 8 | 9 | /** 10 | * 11 | * @author stormcat24 12 | */ 13 | class DataFileReaderFactorySpec extends Specification with Tables with SpecSupport { 14 | 15 | "create" should { 16 | "Illegal values" in { 17 | create(null) must beNone 18 | create(Paths.get("not_exists")) must beNone 19 | } 20 | 21 | "exists files" in { 22 | 23 | "path" | "expect" | 24 | "data.json" ! classOf[JsonDataFileReader] | 25 | "data.yml" ! classOf[YamlDataFileReader] | 26 | "data.yaml" ! classOf[YamlDataFileReader] |> { (path, expect) => 27 | create(getResourcePath(s"data/DataFileReaderFactory/$path")).map(_.getClass) must_== Some(expect) 28 | } 29 | } 30 | 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /aeromock-server/src/main/java/jp/co/cyberagent/aeromock/core/annotation/TemplateIdentifier.java: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.core.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * {@link jp.co.cyberagent.aeromock.template.TemplateService}とテンプレート識別子を紐付けるためのアノテーションです。 10 | * @author stormcat24 11 | * 12 | */ 13 | @Retention(RetentionPolicy.RUNTIME) 14 | @Target(ElementType.TYPE) 15 | public @interface TemplateIdentifier { 16 | 17 | /** 18 | * テンプレート識別子を返します。 19 | * @return テンプレート識別子 20 | */ 21 | String name(); 22 | 23 | /** 24 | * 設定ファイルのマッピングクラスを返します。 25 | * @return マッピングクラス 26 | */ 27 | Class configType(); 28 | 29 | /** 30 | * template.yaml以外のテンプレート設定ファイルを利用する場合、{@code true}を返します。 31 | * @return {@code true}: 非template.yaml / {@code false}: template.yaml 32 | */ 33 | boolean specialConfig() default false; 34 | 35 | } 36 | -------------------------------------------------------------------------------- /aeromock-server/src/test/scala/jp/co/cyberagent/aeromock/helper/StringContextHelperSpec.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.helper 2 | 3 | import java.util.Locale 4 | 5 | import jp.co.cyberagent.aeromock.test.SpecSupport 6 | import org.specs2.mutable.{Tables, Specification} 7 | 8 | /** 9 | * 10 | * @author stormcat24 11 | */ 12 | class StringContextHelperSpec extends Specification with Tables with SpecSupport { 13 | 14 | Locale.setDefault(Locale.US) 15 | "none placeholder message" in { 16 | message"test.none.placeholder" must_== "None Placeholder" 17 | } 18 | 19 | "has placeholder message" in { 20 | "without arguments" in { 21 | message"test.has.placeholder" must_== "Has Placeholder {0}, {1}." 22 | } 23 | "with arguments, sequentially" in { 24 | message"test.has.placeholder${"arg1"}${"arg2"}" must_== "Has Placeholder arg1, arg2." 25 | } 26 | "with arguments, as varargs" in { 27 | message"test.has.placeholder${Seq("arg1", "arg2"): _*}" must_== "Has Placeholder arg1, arg2." 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /aeromock-freemarker/test/data/data_proxy.yaml: -------------------------------------------------------------------------------- 1 | proxy: 2 | propSimple: propSimpleValue 3 | propList: 4 | - 11111 5 | - 22222 6 | - 33333 7 | propMap: 8 | childSimple: childSimpleValue 9 | childList: 10 | - child11111 11 | - child22222 12 | - child33333 13 | __methods: 14 | - name: execute 15 | value: execute1value 16 | - name: executeHash 17 | value: 18 | id: hashid 19 | value: hashvalue 20 | map: 21 | key1: mapvalue1 22 | key2: mapvalue2 23 | - name: executeProxy 24 | value: 25 | key1: mapvalue1 26 | __methods: 27 | - name: executeChild 28 | value: childvalue 29 | - name: executeChildHash 30 | value: 31 | key1: mapvalue1 32 | key2: mapvalue2 33 | - name: executeChildProxy 34 | value: 35 | key1: mapvalue1 36 | __methods: 37 | - name: executeChildChild 38 | value: childchildValue 39 | 40 | 41 | -------------------------------------------------------------------------------- /aeromock-server/src/main/scala/jp/co/cyberagent/aeromock/server/AccessLog.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.server 2 | 3 | import io.netty.handler.codec.http.{HttpHeaders, HttpRequest} 4 | import org.slf4j.LoggerFactory 5 | 6 | /** 7 | * 8 | * @author stormcat24 9 | */ 10 | object AccessLog { 11 | 12 | val LOG = LoggerFactory.getLogger("access") 13 | 14 | type RequestInfo = (HttpRequest, Long) 15 | val threadLocal = new ThreadLocal[RequestInfo] 16 | 17 | def initialize(request: HttpRequest) { 18 | threadLocal.remove() 19 | threadLocal.set((request, System.currentTimeMillis())) 20 | } 21 | 22 | def writeAccessLog(statusCode: Int) { 23 | val requestInfo = threadLocal.get() 24 | val request = requestInfo._1 25 | val protocol = request.getProtocolVersion().protocolName() 26 | val uri = request.getUri() 27 | val headers = request.headers() 28 | val ua = headers.get(HttpHeaders.Names.USER_AGENT) 29 | val time = (System.currentTimeMillis - requestInfo._2).toDouble / 1000 30 | LOG.info(s"$protocol\t$uri\t$statusCode\t$ua\t$time") 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /aeromock-freemarker/src/main/scala/jp/co/cyberagent/aeromock/template/freemarker/method/AeromockCustomMethod.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.template.freemarker.method 2 | 3 | import jp.co.cyberagent.aeromock.core.http.VariableManager 4 | import jp.co.cyberagent.aeromock.core.script.GroovyDirectiveScriptRunner 5 | import freemarker.template.TemplateMethodModelEx 6 | import groovy.lang.Binding 7 | 8 | /** 9 | * Implementation of [[freemarker.template.TemplateMethodModelEx]] to define function in Groovy. 10 | * @author stormcat24 11 | */ 12 | class AeromockCustomMethod(runner: GroovyDirectiveScriptRunner, scriptName: String) 13 | extends TemplateMethodModelEx { 14 | 15 | /** 16 | * @inheritdoc 17 | */ 18 | override def exec(arguments: java.util.List[_]): AnyRef = { 19 | val binding = new Binding 20 | binding.setVariable("arguments", arguments) 21 | VariableManager.getRequestMap().foreach(entry => binding.setVariable(entry._1, entry._2)) 22 | binding.setVariable("_data", VariableManager.getDataMap()) 23 | 24 | runner.run[AnyRef](scriptName, binding) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /aeromock-velocity/src/main/scala/jp/co/cyberagent/aeromock/template/velocity/VelocityConfigDef.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.template.velocity 2 | 3 | import jp.co.cyberagent.aeromock.config.definition.SpecifiedTemplateDef 4 | 5 | import scala.beans.BeanProperty 6 | import scalaz.Scalaz._ 7 | import scalaz._ 8 | 9 | /** 10 | * 11 | * @author stormcat24 12 | */ 13 | class VelocityConfigDef extends SpecifiedTemplateDef[VelocityConfig] { 14 | @BeanProperty var velocity: VelocityConfigDetailDef = null 15 | 16 | override def toValue: ValidationNel[String, Option[VelocityConfig]] = { 17 | 18 | Option(velocity) match { 19 | case None => none[VelocityConfig].successNel[String] 20 | case Some(bean) => { 21 | // TODO validations 22 | val extensionVal = Option(bean.extension) match { 23 | case None => none[String].successNel[String] 24 | case Some(value) => value.some.successNel[String] 25 | } 26 | 27 | for { 28 | extension <- extensionVal 29 | } yield (VelocityConfig(extension).some) 30 | } 31 | } 32 | 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /aeromock-freemarker/test/template/enum.ftl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | <#assign testType = enums["jp.co.cyberagent.aeromock.test.enums.TestType"] /> 5 | <#assign testType2 = enums["jp.co.cyberagent.aeromock.test.enums.TestType2"] /> 6 |
    7 |
  • enums["jp.co.cyberagent.aeromock.test.enums.TestType"].NEKO1.key = ${testType.NEKO1.key}
  • 8 |
  • enums["jp.co.cyberagent.aeromock.test.enums.TestType"].NEKO1.value = ${testType.NEKO1.value}
  • 9 |
  • enums["jp.co.cyberagent.aeromock.test.enums.TestType"].NEKO2.key = ${testType.NEKO2.key}
  • 10 |
  • enums["jp.co.cyberagent.aeromock.test.enums.TestType"].NEKO2.value = ${testType.NEKO2.value}
  • 11 |
  • enums["jp.co.cyberagent.aeromock.test.enums.TestType2"].NUKO1.key = ${testType2.NUKO1.key}
  • 12 |
  • enums["jp.co.cyberagent.aeromock.test.enums.TestType2"].NUKO1.value = ${testType2.NUKO1.value}
  • 13 |
  • enums["jp.co.cyberagent.aeromock.test.enums.TestType2"].NUKO2.key = ${testType2.NUKO2.key}
  • 14 |
  • enums["jp.co.cyberagent.aeromock.test.enums.TestType2"].NUKO2.value = ${testType2.NUKO2.value}
  • 15 |
16 | 17 | 18 | -------------------------------------------------------------------------------- /aeromock-cli/src/test/scala/jp/co/cyberagent/aeromock/cli/CliJobSelectorSpec.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.cli 2 | 3 | import java.nio.file.Path 4 | 5 | import jp.co.cyberagent.aeromock.AeromockTestModule 6 | import jp.co.cyberagent.aeromock.cli.job.ValidationJob 7 | import jp.co.cyberagent.aeromock.cli.option.CliCommand 8 | import jp.co.cyberagent.aeromock.config.definition.ProjectDef 9 | import jp.co.cyberagent.aeromock.test.SpecSupport 10 | import org.specs2.mutable.{Tables, Specification} 11 | 12 | /** 13 | * 14 | * @author stormcat24 15 | */ 16 | class CliJobSelectorSpec extends Specification with Tables with SpecSupport { 17 | 18 | "select" in { 19 | implicit val module = new AeromockTestModule { 20 | override val projectConfigPath: Path = getResourcePath(".").resolve("test/project.yaml").toRealPath() 21 | override val projectDefArround = (projectDef: ProjectDef) => {} 22 | } ++ new AeromockCliModule 23 | 24 | val command = CliCommand(Array("test")) 25 | 26 | val selector = inject[CliJobSelector] 27 | selector.select(command).getClass must_== classOf[ValidationJob] 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /aeromock-server/src/main/scala/jp/co/cyberagent/aeromock/AeromockTestModule.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock 2 | 3 | import java.nio.file.Path 4 | 5 | import jp.co.cyberagent.aeromock.config.definition.ProjectDef 6 | import jp.co.cyberagent.aeromock.config.{UserConfig, Project, ServerOption} 7 | import jp.co.cyberagent.aeromock.data.YamlDataFileReader 8 | import jp.co.cyberagent.aeromock.helper._ 9 | 10 | /** 11 | * 12 | * @author stormcat24 13 | */ 14 | trait AeromockTestModule extends AeromockModule { 15 | 16 | override val serverOption = new ServerOption(None, None) 17 | 18 | val projectDefArround: ProjectDef => Unit 19 | val projectConfigPath: Path 20 | 21 | override def createUserConfig: UserConfig = UserConfig(projectConfigPath, None) 22 | 23 | override def createProject(): Project = { 24 | 25 | val projectDef = if (projectConfigPath.exists) { 26 | inject[YamlDataFileReader] 27 | .deserialize(projectConfigPath, classOf[ProjectDef]) 28 | } else { 29 | new ProjectDef 30 | } 31 | 32 | projectDefArround(projectDef) 33 | projectDef.toValue(projectConfigPath) 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /aeromock-handlebars-java/src/main/scala/jp/co/cyberagent/aeromock/template/handlebars/helper/DynamicHelperMethod.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.template.handlebars.helper 2 | 3 | import java.nio.file.Path 4 | 5 | import jp.co.cyberagent.aeromock.core.http.VariableManager 6 | import jp.co.cyberagent.aeromock.core.script.GroovyScriptRunner 7 | import com.github.jknack.handlebars.{Helper, Options} 8 | import groovy.lang.Binding 9 | 10 | /** 11 | * Dynamic custom helper class for Handlebars. 12 | * @author stormcat24 13 | */ 14 | class DynamicHelperMethod(script: Path) extends Helper[AnyRef] { 15 | 16 | val runner = new GroovyScriptRunner[CharSequence](script) 17 | 18 | /** 19 | * @inheritdoc 20 | */ 21 | override def apply(argument: AnyRef, options: Options): CharSequence = { 22 | 23 | val binding = new Binding 24 | binding.setVariable("argument", argument) 25 | VariableManager.getRequestMap().foreach(entry => binding.setVariable(entry._1, entry._2)) 26 | binding.setVariable("_data", VariableManager.getDataMap()) 27 | binding.setVariable("options", options) 28 | 29 | runner.run(binding) 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright © CyberAgent, Inc. All Rights Reserved. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /aeromock-server/src/main/scala/jp/co/cyberagent/aeromock/Aeromock.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock 2 | 3 | import java.nio.file.Path 4 | 5 | import jp.co.cyberagent.aeromock.core.bootstrap.BootstrapManager 6 | import jp.co.cyberagent.aeromock.server.AeromockServer 7 | import org.slf4j.LoggerFactory 8 | import scaldi.Injectable 9 | 10 | /** 11 | * launcher of Aeromock 12 | * @author stormcat24 13 | */ 14 | object Aeromock extends App with Injectable { 15 | 16 | println("Welcome to") 17 | println(AeromockInfo.splash) 18 | 19 | implicit val module = new AeromockAppModule(args) 20 | 21 | val LOG = LoggerFactory.getLogger(this.getClass()) 22 | 23 | val configFile = inject[Path] (identified by 'configFile) 24 | val listenPort = inject[Int] (identified by 'listenPort) 25 | 26 | LOG.info(s"configuration file = ${configFile.toAbsolutePath.toString}") 27 | LOG.info(s"listening port = ${listenPort}") 28 | 29 | try { 30 | BootstrapManager.delegate 31 | new AeromockServer(listenPort).run 32 | LOG.info("Aeromock Server Running.") 33 | } catch { 34 | case e: Exception => LOG.error("Failed to start Aeromock Server.", e) 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /aeromock-server/src/main/scala/jp/co/cyberagent/aeromock/server/http/AeromockApiHttpRequestProcessor.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.server.http 2 | 3 | import io.netty.channel.ChannelHandlerContext 4 | import io.netty.handler.codec.http.{FullHttpRequest, HttpResponse, HttpResponseStatus} 5 | import jp.co.cyberagent.aeromock.api.AeromockApi 6 | import jp.co.cyberagent.aeromock.config.Project 7 | import jp.co.cyberagent.aeromock.helper._ 8 | import scaldi.Injector 9 | 10 | class AeromockApiHttpRequestProcessor(implicit inj: Injector) extends HttpRequestProcessor with HttpResponseWriter { 11 | 12 | val project = inject[Project] 13 | 14 | override def process(request: FullHttpRequest)(implicit context: ChannelHandlerContext): HttpResponse = { 15 | 16 | AeromockApi.fetchController(request.parsedRequest) match { 17 | case Some(controller) => controller.render(request.parsedRequest) 18 | case None => renderJson(createNotFound, HttpResponseStatus.NOT_FOUND) 19 | } 20 | } 21 | 22 | private def createNotFound: Map[String, Any] = { 23 | Map( 24 | "status" -> HttpResponseStatus.NOT_FOUND.code(), 25 | "message" -> "endpoint not found.") 26 | } 27 | 28 | 29 | } 30 | -------------------------------------------------------------------------------- /aeromock-report/app/scripts/aeromock-report.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | // var lib = require('./components/components'); 3 | (function(scope){ 4 | var polymer = scope.Polymer('aeromock-report', { 5 | /** 6 | * The `noevent` event is not actually fired from here, 7 | * we document it as an example of documenting events. 8 | * 9 | * @event noevent 10 | */ 11 | 12 | /** 13 | * The `notitle` attribute does not yet have a purpose. 14 | * 15 | * @attribute notitle 16 | * @type string 17 | */ 18 | notitle: '', 19 | 20 | /** 21 | * The `aProp` is a property that does something cool. 22 | * 23 | * @property aProp 24 | * @type bool 25 | */ 26 | aProp: false, 27 | 28 | ready: function() { 29 | }, 30 | 31 | /** 32 | * The `task` method does no work at this time. 33 | * 34 | * @method task 35 | * @return {Object} Returns undefined. 36 | * @param {String} dummy Serves no purpose today. 37 | */ 38 | task: function(dummy) { 39 | return dummy; 40 | } 41 | 42 | }); 43 | 44 | return polymer; 45 | })(window); 46 | -------------------------------------------------------------------------------- /aeromock-handlebars-java/test/template/test.hbs: -------------------------------------------------------------------------------- 1 | 2 | {{>common/header}} 3 | 4 | 5 | {{> common/base}} 6 | 7 | {{#block "content"}} 8 | {{/block}} 9 | 10 |

ビルトイン項目確認

11 |
    12 |
  • REQUEST_URI = {{requestUri}}
  • 13 |
  • QUERY_STRING = {{queryString}}
  • 14 |
  • HOST = {{host}}
  • 15 |
  • REMOTE_HOST = {{remoteHost}}
  • 16 |
17 | 18 |

シンプルネスト

19 |
    20 |
  • nest.level1 = {{nest.level1}}
  • 21 |
  • nest.property1 = {{nest.property1}}
  • 22 |
  • nest.child.level2 = {{nest.child.level2}}
  • 23 |
  • nest.child.property2 = {{nest.child.property2}}
  • 24 |
25 | 26 |

シンプルリスト

27 |
    28 | {{#simpleList}} 29 |
  • {{this}}
  • 30 | {{/simpleList}} 31 |
32 | 33 |

ネストリスト

34 |
    35 | {{#nestList}} 36 |
  • {{this}}
  • 37 | {{/nestList}} 38 |
39 | 40 |

プリコンパイルパーツの埋め込み

41 | {{>common/testparts}} 42 | 43 |

ヘルパー

44 |
    45 |
  • lower = {{lower "AAAAA"}}
  • 46 |
  • upper = {{upper "aaaaa"}}
  • 47 |
  • staticUrl(original) =
  • 48 |
49 | 50 | {{>common/footer}} 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /aeromock-server/src/main/scala/jp/co/cyberagent/aeromock/server/http/HttpRequestProcessor.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.server.http 2 | 3 | import io.netty.channel.ChannelHandlerContext 4 | import io.netty.handler.codec.http.{FullHttpRequest, HttpResponse} 5 | import org.slf4j.LoggerFactory 6 | import scaldi.Injectable 7 | 8 | /** 9 | * Base class of request processing. 10 | * @author stormcat24 11 | */ 12 | trait HttpRequestProcessor extends AnyRef with Injectable { 13 | 14 | val LOG = LoggerFactory.getLogger(this.getClass) 15 | 16 | /** 17 | * 18 | * @param request [[io.netty.handler.codec.http.FullHttpRequest]] 19 | * @param context [[io.netty.channel.ChannelHandlerContext]] 20 | * @return [[io.netty.handler.codec.http.HttpResponse]] 21 | */ 22 | def delegate(request: FullHttpRequest)(implicit context: ChannelHandlerContext): HttpResponse = process(request) 23 | 24 | /** 25 | * 26 | * @param request [[io.netty.handler.codec.http.FullHttpRequest]] 27 | * @param context [[io.netty.channel.ChannelHandlerContext]] 28 | * @return [[io.netty.handler.codec.http.HttpResponse]] 29 | */ 30 | def process(request: FullHttpRequest)(implicit context: ChannelHandlerContext): HttpResponse 31 | 32 | } 33 | -------------------------------------------------------------------------------- /aeromock-thymeleaf/src/main/scala/jp/co/cyberagent/aeromock/template/thymeleaf/DynamicUtilityObject.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.template.thymeleaf 2 | 3 | import java.nio.file.Path 4 | import java.util 5 | 6 | import jp.co.cyberagent.aeromock.core.script.GroovyScriptRunner 7 | import jp.co.cyberagent.aeromock.helper._ 8 | import groovy.lang.Binding 9 | import org.thymeleaf.context.IProcessingContext 10 | import org.thymeleaf.dialect.{AbstractDialect, IExpressionEnhancingDialect} 11 | 12 | import scala.collection.JavaConverters._ 13 | 14 | /** 15 | * Dialect to create utility object dynamically. 16 | * @author stormcat24 17 | */ 18 | class DynamicUtilityObject(scriptDir: Path) extends AbstractDialect with IExpressionEnhancingDialect { 19 | 20 | val helpers = scriptDir.getChildren().filter(_.toString().endsWith(".groovy")).map(script => { 21 | val runner = new GroovyScriptRunner[AnyRef](script) 22 | val binding = new Binding() 23 | (script.getFileName.toString.replace(".groovy", ""), runner.run(binding)) 24 | }).toMap 25 | 26 | override def getPrefix: String = "helper" 27 | 28 | override def getAdditionalExpressionObjects(processingContext: IProcessingContext): util.Map[String, AnyRef] = helpers.asJava 29 | } 30 | -------------------------------------------------------------------------------- /aeromock-server/src/main/scala/jp/co/cyberagent/aeromock/AeromockInfo.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock 2 | 3 | import jp.co.cyberagent.aeromock.helper._ 4 | import org.joda.time.DateTime 5 | 6 | /** 7 | * 8 | * @author stormcat24 9 | */ 10 | object AeromockInfo { 11 | 12 | val version = "0.2.5" 13 | 14 | val currentYear = DateTime.now().getYear() 15 | 16 | val defaultListenPort = 3183 17 | 18 | val splash = s""" 19 | *************************************************************************** 20 | ${blue(""" 21 | ___ __ 22 | / | ___ _________ ____ ___ ____ _____/ /__ 23 | / /| |/ _ \/ ___/ __ \/ __ `__ \/ __ \/ ___/ //_/ 24 | / ___ / __/ / / /_/ / / / / / / /_/ / /__/ ,< 25 | /_/ |_\___/_/ \____/_/ /_/ /_/\____/\___/_/|_| 26 | """)} 27 | 28 | Aeromock Version ${lightBlue(AeromockInfo.version)} 29 | Copyright 2013-${currentYear} ${green("CyberAgent, Inc.")} All Rights Reserved. 30 | 31 | "Aeromock" is a mock http server for frontend engineer. 32 | You can get http response if only you write template and data file. 33 | *************************************************************************** 34 | """ 35 | 36 | } 37 | -------------------------------------------------------------------------------- /aeromock-server/src/main/scala/jp/co/cyberagent/aeromock/server/AeromockServerInitializer.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.server 2 | 3 | import io.netty.channel.ChannelInitializer 4 | import io.netty.channel.socket.SocketChannel 5 | import io.netty.handler.codec.http.HttpObjectAggregator 6 | import io.netty.handler.codec.http.HttpRequestDecoder 7 | import io.netty.handler.codec.http.HttpResponseEncoder 8 | import io.netty.handler.codec.protobuf.ProtobufEncoder 9 | import io.netty.handler.stream.ChunkedWriteHandler 10 | import scaldi.Injector 11 | 12 | class AeromockServerInitializer(implicit inj: Injector) extends ChannelInitializer[SocketChannel] { 13 | 14 | override def initChannel(channel: SocketChannel) { 15 | channel.pipeline() 16 | .addLast(classOf[HttpRequestDecoder].getName, new HttpRequestDecoder) 17 | .addLast(classOf[HttpObjectAggregator].getName, new HttpObjectAggregator(65536)) 18 | .addLast(classOf[HttpResponseEncoder].getName, new HttpResponseEncoder) 19 | .addLast(classOf[ProtobufEncoder].getName, new ProtobufEncoder) 20 | .addLast(classOf[ChunkedWriteHandler].getName, new ChunkedWriteHandler) 21 | .addLast(classOf[AeromockServerHandler].getName, new AeromockServerHandler(true)) 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /aeromock-server/src/main/scala/jp/co/cyberagent/aeromock/data/JsonDataFileReader.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.data 2 | 3 | import java.nio.file.Path 4 | 5 | import jp.co.cyberagent.aeromock.util.ResourceUtil 6 | import jp.co.cyberagent.aeromock.{AeromockInvalidDataFileException, AeromockResourceNotFoundException} 7 | import org.json4s.JsonAST.JValue 8 | import org.json4s.native.JsonMethods.parse 9 | import org.json4s.{JArray, JObject, string2JsonInput} 10 | 11 | class JsonDataFileReader extends DataFileReader { 12 | 13 | def readFile[T >: Iterable[_]](file: Path, charset: String = "UTF-8"): T = { 14 | ResourceUtil.readFile(file, charset) match { 15 | case None => throw new AeromockResourceNotFoundException(file.toString) 16 | case Some(json) => convertJValue(parse(json), file) 17 | } 18 | } 19 | 20 | private def convertJValue(jValue: JValue, path: Path): Iterable[_] = { 21 | jValue match { 22 | case o: JObject => o.values 23 | case a: JArray => a.arr.map(convertJValue(_, path)) 24 | case _ => throw new AeromockInvalidDataFileException(path) 25 | } 26 | } 27 | 28 | override def deserialize[T](file: Path, `class`: Class[T], charset: String = "UTF-8"): T = { 29 | 30 | null.asInstanceOf[T] 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /aeromock-server/src/main/scala/jp/co/cyberagent/aeromock/core/http/Rest.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.core.http 2 | 3 | import io.netty.handler.codec.http.HttpMethod 4 | import org.apache.commons.lang3.StringUtils 5 | 6 | case class Endpoint(raw: String) { 7 | 8 | def value: String = raw.replace("\\", "/") 9 | 10 | def last: String = value.split("/").last 11 | 12 | } 13 | 14 | 15 | class ParsedRequest( 16 | val url: String, 17 | val queryParameters: Map[String, String], 18 | val postData: Map[String, Any], 19 | val method: HttpMethod = HttpMethod.GET 20 | ) 21 | 22 | object ParsedRequest { 23 | 24 | def apply(url: String, queryParameters: Map[String, String], 25 | postData: Map[String, Any], method: HttpMethod = HttpMethod.GET): ParsedRequest = { 26 | require(url != null) 27 | 28 | val s = url.trim 29 | val formatted = if (StringUtils.isEmpty(s) || s == "/") { 30 | "/index" 31 | } else if (s.endsWith("/")) { 32 | s"${s}index" 33 | } else { 34 | s 35 | } 36 | 37 | new ParsedRequest(formatted, queryParameters, postData, method) 38 | } 39 | 40 | def unapply(request: ParsedRequest) = { 41 | Some((request.url, request.queryParameters, request.postData, request.method)) 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /aeromock-server/src/test/scala/jp/co/cyberagent/aeromock/helper/SystemHelperSpec.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.helper 2 | 3 | import jp.co.cyberagent.aeromock.test.SpecSupport 4 | import org.specs2.mutable.{Tables, Specification} 5 | 6 | /** 7 | * 8 | * @author stormcat24 9 | */ 10 | class SystemHelperSpec extends Specification with Tables with SpecSupport { 11 | 12 | "SystemHelper" should { 13 | 14 | System.setProperty("INT_PROP_1", "111") 15 | System.setProperty("INT_PROP_2", "hoge") 16 | System.setProperty("STRING_PROP_1", "hoge") 17 | System.setProperty("STRING_PROP_2", "") 18 | 19 | "property#int" in { 20 | "key" | "expect" | 21 | "INT_PROP_1" ! beSome(beRight(111)) | 22 | "INT_PROP_2" ! beSome(beLeft[Throwable]) | 23 | "INT_PROP_NONE" ! beNone |> { (key, expect) => 24 | SystemHelper.property(key.intStrategy) must expect 25 | } 26 | } 27 | 28 | "property#string" in { 29 | "key" | "expect" | 30 | "STRING_PROP_1" ! beSome("hoge") | 31 | "STRING_PROP_NONE" ! beNone |> { (key, expect) => 32 | SystemHelper.property(key) must expect 33 | } 34 | } 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /aeromock-server/src/main/scala/jp/co/cyberagent/aeromock/protobuf/ProtoFieldLabel.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.protobuf 2 | 3 | import com.squareup.protoparser.MessageType 4 | import jp.co.cyberagent.aeromock.AeromockSystemException 5 | import scalaz._ 6 | import Scalaz._ 7 | 8 | /** 9 | * 10 | * @author stormcat24 11 | */ 12 | sealed trait ProtoFieldLabel { 13 | val name: String 14 | 15 | override def toString(): String = name 16 | } 17 | 18 | object ProtoFieldLabel { 19 | 20 | case object REQUIRED extends ProtoFieldLabel { 21 | override val name = "required" 22 | } 23 | 24 | case object OPTIONAL extends ProtoFieldLabel { 25 | override val name = "optional" 26 | } 27 | 28 | case object REPEATED extends ProtoFieldLabel { 29 | override val name = "repeated" 30 | } 31 | 32 | val map = Map( 33 | MessageType.Label.REQUIRED -> REQUIRED, 34 | MessageType.Label.OPTIONAL -> OPTIONAL, 35 | MessageType.Label.REPEATED -> REPEATED 36 | ) 37 | 38 | def valueOf(label: MessageType.Label): ValidationNel[String, ProtoFieldLabel] = { 39 | map.get(label) match { 40 | case Some(v) => v.successNel[String] 41 | case _ => { 42 | s"label '${label.toString}' is not supported.".failureNel[ProtoFieldLabel] 43 | } 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /aeromock-freemarker/test/template/method.ftl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
    5 |
  • obj.execute1() = ${obj1.execute1()}
  • 6 |
  • obj.execute2() = ${obj1.execute2()}
  • 7 |
  • obj.execute3() = ${obj1.execute3()}
  • 8 |
  • obj.execute4() = ${obj1.execute4()}
  • 9 |
  • obj.execute5() = ${obj1.execute5(1111)}
  • 10 |
  • obj.execute6() = ${obj1.execute6("arg1", "arg2", "arg3")}
  • 11 | <#assign execute7Result = obj1.execute7() > 12 |
  • obj.execute7().key = ${execute7Result.key}
  • 13 |
  • obj.execute7().value = ${execute7Result.value}
  • 14 | <#assign execute8Result = obj1.execute8() > 15 |
  • obj.execute8().key = ${execute8Result.key}
  • 16 |
  • obj.execute8().value.property = ${execute8Result.value.property}
  • 17 |
  • obj.execute8().value.execute81() = ${execute8Result.value.execute81()}
  • 18 |
  • obj.execute8().value.execute82() = ${execute8Result.value.execute82()}
  • 19 |
  • obj.execute8().value.execute83() = ${execute8Result.value.execute83()}
  • 20 |
  • obj.execute8().value.execute84() = ${execute8Result.value.execute84()}
  • 21 |
  • obj.execute8().value.execute85() = ${execute8Result.value.execute85()}
  • 22 |
  • obj.execute8().value.execute86() = ${execute8Result.value.execute86("arg81", "arg82", "arg83")}
  • 23 |
24 | 25 | 26 | -------------------------------------------------------------------------------- /aeromock-thymeleaf/test/template/test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |

Aeromock Builtin Variables

7 |
    8 |
  • REQUEST_URI = dummy
  • 9 |
  • QUERY_STRING = dummy
  • 10 |
  • HOST = dummy
  • 11 |
  • REMOTE_HOST = dummy
  • 12 |
13 | 14 |

Simple Nest

15 |
    16 |
  • nest.level1 = dummy
  • 17 |
  • nest.property1 = dummy
  • 18 |
  • nest.child.level2 = dummy
  • 19 |
  • nest.child.property2 = dummy
  • 20 |
21 | 22 |

Mock Functions

23 |
    24 |
  • hoge
  • 25 |
  • hoge
  • 26 |
27 | 28 |

Simple List

29 |
    30 |
  • 31 |
32 | 33 |

Nest List

34 |
    35 |
  • dummy
  • 36 |
37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /aeromock-freemarker/test/data/method.yaml: -------------------------------------------------------------------------------- 1 | obj1: 2 | property1: ${HOST} 3 | __methods: 4 | - name: execute1 5 | value: plainvalue 6 | - name: execute2 7 | value: ${REQUEST_URI} 8 | - name: execute3 9 | value: ${REQUEST_URI}_${REQUEST_URI} 10 | - name: execute4 11 | value: ${"part1:part2:part3".split(":")[0]} 12 | - name: execute5 13 | value: PARAM1.key1 = ${PARAM1.key1}, PARAM1.key2 = ${PARAM1.key2} 14 | - name: execute6 15 | value: ${ARGUMENTS[0]}_${ARGUMENTS[1]}_${ARGUMENTS[2]} 16 | - name: execute7 17 | value: 18 | key: execute7_key 19 | value: execute7_value 20 | - name: execute8 21 | value: 22 | key: execute8_key 23 | value: 24 | property: execute8_value_property 25 | __methods: 26 | - name: execute81 27 | value: plainvalue 28 | - name: execute82 29 | value: ${REQUEST_URI} 30 | - name: execute83 31 | value: ${REQUEST_URI}_${REQUEST_URI} 32 | - name: execute84 33 | value: ${"part1:part2:part3".split(":")[0]} 34 | - name: execute85 35 | value: PARAM1.key1 = ${PARAM1.key1}, PARAM1.key2 = ${PARAM1.key2} 36 | - name: execute86 37 | value: ${ARGUMENTS[0]}_${ARGUMENTS[1]}_${ARGUMENTS[2]} 38 | -------------------------------------------------------------------------------- /aeromock-groovy-template/src/main/scala/jp/co/cyberagent/aeromock/template/groovytemplate/GroovyTemplateConfigDef.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.template.groovytemplate 2 | 3 | import jp.co.cyberagent.aeromock.config.definition.SpecifiedTemplateDef 4 | 5 | import scala.beans.BeanProperty 6 | import scalaz.Scalaz._ 7 | import scalaz._ 8 | 9 | /** 10 | * 11 | * @author stormcat24 12 | */ 13 | class GroovyTemplateConfigDef extends SpecifiedTemplateDef[GroovyTemplateConfig] { 14 | @BeanProperty var groovyTemplate: GroovyTemplateDefailDef = null 15 | 16 | override def toValue: ValidationNel[String, Option[GroovyTemplateConfig]] = { 17 | 18 | Option(groovyTemplate) match { 19 | case None => none[GroovyTemplateConfig].successNel[String] 20 | case Some(bean) => { 21 | 22 | // TODO validations 23 | val extensionVal = Option(bean.extension) match { 24 | case None => none[String].successNel[String] 25 | case Some(value) => value.some.successNel[String] 26 | } 27 | 28 | val modeVal = Option(bean.mode) match { 29 | case None => none[String].successNel[String] 30 | case Some(value) => value.some.successNel[String] 31 | } 32 | 33 | (extensionVal |@| modeVal) { 34 | GroovyTemplateConfig(_, _).some 35 | } 36 | } 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /aeromock-server/src/main/scala/jp/co/cyberagent/aeromock/server/AeromockServer.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.server 2 | 3 | import org.slf4j.LoggerFactory 4 | 5 | import io.netty.bootstrap.ServerBootstrap 6 | import io.netty.channel.nio.NioEventLoopGroup 7 | import io.netty.channel.socket.nio.NioServerSocketChannel 8 | import scaldi.Injector 9 | 10 | /** 11 | * Aeromock Server Daemon 12 | * @param port listeing port 13 | * @author stormcat24 14 | */ 15 | class AeromockServer(val port: Int)(implicit inj: Injector) { 16 | 17 | val LOG = LoggerFactory.getLogger(classOf[AeromockServer]) 18 | LOG.info("Aeromock server listening on port {}", port) 19 | 20 | def run() { 21 | process(new NioEventLoopGroup, new NioEventLoopGroup) { 22 | (root, worker) => 23 | val bootstrap = new ServerBootstrap 24 | bootstrap.group(root, worker) 25 | .channel(classOf[NioServerSocketChannel]) 26 | .childHandler(new AeromockServerInitializer) 27 | .bind(port).sync().channel().closeFuture().sync() 28 | } 29 | } 30 | 31 | private def process(root: NioEventLoopGroup, worker: NioEventLoopGroup)(func: (NioEventLoopGroup, NioEventLoopGroup) => Unit) { 32 | try { 33 | func(root, worker) 34 | } finally { 35 | root.shutdownGracefully() 36 | worker.shutdownGracefully() 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /aeromock-server/src/main/scala/jp/co/cyberagent/aeromock/core/script/GroovyDirectiveScriptRunner.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.core.script 2 | 3 | import java.nio.file.Path 4 | 5 | import groovy.lang.Binding 6 | import groovy.util.GroovyScriptEngine 7 | import jp.co.cyberagent.aeromock.helper.trye 8 | import jp.co.cyberagent.aeromock.{AeromockScriptBadReturnTypeException, AeromockScriptExecutionException} 9 | 10 | import scala.reflect.ClassTag 11 | 12 | /** 13 | * Directory based roovy script runner. 14 | * @author stormcat24 15 | */ 16 | class GroovyDirectiveScriptRunner(directory: Path) { 17 | 18 | val engine = new GroovyScriptEngine(directory.toAbsolutePath().toString()) 19 | 20 | def run[ReturnType](scriptName: String, binding: Binding)(implicit classTag: ClassTag[ReturnType]): ReturnType = { 21 | require(scriptName != null) 22 | require(binding != null) 23 | 24 | val returnClass = implicitly[ClassTag[ReturnType]].runtimeClass 25 | 26 | (trye(engine.run(scriptName, binding)) {e => throw new AeromockScriptExecutionException(directory.resolve(scriptName), e)} match { 27 | case Left(e) => throw e 28 | case Right(v) => trye(returnClass.cast(v).asInstanceOf[ReturnType]) { e => 29 | throw new AeromockScriptBadReturnTypeException(returnClass, directory.resolve(scriptName), e) 30 | } 31 | }).right.get 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /aeromock-velocity/src/main/scala/jp/co/cyberagent/aeromock/template/velocity/VelocityConfigurationInitializer.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.template.velocity 2 | 3 | import java.io.FileInputStream 4 | import java.nio.file.Files 5 | import jp.co.cyberagent.aeromock.config.Project 6 | import jp.co.cyberagent.aeromock.util.ResourceUtil 7 | import jp.co.cyberagent.aeromock.helper._ 8 | import org.apache.commons.collections.ExtendedProperties 9 | import org.apache.velocity.app.Velocity 10 | 11 | /** 12 | * Initializer velocity configuration. 13 | * @author stromcat24 14 | */ 15 | object VelocityConfigurationInitializer { 16 | 17 | /** 18 | * do initialization 19 | * @param project [[Project]] 20 | */ 21 | def initialize(project: Project) { 22 | 23 | Velocity.setProperty("velocimacro.library.autoreload", "true") 24 | Velocity.setProperty("file.resource.loader.path", project._template.root.toString()) 25 | 26 | val propertiesPath = project.root / "velocity.properties" 27 | if (Files.exists(propertiesPath)) { 28 | val properties = new ExtendedProperties() 29 | val is = new FileInputStream(propertiesPath.toAbsolutePath.toFile()) 30 | ResourceUtil.processResrouce(is) { is => 31 | properties.load(is) 32 | } 33 | Velocity.setExtendedProperties(properties) 34 | } 35 | Velocity.init() 36 | 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /aeromock-freemarker/src/main/scala/jp/co/cyberagent/aeromock/template/freemarker/directive/AeromockScriptDirective.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.template.freemarker.directive 2 | 3 | import jp.co.cyberagent.aeromock.core.http.VariableManager 4 | import jp.co.cyberagent.aeromock.core.script.GroovyDirectiveScriptRunner 5 | import freemarker.core.Environment 6 | import freemarker.template.{TemplateDirectiveBody, TemplateDirectiveModel, TemplateModel} 7 | import groovy.lang.Binding 8 | 9 | class AeromockScriptDirective( 10 | runner: GroovyDirectiveScriptRunner, 11 | directiveName: String) extends AeromockCustomDirective with TemplateDirectiveModel { 12 | 13 | override def execute(env: Environment, params: java.util.Map[_, _], 14 | loopVars: Array[TemplateModel], body: TemplateDirectiveBody) { 15 | 16 | val binding = new Binding 17 | binding.setVariable("_env", env) 18 | binding.setVariable("_params", params) 19 | binding.setVariable("_loopVars", loopVars) 20 | binding.setVariable("_body", body) 21 | binding.setVariable("_writer", env.getOut()) 22 | 23 | VariableManager.getRequestMap().foreach(entry => binding.setVariable(entry._1, entry._2)) 24 | binding.setVariable("_data", VariableManager.getDataMap()) 25 | 26 | runner.run[Unit](getDirevtiveName() + ".groovy", binding) 27 | } 28 | 29 | override def getDirevtiveName(): String = directiveName 30 | } 31 | -------------------------------------------------------------------------------- /tutorial/handlebars/template/test.hbs: -------------------------------------------------------------------------------- 1 | 2 | {{>common/header}} 3 | 4 | 5 | {{> common/base}} 6 | 7 | {{#block "content"}} 8 | {{/block}} 9 | 10 |

use Aeromock builtin variables

11 |
    12 |
  • REQUEST_URI = {{requestUri}}
  • 13 |
  • QUERY_STRING = {{queryString}}
  • 14 |
  • HOST = {{host}}
  • 15 |
  • REMOTE_HOST = {{remoteHost}}
  • 16 |
17 | 18 |

simple nest

19 |
    20 |
  • nest.level1 = {{nest.level1}}
  • 21 |
  • nest.property1 = {{nest.property1}}
  • 22 |
  • nest.child.level2 = {{nest.child.level2}}
  • 23 |
  • nest.child.property2 = {{nest.child.property2}}
  • 24 |
25 | 26 |

simple list

27 |
    28 | {{#simpleList}} 29 |
  • {{this}}
  • 30 | {{/simpleList}} 31 |
32 | 33 |

nest list

34 |
    35 | {{#nestList}} 36 |
  • {{this}}
  • 37 | {{/nestList}} 38 |
39 | 40 |

common data

41 |
    42 |
  • commonProp = {{commonProp}}
  • 43 |
  • commonHash.prop1 = {{commonHash.prop1}}
  • 44 |
45 | 46 |

precompiled parts

47 | {{>common/testparts}} 48 | 49 |

helper

50 |
    51 |
  • lower = {{lower "AAAAA"}}
  • 52 |
  • upper = {{upper "aaaaa"}}
  • 53 |
  • staticUrl(original) =
  • 54 |
55 | 56 | {{>common/footer}} 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /aeromock-server/src/main/scala/jp/co/cyberagent/aeromock/protobuf/ParsedProto.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.protobuf 2 | 3 | import com.google.protobuf.CodedOutputStream 4 | import jp.co.cyberagent.aeromock.{AeromockProtoDataViolationException, AeromockInvalidDataFileException, AeromockProtoTypeNotFoundException} 5 | 6 | import scalaz._ 7 | import Scalaz._ 8 | 9 | /** 10 | * 11 | * @author stormcat24 12 | */ 13 | case class ParsedProto( 14 | types: Map[String, List[ProtoField]], 15 | dependencyTypes: Map[String, List[ProtoField]] 16 | ) { 17 | 18 | def buildData(targetTypeName: String, data: Map[Any, Any]): Array[Byte] = { 19 | 20 | val result = (types.get(targetTypeName) match { 21 | case None => throw new AeromockProtoTypeNotFoundException(targetTypeName) 22 | case Some(value) => value.map(f => { 23 | f.toValue(data, dependencyTypes) 24 | }) 25 | }).sequenceU match { 26 | case Success(value) => value.flatten 27 | case Failure(errors) => { 28 | val errorLocations = errors.map(e => s"${e}").toList 29 | throw new AeromockProtoDataViolationException(errorLocations.mkString("\n")) 30 | } 31 | } 32 | 33 | val totalSize = result.foldLeft(0)((left, right) => left + right.serializedSize) 34 | val bytes = new Array[Byte](totalSize) 35 | val output = CodedOutputStream.newInstance(bytes) 36 | result.map(_.write(output)) 37 | bytes 38 | } 39 | 40 | 41 | } 42 | -------------------------------------------------------------------------------- /aeromock-server/src/main/scala/jp/co/cyberagent/aeromock/server/http/TemplateHttpRequestProcessor.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.server.http 2 | 3 | import io.netty.channel.ChannelHandlerContext 4 | import io.netty.handler.codec.http.{FullHttpRequest, HttpResponse, HttpResponseStatus} 5 | import jp.co.cyberagent.aeromock.AeromockBadUsingException 6 | import jp.co.cyberagent.aeromock.config.Project 7 | import jp.co.cyberagent.aeromock.template.TemplateService 8 | import scaldi.Injector 9 | 10 | /** 11 | * [[jp.co.cyberagent.aeromock.server.http.HttpRequestProcessor]] for Template Request. 12 | * @author stormcat24 13 | */ 14 | class TemplateHttpRequestProcessor(implicit inj: Injector) extends HttpRequestProcessor with HttpResponseWriter { 15 | 16 | val project = inject[Project] 17 | 18 | override def process(request: FullHttpRequest)(implicit context: ChannelHandlerContext): HttpResponse = { 19 | 20 | val templateService = inject[Option[TemplateService]] 21 | 22 | templateService match { 23 | case None => throw new AeromockBadUsingException("cannot get TemplateService.") 24 | case Some(templateService) => { 25 | templateService.render(request) match { 26 | case RenderResult(content, _, true) => renderYaml(content, HttpResponseStatus.OK) 27 | case RenderResult(content, customResponse, false) => renderHtml(content, HttpResponseStatus.OK, customResponse) 28 | } 29 | } 30 | } 31 | 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /aeromock-server/src/main/scala/jp/co/cyberagent/aeromock/server/http/ServerExceptionHandler.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.server.http 2 | 3 | import io.netty.channel.ChannelHandlerContext 4 | import jp.co.cyberagent.aeromock._ 5 | import jp.co.cyberagent.aeromock.server.AccessLog 6 | import jp.co.cyberagent.aeromock.server.http.error._ 7 | 8 | object ServerExceptionHandler extends HttpResponseWriter { 9 | 10 | def handle(t: Throwable)(implicit context: ChannelHandlerContext) { 11 | if (context.channel().isActive()) { 12 | val errorPage = (t match { 13 | // AeromockNotFoundException 14 | case e: AeromockNotFoundException => NotFoundErrorPage(e) 15 | 16 | // AeromockConfigurationException 17 | case e: AeromockConfigurationException => ConfigurationErrorPage(e) 18 | 19 | // AeromockBadImplementation 20 | case e: AeromockNoneRelatedDataException => NoneRelatedDataErrorPage(e) 21 | case e: AeromockBadImplementation => BadImplementationErrorPage(e) 22 | 23 | // AeromockBadUsingException 24 | case e: AeromockBadUsingException => BadUsingErrorPage(e) 25 | 26 | // AeromockMethodNotAllowedException 27 | case e: AeromockMethodNotAllowedException => MethodNotAllowedErrorPage(e) 28 | 29 | case _ => SystemErrorPage(t) 30 | }) 31 | 32 | AccessLog.writeAccessLog(errorPage.responseStatus.code()) 33 | renderHtml(errorPage.render(), errorPage.responseStatus, None) 34 | } 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /tutorial/thymeleaf/template/test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |

use Aeromock builtin variables

7 |
    8 |
  • REQUEST_URI = dummy
  • 9 |
  • QUERY_STRING = dummy
  • 10 |
  • HOST = dummy
  • 11 |
  • REMOTE_HOST = dummy
  • 12 |
13 | 14 |

simple nest

15 |
    16 |
  • nest.level1 = dummy
  • 17 |
  • nest.property1 = dummy
  • 18 |
  • nest.child.level2 = dummy
  • 19 |
  • nest.child.property2 = dummy
  • 20 |
21 | 22 |

simple list

23 |
    24 |
  • dummy
  • 25 |
26 | 27 |

nest list

28 |
    29 |
  • dummy
  • 30 |
31 | 32 |

common data

33 |
    34 |
  • commonProp = dummy
  • 35 |
  • commonHash.prop1 = dummy
  • 36 |
37 | 38 |

helper

39 |
    40 |
  • hoge
  • 41 |
  • hoge
  • 42 |
43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /aeromock-server/src/main/scala/jp/co/cyberagent/aeromock/util/ResourceUtil.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.util 2 | 3 | import java.io.{InputStream, Writer} 4 | import java.nio.file.{Files, Path} 5 | 6 | import jp.co.cyberagent.aeromock.helper._ 7 | 8 | import scala.io.Source 9 | import scala.language.reflectiveCalls 10 | 11 | object ResourceUtil { 12 | 13 | type Closable = { def close(): Unit } 14 | 15 | def readFile(file: Path, charset: String = "UTF-8"): Option[String] = { 16 | require(file != null) 17 | 18 | readInputStream(Files.newInputStream(file.withHomeDirectory), charset) 19 | } 20 | 21 | def readInputStream(is: InputStream, charset: String = "UTF-8"): Option[String] = { 22 | require(is != null) 23 | Source.fromInputStream(is, charset) match { 24 | case null => None 25 | case resource => Some(processResrouce(resource)(_.mkString)) 26 | } 27 | } 28 | 29 | def read[A](file: Path, charset: String = "UTF-8"): Option[(InputStream => A) => A] = { 30 | require(file != null) 31 | 32 | Files.newInputStream(file.withHomeDirectory) match { 33 | case null => None 34 | case resource => Some(processResrouce[InputStream, A](resource) _ ) 35 | } 36 | } 37 | 38 | def write(writer: Writer, content: String) { 39 | require(writer != null) 40 | require(content != null) 41 | 42 | processResrouce(writer)(_.write(content)) 43 | } 44 | 45 | def processResrouce[A <: Closable, B](resource: A)(f: A => B) = try { 46 | f(resource) 47 | } finally { resource.close } 48 | } 49 | -------------------------------------------------------------------------------- /aeromock-freemarker/test/data/custom_list.yaml: -------------------------------------------------------------------------------- 1 | list: 2 | property1: value1 3 | booleanType: true 4 | __list: 5 | - 11111 6 | - 22222 7 | - 33333 8 | __methods: 9 | - name: execute 10 | value: nekotan 11 | objectList: 12 | neko: nukonuko 13 | __list: 14 | - property1: value1-1 15 | property2: value1-2 16 | __methods: 17 | - name: getNeko 18 | value: neko1 19 | - property1: value2-1 20 | property2: value2-2 21 | __methods: 22 | - name: getNeko 23 | value: neko2 24 | - property1: value3-1 25 | property2: value3-2 26 | __methods: 27 | - name: getNeko 28 | value: neko3 29 | gettingPrizes: 30 | __methods: 31 | - name: exclude 32 | value: 33 | - point: 10 34 | stampCount: 1 35 | neko: 36 | id: 111 37 | name: nuko 38 | - point: 10 39 | stampCount: 1 40 | neko: 41 | id: 222 42 | name: nuko 43 | proxy: 44 | __methods: 45 | - name: pager 46 | value: 47 | __methods: 48 | - name: getCurrentPage 49 | value: 2 50 | - name: getSimpleDataList 51 | value: 52 | __list: 53 | - data1 54 | - data2 55 | - name: getObjectList 56 | value: 57 | name: neko1 58 | __list: 59 | - id: 100 60 | value: 10000 61 | - id: 200 62 | value: 20000 -------------------------------------------------------------------------------- /aeromock-jade4j/src/main/scala/jp/co/cyberagent/aeromock/template/jade4j/Jade4jConfigDef.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.template.jade4j 2 | 3 | import de.neuland.jade4j.Jade4J 4 | import jp.co.cyberagent.aeromock.config.definition.SpecifiedTemplateDef 5 | 6 | import scala.beans.BeanProperty 7 | import scalaz.Scalaz._ 8 | import scalaz._ 9 | 10 | /** 11 | * 12 | * @author stormcat24 13 | */ 14 | class Jade4jConfigDef extends SpecifiedTemplateDef[Jade4jConfig] { 15 | @BeanProperty var jade4j: Jade4jConfigDetailDef = null 16 | 17 | override def toValue: ValidationNel[String, Option[Jade4jConfig]] = { 18 | Option(jade4j) match { 19 | case None => none[Jade4jConfig].successNel[String] 20 | case Some(value) => { 21 | 22 | val extensionVal = Option(value.extension) match { 23 | case None => none[String].successNel[String] 24 | case Some(extension) => extension.some.successNel 25 | } 26 | 27 | val modeVal = Option(value.mode) match { 28 | case None => none[Jade4J.Mode].successNel[String] 29 | case Some(value) => Jade4J.Mode.valueOf(value).some.successNel 30 | } 31 | 32 | val prettyPrintVal = Option(value.prettyPrint) match { 33 | case None => none[Boolean].successNel[String] 34 | case Some(value) => value.parseBoolean.rightMap(_.some).leftMap(e => s"${e.getMessage} (at 'jade4j.prettyPrint')").toValidationNel 35 | } 36 | 37 | (extensionVal |@| modeVal |@| prettyPrintVal) {Jade4jConfig(_, _, _).some} 38 | } 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /aeromock-jade4j/src/test/scala/jp/co/cyberagent/aeromock/template/jade4j/Jade4jTemplateServiceSpec.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.template.jade4j 2 | 3 | import java.nio.file.Path 4 | 5 | import jp.co.cyberagent.aeromock.config.definition.ProjectDef 6 | import jp.co.cyberagent.aeromock.core.http.VariableManager 7 | import jp.co.cyberagent.aeromock.helper._ 8 | import jp.co.cyberagent.aeromock.template.TemplateService 9 | import jp.co.cyberagent.aeromock.AeromockTestModule 10 | import jp.co.cyberagent.aeromock.test.SpecSupport 11 | import org.specs2.mutable.{Tables, Specification} 12 | 13 | /** 14 | * 15 | * @author stormcat24 16 | */ 17 | class Jade4jTemplateServiceSpec extends Specification with Tables with SpecSupport { 18 | 19 | "render" should { 20 | "tutorial" in { 21 | implicit val module = new AeromockTestModule { 22 | override val projectConfigPath: Path = getResourcePath(".").resolve("../../../../tutorial/jade4j/project.yaml").toRealPath() 23 | override val projectDefArround = (projectDef: ProjectDef) => {} 24 | } 25 | 26 | val service = inject[Option[TemplateService]].get 27 | VariableManager.initializeRequestMap(Map( 28 | "USER_AGENT" -> "test", 29 | "REQUEST_URI" -> "/test", 30 | "HOST" -> "localhost:3183", 31 | "QUERY_STRING" -> "", 32 | "REMOTE_HOST" -> "localhost" 33 | )) 34 | VariableManager.initializeOriginalVariableMap(new java.util.HashMap[String, AnyRef]()) 35 | 36 | trye(service.render(request("/test"))).isRight 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /aeromock-server/src/test/scala/jp/co/cyberagent/aeromock/core/http/ParsedRequestSpec.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.core.http 2 | 3 | import org.specs2.mutable.{Tables, Specification} 4 | 5 | /** 6 | * 7 | * @author stormcat24 8 | */ 9 | class ParsedRequestSpec extends Specification with Tables { 10 | 11 | "ParsedRequest" should { 12 | 13 | "url is null" in { 14 | ParsedRequest(null, Map.empty, Map.empty) must throwA[IllegalArgumentException] 15 | } 16 | 17 | "apply url" in { 18 | 19 | "url" | "expect" | 20 | "" ! "/index" | 21 | " " ! "/index" | 22 | "/" ! "/index" | 23 | "/path1" ! "/path1" | 24 | "/path1/" ! "/path1/index" | 25 | "/path1/index" ! "/path1/index" | 26 | "/path1/path2" ! "/path1/path2" | 27 | "/path1/path2/" ! "/path1/path2/index" | 28 | "/path1/path2/index" ! "/path1/path2/index" |> { 29 | (url, expect) => ParsedRequest(url, Map.empty, Map.empty).url must_== expect 30 | } 31 | } 32 | 33 | "apply map" in { 34 | 35 | val url = "/test" 36 | val queryParameters = Map("qs1" -> "1", "qs2" -> "2") 37 | val postData = Map("fd1" -> "1", "fd2" -> "2") 38 | 39 | val actual = ParsedRequest(url, queryParameters, postData) 40 | actual.url must_== url 41 | actual.queryParameters must_== Map("qs1" -> "1", "qs2" -> "2") 42 | actual.postData must_== Map("fd1" -> "1", "fd2" -> "2") 43 | } 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /aeromock-velocity/src/test/scala/jp/co/cyberagent/aeromock/template/velocity/VelocityTemplateServiceSpec.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.template.velocity 2 | 3 | import java.nio.file.Path 4 | 5 | import jp.co.cyberagent.aeromock.AeromockTestModule 6 | import jp.co.cyberagent.aeromock.test.SpecSupport 7 | import jp.co.cyberagent.aeromock.config.definition.ProjectDef 8 | import jp.co.cyberagent.aeromock.core.http.VariableManager 9 | import jp.co.cyberagent.aeromock.helper._ 10 | import jp.co.cyberagent.aeromock.template.TemplateService 11 | import org.specs2.mutable.{Tables, Specification} 12 | 13 | /** 14 | * 15 | * @author stormcat24 16 | */ 17 | class VelocityTemplateServiceSpec extends Specification with Tables with SpecSupport { 18 | 19 | "render" should { 20 | "tutorial" in { 21 | implicit val module = new AeromockTestModule { 22 | override val projectConfigPath: Path = getResourcePath(".").resolve("../../../../tutorial/velocity/project.yaml").toRealPath() 23 | override val projectDefArround = (projectDef: ProjectDef) => {} 24 | } 25 | 26 | val service = inject[Option[TemplateService]].get 27 | VariableManager.initializeRequestMap(Map( 28 | "USER_AGENT" -> "test", 29 | "REQUEST_URI" -> "/test", 30 | "HOST" -> "localhost:3183", 31 | "QUERY_STRING" -> "", 32 | "REMOTE_HOST" -> "localhost" 33 | )) 34 | VariableManager.initializeOriginalVariableMap(new java.util.HashMap[String, AnyRef]()) 35 | 36 | trye(service.render(request("/test"))).isRight 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /aeromock-thymeleaf/src/test/scala/jp/co/cyberagent/aeromock/template/thymeleaf/ThymeleafTemplateServiceSpec.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.template.thymeleaf 2 | 3 | import java.nio.file.Path 4 | 5 | import jp.co.cyberagent.aeromock.config.definition.ProjectDef 6 | import jp.co.cyberagent.aeromock.core.http.VariableManager 7 | import jp.co.cyberagent.aeromock.helper._ 8 | import jp.co.cyberagent.aeromock.template.TemplateService 9 | import jp.co.cyberagent.aeromock.AeromockTestModule 10 | import jp.co.cyberagent.aeromock.test.SpecSupport 11 | import org.specs2.mutable.{Tables, Specification} 12 | 13 | /** 14 | * 15 | * @author stormcat24 16 | */ 17 | class ThymeleafTemplateServiceSpec extends Specification with Tables with SpecSupport { 18 | 19 | "render" should { 20 | "tutorial" in { 21 | implicit val module = new AeromockTestModule { 22 | override val projectConfigPath: Path = getResourcePath(".").resolve("../../../../tutorial/thymeleaf/project.yaml").toRealPath() 23 | override val projectDefArround = (projectDef: ProjectDef) => {} 24 | } 25 | 26 | val service = inject[Option[TemplateService]].get 27 | VariableManager.initializeRequestMap(Map( 28 | "USER_AGENT" -> "test", 29 | "REQUEST_URI" -> "/test", 30 | "HOST" -> "localhost:3183", 31 | "QUERY_STRING" -> "", 32 | "REMOTE_HOST" -> "localhost" 33 | )) 34 | VariableManager.initializeOriginalVariableMap(new java.util.HashMap[String, AnyRef]()) 35 | 36 | trye(service.render(request("/test"))).isRight 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /aeromock-freemarker/src/test/scala/jp/co/cyberagent/aeromock/template/freemarker/FreemarkerTemplateServiceSpec.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.template.freemarker 2 | 3 | import java.nio.file.Path 4 | 5 | import jp.co.cyberagent.aeromock.AeromockTestModule 6 | import jp.co.cyberagent.aeromock.config.definition.ProjectDef 7 | import jp.co.cyberagent.aeromock.core.http.VariableManager 8 | import jp.co.cyberagent.aeromock.helper._ 9 | import jp.co.cyberagent.aeromock.template.TemplateService 10 | import jp.co.cyberagent.aeromock.test.SpecSupport 11 | import org.specs2.mutable.{Specification, Tables} 12 | 13 | /** 14 | * 15 | * @author stormcat24 16 | */ 17 | class FreemarkerTemplateServiceSpec extends Specification with Tables with SpecSupport { 18 | 19 | "render" should { 20 | "tutorial" in { 21 | implicit val module = new AeromockTestModule { 22 | override val projectConfigPath: Path = getResourcePath(".").resolve("../../../../tutorial/freemarker/project.yaml").toRealPath() 23 | override val projectDefArround = (projectDef: ProjectDef) => {} 24 | } 25 | 26 | val service = inject[Option[TemplateService]].get 27 | VariableManager.initializeRequestMap(Map( 28 | "USER_AGENT" -> "test", 29 | "REQUEST_URI" -> "/test", 30 | "HOST" -> "localhost:3183", 31 | "QUERY_STRING" -> "", 32 | "REMOTE_HOST" -> "localhost" 33 | )) 34 | VariableManager.initializeOriginalVariableMap(new java.util.HashMap[String, AnyRef]()) 35 | 36 | trye(service.render(request("/test"))).isRight 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /aeromock-handlebars-java/src/test/scala/jp/co/cyberagent/aeromock/template/handlebars/HandlebarsTemplateServiceSpec.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.template.handlebars 2 | 3 | import java.nio.file.Path 4 | 5 | import jp.co.cyberagent.aeromock.config.definition.ProjectDef 6 | import jp.co.cyberagent.aeromock.core.http.VariableManager 7 | import jp.co.cyberagent.aeromock.helper._ 8 | import jp.co.cyberagent.aeromock.template.TemplateService 9 | import jp.co.cyberagent.aeromock.AeromockTestModule 10 | import jp.co.cyberagent.aeromock.test.SpecSupport 11 | import org.specs2.mutable.{Tables, Specification} 12 | 13 | /** 14 | * 15 | * @author stormcat24 16 | */ 17 | class HandlebarsTemplateServiceSpec extends Specification with Tables with SpecSupport { 18 | 19 | "render" should { 20 | "tutorial" in { 21 | implicit val module = new AeromockTestModule { 22 | override val projectConfigPath: Path = getResourcePath(".").resolve("../../../../tutorial/handlebars/project.yaml").toRealPath() 23 | override val projectDefArround = (projectDef: ProjectDef) => {} 24 | } 25 | 26 | val service = inject[Option[TemplateService]].get 27 | VariableManager.initializeRequestMap(Map( 28 | "USER_AGENT" -> "test", 29 | "REQUEST_URI" -> "/test", 30 | "HOST" -> "localhost:3183", 31 | "QUERY_STRING" -> "", 32 | "REMOTE_HOST" -> "localhost" 33 | )) 34 | VariableManager.initializeOriginalVariableMap(new java.util.HashMap[String, AnyRef]()) 35 | 36 | trye(service.render(request("/test"))).isRight 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /aeromock-groovy-template/src/test/scala/jp/co/cyberagent/aeromock/template/groovytemplate/GroovyTemplateServiceSpec.scala: -------------------------------------------------------------------------------- 1 | package jp.co.cyberagent.aeromock.template.groovytemplate 2 | 3 | import java.nio.file.Path 4 | 5 | import jp.co.cyberagent.aeromock.config.definition.ProjectDef 6 | import jp.co.cyberagent.aeromock.core.http.VariableManager 7 | import jp.co.cyberagent.aeromock.helper._ 8 | import jp.co.cyberagent.aeromock.template.TemplateService 9 | import jp.co.cyberagent.aeromock.AeromockTestModule 10 | import jp.co.cyberagent.aeromock.test.SpecSupport 11 | import org.specs2.mutable.{Tables, Specification} 12 | 13 | /** 14 | * 15 | * @author stormcat24 16 | */ 17 | class GroovyTemplateServiceSpec extends Specification with Tables with SpecSupport { 18 | 19 | "render" should { 20 | "tutorial" in { 21 | implicit val module = new AeromockTestModule { 22 | override val projectConfigPath: Path = getResourcePath(".").resolve("../../../../tutorial/groovytemplates/project.yaml").toRealPath() 23 | override val projectDefArround = (projectDef: ProjectDef) => {} 24 | } 25 | 26 | val service = inject[Option[TemplateService]].get 27 | VariableManager.initializeRequestMap(Map( 28 | "USER_AGENT" -> "test", 29 | "REQUEST_URI" -> "/test", 30 | "HOST" -> "localhost:3183", 31 | "QUERY_STRING" -> "", 32 | "REMOTE_HOST" -> "localhost" 33 | )) 34 | VariableManager.initializeOriginalVariableMap(new java.util.HashMap[String, AnyRef]()) 35 | 36 | trye(service.render(request("/test"))).isRight 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /aeromock-report/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "aeromock-report", 3 | "version": "0.0.0", 4 | "dependencies": {}, 5 | "devDependencies": { 6 | "browser-sync": "^1.1.2", 7 | "glob": "^4.0.2", 8 | "gulp": "^3.6.0", 9 | "orchestrator": "0.3.6", 10 | "gulp-autoprefixer": "^0.0.7", 11 | "gulp-browserify": "^0.5.0", 12 | "gulp-bower-files": "^0.2.5", 13 | "gulp-concat": "^2.2.0", 14 | "gulp-cache": "^0.1.1", 15 | "gulp-closure-compiler": "^0.2.1", 16 | "gulp-csso": "^0.2.6", 17 | "gulp-flatten": "^0.0.2", 18 | "gulp-if": "^1.2.1", 19 | "gulp-imagemin": "^0.6.0", 20 | "gulp-filter": "^0.5.0", 21 | "gulp-jshint": "^1.5.3", 22 | "gulp-load-plugins": "^0.5.0", 23 | "gulp-minify-html": "^0.1.3", 24 | "gulp-preprocess": "^1.1.1", 25 | "gulp-rename": "^1.2.0", 26 | "gulp-ruby-sass": "^0.5.0", 27 | "gulp-size": "^0.4.0", 28 | "gulp-strip-debug": "^0.3.0", 29 | "gulp-symlink": "^1.1.0", 30 | "gulp-tap": "^0.1.1", 31 | "gulp-uglify": "^0.3.0", 32 | "gulp-uncss": "^0.4.4", 33 | "gulp-useref": "^0.4.3", 34 | "gulp-vulcanize": "^0.2.0", 35 | "gulp-zopfli": "^0.1.1", 36 | "jshint-stylish": "^0.2.0", 37 | "opn": "^0.1.1", 38 | "path": "^0.4.9", 39 | "psi": "0.0.3", 40 | "rimraf": "^2.2.8", 41 | "run-sequence": "^0.3.6", 42 | "gulp-replace": "^0.3.0" 43 | }, 44 | "engines": { 45 | "node": ">=0.10.0", 46 | "npm": ">=1.3.8" 47 | }, 48 | "scripts": { 49 | "pre-publish": "gulp && mkdir -p ../aeromock-report_dist && cp -r _dist/* ../aeromock-report_dist/" 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /aeromock-freemarker/test/template/data.ftl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |

各データ型

6 |
    7 |
  • propString = ${propString}
  • 8 |
  • propInt = ${propInt}
  • 9 |
  • propBoolean = ${propBoolean?string}
  • 10 |
  • propLong = ${propLong}
  • 11 |
  • propDouble = ${propDouble}
  • 12 |
13 | 14 |

Map(通常参照)

15 |
    16 |
  • map.propSimple = ${map.propSimple}
  • 17 | <#list map.propList as value> 18 |
  • map.propList[${value_index}] = ${value}
  • 19 | 20 |
  • map.propMap.childSimple = ${map.propMap.childSimple}
  • 21 | <#list map.propMap.childList as value> 22 |
  • map.propMap.childList[${value_index}] = ${value}
  • 23 | 24 |
25 | 26 |

Map(Hash参照)

27 |
    28 |
  • map["propSimple"] = ${map["propSimple"]}
  • 29 | <#list map["propList"] as value> 30 |
  • map["propList"][${value_index}] = ${value}
  • 31 | 32 |
  • map["propMap"]["childSimple"] = ${map["propMap"]["childSimple"]}
  • 33 | <#list map["propMap"]["childList"] as value> 34 |
  • map["propMap"]["childList"][${value_index}] = ${value}
  • 35 | 36 |
37 | 38 |

Map(get参照)

39 |
    40 |
  • map.get("propSimple") = ${map.get("propSimple")}
  • 41 | <#list map.get("propList") as value> 42 |
  • map.get("propList")[${value_index}] = ${value}
  • 43 | 44 |
  • map.get("propMap").get("childSimple") = ${map.get("propMap").get("childSimple")}
  • 45 | <#list map.get("propMap").get("childList") as value> 46 |
  • map.get("propMap").get("childList")[${value_index}] = ${value}
  • 47 | 48 |
49 | 50 | -------------------------------------------------------------------------------- /tutorial/static/expect/custom_list.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

__list(中身は数値型)自身をループ

5 |
    6 |
  • 11111
  • 7 |
  • 22222
  • 8 |
  • 33333
  • 9 |
10 | 11 |

java.util.Collectionのメソッド呼び出し

12 |
    13 |
  • list.size() = 3
  • 14 |
15 | 16 |

__methods追加メソッド呼び出し

17 |
    18 |
  • list.execute() = nekotan
  • 19 |
20 | 21 |

プロパティ呼び出し

22 |
    23 |
  • list.getProperty1() = value1
  • 24 |
  • list.property1 = value1
  • 25 |
  • list["property1"] = value1
  • 26 |
  • list.booleanType = true
  • 27 |
28 | 29 |

__list(中身はオブジェクト)自身をループ

30 |
    31 |
  • objectList.neko = nukonuko
  • 32 |
  • property1 = value1-1, property2 = value1-2
  • 33 |
  • getNeko() = neko1
  • 34 |
  • property1 = value2-1, property2 = value2-2
  • 35 |
  • getNeko() = neko2
  • 36 |
  • property1 = value3-1, property2 = value3-2
  • 37 |
  • getNeko() = neko3
  • 38 |
39 | 40 | 10, 1, 111
41 | 10, 1, 222
42 | 43 |

proxyが返す__list

44 |
    45 |
  • proxy.pager().getCurrentPage() = 2
  • 46 |
  • proxy.pager().getSimpleDataList()[0] = data1
  • 47 |
  • proxy.pager().getSimpleDataList()[1] = data2
  • 48 |
  • proxy.pager().getObjectList().name = neko1
  • 49 |
  • proxy.pager().getObjectList()[0].id = 100
  • 50 |
  • proxy.pager().getObjectList()[0].value = 10000
  • 51 |
  • proxy.pager().getObjectList()[1].id = 200
  • 52 |
  • proxy.pager().getObjectList()[1].value = 20000
  • 53 |
54 | 55 | -------------------------------------------------------------------------------- /aeromock-freemarker/test/static/expect/custom_list.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

__list(中身は数値型)自身をループ

5 |
    6 |
  • 11111
  • 7 |
  • 22222
  • 8 |
  • 33333
  • 9 |
10 | 11 |

java.util.Collectionのメソッド呼び出し

12 |
    13 |
  • list.size() = 3
  • 14 |
15 | 16 |

__methods追加メソッド呼び出し

17 |
    18 |
  • list.execute() = nekotan
  • 19 |
20 | 21 |

プロパティ呼び出し

22 |
    23 |
  • list.getProperty1() = value1
  • 24 |
  • list.property1 = value1
  • 25 |
  • list["property1"] = value1
  • 26 |
  • list.booleanType = true
  • 27 |
28 | 29 |

__list(中身はオブジェクト)自身をループ

30 |
    31 |
  • objectList.neko = nukonuko
  • 32 |
  • property1 = value1-1, property2 = value1-2
  • 33 |
  • getNeko() = neko1
  • 34 |
  • property1 = value2-1, property2 = value2-2
  • 35 |
  • getNeko() = neko2
  • 36 |
  • property1 = value3-1, property2 = value3-2
  • 37 |
  • getNeko() = neko3
  • 38 |
39 | 40 | 10, 1, 111
41 | 10, 1, 222
42 | 43 |

proxyが返す__list

44 |
    45 |
  • proxy.pager().getCurrentPage() = 2
  • 46 |
  • proxy.pager().getSimpleDataList()[0] = data1
  • 47 |
  • proxy.pager().getSimpleDataList()[1] = data2
  • 48 |
  • proxy.pager().getObjectList().name = neko1
  • 49 |
  • proxy.pager().getObjectList()[0].id = 100
  • 50 |
  • proxy.pager().getObjectList()[0].value = 10000
  • 51 |
  • proxy.pager().getObjectList()[1].id = 200
  • 52 |
  • proxy.pager().getObjectList()[1].value = 20000
  • 53 |
54 | 55 | --------------------------------------------------------------------------------