use of org.talend.components.elasticsearch.ElasticsearchDatastoreProperties in project components by Talend.
the class ElasticsearchDatastoreTestIT method createDatastoreProperties.
/**
* @return the properties for this datastore, fully initialized with the default values and credentials
* from the System environment.
*/
public static ElasticsearchDatastoreProperties createDatastoreProperties() {
// Configure the dataset.
ElasticsearchDatastoreProperties datastoreProps = new ElasticsearchDatastoreProperties(null);
datastoreProps.init();
datastoreProps.nodes.setValue(System.getProperty("es.hosts"));
return datastoreProps;
}
use of org.talend.components.elasticsearch.ElasticsearchDatastoreProperties in project components by Talend.
the class ElasticsearchDatastoreRuntimeTestIT method createDatastoreProp.
public static ElasticsearchDatastoreProperties createDatastoreProp() {
ElasticsearchDatastoreProperties datastore = new ElasticsearchDatastoreProperties("datastore");
datastore.nodes.setValue(ElasticsearchTestConstants.HOSTS);
return datastore;
}
use of org.talend.components.elasticsearch.ElasticsearchDatastoreProperties in project components by Talend.
the class ElasticsearchDatastoreTestIT method testBasic.
@Test
public void testBasic() throws Exception {
ElasticsearchDatastoreProperties props = createDatastoreProperties();
RuntimeInfo ri = def.getRuntimeInfo(props);
try (SandboxedInstance si = RuntimeUtil.createRuntimeClass(ri, getClass().getClassLoader())) {
DatastoreRuntime runtime = (DatastoreRuntime) si.getInstance();
runtime.initialize(null, props);
assertThat(runtime, not(nullValue()));
Iterator iterator = runtime.doHealthChecks(null).iterator();
assertTrue(iterator.hasNext());
assertEquals(ValidationResult.OK, iterator.next());
}
}
use of org.talend.components.elasticsearch.ElasticsearchDatastoreProperties in project components by Talend.
the class ElasticsearchBeamRuntimeTestIT method init.
@Before
public void init() throws IOException, ExecutionException, InterruptedException {
client = ElasticsearchTestUtils.createClient(ElasticsearchTestConstants.HOSTS.split(":")[0], ElasticsearchTestConstants.TRANSPORT_PORT, ElasticsearchTestConstants.CLUSTER_NAME);
datastoreProperties = new ElasticsearchDatastoreProperties("datastore");
datastoreProperties.init();
datastoreProperties.nodes.setValue(ElasticsearchTestConstants.HOSTS);
RestClient restClient = ElasticsearchConnection.createClient(datastoreProperties);
BasicHeader emptyHeader = new BasicHeader("", "");
Map<String, String> emptyParams = new HashMap<>();
ElasticsearchTestUtils.deleteIndex(INDEX_NAME, client);
Response checkExistsResponse = restClient.performRequest("HEAD", "/" + INDEX_NAME, emptyParams);
ElasticsearchResponse checkExists = new ElasticsearchResponse(checkExistsResponse);
if (!checkExists.isOk()) {
// create index for test, name is 'beam'
restClient.performRequest("PUT", "/" + INDEX_NAME, emptyHeader);
}
}
Aggregations