use of org.junit.jupiter.params.ParameterizedTest in project qpp-conversion-tool by CMSgov.
the class TemplateIdTest method testInvalidExtensionFindWithExtensionEnforcementHappy.
@ParameterizedTest
@EnumSource(value = TemplateId.class)
void testInvalidExtensionFindWithExtensionEnforcementHappy(TemplateId templateId) {
System.setProperty(Extension.STRICT_EXTENSION, "yep");
TemplateId actual = TemplateId.getTemplateId(templateId.getRoot(), templateId.getExtension(), new Context());
assertThat(actual).isSameAs(templateId);
}
use of org.junit.jupiter.params.ParameterizedTest in project qpp-conversion-tool by CMSgov.
the class CpcPlusAcceptanceTest method testCpcPlusFileSuccesses.
@ParameterizedTest
@MethodSource("successData")
void testCpcPlusFileSuccesses(Path entry) {
AllErrors errors = null;
Converter converter = new Converter(new PathSource(entry));
try {
converter.transform();
} catch (TransformException failure) {
errors = failure.getDetails();
}
assertThat(errors).isNull();
}
use of org.junit.jupiter.params.ParameterizedTest in project qpp-conversion-tool by CMSgov.
the class CpcPlusAcceptanceTest method testCpcPlusFileFailures.
@ParameterizedTest
@MethodSource("failureData")
void testCpcPlusFileFailures(Path entry) {
String fileName = entry.getFileName().toString();
assertWithMessage("No associated entry in fixture.json for the file %s", fileName).that(fixtureValues).containsKey(fileName);
Converter converter = new Converter(new PathSource(entry));
TransformException expected = Assertions.assertThrows(TransformException.class, converter::transform);
// runnning conversions on individual files
List<Detail> details = expected.getDetails().getErrors().get(0).getDetails();
verifyOutcome(fileName, details);
}
use of org.junit.jupiter.params.ParameterizedTest in project redisson by redisson.
the class RedissonBatchTest method testConnectionLeak.
@ParameterizedTest
@MethodSource("data")
public void testConnectionLeak(BatchOptions batchOptions) throws Exception {
Assumptions.assumeTrue(batchOptions.getExecutionMode() == ExecutionMode.IN_MEMORY);
RedisRunner master1 = new RedisRunner().port(6890).randomDir().nosave();
RedisRunner master2 = new RedisRunner().port(6891).randomDir().nosave();
RedisRunner master3 = new RedisRunner().port(6892).randomDir().nosave();
RedisRunner slave1 = new RedisRunner().port(6900).randomDir().nosave();
RedisRunner slave2 = new RedisRunner().port(6901).randomDir().nosave();
RedisRunner slave3 = new RedisRunner().port(6902).randomDir().nosave();
ClusterRunner clusterRunner = new ClusterRunner().addNode(master1, slave1).addNode(master2, slave2).addNode(master3, slave3);
ClusterRunner.ClusterProcesses process = clusterRunner.run();
Thread.sleep(1000);
Config config = new Config();
config.useClusterServers().setConnectTimeout(500).setPingConnectionInterval(2000).setMasterConnectionMinimumIdleSize(1).setMasterConnectionPoolSize(1).setSlaveConnectionMinimumIdleSize(1).setSlaveConnectionPoolSize(1).setTimeout(100).setRetryAttempts(0).setRetryInterval(20).addNodeAddress(process.getNodes().stream().findAny().get().getRedisServerAddressAndPort());
RedissonClient redisson = Redisson.create(config);
ExecutorService executorService = Executors.newFixedThreadPool(5);
AtomicInteger counter = new AtomicInteger(5 * 150);
AtomicBoolean hasErrors = new AtomicBoolean();
for (int i = 0; i < 5; i++) {
executorService.submit(() -> {
for (int j = 0; j < 150; j++) {
executeBatch(redisson, batchOptions).whenComplete((r, e) -> {
if (e != null) {
hasErrors.set(true);
}
counter.decrementAndGet();
});
}
});
}
Awaitility.await().atMost(10, TimeUnit.SECONDS).until(() -> counter.get() == 0);
Assertions.assertThat(hasErrors).isTrue();
executeBatch(redisson, batchOptions).toCompletableFuture().join();
redisson.shutdown();
process.shutdown();
}
use of org.junit.jupiter.params.ParameterizedTest in project redisson by redisson.
the class RedissonBatchTest method testBatchBigRequest.
@ParameterizedTest
@MethodSource("data")
public void testBatchBigRequest(BatchOptions batchOptions) {
Config config = createConfig();
config.useSingleServer().setTimeout(15000);
RedissonClient redisson = Redisson.create(config);
RBatch batch = redisson.createBatch(batchOptions);
for (int i = 0; i < 210; i++) {
batch.getMap("test").fastPutAsync("1", "2");
batch.getMap("test").fastPutAsync("2", "3");
batch.getMap("test").putAsync("2", "5");
batch.getAtomicLong("counter").incrementAndGetAsync();
batch.getAtomicLong("counter").incrementAndGetAsync();
}
BatchResult<?> res = batch.execute();
org.junit.jupiter.api.Assertions.assertEquals(210 * 5, res.getResponses().size());
redisson.shutdown();
}
Aggregations