use of org.assertj.core.api.Condition in project sonarqube by SonarSource.
the class EsClientProviderTest method connection_to_local_es_when_cluster_mode_is_disabled.
@Test
public void connection_to_local_es_when_cluster_mode_is_disabled() {
settings.setProperty(CLUSTER_ENABLED.getKey(), false);
settings.setProperty(SEARCH_HOST.getKey(), localhostHostname);
settings.setProperty(SEARCH_PORT.getKey(), 9000);
settings.setProperty(ES_PORT.getKey(), 8080);
EsClient client = underTest.provide(settings.asConfig());
RestHighLevelClient nativeClient = client.nativeClient();
assertThat(nativeClient.getLowLevelClient().getNodes()).hasSize(1);
Node node = nativeClient.getLowLevelClient().getNodes().get(0);
assertThat(node.getHost().getAddress().getHostName()).isEqualTo(localhostHostname);
assertThat(node.getHost().getPort()).isEqualTo(9000);
assertThat(logTester.logs(LoggerLevel.INFO)).has(new Condition<>(s -> s.contains("Connected to local Elasticsearch: [http://" + localhostHostname + ":9000]"), ""));
}
use of org.assertj.core.api.Condition in project sonarqube by SonarSource.
the class EsClientProviderTest method connection_to_remote_es_nodes_when_cluster_mode_is_enabled_and_local_es_is_disabled.
@Test
public void connection_to_remote_es_nodes_when_cluster_mode_is_enabled_and_local_es_is_disabled() {
settings.setProperty(CLUSTER_ENABLED.getKey(), true);
settings.setProperty(CLUSTER_NODE_TYPE.getKey(), "application");
settings.setProperty(CLUSTER_SEARCH_HOSTS.getKey(), format("%s:8080,%s:8081", localhostHostname, localhostHostname));
EsClient client = underTest.provide(settings.asConfig());
RestHighLevelClient nativeClient = client.nativeClient();
assertThat(nativeClient.getLowLevelClient().getNodes()).hasSize(2);
Node node = nativeClient.getLowLevelClient().getNodes().get(0);
assertThat(node.getHost().getAddress().getHostName()).isEqualTo(localhostHostname);
assertThat(node.getHost().getPort()).isEqualTo(8080);
node = nativeClient.getLowLevelClient().getNodes().get(1);
assertThat(node.getHost().getAddress().getHostName()).isEqualTo(localhostHostname);
assertThat(node.getHost().getPort()).isEqualTo(8081);
assertThat(logTester.logs(LoggerLevel.INFO)).has(new Condition<>(s -> s.contains("Connected to remote Elasticsearch: [http://" + localhostHostname + ":8080, http://" + localhostHostname + ":8081]"), ""));
}
use of org.assertj.core.api.Condition in project rabbitmq-java-client by rabbitmq.
the class JavaNioTest method byteBufferFactory.
@Test
public void byteBufferFactory() throws Exception {
ConnectionFactory cf = new ConnectionFactory();
cf.useNio();
int baseCapacity = 32768;
NioParams nioParams = new NioParams();
nioParams.setReadByteBufferSize(baseCapacity / 2);
nioParams.setWriteByteBufferSize(baseCapacity / 4);
List<ByteBuffer> byteBuffers = new CopyOnWriteArrayList<>();
cf.setNioParams(nioParams.setByteBufferFactory(new DefaultByteBufferFactory(capacity -> {
ByteBuffer bb = ByteBuffer.allocate(capacity);
byteBuffers.add(bb);
return bb;
})));
try (Connection c = cf.newConnection()) {
sendAndVerifyMessage(c, 100);
}
assertThat(byteBuffers).hasSize(2);
Condition<Integer> condition = new Condition<>(c -> c == nioParams.getReadByteBufferSize() || c == nioParams.getWriteByteBufferSize(), "capacity set by factory");
assertThat(byteBuffers.get(0).capacity()).is(condition);
assertThat(byteBuffers.get(1).capacity()).is(condition);
}
use of org.assertj.core.api.Condition in project project-build-plugin by axonivy.
the class TestDeployToRunningEngine method canDeployIar.
@Test
public void canDeployIar() throws Exception {
deployMojo.deployToEngineApplication = "Portal";
File deployedIar = getTarget(deployMojo.deployFile, deployMojo);
File deployedIarFlagFile = new File(deployedIar.getParent(), deployedIar.getName() + ".deployed");
File deployedIarLogFile = new File(deployedIar.getParent(), deployedIar.getName() + ".deploymentLog");
Executor startedProcess = null;
try {
startedProcess = mojo.startEngine();
deployMojo.execute();
assertThat(deployedIar).doesNotExist();
assertThat(deployedIarFlagFile).exists();
assertThat(deployedIarLogFile).exists();
assertThat(linesOf(deployedIarLogFile)).haveAtLeast(1, new Condition<>(s -> s.contains("Deploying users ..."), ""));
} finally {
kill(startedProcess);
}
}
use of org.assertj.core.api.Condition in project spring-data-jdbc by spring-projects.
the class JdbcRepositoryPropertyConversionIntegrationTests method representingTheSameAs.
private Condition<Date> representingTheSameAs(Date other) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
String expected = format.format(other);
return new Condition<>(date -> format.format(date).equals(expected), expected);
}
Aggregations