Skip to content

Commit

Permalink
Releasing zentity-1.0.1. Zentity will be tested and built for Elastic…
Browse files Browse the repository at this point in the history
…search versions 6.5.0 and above from here on out.
  • Loading branch information
davemoore- committed Dec 1, 2018
1 parent 861b2f8 commit 56b94b7
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 32 deletions.
12 changes: 2 additions & 10 deletions .travis.yml
Expand Up @@ -3,16 +3,8 @@ jdk:
- oraclejdk8
env:
matrix:
- ELASTICSEARCH_VERSION=6.2.4
- ELASTICSEARCH_VERSION=6.2.3
- ELASTICSEARCH_VERSION=6.2.2
- ELASTICSEARCH_VERSION=6.2.1
- ELASTICSEARCH_VERSION=6.2.0
- ELASTICSEARCH_VERSION=6.1.3
- ELASTICSEARCH_VERSION=6.1.2
- ELASTICSEARCH_VERSION=6.1.1
- ELASTICSEARCH_VERSION=6.0.1
- ELASTICSEARCH_VERSION=6.0.0
- ELASTICSEARCH_VERSION=6.5.1
- ELASTICSEARCH_VERSION=6.5.0

script: "mvn clean install -Delasticsearch.version=${ELASTICSEARCH_VERSION}"

Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -31,7 +31,7 @@ Once you have installed Elasticsearch, you can install zentity from a remote URL

Example:

`elasticsearch-plugin install https://zentity.io/releases/zentity-1.0.0-elasticsearch-6.2.4.zip`
`elasticsearch-plugin install https://zentity.io/releases/zentity-1.0.1-elasticsearch-6.5.1.zip`

Read the [installation](https://zentity.io/docs/installation) docs for more details.

Expand Down
6 changes: 3 additions & 3 deletions pom.xml
Expand Up @@ -14,9 +14,9 @@
<zentity.author>Dave Moore</zentity.author>
<zentity.classname>org.elasticsearch.plugin.zentity.ZentityPlugin</zentity.classname>
<zentity.website>https://zentity.io</zentity.website>
<zentity.version>1.0.0</zentity.version>
<zentity.version>1.0.1</zentity.version>
<!-- dependency versions -->
<elasticsearch.version>6.2.4</elasticsearch.version>
<elasticsearch.version>6.5.1</elasticsearch.version>
<jackson.version>2.9.4</jackson.version>
<jdk.version>1.8</jdk.version>
<log4j.version>2.9.1</log4j.version>
Expand Down Expand Up @@ -176,7 +176,7 @@
<artifactItems>
<artifactItem>
<groupId>org.elasticsearch.distribution.zip</groupId>
<artifactId>elasticsearch</artifactId>
<artifactId>elasticsearch-oss</artifactId>
<version>${elasticsearch.version}</version>
<type>zip</type>
</artifactItem>
Expand Down
4 changes: 2 additions & 2 deletions src/main/assemblies/plugin.xml
Expand Up @@ -8,13 +8,13 @@
<files>
<file>
<source>${project.basedir}/src/main/resources/plugin-descriptor.properties</source>
<outputDirectory>elasticsearch</outputDirectory>
<outputDirectory>/</outputDirectory>
<filtered>true</filtered>
</file>
</files>
<dependencySets>
<dependencySet>
<outputDirectory>elasticsearch</outputDirectory>
<outputDirectory>/</outputDirectory>
<useProjectArtifact>true</useProjectArtifact>
<useTransitiveFiltering>true</useTransitiveFiltering>
</dependencySet>
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/io/zentity/resolution/Job.java
Expand Up @@ -16,6 +16,7 @@
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.DeprecationHandler;
import org.elasticsearch.common.xcontent.NamedXContentRegistry;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.common.xcontent.XContentParser;
Expand Down Expand Up @@ -109,7 +110,7 @@ public static String makeScriptFieldsClause(Input input, String indexName) throw
}

