public MeshServerInfoModel getInfoExample() { MeshServerInfoModel info = new MeshServerInfoModel(); info.setDatabaseVendor("orientdb"); info.setDatabaseVersion("2.2.16"); info.setSearchVendor("elasticsearch"); info.setSearchVersion("2.4.3"); info.setMeshVersion(Mesh.getPlainVersion()); info.setMeshNodeId("Reminiscent Tirtouga"); info.setVertxVersion(VersionCommand.getVersion()); return info; }
@Override public void registerEndPoints() { EndpointRoute endpoint = createEndpoint(); endpoint.path("/raml"); endpoint.method(GET); endpoint.description("Endpoint which provides a RAML document for all registed endpoints."); endpoint.displayName("RAML specification"); endpoint.exampleResponse(OK, "123"); endpoint.produces(APPLICATION_YAML); endpoint.blockingHandler(rc -> { RAMLGenerator generator = new RAMLGenerator(); String raml = generator.generate(); rc.response().putHeader(HttpHeaders.CONTENT_TYPE, APPLICATION_YAML_UTF8); rc.response().end(raml); }, false); EndpointRoute infoEndpoint = createEndpoint(); infoEndpoint.path("/"); infoEndpoint.description("Endpoint which returns version information"); infoEndpoint.displayName("Version Information"); infoEndpoint.produces(APPLICATION_JSON); infoEndpoint.exampleResponse(OK, examples.getInfoExample(), "JSON which contains version information"); infoEndpoint.method(GET); infoEndpoint.blockingHandler(rc -> { InternalActionContext ac = new InternalRoutingActionContextImpl(rc); MeshServerInfoModel info = new MeshServerInfoModel(); info.setDatabaseVendor(db.getVendorName()); info.setDatabaseVersion(db.getVersion()); info.setSearchVendor(searchProvider.getVendorName()); info.setSearchVersion(searchProvider.getVersion()); info.setMeshVersion(Mesh.getPlainVersion()); info.setMeshNodeId(Mesh.mesh().getOptions().getNodeName()); info.setVertxVersion(VersionCommand.getVersion()); ac.send(info, OK); }, false); }
@Test public void testGetInfo() { MeshServerInfoModel info = call(() -> client().getApiInfo()); assertEquals(Mesh.getPlainVersion(), info.getMeshVersion()); assertEquals("orientdb", info.getDatabaseVendor()); assertEquals("dummy", info.getSearchVendor()); assertEquals(VersionCommand.getVersion(), info.getVertxVersion()); assertEquals(Mesh.mesh().getOptions().getNodeName(), info.getMeshNodeId()); assertEquals("The database version did not match.", OConstants.getVersion(), info.getDatabaseVersion()); assertEquals("1.0", info.getSearchVersion()); }
@Before public void setUp() { FileUtils.delete(root); Awaitility.await().atMost(10, TimeUnit.SECONDS).until(() -> !root.exists()); String vertxVersion = new VersionCommand().getVersion(); assertThat(vertxVersion).isNotEmpty(); System.setProperty("vertx.version", vertxVersion); }
public static String loadUserAgent() { String userAgent = "Vert.x-WebClient"; String version = VersionCommand.getVersion(); if (version.length() > 0) { userAgent += "/" + version; } return userAgent; }
@Test public void testFromJson() { JsonObject json = new JsonObject() .put("defaultPort", 4848) .put("userAgentEnabled", false) .put("maxPoolSize", 50); WebClientOptions options = new WebClientOptions(json); assertEquals(4848, options.getDefaultPort()); assertFalse(options.isUserAgentEnabled()); assertEquals("Vert.x-WebClient/" + VersionCommand.getVersion(), options.getUserAgent()); assertEquals(50, options.getMaxPoolSize()); }
public GraphQLObjectType createType() { Builder root = newObject(); root.name(MESH_TYPE_NAME); root.description("Mesh version information"); root.field(newFieldDefinition().name("meshVersion").description("Version of mesh").type(GraphQLString).dataFetcher((env) -> { return Mesh.getPlainVersion(); })); // .meshNodeId root.field(newFieldDefinition().name("meshNodeId").description("Node id of this mesh instance").type(GraphQLString).dataFetcher((env) -> { return Mesh.mesh().getOptions().getNodeName(); })); // .databaseVendor root.field(newFieldDefinition().name("databaseVendor").description("Name of the graph database vendor").type(GraphQLString) .dataFetcher((env) -> { return db.getVendorName(); })); // .databaseVersion root.field(newFieldDefinition().name("databaseVersion").description("Version of the used graph database").type(GraphQLString) .dataFetcher((env) -> { return db.getVersion(); })); // .searchVendor root.field(newFieldDefinition().name("searchVendor").description("Name of the search index vendor").type(GraphQLString).dataFetcher((env) -> { return searchProvider.getVendorName(); })); // .searchVersion root.field( newFieldDefinition().name("searchVersion").description("Version of the used search index").type(GraphQLString).dataFetcher((env) -> { return searchProvider.getVersion(); })); // .vertxVersion root.field(newFieldDefinition().name("vertxVersion").description("Vert.x version").type(GraphQLString).dataFetcher((env) -> { return VersionCommand.getVersion(); })); return root.build(); }
@Override public void run() throws CLIException { log.info("Apiman " + getApimanVersion()); log.info("Vert.x " + VersionCommand.getVersion()); }
/** * Return the vertx version. * * @return */ private String getVertxVersion() { return VersionCommand.getVersion(); }