Skip to content

Commit d12279d

Browse files
committed
Switch to elasticsearch-plugin as a parent project
Changes related to elastic/elasticsearch#12367
1 parent 96f8b93 commit d12279d

File tree

5 files changed

+113
-127
lines changed

5 files changed

+113
-127
lines changed

pom.xml

Lines changed: 30 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,55 @@
22
<project xmlns="http://maven.apache.org/POM/4.0.0"
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5-
<!-- ============================================================= -->
6-
<!-- Standard project header. Change the project name, groupId, -->
7-
<!-- artifactId and description to match your project. -->
8-
<!-- ============================================================= -->
9-
<name>elasticsearch-native-script-example</name>
105
<modelVersion>4.0.0</modelVersion>
11-
<groupId>org.elasticsearch</groupId>
6+
7+
<parent>
8+
<groupId>org.elasticsearch.plugin</groupId>
9+
<artifactId>elasticsearch-plugin</artifactId>
10+
<version>2.0.0-beta1-SNAPSHOT</version>
11+
</parent>
12+
13+
<name>elasticsearch-native-script-example</name>
14+
<groupId>org.elasticsearch.plugin</groupId>
1215
<artifactId>elasticsearch-native-script-example</artifactId>
1316
<version>2.0.0-beta1-SNAPSHOT</version>
14-
<packaging>jar</packaging>
1517
<description>ElasticSearch Plugin with Native Script Examples</description>
1618
<inceptionYear>2013</inceptionYear>
19+
1720
<licenses>
1821
<license>
1922
<name>The Apache Software License, Version 2.0</name>
2023
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
2124
<distribution>repo</distribution>
2225
</license>
2326
</licenses>
27+
2428
<scm>
2529
<connection>scm:git:git@github.com:imotov/elasticsearch-native-script-example.git</connection>
2630
<developerConnection>scm:git:git@github.com:imotov/elasticsearch-native-script-example.git</developerConnection>
2731
<url>http://github.com/imotov/elasticsearch-native-script-example</url>
2832
</scm>
2933

30-
<parent>
31-
<groupId>org.elasticsearch</groupId>
32-
<artifactId>elasticsearch-parent</artifactId>
33-
<version>2.0.0-beta1-SNAPSHOT</version>
34-
</parent>
34+
<!-- ============================================================= -->
35+
<!-- Most of the build and assembly logic is defined in the parent -->
36+
<!-- pom. We just need to override a few settings here -->
37+
<!-- ============================================================= -->
38+
39+
<properties>
40+
<!-- define class name for the descriptor file -->
41+
<elasticsearch.plugin.classname>org.elasticsearch.examples.nativescript.plugin.NativeScriptExamplesPlugin</elasticsearch.plugin.classname>
3542

43+
<!-- we have custom licence header in this project -->
44+
<elasticsearch.license.header>${project.basedir}/dev-tools/src/main/resources/license-check/native_script_example_license_header.txt</elasticsearch.license.header>
45+
<elasticsearch.license.headerDefinition>${project.basedir}/dev-tools/src/main/resources/license-check/license_header_definition.xml</elasticsearch.license.headerDefinition>
46+
47+
<!-- define where to find integration rest tests -->
48+
<tests.ifNoTests>warn</tests.ifNoTests>
49+
<tests.rest.suite>nativescript</tests.rest.suite>
50+
<tests.rest.load_packaged>false</tests.rest.load_packaged>
51+
</properties>
52+
53+
<!-- needed for the snapshots of elasticsearch -->
3654
<repositories>
3755
<repository>
3856
<id>oss-snapshots</id>
@@ -41,107 +59,11 @@
4159
</repository>
4260
</repositories>
4361

