language stringclasses 1 value | repo stringclasses 60 values | path stringlengths 22 294 | class_span dict | source stringlengths 13 1.16M | target stringlengths 1 113 |
|---|---|---|---|---|---|
java | spring-projects__spring-boot | configuration-metadata/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/MetadataGenerationEnvironment.java | {
"start": 2081,
"end": 14694
} | class ____ {
private static final String NULLABLE_ANNOTATION = "org.jspecify.annotations.Nullable";
private static final Set<String> TYPE_EXCLUDES = Set.of("com.zaxxer.hikari.IConnectionCustomizer",
"groovy.lang.MetaClass", "groovy.text.markup.MarkupTemplateEngine", "java.io.Writer", "java.io.PrintWriter",
"java.lang.ClassLoader", "java.util.concurrent.ThreadFactory", "jakarta.jms.XAConnectionFactory",
"javax.sql.DataSource", "javax.sql.XADataSource", "org.apache.tomcat.jdbc.pool.PoolConfiguration",
"org.apache.tomcat.jdbc.pool.Validator", "org.flywaydb.core.api.callback.FlywayCallback",
"org.flywaydb.core.api.resolver.MigrationResolver");
private static final Set<String> DEPRECATION_EXCLUDES = Set.of(
"org.apache.commons.dbcp2.BasicDataSource#getPassword",
"org.apache.commons.dbcp2.BasicDataSource#getUsername");
private final TypeUtils typeUtils;
private final Elements elements;
private final Messager messager;
private final FieldValuesParser fieldValuesParser;
private final ConfigurationPropertiesSourceResolver sourceResolver;
private final Map<TypeElement, Map<String, Object>> defaultValues = new HashMap<>();
private final Map<TypeElement, SourceMetadata> sources = new HashMap<>();
private final String configurationPropertiesAnnotation;
private final String nestedConfigurationPropertyAnnotation;
private final String configurationPropertiesSourceAnnotation;
private final String deprecatedConfigurationPropertyAnnotation;
private final String constructorBindingAnnotation;
private final String defaultValueAnnotation;
private final Set<String> endpointAnnotations;
private final String readOperationAnnotation;
private final String nameAnnotation;
private final String autowiredAnnotation;
MetadataGenerationEnvironment(ProcessingEnvironment environment, String configurationPropertiesAnnotation,
String configurationPropertiesSourceAnnotation, String nestedConfigurationPropertyAnnotation,
String deprecatedConfigurationPropertyAnnotation, String constructorBindingAnnotation,
String autowiredAnnotation, String defaultValueAnnotation, Set<String> endpointAnnotations,
String readOperationAnnotation, String nameAnnotation) {
this.typeUtils = new TypeUtils(environment);
this.elements = environment.getElementUtils();
this.messager = environment.getMessager();
this.fieldValuesParser = resolveFieldValuesParser(environment);
this.sourceResolver = new ConfigurationPropertiesSourceResolver(environment, this.typeUtils);
this.configurationPropertiesAnnotation = configurationPropertiesAnnotation;
this.configurationPropertiesSourceAnnotation = configurationPropertiesSourceAnnotation;
this.nestedConfigurationPropertyAnnotation = nestedConfigurationPropertyAnnotation;
this.deprecatedConfigurationPropertyAnnotation = deprecatedConfigurationPropertyAnnotation;
this.constructorBindingAnnotation = constructorBindingAnnotation;
this.autowiredAnnotation = autowiredAnnotation;
this.defaultValueAnnotation = defaultValueAnnotation;
this.endpointAnnotations = endpointAnnotations;
this.readOperationAnnotation = readOperationAnnotation;
this.nameAnnotation = nameAnnotation;
}
private static FieldValuesParser resolveFieldValuesParser(ProcessingEnvironment env) {
try {
return new JavaCompilerFieldValuesParser(env);
}
catch (Throwable ex) {
return FieldValuesParser.NONE;
}
}
TypeUtils getTypeUtils() {
return this.typeUtils;
}
Messager getMessager() {
return this.messager;
}
/**
* Return the default value of the given {@code field}.
* @param type the type to consider
* @param field the field or {@code null} if it is not available
* @return the default value or {@code null} if the field does not exist or no default
* value has been detected
*/
Object getFieldDefaultValue(TypeElement type, VariableElement field) {
return (field != null) ? this.defaultValues.computeIfAbsent(type, this::resolveFieldValues)
.get(field.getSimpleName().toString()) : null;
}
/**
* Resolve the {@link SourceMetadata} for the specified property.
* @param field the field of the property (can be {@code null})
* @param getter the getter of the property (can be {@code null})
* @return the {@link SourceMetadata} for the specified property
*/
SourceMetadata resolveSourceMetadata(VariableElement field, ExecutableElement getter) {
if (field != null && field.getEnclosingElement() instanceof TypeElement type) {
return this.sources.computeIfAbsent(type, this.sourceResolver::resolveSource);
}
if (getter != null && getter.getEnclosingElement() instanceof TypeElement type) {
return this.sources.computeIfAbsent(type, this.sourceResolver::resolveSource);
}
return SourceMetadata.EMPTY;
}
boolean isExcluded(TypeMirror type) {
if (type == null) {
return false;
}
String typeName = type.toString();
if (typeName.endsWith("[]")) {
typeName = typeName.substring(0, typeName.length() - 2);
}
return TYPE_EXCLUDES.contains(typeName);
}
boolean isDeprecated(Element element) {
if (element == null) {
return false;
}
String elementName = element.getEnclosingElement() + "#" + element.getSimpleName();
if (DEPRECATION_EXCLUDES.contains(elementName)) {
return false;
}
if (isElementDeprecated(element)) {
return true;
}
if (element instanceof VariableElement || element instanceof ExecutableElement) {
return isElementDeprecated(element.getEnclosingElement());
}
return false;
}
ItemDeprecation resolveItemDeprecation(Element element) {
AnnotationMirror annotation = getAnnotation(element, this.deprecatedConfigurationPropertyAnnotation);
String reason = null;
String replacement = null;
String since = null;
if (annotation != null) {
reason = getAnnotationElementStringValue(annotation, "reason");
replacement = getAnnotationElementStringValue(annotation, "replacement");
since = getAnnotationElementStringValue(annotation, "since");
}
return new ItemDeprecation(reason, replacement, since);
}
boolean hasConstructorBindingAnnotation(ExecutableElement element) {
return hasAnnotation(element, this.constructorBindingAnnotation, true);
}
boolean hasAutowiredAnnotation(ExecutableElement element) {
return hasAnnotation(element, this.autowiredAnnotation);
}
boolean hasAnnotation(Element element, String type) {
return hasAnnotation(element, type, false);
}
boolean hasAnnotation(Element element, String type, boolean considerMetaAnnotations) {
if (element != null) {
for (AnnotationMirror annotation : element.getAnnotationMirrors()) {
if (type.equals(annotation.getAnnotationType().toString())) {
return true;
}
}
if (considerMetaAnnotations) {
Set<Element> seen = new HashSet<>();
for (AnnotationMirror annotation : element.getAnnotationMirrors()) {
if (hasMetaAnnotation(annotation.getAnnotationType().asElement(), type, seen)) {
return true;
}
}
}
}
return false;
}
private boolean hasMetaAnnotation(Element annotationElement, String type, Set<Element> seen) {
if (seen.add(annotationElement)) {
for (AnnotationMirror annotation : annotationElement.getAnnotationMirrors()) {
DeclaredType annotationType = annotation.getAnnotationType();
if (type.equals(annotationType.toString())
|| hasMetaAnnotation(annotationType.asElement(), type, seen)) {
return true;
}
}
}
return false;
}
AnnotationMirror getAnnotation(Element element, String type) {
if (element != null) {
for (AnnotationMirror annotation : element.getAnnotationMirrors()) {
if (type.equals(annotation.getAnnotationType().toString())) {
return annotation;
}
}
}
return null;
}
private AnnotationMirror getTypeUseAnnotation(Element element, String type) {
if (element != null) {
for (AnnotationMirror annotation : element.asType().getAnnotationMirrors()) {
if (type.equals(annotation.getAnnotationType().toString())) {
return annotation;
}
}
}
return null;
}
/**
* Collect the annotations that are annotated or meta-annotated with the specified
* {@link TypeElement annotation}.
* @param element the element to inspect
* @param annotationType the annotation to discover
* @return the annotations that are annotated or meta-annotated with this annotation
*/
List<Element> getElementsAnnotatedOrMetaAnnotatedWith(Element element, TypeElement annotationType) {
LinkedList<Element> stack = new LinkedList<>();
stack.push(element);
collectElementsAnnotatedOrMetaAnnotatedWith(annotationType, stack);
stack.removeFirst();
return Collections.unmodifiableList(stack);
}
private boolean collectElementsAnnotatedOrMetaAnnotatedWith(TypeElement annotationType, LinkedList<Element> stack) {
Element element = stack.peekLast();
for (AnnotationMirror annotation : this.elements.getAllAnnotationMirrors(element)) {
Element annotationElement = annotation.getAnnotationType().asElement();
if (!stack.contains(annotationElement)) {
stack.addLast(annotationElement);
if (annotationElement.equals(annotationType)) {
return true;
}
if (!collectElementsAnnotatedOrMetaAnnotatedWith(annotationType, stack)) {
stack.removeLast();
}
}
}
return false;
}
Map<String, Object> getAnnotationElementValues(AnnotationMirror annotation) {
Map<String, Object> values = new LinkedHashMap<>();
annotation.getElementValues()
.forEach((name, value) -> values.put(name.getSimpleName().toString(), getAnnotationValue(value)));
return values;
}
String getAnnotationElementStringValue(AnnotationMirror annotation, String name) {
return annotation.getElementValues()
.entrySet()
.stream()
.filter((element) -> element.getKey().getSimpleName().toString().equals(name))
.map((element) -> asString(getAnnotationValue(element.getValue())))
.findFirst()
.orElse(null);
}
private Object getAnnotationValue(AnnotationValue annotationValue) {
Object value = annotationValue.getValue();
if (value instanceof List) {
List<Object> values = new ArrayList<>();
((List<?>) value).forEach((v) -> values.add(((AnnotationValue) v).getValue()));
return values;
}
return value;
}
private String asString(Object value) {
return (value == null || value.toString().isEmpty()) ? null : (String) value;
}
TypeElement getConfigurationPropertiesAnnotationElement() {
return this.elements.getTypeElement(this.configurationPropertiesAnnotation);
}
AnnotationMirror getConfigurationPropertiesAnnotation(Element element) {
return getAnnotation(element, this.configurationPropertiesAnnotation);
}
TypeElement getConfigurationPropertiesSourceAnnotationElement() {
return this.elements.getTypeElement(this.configurationPropertiesSourceAnnotation);
}
AnnotationMirror getNestedConfigurationPropertyAnnotation(Element element) {
return getAnnotation(element, this.nestedConfigurationPropertyAnnotation);
}
AnnotationMirror getDefaultValueAnnotation(Element element) {
return getAnnotation(element, this.defaultValueAnnotation);
}
Set<TypeElement> getEndpointAnnotationElements() {
return this.endpointAnnotations.stream()
.map(this.elements::getTypeElement)
.filter(Objects::nonNull)
.collect(Collectors.toSet());
}
AnnotationMirror getReadOperationAnnotation(Element element) {
return getAnnotation(element, this.readOperationAnnotation);
}
AnnotationMirror getNameAnnotation(Element element) {
return getAnnotation(element, this.nameAnnotation);
}
boolean hasNullableAnnotation(Element element) {
return getTypeUseAnnotation(element, NULLABLE_ANNOTATION) != null;
}
private boolean isElementDeprecated(Element element) {
return hasAnnotation(element, "java.lang.Deprecated")
|| hasAnnotation(element, this.deprecatedConfigurationPropertyAnnotation);
}
private Map<String, Object> resolveFieldValues(TypeElement element) {
Map<String, Object> values = new LinkedHashMap<>();
resolveFieldValuesFor(values, element);
return values;
}
private void resolveFieldValuesFor(Map<String, Object> values, TypeElement element) {
try {
this.fieldValuesParser.getFieldValues(element).forEach((name, value) -> {
if (!values.containsKey(name)) {
values.put(name, value);
}
});
}
catch (Exception ex) {
// continue
}
Element superType = this.typeUtils.asElement(element.getSuperclass());
if (superType instanceof TypeElement && superType.asType().getKind() != TypeKind.NONE) {
resolveFieldValuesFor(values, (TypeElement) superType);
}
}
}
| MetadataGenerationEnvironment |
java | apache__camel | components/camel-azure/camel-azure-servicebus/src/main/java/org/apache/camel/component/azure/servicebus/ServiceBusConfigurationOptionsProxy.java | {
"start": 1290,
"end": 3174
} | class ____ {
private final ServiceBusConfiguration configuration;
public ServiceBusConfigurationOptionsProxy(final ServiceBusConfiguration configuration) {
this.configuration = configuration;
}
private static <T> T getObjectFromHeaders(final Exchange exchange, final String headerName, final Class<T> classType) {
return exchange.getIn().getHeader(headerName, classType);
}
public ServiceBusConfiguration getConfiguration() {
return configuration;
}
public ServiceBusTransactionContext getServiceBusTransactionContext(final Exchange exchange) {
return getOption(exchange, ServiceBusConstants.SERVICE_BUS_TRANSACTION_CONTEXT,
configuration::getServiceBusTransactionContext, ServiceBusTransactionContext.class);
}
public OffsetDateTime getScheduledEnqueueTime(final Exchange exchange) {
return getOption(exchange, ServiceBusConstants.SCHEDULED_ENQUEUE_TIME, configuration::getScheduledEnqueueTime,
OffsetDateTime.class);
}
public ServiceBusProducerOperationDefinition getServiceBusProducerOperationDefinition(final Exchange exchange) {
return getOption(exchange, ServiceBusConstants.PRODUCER_OPERATION, configuration::getProducerOperation,
ServiceBusProducerOperationDefinition.class);
}
private <R> R getOption(
final Exchange exchange, final String headerName, final Supplier<R> fallbackFn, final Class<R> type) {
// we first try to look if our value in exchange otherwise fallback to fallbackFn which could be either a function or constant
return ObjectHelper.isEmpty(exchange) || ObjectHelper.isEmpty(getObjectFromHeaders(exchange, headerName, type))
? fallbackFn.get()
: getObjectFromHeaders(exchange, headerName, type);
}
}
| ServiceBusConfigurationOptionsProxy |
java | apache__hadoop | hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/WindowsSecureContainerExecutor.java | {
"start": 10521,
"end": 11220
} | class ____
extends LocalWrapperScriptBuilder {
public WindowsSecureWrapperScriptBuilder(Path containerWorkDir) {
super(containerWorkDir);
}
@Override
protected void writeLocalWrapperScript(Path launchDst, Path pidFile, PrintStream pout) {
pout.format("@call \"%s\"", launchDst);
}
}
/**
* This is a skeleton file system used to elevate certain operations.
* WSCE has to create container dirs under local/userchache/$user but
* this dir itself is owned by $user, with chmod 750. As ther NM has no
* write access, it must delegate the write operations to the privileged
* hadoopwintuilsvc.
*/
private static | WindowsSecureWrapperScriptBuilder |
java | apache__flink | flink-runtime/src/test/java/org/apache/flink/runtime/io/network/util/TestNotificationListener.java | {
"start": 1019,
"end": 2341
} | class ____ implements NotificationListener {
final AtomicInteger numberOfNotifications = new AtomicInteger();
@Override
public void onNotification() {
synchronized (numberOfNotifications) {
numberOfNotifications.incrementAndGet();
numberOfNotifications.notifyAll();
}
}
/**
* Waits on a notification.
*
* <p><strong>Important</strong>: It's necessary to get the current number of notifications
* <em>before</em> registering the listener. Otherwise the wait call may block indefinitely.
*
* <pre>
* MockNotificationListener listener = new MockNotificationListener();
*
* int current = listener.getNumberOfNotifications();
*
* // Register the listener
* register(listener);
*
* listener.waitForNotification(current);
* </pre>
*/
public void waitForNotification(int current) throws InterruptedException {
synchronized (numberOfNotifications) {
while (current == numberOfNotifications.get()) {
numberOfNotifications.wait();
}
}
}
public int getNumberOfNotifications() {
return numberOfNotifications.get();
}
public void reset() {
numberOfNotifications.set(0);
}
}
| TestNotificationListener |
java | apache__camel | core/camel-core/src/test/java/org/apache/camel/processor/RecipientListFineGrainedErrorHandlingTest.java | {
"start": 1302,
"end": 6020
} | class ____ extends ContextTestSupport {
private static int counter;
private static int tries;
@Override
protected Registry createCamelRegistry() throws Exception {
Registry jndi = super.createCamelRegistry();
jndi.bind("fail", new MyFailBean());
return jndi;
}
@Test
public void testRecipientListOk() throws Exception {
context.addRoutes(new RouteBuilder() {
@Override
public void configure() {
onException(Exception.class).redeliveryDelay(0).maximumRedeliveries(2);
from("direct:start").to("mock:a").recipientList(header("foo")).stopOnException();
}
});
context.start();
getMockEndpoint("mock:a").expectedMessageCount(1);
getMockEndpoint("mock:foo").expectedMessageCount(1);
getMockEndpoint("mock:bar").expectedMessageCount(1);
getMockEndpoint("mock:baz").expectedMessageCount(1);
template.sendBodyAndHeader("direct:start", "Hello World", "foo", "mock:foo,mock:bar,mock:baz");
assertMockEndpointsSatisfied();
}
@Test
public void testRecipientListErrorAggregate() throws Exception {
counter = 0;
tries = 0;
context.addRoutes(new RouteBuilder() {
@Override
public void configure() {
from("direct:start").onException(Exception.class).redeliveryDelay(0).maximumRedeliveries(3).end().to("mock:a")
.recipientList(header("foo"))
.aggregationStrategy(new MyAggregationStrategy()).parallelProcessing();
}
});
context.start();
getMockEndpoint("mock:a").expectedMessageCount(1);
// can be 0 or 1 depending whether the task was executed or not (we run
// parallel)
getMockEndpoint("mock:foo").expectedMinimumMessageCount(0);
getMockEndpoint("mock:bar").expectedMinimumMessageCount(0);
getMockEndpoint("mock:baz").expectedMinimumMessageCount(0);
template.sendBodyAndHeader("direct:start", "Hello World", "foo", "mock:foo,mock:bar,bean:fail,mock:baz");
assertMockEndpointsSatisfied();
// bean is invoked 4 times
assertEquals(4, counter);
// of which 3 of them is retries
assertEquals(3, tries);
}
@Test
public void testRecipientListError() throws Exception {
counter = 0;
context.addRoutes(new RouteBuilder() {
@Override
public void configure() {
onException(Exception.class).redeliveryDelay(0).maximumRedeliveries(2);
from("direct:start").to("mock:a").recipientList(header("foo")).stopOnException();
}
});
context.start();
getMockEndpoint("mock:a").expectedMessageCount(1);
getMockEndpoint("mock:foo").expectedMessageCount(1);
getMockEndpoint("mock:bar").expectedMessageCount(1);
getMockEndpoint("mock:baz").expectedMessageCount(0);
try {
template.sendBodyAndHeader("direct:start", "Hello World", "foo", "mock:foo,mock:bar,bean:fail,mock:baz");
fail("Should throw exception");
} catch (Exception e) {
// expected
}
assertMockEndpointsSatisfied();
assertEquals(3, counter);
}
@Test
public void testRecipientListAsBeanError() throws Exception {
counter = 0;
context.addRoutes(new RouteBuilder() {
@Override
public void configure() {
context.setTracing(true);
onException(Exception.class).redeliveryDelay(0).maximumRedeliveries(2);
from("direct:start").to("mock:a").bean(MyRecipientBean.class);
}
});
context.start();
getMockEndpoint("mock:a").expectedMessageCount(1);
getMockEndpoint("mock:foo").expectedMessageCount(1);
getMockEndpoint("mock:bar").expectedMessageCount(1);
getMockEndpoint("mock:baz").expectedMessageCount(0);
try {
template.sendBody("direct:start", "Hello World");
fail("Should throw exception");
} catch (CamelExecutionException e) {
// expected
assertIsInstanceOf(CamelExchangeException.class, e.getCause());
assertIsInstanceOf(IllegalArgumentException.class, e.getCause().getCause());
assertEquals("Damn", e.getCause().getCause().getMessage());
}
assertMockEndpointsSatisfied();
assertEquals(3, counter);
}
@Override
public boolean isUseRouteBuilder() {
return false;
}
public static | RecipientListFineGrainedErrorHandlingTest |
java | quarkusio__quarkus | extensions/resteasy-reactive/rest/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/ResteasyReactiveCDIProcessor.java | {
"start": 9331,
"end": 10754
} | class ____ exception mappers do not run
// interceptors bound using class-level interceptor bindings (like security)
ctx.transform().add(DotNames.NO_CLASS_INTERCEPTORS).done();
}
}));
}
@BuildStep
void subResourcesAsBeans(ResourceScanningResultBuildItem setupEndpointsResult,
List<SubResourcesAsBeansBuildItem> subResourcesAsBeans,
BuildProducer<UnremovableBeanBuildItem> unremovableProducer,
BuildProducer<AdditionalBeanBuildItem> additionalProducer) {
Map<DotName, ClassInfo> possibleSubResources = setupEndpointsResult.getResult().getPossibleSubResources();
if (possibleSubResources.isEmpty()) {
return;
}
// make SubResources unremovable - this will only apply if they become beans by some other means
unremovableProducer.produce(UnremovableBeanBuildItem.beanTypes(possibleSubResources.keySet()));
if (subResourcesAsBeans.isEmpty()) {
return;
}
// now actually make SubResources beans as it was requested via build item
AdditionalBeanBuildItem.Builder builder = AdditionalBeanBuildItem.builder();
for (DotName subResourceClass : possibleSubResources.keySet()) {
builder.addBeanClass(subResourceClass.toString());
}
additionalProducer.produce(builder.build());
}
// when an | level |
java | google__guava | android/guava/src/com/google/common/collect/FilteredEntryMultimap.java | {
"start": 2634,
"end": 5284
} | class ____ implements Predicate<V> {
@ParametricNullness private final K key;
ValuePredicate(@ParametricNullness K key) {
this.key = key;
}
@Override
public boolean apply(@ParametricNullness V value) {
return satisfies(key, value);
}
}
static <E extends @Nullable Object> Collection<E> filterCollection(
Collection<E> collection, Predicate<? super E> predicate) {
if (collection instanceof Set) {
return Sets.filter((Set<E>) collection, predicate);
} else {
return Collections2.filter(collection, predicate);
}
}
@Override
public boolean containsKey(@Nullable Object key) {
return asMap().get(key) != null;
}
@Override
public Collection<V> removeAll(@Nullable Object key) {
return MoreObjects.firstNonNull(asMap().remove(key), unmodifiableEmptyCollection());
}
@SuppressWarnings("EmptyList") // ImmutableList doesn't support nullable element types
Collection<V> unmodifiableEmptyCollection() {
// These return false, rather than throwing a UOE, on remove calls.
return (unfiltered instanceof SetMultimap) ? emptySet() : emptyList();
}
@Override
public void clear() {
entries().clear();
}
@Override
public Collection<V> get(@ParametricNullness K key) {
return filterCollection(unfiltered.get(key), new ValuePredicate(key));
}
@Override
Collection<Entry<K, V>> createEntries() {
return filterCollection(unfiltered.entries(), predicate);
}
@Override
Collection<V> createValues() {
return new FilteredMultimapValues<>(this);
}
@Override
Iterator<Entry<K, V>> entryIterator() {
throw new AssertionError("should never be called");
}
@Override
Map<K, Collection<V>> createAsMap() {
return new AsMap();
}
@Override
Set<K> createKeySet() {
return asMap().keySet();
}
boolean removeEntriesIf(Predicate<? super Entry<K, Collection<V>>> predicate) {
Iterator<Entry<K, Collection<V>>> entryIterator = unfiltered.asMap().entrySet().iterator();
boolean changed = false;
while (entryIterator.hasNext()) {
Entry<K, Collection<V>> entry = entryIterator.next();
K key = entry.getKey();
Collection<V> collection = filterCollection(entry.getValue(), new ValuePredicate(key));
if (!collection.isEmpty()
&& predicate.apply(Maps.<K, Collection<V>>immutableEntry(key, collection))) {
if (collection.size() == entry.getValue().size()) {
entryIterator.remove();
} else {
collection.clear();
}
changed = true;
}
}
return changed;
}
@WeakOuter
private final | ValuePredicate |
java | FasterXML__jackson-databind | src/test/java/tools/jackson/databind/deser/builder/BuilderInfiniteLoop1979Test.java | {
"start": 1902,
"end": 2448
} | class ____
{
public int element1;
public String element2;
}
/*
/**********************************************************************
/* Test methods
/**********************************************************************
*/
// for [databind#1978]
@Test
public void testInfiniteLoop1978() throws Exception
{
String json = "{\"sub.el1\":34,\"sub.el2\":\"some text\"}";
Bean bean = sharedMapper().readValue( json, Bean.class );
assertNotNull(bean);
}
}
| SubBean |
java | mybatis__mybatis-3 | src/test/java/org/apache/ibatis/submitted/heavy_initial_load/Code.java | {
"start": 714,
"end": 51654
} | class ____ {
public static final Code _1 = new Code("1");
public static final Code _2 = new Code("2");
public static final Code _3 = new Code("3");
public static final Code _4 = new Code("4");
public static final Code _5 = new Code("5");
public static final Code _6 = new Code("6");
public static final Code _7 = new Code("7");
public static final Code _8 = new Code("8");
public static final Code _9 = new Code("9");
public static final Code _10 = new Code("10");
public static final Code _11 = new Code("11");
public static final Code _12 = new Code("12");
public static final Code _13 = new Code("13");
public static final Code _14 = new Code("14");
public static final Code _15 = new Code("15");
public static final Code _16 = new Code("16");
public static final Code _17 = new Code("17");
public static final Code _18 = new Code("18");
public static final Code _19 = new Code("19");
public static final Code _20 = new Code("20");
public static final Code _21 = new Code("21");
public static final Code _22 = new Code("22");
public static final Code _23 = new Code("23");
public static final Code _24 = new Code("24");
public static final Code _25 = new Code("25");
public static final Code _26 = new Code("26");
public static final Code _27 = new Code("27");
public static final Code _28 = new Code("28");
public static final Code _29 = new Code("29");
public static final Code _30 = new Code("30");
public static final Code _31 = new Code("31");
public static final Code _32 = new Code("32");
public static final Code _33 = new Code("33");
public static final Code _34 = new Code("34");
public static final Code _35 = new Code("35");
public static final Code _36 = new Code("36");
public static final Code _37 = new Code("37");
public static final Code _38 = new Code("38");
public static final Code _39 = new Code("39");
public static final Code _40 = new Code("40");
public static final Code _41 = new Code("41");
public static final Code _42 = new Code("42");
public static final Code _43 = new Code("43");
public static final Code _44 = new Code("44");
public static final Code _45 = new Code("45");
public static final Code _46 = new Code("46");
public static final Code _47 = new Code("47");
public static final Code _48 = new Code("48");
public static final Code _49 = new Code("49");
public static final Code _50 = new Code("50");
public static final Code _51 = new Code("51");
public static final Code _52 = new Code("52");
public static final Code _53 = new Code("53");
public static final Code _54 = new Code("54");
public static final Code _55 = new Code("55");
public static final Code _56 = new Code("56");
public static final Code _57 = new Code("57");
public static final Code _58 = new Code("58");
public static final Code _59 = new Code("59");
public static final Code _60 = new Code("60");
public static final Code _61 = new Code("61");
public static final Code _62 = new Code("62");
public static final Code _63 = new Code("63");
public static final Code _64 = new Code("64");
public static final Code _65 = new Code("65");
public static final Code _66 = new Code("66");
public static final Code _67 = new Code("67");
public static final Code _68 = new Code("68");
public static final Code _69 = new Code("69");
public static final Code _70 = new Code("70");
public static final Code _71 = new Code("71");
public static final Code _72 = new Code("72");
public static final Code _73 = new Code("73");
public static final Code _74 = new Code("74");
public static final Code _75 = new Code("75");
public static final Code _76 = new Code("76");
public static final Code _77 = new Code("77");
public static final Code _78 = new Code("78");
public static final Code _79 = new Code("79");
public static final Code _80 = new Code("80");
public static final Code _81 = new Code("81");
public static final Code _82 = new Code("82");
public static final Code _83 = new Code("83");
public static final Code _84 = new Code("84");
public static final Code _85 = new Code("85");
public static final Code _86 = new Code("86");
public static final Code _87 = new Code("87");
public static final Code _88 = new Code("88");
public static final Code _89 = new Code("89");
public static final Code _90 = new Code("90");
public static final Code _91 = new Code("91");
public static final Code _92 = new Code("92");
public static final Code _93 = new Code("93");
public static final Code _94 = new Code("94");
public static final Code _95 = new Code("95");
public static final Code _96 = new Code("96");
public static final Code _97 = new Code("97");
public static final Code _98 = new Code("98");
public static final Code _99 = new Code("99");
public static final Code _100 = new Code("100");
public static final Code _101 = new Code("101");
public static final Code _102 = new Code("102");
public static final Code _103 = new Code("103");
public static final Code _104 = new Code("104");
public static final Code _105 = new Code("105");
public static final Code _106 = new Code("106");
public static final Code _107 = new Code("107");
public static final Code _108 = new Code("108");
public static final Code _109 = new Code("109");
public static final Code _110 = new Code("110");
public static final Code _111 = new Code("111");
public static final Code _112 = new Code("112");
public static final Code _113 = new Code("113");
public static final Code _114 = new Code("114");
public static final Code _115 = new Code("115");
public static final Code _116 = new Code("116");
public static final Code _117 = new Code("117");
public static final Code _118 = new Code("118");
public static final Code _119 = new Code("119");
public static final Code _120 = new Code("120");
public static final Code _121 = new Code("121");
public static final Code _122 = new Code("122");
public static final Code _123 = new Code("123");
public static final Code _124 = new Code("124");
public static final Code _125 = new Code("125");
public static final Code _126 = new Code("126");
public static final Code _127 = new Code("127");
public static final Code _128 = new Code("128");
public static final Code _129 = new Code("129");
public static final Code _130 = new Code("130");
public static final Code _131 = new Code("131");
public static final Code _132 = new Code("132");
public static final Code _133 = new Code("133");
public static final Code _134 = new Code("134");
public static final Code _135 = new Code("135");
public static final Code _136 = new Code("136");
public static final Code _137 = new Code("137");
public static final Code _138 = new Code("138");
public static final Code _139 = new Code("139");
public static final Code _140 = new Code("140");
public static final Code _141 = new Code("141");
public static final Code _142 = new Code("142");
public static final Code _143 = new Code("143");
public static final Code _144 = new Code("144");
public static final Code _145 = new Code("145");
public static final Code _146 = new Code("146");
public static final Code _147 = new Code("147");
public static final Code _148 = new Code("148");
public static final Code _149 = new Code("149");
public static final Code _150 = new Code("150");
public static final Code _151 = new Code("151");
public static final Code _152 = new Code("152");
public static final Code _153 = new Code("153");
public static final Code _154 = new Code("154");
public static final Code _155 = new Code("155");
public static final Code _156 = new Code("156");
public static final Code _157 = new Code("157");
public static final Code _158 = new Code("158");
public static final Code _159 = new Code("159");
public static final Code _160 = new Code("160");
public static final Code _161 = new Code("161");
public static final Code _162 = new Code("162");
public static final Code _163 = new Code("163");
public static final Code _164 = new Code("164");
public static final Code _165 = new Code("165");
public static final Code _166 = new Code("166");
public static final Code _167 = new Code("167");
public static final Code _168 = new Code("168");
public static final Code _169 = new Code("169");
public static final Code _170 = new Code("170");
public static final Code _171 = new Code("171");
public static final Code _172 = new Code("172");
public static final Code _173 = new Code("173");
public static final Code _174 = new Code("174");
public static final Code _175 = new Code("175");
public static final Code _176 = new Code("176");
public static final Code _177 = new Code("177");
public static final Code _178 = new Code("178");
public static final Code _179 = new Code("179");
public static final Code _180 = new Code("180");
public static final Code _181 = new Code("181");
public static final Code _182 = new Code("182");
public static final Code _183 = new Code("183");
public static final Code _184 = new Code("184");
public static final Code _185 = new Code("185");
public static final Code _186 = new Code("186");
public static final Code _187 = new Code("187");
public static final Code _188 = new Code("188");
public static final Code _189 = new Code("189");
public static final Code _190 = new Code("190");
public static final Code _191 = new Code("191");
public static final Code _192 = new Code("192");
public static final Code _193 = new Code("193");
public static final Code _194 = new Code("194");
public static final Code _195 = new Code("195");
public static final Code _196 = new Code("196");
public static final Code _197 = new Code("197");
public static final Code _198 = new Code("198");
public static final Code _199 = new Code("199");
public static final Code _200 = new Code("200");
public static final Code _201 = new Code("201");
public static final Code _202 = new Code("202");
public static final Code _203 = new Code("203");
public static final Code _204 = new Code("204");
public static final Code _205 = new Code("205");
public static final Code _206 = new Code("206");
public static final Code _207 = new Code("207");
public static final Code _208 = new Code("208");
public static final Code _209 = new Code("209");
public static final Code _210 = new Code("210");
public static final Code _211 = new Code("211");
public static final Code _212 = new Code("212");
public static final Code _213 = new Code("213");
public static final Code _214 = new Code("214");
public static final Code _215 = new Code("215");
public static final Code _216 = new Code("216");
public static final Code _217 = new Code("217");
public static final Code _218 = new Code("218");
public static final Code _219 = new Code("219");
public static final Code _220 = new Code("220");
public static final Code _221 = new Code("221");
public static final Code _222 = new Code("222");
public static final Code _223 = new Code("223");
public static final Code _224 = new Code("224");
public static final Code _225 = new Code("225");
public static final Code _226 = new Code("226");
public static final Code _227 = new Code("227");
public static final Code _228 = new Code("228");
public static final Code _229 = new Code("229");
public static final Code _230 = new Code("230");
public static final Code _231 = new Code("231");
public static final Code _232 = new Code("232");
public static final Code _233 = new Code("233");
public static final Code _234 = new Code("234");
public static final Code _235 = new Code("235");
public static final Code _236 = new Code("236");
public static final Code _237 = new Code("237");
public static final Code _238 = new Code("238");
public static final Code _239 = new Code("239");
public static final Code _240 = new Code("240");
public static final Code _241 = new Code("241");
public static final Code _242 = new Code("242");
public static final Code _243 = new Code("243");
public static final Code _244 = new Code("244");
public static final Code _245 = new Code("245");
public static final Code _246 = new Code("246");
public static final Code _247 = new Code("247");
public static final Code _248 = new Code("248");
public static final Code _249 = new Code("249");
public static final Code _250 = new Code("250");
public static final Code _251 = new Code("251");
public static final Code _252 = new Code("252");
public static final Code _253 = new Code("253");
public static final Code _254 = new Code("254");
public static final Code _255 = new Code("255");
public static final Code _256 = new Code("256");
public static final Code _257 = new Code("257");
public static final Code _258 = new Code("258");
public static final Code _259 = new Code("259");
public static final Code _260 = new Code("260");
public static final Code _261 = new Code("261");
public static final Code _262 = new Code("262");
public static final Code _263 = new Code("263");
public static final Code _264 = new Code("264");
public static final Code _265 = new Code("265");
public static final Code _266 = new Code("266");
public static final Code _267 = new Code("267");
public static final Code _268 = new Code("268");
public static final Code _269 = new Code("269");
public static final Code _270 = new Code("270");
public static final Code _271 = new Code("271");
public static final Code _272 = new Code("272");
public static final Code _273 = new Code("273");
public static final Code _274 = new Code("274");
public static final Code _275 = new Code("275");
public static final Code _276 = new Code("276");
public static final Code _277 = new Code("277");
public static final Code _278 = new Code("278");
public static final Code _279 = new Code("279");
public static final Code _280 = new Code("280");
public static final Code _281 = new Code("281");
public static final Code _282 = new Code("282");
public static final Code _283 = new Code("283");
public static final Code _284 = new Code("284");
public static final Code _285 = new Code("285");
public static final Code _286 = new Code("286");
public static final Code _287 = new Code("287");
public static final Code _288 = new Code("288");
public static final Code _289 = new Code("289");
public static final Code _290 = new Code("290");
public static final Code _291 = new Code("291");
public static final Code _292 = new Code("292");
public static final Code _293 = new Code("293");
public static final Code _294 = new Code("294");
public static final Code _295 = new Code("295");
public static final Code _296 = new Code("296");
public static final Code _297 = new Code("297");
public static final Code _298 = new Code("298");
public static final Code _299 = new Code("299");
public static final Code _300 = new Code("300");
public static final Code _301 = new Code("301");
public static final Code _302 = new Code("302");
public static final Code _303 = new Code("303");
public static final Code _304 = new Code("304");
public static final Code _305 = new Code("305");
public static final Code _306 = new Code("306");
public static final Code _307 = new Code("307");
public static final Code _308 = new Code("308");
public static final Code _309 = new Code("309");
public static final Code _310 = new Code("310");
public static final Code _311 = new Code("311");
public static final Code _312 = new Code("312");
public static final Code _313 = new Code("313");
public static final Code _314 = new Code("314");
public static final Code _315 = new Code("315");
public static final Code _316 = new Code("316");
public static final Code _317 = new Code("317");
public static final Code _318 = new Code("318");
public static final Code _319 = new Code("319");
public static final Code _320 = new Code("320");
public static final Code _321 = new Code("321");
public static final Code _322 = new Code("322");
public static final Code _323 = new Code("323");
public static final Code _324 = new Code("324");
public static final Code _325 = new Code("325");
public static final Code _326 = new Code("326");
public static final Code _327 = new Code("327");
public static final Code _328 = new Code("328");
public static final Code _329 = new Code("329");
public static final Code _330 = new Code("330");
public static final Code _331 = new Code("331");
public static final Code _332 = new Code("332");
public static final Code _333 = new Code("333");
public static final Code _334 = new Code("334");
public static final Code _335 = new Code("335");
public static final Code _336 = new Code("336");
public static final Code _337 = new Code("337");
public static final Code _338 = new Code("338");
public static final Code _339 = new Code("339");
public static final Code _340 = new Code("340");
public static final Code _341 = new Code("341");
public static final Code _342 = new Code("342");
public static final Code _343 = new Code("343");
public static final Code _344 = new Code("344");
public static final Code _345 = new Code("345");
public static final Code _346 = new Code("346");
public static final Code _347 = new Code("347");
public static final Code _348 = new Code("348");
public static final Code _349 = new Code("349");
public static final Code _350 = new Code("350");
public static final Code _351 = new Code("351");
public static final Code _352 = new Code("352");
public static final Code _353 = new Code("353");
public static final Code _354 = new Code("354");
public static final Code _355 = new Code("355");
public static final Code _356 = new Code("356");
public static final Code _357 = new Code("357");
public static final Code _358 = new Code("358");
public static final Code _359 = new Code("359");
public static final Code _360 = new Code("360");
public static final Code _361 = new Code("361");
public static final Code _362 = new Code("362");
public static final Code _363 = new Code("363");
public static final Code _364 = new Code("364");
public static final Code _365 = new Code("365");
public static final Code _366 = new Code("366");
public static final Code _367 = new Code("367");
public static final Code _368 = new Code("368");
public static final Code _369 = new Code("369");
public static final Code _370 = new Code("370");
public static final Code _371 = new Code("371");
public static final Code _372 = new Code("372");
public static final Code _373 = new Code("373");
public static final Code _374 = new Code("374");
public static final Code _375 = new Code("375");
public static final Code _376 = new Code("376");
public static final Code _377 = new Code("377");
public static final Code _378 = new Code("378");
public static final Code _379 = new Code("379");
public static final Code _380 = new Code("380");
public static final Code _381 = new Code("381");
public static final Code _382 = new Code("382");
public static final Code _383 = new Code("383");
public static final Code _384 = new Code("384");
public static final Code _385 = new Code("385");
public static final Code _386 = new Code("386");
public static final Code _387 = new Code("387");
public static final Code _388 = new Code("388");
public static final Code _389 = new Code("389");
public static final Code _390 = new Code("390");
public static final Code _391 = new Code("391");
public static final Code _392 = new Code("392");
public static final Code _393 = new Code("393");
public static final Code _394 = new Code("394");
public static final Code _395 = new Code("395");
public static final Code _396 = new Code("396");
public static final Code _397 = new Code("397");
public static final Code _398 = new Code("398");
public static final Code _399 = new Code("399");
public static final Code _400 = new Code("400");
public static final Code _401 = new Code("401");
public static final Code _402 = new Code("402");
public static final Code _403 = new Code("403");
public static final Code _404 = new Code("404");
public static final Code _405 = new Code("405");
public static final Code _406 = new Code("406");
public static final Code _407 = new Code("407");
public static final Code _408 = new Code("408");
public static final Code _409 = new Code("409");
public static final Code _410 = new Code("410");
public static final Code _411 = new Code("411");
public static final Code _412 = new Code("412");
public static final Code _413 = new Code("413");
public static final Code _414 = new Code("414");
public static final Code _415 = new Code("415");
public static final Code _416 = new Code("416");
public static final Code _417 = new Code("417");
public static final Code _418 = new Code("418");
public static final Code _419 = new Code("419");
public static final Code _420 = new Code("420");
public static final Code _421 = new Code("421");
public static final Code _422 = new Code("422");
public static final Code _423 = new Code("423");
public static final Code _424 = new Code("424");
public static final Code _425 = new Code("425");
public static final Code _426 = new Code("426");
public static final Code _427 = new Code("427");
public static final Code _428 = new Code("428");
public static final Code _429 = new Code("429");
public static final Code _430 = new Code("430");
public static final Code _431 = new Code("431");
public static final Code _432 = new Code("432");
public static final Code _433 = new Code("433");
public static final Code _434 = new Code("434");
public static final Code _435 = new Code("435");
public static final Code _436 = new Code("436");
public static final Code _437 = new Code("437");
public static final Code _438 = new Code("438");
public static final Code _439 = new Code("439");
public static final Code _440 = new Code("440");
public static final Code _441 = new Code("441");
public static final Code _442 = new Code("442");
public static final Code _443 = new Code("443");
public static final Code _444 = new Code("444");
public static final Code _445 = new Code("445");
public static final Code _446 = new Code("446");
public static final Code _447 = new Code("447");
public static final Code _448 = new Code("448");
public static final Code _449 = new Code("449");
public static final Code _450 = new Code("450");
public static final Code _451 = new Code("451");
public static final Code _452 = new Code("452");
public static final Code _453 = new Code("453");
public static final Code _454 = new Code("454");
public static final Code _455 = new Code("455");
public static final Code _456 = new Code("456");
public static final Code _457 = new Code("457");
public static final Code _458 = new Code("458");
public static final Code _459 = new Code("459");
public static final Code _460 = new Code("460");
public static final Code _461 = new Code("461");
public static final Code _462 = new Code("462");
public static final Code _463 = new Code("463");
public static final Code _464 = new Code("464");
public static final Code _465 = new Code("465");
public static final Code _466 = new Code("466");
public static final Code _467 = new Code("467");
public static final Code _468 = new Code("468");
public static final Code _469 = new Code("469");
public static final Code _470 = new Code("470");
public static final Code _471 = new Code("471");
public static final Code _472 = new Code("472");
public static final Code _473 = new Code("473");
public static final Code _474 = new Code("474");
public static final Code _475 = new Code("475");
public static final Code _476 = new Code("476");
public static final Code _477 = new Code("477");
public static final Code _478 = new Code("478");
public static final Code _479 = new Code("479");
public static final Code _480 = new Code("480");
public static final Code _481 = new Code("481");
public static final Code _482 = new Code("482");
public static final Code _483 = new Code("483");
public static final Code _484 = new Code("484");
public static final Code _485 = new Code("485");
public static final Code _486 = new Code("486");
public static final Code _487 = new Code("487");
public static final Code _488 = new Code("488");
public static final Code _489 = new Code("489");
public static final Code _490 = new Code("490");
public static final Code _491 = new Code("491");
public static final Code _492 = new Code("492");
public static final Code _493 = new Code("493");
public static final Code _494 = new Code("494");
public static final Code _495 = new Code("495");
public static final Code _496 = new Code("496");
public static final Code _497 = new Code("497");
public static final Code _498 = new Code("498");
public static final Code _499 = new Code("499");
public static final Code _500 = new Code("500");
public static final Code _501 = new Code("501");
public static final Code _502 = new Code("502");
public static final Code _503 = new Code("503");
public static final Code _504 = new Code("504");
public static final Code _505 = new Code("505");
public static final Code _506 = new Code("506");
public static final Code _507 = new Code("507");
public static final Code _508 = new Code("508");
public static final Code _509 = new Code("509");
public static final Code _510 = new Code("510");
public static final Code _511 = new Code("511");
public static final Code _512 = new Code("512");
public static final Code _513 = new Code("513");
public static final Code _514 = new Code("514");
public static final Code _515 = new Code("515");
public static final Code _516 = new Code("516");
public static final Code _517 = new Code("517");
public static final Code _518 = new Code("518");
public static final Code _519 = new Code("519");
public static final Code _520 = new Code("520");
public static final Code _521 = new Code("521");
public static final Code _522 = new Code("522");
public static final Code _523 = new Code("523");
public static final Code _524 = new Code("524");
public static final Code _525 = new Code("525");
public static final Code _526 = new Code("526");
public static final Code _527 = new Code("527");
public static final Code _528 = new Code("528");
public static final Code _529 = new Code("529");
public static final Code _530 = new Code("530");
public static final Code _531 = new Code("531");
public static final Code _532 = new Code("532");
public static final Code _533 = new Code("533");
public static final Code _534 = new Code("534");
public static final Code _535 = new Code("535");
public static final Code _536 = new Code("536");
public static final Code _537 = new Code("537");
public static final Code _538 = new Code("538");
public static final Code _539 = new Code("539");
public static final Code _540 = new Code("540");
public static final Code _541 = new Code("541");
public static final Code _542 = new Code("542");
public static final Code _543 = new Code("543");
public static final Code _544 = new Code("544");
public static final Code _545 = new Code("545");
public static final Code _546 = new Code("546");
public static final Code _547 = new Code("547");
public static final Code _548 = new Code("548");
public static final Code _549 = new Code("549");
public static final Code _550 = new Code("550");
public static final Code _551 = new Code("551");
public static final Code _552 = new Code("552");
public static final Code _553 = new Code("553");
public static final Code _554 = new Code("554");
public static final Code _555 = new Code("555");
public static final Code _556 = new Code("556");
public static final Code _557 = new Code("557");
public static final Code _558 = new Code("558");
public static final Code _559 = new Code("559");
public static final Code _560 = new Code("560");
public static final Code _561 = new Code("561");
public static final Code _562 = new Code("562");
public static final Code _563 = new Code("563");
public static final Code _564 = new Code("564");
public static final Code _565 = new Code("565");
public static final Code _566 = new Code("566");
public static final Code _567 = new Code("567");
public static final Code _568 = new Code("568");
public static final Code _569 = new Code("569");
public static final Code _570 = new Code("570");
public static final Code _571 = new Code("571");
public static final Code _572 = new Code("572");
public static final Code _573 = new Code("573");
public static final Code _574 = new Code("574");
public static final Code _575 = new Code("575");
public static final Code _576 = new Code("576");
public static final Code _577 = new Code("577");
public static final Code _578 = new Code("578");
public static final Code _579 = new Code("579");
public static final Code _580 = new Code("580");
public static final Code _581 = new Code("581");
public static final Code _582 = new Code("582");
public static final Code _583 = new Code("583");
public static final Code _584 = new Code("584");
public static final Code _585 = new Code("585");
public static final Code _586 = new Code("586");
public static final Code _587 = new Code("587");
public static final Code _588 = new Code("588");
public static final Code _589 = new Code("589");
public static final Code _590 = new Code("590");
public static final Code _591 = new Code("591");
public static final Code _592 = new Code("592");
public static final Code _593 = new Code("593");
public static final Code _594 = new Code("594");
public static final Code _595 = new Code("595");
public static final Code _596 = new Code("596");
public static final Code _597 = new Code("597");
public static final Code _598 = new Code("598");
public static final Code _599 = new Code("599");
public static final Code _600 = new Code("600");
public static final Code _601 = new Code("601");
public static final Code _602 = new Code("602");
public static final Code _603 = new Code("603");
public static final Code _604 = new Code("604");
public static final Code _605 = new Code("605");
public static final Code _606 = new Code("606");
public static final Code _607 = new Code("607");
public static final Code _608 = new Code("608");
public static final Code _609 = new Code("609");
public static final Code _610 = new Code("610");
public static final Code _611 = new Code("611");
public static final Code _612 = new Code("612");
public static final Code _613 = new Code("613");
public static final Code _614 = new Code("614");
public static final Code _615 = new Code("615");
public static final Code _616 = new Code("616");
public static final Code _617 = new Code("617");
public static final Code _618 = new Code("618");
public static final Code _619 = new Code("619");
public static final Code _620 = new Code("620");
public static final Code _621 = new Code("621");
public static final Code _622 = new Code("622");
public static final Code _623 = new Code("623");
public static final Code _624 = new Code("624");
public static final Code _625 = new Code("625");
public static final Code _626 = new Code("626");
public static final Code _627 = new Code("627");
public static final Code _628 = new Code("628");
public static final Code _629 = new Code("629");
public static final Code _630 = new Code("630");
public static final Code _631 = new Code("631");
public static final Code _632 = new Code("632");
public static final Code _633 = new Code("633");
public static final Code _634 = new Code("634");
public static final Code _635 = new Code("635");
public static final Code _636 = new Code("636");
public static final Code _637 = new Code("637");
public static final Code _638 = new Code("638");
public static final Code _639 = new Code("639");
public static final Code _640 = new Code("640");
public static final Code _641 = new Code("641");
public static final Code _642 = new Code("642");
public static final Code _643 = new Code("643");
public static final Code _644 = new Code("644");
public static final Code _645 = new Code("645");
public static final Code _646 = new Code("646");
public static final Code _647 = new Code("647");
public static final Code _648 = new Code("648");
public static final Code _649 = new Code("649");
public static final Code _650 = new Code("650");
public static final Code _651 = new Code("651");
public static final Code _652 = new Code("652");
public static final Code _653 = new Code("653");
public static final Code _654 = new Code("654");
public static final Code _655 = new Code("655");
public static final Code _656 = new Code("656");
public static final Code _657 = new Code("657");
public static final Code _658 = new Code("658");
public static final Code _659 = new Code("659");
public static final Code _660 = new Code("660");
public static final Code _661 = new Code("661");
public static final Code _662 = new Code("662");
public static final Code _663 = new Code("663");
public static final Code _664 = new Code("664");
public static final Code _665 = new Code("665");
public static final Code _666 = new Code("666");
public static final Code _667 = new Code("667");
public static final Code _668 = new Code("668");
public static final Code _669 = new Code("669");
public static final Code _670 = new Code("670");
public static final Code _671 = new Code("671");
public static final Code _672 = new Code("672");
public static final Code _673 = new Code("673");
public static final Code _674 = new Code("674");
public static final Code _675 = new Code("675");
public static final Code _676 = new Code("676");
public static final Code _677 = new Code("677");
public static final Code _678 = new Code("678");
public static final Code _679 = new Code("679");
public static final Code _680 = new Code("680");
public static final Code _681 = new Code("681");
public static final Code _682 = new Code("682");
public static final Code _683 = new Code("683");
public static final Code _684 = new Code("684");
public static final Code _685 = new Code("685");
public static final Code _686 = new Code("686");
public static final Code _687 = new Code("687");
public static final Code _688 = new Code("688");
public static final Code _689 = new Code("689");
public static final Code _690 = new Code("690");
public static final Code _691 = new Code("691");
public static final Code _692 = new Code("692");
public static final Code _693 = new Code("693");
public static final Code _694 = new Code("694");
public static final Code _695 = new Code("695");
public static final Code _696 = new Code("696");
public static final Code _697 = new Code("697");
public static final Code _698 = new Code("698");
public static final Code _699 = new Code("699");
public static final Code _700 = new Code("700");
public static final Code _701 = new Code("701");
public static final Code _702 = new Code("702");
public static final Code _703 = new Code("703");
public static final Code _704 = new Code("704");
public static final Code _705 = new Code("705");
public static final Code _706 = new Code("706");
public static final Code _707 = new Code("707");
public static final Code _708 = new Code("708");
public static final Code _709 = new Code("709");
public static final Code _710 = new Code("710");
public static final Code _711 = new Code("711");
public static final Code _712 = new Code("712");
public static final Code _713 = new Code("713");
public static final Code _714 = new Code("714");
public static final Code _715 = new Code("715");
public static final Code _716 = new Code("716");
public static final Code _717 = new Code("717");
public static final Code _718 = new Code("718");
public static final Code _719 = new Code("719");
public static final Code _720 = new Code("720");
public static final Code _721 = new Code("721");
public static final Code _722 = new Code("722");
public static final Code _723 = new Code("723");
public static final Code _724 = new Code("724");
public static final Code _725 = new Code("725");
public static final Code _726 = new Code("726");
public static final Code _727 = new Code("727");
public static final Code _728 = new Code("728");
public static final Code _729 = new Code("729");
public static final Code _730 = new Code("730");
public static final Code _731 = new Code("731");
public static final Code _732 = new Code("732");
public static final Code _733 = new Code("733");
public static final Code _734 = new Code("734");
public static final Code _735 = new Code("735");
public static final Code _736 = new Code("736");
public static final Code _737 = new Code("737");
public static final Code _738 = new Code("738");
public static final Code _739 = new Code("739");
public static final Code _740 = new Code("740");
public static final Code _741 = new Code("741");
public static final Code _742 = new Code("742");
public static final Code _743 = new Code("743");
public static final Code _744 = new Code("744");
public static final Code _745 = new Code("745");
public static final Code _746 = new Code("746");
public static final Code _747 = new Code("747");
public static final Code _748 = new Code("748");
public static final Code _749 = new Code("749");
public static final Code _750 = new Code("750");
public static final Code _751 = new Code("751");
public static final Code _752 = new Code("752");
public static final Code _753 = new Code("753");
public static final Code _754 = new Code("754");
public static final Code _755 = new Code("755");
public static final Code _756 = new Code("756");
public static final Code _757 = new Code("757");
public static final Code _758 = new Code("758");
public static final Code _759 = new Code("759");
public static final Code _760 = new Code("760");
public static final Code _761 = new Code("761");
public static final Code _762 = new Code("762");
public static final Code _763 = new Code("763");
public static final Code _764 = new Code("764");
public static final Code _765 = new Code("765");
public static final Code _766 = new Code("766");
public static final Code _767 = new Code("767");
public static final Code _768 = new Code("768");
public static final Code _769 = new Code("769");
public static final Code _770 = new Code("770");
public static final Code _771 = new Code("771");
public static final Code _772 = new Code("772");
public static final Code _773 = new Code("773");
public static final Code _774 = new Code("774");
public static final Code _775 = new Code("775");
public static final Code _776 = new Code("776");
public static final Code _777 = new Code("777");
public static final Code _778 = new Code("778");
public static final Code _779 = new Code("779");
public static final Code _780 = new Code("780");
public static final Code _781 = new Code("781");
public static final Code _782 = new Code("782");
public static final Code _783 = new Code("783");
public static final Code _784 = new Code("784");
public static final Code _785 = new Code("785");
public static final Code _786 = new Code("786");
public static final Code _787 = new Code("787");
public static final Code _788 = new Code("788");
public static final Code _789 = new Code("789");
public static final Code _790 = new Code("790");
public static final Code _791 = new Code("791");
public static final Code _792 = new Code("792");
public static final Code _793 = new Code("793");
public static final Code _794 = new Code("794");
public static final Code _795 = new Code("795");
public static final Code _796 = new Code("796");
public static final Code _797 = new Code("797");
public static final Code _798 = new Code("798");
public static final Code _799 = new Code("799");
public static final Code _800 = new Code("800");
public static final Code _801 = new Code("801");
public static final Code _802 = new Code("802");
public static final Code _803 = new Code("803");
public static final Code _804 = new Code("804");
public static final Code _805 = new Code("805");
public static final Code _806 = new Code("806");
public static final Code _807 = new Code("807");
public static final Code _808 = new Code("808");
public static final Code _809 = new Code("809");
public static final Code _810 = new Code("810");
public static final Code _811 = new Code("811");
public static final Code _812 = new Code("812");
public static final Code _813 = new Code("813");
public static final Code _814 = new Code("814");
public static final Code _815 = new Code("815");
public static final Code _816 = new Code("816");
public static final Code _817 = new Code("817");
public static final Code _818 = new Code("818");
public static final Code _819 = new Code("819");
public static final Code _820 = new Code("820");
public static final Code _821 = new Code("821");
public static final Code _822 = new Code("822");
public static final Code _823 = new Code("823");
public static final Code _824 = new Code("824");
public static final Code _825 = new Code("825");
public static final Code _826 = new Code("826");
public static final Code _827 = new Code("827");
public static final Code _828 = new Code("828");
public static final Code _829 = new Code("829");
public static final Code _830 = new Code("830");
public static final Code _831 = new Code("831");
public static final Code _832 = new Code("832");
public static final Code _833 = new Code("833");
public static final Code _834 = new Code("834");
public static final Code _835 = new Code("835");
public static final Code _836 = new Code("836");
public static final Code _837 = new Code("837");
public static final Code _838 = new Code("838");
public static final Code _839 = new Code("839");
public static final Code _840 = new Code("840");
public static final Code _841 = new Code("841");
public static final Code _842 = new Code("842");
public static final Code _843 = new Code("843");
public static final Code _844 = new Code("844");
public static final Code _845 = new Code("845");
public static final Code _846 = new Code("846");
public static final Code _847 = new Code("847");
public static final Code _848 = new Code("848");
public static final Code _849 = new Code("849");
public static final Code _850 = new Code("850");
public static final Code _851 = new Code("851");
public static final Code _852 = new Code("852");
public static final Code _853 = new Code("853");
public static final Code _854 = new Code("854");
public static final Code _855 = new Code("855");
public static final Code _856 = new Code("856");
public static final Code _857 = new Code("857");
public static final Code _858 = new Code("858");
public static final Code _859 = new Code("859");
public static final Code _860 = new Code("860");
public static final Code _861 = new Code("861");
public static final Code _862 = new Code("862");
public static final Code _863 = new Code("863");
public static final Code _864 = new Code("864");
public static final Code _865 = new Code("865");
public static final Code _866 = new Code("866");
public static final Code _867 = new Code("867");
public static final Code _868 = new Code("868");
public static final Code _869 = new Code("869");
public static final Code _870 = new Code("870");
public static final Code _871 = new Code("871");
public static final Code _872 = new Code("872");
public static final Code _873 = new Code("873");
public static final Code _874 = new Code("874");
public static final Code _875 = new Code("875");
public static final Code _876 = new Code("876");
public static final Code _877 = new Code("877");
public static final Code _878 = new Code("878");
public static final Code _879 = new Code("879");
public static final Code _880 = new Code("880");
public static final Code _881 = new Code("881");
public static final Code _882 = new Code("882");
public static final Code _883 = new Code("883");
public static final Code _884 = new Code("884");
public static final Code _885 = new Code("885");
public static final Code _886 = new Code("886");
public static final Code _887 = new Code("887");
public static final Code _888 = new Code("888");
public static final Code _889 = new Code("889");
public static final Code _890 = new Code("890");
public static final Code _891 = new Code("891");
public static final Code _892 = new Code("892");
public static final Code _893 = new Code("893");
public static final Code _894 = new Code("894");
public static final Code _895 = new Code("895");
public static final Code _896 = new Code("896");
public static final Code _897 = new Code("897");
public static final Code _898 = new Code("898");
public static final Code _899 = new Code("899");
public static final Code _900 = new Code("900");
public static final Code _901 = new Code("901");
public static final Code _902 = new Code("902");
public static final Code _903 = new Code("903");
public static final Code _904 = new Code("904");
public static final Code _905 = new Code("905");
public static final Code _906 = new Code("906");
public static final Code _907 = new Code("907");
public static final Code _908 = new Code("908");
public static final Code _909 = new Code("909");
public static final Code _910 = new Code("910");
public static final Code _911 = new Code("911");
public static final Code _912 = new Code("912");
public static final Code _913 = new Code("913");
public static final Code _914 = new Code("914");
public static final Code _915 = new Code("915");
public static final Code _916 = new Code("916");
public static final Code _917 = new Code("917");
public static final Code _918 = new Code("918");
public static final Code _919 = new Code("919");
public static final Code _920 = new Code("920");
public static final Code _921 = new Code("921");
public static final Code _922 = new Code("922");
public static final Code _923 = new Code("923");
public static final Code _924 = new Code("924");
public static final Code _925 = new Code("925");
public static final Code _926 = new Code("926");
public static final Code _927 = new Code("927");
public static final Code _928 = new Code("928");
public static final Code _929 = new Code("929");
public static final Code _930 = new Code("930");
public static final Code _931 = new Code("931");
public static final Code _932 = new Code("932");
public static final Code _933 = new Code("933");
public static final Code _934 = new Code("934");
public static final Code _935 = new Code("935");
public static final Code _936 = new Code("936");
public static final Code _937 = new Code("937");
public static final Code _938 = new Code("938");
public static final Code _939 = new Code("939");
public static final Code _940 = new Code("940");
public static final Code _941 = new Code("941");
public static final Code _942 = new Code("942");
public static final Code _943 = new Code("943");
public static final Code _944 = new Code("944");
public static final Code _945 = new Code("945");
public static final Code _946 = new Code("946");
public static final Code _947 = new Code("947");
public static final Code _948 = new Code("948");
public static final Code _949 = new Code("949");
public static final Code _950 = new Code("950");
public static final Code _951 = new Code("951");
public static final Code _952 = new Code("952");
public static final Code _953 = new Code("953");
public static final Code _954 = new Code("954");
public static final Code _955 = new Code("955");
public static final Code _956 = new Code("956");
public static final Code _957 = new Code("957");
public static final Code _958 = new Code("958");
public static final Code _959 = new Code("959");
public static final Code _960 = new Code("960");
public static final Code _961 = new Code("961");
public static final Code _962 = new Code("962");
public static final Code _963 = new Code("963");
public static final Code _964 = new Code("964");
public static final Code _965 = new Code("965");
public static final Code _966 = new Code("966");
public static final Code _967 = new Code("967");
public static final Code _968 = new Code("968");
public static final Code _969 = new Code("969");
public static final Code _970 = new Code("970");
public static final Code _971 = new Code("971");
public static final Code _972 = new Code("972");
public static final Code _973 = new Code("973");
public static final Code _974 = new Code("974");
public static final Code _975 = new Code("975");
public static final Code _976 = new Code("976");
public static final Code _977 = new Code("977");
public static final Code _978 = new Code("978");
public static final Code _979 = new Code("979");
public static final Code _980 = new Code("980");
public static final Code _981 = new Code("981");
public static final Code _982 = new Code("982");
public static final Code _983 = new Code("983");
public static final Code _984 = new Code("984");
public static final Code _985 = new Code("985");
public static final Code _986 = new Code("986");
public static final Code _987 = new Code("987");
public static final Code _988 = new Code("988");
public static final Code _989 = new Code("989");
public static final Code _990 = new Code("990");
public static final Code _991 = new Code("991");
public static final Code _992 = new Code("992");
public static final Code _993 = new Code("993");
public static final Code _994 = new Code("994");
public static final Code _995 = new Code("995");
public static final Code _996 = new Code("996");
public static final Code _997 = new Code("997");
public static final Code _998 = new Code("998");
public static final Code _999 = new Code("999");
public static final Code _1000 = new Code("1000");
private final String value;
public Code(String aValue) {
value = aValue;
}
public String getValue() {
return value;
}
}
| Code |
java | jhy__jsoup | src/main/java/org/jsoup/SerializationException.java | {
"start": 246,
"end": 957
} | class ____ extends RuntimeException {
/**
* Creates and initializes a new serialization exception with no error message and cause.
*/
public SerializationException() {
super();
}
/**
* Creates and initializes a new serialization exception with the given error message and no cause.
*
* @param message
* the error message of the new serialization exception (may be <code>null</code>).
*/
public SerializationException(String message) {
super(message);
}
/**
* Creates and initializes a new serialization exception with the specified cause and an error message of
* <code>(cause==null ? null : cause.toString())</code> (which typically contains the | SerializationException |
java | elastic__elasticsearch | x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/transforms/pivot/AggregationResultUtils.java | {
"start": 26661,
"end": 27036
} | class ____ implements BucketKeyExtractor {
@Override
public Object value(Object key, String type) {
if (isNumericType(type) && key instanceof Double) {
return dropFloatingPointComponentIfTypeRequiresIt(type, (Double) key);
} else {
return key;
}
}
}
}
| DatesAsEpochBucketKeyExtractor |
java | alibaba__fastjson | src/test/java/com/alibaba/json/bvt/ByteArrayFieldTest_4.java | {
"start": 735,
"end": 824
} | class ____ {
@JSONField(format = "hex")
public byte[] value;
}
}
| Model |
java | spring-projects__spring-framework | spring-jdbc/src/main/java/org/springframework/jdbc/core/DataClassRowMapper.java | {
"start": 1270,
"end": 1657
} | class ____ {@code static} nested class, and it may expose either a
* <em>data class</em> constructor with named parameters corresponding to column
* names or classic bean property setter methods with property names corresponding
* to column names (or even a combination of both).
*
* <p>The term "data class" applies to Java <em>records</em>, Kotlin <em>data
* classes</em>, and any | or |
java | apache__kafka | clients/src/main/java/org/apache/kafka/clients/consumer/internals/ShareConsumerMetadata.java | {
"start": 1185,
"end": 3426
} | class ____ extends Metadata {
private final boolean allowAutoTopicCreation;
private final SubscriptionState subscription;
public ShareConsumerMetadata(long refreshBackoffMs,
long refreshBackoffMaxMs,
long metadataExpireMs,
boolean allowAutoTopicCreation,
SubscriptionState subscription,
LogContext logContext,
ClusterResourceListeners clusterResourceListeners) {
super(refreshBackoffMs, refreshBackoffMaxMs, metadataExpireMs, logContext, clusterResourceListeners);
this.allowAutoTopicCreation = allowAutoTopicCreation;
this.subscription = subscription;
}
public ShareConsumerMetadata(ConsumerConfig config,
SubscriptionState subscriptions,
LogContext logContext,
ClusterResourceListeners clusterResourceListeners) {
this(config.getLong(ConsumerConfig.RETRY_BACKOFF_MS_CONFIG),
config.getLong(ConsumerConfig.RETRY_BACKOFF_MAX_MS_CONFIG),
config.getLong(ConsumerConfig.METADATA_MAX_AGE_CONFIG),
config.getBoolean(ConsumerConfig.ALLOW_AUTO_CREATE_TOPICS_CONFIG),
subscriptions,
logContext,
clusterResourceListeners);
}
public boolean allowAutoTopicCreation() {
return allowAutoTopicCreation;
}
/**
* Constructs a metadata request builder for fetching cluster metadata for the topics the share consumer needs.
*/
@Override
public synchronized MetadataRequest.Builder newMetadataRequestBuilder() {
List<String> topics = new ArrayList<>();
topics.addAll(subscription.metadataTopics());
return MetadataRequest.Builder.forTopicNames(topics, allowAutoTopicCreation);
}
/**
* Check if the metadata for the topic should be retained, based on the topic name.
*/
@Override
public synchronized boolean retainTopic(String topic, boolean isInternal, long nowMs) {
return subscription.needsMetadata(topic);
}
}
| ShareConsumerMetadata |
java | alibaba__druid | core/src/test/java/com/alibaba/druid/bvt/sql/mysql/select/MySqlSelectTest_group_concat_2.java | {
"start": 1208,
"end": 2833
} | class ____ extends MysqlTest {
public void test_0() throws Exception {
String sql = "SELECT student_name, "
+ "GROUP_CONCAT(DISTINCT test_score "
+ " ORDER BY test_score DESC SEPARATOR ' ') "
+ "FROM student "
+ "GROUP BY student_name";
MySqlStatementParser parser = new MySqlStatementParser(sql);
List<SQLStatement> statementList = parser.parseStatementList();
SQLStatement stmt = statementList.get(0);
SQLSelectStatement selectStmt = (SQLSelectStatement) stmt;
SQLSelect select = selectStmt.getSelect();
assertNotNull(select.getQuery());
MySqlSelectQueryBlock queryBlock = (MySqlSelectQueryBlock) select.getQuery();
assertNull(queryBlock.getOrderBy());
// print(statementList);
assertEquals(1, statementList.size());
MySqlSchemaStatVisitor visitor = new MySqlSchemaStatVisitor();
stmt.accept(visitor);
assertEquals(1, visitor.getTables().size());
assertEquals(2, visitor.getColumns().size());
assertEquals(0, visitor.getConditions().size());
assertEquals(1, visitor.getOrderByColumns().size());
assertTrue(visitor.getTables().containsKey(new TableStat.Name("student")));
String output = SQLUtils.toMySqlString(stmt);
assertEquals("SELECT student_name, GROUP_CONCAT(DISTINCT test_score ORDER BY test_score DESC SEPARATOR ' ')"
+ "\nFROM student"
+ "\nGROUP BY student_name", //
output);
}
}
| MySqlSelectTest_group_concat_2 |
java | mapstruct__mapstruct | processor/src/test/java/org/mapstruct/ap/test/annotatewith/AnnotationWithRequiredParameter.java | {
"start": 496,
"end": 565
} | interface ____ {
String required();
}
| AnnotationWithRequiredParameter |
java | alibaba__druid | core/src/main/java/com/alibaba/druid/support/spring/stat/SpringStatUtils.java | {
"start": 850,
"end": 2614
} | class ____ {
private static final Log LOG = LogFactory.getLog(SpringStatUtils.class);
@SuppressWarnings("unchecked")
public static List<Map<String, Object>> getMethodStatDataList(Object methodStat) {
if (methodStat.getClass() == SpringStat.class) {
return ((SpringStat) methodStat).getMethodStatDataList();
}
try {
Method method = methodStat.getClass().getMethod("getMethodStatDataList");
Object obj = method.invoke(methodStat);
return (List<Map<String, Object>>) obj;
} catch (Exception e) {
LOG.error("getMethodStatDataList error", e);
return null;
}
}
@SuppressWarnings("unchecked")
public static Map<String, Object> getMethodStatData(Object methodStat, String clazz, String methodSignature) {
if (methodStat.getClass() == SpringStat.class) {
return ((SpringStat) methodStat).getMethodStatData(clazz, methodSignature);
}
try {
Method method = methodStat.getClass().getMethod("getMethodStatData", String.class, String.class);
Object obj = method.invoke(methodStat, clazz, methodSignature);
return (Map<String, Object>) obj;
} catch (Exception e) {
LOG.error("getMethodStatDataList error", e);
return null;
}
}
public static void reset(Object webStat) {
if (webStat.getClass() == SpringStat.class) {
((SpringStat) webStat).reset();
return;
}
try {
Method method = webStat.getClass().getMethod("reset");
method.invoke(webStat);
} catch (Exception e) {
LOG.error("reset error", e);
}
}
}
| SpringStatUtils |
java | apache__hadoop | hadoop-tools/hadoop-gridmix/src/main/java/org/apache/hadoop/mapred/gridmix/emulators/resourceusage/TotalHeapUsageEmulatorPlugin.java | {
"start": 5130,
"end": 10082
} | class ____
implements HeapUsageEmulatorCore {
// store the unit loads in a list
private static final ArrayList<Object> heapSpace =
new ArrayList<Object>();
/**
* Increase heap usage by current process by the given amount.
* This is done by creating objects each of size 1MB.
*/
public void load(long sizeInMB) {
for (long i = 0; i < sizeInMB; ++i) {
// Create another String object of size 1MB
heapSpace.add((Object)new byte[ONE_MB]);
}
}
/**
* Gets the total number of 1mb objects stored in the emulator.
*
* @return total number of 1mb objects.
*/
@VisibleForTesting
public int getHeapSpaceSize() {
return heapSpace.size();
}
/**
* This will initialize the core and check if the core can emulate the
* desired target on the underlying hardware.
*/
public void initialize(ResourceCalculatorPlugin monitor,
long totalHeapUsageInMB) {
long maxPhysicalMemoryInMB = monitor.getPhysicalMemorySize() / ONE_MB ;
if(maxPhysicalMemoryInMB < totalHeapUsageInMB) {
throw new RuntimeException("Total heap the can be used is "
+ maxPhysicalMemoryInMB
+ " bytes while the emulator is configured to emulate a total of "
+ totalHeapUsageInMB + " bytes");
}
}
/**
* Clear references to all the GridMix-allocated special objects so that
* heap usage is reduced.
*/
@Override
public void reset() {
heapSpace.clear();
}
}
public TotalHeapUsageEmulatorPlugin() {
this(new DefaultHeapUsageEmulator());
}
/**
* For testing.
*/
public TotalHeapUsageEmulatorPlugin(HeapUsageEmulatorCore core) {
emulatorCore = core;
}
protected long getTotalHeapUsageInMB() {
return Runtime.getRuntime().totalMemory() / ONE_MB;
}
protected long getMaxHeapUsageInMB() {
return Runtime.getRuntime().maxMemory() / ONE_MB;
}
@Override
public float getProgress() {
return enabled
? Math.min(1f, ((float)getTotalHeapUsageInMB())/targetHeapUsageInMB)
: 1.0f;
}
@Override
public void emulate() throws IOException, InterruptedException {
if (enabled) {
float currentProgress = progress.getProgress();
if (prevEmulationProgress < currentProgress
&& ((currentProgress - prevEmulationProgress) >= emulationInterval
|| currentProgress == 1)) {
long maxHeapSizeInMB = getMaxHeapUsageInMB();
long committedHeapSizeInMB = getTotalHeapUsageInMB();
// Increase committed heap usage, if needed
// Using a linear weighing function for computing the expected usage
long expectedHeapUsageInMB =
Math.min(maxHeapSizeInMB,
(long) (targetHeapUsageInMB * currentProgress));
if (expectedHeapUsageInMB < maxHeapSizeInMB
&& committedHeapSizeInMB < expectedHeapUsageInMB) {
long bufferInMB = (long)(minFreeHeapRatio * expectedHeapUsageInMB);
long currentDifferenceInMB =
expectedHeapUsageInMB - committedHeapSizeInMB;
long currentIncrementLoadSizeInMB =
(long)(currentDifferenceInMB * heapLoadRatio);
// Make sure that at least 1 MB is incremented.
currentIncrementLoadSizeInMB =
Math.max(1, currentIncrementLoadSizeInMB);
while (committedHeapSizeInMB + bufferInMB < expectedHeapUsageInMB) {
// add blocks in order of X% of the difference, X = 10% by default
emulatorCore.load(currentIncrementLoadSizeInMB);
committedHeapSizeInMB = getTotalHeapUsageInMB();
}
}
// store the emulation progress boundary
prevEmulationProgress = currentProgress;
}
// reset the core so that the garbage is reclaimed
emulatorCore.reset();
}
}
@Override
public void initialize(Configuration conf, ResourceUsageMetrics metrics,
ResourceCalculatorPlugin monitor,
Progressive progress) {
this.progress = progress;
// get the target heap usage
targetHeapUsageInMB = metrics.getHeapUsage() / ONE_MB;
if (targetHeapUsageInMB <= 0 ) {
enabled = false;
return;
} else {
// calibrate the core heap-usage utility
emulatorCore.initialize(monitor, targetHeapUsageInMB);
enabled = true;
}
emulationInterval =
conf.getFloat(HEAP_EMULATION_PROGRESS_INTERVAL,
DEFAULT_EMULATION_PROGRESS_INTERVAL);
minFreeHeapRatio = conf.getFloat(MIN_HEAP_FREE_RATIO,
DEFAULT_MIN_FREE_HEAP_RATIO);
heapLoadRatio = conf.getFloat(HEAP_LOAD_RATIO, DEFAULT_HEAP_LOAD_RATIO);
prevEmulationProgress = 0;
}
} | DefaultHeapUsageEmulator |
java | micronaut-projects__micronaut-core | test-suite/src/test/java/io/micronaut/docs/function/client/aws/MathService.java | {
"start": 749,
"end": 1079
} | class ____ {
@Value("${math.multiplier:1}")
private Integer multiplier = 1;
public int round(float value) {
return Math.round(value) * multiplier;
}
public Integer max() {
return Integer.MAX_VALUE;
}
public long sum(Sum sum) {
return sum.getA() + sum.getB();
}
}
| MathService |
java | apache__camel | core/camel-core-model/src/main/java/org/apache/camel/model/dataformat/HL7DataFormat.java | {
"start": 2828,
"end": 3755
} | class ____ implements DataFormatBuilder<HL7DataFormat> {
private String parser;
private String validate;
/**
* Whether to validate the HL7 message
* <p/>
* Is by default true.
*/
public Builder validate(String validate) {
this.validate = validate;
return this;
}
/**
* Whether to validate the HL7 message
* <p/>
* Is by default true.
*/
public Builder validate(boolean validate) {
this.validate = Boolean.toString(validate);
return this;
}
/**
* To use a custom HL7 parser
*/
public Builder parser(String parser) {
this.parser = parser;
return this;
}
@Override
public HL7DataFormat end() {
return new HL7DataFormat(this);
}
}
}
| Builder |
java | alibaba__nacos | client/src/main/java/com/alibaba/nacos/client/naming/remote/http/NamingHttpClientManager.java | {
"start": 2093,
"end": 3235
} | class ____ {
private static final NamingHttpClientManager INSTANCE = new NamingHttpClientManager();
}
public static NamingHttpClientManager getInstance() {
return NamingHttpClientManagerInstance.INSTANCE;
}
public String getPrefix() {
return ENABLE_HTTPS ? HTTPS_PREFIX : HTTP_PREFIX;
}
public NacosRestTemplate getNacosRestTemplate() {
return HttpClientBeanHolder.getNacosRestTemplate(HTTP_CLIENT_FACTORY);
}
@Override
public void shutdown() throws NacosException {
NAMING_LOGGER.info("[NamingHttpClientManager] Start destroying NacosRestTemplate");
try {
HttpClientBeanHolder.shutdownNacosSyncRest(HTTP_CLIENT_FACTORY.getClass().getName());
} catch (Exception ex) {
NAMING_LOGGER.error("[NamingHttpClientManager] An exception occurred when the HTTP client was closed : {}",
ExceptionUtil.getStackTrace(ex));
}
NAMING_LOGGER.info("[NamingHttpClientManager] Completed destruction of NacosRestTemplate");
}
private static | NamingHttpClientManagerInstance |
java | apache__dubbo | dubbo-spring-boot-project/dubbo-spring-boot-actuator-autoconfigure/src/main/java/org/apache/dubbo/spring/boot/actuate/autoconfigure/DubboEndpointAnnotationAutoConfiguration.java | {
"start": 2451,
"end": 3967
} | class ____ {
@Bean
@ConditionalOnMissingBean
@ConditionalOnAvailableEndpoint
@CompatibleConditionalOnEnabledEndpoint
public DubboQosEndpoints dubboQosEndpoints() {
return new DubboQosEndpoints();
}
@Bean
@ConditionalOnMissingBean
@ConditionalOnAvailableEndpoint
@CompatibleConditionalOnEnabledEndpoint
public DubboConfigsMetadataEndpoint dubboConfigsMetadataEndpoint() {
return new DubboConfigsMetadataEndpoint();
}
@Bean
@ConditionalOnMissingBean
@ConditionalOnAvailableEndpoint
@CompatibleConditionalOnEnabledEndpoint
public DubboPropertiesMetadataEndpoint dubboPropertiesEndpoint() {
return new DubboPropertiesMetadataEndpoint();
}
@Bean
@ConditionalOnMissingBean
@ConditionalOnAvailableEndpoint
@CompatibleConditionalOnEnabledEndpoint
public DubboReferencesMetadataEndpoint dubboReferencesMetadataEndpoint() {
return new DubboReferencesMetadataEndpoint();
}
@Bean
@ConditionalOnMissingBean
@ConditionalOnAvailableEndpoint
@CompatibleConditionalOnEnabledEndpoint
public DubboServicesMetadataEndpoint dubboServicesMetadataEndpoint() {
return new DubboServicesMetadataEndpoint();
}
@Bean
@ConditionalOnMissingBean
@ConditionalOnAvailableEndpoint
@CompatibleConditionalOnEnabledEndpoint
public DubboShutdownEndpoint dubboShutdownEndpoint() {
return new DubboShutdownEndpoint();
}
}
| DubboEndpointAnnotationAutoConfiguration |
java | FasterXML__jackson-databind | src/test/java/tools/jackson/databind/jsontype/TestWithGenerics.java | {
"start": 1974,
"end": 2075
} | class ____ {
public String someValue = UUID.randomUUID().toString();
}
static | SomeObject |
java | elastic__elasticsearch | modules/mapper-extras/src/main/java/org/elasticsearch/index/mapper/extras/MatchOnlyTextFieldMapper.java | {
"start": 4165,
"end": 4303
} | class ____ extends FieldMapper {
public static final String CONTENT_TYPE = "match_only_text";
public static | MatchOnlyTextFieldMapper |
java | alibaba__fastjson | src/test/java/com/alibaba/json/bvt/date/DateNewTest.java | {
"start": 162,
"end": 470
} | class ____ extends TestCase {
public void test_date() throws Exception {
Assert.assertEquals(1324138987429L, ((Date) JSON.parse("new Date(1324138987429)")).getTime());
Assert.assertEquals(1324138987429L, ((Date) JSON.parse("new \n\t\r\f\bDate(1324138987429)")).getTime());
}
}
| DateNewTest |
java | alibaba__fastjson | src/test/java/com/alibaba/json/bvt/parser/deser/asm/TestASM_object.java | {
"start": 149,
"end": 461
} | class ____ extends TestCase {
public void test_asm() throws Exception {
V0 v = new V0();
String text = JSON.toJSONString(v);
V0 v1 = JSON.parseObject(text, V0.class);
Assert.assertEquals(v.getValue().getValue(), v1.getValue().getValue());
}
public static | TestASM_object |
java | spring-projects__spring-boot | core/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java | {
"start": 23248,
"end": 24532
} | enum ____ {
/**
* The original form as specified when the name was created or adapted. For
* example:
* <ul>
* <li>"{@code foo-bar}" = "{@code foo-bar}"</li>
* <li>"{@code fooBar}" = "{@code fooBar}"</li>
* <li>"{@code foo_bar}" = "{@code foo_bar}"</li>
* <li>"{@code [Foo.bar]}" = "{@code Foo.bar}"</li>
* </ul>
*/
ORIGINAL,
/**
* The dashed configuration form (used for toString; lower-case with only
* alphanumeric characters and dashes).
* <ul>
* <li>"{@code foo-bar}" = "{@code foo-bar}"</li>
* <li>"{@code fooBar}" = "{@code foobar}"</li>
* <li>"{@code foo_bar}" = "{@code foobar}"</li>
* <li>"{@code [Foo.bar]}" = "{@code Foo.bar}"</li>
* </ul>
*/
DASHED,
/**
* The uniform configuration form (used for equals/hashCode; lower-case with only
* alphanumeric characters).
* <ul>
* <li>"{@code foo-bar}" = "{@code foobar}"</li>
* <li>"{@code fooBar}" = "{@code foobar}"</li>
* <li>"{@code foo_bar}" = "{@code foobar}"</li>
* <li>"{@code [Foo.bar]}" = "{@code Foo.bar}"</li>
* </ul>
*/
UNIFORM
}
/**
* Allows access to the individual elements that make up the name. We store the
* indexes in arrays rather than a list of object in order to conserve memory.
*/
private static | Form |
java | apache__camel | components/camel-zendesk/src/generated/java/org/apache/camel/component/zendesk/internal/ZendeskApiCollection.java | {
"start": 1841,
"end": 1973
} | class ____ {
private static final ZendeskApiCollection INSTANCE = new ZendeskApiCollection();
}
}
| ZendeskApiCollectionHolder |
java | apache__flink | flink-runtime/src/test/java/org/apache/flink/runtime/taskmanager/TaskTest.java | {
"start": 58998,
"end": 59565
} | class ____ extends AbstractInvokable {
public InvokableWithExceptionInRestore(Environment environment) {
super(environment);
}
@Override
public void restore() throws Exception {
throw new Exception(RESTORE_EXCEPTION_MSG);
}
@Override
public void invoke() {}
@Override
public void cleanUp(Throwable throwable) throws Exception {
wasCleanedUp = true;
super.cleanUp(throwable);
}
}
private static final | InvokableWithExceptionInRestore |
java | hibernate__hibernate-orm | hibernate-testing/src/main/java/org/hibernate/testing/orm/junit/DialectFeatureChecks.java | {
"start": 41252,
"end": 41479
} | class ____ implements DialectFeatureCheck {
public boolean apply(Dialect dialect) {
return dialect instanceof SybaseDialect && ( (SybaseDialect) dialect ).getDriverKind() == SybaseDriverKind.JTDS;
}
}
public static | IsJtds |
java | quarkusio__quarkus | integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/KubernetesWithIdempotentTest.java | {
"start": 571,
"end": 2548
} | class ____ {
private static final String APP_NAME = "kubernetes-with-idempotent";
@RegisterExtension
static final QuarkusProdModeTest config = new QuarkusProdModeTest()
.withApplicationRoot((jar) -> jar.addClasses(GreetingResource.class))
.setApplicationName(APP_NAME)
.setApplicationVersion("0.1-SNAPSHOT")
.withConfigurationResource(APP_NAME + ".properties")
.setLogFileName("k8s.log")
.setForcedDependencies(List.of(Dependency.of("io.quarkus", "quarkus-kubernetes", Version.getVersion())));
@Test
public void assertGeneratedResources() throws IOException {
final Path kubernetesDir = Paths.get("target").resolve(APP_NAME);
assertThat(kubernetesDir)
.isDirectoryContaining(p -> p.getFileName().endsWith("kubernetes.json"))
.isDirectoryContaining(p -> p.getFileName().endsWith("kubernetes.yml"));
List<HasMetadata> kubernetesList = DeserializationUtil
.deserializeAsList(kubernetesDir.resolve("kubernetes.yml"));
assertThat(kubernetesList).allSatisfy(resource -> {
assertThat(resource.getMetadata()).satisfies(m -> {
assertThat(m.getName()).isEqualTo(APP_NAME);
assertThat(m.getAnnotations().get("app.quarkus.io/quarkus-version")).isNotBlank();
assertThat(m.getAnnotations().get("app.quarkus.io/commit-id")).isNull();
assertThat(m.getAnnotations().get("app.quarkus.io/build-timestamp")).isNull();
});
if (resource instanceof Deployment) {
Deployment deployment = (Deployment) resource;
assertThat(deployment.getSpec().getSelector().getMatchLabels()).doesNotContainKey(Labels.VERSION);
assertThat(deployment.getSpec().getTemplate().getMetadata().getLabels()).doesNotContainKey(Labels.VERSION);
}
});
}
}
| KubernetesWithIdempotentTest |
java | redisson__redisson | redisson/src/main/java/org/redisson/api/RedissonRxClient.java | {
"start": 50597,
"end": 52905
} | interface ____ Redis Function feature with specified <code>options</code>.
*
* @param options instance options
* @return function object
*/
RFunctionRx getFunction(OptionalOptions options);
/**
* Returns script operations object
*
* @return Script object
*/
RScriptRx getScript();
/**
* Returns script operations object using provided codec.
*
* @param codec codec for params and result
* @return Script object
*/
RScriptRx getScript(Codec codec);
/**
* Returns script operations object with specified <code>options</code>.
*
* @param options instance options
* @return Script object
*/
RScriptRx getScript(OptionalOptions options);
/**
* Returns vector set instance by name.
* <p>
* Requires <b>Redis 8.0.0 and higher.</b>
*
* @param name - name of vector set
* @return vector set instance
*/
RVectorSetRx getVectorSet(String name);
/**
* Returns vector set instance by name with specified <code>options</code>.
* <p>
* Requires <b>Redis 8.0.0 and higher.</b>
*
* @param options instance options
* @return vector set instance
*/
RVectorSetRx getVectorSet(CommonOptions options);
/**
* Creates transaction with <b>READ_COMMITTED</b> isolation level.
*
* @param options transaction configuration
* @return Transaction object
*/
RTransactionRx createTransaction(TransactionOptions options);
/**
* Return batch object which executes group of
* command in pipeline.
*
* See <a href="http://redis.io/topics/pipelining">http://redis.io/topics/pipelining</a>
*
* @param options batch configuration
* @return Batch object
*/
RBatchRx createBatch(BatchOptions options);
/**
* Return batch object which executes group of
* command in pipeline.
*
* See <a href="http://redis.io/topics/pipelining">http://redis.io/topics/pipelining</a>
*
* @return Batch object
*/
RBatchRx createBatch();
/**
* Returns keys operations.
* Each of Redis/Redisson object associated with own key
*
* @return Keys object
*/
RKeysRx getKeys();
/**
* Returns | for |
java | google__dagger | javatests/dagger/functional/subcomponent/multibindings/MultibindingSubcomponents.java | {
"start": 1111,
"end": 1229
} | enum ____ {
INSTANCE;
}
/** Multibindings for this type are bound only in the child component. */
| BoundInParent |
java | apache__kafka | clients/src/test/java/org/apache/kafka/common/message/RecordsSerdeTest.java | {
"start": 1306,
"end": 3127
} | class ____ {
@Test
public void testSerdeRecords() {
MemoryRecords records = MemoryRecords.withRecords(Compression.NONE,
new SimpleRecord("foo".getBytes()),
new SimpleRecord("bar".getBytes()));
SimpleRecordsMessageData message = new SimpleRecordsMessageData()
.setTopic("foo")
.setRecordSet(records);
testAllRoundTrips(message);
}
@Test
public void testSerdeNullRecords() {
SimpleRecordsMessageData message = new SimpleRecordsMessageData()
.setTopic("foo");
assertNull(message.recordSet());
testAllRoundTrips(message);
}
@Test
public void testSerdeEmptyRecords() {
SimpleRecordsMessageData message = new SimpleRecordsMessageData()
.setTopic("foo")
.setRecordSet(MemoryRecords.EMPTY);
testAllRoundTrips(message);
}
private void testAllRoundTrips(SimpleRecordsMessageData message) {
for (short version = SimpleRecordsMessageData.LOWEST_SUPPORTED_VERSION;
version <= SimpleRecordsMessageData.HIGHEST_SUPPORTED_VERSION;
version++) {
testRoundTrip(message, version);
}
}
private void testRoundTrip(SimpleRecordsMessageData message, short version) {
ByteBuffer buf = MessageUtil.toByteBufferAccessor(message, version).buffer();
SimpleRecordsMessageData message2 = deserialize(buf.duplicate(), version);
assertEquals(message, message2);
assertEquals(message.hashCode(), message2.hashCode());
}
private SimpleRecordsMessageData deserialize(ByteBuffer buffer, short version) {
ByteBufferAccessor readable = new ByteBufferAccessor(buffer);
return new SimpleRecordsMessageData(readable, version);
}
}
| RecordsSerdeTest |
java | spring-projects__spring-security | config/src/main/java/org/springframework/security/config/annotation/web/configurers/AnonymousConfigurer.java | {
"start": 1972,
"end": 6607
} | class ____<H extends HttpSecurityBuilder<H>>
extends AbstractHttpConfigurer<AnonymousConfigurer<H>, H> {
private String key;
private AuthenticationProvider authenticationProvider;
private AnonymousAuthenticationFilter authenticationFilter;
private Object principal = "anonymousUser";
private List<GrantedAuthority> authorities = AuthorityUtils.createAuthorityList("ROLE_ANONYMOUS");
private String computedKey;
/**
* Creates a new instance
* @see HttpSecurity#anonymous(Customizer)
*/
public AnonymousConfigurer() {
}
/**
* Sets the key to identify tokens created for anonymous authentication. Default is a
* secure randomly generated key.
* @param key the key to identify tokens created for anonymous authentication. Default
* is a secure randomly generated key.
* @return the {@link AnonymousConfigurer} for further customization of anonymous
* authentication
*/
public AnonymousConfigurer<H> key(String key) {
this.key = key;
return this;
}
/**
* Sets the principal for {@link Authentication} objects of anonymous users
* @param principal used for the {@link Authentication} object of anonymous users
* @return the {@link AnonymousConfigurer} for further customization of anonymous
* authentication
*/
public AnonymousConfigurer<H> principal(Object principal) {
this.principal = principal;
return this;
}
/**
* Sets the {@link org.springframework.security.core.Authentication#getAuthorities()}
* for anonymous users
* @param authorities Sets the
* {@link org.springframework.security.core.Authentication#getAuthorities()} for
* anonymous users
* @return the {@link AnonymousConfigurer} for further customization of anonymous
* authentication
*/
public AnonymousConfigurer<H> authorities(List<GrantedAuthority> authorities) {
this.authorities = authorities;
return this;
}
/**
* Sets the {@link org.springframework.security.core.Authentication#getAuthorities()}
* for anonymous users
* @param authorities Sets the
* {@link org.springframework.security.core.Authentication#getAuthorities()} for
* anonymous users (i.e. "ROLE_ANONYMOUS")
* @return the {@link AnonymousConfigurer} for further customization of anonymous
* authentication
*/
public AnonymousConfigurer<H> authorities(String... authorities) {
return authorities(AuthorityUtils.createAuthorityList(authorities));
}
/**
* Sets the {@link AuthenticationProvider} used to validate an anonymous user. If this
* is set, no attributes on the {@link AnonymousConfigurer} will be set on the
* {@link AuthenticationProvider}.
* @param authenticationProvider the {@link AuthenticationProvider} used to validate
* an anonymous user. Default is {@link AnonymousAuthenticationProvider}
* @return the {@link AnonymousConfigurer} for further customization of anonymous
* authentication
*/
public AnonymousConfigurer<H> authenticationProvider(AuthenticationProvider authenticationProvider) {
this.authenticationProvider = authenticationProvider;
return this;
}
/**
* Sets the {@link AnonymousAuthenticationFilter} used to populate an anonymous user.
* If this is set, no attributes on the {@link AnonymousConfigurer} will be set on the
* {@link AnonymousAuthenticationFilter}.
* @param authenticationFilter the {@link AnonymousAuthenticationFilter} used to
* populate an anonymous user.
* @return the {@link AnonymousConfigurer} for further customization of anonymous
* authentication
*/
public AnonymousConfigurer<H> authenticationFilter(AnonymousAuthenticationFilter authenticationFilter) {
this.authenticationFilter = authenticationFilter;
return this;
}
@Override
public void init(H http) {
if (this.authenticationProvider == null) {
this.authenticationProvider = new AnonymousAuthenticationProvider(getKey());
}
this.authenticationProvider = postProcess(this.authenticationProvider);
http.authenticationProvider(this.authenticationProvider);
}
@Override
public void configure(H http) {
if (this.authenticationFilter == null) {
this.authenticationFilter = new AnonymousAuthenticationFilter(getKey(), this.principal, this.authorities);
}
this.authenticationFilter.setSecurityContextHolderStrategy(getSecurityContextHolderStrategy());
this.authenticationFilter.afterPropertiesSet();
http.addFilter(this.authenticationFilter);
}
private String getKey() {
if (this.computedKey != null) {
return this.computedKey;
}
if (this.key == null) {
this.computedKey = UUID.randomUUID().toString();
}
else {
this.computedKey = this.key;
}
return this.computedKey;
}
}
| AnonymousConfigurer |
java | hibernate__hibernate-orm | hibernate-envers/src/test/java/org/hibernate/orm/test/envers/integration/collection/embeddable/EmbeddableList1.java | {
"start": 1032,
"end": 3760
} | class ____ {
private Integer ele1_id = null;
private final Component4 c4_1 = new Component4( "c41", "c41_value", "c41_description" );
private final Component4 c4_2 = new Component4( "c42", "c42_value2", "c42_description" );
private final Component3 c3_1 = new Component3( "c31", c4_1, c4_2 );
private final Component3 c3_2 = new Component3( "c32", c4_1, c4_2 );
@BeforeClassTemplate
public void initData(EntityManagerFactoryScope scope) {
// Revision 1 (ele1: initially 1 element in both collections)
scope.inTransaction( em -> {
EmbeddableListEntity1 ele1 = new EmbeddableListEntity1();
ele1.getComponentList().add( c3_1 );
em.persist( ele1 );
ele1_id = ele1.getId();
} );
// Revision (still 1) (ele1: removing non-existing element)
scope.inTransaction( em -> {
EmbeddableListEntity1 ele1 = em.find( EmbeddableListEntity1.class, ele1_id );
ele1.getComponentList().remove( c3_2 );
} );
// Revision 2 (ele1: adding one element)
scope.inTransaction( em -> {
EmbeddableListEntity1 ele1 = em.find( EmbeddableListEntity1.class, ele1_id );
ele1.getComponentList().add( c3_2 );
} );
// Revision 3 (ele1: adding one existing element)
scope.inTransaction( em -> {
EmbeddableListEntity1 ele1 = em.find( EmbeddableListEntity1.class, ele1_id );
ele1.getComponentList().add( c3_1 );
} );
// Revision 4 (ele1: removing one existing element)
scope.inTransaction( em -> {
EmbeddableListEntity1 ele1 = em.find( EmbeddableListEntity1.class, ele1_id );
ele1.getComponentList().remove( c3_2 );
} );
}
@Test
public void testRevisionsCounts(EntityManagerFactoryScope scope) {
scope.inEntityManager( em -> {
final var auditReader = AuditReaderFactory.get( em );
assertEquals(
Arrays.asList( 1, 2, 3, 4 ),
auditReader.getRevisions( EmbeddableListEntity1.class, ele1_id )
);
} );
}
@Test
public void testHistoryOfEle1(EntityManagerFactoryScope scope) {
scope.inEntityManager( em -> {
final var auditReader = AuditReaderFactory.get( em );
EmbeddableListEntity1 rev1 = auditReader.find( EmbeddableListEntity1.class, ele1_id, 1 );
EmbeddableListEntity1 rev2 = auditReader.find( EmbeddableListEntity1.class, ele1_id, 2 );
EmbeddableListEntity1 rev3 = auditReader.find( EmbeddableListEntity1.class, ele1_id, 3 );
EmbeddableListEntity1 rev4 = auditReader.find( EmbeddableListEntity1.class, ele1_id, 4 );
assertEquals( Collections.singletonList( c3_1 ), rev1.getComponentList() );
assertEquals( Arrays.asList( c3_1, c3_2 ), rev2.getComponentList() );
assertEquals( Arrays.asList( c3_1, c3_2, c3_1 ), rev3.getComponentList() );
assertEquals( Arrays.asList( c3_1, c3_1 ), rev4.getComponentList() );
} );
}
}
| EmbeddableList1 |
java | elastic__elasticsearch | x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/operator/lookup/EnrichResultBuilder.java | {
"start": 844,
"end": 2560
} | class ____ implements Releasable {
protected final BlockFactory blockFactory;
protected final int channel;
private long usedBytes;
EnrichResultBuilder(BlockFactory blockFactory, int channel) {
this.blockFactory = blockFactory;
this.channel = channel;
}
/**
* Collects the input values from the input page.
*
* @param positions the positions vector
* @param page the input page. The block located at {@code channel} is the value block
*/
abstract void addInputPage(IntVector positions, Page page);
abstract Block build(IntBlock selected);
final void adjustBreaker(long bytes) {
blockFactory.breaker().addEstimateBytesAndMaybeBreak(bytes, "<<enrich-result>>");
usedBytes += bytes;
}
@Override
public void close() {
blockFactory.breaker().addWithoutBreaking(-usedBytes);
}
static EnrichResultBuilder enrichResultBuilder(ElementType elementType, BlockFactory blockFactory, int channel) {
return switch (elementType) {
case NULL -> new EnrichResultBuilderForNull(blockFactory, channel);
case INT -> new EnrichResultBuilderForInt(blockFactory, channel);
case LONG -> new EnrichResultBuilderForLong(blockFactory, channel);
case DOUBLE -> new EnrichResultBuilderForDouble(blockFactory, channel);
case BOOLEAN -> new EnrichResultBuilderForBoolean(blockFactory, channel);
case BYTES_REF -> new EnrichResultBuilderForBytesRef(blockFactory, channel);
default -> throw new IllegalArgumentException("no enrich result builder for [" + elementType + "]");
};
}
private static | EnrichResultBuilder |
java | spring-projects__spring-framework | spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests.java | {
"start": 72226,
"end": 72536
} | class ____ implements MethodReplacer {
public Object lastArg;
@Override
public Object reimplement(Object obj, Method method, Object[] args) {
assertThat(args).hasSize(1);
assertThat(method.getName()).isEqualTo("doSomething");
lastArg = args[0];
return null;
}
}
static | DoSomethingReplacer |
java | apache__camel | components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyServerBossPoolBuilder.java | {
"start": 1432,
"end": 3368
} | class ____ {
private String name = "NettyServerBoss";
private String pattern;
private int bossCount = 1;
private boolean nativeTransport;
public void setName(String name) {
this.name = name;
}
public void setPattern(String pattern) {
this.pattern = pattern;
}
public void setBossCount(int bossCount) {
this.bossCount = bossCount;
}
public void setNativeTransport(boolean nativeTransport) {
this.nativeTransport = nativeTransport;
}
public NettyServerBossPoolBuilder withName(String name) {
setName(name);
return this;
}
public NettyServerBossPoolBuilder withPattern(String pattern) {
setPattern(pattern);
return this;
}
public NettyServerBossPoolBuilder withBossCount(int bossCount) {
setBossCount(bossCount);
return this;
}
public NettyServerBossPoolBuilder withNativeTransport(boolean nativeTransport) {
setNativeTransport(nativeTransport);
return this;
}
/**
* Creates a new boss pool.
*/
public EventLoopGroup build() {
if (nativeTransport) {
if (KQueue.isAvailable()) {
return new KQueueEventLoopGroup(
bossCount,
new CamelThreadFactory(pattern, name, false));
} else if (Epoll.isAvailable()) {
return new EpollEventLoopGroup(
bossCount,
new CamelThreadFactory(pattern, name, false));
} else {
throw new IllegalStateException(
"Unable to use native transport - both Epoll and KQueue are not available");
}
} else {
return new NioEventLoopGroup(
bossCount,
new CamelThreadFactory(pattern, name, false));
}
}
}
| NettyServerBossPoolBuilder |
java | quarkusio__quarkus | extensions/panache/mongodb-panache/runtime/src/main/java/io/quarkus/mongodb/panache/PanacheQuery.java | {
"start": 554,
"end": 678
} | interface ____ be reused to obtain multiple pages of results.
*
* @param <Entity> The entity type being queried
*/
public | can |
java | spring-projects__spring-boot | configuration-metadata/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/lombok/SimpleLombokPojo.java | {
"start": 825,
"end": 874
} | class ____ {
private int value;
}
| SimpleLombokPojo |
java | spring-projects__spring-framework | framework-docs/src/main/java/org/springframework/docs/testing/mockmvc/assertj/mockmvctesterassertionsjson/FamilyControllerTests.java | {
"start": 949,
"end": 2160
} | class ____ {
private final MockMvcTester mockMvc = MockMvcTester.of(new FamilyController());
void extractingPathAsMap() {
// tag::extract-asmap[]
assertThat(mockMvc.get().uri("/family")).bodyJson()
.extractingPath("$.members[0]")
.asMap()
.contains(entry("name", "Homer"));
// end::extract-asmap[]
}
void extractingPathAndConvertWithType() {
// tag::extract-convert[]
assertThat(mockMvc.get().uri("/family")).bodyJson()
.extractingPath("$.members[0]")
.convertTo(Member.class)
.satisfies(member -> assertThat(member.name).isEqualTo("Homer"));
// end::extract-convert[]
}
void extractingPathAndConvertWithAssertFactory() {
// tag::extract-convert-assert-factory[]
assertThat(mockMvc.get().uri("/family")).bodyJson()
.extractingPath("$.members")
.convertTo(InstanceOfAssertFactories.list(Member.class))
.hasSize(5)
.element(0).satisfies(member -> assertThat(member.name).isEqualTo("Homer"));
// end::extract-convert-assert-factory[]
}
void assertTheSimpsons() {
// tag::assert-file[]
assertThat(mockMvc.get().uri("/family")).bodyJson()
.isStrictlyEqualTo("sample/simpsons.json");
// end::assert-file[]
}
static | FamilyControllerTests |
java | quarkusio__quarkus | extensions/info/deployment/src/test/java/io/quarkus/info/deployment/CustomDataInfoTest.java | {
"start": 2392,
"end": 2656
} | class ____ implements InfoContributor {
@Override
public String name() {
return "test";
}
@Override
public Map<String, Object> data() {
return Map.of("foo", "bar");
}
}
}
| TestInfoContributor |
java | FasterXML__jackson-databind | src/test/java/tools/jackson/databind/ser/SerializationAnnotationsTest.java | {
"start": 1363,
"end": 1601
} | class ____
{
// Should be considered property "y" even tho non-public
@JsonSerialize protected int getY() { return 8; }
}
/**
* Class for testing {@link ValueSerializer} annotation
* for | SizeClassGetter3 |
java | square__retrofit | retrofit/java-test/src/test/java/retrofit2/RequestFactoryTest.java | {
"start": 80594,
"end": 81095
} | class ____ {
@FormUrlEncoded //
@POST("/foo") //
Call<ResponseBody> method(@Field("foo") String foo, @Field("ping") String ping) {
return null;
}
}
Request request = buildRequest(Example.class, "bar", "pong");
RequestBody body = request.body();
assertBody(body, "foo=bar&ping=pong");
assertThat(body.contentType().toString()).isEqualTo("application/x-www-form-urlencoded");
}
@Test
public void formEncodedWithEncodedNameFieldParam() {
| Example |
java | apache__hadoop | hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/erasurecode/coder/TestHHErasureCoderBase.java | {
"start": 1121,
"end": 2689
} | class ____ extends TestErasureCoderBase{
protected int subPacketSize = 2;
@Override
protected void performCodingStep(ErasureCodingStep codingStep) {
// Pretend that we're opening these input blocks and output blocks.
ECBlock[] inputBlocks = codingStep.getInputBlocks();
ECBlock[] outputBlocks = codingStep.getOutputBlocks();
// We allocate input and output chunks accordingly.
ECChunk[] inputChunks = new ECChunk[inputBlocks.length * subPacketSize];
ECChunk[] outputChunks = new ECChunk[outputBlocks.length * subPacketSize];
for (int i = 0; i < numChunksInBlock; i += subPacketSize) {
// Pretend that we're reading input chunks from input blocks.
for (int k = 0; k < subPacketSize; ++k) {
for (int j = 0; j < inputBlocks.length; ++j) {
inputChunks[k * inputBlocks.length + j] = ((TestBlock)
inputBlocks[j]).chunks[i + k];
}
// Pretend that we allocate and will write output results to the blocks.
for (int j = 0; j < outputBlocks.length; ++j) {
outputChunks[k * outputBlocks.length + j] = allocateOutputChunk();
((TestBlock) outputBlocks[j]).chunks[i + k] =
outputChunks[k * outputBlocks.length + j];
}
}
// Given the input chunks and output chunk buffers, just call it !
try {
codingStep.performCoding(inputChunks, outputChunks);
} catch (IOException e) {
fail("Unexpected IOException: " + e.getMessage());
}
}
codingStep.finish();
}
}
| TestHHErasureCoderBase |
java | google__dagger | dagger-compiler/main/java/dagger/internal/codegen/binding/ModuleDescriptor.java | {
"start": 4390,
"end": 12991
} | class ____ implements ClearableCache {
private final XProcessingEnv processingEnv;
private final BindingFactory bindingFactory;
private final MultibindingDeclaration.Factory multibindingDeclarationFactory;
private final DelegateDeclaration.Factory bindingDelegateDeclarationFactory;
private final SubcomponentDeclaration.Factory subcomponentDeclarationFactory;
private final OptionalBindingDeclaration.Factory optionalBindingDeclarationFactory;
private final DaggerSuperficialValidation superficialValidation;
private final Map<XTypeElement, ModuleDescriptor> cache = new HashMap<>();
private final Set<XTypeElement> implicitlyIncludedModules = new LinkedHashSet<>();
@Inject
Factory(
XProcessingEnv processingEnv,
BindingFactory bindingFactory,
MultibindingDeclaration.Factory multibindingDeclarationFactory,
DelegateDeclaration.Factory bindingDelegateDeclarationFactory,
SubcomponentDeclaration.Factory subcomponentDeclarationFactory,
OptionalBindingDeclaration.Factory optionalBindingDeclarationFactory,
DaggerSuperficialValidation superficialValidation) {
this.processingEnv = processingEnv;
this.bindingFactory = bindingFactory;
this.multibindingDeclarationFactory = multibindingDeclarationFactory;
this.bindingDelegateDeclarationFactory = bindingDelegateDeclarationFactory;
this.subcomponentDeclarationFactory = subcomponentDeclarationFactory;
this.optionalBindingDeclarationFactory = optionalBindingDeclarationFactory;
this.superficialValidation = superficialValidation;
}
public ModuleDescriptor create(XTypeElement moduleElement) {
return reentrantComputeIfAbsent(cache, moduleElement, this::createUncached);
}
public ModuleDescriptor createUncached(XTypeElement moduleElement) {
ImmutableSet.Builder<ContributionBinding> bindings = ImmutableSet.builder();
ImmutableSet.Builder<DelegateDeclaration> delegates = ImmutableSet.builder();
ImmutableSet.Builder<MultibindingDeclaration> multibindingDeclarations =
ImmutableSet.builder();
ImmutableSet.Builder<OptionalBindingDeclaration> optionalDeclarations =
ImmutableSet.builder();
XTypeElements.getAllMethods(moduleElement)
.forEach(
moduleMethod -> {
if (moduleMethod.hasAnnotation(XTypeNames.PROVIDES)) {
bindings.add(bindingFactory.providesMethodBinding(moduleMethod, moduleElement));
}
if (moduleMethod.hasAnnotation(XTypeNames.PRODUCES)) {
bindings.add(bindingFactory.producesMethodBinding(moduleMethod, moduleElement));
}
if (moduleMethod.hasAnnotation(XTypeNames.BINDS)) {
delegates.add(
bindingDelegateDeclarationFactory.create(moduleMethod, moduleElement));
}
if (moduleMethod.hasAnnotation(XTypeNames.MULTIBINDS)) {
multibindingDeclarations.add(
multibindingDeclarationFactory.forMultibindsMethod(
moduleMethod, moduleElement));
}
if (moduleMethod.hasAnnotation(XTypeNames.BINDS_OPTIONAL_OF)) {
optionalDeclarations.add(
optionalBindingDeclarationFactory.forMethod(moduleMethod, moduleElement));
}
});
moduleElement.getEnclosedTypeElements().stream()
.filter(XTypeElement::isCompanionObject)
.collect(toOptional())
.ifPresent(companionModule -> collectCompanionModuleBindings(companionModule, bindings));
return new AutoValue_ModuleDescriptor(
moduleElement,
bindings.build(),
multibindingDeclarations.build(),
subcomponentDeclarationFactory.forModule(moduleElement),
delegates.build(),
optionalDeclarations.build(),
ModuleKind.forAnnotatedElement(moduleElement).get(),
implicitlyIncludedModules.contains(moduleElement));
}
private void collectCompanionModuleBindings(
XTypeElement companionModule, ImmutableSet.Builder<ContributionBinding> bindings) {
ImmutableSet<String> bindingElementDescriptors =
bindings.build().stream()
.map(binding -> asMethod(binding.bindingElement().get()).getJvmDescriptor())
.collect(toImmutableSet());
XTypeElements.getAllMethods(companionModule).stream()
// Binding methods in companion objects with @JvmStatic are mirrored in the enclosing
// class, therefore we should ignore it or else it'll be a duplicate binding.
.filter(method -> !method.hasAnnotation(XTypeNames.JVM_STATIC))
// Fallback strategy for de-duping contributing bindings in the companion module with
// @JvmStatic by comparing descriptors. Contributing bindings are the only valid bindings
// a companion module can declare. See: https://youtrack.jetbrains.com/issue/KT-35104
// TODO(danysantiago): Checks qualifiers too.
.filter(method -> !bindingElementDescriptors.contains(method.getJvmDescriptor()))
.forEach(
method -> {
if (method.hasAnnotation(XTypeNames.PROVIDES)) {
bindings.add(bindingFactory.providesMethodBinding(method, companionModule));
}
if (method.hasAnnotation(XTypeNames.PRODUCES)) {
bindings.add(bindingFactory.producesMethodBinding(method, companionModule));
}
});
}
/** Returns all the modules transitively included by given modules, including the arguments. */
ImmutableSet<ModuleDescriptor> transitiveModules(Collection<XTypeElement> modules) {
// Traverse as a graph to automatically handle modules with cyclic includes.
return ImmutableSet.copyOf(
Traverser.forGraph(
(ModuleDescriptor module) -> transform(includedModules(module), this::create))
.depthFirstPreOrder(transform(modules, this::create)));
}
private ImmutableSet<XTypeElement> includedModules(ModuleDescriptor moduleDescriptor) {
return ImmutableSet.copyOf(
collectIncludedModules(new LinkedHashSet<>(), moduleDescriptor.moduleElement()));
}
@CanIgnoreReturnValue
private Set<XTypeElement> collectIncludedModules(
Set<XTypeElement> includedModules, XTypeElement moduleElement) {
XType superclass = moduleElement.getSuperType();
if (superclass != null) {
verify(isDeclared(superclass));
if (!superclass.asTypeName().equals(XTypeName.ANY_OBJECT)) {
collectIncludedModules(includedModules, superclass.getTypeElement());
}
}
moduleAnnotation(moduleElement, superficialValidation)
.ifPresent(
moduleAnnotation -> {
includedModules.addAll(moduleAnnotation.includes());
ImmutableSet<XTypeElement> daggerAndroidModules =
implicitlyIncludedModules(moduleElement);
includedModules.addAll(daggerAndroidModules);
implicitlyIncludedModules.addAll(daggerAndroidModules);
});
return includedModules;
}
private static final XClassName CONTRIBUTES_ANDROID_INJECTOR =
XClassName.get("dagger.android", "ContributesAndroidInjector");
// @ContributesAndroidInjector generates a module that is implicitly included in the enclosing
// module
private ImmutableSet<XTypeElement> implicitlyIncludedModules(XTypeElement module) {
if (processingEnv.findTypeElement(CONTRIBUTES_ANDROID_INJECTOR) == null) {
return ImmutableSet.of();
}
return module.getDeclaredMethods().stream()
.filter(method -> method.hasAnnotation(CONTRIBUTES_ANDROID_INJECTOR))
.map(
method ->
DaggerSuperficialValidation.requireTypeElement(
processingEnv, implicitlyIncludedModuleName(module, method)))
.collect(toImmutableSet());
}
private XClassName implicitlyIncludedModuleName(XTypeElement module, XMethodElement method) {
return XClassName.get(
module.getPackageName(),
String.format(
"%s_%s",
classFileName(module.asClassName()),
LOWER_CAMEL.to(UPPER_CAMEL, getSimpleName(method))));
}
@Override
public void clearCache() {
cache.clear();
}
}
}
| Factory |
java | elastic__elasticsearch | modules/lang-mustache/src/test/java/org/elasticsearch/script/mustache/SearchTemplateResponseTests.java | {
"start": 1481,
"end": 3445
} | class ____ extends AbstractXContentTestCase<SearchTemplateResponse> {
@Override
protected SearchTemplateResponse createTestInstance() {
SearchTemplateResponse response = new SearchTemplateResponse();
if (randomBoolean()) {
response.setResponse(createSearchResponse());
} else {
response.setSource(createSource());
}
return response;
}
@Override
protected SearchTemplateResponse doParseInstance(XContentParser parser) throws IOException {
SearchTemplateResponse searchTemplateResponse = new SearchTemplateResponse();
Map<String, Object> contentAsMap = parser.map();
if (contentAsMap.containsKey(SearchTemplateResponse.TEMPLATE_OUTPUT_FIELD.getPreferredName())) {
Object source = contentAsMap.get(SearchTemplateResponse.TEMPLATE_OUTPUT_FIELD.getPreferredName());
XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON).value(source);
searchTemplateResponse.setSource(BytesReference.bytes(builder));
} else {
XContentType contentType = parser.contentType();
XContentBuilder builder = XContentFactory.contentBuilder(contentType).map(contentAsMap);
try (
XContentParser searchResponseParser = XContentHelper.createParserNotCompressed(
XContentParserConfiguration.EMPTY.withRegistry(parser.getXContentRegistry())
.withDeprecationHandler(parser.getDeprecationHandler()),
BytesReference.bytes(builder),
contentType
)
) {
searchTemplateResponse.setResponse(SearchResponseUtils.parseSearchResponse(searchResponseParser));
}
}
return searchTemplateResponse;
}
/**
* For simplicity we create a minimal response, as there is already a dedicated
* test | SearchTemplateResponseTests |
java | alibaba__nacos | config/src/main/java/com/alibaba/nacos/config/server/service/LongPollingService.java | {
"start": 11842,
"end": 13337
} | class ____ implements Runnable {
@Override
public void run() {
try {
for (Iterator<ClientLongPolling> iter = allSubs.iterator(); iter.hasNext(); ) {
ClientLongPolling clientSub = iter.next();
if (clientSub.clientMd5Map.containsKey(groupKey)) {
getRetainIps().put(clientSub.ip, System.currentTimeMillis());
iter.remove(); // Delete subscribers' relationships.
LogUtil.CLIENT_LOG.info("{}|{}|{}|{}|{}|{}|{}", (System.currentTimeMillis() - changeTime),
"in-advance",
RequestUtil.getRemoteIp((HttpServletRequest) clientSub.asyncContext.getRequest()),
"polling", clientSub.clientMd5Map.size(), clientSub.probeRequestSize, groupKey);
clientSub.sendResponse(Collections.singletonMap(groupKey, clientSub.clientMd5Map.get(groupKey)));
}
}
} catch (Throwable t) {
LogUtil.DEFAULT_LOG.error("data change error: {}", ExceptionUtil.getStackTrace(t));
}
}
DataChangeTask(String groupKey) {
this.groupKey = groupKey;
}
final String groupKey;
final long changeTime = System.currentTimeMillis();
}
| DataChangeTask |
java | hibernate__hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/hql/HqlParserMemoryUsageTest.java | {
"start": 3356,
"end": 3623
} | class ____ {
@Id
private Long id;
private String name;
@OneToMany(mappedBy = "user")
private Set<Address> addresses;
@OneToMany(mappedBy = "user")
private Set<Order> orders;
}
@Entity(name = "Category")
@Table(name = "categories")
public static | AppUser |
java | google__auto | value/src/test/java/com/google/auto/value/processor/AutoValueCompilationTest.java | {
"start": 18344,
"end": 19086
} | class ____ {",
" public abstract void foo();",
"}");
Compilation compilation =
javac().withProcessors(new AutoValueProcessor()).compile(javaFileObject);
assertThat(compilation).failed();
assertThat(compilation)
.hadWarningContaining(
"Abstract method is neither a property getter nor a Builder converter")
.inFile(javaFileObject)
.onLineContaining("void foo()");
}
@Test
public void testAbstractWithParams() {
JavaFileObject javaFileObject =
JavaFileObjects.forSourceLines(
"foo.bar.Baz",
"package foo.bar;",
"import com.google.auto.value.AutoValue;",
"@AutoValue",
"public abstract | Baz |
java | alibaba__fastjson | src/main/java/com/alibaba/fastjson/annotation/JSONType.java | {
"start": 586,
"end": 1875
} | interface ____ {
boolean asm() default true;
String[] orders() default {};
/**
* @since 1.2.6
*/
String[] includes() default {};
String[] ignores() default {};
SerializerFeature[] serialzeFeatures() default {};
Feature[] parseFeatures() default {};
boolean alphabetic() default true;
Class<?> mappingTo() default Void.class;
Class<?> builder() default Void.class;
/**
* @since 1.2.11
*/
String typeName() default "";
/**
* @since 1.2.32
*/
String typeKey() default "";
/**
* @since 1.2.11
*/
Class<?>[] seeAlso() default{};
/**
* @since 1.2.14
*/
Class<?> serializer() default Void.class;
/**
* @since 1.2.14
*/
Class<?> deserializer() default Void.class;
boolean serializeEnumAsJavaBean() default false;
PropertyNamingStrategy naming() default PropertyNamingStrategy.NeverUseThisValueExceptDefaultValue;
/**
* @since 1.2.49
*/
Class<? extends SerializeFilter>[] serialzeFilters() default {};
/**
* @since 1.2.71
* @return
*/
Class<? extends ParserConfig.AutoTypeCheckHandler> autoTypeCheckHandler() default ParserConfig.AutoTypeCheckHandler.class;
}
| JSONType |
java | apache__dubbo | dubbo-common/src/test/java/org/apache/dubbo/common/utils/NetUtilsInterfaceDisplayNameHasMetaCharactersTest.java | {
"start": 1193,
"end": 1702
} | class ____ {
private static final String IGNORED_DISPLAY_NAME_HAS_METACHARACTERS = "Mock(R) ^$*+[?].|-[0-9] Adapter";
private static final String SELECTED_DISPLAY_NAME = "Selected Adapter";
private static final String SELECTED_HOST_ADDR = "192.168.0.1";
@Test
void testIgnoreGivenInterfaceNameWithMetaCharacters() throws Exception {
String originIgnoredInterfaces = this.getIgnoredInterfaces();
// mock static methods of final | NetUtilsInterfaceDisplayNameHasMetaCharactersTest |
java | bumptech__glide | samples/giphy/src/main/java/com/bumptech/glide/samples/giphy/Api.java | {
"start": 3782,
"end": 4215
} | class ____ {
public GifResult[] data;
@Override
public String toString() {
return "SearchResult{" + "data=" + Arrays.toString(data) + '}';
}
}
/**
* A POJO mirroring an individual GIF image returned from Giphy's api.
*
* <p>Implements equals and hashcode so that in memory caching will work when this object is used
* as a model for loading Glide's images.
*/
public static final | SearchResult |
java | apache__hadoop | hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/file/tfile/Compression.java | {
"start": 2135,
"end": 2677
} | class ____ extends FilterOutputStream {
public FinishOnFlushCompressionStream(CompressionOutputStream cout) {
super(cout);
}
@Override
public void write(byte b[], int off, int len) throws IOException {
out.write(b, off, len);
}
@Override
public void flush() throws IOException {
CompressionOutputStream cout = (CompressionOutputStream) out;
cout.finish();
cout.flush();
cout.resetState();
}
}
/**
* Compression algorithms.
*/
public | FinishOnFlushCompressionStream |
java | quarkusio__quarkus | integration-tests/hibernate-search-orm-elasticsearch/src/test/java/io/quarkus/it/hibernate/search/orm/elasticsearch/layout/HibernateSearchElasticsearchIndexLayoutTest.java | {
"start": 557,
"end": 1564
} | class ____ implements QuarkusTestProfile {
@Override
public Map<String, String> getConfigOverrides() {
return Map.of(
"quarkus.hibernate-search-orm.elasticsearch.layout.strategy",
"bean:%s".formatted("CustomIndexLayoutStrategy"),
"test.index-layout.prefix", "this-is-a-test-value-");
}
}
@Test
public void testHibernateSearch() {
// make sure that the bean reference property was passed over:
RestAssured.when().get("/test/layout-strategy/property").then()
.statusCode(200)
.body(stringContainsInOrder("CustomIndexLayoutStrategy"));
// check the actual index name to see that the strategy worked:
RestAssured.when().get("/test/layout-strategy/index-name").then()
.statusCode(200)
.body(is("LayoutEntity - this-is-a-test-value-layoutentity-read - this-is-a-test-value-layoutentity-write"));
}
}
| Profile |
java | FasterXML__jackson-databind | src/test/java/tools/jackson/databind/jsontype/TestPolymorphicDeduction.java | {
"start": 1476,
"end": 1589
} | class ____ extends Cat {
public boolean angry;
}
// No distinguishing properties whatsoever
static | LiveCat |
java | apache__thrift | lib/java/src/test/java/org/apache/thrift/transport/TestTSimpleFileTransport.java | {
"start": 1127,
"end": 2860
} | class ____ {
@Test
public void testFresh() throws Exception {
// Test write side
Path tempFilePathName = Files.createTempFile("TSimpleFileTransportTest", null);
Files.delete(tempFilePathName);
byte[] input_buf = new byte[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
TSimpleFileTransport trans_write =
new TSimpleFileTransport(tempFilePathName.toString(), false, true, false);
assert (!trans_write.isOpen());
trans_write.open();
assert (trans_write.isOpen());
trans_write.write(input_buf);
trans_write.write(input_buf, 2, 2);
trans_write.flush();
trans_write.close();
// Test read side
TSimpleFileTransport trans = new TSimpleFileTransport(tempFilePathName.toString(), true, false);
assert (trans.isOpen());
// Simple file trans provides no buffer access
assertEquals(0, trans.getBufferPosition());
assertNull(trans.getBuffer());
assertEquals(-1, trans.getBytesRemainingInBuffer());
// Test file pointer operations
assertEquals(0, trans.getFilePointer());
assertEquals(12, trans.length());
final int BUFSIZ = 4;
byte[] buf1 = new byte[BUFSIZ];
trans.readAll(buf1, 0, BUFSIZ);
assertEquals(BUFSIZ, trans.getFilePointer());
assertArrayEquals(new byte[] {1, 2, 3, 4}, buf1);
int bytesRead = trans.read(buf1, 0, BUFSIZ);
assert (bytesRead > 0);
for (int i = 0; i < bytesRead; ++i) {
assertEquals(buf1[i], i + 5);
}
trans.seek(0);
assertEquals(0, trans.getFilePointer());
trans.readAll(buf1, 0, BUFSIZ);
assertArrayEquals(new byte[] {1, 2, 3, 4}, buf1);
assertEquals(BUFSIZ, trans.getFilePointer());
trans.close();
Files.delete(tempFilePathName);
}
}
| TestTSimpleFileTransport |
java | spring-projects__spring-framework | spring-aop/src/main/java/org/springframework/aop/target/LazyInitTargetSource.java | {
"start": 2057,
"end": 2412
} | class ____ override the {@link #postProcessTargetObject(Object)} to
* perform some additional processing with the target object when it is first loaded.
*
* @author Juergen Hoeller
* @author Rob Harrop
* @since 1.1.4
* @see org.springframework.beans.factory.BeanFactory#getBean
* @see #postProcessTargetObject
*/
@SuppressWarnings("serial")
public | and |
java | elastic__elasticsearch | distribution/tools/server-cli/src/main/java/org/elasticsearch/server/cli/ProcessUtil.java | {
"start": 508,
"end": 581
} | class ____ {
private ProcessUtil() { /* no instance*/ }
| ProcessUtil |
java | apache__hadoop | hadoop-tools/hadoop-gcp/src/main/java/org/apache/hadoop/fs/gs/Fadvise.java | {
"start": 841,
"end": 898
} | enum ____ {
RANDOM, SEQUENTIAL, AUTO, AUTO_RANDOM
}
| Fadvise |
java | elastic__elasticsearch | server/src/main/java/org/elasticsearch/index/codec/tsdb/ES87TSDBDocValuesProducer.java | {
"start": 55289,
"end": 55406
} | class ____ {
NumericEntry ordsEntry;
TermsDictEntry termsDictEntry;
}
private static | SortedEntry |
java | apache__flink | flink-table/flink-table-common/src/test/java/org/apache/flink/table/types/extraction/TypeInferenceExtractorTest.java | {
"start": 89238,
"end": 89467
} | class ____ extends ScalarFunction {
public Integer eval(int i, Double d) {
return null;
}
public long eval(String s) {
return 0L;
}
}
private static | OverloadedFunction |
java | elastic__elasticsearch | x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/collector/indices/IndicesStatsMonitoringDocTests.java | {
"start": 1838,
"end": 9140
} | class ____ extends BaseFilteredMonitoringDocTestCase<IndicesStatsMonitoringDoc> {
private List<IndexStats> indicesStats;
@Override
@Before
public void setUp() throws Exception {
super.setUp();
indicesStats = Collections.singletonList(
new IndexStats(
"index-0",
"dcvO5uZATE-EhIKc3tk9Bg",
null,
null,
new ShardStats[] {
// Primaries
new ShardStats(mockShardRouting(true), mockShardPath(), mockCommonStats(), null, null, null, false, 0),
new ShardStats(mockShardRouting(true), mockShardPath(), mockCommonStats(), null, null, null, false, 0),
// Replica
new ShardStats(mockShardRouting(false), mockShardPath(), mockCommonStats(), null, null, null, false, 0) }
)
);
}
@Override
protected IndicesStatsMonitoringDoc createMonitoringDoc(
String cluster,
long timestamp,
long interval,
MonitoringDoc.Node node,
MonitoredSystem system,
String type,
String id
) {
return new IndicesStatsMonitoringDoc(cluster, timestamp, interval, node, indicesStats);
}
@Override
protected void assertFilteredMonitoringDoc(final IndicesStatsMonitoringDoc document) {
assertThat(document.getSystem(), is(MonitoredSystem.ES));
assertThat(document.getType(), is(IndicesStatsMonitoringDoc.TYPE));
assertThat(document.getId(), nullValue());
assertThat(document.getIndicesStats(), is(indicesStats));
}
@Override
protected Set<String> getExpectedXContentFilters() {
return IndicesStatsMonitoringDoc.XCONTENT_FILTERS;
}
public void testConstructorIndexStatsMustNotBeNull() {
expectThrows(NullPointerException.class, () -> new IndicesStatsMonitoringDoc(cluster, timestamp, interval, node, null));
}
@Override
public void testToXContent() throws IOException {
final MonitoringDoc.Node node = new MonitoringDoc.Node("_uuid", "_host", "_addr", "_ip", "_name", 1504169190855L);
final IndicesStatsMonitoringDoc document = new IndicesStatsMonitoringDoc(
"_cluster",
1502266739402L,
1506593717631L,
node,
indicesStats
);
final BytesReference xContent = XContentHelper.toXContent(document, XContentType.JSON, false);
final String expected = XContentHelper.stripWhitespace("""
{
"cluster_uuid": "_cluster",
"timestamp": "2017-08-09T08:18:59.402Z",
"interval_ms": 1506593717631,
"type": "indices_stats",
"source_node": {
"uuid": "_uuid",
"host": "_host",
"transport_address": "_addr",
"ip": "_ip",
"name": "_name",
"timestamp": "2017-08-31T08:46:30.855Z"
},
"indices_stats": {
"_all": {
"primaries": {
"docs": {
"count": 2
},
"store": {
"size_in_bytes": 4
},
"indexing": {
"index_total": 6,
"index_time_in_millis": 8,
"is_throttled": true,
"throttle_time_in_millis": 10
},
"search": {
"query_total": 12,
"query_time_in_millis": 14
},
"bulk": {
"total_operations": 0,
"total_time_in_millis": 0,
"total_size_in_bytes": 0,
"avg_time_in_millis": 0,
"avg_size_in_bytes": 0
}
},
"total": {
"docs": {
"count": 3
},
"store": {
"size_in_bytes": 6
},
"indexing": {
"index_total": 9,
"index_time_in_millis": 12,
"is_throttled": true,
"throttle_time_in_millis": 15
},
"search": {
"query_total": 18,
"query_time_in_millis": 21
},
"bulk": {
"total_operations": 0,
"total_time_in_millis": 0,
"total_size_in_bytes": 0,
"avg_time_in_millis": 0,
"avg_size_in_bytes": 0
}
}
}
}
}""");
assertEquals(expected, xContent.utf8ToString());
}
private CommonStats mockCommonStats() {
final CommonStats commonStats = new CommonStats(CommonStatsFlags.ALL);
commonStats.getDocs().add(new DocsStats(1L, 0L, randomNonNegativeLong() >> 8)); // >> 8 to avoid overflow - we add these things up
commonStats.getStore().add(new StoreStats(2L, 0L, 0L));
final IndexingStats.Stats indexingStats = new IndexingStats.Stats(3L, 4L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, true, 5L, 0, 0, 0, 0.0, 0.0);
commonStats.getIndexing().add(new IndexingStats(indexingStats));
final SearchStats.Stats searchStats = new SearchStats.Stats(6L, 7L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0.0);
commonStats.getSearch().add(new SearchStats(searchStats, 0L, null));
final BulkStats bulkStats = new BulkStats(0L, 0L, 0L, 0L, 0L);
commonStats.getBulk().add(bulkStats);
return commonStats;
}
private ShardPath mockShardPath() {
// Mock paths in a way that pass ShardPath constructor assertions
final int shardId = randomIntBetween(0, 10);
final Path getFileNameShardId = mock(Path.class);
when(getFileNameShardId.toString()).thenReturn(Integer.toString(shardId));
final String shardUuid = randomAlphaOfLength(5);
final Path getFileNameShardUuid = mock(Path.class);
when(getFileNameShardUuid.toString()).thenReturn(shardUuid);
final Path getParent = mock(Path.class);
when(getParent.getFileName()).thenReturn(getFileNameShardUuid);
final Path path = mock(Path.class);
when(path.getParent()).thenReturn(getParent);
when(path.getFileName()).thenReturn(getFileNameShardId);
// Mock paths for ShardPath#getRootDataPath()
final Path getParentOfParent = mock(Path.class);
when(getParent.getParent()).thenReturn(getParentOfParent);
when(getParentOfParent.getParent()).thenReturn(mock(Path.class));
return new ShardPath(false, path, path, new ShardId(randomAlphaOfLength(5), shardUuid, shardId));
}
private ShardRouting mockShardRouting(final boolean primary) {
return TestShardRouting.newShardRouting(randomAlphaOfLength(5), randomInt(), randomAlphaOfLength(5), primary, INITIALIZING);
}
}
| IndicesStatsMonitoringDocTests |
java | bumptech__glide | library/src/main/java/com/bumptech/glide/load/model/LazyHeaders.java | {
"start": 8323,
"end": 9023
} | class ____ implements LazyHeaderFactory {
@NonNull private final String value;
StringHeaderFactory(@NonNull String value) {
this.value = value;
}
@Override
public String buildHeader() {
return value;
}
@Override
public String toString() {
return "StringHeaderFactory{" + "value='" + value + '\'' + '}';
}
@Override
public boolean equals(Object o) {
if (o instanceof StringHeaderFactory) {
StringHeaderFactory other = (StringHeaderFactory) o;
return value.equals(other.value);
}
return false;
}
@Override
public int hashCode() {
return value.hashCode();
}
}
}
| StringHeaderFactory |
java | quarkusio__quarkus | extensions/redis-client/runtime/src/main/java/io/quarkus/redis/datasource/keys/KeyScanCursor.java | {
"start": 117,
"end": 421
} | interface ____<K> extends Cursor<Set<K>> {
/**
* Returns an {@code Iterable} providing the keys individually.
* Unlike {@link #next()} which provides the keys by batch, this method returns them one by one.
*
* @return the iterable
*/
Iterable<K> toIterable();
}
| KeyScanCursor |
java | netty__netty | codec-classes-quic/src/main/java/io/netty/handler/codec/quic/QuicHeaderParser.java | {
"start": 1279,
"end": 10720
} | class ____ implements AutoCloseable {
// See https://datatracker.ietf.org/doc/rfc7714/
private static final int AES_128_GCM_TAG_LENGTH = 16;
private final int localConnectionIdLength;
private boolean closed;
public QuicHeaderParser(int localConnectionIdLength) {
this.localConnectionIdLength = checkPositiveOrZero(localConnectionIdLength, "localConnectionIdLength");
}
@Override
public void close() {
if (!closed) {
closed = true;
}
}
/**
* Parses a QUIC packet and extract the header values out of it. This method takes no ownership of the packet itself
* which means the caller of this method is expected to call {@link ByteBuf#release()} once the packet is not needed
* anymore.
*
* @param sender the sender of the packet. This is directly passed to the {@link QuicHeaderProcessor} once
* parsing was successful.
* @param recipient the recipient of the packet.This is directly passed to the {@link QuicHeaderProcessor} once
* parsing was successful.
* @param packet raw QUIC packet itself. The ownership of the packet is not transferred. This is directly
* passed to the {@link QuicHeaderProcessor} once parsing was successful.
* @param callback the {@link QuicHeaderProcessor} that is called once a QUIC packet could be parsed and all
* the header values be extracted.
* @throws Exception thrown if we couldn't parse the header or if the {@link QuicHeaderProcessor} throws an
* exception.
*/
public void parse(InetSocketAddress sender, InetSocketAddress recipient, ByteBuf packet,
QuicHeaderProcessor callback) throws Exception {
if (closed) {
throw new IllegalStateException(QuicHeaderParser.class.getSimpleName() + " is already closed");
}
// See https://datatracker.ietf.org/doc/html/rfc9000#section-17
int offset = 0;
int readable = packet.readableBytes();
checkReadable(offset, readable, Byte.BYTES);
byte first = packet.getByte(offset);
offset += Byte.BYTES;
final QuicPacketType type;
final long version;
final ByteBuf dcid;
final ByteBuf scid;
final ByteBuf token;
if (hasShortHeader(first)) {
// See https://www.rfc-editor.org/rfc/rfc9000.html#section-17.3
// 1-RTT Packet {
// Header Form (1) = 0,
// Fixed Bit (1) = 1,
// Spin Bit (1),
// Reserved Bits (2),
// Key Phase (1),
// Packet Number Length (2),
// Destination Connection ID (0..160),
// Packet Number (8..32),
// Packet Payload (8..),
//}
version = 0;
type = QuicPacketType.SHORT;
// Short packets have no source connection id and no token.
scid = Unpooled.EMPTY_BUFFER;
token = Unpooled.EMPTY_BUFFER;
dcid = sliceCid(packet, offset, localConnectionIdLength);
} else {
// See https://www.rfc-editor.org/rfc/rfc9000.html#section-17.2
// Long Header Packet {
// Header Form (1) = 1,
// Fixed Bit (1) = 1,
// Long Packet Type (2),
// Type-Specific Bits (4),
// Version (32),
// Destination Connection ID Length (8),
// Destination Connection ID (0..160),
// Source Connection ID Length (8),
// Source Connection ID (0..160),
// Type-Specific Payload (..),
//}
checkReadable(offset, readable, Integer.BYTES);
// Version uses an unsigned int:
// https://www.rfc-editor.org/rfc/rfc9000.html#section-15
version = packet.getUnsignedInt(offset);
offset += Integer.BYTES;
type = typeOfLongHeader(first, version);
int dcidLen = packet.getUnsignedByte(offset);
checkCidLength(dcidLen);
offset += Byte.BYTES;
dcid = sliceCid(packet, offset, dcidLen);
offset += dcidLen;
int scidLen = packet.getUnsignedByte(offset);
checkCidLength(scidLen);
offset += Byte.BYTES;
scid = sliceCid(packet, offset, scidLen);
offset += scidLen;
token = sliceToken(type, packet, offset, readable);
}
callback.process(sender, recipient, packet, type, version, scid, dcid, token);
}
// Check if the connection id is not longer then 20. This is what is the maximum for QUIC version 1.
// See https://www.rfc-editor.org/rfc/rfc9000.html#section-17.2
private static void checkCidLength(int length) throws QuicException {
if (length > Quic.MAX_CONN_ID_LEN) {
throw new QuicException("connection id to large: " + length + " > " + Quic.MAX_CONN_ID_LEN,
QuicTransportError.PROTOCOL_VIOLATION);
}
}
private static ByteBuf sliceToken(QuicPacketType type, ByteBuf packet, int offset, int readable)
throws QuicException {
switch (type) {
case INITIAL:
// See
checkReadable(offset, readable, Byte.BYTES);
int numBytes = numBytesForVariableLengthInteger(packet.getByte(offset));
int len = (int) getVariableLengthInteger(packet, offset, numBytes);
offset += numBytes;
checkReadable(offset, readable, len);
return packet.slice(offset, len);
case RETRY:
// Exclude the integrity tag from the token.
// See https://www.rfc-editor.org/rfc/rfc9000.html#section-17.2.5
checkReadable(offset, readable, AES_128_GCM_TAG_LENGTH);
int tokenLen = readable - offset - AES_128_GCM_TAG_LENGTH;
return packet.slice(offset, tokenLen);
default:
// No token included.
return Unpooled.EMPTY_BUFFER;
}
}
private static QuicException newProtocolViolationException(String message) {
return new QuicException(message, QuicTransportError.PROTOCOL_VIOLATION);
}
static ByteBuf sliceCid(ByteBuf buffer, int offset, int len) throws QuicException {
checkReadable(offset, buffer.readableBytes(), len);
return buffer.slice(offset, len);
}
private static void checkReadable(int offset, int readable, int needed) throws QuicException {
int r = readable - offset;
if (r < needed) {
throw newProtocolViolationException("Not enough bytes to read, " + r + " < " + needed);
}
}
/**
* Read the variable length integer from the {@link ByteBuf}.
* See <a href="https://tools.ietf.org/html/draft-ietf-quic-transport-32#section-16">
* Variable-Length Integer Encoding </a>
*/
private static long getVariableLengthInteger(ByteBuf in, int offset, int len) throws QuicException {
checkReadable(offset, in.readableBytes(), len);
switch (len) {
case 1:
return in.getUnsignedByte(offset);
case 2:
return in.getUnsignedShort(offset) & 0x3fff;
case 4:
return in.getUnsignedInt(offset) & 0x3fffffff;
case 8:
return in.getLong(offset) & 0x3fffffffffffffffL;
default:
throw newProtocolViolationException("Unsupported length:" + len);
}
}
/**
* Returns the number of bytes that were encoded into the byte for a variable length integer to read.
* See <a href="https://tools.ietf.org/html/draft-ietf-quic-transport-32#section-16">
* Variable-Length Integer Encoding </a>
*/
private static int numBytesForVariableLengthInteger(byte b) {
byte val = (byte) (b >> 6);
if ((val & 1) != 0) {
if ((val & 2) != 0) {
return 8;
}
return 2;
}
if ((val & 2) != 0) {
return 4;
}
return 1;
}
static boolean hasShortHeader(byte b) {
return (b & 0x80) == 0;
}
private static QuicPacketType typeOfLongHeader(byte first, long version) throws QuicException {
if (version == 0) {
// If we parsed a version of 0 we are sure it's a version negotiation packet:
// https://www.rfc-editor.org/rfc/rfc9000.html#section-17.2.1
//
// This also means we should ignore everything that is left in 'first'.
return QuicPacketType.VERSION_NEGOTIATION;
}
int packetType = (first & 0x30) >> 4;
switch (packetType) {
case 0x00:
return QuicPacketType.INITIAL;
case 0x01:
return QuicPacketType.ZERO_RTT;
case 0x02:
return QuicPacketType.HANDSHAKE;
case 0x03:
return QuicPacketType.RETRY;
default:
throw newProtocolViolationException("Unknown packet type: " + packetType);
}
}
/**
* Called when a QUIC packet and its header could be parsed.
*/
public | QuicHeaderParser |
java | hibernate__hibernate-orm | hibernate-spatial/src/main/java/org/hibernate/spatial/SpatialRelation.java | {
"start": 414,
"end": 1370
} | interface ____ {
/**
* The geometries are spatially equal to each other.
*/
public static int EQUALS = 0;
/**
* The geometries are spatially dijoint
*/
public static int DISJOINT = 1;
/**
* The geometries touch
*/
public static int TOUCHES = 2;
/**
* The geometries cross
*/
public static int CROSSES = 3;
/**
* The first geometry is spatially within the second
*/
public static int WITHIN = 4;
/**
* The geometries spatially overlap
*/
public static int OVERLAPS = 5;
/**
* The first geometry spatially contains the second
*/
public static int CONTAINS = 6;
/**
* The first geometry intersects the second
*/
public static int INTERSECTS = 7;
/**
* The bounding box of the first geometry intersects the bounding box of the second
* <p>
* <p>This relation is not defined in OGC 99-049, it corresponds to the Postgis '&&' operator.</p>
*/
public static int FILTER = 8;
}
| SpatialRelation |
java | assertj__assertj-core | assertj-core/src/test/java/org/assertj/core/api/ComparableAssertion_should_be_flexible_Test.java | {
"start": 684,
"end": 1102
} | class ____ {
@Test
void comparable_api_should_be_flexible() {
TestClass testClass1 = new TestClass();
TestClass testClass2 = new TestClass();
TestClassAssert.assertThat(testClass1).isEqualByComparingTo(testClass2);
}
// The important thing here is that TestClass implements Comparable<Object> and not Comparable<TestClass>
// even
private static final | ComparableAssertion_should_be_flexible_Test |
java | apache__flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/catalog/FileCatalogStoreFactory.java | {
"start": 1546,
"end": 2514
} | class ____ implements CatalogStoreFactory {
private String path;
@Override
public CatalogStore createCatalogStore() {
return new FileCatalogStore(path);
}
@Override
public void open(Context context) {
FactoryHelper<CatalogStoreFactory> factoryHelper =
createCatalogStoreFactoryHelper(this, context);
factoryHelper.validate();
ReadableConfig options = factoryHelper.getOptions();
path = options.get(PATH);
}
@Override
public void close() {}
@Override
public String factoryIdentifier() {
return IDENTIFIER;
}
@Override
public Set<ConfigOption<?>> requiredOptions() {
Set<ConfigOption<?>> options = new HashSet<>();
options.add(PATH);
return Collections.unmodifiableSet(options);
}
@Override
public Set<ConfigOption<?>> optionalOptions() {
return Collections.emptySet();
}
}
| FileCatalogStoreFactory |
java | elastic__elasticsearch | server/src/main/java/org/elasticsearch/index/mapper/NumberFieldMapper.java | {
"start": 5186,
"end": 5496
} | class ____ extends FieldMapper {
public static final Setting<Boolean> COERCE_SETTING = Setting.boolSetting("index.mapping.coerce", true, Property.IndexScope);
private static NumberFieldMapper toType(FieldMapper in) {
return (NumberFieldMapper) in;
}
public static final | NumberFieldMapper |
java | ReactiveX__RxJava | src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableInternalHelperTest.java | {
"start": 793,
"end": 1090
} | class ____ extends RxJavaTest {
@Test
public void utilityClass() {
TestHelper.checkUtilityClass(FlowableInternalHelper.class);
}
@Test
public void requestMaxEnum() {
TestHelper.checkEnum(FlowableInternalHelper.RequestMax.class);
}
}
| FlowableInternalHelperTest |
java | elastic__elasticsearch | server/src/test/java/org/elasticsearch/rest/action/admin/indices/RestIndicesStatsActionTests.java | {
"start": 1036,
"end": 5431
} | class ____ extends ESTestCase {
private RestIndicesStatsAction action;
@Override
public void setUp() throws Exception {
super.setUp();
action = new RestIndicesStatsAction();
}
public void testUnrecognizedMetric() throws IOException {
final HashMap<String, String> params = new HashMap<>();
final String metric = randomAlphaOfLength(64);
params.put("metric", metric);
final RestRequest request = new FakeRestRequest.Builder(xContentRegistry()).withPath("/_stats").withParams(params).build();
final IllegalArgumentException e = expectThrows(
IllegalArgumentException.class,
() -> action.prepareRequest(request, mock(NodeClient.class))
);
assertThat(e, hasToString(containsString("request [/_stats] contains unrecognized metric: [" + metric + "]")));
}
public void testUnrecognizedMetricDidYouMean() throws IOException {
final HashMap<String, String> params = new HashMap<>();
params.put("metric", "request_cache,fieldata,unrecognized");
final RestRequest request = new FakeRestRequest.Builder(xContentRegistry()).withPath("/_stats").withParams(params).build();
final IllegalArgumentException e = expectThrows(
IllegalArgumentException.class,
() -> action.prepareRequest(request, mock(NodeClient.class))
);
assertThat(
e,
hasToString(
containsString("request [/_stats] contains unrecognized metrics: [fieldata] -> did you mean [fielddata]?, [unrecognized]")
)
);
}
public void testAllRequestWithOtherMetrics() throws IOException {
final HashMap<String, String> params = new HashMap<>();
final String metric = randomSubsetOf(1, RestIndicesStatsAction.METRICS.keySet()).get(0);
params.put("metric", "_all," + metric);
final RestRequest request = new FakeRestRequest.Builder(xContentRegistry()).withPath("/_stats").withParams(params).build();
final IllegalArgumentException e = expectThrows(
IllegalArgumentException.class,
() -> action.prepareRequest(request, mock(NodeClient.class))
);
assertThat(e, hasToString(containsString("request [/_stats] contains _all and individual metrics [_all," + metric + "]")));
}
public void testLevelValidation() throws IOException {
final HashMap<String, String> params = new HashMap<>();
params.put("level", ClusterStatsLevel.CLUSTER.getLevel());
// cluster is valid
RestRequest request = new FakeRestRequest.Builder(xContentRegistry()).withPath("/_stats").withParams(params).build();
action.prepareRequest(request, mock(NodeClient.class));
// indices is valid
params.put("level", ClusterStatsLevel.INDICES.getLevel());
request = new FakeRestRequest.Builder(xContentRegistry()).withPath("/_stats").withParams(params).build();
action.prepareRequest(request, mock(NodeClient.class));
// shards is valid
params.put("level", ClusterStatsLevel.SHARDS.getLevel());
request = new FakeRestRequest.Builder(xContentRegistry()).withPath("/_stats").withParams(params).build();
action.prepareRequest(request, mock(NodeClient.class));
params.put("level", NodeStatsLevel.NODE.getLevel());
final RestRequest invalidLevelRequest1 = new FakeRestRequest.Builder(xContentRegistry()).withPath("/_stats")
.withParams(params)
.build();
IllegalArgumentException e = expectThrows(
IllegalArgumentException.class,
() -> action.prepareRequest(invalidLevelRequest1, mock(NodeClient.class))
);
assertThat(e, hasToString(containsString("level parameter must be one of [cluster] or [indices] or [shards] but was [node]")));
params.put("level", "invalid");
final RestRequest invalidLevelRequest2 = new FakeRestRequest.Builder(xContentRegistry()).withPath("/_stats")
.withParams(params)
.build();
e = expectThrows(IllegalArgumentException.class, () -> action.prepareRequest(invalidLevelRequest2, mock(NodeClient.class)));
assertThat(e, hasToString(containsString("level parameter must be one of [cluster] or [indices] or [shards] but was [invalid]")));
}
}
| RestIndicesStatsActionTests |
java | assertj__assertj-core | assertj-core/src/main/java/org/assertj/core/api/Assertions.java | {
"start": 146792,
"end": 148849
} | class ____ implements AssertDelegateTarget {
*
* private MyButton button;
* MyButtonAssert(MyButton button) { this.button = button; }
*
* void isBlinking() {
* // standard assertion from core Assertions.assertThat
* assertThat(button.isBlinking()).isTrue();
* }
*
* void isNotBlinking() {
* // standard assertion from core Assertions.assertThat
* assertThat(button.isBlinking()).isFalse();
* }
* }</code></pre>
*
* As MyButtonAssert implements AssertDelegateTarget, you can use <code>assertThat(buttonAssert).isBlinking();</code>
* instead of <code>buttonAssert.isBlinking();</code> to have easier to read assertions:
* <pre><code class='java'> {@literal @}Test
* public void AssertDelegateTarget_example() {
*
* MyButton button = new MyButton();
* MyButtonAssert buttonAssert = new MyButtonAssert(button);
*
* // you can encapsulate MyButtonAssert assertions methods within assertThat
* assertThat(buttonAssert).isNotBlinking(); // same as : buttonAssert.isNotBlinking();
*
* button.setBlinking(true);
*
* assertThat(buttonAssert).isBlinking(); // same as : buttonAssert.isBlinking();
* }</code></pre>
*
* @param <T> the generic type of the user-defined assert.
* @param assertion the assertion to return.
* @return the given assertion.
*/
public static <T extends AssertDelegateTarget> T assertThat(T assertion) {
return assertion;
}
/**
* Use the given {@link Representation} in all remaining tests assertions.
* <p>
* {@link Representation} are used to format types in assertions error messages.
* <p>
* An alternative way of using a different representation is to register one as a service,
* this approach is described in {@link Representation}, it requires more work than this method
* but has the advantage of not having to do anything in your tests and it would be applied to all the tests globally
* <p>
* Example :
* <pre><code class='java'> private | MyButtonAssert |
java | hibernate__hibernate-orm | hibernate-envers/src/test/java/org/hibernate/orm/test/envers/integration/ids/embeddedid/PurchaseOrder.java | {
"start": 588,
"end": 2554
} | class ____ implements Serializable {
@Id
@GeneratedValue
private Integer id;
@ManyToOne
@JoinColumns({
@JoinColumn(name = "model", referencedColumnName = "model", nullable = true),
@JoinColumn(name = "version", referencedColumnName = "version", nullable = true),
@JoinColumn(name = "producer", referencedColumnName = "producer", nullable = true)
})
private Item item;
@Column(name = "NOTE")
private String comment;
public PurchaseOrder() {
}
public PurchaseOrder(Item item, String comment) {
this.item = item;
this.comment = comment;
}
public PurchaseOrder(Integer id, Item item, String comment) {
this.id = id;
this.item = item;
this.comment = comment;
}
@Override
public boolean equals(Object o) {
if ( this == o ) {
return true;
}
if ( !(o instanceof PurchaseOrder) ) {
return false;
}
PurchaseOrder that = (PurchaseOrder) o;
if ( getComment() != null ? !getComment().equals( that.getComment() ) : that.getComment() != null ) {
return false;
}
if ( getId() != null ? !getId().equals( that.getId() ) : that.getId() != null ) {
return false;
}
if ( getItem() != null ? !getItem().equals( that.getItem() ) : that.getItem() != null ) {
return false;
}
return true;
}
@Override
public String toString() {
return "PurchaseOrder(id = " + id + ", item = " + item + ", comment = " + comment + ")";
}
@Override
public int hashCode() {
int result = id != null ? id.hashCode() : 0;
result = 31 * result + (item != null ? item.hashCode() : 0);
result = 31 * result + (comment != null ? comment.hashCode() : 0);
return result;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Item getItem() {
return item;
}
public void setItem(Item item) {
this.item = item;
}
public String getComment() {
return comment;
}
public void setComment(String comment) {
this.comment = comment;
}
}
| PurchaseOrder |
java | spring-projects__spring-security | oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jwt/JwtClaimAccessor.java | {
"start": 1175,
"end": 3202
} | interface ____ extends ClaimAccessor {
/**
* Returns the Issuer {@code (iss)} claim which identifies the principal that issued
* the JWT.
* @return the Issuer identifier
*/
default URL getIssuer() {
return this.getClaimAsURL(JwtClaimNames.ISS);
}
/**
* Returns the Subject {@code (sub)} claim which identifies the principal that is the
* subject of the JWT.
* @return the Subject identifier
*/
default String getSubject() {
return this.getClaimAsString(JwtClaimNames.SUB);
}
/**
* Returns the Audience {@code (aud)} claim which identifies the recipient(s) that the
* JWT is intended for.
* @return the Audience(s) that this JWT intended for
*/
default List<String> getAudience() {
return this.getClaimAsStringList(JwtClaimNames.AUD);
}
/**
* Returns the Expiration time {@code (exp)} claim which identifies the expiration
* time on or after which the JWT MUST NOT be accepted for processing.
* @return the Expiration time on or after which the JWT MUST NOT be accepted for
* processing
*/
default Instant getExpiresAt() {
return this.getClaimAsInstant(JwtClaimNames.EXP);
}
/**
* Returns the Not Before {@code (nbf)} claim which identifies the time before which
* the JWT MUST NOT be accepted for processing.
* @return the Not Before time before which the JWT MUST NOT be accepted for
* processing
*/
default Instant getNotBefore() {
return this.getClaimAsInstant(JwtClaimNames.NBF);
}
/**
* Returns the Issued at {@code (iat)} claim which identifies the time at which the
* JWT was issued.
* @return the Issued at claim which identifies the time at which the JWT was issued
*/
default Instant getIssuedAt() {
return this.getClaimAsInstant(JwtClaimNames.IAT);
}
/**
* Returns the JWT ID {@code (jti)} claim which provides a unique identifier for the
* JWT.
* @return the JWT ID claim which provides a unique identifier for the JWT
*/
default String getId() {
return this.getClaimAsString(JwtClaimNames.JTI);
}
}
| JwtClaimAccessor |
java | hibernate__hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/annotations/entity/Length.java | {
"start": 190,
"end": 236
} | interface ____<Type> {
Type getLength();
}
| Length |
java | apache__camel | dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializers.java | {
"start": 209341,
"end": 229516
} | class ____ extends YamlDeserializerBase<DataFormatTransformerDefinition> {
public DataFormatTransformerDefinitionDeserializer() {
super(DataFormatTransformerDefinition.class);
}
@Override
protected DataFormatTransformerDefinition newInstance() {
return new DataFormatTransformerDefinition();
}
@Override
protected boolean setProperty(DataFormatTransformerDefinition target, String propertyKey,
String propertyName, Node node) {
propertyKey = org.apache.camel.util.StringHelper.dashToCamelCase(propertyKey);
switch(propertyKey) {
case "dataFormatType": {
MappingNode val = asMappingNode(node);
setProperties(target, val);
break;
}
case "asn1": {
org.apache.camel.model.dataformat.ASN1DataFormat val = asType(node, org.apache.camel.model.dataformat.ASN1DataFormat.class);
target.setDataFormatType(val);
break;
}
case "avro": {
org.apache.camel.model.dataformat.AvroDataFormat val = asType(node, org.apache.camel.model.dataformat.AvroDataFormat.class);
target.setDataFormatType(val);
break;
}
case "barcode": {
org.apache.camel.model.dataformat.BarcodeDataFormat val = asType(node, org.apache.camel.model.dataformat.BarcodeDataFormat.class);
target.setDataFormatType(val);
break;
}
case "base64": {
org.apache.camel.model.dataformat.Base64DataFormat val = asType(node, org.apache.camel.model.dataformat.Base64DataFormat.class);
target.setDataFormatType(val);
break;
}
case "beanio": {
org.apache.camel.model.dataformat.BeanioDataFormat val = asType(node, org.apache.camel.model.dataformat.BeanioDataFormat.class);
target.setDataFormatType(val);
break;
}
case "bindy": {
org.apache.camel.model.dataformat.BindyDataFormat val = asType(node, org.apache.camel.model.dataformat.BindyDataFormat.class);
target.setDataFormatType(val);
break;
}
case "cbor": {
org.apache.camel.model.dataformat.CBORDataFormat val = asType(node, org.apache.camel.model.dataformat.CBORDataFormat.class);
target.setDataFormatType(val);
break;
}
case "crypto": {
org.apache.camel.model.dataformat.CryptoDataFormat val = asType(node, org.apache.camel.model.dataformat.CryptoDataFormat.class);
target.setDataFormatType(val);
break;
}
case "csv": {
org.apache.camel.model.dataformat.CsvDataFormat val = asType(node, org.apache.camel.model.dataformat.CsvDataFormat.class);
target.setDataFormatType(val);
break;
}
case "custom": {
org.apache.camel.model.dataformat.CustomDataFormat val = asType(node, org.apache.camel.model.dataformat.CustomDataFormat.class);
target.setDataFormatType(val);
break;
}
case "dfdl": {
org.apache.camel.model.dataformat.DfdlDataFormat val = asType(node, org.apache.camel.model.dataformat.DfdlDataFormat.class);
target.setDataFormatType(val);
break;
}
case "fhirJson": {
org.apache.camel.model.dataformat.FhirJsonDataFormat val = asType(node, org.apache.camel.model.dataformat.FhirJsonDataFormat.class);
target.setDataFormatType(val);
break;
}
case "fhirXml": {
org.apache.camel.model.dataformat.FhirXmlDataFormat val = asType(node, org.apache.camel.model.dataformat.FhirXmlDataFormat.class);
target.setDataFormatType(val);
break;
}
case "flatpack": {
org.apache.camel.model.dataformat.FlatpackDataFormat val = asType(node, org.apache.camel.model.dataformat.FlatpackDataFormat.class);
target.setDataFormatType(val);
break;
}
case "fory": {
org.apache.camel.model.dataformat.ForyDataFormat val = asType(node, org.apache.camel.model.dataformat.ForyDataFormat.class);
target.setDataFormatType(val);
break;
}
case "grok": {
org.apache.camel.model.dataformat.GrokDataFormat val = asType(node, org.apache.camel.model.dataformat.GrokDataFormat.class);
target.setDataFormatType(val);
break;
}
case "groovyXml": {
org.apache.camel.model.dataformat.GroovyXmlDataFormat val = asType(node, org.apache.camel.model.dataformat.GroovyXmlDataFormat.class);
target.setDataFormatType(val);
break;
}
case "gzipDeflater": {
org.apache.camel.model.dataformat.GzipDeflaterDataFormat val = asType(node, org.apache.camel.model.dataformat.GzipDeflaterDataFormat.class);
target.setDataFormatType(val);
break;
}
case "hl7": {
org.apache.camel.model.dataformat.HL7DataFormat val = asType(node, org.apache.camel.model.dataformat.HL7DataFormat.class);
target.setDataFormatType(val);
break;
}
case "ical": {
org.apache.camel.model.dataformat.IcalDataFormat val = asType(node, org.apache.camel.model.dataformat.IcalDataFormat.class);
target.setDataFormatType(val);
break;
}
case "iso8583": {
org.apache.camel.model.dataformat.Iso8583DataFormat val = asType(node, org.apache.camel.model.dataformat.Iso8583DataFormat.class);
target.setDataFormatType(val);
break;
}
case "jacksonXml": {
org.apache.camel.model.dataformat.JacksonXMLDataFormat val = asType(node, org.apache.camel.model.dataformat.JacksonXMLDataFormat.class);
target.setDataFormatType(val);
break;
}
case "jaxb": {
org.apache.camel.model.dataformat.JaxbDataFormat val = asType(node, org.apache.camel.model.dataformat.JaxbDataFormat.class);
target.setDataFormatType(val);
break;
}
case "json": {
org.apache.camel.model.dataformat.JsonDataFormat val = asType(node, org.apache.camel.model.dataformat.JsonDataFormat.class);
target.setDataFormatType(val);
break;
}
case "jsonApi": {
org.apache.camel.model.dataformat.JsonApiDataFormat val = asType(node, org.apache.camel.model.dataformat.JsonApiDataFormat.class);
target.setDataFormatType(val);
break;
}
case "lzf": {
org.apache.camel.model.dataformat.LZFDataFormat val = asType(node, org.apache.camel.model.dataformat.LZFDataFormat.class);
target.setDataFormatType(val);
break;
}
case "mimeMultipart": {
org.apache.camel.model.dataformat.MimeMultipartDataFormat val = asType(node, org.apache.camel.model.dataformat.MimeMultipartDataFormat.class);
target.setDataFormatType(val);
break;
}
case "parquetAvro": {
org.apache.camel.model.dataformat.ParquetAvroDataFormat val = asType(node, org.apache.camel.model.dataformat.ParquetAvroDataFormat.class);
target.setDataFormatType(val);
break;
}
case "protobuf": {
org.apache.camel.model.dataformat.ProtobufDataFormat val = asType(node, org.apache.camel.model.dataformat.ProtobufDataFormat.class);
target.setDataFormatType(val);
break;
}
case "rss": {
org.apache.camel.model.dataformat.RssDataFormat val = asType(node, org.apache.camel.model.dataformat.RssDataFormat.class);
target.setDataFormatType(val);
break;
}
case "smooks": {
org.apache.camel.model.dataformat.SmooksDataFormat val = asType(node, org.apache.camel.model.dataformat.SmooksDataFormat.class);
target.setDataFormatType(val);
break;
}
case "soap": {
org.apache.camel.model.dataformat.SoapDataFormat val = asType(node, org.apache.camel.model.dataformat.SoapDataFormat.class);
target.setDataFormatType(val);
break;
}
case "swiftMt": {
org.apache.camel.model.dataformat.SwiftMtDataFormat val = asType(node, org.apache.camel.model.dataformat.SwiftMtDataFormat.class);
target.setDataFormatType(val);
break;
}
case "swiftMx": {
org.apache.camel.model.dataformat.SwiftMxDataFormat val = asType(node, org.apache.camel.model.dataformat.SwiftMxDataFormat.class);
target.setDataFormatType(val);
break;
}
case "syslog": {
org.apache.camel.model.dataformat.SyslogDataFormat val = asType(node, org.apache.camel.model.dataformat.SyslogDataFormat.class);
target.setDataFormatType(val);
break;
}
case "tarFile": {
org.apache.camel.model.dataformat.TarFileDataFormat val = asType(node, org.apache.camel.model.dataformat.TarFileDataFormat.class);
target.setDataFormatType(val);
break;
}
case "thrift": {
org.apache.camel.model.dataformat.ThriftDataFormat val = asType(node, org.apache.camel.model.dataformat.ThriftDataFormat.class);
target.setDataFormatType(val);
break;
}
case "univocityCsv": {
org.apache.camel.model.dataformat.UniVocityCsvDataFormat val = asType(node, org.apache.camel.model.dataformat.UniVocityCsvDataFormat.class);
target.setDataFormatType(val);
break;
}
case "univocityFixed": {
org.apache.camel.model.dataformat.UniVocityFixedDataFormat val = asType(node, org.apache.camel.model.dataformat.UniVocityFixedDataFormat.class);
target.setDataFormatType(val);
break;
}
case "univocityTsv": {
org.apache.camel.model.dataformat.UniVocityTsvDataFormat val = asType(node, org.apache.camel.model.dataformat.UniVocityTsvDataFormat.class);
target.setDataFormatType(val);
break;
}
case "xmlSecurity": {
org.apache.camel.model.dataformat.XMLSecurityDataFormat val = asType(node, org.apache.camel.model.dataformat.XMLSecurityDataFormat.class);
target.setDataFormatType(val);
break;
}
case "pgp": {
org.apache.camel.model.dataformat.PGPDataFormat val = asType(node, org.apache.camel.model.dataformat.PGPDataFormat.class);
target.setDataFormatType(val);
break;
}
case "yaml": {
org.apache.camel.model.dataformat.YAMLDataFormat val = asType(node, org.apache.camel.model.dataformat.YAMLDataFormat.class);
target.setDataFormatType(val);
break;
}
case "zipDeflater": {
org.apache.camel.model.dataformat.ZipDeflaterDataFormat val = asType(node, org.apache.camel.model.dataformat.ZipDeflaterDataFormat.class);
target.setDataFormatType(val);
break;
}
case "zipFile": {
org.apache.camel.model.dataformat.ZipFileDataFormat val = asType(node, org.apache.camel.model.dataformat.ZipFileDataFormat.class);
target.setDataFormatType(val);
break;
}
case "fromType": {
String val = asText(node);
target.setFromType(val);
break;
}
case "name": {
String val = asText(node);
target.setName(val);
break;
}
case "scheme": {
String val = asText(node);
target.setScheme(val);
break;
}
case "toType": {
String val = asText(node);
target.setToType(val);
break;
}
default: {
return false;
}
}
return true;
}
}
@YamlType(
nodes = "dataFormats",
types = org.apache.camel.model.dataformat.DataFormatsDefinition.class,
order = org.apache.camel.dsl.yaml.common.YamlDeserializerResolver.ORDER_LOWEST - 1,
displayName = "Data formats",
description = "Configure data formats.",
deprecated = false,
properties = {
@YamlProperty(name = "asn1", type = "object:org.apache.camel.model.dataformat.ASN1DataFormat"),
@YamlProperty(name = "avro", type = "object:org.apache.camel.model.dataformat.AvroDataFormat"),
@YamlProperty(name = "barcode", type = "object:org.apache.camel.model.dataformat.BarcodeDataFormat"),
@YamlProperty(name = "base64", type = "object:org.apache.camel.model.dataformat.Base64DataFormat"),
@YamlProperty(name = "beanio", type = "object:org.apache.camel.model.dataformat.BeanioDataFormat"),
@YamlProperty(name = "bindy", type = "object:org.apache.camel.model.dataformat.BindyDataFormat"),
@YamlProperty(name = "cbor", type = "object:org.apache.camel.model.dataformat.CBORDataFormat"),
@YamlProperty(name = "crypto", type = "object:org.apache.camel.model.dataformat.CryptoDataFormat"),
@YamlProperty(name = "csv", type = "object:org.apache.camel.model.dataformat.CsvDataFormat"),
@YamlProperty(name = "custom", type = "object:org.apache.camel.model.dataformat.CustomDataFormat"),
@YamlProperty(name = "dfdl", type = "object:org.apache.camel.model.dataformat.DfdlDataFormat"),
@YamlProperty(name = "fhirJson", type = "object:org.apache.camel.model.dataformat.FhirJsonDataFormat"),
@YamlProperty(name = "fhirXml", type = "object:org.apache.camel.model.dataformat.FhirXmlDataFormat"),
@YamlProperty(name = "flatpack", type = "object:org.apache.camel.model.dataformat.FlatpackDataFormat"),
@YamlProperty(name = "fory", type = "object:org.apache.camel.model.dataformat.ForyDataFormat"),
@YamlProperty(name = "grok", type = "object:org.apache.camel.model.dataformat.GrokDataFormat"),
@YamlProperty(name = "groovyXml", type = "object:org.apache.camel.model.dataformat.GroovyXmlDataFormat"),
@YamlProperty(name = "gzipDeflater", type = "object:org.apache.camel.model.dataformat.GzipDeflaterDataFormat"),
@YamlProperty(name = "hl7", type = "object:org.apache.camel.model.dataformat.HL7DataFormat"),
@YamlProperty(name = "ical", type = "object:org.apache.camel.model.dataformat.IcalDataFormat"),
@YamlProperty(name = "iso8583", type = "object:org.apache.camel.model.dataformat.Iso8583DataFormat"),
@YamlProperty(name = "jacksonXml", type = "object:org.apache.camel.model.dataformat.JacksonXMLDataFormat"),
@YamlProperty(name = "jaxb", type = "object:org.apache.camel.model.dataformat.JaxbDataFormat"),
@YamlProperty(name = "json", type = "object:org.apache.camel.model.dataformat.JsonDataFormat"),
@YamlProperty(name = "jsonApi", type = "object:org.apache.camel.model.dataformat.JsonApiDataFormat"),
@YamlProperty(name = "lzf", type = "object:org.apache.camel.model.dataformat.LZFDataFormat"),
@YamlProperty(name = "mimeMultipart", type = "object:org.apache.camel.model.dataformat.MimeMultipartDataFormat"),
@YamlProperty(name = "parquetAvro", type = "object:org.apache.camel.model.dataformat.ParquetAvroDataFormat"),
@YamlProperty(name = "pgp", type = "object:org.apache.camel.model.dataformat.PGPDataFormat"),
@YamlProperty(name = "protobuf", type = "object:org.apache.camel.model.dataformat.ProtobufDataFormat"),
@YamlProperty(name = "rss", type = "object:org.apache.camel.model.dataformat.RssDataFormat"),
@YamlProperty(name = "smooks", type = "object:org.apache.camel.model.dataformat.SmooksDataFormat"),
@YamlProperty(name = "soap", type = "object:org.apache.camel.model.dataformat.SoapDataFormat"),
@YamlProperty(name = "swiftMt", type = "object:org.apache.camel.model.dataformat.SwiftMtDataFormat"),
@YamlProperty(name = "swiftMx", type = "object:org.apache.camel.model.dataformat.SwiftMxDataFormat"),
@YamlProperty(name = "syslog", type = "object:org.apache.camel.model.dataformat.SyslogDataFormat"),
@YamlProperty(name = "tarFile", type = "object:org.apache.camel.model.dataformat.TarFileDataFormat"),
@YamlProperty(name = "thrift", type = "object:org.apache.camel.model.dataformat.ThriftDataFormat"),
@YamlProperty(name = "univocityCsv", type = "object:org.apache.camel.model.dataformat.UniVocityCsvDataFormat"),
@YamlProperty(name = "univocityFixed", type = "object:org.apache.camel.model.dataformat.UniVocityFixedDataFormat"),
@YamlProperty(name = "univocityTsv", type = "object:org.apache.camel.model.dataformat.UniVocityTsvDataFormat"),
@YamlProperty(name = "xmlSecurity", type = "object:org.apache.camel.model.dataformat.XMLSecurityDataFormat"),
@YamlProperty(name = "yaml", type = "object:org.apache.camel.model.dataformat.YAMLDataFormat"),
@YamlProperty(name = "zipDeflater", type = "object:org.apache.camel.model.dataformat.ZipDeflaterDataFormat"),
@YamlProperty(name = "zipFile", type = "object:org.apache.camel.model.dataformat.ZipFileDataFormat")
}
)
public static | DataFormatTransformerDefinitionDeserializer |
java | apache__hadoop | hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/MetricsCollector.java | {
"start": 1070,
"end": 1498
} | interface ____ {
/**
* Add a metrics record
* @param name of the record
* @return a {@link MetricsRecordBuilder} for the record {@code name}
*/
public MetricsRecordBuilder addRecord(String name);
/**
* Add a metrics record
* @param info of the record
* @return a {@link MetricsRecordBuilder} for metrics {@code info}
*/
public MetricsRecordBuilder addRecord(MetricsInfo info);
}
| MetricsCollector |
java | quarkusio__quarkus | extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/devmode/HttpRemoteDevClient.java | {
"start": 3003,
"end": 15028
} | class ____ implements Closeable, Runnable {
private String sessionId = null;
private int currentSessionCounter = 1;
private final RemoteDevState initialState;
private final Function<Set<String>, Map<String, byte[]>> initialConnectFunction;
private final Supplier<SyncResult> changeRequestFunction;
private volatile boolean closed;
private final Thread httpThread;
private final String url;
private final URL devUrl;
private final URL probeUrl;
int errorCount;
private Session(RemoteDevState initialState,
Function<Set<String>, Map<String, byte[]>> initialConnectFunction, Supplier<SyncResult> changeRequestFunction)
throws MalformedURLException {
this.initialState = initialState;
this.initialConnectFunction = initialConnectFunction;
this.changeRequestFunction = changeRequestFunction;
devUrl = new URL(HttpRemoteDevClient.this.url + RemoteSyncHandler.DEV);
probeUrl = new URL(HttpRemoteDevClient.this.url + RemoteSyncHandler.PROBE);
url = HttpRemoteDevClient.this.url;
httpThread = new Thread(this, "Remote dev client thread");
httpThread.start();
}
private void sendData(Map.Entry<String, byte[]> entry, String session) throws IOException {
HttpURLConnection connection;
log.info("Sending " + entry.getKey());
connection = (HttpURLConnection) new URL(url + "/" + entry.getKey()).openConnection();
connection.setRequestMethod("PUT");
connection.setDoOutput(true);
connection.setRequestProperty(HttpHeaders.ACCEPT.toString(), DEFAULT_ACCEPT);
connection.addRequestProperty(HttpHeaders.CONTENT_TYPE.toString(), RemoteSyncHandler.APPLICATION_QUARKUS);
connection.addRequestProperty(RemoteSyncHandler.QUARKUS_SESSION_COUNT, Integer.toString(currentSessionCounter));
connection.addRequestProperty(RemoteSyncHandler.QUARKUS_PASSWORD,
sha256(sha256(entry.getValue()) + session + currentSessionCounter + password));
currentSessionCounter++;
connection.addRequestProperty(RemoteSyncHandler.QUARKUS_SESSION, session);
connection.getOutputStream().write(entry.getValue());
connection.getOutputStream().close();
IoUtil.readBytes(connection.getInputStream());
}
private String doConnect(RemoteDevState initialState, Function<Set<String>, Map<String, byte[]>> initialConnectFunction)
throws IOException {
currentSessionCounter = 1;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try (ObjectOutputStream out = new ObjectOutputStream(baos)) {
out.writeObject(initialState);
}
byte[] initialData = baos.toByteArray();
String dataHash = sha256(initialData);
HttpURLConnection connection = (HttpURLConnection) new URL(url + RemoteSyncHandler.CONNECT)
.openConnection();
connection.setRequestProperty(HttpHeaders.ACCEPT.toString(), DEFAULT_ACCEPT);
connection.addRequestProperty(HttpHeaders.CONTENT_TYPE.toString(), RemoteSyncHandler.APPLICATION_QUARKUS);
//for the connection we use the hash of the password and the contents
//this can be replayed, but only with the same contents, and this does not affect the server
//state anyway
//subsequent requests need to use the randomly generated session ID which prevents replay
//when actually updating the server
connection.addRequestProperty(RemoteSyncHandler.QUARKUS_PASSWORD, sha256(dataHash + password));
connection.setDoOutput(true);
connection.getOutputStream().write(initialData);
connection.getOutputStream().close();
String session = connection.getHeaderField(RemoteSyncHandler.QUARKUS_SESSION);
String error = connection.getHeaderField(RemoteSyncHandler.QUARKUS_ERROR);
if (error != null) {
throw createIOException("Server did not start a remote dev session: " + error);
}
if (session == null) {
throw createIOException(
"Server did not start a remote dev session. Make sure the environment variable 'QUARKUS_LAUNCH_DEVMODE' is set to 'true' when launching the server");
}
String result = new String(IoUtil.readBytes(connection.getInputStream()), StandardCharsets.UTF_8);
Set<String> changed = new HashSet<>();
changed.addAll(Arrays.asList(result.split(";")));
Map<String, byte[]> data = new LinkedHashMap<>(initialConnectFunction.apply(changed));
//this file needs to be sent last
//if it is modified it will trigger a reload
//and we need the rest of the app to be present
byte[] lastFile = data.remove(QuarkusEntryPoint.LIB_DEPLOYMENT_APPMODEL_DAT);
if (lastFile != null) {
data.put(QuarkusEntryPoint.LIB_DEPLOYMENT_APPMODEL_DAT, lastFile);
}
for (Map.Entry<String, byte[]> entry : data.entrySet()) {
sendData(entry, session);
}
if (lastFile != null) {
//a bit of a hack, but if we sent this the app is going to restart
//if we attempt to connect too soon it won't be ready
session = waitForRestart(initialState, initialConnectFunction);
} else {
log.info("Connected to remote server");
}
return session;
}
private IOException createIOException(String message) {
IOException result = new IOException(message);
result.setStackTrace(new StackTraceElement[] {});
return result;
}
@Override
public void close() throws IOException {
closed = true;
httpThread.interrupt();
}
@Override
public void run() {
Throwable problem = null;
while (!closed) {
HttpURLConnection connection = null;
try {
if (sessionId == null) {
sessionId = doConnect(initialState, initialConnectFunction);
}
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try (ObjectOutputStream out = new ObjectOutputStream(baos)) {
out.writeObject(problem);
}
//long polling request
//we always send the current problem state
connection = (HttpURLConnection) devUrl.openConnection();
connection.setRequestProperty(HttpHeaders.ACCEPT.toString(), DEFAULT_ACCEPT);
connection.setRequestMethod("POST");
connection.addRequestProperty(HttpHeaders.CONTENT_TYPE.toString(), RemoteSyncHandler.APPLICATION_QUARKUS);
connection.addRequestProperty(RemoteSyncHandler.QUARKUS_SESSION_COUNT,
Integer.toString(currentSessionCounter));
connection.addRequestProperty(RemoteSyncHandler.QUARKUS_PASSWORD,
sha256(sha256(baos.toByteArray()) + sessionId + currentSessionCounter + password));
currentSessionCounter++;
connection.addRequestProperty(RemoteSyncHandler.QUARKUS_SESSION, sessionId);
connection.setDoOutput(true);
connection.getOutputStream().write(baos.toByteArray());
IoUtil.readBytes(connection.getInputStream());
int status = connection.getResponseCode();
if (status == 200) {
SyncResult sync = changeRequestFunction.get();
problem = sync.getProblem();
//if there have been any changes send the new files
for (Map.Entry<String, byte[]> entry : sync.getChangedFiles().entrySet()) {
sendData(entry, sessionId);
}
for (String file : sync.getRemovedFiles()) {
if (file.endsWith("META-INF/MANIFEST.MF") || file.contains("META-INF/maven")
|| !file.contains("/")) {
//we have some filters, for files that we don't want to delete
continue;
}
log.info("deleting " + file);
connection = (HttpURLConnection) new URL(url + "/" + file).openConnection();
connection.setRequestProperty(HttpHeaders.ACCEPT.toString(), DEFAULT_ACCEPT);
connection.setRequestMethod("DELETE");
connection.addRequestProperty(HttpHeaders.CONTENT_TYPE.toString(),
RemoteSyncHandler.APPLICATION_QUARKUS);
connection.addRequestProperty(RemoteSyncHandler.QUARKUS_SESSION_COUNT,
Integer.toString(currentSessionCounter));
//for delete requests we add the path to the password hash
connection.addRequestProperty(RemoteSyncHandler.QUARKUS_PASSWORD,
sha256(sha256("/" + file) + sessionId + currentSessionCounter + password));
currentSessionCounter++;
connection.addRequestProperty(RemoteSyncHandler.QUARKUS_SESSION, sessionId);
connection.getOutputStream().close();
IoUtil.readBytes(connection.getInputStream());
}
} else if (status == 203) {
//need a new session
sessionId = doConnect(initialState, initialConnectFunction);
}
errorCount = 0;
} catch (Throwable e) {
errorCount++;
log.error("Remote dev request failed", e);
if (errorCount == retryMaxAttempts) {
log.errorf("Connection failed after %d retries, exiting", errorCount);
return;
}
try {
Thread.sleep(retryIntervalMillis);
} catch (InterruptedException ex) {
}
}
}
}
private String waitForRestart(RemoteDevState initialState,
Function<Set<String>, Map<String, byte[]>> initialConnectFunction) {
long timeout = System.currentTimeMillis() + reconnectTimeoutMillis;
try {
Thread.sleep(500);
} catch (InterruptedException e) {
}
while (System.currentTimeMillis() < timeout) {
try {
HttpURLConnection connection = (HttpURLConnection) probeUrl.openConnection();
connection.setRequestProperty(HttpHeaders.ACCEPT.toString(), DEFAULT_ACCEPT);
connection.setRequestMethod("POST");
connection.addRequestProperty(HttpHeaders.CONTENT_TYPE.toString(), RemoteSyncHandler.APPLICATION_QUARKUS);
IoUtil.readBytes(connection.getInputStream());
return doConnect(initialState, initialConnectFunction);
} catch (IOException e) {
}
}
throw new RuntimeException("Could not connect to remote side after restart");
}
}
}
| Session |
java | quarkusio__quarkus | independent-projects/tools/registry-client/src/main/java/io/quarkus/registry/client/RegistryNonPlatformExtensionsResolver.java | {
"start": 154,
"end": 767
} | interface ____ {
/**
* Returns a catalog of extensions that are compatible with a given Quarkus version
* or null, in case the registry does not include any extension that is compatible
* with the given Quarkus version.
*
* @param quarkusVersion Quarkus version
* @return catalog of extensions compatible with a given Quarkus version or null
* @throws RegistryResolutionException in case of a failure
*/
ExtensionCatalog.Mutable resolveNonPlatformExtensions(String quarkusVersion)
throws RegistryResolutionException;
}
| RegistryNonPlatformExtensionsResolver |
java | alibaba__fastjson | src/test/java/com/alibaba/json/bvt/stream/JSONWriterTest_3.java | {
"start": 234,
"end": 768
} | class ____ extends TestCase {
public void test_writer() throws Exception {
StringWriter out = new StringWriter();
JSONWriter writer = new JSONWriter(out);
writer.config(SerializerFeature.UseSingleQuotes, true);
writer.startObject();
writer.startObject();
writer.endObject();
writer.startObject();
writer.endObject();
writer.endObject();
writer.close();
Assert.assertEquals("{{}:{}}", out.toString());
}
}
| JSONWriterTest_3 |
java | apache__flink | flink-core-api/src/main/java/org/apache/flink/api/java/tuple/builder/Tuple5Builder.java | {
"start": 1267,
"end": 1490
} | class ____ {@link Tuple5}.
*
* @param <T0> The type of field 0
* @param <T1> The type of field 1
* @param <T2> The type of field 2
* @param <T3> The type of field 3
* @param <T4> The type of field 4
*/
@Public
public | for |
java | spring-projects__spring-security | config/src/test/java/org/springframework/security/config/annotation/web/configurers/AuthorizeHttpRequestsConfigurerTests.java | {
"start": 53268,
"end": 53667
} | class ____ {
@Bean
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
// @formatter:off
return http
.httpBasic(withDefaults())
.authorizeHttpRequests((authorize) -> authorize
.anyRequest().hasAnyAuthority("ROLE_USER", "ROLE_ADMIN")
)
.build();
// @formatter:on
}
}
@Configuration
@EnableWebSecurity
static | RoleUserOrRoleAdminAuthorityConfig |
java | quarkusio__quarkus | core/runtime/src/main/java/io/quarkus/runtime/graal/DisableLoggingFeature.java | {
"start": 258,
"end": 1695
} | class ____ implements Feature {
/**
* Category to configure to WARNING
*/
private static final String[] WARN_CATEGORIES = {
"org.jboss.threads" };
/**
* Category to configure to ERROR
*/
private static final String[] ERROR_CATEGORIES = {
"io.netty.resolver.dns.DnsServerAddressStreamProviders"
};
private final Map<String, Level> categoryMap = new HashMap<>(WARN_CATEGORIES.length + ERROR_CATEGORIES.length);
@Override
public void beforeAnalysis(BeforeAnalysisAccess access) {
for (String category : WARN_CATEGORIES) {
Logger logger = Logger.getLogger(category);
categoryMap.put(category, logger.getLevel());
logger.setLevel(Level.WARNING);
}
for (String category : ERROR_CATEGORIES) {
Logger logger = Logger.getLogger(category);
categoryMap.put(category, logger.getLevel());
logger.setLevel(Level.SEVERE);
}
}
@Override
public void afterAnalysis(AfterAnalysisAccess access) {
for (Map.Entry<String, Level> entry : categoryMap.entrySet()) {
Logger logger = Logger.getLogger(entry.getKey());
logger.setLevel(entry.getValue());
}
categoryMap.clear();
}
@Override
public String getDescription() {
return "Adapts logging during the analysis phase";
}
}
| DisableLoggingFeature |
java | apache__commons-lang | src/test/java/org/apache/commons/lang3/CharEncodingTest.java | {
"start": 1277,
"end": 1509
} | class ____ extends AbstractLangTest {
private void assertSupportedEncoding(final String name) {
assertTrue(CharEncoding.isSupported(name), "Encoding should be supported: " + name);
}
/**
* The | CharEncodingTest |
java | google__guice | core/src/com/google/inject/matcher/Matchers.java | {
"start": 9859,
"end": 10999
} | class ____ extends AbstractMatcher<Class> implements Serializable {
private final String targetPackageName;
public InSubpackage(String targetPackageName) {
this.targetPackageName = targetPackageName;
}
@Override
public boolean matches(Class c) {
String classPackageName = c.getPackage().getName();
return classPackageName.equals(targetPackageName)
|| classPackageName.startsWith(targetPackageName + ".");
}
@Override
public boolean equals(Object other) {
return other instanceof InSubpackage
&& ((InSubpackage) other).targetPackageName.equals(targetPackageName);
}
@Override
public int hashCode() {
return 37 * targetPackageName.hashCode();
}
@Override
public String toString() {
return "inSubpackage(" + targetPackageName + ")";
}
private static final long serialVersionUID = 0;
}
/** Returns a matcher which matches methods with matching return types. */
public static Matcher<Method> returns(final Matcher<? super Class<?>> returnType) {
return new Returns(returnType);
}
private static | InSubpackage |
java | apache__flink | flink-runtime/src/test/java/org/apache/flink/runtime/checkpoint/CheckpointCoordinatorTest.java | {
"start": 209229,
"end": 209535
} | class ____ extends CheckpointIDCounterWithOwner {
@Override
public long getAndIncrement() throws Exception {
checkNotNull(owner);
owner.stopCheckpointScheduler();
return super.getAndIncrement();
}
}
private static | StoppingCheckpointIDCounter |
java | bumptech__glide | library/src/main/java/com/bumptech/glide/request/transition/ViewPropertyAnimationFactory.java | {
"start": 257,
"end": 1197
} | class ____<R> implements TransitionFactory<R> {
private final ViewPropertyTransition.Animator animator;
private ViewPropertyTransition<R> animation;
public ViewPropertyAnimationFactory(ViewPropertyTransition.Animator animator) {
this.animator = animator;
}
/**
* Returns a new {@link Transition} for the given arguments. If isMemoryCache is {@code true} or
* isFirstImage is {@code false}, returns a {@link NoTransition} and otherwise returns a new
* {@link ViewPropertyTransition} for the {@link ViewPropertyTransition.Animator} provided in the
* constructor.
*/
@Override
public Transition<R> build(DataSource dataSource, boolean isFirstResource) {
if (dataSource == DataSource.MEMORY_CACHE || !isFirstResource) {
return NoTransition.get();
}
if (animation == null) {
animation = new ViewPropertyTransition<>(animator);
}
return animation;
}
}
| ViewPropertyAnimationFactory |
java | alibaba__fastjson | src/test/java/com/alibaba/json/bvt/bug/Bug_for_leupom.java | {
"start": 517,
"end": 728
} | class ____ extends Model {
private Integer id;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
}
}
| Person |
java | quarkusio__quarkus | integration-tests/hibernate-search-orm-elasticsearch/src/main/java/io/quarkus/it/hibernate/search/orm/elasticsearch/layout/LayoutEntity.java | {
"start": 551,
"end": 1193
} | class ____ {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "personSeq")
private Long id;
@FullTextField(analyzer = "standard")
@KeywordField(name = "name_sort", normalizer = "lowercase", sortable = Sortable.YES)
private String name;
public LayoutEntity() {
}
public LayoutEntity(String name) {
this.name = name;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
| LayoutEntity |
java | reactor__reactor-core | reactor-core/src/test/java/reactor/core/publisher/FluxSampleFirstTest.java | {
"start": 1072,
"end": 7641
} | class ____ {
@Test
public void normal() {
AssertSubscriber<Integer> ts = AssertSubscriber.create();
Sinks.Many<Integer> sp1 = Sinks.unsafe().many().multicast().directBestEffort();
Sinks.Many<Integer> sp2 = Sinks.unsafe().many().multicast().directBestEffort();
Sinks.Many<Integer> sp3 = Sinks.unsafe().many().multicast().directBestEffort();
sp1.asFlux()
.sampleFirst(v -> v == 1 ? sp2.asFlux() : sp3.asFlux())
.subscribe(ts);
sp1.emitNext(1, FAIL_FAST);
ts.assertValues(1)
.assertNoError()
.assertNotComplete();
sp1.emitNext(2, FAIL_FAST);
ts.assertValues(1)
.assertNoError()
.assertNotComplete();
sp2.emitNext(1, FAIL_FAST);
ts.assertValues(1)
.assertNoError()
.assertNotComplete();
sp1.emitNext(3, FAIL_FAST);
ts.assertValues(1, 3)
.assertNoError()
.assertNotComplete();
sp1.emitComplete(FAIL_FAST);
ts.assertValues(1, 3)
.assertNoError()
.assertComplete();
assertThat(sp1.currentSubscriberCount()).as("sp1 has subscriber").isZero();
assertThat(sp2.currentSubscriberCount()).as("sp2 has subscriber").isZero();
assertThat(sp3.currentSubscriberCount()).as("sp3 has subscriber").isZero();
}
@Test
public void mainError() {
AssertSubscriber<Integer> ts = AssertSubscriber.create();
Sinks.Many<Integer> sp1 = Sinks.unsafe().many().multicast().directBestEffort();
Sinks.Many<Integer> sp2 = Sinks.unsafe().many().multicast().directBestEffort();
Sinks.Many<Integer> sp3 = Sinks.unsafe().many().multicast().directBestEffort();
sp1.asFlux()
.sampleFirst(v -> v == 1 ? sp2.asFlux() : sp3.asFlux())
.subscribe(ts);
sp1.emitNext(1, FAIL_FAST);
sp1.emitError(new RuntimeException("forced failure"), FAIL_FAST);
ts.assertValues(1)
.assertError(RuntimeException.class)
.assertErrorMessage("forced failure")
.assertNotComplete();
assertThat(sp1.currentSubscriberCount()).as("sp1 has subscriber").isZero();
assertThat(sp2.currentSubscriberCount()).as("sp2 has subscriber").isZero();
assertThat(sp3.currentSubscriberCount()).as("sp3 has subscriber").isZero();
}
@Test
public void throttlerError() {
AssertSubscriber<Integer> ts = AssertSubscriber.create();
Sinks.Many<Integer> sp1 = Sinks.unsafe().many().multicast().directBestEffort();
Sinks.Many<Integer> sp2 = Sinks.unsafe().many().multicast().directBestEffort();
Sinks.Many<Integer> sp3 = Sinks.unsafe().many().multicast().directBestEffort();
sp1.asFlux()
.sampleFirst(v -> v == 1 ? sp2.asFlux() : sp3.asFlux())
.subscribe(ts);
sp1.emitNext(1, FAIL_FAST);
sp2.emitError(new RuntimeException("forced failure"), FAIL_FAST);
ts.assertValues(1)
.assertError(RuntimeException.class)
.assertErrorMessage("forced failure")
.assertNotComplete();
assertThat(sp1.currentSubscriberCount()).as("sp1 has subscriber").isZero();
assertThat(sp2.currentSubscriberCount()).as("sp2 has subscriber").isZero();
assertThat(sp3.currentSubscriberCount()).as("sp3 has subscriber").isZero();
}
@Test
public void throttlerThrows() {
AssertSubscriber<Integer> ts = AssertSubscriber.create();
Sinks.Many<Integer> sp1 = Sinks.unsafe().many().multicast().directBestEffort();
sp1.asFlux()
.sampleFirst(v -> {
throw new RuntimeException("forced failure");
})
.subscribe(ts);
sp1.emitNext(1, FAIL_FAST);
ts.assertValues(1)
.assertError(RuntimeException.class)
.assertErrorMessage("forced failure")
.assertNotComplete();
assertThat(sp1.currentSubscriberCount()).as("sp1 has subscriber").isZero();
}
@Test
public void throttlerReturnsNull() {
AssertSubscriber<Integer> ts = AssertSubscriber.create();
Sinks.Many<Integer> sp1 = Sinks.unsafe().many().multicast().directBestEffort();
sp1.asFlux()
.sampleFirst(v -> null)
.subscribe(ts);
sp1.emitNext(1, FAIL_FAST);
ts.assertValues(1)
.assertError(NullPointerException.class)
.assertNotComplete();
assertThat(sp1.currentSubscriberCount()).as("sp1 has subscriber").isZero();
}
Flux<Integer> scenario_sampleFirstTime(){
return Flux.range(1, 10)
.delayElements(Duration.ofMillis(200))
.sampleFirst(Duration.ofSeconds(1));
}
@Test
public void sampleFirstTime(){
StepVerifier.withVirtualTime(this::scenario_sampleFirstTime)
.thenAwait(Duration.ofSeconds(10))
.expectNext(1, 6)
.verifyComplete();
}
@Test
public void scanOperator(){
FluxSampleFirst<Integer, Integer> test = new FluxSampleFirst<>(Flux.just(1), i -> Flux.just(i));
assertThat(test.scan(Scannable.Attr.RUN_STYLE)).isSameAs(Scannable.Attr.RunStyle.SYNC);
}
@Test
public void scanMainSubscriber() {
CoreSubscriber<Integer> actual = new LambdaSubscriber<>(null, e -> {}, null, null);
FluxSampleFirst.SampleFirstMain<Integer, Integer> test =
new FluxSampleFirst.SampleFirstMain<>(actual, i -> Flux.just(i));
Subscription parent = Operators.emptySubscription();
test.onSubscribe(parent);
assertThat(test.scan(Scannable.Attr.PARENT)).isSameAs(parent);
assertThat(test.scan(Scannable.Attr.ACTUAL)).isSameAs(actual);
assertThat(test.scan(Scannable.Attr.RUN_STYLE)).isSameAs(Scannable.Attr.RunStyle.SYNC);
test.requested = 35;
assertThat(test.scan(Scannable.Attr.REQUESTED_FROM_DOWNSTREAM)).isEqualTo(35L);
test.error = new IllegalStateException("boom");
assertThat(test.scan(Scannable.Attr.ERROR)).hasMessage("boom");
assertThat(test.scan(Scannable.Attr.CANCELLED)).isFalse();
test.cancel();
assertThat(test.scan(Scannable.Attr.CANCELLED)).isTrue();
}
@Test
public void scanOtherSubscriber() {
CoreSubscriber<Integer> actual = new LambdaSubscriber<>(null, e -> {}, null, null);
FluxSampleFirst.SampleFirstMain<Integer, Integer> main =
new FluxSampleFirst.SampleFirstMain<>(actual, i -> Flux.just(i));
FluxSampleFirst.SampleFirstOther<Integer> test = new FluxSampleFirst.SampleFirstOther<>(main);
assertThat(test.scan(Scannable.Attr.PARENT)).isSameAs(main.other);
assertThat(test.scan(Scannable.Attr.ACTUAL)).isSameAs(main);
assertThat(test.scan(Scannable.Attr.RUN_STYLE)).isSameAs(Scannable.Attr.RunStyle.SYNC);
test.request(35);
assertThat(test.scan(Scannable.Attr.REQUESTED_FROM_DOWNSTREAM)).isEqualTo(35);
assertThat(test.scan(Scannable.Attr.CANCELLED)).isFalse();
test.cancel();
assertThat(test.scan(Scannable.Attr.CANCELLED)).isTrue();
}
}
| FluxSampleFirstTest |
java | apache__flink | flink-libraries/flink-state-processing-api/src/test/java/org/apache/flink/state/api/SavepointWindowReaderITCase.java | {
"start": 19916,
"end": 20166
} | class ____ implements ReduceFunction<Long> {
private static final long serialVersionUID = 1L;
@Override
public Long reduce(Long value1, Long value2) throws Exception {
return value1 + value2;
}
}
}
| LongSum |
java | spring-projects__spring-framework | spring-tx/src/test/java/org/springframework/transaction/annotation/EnableTransactionManagementTests.java | {
"start": 18665,
"end": 18782
} | class ____ {
@Bean
Object someBean() {
return new Object();
}
}
@Configuration
static | ParentEnableTxConfig |
java | mybatis__mybatis-3 | src/main/java/org/apache/ibatis/io/ResolverUtil.java | {
"start": 3301,
"end": 3458
} | class ____ assignable to the provided class. Note that this test will match the
* parent type itself if it is presented for matching.
*/
public static | is |
java | apache__camel | components/camel-leveldb/src/test/java/org/apache/camel/component/leveldb/LevelDBTestSupport.java | {
"start": 3299,
"end": 4014
} | class ____ implements AggregationStrategy {
@Override
public Exchange aggregate(Exchange oldExchange, Exchange newExchange) {
if (oldExchange == null) {
return newExchange;
}
try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) {
outputStream.write(oldExchange.getIn().getBody(byte[].class));
outputStream.write(newExchange.getIn().getBody(byte[].class));
oldExchange.getIn().setBody(outputStream.toByteArray());
} catch (IOException e) {
//ignore
}
return oldExchange;
}
}
public static | ByteAggregationStrategy |
java | apache__spark | sql/catalyst/src/main/java/org/apache/spark/sql/connector/read/SupportsPushDownTopN.java | {
"start": 1278,
"end": 1685
} | interface ____ extends ScanBuilder {
/**
* Pushes down top N to the data source.
*/
boolean pushTopN(SortOrder[] orders, int limit);
/**
* Whether the top N is partially pushed or not. If it returns true, then Spark will do top N
* again. This method will only be called when {@link #pushTopN} returns true.
*/
default boolean isPartiallyPushed() { return true; }
}
| SupportsPushDownTopN |
java | hibernate__hibernate-orm | hibernate-core/src/main/java/org/hibernate/query/criteria/JpaJoin.java | {
"start": 692,
"end": 1263
} | interface ____<L, R> extends JpaFrom<L,R>, Join<L,R> {
@Override
@Nullable PersistentAttribute<? super L, ?> getAttribute();
JpaJoin<L, R> on(@Nullable JpaExpression<Boolean> restriction);
@Override
JpaJoin<L, R> on(@Nullable Expression<Boolean> restriction);
JpaJoin<L, R> on(JpaPredicate @Nullable... restrictions);
@Override
JpaJoin<L, R> on(Predicate @Nullable... restrictions);
@Override
<S extends R> JpaTreatedJoin<L,R,S> treatAs(Class<S> treatAsType);
@Override
<S extends R> JpaTreatedJoin<L,R,S> treatAs(EntityDomainType<S> treatAsType);
}
| JpaJoin |
java | hibernate__hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/inheritance/repeatedtable/RepeatedSubclassTableTest.java | {
"start": 3816,
"end": 4553
} | class ____ extends DataType {
private String description;
private List<Prop> properties;
protected ObjectType() {
}
public ObjectType(Integer id, String name, String description) {
super( id, name );
this.description = description;
}
@Column(name = "descr")
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
@OneToMany(mappedBy = "objectType", cascade = ALL, orphanRemoval = true)
public List<Prop> getProperties() {
return properties;
}
public void setProperties(List<Prop> properties) {
this.properties = properties;
}
}
@Entity(name = "Prop")
@Table(name = "PROP")
public static | ObjectType |
java | elastic__elasticsearch | server/src/test/java/org/elasticsearch/index/store/ByteSizeCachingDirectoryTests.java | {
"start": 982,
"end": 5038
} | class ____ extends FilterDirectory {
int numFileLengthCalls;
LengthCountingDirectory(Directory in) {
super(in);
}
@Override
public long fileLength(String name) throws IOException {
numFileLengthCalls++;
return super.fileLength(name);
}
}
public void testBasics() throws IOException {
try (Directory dir = newDirectory()) {
try (IndexOutput out = dir.createOutput("quux", IOContext.DEFAULT)) {
out.writeBytes(new byte[11], 11);
}
LengthCountingDirectory countingDir = new LengthCountingDirectory(dir);
ByteSizeCachingDirectory cachingDir = new ByteSizeCachingDirectory(countingDir, new TimeValue(0));
assertEquals(11, cachingDir.estimateSizeInBytes());
assertEquals(11, cachingDir.estimateSizeInBytes());
assertEquals(11, cachingDir.estimateDataSetSizeInBytes());
assertEquals(1, countingDir.numFileLengthCalls);
try (IndexOutput out = cachingDir.createOutput("foo", IOContext.DEFAULT)) {
out.writeBytes(new byte[5], 5);
cachingDir.estimateSizeInBytes();
// +2 because there are 3 files
assertEquals(3, countingDir.numFileLengthCalls);
// An index output is open so no caching
cachingDir.estimateSizeInBytes();
assertEquals(5, countingDir.numFileLengthCalls);
}
assertEquals(16, cachingDir.estimateSizeInBytes());
assertEquals(7, countingDir.numFileLengthCalls);
assertEquals(16, cachingDir.estimateSizeInBytes());
assertEquals(7, countingDir.numFileLengthCalls);
assertEquals(16, cachingDir.estimateDataSetSizeInBytes());
try (IndexOutput out = cachingDir.createTempOutput("bar", "baz", IOContext.DEFAULT)) {
out.writeBytes(new byte[4], 4);
cachingDir.estimateSizeInBytes();
assertEquals(10, countingDir.numFileLengthCalls);
// An index output is open so no caching
cachingDir.estimateSizeInBytes();
assertEquals(13, countingDir.numFileLengthCalls);
}
assertEquals(20, cachingDir.estimateSizeInBytes());
// +3 because there are 3 files
assertEquals(16, countingDir.numFileLengthCalls);
assertEquals(20, cachingDir.estimateSizeInBytes());
assertEquals(16, countingDir.numFileLengthCalls);
assertEquals(20, cachingDir.estimateDataSetSizeInBytes());
cachingDir.deleteFile("foo");
assertEquals(15, cachingDir.estimateSizeInBytes());
// +2 because there are 2 files now
assertEquals(18, countingDir.numFileLengthCalls);
assertEquals(15, cachingDir.estimateSizeInBytes());
assertEquals(18, countingDir.numFileLengthCalls);
assertEquals(15, cachingDir.estimateDataSetSizeInBytes());
// Close more than once
IndexOutput out = cachingDir.createOutput("foo", IOContext.DEFAULT);
try {
out.writeBytes(new byte[5], 5);
cachingDir.estimateSizeInBytes();
// +3 because there are 3 files
assertEquals(21, countingDir.numFileLengthCalls);
// An index output is open so no caching
cachingDir.estimateSizeInBytes();
assertEquals(24, countingDir.numFileLengthCalls);
} finally {
out.close();
assertEquals(20, cachingDir.estimateSizeInBytes());
assertEquals(27, countingDir.numFileLengthCalls);
}
out.close();
assertEquals(20, cachingDir.estimateSizeInBytes());
assertEquals(20, cachingDir.estimateDataSetSizeInBytes());
assertEquals(27, countingDir.numFileLengthCalls);
}
}
}
| LengthCountingDirectory |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.