From bd416b7a73dd7c4534489fe6635d86bdbe39b5f6 Mon Sep 17 00:00:00 2001 From: Areek Zillur Date: Tue, 7 Jul 2015 19:32:14 -0400 Subject: [PATCH] Add basic license integ test Original commit: elastic/x-pack-elasticsearch@248f2a745d3eabaa86e619f97105fbd0be14ae6e --- plugin/pom.xml | 2 ++ plugin/rest-api-spec/api/licenses.json | 19 +++++++++++++ .../rest-api-spec/test/license/10_basic.yaml | 4 +++ .../license/plugin/rest/LicensesRestIT.java | 27 +++++++++++++++++++ 4 files changed, 52 insertions(+) create mode 100644 plugin/rest-api-spec/api/licenses.json create mode 100644 plugin/rest-api-spec/test/license/10_basic.yaml create mode 100644 plugin/src/test/java/org/elasticsearch/license/plugin/rest/LicensesRestIT.java diff --git a/plugin/pom.xml b/plugin/pom.xml index a2292e7230d..62be5a4d981 100644 --- a/plugin/pom.xml +++ b/plugin/pom.xml @@ -16,6 +16,8 @@ --> ${basedir}/src/test/resources ${project.parent.basedir} + license + false diff --git a/plugin/rest-api-spec/api/licenses.json b/plugin/rest-api-spec/api/licenses.json new file mode 100644 index 00000000000..1ab8197c227 --- /dev/null +++ b/plugin/rest-api-spec/api/licenses.json @@ -0,0 +1,19 @@ +{ + "licenses": { + "documentation": "https://www.elastic.co/guide/en/shield/current/license-management.html", + "methods": ["GET"], + "url": { + "path": "/_licenses", + "paths": ["/_licenses"], + "parts" : { + }, + "params": { + "local": { + "type" : "boolean", + "description" : "Return local information, do not retrieve the state from master node (default: false)" + } + } + }, + "body": null + } +} diff --git a/plugin/rest-api-spec/test/license/10_basic.yaml b/plugin/rest-api-spec/test/license/10_basic.yaml new file mode 100644 index 00000000000..30d9f3e3d49 --- /dev/null +++ b/plugin/rest-api-spec/test/license/10_basic.yaml @@ -0,0 +1,4 @@ +--- +"licenses endpoint exists": + - do: {licenses: {}} + - match: {licenses: []} diff --git a/plugin/src/test/java/org/elasticsearch/license/plugin/rest/LicensesRestIT.java b/plugin/src/test/java/org/elasticsearch/license/plugin/rest/LicensesRestIT.java new file mode 100644 index 00000000000..158aac9bf0a --- /dev/null +++ b/plugin/src/test/java/org/elasticsearch/license/plugin/rest/LicensesRestIT.java @@ -0,0 +1,27 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ +package org.elasticsearch.license.plugin.rest; + + +import com.carrotsearch.randomizedtesting.annotations.Name; +import com.carrotsearch.randomizedtesting.annotations.ParametersFactory; +import org.elasticsearch.test.rest.ElasticsearchRestTestCase; +import org.elasticsearch.test.rest.RestTestCandidate; +import org.elasticsearch.test.rest.parser.RestTestParseException; + +import java.io.IOException; + +public class LicensesRestIT extends ElasticsearchRestTestCase { + + public LicensesRestIT(@Name("yaml") RestTestCandidate testCandidate) { + super(testCandidate); + } + + @ParametersFactory + public static Iterable parameters() throws IOException, RestTestParseException { + return ElasticsearchRestTestCase.createParameters(0, 1); + } +}