Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Aeromockが渋谷Javaにやってキタ━(゚∀゚)━!(Aeromockを支える技術)
Search
stormcat24
December 12, 2014
Programming
1
1k
Aeromockが渋谷Javaにやってキタ━(゚∀゚)━!(Aeromockを支える技術)
Shibuya Java #9
stormcat24
December 12, 2014
Tweet
Share
More Decks by stormcat24
See All by stormcat24
素早く賢く失敗するDeveloper Productivityの実現を目指して
stormcat24
4
4.6k
KubernetesのマニフェストをそれなりにCIしたい
stormcat24
4
1.2k
令和時代のSaaS開発
stormcat24
1
240
History in 5 years of CircleCI and CyberAgent
stormcat24
3
810
Kubernetes Handson Osaka
stormcat24
5
540
Kubernetes Handson
stormcat24
5
4.2k
DockerとKubernetesでアプリケーション開発にコンテナをフル活用!
stormcat24
0
290
Base Image Journey 2018
stormcat24
29
130k
kotlin-fest
stormcat24
13
17k
Other Decks in Programming
See All in Programming
C++でシェーダを書く
fadis
6
4.1k
Laravel や Symfony で手っ取り早く OpenAPI のドキュメントを作成する
azuki
2
120
『ドメイン駆動設計をはじめよう』のモデリングアプローチ
masuda220
PRO
8
540
距離関数を極める! / SESSIONS 2024
gam0022
0
280
Nurturing OpenJDK distribution: Eclipse Temurin Success History and plan
ivargrimstad
0
900
Jakarta EE meets AI
ivargrimstad
0
150
「今のプロジェクトいろいろ大変なんですよ、app/services とかもあって……」/After Kaigi on Rails 2024 LT Night
junk0612
5
2.1k
ヤプリ新卒SREの オンボーディング
masaki12
0
130
よくできたテンプレート言語として TypeScript + JSX を利用する試み / Using TypeScript + JSX outside of Web Frontend #TSKaigiKansai
izumin5210
6
1.7k
Arm移行タイムアタック
qnighy
0
320
TypeScriptでライブラリとの依存を限定的にする方法
tutinoko
2
670
Hotwire or React? ~アフタートーク・本編に含めなかった話~ / Hotwire or React? after talk
harunatsujita
1
120
Featured
See All Featured
Making Projects Easy
brettharned
115
5.9k
Agile that works and the tools we love
rasmusluckow
327
21k
[RailsConf 2023] Rails as a piece of cake
palkan
52
4.9k
Git: the NoSQL Database
bkeepers
PRO
427
64k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
Unsuck your backbone
ammeep
668
57k
We Have a Design System, Now What?
morganepeng
50
7.2k
Building a Scalable Design System with Sketch
lauravandoore
459
33k
Happy Clients
brianwarren
98
6.7k
Measuring & Analyzing Core Web Vitals
bluesmoon
4
120
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
Become a Pro
speakerdeck
PRO
25
5k
Transcript
Aeromock͕ौ୩Javaʹ ͬͯŝŦᴸᴸ ƅ㱼ƅ)ᴸᴸ!! (AeromockΛࢧ͑Δٕज़ʣ Akinori Yamada (@stormcat24) 2014/12/13 Shibuya Java
#9
who? ‣ @stormcat24 ‣ CyberAgent, Inc. ‣ ࡶ༻ܥΖ͙Β·ʔ ‣ Scalaͱ͔ͦͷΜ
‣ ࠷ۙJavaΛݟͭͭ͋͠Δ
Agenda ‣ Aeromock is Կ ‣ AeromockΛࢧ͑Δٕज़ ‣ ࠓޙͷలʹ͍ͭͯ ‣
·ͱΊ
Aeromock is Կ
https://github.com/CyberAgent/aeromock
Aeromock is ‣ ScalaϞοΫαʔό ‣ JVMܥςϯϓϨʔτΤϯδϯͷελϒ ‣ Freemarker/Velocity/Groovy Templates etc
‣ JSON API ‣ Protocol Buffers
動作イメージ Aeromock Client 3FRVFTU )5.- σʔλϑΝΠϧ (JSON / YAML) ςϯϓϨʔτ
ϑΝΠϧ (FTLʣ
目指すところ ‣ ϑϩϯτ͕αʔόαΠυʹґଘͤͣʹ։ൃ ‣ ຊͷҙຯͰͷɺϑϩϯτΤϯυɾαʔόαΠυ ۀͷཱ֬ ‣ ઐྖҬͷ࡞ۀʹྗ ‣ লϦιʔε
‣ ࠶ىಈෆཁͰαΫαΫ։ൃ
Aeromockを支える技術
使ってる技術 ‣ Netty ‣ Javassist ‣ Groovy ‣ Gradle ‣
snakeyaml ‣ javax.el ‣ Scaldi
Netty ‣ http://netty.io/ ‣ Netty4ܥΛར༻ ‣ ͱʹ͔͘ബ͚Εബ͍΄Ͳ͍͍ͱ͍͏ߟ͑ ‣ ϨΠϠʔͷίϯτϩʔϧ͕͍͢͠
Javassist ‣ όΠτίʔυΤϯϋϯα ‣ ςϯϓϨ্Ͱϝιουίʔϧ͕͋ΔʢΫιʣ࣮ͱ͔ ੈؒʹͬͺΓ͋Δ ‣ σʔλϑΝΠϧͰඞཁͳϝιουఆٛΛͯ͠ɺಈత ʹΠϯελϯεʹ࣮ͤ͞Δ
<p>${target.execute()}</p> メソッド呼び出し(遺憾) target: __methods: - name: execute: value: shibuya_java <p>shibuya_java</p>
動的に追加されるメソッド public Object execute(Object[] args) { return “shibuya_java”; }
Groovy ‣ ϧʔςΟϯά੍ޚεΫϦϓτʢrouting.groovyʣͷDSLΛGroovy Ͱ࣮ ‣ ΧελϜλάϑΝϯΫγϣϯͷϞοΫ࣮ʹར༻ ‣ ࠶ىಈͳ͠ͰɺτϥΠΞϯυΤϥʔ͍ͨ͠εΫϦϓςΟϯάʹ ͔ͳΓ༗༻ ‣
ύϑΥʔϚϯεʹҙʢมߋ͕͋ͬͨͱ͖͚ͩύʔε͢Δ࣮ ʹͯ͠Δʣ ‣ groovy.util.GroovyScriptEngineͰ༰қʹΈࠐΊΔ
Gradle ‣ aeromock-brewʢύοέʔδϚωʔδϟʣͰར༻ ‣ https://github.com/CyberAgent/aeromock-brew ‣ gradlewΛ௨ͯ͠ɺMaven Central͔Βҙͷόʔ δϣϯΛΠϯετʔϧͰ͖Δ ‣
GradleͰॻ͚ΫϩεϓϥοτϑΥʔϜΛ͋Μ·Γ ҙࣝ͠ͳͯ͘ࡁΉ
snakeyaml ‣ https://code.google.com/p/snakeyaml/ ‣ JavaͷYAML࣮ ‣ σʔλϑΝΠϧͱͯ͠JSONʹՃ͑ɺYAMLΛ࠾༻ ͍ͯ͠ΔʢίϝϯτΛ༷ͱ͍ͯͨ͢͠͠Ίʣ
javax.el ‣ σʔλϑΝΠϧͷதͰɺมΛՃ͍ͨ͠Α͏ͳͱ ͖ɺELࣜͷൣᙝͰ͖ͳΑ͏ʹͰ͖Δ ‣ EL3.0ʢJSR-341ʣ ‣ org.glassfish:javax.el:3.0.0Λར༻ ‣ javax.el.ELProcessorΛ͑ɺׂͱ؆୯ʹಋೖͰ
͖Δ
form_data: name: ${FORM_DATA[‘name’].trim()} age: ${PARAMETERS[‘age’].trim()} comment: ${PARAMETERS[‘comment’].substring(0, 100)} ELར༻ྫ
protobuf-java ‣ protobufͷJava࣮ ‣ com.google.protobuf:protobuf-java:2.6.1 ‣ protobufͷόΠφϦΛੜ͢ΔͨΊʹར༻
protoparser ‣ https://github.com/square/protoparser ‣ protoϑΝΠϧͷύʔαʔ ‣ protobuf-javaʹύʔαʔແ͔ͬͨʢผ్ protocͰύʔεˠJavaͷίʔυΛੜ͢ΔͨΊʣ ‣ ύʔεͯ͠औಘͨ͠protobufͷߏͱɺσʔλϑΝ
ΠϧΛಥ͖߹ΘͤΔ
Scaldi ‣ http://scaldi.org/ ‣ Scala༻ͷܰྔͳDIϥΠϒϥϦ ‣ ࠷ॳDIແ͠Ͱ࣮͕ͯͨ͠ɺͩΜͩΜਏ͘ͳ͖ͬͯ ͨͷͰಋೖ
今後の展望について
φϏήʔγϣϯπʔϧ ‣ ݱঢ়ɺݟ͍ͨը໘ͷURLΛ͍͍ͪͪϒϥβʹೖྗ ͢Δඞཁ͕͋ΔͷͰλϧ͍ ‣ ԼͷςϯϓϨʔτΛϑΝΠϧπϦʔදࣔͯ͠ɺඈ ΔWeb UIΛ༻ҙ ‣ ࣍ͷϝδϟʔϦϦʔεͰͷೖΛ༧ఆ
Live Loading ‣ ςϯϓϨσʔλϑΝΠϧΛมߋͨ͠߹ɺ͍͍ͪ ͪϦϩʔυ͢Δͷ͕λϧ͍ ‣ grunt-contrib-watchͷAeromock൛Έ͍ͨͳ
テンプレートエンジン ‣ धཁͷߴͦ͏ͳςϯϓϨʔτΤϯδϯʹରԠ͢Δ ‣ ࣍Կ͕͍͍Ͱ͔͢Ͷ|шƅ)ŧŽŕ ‣ ಛఆͷόʔδϣϯʹ͕ͬͭΓґଘͯ͠͠·͍ͬͯΔ ͷͰɺ͏গ͠ϓϥΨϒϧͳߏʹ͍ͨ͠ʢOSGi ͷ࠾༻ͱ͔ʣ
テスト支援 ‣ ςϯϓϨʔτͱσʔλϑΝΠϧͷνΣοΫπʔϧ ‣ Ұಈ͘Α͏ʹ࡞ͬͨσʔλϑΝΠϧ͕ɺ์ஔ͞Ε ͯ؊৺ͳͱ͖ʹಈ͔ͳ͍ͳΜͯ͜ͱ͋Δ ‣ ܧଓతʹ࣭ΛอͯΔΈΛͭ͘Δ ‣ ࣮Ӆ͠ػೳͱͯ͠طʹ͋Δʢ·͍ͩʣ
まとめ
Javaで迷惑かけないようにしよう ‣ αʔόαΠυʹҾ͖ͣΒΕΔͱɺϑϩϯτΤϯδχ ΞͷJavaͷҹ͕ѱ͘ͳΔ ‣ Javaѱ͘ͳ͍ɻʢΫιʣϓϩδΣΫτ͕ѱ͍ ‣ ϑϩϯτΤϯδχΞʹจ۟ݴΘΕͳ͍ͨΊͷࢪࡦ͕ ඞཁ
ステッカー置いてきますね