method2testcases
stringlengths
118
3.08k
### Question: CpArguments { @Option("backup") abstract Optional<Control> backup(); }### Answer: @Test void testEnum() { assertEquals(Optional.of(Control.NUMBERED), f.parse("a", "b", "--backup=NUMBERED").backup()); f.assertThat("-r", "a", "b", "--backup", "SIMPLE") .succeeds( "source", "a", "dest", "b", "recursive", ...
### Question: AllFloatsArguments { @Param(1) abstract List<Float> positional(); }### Answer: @Test void positional() { f.assertThat("--obj=1.5", "--prim=1.5", "5.5", "3.5").succeeds( "positional", asList(5.5f, 3.5f), "listOfFloats", emptyList(), "optionalFloat", Optional.empty(), "floatObject", 1.5f, "primitiveFloat...
### Question: TarArguments { @Option(value = "x", mnemonic = 'x') abstract boolean extract(); }### Answer: @Test void testExtract() { f.assertThat("-x", "-f", "foo.tar").succeeds( "extract", true, "create", false, "verbose", false, "compress", false, "file", "foo.tar"); f.assertThat("-v", "-x", "-f", "foo.tar").succ...
### Question: ListIntegerArguments { @Option(value = "a", mnemonic = 'a', mappedBy = Mapper.class) abstract List<Integer> a(); }### Answer: @Test void testPresent() { ListIntegerArguments args = new ListIntegerArguments_Parser().parseOrExit(new String[]{"-a", "1"}); assertEquals(Collections.singletonList(1), args.a(...
### Question: OptionalIntArguments { @Option(value = "a", mnemonic = 'a', mappedBy = Mapper.class) abstract OptionalInt a(); }### Answer: @Test void testPresent() { OptionalIntArguments args = new OptionalIntArguments_Parser().parseOrExit(new String[]{"-a", "1"}); assertEquals(OptionalInt.of(1), args.a()); }
### Question: Main { public static void main(String[] arguments) { Arguments args = new Main_Arguments_Parser().parseOrExit(arguments); System.out.println("The file '" + args.file() + "' was provided and verbosity is set to '" + args.verbose() + "'."); } static void main(String[] arguments); }### Answer: @Test void t...
### Question: OptionalIntArgumentsOptional { @Option(value = "a", mnemonic = 'a', mappedBy = Mapper.class) abstract OptionalInt a(); }### Answer: @Test void testPresent() { OptionalIntArgumentsOptional args = new OptionalIntArgumentsOptional_Parser().parseOrExit(new String[]{"-a", "1"}); assertEquals(OptionalInt.of(...
### Question: AllLongsArguments { @Param(1) abstract List<Long> positional(); }### Answer: @Test void positional() { f.assertThat("--obj=1", "--prim=1", "5", "3").succeeds( "positional", asList(5L, 3L), "listOfLongs", emptyList(), "optionalLong", Optional.empty(), "longObject", 1L, "primitiveLong", 1L); }
### Question: VariousArguments { @Option("bigDecimal") abstract BigDecimal bigDecimal(); }### Answer: @Test void bigDecimal() { VariousArguments_Parser.ParseResult parsed = new VariousArguments_Parser().parse(new String[]{ "--bigDecimal", "3.14159265358979323846264338327950288419716939937510", "--bigInteger", "60221...
### Question: AllIntegersArguments { @Option("opt") abstract Optional<Integer> optionalInteger(); }### Answer: @Test void optionalInteger() { f.assertThat("--opt", "1", "--obj=1", "--prim=1").succeeds( "positional", emptyList(), "listOfIntegers", emptyList(), "optionalInteger", Optional.of(1), "integer", 1, "primiti...
### Question: AllIntegersArguments { @Param(1) abstract List<Integer> positional(); }### Answer: @Test void positional() { f.assertThat("--obj=1", "--prim=1", "5", "3").succeeds( "positional", asList(5, 3), "listOfIntegers", emptyList(), "optionalInteger", Optional.empty(), "integer", 1, "primitiveInt", 1); }
### Question: Optionalish { static Optional<Optionalish> unwrap(TypeMirror type, TypeTool tool) { Optional<Optionalish> optionalPrimtive = getOptionalPrimitive(type, tool); if (optionalPrimtive.isPresent()) { return optionalPrimtive; } return tool.unwrap(Optional.class, type) .map(wrapped -> new Optionalish(p -> CodeBl...
### Question: ReferenceTool { public ReferencedType<E> getReferencedType() { return resolver.typecheck(referencedClass, Supplier.class) .fold(this::handleNotSupplier, this::handleSupplier); } ReferenceTool(ExpectedType<E> expectedType, Function<String, ValidationException> errorHandler, TypeTool tool, TypeElement refer...
### Question: ExtremelySimpleArguments { @Param(value = 1) abstract int hello(); }### Answer: @Test void simpleTest() { assertEquals(1, f.parse("1").hello()); }
### Question: TypevarMapping { public TypeMirror get(String key) { return map.get(key); } TypevarMapping(Map<String, TypeMirror> map, TypeTool tool); Set<Map.Entry<String, TypeMirror>> entries(); TypeMirror get(String key); Either<TypecheckFailure, TypeMirror> substitute(TypeMirror input); Either<TypecheckFailure, Decl...
### Question: TypevarMapping { public Either<TypecheckFailure, TypeMirror> substitute(TypeMirror input) { if (input.getKind() == TypeKind.TYPEVAR) { return right(map.getOrDefault(input.toString(), input)); } if (input.getKind() == TypeKind.ARRAY) { return right(input); } return substitute(input.accept(AS_DECLARED, null...
### Question: CustomCollectorArguments { @Option(value = "H", mnemonic = 'H', collectedBy = MyStringCollector.class) abstract Set<String> strings(); }### Answer: @Test void testNoMapper() { CustomCollectorArguments parsed = f.parse( "-H", "A", "-H", "A", "-H", "HA"); assertEquals(new HashSet<>(asList("A", "HA")), pa...
### Question: CustomCollectorArguments { @Option(value = "B", mnemonic = 'B', collectedBy = MyIntegerCollector.class) abstract Set<Integer> integers(); }### Answer: @Test void testBuiltinMapper() { CustomCollectorArguments parsed = f.parse( "-B", "1", "-B", "1", "-B", "2"); assertEquals(new HashSet<>(asList(1, 2)), ...
### Question: CustomCollectorArguments { @Option( value = "M", mnemonic = 'M', mappedBy = CustomBigIntegerMapper.class, collectedBy = ToSetCollector.class) abstract Set<BigInteger> bigIntegers(); }### Answer: @Test void testCustomMapper() { CustomCollectorArguments parsed = f.parse( "-M", "0x5", "-M", "0xA", "-M", "...
### Question: CustomCollectorArguments { @Option(value = "K", mnemonic = 'K', collectedBy = ToSetCollector.class) abstract Set<Giddy> moneySet(); }### Answer: @Test void testCustomEnum() { CustomCollectorArguments parsed = f.parse( "-K", "SOME", "-K", "NONE"); assertEquals(Stream.of( CustomCollectorArguments.Giddy.S...
### Question: CustomCollectorArguments { @Option( value = "T", mnemonic = 'T', mappedBy = MapEntryTokenizer.class, collectedBy = ToMapCollector.class) abstract Map<String, LocalDate> dateMap(); }### Answer: @Test void testMap() { CustomCollectorArguments parsed = f.parse( "-T", "A:2004-11-11", "-T", "B:2018-11-12");...
### Question: ComplicatedMapperArguments { @Option( value = "number", mappedBy = Mapper.class) abstract Integer number(); }### Answer: @Test void number() { ComplicatedMapperArguments parsed = f.parse( "--number", "12", "--numbers", "3", "--numbers", "oops"); assertEquals(1, parsed.number().intValue()); assertEquals...
### Question: AdditionArguments { final int sum() { return a() + b() + c().orElse(0); } }### Answer: @Test void dashesIgnored() { f.assertThat("--", "1", "-2", "3").satisfies(e -> e.sum() == 2); f.assertThat("--", "-1", "-2", "-3").satisfies(e -> e.sum() == -6); f.assertThat("--", "-1", "-2", "3").satisfies(e -> e.s...
### Question: CustomStringSpanName implements QuerySpanNameProvider { CustomStringSpanName(String customString) { if (customString == null) { this.customString = "execute"; } else { this.customString = customString; } } CustomStringSpanName(String customString); @Override String querySpanName(String query); static Buil...
### Question: PrefixedFullQuerySpanName implements QuerySpanNameProvider { PrefixedFullQuerySpanName(String prefix) { if (prefix == null || prefix.equals("")) { this.prefix = ""; } else { this.prefix = prefix + ": "; } } PrefixedFullQuerySpanName(String prefix); @Override String querySpanName(String query); static Buil...
### Question: FullQuerySpanName implements QuerySpanNameProvider { FullQuerySpanName() { } FullQuerySpanName(); @Override String querySpanName(String query); static Builder newBuilder(); }### Answer: @Test public void fullQuerySpanNameTest() { QuerySpanNameProvider fullQuerySpanName = FullQuerySpanName.newBuilder().bu...
### Question: GuavaCompatibilityUtil { static boolean isGuavaCompatibilityFound() { return INSTANCE.isGuavaCompatibilityFound; } private GuavaCompatibilityUtil(); }### Answer: @Test public void isGuavaCompatibilityFound() { assertTrue(GuavaCompatibilityUtil.isGuavaCompatibilityFound()); }
### Question: LiveFrameRateMonitor implements IFeedRtcp { @Override public void feed(JFGMsgVideoRtcp rtcp) { Log.d("rtcp", "此消息在smartcall已有打印,无需再打印.rtcp:" + rtcp.frameRate); badFrameCount = rtcp.frameRate == 0 ? ++badFrameCount : 0; if (monitorListener == null) return; boolean isFrameFailed = badFrameCount >= FAILED_TA...
### Question: HomeMinePresenterImpl extends AbstractFragmentPresenter<HomeMineContract.View> implements HomeMineContract.Presenter { @Override public void start() { super.start(); addSubscription(getAccountBack()); addSubscription(loginInMe()); } HomeMinePresenterImpl(HomeMineContract.View view); @Override void start()...
### Question: HomeMinePresenterImpl extends AbstractFragmentPresenter<HomeMineContract.View> implements HomeMineContract.Presenter { @Override public void stop() { super.stop(); } HomeMinePresenterImpl(HomeMineContract.View view); @Override void start(); @Override void stop(); @Override void portraitBlur(Bitmap bitmap)...
### Question: HomeMinePresenterImpl extends AbstractFragmentPresenter<HomeMineContract.View> implements HomeMineContract.Presenter { @Override public void portraitBlur(Bitmap bitmap) { AppLogger.e("需要在io线程操作."); Observable.just(bitmap) .subscribeOn(Schedulers.io()) .map(b -> { if (b == null) { b = BitmapFactory.decodeR...
### Question: HomeMinePresenterImpl extends AbstractFragmentPresenter<HomeMineContract.View> implements HomeMineContract.Presenter { @Override public String createRandomName() { String[] firtPart = {"a", "isFriend", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l" , "m", "n", "o", "p", "q", "r", "account", "t", "u", "v...
### Question: TimeUtils { public static String getMediaVideoTimeInString(final long time) { return getSimpleDateFormatVideo.get().format(new Date(time)); } static String getMM_SS(long time); static String getYHM(long time); static String getHistoryTime(long timeInLong); static String getHistoryTime1(long timeInLong); ...
### Question: LiveFrameRateMonitor implements IFeedRtcp { @Override public void stop() { preStatus = false; badFrameCount = 0; } @Override void feed(JFGMsgVideoRtcp rtcp); @Override void stop(); void setMonitorListener(MonitorListener monitorListener); }### Answer: @Test public void stop() throws Exception { }
### Question: TimeUtils { public static String getTodayString() { return new SimpleDateFormat("yyyy.MM.dd", Locale.getDefault()) .format(new Date(System.currentTimeMillis())); } static String getMM_SS(long time); static String getYHM(long time); static String getHistoryTime(long timeInLong); static String getHistoryTi...
### Question: TimeUtils { public static String getDayString(long time) { return new SimpleDateFormat("yyyy.MM.dd", Locale.getDefault()) .format(new Date(time)); } static String getMM_SS(long time); static String getYHM(long time); static String getHistoryTime(long timeInLong); static String getHistoryTime1(long timeIn...
### Question: TimeUtils { public static String getDayInMonth(long time) { Calendar instance = Calendar.getInstance(); instance.setTimeInMillis(time); int i = instance.get(Calendar.DAY_OF_MONTH); return i + ""; } static String getMM_SS(long time); static String getYHM(long time); static String getHistoryTime(long timeI...
### Question: TimeUtils { public static String getMM_DD(long time) { return new SimpleDateFormat("MM月dd日", Locale.getDefault()) .format(new Date(time)); } static String getMM_SS(long time); static String getYHM(long time); static String getHistoryTime(long timeInLong); static String getHistoryTime1(long timeInLong); s...
### Question: TimeUtils { public static String getHH_MM(long time) { return getSimpleDateFormatHHMM.get().format(new Date(time)); } static String getMM_SS(long time); static String getYHM(long time); static String getHistoryTime(long timeInLong); static String getHistoryTime1(long timeInLong); static String getLiveTim...
### Question: TimeUtils { public static String getSpecifiedDate(long time) { return simpleDateFormat_1.format(new Date(time)); } static String getMM_SS(long time); static String getYHM(long time); static String getHistoryTime(long timeInLong); static String getHistoryTime1(long timeInLong); static String getLiveTime(l...
### Question: TimeUtils { public static String getSuperString(long time) { return getDateFormatSuper.get().format(new Date(time)); } static String getMM_SS(long time); static String getYHM(long time); static String getHistoryTime(long timeInLong); static String getHistoryTime1(long timeInLong); static String getLiveTi...
### Question: MapSubscription implements Subscription { @Override public boolean isUnsubscribed() { return unsubscribed; } MapSubscription(); @Override boolean isUnsubscribed(); void add(final Subscription s, String tag); void remove(final String tag); void clear(); @Override void unsubscribe(); boolean hasSubscription...
### Question: MapSubscription implements Subscription { public void add(final Subscription s, String tag) { remove(tag); if (!unsubscribed) { synchronized (this) { if (!unsubscribed) { if (subscriptions == null) { subscriptions = new HashMap<>(4); } subscriptions.put(tag, s); AppLogger.d("add to sub:" + tag); return; }...
### Question: MapSubscription implements Subscription { public void remove(final String tag) { if (!unsubscribed) { Subscription unsubscribe = null; synchronized (this) { if (unsubscribed || subscriptions == null) { return; } unsubscribe = subscriptions.remove(tag); } if (unsubscribe != null) { unsubscribe.unsubscribe(...
### Question: MapSubscription implements Subscription { public void clear() { if (!unsubscribed) { Collection<Map.Entry<String, Subscription>> unsubscribe = null; synchronized (this) { if (unsubscribed || subscriptions == null) { return; } else { unsubscribe = subscriptions.entrySet(); subscriptions = null; } unsubscri...
### Question: MapSubscription implements Subscription { @Override public void unsubscribe() { if (!unsubscribed) { Collection<Map.Entry<String, Subscription>> unsubscribe = null; synchronized (this) { if (unsubscribed || subscriptions == null) { return; } unsubscribed = true; unsubscribe = subscriptions.entrySet(); sub...
### Question: MapSubscription implements Subscription { public boolean hasSubscriptions() { if (!unsubscribed) { synchronized (this) { return !unsubscribed && subscriptions != null && !subscriptions.isEmpty(); } } return false; } MapSubscription(); @Override boolean isUnsubscribed(); void add(final Subscription s, Stri...
### Question: DeviceBean implements Parcelable { @Override public int hashCode() { return uuid != null ? uuid.hashCode() : 0; } DeviceBean(); protected DeviceBean(Parcel in); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); @Override int describeContents(); @Override void writ...
### Question: SimpleMemoryManager { public int malloc(final int size) { return malloc_internal(size + 16) + 16; } SimpleMemoryManager(final int totalMemory); int freeMemory(); int allocated(); int malloc(final int size); void free(final int position); void GC(); void printDebug(final PrintStream ps); }### Answer: @Tes...
### Question: Module { public ImportsSection getImports() { return imports; } Module(final String label, final String sourcemapFileName); void writeTo(final TextWriter writer, final boolean enableDebug); TypesSection getTypes(); GlobalsIndex globalsIndex(); EventIndex eventIndex(); FunctionIndex functionIndex(); void w...
### Question: SimpleMemoryManager { public void GC() { Chunk current = allocatedList; while (current != null) { final Chunk next = current.next; free_internal(current.position); current = next; } } SimpleMemoryManager(final int totalMemory); int freeMemory(); int allocated(); int malloc(final int size); void free(final...
### Question: VLQ { public static int[] decode(final String aData) { final List<Integer> theResult = new ArrayList<>(); int theShift = 0; int theValue = 0; for (int i=0;i<aData.length();i++) { int theInteger = CHARACTERS.indexOf(aData.charAt(i)); final int hasContinuationBit = theInteger & 32; theInteger &= 31; theValu...
### Question: VLQ { public static String encode(final int[] aData) { final StringBuilder theResult = new StringBuilder(); for (int i = 0; i < aData.length; i += 1 ) { theResult.append(encodeInteger(aData[i])); } return theResult.toString(); } private VLQ(); static int[] decode(final String aData); static String encode...
### Question: BytecodeLoader { public BytecodeClass loadByteCode(final BytecodeObjectTypeRef aTypeRef) throws IOException, ClassNotFoundException { return loadByteCode(aTypeRef, bytecodeReplacer); } BytecodeLoader(final ClassLoader aClassLoader); BytecodeSignatureParser getSignatureParser(); BytecodeClass loadByteCode(...
### Question: StructuredControlFlow { public void printDebug(final PrintWriter pw) { pw.println("Original:"); printDebug(pw, false); for (final JumpArrow<T> arrow : knownJumpArrows) { pw.println(String.format(" %s %d -> %d", arrow.getEdgeType(), indexOf(arrow.getTail()), indexOf(arrow.getHead()))); } pw.println(); pw.p...
### Question: AnnotationBasedExpiration implements BeanFactoryAware, CustomExpiry<K, V> { protected ExpirationAttributes getDefaultExpirationAttributes() { return this.defaultExpirationAttributes; } AnnotationBasedExpiration(); AnnotationBasedExpiration(ExpirationAttributes defaultExpirationAttributes); static Annotat...
### Question: AnnotationBasedExpiration implements BeanFactoryAware, CustomExpiry<K, V> { protected Expiration getExpiration(Region.Entry<K, V> entry) { return getExpiration(entry.getValue()); } AnnotationBasedExpiration(); AnnotationBasedExpiration(ExpirationAttributes defaultExpirationAttributes); static AnnotationB...
### Question: AnnotationBasedExpiration implements BeanFactoryAware, CustomExpiry<K, V> { protected IdleTimeoutExpiration getIdleTimeout(Region.Entry<K, V> entry) { return getIdleTimeout(entry.getValue()); } AnnotationBasedExpiration(); AnnotationBasedExpiration(ExpirationAttributes defaultExpirationAttributes); stati...
### Question: RegionShortcutConverter implements Converter<String, RegionShortcut> { protected static String toUpperCase(final String value) { return (value != null ? value.toUpperCase().trim() : String.valueOf(value)); } @Override RegionShortcut convert(final String source); }### Answer: @Test public void testToUppe...
### Question: RegionShortcutConverter implements Converter<String, RegionShortcut> { @Override public RegionShortcut convert(final String source) { return RegionShortcut.valueOf(toUpperCase(source)); } @Override RegionShortcut convert(final String source); }### Answer: @Test public void testConvert() { for (RegionSho...
### Question: AnnotationBasedExpiration implements BeanFactoryAware, CustomExpiry<K, V> { protected TimeToLiveExpiration getTimeToLive(Region.Entry<K, V> entry) { return getTimeToLive(entry.getValue()); } AnnotationBasedExpiration(); AnnotationBasedExpiration(ExpirationAttributes defaultExpirationAttributes); static A...
### Question: ListRegionsOnServerFunction implements Function { @Override public String getId() { return this.getClass().getName(); } @Override @SuppressWarnings("unchecked") void execute(FunctionContext functionContext); @Override String getId(); @Override boolean hasResult(); @Override boolean isHA(); @Override bool...
### Question: ListRegionsOnServerFunction implements Function { @Override public boolean hasResult() { return true; } @Override @SuppressWarnings("unchecked") void execute(FunctionContext functionContext); @Override String getId(); @Override boolean hasResult(); @Override boolean isHA(); @Override boolean optimizeForW...
### Question: ClientRegionShortcutConverter implements Converter<String, ClientRegionShortcut> { protected static String toUpperCase(final String value) { return (value != null ? value.toUpperCase().trim() : String.valueOf(value)); } @Override ClientRegionShortcut convert(final String source); }### Answer: @Test publ...
### Question: ClientRegionShortcutConverter implements Converter<String, ClientRegionShortcut> { @Override public ClientRegionShortcut convert(final String source) { return ClientRegionShortcut.valueOf(toUpperCase(source)); } @Override ClientRegionShortcut convert(final String source); }### Answer: @Test public void ...
### Question: GemfireDataSourcePostProcessor implements BeanFactoryAware, BeanPostProcessor { @Override public void setBeanFactory(BeanFactory beanFactory) throws BeansException { if (beanFactory instanceof ConfigurableBeanFactory) { this.beanFactory = (ConfigurableBeanFactory) beanFactory; } else { throw new TypeMisma...
### Question: GemfireDataSourcePostProcessor implements BeanFactoryAware, BeanPostProcessor { boolean containsRegionInformation(Object results) { return results instanceof Object[] && ((Object[]) results).length > 0 && ((Object[]) results)[0] instanceof RegionInformation; } @Override void setBeanFactory(BeanFactory be...
### Question: FactoryDefaultsPoolAdapter extends PoolAdapter { @Override public List<InetSocketAddress> getLocators() { return Collections.emptyList(); } @Override int getFreeConnectionTimeout(); @Override long getIdleTimeout(); @Override int getLoadConditioningInterval(); @Override List<InetSocketAddress> getLocators...
### Question: FactoryDefaultsPoolAdapter extends PoolAdapter { @Override public String getName() { return DEFAULT_POOL_NAME; } @Override int getFreeConnectionTimeout(); @Override long getIdleTimeout(); @Override int getLoadConditioningInterval(); @Override List<InetSocketAddress> getLocators(); @Override int getMaxCon...
### Question: FactoryDefaultsPoolAdapter extends PoolAdapter { @Override public List<InetSocketAddress> getOnlineLocators() { return Collections.emptyList(); } @Override int getFreeConnectionTimeout(); @Override long getIdleTimeout(); @Override int getLoadConditioningInterval(); @Override List<InetSocketAddress> getLo...
### Question: FactoryDefaultsPoolAdapter extends PoolAdapter { @Override public QueryService getQueryService() { return null; } @Override int getFreeConnectionTimeout(); @Override long getIdleTimeout(); @Override int getLoadConditioningInterval(); @Override List<InetSocketAddress> getLocators(); @Override int getMaxCo...
### Question: FactoryDefaultsPoolAdapter extends PoolAdapter { @Override public List<InetSocketAddress> getServers() { return Collections.singletonList(new InetSocketAddress(LOCALHOST, GemfireUtils.DEFAULT_CACHE_SERVER_PORT)); } @Override int getFreeConnectionTimeout(); @Override long getIdleTimeout(); @Override int g...
### Question: AnnotationBasedExpiration implements BeanFactoryAware, CustomExpiry<K, V> { private <T extends Annotation> T getAnnotation(Object obj, Class<T> annotationType) { return AnnotationUtils.getAnnotation(obj.getClass(), annotationType); } AnnotationBasedExpiration(); AnnotationBasedExpiration(ExpirationAttrib...
### Question: FactoryDefaultsPoolAdapter extends PoolAdapter { public void destroy() { destroy(DEFAULT_KEEP_ALIVE); } @Override int getFreeConnectionTimeout(); @Override long getIdleTimeout(); @Override int getLoadConditioningInterval(); @Override List<InetSocketAddress> getLocators(); @Override int getMaxConnections(...
### Question: DefaultableDelegatingPoolAdapter { protected Pool getDelegate() { return this.delegate; } protected DefaultableDelegatingPoolAdapter(Pool delegate); static DefaultableDelegatingPoolAdapter from(Pool delegate); DefaultableDelegatingPoolAdapter preferDefault(); DefaultableDelegatingPoolAdapter preferPool()...
### Question: BatchingResultSender { public void sendArrayResults(Object result) { Assert.isTrue(ObjectUtils.isArray(result), () -> String.format("Object must be an array; was [%s]", ObjectUtils.nullSafeClassName(result))); int arrayLength = Array.getLength(result); ResultSender<Object> resultSender = getResultSender()...
### Question: AbstractFunctionExecution { <T> T executeAndExtract() { Iterable<T> results = execute(); if (isEmpty(results)) { return null; } T result = results.iterator().next(); return throwOnExceptionOrReturn(result); } @SuppressWarnings("rawtypes") AbstractFunctionExecution(Function function, Object... arguments);...
### Question: ExpirationAttributesFactoryBean implements FactoryBean<ExpirationAttributes>, InitializingBean { @Override public boolean isSingleton() { return true; } @Override ExpirationAttributes getObject(); @Override Class<?> getObjectType(); @Override boolean isSingleton(); void setAction(final ExpirationAction a...
### Question: CallableCacheLoaderAdapter implements Callable<V>, CacheLoader<K, V> { public void close() { getCacheLoader().close(); } CallableCacheLoaderAdapter(CacheLoader<K, V> delegate); CallableCacheLoaderAdapter(CacheLoader<K, V> delegate, K key, Region<K, V> region); CallableCacheLoaderAdapter(CacheLoader<K, V...
### Question: CallableCacheLoaderAdapter implements Callable<V>, CacheLoader<K, V> { public V load(LoaderHelper<K, V> loaderHelper) throws CacheLoaderException { return getCacheLoader().load(loaderHelper); } CallableCacheLoaderAdapter(CacheLoader<K, V> delegate); CallableCacheLoaderAdapter(CacheLoader<K, V> delegate, ...
### Question: DiskStoreFactoryBean extends AbstractFactoryBeanSupport<DiskStore> implements InitializingBean { protected void validateCompactionThreshold(Integer compactionThreshold) { Assert.isTrue(compactionThreshold == null || (compactionThreshold >= 0 && compactionThreshold <= 100), String.format("The DiskStore's (...
### Question: DiskStoreFactoryBean extends AbstractFactoryBeanSupport<DiskStore> implements InitializingBean { public void setCompactionThreshold(Integer compactionThreshold) { validateCompactionThreshold(compactionThreshold); this.compactionThreshold = compactionThreshold; } @Override void afterPropertiesSet(); @Over...
### Question: DiskStoreFactoryBean extends AbstractFactoryBeanSupport<DiskStore> implements InitializingBean { @Override public void afterPropertiesSet() throws Exception { String diskStoreName = resolveDiskStoreName(); applyDiskStoreConfigurers(diskStoreName); GemFireCache cache = resolveCache(diskStoreName); DiskStor...
### Question: ExpirationAttributesFactoryBean implements FactoryBean<ExpirationAttributes>, InitializingBean { @Override public void afterPropertiesSet() throws Exception { expirationAttributes = new ExpirationAttributes(getTimeout(), getAction()); } @Override ExpirationAttributes getObject(); @Override Class<?> getOb...
### Question: DataPolicyConverter implements Converter<String, DataPolicy> { @Override public DataPolicy convert(String policyValue) { Policy policy = Policy.getValue(policyValue); return (policy == null ? null : policy.toDataPolicy()); } @Override DataPolicy convert(String policyValue); }### Answer: @Test public voi...
### Question: CacheServerFactoryBean extends AbstractFactoryBeanSupport<CacheServer> implements DisposableBean, InitializingBean, SmartLifecycle { @Override public CacheServer getObject() { return this.cacheServer; } @Override void afterPropertiesSet(); @Override CacheServer getObject(); @Override Class<?> getObjectTy...
### Question: CacheServerFactoryBean extends AbstractFactoryBeanSupport<CacheServer> implements DisposableBean, InitializingBean, SmartLifecycle { @Override public Class<?> getObjectType() { return this.cacheServer != null ? this.cacheServer.getClass() : CacheServer.class; } @Override void afterPropertiesSet(); @Overr...
### Question: ComposableSnapshotFilter implements SnapshotFilter<K, V> { @SuppressWarnings("unchecked") protected static <K, V> SnapshotFilter<K, V> compose(Operator operator, SnapshotFilter<K, V>... snapshotFilters) { SnapshotFilter<K, V> composedSnapshotFilter = null; for (SnapshotFilter<K, V> snapshotFilter : nullSa...
### Question: SnapshotServiceFactoryBean extends AbstractFactoryBeanSupport<SnapshotServiceAdapter<K, V>> implements InitializingBean, DisposableBean, ApplicationListener<SnapshotApplicationEvent<K, V>> { static boolean nullSafeIsDirectory(File file) { return file != null && file.isDirectory(); } @Override @SuppressWa...
### Question: SnapshotServiceFactoryBean extends AbstractFactoryBeanSupport<SnapshotServiceAdapter<K, V>> implements InitializingBean, DisposableBean, ApplicationListener<SnapshotApplicationEvent<K, V>> { static boolean nullSafeIsFile(File file) { return file != null && file.isFile(); } @Override @SuppressWarnings("un...
### Question: SnapshotServiceFactoryBean extends AbstractFactoryBeanSupport<SnapshotServiceAdapter<K, V>> implements InitializingBean, DisposableBean, ApplicationListener<SnapshotApplicationEvent<K, V>> { public void setCache(Cache cache) { this.cache = Optional.ofNullable(cache) .orElseThrow(() -> newIllegalArgumentEx...
### Question: SnapshotServiceFactoryBean extends AbstractFactoryBeanSupport<SnapshotServiceAdapter<K, V>> implements InitializingBean, DisposableBean, ApplicationListener<SnapshotApplicationEvent<K, V>> { protected Cache getCache() { return Optional.ofNullable(this.cache) .orElseThrow(() -> newIllegalStateException("Th...
### Question: SnapshotServiceFactoryBean extends AbstractFactoryBeanSupport<SnapshotServiceAdapter<K, V>> implements InitializingBean, DisposableBean, ApplicationListener<SnapshotApplicationEvent<K, V>> { @Override public boolean isSingleton() { return true; } @Override @SuppressWarnings("unchecked") void afterPropert...
### Question: SnapshotServiceFactoryBean extends AbstractFactoryBeanSupport<SnapshotServiceAdapter<K, V>> implements InitializingBean, DisposableBean, ApplicationListener<SnapshotApplicationEvent<K, V>> { protected SnapshotServiceAdapter<Object, Object> wrap(CacheSnapshotService cacheSnapshotService) { return new Cache...
### Question: SnapshotApplicationEvent extends ApplicationEvent { public boolean matches(Region region) { return (region != null && matches(region.getFullPath())); } SnapshotApplicationEvent(Object source, SnapshotMetadata<K, V>... snapshotMetadata); SnapshotApplicationEvent(Object source, String regionPath, SnapshotM...
### Question: ConnectionEndpointList extends AbstractList<ConnectionEndpoint> { @Override @SuppressWarnings("all") public ConnectionEndpoint[] toArray() { return connectionEndpoints.toArray(new ConnectionEndpoint[connectionEndpoints.size()]); } ConnectionEndpointList(); ConnectionEndpointList(ConnectionEndpoint... con...
### Question: ConnectionEndpointList extends AbstractList<ConnectionEndpoint> { @Override public String toString() { return connectionEndpoints.toString(); } ConnectionEndpointList(); ConnectionEndpointList(ConnectionEndpoint... connectionEndpoints); ConnectionEndpointList(Iterable<ConnectionEndpoint> connectionEndpo...
### Question: SpringContextBootstrappingInitializer implements Declarable, ApplicationListener<ApplicationContextEvent> { public static synchronized ConfigurableApplicationContext getApplicationContext() { Assert.state(applicationContext != null, "A Spring ApplicationContext was not configured and initialized properly"...
### Question: SpringContextBootstrappingInitializer implements Declarable, ApplicationListener<ApplicationContextEvent> { protected ConfigurableApplicationContext initApplicationContext(ConfigurableApplicationContext applicationContext) { Assert.notNull(applicationContext, "ConfigurableApplicationContext must not be nu...
### Question: SpringContextBootstrappingInitializer implements Declarable, ApplicationListener<ApplicationContextEvent> { protected ConfigurableApplicationContext refreshApplicationContext(ConfigurableApplicationContext applicationContext) { Assert.notNull(applicationContext, "ConfigurableApplicationContext must not be...