Vert.x

  • ,

    Vert.x 3.1.0 Tutorial – 2 : Hello World TEST

    Vert.x applicationはJUnitとvertx-unitでunitテストが可能なので 今回は前回のHello WorldのUnitテスト手順を投稿 本家の説明はこちら 前回の記事はこちら 今回のソースはこちら 1.依存関係追加 JUnitとvertx-unitテスト用の依存関係をpom.xmlに追加 <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.12</version> <scope>test</scope> </dependency> <dependency> <groupId>io.vertx</groupId> <artifactId>vertx-unit</artifactId> <version>3.1.0</version> <scope>test</scope> </dependency> 追加後libraryを更新[Maven Project パネルより->Reimport all maven projectsを実施] 2.テストソース 以下ソースをsrc/test/java/tutorial/vertx/HelloVerticleTest.javaに生成 /** * Created by bhags on 15/11/08. */ package tutorial.vertx; import io.vertx.core.Vertx; import io.vertx.ext.unit.Async; import io.vertx.ext.unit.TestContext; import io.vertx.ext.unit.junit.VertxUnitRunner; import io.vertx.core.logging.LoggerFactory; import io.vertx.core.logging.Logger; import org.junit.After; import org.junit.Before;…

    続きを読む

  • , , ,

    Vert.x 3.1.0 Tutorial – 1 : Hello World

    Vert.xの紹介は本家サイト(http://vertx.io/)に譲ってとりあえずHello Word! まず、今回のソースコードはこちら 0.開発環境 Mac OS  X java 1.8 以上 IntelliJ 14. 1 : IntelliJでmaven新規プロジェクト作成 File ->New -> Project Mavenを選択しNext maven project 設定 GroupId : totorial.vertx ArtifactId : hello-verticle Version : 1.0-SNAPSHOT Project name / location name : hello-virticle location : すきなところへ 2 : pom.xml に依存関係を追加 以下の依存関係およびbuildをpom.xml のversionの下に追加 <dependencies> <dependency> <groupId>io.vertx</groupId> <artifactId>vertx-core</artifactId> <version>3.1.0</version> </dependency> </dependencies>…

    続きを読む

  • Vert.x 3.1.0 Service Tutorial

    [前置き] Vert.x 3.0よりv直接classnameもしくはscript nameを利用しdeployせずに, ServicVerticleFactoryを利用しdeployすることが可能。 [Tutorial] 1.pom.xmlに以下のService Factory Dependencyを追加 <dependency> <groupId>io.vertx</groupId> <artifactId>vertx-service-factory</artifactId> <version>3.0.0</version> </dependency> ServiceFactoryはservice nameを元にverticleをdeployするためのVeticleFactoryの実装 2.First Sample Service – Serviceが呼び出されたら”This is my test service”を出力 package biz.playport.vertx.services; import io.vertx.core.AbstractVerticle; import io.vertx.core.logging.Logger; import io.vertx.core.logging.LoggerFactory; /** * Created by bhags on 15/11/07. */ public class FirstServiceVerticle extends AbstractVerticle { private final static Logger log = LoggerFactory.getLogger(FirstServiceVerticle.class); @Override…

    続きを読む