「Oracle Code One 2018 報告会」に行ってきた。
2018/11/17(土)に行われたOracle Code One 2018 報告会に行ってきました。
メモとか感想とかです。まとまっていません。
メモやTwitterまとめ
togetter
@yamadamnさんがまとめて下さいました。
現時点での公開スライドを一通り反映し、関係ないbotツイートくらい削ったつもりです。「【東京】Oracle Code One 2018 報告会 #oc1jp #jjug」 https://t.co/6spK9Bq5iR
— Takahiro YAMADA (@yamadamn) November 18, 2018
ハッシュタグは「#oc1jp」を使うと追えます。
Code One Overview & Java in Container / いとうちひろさん (@chiroito)
全体の日程や、有志で安全な場所や美味しい店などのマッピングについて共有されていました。
Oracle Code Oneでは初級から上級まで様々なセッションが行われているようです。
メッセージとして、
「Oracle evileと言われているけど、Javaには投資しているんだよ。
Javaは今後もOpen and Free。」
後は、各種Java開発のプロジェクトについての紹介と、David Buckさんの発表の再演とZGCについての紹介でした。初めて伊藤さんの発表を聞いたと思うのですが、聴きやすかったです。
以下の資料、動画は発表に関連しそうな参考として貼っているので、当日発表の資料ではありません。
www.slideshare.net
Vector API from Project Panama / 吉田 真也さん(@bitter_fox)
Vector API from Project Panama https://t.co/v4ZHEH9GHj 発表資料を公開しました #jjug #oc1jp
— shinyafox@bitter_fox (@shinyafox) November 17, 2018
ベクトル演算とか直積とか数年ぶりに見ました。中々興味深かったです。
- SIMD/SISD/MISD/MIMD
- S:Single
- M:Multi
- I:instruction
- D:Data
GraalVMについて / きしだなおきさん (@kis)
Jakarta EE and Microservices / 西川 彰広さん [日本オラクル]
全然メモってなかった・・・
Helidonの話とかあった。
(この辺からメモが雑に・・・)
JDKライセンスモデルの変更(三たび) / 伊藤 敬さん
www.slideshare.net
Twitter4j: Duke's choice Award 2018受賞記念セッション / 山本 ユースケさん (@yusuke)
メモが「過剰包装」のみ・・・
ゆるふわ! Comminity Activities @ OC1 / JJUG幹事
以下、印象に残った話し。
* Technovation Challenge
* 世界規模の女学生向けシステムコンペ
* アプリ開発、ビジネスプラン、ピッチdemoのビデオ
* 日本が2チーム出ていた。
* 2019年に向けて開始している。
* mentor募集中。
これは知らなかったなー。
- women bringing the tech chasm
- アンカンファレンス形式
- 参加者のお悩みを聞く座談会
- 「女性らしさ」についての議論に火が付いて会場を追い出されるまで議論が続く
南米の昭和感は意外だった。日本はマシになった方ですね。
けど、色々まだ足りてないと感じています。
新入社員で女性も入ってくるけど、どうしたら楽しく働けるのか。
産休・育休などの制度はあるし使われている方だと思うけど。(弊社)
その他Oracle Code One関連
@zinbeさんのレポート記事
動画。全てのセッションではないですが、一部は公開されています。
Fn Project関連のセッションもあったので観てみようと探したのですが、ありませんでした。残念。
2018 Oracle Code One - Java - YouTube
Oracle Code One 2018 - YouTube
LT大会
メモは一つもありませんw
togetterを追っていただければと思います。
@nishino_chekhovのLT資料は以下です。
www.slideshare.net
感想
楽しそうだなーと言うのが率直な感想。「とりあえず行っとけ!」と楽しんでいる人は言っていましたので、来年は行ってみようかなーと貯金を始めます。会社を利用できれば利用してみようw
Fn Projectについて調べて見た。④
Introduction to Fn with Javaの最後です。
前回はfn invoke
が成功したところまで。
まずは、Fn Projectの更新。
brew upgrade fn
でFn CLIを更新fn update server
でFn Serverを更新
2018/11/26時点で、fn version 0.5.29
、Fn Server v0.3.624
です。
Tutorialのコードを確認。
これまで動かしていたコードは以下です。
package com.example.fn; public class HelloFunction { public String handleRequest(String input) { String name = (input == null || input.isEmpty()) ? "world" : input; return "Hello, " + name + "!"; } }
テストコードは以下。
package com.example.fn; import com.fnproject.fn.testing.*; import org.junit.*; import static org.junit.Assert.*; public class HelloFunctionTest { @Rule public final FnTestingRule testing = FnTestingRule.createDefault(); @Test public void shouldReturnGreeting() { testing.givenEvent().enqueue(); testing.thenRun(HelloFunction.class, "handleRequest"); FnResult result = testing.getOnlyResult(); assertEquals("Hello, world!", result.getBodyAsString()); } @Test public void shouldReturnWithInput() { testing.givenEvent().withBody("Bob").enqueue(); testing.thenRun(HelloFunction.class, "handleRequest"); FnResult result = testing.getOnlyResult(); assertEquals("Hello, Bob!", result.getBodyAsString()); } }
JSONで入出力する。
コードを書き換えます。
package com.example.fn; public class HelloFunction { public static class Input { public String name; } public static class Result { public String salutation; } public Result handleRequest(Input input) { Result result = new Result(); result.salutation = "Hello " + input.name; return result; } }
この状態で、fn deploy
します。
$ fn --verbose deploy --app myapp --local Deploying fntest to app: myapp Bumped to version 0.0.18 Building image fntest:0.0.18 (中略) ------------------------------------------------------- T E S T S ------------------------------------------------------- Running com.example.fn.HelloFunctionTest Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.829 sec <<< FAILURE! shouldReturnGreeting(com.example.fn.HelloFunctionTest) Time elapsed: 0.472 sec <<< FAILURE! org.junit.ComparisonFailure: expected:<{"salutation":"[Hello ]Bob"}> but was:<{"salutation":"[]Bob"}> at org.junit.Assert.assertEquals(Assert.java:115) at org.junit.Assert.assertEquals(Assert.java:144) at com.example.fn.HelloFunctionTest.shouldReturnGreeting(HelloFunctionTest.java:19) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:564) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.rules.RunRules.evaluate(RunRules.java:20) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252) at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141) at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:564) at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189) at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165) at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85) at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75) Results : Failed tests: shouldReturnGreeting(com.example.fn.HelloFunctionTest): expected:<{"salutation":"[Hello ]Bob"}> but was:<{"salutation":"[]Bob"}> Tests run: 1, Failures: 1, Errors: 0, Skipped: 0 [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 3.544 s [INFO] Finished at: 2018-11-25T16:51:12Z [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project hello: There are test failures. [ERROR] [ERROR] Please refer to /function/target/surefire-reports for the individual test results. [ERROR] -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException The command 'mvn package' returned a non-zero code: 1 Fn: error running docker build: exit status 1 See 'fn <command> --help' for more information. Client version: 0.5.29
失敗しました。テストを書き換えてないから当然です、と言うことで書き換えます。
package com.example.fn; import com.fnproject.fn.testing.*; import org.junit.*; import static org.junit.Assert.*; public class HelloFunctionTest { @Rule public final FnTestingRule testing = FnTestingRule.createDefault(); @Test public void shouldReturnGreeting() { testing.givenEvent().withBody("{\"name\":\"Bob\"}").enqueue(); testing.thenRun(HelloFunction.class, "handleRequest"); FnResult result = testing.getOnlyResult(); assertEquals("{\"salutation\":\"Hello Bob\"}", result.getBodyAsString()); } }
再度、fn deploy
をしてみます。
$ fn --verbose deploy --app myapp --local Deploying fntest to app: myapp Bumped to version 0.0.19 Building image fntest:0.0.19 (中略) ------------------------------------------------------- T E S T S ------------------------------------------------------- Running com.example.fn.HelloFunctionTest Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.859 sec Results : Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 [INFO] [INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ hello --- [INFO] Building jar: /function/target/hello-1.0.0.jar [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 3.896 s [INFO] Finished at: 2018-11-25T16:54:27Z [INFO] ------------------------------------------------------------------------ Removing intermediate container 3e81cb813926 ---> 2ffe6ce2f4c3 Step 8/11 : FROM fnproject/fn-java-fdk:jdk9-1.0.72 ---> d23b2ab9ca0a Step 9/11 : WORKDIR /function ---> Using cache ---> 2484b72ee70d Step 10/11 : COPY --from=build-stage /function/target/*.jar /function/app/ ---> cf6f2b4d62e2 Step 11/11 : CMD ["com.example.fn.HelloFunction::handleRequest"] ---> Running in 3b7325fbd756 Removing intermediate container 3b7325fbd756 ---> 435980547049 Successfully built 435980547049 Successfully tagged fntest:0.0.19 Updating function fntest using image fntest:0.0.19...
無事に成功しました。
動作確認します。期待通りの結果が返ってきます。
$ curl -H "Content-Type: application/json" -d '{"name":"Bob"}' http://localhost:8080/t/myapp/fntest-trigger {"salutation":"Hello Bob"}
Tutorialでは想定通りにならないコマンドがあった。
$ curl -H "Content-Type: application/json" http://localhost:8080/t/myapp/fntest-trigger {"message":"invalid function response"}
Tutorialでは{"salutation":"Hello World"}
となるっぽいですが、なぜか上記のような結果に。
コードを書き換えてみました。
package com.example.fn; public class HelloFunction { public static class Input { public String name = "World"; } public static class Result { public String salutation; } public Result handleRequest(Input input) { Result result = new Result(); result.salutation = "Hello " + input.name; return result; } }
動作を確認します。
$ curl -H "Content-Type: application/json" http://localhost:8080/t/myapp/fntest-trigger {"message":"invalid function response"} $ curl -H "Content-Type: application/json" -d '{}' http://localhost:8080/t/myapp/fntest-trigger {"salutation":"Hello World"} $ curl -H "Content-Type: application/json" -d '{"name":"Bob"}' http://localhost:8080/t/myapp/fntest-trigger {"salutation":"Hello Bob"}
Tutorialに書いている通りのコマンドだと当然失敗します。書き換えて空っぽのJSONを渡すとHello World
が返りますが、そうじゃない感。
Tutorialの何かを見落としているか、Tutorialが間違っているか。
今後
Introductionが終わったので、引き続きTutorialを続けていきます。
Fn CLIのコマンドをまとめたいなー。
JJUGナイトセミナー「Oracle Groundbreakers APAC Tour in Tokyo」に行ってきた。
行ってきました。
何度も言っていますが英語はからっきしですので、内容が入ってくるかは不安でした。
案の定からっきしでしたが、メモれた内容は残しておこうと思います。
Java TrackとDevOps/DB Trackが行われていましたが、私はJava Trackのみを聞いていました。
誰かがレポート書くかな?
Oracle Groundbreakersとは?
コミュニティに貢献している開発者達という感じ?
世界各国を周って今回のようなセッションを行ってくれているようです。
※間違ってたら教えてください。
Serverless, the future of the Cloud (Bert Ertman)
www.slideshare.net
↑のスライドにはないですが、「Serverless removes 'R' from ComputeR」というのがありました。
computerの意味・使い方 - 英和辞典 Weblio辞書
computeの意味・使い方 - 英和辞典 Weblio辞書
多分説明してくれていたと思うんですけど、聞き取れていません。
「コンピューター」を意識することなく、「計算する」ことだけを意識できるようになる、と解釈しました。
上記のサイトを紹介していました。
Severlessに関わらずCloud Native Trail Mapとして参考になりそうです。
結構頻繁に更新されているようです。
デモでEclipseからAWSに連携していたようですが、そんなこともできるんですー。
今更ながらに知りました。
あとは、Bert氏はSTAR WARSが好きそうだということは察しました。
Java in a World of Containers(David Buck)
日本語セッションでしたw
内容はJava Day Tokyo [JSE-1]と同じ感じでした。
仕事で使う機会は今のところ全くないのですが、jlink
についてはやはり、今後ちゃんと学ぶ必要がありますね。
DockerでJavaで動かす際にCPU、メモリをちゃんと割り当てられるようになりました。その内容はJDK8にバックポートされたとのことです。
@Mitsuyuki Shiibaさんが試されています。 bufferings.hatenablog.com
個人的にはDavid氏から聞けるちょっとした小ネタが好きです。
今回はAlpineに関するProject Portolaが、
何で「Portola」になったかという話し。
地図を見ていただくと分かるのですが、Portolaという道がAlpineという道に合流しています。
「PortolaはAlpineに繋がっている」という意味のようですが、そのようにこじつけたらしいw
Microservices Gone Wrong! (Bert Ertman)
www.slideshare.net
Google翻訳をエディタとして、スライドでわからない単語や文章をひたすら打ち込んで、何の話をしているかを理解するのに費やしました。
リスニング云々ではなく、単語の意味が全くわからないのは、ダメすぎるなと実感しました。
Microservicesは聞いたこともあって、雰囲気はフワフワっと知っていましたが、基礎のような内容だったので、あとでじっくり見返してみたいと思います。