use of com.github.alexcojocaru.mojo.elasticsearch.v2.ClusterConfiguration in project elasticsearch-maven-plugin by alexcojocaru.
the class BootstrapClusterStep method execute.
@Override
public void execute(ClusterConfiguration config) {
if (StringUtils.isBlank(config.getPathInitScript())) {
// nothing to do; return
return;
}
String filePath = config.getPathInitScript();
validateFile(filePath);
// we'll run all commands against the first node in the cluster
ElasticsearchClient client = new ElasticsearchClient.Builder().withInstanceConfiguration(config.getInstanceConfigurationList().get(0)).withHostname("localhost").build();
Stream<String> stream = null;
try {
stream = Files.lines(Paths.get(filePath));
stream.forEach(command -> executeInitCommand(client, config.getLog(), command));
} catch (IOException e) {
throw new ElasticsearchSetupException("Cannot read the init script file", e);
} finally {
if (stream != null) {
stream.close();
}
}
}
use of com.github.alexcojocaru.mojo.elasticsearch.v2.ClusterConfiguration in project elasticsearch-maven-plugin by alexcojocaru.
the class ValidateVersionStepTest method testCheckVersionWithIncorrectVersion.
/**
* Test the version check with incorrect version
*/
@Test(expected = ElasticsearchSetupException.class)
public void testCheckVersionWithIncorrectVersion() {
String version = "1.0.0";
ClusterConfiguration config = buildConfig(version);
new ValidateVersionStep().execute(config);
}
use of com.github.alexcojocaru.mojo.elasticsearch.v2.ClusterConfiguration in project elasticsearch-maven-plugin by alexcojocaru.
the class ValidateClusterNameStepTest method TestWithClusterNameContainingDot.
@Test
public void TestWithClusterNameContainingDot() {
ClusterConfiguration clusterConfiguration = configBuilder.withClusterName("ONE.TWO.THREE").build();
validateClusterNameStep.execute(clusterConfiguration);
}
use of com.github.alexcojocaru.mojo.elasticsearch.v2.ClusterConfiguration in project elasticsearch-maven-plugin by alexcojocaru.
the class ValidateClusterNameStepTest method TestWithClusterNameContainingQuote.
@Test(expected = ElasticsearchSetupException.class)
public void TestWithClusterNameContainingQuote() {
ClusterConfiguration clusterConfiguration = configBuilder.withClusterName("ONE'TWO'THREE").build();
validateClusterNameStep.execute(clusterConfiguration);
}
use of com.github.alexcojocaru.mojo.elasticsearch.v2.ClusterConfiguration in project elasticsearch-maven-plugin by alexcojocaru.
the class ValidateUniquePortsStepTest method testWithTwoInstancesWithUniquePorts.
/**
* Test with 2 instances; all ports are unique.
*/
@Test
public void testWithTwoInstancesWithUniquePorts() {
ClusterConfiguration config = buildConfig(2000, 2010, 2001, 2011);
new ValidateUniquePortsStep().execute(config);
}
Aggregations