Search in sources :

Example 91 with Parameters

use of junitparams.Parameters in project geode by apache.

the class RebalanceDUnitTest method returnCorrectResultsWhenMoveBucketHappensOnQuery.

@Test
@Parameters(method = "getListOfRegionTestTypes")
public void returnCorrectResultsWhenMoveBucketHappensOnQuery(RegionTestableType regionTestType) throws InterruptedException {
    final DistributedMember member2 = dataStore2.invoke(() -> getCache().getDistributedSystem().getDistributedMember());
    addCallbackToMovePrimaryOnQuery(dataStore1, member2);
    putEntriesAndValidateQueryResults(regionTestType);
}
Also used : DistributedMember(org.apache.geode.distributed.DistributedMember) Parameters(junitparams.Parameters) Test(org.junit.Test) DistributedTest(org.apache.geode.test.junit.categories.DistributedTest)

Example 92 with Parameters

use of junitparams.Parameters in project apex-core by apache.

the class AbstractReservoirTest method testAddAndSweepTuple.

@Test
@Parameters(method = "defaultTestParameters")
public void testAddAndSweepTuple(final AbstractReservoir reservoir, final Class<? extends Throwable> type) {
    final Tuple t = new Tuple(BEGIN_WINDOW, 0L);
    assertTrue(reservoir.add(t));
    assertFalse(reservoir.isEmpty());
    assertEquals(1, reservoir.size());
    assertEquals(1, reservoir.size(false));
    assertEquals(t, reservoir.peek());
    assertEquals(t, reservoir.sweep());
    assertEquals(t, reservoir.sweep());
    assertEquals(0, reservoir.getCount(false));
    assertEquals(0, reservoir.getSink().getCount(false));
    assertFalse(reservoir.isEmpty());
    assertEquals(t, reservoir.remove());
    assertNull(reservoir.peek());
    assertNull(reservoir.poll());
    assertNull(reservoir.sweep());
    exception.expect(type);
    reservoir.remove();
}
Also used : Tuple(com.datatorrent.stram.tuple.Tuple) Parameters(junitparams.Parameters) Test(org.junit.Test)

Example 93 with Parameters

use of junitparams.Parameters in project protoman by spotify.

the class SemverSchemaVersionerTest method testDetermineVersion.

@Test
@Parameters(method = "testParams")
public void testDetermineVersion(final Path root, final String protoPackage, final SchemaVersion currentVersion, final SchemaVersion expectedVersion) throws Exception {
    final SemverSchemaVersioner sut = SemverSchemaVersioner.create();
    final DescriptorSetPair descriptorSetPair = DescriptorSetUtils.buildDescriptorSetPair(root);
    final SchemaVersion version = sut.determineVersion(protoPackage, currentVersion, descriptorSetPair.current(), descriptorSetPair.candidate());
    assertThat(version, equalTo(expectedVersion));
}
Also used : DescriptorSetPair(com.spotify.protoman.testutil.DescriptorSetPair) Parameters(junitparams.Parameters) Test(org.junit.Test)

Example 94 with Parameters

use of junitparams.Parameters in project protoman by spotify.

the class EnumDefaultValueTest method testDisallowedName.

@Parameters(method = "disallowedNames")
@Test
public void testDisallowedName(final String name) throws Exception {
    final DescriptorSet candidate = DescriptorSetUtils.buildDescriptorSet("a.proto", String.format(TEMPLATE, name));
    final ImmutableList<ValidationViolation> violations = schemaValidator.validate(DescriptorSet.empty(), candidate);
    assertThat(violations, contains(validationViolation().description(equalTo("enum value 0 should be used for unknown value, e.g. AN_ENUM_UNSPECIFIED")).type(equalTo(ViolationType.BEST_PRACTICE_VIOLATION)).current(nullValue(GenericDescriptor.class)).candidate(genericDescriptor().sourceCodeInfo(optionalWithValue(sourceCodeInfo().start(filePosition().line(2).column(1)))))));
}
Also used : ValidationViolation(com.spotify.protoman.validation.ValidationViolation) DescriptorSet(com.spotify.protoman.descriptor.DescriptorSet) Parameters(junitparams.Parameters) Test(org.junit.Test)

Example 95 with Parameters

use of junitparams.Parameters in project protoman by spotify.

the class EnumNamingRuleTest method testDisallowedName_existing.

@Parameters(method = "disallowedNames")
@Test
public void testDisallowedName_existing(final String name) throws Exception {
    final DescriptorSet candidate = DescriptorSetUtils.buildDescriptorSet("a.proto", String.format(TEMPLATE, name));
    final ImmutableList<ValidationViolation> violations = schemaValidator.validate(candidate, candidate);
    assertThat(violations, is(empty()));
}
Also used : ValidationViolation(com.spotify.protoman.validation.ValidationViolation) DescriptorSet(com.spotify.protoman.descriptor.DescriptorSet) Parameters(junitparams.Parameters) Test(org.junit.Test)

Aggregations

Parameters (junitparams.Parameters)121 Test (org.junit.Test)121 DistributedTest (org.apache.geode.test.junit.categories.DistributedTest)55 DescriptorSet (com.spotify.protoman.descriptor.DescriptorSet)43 ValidationViolation (com.spotify.protoman.validation.ValidationViolation)43 SerializableRunnableIF (org.apache.geode.test.dunit.SerializableRunnableIF)41 CommandResult (org.apache.geode.management.internal.cli.result.CommandResult)11 Region (org.apache.geode.cache.Region)10 Cache (org.apache.geode.cache.Cache)9 IntegrationTest (org.apache.geode.test.junit.categories.IntegrationTest)9 DistributedMember (org.apache.geode.distributed.DistributedMember)8 UnitTest (org.apache.geode.test.junit.categories.UnitTest)7 ArrayList (java.util.ArrayList)6 SecurityTest (org.apache.geode.test.junit.categories.SecurityTest)5 List (java.util.List)4 ResultCollector (org.apache.geode.cache.execute.ResultCollector)4 LuceneDestroyIndexFunction (org.apache.geode.cache.lucene.internal.cli.functions.LuceneDestroyIndexFunction)4 PartitionedRegion (org.apache.geode.internal.cache.PartitionedRegion)4 CliFunctionResult (org.apache.geode.management.internal.cli.functions.CliFunctionResult)4 AsyncInvocation (org.apache.geode.test.dunit.AsyncInvocation)4