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
5k
KubernetesのマニフェストをそれなりにCIしたい
stormcat24
4
1.4k
令和時代のSaaS開発
stormcat24
1
290
History in 5 years of CircleCI and CyberAgent
stormcat24
3
860
Kubernetes Handson Osaka
stormcat24
5
590
Kubernetes Handson
stormcat24
5
4.3k
DockerとKubernetesでアプリケーション開発にコンテナをフル活用!
stormcat24
0
340
Base Image Journey 2018
stormcat24
29
140k
kotlin-fest
stormcat24
13
18k
Other Decks in Programming
See All in Programming
TDD 実践ミニトーク
contour_gara
0
150
Flutterと Vibe Coding で個人開発!
hyshu
1
270
AHC051解法紹介
eijirou
0
620
[FEConf 2025] 모노레포 절망편, 14개 레포로 부활하기까지 걸린 1년
mmmaxkim
0
1.1k
The state patternの実践 個人開発で培ったpractice集
miyanokomiya
0
150
RDoc meets YARD
okuramasafumi
2
130
WebAssemblyインタプリタを書く ~Component Modelを添えて~
ruccho
1
920
オープンセミナー2025@広島LT技術ブログを続けるには
satoshi256kbyte
0
130
Laravel Boost 超入門
fire_arlo
1
130
TROCCO×dbtで実現する人にもAIにもやさしいデータ基盤
nealle
0
330
【第4回】関東Kaggler会「Kaggleは執筆に役立つ」
mipypf
0
850
Portapad紹介プレゼンテーション
gotoumakakeru
1
130
Featured
See All Featured
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
ReactJS: Keep Simple. Everything can be a component!
pedronauck
667
120k
RailsConf 2023
tenderlove
30
1.2k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
358
30k
Designing for Performance
lara
610
69k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
Music & Morning Musume
bryan
46
6.7k
KATA
mclloyd
32
14k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
53k
Practical Orchestrator
shlominoach
190
11k
Producing Creativity
orderedlist
PRO
347
40k
Thoughts on Productivity
jonyablonski
69
4.8k
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ѱ͘ͳ͍ɻʢΫιʣϓϩδΣΫτ͕ѱ͍ ‣ ϑϩϯτΤϯδχΞʹจ۟ݴΘΕͳ͍ͨΊͷࢪࡦ͕ ඞཁ
ステッカー置いてきますね