// Make the "script" clause
String scriptSource = "doc[params.field].value.toString(params.format)";
String scriptSource = "DateFormat df = new SimpleDateFormat(params.format); df.setTimeZone(TimeZone.getTimeZone('UTC')); return df.format(doc[params.field].value.toInstant().toEpochMilli())";
String scriptParams = "\"field\":\"" + indexFieldName + "\",\"format\":\"" + format + "\"";
String scriptFieldClause = "\"" + indexFieldName + "\":{\"script\":{\"lang\":\"painless\",\"source\":\"" + scriptSource + "\",\"params\":{" + scriptParams + "}}}";
scriptFieldClauses.add(scriptFieldClause);
Expand Down Expand Up @@ -509,7 +510,7 @@ private SearchResponse search(String indexName, String query) throws IOException
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
SearchModule searchModule = new SearchModule(Settings.EMPTY, false, Collections.emptyList());
try (XContentParser parser = XContentFactory.xContent(XContentType.JSON).createParser(new NamedXContentRegistry(searchModule
.getNamedXContents()), query)) {
.getNamedXContents()), DeprecationHandler.THROW_UNSUPPORTED_OPERATION, query)) {
searchSourceBuilder.parseXContent(parser);
}
SearchRequestBuilder searchRequestBuilder = new SearchRequestBuilder(client, SearchAction.INSTANCE);
Expand Down
2 changes: 1 addition & 1 deletion src/test/ant/integration-tests.xml
Expand Up @@ -238,7 +238,7 @@
<target name="setup-workspace" depends="stop-external-cluster">
<sequential>
<delete dir="${project.build.directory}/integration-tests/run"/>
<unzip src="${project.build.directory}/integration-tests/binaries/elasticsearch-${elasticsearch.version}.zip"
<unzip src="${project.build.directory}/integration-tests/binaries/elasticsearch-oss-${elasticsearch.version}.zip"
dest="${project.build.directory}/integration-tests/run"/>
</sequential>
</target>
Expand Down
7 changes: 0 additions & 7 deletions src/test/java/io/zentity/resolution/AbstractITCase.java
Expand Up @@ -3,10 +3,8 @@
import com.fasterxml.jackson.databind.JsonNode;
import io.zentity.common.Json;
import org.apache.http.HttpHost;
import org.apache.logging.log4j.Logger;
import org.elasticsearch.client.Response;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.common.logging.ESLoggerFactory;
import org.elasticsearch.test.ESTestCase;
import org.junit.AfterClass;
import org.junit.BeforeClass;
Expand All @@ -18,7 +16,6 @@
import static org.junit.Assume.assumeThat;

public abstract class AbstractITCase extends ESTestCase {
protected static final Logger logger = ESLoggerFactory.getLogger("it");
protected final static int HTTP_TEST_PORT = 9400;
protected static RestClient client;

Expand All @@ -29,12 +26,9 @@ public static void startRestClient() throws IOException {
Response response = client.performRequest("GET", "/");
JsonNode json = Json.MAPPER.readTree(response.getEntity().getContent());
assertTrue(json.get("tagline").textValue().equals("You Know, for Search"));
logger.info("Integration tests ready to start... Cluster is running.");
} catch (IOException e) {
// If we have an exception here, let's ignore the test
logger.warn("Integration tests are skipped: [{}]", e.getMessage());
assumeThat("Integration tests are skipped", e.getMessage(), not(containsString("Connection refused")));
logger.error("Full error is", e);
fail("Something wrong is happening. REST Client seemed to raise an exception.");
if (client != null) {
client.close();
Expand All @@ -49,6 +43,5 @@ public static void stopRestClient() throws IOException {
client.close();
client = null;
}
logger.info("Stopping integration tests against an external cluster");
}
}
12 changes: 6 additions & 6 deletions src/test/java/io/zentity/resolution/JobTest.java
Expand Up @@ -300,7 +300,7 @@ public void testMakeScriptFieldsClauseTypeDateFormatInputAttributeOnly() throws
"}";
Input input = new Input(json, model);
String scriptFieldsClause = Job.makeScriptFieldsClause(input, "index");
String expected = "\"script_fields\":{\"field_timestamp\":{\"script\":{\"lang\":\"painless\",\"source\":\"doc[params.field].value.toString(params.format)\",\"params\":{\"field\":\"field_timestamp\",\"format\":\"yyyy-MM-dd\"}}}}";
String expected = "\"script_fields\":{\"field_timestamp\":{\"script\":{\"lang\":\"painless\",\"source\":\"DateFormat df = new SimpleDateFormat(params.format); df.setTimeZone(TimeZone.getTimeZone('UTC')); return df.format(doc[params.field].value.toInstant().toEpochMilli())\",\"params\":{\"field\":\"field_timestamp\",\"format\":\"yyyy-MM-dd\"}}}}";
Assert.assertEquals(scriptFieldsClause, expected);
}

Expand Down Expand Up @@ -366,7 +366,7 @@ public void testMakeScriptFieldsClauseTypeDateFormatMatcherOnly() throws Excepti
"}";
Input input = new Input(json, model);
String scriptFieldsClause = Job.makeScriptFieldsClause(input, "index");
String expected = "\"script_fields\":{\"field_timestamp\":{\"script\":{\"lang\":\"painless\",\"source\":\"doc[params.field].value.toString(params.format)\",\"params\":{\"field\":\"field_timestamp\",\"format\":\"yyyy-MM-dd\"}}}}";
String expected = "\"script_fields\":{\"field_timestamp\":{\"script\":{\"lang\":\"painless\",\"source\":\"DateFormat df = new SimpleDateFormat(params.format); df.setTimeZone(TimeZone.getTimeZone('UTC')); return df.format(doc[params.field].value.toInstant().toEpochMilli())\",\"params\":{\"field\":\"field_timestamp\",\"format\":\"yyyy-MM-dd\"}}}}";
Assert.assertEquals(scriptFieldsClause, expected);
}

