http://git-wip-us.apache.org/repos/asf/incubator-streams-examples/blob/5b96588c/local/elasticsearch-reindex/src/test/java/org/apache/streams/example/test/ElasticsearchReindexIT.java ---------------------------------------------------------------------- diff --git a/local/elasticsearch-reindex/src/test/java/org/apache/streams/example/test/ElasticsearchReindexIT.java b/local/elasticsearch-reindex/src/test/java/org/apache/streams/example/test/ElasticsearchReindexIT.java new file mode 100644 index 0000000..3fee0d7 --- /dev/null +++ b/local/elasticsearch-reindex/src/test/java/org/apache/streams/example/test/ElasticsearchReindexIT.java @@ -0,0 +1,120 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.streams.example.test; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.typesafe.config.Config; +import com.typesafe.config.ConfigFactory; +import com.typesafe.config.ConfigParseOptions; +import org.apache.streams.config.ComponentConfigurator; +import org.apache.streams.config.StreamsConfiguration; +import org.apache.streams.config.StreamsConfigurator; +import org.apache.streams.elasticsearch.ElasticsearchClientManager; +import org.apache.streams.example.ElasticsearchReindex; +import org.apache.streams.example.ElasticsearchReindexConfiguration; +import org.apache.streams.jackson.StreamsJacksonMapper; +import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest; +import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; +import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsRequest; +import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsResponse; +import org.elasticsearch.action.search.SearchRequestBuilder; +import org.elasticsearch.action.search.SearchResponse; +import org.elasticsearch.client.Client; +import org.elasticsearch.client.Requests; +import org.elasticsearch.cluster.health.ClusterHealthStatus; +import org.junit.Before; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStream; +import java.util.Properties; + +import static junit.framework.TestCase.assertTrue; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; + +/** + * Test copying documents between two indexes on same cluster + */ +public class ElasticsearchReindexIT { + + private final static Logger LOGGER = LoggerFactory.getLogger(ElasticsearchReindexIT.class); + + ObjectMapper MAPPER = StreamsJacksonMapper.getInstance(); + + protected ElasticsearchReindexConfiguration testConfiguration; + protected Client testClient; + + private int count = 0; + + @Before + public void prepareTest() throws Exception { + + Config reference = ConfigFactory.load(); + File conf_file = new File("target/test-classes/ElasticsearchReindexIT.conf"); + assert(conf_file.exists()); + Config testResourceConfig = ConfigFactory.parseFileAnySyntax(conf_file, ConfigParseOptions.defaults().setAllowMissing(false)); + Properties es_properties = new Properties(); + InputStream es_stream = new FileInputStream("elasticsearch.properties"); + es_properties.load(es_stream); + Config esProps = ConfigFactory.parseProperties(es_properties); + Config typesafe = testResourceConfig.withFallback(esProps).withFallback(reference).resolve(); + StreamsConfiguration streams = StreamsConfigurator.detectConfiguration(typesafe); + testConfiguration = new ComponentConfigurator<>(ElasticsearchReindexConfiguration.class).detectConfiguration(typesafe); + testClient = new ElasticsearchClientManager(testConfiguration.getSource()).getClient(); + + ClusterHealthRequest clusterHealthRequest = Requests.clusterHealthRequest(); + ClusterHealthResponse clusterHealthResponse = testClient.admin().cluster().health(clusterHealthRequest).actionGet(); + assertNotEquals(clusterHealthResponse.getStatus(), ClusterHealthStatus.RED); + + IndicesExistsRequest indicesExistsRequest = Requests.indicesExistsRequest(testConfiguration.getSource().getIndexes().get(0)); + IndicesExistsResponse indicesExistsResponse = testClient.admin().indices().exists(indicesExistsRequest).actionGet(); + assertTrue(indicesExistsResponse.isExists()); + + SearchRequestBuilder countRequest = testClient + .prepareSearch(testConfiguration.getSource().getIndexes().get(0)) + .setTypes(testConfiguration.getSource().getTypes().get(0)); + SearchResponse countResponse = countRequest.execute().actionGet(); + + count = (int)countResponse.getHits().getTotalHits(); + + assertNotEquals(count, 0); + + } + + @Test + public void testReindex() throws Exception { + + ElasticsearchReindex reindex = new ElasticsearchReindex(testConfiguration); + + reindex.run(); + + // assert lines in file + SearchRequestBuilder countRequest = testClient + .prepareSearch(testConfiguration.getDestination().getIndex()) + .setTypes(testConfiguration.getDestination().getType()); + SearchResponse countResponse = countRequest.execute().actionGet(); + + assertEquals(count, (int)countResponse.getHits().getTotalHits()); + + } +}
http://git-wip-us.apache.org/repos/asf/incubator-streams-examples/blob/5b96588c/local/elasticsearch-reindex/src/test/java/org/apache/streams/example/test/ElasticsearchReindexParentIT.java ---------------------------------------------------------------------- diff --git a/local/elasticsearch-reindex/src/test/java/org/apache/streams/example/test/ElasticsearchReindexParentIT.java b/local/elasticsearch-reindex/src/test/java/org/apache/streams/example/test/ElasticsearchReindexParentIT.java new file mode 100644 index 0000000..fc80453 --- /dev/null +++ b/local/elasticsearch-reindex/src/test/java/org/apache/streams/example/test/ElasticsearchReindexParentIT.java @@ -0,0 +1,133 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.streams.example.test; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.ObjectNode; +import com.typesafe.config.Config; +import com.typesafe.config.ConfigFactory; +import com.typesafe.config.ConfigParseOptions; +import org.apache.streams.config.ComponentConfigurator; +import org.apache.streams.config.StreamsConfiguration; +import org.apache.streams.config.StreamsConfigurator; +import org.apache.streams.elasticsearch.ElasticsearchClientManager; +import org.apache.streams.example.ElasticsearchReindex; +import org.apache.streams.example.ElasticsearchReindexConfiguration; +import org.apache.streams.elasticsearch.test.ElasticsearchParentChildWriterIT; +import org.apache.streams.jackson.StreamsJacksonMapper; +import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest; +import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; +import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsRequest; +import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsResponse; +import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequestBuilder; +import org.elasticsearch.action.search.SearchRequestBuilder; +import org.elasticsearch.action.search.SearchResponse; +import org.elasticsearch.client.Client; +import org.elasticsearch.client.Requests; +import org.elasticsearch.cluster.health.ClusterHealthStatus; +import org.junit.Before; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStream; +import java.net.URL; +import java.util.Properties; + +import static junit.framework.TestCase.assertTrue; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; + +/** + * Test copying parent/child associated documents between two indexes on same cluster + */ +public class ElasticsearchReindexParentIT { + + private final static Logger LOGGER = LoggerFactory.getLogger(ElasticsearchReindexIT.class); + + ObjectMapper MAPPER = StreamsJacksonMapper.getInstance(); + + protected ElasticsearchReindexConfiguration testConfiguration; + protected Client testClient; + + private int count = 0; + + @Before + public void prepareTest() throws Exception { + + Config reference = ConfigFactory.load(); + File conf_file = new File("target/test-classes/ElasticsearchReindexParentIT.conf"); + assert(conf_file.exists()); + Config testResourceConfig = ConfigFactory.parseFileAnySyntax(conf_file, ConfigParseOptions.defaults().setAllowMissing(false)); + Properties es_properties = new Properties(); + InputStream es_stream = new FileInputStream("elasticsearch.properties"); + es_properties.load(es_stream); + Config esProps = ConfigFactory.parseProperties(es_properties); + Config typesafe = testResourceConfig.withFallback(esProps).withFallback(reference).resolve(); + StreamsConfiguration streams = StreamsConfigurator.detectConfiguration(typesafe); + testConfiguration = new ComponentConfigurator<>(ElasticsearchReindexConfiguration.class).detectConfiguration(typesafe); + testClient = new ElasticsearchClientManager(testConfiguration.getSource()).getClient(); + + ClusterHealthRequest clusterHealthRequest = Requests.clusterHealthRequest(); + ClusterHealthResponse clusterHealthResponse = testClient.admin().cluster().health(clusterHealthRequest).actionGet(); + assertNotEquals(clusterHealthResponse.getStatus(), ClusterHealthStatus.RED); + + IndicesExistsRequest indicesExistsRequest = Requests.indicesExistsRequest(testConfiguration.getSource().getIndexes().get(0)); + IndicesExistsResponse indicesExistsResponse = testClient.admin().indices().exists(indicesExistsRequest).actionGet(); + assertTrue(indicesExistsResponse.isExists()); + + SearchRequestBuilder countRequest = testClient + .prepareSearch(testConfiguration.getSource().getIndexes().get(0)) + .setTypes(testConfiguration.getSource().getTypes().get(0)); + SearchResponse countResponse = countRequest.execute().actionGet(); + + count = (int)countResponse.getHits().getTotalHits(); + + PutIndexTemplateRequestBuilder putTemplateRequestBuilder = testClient.admin().indices().preparePutTemplate("mappings"); + URL templateURL = ElasticsearchParentChildWriterIT.class.getResource("/ActivityChildObjectParent.json"); + ObjectNode template = MAPPER.readValue(templateURL, ObjectNode.class); + String templateSource = MAPPER.writeValueAsString(template); + putTemplateRequestBuilder.setSource(templateSource); + + testClient.admin().indices().putTemplate(putTemplateRequestBuilder.request()).actionGet(); + + assertNotEquals(count, 0); + + } + + @Test + public void testReindex() throws Exception { + + ElasticsearchReindex reindex = new ElasticsearchReindex(testConfiguration); + + reindex.run(); + + // assert lines in file + SearchRequestBuilder countRequest = testClient + .prepareSearch(testConfiguration.getDestination().getIndex()) + .setTypes(testConfiguration.getDestination().getType()); + SearchResponse countResponse = countRequest.execute().actionGet(); + + assertEquals(count, (int)countResponse.getHits().getTotalHits()); + + } + +} http://git-wip-us.apache.org/repos/asf/incubator-streams-examples/blob/5b96588c/local/elasticsearch-reindex/src/test/java/org/apache/streams/example/test/ReindexITs.java ---------------------------------------------------------------------- diff --git a/local/elasticsearch-reindex/src/test/java/org/apache/streams/example/test/ReindexITs.java b/local/elasticsearch-reindex/src/test/java/org/apache/streams/example/test/ReindexITs.java new file mode 100644 index 0000000..ee79224 --- /dev/null +++ b/local/elasticsearch-reindex/src/test/java/org/apache/streams/example/test/ReindexITs.java @@ -0,0 +1,20 @@ +package org.apache.streams.example.test; + +import org.apache.streams.elasticsearch.test.ElasticsearchParentChildWriterIT; +import org.apache.streams.elasticsearch.test.ElasticsearchPersistWriterIT; +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +@RunWith(Suite.class) [email protected]({ + ElasticsearchPersistWriterIT.class, + ElasticsearchParentChildWriterIT.class, + ElasticsearchReindexIT.class, + ElasticsearchReindexParentIT.class, + ElasticsearchReindexChildIT.class +}) + +public class ReindexITs { + // the class remains empty, + // used only as a holder for the above annotations +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-streams-examples/blob/5b96588c/local/mongo-elasticsearch-sync/src/main/java/org/apache/streams/elasticsearch/example/MongoElasticsearchSync.java ---------------------------------------------------------------------- diff --git a/local/mongo-elasticsearch-sync/src/main/java/org/apache/streams/elasticsearch/example/MongoElasticsearchSync.java b/local/mongo-elasticsearch-sync/src/main/java/org/apache/streams/elasticsearch/example/MongoElasticsearchSync.java deleted file mode 100644 index f77ecce..0000000 --- a/local/mongo-elasticsearch-sync/src/main/java/org/apache/streams/elasticsearch/example/MongoElasticsearchSync.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.streams.elasticsearch.example; - -import com.google.common.collect.Maps; -import org.apache.streams.config.ComponentConfigurator; -import org.apache.streams.config.StreamsConfigurator; -import org.apache.streams.elasticsearch.*; -import org.apache.streams.core.StreamBuilder; -import org.apache.streams.example.elasticsearch.MongoElasticsearchSyncConfiguration; -import org.apache.streams.local.builders.LocalStreamBuilder; -import org.apache.streams.mongo.MongoPersistReader; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.Map; - -/** - * Copies documents into a new index - */ -public class MongoElasticsearchSync implements Runnable { - - public final static String STREAMS_ID = "MongoElasticsearchSync"; - - private final static Logger LOGGER = LoggerFactory.getLogger(MongoElasticsearchSync.class); - - MongoElasticsearchSyncConfiguration config; - - public MongoElasticsearchSync() { - this(new ComponentConfigurator<MongoElasticsearchSyncConfiguration>(MongoElasticsearchSyncConfiguration.class).detectConfiguration(StreamsConfigurator.getConfig())); - } - - public MongoElasticsearchSync(MongoElasticsearchSyncConfiguration config) { - this.config = config; - } - - public static void main(String[] args) - { - LOGGER.info(StreamsConfigurator.config.toString()); - - MongoElasticsearchSync sync = new MongoElasticsearchSync(); - - new Thread(sync).start(); - - } - - @Override - public void run() { - - MongoPersistReader mongoPersistReader = new MongoPersistReader(config.getSource()); - - ElasticsearchPersistWriter elasticsearchPersistWriter = new ElasticsearchPersistWriter(config.getDestination()); - - Map<String, Object> streamConfig = Maps.newHashMap(); - streamConfig.put(LocalStreamBuilder.STREAM_IDENTIFIER_KEY, STREAMS_ID); - streamConfig.put(LocalStreamBuilder.TIMEOUT_KEY, 7 * 24 * 60 * 1000); - StreamBuilder builder = new LocalStreamBuilder(1000, streamConfig); - - builder.newPerpetualStream(MongoPersistReader.STREAMS_ID, mongoPersistReader); - builder.addStreamsPersistWriter(ElasticsearchPersistWriter.STREAMS_ID, elasticsearchPersistWriter, 1, MongoPersistReader.STREAMS_ID); - builder.start(); - } -} http://git-wip-us.apache.org/repos/asf/incubator-streams-examples/blob/5b96588c/local/mongo-elasticsearch-sync/src/main/java/org/apache/streams/example/MongoElasticsearchSync.java ---------------------------------------------------------------------- diff --git a/local/mongo-elasticsearch-sync/src/main/java/org/apache/streams/example/MongoElasticsearchSync.java b/local/mongo-elasticsearch-sync/src/main/java/org/apache/streams/example/MongoElasticsearchSync.java new file mode 100644 index 0000000..e89318c --- /dev/null +++ b/local/mongo-elasticsearch-sync/src/main/java/org/apache/streams/example/MongoElasticsearchSync.java @@ -0,0 +1,79 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.streams.example; + +import com.google.common.collect.Maps; +import org.apache.streams.config.ComponentConfigurator; +import org.apache.streams.config.StreamsConfigurator; +import org.apache.streams.elasticsearch.*; +import org.apache.streams.core.StreamBuilder; +import org.apache.streams.example.MongoElasticsearchSyncConfiguration; +import org.apache.streams.local.builders.LocalStreamBuilder; +import org.apache.streams.mongo.MongoPersistReader; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.Map; + +/** + * Copies documents into a new index + */ +public class MongoElasticsearchSync implements Runnable { + + public final static String STREAMS_ID = "MongoElasticsearchSync"; + + private final static Logger LOGGER = LoggerFactory.getLogger(MongoElasticsearchSync.class); + + MongoElasticsearchSyncConfiguration config; + + public MongoElasticsearchSync() { + this(new ComponentConfigurator<MongoElasticsearchSyncConfiguration>(MongoElasticsearchSyncConfiguration.class).detectConfiguration(StreamsConfigurator.getConfig())); + } + + public MongoElasticsearchSync(MongoElasticsearchSyncConfiguration config) { + this.config = config; + } + + public static void main(String[] args) + { + LOGGER.info(StreamsConfigurator.config.toString()); + + MongoElasticsearchSync sync = new MongoElasticsearchSync(); + + new Thread(sync).start(); + + } + + @Override + public void run() { + + MongoPersistReader mongoPersistReader = new MongoPersistReader(config.getSource()); + + ElasticsearchPersistWriter elasticsearchPersistWriter = new ElasticsearchPersistWriter(config.getDestination()); + + Map<String, Object> streamConfig = Maps.newHashMap(); + streamConfig.put(LocalStreamBuilder.STREAM_IDENTIFIER_KEY, STREAMS_ID); + streamConfig.put(LocalStreamBuilder.TIMEOUT_KEY, 7 * 24 * 60 * 1000); + StreamBuilder builder = new LocalStreamBuilder(1000, streamConfig); + + builder.newPerpetualStream(MongoPersistReader.STREAMS_ID, mongoPersistReader); + builder.addStreamsPersistWriter(ElasticsearchPersistWriter.STREAMS_ID, elasticsearchPersistWriter, 1, MongoPersistReader.STREAMS_ID); + builder.start(); + } +} http://git-wip-us.apache.org/repos/asf/incubator-streams-examples/blob/5b96588c/local/mongo-elasticsearch-sync/src/main/jsonschema/MongoElasticsearchSyncConfiguration.json ---------------------------------------------------------------------- diff --git a/local/mongo-elasticsearch-sync/src/main/jsonschema/MongoElasticsearchSyncConfiguration.json b/local/mongo-elasticsearch-sync/src/main/jsonschema/MongoElasticsearchSyncConfiguration.json index 8f9fed2..0065468 100644 --- a/local/mongo-elasticsearch-sync/src/main/jsonschema/MongoElasticsearchSyncConfiguration.json +++ b/local/mongo-elasticsearch-sync/src/main/jsonschema/MongoElasticsearchSyncConfiguration.json @@ -4,7 +4,7 @@ "http://www.apache.org/licenses/LICENSE-2.0" ], "type": "object", - "javaType" : "org.apache.streams.example.elasticsearch.MongoElasticsearchSyncConfiguration", + "javaType" : "org.apache.streams.example.MongoElasticsearchSyncConfiguration", "javaInterfaces": ["java.io.Serializable"], "properties": { "source": { "javaType": "org.apache.streams.mongo.MongoConfiguration", "type": "object", "required": true }, http://git-wip-us.apache.org/repos/asf/incubator-streams-examples/blob/5b96588c/local/mongo-elasticsearch-sync/src/test/java/org/apache/streams/example/mongodb/test/MongoElasticsearchSyncIT.java ---------------------------------------------------------------------- diff --git a/local/mongo-elasticsearch-sync/src/test/java/org/apache/streams/example/mongodb/test/MongoElasticsearchSyncIT.java b/local/mongo-elasticsearch-sync/src/test/java/org/apache/streams/example/mongodb/test/MongoElasticsearchSyncIT.java deleted file mode 100644 index 5ebc204..0000000 --- a/local/mongo-elasticsearch-sync/src/test/java/org/apache/streams/example/mongodb/test/MongoElasticsearchSyncIT.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.streams.example.mongodb.test; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.typesafe.config.Config; -import com.typesafe.config.ConfigFactory; -import com.typesafe.config.ConfigParseOptions; -import org.apache.commons.io.Charsets; -import org.apache.commons.io.IOUtils; -import org.apache.streams.config.ComponentConfigurator; -import org.apache.streams.config.StreamsConfiguration; -import org.apache.streams.config.StreamsConfigurator; -import org.apache.streams.core.StreamsDatum; -import org.apache.streams.elasticsearch.ElasticsearchClientManager; -import org.apache.streams.elasticsearch.example.MongoElasticsearchSync; -import org.apache.streams.example.elasticsearch.MongoElasticsearchSyncConfiguration; -import org.apache.streams.jackson.StreamsJacksonMapper; -import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest; -import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; -import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsRequest; -import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsResponse; -import org.elasticsearch.action.search.SearchRequestBuilder; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.client.Client; -import org.elasticsearch.client.Requests; -import org.elasticsearch.cluster.health.ClusterHealthStatus; -import org.junit.Before; -import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.File; -import java.io.FileInputStream; -import java.io.InputStream; -import java.util.List; -import java.util.Properties; - -import static junit.framework.TestCase.assertTrue; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotEquals; - -/** - * Test copying documents between two indexes on same cluster - */ -public class MongoElasticsearchSyncIT { - - private final static Logger LOGGER = LoggerFactory.getLogger(MongoElasticsearchSyncIT.class); - - ObjectMapper MAPPER = StreamsJacksonMapper.getInstance(); - - protected MongoElasticsearchSyncConfiguration testConfiguration; - protected Client testClient; - - @Before - public void prepareTest() throws Exception { - - Config reference = ConfigFactory.load(); - File conf_file = new File("target/test-classes/MongoElasticsearchSyncIT.conf"); - assert(conf_file.exists()); - Config testResourceConfig = ConfigFactory.parseFileAnySyntax(conf_file, ConfigParseOptions.defaults().setAllowMissing(false)); - Properties mongo_properties = new Properties(); - InputStream mongo_stream = new FileInputStream("mongo.properties"); - mongo_properties.load(mongo_stream); - Config mongoProps = ConfigFactory.parseProperties(mongo_properties); - Properties es_properties = new Properties(); - InputStream es_stream = new FileInputStream("elasticsearch.properties"); - es_properties.load(es_stream); - Config esProps = ConfigFactory.parseProperties(es_properties); - Config typesafe = testResourceConfig.withFallback(mongoProps).withFallback(esProps).withFallback(reference).resolve(); - StreamsConfiguration streams = StreamsConfigurator.detectConfiguration(typesafe); - testConfiguration = new ComponentConfigurator<>(MongoElasticsearchSyncConfiguration.class).detectConfiguration(typesafe); - testClient = new ElasticsearchClientManager(testConfiguration.getDestination()).getClient(); - - ClusterHealthRequest clusterHealthRequest = Requests.clusterHealthRequest(); - ClusterHealthResponse clusterHealthResponse = testClient.admin().cluster().health(clusterHealthRequest).actionGet(); - assertNotEquals(clusterHealthResponse.getStatus(), ClusterHealthStatus.RED); - - IndicesExistsRequest indicesExistsRequest = Requests.indicesExistsRequest(testConfiguration.getDestination().getIndex()); - IndicesExistsResponse indicesExistsResponse = testClient.admin().indices().exists(indicesExistsRequest).actionGet(); - assertFalse(indicesExistsResponse.isExists()); - } - - @Test - public void testSync() throws Exception { - - MongoElasticsearchSync sync = new MongoElasticsearchSync(testConfiguration); - - sync.run(); - - IndicesExistsRequest indicesExistsRequest = Requests.indicesExistsRequest(testConfiguration.getDestination().getIndex()); - IndicesExistsResponse indicesExistsResponse = testClient.admin().indices().exists(indicesExistsRequest).actionGet(); - assertTrue(indicesExistsResponse.isExists()); - - // assert lines in file - SearchRequestBuilder countRequest = testClient - .prepareSearch(testConfiguration.getDestination().getIndex()) - .setTypes(testConfiguration.getDestination().getType()); - SearchResponse countResponse = countRequest.execute().actionGet(); - - assertEquals(89, (int)countResponse.getHits().getTotalHits()); - - } -} http://git-wip-us.apache.org/repos/asf/incubator-streams-examples/blob/5b96588c/local/mongo-elasticsearch-sync/src/test/java/org/apache/streams/example/mongodb/test/SyncITs.java ---------------------------------------------------------------------- diff --git a/local/mongo-elasticsearch-sync/src/test/java/org/apache/streams/example/mongodb/test/SyncITs.java b/local/mongo-elasticsearch-sync/src/test/java/org/apache/streams/example/mongodb/test/SyncITs.java deleted file mode 100644 index 7ba67a5..0000000 --- a/local/mongo-elasticsearch-sync/src/test/java/org/apache/streams/example/mongodb/test/SyncITs.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.apache.streams.example.mongodb.test; - -import org.apache.streams.mongo.test.MongoPersistIT; -import org.junit.runner.RunWith; -import org.junit.runners.Suite; - -@RunWith(Suite.class) [email protected]({ - MongoPersistIT.class, - MongoElasticsearchSyncIT.class -}) - -public class SyncITs { - // the class remains empty, - // used only as a holder for the above annotations -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-streams-examples/blob/5b96588c/local/mongo-elasticsearch-sync/src/test/java/org/apache/streams/example/test/MongoElasticsearchSyncIT.java ---------------------------------------------------------------------- diff --git a/local/mongo-elasticsearch-sync/src/test/java/org/apache/streams/example/test/MongoElasticsearchSyncIT.java b/local/mongo-elasticsearch-sync/src/test/java/org/apache/streams/example/test/MongoElasticsearchSyncIT.java new file mode 100644 index 0000000..47851f3 --- /dev/null +++ b/local/mongo-elasticsearch-sync/src/test/java/org/apache/streams/example/test/MongoElasticsearchSyncIT.java @@ -0,0 +1,117 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.streams.example.test; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.typesafe.config.Config; +import com.typesafe.config.ConfigFactory; +import com.typesafe.config.ConfigParseOptions; +import org.apache.streams.config.ComponentConfigurator; +import org.apache.streams.config.StreamsConfiguration; +import org.apache.streams.config.StreamsConfigurator; +import org.apache.streams.elasticsearch.ElasticsearchClientManager; +import org.apache.streams.example.MongoElasticsearchSync; +import org.apache.streams.example.MongoElasticsearchSyncConfiguration; +import org.apache.streams.jackson.StreamsJacksonMapper; +import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest; +import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; +import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsRequest; +import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsResponse; +import org.elasticsearch.action.search.SearchRequestBuilder; +import org.elasticsearch.action.search.SearchResponse; +import org.elasticsearch.client.Client; +import org.elasticsearch.client.Requests; +import org.elasticsearch.cluster.health.ClusterHealthStatus; +import org.junit.Before; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStream; +import java.util.Properties; + +import static junit.framework.TestCase.assertTrue; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotEquals; + +/** + * Test copying documents between two indexes on same cluster + */ +public class MongoElasticsearchSyncIT { + + private final static Logger LOGGER = LoggerFactory.getLogger(MongoElasticsearchSyncIT.class); + + ObjectMapper MAPPER = StreamsJacksonMapper.getInstance(); + + protected MongoElasticsearchSyncConfiguration testConfiguration; + protected Client testClient; + + @Before + public void prepareTest() throws Exception { + + Config reference = ConfigFactory.load(); + File conf_file = new File("target/test-classes/MongoElasticsearchSyncIT.conf"); + assert(conf_file.exists()); + Config testResourceConfig = ConfigFactory.parseFileAnySyntax(conf_file, ConfigParseOptions.defaults().setAllowMissing(false)); + Properties mongo_properties = new Properties(); + InputStream mongo_stream = new FileInputStream("mongo.properties"); + mongo_properties.load(mongo_stream); + Config mongoProps = ConfigFactory.parseProperties(mongo_properties); + Properties es_properties = new Properties(); + InputStream es_stream = new FileInputStream("elasticsearch.properties"); + es_properties.load(es_stream); + Config esProps = ConfigFactory.parseProperties(es_properties); + Config typesafe = testResourceConfig.withFallback(mongoProps).withFallback(esProps).withFallback(reference).resolve(); + StreamsConfiguration streams = StreamsConfigurator.detectConfiguration(typesafe); + testConfiguration = new ComponentConfigurator<>(MongoElasticsearchSyncConfiguration.class).detectConfiguration(typesafe); + testClient = new ElasticsearchClientManager(testConfiguration.getDestination()).getClient(); + + ClusterHealthRequest clusterHealthRequest = Requests.clusterHealthRequest(); + ClusterHealthResponse clusterHealthResponse = testClient.admin().cluster().health(clusterHealthRequest).actionGet(); + assertNotEquals(clusterHealthResponse.getStatus(), ClusterHealthStatus.RED); + + IndicesExistsRequest indicesExistsRequest = Requests.indicesExistsRequest(testConfiguration.getDestination().getIndex()); + IndicesExistsResponse indicesExistsResponse = testClient.admin().indices().exists(indicesExistsRequest).actionGet(); + assertFalse(indicesExistsResponse.isExists()); + } + + @Test + public void testSync() throws Exception { + + MongoElasticsearchSync sync = new MongoElasticsearchSync(testConfiguration); + + sync.run(); + + IndicesExistsRequest indicesExistsRequest = Requests.indicesExistsRequest(testConfiguration.getDestination().getIndex()); + IndicesExistsResponse indicesExistsResponse = testClient.admin().indices().exists(indicesExistsRequest).actionGet(); + assertTrue(indicesExistsResponse.isExists()); + + // assert lines in file + SearchRequestBuilder countRequest = testClient + .prepareSearch(testConfiguration.getDestination().getIndex()) + .setTypes(testConfiguration.getDestination().getType()); + SearchResponse countResponse = countRequest.execute().actionGet(); + + assertEquals(89, (int)countResponse.getHits().getTotalHits()); + + } +} http://git-wip-us.apache.org/repos/asf/incubator-streams-examples/blob/5b96588c/local/mongo-elasticsearch-sync/src/test/java/org/apache/streams/example/test/SyncITs.java ---------------------------------------------------------------------- diff --git a/local/mongo-elasticsearch-sync/src/test/java/org/apache/streams/example/test/SyncITs.java b/local/mongo-elasticsearch-sync/src/test/java/org/apache/streams/example/test/SyncITs.java new file mode 100644 index 0000000..cb8af91 --- /dev/null +++ b/local/mongo-elasticsearch-sync/src/test/java/org/apache/streams/example/test/SyncITs.java @@ -0,0 +1,16 @@ +package org.apache.streams.example.test; + +import org.apache.streams.mongo.test.MongoPersistIT; +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +@RunWith(Suite.class) [email protected]({ + MongoPersistIT.class, + MongoElasticsearchSyncIT.class +}) + +public class SyncITs { + // the class remains empty, + // used only as a holder for the above annotations +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-streams-examples/blob/5b96588c/local/mongo-elasticsearch-sync/src/test/resources/testSync.json ---------------------------------------------------------------------- diff --git a/local/mongo-elasticsearch-sync/src/test/resources/testSync.json b/local/mongo-elasticsearch-sync/src/test/resources/testSync.json deleted file mode 100644 index 8a77262..0000000 --- a/local/mongo-elasticsearch-sync/src/test/resources/testSync.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "$license": [ - "http://www.apache.org/licenses/LICENSE-2.0" - ], - "source": { - "host": "localhost", - "port": 37017, - "db": "local", - "collection": "activities" - }, - "destination": { - "hosts": [ - "localhost" - ], - "port": 9300, - "clusterName": "elasticsearch", - "index": "destination", - "type": "activity", - "forceUseConfig": true - } -} http://git-wip-us.apache.org/repos/asf/incubator-streams-examples/blob/5b96588c/local/pom.xml ---------------------------------------------------------------------- diff --git a/local/pom.xml b/local/pom.xml index fbde938..e515606 100644 --- a/local/pom.xml +++ b/local/pom.xml @@ -42,12 +42,9 @@ <module>elasticsearch-hdfs</module> <module>elasticsearch-reindex</module> <module>mongo-elasticsearch-sync</module> - <module>twitter-follow-graph</module> + <module>twitter-follow-neo4j</module> <module>twitter-history-elasticsearch</module> <module>twitter-userstream-elasticsearch</module> </modules> - <build> - - </build> </project> http://git-wip-us.apache.org/repos/asf/incubator-streams-examples/blob/5b96588c/local/twitter-follow-graph/README.md ---------------------------------------------------------------------- diff --git a/local/twitter-follow-graph/README.md b/local/twitter-follow-graph/README.md deleted file mode 100644 index 3e63a53..0000000 --- a/local/twitter-follow-graph/README.md +++ /dev/null @@ -1,8 +0,0 @@ -Apache Streams (incubating) -Licensed under Apache License 2.0 - http://www.apache.org/licenses/LICENSE-2.0 --------------------------------------------------------------------------------- - -org.apache.streams:twitter-follow-graph -======================================= - -[README.md](src/site/markdown/index.md "README") http://git-wip-us.apache.org/repos/asf/incubator-streams-examples/blob/5b96588c/local/twitter-follow-graph/pom.xml ---------------------------------------------------------------------- diff --git a/local/twitter-follow-graph/pom.xml b/local/twitter-follow-graph/pom.xml deleted file mode 100644 index 4ce6a64..0000000 --- a/local/twitter-follow-graph/pom.xml +++ /dev/null @@ -1,316 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. ---> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <parent> - <groupId>org.apache.streams</groupId> - <artifactId>streams-examples-local</artifactId> - <version>0.4-incubating-SNAPSHOT</version> - <relativePath>..</relativePath> - </parent> - <modelVersion>4.0.0</modelVersion> - - <artifactId>twitter-follow-graph</artifactId> - <name>twitter-follow-graph</name> - - <description> - Collects friend or follower connections for a set of twitter users to build a graph database in neo4j. - </description> - - <properties> - <docker.repo>apachestreams</docker.repo> - </properties> - - <dependencies> - <dependency> - <groupId>com.typesafe</groupId> - <artifactId>config</artifactId> - </dependency> - <dependency> - <groupId>org.apache.streams</groupId> - <artifactId>streams-core</artifactId> - </dependency> - <dependency> - <groupId>org.apache.streams</groupId> - <artifactId>streams-config</artifactId> - <version>0.4-incubating-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.apache.streams</groupId> - <artifactId>streams-runtime-local</artifactId> - <version>0.4-incubating-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.apache.streams</groupId> - <artifactId>streams-provider-twitter</artifactId> - <version>0.4-incubating-SNAPSHOT</version> - <exclusions> - <exclusion> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.apache.streams</groupId> - <artifactId>streams-persist-graph</artifactId> - <version>0.4-incubating-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.apache.streams</groupId> - <artifactId>streams-pojo</artifactId> - <version>0.4-incubating-SNAPSHOT</version> - <type>test-jar</type> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>log4j-over-slf4j</artifactId> - <version>${slf4j.version}</version> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>jcl-over-slf4j</artifactId> - <version>${slf4j.version}</version> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>jul-to-slf4j</artifactId> - <version>${slf4j.version}</version> - </dependency> - <dependency> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-classic</artifactId> - <version>${logback.version}</version> - </dependency> - <dependency> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-core</artifactId> - <version>${logback.version}</version> - </dependency> - </dependencies> - - <build> - <sourceDirectory>src/main/java</sourceDirectory> - <testSourceDirectory>src/test/java</testSourceDirectory> - <resources> - <resource> - <directory>src/main/resources</directory> - </resource> - </resources> - <testResources> - <testResource> - <directory>src/test/resources</directory> - </testResource> - </testResources> - <plugins> - <!-- This binary runs with logback --> - <!-- Keep log4j out --> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-enforcer-plugin</artifactId> - <version>1.3.1</version> - <executions> - <execution> - <id>enforce-banned-dependencies</id> - <goals> - <goal>enforce</goal> - </goals> - <configuration> - <rules> - <bannedDependencies> - <excludes> - <exclude>org.slf4j:slf4j-log4j12</exclude> - <exclude>org.slf4j:slf4j-jcl</exclude> - <exclude>org.slf4j:slf4j-jdk14</exclude> - <exclude>org.log4j:log4j</exclude> - <exclude>commons-logging:commons-logging</exclude> - </excludes> - </bannedDependencies> - </rules> - <fail>true</fail> - </configuration> - </execution> - </executions> - </plugin> - <plugin> - <artifactId>maven-clean-plugin</artifactId> - <configuration> - <filesets> - <fileset> - <directory>data</directory> - <followSymlinks>false</followSymlinks> - </fileset> - </filesets> - </configuration> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-shade-plugin</artifactId> - </plugin> - <plugin> - <groupId>org.jsonschema2pojo</groupId> - <artifactId>jsonschema2pojo-maven-plugin</artifactId> - <version>0.4.6</version> - <configuration> - <addCompileSourceRoot>true</addCompileSourceRoot> - <generateBuilders>true</generateBuilders> - <sourcePaths> - <sourcePath>src/main/jsonschema</sourcePath> - </sourcePaths> - <outputDirectory>target/generated-sources/jsonschema2pojo</outputDirectory> - <targetPackage>org.apache.streams.example.elasticsearch</targetPackage> - <useJodaDates>false</useJodaDates> - </configuration> - <executions> - <execution> - <goals> - <goal>generate</goal> - </goals> - </execution> - </executions> - </plugin> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>build-helper-maven-plugin</artifactId> - <executions> - <execution> - <id>add-source</id> - <phase>generate-sources</phase> - <goals> - <goal>add-source</goal> - </goals> - <configuration> - <sources> - <source>target/generated-sources/jsonschema2pojo</source> - </sources> - </configuration> - </execution> - </executions> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-dependency-plugin</artifactId> - <version>2.4</version> - <executions> - <execution> - <id>resource-dependencies</id> - <phase>process-test-resources</phase> - <goals> - <goal>unpack-dependencies</goal> - </goals> - <configuration> - <includeArtifactIds>streams-pojo</includeArtifactIds> - <includes>**/*.json</includes> - <outputDirectory>${project.build.directory}/test-classes</outputDirectory> - </configuration> - </execution> - </executions> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-failsafe-plugin</artifactId> - <version>2.12.4</version> - <executions> - <execution> - <id>integration-tests</id> - <goals> - <goal>integration-test</goal> - <goal>verify</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> - - <profiles> - <profile> - <id>dockerITs</id> - <activation> - <activeByDefault>false</activeByDefault> - <property> - <name>skipITs</name> - <value>false</value> - </property> - </activation> - <build> - <plugins> - <plugin> - <groupId>io.fabric8</groupId> - <artifactId>docker-maven-plugin</artifactId> - <version>${docker.plugin.version}</version> - <configuration combine.self="override"> - <watchInterval>500</watchInterval> - <logDate>default</logDate> - <verbose>true</verbose> - <autoPull>on</autoPull> - <images> - <image> - <name>neo4j</name> - <alias>graph</alias> - <run> - <env> - <NEO4J_AUTH>none</NEO4J_AUTH> - </env> - <namingStrategy>none</namingStrategy> - <ports> - <port>${graph.http.host}:${graph.http.port}:7474</port> - <port>${graph.tcp.host}:${graph.tcp.port}:7687</port> - </ports> - <portPropertyFile>graph.properties</portPropertyFile> - <wait> - <log>graph startup</log> - <http> - <url>http://${graph.http.host}:${graph.http.port}</url> - <method>GET</method> - <status>200</status> - </http> - <time>20000</time> - <kill>1000</kill> - <shutdown>500</shutdown> - <!--<tcp>--> - <!--<host>${es.transport.host}</host>--> - <!--<ports>--> - <!--<port>${es.transport.port}</port>--> - <!--</ports>--> - <!--</tcp>--> - </wait> - <log> - <enabled>true</enabled> - <date>default</date> - <color>cyan</color> - </log> - </run> - <watch> - <mode>none</mode> - </watch> - </image> - - </images> - </configuration> - - </plugin> - - </plugins> - </build> - - </profile> - </profiles> - -</project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-streams-examples/blob/5b96588c/local/twitter-follow-graph/src/main/java/org/apache/streams/example/graph/TwitterFollowGraph.java ---------------------------------------------------------------------- diff --git a/local/twitter-follow-graph/src/main/java/org/apache/streams/example/graph/TwitterFollowGraph.java b/local/twitter-follow-graph/src/main/java/org/apache/streams/example/graph/TwitterFollowGraph.java deleted file mode 100644 index 11c52bb..0000000 --- a/local/twitter-follow-graph/src/main/java/org/apache/streams/example/graph/TwitterFollowGraph.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.streams.example.graph; - -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; -import org.apache.streams.config.ComponentConfigurator; -import org.apache.streams.config.StreamsConfiguration; -import org.apache.streams.config.StreamsConfigurator; -import org.apache.streams.converter.ActivityConverterProcessor; -import org.apache.streams.converter.ActivityConverterProcessorConfiguration; -import org.apache.streams.converter.TypeConverterProcessor; -import org.apache.streams.core.StreamBuilder; -import org.apache.streams.data.ActivityConverter; -import org.apache.streams.data.DocumentClassifier; -import org.apache.streams.graph.GraphHttpConfiguration; -import org.apache.streams.graph.GraphHttpPersistWriter; -import org.apache.streams.local.builders.LocalStreamBuilder; -import org.apache.streams.twitter.TwitterFollowingConfiguration; -import org.apache.streams.twitter.TwitterUserInformationConfiguration; -import org.apache.streams.twitter.converter.TwitterFollowActivityConverter; -import org.apache.streams.twitter.pojo.Follow; -import org.apache.streams.twitter.provider.TwitterFollowingProvider; -import org.apache.streams.twitter.converter.TwitterDocumentClassifier; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.Map; - -/** - * Collects friend and follow connections for a set of twitter users and builds a graph - * database in neo4j. - */ -public class TwitterFollowGraph implements Runnable { - - private final static Logger LOGGER = LoggerFactory.getLogger(TwitterFollowGraph.class); - - TwitterFollowGraphConfiguration config; - - public TwitterFollowGraph() { - this(new ComponentConfigurator<>(TwitterFollowGraphConfiguration.class).detectConfiguration(StreamsConfigurator.getConfig())); - } - - public TwitterFollowGraph(TwitterFollowGraphConfiguration config) { - this.config = config; - } - - public void run() { - - TwitterFollowingConfiguration twitterFollowingConfiguration = config.getTwitter(); - TwitterFollowingProvider followingProvider = new TwitterFollowingProvider(twitterFollowingConfiguration); - TypeConverterProcessor converter = new TypeConverterProcessor(String.class); - - ActivityConverterProcessorConfiguration activityConverterProcessorConfiguration = - new ActivityConverterProcessorConfiguration() - .withClassifiers(Lists.newArrayList((DocumentClassifier) new TwitterDocumentClassifier())) - .withConverters(Lists.newArrayList((ActivityConverter) new TwitterFollowActivityConverter())); - ActivityConverterProcessor activity = new ActivityConverterProcessor(activityConverterProcessorConfiguration); - - GraphHttpConfiguration graphWriterConfiguration = config.getGraph(); - GraphHttpPersistWriter graphPersistWriter = new GraphHttpPersistWriter(graphWriterConfiguration); - - StreamBuilder builder = new LocalStreamBuilder(); - builder.newPerpetualStream(TwitterFollowingProvider.STREAMS_ID, followingProvider); - builder.addStreamsProcessor("converter", converter, 1, TwitterFollowingProvider.STREAMS_ID); - builder.addStreamsProcessor("activity", activity, 1, "converter"); - builder.addStreamsPersistWriter("graph", graphPersistWriter, 1, "activity"); - - builder.start(); - } - - public static void main(String[] args) { - - LOGGER.info(StreamsConfigurator.config.toString()); - - TwitterFollowGraph stream = new TwitterFollowGraph(); - - stream.run(); - - LOGGER.info(StreamsConfigurator.config.toString()); - - StreamsConfiguration streams = StreamsConfigurator.detectConfiguration(); - - - } - -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-streams-examples/blob/5b96588c/local/twitter-follow-graph/src/main/jsonschema/TwitterFollowGraphConfiguration.json ---------------------------------------------------------------------- diff --git a/local/twitter-follow-graph/src/main/jsonschema/TwitterFollowGraphConfiguration.json b/local/twitter-follow-graph/src/main/jsonschema/TwitterFollowGraphConfiguration.json deleted file mode 100644 index f9c4ac1..0000000 --- a/local/twitter-follow-graph/src/main/jsonschema/TwitterFollowGraphConfiguration.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-03/schema", - "$license": [ - "http://www.apache.org/licenses/LICENSE-2.0" - ], - "type": "object", - "javaType" : "org.apache.streams.example.graph.TwitterFollowGraphConfiguration", - "javaInterfaces": ["java.io.Serializable"], - "properties": { - "twitter": { "javaType": "org.apache.streams.twitter.TwitterFollowingConfiguration", "type": "object", "required": true }, - "graph": { "javaType": "org.apache.streams.graph.GraphHttpConfiguration", "type": "object", "required": true } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-streams-examples/blob/5b96588c/local/twitter-follow-graph/src/main/resources/TwitterFollowGraph.dot ---------------------------------------------------------------------- diff --git a/local/twitter-follow-graph/src/main/resources/TwitterFollowGraph.dot b/local/twitter-follow-graph/src/main/resources/TwitterFollowGraph.dot deleted file mode 100644 index 2d9e495..0000000 --- a/local/twitter-follow-graph/src/main/resources/TwitterFollowGraph.dot +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - digraph g { - - //providers - TwitterFollowingProvider [label="TwitterFollowingProvider",shape=ellipse,URL="https://github.com/apache/incubator-streams/blob/master/streams-contrib/streams-provider-twitter/src/main/java/org/apache/streams/twitter/provider/TwitterFollowingProvider.java"]; - - //processors - TypeConverterProcessor [label="TypeConverterProcessor",shape=ellipse,URL="https://github.com/apache/incubator-streams/blob/master/streams-components/streams-converters/src/main/java/org/apache/streams/converters/TypeConverterProcessor.java"]; - ActivityConverterProcessor [label="ActivityConverterProcessor",shape=ellipse,URL="https://github.com/apache/incubator-streams/blob/master/streams-components/streams-converters/src/main/java/org/apache/streams/converters/ActivityConverterProcessor.java"]; - - //persisters - GraphPersistWriter [label="GraphPersistWriter",shape=ellipse,URL="https://github.com/apache/incubator-streams/blob/master/streams-contrib/streams-persist-graph/src/main/java/org/apache/streams/graph/GraphPersistWriter.java"]; - - //data - destination [label="http://{host}:{port}/db/data",shape=box]; - - //stream - TwitterFollowingProvider -> TypeConverterProcessor [label="Follow",URL="https://github.com/apache/incubator-streams/blob/master/streams-contrib/streams-provider-twitter/src/main/jsonschema/com/twitter/Follow.java"]; - TypeConverterProcessor -> ActivityConverterProcessor [label="String"]; - ActivityConverterProcessor -> GraphPersistWriter [label="Activity",URL="https://github.com/apache/incubator-streams/blob/master/streams-pojo/src/main/jsonschema/org/apache/streams/pojo/json/activity.json"]; - GraphPersistWriter -> destination -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-streams-examples/blob/5b96588c/local/twitter-follow-graph/src/site/markdown/index.md ---------------------------------------------------------------------- diff --git a/local/twitter-follow-graph/src/site/markdown/index.md b/local/twitter-follow-graph/src/site/markdown/index.md deleted file mode 100644 index 3991688..0000000 --- a/local/twitter-follow-graph/src/site/markdown/index.md +++ /dev/null @@ -1,75 +0,0 @@ -twitter-follow-graph -============================== - -Requirements: -------------- - - Authorized Twitter API credentials - - A running Neo4J 1.9.0+ instance - -Description: ------------- -Collects friend or follower connections for a set of twitter users to build a graph database in neo4j. - -Specification: ------------------ - -[TwitterFollowGraph.dot](TwitterFollowGraph.dot "TwitterFollowGraph.dot" ) - -Diagram: ------------------ - - - -Example Configuration: ----------------------- - -[testGraph.json](testGraph.json "testGraph.json" ) - -Build: ---------- - - mvn clean package verify - -Test: ------ -Create a local file `application.conf` with valid twitter credentials - - twitter { - oauth { - consumerKey = "" - consumerSecret = "" - accessToken = "" - accessTokenSecret = "" - } - } - -Start up neo4j with docker: - - mvn -PdockerITs docker:start - -Build with integration testing enabled, using your credentials - - mvn clean test verify -DskipITs=false -DargLine="-Dconfig.file=`pwd`/application.conf" - -Shutdown neo4j when finished: - - mvn -PdockerITs docker:stop - -Run (Local): ------------- - - java -cp dist/twitter-follow-graph-jar-with-dependencies.jar -Dconfig.file=file://<location_of_config_file> org.apache.streams.example.graph.TwitterFollowGraph - -Deploy (Docker): ----------------- - - mvn -Pdocker -Ddocker.repo=<your docker host>:<your docker repo> docker:build docker:push - -Run (Docker): -------------- - - docker run twitter-follow-graph java -cp twitter-follow-graph-jar-with-dependencies.jar -Dconfig.url=http://<location_of_config_file> org.apache.streams.elasticsearch.example.TwitterFollowGraph - -[JavaDocs](apidocs/index.html "JavaDocs") - -###### Licensed under Apache License 2.0 - http://www.apache.org/licenses/LICENSE-2.0 http://git-wip-us.apache.org/repos/asf/incubator-streams-examples/blob/5b96588c/local/twitter-follow-graph/src/test/java/org/apache/streams/twitter/example/TwitterFollowGraphIT.java ---------------------------------------------------------------------- diff --git a/local/twitter-follow-graph/src/test/java/org/apache/streams/twitter/example/TwitterFollowGraphIT.java b/local/twitter-follow-graph/src/test/java/org/apache/streams/twitter/example/TwitterFollowGraphIT.java deleted file mode 100644 index c5254fe..0000000 --- a/local/twitter-follow-graph/src/test/java/org/apache/streams/twitter/example/TwitterFollowGraphIT.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.streams.twitter.example; - -import com.typesafe.config.Config; -import com.typesafe.config.ConfigFactory; -import com.typesafe.config.ConfigParseOptions; -import org.apache.streams.config.ComponentConfigurator; -import org.apache.streams.config.StreamsConfiguration; -import org.apache.streams.config.StreamsConfigurator; -import org.apache.streams.example.graph.TwitterFollowGraph; -import org.apache.streams.example.graph.TwitterFollowGraphConfiguration; -import org.junit.Before; -import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.File; -import java.io.FileInputStream; -import java.io.InputStream; -import java.util.Properties; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotEquals; - -/** - * Example stream that populates elasticsearch with activities from twitter userstream in real-time - */ -public class TwitterFollowGraphIT { - - private final static Logger LOGGER = LoggerFactory.getLogger(TwitterFollowGraphIT.class); - - protected TwitterFollowGraphConfiguration testConfiguration; - - private int count = 0; - - @Before - public void prepareTest() throws Exception { - - Config reference = ConfigFactory.load(); - File conf_file = new File("target/test-classes/TwitterFollowGraphIT.conf"); - assert(conf_file.exists()); - Config testResourceConfig = ConfigFactory.parseFileAnySyntax(conf_file, ConfigParseOptions.defaults().setAllowMissing(false)); - Properties graph_properties = new Properties(); - InputStream graph_stream = new FileInputStream("graph.properties"); - graph_properties.load(graph_stream); - Config graphProps = ConfigFactory.parseProperties(graph_properties); - Config typesafe = testResourceConfig.withFallback(graphProps).withFallback(reference).resolve(); - StreamsConfiguration streams = StreamsConfigurator.detectConfiguration(typesafe); - testConfiguration = new ComponentConfigurator<>(TwitterFollowGraphConfiguration.class).detectConfiguration(typesafe); - - } - - @Test - public void testTwitterFollowGraph() throws Exception { - - TwitterFollowGraph stream = new TwitterFollowGraph(testConfiguration); - - stream.run(); - - } - -} http://git-wip-us.apache.org/repos/asf/incubator-streams-examples/blob/5b96588c/local/twitter-follow-graph/src/test/resources/TwitterFollowGraphIT.conf ---------------------------------------------------------------------- diff --git a/local/twitter-follow-graph/src/test/resources/TwitterFollowGraphIT.conf b/local/twitter-follow-graph/src/test/resources/TwitterFollowGraphIT.conf deleted file mode 100644 index ecd4fd4..0000000 --- a/local/twitter-follow-graph/src/test/resources/TwitterFollowGraphIT.conf +++ /dev/null @@ -1,28 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -twitter { - endpoint = "friends" - info = [ - 18055613 - ] - twitter.max_items = 1000 -} -graph { - hostname = ${graph.http.host} - port = ${graph.http.port} - type = "neo4j" - graph = "data" -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-streams-examples/blob/5b96588c/local/twitter-follow-neo4j/README.md ---------------------------------------------------------------------- diff --git a/local/twitter-follow-neo4j/README.md b/local/twitter-follow-neo4j/README.md new file mode 100644 index 0000000..3e63a53 --- /dev/null +++ b/local/twitter-follow-neo4j/README.md @@ -0,0 +1,8 @@ +Apache Streams (incubating) +Licensed under Apache License 2.0 - http://www.apache.org/licenses/LICENSE-2.0 +-------------------------------------------------------------------------------- + +org.apache.streams:twitter-follow-graph +======================================= + +[README.md](src/site/markdown/index.md "README") http://git-wip-us.apache.org/repos/asf/incubator-streams-examples/blob/5b96588c/local/twitter-follow-neo4j/dist/twitter-follow-graph-jar-with-dependencies.jar ---------------------------------------------------------------------- diff --git a/local/twitter-follow-neo4j/dist/twitter-follow-graph-jar-with-dependencies.jar b/local/twitter-follow-neo4j/dist/twitter-follow-graph-jar-with-dependencies.jar new file mode 100644 index 0000000..758e5cf Binary files /dev/null and b/local/twitter-follow-neo4j/dist/twitter-follow-graph-jar-with-dependencies.jar differ http://git-wip-us.apache.org/repos/asf/incubator-streams-examples/blob/5b96588c/local/twitter-follow-neo4j/pom.xml ---------------------------------------------------------------------- diff --git a/local/twitter-follow-neo4j/pom.xml b/local/twitter-follow-neo4j/pom.xml new file mode 100644 index 0000000..e644c3c --- /dev/null +++ b/local/twitter-follow-neo4j/pom.xml @@ -0,0 +1,316 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <parent> + <groupId>org.apache.streams</groupId> + <artifactId>streams-examples-local</artifactId> + <version>0.4-incubating-SNAPSHOT</version> + <relativePath>..</relativePath> + </parent> + <modelVersion>4.0.0</modelVersion> + + <artifactId>twitter-follow-graph</artifactId> + <name>twitter-follow-graph</name> + + <description> + Collects friend or follower connections for a set of twitter users to build a graph database in neo4j. + </description> + + <properties> + <docker.repo>apachestreams</docker.repo> + </properties> + + <dependencies> + <dependency> + <groupId>com.typesafe</groupId> + <artifactId>config</artifactId> + </dependency> + <dependency> + <groupId>org.apache.streams</groupId> + <artifactId>streams-core</artifactId> + </dependency> + <dependency> + <groupId>org.apache.streams</groupId> + <artifactId>streams-config</artifactId> + <version>0.4-incubating-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>org.apache.streams</groupId> + <artifactId>streams-runtime-local</artifactId> + <version>0.4-incubating-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>org.apache.streams</groupId> + <artifactId>streams-provider-twitter</artifactId> + <version>0.4-incubating-SNAPSHOT</version> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.apache.streams</groupId> + <artifactId>streams-persist-graph</artifactId> + <version>0.4-incubating-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>org.apache.streams</groupId> + <artifactId>streams-pojo</artifactId> + <version>0.4-incubating-SNAPSHOT</version> + <type>test-jar</type> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>log4j-over-slf4j</artifactId> + <version>${slf4j.version}</version> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>jcl-over-slf4j</artifactId> + <version>${slf4j.version}</version> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>jul-to-slf4j</artifactId> + <version>${slf4j.version}</version> + </dependency> + <dependency> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-classic</artifactId> + <version>${logback.version}</version> + </dependency> + <dependency> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-core</artifactId> + <version>${logback.version}</version> + </dependency> + </dependencies> + + <build> + <sourceDirectory>src/main/java</sourceDirectory> + <testSourceDirectory>src/test/java</testSourceDirectory> + <resources> + <resource> + <directory>src/main/resources</directory> + </resource> + </resources> + <testResources> + <testResource> + <directory>src/test/resources</directory> + </testResource> + </testResources> + <plugins> + <!-- This binary runs with logback --> + <!-- Keep log4j out --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-enforcer-plugin</artifactId> + <version>1.3.1</version> + <executions> + <execution> + <id>enforce-banned-dependencies</id> + <goals> + <goal>enforce</goal> + </goals> + <configuration> + <rules> + <bannedDependencies> + <excludes> + <exclude>org.slf4j:slf4j-log4j12</exclude> + <exclude>org.slf4j:slf4j-jcl</exclude> + <exclude>org.slf4j:slf4j-jdk14</exclude> + <exclude>org.log4j:log4j</exclude> + <exclude>commons-logging:commons-logging</exclude> + </excludes> + </bannedDependencies> + </rules> + <fail>true</fail> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-clean-plugin</artifactId> + <configuration> + <filesets> + <fileset> + <directory>data</directory> + <followSymlinks>false</followSymlinks> + </fileset> + </filesets> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-shade-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.jsonschema2pojo</groupId> + <artifactId>jsonschema2pojo-maven-plugin</artifactId> + <version>0.4.6</version> + <configuration> + <addCompileSourceRoot>true</addCompileSourceRoot> + <generateBuilders>true</generateBuilders> + <sourcePaths> + <sourcePath>src/main/jsonschema</sourcePath> + </sourcePaths> + <outputDirectory>target/generated-sources/jsonschema2pojo</outputDirectory> + <targetPackage>org.apache.streams.example.elasticsearch</targetPackage> + <useJodaDates>false</useJodaDates> + </configuration> + <executions> + <execution> + <goals> + <goal>generate</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + <executions> + <execution> + <id>add-source</id> + <phase>generate-sources</phase> + <goals> + <goal>add-source</goal> + </goals> + <configuration> + <sources> + <source>target/generated-sources/jsonschema2pojo</source> + </sources> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <version>2.4</version> + <executions> + <execution> + <id>resource-dependencies</id> + <phase>process-test-resources</phase> + <goals> + <goal>unpack-dependencies</goal> + </goals> + <configuration> + <includeArtifactIds>streams-pojo</includeArtifactIds> + <includes>**/*.json</includes> + <outputDirectory>${project.build.directory}/test-classes</outputDirectory> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-failsafe-plugin</artifactId> + <version>2.12.4</version> + <executions> + <execution> + <id>integration-tests</id> + <goals> + <goal>integration-test</goal> + <goal>verify</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + + <profiles> + <profile> + <id>dockerITs</id> + <activation> + <activeByDefault>false</activeByDefault> + <property> + <name>skipITs</name> + <value>false</value> + </property> + </activation> + <build> + <plugins> + <plugin> + <groupId>io.fabric8</groupId> + <artifactId>docker-maven-plugin</artifactId> + <version>${docker.plugin.version}</version> + <configuration combine.self="override"> + <watchInterval>500</watchInterval> + <logDate>default</logDate> + <verbose>true</verbose> + <autoPull>on</autoPull> + <images> + <image> + <name>neo4j</name> + <alias>graph</alias> + <run> + <env> + <NEO4J_AUTH>none</NEO4J_AUTH> + </env> + <namingStrategy>none</namingStrategy> + <ports> + <port>${neo4j.http.host}:${neo4j.http.port}:7474</port> + <port>${neo4j.tcp.host}:${neo4j.tcp.port}:7687</port> + </ports> + <portPropertyFile>neo4j.properties</portPropertyFile> + <wait> + <log>graph startup</log> + <http> + <url>http://${neo4j.http.host}:${neo4j.http.port}</url> + <method>GET</method> + <status>200</status> + </http> + <time>20000</time> + <kill>1000</kill> + <shutdown>500</shutdown> + <!--<tcp>--> + <!--<host>${es.transport.host}</host>--> + <!--<ports>--> + <!--<port>${es.transport.port}</port>--> + <!--</ports>--> + <!--</tcp>--> + </wait> + <log> + <enabled>true</enabled> + <date>default</date> + <color>cyan</color> + </log> + </run> + <watch> + <mode>none</mode> + </watch> + </image> + + </images> + </configuration> + + </plugin> + + </plugins> + </build> + + </profile> + </profiles> + +</project> \ No newline at end of file
