Search in sources :

Example 51 with Parameters

use of junitparams.Parameters in project protoman by spotify.

the class ServiceNamingRuleTest method testAllowedName_new.

@Parameters(method = "allowedNames")
@Test
public void testAllowedName_new(final String name) throws Exception {
    final DescriptorSet current = DescriptorSet.empty();
    final DescriptorSet candidate = DescriptorSetUtils.buildDescriptorSet("a.proto", "syntax = 'proto3';\n" + String.format("service %s {\n", name) + "}");
    final ImmutableList<ValidationViolation> violations = schemaValidator.validate(current, 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)

Example 52 with Parameters

use of junitparams.Parameters in project protoman by spotify.

the class ServiceNamingRuleTest method testAllowedName_existing.

@Parameters(method = "allowedNames")
@Test
public void testAllowedName_existing(final String name) throws Exception {
    final DescriptorSet candidate = DescriptorSetUtils.buildDescriptorSet("a.proto", "syntax = 'proto3';\n" + String.format("service %s {\n", 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)

Example 53 with Parameters

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

the class SpillableMapImplTest method serializationBufferTest.

@Test
@Parameters({ "TimeUnifiedManagedState" })
public void serializationBufferTest(String opt) {
    SerializationBuffer keyBuffer = null;
    SerializationBuffer valueBuffer = null;
    SerializationBuffer currentBuffer;
    setup(opt);
    SpillableMapImplForTest<String, String> map;
    if (te == null) {
        map = new SpillableMapImplForTest<>(store, ID1, 0L, new StringSerde(), new StringSerde());
    } else {
        map = new SpillableMapImplForTest<>(store, ID1, new StringSerde(), new StringSerde(), te);
    }
    store.setup(testMeta.operatorContext);
    map.setup(testMeta.operatorContext);
    long windowId = 0L;
    store.beginWindow(windowId);
    map.beginWindow(windowId);
    map.put("a", "1");
    map.endWindow();
    store.endWindow();
    currentBuffer = map.serdeManager.getKeyBufferForWrite();
    Assert.assertTrue(currentBuffer != keyBuffer);
    keyBuffer = currentBuffer;
    currentBuffer = map.serdeManager.getValueBuffer();
    Assert.assertTrue(currentBuffer != valueBuffer);
    valueBuffer = currentBuffer;
    ++windowId;
    store.beginWindow(windowId);
    map.beginWindow(windowId);
    // each put use different key to make sure use the different bucket
    map.put("b", "2");
    map.endWindow();
    store.endWindow();
    currentBuffer = map.serdeManager.getKeyBufferForWrite();
    Assert.assertTrue(currentBuffer != keyBuffer);
    keyBuffer = currentBuffer;
    currentBuffer = map.serdeManager.getValueBuffer();
    Assert.assertTrue(currentBuffer != valueBuffer);
    valueBuffer = currentBuffer;
    map.teardown();
    store.teardown();
}
Also used : SerializationBuffer(org.apache.apex.malhar.lib.utils.serde.SerializationBuffer) StringSerde(org.apache.apex.malhar.lib.utils.serde.StringSerde) Parameters(junitparams.Parameters) Test(org.junit.Test)

Example 54 with Parameters

use of junitparams.Parameters in project druid by druid-io.

the class LookupDimensionSpecTest method testSerDesr.

@Parameters
@Test
public void testSerDesr(DimensionSpec lookupDimSpec) throws IOException {
    ObjectMapper mapper = new DefaultObjectMapper();
    InjectableValues injectableValues = new InjectableValues.Std().addValue(LookupReferencesManager.class, LOOKUP_REF_MANAGER);
    String serLookup = mapper.writeValueAsString(lookupDimSpec);
    Assert.assertEquals(lookupDimSpec, mapper.reader(DimensionSpec.class).with(injectableValues).readValue(serLookup));
}
Also used : DefaultObjectMapper(io.druid.jackson.DefaultObjectMapper) InjectableValues(com.fasterxml.jackson.databind.InjectableValues) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) DefaultObjectMapper(io.druid.jackson.DefaultObjectMapper) Parameters(junitparams.Parameters) Test(org.junit.Test)

Example 55 with Parameters

use of junitparams.Parameters in project geode by apache.

the class EvictionDUnitTest method regionsWithEvictionWithOverflowMustBeAbleToCreateLuceneIndexes.

@Test
@Parameters(method = "getPartitionRedundantOverflowEvictionRegionType")
public void regionsWithEvictionWithOverflowMustBeAbleToCreateLuceneIndexes(RegionTestableType regionTestType) {
    SerializableRunnableIF createIndex = () -> {
        LuceneService luceneService = LuceneServiceProvider.get(getCache());
        luceneService.createIndexFactory().setFields("text").create(INDEX_NAME, REGION_NAME);
    };
    dataStore1.invoke(() -> initDataStore(createIndex, regionTestType));
    accessor.invoke(() -> initDataStore(createIndex, regionTestType));
    accessor.invoke(() -> {
        Cache cache = getCache();
        Region region = cache.getRegion(REGION_NAME);
        IntStream.range(0, NUM_BUCKETS).forEach(i -> region.put(i, new TestObject("hello world")));
    });
    waitForFlushBeforeExecuteTextSearch(accessor, 60000);
    dataStore1.invoke(() -> {
        try {
            getCache().getResourceManager().setEvictionHeapPercentage(INITIAL_EVICTION_HEAP_PERCENTAGE);
            final PartitionedRegion partitionedRegion = (PartitionedRegion) getRootRegion(REGION_NAME);
            raiseFakeNotification();
            Awaitility.await().atMost(60, TimeUnit.SECONDS).until(() -> {
                assertTrue(partitionedRegion.getDiskRegionStats().getNumOverflowOnDisk() > 0);
            });
        } finally {
            cleanUpAfterFakeNotification();
        }
    });
    accessor.invoke(() -> {
        LuceneService luceneService = LuceneServiceProvider.get(getCache());
        LuceneQuery<Integer, TestObject> query = luceneService.createLuceneQueryFactory().setLimit(100).create(INDEX_NAME, REGION_NAME, "world", "text");
        List<LuceneResultStruct<Integer, TestObject>> resultList = query.findResults();
        assertEquals(NUM_BUCKETS, resultList.size());
    });
}
Also used : PartitionedRegion(org.apache.geode.internal.cache.PartitionedRegion) Region(org.apache.geode.cache.Region) PartitionedRegion(org.apache.geode.internal.cache.PartitionedRegion) SerializableRunnableIF(org.apache.geode.test.dunit.SerializableRunnableIF) Cache(org.apache.geode.cache.Cache) Parameters(junitparams.Parameters) Test(org.junit.Test) DistributedTest(org.apache.geode.test.junit.categories.DistributedTest)

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