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()));
}
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()));
}
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();
}
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));
}
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());
});
}
Aggregations