Search in sources :

Example 66 with ParameterizedTest

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);
}
Also used : Context(gov.cms.qpp.conversion.Context) EnumSource(org.junit.jupiter.params.provider.EnumSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 67 with ParameterizedTest

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();
}
Also used : AllErrors(gov.cms.qpp.conversion.model.error.AllErrors) PathSource(gov.cms.qpp.conversion.PathSource) TransformException(gov.cms.qpp.conversion.model.error.TransformException) Converter(gov.cms.qpp.conversion.Converter) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 68 with ParameterizedTest

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);
}
Also used : PathSource(gov.cms.qpp.conversion.PathSource) TransformException(gov.cms.qpp.conversion.model.error.TransformException) Converter(gov.cms.qpp.conversion.Converter) Detail(gov.cms.qpp.conversion.model.error.Detail) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 69 with ParameterizedTest

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();
}
Also used : AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) ClusterProcesses(org.redisson.ClusterRunner.ClusterProcesses) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Config(org.redisson.config.Config) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 70 with ParameterizedTest

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();
}
Also used : Config(org.redisson.config.Config) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Aggregations

ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)2045 MethodSource (org.junit.jupiter.params.provider.MethodSource)1116 EnumSource (org.junit.jupiter.params.provider.EnumSource)325 ValueSource (org.junit.jupiter.params.provider.ValueSource)302 ArgumentsSource (org.junit.jupiter.params.provider.ArgumentsSource)181 Transaction (org.neo4j.graphdb.Transaction)117 CsvSource (org.junit.jupiter.params.provider.CsvSource)113 ArrayList (java.util.ArrayList)112 ByteBuffer (java.nio.ByteBuffer)81 List (java.util.List)81 Path (java.nio.file.Path)75 Test (org.junit.jupiter.api.Test)74 InterruptAfter (io.aeron.test.InterruptAfter)72 IOException (java.io.IOException)72 KernelTransaction (org.neo4j.kernel.api.KernelTransaction)67 TimeUnit (java.util.concurrent.TimeUnit)65 ExtendWith (org.junit.jupiter.api.extension.ExtendWith)62 CountDownLatch (java.util.concurrent.CountDownLatch)61 SelfSignedCertificate (io.netty.handler.ssl.util.SelfSignedCertificate)60 Stream (java.util.stream.Stream)59