Expand Down Expand Up @@ -428,7 +428,7 @@ public void testMakeScriptFieldsClauseTypeDateFormatModelAttributeOnly() throws
"}";
Input input = new Input(json, model);
String scriptFieldsClause = Job.makeScriptFieldsClause(input, "index");
String expected = "\"script_fields\":{\"field_timestamp\":{\"script\":{\"lang\":\"painless\",\"source\":\"doc[params.field].value.toString(params.format)\",\"params\":{\"field\":\"field_timestamp\",\"format\":\"yyyy-MM-dd\"}}}}";
String expected = "\"script_fields\":{\"field_timestamp\":{\"script\":{\"lang\":\"painless\",\"source\":\"DateFormat df = new SimpleDateFormat(params.format); df.setTimeZone(TimeZone.getTimeZone('UTC')); return df.format(doc[params.field].value.toInstant().toEpochMilli())\",\"params\":{\"field\":\"field_timestamp\",\"format\":\"yyyy-MM-dd\"}}}}";
Assert.assertEquals(scriptFieldsClause, expected);
}

Expand Down Expand Up @@ -493,7 +493,7 @@ public void testMakeScriptFieldsClauseTypeDateFormatModelAttributeOverridesMatch
"}";
Input input = new Input(json, model);
String scriptFieldsClause = Job.makeScriptFieldsClause(input, "index");
String expected = "\"script_fields\":{\"field_timestamp\":{\"script\":{\"lang\":\"painless\",\"source\":\"doc[params.field].value.toString(params.format)\",\"params\":{\"field\":\"field_timestamp\",\"format\":\"yyyy-MM-dd'T'HH:mm:ss\"}}}}";
String expected = "\"script_fields\":{\"field_timestamp\":{\"script\":{\"lang\":\"painless\",\"source\":\"DateFormat df = new SimpleDateFormat(params.format); df.setTimeZone(TimeZone.getTimeZone('UTC')); return df.format(doc[params.field].value.toInstant().toEpochMilli())\",\"params\":{\"field\":\"field_timestamp\",\"format\":\"yyyy-MM-dd'T'HH:mm:ss\"}}}}";
Assert.assertEquals(scriptFieldsClause, expected);
}

Expand Down Expand Up @@ -560,7 +560,7 @@ public void testMakeScriptFieldsClauseTypeDateFormatInputAttributeOverridesModel
"}";
Input input = new Input(json, model);
String scriptFieldsClause = Job.makeScriptFieldsClause(input, "index");
String expected = "\"script_fields\":{\"field_timestamp\":{\"script\":{\"lang\":\"painless\",\"source\":\"doc[params.field].value.toString(params.format)\",\"params\":{\"field\":\"field_timestamp\",\"format\":\"yyyy-MM-dd'T'HH:mm:ss.SSS\"}}}}";
String expected = "\"script_fields\":{\"field_timestamp\":{\"script\":{\"lang\":\"painless\",\"source\":\"DateFormat df = new SimpleDateFormat(params.format); df.setTimeZone(TimeZone.getTimeZone('UTC')); return df.format(doc[params.field].value.toInstant().toEpochMilli())\",\"params\":{\"field\":\"field_timestamp\",\"format\":\"yyyy-MM-dd'T'HH:mm:ss.SSS\"}}}}";
Assert.assertEquals(scriptFieldsClause, expected);
}

Expand Down Expand Up @@ -627,7 +627,7 @@ public void testMakeScriptFieldsClauseTypeDateFormatNullNotOverrides() throws Ex
"}";
Input input = new Input(json, model);
String scriptFieldsClause = Job.makeScriptFieldsClause(input, "index");
String expected = "\"script_fields\":{\"field_timestamp\":{\"script\":{\"lang\":\"painless\",\"source\":\"doc[params.field].value.toString(params.format)\",\"params\":{\"field\":\"field_timestamp\",\"format\":\"yyyy-MM-dd'T'HH:mm:ss\"}}}}";
String expected = "\"script_fields\":{\"field_timestamp\":{\"script\":{\"lang\":\"painless\",\"source\":\"DateFormat df = new SimpleDateFormat(params.format); df.setTimeZone(TimeZone.getTimeZone('UTC')); return df.format(doc[params.field].value.toInstant().toEpochMilli())\",\"params\":{\"field\":\"field_timestamp\",\"format\":\"yyyy-MM-dd'T'HH:mm:ss\"}}}}";
Assert.assertEquals(scriptFieldsClause, expected);
}

Expand Down

0 comments on commit 56b94b7

Please sign in to comment.