44-
<!-- ============================================================= -->
45-
<!-- The minimal set of Elasticsearch dependencies that plugin -->
46-
<!-- project needs that the project will be built with -->
47-
<!-- ============================================================= -->
48-
<dependencies>
49-
50-
<dependency>
51-
<groupId>org.apache.lucene</groupId>
52-
<artifactId>lucene-test-framework</artifactId>
53-
</dependency>
54-
55-
<dependency>
56-
<groupId>org.elasticsearch</groupId>
57-
<artifactId>elasticsearch</artifactId>
58-
</dependency>
59-
60-
<dependency>
61-
<groupId>org.elasticsearch</groupId>
62-
<artifactId>elasticsearch</artifactId>
63-
<scope>test</scope>
64-
<type>test-jar</type>
65-
</dependency>
66-
67-
<dependency>
68-
<groupId>log4j</groupId>
69-
<artifactId>log4j</artifactId>
70-
</dependency>
71-
72-
<dependency>
73-
<groupId>org.slf4j</groupId>
74-
<artifactId>slf4j-api</artifactId>
75-
</dependency>
76-
77-
<dependency>
78-
<groupId>org.hamcrest</groupId>
79-
<artifactId>hamcrest-all</artifactId>
80-
</dependency>
81-
82-
<dependency>
83-
<groupId>com.carrotsearch.randomizedtesting</groupId>
84-
<artifactId>randomizedtesting-runner</artifactId>
85-
</dependency>
86-
87-
</dependencies>
88-
8962
<build>
9063
<plugins>
91-
<!-- ============================================================= -->
92-
<!-- Elasticsearch is using java 1.7 at the moment. -->
93-
<!-- ============================================================= -->
9464
<plugin>
9565
<groupId>org.apache.maven.plugins</groupId>
96-
<artifactId>maven-compiler-plugin</artifactId>
97-
<version>2.3.2</version>
98-
<configuration>
99-
<source>1.7</source>
100-
<target>1.7</target>
101-
</configuration>
102-
</plugin>
103-
<!-- ============================================================= -->
104-
<!-- Optional. This plugin is using surefire plugin to run tests. -->
105-
<!-- ============================================================= -->
106-
<plugin>
107-
<groupId>org.apache.maven.plugins</groupId>
108-
<artifactId>maven-surefire-plugin</artifactId>
109-
<version>2.12.3</version>
110-
<configuration>
111-
<includes>
112-
<include>**/*Tests.java</include>
113-
</includes>
114-
</configuration>
115-
</plugin>
116-
<!-- ============================================================= -->
117-
<!-- This plugin assembles plugin .zip package. -->
118-
<!-- ============================================================= -->
119-
<plugin>
12066
<artifactId>maven-assembly-plugin</artifactId>
121-
<version>2.3</version>
122-
<configuration>
123-
<appendAssemblyId>false</appendAssemblyId>
124-
<outputDirectory>${project.build.directory}/releases/</outputDirectory>
125-
<descriptors>
126-
<descriptor>${basedir}/src/main/assemblies/plugin.xml</descriptor>
127-
</descriptors>
128-
</configuration>
129-
<executions>
130-
<execution>
131-
<phase>package</phase>
132-
<goals>
133-
<goal>single</goal>
134-
</goals>
135-
</execution>
136-
</executions>
137-
</plugin>
138-
139-
<plugin>
140-
<groupId>com.mycila</groupId>
141-
<artifactId>license-maven-plugin</artifactId>
142-
<configuration>
143-
<header>${project.basedir}/dev-tools/src/main/resources/license-check/native_script_example_license_header.txt</header>
144-
</configuration>
14567
</plugin>
14668
</plugins>
14769
</build>
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Integration tests for the lookup script
2+
#
3+
setup:
4+
- do:
5+
indices.create:
6+
index: test_index
7+
body:
8+
settings:
9+
index.number_of_shards: 1
10+
index.number_of_replicas: 0
11+
mappings.type1:
12+
properties:
13+
name.type: string
14+
number.type: integer
15+
16+
- do:
17+
index: {index: test_index, type: type1, id: 1, body: {name: "rec 1", number: 1}}
18+
19+
- do:
20+
index: {index: test_index, type: type1, id: 2, body: {name: "rec 2", number: 2}}
21+
22+
- do:
23+
index: {index: test_index, type: type1, id: 3, body: {name: "rec 3", number: 3}}
24+
25+
- do:
26+
index: {index: test_index, type: type1, id: 4, body: {name: "rec 4", number: 4}}
27+
28+
- do:
29+
index: {index: test_index, type: type1, id: 5, body: {name: "rec 5", number: 5}}
30+
- do:
31+
indices.refresh: {}
32+
33+
---
34+
35+
"Primes Test":
36+
- do:
37+
search:
38+
body:
39+
query:
40+
filtered:
41+
filter:
42+
script:
43+
script: is_prime
44+
lang: native
45+
params:
46+
field: number
47+
48+
- match: { hits.total: 3}

src/main/assemblies/plugin.xml

Lines changed: 0 additions & 18 deletions
This file was deleted.

src/main/resources/es-plugin.properties

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Licensed under the Apache License, Version 2.0 (the "License");
3+
* you may not use this file except in compliance with the License.
4+
* You may obtain a copy of the License at
5+
*
6+
* http://www.apache.org/licenses/LICENSE-2.0
7+
*
8+
* Unless required by applicable law or agreed to in writing, software
9+
* distributed under the License is distributed on an "AS IS" BASIS,
10+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
* See the License for the specific language governing permissions and
12+
* limitations under the License.
13+
*/
14+
package org.elasticsearch.examples.nativescript.plugin;
15+
16+
import com.carrotsearch.randomizedtesting.annotations.Name;
17+
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
18+
import org.elasticsearch.test.rest.ElasticsearchRestTestCase;
19+
import org.elasticsearch.test.rest.RestTestCandidate;
20+
import org.elasticsearch.test.rest.parser.RestTestParseException;
21+
22+
import java.io.IOException;
23+
24+
public class NativeScriptExamplesRestIT extends ElasticsearchRestTestCase {
25+
26+
public NativeScriptExamplesRestIT(@Name("yaml") RestTestCandidate testCandidate) {
27+
super(testCandidate);
28+
}
29+
30+
@ParametersFactory
31+
public static Iterable<Object[]> parameters() throws IOException, RestTestParseException {
32+
return ElasticsearchRestTestCase.createParameters(0, 1);
33+
}
34+
}
35+

0 commit comments

Comments
 (0)