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 | netty__netty | handler/src/main/java/io/netty/handler/ssl/ResumableX509ExtendedTrustManager.java | {
"start": 980,
"end": 1472
} | interface ____ {@code TrustManager} instances can implement, to be notified of resumed SSL sessions.
* <p>
* A {@link TrustManager} is called during the TLS handshake, and make decisions about whether
* the connected peer can be trusted or not. TLS include a feature where previously established sessions can
* be resumed without going through the trust verification steps.
* <p>
* When an {@link SSLSession} is resumed, any values added to it in the prior session may be lost.
* This | that |
java | google__guava | android/guava-tests/test/com/google/common/util/concurrent/ClassPathUtil.java | {
"start": 2140,
"end": 2379
} | class ____. */
static URL[] getClassPathUrls() {
return ClassPathUtil.class.getClassLoader() instanceof URLClassLoader
? ((URLClassLoader) ClassPathUtil.class.getClassLoader()).getURLs()
: parseJavaClassPath();
}
}
| path |
java | elastic__elasticsearch | x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/BooleanVectorFixedBuilder.java | {
"start": 522,
"end": 610
} | class ____ generated. Edit {@code X-VectorFixedBuilder.java.st} instead.
*/
public final | is |
java | grpc__grpc-java | api/src/main/java/io/grpc/InternalMetadata.java | {
"start": 1277,
"end": 4262
} | interface ____<T> extends Metadata.TrustedAsciiMarshaller<T> {}
/**
* Copy of StandardCharsets, which is only available on Java 1.7 and above.
*/
@Internal
public static final Charset US_ASCII = Charset.forName("US-ASCII");
/**
* An instance of base64 encoder that omits padding.
*/
@Internal
public static final BaseEncoding BASE64_ENCODING_OMIT_PADDING
= Metadata.BASE64_ENCODING_OMIT_PADDING;
@Internal
public static <T> Metadata.Key<T> keyOf(String name, TrustedAsciiMarshaller<T> marshaller) {
boolean isPseudo = name != null && !name.isEmpty() && name.charAt(0) == ':';
return Metadata.Key.of(name, isPseudo, marshaller);
}
@Internal
public static <T> Metadata.Key<T> keyOf(String name, AsciiMarshaller<T> marshaller) {
boolean isPseudo = name != null && !name.isEmpty() && name.charAt(0) == ':';
return Metadata.Key.of(name, isPseudo, marshaller);
}
@Internal
public static Metadata newMetadata(byte[]... binaryValues) {
return new Metadata(binaryValues);
}
@Internal
public static Metadata newMetadata(int usedNames, byte[]... binaryValues) {
return new Metadata(usedNames, binaryValues);
}
@Internal
public static byte[][] serialize(Metadata md) {
return md.serialize();
}
@Internal
public static int headerCount(Metadata md) {
return md.headerCount();
}
/**
* Serializes all metadata entries, leaving some values as {@link InputStream}s.
*
* <p>Produces serialized names and values interleaved. result[i*2] are names, while
* result[i*2+1] are values.
*
* <p>Names are byte arrays as described according to the {@link Metadata#serialize}
* method. Values are either byte arrays or {@link InputStream}s.
*/
@Internal
public static Object[] serializePartial(Metadata md) {
return md.serializePartial();
}
/**
* Creates a holder for a pre-parsed value read by the transport.
*
* @param marshaller The {@link Metadata.BinaryStreamMarshaller} associated with this value.
* @param value The value to store.
* @return an object holding the pre-parsed value for this key.
*/
@Internal
public static <T> Object parsedValue(BinaryStreamMarshaller<T> marshaller, T value) {
return new Metadata.LazyValue<>(marshaller, value);
}
/**
* Creates a new {@link Metadata} instance from serialized data,
* with some values pre-parsed. Metadata will mutate the passed in array.
*
* @param usedNames The number of names used.
* @param namesAndValues An array of interleaved names and values,
* with each name (at even indices) represented as a byte array,
* and each value (at odd indices) represented as either a byte
* array or an object returned by the {@link #parsedValue}
* method.
*/
@Internal
public static Metadata newMetadataWithParsedValues(int usedNames, Object[] namesAndValues) {
return new Metadata(usedNames, namesAndValues);
}
}
| TrustedAsciiMarshaller |
java | hibernate__hibernate-orm | hibernate-core/src/main/java/org/hibernate/annotations/SQLRestriction.java | {
"start": 779,
"end": 1896
} | class ____ {
* ...
* @Enumerated(STRING)
* Status status;
* ...
* }
* </pre>
* <p>
* or, at the level of an association to the entity:
* <pre>
* @OneToMany(mappedBy = "owner")
* @SQLRestriction("status <> 'DELETED'")
* List<Document> documents;
* </pre>
* <p>
* The {@link SQLJoinTableRestriction} annotation lets a restriction be
* applied to an {@linkplain jakarta.persistence.JoinTable association table}:
* <pre>
* @ManyToMany
* @JoinTable(name = "collaborations")
* @SQLRestriction("status <> 'DELETED'")
* @SQLJoinTableRestriction("status = 'ACTIVE'")
* List<Document> documents;
* </pre>
* <p>
* Note that {@code @SQLRestriction}s are always applied and cannot be
* disabled. Nor may they be parameterized. They're therefore <em>much</em>
* less flexible than {@linkplain Filter filters}.
*
* @see Filter
* @see DialectOverride.SQLRestriction
* @see SQLJoinTableRestriction
*
* @since 6.3
*
* @author Gavin King
* @author Emmanuel Bernard
*/
@Target({TYPE, METHOD, FIELD})
@Retention(RUNTIME)
public @ | Document |
java | apache__camel | core/camel-core/src/test/java/org/apache/camel/component/controlbus/ControlBusRestartRouteTest.java | {
"start": 1129,
"end": 2114
} | class ____ extends ContextTestSupport {
private final MyRoutePolicy myRoutePolicy = new MyRoutePolicy();
@Test
public void testControlBusRestart() {
assertEquals(1, myRoutePolicy.getStart());
assertEquals(0, myRoutePolicy.getStop());
assertEquals("Started", context.getRouteController().getRouteStatus("foo").name());
template.sendBody("controlbus:route?routeId=foo&action=restart&restartDelay=0", null);
assertEquals("Started", context.getRouteController().getRouteStatus("foo").name());
assertEquals(2, myRoutePolicy.getStart());
assertEquals(1, myRoutePolicy.getStop());
}
@Override
protected RouteBuilder createRouteBuilder() {
return new RouteBuilder() {
@Override
public void configure() {
from("seda:foo").routeId("foo").routePolicy(myRoutePolicy).to("mock:foo");
}
};
}
private static final | ControlBusRestartRouteTest |
java | spring-projects__spring-boot | module/spring-boot-jdbc/src/main/java/org/springframework/boot/jdbc/metadata/CommonsDbcp2DataSourcePoolMetadata.java | {
"start": 940,
"end": 1736
} | class ____ extends AbstractDataSourcePoolMetadata<BasicDataSource> {
public CommonsDbcp2DataSourcePoolMetadata(BasicDataSource dataSource) {
super(dataSource);
}
@Override
public @Nullable Integer getActive() {
return getDataSource().getNumActive();
}
@Override
public @Nullable Integer getIdle() {
return getDataSource().getNumIdle();
}
@Override
public @Nullable Integer getMax() {
return getDataSource().getMaxTotal();
}
@Override
public @Nullable Integer getMin() {
return getDataSource().getMinIdle();
}
@Override
public @Nullable String getValidationQuery() {
return getDataSource().getValidationQuery();
}
@Override
public @Nullable Boolean getDefaultAutoCommit() {
return getDataSource().getDefaultAutoCommit();
}
}
| CommonsDbcp2DataSourcePoolMetadata |
java | hibernate__hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/identifier/SimpleNaturalIdTest.java | {
"start": 594,
"end": 1715
} | class ____ {
@Test
public void test(EntityManagerFactoryScope scope) {
scope.inTransaction( entityManager -> {
Book book = new Book();
book.setId(1L);
book.setTitle("High-Performance Java Persistence");
book.setAuthor("Vlad Mihalcea");
book.setIsbn("978-9730228236");
entityManager.persist(book);
});
scope.inTransaction( entityManager -> {
//tag::naturalid-simple-load-access-example[]
Book book = entityManager
.unwrap(Session.class)
.bySimpleNaturalId(Book.class)
.load("978-9730228236");
//end::naturalid-simple-load-access-example[]
assertEquals("High-Performance Java Persistence", book.getTitle());
});
scope.inTransaction( entityManager -> {
//tag::naturalid-load-access-example[]
Book book = entityManager
.unwrap(Session.class)
.byNaturalId(Book.class)
.using("isbn", "978-9730228236")
.load();
//end::naturalid-load-access-example[]
assertEquals("High-Performance Java Persistence", book.getTitle());
});
}
//tag::naturalid-simple-basic-attribute-mapping-example[]
@Entity(name = "Book")
public static | SimpleNaturalIdTest |
java | google__error-prone | check_api/src/test/java/com/google/errorprone/util/ASTHelpersTest.java | {
"start": 22215,
"end": 22597
} | class ____ {
public List<Number> myList;
}
""");
TestScanner scanner = getUpperBoundScanner("java.lang.Number");
tests.add(scanner);
assertCompiles(scanner);
}
@Test
public void getUpperBoundUpperBoundedWildcard() {
writeFile(
"A.java",
"""
import java.lang.Number;
import java.util.List;
public | A |
java | apache__camel | dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/GistHelper.java | {
"start": 1187,
"end": 4867
} | class ____ {
private GistHelper() {
}
public static String asGistSingleUrl(String url) {
if (url.startsWith("https://gist.githubusercontent.com/")) {
url = url.substring(35);
} else if (url.startsWith("https://gist.github.com/")) {
url = url.substring(24);
}
// https://gist.github.com/davsclaus/477ddff5cdeb1ae03619aa544ce47e92
// https://gist.githubusercontent.com/davsclaus/477ddff5cdeb1ae03619aa544ce47e92/raw/cd1be96034748e42e43879a4d27ed297752b6115/mybeer.xml
url = url.replaceFirst("/", ":");
url = url.replaceFirst("/raw/", ":");
url = url.replaceFirst("/", ":");
return "gist:" + url;
}
public static void fetchGistUrls(String url, StringJoiner all) throws Exception {
doFetchGistUrls(url, null, null, null, all);
}
public static void fetchGistUrls(String url, StringJoiner routes, StringJoiner kamelets, StringJoiner properties)
throws Exception {
doFetchGistUrls(url, routes, kamelets, properties, null);
}
private static void doFetchGistUrls(
String url, StringJoiner routes, StringJoiner kamelets, StringJoiner properties,
StringJoiner all)
throws Exception {
// a gist can have one or more files
// https://gist.github.com/davsclaus/477ddff5cdeb1ae03619aa544ce47e92
// strip https://gist.github.com/
url = url.substring(24);
String[] parts = url.split("/");
if (parts.length < 2) {
return;
}
String gid = parts[1];
url = "https://api.github.com/gists/" + gid;
resolveGistAsRawFiles(url, routes, kamelets, properties, all);
}
private static void resolveGistAsRawFiles(
String url, StringJoiner routes, StringJoiner kamelets, StringJoiner properties, StringJoiner all)
throws Exception {
// use JDK http client to call github api
HttpClient hc = HttpClient.newHttpClient();
HttpResponse<String> res = hc.send(HttpRequest.newBuilder(new URI(url)).timeout(Duration.ofSeconds(20)).build(),
HttpResponse.BodyHandlers.ofString());
if (res.statusCode() == 200) {
ObjectMapper mapper = new ObjectMapper();
JsonNode root = mapper.readTree(res.body());
for (JsonNode c : root.get("files")) {
String name = c.get("filename").asText();
String ext = FileUtil.onlyExt(name, false);
if (kamelets != null && "kamelet.yaml".equalsIgnoreCase(ext)) {
String rawUrl = c.get("raw_url").asText();
String u = asGistSingleUrl(rawUrl);
kamelets.add(u);
} else if (properties != null && "properties".equalsIgnoreCase(ext)) {
String rawUrl = c.get("raw_url").asText();
String u = asGistSingleUrl(rawUrl);
properties.add(u);
} else if (routes != null) {
if ("java".equalsIgnoreCase(ext) || "xml".equalsIgnoreCase(ext)
|| "yaml".equalsIgnoreCase(ext) || "camel.yaml".equalsIgnoreCase(ext)) {
String rawUrl = c.get("raw_url").asText();
String u = asGistSingleUrl(rawUrl);
routes.add(u);
}
} else if (all != null) {
String rawUrl = c.get("raw_url").asText();
String u = asGistSingleUrl(rawUrl);
all.add(u);
}
}
}
}
}
| GistHelper |
java | alibaba__druid | core/src/test/java/com/alibaba/druid/bvt/bug/Bug_for_wdw1206.java | {
"start": 194,
"end": 1031
} | class ____ extends TestCase {
private ClassLoader ctxClassLoader;
private DruidDataSource dataSource;
protected void setUp() throws Exception {
ctxClassLoader = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(null);
dataSource = new DruidDataSource();
dataSource.setUrl("jdbc:mock:");
dataSource.setPoolPreparedStatements(false);
dataSource.setTestOnBorrow(true);
dataSource.setFilters("stat");
}
protected void tearDown() throws Exception {
Thread.currentThread().setContextClassLoader(ctxClassLoader);
JdbcUtils.close(dataSource);
}
public void test_nullCtxClassLoader() throws Exception {
Connection conn = dataSource.getConnection();
conn.close();
}
}
| Bug_for_wdw1206 |
java | google__error-prone | core/src/test/java/com/google/errorprone/bugpatterns/OptionalOfRedundantMethodTest.java | {
"start": 15709,
"end": 16087
} | class ____ {
void f(Optional<String> maybeString) {
maybeString.ifPresent(String::length);
}
}
""")
.doTest();
}
@Test
public void negative_orElse() {
compilationTestHelper
.addSourceLines(
"Test.java",
"""
import java.util.Optional;
| Test |
java | elastic__elasticsearch | server/src/main/java/org/elasticsearch/ingest/IngestService.java | {
"start": 34899,
"end": 35016
} | class ____ externally by the {@link org.elasticsearch.action.ingest.ReservedPipelineAction}
*/
public static | and |
java | google__dagger | javatests/dagger/hilt/processor/internal/root/RootProcessorErrorsTest.java | {
"start": 1107,
"end": 2132
} | class ____ {
@Parameters(name = "{0}")
public static ImmutableCollection<Object[]> parameters() {
return ImmutableList.copyOf(new Object[][] {{true}, {false}});
}
private final boolean disableCrossCompilationRootValidation;
public RootProcessorErrorsTest(boolean disableCrossCompilationRootValidation) {
this.disableCrossCompilationRootValidation = disableCrossCompilationRootValidation;
}
private ImmutableMap<String, String> processorOptions() {
return ImmutableMap.of(
"dagger.hilt.disableCrossCompilationRootValidation",
Boolean.toString(disableCrossCompilationRootValidation));
}
@Test
public void multipleAppRootsTest() {
Source appRoot1 =
HiltCompilerTests.javaSource(
"test.AppRoot1",
"package test;",
"",
"import android.app.Application;",
"import dagger.hilt.android.HiltAndroidApp;",
"",
"@HiltAndroidApp(Application.class)",
"public | RootProcessorErrorsTest |
java | grpc__grpc-java | core/src/main/java/io/grpc/internal/DnsNameResolver.java | {
"start": 10710,
"end": 19704
} | class ____ implements Runnable {
private final Listener2 savedListener;
Resolve(Listener2 savedListener) {
this.savedListener = checkNotNull(savedListener, "savedListener");
}
@Override
public void run() {
if (logger.isLoggable(Level.FINER)) {
logger.finer("Attempting DNS resolution of " + host);
}
InternalResolutionResult result = null;
try {
EquivalentAddressGroup proxiedAddr = detectProxy();
ResolutionResult.Builder resolutionResultBuilder = ResolutionResult.newBuilder();
if (proxiedAddr != null) {
if (logger.isLoggable(Level.FINER)) {
logger.finer("Using proxy address " + proxiedAddr);
}
resolutionResultBuilder.setAddressesOrError(
StatusOr.fromValue(Collections.singletonList(proxiedAddr)));
} else {
result = doResolve(false);
if (result.error != null) {
InternalResolutionResult finalResult = result;
syncContext.execute(() ->
savedListener.onResult2(ResolutionResult.newBuilder()
.setAddressesOrError(StatusOr.fromStatus(finalResult.error))
.build()));
return;
}
if (result.addresses != null) {
resolutionResultBuilder.setAddressesOrError(StatusOr.fromValue(result.addresses));
}
if (result.config != null) {
resolutionResultBuilder.setServiceConfig(result.config);
}
if (result.attributes != null) {
resolutionResultBuilder.setAttributes(result.attributes);
}
}
syncContext.execute(() -> {
savedListener.onResult2(resolutionResultBuilder.build());
});
} catch (IOException e) {
syncContext.execute(() ->
savedListener.onResult2(ResolutionResult.newBuilder()
.setAddressesOrError(
StatusOr.fromStatus(
Status.UNAVAILABLE.withDescription(
"Unable to resolve host " + host).withCause(e))).build()));
} finally {
final boolean succeed = result != null && result.error == null;
syncContext.execute(new Runnable() {
@Override
public void run() {
if (succeed) {
resolved = true;
if (cacheTtlNanos > 0) {
stopwatch.reset().start();
}
}
resolving = false;
}
});
}
}
}
@Nullable
static ConfigOrError parseServiceConfig(
List<String> rawTxtRecords, Random random, String localHostname) {
List<Map<String, ?>> possibleServiceConfigChoices;
try {
possibleServiceConfigChoices = parseTxtResults(rawTxtRecords);
} catch (IOException | RuntimeException e) {
return ConfigOrError.fromError(
Status.UNKNOWN.withDescription("failed to parse TXT records").withCause(e));
}
Map<String, ?> possibleServiceConfig = null;
for (Map<String, ?> possibleServiceConfigChoice : possibleServiceConfigChoices) {
try {
possibleServiceConfig =
maybeChooseServiceConfig(possibleServiceConfigChoice, random, localHostname);
} catch (RuntimeException e) {
return ConfigOrError.fromError(
Status.UNKNOWN.withDescription("failed to pick service config choice").withCause(e));
}
if (possibleServiceConfig != null) {
break;
}
}
if (possibleServiceConfig == null) {
return null;
}
return ConfigOrError.fromConfig(possibleServiceConfig);
}
private void resolve() {
if (resolving || shutdown || !cacheRefreshRequired()) {
return;
}
resolving = true;
executor.execute(new Resolve(listener));
}
private boolean cacheRefreshRequired() {
return !resolved
|| cacheTtlNanos == 0
|| (cacheTtlNanos > 0 && stopwatch.elapsed(TimeUnit.NANOSECONDS) > cacheTtlNanos);
}
@Override
public void shutdown() {
if (shutdown) {
return;
}
shutdown = true;
if (executor != null) {
executor = executorPool.returnObject(executor);
}
}
final int getPort() {
return port;
}
/**
* Parse TXT service config records as JSON.
*
* @throws IOException if one of the txt records contains improperly formatted JSON.
*/
@VisibleForTesting
static List<Map<String, ?>> parseTxtResults(List<String> txtRecords) throws IOException {
List<Map<String, ?>> possibleServiceConfigChoices = new ArrayList<>();
for (String txtRecord : txtRecords) {
if (!txtRecord.startsWith(SERVICE_CONFIG_PREFIX)) {
logger.log(Level.FINE, "Ignoring non service config {0}", new Object[]{txtRecord});
continue;
}
Object rawChoices = JsonParser.parse(txtRecord.substring(SERVICE_CONFIG_PREFIX.length()));
if (!(rawChoices instanceof List)) {
throw new ClassCastException("wrong type " + rawChoices);
}
List<?> listChoices = (List<?>) rawChoices;
possibleServiceConfigChoices.addAll(JsonUtil.checkObjectList(listChoices));
}
return possibleServiceConfigChoices;
}
@Nullable
private static final Double getPercentageFromChoice(Map<String, ?> serviceConfigChoice) {
return JsonUtil.getNumberAsDouble(serviceConfigChoice, SERVICE_CONFIG_CHOICE_PERCENTAGE_KEY);
}
@Nullable
private static final List<String> getClientLanguagesFromChoice(
Map<String, ?> serviceConfigChoice) {
return JsonUtil.getListOfStrings(
serviceConfigChoice, SERVICE_CONFIG_CHOICE_CLIENT_LANGUAGE_KEY);
}
@Nullable
private static final List<String> getHostnamesFromChoice(Map<String, ?> serviceConfigChoice) {
return JsonUtil.getListOfStrings(
serviceConfigChoice, SERVICE_CONFIG_CHOICE_CLIENT_HOSTNAME_KEY);
}
/**
* Returns value of network address cache ttl property if not Android environment. For android,
* DnsNameResolver does not cache the dns lookup result.
*/
private static long getNetworkAddressCacheTtlNanos(boolean isAndroid) {
if (isAndroid) {
// on Android, ignore dns cache.
return 0;
}
String cacheTtlPropertyValue = System.getProperty(NETWORKADDRESS_CACHE_TTL_PROPERTY);
long cacheTtl = DEFAULT_NETWORK_CACHE_TTL_SECONDS;
if (cacheTtlPropertyValue != null) {
try {
cacheTtl = Long.parseLong(cacheTtlPropertyValue);
} catch (NumberFormatException e) {
logger.log(
Level.WARNING,
"Property({0}) valid is not valid number format({1}), fall back to default({2})",
new Object[] {NETWORKADDRESS_CACHE_TTL_PROPERTY, cacheTtlPropertyValue, cacheTtl});
}
}
return cacheTtl > 0 ? TimeUnit.SECONDS.toNanos(cacheTtl) : cacheTtl;
}
/**
* Determines if a given Service Config choice applies, and if so, returns it.
*
* @see <a href="https://github.com/grpc/proposal/blob/master/A2-service-configs-in-dns.md">
* Service Config in DNS</a>
* @param choice The service config choice.
* @return The service config object or {@code null} if this choice does not apply.
*/
@Nullable
@VisibleForTesting
static Map<String, ?> maybeChooseServiceConfig(
Map<String, ?> choice, Random random, String hostname) {
for (Map.Entry<String, ?> entry : choice.entrySet()) {
Verify.verify(SERVICE_CONFIG_CHOICE_KEYS.contains(entry.getKey()), "Bad key: %s", entry);
}
List<String> clientLanguages = getClientLanguagesFromChoice(choice);
if (clientLanguages != null && !clientLanguages.isEmpty()) {
boolean javaPresent = false;
for (String lang : clientLanguages) {
if ("java".equalsIgnoreCase(lang)) {
javaPresent = true;
break;
}
}
if (!javaPresent) {
return null;
}
}
Double percentage = getPercentageFromChoice(choice);
if (percentage != null) {
int pct = percentage.intValue();
Verify.verify(pct >= 0 && pct <= 100, "Bad percentage: %s", percentage);
if (random.nextInt(100) >= pct) {
return null;
}
}
List<String> clientHostnames = getHostnamesFromChoice(choice);
if (clientHostnames != null && !clientHostnames.isEmpty()) {
boolean hostnamePresent = false;
for (String clientHostname : clientHostnames) {
if (clientHostname.equals(hostname)) {
hostnamePresent = true;
break;
}
}
if (!hostnamePresent) {
return null;
}
}
Map<String, ?> sc =
JsonUtil.getObject(choice, SERVICE_CONFIG_CHOICE_SERVICE_CONFIG_KEY);
if (sc == null) {
throw new VerifyException(String.format(
"key '%s' missing in '%s'", choice, SERVICE_CONFIG_CHOICE_SERVICE_CONFIG_KEY));
}
return sc;
}
/**
* Used as a DNS-based name resolver's internal representation of resolution result.
*/
protected static final | Resolve |
java | elastic__elasticsearch | plugins/analysis-kuromoji/src/main/java/org/elasticsearch/plugin/analysis/kuromoji/AnalysisKuromojiPlugin.java | {
"start": 1074,
"end": 2815
} | class ____ extends Plugin implements AnalysisPlugin {
@Override
public Map<String, AnalysisProvider<CharFilterFactory>> getCharFilters() {
return singletonMap("kuromoji_iteration_mark", KuromojiIterationMarkCharFilterFactory::new);
}
@Override
public Map<String, AnalysisProvider<TokenFilterFactory>> getTokenFilters() {
Map<String, AnalysisProvider<TokenFilterFactory>> extra = new HashMap<>();
extra.put("kuromoji_baseform", KuromojiBaseFormFilterFactory::new);
extra.put("kuromoji_part_of_speech", KuromojiPartOfSpeechFilterFactory::new);
extra.put("kuromoji_readingform", KuromojiReadingFormFilterFactory::new);
extra.put("kuromoji_stemmer", KuromojiKatakanaStemmerFactory::new);
extra.put("ja_stop", JapaneseStopTokenFilterFactory::new);
extra.put("kuromoji_number", KuromojiNumberFilterFactory::new);
extra.put("kuromoji_completion", KuromojiCompletionFilterFactory::new);
extra.put("hiragana_uppercase", HiraganaUppercaseFilterFactory::new);
extra.put("katakana_uppercase", KatakanaUppercaseFilterFactory::new);
return extra;
}
@Override
public Map<String, AnalysisProvider<TokenizerFactory>> getTokenizers() {
return singletonMap("kuromoji_tokenizer", KuromojiTokenizerFactory::new);
}
@Override
public Map<String, AnalysisProvider<AnalyzerProvider<? extends Analyzer>>> getAnalyzers() {
Map<String, AnalysisProvider<AnalyzerProvider<? extends Analyzer>>> extra = new HashMap<>();
extra.put("kuromoji", KuromojiAnalyzerProvider::new);
extra.put("kuromoji_completion", KuromojiCompletionAnalyzerProvider::new);
return extra;
}
}
| AnalysisKuromojiPlugin |
java | spring-projects__spring-boot | core/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/BindableRuntimeHintsRegistrarTests.java | {
"start": 15193,
"end": 15311
} | class ____ {
public List<String> getNames() {
return Collections.emptyList();
}
}
public static | WithSimpleList |
java | apache__dubbo | dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/h3/grpc/GrpcHttp3ServerTransportListener.java | {
"start": 1294,
"end": 2302
} | class ____ extends GrpcHttp2ServerTransportListener
implements Http3TransportListener {
public GrpcHttp3ServerTransportListener(H2StreamChannel h2StreamChannel, URL url, FrameworkModel frameworkModel) {
super(h2StreamChannel, url, frameworkModel);
}
@Override
protected Http2ServerChannelObserver newResponseObserver(H2StreamChannel h2StreamChannel) {
return new GrpcHttp3UnaryServerChannelObserver(getFrameworkModel(), h2StreamChannel);
}
@Override
protected Http2ServerChannelObserver newStreamResponseObserver(H2StreamChannel h2StreamChannel) {
return new GrpcHttp3ServerChannelObserver(getFrameworkModel(), h2StreamChannel);
}
@Override
protected void doOnData(Http2InputMessage message) {
if (message.isEndStream()) {
onDataCompletion(message);
return;
}
super.doOnData(message);
}
@Override
protected void initializeAltSvc(URL url) {}
}
| GrpcHttp3ServerTransportListener |
java | elastic__elasticsearch | server/src/test/java/org/elasticsearch/index/mapper/CompletionFieldMapperTests.java | {
"start": 3481,
"end": 46026
} | class ____ extends MapperTestCase {
@Override
protected Object getSampleValueForDocument() {
return "value";
}
@Override
protected Object getSampleObjectForDocument() {
return Map.of("input", "value");
}
@Override
protected void minimalMapping(XContentBuilder b) throws IOException {
b.field("type", "completion");
}
@Override
protected void metaMapping(XContentBuilder b) throws IOException {
b.field("type", "completion");
b.field("analyzer", "simple");
b.field("preserve_separators", true);
b.field("preserve_position_increments", true);
b.field("max_input_length", 50);
}
@Override
protected boolean supportsStoredFields() {
return false;
}
@Override
protected boolean supportsIgnoreMalformed() {
return false;
}
@Override
protected void registerParameters(ParameterChecker checker) throws IOException {
checker.registerConflictCheck("analyzer", b -> b.field("analyzer", "standard"));
checker.registerConflictCheck("preserve_separators", b -> b.field("preserve_separators", false));
checker.registerConflictCheck("preserve_position_increments", b -> b.field("preserve_position_increments", false));
checker.registerConflictCheck("contexts", b -> {
b.startArray("contexts");
{
b.startObject();
b.field("name", "place_type");
b.field("type", "category");
b.field("path", "cat");
b.endObject();
}
b.endArray();
});
checker.registerUpdateCheck(
b -> b.field("search_analyzer", "standard"),
m -> assertEquals("standard", m.fieldType().getTextSearchInfo().searchAnalyzer().name())
);
checker.registerUpdateCheck(b -> b.field("max_input_length", 30), m -> {
CompletionFieldMapper cfm = (CompletionFieldMapper) m;
assertEquals(30, cfm.getMaxInputLength());
});
}
@Override
protected IndexAnalyzers createIndexAnalyzers(IndexSettings indexSettings) {
return IndexAnalyzers.of(
Map.of(
"default",
new NamedAnalyzer("default", AnalyzerScope.INDEX, new StandardAnalyzer()),
"standard",
new NamedAnalyzer("standard", AnalyzerScope.INDEX, new StandardAnalyzer()),
"simple",
new NamedAnalyzer("simple", AnalyzerScope.INDEX, new SimpleAnalyzer())
)
);
}
public void testPostingsFormat() throws IOException {
final Class<?> latestLuceneCPClass = Completion101PostingsFormat.class;
MapperService mapperService = createMapperService(fieldMapping(this::minimalMapping));
CodecService codecService = new CodecService(mapperService, BigArrays.NON_RECYCLING_INSTANCE);
Codec codec = codecService.codec("default");
if (CodecService.ZSTD_STORED_FIELDS_FEATURE_FLAG) {
assertThat(codec, instanceOf(PerFieldMapperCodec.class));
assertThat(((PerFieldMapperCodec) codec).getPostingsFormatForField("field"), instanceOf(latestLuceneCPClass));
} else {
if (codec instanceof CodecService.DeduplicateFieldInfosCodec deduplicateFieldInfosCodec) {
codec = deduplicateFieldInfosCodec.delegate();
}
assertThat(codec, instanceOf(LegacyPerFieldMapperCodec.class));
assertThat(((LegacyPerFieldMapperCodec) codec).getPostingsFormatForField("field"), instanceOf(latestLuceneCPClass));
}
}
public void testDefaultConfiguration() throws IOException {
DocumentMapper defaultMapper = createDocumentMapper(fieldMapping(this::minimalMapping));
Mapper fieldMapper = defaultMapper.mappers().getMapper("field");
assertThat(fieldMapper, instanceOf(CompletionFieldMapper.class));
MappedFieldType completionFieldType = ((CompletionFieldMapper) fieldMapper).fieldType();
NamedAnalyzer indexAnalyzer = ((CompletionFieldMapper) fieldMapper).indexAnalyzers().values().iterator().next();
assertThat(indexAnalyzer.name(), equalTo("simple"));
assertThat(indexAnalyzer.analyzer(), instanceOf(CompletionAnalyzer.class));
CompletionAnalyzer analyzer = (CompletionAnalyzer) indexAnalyzer.analyzer();
assertThat(analyzer.preservePositionIncrements(), equalTo(true));
assertThat(analyzer.preserveSep(), equalTo(true));
NamedAnalyzer searchAnalyzer = completionFieldType.getTextSearchInfo().searchAnalyzer();
assertThat(searchAnalyzer.name(), equalTo("simple"));
assertThat(searchAnalyzer.analyzer(), instanceOf(CompletionAnalyzer.class));
analyzer = (CompletionAnalyzer) searchAnalyzer.analyzer();
assertThat(analyzer.preservePositionIncrements(), equalTo(true));
assertThat(analyzer.preserveSep(), equalTo(true));
}
public void testCompletionAnalyzerSettings() throws Exception {
DocumentMapper defaultMapper = createDocumentMapper(fieldMapping(b -> {
b.field("type", "completion");
b.field("analyzer", "simple");
b.field("search_analyzer", "standard");
b.field("preserve_separators", false);
b.field("preserve_position_increments", true);
}));
Mapper fieldMapper = defaultMapper.mappers().getMapper("field");
assertThat(fieldMapper, instanceOf(CompletionFieldMapper.class));
MappedFieldType completionFieldType = ((CompletionFieldMapper) fieldMapper).fieldType();
NamedAnalyzer indexAnalyzer = ((CompletionFieldMapper) fieldMapper).indexAnalyzers().values().iterator().next();
assertThat(indexAnalyzer.name(), equalTo("simple"));
assertThat(indexAnalyzer.analyzer(), instanceOf(CompletionAnalyzer.class));
CompletionAnalyzer analyzer = (CompletionAnalyzer) indexAnalyzer.analyzer();
assertThat(analyzer.preservePositionIncrements(), equalTo(true));
assertThat(analyzer.preserveSep(), equalTo(false));
NamedAnalyzer searchAnalyzer = completionFieldType.getTextSearchInfo().searchAnalyzer();
assertThat(searchAnalyzer.name(), equalTo("standard"));
assertThat(searchAnalyzer.analyzer(), instanceOf(CompletionAnalyzer.class));
analyzer = (CompletionAnalyzer) searchAnalyzer.analyzer();
assertThat(analyzer.preservePositionIncrements(), equalTo(true));
assertThat(analyzer.preserveSep(), equalTo(false));
assertEquals("""
{"field":{"type":"completion","analyzer":"simple","search_analyzer":"standard",\
"preserve_separators":false,"preserve_position_increments":true,"max_input_length":50}}""", Strings.toString(fieldMapper));
}
@SuppressWarnings("unchecked")
public void testTypeParsing() throws Exception {
DocumentMapper defaultMapper = createDocumentMapper(fieldMapping(b -> {
b.field("type", "completion");
b.field("analyzer", "simple");
b.field("search_analyzer", "standard");
b.field("preserve_separators", false);
b.field("preserve_position_increments", true);
b.field("max_input_length", 14);
}));
Mapper fieldMapper = defaultMapper.mappers().getMapper("field");
assertThat(fieldMapper, instanceOf(CompletionFieldMapper.class));
XContentBuilder builder = jsonBuilder().startObject();
fieldMapper.toXContent(builder, new ToXContent.MapParams(Map.of("include_defaults", "true"))).endObject();
builder.close();
Map<String, Object> serializedMap;
try (var parser = createParser(JsonXContent.jsonXContent, BytesReference.bytes(builder))) {
serializedMap = parser.map();
}
Map<String, Object> configMap = (Map<String, Object>) serializedMap.get("field");
assertThat(configMap.get("analyzer").toString(), is("simple"));
assertThat(configMap.get("search_analyzer").toString(), is("standard"));
assertThat(Booleans.parseBoolean(configMap.get("preserve_separators").toString()), is(false));
assertThat(Booleans.parseBoolean(configMap.get("preserve_position_increments").toString()), is(true));
assertThat(Integer.valueOf(configMap.get("max_input_length").toString()), is(14));
}
public void testParsingMinimal() throws Exception {
DocumentMapper defaultMapper = createDocumentMapper(fieldMapping(this::minimalMapping));
Mapper fieldMapper = defaultMapper.mappers().getMapper("field");
ParsedDocument parsedDocument = defaultMapper.parse(source(b -> b.field("field", "suggestion")));
List<IndexableField> fields = parsedDocument.rootDoc().getFields(fieldMapper.fullPath());
assertFieldsOfType(fields);
}
public void testParsingFailure() throws Exception {
DocumentMapper defaultMapper = createDocumentMapper(fieldMapping(this::minimalMapping));
DocumentParsingException e = expectThrows(
DocumentParsingException.class,
() -> defaultMapper.parse(source(b -> b.field("field", 1.0)))
);
assertEquals("failed to parse [field]: expected text or object, but got VALUE_NUMBER", e.getCause().getMessage());
}
public void testKeywordWithSubCompletionAndContext() throws Exception {
DocumentMapper defaultMapper = createDocumentMapper(fieldMapping(b -> {
b.field("type", "keyword");
b.startObject("fields");
{
b.startObject("subsuggest");
{
b.field("type", "completion");
b.startArray("contexts");
{
b.startObject();
b.field("name", "place_type");
b.field("type", "category");
b.field("path", "cat");
b.endObject();
}
b.endArray();
}
b.endObject();
}
b.endObject();
}));
ParsedDocument parsedDocument = defaultMapper.parse(source(b -> b.array("field", "key1", "key2", "key3")));
LuceneDocument indexableFields = parsedDocument.rootDoc();
assertThat(
indexableFields.getFields("field"),
containsInAnyOrder(keywordField("key1"), keywordField("key2"), keywordField("key3"))
);
assertThat(
indexableFields.getFields("field.subsuggest"),
containsInAnyOrder(contextSuggestField("key1"), contextSuggestField("key2"), contextSuggestField("key3"))
);
}
public void testDuplicateSuggestionsWithContexts() throws IOException {
DocumentMapper defaultMapper = createDocumentMapper(fieldMapping(b -> {
b.field("type", "completion");
b.startArray("contexts");
{
b.startObject();
b.field("name", "place");
b.field("type", "category");
b.endObject();
}
b.endArray();
}));
ParsedDocument parsedDocument = defaultMapper.parse(source(b -> {
b.startArray("field");
{
b.startObject();
{
b.array("input", "timmy", "starbucks");
b.startObject("contexts").array("place", "cafe", "food").endObject();
b.field("weight", 10);
}
b.endObject();
b.startObject();
{
b.array("input", "timmy", "starbucks");
b.startObject("contexts").array("place", "restaurant").endObject();
b.field("weight", 1);
}
b.endObject();
}
b.endArray();
}));
List<IndexableField> indexedFields = parsedDocument.rootDoc().getFields("field");
assertThat(indexedFields, hasSize(4));
assertThat(
indexedFields,
containsInAnyOrder(
contextSuggestField("timmy"),
contextSuggestField("timmy"),
contextSuggestField("starbucks"),
contextSuggestField("starbucks")
)
);
}
public void testCompletionWithContextAndSubCompletion() throws Exception {
DocumentMapper defaultMapper = createDocumentMapper(fieldMapping(b -> {
b.field("type", "completion");
b.startArray("contexts");
{
b.startObject();
b.field("name", "place_type");
b.field("type", "category");
b.field("path", "cat");
b.endObject();
}
b.endArray();
b.startObject("fields");
{
b.startObject("subsuggest");
{
b.field("type", "completion");
b.startArray("contexts");
{
b.startObject();
b.field("name", "place_type");
b.field("type", "category");
b.field("path", "cat");
b.endObject();
}
b.endArray();
}
b.endObject();
}
b.endObject();
}));
{
ParsedDocument parsedDocument = defaultMapper.parse(source(b -> {
b.startObject("field");
{
b.array("input", "timmy", "starbucks");
b.startObject("contexts").array("place_type", "cafe", "food").endObject();
b.field("weight", 3);
}
b.endObject();
}));
LuceneDocument indexableFields = parsedDocument.rootDoc();
assertThat(
indexableFields.getFields("field"),
containsInAnyOrder(contextSuggestField("timmy"), contextSuggestField("starbucks"))
);
assertThat(
indexableFields.getFields("field.subsuggest"),
containsInAnyOrder(contextSuggestField("timmy"), contextSuggestField("starbucks"))
);
// check that the indexable fields produce tokenstreams without throwing an exception
// if this breaks it is likely a problem with setting contexts
try (TokenStream ts = indexableFields.getFields("field.subsuggest").get(0).tokenStream(Lucene.WHITESPACE_ANALYZER, null)) {
ts.reset();
while (ts.incrementToken()) {
}
ts.end();
}
// unable to assert about context, covered in a REST test
}
{
ParsedDocument parsedDocument = defaultMapper.parse(source(b -> {
b.array("field", "timmy", "starbucks");
b.array("cat", "cafe", "food");
}));
LuceneDocument indexableFields = parsedDocument.rootDoc();
assertThat(
indexableFields.getFields("field"),
containsInAnyOrder(contextSuggestField("timmy"), contextSuggestField("starbucks"))
);
assertThat(
indexableFields.getFields("field.subsuggest"),
containsInAnyOrder(contextSuggestField("timmy"), contextSuggestField("starbucks"))
);
// unable to assert about context, covered in a REST test
}
}
public void testGeoHashWithSubCompletionAndStringInsert() throws Exception {
DocumentMapper defaultMapper = createDocumentMapper(fieldMapping(b -> {
b.field("type", "geo_point");
b.startObject("fields");
{
b.startObject("analyzed").field("type", "completion").endObject();
}
b.endObject();
}));
// "41.12,-71.34"
ParsedDocument parsedDocument = defaultMapper.parse(source(b -> b.field("field", "drm3btev3e86")));
LuceneDocument indexableFields = parsedDocument.rootDoc();
assertThat(indexableFields.getFields("field"), hasSize(1));
assertThat(indexableFields.getFields("field.analyzed"), containsInAnyOrder(suggestField("drm3btev3e86")));
// unable to assert about geofield content, covered in a REST test
}
public void testCompletionTypeWithSubfieldsAndStringInsert() throws Exception {
List<CheckedConsumer<XContentBuilder, IOException>> builders = new ArrayList<>();
builders.add(b -> b.startObject("analyzed1").field("type", "keyword").endObject());
builders.add(b -> b.startObject("analyzed2").field("type", "keyword").endObject());
builders.add(b -> b.startObject("subsuggest1").field("type", "completion").endObject());
builders.add(b -> b.startObject("subsuggest2").field("type", "completion").endObject());
Collections.shuffle(builders, random());
DocumentMapper defaultMapper = createDocumentMapper(fieldMapping(b -> {
b.field("type", "completion");
b.startObject("fields");
for (CheckedConsumer<XContentBuilder, IOException> builder : builders) {
builder.accept(b);
}
b.endObject();
}));
ParsedDocument parsedDocument = defaultMapper.parse(source(b -> b.field("field", "suggestion")));
LuceneDocument indexableFields = parsedDocument.rootDoc();
assertThat(indexableFields.getFields("field"), containsInAnyOrder(suggestField("suggestion")));
assertThat(indexableFields.getFields("field.subsuggest1"), containsInAnyOrder(suggestField("suggestion")));
assertThat(indexableFields.getFields("field.subsuggest2"), containsInAnyOrder(suggestField("suggestion")));
assertThat(indexableFields.getFields("field.analyzed1"), containsInAnyOrder(keywordField("suggestion")));
assertThat(indexableFields.getFields("field.analyzed2"), containsInAnyOrder(keywordField("suggestion")));
}
public void testCompletionTypeWithSubfieldsAndArrayInsert() throws Exception {
List<CheckedConsumer<XContentBuilder, IOException>> builders = new ArrayList<>();
builders.add(b -> b.startObject("analyzed1").field("type", "keyword").endObject());
builders.add(b -> b.startObject("analyzed2").field("type", "keyword").endObject());
builders.add(b -> b.startObject("subcompletion1").field("type", "completion").endObject());
builders.add(b -> b.startObject("subcompletion2").field("type", "completion").endObject());
Collections.shuffle(builders, random());
DocumentMapper defaultMapper = createDocumentMapper(fieldMapping(b -> {
b.field("type", "completion");
b.startObject("fields");
for (CheckedConsumer<XContentBuilder, IOException> builder : builders) {
builder.accept(b);
}
b.endObject();
}));
ParsedDocument parsedDocument = defaultMapper.parse(source(b -> b.array("field", "New York", "NY")));
LuceneDocument indexableFields = parsedDocument.rootDoc();
assertThat(indexableFields.getFields("field"), containsInAnyOrder(suggestField("New York"), suggestField("NY")));
assertThat(indexableFields.getFields("field.subcompletion1"), containsInAnyOrder(suggestField("New York"), suggestField("NY")));
assertThat(indexableFields.getFields("field.subcompletion2"), containsInAnyOrder(suggestField("New York"), suggestField("NY")));
assertThat(indexableFields.getFields("field.analyzed1"), containsInAnyOrder(keywordField("New York"), keywordField("NY")));
assertThat(indexableFields.getFields("field.analyzed2"), containsInAnyOrder(keywordField("New York"), keywordField("NY")));
}
public void testCompletionTypeWithSubfieldsAndObjectInsert() throws Exception {
List<CheckedConsumer<XContentBuilder, IOException>> builders = new ArrayList<>();
builders.add(b -> b.startObject("analyzed1").field("type", "keyword").endObject());
builders.add(b -> b.startObject("analyzed2").field("type", "keyword").endObject());
builders.add(b -> b.startObject("subcompletion1").field("type", "completion").endObject());
builders.add(b -> b.startObject("subcompletion2").field("type", "completion").endObject());
Collections.shuffle(builders, random());
DocumentMapper defaultMapper = createDocumentMapper(fieldMapping(b -> {
b.field("type", "completion");
b.startObject("fields");
for (CheckedConsumer<XContentBuilder, IOException> builder : builders) {
builder.accept(b);
}
b.endObject();
}));
ParsedDocument parsedDocument = defaultMapper.parse(source(b -> {
b.startObject("field");
{
b.array("input", "New York", "NY");
b.field("weight", 34);
}
b.endObject();
}));
LuceneDocument indexableFields = parsedDocument.rootDoc();
assertThat(indexableFields.getFields("field"), containsInAnyOrder(suggestField("New York"), suggestField("NY")));
assertThat(indexableFields.getFields("field.subcompletion1"), containsInAnyOrder(suggestField("New York"), suggestField("NY")));
assertThat(indexableFields.getFields("field.subcompletion2"), containsInAnyOrder(suggestField("New York"), suggestField("NY")));
assertThat(indexableFields.getFields("field.analyzed1"), containsInAnyOrder(keywordField("New York"), keywordField("NY")));
assertThat(indexableFields.getFields("field.analyzed2"), containsInAnyOrder(keywordField("New York"), keywordField("NY")));
// unable to assert about weight, covered in a REST test
}
public void testParsingMultiValued() throws Exception {
DocumentMapper defaultMapper = createDocumentMapper(fieldMapping(this::minimalMapping));
Mapper fieldMapper = defaultMapper.mappers().getMapper("field");
ParsedDocument parsedDocument = defaultMapper.parse(source(b -> b.array("field", "suggestion1", "suggestion2")));
List<IndexableField> fields = parsedDocument.rootDoc().getFields(fieldMapper.fullPath());
assertThat(fields, containsInAnyOrder(suggestField("suggestion1"), suggestField("suggestion2")));
}
public void testParsingWithWeight() throws Exception {
DocumentMapper defaultMapper = createDocumentMapper(fieldMapping(this::minimalMapping));
Mapper fieldMapper = defaultMapper.mappers().getMapper("field");
ParsedDocument parsedDocument = defaultMapper.parse(source(b -> {
b.startObject("field");
{
b.field("input", "suggestion");
b.field("weight", 2);
}
b.endObject();
}));
List<IndexableField> fields = parsedDocument.rootDoc().getFields(fieldMapper.fullPath());
assertThat(fields, containsInAnyOrder(suggestField("suggestion")));
}
public void testParsingMultiValueWithWeight() throws Exception {
DocumentMapper defaultMapper = createDocumentMapper(fieldMapping(this::minimalMapping));
Mapper fieldMapper = defaultMapper.mappers().getMapper("field");
ParsedDocument parsedDocument = defaultMapper.parse(source(b -> {
b.startObject("field");
{
b.array("input", "suggestion1", "suggestion2", "suggestion3");
b.field("weight", 2);
}
b.endObject();
}));
List<IndexableField> fields = parsedDocument.rootDoc().getFields(fieldMapper.fullPath());
assertThat(fields, containsInAnyOrder(suggestField("suggestion1"), suggestField("suggestion2"), suggestField("suggestion3")));
}
public void testParsingWithGeoFieldAlias() throws Exception {
MapperService mapperService = createMapperService(mapping(b -> {
b.startObject("completion");
{
b.field("type", "completion");
b.startObject("contexts");
{
b.field("name", "location");
b.field("type", "geo");
b.field("path", "alias");
}
b.endObject();
}
b.endObject();
b.startObject("birth-place").field("type", "geo_point").endObject();
b.startObject("alias");
{
b.field("type", "alias");
b.field("path", "birth-place");
}
b.endObject();
}));
Mapper fieldMapper = mapperService.documentMapper().mappers().getMapper("completion");
ParsedDocument parsedDocument = mapperService.documentMapper().parse(source(b -> {
b.startObject("completion");
{
b.field("input", "suggestion");
b.startObject("contexts").field("location", "37.77,-122.42").endObject();
}
b.endObject();
}));
List<IndexableField> fields = parsedDocument.rootDoc().getFields(fieldMapper.fullPath());
assertFieldsOfType(fields);
}
public void testParsingFull() throws Exception {
DocumentMapper defaultMapper = createDocumentMapper(fieldMapping(this::minimalMapping));
Mapper fieldMapper = defaultMapper.mappers().getMapper("field");
ParsedDocument parsedDocument = defaultMapper.parse(source(b -> {
b.startArray("field");
{
b.startObject().field("input", "suggestion1").field("weight", 3).endObject();
b.startObject().field("input", "suggestion2").field("weight", 4).endObject();
b.startObject().field("input", "suggestion3").field("weight", 5).endObject();
}
b.endArray();
}));
List<IndexableField> fields = parsedDocument.rootDoc().getFields(fieldMapper.fullPath());
assertThat(fields, containsInAnyOrder(suggestField("suggestion1"), suggestField("suggestion2"), suggestField("suggestion3")));
}
public void testParsingMixed() throws Exception {
DocumentMapper defaultMapper = createDocumentMapper(fieldMapping(this::minimalMapping));
Mapper fieldMapper = defaultMapper.mappers().getMapper("field");
ParsedDocument parsedDocument = defaultMapper.parse(source(b -> {
b.startArray("field");
{
b.startObject();
{
b.array("input", "suggestion1", "suggestion2");
b.field("weight", 3);
}
b.endObject();
b.startObject();
{
b.array("input", "suggestion3");
b.field("weight", 4);
}
b.endObject();
b.startObject();
{
b.array("input", "suggestion4", "suggestion5", "suggestion6");
b.field("weight", 5);
}
b.endObject();
}
b.endArray();
}));
List<IndexableField> fields = parsedDocument.rootDoc().getFields(fieldMapper.fullPath());
assertThat(
fields,
containsInAnyOrder(
suggestField("suggestion1"),
suggestField("suggestion2"),
suggestField("suggestion3"),
suggestField("suggestion4"),
suggestField("suggestion5"),
suggestField("suggestion6")
)
);
}
public void testNonContextEnabledParsingWithContexts() throws Exception {
DocumentMapper defaultMapper = createDocumentMapper(fieldMapping(this::minimalMapping));
DocumentParsingException e = expectThrows(DocumentParsingException.class, () -> defaultMapper.parse(source(b -> {
b.startObject("field");
{
b.field("input", "suggestion1");
b.startObject("contexts").field("ctx", "ctx2").endObject();
b.field("weight", 3);
}
b.endObject();
})));
assertThat(e.getMessage(), containsString("field"));
}
public void testFieldValueValidation() throws Exception {
DocumentMapper defaultMapper = createDocumentMapper(fieldMapping(this::minimalMapping));
CharsRefBuilder charsRefBuilder = new CharsRefBuilder();
charsRefBuilder.append("sugg");
charsRefBuilder.setCharAt(2, '\u001F');
{
DocumentParsingException e = expectThrows(
DocumentParsingException.class,
() -> defaultMapper.parse(source(b -> b.field("field", charsRefBuilder.get().toString())))
);
Throwable cause = e.getCause();
assertThat(cause, instanceOf(IllegalArgumentException.class));
assertThat(cause.getMessage(), containsString("[0x1f]"));
}
charsRefBuilder.setCharAt(2, '\u0000');
{
DocumentParsingException e = expectThrows(
DocumentParsingException.class,
() -> defaultMapper.parse(source(b -> b.field("field", charsRefBuilder.get().toString())))
);
Throwable cause = e.getCause();
assertThat(cause, instanceOf(IllegalArgumentException.class));
assertThat(cause.getMessage(), containsString("[0x0]"));
}
charsRefBuilder.setCharAt(2, '\u001E');
{
DocumentParsingException e = expectThrows(
DocumentParsingException.class,
() -> defaultMapper.parse(source(b -> b.field("field", charsRefBuilder.get().toString())))
);
Throwable cause = e.getCause();
assertThat(cause, instanceOf(IllegalArgumentException.class));
assertThat(cause.getMessage(), containsString("[0x1e]"));
}
// empty inputs are ignored
ParsedDocument doc = defaultMapper.parse(source(b -> b.array("field", " ", "")));
assertThat(doc.docs().size(), equalTo(1));
assertNull(doc.docs().get(0).get("field"));
assertNotNull(doc.docs().get(0).getField("_ignored"));
List<IndexableField> ignoredFields = doc.docs().get(0).getFields("_ignored");
assertTrue(ignoredFields.stream().anyMatch(field -> "field".equals(field.stringValue())));
// null inputs are ignored
ParsedDocument nullDoc = defaultMapper.parse(source(b -> b.nullField("field")));
assertThat(nullDoc.docs().size(), equalTo(1));
assertNull(nullDoc.docs().get(0).get("field"));
assertNull(nullDoc.docs().get(0).getField("_ignored"));
}
public void testPrefixQueryType() throws Exception {
DocumentMapper defaultMapper = createDocumentMapper(fieldMapping(this::minimalMapping));
Mapper fieldMapper = defaultMapper.mappers().getMapper("field");
CompletionFieldMapper completionFieldMapper = (CompletionFieldMapper) fieldMapper;
Query prefixQuery = completionFieldMapper.fieldType().prefixQuery(new BytesRef("co"));
assertThat(prefixQuery, instanceOf(PrefixCompletionQuery.class));
}
public void testFuzzyQueryType() throws Exception {
DocumentMapper defaultMapper = createDocumentMapper(fieldMapping(this::minimalMapping));
Mapper fieldMapper = defaultMapper.mappers().getMapper("field");
CompletionFieldMapper completionFieldMapper = (CompletionFieldMapper) fieldMapper;
Query prefixQuery = completionFieldMapper.fieldType()
.fuzzyQuery(
"co",
Fuzziness.fromEdits(FuzzyCompletionQuery.DEFAULT_MAX_EDITS),
FuzzyCompletionQuery.DEFAULT_NON_FUZZY_PREFIX,
FuzzyCompletionQuery.DEFAULT_MIN_FUZZY_LENGTH,
Operations.DEFAULT_DETERMINIZE_WORK_LIMIT,
FuzzyCompletionQuery.DEFAULT_TRANSPOSITIONS,
FuzzyCompletionQuery.DEFAULT_UNICODE_AWARE
);
assertThat(prefixQuery, instanceOf(FuzzyCompletionQuery.class));
}
public void testRegexQueryType() throws Exception {
DocumentMapper defaultMapper = createDocumentMapper(fieldMapping(this::minimalMapping));
Mapper fieldMapper = defaultMapper.mappers().getMapper("field");
CompletionFieldMapper completionFieldMapper = (CompletionFieldMapper) fieldMapper;
Query prefixQuery = completionFieldMapper.fieldType()
.regexpQuery(new BytesRef("co"), RegExp.ALL, Operations.DEFAULT_DETERMINIZE_WORK_LIMIT);
assertThat(prefixQuery, instanceOf(RegexCompletionQuery.class));
}
private static void assertFieldsOfType(List<IndexableField> fields) {
int actualFieldCount = 0;
for (IndexableField field : fields) {
if (field instanceof SuggestField) {
actualFieldCount++;
}
}
assertThat(actualFieldCount, equalTo(1));
}
public void testLimitOfContextMappings() throws Throwable {
XContentBuilder mappingBuilder = XContentFactory.jsonBuilder()
.startObject()
.startObject("properties")
.startObject("suggest")
.field("type", "completion")
.startArray("contexts");
for (int i = 0; i < COMPLETION_CONTEXTS_LIMIT + 1; i++) {
mappingBuilder.startObject();
mappingBuilder.field("name", Integer.toString(i));
mappingBuilder.field("type", "category");
mappingBuilder.endObject();
}
mappingBuilder.endArray().endObject().endObject().endObject();
MapperParsingException e = expectThrows(MapperParsingException.class, () -> createDocumentMapper(fieldMapping(b -> {
b.field("type", "completion");
b.startArray("contexts");
for (int i = 0; i < COMPLETION_CONTEXTS_LIMIT + 1; i++) {
b.startObject();
b.field("name", Integer.toString(i));
b.field("type", "category");
b.endObject();
}
b.endArray();
})));
assertTrue(
e.getMessage(),
e.getMessage().contains("Limit of completion field contexts [" + COMPLETION_CONTEXTS_LIMIT + "] has been exceeded")
);
// test pre-8 deprecation warnings
createDocumentMapper(IndexVersions.V_7_0_0, fieldMapping(b -> {
b.field("type", "completion");
b.startArray("contexts");
for (int i = 0; i < COMPLETION_CONTEXTS_LIMIT + 1; i++) {
b.startObject();
b.field("name", Integer.toString(i));
b.field("type", "category");
b.endObject();
}
b.endArray();
}));
assertCriticalWarnings(
"You have defined more than ["
+ COMPLETION_CONTEXTS_LIMIT
+ "] completion contexts"
+ " in the mapping for field [field]. The maximum allowed number of completion contexts in a mapping will be limited to "
+ "["
+ COMPLETION_CONTEXTS_LIMIT
+ "] starting in version [8.0]."
);
}
private static CompletionFieldMapper.CompletionInputMetadata randomCompletionMetadata() {
Map<String, Set<String>> contexts = randomBoolean()
? Collections.emptyMap()
: Collections.singletonMap("filter", Collections.singleton("value"));
return new CompletionFieldMapper.CompletionInputMetadata("text", contexts, 10);
}
private static XContentParser documentParser(CompletionFieldMapper.CompletionInputMetadata metadata) throws IOException {
XContentBuilder docBuilder = JsonXContent.contentBuilder();
if (randomBoolean()) {
docBuilder.prettyPrint();
}
docBuilder.startObject();
docBuilder.field("field");
docBuilder.map(metadata.toMap());
docBuilder.endObject();
String document = Strings.toString(docBuilder);
XContentParser docParser = JsonXContent.jsonXContent.createParser(XContentParserConfiguration.EMPTY, document);
docParser.nextToken();
docParser.nextToken();
assertEquals(XContentParser.Token.START_OBJECT, docParser.nextToken());
return docParser;
}
public void testMultiFieldParserSimpleValue() throws IOException {
CompletionFieldMapper.CompletionInputMetadata metadata = randomCompletionMetadata();
XContentParser documentParser = documentParser(metadata);
XContentParser multiFieldParser = new CompletionFieldMapper.MultiFieldParser(
metadata,
documentParser.currentName(),
documentParser.getTokenLocation()
);
// we don't check currentToken here because it returns START_OBJECT that is inconsistent with returning a value
assertEquals("text", multiFieldParser.textOrNull());
assertEquals(documentParser.getTokenLocation(), multiFieldParser.getTokenLocation());
assertEquals(documentParser.currentName(), multiFieldParser.currentName());
}
public void testMultiFieldParserCompletionSubfield() throws IOException {
CompletionFieldMapper.CompletionInputMetadata metadata = randomCompletionMetadata();
XContentParser documentParser = documentParser(metadata);
// compare the object structure with the original metadata, this implicitly verifies that the xcontent read is valid
XContentBuilder multiFieldBuilder = JsonXContent.contentBuilder()
.copyCurrentStructure(
new CompletionFieldMapper.MultiFieldParser(metadata, documentParser.currentName(), documentParser.getTokenLocation())
);
XContentBuilder metadataBuilder = JsonXContent.contentBuilder().map(metadata.toMap());
String jsonMetadata = Strings.toString(metadataBuilder);
assertEquals(jsonMetadata, Strings.toString(multiFieldBuilder));
// advance token by token and verify currentName as well as getTokenLocation
XContentParser multiFieldParser = new CompletionFieldMapper.MultiFieldParser(
metadata,
documentParser.currentName(),
documentParser.getTokenLocation()
);
XContentParser expectedParser = JsonXContent.jsonXContent.createParser(XContentParserConfiguration.EMPTY, jsonMetadata);
assertEquals(expectedParser.nextToken(), multiFieldParser.currentToken());
XContentLocation expectedTokenLocation = documentParser.getTokenLocation();
while (expectedParser.nextToken() != null) {
XContentParser.Token token = multiFieldParser.nextToken();
assertEquals(expectedParser.currentToken(), token);
assertEquals(expectedParser.currentToken(), multiFieldParser.currentToken());
assertEquals(expectedTokenLocation, multiFieldParser.getTokenLocation());
assertEquals(documentParser.nextToken(), multiFieldParser.currentToken());
assertEquals(documentParser.currentName(), multiFieldParser.currentName());
}
assertNull(multiFieldParser.nextToken());
}
public void testMultiFieldParserMixedSubfields() throws IOException {
CompletionFieldMapper.CompletionInputMetadata metadata = randomCompletionMetadata();
XContentParser documentParser = documentParser(metadata);
// simulate 10 sub-fields which may either read simple values or the full object structure
for (int i = 0; i < 10; i++) {
XContentParser multiFieldParser = new CompletionFieldMapper.MultiFieldParser(
metadata,
documentParser.currentName(),
documentParser.getTokenLocation()
);
if (randomBoolean()) {
assertEquals("text", multiFieldParser.textOrNull());
} else {
XContentBuilder multiFieldBuilder = JsonXContent.contentBuilder().copyCurrentStructure(multiFieldParser);
XContentBuilder metadataBuilder = JsonXContent.contentBuilder().map(metadata.toMap());
String jsonMetadata = Strings.toString(metadataBuilder);
assertEquals(jsonMetadata, Strings.toString(multiFieldBuilder));
}
}
}
private Matcher<IndexableField> suggestField(String value) {
return Matchers.allOf(hasProperty(IndexableField::stringValue, equalTo(value)), Matchers.instanceOf(SuggestField.class));
}
private Matcher<IndexableField> contextSuggestField(String value) {
return Matchers.allOf(hasProperty(IndexableField::stringValue, equalTo(value)), Matchers.instanceOf(ContextSuggestField.class));
}
private Matcher<IndexableField> keywordField(String value) {
return Matchers.allOf(
hasProperty(IndexableField::binaryValue, equalTo(new BytesRef(value))),
hasProperty(ft -> ft.fieldType().indexOptions(), equalTo(IndexOptions.DOCS)),
hasProperty(ft -> ft.fieldType().docValuesType(), equalTo(DocValuesType.SORTED_SET))
);
}
private <T, V> Matcher<T> hasProperty(Function<? super T, ? extends V> property, Matcher<V> valueMatcher) {
return new FeatureMatcher<>(valueMatcher, "object with", property.toString()) {
@Override
protected V featureValueOf(T actual) {
return property.apply(actual);
}
};
}
@Override
protected Object generateRandomInputValue(MappedFieldType ft) {
assumeFalse("We don't have doc values or fielddata", true);
return null;
}
@Override
protected SyntheticSourceSupport syntheticSourceSupport(boolean ignoreMalformed) {
throw new AssumptionViolatedException("not supported");
}
@Override
protected IngestScriptSupport ingestScriptSupport() {
throw new AssumptionViolatedException("not supported");
}
@Override
protected List<SortShortcutSupport> getSortShortcutSupport() {
return List.of();
}
@Override
protected boolean supportsDocValuesSkippers() {
return false;
}
}
| CompletionFieldMapperTests |
java | mockito__mockito | mockito-core/src/testFixtures/java/org/mockitoutil/ClassLoaders.java | {
"start": 15646,
"end": 16084
} | class ____ extends URLStreamHandler {
private InMemoryClassLoader inMemoryClassLoader;
public MemHandler(InMemoryClassLoader inMemoryClassLoader) {
this.inMemoryClassLoader = inMemoryClassLoader;
}
@Override
protected URLConnection openConnection(URL url) throws IOException {
return new MemURLConnection(url, inMemoryClassLoader);
}
private static | MemHandler |
java | hibernate__hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/query/criteria/CriteriaBuilderNonStandardFunctionsTest.java | {
"start": 2093,
"end": 20832
} | class ____ {
private final static String DATETIME_PATTERN = "yyyy-MM-dd HH:mm:ss";
@BeforeEach
public void prepareData(SessionFactoryScope scope) {
scope.inTransaction( em -> {
Date now = new Date();
EntityOfBasics entity1 = new EntityOfBasics();
entity1.setId( 1 );
entity1.setTheString( "5" );
entity1.setTheInt( 5 );
entity1.setTheInteger( -1 );
entity1.setTheDouble( 1.0 );
entity1.setTheDate( now );
entity1.setTheLocalDateTime( LocalDateTime.now() );
entity1.setTheBoolean( true );
em.persist( entity1 );
EntityOfBasics entity2 = new EntityOfBasics();
entity2.setId( 2 );
entity2.setTheString( "6" );
entity2.setTheInt( 6 );
entity2.setTheInteger( -2 );
entity2.setTheDouble( 6.0 );
entity2.setTheBoolean( true );
em.persist( entity2 );
EntityOfBasics entity3 = new EntityOfBasics();
entity3.setId( 3 );
entity3.setTheString( "7" );
entity3.setTheInt( 7 );
entity3.setTheInteger( 3 );
entity3.setTheDouble( 7.0 );
entity3.setTheBoolean( false );
entity3.setTheDate( new Date( now.getTime() + 200000L ) );
em.persist( entity3 );
EntityOfBasics entity4 = new EntityOfBasics();
entity4.setId( 4 );
entity4.setTheString( "thirteen" );
entity4.setTheInt( 13 );
entity4.setTheInteger( 4 );
entity4.setTheDouble( 13.0 );
entity4.setTheBoolean( false );
entity4.setTheDate( new Date( now.getTime() + 300000L ) );
em.persist( entity4 );
EntityOfBasics entity5 = new EntityOfBasics();
entity5.setId( 5 );
entity5.setTheString( "5" );
entity5.setTheInt( 5 );
entity5.setTheInteger( 5 );
entity5.setTheDouble( 9.0 );
entity5.setTheBoolean( false );
em.persist( entity5 );
} );
}
@AfterEach
public void tearDown(SessionFactoryScope scope) {
scope.getSessionFactory().getSchemaManager().truncate();
}
@Test
public void testSql(SessionFactoryScope scope) {
scope.inTransaction( session -> {
HibernateCriteriaBuilder cb = session.getCriteriaBuilder();
CriteriaQuery<String> query = cb.createQuery( String.class );
Root<EntityOfBasics> from = query.from( EntityOfBasics.class );
query.select( cb.sql( "'test'", String.class ) );
List<String> resultList = session.createQuery( query ).getResultList();
assertEquals( 5, resultList.size() );
resultList.forEach( r -> assertEquals( "test", r ) );
} );
}
@Test
@RequiresDialect(PostgreSQLDialect.class)
public void testSqlCustomType(SessionFactoryScope scope) {
scope.inTransaction( session -> {
HibernateCriteriaBuilder cb = session.getCriteriaBuilder();
CriteriaQuery<Integer> query = cb.createQuery( Integer.class );
Root<EntityOfBasics> from = query.from( EntityOfBasics.class );
try {
query.select( from.get( "id" ) ).where( cb.equal(
cb.value( InetAddress.getByName( "127.0.0.1" ) ),
cb.sql( "?::inet", InetAddress.class, cb.literal( "127.0.0.1" ) )
) );
}
catch (UnknownHostException e) {
throw new RuntimeException( e );
}
List<Integer> resultList = session.createQuery( query ).getResultList();
assertEquals( 5, resultList.size() );
} );
}
@Test
@RequiresDialectFeature(feature = DialectFeatureChecks.SupportsFormat.class)
public void testFormatWithJavaUtilDate(SessionFactoryScope scope) {
scope.inTransaction( session -> {
HibernateCriteriaBuilder cb = session.getCriteriaBuilder();
CriteriaQuery<Tuple> query = cb.createQuery( Tuple.class );
Root<EntityOfBasics> from = query.from( EntityOfBasics.class );
Expression<LocalDate> theDate = from.get( "theDate" ).as( LocalDate.class );
query.multiselect( from.get( "id" ), cb.format( theDate, DATETIME_PATTERN ) )
.where( cb.isNotNull( theDate ) )
.orderBy( cb.asc( theDate ) );
List<Tuple> resultList = session.createQuery( query ).getResultList();
assertEquals( 3, resultList.size() );
EntityOfBasics eob = session.find( EntityOfBasics.class, resultList.get( 0 ).get( 0 ) );
String formattedDate = new SimpleDateFormat( DATETIME_PATTERN ).format( eob.getTheDate() );
assertEquals( formattedDate, resultList.get( 0 ).get( 1 ) );
} );
}
@Test
@RequiresDialectFeature(feature = DialectFeatureChecks.SupportsFormat.class)
public void testFormatWithJavaTimeLocalDateTime(SessionFactoryScope scope) {
scope.inTransaction( session -> {
HibernateCriteriaBuilder cb = session.getCriteriaBuilder();
CriteriaQuery<Tuple> query = cb.createTupleQuery();
Root<EntityOfBasics> from = query.from( EntityOfBasics.class );
Path<LocalDateTime> theLocalDateTime = from.get( "theLocalDateTime" );
query.multiselect( from.get( "id" ), cb.format( theLocalDateTime, DATETIME_PATTERN ) )
.where( cb.isNotNull( theLocalDateTime ) );
List<Tuple> resultList = session.createQuery( query ).getResultList();
assertEquals( 1, resultList.size() );
EntityOfBasics eob = session.find( EntityOfBasics.class, resultList.get( 0 ).get( 0 ) );
String formattedDate = DateTimeFormatter.ofPattern( DATETIME_PATTERN ).format( eob.getTheLocalDateTime() );
assertEquals( formattedDate, resultList.get( 0 ).get( 1 ) );
} );
}
@Test
public void testExtractFunctions(SessionFactoryScope scope) {
scope.inTransaction( session -> {
HibernateCriteriaBuilder cb = session.getCriteriaBuilder();
CriteriaQuery<Tuple> query = cb.createTupleQuery();
Root<EntityOfBasics> from = query.from( EntityOfBasics.class );
Expression<LocalDateTime> theLocalDateTime = from.get( "theLocalDateTime" );
query.multiselect(
from.get( "id" ),
cb.year( theLocalDateTime ),
cb.month( theLocalDateTime ),
cb.day( theLocalDateTime ),
cb.hour( theLocalDateTime ),
cb.minute( theLocalDateTime )
).where( cb.isNotNull( theLocalDateTime ) );
Tuple result = session.createQuery( query ).getSingleResult();
EntityOfBasics eob = session.find( EntityOfBasics.class, result.get( 0 ) );
assertEquals( eob.getTheLocalDateTime().getYear(), result.get( 1 ) );
assertEquals( eob.getTheLocalDateTime().getMonth().getValue(), result.get( 2 ) );
assertEquals( eob.getTheLocalDateTime().getDayOfMonth(), result.get( 3 ) );
assertEquals( eob.getTheLocalDateTime().getHour(), result.get( 4 ) );
assertEquals( eob.getTheLocalDateTime().getMinute(), result.get( 5 ) );
} );
}
@Test
public void testOverlay(SessionFactoryScope scope) {
scope.inTransaction( session -> {
HibernateCriteriaBuilder cb = session.getCriteriaBuilder();
CriteriaQuery<Tuple> query = cb.createTupleQuery();
Root<EntityOfBasics> from = query.from( EntityOfBasics.class );
Expression<String> theString = from.get( "theString" );
query.multiselect(
cb.overlay( theString, "33", 6 ),
cb.overlay( theString, ( (JpaExpression) from.get( "theInt" ) ).cast( String.class ), 6 ),
cb.overlay( theString, "1234", from.get( "theInteger" ), 2 )
).where( cb.equal( from.get( "id" ), 4 ) );
Tuple result = session.createQuery( query ).getSingleResult();
assertEquals( "thirt33n", result.get( 0 ) );
assertEquals( "thirt13n", result.get( 1 ) );
assertEquals( "thi1234een", result.get( 2 ) );
} );
}
@Test
@RequiresDialectFeature(feature = DialectFeatureChecks.SupportsPadWithChar.class)
public void testPad(SessionFactoryScope scope) {
scope.inTransaction( session -> {
HibernateCriteriaBuilder cb = session.getCriteriaBuilder();
CriteriaQuery<Tuple> query = cb.createTupleQuery();
Root<EntityOfBasics> from = query.from( EntityOfBasics.class );
Expression<String> theString = from.get( "theString" );
query.multiselect(
cb.pad( theString, 5 ),
cb.pad( CriteriaBuilder.Trimspec.TRAILING, theString, from.get( "theInt" ) ),
cb.pad( CriteriaBuilder.Trimspec.LEADING, theString, 3, '#' )
).where( cb.equal( from.get( "id" ), 1 ) );
Tuple result = session.createQuery( query ).getSingleResult();
assertEquals( "5 ", result.get( 0 ) );
assertEquals( "5 ", result.get( 1 ) );
assertEquals( "##5", result.get( 2 ) );
} );
}
@Test
public void testLeftRight(SessionFactoryScope scope) {
scope.inTransaction( session -> {
CriteriaBuilder cb = session.getCriteriaBuilder();
CriteriaQuery<Tuple> query = cb.createTupleQuery();
Root<EntityOfBasics> from = query.from( EntityOfBasics.class );
Expression<String> theString = from.get( "theString" );
query.multiselect(
cb.left( theString, 3 ),
cb.right( theString, from.get( "theInteger" ) )
).where( cb.equal( from.get( "id" ), 4 ) );
Tuple result = session.createQuery( query ).getSingleResult();
assertEquals( "thi", result.get( 0 ) );
assertEquals( "teen", result.get( 1 ) );
} );
}
@Test
@RequiresDialectFeature(feature = DialectFeatureChecks.SupportsReplace.class)
public void testReplace(SessionFactoryScope scope) {
scope.inTransaction( session -> {
CriteriaBuilder cb = session.getCriteriaBuilder();
CriteriaQuery<Tuple> query = cb.createTupleQuery();
Root<EntityOfBasics> from = query.from( EntityOfBasics.class );
Expression<String> theString = from.get( "theString" );
query.multiselect(
cb.replace( theString, "thi", "12345" ),
cb.replace( theString, "t", ( (JpaExpression) from.get( "theInteger" ) ).cast( String.class ) )
).where( cb.equal( from.get( "id" ), 4 ) );
Tuple result = session.createQuery( query ).getSingleResult();
assertEquals( "12345rteen", result.get( 0 ) );
assertEquals( "4hir4een", result.get( 1 ) );
} );
}
@Test
@RequiresDialectFeature(feature = DialectFeatureChecks.SupportsRepeat.class)
public void testRepeat(SessionFactoryScope scope) {
scope.inTransaction( session -> {
HibernateCriteriaBuilder cb = session.getCriteriaBuilder();
CriteriaQuery<String> query = cb.createQuery( String.class ).select( cb.repeat("hello", cb.literal(3)) );
assertEquals( "hellohellohello", session.createQuery( query ).getSingleResult() );
} );
}
@Test
@RequiresDialect(PostgreSQLDialect.class)
public void testCollatePostgreSQL(SessionFactoryScope scope) {
scope.inTransaction( session -> {
HibernateCriteriaBuilder cb = session.getCriteriaBuilder();
CriteriaQuery<String> query = cb.createQuery( String.class );
Root<EntityOfBasics> from = query.from( EntityOfBasics.class );
Expression<String> theString = from.get( "theString" );
query.select( theString )
.where( cb.isNotNull( theString ) )
.orderBy( cb.asc( cb.collate( theString, "ucs_basic" ) ) );
assertNotNull( session.createQuery( query ).getResultList() );
CriteriaQuery<Boolean> query2 = cb.createQuery( Boolean.class );
query2.select( cb.lessThan( cb.collate(
cb.literal( "bar" ),
"ucs_basic"
), cb.literal( "foo" ) ) );
assertTrue( session.createQuery( query2 ).getSingleResult() );
} );
}
@Test
@SkipForDialect(dialectClass = CockroachDialect.class, reason = "Cockroach has unreliable support for numeric types in log function")
public void testLog(SessionFactoryScope scope) {
scope.inTransaction( session -> {
HibernateCriteriaBuilder cb = session.getCriteriaBuilder();
CriteriaQuery<Tuple> query = cb.createTupleQuery();
Root<EntityOfBasics> from = query.from( EntityOfBasics.class );
query.multiselect(
cb.log10( from.get( "theInt" ) ),
cb.log( 2, from.get( "theInt" ) )
).where( cb.equal( from.get( "id" ), 1 ) );
Tuple result = session.createQuery( query ).getSingleResult();
assertEquals( Math.log10( 5 ), result.get( 0, Double.class ), 1e-6 );
assertEquals( Math.log( 5 ) / Math.log( 2 ), result.get( 1, Double.class ), 1e-6 );
} );
}
@Test
public void testPi(SessionFactoryScope scope) {
scope.inTransaction( session -> {
HibernateCriteriaBuilder cb = session.getCriteriaBuilder();
CriteriaQuery<Double> query = cb.createQuery( Double.class ).select( cb.pi() );
assertEquals( Math.PI, session.createQuery( query ).getSingleResult(), 1e-6 );
} );
}
@Test
public void testTrigonometricFunctions(SessionFactoryScope scope) {
scope.inTransaction( session -> {
HibernateCriteriaBuilder cb = session.getCriteriaBuilder();
CriteriaQuery<Tuple> query = cb.createTupleQuery();
Root<EntityOfBasics> from = query.from( EntityOfBasics.class );
Path<Double> theDouble = from.get( "theDouble" );
query.multiselect(
cb.sin( theDouble ),
cb.cos( theDouble ),
cb.tan( theDouble ),
cb.asin( theDouble ),
cb.acos( theDouble ),
cb.atan( theDouble )
).where( cb.equal( from.get( "id" ), 1 ) );
Tuple result = session.createQuery( query ).getSingleResult();
assertEquals( Math.sin( 1.0 ), result.get( 0, Double.class ), 1e-6 );
assertEquals( Math.cos( 1.0 ), result.get( 1, Double.class ), 1e-6 );
assertEquals( Math.tan( 1.0 ), result.get( 2, Double.class ), 1e-6 );
assertEquals( Math.asin( 1.0 ), result.get( 3, Double.class ), 1e-6 );
assertEquals( Math.acos( 1.0 ), result.get( 4, Double.class ), 1e-6 );
assertEquals( Math.atan( 1.0 ), result.get( 5, Double.class ), 1e-6 );
} );
}
@Test
public void testAtan2(SessionFactoryScope scope) {
scope.inTransaction( session -> {
HibernateCriteriaBuilder cb = session.getCriteriaBuilder();
CriteriaQuery<Tuple> query = cb.createTupleQuery();
Root<EntityOfBasics> from = query.from( EntityOfBasics.class );
Path<Double> theDouble = from.get( "theDouble" );
query.multiselect(
cb.atan2( cb.sin( theDouble ), 0 ),
cb.atan2( cb.sin( theDouble ), cb.cos( theDouble ) )
).where( cb.equal( from.get( "id" ), 1 ) );
Tuple result = session.createQuery( query ).getSingleResult();
assertEquals( Math.atan2( Math.sin( 1.0 ), 0 ), result.get( 0, Double.class ), 1e-6 );
assertEquals( Math.atan2( Math.sin( 1.0 ), Math.cos( 1.0 ) ), result.get( 1, Double.class ), 1e-6 );
} );
}
@Test
public void testHyperbolic(SessionFactoryScope scope) {
scope.inTransaction( session -> {
HibernateCriteriaBuilder cb = session.getCriteriaBuilder();
CriteriaQuery<Tuple> query = cb.createTupleQuery();
Root<EntityOfBasics> from = query.from( EntityOfBasics.class );
Path<Double> theDouble = from.get( "theDouble" );
query.multiselect(
cb.sinh( theDouble ),
cb.cosh( theDouble ),
cb.tanh( theDouble )
).where( cb.equal( from.get( "id" ), 1 ) );
Tuple result = session.createQuery( query ).getSingleResult();
assertEquals( Math.sinh( 1.0 ), result.get( 0, Double.class ), 1e-6 );
assertEquals( Math.cosh( 1.0 ), result.get( 1, Double.class ), 1e-6 );
assertEquals( Math.tanh( 1.0 ), result.get( 2, Double.class ), 1e-6 );
} );
}
@Test
public void testDegrees(SessionFactoryScope scope) {
scope.inTransaction( session -> {
HibernateCriteriaBuilder cb = session.getCriteriaBuilder();
CriteriaQuery<Tuple> query = cb.createTupleQuery();
query.multiselect( cb.degrees( cb.pi() ), cb.radians( cb.literal( 180.0 ) ) );
Tuple result = session.createQuery( query ).getSingleResult();
assertEquals( 180.0, result.get( 0, Double.class ), 1e-9 );
assertEquals( Math.PI, result.get( 1, Double.class ), 1e-9 );
} );
}
@Test
@JiraKey("HHH-16185")
public void testNumericTruncFunction(SessionFactoryScope scope) {
scope.inTransaction( session -> {
final CriteriaBuilder cb = session.getCriteriaBuilder();
final CriteriaQuery<Tuple> query = cb.createTupleQuery();
query.multiselect(
cb.function( "trunc", Float.class, cb.literal( 32.92345f ) ),
cb.function( "truncate", Float.class, cb.literal( 32.92345f ) ),
cb.function( "trunc", Float.class, cb.literal( 32.92345f ), cb.literal( 3 ) ),
cb.function( "truncate", Float.class, cb.literal( 32.92345f ), cb.literal( 3 ) ),
cb.function( "trunc", Double.class, cb.literal( 32.92345d ) ),
cb.function( "truncate", Double.class, cb.literal( 32.92345d ) ),
cb.function( "trunc", Double.class, cb.literal( 32.92345d ), cb.literal( 3 ) ),
cb.function( "truncate", Double.class, cb.literal( 32.92345d ), cb.literal( 3 ) )
);
final Tuple result = session.createQuery( query ).getSingleResult();
assertEquals( 32f, result.get( 0 ) );
assertEquals( 32f, result.get( 1 ) );
assertEquals( 32.923f, result.get( 2 ) );
assertEquals( 32.923f, result.get( 3 ) );
assertEquals( 32d, result.get( 4 ) );
assertEquals( 32d, result.get( 5 ) );
assertEquals( 32.923d, result.get( 6 ) );
assertEquals( 32.923d, result.get( 7 ) );
} );
}
@Test
@JiraKey("HHH-16130")
@RequiresDialectFeature( feature = DialectFeatureChecks.SupportsDateTimeTruncation.class )
public void testDateTruncFunction(SessionFactoryScope scope) {
scope.inTransaction( session -> {
HibernateCriteriaBuilder cb = session.getCriteriaBuilder();
CriteriaQuery<Tuple> query = cb.createTupleQuery();
Root<EntityOfBasics> from = query.from( EntityOfBasics.class );
Expression<LocalDateTime> theLocalDateTime = from.get( "theLocalDateTime" );
query.multiselect(
from.get( "id" ),
cb.truncate( theLocalDateTime, TemporalUnit.YEAR ),
cb.truncate( theLocalDateTime, TemporalUnit.MONTH ),
cb.truncate( theLocalDateTime, TemporalUnit.DAY ),
cb.truncate( theLocalDateTime, TemporalUnit.HOUR ),
cb.truncate( theLocalDateTime, TemporalUnit.MINUTE ),
cb.truncate( theLocalDateTime, TemporalUnit.SECOND )
).where( cb.isNotNull( theLocalDateTime ) );
Tuple result = session.createQuery( query ).getSingleResult();
EntityOfBasics eob = session.find( EntityOfBasics.class, result.get( 0 ) );
assertEquals(
eob.getTheLocalDateTime().withMonth( 1 ).withDayOfMonth( 1 ).truncatedTo( ChronoUnit.DAYS ),
result.get( 1 )
);
assertEquals(
eob.getTheLocalDateTime().withDayOfMonth( 1 ).truncatedTo( ChronoUnit.DAYS ),
result.get( 2 )
);
assertEquals( eob.getTheLocalDateTime().truncatedTo( ChronoUnit.DAYS ), result.get( 3 ) );
assertEquals( eob.getTheLocalDateTime().truncatedTo( ChronoUnit.HOURS ), result.get( 4 ) );
assertEquals( eob.getTheLocalDateTime().truncatedTo( ChronoUnit.MINUTES ), result.get( 5 ) );
assertEquals( eob.getTheLocalDateTime().truncatedTo( ChronoUnit.SECONDS ), result.get( 6 ) );
} );
}
@Test
@JiraKey("HHH-16954")
public void testParameterList(SessionFactoryScope scope) {
scope.inTransaction( session -> {
HibernateCriteriaBuilder cb = session.getCriteriaBuilder();
CriteriaQuery<Tuple> query = cb.createTupleQuery();
Root<EntityOfBasics> from = query.from(EntityOfBasics.class);
ParameterExpression<List<Integer>> ids = cb.listParameter(Integer.class);
query.where( from.get("id").in(ids));
assertEquals(3,
session.createQuery( query )
.setParameter(ids, List.of(2, 3, 5))
.getResultCount());
} );
}
}
| CriteriaBuilderNonStandardFunctionsTest |
java | elastic__elasticsearch | server/src/main/java/org/elasticsearch/action/admin/cluster/stats/ClusterStatsIndices.java | {
"start": 1248,
"end": 5452
} | class ____ implements ToXContentFragment {
private final int indexCount;
private final ShardStats shards;
private final DocsStats docs;
private final StoreStats store;
private final SearchUsageStats searchUsageStats;
private final FieldDataStats fieldData;
private final QueryCacheStats queryCache;
private final CompletionStats completion;
private final SegmentsStats segments;
private final AnalysisStats analysis;
private final MappingStats mappings;
private final VersionStats versions;
private final DenseVectorStats denseVectorStats;
private final SparseVectorStats sparseVectorStats;
public ClusterStatsIndices(
List<ClusterStatsNodeResponse> nodeResponses,
MappingStats mappingStats,
AnalysisStats analysisStats,
VersionStats versionStats
) {
Map<String, ShardStats> countsPerIndex = new HashMap<>();
this.docs = new DocsStats();
this.store = new StoreStats();
this.searchUsageStats = new SearchUsageStats();
this.fieldData = new FieldDataStats();
this.queryCache = new QueryCacheStats();
this.completion = new CompletionStats();
this.segments = new SegmentsStats();
this.denseVectorStats = new DenseVectorStats();
this.sparseVectorStats = new SparseVectorStats();
for (ClusterStatsNodeResponse r : nodeResponses) {
for (org.elasticsearch.action.admin.indices.stats.ShardStats shardStats : r.shardsStats()) {
final String indexUuid = shardStats.getShardRouting().index().getUUID();
ShardStats indexShardStats = countsPerIndex.get(indexUuid);
if (indexShardStats == null) {
indexShardStats = new ShardStats();
countsPerIndex.put(indexUuid, indexShardStats);
}
indexShardStats.total++;
CommonStats shardCommonStats = shardStats.getStats();
if (shardStats.getShardRouting().primary()) {
indexShardStats.primaries++;
docs.add(shardCommonStats.getDocs());
denseVectorStats.add(shardCommonStats.getDenseVectorStats());
sparseVectorStats.add(shardCommonStats.getSparseVectorStats());
}
store.add(shardCommonStats.getStore());
fieldData.add(shardCommonStats.getFieldData());
queryCache.add(shardCommonStats.getQueryCache());
completion.add(shardCommonStats.getCompletion());
segments.add(shardCommonStats.getSegments());
}
searchUsageStats.add(r.searchUsageStats());
}
shards = new ShardStats();
indexCount = countsPerIndex.size();
for (Map.Entry<String, ShardStats> indexCountsCursor : countsPerIndex.entrySet()) {
shards.addIndexShardCount(indexCountsCursor.getValue());
}
this.mappings = mappingStats;
this.analysis = analysisStats;
this.versions = versionStats;
}
public int getIndexCount() {
return indexCount;
}
public ShardStats getShards() {
return this.shards;
}
public DocsStats getDocs() {
return docs;
}
public StoreStats getStore() {
return store;
}
public FieldDataStats getFieldData() {
return fieldData;
}
public QueryCacheStats getQueryCache() {
return queryCache;
}
public CompletionStats getCompletion() {
return completion;
}
public SegmentsStats getSegments() {
return segments;
}
public MappingStats getMappings() {
return mappings;
}
public AnalysisStats getAnalysis() {
return analysis;
}
public VersionStats getVersions() {
return versions;
}
public SearchUsageStats getSearchUsageStats() {
return searchUsageStats;
}
public DenseVectorStats getDenseVectorStats() {
return denseVectorStats;
}
public SparseVectorStats getSparseVectorStats() {
return sparseVectorStats;
}
static final | ClusterStatsIndices |
java | google__error-prone | core/src/test/java/com/google/errorprone/refaster/testdata/template/EmitCommentBeforeTemplate.java | {
"start": 960,
"end": 1241
} | class ____ {
@BeforeTemplate
int before(String str) {
return str.length();
}
@AfterTemplate
@UseImportPolicy(ImportPolicy.STATIC_IMPORT_ALWAYS)
int after(String str) {
return Refaster.emitCommentBefore("comment here", str.length());
}
}
| EmitCommentBeforeTemplate |
java | junit-team__junit5 | platform-tests/src/test/java/org/junit/platform/commons/util/ReflectionUtilsTests.java | {
"start": 82431,
"end": 82518
} | class ____ implements InterfaceWithStaticMethod {
}
static | InterfaceWithStaticMethodImpl |
java | elastic__elasticsearch | test/framework/src/main/java/org/elasticsearch/test/transport/StubbableConnectionManager.java | {
"start": 1115,
"end": 4636
} | class ____ implements ConnectionManager {
private final ConnectionManager delegate;
private final ConcurrentMap<TransportAddress, GetConnectionBehavior> getConnectionBehaviors;
private volatile GetConnectionBehavior defaultGetConnectionBehavior = ConnectionManager::getConnection;
private volatile NodeConnectedBehavior defaultNodeConnectedBehavior = ConnectionManager::nodeConnected;
public StubbableConnectionManager(ConnectionManager delegate) {
this.delegate = delegate;
this.getConnectionBehaviors = new ConcurrentHashMap<>();
}
public boolean addGetConnectionBehavior(TransportAddress transportAddress, GetConnectionBehavior connectBehavior) {
return getConnectionBehaviors.put(transportAddress, connectBehavior) == null;
}
public boolean setDefaultGetConnectionBehavior(GetConnectionBehavior behavior) {
GetConnectionBehavior prior = defaultGetConnectionBehavior;
defaultGetConnectionBehavior = behavior;
return prior == null;
}
public boolean setDefaultNodeConnectedBehavior(NodeConnectedBehavior behavior) {
NodeConnectedBehavior prior = defaultNodeConnectedBehavior;
defaultNodeConnectedBehavior = behavior;
return prior == null;
}
public void clearBehaviors() {
defaultGetConnectionBehavior = ConnectionManager::getConnection;
getConnectionBehaviors.clear();
}
public void clearBehavior(TransportAddress transportAddress) {
getConnectionBehaviors.remove(transportAddress);
}
@Override
public void openConnection(DiscoveryNode node, ConnectionProfile connectionProfile, ActionListener<Transport.Connection> listener) {
delegate.openConnection(node, connectionProfile, listener);
}
@Override
public Transport.Connection getConnection(DiscoveryNode node) {
TransportAddress address = node.getAddress();
GetConnectionBehavior behavior = getConnectionBehaviors.getOrDefault(address, defaultGetConnectionBehavior);
return behavior.getConnection(delegate, node);
}
@Override
public boolean nodeConnected(DiscoveryNode node) {
return defaultNodeConnectedBehavior.connectedNodes(delegate, node);
}
@Override
public void addListener(TransportConnectionListener listener) {
delegate.addListener(listener);
}
@Override
public void removeListener(TransportConnectionListener listener) {
delegate.removeListener(listener);
}
@Override
public void connectToNode(
DiscoveryNode node,
ConnectionProfile connectionProfile,
ConnectionValidator connectionValidator,
ActionListener<Releasable> listener
) throws ConnectTransportException {
delegate.connectToNode(node, connectionProfile, connectionValidator, listener);
}
@Override
public void disconnectFromNode(DiscoveryNode node) {
delegate.disconnectFromNode(node);
}
@Override
public int size() {
return delegate.size();
}
@Override
public Set<DiscoveryNode> getAllConnectedNodes() {
return delegate.getAllConnectedNodes();
}
@Override
public void close() {
delegate.close();
}
@Override
public void closeNoBlock() {
delegate.closeNoBlock();
}
@Override
public ConnectionProfile getConnectionProfile() {
return delegate.getConnectionProfile();
}
@FunctionalInterface
public | StubbableConnectionManager |
java | apache__hadoop | hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/hamlet2/HamletSpec.java | {
"start": 59406,
"end": 59746
} | interface ____ {
/**
* Add a TR (table row) element.
* @return a new TR element builder
*/
TR tr();
/**
* Add a TR element.
* @param selector the css selector in the form of (#id)*(.class)*
* @return a new TR element builder
*/
TR tr(String selector);
}
/**
*
*/
public | _TableRow |
java | quarkusio__quarkus | extensions/arc/deployment/src/test/java/io/quarkus/arc/test/startup/SyntheticBeanStartupTest.java | {
"start": 809,
"end": 2181
} | class ____ {
@RegisterExtension
static final QuarkusUnitTest config = new QuarkusUnitTest()
.withApplicationRoot(
root -> root.addClasses(SyntheticBeanStartupTest.class, SynthBean.class, SynthBeanCreator.class))
.addBuildChainCustomizer(buildCustomizer());
static Consumer<BuildChainBuilder> buildCustomizer() {
return new Consumer<BuildChainBuilder>() {
@Override
public void accept(BuildChainBuilder builder) {
builder.addBuildStep(new BuildStep() {
@Override
public void execute(BuildContext context) {
context.produce(SyntheticBeanBuildItem.configure(SynthBean.class)
.scope(ApplicationScoped.class)
.identifier("ok")
.startup()
.creator(SynthBeanCreator.class)
.done());
}
}).produces(SyntheticBeanBuildItem.class).build();
}
};
}
@Inject
Provider<SynthBean> synthBean;
@Test
public void testStartup() {
assertTrue(SynthBeanCreator.CREATED.get());
assertEquals("foo", synthBean.get().getValue());
}
public static | SyntheticBeanStartupTest |
java | alibaba__fastjson | src/test/java/com/alibaba/json/bvt/GetSetNotMatchTest.java | {
"start": 526,
"end": 737
} | class ____ {
private int value;
public boolean getValue() {
return value == 1;
}
public void setValue(int value) {
this.value = value;
}
}
}
| VO |
java | quarkusio__quarkus | extensions/security/deployment/src/test/java/io/quarkus/security/test/permissionsallowed/ClassLevelCustomPermissionsAllowedTest.java | {
"start": 7975,
"end": 8581
} | class ____ {
public final String write() {
return WRITE_PERMISSION;
}
public final String read() {
return READ_PERMISSION;
}
public final Uni<String> writeNonBlocking() {
return Uni.createFrom().item(WRITE_PERMISSION);
}
public final Uni<String> readNonBlocking() {
return Uni.createFrom().item(READ_PERMISSION);
}
}
@PermissionsAllowed(value = { WRITE_PERMISSION_BEAN, READ_PERMISSION_BEAN }, permission = CustomPermission.class)
@Singleton
public static | MultipleWriteReadBean |
java | spring-projects__spring-framework | spring-messaging/src/main/java/org/springframework/messaging/MessageHeaders.java | {
"start": 2610,
"end": 9594
} | class ____ implements Map<String, Object>, Serializable {
/**
* UUID for none.
*/
public static final UUID ID_VALUE_NONE = new UUID(0,0);
/**
* The key for the Message ID. This is an automatically generated UUID and
* should never be explicitly set in the header map <b>except</b> in the
* case of Message deserialization where the serialized Message's generated
* UUID is being restored.
*/
public static final String ID = "id";
/**
* The key for the message timestamp.
*/
public static final String TIMESTAMP = "timestamp";
/**
* The key for the message content type.
*/
public static final String CONTENT_TYPE = "contentType";
/**
* The key for the message reply channel.
*/
public static final String REPLY_CHANNEL = "replyChannel";
/**
* The key for the message error channel.
*/
public static final String ERROR_CHANNEL = "errorChannel";
private static final long serialVersionUID = 7035068984263400920L;
private static final Log logger = LogFactory.getLog(MessageHeaders.class);
private static final IdGenerator defaultIdGenerator = new AlternativeJdkIdGenerator();
private static volatile @Nullable IdGenerator idGenerator;
@SuppressWarnings("serial")
private final Map<String, Object> headers;
/**
* Construct a {@link MessageHeaders} with the given headers. An {@link #ID} and
* {@link #TIMESTAMP} headers will also be added, overriding any existing values.
* @param headers a map with headers to add
*/
public MessageHeaders(@Nullable Map<String, Object> headers) {
this(headers, null, null);
}
/**
* Constructor providing control over the ID and TIMESTAMP header values.
* @param headers a map with headers to add
* @param id the {@link #ID} header value
* @param timestamp the {@link #TIMESTAMP} header value
*/
protected MessageHeaders(@Nullable Map<String, Object> headers, @Nullable UUID id, @Nullable Long timestamp) {
this.headers = (headers != null ? new HashMap<>(headers) : new HashMap<>());
if (id == null) {
this.headers.put(ID, getIdGenerator().generateId());
}
else if (id == ID_VALUE_NONE) {
this.headers.remove(ID);
}
else {
this.headers.put(ID, id);
}
if (timestamp == null) {
this.headers.put(TIMESTAMP, System.currentTimeMillis());
}
else if (timestamp < 0) {
this.headers.remove(TIMESTAMP);
}
else {
this.headers.put(TIMESTAMP, timestamp);
}
}
/**
* Copy constructor which allows for ignoring certain entries.
* Used for serialization without non-serializable entries.
* @param original the MessageHeaders to copy
* @param keysToIgnore the keys of the entries to ignore
*/
private MessageHeaders(MessageHeaders original, Set<String> keysToIgnore) {
this.headers = CollectionUtils.newHashMap(original.headers.size());
original.headers.forEach((key, value) -> {
if (!keysToIgnore.contains(key)) {
this.headers.put(key, value);
}
});
}
protected Map<String, Object> getRawHeaders() {
return this.headers;
}
protected static IdGenerator getIdGenerator() {
IdGenerator generator = idGenerator;
return (generator != null ? generator : defaultIdGenerator);
}
public @Nullable UUID getId() {
return get(ID, UUID.class);
}
public @Nullable Long getTimestamp() {
return get(TIMESTAMP, Long.class);
}
public @Nullable Object getReplyChannel() {
return get(REPLY_CHANNEL);
}
public @Nullable Object getErrorChannel() {
return get(ERROR_CHANNEL);
}
@SuppressWarnings("unchecked")
public <T> @Nullable T get(Object key, Class<T> type) {
Object value = this.headers.get(key);
if (value == null) {
return null;
}
if (!type.isAssignableFrom(value.getClass())) {
throw new IllegalArgumentException("Incorrect type specified for header '" +
key + "'. Expected [" + type + "] but actual type is [" + value.getClass() + "]");
}
return (T) value;
}
// Delegating Map implementation
@Override
public boolean containsKey(Object key) {
return this.headers.containsKey(key);
}
@Override
public boolean containsValue(Object value) {
return this.headers.containsValue(value);
}
@Override
public Set<Map.Entry<String, Object>> entrySet() {
return Collections.unmodifiableMap(this.headers).entrySet();
}
@Override
public @Nullable Object get(Object key) {
return this.headers.get(key);
}
@Override
public boolean isEmpty() {
return this.headers.isEmpty();
}
@Override
public Set<String> keySet() {
return Collections.unmodifiableSet(this.headers.keySet());
}
@Override
public int size() {
return this.headers.size();
}
@Override
public Collection<Object> values() {
return Collections.unmodifiableCollection(this.headers.values());
}
// Unsupported Map operations
/**
* Since MessageHeaders are immutable, the call to this method
* will result in {@link UnsupportedOperationException}.
*/
@Override
public Object put(String key, Object value) {
throw new UnsupportedOperationException("MessageHeaders is immutable");
}
/**
* Since MessageHeaders are immutable, the call to this method
* will result in {@link UnsupportedOperationException}.
*/
@Override
public void putAll(Map<? extends String, ? extends Object> map) {
throw new UnsupportedOperationException("MessageHeaders is immutable");
}
/**
* Since MessageHeaders are immutable, the call to this method
* will result in {@link UnsupportedOperationException}.
*/
@Override
public Object remove(Object key) {
throw new UnsupportedOperationException("MessageHeaders is immutable");
}
/**
* Since MessageHeaders are immutable, the call to this method
* will result in {@link UnsupportedOperationException}.
*/
@Override
public void clear() {
throw new UnsupportedOperationException("MessageHeaders is immutable");
}
// Serialization methods
private void writeObject(ObjectOutputStream out) throws IOException {
Set<String> keysToIgnore = new HashSet<>();
this.headers.forEach((key, value) -> {
if (!(value instanceof Serializable)) {
keysToIgnore.add(key);
}
});
if (keysToIgnore.isEmpty()) {
// All entries are serializable -> serialize the regular MessageHeaders instance
out.defaultWriteObject();
}
else {
// Some non-serializable entries -> serialize a temporary MessageHeaders copy
if (logger.isDebugEnabled()) {
logger.debug("Ignoring non-serializable message headers: " + keysToIgnore);
}
out.writeObject(new MessageHeaders(this, keysToIgnore));
}
}
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
}
// equals, hashCode, toString
@Override
public boolean equals(@Nullable Object other) {
return (this == other || (other instanceof MessageHeaders that && this.headers.equals(that.headers)));
}
@Override
public int hashCode() {
return this.headers.hashCode();
}
@Override
public String toString() {
return this.headers.toString();
}
}
| MessageHeaders |
java | elastic__elasticsearch | x-pack/plugin/old-lucene-versions/src/main/java/org/elasticsearch/xpack/lucene/bwc/codecs/lucene54/LegacyStringHelper.java | {
"start": 1180,
"end": 2864
} | class ____ {
/**
* Compares two {@link BytesRef}, element by element, and returns the
* number of elements common to both arrays (from the start of each).
*
* @param left The first {@link BytesRef} to compare
* @param right The second {@link BytesRef} to compare
* @return The number of common elements (from the start of each).
*/
public static int bytesDifference(BytesRef left, BytesRef right) {
int len = left.length < right.length ? left.length : right.length;
final byte[] bytesLeft = left.bytes;
final int offLeft = left.offset;
byte[] bytesRight = right.bytes;
final int offRight = right.offset;
for (int i = 0; i < len; i++) {
if (bytesLeft[i + offLeft] != bytesRight[i + offRight]) return i;
}
return len;
}
/**
* Returns the length of {@code currentTerm} needed for use as a sort key.
* so that {@link BytesRef#compareTo(BytesRef)} still returns the same result.
* This method assumes currentTerm comes after priorTerm.
*/
public static int sortKeyLength(final BytesRef priorTerm, final BytesRef currentTerm) {
final int currentTermOffset = currentTerm.offset;
final int priorTermOffset = priorTerm.offset;
final int limit = Math.min(priorTerm.length, currentTerm.length);
for (int i = 0; i < limit; i++) {
if (priorTerm.bytes[priorTermOffset + i] != currentTerm.bytes[currentTermOffset + i]) {
return i + 1;
}
}
return Math.min(1 + priorTerm.length, currentTerm.length);
}
private LegacyStringHelper() {}
}
| LegacyStringHelper |
java | apache__camel | components/camel-cron/src/generated/java/org/apache/camel/component/cron/CronEndpointConfigurer.java | {
"start": 731,
"end": 2998
} | class ____ extends PropertyConfigurerSupport implements GeneratedPropertyConfigurer, PropertyConfigurerGetter {
@Override
public boolean configure(CamelContext camelContext, Object obj, String name, Object value, boolean ignoreCase) {
CronEndpoint target = (CronEndpoint) obj;
switch (ignoreCase ? name.toLowerCase() : name) {
case "bridgeerrorhandler":
case "bridgeErrorHandler": target.setBridgeErrorHandler(property(camelContext, boolean.class, value)); return true;
case "exceptionhandler":
case "exceptionHandler": target.setExceptionHandler(property(camelContext, org.apache.camel.spi.ExceptionHandler.class, value)); return true;
case "exchangepattern":
case "exchangePattern": target.setExchangePattern(property(camelContext, org.apache.camel.ExchangePattern.class, value)); return true;
case "schedule": target.getConfiguration().setSchedule(property(camelContext, java.lang.String.class, value)); return true;
default: return false;
}
}
@Override
public Class<?> getOptionType(String name, boolean ignoreCase) {
switch (ignoreCase ? name.toLowerCase() : name) {
case "bridgeerrorhandler":
case "bridgeErrorHandler": return boolean.class;
case "exceptionhandler":
case "exceptionHandler": return org.apache.camel.spi.ExceptionHandler.class;
case "exchangepattern":
case "exchangePattern": return org.apache.camel.ExchangePattern.class;
case "schedule": return java.lang.String.class;
default: return null;
}
}
@Override
public Object getOptionValue(Object obj, String name, boolean ignoreCase) {
CronEndpoint target = (CronEndpoint) obj;
switch (ignoreCase ? name.toLowerCase() : name) {
case "bridgeerrorhandler":
case "bridgeErrorHandler": return target.isBridgeErrorHandler();
case "exceptionhandler":
case "exceptionHandler": return target.getExceptionHandler();
case "exchangepattern":
case "exchangePattern": return target.getExchangePattern();
case "schedule": return target.getConfiguration().getSchedule();
default: return null;
}
}
}
| CronEndpointConfigurer |
java | spring-projects__spring-framework | spring-websocket/src/test/java/org/springframework/web/socket/messaging/StompWebSocketIntegrationTests.java | {
"start": 12511,
"end": 12717
} | class ____ {
@MessageMapping("/increment")
public int handle(int i) {
return i + 1;
}
@SubscribeMapping("/number")
public int number() {
return 42;
}
}
private static | IncrementController |
java | spring-projects__spring-framework | spring-test/src/test/java/org/springframework/test/context/transaction/TransactionalTestExecutionListenerTests.java | {
"start": 17291,
"end": 17450
} | class ____
implements RollbackFalseViaMetaAnnotationTestInterface {
public void test() {
}
}
}
| ClassLevelRollbackViaMetaAnnotationOnTestInterfaceTestCase |
java | hibernate__hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/mapping/basic/bitset/BitSetTypeTest.java | {
"start": 1085,
"end": 2503
} | class ____ {
@AfterEach
public void cleanup(SessionFactoryScope scope) {
scope.getSessionFactory().getSchemaManager().truncateMappedObjects();
}
/*
* We don't need this code for the test itself but we need to include it in the ref doc.
*/
public void ignoredJustForIncludeInSources() {
try (org.hibernate.service.ServiceRegistry standardRegistry = new StandardServiceRegistryBuilder().build()) {
//tag::basic-custom-type-register-BasicType-example[]
MetadataSources sources = new MetadataSources( standardRegistry );
MetadataBuilder metadataBuilder = sources.getMetadataBuilder();
metadataBuilder.applyBasicType( BitSetType.INSTANCE );
//end::basic-custom-type-register-BasicType-example[]
}
catch (Exception ignore) {
}
}
@Test
public void test(SessionFactoryScope scope) {
//tag::basic-custom-type-BitSetType-persistence-example[]
BitSet bitSet = BitSet.valueOf( new long[] {1, 2, 3} );
scope.inTransaction( session -> {
Product product = new Product( );
product.setId( 1 );
product.setBitSet( bitSet );
session.persist( product );
} );
scope.inTransaction( session -> {
Product product = session.find( Product.class, 1 );
assertEquals(bitSet, product.getBitSet());
} );
//end::basic-custom-type-BitSetType-persistence-example[]
}
//tag::basic-custom-type-BitSetType-mapping-example[]
@Entity(name = "Product")
public static | BitSetTypeTest |
java | apache__hadoop | hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/policies/manager/AbstractPolicyManager.java | {
"start": 1845,
"end": 8085
} | class ____ implements
FederationPolicyManager {
private String queue;
@SuppressWarnings("checkstyle:visibilitymodifier")
protected Class routerFederationPolicy;
@SuppressWarnings("checkstyle:visibilitymodifier")
protected Class amrmProxyFederationPolicy;
public static final Logger LOG =
LoggerFactory.getLogger(AbstractPolicyManager.class);
/**
* This default implementation validates the
* {@link FederationPolicyInitializationContext},
* then checks whether it needs to reinstantiate the class (null or
* mismatching type), and reinitialize the policy.
*
* @param federationPolicyContext the current context
* @param oldInstance the existing (possibly null) instance.
*
* @return a valid and fully reinitialized {@link FederationAMRMProxyPolicy}
* instance
*
* @throws FederationPolicyInitializationException if the reinitialization is
* not valid, and ensure
* previous state is preserved
*/
public FederationAMRMProxyPolicy getAMRMPolicy(
FederationPolicyInitializationContext federationPolicyContext,
FederationAMRMProxyPolicy oldInstance)
throws FederationPolicyInitializationException {
if (amrmProxyFederationPolicy == null) {
throw new FederationPolicyInitializationException("The parameter "
+ "amrmProxyFederationPolicy should be initialized in "
+ this.getClass().getSimpleName() + " constructor.");
}
try {
return (FederationAMRMProxyPolicy) internalPolicyGetter(
federationPolicyContext, oldInstance, amrmProxyFederationPolicy);
} catch (ClassCastException e) {
throw new FederationPolicyInitializationException(e);
}
}
/**
* This default implementation validates the
* {@link FederationPolicyInitializationContext},
* then checks whether it needs to reinstantiate the class (null or
* mismatching type), and reinitialize the policy.
*
* @param federationPolicyContext the current context
* @param oldInstance the existing (possibly null) instance.
*
* @return a valid and fully reinitialized {@link FederationRouterPolicy}
* instance
*
* @throws FederationPolicyInitializationException if the reinitialization is
* not valid, and ensure
* previous state is preserved
*/
public FederationRouterPolicy getRouterPolicy(
FederationPolicyInitializationContext federationPolicyContext,
FederationRouterPolicy oldInstance)
throws FederationPolicyInitializationException {
//checks that sub-types properly initialize the types of policies
if (routerFederationPolicy == null) {
throw new FederationPolicyInitializationException("The policy "
+ "type should be initialized in " + this.getClass().getSimpleName()
+ " constructor.");
}
try {
return (FederationRouterPolicy) internalPolicyGetter(
federationPolicyContext, oldInstance, routerFederationPolicy);
} catch (ClassCastException e) {
throw new FederationPolicyInitializationException(e);
}
}
@Override
public SubClusterPolicyConfiguration serializeConf()
throws FederationPolicyInitializationException {
// default implementation works only for sub-classes which do not require
// any parameters
ByteBuffer buf = ByteBuffer.allocate(0);
return SubClusterPolicyConfiguration
.newInstance(getQueue(), this.getClass().getCanonicalName(), buf);
}
@Override
public String getQueue() {
return queue;
}
@Override
public void setQueue(String queue) {
this.queue = queue;
}
/**
* Common functionality to instantiate a reinitialize a {@link
* ConfigurableFederationPolicy}.
*/
private ConfigurableFederationPolicy internalPolicyGetter(
final FederationPolicyInitializationContext federationPolicyContext,
ConfigurableFederationPolicy oldInstance, Class policy)
throws FederationPolicyInitializationException {
FederationPolicyInitializationContextValidator
.validate(federationPolicyContext, this.getClass().getCanonicalName());
if (oldInstance == null || !oldInstance.getClass().equals(policy)) {
try {
oldInstance = (ConfigurableFederationPolicy) policy.newInstance();
} catch (InstantiationException e) {
throw new FederationPolicyInitializationException(e);
} catch (IllegalAccessException e) {
throw new FederationPolicyInitializationException(e);
}
}
//copying the context to avoid side-effects
FederationPolicyInitializationContext modifiedContext =
updateContext(federationPolicyContext,
oldInstance.getClass().getCanonicalName());
oldInstance.reinitialize(modifiedContext);
return oldInstance;
}
/**
* This method is used to copy-on-write the context, that will be passed
* downstream to the router/amrmproxy policies.
*/
private FederationPolicyInitializationContext updateContext(
FederationPolicyInitializationContext federationPolicyContext,
String type) {
// copying configuration and context to avoid modification of original
SubClusterPolicyConfiguration newConf = SubClusterPolicyConfiguration
.newInstance(federationPolicyContext
.getSubClusterPolicyConfiguration());
newConf.setType(type);
return new FederationPolicyInitializationContext(newConf,
federationPolicyContext.getFederationSubclusterResolver(),
federationPolicyContext.getFederationStateStoreFacade(),
federationPolicyContext.getHomeSubcluster());
}
/**
* We get the WeightedPolicyInfo of the subCluster.
*
* @return WeightedPolicyInfo.
*/
public abstract WeightedPolicyInfo getWeightedPolicyInfo();
/**
* We set the WeightedPolicyInfo of the subCluster.
*
* @param weightedPolicyInfo weightedPolicyInfo of the subCluster.
*/
public abstract void setWeightedPolicyInfo(WeightedPolicyInfo weightedPolicyInfo);
}
| AbstractPolicyManager |
java | apache__camel | components/camel-hl7/src/generated/java/org/apache/camel/component/hl7/HL724ConverterLoader.java | {
"start": 879,
"end": 150419
} | class ____ implements TypeConverterLoader, CamelContextAware {
private CamelContext camelContext;
public HL724ConverterLoader() {
}
@Override
public void setCamelContext(CamelContext camelContext) {
this.camelContext = camelContext;
}
@Override
public CamelContext getCamelContext() {
return camelContext;
}
@Override
public void load(TypeConverterRegistry registry) throws TypeConverterLoaderException {
try {
registerConverters(registry);
} catch (Throwable e) {
// ignore on load error
}
}
private void registerConverters(TypeConverterRegistry registry) {
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ACK.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toACK((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ACK.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toACK((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ADR_A19.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toAdrA19((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ADR_A19.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toAdrA19((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ADT_A01.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toAdtA01((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ADT_A01.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toAdtA01((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ADT_A02.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toAdtA02((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ADT_A02.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toAdtA02((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ADT_A03.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toAdtA03((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ADT_A03.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toAdtA03((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ADT_A05.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toAdtA05((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ADT_A05.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toAdtA05((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ADT_A06.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toAdtA06((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ADT_A06.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toAdtA06((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ADT_A09.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toAdtA09((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ADT_A09.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toAdtA09((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ADT_A15.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toAdtA15((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ADT_A15.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toAdtA15((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ADT_A16.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toAdtA16((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ADT_A16.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toAdtA16((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ADT_A17.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toAdtA17((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ADT_A17.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toAdtA17((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ADT_A18.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toAdtA18((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ADT_A18.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toAdtA18((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ADT_A20.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toAdtA20((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ADT_A20.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toAdtA20((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ADT_A21.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toAdtA21((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ADT_A21.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toAdtA21((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ADT_A24.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toAdtA24((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ADT_A24.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toAdtA24((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ADT_A30.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toAdtA30((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ADT_A30.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toAdtA30((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ADT_A37.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toAdtA37((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ADT_A37.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toAdtA37((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ADT_A38.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toAdtA38((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ADT_A38.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toAdtA38((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ADT_A39.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toAdtA39((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ADT_A39.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toAdtA39((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ADT_A43.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toAdtA43((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ADT_A43.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toAdtA43((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ADT_A45.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toAdtA45((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ADT_A45.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toAdtA45((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ADT_A50.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toAdtA50((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ADT_A50.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toAdtA50((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ADT_A52.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toAdtA52((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ADT_A52.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toAdtA52((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ADT_A54.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toAdtA54((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ADT_A54.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toAdtA54((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ADT_A60.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toAdtA60((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ADT_A60.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toAdtA60((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ADT_A61.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toAdtA61((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ADT_A61.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toAdtA61((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ADT_AXX.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toAdtAXX((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ADT_AXX.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toAdtAXX((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.BAR_P01.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toBarP01((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.BAR_P01.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toBarP01((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.BAR_P02.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toBarP02((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.BAR_P02.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toBarP02((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.BAR_P05.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toBarP05((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.BAR_P05.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toBarP05((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.BAR_P06.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toBarP06((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.BAR_P06.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toBarP06((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.BAR_P10.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toBarP10((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.BAR_P10.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toBarP10((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.CRM_C01.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toCrmC01((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.CRM_C01.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toCrmC01((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.CSU_C09.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toCsuC09((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.CSU_C09.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toCsuC09((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.DFT_P03.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toDftP03((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.DFT_P03.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toDftP03((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.DFT_P11.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toDftP11((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.DFT_P11.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toDftP11((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.DOC_T12.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toDocT12((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.DOC_T12.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toDocT12((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.DSR_Q01.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toDsrQ01((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.DSR_Q01.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toDsrQ01((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.DSR_Q03.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toDsrQ03((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.DSR_Q03.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toDsrQ03((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.EAC_U07.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toEacU07((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.EAC_U07.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toEacU07((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.EAN_U09.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toEanU09((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.EAN_U09.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toEanU09((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.EAR_U08.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toEarU08((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.EAR_U08.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toEarU08((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.EDR_R07.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toEdrR07((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.EDR_R07.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toEdrR07((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.EQQ_Q04.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toEqqQ04((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.EQQ_Q04.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toEqqQ04((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ERP_R09.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toErpR09((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ERP_R09.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toErpR09((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ESR_U02.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toEsrU02((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ESR_U02.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toEsrU02((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ESU_U01.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toEsuU01((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ESU_U01.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toEsuU01((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.INR_U06.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toInrU06((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.INR_U06.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toInrU06((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.INU_U05.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toInuU05((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.INU_U05.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toInuU05((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.LSU_U12.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toLsuU12((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.LSU_U12.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toLsuU12((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.MDM_T01.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toMdmT01((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.MDM_T01.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toMdmT01((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.MDM_T02.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toMdmT02((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.MDM_T02.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toMdmT02((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.MFK_M01.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toMfkM01((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.MFK_M01.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toMfkM01((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.MFN_M01.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toMfnM01((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.MFN_M01.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toMfnM01((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.MFN_M02.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toMfnM02((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.MFN_M02.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toMfnM02((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.MFN_M03.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toMfnM03((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.MFN_M03.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toMfnM03((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.MFN_M04.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toMfnM04((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.MFN_M04.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toMfnM04((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.MFN_M05.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toMfnM05((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.MFN_M05.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toMfnM05((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.MFN_M06.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toMfnM06((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.MFN_M06.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toMfnM06((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.MFN_M07.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toMfnM07((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.MFN_M07.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toMfnM07((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.MFN_M08.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toMfnM08((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.MFN_M08.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toMfnM08((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.MFN_M09.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toMfnM09((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.MFN_M09.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toMfnM09((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.MFN_M10.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toMfnM10((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.MFN_M10.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toMfnM10((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.MFN_M11.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toMfnM11((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.MFN_M11.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toMfnM11((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.MFN_M12.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toMfnM12((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.MFN_M12.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toMfnM12((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.MFQ_M01.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toMfqM01((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.MFQ_M01.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toMfqM01((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.MFR_M01.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toMfrM01((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.MFR_M01.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toMfrM01((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.NMD_N02.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toNmdN02((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.NMD_N02.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toNmdN02((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.NMQ_N01.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toNmqN01((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.NMQ_N01.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toNmqN01((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.NMR_N01.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toNmrN01((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.NMR_N01.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toNmrN01((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.OMD_O03.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toOmdO03((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.OMD_O03.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toOmdO03((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.OMG_O19.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toOmgO19((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.OMG_O19.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toOmgO19((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.OML_O21.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toOmlO21((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.OML_O21.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toOmlO21((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.OMN_O07.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toOmnO07((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.OMN_O07.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toOmnO07((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.OMP_O09.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toOmpO09((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.OMP_O09.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toOmpO09((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.OMS_O05.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toOmsO05((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.OMS_O05.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toOmsO05((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ORD_O04.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toOrdO04((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ORD_O04.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toOrdO04((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ORF_R04.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toOrfR04((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ORF_R04.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toOrfR04((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ORG_O20.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toOrgO20((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ORG_O20.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toOrgO20((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ORL_O22.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toOrlO22((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ORL_O22.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toOrlO22((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ORM_O01.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toOrmO01((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ORM_O01.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toOrmO01((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ORN_O08.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toOrnO08((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ORN_O08.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toOrnO08((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ORP_O10.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toOrpO10((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ORP_O10.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toOrpO10((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ORR_O02.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toOrrO02((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ORR_O02.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toOrrO02((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ORS_O06.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toOrsO06((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ORS_O06.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toOrsO06((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ORU_R01.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toOruR01((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ORU_R01.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toOruR01((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.OSQ_Q06.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toOsqQ06((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.OSQ_Q06.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toOsqQ06((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.OSR_Q06.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toOsrQ06((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.OSR_Q06.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toOsrQ06((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.OUL_R21.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toOulR21((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.OUL_R21.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toOulR21((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.PEX_P07.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toPexP07((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.PEX_P07.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toPexP07((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.PGL_PC6.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toPglPc6((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.PGL_PC6.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toPglPc6((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.PMU_B01.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toPmuB01((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.PMU_B01.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toPmuB01((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.PMU_B03.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toPmuB03((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.PMU_B03.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toPmuB03((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.PMU_B04.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toPmuB04((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.PMU_B04.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toPmuB04((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.PPG_PCG.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toPpgPcg((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.PPG_PCG.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toPpgPcg((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.PPP_PCB.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toPppPcb((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.PPP_PCB.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toPppPcb((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.PPR_PC1.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toPprPc1((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.PPR_PC1.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toPprPc1((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.PPT_PCL.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toPptPcl((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.PPT_PCL.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toPptPcl((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.PPV_PCA.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toPpvPca((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.PPV_PCA.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toPpvPca((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.PRR_PC5.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toPrrPc5((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.PRR_PC5.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toPrrPc5((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.PTR_PCF.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toPtrPcf((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.PTR_PCF.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toPtrPcf((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.QBP_K13.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toQbpK13((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.QBP_K13.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toQbpK13((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.QBP_Q11.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toQbpQ11((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.QBP_Q11.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toQbpQ11((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.QBP_Q13.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toQbpQ13((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.QBP_Q13.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toQbpQ13((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.QBP_Q15.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toQbpQ15((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.QBP_Q15.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toQbpQ15((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.QBP_Q21.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toQbpQ21((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.QBP_Q21.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toQbpQ21((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.QBP_Qnn.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toQbpQnn((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.QBP_Qnn.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toQbpQnn((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.QBP_Z73.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toQbpZ73((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.QBP_Z73.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toQbpZ73((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.QCK_Q02.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toQckQ02((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.QCK_Q02.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toQckQ02((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.QCN_J01.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toQcnJ01((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.QCN_J01.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toQcnJ01((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.QRY_A19.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toQryA19((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.QRY_A19.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toQryA19((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.QRY_PC4.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toQryPC4((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.QRY_PC4.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toQryPC4((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.QRY_Q01.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toQryQ01((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.QRY_Q01.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toQryQ01((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.QRY_Q02.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toQryQ02((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.QRY_Q02.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toQryQ02((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.QRY_R02.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toQryR02((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.QRY_R02.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toQryR02((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.QRY_T12.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toQryT12((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.QRY_T12.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toQryT12((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.QSB_Q16.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toQsbQ16((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.QSB_Q16.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toQsbQ16((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.QVR_Q17.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toQvrQ17((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.QVR_Q17.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toQvrQ17((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RAR_RAR.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRarRar((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RAR_RAR.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRarRar((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RAS_O17.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRasO17((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RAS_O17.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRasO17((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RCI_I05.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRciI05((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RCI_I05.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRciI05((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RCL_I06.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRclI06((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RCL_I06.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRclI06((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RDE_O11.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRdeO11((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RDE_O11.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRdeO11((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RDR_RDR.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRdrRdr((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RDR_RDR.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRdrRdr((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RDS_O13.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRdsO13((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RDS_O13.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRdsO13((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RDY_K15.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRdyK15((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RDY_K15.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRdyK15((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.REF_I12.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRefI12((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.REF_I12.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRefI12((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RER_RER.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRerRer((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RER_RER.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRerRer((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RGR_RGR.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRgrRgr((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RGR_RGR.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRgrRgr((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RGV_O15.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRgvO15((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RGV_O15.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRgvO15((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ROR_ROR.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRorRor((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.ROR_ROR.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRorRor((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RPA_I08.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRpaI08((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RPA_I08.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRpaI08((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RPI_I01.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRpiI01((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RPI_I01.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRpiI01((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RPI_I04.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRpiI04((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RPI_I04.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRpiI04((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RPL_I02.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRplI02((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RPL_I02.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRplI02((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RPR_I03.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRprI03((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RPR_I03.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRprI03((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RQA_I08.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRqaI08((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RQA_I08.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRqaI08((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RQC_I05.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRqcI05((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RQC_I05.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRqcI05((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RQI_I01.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRqiI01((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RQI_I01.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRqiI01((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RQP_I04.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRqpI04((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RQP_I04.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRqpI04((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RQQ_Q09.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRqqQ09((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RQQ_Q09.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRqqQ09((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RRA_O18.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRraO18((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RRA_O18.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRraO18((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RRD_O14.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRrdO14((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RRD_O14.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRrdO14((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RRE_O12.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRreO12((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RRE_O12.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRreO12((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RRG_O16.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRrgO16((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RRG_O16.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRrgO16((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RRI_I12.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRriI12((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RRI_I12.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRriI12((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RSP_K11.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRspK11((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RSP_K11.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRspK11((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RSP_K13.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRspK13((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RSP_K13.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRspK13((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RSP_K15.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRspK15((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RSP_K15.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRspK15((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RSP_K21.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRspK21((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RSP_K21.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRspK21((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RSP_K22.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRspK22((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RSP_K22.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRspK22((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RSP_K23.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRspK23((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RSP_K23.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRspK23((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RSP_K24.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRspK24((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RSP_K24.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRspK24((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RSP_K25.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRspK25((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RSP_K25.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRspK25((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RSP_Z82.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRspZ82((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RSP_Z82.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRspZ82((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RSP_Z86.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRspZ86((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RSP_Z86.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRspZ86((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RSP_Z88.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRspZ88((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RSP_Z88.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRspZ88((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RSP_Z90.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRspZ90((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RSP_Z90.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRspZ90((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RTB_K13.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRtbK13((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RTB_K13.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRtbK13((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RTB_Knn.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRtbKnn((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RTB_Knn.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRtbKnn((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RTB_Q13.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRtbQ13((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RTB_Q13.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRtbQ13((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RTB_Z74.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRtbZ74((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.RTB_Z74.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toRtbZ74((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.SIU_S12.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toSiuS12((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.SIU_S12.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toSiuS12((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.SPQ_Q08.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toSpqQ08((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.SPQ_Q08.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toSpqQ08((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.SQM_S25.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toSqmS25((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.SQM_S25.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toSqmS25((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.SQR_S25.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toSqrS25((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.SQR_S25.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toSqrS25((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.SRM_S01.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toSrmS01((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.SRM_S01.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toSrmS01((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.SRR_S01.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toSrrS01((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.SRR_S01.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toSrrS01((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.SSR_U04.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toSsrU04((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.SSR_U04.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toSsrU04((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.SSU_U03.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toSsuU03((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.SSU_U03.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toSsuU03((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.SUR_P09.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toSurP09((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.SUR_P09.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toSurP09((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.TBR_R08.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toTbrR08((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.TBR_R08.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toTbrR08((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.TCU_U10.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toTcuU10((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.TCU_U10.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toTcuU10((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.UDM_Q05.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toUdmQ05((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.UDM_Q05.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toUdmQ05((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.VQQ_Q07.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toVqqQ07((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.VQQ_Q07.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toVqqQ07((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.VXQ_V01.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toVxqV01((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.VXQ_V01.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toVxqV01((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.VXR_V03.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toVxrV03((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.VXR_V03.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toVxrV03((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.VXU_V04.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toVxuV04((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.VXU_V04.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toVxuV04((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.VXX_V02.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toVxxV02((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v24.message.VXX_V02.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL724Converter.toVxxV02((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
}
private static void addTypeConverter(TypeConverterRegistry registry, Class<?> toType, Class<?> fromType, boolean allowNull, SimpleTypeConverter.ConversionMethod method) {
registry.addTypeConverter(toType, fromType, new SimpleTypeConverter(allowNull, method));
}
}
| HL724ConverterLoader |
java | apache__hadoop | hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/RandomTextWriter.java | {
"start": 4167,
"end": 40782
} | class ____ extends Mapper<Text, Text, Text, Text> {
private long numBytesToWrite;
private int minWordsInKey;
private int wordsInKeyRange;
private int minWordsInValue;
private int wordsInValueRange;
/**
* Save the configuration value that we need to write the data.
*/
public void setup(Context context) {
Configuration conf = context.getConfiguration();
numBytesToWrite = conf.getLong(BYTES_PER_MAP,
1*1024*1024*1024);
minWordsInKey = conf.getInt(MIN_KEY, 5);
wordsInKeyRange = (conf.getInt(MAX_KEY, 10) - minWordsInKey);
minWordsInValue = conf.getInt(MIN_VALUE, 10);
wordsInValueRange = (conf.getInt(MAX_VALUE, 100) - minWordsInValue);
}
/**
* Given an output filename, write a bunch of random records to it.
*/
public void map(Text key, Text value,
Context context) throws IOException,InterruptedException {
int itemCount = 0;
ThreadLocalRandom rand = ThreadLocalRandom.current();
while (numBytesToWrite > 0) {
// Generate the key/value
int noWordsKey = minWordsInKey +
(wordsInKeyRange != 0 ? rand.nextInt(wordsInKeyRange) : 0);
int noWordsValue = minWordsInValue +
(wordsInValueRange != 0 ? rand.nextInt(wordsInValueRange) : 0);
Text keyWords = generateSentence(noWordsKey);
Text valueWords = generateSentence(noWordsValue);
// Write the sentence
context.write(keyWords, valueWords);
numBytesToWrite -= (keyWords.getLength() + valueWords.getLength());
// Update counters, progress etc.
context.getCounter(Counters.BYTES_WRITTEN).increment(
keyWords.getLength() + valueWords.getLength());
context.getCounter(Counters.RECORDS_WRITTEN).increment(1);
if (++itemCount % 200 == 0) {
context.setStatus("wrote record " + itemCount + ". " +
numBytesToWrite + " bytes left.");
}
}
context.setStatus("done with " + itemCount + " records.");
}
private Text generateSentence(int noWords) {
String sentence =
generateSentenceWithRand(ThreadLocalRandom.current(), noWords);
return new Text(sentence);
}
}
/**
* This is the main routine for launching a distributed random write job.
* It runs 10 maps/node and each node writes 1 gig of data to a DFS file.
* The reduce doesn't do anything.
*
* @throws IOException
*/
public int run(String[] args) throws Exception {
if (args.length == 0) {
return printUsage();
}
Configuration conf = getConf();
JobClient client = new JobClient(conf);
ClusterStatus cluster = client.getClusterStatus();
int numMapsPerHost = conf.getInt(MAPS_PER_HOST, 10);
long numBytesToWritePerMap = conf.getLong(BYTES_PER_MAP,
1*1024*1024*1024);
if (numBytesToWritePerMap == 0) {
System.err.println("Cannot have " + BYTES_PER_MAP +" set to 0");
return -2;
}
long totalBytesToWrite = conf.getLong(TOTAL_BYTES,
numMapsPerHost*numBytesToWritePerMap*cluster.getTaskTrackers());
int numMaps = (int) (totalBytesToWrite / numBytesToWritePerMap);
if (numMaps == 0 && totalBytesToWrite > 0) {
numMaps = 1;
conf.setLong(BYTES_PER_MAP, totalBytesToWrite);
}
conf.setInt(MRJobConfig.NUM_MAPS, numMaps);
Job job = Job.getInstance(conf);
job.setJarByClass(RandomTextWriter.class);
job.setJobName("random-text-writer");
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(Text.class);
job.setInputFormatClass(RandomWriter.RandomInputFormat.class);
job.setMapperClass(RandomTextMapper.class);
Class<? extends OutputFormat> outputFormatClass =
SequenceFileOutputFormat.class;
List<String> otherArgs = new ArrayList<String>();
for(int i=0; i < args.length; ++i) {
try {
if ("-outFormat".equals(args[i])) {
outputFormatClass =
Class.forName(args[++i]).asSubclass(OutputFormat.class);
} else {
otherArgs.add(args[i]);
}
} catch (ArrayIndexOutOfBoundsException except) {
System.out.println("ERROR: Required parameter missing from " +
args[i-1]);
return printUsage(); // exits
}
}
job.setOutputFormatClass(outputFormatClass);
FileOutputFormat.setOutputPath(job, new Path(otherArgs.get(0)));
System.out.println("Running " + numMaps + " maps.");
// reducer NONE
job.setNumReduceTasks(0);
Date startTime = new Date();
System.out.println("Job started: " + startTime);
int ret = job.waitForCompletion(true) ? 0 : 1;
Date endTime = new Date();
System.out.println("Job ended: " + endTime);
System.out.println("The job took " +
(endTime.getTime() - startTime.getTime()) /1000 +
" seconds.");
return ret;
}
public static void main(String[] args) throws Exception {
int res = ToolRunner.run(new Configuration(), new RandomTextWriter(), args);
System.exit(res);
}
/**
* A random list of 1000 words from /usr/share/dict/words
*/
private static String[] words = {
"diurnalness", "Homoiousian",
"spiranthic", "tetragynian",
"silverhead", "ungreat",
"lithograph", "exploiter",
"physiologian", "by",
"hellbender", "Filipendula",
"undeterring", "antiscolic",
"pentagamist", "hypoid",
"cacuminal", "sertularian",
"schoolmasterism", "nonuple",
"gallybeggar", "phytonic",
"swearingly", "nebular",
"Confervales", "thermochemically",
"characinoid", "cocksuredom",
"fallacious", "feasibleness",
"debromination", "playfellowship",
"tramplike", "testa",
"participatingly", "unaccessible",
"bromate", "experientialist",
"roughcast", "docimastical",
"choralcelo", "blightbird",
"peptonate", "sombreroed",
"unschematized", "antiabolitionist",
"besagne", "mastication",
"bromic", "sviatonosite",
"cattimandoo", "metaphrastical",
"endotheliomyoma", "hysterolysis",
"unfulminated", "Hester",
"oblongly", "blurredness",
"authorling", "chasmy",
"Scorpaenidae", "toxihaemia",
"Dictograph", "Quakerishly",
"deaf", "timbermonger",
"strammel", "Thraupidae",
"seditious", "plerome",
"Arneb", "eristically",
"serpentinic", "glaumrie",
"socioromantic", "apocalypst",
"tartrous", "Bassaris",
"angiolymphoma", "horsefly",
"kenno", "astronomize",
"euphemious", "arsenide",
"untongued", "parabolicness",
"uvanite", "helpless",
"gemmeous", "stormy",
"templar", "erythrodextrin",
"comism", "interfraternal",
"preparative", "parastas",
"frontoorbital", "Ophiosaurus",
"diopside", "serosanguineous",
"ununiformly", "karyological",
"collegian", "allotropic",
"depravity", "amylogenesis",
"reformatory", "epidymides",
"pleurotropous", "trillium",
"dastardliness", "coadvice",
"embryotic", "benthonic",
"pomiferous", "figureheadship",
"Megaluridae", "Harpa",
"frenal", "commotion",
"abthainry", "cobeliever",
"manilla", "spiciferous",
"nativeness", "obispo",
"monilioid", "biopsic",
"valvula", "enterostomy",
"planosubulate", "pterostigma",
"lifter", "triradiated",
"venialness", "tum",
"archistome", "tautness",
"unswanlike", "antivenin",
"Lentibulariaceae", "Triphora",
"angiopathy", "anta",
"Dawsonia", "becomma",
"Yannigan", "winterproof",
"antalgol", "harr",
"underogating", "ineunt",
"cornberry", "flippantness",
"scyphostoma", "approbation",
"Ghent", "Macraucheniidae",
"scabbiness", "unanatomized",
"photoelasticity", "eurythermal",
"enation", "prepavement",
"flushgate", "subsequentially",
"Edo", "antihero",
"Isokontae", "unforkedness",
"porriginous", "daytime",
"nonexecutive", "trisilicic",
"morphiomania", "paranephros",
"botchedly", "impugnation",
"Dodecatheon", "obolus",
"unburnt", "provedore",
"Aktistetae", "superindifference",
"Alethea", "Joachimite",
"cyanophilous", "chorograph",
"brooky", "figured",
"periclitation", "quintette",
"hondo", "ornithodelphous",
"unefficient", "pondside",
"bogydom", "laurinoxylon",
"Shiah", "unharmed",
"cartful", "noncrystallized",
"abusiveness", "cromlech",
"japanned", "rizzomed",
"underskin", "adscendent",
"allectory", "gelatinousness",
"volcano", "uncompromisingly",
"cubit", "idiotize",
"unfurbelowed", "undinted",
"magnetooptics", "Savitar",
"diwata", "ramosopalmate",
"Pishquow", "tomorn",
"apopenptic", "Haversian",
"Hysterocarpus", "ten",
"outhue", "Bertat",
"mechanist", "asparaginic",
"velaric", "tonsure",
"bubble", "Pyrales",
"regardful", "glyphography",
"calabazilla", "shellworker",
"stradametrical", "havoc",
"theologicopolitical", "sawdust",
"diatomaceous", "jajman",
"temporomastoid", "Serrifera",
"Ochnaceae", "aspersor",
"trailmaking", "Bishareen",
"digitule", "octogynous",
"epididymitis", "smokefarthings",
"bacillite", "overcrown",
"mangonism", "sirrah",
"undecorated", "psychofugal",
"bismuthiferous", "rechar",
"Lemuridae", "frameable",
"thiodiazole", "Scanic",
"sportswomanship", "interruptedness",
"admissory", "osteopaedion",
"tingly", "tomorrowness",
"ethnocracy", "trabecular",
"vitally", "fossilism",
"adz", "metopon",
"prefatorial", "expiscate",
"diathermacy", "chronist",
"nigh", "generalizable",
"hysterogen", "aurothiosulphuric",
"whitlowwort", "downthrust",
"Protestantize", "monander",
"Itea", "chronographic",
"silicize", "Dunlop",
"eer", "componental",
"spot", "pamphlet",
"antineuritic", "paradisean",
"interruptor", "debellator",
"overcultured", "Florissant",
"hyocholic", "pneumatotherapy",
"tailoress", "rave",
"unpeople", "Sebastian",
"thermanesthesia", "Coniferae",
"swacking", "posterishness",
"ethmopalatal", "whittle",
"analgize", "scabbardless",
"naught", "symbiogenetically",
"trip", "parodist",
"columniform", "trunnel",
"yawler", "goodwill",
"pseudohalogen", "swangy",
"cervisial", "mediateness",
"genii", "imprescribable",
"pony", "consumptional",
"carposporangial", "poleax",
"bestill", "subfebrile",
"sapphiric", "arrowworm",
"qualminess", "ultraobscure",
"thorite", "Fouquieria",
"Bermudian", "prescriber",
"elemicin", "warlike",
"semiangle", "rotular",
"misthread", "returnability",
"seraphism", "precostal",
"quarried", "Babylonism",
"sangaree", "seelful",
"placatory", "pachydermous",
"bozal", "galbulus",
"spermaphyte", "cumbrousness",
"pope", "signifier",
"Endomycetaceae", "shallowish",
"sequacity", "periarthritis",
"bathysphere", "pentosuria",
"Dadaism", "spookdom",
"Consolamentum", "afterpressure",
"mutter", "louse",
"ovoviviparous", "corbel",
"metastoma", "biventer",
"Hydrangea", "hogmace",
"seizing", "nonsuppressed",
"oratorize", "uncarefully",
"benzothiofuran", "penult",
"balanocele", "macropterous",
"dishpan", "marten",
"absvolt", "jirble",
"parmelioid", "airfreighter",
"acocotl", "archesporial",
"hypoplastral", "preoral",
"quailberry", "cinque",
"terrestrially", "stroking",
"limpet", "moodishness",
"canicule", "archididascalian",
"pompiloid", "overstaid",
"introducer", "Italical",
"Christianopaganism", "prescriptible",
"subofficer", "danseuse",
"cloy", "saguran",
"frictionlessly", "deindividualization",
"Bulanda", "ventricous",
"subfoliar", "basto",
"scapuloradial", "suspend",
"stiffish", "Sphenodontidae",
"eternal", "verbid",
"mammonish", "upcushion",
"barkometer", "concretion",
"preagitate", "incomprehensible",
"tristich", "visceral",
"hemimelus", "patroller",
"stentorophonic", "pinulus",
"kerykeion", "brutism",
"monstership", "merciful",
"overinstruct", "defensibly",
"bettermost", "splenauxe",
"Mormyrus", "unreprimanded",
"taver", "ell",
"proacquittal", "infestation",
"overwoven", "Lincolnlike",
"chacona", "Tamil",
"classificational", "lebensraum",
"reeveland", "intuition",
"Whilkut", "focaloid",
"Eleusinian", "micromembrane",
"byroad", "nonrepetition",
"bacterioblast", "brag",
"ribaldrous", "phytoma",
"counteralliance", "pelvimetry",
"pelf", "relaster",
"thermoresistant", "aneurism",
"molossic", "euphonym",
"upswell", "ladhood",
"phallaceous", "inertly",
"gunshop", "stereotypography",
"laryngic", "refasten",
"twinling", "oflete",
"hepatorrhaphy", "electrotechnics",
"cockal", "guitarist",
"topsail", "Cimmerianism",
"larklike", "Llandovery",
"pyrocatechol", "immatchable",
"chooser", "metrocratic",
"craglike", "quadrennial",
"nonpoisonous", "undercolored",
"knob", "ultratense",
"balladmonger", "slait",
"sialadenitis", "bucketer",
"magnificently", "unstipulated",
"unscourged", "unsupercilious",
"packsack", "pansophism",
"soorkee", "percent",
"subirrigate", "champer",
"metapolitics", "spherulitic",
"involatile", "metaphonical",
"stachyuraceous", "speckedness",
"bespin", "proboscidiform",
"gul", "squit",
"yeelaman", "peristeropode",
"opacousness", "shibuichi",
"retinize", "yote",
"misexposition", "devilwise",
"pumpkinification", "vinny",
"bonze", "glossing",
"decardinalize", "transcortical",
"serphoid", "deepmost",
"guanajuatite", "wemless",
"arval", "lammy",
"Effie", "Saponaria",
"tetrahedral", "prolificy",
"excerpt", "dunkadoo",
"Spencerism", "insatiately",
"Gilaki", "oratorship",
"arduousness", "unbashfulness",
"Pithecolobium", "unisexuality",
"veterinarian", "detractive",
"liquidity", "acidophile",
"proauction", "sural",
"totaquina", "Vichyite",
"uninhabitedness", "allegedly",
"Gothish", "manny",
"Inger", "flutist",
"ticktick", "Ludgatian",
"homotransplant", "orthopedical",
"diminutively", "monogoneutic",
"Kenipsim", "sarcologist",
"drome", "stronghearted",
"Fameuse", "Swaziland",
"alen", "chilblain",
"beatable", "agglomeratic",
"constitutor", "tendomucoid",
"porencephalous", "arteriasis",
"boser", "tantivy",
"rede", "lineamental",
"uncontradictableness", "homeotypical",
"masa", "folious",
"dosseret", "neurodegenerative",
"subtransverse", "Chiasmodontidae",
"palaeotheriodont", "unstressedly",
"chalcites", "piquantness",
"lampyrine", "Aplacentalia",
"projecting", "elastivity",
"isopelletierin", "bladderwort",
"strander", "almud",
"iniquitously", "theologal",
"bugre", "chargeably",
"imperceptivity", "meriquinoidal",
"mesophyte", "divinator",
"perfunctory", "counterappellant",
"synovial", "charioteer",
"crystallographical", "comprovincial",
"infrastapedial", "pleasurehood",
"inventurous", "ultrasystematic",
"subangulated", "supraoesophageal",
"Vaishnavism", "transude",
"chrysochrous", "ungrave",
"reconciliable", "uninterpleaded",
"erlking", "wherefrom",
"aprosopia", "antiadiaphorist",
"metoxazine", "incalculable",
"umbellic", "predebit",
"foursquare", "unimmortal",
"nonmanufacture", "slangy",
"predisputant", "familist",
"preaffiliate", "friarhood",
"corelysis", "zoonitic",
"halloo", "paunchy",
"neuromimesis", "aconitine",
"hackneyed", "unfeeble",
"cubby", "autoschediastical",
"naprapath", "lyrebird",
"inexistency", "leucophoenicite",
"ferrogoslarite", "reperuse",
"uncombable", "tambo",
"propodiale", "diplomatize",
"Russifier", "clanned",
"corona", "michigan",
"nonutilitarian", "transcorporeal",
"bought", "Cercosporella",
"stapedius", "glandularly",
"pictorially", "weism",
"disilane", "rainproof",
"Caphtor", "scrubbed",
"oinomancy", "pseudoxanthine",
"nonlustrous", "redesertion",
"Oryzorictinae", "gala",
"Mycogone", "reappreciate",
"cyanoguanidine", "seeingness",
"breadwinner", "noreast",
"furacious", "epauliere",
"omniscribent", "Passiflorales",
"uninductive", "inductivity",
"Orbitolina", "Semecarpus",
"migrainoid", "steprelationship",
"phlogisticate", "mesymnion",
"sloped", "edificator",
"beneficent", "culm",
"paleornithology", "unurban",
"throbless", "amplexifoliate",
"sesquiquintile", "sapience",
"astucious", "dithery",
"boor", "ambitus",
"scotching", "uloid",
"uncompromisingness", "hoove",
"waird", "marshiness",
"Jerusalem", "mericarp",
"unevoked", "benzoperoxide",
"outguess", "pyxie",
"hymnic", "euphemize",
"mendacity", "erythremia",
"rosaniline", "unchatteled",
"lienteria", "Bushongo",
"dialoguer", "unrepealably",
"rivethead", "antideflation",
"vinegarish", "manganosiderite",
"doubtingness", "ovopyriform",
"Cephalodiscus", "Muscicapa",
"Animalivora", "angina",
"planispheric", "ipomoein",
"cuproiodargyrite", "sandbox",
"scrat", "Munnopsidae",
"shola", "pentafid",
"overstudiousness", "times",
"nonprofession", "appetible",
"valvulotomy", "goladar",
"uniarticular", "oxyterpene",
"unlapsing", "omega",
"trophonema", "seminonflammable",
"circumzenithal", "starer",
"depthwise", "liberatress",
"unleavened", "unrevolting",
"groundneedle", "topline",
"wandoo", "umangite",
"ordinant", "unachievable",
"oversand", "snare",
"avengeful", "unexplicit",
"mustafina", "sonable",
"rehabilitative", "eulogization",
"papery", "technopsychology",
"impressor", "cresylite",
"entame", "transudatory",
"scotale", "pachydermatoid",
"imaginary", "yeat",
"slipped", "stewardship",
"adatom", "cockstone",
"skyshine", "heavenful",
"comparability", "exprobratory",
"dermorhynchous", "parquet",
"cretaceous", "vesperal",
"raphis", "undangered",
"Glecoma", "engrain",
"counteractively", "Zuludom",
"orchiocatabasis", "Auriculariales",
"warriorwise", "extraorganismal",
"overbuilt", "alveolite",
"tetchy", "terrificness",
"widdle", "unpremonished",
"rebilling", "sequestrum",
"equiconvex", "heliocentricism",
"catabaptist", "okonite",
"propheticism", "helminthagogic",
"calycular", "giantly",
"wingable", "golem",
"unprovided", "commandingness",
"greave", "haply",
"doina", "depressingly",
"subdentate", "impairment",
"decidable", "neurotrophic",
"unpredict", "bicorporeal",
"pendulant", "flatman",
"intrabred", "toplike",
"Prosobranchiata", "farrantly",
"toxoplasmosis", "gorilloid",
"dipsomaniacal", "aquiline",
"atlantite", "ascitic",
"perculsive", "prospectiveness",
"saponaceous", "centrifugalization",
"dinical", "infravaginal",
"beadroll", "affaite",
"Helvidian", "tickleproof",
"abstractionism", "enhedge",
"outwealth", "overcontribute",
"coldfinch", "gymnastic",
"Pincian", "Munychian",
"codisjunct", "quad",
"coracomandibular", "phoenicochroite",
"amender", "selectivity",
"putative", "semantician",
"lophotrichic", "Spatangoidea",
"saccharogenic", "inferent",
"Triconodonta", "arrendation",
"sheepskin", "taurocolla",
"bunghole", "Machiavel",
"triakistetrahedral", "dehairer",
"prezygapophysial", "cylindric",
"pneumonalgia", "sleigher",
"emir", "Socraticism",
"licitness", "massedly",
"instructiveness", "sturdied",
"redecrease", "starosta",
"evictor", "orgiastic",
"squdge", "meloplasty",
"Tsonecan", "repealableness",
"swoony", "myesthesia",
"molecule", "autobiographist",
"reciprocation", "refective",
"unobservantness", "tricae",
"ungouged", "floatability",
"Mesua", "fetlocked",
"chordacentrum", "sedentariness",
"various", "laubanite",
"nectopod", "zenick",
"sequentially", "analgic",
"biodynamics", "posttraumatic",
"nummi", "pyroacetic",
"bot", "redescend",
"dispermy", "undiffusive",
"circular", "trillion",
"Uraniidae", "ploration",
"discipular", "potentness",
"sud", "Hu",
"Eryon", "plugger",
"subdrainage", "jharal",
"abscission", "supermarket",
"countergabion", "glacierist",
"lithotresis", "minniebush",
"zanyism", "eucalypteol",
"sterilely", "unrealize",
"unpatched", "hypochondriacism",
"critically", "cheesecutter",
};
}
| RandomTextMapper |
java | assertj__assertj-core | assertj-core/src/main/java/org/assertj/core/error/ShouldHaveLineCount.java | {
"start": 817,
"end": 1860
} | class ____ extends BasicErrorMessageFactory {
/**
* Creates a new <code>{@link ShouldHaveLineCount}</code>.
* @param actual the actual value in the failed assertion.
* @param actualSize the lines count of {@code actual}.
* @param expectedSize the expected lines count.
* @return the created {@code ErrorMessageFactory}.
*/
public static ErrorMessageFactory shouldHaveLinesCount(Object actual, int actualSize, int expectedSize) {
return new ShouldHaveLineCount(actual, actualSize, expectedSize);
}
private ShouldHaveLineCount(Object actual, int actualSize, int expectedSize) {
// format the sizes in a standard way, otherwise if we use (for ex) an Hexadecimal representation
// it will format sizes in hexadecimal while we only want actual to be formatted in hexadecimal
// Also don't indent actual first line since the remaining lines won't have any indentation
super("%nExpecting text:%n%s%nto have %s lines but had %s.".formatted("%s", expectedSize, actualSize), actual);
}
}
| ShouldHaveLineCount |
java | elastic__elasticsearch | modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/ScriptProcessorTests.java | {
"start": 1253,
"end": 4038
} | class ____ extends ESTestCase {
private ScriptService scriptService;
private Script script;
private IngestScript.Factory ingestScriptFactory;
@Before
public void setupScripting() {
String scriptName = "script";
scriptService = new ScriptService(
Settings.builder().build(),
Map.of(Script.DEFAULT_SCRIPT_LANG, new MockScriptEngine(Script.DEFAULT_SCRIPT_LANG, Map.of(scriptName, ctx -> {
Integer bytesIn = (Integer) ctx.get("bytes_in");
Integer bytesOut = (Integer) ctx.get("bytes_out");
ctx.put("bytes_total", bytesIn + bytesOut);
ctx.put("_dynamic_templates", Map.of("foo", "bar"));
return null;
}), Map.of())),
new HashMap<>(ScriptModule.CORE_CONTEXTS),
() -> 1L,
TestProjectResolvers.singleProject(randomProjectIdOrDefault())
);
script = new Script(ScriptType.INLINE, Script.DEFAULT_SCRIPT_LANG, scriptName, Map.of());
ingestScriptFactory = scriptService.compile(script, IngestScript.CONTEXT);
}
public void testScriptingWithoutPrecompiledScriptFactory() throws Exception {
ScriptProcessor processor = new ScriptProcessor(randomAlphaOfLength(10), null, script, null, scriptService);
IngestDocument ingestDocument = randomDocument();
processor.execute(ingestDocument);
assertIngestDocument(ingestDocument);
}
public void testScriptingWithPrecompiledIngestScript() {
ScriptProcessor processor = new ScriptProcessor(randomAlphaOfLength(10), null, script, ingestScriptFactory, scriptService);
IngestDocument ingestDocument = randomDocument();
processor.execute(ingestDocument);
assertIngestDocument(ingestDocument);
}
private IngestDocument randomDocument() {
Map<String, Object> document = new HashMap<>();
document.put("bytes_in", randomInt());
document.put("bytes_out", randomInt());
return RandomDocumentPicks.randomIngestDocument(random(), document);
}
private void assertIngestDocument(IngestDocument ingestDocument) {
assertThat(ingestDocument.getSourceAndMetadata(), hasKey("bytes_in"));
assertThat(ingestDocument.getSourceAndMetadata(), hasKey("bytes_out"));
assertThat(ingestDocument.getSourceAndMetadata(), hasKey("bytes_total"));
int bytesTotal = ingestDocument.getFieldValue("bytes_in", Integer.class) + ingestDocument.getFieldValue("bytes_out", Integer.class);
assertThat(ingestDocument.getSourceAndMetadata().get("bytes_total"), is(bytesTotal));
assertThat(ingestDocument.getSourceAndMetadata().get("_dynamic_templates"), equalTo(Map.of("foo", "bar")));
}
}
| ScriptProcessorTests |
java | apache__flink | flink-runtime/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/WindowOperator.java | {
"start": 39330,
"end": 41493
} | class ____<K, W extends Window> implements Comparable<Timer<K, W>> {
protected long timestamp;
protected K key;
protected W window;
public Timer(long timestamp, K key, W window) {
this.timestamp = timestamp;
this.key = key;
this.window = window;
}
@Override
public int compareTo(Timer<K, W> o) {
return Long.compare(this.timestamp, o.timestamp);
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Timer<?, ?> timer = (Timer<?, ?>) o;
return timestamp == timer.timestamp
&& key.equals(timer.key)
&& window.equals(timer.window);
}
@Override
public int hashCode() {
int result = (int) (timestamp ^ (timestamp >>> 32));
result = 31 * result + key.hashCode();
result = 31 * result + window.hashCode();
return result;
}
@Override
public String toString() {
return "Timer{"
+ "timestamp="
+ timestamp
+ ", key="
+ key
+ ", window="
+ window
+ '}';
}
}
// ------------------------------------------------------------------------
// Getters for testing
// ------------------------------------------------------------------------
@VisibleForTesting
public Trigger<? super IN, ? super W> getTrigger() {
return trigger;
}
@VisibleForTesting
public KeySelector<IN, K> getKeySelector() {
return keySelector;
}
@VisibleForTesting
public WindowAssigner<? super IN, W> getWindowAssigner() {
return windowAssigner;
}
@VisibleForTesting
public StateDescriptor<? extends AppendingState<IN, ACC>, ?> getStateDescriptor() {
return windowStateDescriptor;
}
}
| Timer |
java | quarkusio__quarkus | extensions/resteasy-reactive/rest-client/runtime/src/main/java/io/quarkus/rest/client/reactive/runtime/devui/RestClientsContainer.java | {
"start": 3411,
"end": 3707
} | class ____ {
public final String interfaceClass;
public final String failure;
public PossibleRestClientInfo(String interfaceClass, String failure) {
this.interfaceClass = interfaceClass;
this.failure = failure;
}
}
}
| PossibleRestClientInfo |
java | apache__kafka | raft/src/test/java/org/apache/kafka/raft/RaftEventSimulationTest.java | {
"start": 44959,
"end": 46351
} | class ____ implements Invariant {
final Cluster cluster;
int epoch = 0;
OptionalInt leaderId = OptionalInt.empty();
private SingleLeader(Cluster cluster) {
this.cluster = cluster;
}
@Override
public void verify() {
for (Map.Entry<Integer, PersistentState> nodeEntry : cluster.nodes.entrySet()) {
PersistentState state = nodeEntry.getValue();
Optional<ElectionState> electionState = state.store.readElectionState();
electionState.ifPresent(election -> {
if (election.epoch() >= epoch && election.hasLeader()) {
if (epoch == election.epoch() && leaderId.isPresent()) {
assertEquals(leaderId.getAsInt(), election.leaderId());
} else {
epoch = election.epoch();
leaderId = OptionalInt.of(election.leaderId());
}
}
});
}
}
}
/**
* This invariant currently checks that the leader does not change after the first successful election
* and should only be applied to tests where we expect leadership not to change (e.g. non-impactful
* routing filter changes, no network jitter)
*/
private static | SingleLeader |
java | apache__flink | flink-runtime/src/main/java/org/apache/flink/streaming/api/operators/collect/CheckpointedCollectResultBuffer.java | {
"start": 1213,
"end": 1997
} | class ____<T> extends AbstractCollectResultBuffer<T> {
public CheckpointedCollectResultBuffer(TypeSerializer<T> serializer) {
super(serializer);
}
@Override
protected void sinkRestarted(long lastCheckpointedOffset) {
// sink restarted, we revert back to where the sink tells us
revert(lastCheckpointedOffset);
}
@Override
protected void maintainVisibility(long currentVisiblePos, long lastCheckpointedOffset) {
if (currentVisiblePos < lastCheckpointedOffset) {
// lastCheckpointedOffset increases, this means that more results have been
// checkpointed, and we can give these results to the user
makeResultsVisible(lastCheckpointedOffset);
}
}
}
| CheckpointedCollectResultBuffer |
java | apache__hadoop | hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestSortLocatedBlock.java | {
"start": 1632,
"end": 1714
} | class ____ the sorting of located blocks based on
* multiple states.
*/
public | tests |
java | apache__camel | core/camel-management-api/src/main/java/org/apache/camel/api/management/mbean/ManagedWireTapMBean.java | {
"start": 1021,
"end": 2120
} | interface ____ extends ManagedProcessorMBean, ManagedExtendedInformation, ManagedDestinationAware {
@ManagedAttribute(description = "The uri of the endpoint to wiretap to. The uri can be dynamic computed using the expressions.",
mask = true)
String getUri();
@ManagedAttribute(description = "Sets the maximum size used by the ProducerCache which is used to cache and reuse producers")
Integer getCacheSize();
@ManagedAttribute(description = "Ignore the invalidate endpoint exception when try to create a producer with that endpoint")
Boolean isIgnoreInvalidEndpoint();
@ManagedAttribute(description = "Uses a copy of the original exchange")
Boolean isCopy();
@ManagedAttribute(description = "Whether the uri is dynamic or static")
Boolean isDynamicUri();
@ManagedAttribute(description = "Current size of inflight wire tapped exchanges.")
Integer getTaskSize();
@Override
@ManagedOperation(description = "Statistics of the endpoints which has been sent to")
TabularData extendedInformation();
}
| ManagedWireTapMBean |
java | apache__kafka | trogdor/src/main/java/org/apache/kafka/trogdor/task/TaskWorker.java | {
"start": 970,
"end": 1015
} | interface ____ implementing tasks.
*/
public | for |
java | apache__hadoop | hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/timeline/reader/TimelineEventsReader.java | {
"start": 1812,
"end": 3097
} | class ____ implements MessageBodyReader<TimelineEvents> {
private ObjectMapper objectMapper = new ObjectMapper();
@Override
public boolean isReadable(Class<?> type, Type genericType,
Annotation[] annotations, MediaType mediaType) {
return type == TimelineEvents.class;
}
@Override
public TimelineEvents readFrom(Class<TimelineEvents> type, Type genericType,
Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders,
InputStream entityStream) throws IOException, WebApplicationException {
TimelineEvents timelineEvents = objectMapper.readValue(entityStream, TimelineEvents.class);
if (timelineEvents != null) {
List<EventsOfOneEntity> allEvents = timelineEvents.getAllEvents();
for (EventsOfOneEntity oneEvent : allEvents) {
if (oneEvent.getEvents() == null) {
oneEvent.setEvents(new ArrayList<>());
} else {
List<TimelineEvent> events = oneEvent.getEvents();
for (TimelineEvent event : events) {
Map<String, Object> eventInfo = event.getEventInfo();
if (eventInfo == null) {
event.setEventInfo(new HashMap<>());
}
}
}
}
}
return timelineEvents;
}
}
| TimelineEventsReader |
java | apache__camel | core/camel-core/src/test/java/org/apache/camel/support/PropertyBindingSupportFlattenTest.java | {
"start": 10866,
"end": 11462
} | class ____ {
private String name;
private Bar bar = new Bar();
private Animal animal;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Bar getBar() {
return bar;
}
public void setBar(Bar bar) {
this.bar = bar;
}
public Animal getAnimal() {
return animal;
}
public void setAnimal(Animal animal) {
this.animal = animal;
}
}
public static | Foo |
java | spring-projects__spring-framework | spring-beans/src/test/java/org/springframework/beans/propertyeditors/ZoneIdEditorTests.java | {
"start": 1073,
"end": 2561
} | class ____ {
private final ZoneIdEditor editor = new ZoneIdEditor();
@ParameterizedTest(name = "[{index}] text = ''{0}''")
@ValueSource(strings = {
"America/Chicago",
" America/Chicago ",
})
void americaChicago(String text) {
editor.setAsText(text);
ZoneId zoneId = (ZoneId) editor.getValue();
assertThat(zoneId).as("The zone ID should not be null.").isNotNull();
assertThat(zoneId).as("The zone ID is not correct.").isEqualTo(ZoneId.of("America/Chicago"));
assertThat(editor.getAsText()).as("The text version is not correct.").isEqualTo("America/Chicago");
}
@Test
void americaLosAngeles() {
editor.setAsText("America/Los_Angeles");
ZoneId zoneId = (ZoneId) editor.getValue();
assertThat(zoneId).as("The zone ID should not be null.").isNotNull();
assertThat(zoneId).as("The zone ID is not correct.").isEqualTo(ZoneId.of("America/Los_Angeles"));
assertThat(editor.getAsText()).as("The text version is not correct.").isEqualTo("America/Los_Angeles");
}
@Test
void getNullAsText() {
assertThat(editor.getAsText()).as("The returned value is not correct.").isEmpty();
}
@Test
void getValueAsText() {
editor.setValue(ZoneId.of("America/New_York"));
assertThat(editor.getAsText()).as("The text version is not correct.").isEqualTo("America/New_York");
}
@Test
void correctExceptionForInvalid() {
assertThatIllegalArgumentException().isThrownBy(() -> editor.setAsText("INVALID")).withMessageContaining("INVALID");
}
}
| ZoneIdEditorTests |
java | apache__hadoop | hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/placement/csmappingrule/MappingRuleActions.java | {
"start": 1543,
"end": 4355
} | class ____ extends MappingRuleActionBase {
/**
* We store the queue pattern in this variable, it may contain substitutable
* variables.
*/
private String queuePattern;
/**
* This flag indicates whether the target queue can be created if it does
* not exist yet.
*/
private boolean allowCreate;
/**
* Constructor.
* @param queuePattern The queue pattern in which the application will be
* placed if this action is fired. The pattern may
* contain variables. eg. root.%primary_group.%user
* @param allowCreate Determines if the target queue should be created if it
* does not exist
*/
PlaceToQueueAction(String queuePattern, boolean allowCreate) {
this.allowCreate = allowCreate;
this.queuePattern = queuePattern == null ? "" : queuePattern;
}
/**
* This method is the main logic of the action, it will replace all the
* variables in the queuePattern with their respective values, then returns
* a placementResult with the final queue name.
*
* @param variables The variable context, which contains all the variables
* @return The result of the action
*/
@Override
public MappingRuleResult execute(VariableContext variables) {
String substituted = variables.replacePathVariables(queuePattern);
return MappingRuleResult.createPlacementResult(
substituted, allowCreate);
}
/**
* This method is responsible for config validation, we use the validation
* context's helper method to validate if our path is valid. From the
* point of the action all paths are valid, that is why we need to use
* an external component which is aware of the queue structure and know
* when a queue placement is valid in that context. This way this calass can
* stay independent of the capacity scheduler's internal queue placement
* logic, yet it is able to obey it's rules.
* @param ctx Validation context with all the necessary objects and helper
* methods required during validation
* @throws YarnException is thrown on validation error
*/
@Override
public void validate(MappingRuleValidationContext ctx)
throws YarnException {
ctx.validateQueuePath(this.queuePattern);
}
@Override
public String toString() {
return "PlaceToQueueAction{" +
"queueName='" + queuePattern + "'," +
"allowCreate=" + allowCreate +
"}";
}
}
/**
* RejectAction represents the action when the application is rejected, this
* simply will throw an error on the user's side letting it know the
* submission was rejected.
*/
public static | PlaceToQueueAction |
java | hibernate__hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/inheritance/join/EntityJoinWithTablePerClassInheritanceTest.java | {
"start": 6309,
"end": 6546
} | class ____ {
@Id
private Integer id;
public BaseClass() {
}
public BaseClass(Integer id) {
this.id = id;
}
public Integer getId() {
return id;
}
}
@Entity( name = "ChildEntityA" )
public static abstract | BaseClass |
java | quarkusio__quarkus | extensions/amazon-lambda/deployment/src/main/java/io/quarkus/amazon/lambda/deployment/AmazonLambdaProcessor.java | {
"start": 12992,
"end": 19393
} | class ____ runtime if there is not a provided lambda or there is more than one lambda in
// deployment
if (!providedLambda.isPresent() && lambdas != null && lambdas.size() > 1) {
List<RequestHandlerDefinition> unnamed = new ArrayList<>();
Map<String, RequestHandlerDefinition> named = new HashMap<>();
List<Class<? extends RequestStreamHandler>> unnamedStreamHandler = new ArrayList<>();
Map<String, Class<? extends RequestStreamHandler>> namedStreamHandler = new HashMap<>();
for (AmazonLambdaBuildItem i : lambdas) {
if (i.isStreamHandler()) {
if (i.getName() == null) {
unnamedStreamHandler
.add((Class<? extends RequestStreamHandler>) context.classProxy(i.getHandlerClass()));
} else {
namedStreamHandler.put(i.getName(),
(Class<? extends RequestStreamHandler>) context.classProxy(i.getHandlerClass()));
}
} else {
if (i.getName() == null) {
RequestHandlerJandexDefinition requestHandlerJandexDefinition = RequestHandlerJandexUtil
.discoverHandlerMethod(i.getHandlerClass(), index.getComputingIndex());
registerForReflection(requestHandlerJandexDefinition, reflectiveMethods, reflectiveHierarchies);
unnamed.add(toRequestHandlerDefinition(requestHandlerJandexDefinition, context));
} else {
RequestHandlerJandexDefinition requestHandlerJandexDefinition = RequestHandlerJandexUtil
.discoverHandlerMethod(i.getHandlerClass(), index.getComputingIndex());
registerForReflection(requestHandlerJandexDefinition, reflectiveMethods, reflectiveHierarchies);
named.put(i.getName(), toRequestHandlerDefinition(requestHandlerJandexDefinition, context));
}
}
}
recorder.chooseHandlerClass(unnamed, named, unnamedStreamHandler, namedStreamHandler);
}
}
/**
* This should only run when building a native image
*/
@BuildStep(onlyIf = NativeBuild.class)
@Record(value = ExecutionTime.RUNTIME_INIT)
void startPoolLoop(AmazonLambdaRecorder recorder,
ShutdownContextBuildItem shutdownContextBuildItem,
LaunchModeBuildItem launchModeBuildItem,
List<ServiceStartBuildItem> orderServicesFirst // try to order this after service recorders
) {
recorder.startPollLoop(shutdownContextBuildItem, launchModeBuildItem.getLaunchMode());
}
@BuildStep
@Record(value = ExecutionTime.RUNTIME_INIT)
void startPoolLoopDevOrTest(AmazonLambdaRecorder recorder,
List<ServiceStartBuildItem> orderServicesFirst, // force some ordering of recorders
ShutdownContextBuildItem shutdownContextBuildItem,
LaunchModeBuildItem launchModeBuildItem) {
LaunchMode mode = launchModeBuildItem.getLaunchMode();
if (mode.isDevOrTest()) {
recorder.startPollLoop(shutdownContextBuildItem, mode);
}
}
@BuildStep
@Record(value = ExecutionTime.STATIC_INIT)
void recordExpectedExceptions(LambdaBuildTimeConfig config,
BuildProducer<ReflectiveClassBuildItem> registerForReflection,
AmazonLambdaStaticRecorder recorder) {
Set<Class<?>> classes = config.expectedExceptions().map(Set::copyOf).orElseGet(Set::of);
classes.stream()
.map(clazz -> ReflectiveClassBuildItem.builder(clazz).constructors(false)
.reason(getClass().getName() + " expectedExceptions")
.build())
.forEach(registerForReflection::produce);
recorder.setExpectedExceptionClasses(classes);
}
private static String getCdiName(ClassInfo handler) {
AnnotationInstance named = handler.declaredAnnotation(NAMED);
if (named == null) {
return null;
}
return named.value().asString();
}
private static void registerForReflection(RequestHandlerJandexDefinition requestHandlerJandexDefinition,
BuildProducer<ReflectiveMethodBuildItem> reflectiveMethods,
BuildProducer<ReflectiveHierarchyBuildItem> reflectiveHierarchies) {
String source = AmazonLambdaProcessor.class.getSimpleName() + " > "
+ requestHandlerJandexDefinition.method().declaringClass() + "[" + requestHandlerJandexDefinition.method()
+ "]";
reflectiveHierarchies.produce(ReflectiveHierarchyBuildItem
.builder(requestHandlerJandexDefinition.inputOutputTypes().inputType())
.source(source)
.build());
reflectiveHierarchies.produce(ReflectiveHierarchyBuildItem
.builder(requestHandlerJandexDefinition.inputOutputTypes().outputType())
.source(source)
.build());
if (requestHandlerJandexDefinition.inputOutputTypes().isCollection()) {
reflectiveMethods.produce(new ReflectiveMethodBuildItem(
"method reflectively accessed in io.quarkus.amazon.lambda.runtime.AmazonLambdaRecorder.discoverHandlerMethod",
requestHandlerJandexDefinition.method()));
reflectiveHierarchies.produce(ReflectiveHierarchyBuildItem
.builder(requestHandlerJandexDefinition.inputOutputTypes().elementType())
.source(source)
.build());
}
}
private static RequestHandlerDefinition toRequestHandlerDefinition(RequestHandlerJandexDefinition jandexDefinition,
RecorderContext context) {
return new RequestHandlerDefinition(
(Class<? extends RequestHandler<?, ?>>) context.classProxy(jandexDefinition.handlerClass().name().toString()),
context.classProxy(jandexDefinition.method().declaringClass().name().toString()),
context.classProxy(jandexDefinition.inputOutputTypes().inputType().name().toString()),
context.classProxy(jandexDefinition.inputOutputTypes().outputType().name().toString()));
}
}
| at |
java | spring-projects__spring-boot | module/spring-boot-webflux/src/main/java/org/springframework/boot/webflux/actuate/web/mappings/DispatcherHandlersMappingDescriptionProvider.java | {
"start": 2903,
"end": 4510
} | class ____ implements MappingDescriptionProvider {
private static final List<HandlerMappingDescriptionProvider<? extends HandlerMapping>> descriptionProviders = Arrays
.asList(new RequestMappingInfoHandlerMappingDescriptionProvider(), new UrlHandlerMappingDescriptionProvider(),
new RouterFunctionMappingDescriptionProvider());
@Override
public String getMappingName() {
return "dispatcherHandlers";
}
@Override
public Map<String, List<DispatcherHandlerMappingDescription>> describeMappings(ApplicationContext context) {
Map<String, List<DispatcherHandlerMappingDescription>> mappings = new HashMap<>();
context.getBeansOfType(DispatcherHandler.class)
.forEach((name, handler) -> mappings.put(name, describeMappings(handler)));
return mappings;
}
private List<DispatcherHandlerMappingDescription> describeMappings(DispatcherHandler dispatcherHandler) {
List<HandlerMapping> handlerMappings = dispatcherHandler.getHandlerMappings();
if (handlerMappings == null) {
return Collections.emptyList();
}
return handlerMappings.stream().flatMap(this::describe).toList();
}
@SuppressWarnings("unchecked")
private <T extends HandlerMapping> Stream<DispatcherHandlerMappingDescription> describe(T handlerMapping) {
for (HandlerMappingDescriptionProvider<?> descriptionProvider : descriptionProviders) {
if (descriptionProvider.getMappingClass().isInstance(handlerMapping)) {
return ((HandlerMappingDescriptionProvider<T>) descriptionProvider).describe(handlerMapping).stream();
}
}
return Stream.empty();
}
private | DispatcherHandlersMappingDescriptionProvider |
java | hibernate__hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/query/hhh12076/TaskStatus.java | {
"start": 173,
"end": 2141
} | class ____ {
private Long _id;
private Integer _version;
private Date _creationDate;
private Date _modifiedDate;
private boolean _active;
private Integer _orderIndex;
private String _name;
private String _displayName;
public TaskStatus() {
}
public String getEntityName() {
return _displayName;
}
public Long getId() {
return _id;
}
public void setId(Long id) {
_id = id;
}
public Integer getVersion() {
return _version;
}
public void setVersion(Integer version) {
_version = version;
}
public Date getCreationDate() {
return _creationDate;
}
public void setCreationDate(Date creationDate) {
_creationDate = creationDate;
}
public Date getModifiedDate() {
return _modifiedDate;
}
public void setModifiedDate(Date modifiedDate) {
_modifiedDate = modifiedDate;
}
public String getName() {
return _name;
}
public void setName(String name) {
_name = name;
}
public String getDisplayName() {
return _displayName;
}
public void setDisplayName(String displayName) {
_displayName = displayName;
}
public boolean isActive() {
return _active;
}
public void setActive(boolean active) {
_active = active;
}
@Override
public String toString() {
return _name;
}
public Integer getOrderIndex() {
return _orderIndex;
}
public void setOrderIndex(Integer ordering) {
_orderIndex = ordering;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ( ( _name == null ) ? 0 : _name.hashCode() );
return result;
}
@Override
public boolean equals(Object obj) {
if ( obj == null ) {
return false;
}
if ( obj == this ) {
return true;
}
if ( !( obj instanceof TaskStatus ) ) {
return false;
}
TaskStatus other = (TaskStatus) obj;
if ( _name == null ) {
if ( other._name != null ) {
return false;
}
}
else if ( !_name.equals( other._name ) ) {
return false;
}
return true;
}
}
| TaskStatus |
java | google__guava | android/guava-tests/test/com/google/common/collect/ImmutableSortedMapTailMapMapInterfaceTest.java | {
"start": 801,
"end": 1249
} | class ____
extends AbstractImmutableSortedMapMapInterfaceTest<String, Integer> {
@Override
protected SortedMap<String, Integer> makePopulatedMap() {
return ImmutableSortedMap.of("a", 1, "b", 2, "c", 3, "d", 4, "e", 5).tailMap("b");
}
@Override
protected String getKeyNotInPopulatedMap() {
return "a";
}
@Override
protected Integer getValueNotInPopulatedMap() {
return 1;
}
}
| ImmutableSortedMapTailMapMapInterfaceTest |
java | mybatis__mybatis-3 | src/main/java/org/apache/ibatis/annotations/ResultType.java | {
"start": 1549,
"end": 1670
} | interface ____ {
/**
* Returns the return type.
*
* @return the return type
*/
Class<?> value();
}
| ResultType |
java | apache__camel | components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestJettyInvalidJSonClientRequestValidationTest.java | {
"start": 1440,
"end": 3146
} | class ____ extends BaseJettyTest {
@Test
public void testJettyInvalidJSon() {
FluentProducerTemplate requestTemplate = fluentTemplate.withHeader(Exchange.CONTENT_TYPE, "application/json")
.withHeader(Exchange.HTTP_METHOD, "post")
.withBody("{\"name\": \"Donald\"") // the body is invalid as the ending } is missing
.to("http://localhost:" + getPort() + "/users/123/update");
Exception ex = assertThrows(CamelExecutionException.class, () -> requestTemplate.request(String.class));
HttpOperationFailedException cause = assertIsInstanceOf(HttpOperationFailedException.class, ex.getCause());
assertEquals(400, cause.getStatusCode());
assertEquals("Invalid JSon payload.", cause.getResponseBody());
}
@Override
protected RouteBuilder createRouteBuilder() {
return new RouteBuilder() {
@Override
public void configure() {
// configure to use jetty on localhost with the given port
restConfiguration().component("jetty").host("localhost").port(getPort())
.bindingMode(RestBindingMode.json)
// turn on client request validation
.clientRequestValidation(true);
// use the rest DSL to define the rest services
rest("/users/").post("{id}/update")
.consumes("application/json").produces("application/json")
.to("direct:update");
from("direct:update").setBody(constant("{ \"status\": \"ok\" }"));
}
};
}
}
| RestJettyInvalidJSonClientRequestValidationTest |
java | apache__camel | components/camel-mllp/src/test/java/org/apache/camel/component/mllp/MllpIdleTimeoutStrategyTest.java | {
"start": 1958,
"end": 8511
} | class ____ extends CamelTestSupport {
static final int IDLE_TIMEOUT = 500;
@RegisterExtension
public MllpServerResource mllpServer = new MllpServerResource("localhost", AvailablePortFinder.getNextAvailable());
@EndpointInject("direct://sourcedefault")
ProducerTemplate defaultStrategySource;
@EndpointInject("direct://sourcereset")
ProducerTemplate resetStrategySource;
@EndpointInject("direct://sourceclose")
ProducerTemplate closeStrategySource;
@EndpointInject("mock://target")
MockEndpoint target;
private MllpEndpoint defaultStrategyEndpoint;
private MllpEndpoint resetStrategyEndpoint;
private MllpEndpoint closeStrategyEndpoint;
private MllpSocketBuffer defaultStrategyMllpSocketBuffer;
private MllpSocketBuffer resetStrategyMllpSocketBuffer;
private MllpSocketBuffer closeStrategyMllpSocketBuffer;
private MllpTcpClientProducer defaultStrategyProducer;
private MllpTcpClientProducer resetStrategyProducer;
private MllpTcpClientProducer closeStrategyProducer;
@Override
protected CamelContext createCamelContext() throws Exception {
if (context != null) {
return context;
}
return super.createCamelContext();
}
@Override
protected void doPreSetup() throws Exception {
MllpComponent mllpComponent = createCamelContext().getComponent("mllp", MllpComponent.class);
defaultStrategyEndpoint = Mockito.spy(
(MllpEndpoint) mllpComponent.createEndpoint(
String.format("mllp://%s:%d?idleTimeout=%d", mllpServer.getListenHost(), mllpServer.getListenPort(),
IDLE_TIMEOUT)));
resetStrategyEndpoint = Mockito.spy(
(MllpEndpoint) mllpComponent.createEndpoint(
String.format("mllp://%s:%d?idleTimeout=%d&idleTimeoutStrategy=reset", mllpServer.getListenHost(),
mllpServer.getListenPort(), IDLE_TIMEOUT)));
closeStrategyEndpoint = Mockito.spy(
(MllpEndpoint) mllpComponent.createEndpoint(
String.format("mllp://%s:%d?idleTimeout=%d&idleTimeoutStrategy=close", mllpServer.getListenHost(),
mllpServer.getListenPort(), IDLE_TIMEOUT)));
defaultStrategyProducer = Mockito.spy(new MllpTcpClientProducer(defaultStrategyEndpoint));
defaultStrategyProducer.start();
Field defaultStrategyMllpBufferField = MllpTcpClientProducer.class.getDeclaredField("mllpBuffer");
defaultStrategyMllpBufferField.setAccessible(true);
defaultStrategyMllpSocketBuffer = Mockito.spy(new MllpSocketBuffer(defaultStrategyEndpoint));
defaultStrategyMllpBufferField.set(defaultStrategyProducer, defaultStrategyMllpSocketBuffer);
when(defaultStrategyEndpoint.createProducer())
.thenReturn(defaultStrategyProducer);
resetStrategyProducer = Mockito.spy(new MllpTcpClientProducer(resetStrategyEndpoint));
Field resetStrategyMllpBufferField = MllpTcpClientProducer.class.getDeclaredField("mllpBuffer");
resetStrategyMllpBufferField.setAccessible(true);
resetStrategyMllpSocketBuffer = Mockito.spy(new MllpSocketBuffer(resetStrategyEndpoint));
resetStrategyMllpBufferField.set(resetStrategyProducer, resetStrategyMllpSocketBuffer);
when(resetStrategyEndpoint.createProducer())
.thenReturn(resetStrategyProducer);
closeStrategyProducer = Mockito.spy(new MllpTcpClientProducer(closeStrategyEndpoint));
Field closeStrategyMllpBufferField = MllpTcpClientProducer.class.getDeclaredField("mllpBuffer");
closeStrategyMllpBufferField.setAccessible(true);
closeStrategyMllpSocketBuffer = Mockito.spy(new MllpSocketBuffer(closeStrategyEndpoint));
closeStrategyMllpBufferField.set(closeStrategyProducer, closeStrategyMllpSocketBuffer);
when(closeStrategyEndpoint.createProducer())
.thenReturn(closeStrategyProducer);
defaultStrategyProducer.start();
resetStrategyProducer.start();
closeStrategyProducer.start();
}
@BeforeEach
public void setupMock() {
MockEndpoint.resetMocks(context);
}
private void sendHl7Message(ProducerTemplate template) throws Exception {
target.expectedMessageCount(1);
template.sendBody(Hl7TestMessageGenerator.generateMessage());
// Need to send one message to get the connection established
Awaitility.await().atMost(IDLE_TIMEOUT * 3, TimeUnit.MILLISECONDS).pollInterval(500, TimeUnit.MILLISECONDS)
.untilAsserted(() -> MockEndpoint.assertIsSatisfied(context, 5, TimeUnit.SECONDS));
}
@Test
public void defaultStrategyTest() throws Exception {
sendHl7Message(defaultStrategySource);
verify(defaultStrategyMllpSocketBuffer, times(1)).resetSocket(any());
verify(defaultStrategyMllpSocketBuffer, never()).closeSocket(any());
}
@Test
public void resetStrategyTest() throws Exception {
sendHl7Message(resetStrategySource);
verify(resetStrategyMllpSocketBuffer, times(1)).resetSocket(any());
verify(resetStrategyMllpSocketBuffer, never()).closeSocket(any());
}
@Test
public void closeStrategyTest() throws Exception {
sendHl7Message(closeStrategySource);
verify(closeStrategyMllpSocketBuffer, times(1)).closeSocket(any());
verify(closeStrategyMllpSocketBuffer, never()).resetSocket(any());
}
@Override
protected RoutesBuilder createRouteBuilder() {
return new RouteBuilder() {
@Override
public void configure() {
route("mllp-sender-default", defaultStrategySource.getDefaultEndpoint(), defaultStrategyEndpoint);
route("mllp-sender-reset", resetStrategySource.getDefaultEndpoint(), resetStrategyEndpoint);
route("mllp-sender-close", closeStrategySource.getDefaultEndpoint(), closeStrategyEndpoint);
}
private void route(String routeId, Endpoint sourceEndpoint, Endpoint destinationEndpoint) {
from(sourceEndpoint).routeId(routeId)
.log(LoggingLevel.INFO, routeId, "Sending Message")
.to(destinationEndpoint)
.log(LoggingLevel.INFO, routeId, "Received Acknowledgement")
.to(target);
}
};
}
}
| MllpIdleTimeoutStrategyTest |
java | quarkusio__quarkus | integration-tests/smallrye-graphql/src/test/java/io/quarkus/it/smallrye/graphql/GreetingsResourceTestIT.java | {
"start": 119,
"end": 183
} | class ____ extends GreetingsResourceTest {
}
| GreetingsResourceTestIT |
java | spring-projects__spring-security | config/src/main/java/org/springframework/security/config/annotation/web/configurers/X509Configurer.java | {
"start": 3660,
"end": 10361
} | class ____<H extends HttpSecurityBuilder<H>>
extends AbstractHttpConfigurer<X509Configurer<H>, H> {
private X509AuthenticationFilter x509AuthenticationFilter;
private X509PrincipalExtractor x509PrincipalExtractor;
private AuthenticationUserDetailsService<PreAuthenticatedAuthenticationToken> authenticationUserDetailsService;
private AuthenticationDetailsSource<HttpServletRequest, PreAuthenticatedGrantedAuthoritiesWebAuthenticationDetails> authenticationDetailsSource;
/**
* Creates a new instance
*
* @see HttpSecurity#x509(Customizer)
*/
public X509Configurer() {
}
/**
* Allows specifying the entire {@link X509AuthenticationFilter}. If this is
* specified, the properties on {@link X509Configurer} will not be populated on the
* {@link X509AuthenticationFilter}.
* @param x509AuthenticationFilter the {@link X509AuthenticationFilter} to use
* @return the {@link X509Configurer} for further customizations
*/
public X509Configurer<H> x509AuthenticationFilter(X509AuthenticationFilter x509AuthenticationFilter) {
this.x509AuthenticationFilter = x509AuthenticationFilter;
return this;
}
/**
* Specifies the {@link X509PrincipalExtractor}
* @param x509PrincipalExtractor the {@link X509PrincipalExtractor} to use
* @return the {@link X509Configurer} to use
*/
public X509Configurer<H> x509PrincipalExtractor(X509PrincipalExtractor x509PrincipalExtractor) {
this.x509PrincipalExtractor = x509PrincipalExtractor;
return this;
}
/**
* Specifies the {@link AuthenticationDetailsSource}
* @param authenticationDetailsSource the {@link AuthenticationDetailsSource} to use
* @return the {@link X509Configurer} to use
*/
public X509Configurer<H> authenticationDetailsSource(
AuthenticationDetailsSource<HttpServletRequest, PreAuthenticatedGrantedAuthoritiesWebAuthenticationDetails> authenticationDetailsSource) {
this.authenticationDetailsSource = authenticationDetailsSource;
return this;
}
/**
* Shortcut for invoking
* {@link #authenticationUserDetailsService(AuthenticationUserDetailsService)} with a
* {@link UserDetailsByNameServiceWrapper}.
* @param userDetailsService the {@link UserDetailsService} to use
* @return the {@link X509Configurer} for further customizations
*/
public X509Configurer<H> userDetailsService(UserDetailsService userDetailsService) {
UserDetailsByNameServiceWrapper<PreAuthenticatedAuthenticationToken> authenticationUserDetailsService = new UserDetailsByNameServiceWrapper<>();
authenticationUserDetailsService.setUserDetailsService(userDetailsService);
return authenticationUserDetailsService(authenticationUserDetailsService);
}
/**
* Specifies the {@link AuthenticationUserDetailsService} to use. If not specified,
* then the {@link UserDetailsService} bean will be used by default.
* @param authenticationUserDetailsService the
* {@link AuthenticationUserDetailsService} to use
* @return the {@link X509Configurer} for further customizations
*/
public X509Configurer<H> authenticationUserDetailsService(
AuthenticationUserDetailsService<PreAuthenticatedAuthenticationToken> authenticationUserDetailsService) {
this.authenticationUserDetailsService = authenticationUserDetailsService;
return this;
}
/**
* Specifies the regex to extract the principal from the certificate. If not
* specified, the default expression from {@link SubjectDnX509PrincipalExtractor} is
* used.
* @param subjectPrincipalRegex the regex to extract the user principal from the
* certificate (i.e. "CN=(.*?)(?:,|$)").
* @return the {@link X509Configurer} for further customizations
* @deprecated Please use {{@link #x509PrincipalExtractor(X509PrincipalExtractor)}
* instead
*/
@Deprecated
public X509Configurer<H> subjectPrincipalRegex(String subjectPrincipalRegex) {
SubjectDnX509PrincipalExtractor principalExtractor = new SubjectDnX509PrincipalExtractor();
principalExtractor.setSubjectDnRegex(subjectPrincipalRegex);
this.x509PrincipalExtractor = principalExtractor;
return this;
}
@Override
public void init(H http) {
PreAuthenticatedAuthenticationProvider authenticationProvider = new PreAuthenticatedAuthenticationProvider();
authenticationProvider.setPreAuthenticatedUserDetailsService(getAuthenticationUserDetailsService(http));
authenticationProvider.setGrantedAuthoritySupplier(
() -> AuthorityUtils.createAuthorityList(FactorGrantedAuthority.X509_AUTHORITY));
http.authenticationProvider(authenticationProvider)
.setSharedObject(AuthenticationEntryPoint.class, new Http403ForbiddenEntryPoint());
ExceptionHandlingConfigurer<H> exceptions = http.getConfigurer(ExceptionHandlingConfigurer.class);
if (exceptions != null) {
AuthenticationEntryPoint forbidden = new Http403ForbiddenEntryPoint();
exceptions.defaultDeniedHandlerForMissingAuthority((ep) -> ep.defaultEntryPoint(forbidden),
FactorGrantedAuthority.X509_AUTHORITY);
}
}
@Override
public void configure(H http) {
X509AuthenticationFilter filter = getFilter(http.getSharedObject(AuthenticationManager.class), http);
http.addFilter(filter);
}
private X509AuthenticationFilter getFilter(AuthenticationManager authenticationManager, H http) {
if (this.x509AuthenticationFilter == null) {
this.x509AuthenticationFilter = new X509AuthenticationFilter();
this.x509AuthenticationFilter.setAuthenticationManager(authenticationManager);
if (this.x509PrincipalExtractor != null) {
this.x509AuthenticationFilter.setPrincipalExtractor(this.x509PrincipalExtractor);
}
if (this.authenticationDetailsSource != null) {
this.x509AuthenticationFilter.setAuthenticationDetailsSource(this.authenticationDetailsSource);
}
this.x509AuthenticationFilter.setSecurityContextRepository(new RequestAttributeSecurityContextRepository());
this.x509AuthenticationFilter.setSecurityContextHolderStrategy(getSecurityContextHolderStrategy());
this.x509AuthenticationFilter = postProcess(this.x509AuthenticationFilter);
}
return this.x509AuthenticationFilter;
}
private AuthenticationUserDetailsService<PreAuthenticatedAuthenticationToken> getAuthenticationUserDetailsService(
H http) {
if (this.authenticationUserDetailsService == null) {
userDetailsService(getSharedOrBean(http, UserDetailsService.class));
}
return this.authenticationUserDetailsService;
}
private <C> C getSharedOrBean(H http, Class<C> type) {
C shared = http.getSharedObject(type);
if (shared != null) {
return shared;
}
ApplicationContext context = getBuilder().getSharedObject(ApplicationContext.class);
if (context == null) {
return null;
}
return context.getBeanProvider(type).getIfUnique();
}
}
| X509Configurer |
java | apache__flink | flink-core-api/src/main/java/org/apache/flink/util/function/CheckedSupplier.java | {
"start": 1000,
"end": 1615
} | interface ____<R> extends SupplierWithException<R, Exception> {
static <R> Supplier<R> unchecked(CheckedSupplier<R> checkedSupplier) {
return () -> {
try {
return checkedSupplier.get();
} catch (Exception e) {
throw new RuntimeException(e);
}
};
}
static <R> CheckedSupplier<R> checked(Supplier<R> supplier) {
return () -> {
try {
return supplier.get();
} catch (RuntimeException e) {
throw new Exception(e);
}
};
}
}
| CheckedSupplier |
java | playframework__playframework | dev-mode/sbt-plugin/src/sbt-test/play-sbt-plugin/routes-compiler-routes-compilation-java/tests/test/BooleanParamTest.java | {
"start": 401,
"end": 12090
} | class ____ extends AbstractRoutesTest {
/** Tests route {@code /bool-p} {@link BooleanController#path}. */
@Test
public void checkPath() {
var path = "/bool-p";
// Correct value
checkResult(path + "/true", okContains("true"));
checkResult(path + "/false", okContains("false"));
checkResult(path + "/1", okContains("true"));
checkResult(path + "/0", okContains("false"));
// Without param
checkResult(path, this::notFound);
// Incorrect value
checkResult(path + "/invalid", this::badRequestCannotParseParameter);
// Reverse route
assertThat(BooleanController.path(null).url()).isEqualTo(path + "/false");
assertThat(BooleanController.path(true).url()).isEqualTo(path + "/true");
assertThat(BooleanController.path(false).url()).isEqualTo(path + "/false");
}
/** Tests route {@code /bool} {@link BooleanController#query}. */
@Test
public void checkQuery() {
var path = "/bool";
// Correct value
checkResult(path, "x=true", okContains("true"));
checkResult(path, "x=false", okContains("false"));
checkResult(path, "x=1", okContains("true"));
checkResult(path, "x=0", okContains("false"));
// Without/Empty/NoValue param
checkResult(path, this::badRequestMissingParameter);
checkResult(path, "x", this::badRequestMissingParameter);
checkResult(path, "x=", this::badRequestMissingParameter);
// Incorrect value
checkResult(path, "x=invalid", this::badRequestCannotParseParameter);
// Reverse route
assertThat(BooleanController.query(null).url()).isEqualTo(path + "?x=false");
assertThat(BooleanController.query(true).url()).isEqualTo(path + "?x=true");
assertThat(BooleanController.query(false).url()).isEqualTo(path + "?x=false");
}
/** Tests route {@code /bool-d} {@link controllers.BooleanController#queryDefault}. */
@Test
public void checkQueryDefault() {
var path = "/bool-d";
// Correct value
checkResult(path, "x?%3D=false", okContains("false"));
// Without/Empty/NoValue param
checkResult(path, okContains("true"));
checkResult(path, "x?%3D=", okContains("true"));
checkResult(path, "x?%3D=", okContains("true"));
// Incorrect value
checkResult(path, "x?%3D=invalid", this::badRequestCannotParseParameter);
// Reverse route
assertThat(BooleanController.queryDefault(null).url()).isEqualTo(path + "?x%3F%3D=false");
assertThat(BooleanController.queryDefault(true).url()).isEqualTo(path);
assertThat(BooleanController.queryDefault(false).url()).isEqualTo(path + "?x%3F%3D=false");
}
/** Tests route {@code /bool-f} {@link controllers.BooleanController#queryFixed}. */
@Test
public void checkQueryFixed() {
var path = "/bool-f";
// Correct value
checkResult(path, "x=true", okContains("true"));
checkResult(path, "x=false", okContains("true"));
checkResult(path, "x=1", okContains("true"));
checkResult(path, "x=0", okContains("true"));
// Without/Empty/NoValue param
checkResult(path, okContains("true"));
checkResult(path, "x", okContains("true"));
checkResult(path, "x=", okContains("true"));
// Incorrect value
checkResult(path, "x=invalid", okContains("true"));
// Reverse route
assertThat(BooleanController.queryFixed().url()).isEqualTo(path);
}
/** Tests route {@code /bool-null} {@link controllers.BooleanController#queryNullable}. */
@Test
public void checkQueryNullable() {
var path = "/bool-null";
// Correct value
checkResult(path, "x?=true", okContains("true"));
checkResult(path, "x?=false", okContains("false"));
// Without/Empty/NoValue param
checkResult(path, okContains("null"));
checkResult(path, "x?", okContains("null"));
checkResult(path, "x?=", okContains("null"));
// Incorrect value
checkResult(path, "x?=invalid", this::badRequestCannotParseParameter);
// Reverse route
assertThat(BooleanController.queryNullable(null).url()).isEqualTo(path);
assertThat(BooleanController.queryNullable(true).url()).isEqualTo(path + "?x%3F=true");
assertThat(BooleanController.queryNullable(false).url()).isEqualTo(path + "?x%3F=false");
}
/** Tests route {@code /bool-opt} {@link controllers.BooleanController#queryOptional}. */
@Test
public void checkQueryOptional() {
var path = "/bool-opt";
// Correct value
checkResult(path, "x?=true", okContains("true"));
checkResult(path, "x?=false", okContains("false"));
checkResult(path, "x?=1", okContains("true"));
checkResult(path, "x?=0", okContains("false"));
// Without/Empty/NoValue param
checkResult(path, this::okEmptyOptional);
checkResult(path, "x?", this::okEmptyOptional);
checkResult(path, "x?=", this::okEmptyOptional);
// Incorrect value
checkResult(path, "x?=invalid", this::badRequestCannotParseParameter);
// Reverse route
assertThat(BooleanController.queryOptional(Optional.empty()).url()).isEqualTo(path);
assertThat(BooleanController.queryOptional(Optional.of(true)).url())
.isEqualTo(path + "?x%3F=true");
assertThat(BooleanController.queryOptional(Optional.of(false)).url())
.isEqualTo(path + "?x%3F=false");
}
/** Tests route {@code /bool-opt-d} {@link controllers.BooleanController#queryOptionalDefault}. */
@Test
public void checkQueryOptionalDefault() {
var path = "/bool-opt-d";
// Correct value
checkResult(path, "x?%3D=true", okContains("true"));
checkResult(path, "x?%3D=false", okContains("false"));
checkResult(path, "x?%3D=1", okContains("true"));
checkResult(path, "x?%3D=0", okContains("false"));
// Without/Empty/NoValue param
checkResult(path, okContains("true"));
checkResult(path, "x?%3D", okContains("true"));
checkResult(path, "x?%3D=", okContains("true"));
// Incorrect value
checkResult(path, "x?%3D=invalid", this::badRequestCannotParseParameter);
// Reverse route
assertThat(BooleanController.queryOptionalDefault(Optional.empty()).url()).isEqualTo(path);
assertThat(BooleanController.queryOptionalDefault(Optional.of(true)).url()).isEqualTo(path);
assertThat(BooleanController.queryOptionalDefault(Optional.of(false)).url())
.isEqualTo(path + "?x%3F%3D=false");
}
/** Tests route {@code /bool-list} {@link controllers.BooleanController#queryList}. */
@Test
public void checkQueryList() {
var path = "/bool-list";
// Correct value
checkResult(path, "x[]=true&x[]=false&x[]=true", okContains("true,false,true"));
checkResult(path, "x[]=1&x[]=0&x[]=1", okContains("true,false,true"));
// Without/Empty/NoValue param
checkResult(path, this::okEmpty);
checkResult(path, "x[]", this::okEmpty);
checkResult(path, "x[]=", this::okEmpty);
// Incorrect value
checkResult(path, "x[]=1&x[]=invalid", this::badRequestCannotParseParameter);
// Reverse route
assertThat(BooleanController.queryList(List.of()).url()).isEqualTo(path);
assertThat(BooleanController.queryList(List.of(true, false, true)).url())
.isEqualTo(path + "?x%5B%5D=true&x%5B%5D=false&x%5B%5D=true");
}
/** Tests route {@code /bool-list-d} {@link controllers.BooleanController#queryListDefault}. */
@Test
public void checkQueryListDefault() {
var path = "/bool-list-d";
// Correct value
checkResult(path, "x[]%3D=false&x[]%3D=false&x[]%3D=true", okContains("false,false,true"));
checkResult(path, "x[]%3D=0&x[]%3D=0&x[]%3D=1", okContains("false,false,true"));
// Without/Empty/NoValue param
checkResult(path, okContains("true,false,true"));
checkResult(path, "x[]%3D", okContains("true,false,true"));
checkResult(path, "x[]%3D=", okContains("true,false,true"));
// Incorrect value
checkResult(path, "x[]%3D=1&x[]%3D=invalid", this::badRequestCannotParseParameter);
// Reverse route
assertThat(BooleanController.queryListDefault(List.of()).url()).isEqualTo(path);
assertThat(BooleanController.queryListDefault(List.of(true, false, true)).url())
.isEqualTo(path);
assertThat(BooleanController.queryListDefault(List.of(false, false, true)).url())
.isEqualTo(path + "?x%5B%5D%3D=false&x%5B%5D%3D=false&x%5B%5D%3D=true");
}
/**
* Tests route {@code /bool-list-null} {@link controllers.BooleanController#queryListNullable}.
*/
@Test
public void checkQueryListNullable() {
var path = "/bool-list-null";
// Correct value
checkResult(path, "x[]?=true&x[]?=false&x[]?=true", okContains("true,false,true"));
checkResult(path, "x[]?=1&x[]?=0&x[]?=1", okContains("true,false,true"));
// Without/Empty/NoValue param
checkResult(path, okContains("null"));
checkResult(path, "x[]?", okContains("null"));
checkResult(path, "x[]?=", okContains("null"));
// Incorrect value
checkResult(path, "x[]?=1&x[]?=invalid", this::badRequestCannotParseParameter);
// Reverse route
assertThat(BooleanController.queryListNullable(null).url()).isEqualTo(path);
assertThat(BooleanController.queryListNullable(List.of()).url()).isEqualTo(path);
assertThat(BooleanController.queryListNullable(List.of(true, false, true)).url())
.isEqualTo(path + "?x%5B%5D%3F=true&x%5B%5D%3F=false&x%5B%5D%3F=true");
}
/** Tests route {@code /bool-list-opt} {@link controllers.BooleanController#queryListOptional}. */
@Test
public void checkQueryListOptional() {
var path = "/bool-list-opt";
// Correct value
checkResult(path, "x[]?=true&x[]?=false&x[]?=true", okContains("true,false,true"));
checkResult(path, "x[]?=1&x[]?=0&x[]?=1", okContains("true,false,true"));
// Without/Empty/NoValue param
checkResult(path, this::okEmpty);
checkResult(path, "x[]?", this::okEmpty);
checkResult(path, "x[]?=", this::okEmpty);
// Incorrect value
checkResult(path, "x[]?=1&x[]?=invalid", this::badRequestCannotParseParameter);
// Reverse route
assertThat(BooleanController.queryListOptional(Optional.empty()).url()).isEqualTo(path);
assertThat(BooleanController.queryListOptional(Optional.of(List.of())).url()).isEqualTo(path);
assertThat(BooleanController.queryListOptional(Optional.of(List.of(true, false, true))).url())
.isEqualTo(path + "?x%5B%5D%3F=true&x%5B%5D%3F=false&x%5B%5D%3F=true");
}
/**
* Tests route {@code /bool-list-opt-d} {@link
* controllers.BooleanController#queryListOptionalDefault}.
*/
@Test
public void checkQueryListOptionalDefault() {
var path = "/bool-list-opt-d";
// Correct value
checkResult(path, "x[]?%3D=false&x[]?%3D=false&x[]?%3D=true", okContains("false,false,true"));
checkResult(path, "x[]?%3D=0&x[]?%3D=0&x[]?%3D=1", okContains("false,false,true"));
// Without/Empty/NoValue param
checkResult(path, okContains("true,false,true"));
checkResult(path, "x[]?%3D", okContains("true,false,true"));
checkResult(path, "x[]?%3D=", okContains("true,false,true"));
// Incorrect value
checkResult(path, "x[]?%3D=1&x[]?%3D=invalid", this::badRequestCannotParseParameter);
// Reverse route
assertThat(BooleanController.queryListOptionalDefault(Optional.empty()).url()).isEqualTo(path);
assertThat(BooleanController.queryListOptionalDefault(Optional.of(List.of())).url())
.isEqualTo(path);
assertThat(
BooleanController.queryListOptionalDefault(Optional.of(List.of(true, false, true)))
.url())
.isEqualTo(path);
assertThat(
BooleanController.queryListOptionalDefault(Optional.of(List.of(false, false, true)))
.url())
.isEqualTo(path + "?x%5B%5D%3F%3D=false&x%5B%5D%3F%3D=false&x%5B%5D%3F%3D=true");
}
}
| BooleanParamTest |
java | apache__camel | components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/SecurityConstraintMappingTest.java | {
"start": 1016,
"end": 4330
} | class ____ {
@Test
public void testDefault() {
SecurityConstraintMapping matcher = new SecurityConstraintMapping();
assertNotNull(matcher.restricted("/"));
assertNotNull(matcher.restricted("/foo"));
}
@Test
public void testFoo() {
SecurityConstraintMapping matcher = new SecurityConstraintMapping();
matcher.addInclusion("/foo");
assertNull(matcher.restricted("/"));
assertNotNull(matcher.restricted("/foo"));
assertNull(matcher.restricted("/foobar"));
assertNull(matcher.restricted("/foo/bar"));
}
@Test
public void testFooWildcard() {
SecurityConstraintMapping matcher = new SecurityConstraintMapping();
matcher.addInclusion("/foo*");
assertNull(matcher.restricted("/"));
assertNotNull(matcher.restricted("/foo"));
assertNotNull(matcher.restricted("/foobar"));
assertNotNull(matcher.restricted("/foo/bar"));
}
@Test
public void testFooBar() {
SecurityConstraintMapping matcher = new SecurityConstraintMapping();
matcher.addInclusion("/foo");
matcher.addInclusion("/bar");
assertNull(matcher.restricted("/"));
assertNotNull(matcher.restricted("/foo"));
assertNull(matcher.restricted("/foobar"));
assertNull(matcher.restricted("/foo/bar"));
assertNotNull(matcher.restricted("/bar"));
assertNull(matcher.restricted("/barbar"));
assertNull(matcher.restricted("/bar/bar"));
}
@Test
public void testFooBarWildcard() {
SecurityConstraintMapping matcher = new SecurityConstraintMapping();
matcher.addInclusion("/foo*");
matcher.addInclusion("/bar*");
assertNull(matcher.restricted("/"));
assertNotNull(matcher.restricted("/foo"));
assertNotNull(matcher.restricted("/foobar"));
assertNotNull(matcher.restricted("/foo/bar"));
assertNotNull(matcher.restricted("/bar"));
assertNotNull(matcher.restricted("/barbar"));
assertNotNull(matcher.restricted("/bar/bar"));
}
@Test
public void testFooExclusion() {
SecurityConstraintMapping matcher = new SecurityConstraintMapping();
matcher.addInclusion("/foo/*");
matcher.addExclusion("/foo/public/*");
assertNull(matcher.restricted("/"));
assertNotNull(matcher.restricted("/foo"));
assertNotNull(matcher.restricted("/foo/bar"));
assertNull(matcher.restricted("/foo/public"));
assertNull(matcher.restricted("/foo/public/open"));
}
@Test
public void testDefaultExclusion() {
// everything is restricted unless its from the public
SecurityConstraintMapping matcher = new SecurityConstraintMapping();
matcher.addExclusion("/public/*");
matcher.addExclusion("/index");
matcher.addExclusion("/index.html");
assertNotNull(matcher.restricted("/"));
assertNotNull(matcher.restricted("/foo"));
assertNotNull(matcher.restricted("/foo/bar"));
assertNull(matcher.restricted("/public"));
assertNull(matcher.restricted("/public/open"));
assertNull(matcher.restricted("/index"));
assertNull(matcher.restricted("/index.html"));
}
}
| SecurityConstraintMappingTest |
java | apache__camel | components/camel-jpa/src/test/java/org/apache/camel/processor/jpa/JpaPollingConsumerLockEntityTest.java | {
"start": 1289,
"end": 5335
} | class ____ extends AbstractJpaTest {
protected static final String SELECT_ALL_STRING = "select x from " + Customer.class.getName() + " x";
@BeforeEach
public void setupBeans() {
Customer customer = new Customer();
customer.setName("Donald Duck");
saveEntityInDB(customer);
Customer customer2 = new Customer();
customer2.setName("Goofy");
saveEntityInDB(customer2);
assertEntityInDB(2, Customer.class);
}
@Test
public void testPollingConsumerWithLock() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:locked");
mock.expectedBodiesReceived(
"orders: 1",
"orders: 2");
Map<String, Object> headers = new HashMap<>();
headers.put("name", "Donald%");
template.asyncRequestBodyAndHeaders("direct:locked", "message", headers);
template.asyncRequestBodyAndHeaders("direct:locked", "message", headers);
MockEndpoint.assertIsSatisfied(context, 20, TimeUnit.SECONDS);
}
@Test
public void testPollingConsumerWithoutLock() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:not-locked");
MockEndpoint errMock = getMockEndpoint("mock:error");
mock.expectedBodiesReceived("orders: 1");
errMock.expectedMessageCount(1);
errMock.message(0).body().isInstanceOf(OptimisticLockException.class);
Map<String, Object> headers = new HashMap<>();
headers.put("name", "Donald%");
template.asyncRequestBodyAndHeaders("direct:not-locked", "message", headers);
template.asyncRequestBodyAndHeaders("direct:not-locked", "message", headers);
MockEndpoint.assertIsSatisfied(context);
}
@Override
protected RouteBuilder createRouteBuilder() {
return new RouteBuilder() {
public void configure() {
AggregationStrategy enrichStrategy = new AggregationStrategy() {
@Override
public Exchange aggregate(Exchange originalExchange, Exchange jpaExchange) {
Customer customer = jpaExchange.getIn().getBody(Customer.class);
customer.setOrderCount(customer.getOrderCount() + 1);
return jpaExchange;
}
};
onException(Exception.class)
.setBody().simple("${exception}")
.to("mock:error")
.handled(true);
from("direct:locked")
.onException(OptimisticLockException.class)
.redeliveryDelay(60)
.maximumRedeliveries(2)
.end()
.pollEnrich()
.simple("jpa://" + Customer.class.getName()
+ "?lockModeType=OPTIMISTIC_FORCE_INCREMENT&query=select c from Customer c where c.name like '${header.name}'")
.aggregationStrategy(enrichStrategy)
.to("jpa://" + Customer.class.getName())
.setBody().simple("orders: ${body.orderCount}")
.to("mock:locked");
from("direct:not-locked")
.pollEnrich()
.simple("jpa://" + Customer.class.getName()
+ "?query=select c from Customer c where c.name like '${header.name}'")
.aggregationStrategy(enrichStrategy)
.to("jpa://" + Customer.class.getName())
.setBody().simple("orders: ${body.orderCount}")
.to("mock:not-locked");
}
};
}
@Override
protected String routeXml() {
return "org/apache/camel/processor/jpa/springJpaRouteTest.xml";
}
@Override
protected String selectAllString() {
return SELECT_ALL_STRING;
}
}
| JpaPollingConsumerLockEntityTest |
java | apache__camel | dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/OpenstackSwiftComponentBuilderFactory.java | {
"start": 1377,
"end": 1881
} | interface ____ {
/**
* OpenStack Swift (camel-openstack)
* Access OpenStack Swift object/blob store.
*
* Category: container
* Since: 2.19
* Maven coordinates: org.apache.camel:camel-openstack
*
* @return the dsl builder
*/
static OpenstackSwiftComponentBuilder openstackSwift() {
return new OpenstackSwiftComponentBuilderImpl();
}
/**
* Builder for the OpenStack Swift component.
*/
| OpenstackSwiftComponentBuilderFactory |
java | dropwizard__dropwizard | dropwizard-client/src/test/java/io/dropwizard/client/DropwizardSSLConnectionSocketFactoryTest.java | {
"start": 2217,
"end": 16109
} | class ____ extends Application<Configuration> {
public static void main(String[] args) throws Exception {
new TlsTestApplication().run(args);
}
@Override
public void run(Configuration configuration, Environment environment) {
environment.jersey().register(TestResource.class);
}
}
static {
Security.insertProviderAt(new BouncyCastleProvider(), 1);
}
@AfterAll
static void classTearDown() {
Security.removeProvider(PROVIDER_NAME);
}
private static final DropwizardAppExtension<Configuration> TLS_APP_RULE = new DropwizardAppExtension<>(TlsTestApplication.class,
"yaml/ssl_connection_socket_factory_test.yml",
new ResourceConfigurationSourceProvider(),
"tls",
config("tls", "server.applicationConnectors[0].keyStorePath", resourceFilePath("stores/server/keycert.p12")),
config("tls", "server.applicationConnectors[1].keyStorePath", resourceFilePath("stores/server/self_sign_keycert.p12")),
config("tls", "server.applicationConnectors[2].keyStorePath", resourceFilePath("stores/server/keycert.p12")),
config("tls", "server.applicationConnectors[2].trustStorePath", resourceFilePath("stores/server/ca_truststore.ts")),
config("tls", "server.applicationConnectors[2].wantClientAuth", "true"),
config("tls", "server.applicationConnectors[2].needClientAuth", "true"),
config("tls", "server.applicationConnectors[2].validatePeers", "false"),
config("tls", "server.applicationConnectors[2].trustStorePassword", "password"),
config("tls", "server.applicationConnectors[3].keyStorePath", resourceFilePath("stores/server/bad_host_keycert.p12")),
config("tls", "server.applicationConnectors[4].keyStorePath", resourceFilePath("stores/server/keycert.p12")),
config("tls", "server.applicationConnectors[4].supportedProtocols", "SSLv1,SSLv2,SSLv3"),
config("tls", "server.applicationConnectors[5].keyStorePath", resourceFilePath("stores/server/acme-weak.keystore.p12")),
config("tls", "server.applicationConnectors[5].trustStorePath", resourceFilePath("stores/server/acme-weak.truststore.p12")),
config("tls", "server.applicationConnectors[5].wantClientAuth", "true"),
config("tls", "server.applicationConnectors[5].needClientAuth", "true"),
config("tls", "server.applicationConnectors[5].validatePeers", "true"),
config("tls", "server.applicationConnectors[5].trustStorePassword", "acme2"),
config("tls", "server.applicationConnectors[5].keyStorePassword", "acme2"),
config("tls", "server.applicationConnectors[5].trustStoreProvider", PROVIDER_NAME),
config("tls", "server.applicationConnectors[5].keyStoreProvider", PROVIDER_NAME));
@BeforeEach
void setUp() throws Exception {
tlsConfiguration = new TlsConfiguration();
tlsConfiguration.setTrustStorePath(toFile("stores/server/ca_truststore.ts"));
tlsConfiguration.setTrustStorePassword("password");
jerseyClientConfiguration = new JerseyClientConfiguration();
jerseyClientConfiguration.setTlsConfiguration(tlsConfiguration);
jerseyClientConfiguration.setConnectionTimeout(Duration.milliseconds(2000));
jerseyClientConfiguration.setTimeout(Duration.milliseconds(5000));
}
@Test
void configOnlyConstructorShouldSetNullCustomVerifier() {
assertThat(new DropwizardSSLConnectionSocketFactory(tlsConfiguration).verifier).isNull();
}
@Test
void shouldReturn200IfServerCertInTruststore() {
final Client client = new JerseyClientBuilder(TLS_APP_RULE.getEnvironment()).using(jerseyClientConfiguration).build("tls_working_client");
final Response response = client.target(String.format("https://localhost:%d", TLS_APP_RULE.getLocalPort())).request().get();
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
void shouldErrorIfServerCertNotFoundInTruststore() throws Exception {
tlsConfiguration.setTrustStorePath(toFile("stores/server/other_cert_truststore.ts"));
final Client client = new JerseyClientBuilder(TLS_APP_RULE.getEnvironment()).using(jerseyClientConfiguration).build("tls_broken_client");
Invocation.Builder request = client.target(String.format("https://localhost:%d", TLS_APP_RULE.getLocalPort())).request();
assertThatExceptionOfType(ProcessingException.class)
.isThrownBy(request::get)
.withCauseInstanceOf(SSLHandshakeException.class);
}
@Test
void shouldNotErrorIfServerCertSelfSignedAndSelfSignedCertsAllowed() {
tlsConfiguration.setTrustSelfSignedCertificates(true);
final Client client = new JerseyClientBuilder(TLS_APP_RULE.getEnvironment()).using(jerseyClientConfiguration).build("self_sign_permitted");
final Response response = client.target(String.format("https://localhost:%d", TLS_APP_RULE.getTestSupport().getPort(1))).request().get();
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
void shouldErrorIfServerCertSelfSignedAndSelfSignedCertsNotAllowed() {
final Client client = new JerseyClientBuilder(TLS_APP_RULE.getEnvironment()).using(jerseyClientConfiguration).build("self_sign_failure");
Invocation.Builder request = client.target(String.format("https://localhost:%d", TLS_APP_RULE.getPort(1))).request();
assertThatExceptionOfType(ProcessingException.class)
.isThrownBy(() -> request.get(ClientResponse.class))
.withCauseInstanceOf(SSLHandshakeException.class);
}
@Test
void shouldReturn200IfAbleToClientAuth() throws Exception {
tlsConfiguration.setKeyStorePath(toFile("stores/client/keycert.p12"));
tlsConfiguration.setKeyStorePassword("password");
tlsConfiguration.setKeyStoreType("PKCS12");
final Client client = new JerseyClientBuilder(TLS_APP_RULE.getEnvironment()).using(jerseyClientConfiguration).build("client_auth_working");
final Response response = client.target(String.format("https://localhost:%d", TLS_APP_RULE.getPort(2))).request().get();
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
void shouldErrorIfClientAuthFails() throws Exception {
tlsConfiguration.setKeyStorePath(toFile("stores/server/self_sign_keycert.p12"));
tlsConfiguration.setKeyStorePassword("password");
tlsConfiguration.setKeyStoreType("PKCS12");
final Client client = new JerseyClientBuilder(TLS_APP_RULE.getEnvironment()).using(jerseyClientConfiguration).build("client_auth_broken");
Invocation.Builder request = client.target(String.format("https://localhost:%d", TLS_APP_RULE.getPort(2))).request();
assertThatExceptionOfType(ProcessingException.class)
.isThrownBy(request::get)
.satisfies(e -> assertThat(e.getCause()).isInstanceOfAny(SocketException.class, SSLHandshakeException.class, SSLException.class));
}
@Test
void shouldReturn200IfAbleToClientAuthSpecifyingCertAliasForGoodCert() throws Exception {
tlsConfiguration.setKeyStorePath(toFile("stores/client/twokeys.p12"));
tlsConfiguration.setKeyStorePassword("password");
tlsConfiguration.setKeyStoreType("PKCS12");
tlsConfiguration.setCertAlias("1");
final Client client = new JerseyClientBuilder(TLS_APP_RULE.getEnvironment()).using(jerseyClientConfiguration).build("client_auth_using_cert_alias_working");
final Response response = client.target(String.format("https://localhost:%d", TLS_APP_RULE.getPort(2))).request().get();
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
void shouldErrorIfTryToClientAuthSpecifyingCertAliasForBadCert() throws Exception {
tlsConfiguration.setKeyStorePath(toFile("stores/client/twokeys.p12"));
tlsConfiguration.setKeyStorePassword("password");
tlsConfiguration.setKeyStoreType("PKCS12");
tlsConfiguration.setCertAlias("2");
final Client client = new JerseyClientBuilder(TLS_APP_RULE.getEnvironment()).using(jerseyClientConfiguration).build("client_auth_using_cert_alias_broken");
Invocation.Builder request = client.target(String.format("https://localhost:%d", TLS_APP_RULE.getPort(2))).request();
assertThatExceptionOfType(ProcessingException.class)
.isThrownBy(request::get)
.satisfies(e -> assertThat(e.getCause()).isInstanceOfAny(SocketException.class, SSLHandshakeException.class, SSLException.class));
}
@Test
void shouldErrorIfTryToClientAuthSpecifyingUnknownCertAlias() throws Exception {
tlsConfiguration.setKeyStorePath(toFile("stores/client/twokeys.p12"));
tlsConfiguration.setKeyStorePassword("password");
tlsConfiguration.setKeyStoreType("PKCS12");
tlsConfiguration.setCertAlias("unknown");
final Client client = new JerseyClientBuilder(TLS_APP_RULE.getEnvironment()).using(jerseyClientConfiguration).build("client_auth_using_unknown_cert_alias_broken");
Invocation.Builder request = client.target(String.format("https://localhost:%d", TLS_APP_RULE.getPort(2))).request();
assertThatExceptionOfType(ProcessingException.class)
.isThrownBy(request::get)
.satisfies(e -> assertThat(e.getCause()).isInstanceOfAny(SocketException.class, SSLHandshakeException.class, SSLException.class));
}
@Test
void shouldErrorIfHostnameVerificationOnAndServerHostnameDoesntMatch() {
final Client client = new JerseyClientBuilder(TLS_APP_RULE.getEnvironment()).using(jerseyClientConfiguration).build("bad_host_broken");
assertThatThrownBy(() -> client.target(String.format("https://localhost:%d", TLS_APP_RULE.getPort(3))).request().get())
.hasCauseExactlyInstanceOf(SSLPeerUnverifiedException.class)
.hasRootCauseMessage("Certificate for <localhost> doesn't match common name of the certificate subject: badhost");
}
@Test
void shouldErrorIfHostnameVerificationOnAndServerHostnameMatchesAndFailVerifierSpecified() {
final Client client = new JerseyClientBuilder(TLS_APP_RULE.getEnvironment()).using(jerseyClientConfiguration).using(new FailVerifier()).build("bad_host_broken_fail_verifier");
assertThatThrownBy(() -> client.target(String.format("https://localhost:%d", TLS_APP_RULE.getLocalPort())).request().get())
.hasCauseExactlyInstanceOf(SSLPeerUnverifiedException.class)
.hasRootCauseMessage("Certificate for <localhost> doesn't match any of the subject alternative names: []");
}
@Test
void shouldBeOkIfHostnameVerificationOnAndServerHostnameDoesntMatchAndNoopVerifierSpecified() {
final Client client = new JerseyClientBuilder(TLS_APP_RULE.getEnvironment()).using(jerseyClientConfiguration).using(new NoopHostnameVerifier()).build("bad_host_noop_verifier_working");
final Response response = client.target(String.format("https://localhost:%d", TLS_APP_RULE.getPort(3))).request().get();
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
void shouldBeOkIfHostnameVerificationOffAndServerHostnameDoesntMatch() {
tlsConfiguration.setVerifyHostname(false);
final Client client = new JerseyClientBuilder(TLS_APP_RULE.getEnvironment()).using(jerseyClientConfiguration).build("bad_host_working");
final Response response = client.target(String.format("https://localhost:%d", TLS_APP_RULE.getPort(3))).request().get();
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
void shouldBeOkIfHostnameVerificationOffAndServerHostnameMatchesAndFailVerifierSpecified() {
tlsConfiguration.setVerifyHostname(false);
final Client client = new JerseyClientBuilder(TLS_APP_RULE.getEnvironment()).using(jerseyClientConfiguration).using(new FailVerifier()).build("bad_host_fail_verifier_working");
final Response response = client.target(String.format("https://localhost:%d", TLS_APP_RULE.getLocalPort())).request().get();
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
void shouldRejectNonSupportedProtocols() {
tlsConfiguration.setSupportedProtocols(Collections.singletonList("TLSv1.2"));
final Client client = new JerseyClientBuilder(TLS_APP_RULE.getEnvironment()).using(jerseyClientConfiguration).build("reject_non_supported");
Invocation.Builder request = client.target(String.format("https://localhost:%d", TLS_APP_RULE.getPort(4))).request();
assertThatExceptionOfType(ProcessingException.class)
.isThrownBy(request::get)
.withRootCauseInstanceOf(IOException.class);
}
@Test
void shouldSucceedWithBcProvider() throws Exception {
// switching host verifier off for simplicity
tlsConfiguration.setVerifyHostname(false);
tlsConfiguration.setKeyStorePath(toFile("stores/client/acme-weak.keystore.p12"));
tlsConfiguration.setKeyStorePassword("acme2");
tlsConfiguration.setKeyStoreType("PKCS12");
tlsConfiguration.setKeyStoreProvider(PROVIDER_NAME);
tlsConfiguration.setCertAlias("acme-weak");
tlsConfiguration.setTrustStorePath(toFile("stores/server/acme-weak.truststore.p12"));
tlsConfiguration.setTrustStorePassword("acme2");
tlsConfiguration.setTrustStoreType("PKCS12");
tlsConfiguration.setTrustStoreProvider(PROVIDER_NAME);
final Client client = new JerseyClientBuilder(TLS_APP_RULE.getEnvironment()).using(jerseyClientConfiguration).build("custom_jce_supported");
final Response response = client.target(String.format("https://localhost:%d", TLS_APP_RULE.getPort(5))).request().get();
assertThat(response.getStatus()).isEqualTo(200);
}
private static | TlsTestApplication |
java | ReactiveX__RxJava | src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatMapScheduler.java | {
"start": 11608,
"end": 17404
} | class ____<T, R>
extends BaseConcatMapSubscriber<T, R> {
private static final long serialVersionUID = -2945777694260521066L;
final Subscriber<? super R> downstream;
final boolean veryEnd;
ConcatMapDelayed(Subscriber<? super R> actual,
Function<? super T, ? extends Publisher<? extends R>> mapper,
int prefetch, boolean veryEnd, Scheduler.Worker worker) {
super(mapper, prefetch, worker);
this.downstream = actual;
this.veryEnd = veryEnd;
}
@Override
void subscribeActual() {
downstream.onSubscribe(this);
}
@Override
public void onError(Throwable t) {
if (errors.tryAddThrowableOrReport(t)) {
done = true;
schedule();
}
}
@Override
public void innerNext(R value) {
downstream.onNext(value);
}
@Override
public void innerError(Throwable e) {
if (errors.tryAddThrowableOrReport(e)) {
if (!veryEnd) {
upstream.cancel();
done = true;
}
active = false;
schedule();
}
}
@Override
public void request(long n) {
inner.request(n);
}
@Override
public void cancel() {
if (!cancelled) {
cancelled = true;
inner.cancel();
upstream.cancel();
worker.dispose();
errors.tryTerminateAndReport();
}
}
@Override
void schedule() {
if (getAndIncrement() == 0) {
worker.schedule(this);
}
}
@Override
public void run() {
for (;;) {
if (cancelled) {
return;
}
if (!active) {
boolean d = done;
if (d && !veryEnd) {
Throwable ex = errors.get();
if (ex != null) {
errors.tryTerminateConsumer(downstream);
worker.dispose();
return;
}
}
T v;
try {
v = queue.poll();
} catch (Throwable e) {
Exceptions.throwIfFatal(e);
upstream.cancel();
errors.tryAddThrowableOrReport(e);
errors.tryTerminateConsumer(downstream);
worker.dispose();
return;
}
boolean empty = v == null;
if (d && empty) {
errors.tryTerminateConsumer(downstream);
worker.dispose();
return;
}
if (!empty) {
Publisher<? extends R> p;
try {
p = Objects.requireNonNull(mapper.apply(v), "The mapper returned a null Publisher");
} catch (Throwable e) {
Exceptions.throwIfFatal(e);
upstream.cancel();
errors.tryAddThrowableOrReport(e);
errors.tryTerminateConsumer(downstream);
worker.dispose();
return;
}
if (sourceMode != QueueSubscription.SYNC) {
int c = consumed + 1;
if (c == limit) {
consumed = 0;
upstream.request(c);
} else {
consumed = c;
}
}
if (p instanceof Supplier) {
@SuppressWarnings("unchecked")
Supplier<R> supplier = (Supplier<R>) p;
R vr;
try {
vr = supplier.get();
} catch (Throwable e) {
Exceptions.throwIfFatal(e);
errors.tryAddThrowableOrReport(e);
if (!veryEnd) {
upstream.cancel();
errors.tryTerminateConsumer(downstream);
worker.dispose();
return;
}
vr = null;
}
if (vr == null || cancelled) {
continue;
}
if (inner.isUnbounded()) {
downstream.onNext(vr);
continue;
} else {
active = true;
inner.setSubscription(new SimpleScalarSubscription<>(vr, inner));
}
} else {
active = true;
p.subscribe(inner);
}
}
}
if (decrementAndGet() == 0) {
break;
}
}
}
}
}
| ConcatMapDelayed |
java | FasterXML__jackson-databind | src/test/java/tools/jackson/databind/ser/enums/EnumSerializationMixinTest.java | {
"start": 876,
"end": 2354
} | enum ____ {
ITEM_A {
@Override
public String toString() {
return "A_mixin";
}
},
@JsonProperty("B_MIXIN_PROP")
ITEM_B,
@JsonAlias({"C_MIXIN_ALIAS_1", "C_MIXIN_ALIAS_2"})
@JsonProperty("C_COMMON")
ITEM_C_MIXIN,
ITEM_MIXIN;
@Override
public String toString() {
return "SHOULD NOT USE WITH TO STRING";
}
}
@Test
public void testSerialization() throws Exception {
ObjectMapper mixinMapper = jsonMapperBuilder()
.disable(EnumFeature.WRITE_ENUMS_USING_TO_STRING)
.addMixIn(EnumBaseA.class, EnumMixinA.class).build();
// equal name(), different toString() value
assertEquals(q("ITEM_A"), _w(EnumBaseA.ITEM_A, mixinMapper));
// equal name(), differnt @JsonProperty
assertEquals(q("B_MIXIN_PROP"), _w(EnumBaseA.ITEM_B, mixinMapper));
// different name(), equal @JsonProperty
assertEquals(q("C_COMMON"), _w(EnumBaseA.ITEM_C_BASE, mixinMapper));
// different name(), equal ordinal()
assertEquals(q("ITEM_ORIGIN"), _w(EnumBaseA.ITEM_ORIGIN, mixinMapper));
}
/**
* Helper method to {@link ObjectMapper#writeValueAsString(Object)}
*/
private <T> String _w(T value, ObjectMapper mapper) throws Exception {
return mapper.writeValueAsString(value);
}
}
| EnumMixinA |
java | apache__flink | flink-tests/src/test/java/org/apache/flink/test/classloading/jar/CheckpointingCustomKvStateProgram.java | {
"start": 2725,
"end": 4707
} | class ____ {
public static void main(String[] args) throws Exception {
final String checkpointPath = args[0];
final String outputPath = args[1];
final int parallelism = 1;
StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
env.setParallelism(parallelism);
env.enableCheckpointing(100);
RestartStrategyUtils.configureFixedDelayRestartStrategy(env, 1, 1000L);
StateBackendUtils.configureHashMapStateBackend(env);
CheckpointStorageUtils.configureFileSystemCheckpointStorage(env, checkpointPath);
DataStream<Integer> source = env.addSource(new InfiniteIntegerSource());
source.map(
new MapFunction<Integer, Tuple2<Integer, Integer>>() {
private static final long serialVersionUID = 1L;
@Override
public Tuple2<Integer, Integer> map(Integer value) throws Exception {
return new Tuple2<>(
ThreadLocalRandom.current().nextInt(parallelism), value);
}
})
.keyBy(
new KeySelector<Tuple2<Integer, Integer>, Integer>() {
private static final long serialVersionUID = 1L;
@Override
public Integer getKey(Tuple2<Integer, Integer> value) throws Exception {
return value.f0;
}
})
.flatMap(new ReducingStateFlatMap())
.sinkTo(
FileSink.forRowFormat(
new Path(outputPath), new SimpleStringEncoder<Integer>())
.build());
env.execute();
}
private static | CheckpointingCustomKvStateProgram |
java | alibaba__druid | core/src/test/java/com/alibaba/druid/bvt/sql/bigquery/BigQueryResourceTest.java | {
"start": 159,
"end": 425
} | class ____ extends SQLResourceTest {
public BigQueryResourceTest() {
super(DbType.bigquery);
}
@Test
public void bigquery_parse() throws Exception {
fileTest(0, 999, i -> "bvt/parser/bigquery/" + i + ".txt");
}
}
| BigQueryResourceTest |
java | spring-projects__spring-boot | module/spring-boot-hibernate/src/test/java/org/springframework/boot/hibernate/autoconfigure/HibernateJpaAutoConfigurationTests.java | {
"start": 44445,
"end": 44701
} | class ____ {
@Bean
OpenEntityManagerInViewFilter openEntityManagerInViewFilter() {
return new OpenEntityManagerInViewFilter();
}
}
@Configuration(proxyBeanMethods = false)
@TestAutoConfigurationPackage(City.class)
static | TestFilterConfiguration |
java | google__error-prone | check_api/src/test/java/com/google/errorprone/util/ASTHelpersTest.java | {
"start": 14332,
"end": 14502
} | interface ____ {}
""");
writeFile(
"B.java",
"""
import com.google.errorprone.util.InheritedAnnotation;
public | InheritedAnnotation |
java | spring-projects__spring-boot | documentation/spring-boot-actuator-docs/src/test/java/org/springframework/boot/actuate/docs/management/HeapDumpWebEndpointDocumentationTests.java | {
"start": 2261,
"end": 2643
} | class ____ {
@Bean
HeapDumpWebEndpoint endpoint() {
return new HeapDumpWebEndpoint() {
@Override
protected HeapDumper createHeapDumper() {
return (live) -> {
File file = Files.createTempFile("heap-", ".hprof").toFile();
FileCopyUtils.copy("<<binary content>>", new FileWriter(file));
return file;
};
}
};
}
}
}
| TestConfiguration |
java | hibernate__hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/annotations/idclass/IdClassOneToOneTest.java | {
"start": 1059,
"end": 2472
} | class ____ {
@BeforeAll
public void setUp(SessionFactoryScope scope) {
scope.inTransaction( session -> {
session.persist( new ParentEntity( "1", "one" ) );
session.persist( new ChildEntity( "1", "one" ) );
} );
}
@AfterAll
public void tearDown(SessionFactoryScope scope) {
scope.inTransaction( session -> {
session.createMutationQuery( "delete from ChildEntity" ).executeUpdate();
session.createMutationQuery( "delete from ParentEntity" ).executeUpdate();
} );
}
@Test
public void testQuery(SessionFactoryScope scope) {
scope.inTransaction( session -> {
final ParentEntity result = session.createQuery(
"select p from ParentEntity p where p.first = :first",
ParentEntity.class
).setParameter( "first", "1" ).getSingleResult();
assertThat( result.getChildEntity() ).isNotNull();
assertThat( result.getChildEntity().getFirst() ).isEqualTo( "1" );
assertThat( result.getChildEntity().getSecond() ).isEqualTo( "one" );
} );
}
@Test
public void testFind(SessionFactoryScope scope) {
scope.inTransaction( session -> {
final ParentEntity result = session.find( ParentEntity.class, new CompositeId( "1", "one" ) );
assertThat( result.getChildEntity() ).isNotNull();
assertThat( result.getChildEntity().getFirst() ).isEqualTo( "1" );
assertThat( result.getChildEntity().getSecond() ).isEqualTo( "one" );
} );
}
public static | IdClassOneToOneTest |
java | apache__hadoop | hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/speculate/forecast/TestSimpleExponentialForecast.java | {
"start": 1162,
"end": 4050
} | class ____ {
private static final Logger LOG = LoggerFactory.getLogger(TestSimpleExponentialForecast.class);
private static long clockTicks = 1000L;
private ControlledClock clock;
private int incTestSimpleExponentialForecast() {
clock = new ControlledClock();
clock.tickMsec(clockTicks);
SimpleExponentialSmoothing forecaster =
new SimpleExponentialSmoothing(10000,
12, 10000, clock.getTime());
double progress = 0.0;
while(progress <= 1.0) {
clock.tickMsec(clockTicks);
forecaster.incorporateReading(clock.getTime(), progress);
LOG.info("progress: " + progress + " --> " + forecaster.toString());
progress += 0.005;
}
return forecaster.getSSE() < Math.pow(10.0, -6) ? 0 : 1;
}
private int decTestSimpleExponentialForecast() {
clock = new ControlledClock();
clock.tickMsec(clockTicks);
SimpleExponentialSmoothing forecaster =
new SimpleExponentialSmoothing(800,
12, 10000, clock.getTime());
double progress = 0.0;
double[] progressRates = new double[]{0.005, 0.004, 0.002, 0.001};
while(progress <= 1.0) {
clock.tickMsec(clockTicks);
forecaster.incorporateReading(clock.getTime(), progress);
LOG.info("progress: " + progress + " --> " + forecaster.toString());
progress += progressRates[(int)(progress / 0.25)];
}
return forecaster.getSSE() < Math.pow(10.0, -6) ? 0 : 1;
}
private int zeroTestSimpleExponentialForecast() {
clock = new ControlledClock();
clock.tickMsec(clockTicks);
SimpleExponentialSmoothing forecaster =
new SimpleExponentialSmoothing(800,
12, 10000, clock.getTime());
double progress = 0.0;
double[] progressRates = new double[]{0.005, 0.004, 0.002, 0.0, 0.003};
int progressInd = 0;
while(progress <= 1.0) {
clock.tickMsec(clockTicks);
forecaster.incorporateReading(clock.getTime(), progress);
LOG.info("progress: " + progress + " --> " + forecaster.toString());
int currInd = progressInd++ > 1000 ? 4 : (int)(progress / 0.25);
progress += progressRates[currInd];
}
return forecaster.getSSE() < Math.pow(10.0, -6) ? 0 : 1;
}
@Test
public void testSimpleExponentialForecastLinearInc() throws Exception {
int res = incTestSimpleExponentialForecast();
assertEquals(res, 0, "We got the wrong estimate from simple exponential.");
}
@Test
public void testSimpleExponentialForecastLinearDec() throws Exception {
int res = decTestSimpleExponentialForecast();
assertEquals(res, 0, "We got the wrong estimate from simple exponential.");
}
@Test
public void testSimpleExponentialForecastZeros() throws Exception {
int res = zeroTestSimpleExponentialForecast();
assertEquals(res, 0, "We got the wrong estimate from simple exponential.");
}
}
| TestSimpleExponentialForecast |
java | grpc__grpc-java | api/src/jmh/java/io/grpc/WriteBenchmark.java | {
"start": 1147,
"end": 2067
} | class ____ {
@Param({"0", "10", "25", "100"})
public int preexistingKeys;
Context.Key<Object> key1 = Context.key("key1");
Context.Key<Object> key2 = Context.key("key2");
Context.Key<Object> key3 = Context.key("key3");
Context.Key<Object> key4 = Context.key("key4");
Context context;
Object val = new Object();
@Setup
public void setup() {
context = Context.ROOT;
for (int i = 0; i < preexistingKeys; i++) {
context = context.withValue(Context.key("preexisting_key" + i), val);
}
}
}
/** Perform the write operation. */
@Benchmark
@BenchmarkMode(Mode.SampleTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public Context doWrite(ContextState state, Blackhole bh) {
return state.context.withValues(
state.key1, state.val,
state.key2, state.val,
state.key3, state.val,
state.key4, state.val);
}
}
| ContextState |
java | quarkusio__quarkus | extensions/reactive-pg-client/runtime/src/main/java/io/quarkus/reactive/pg/client/runtime/PgPoolRecorder.java | {
"start": 14852,
"end": 15806
} | class ____ implements PgPoolCreator.Input {
private final Vertx vertx;
private final PoolOptions poolOptions;
private final List<PgConnectOptions> pgConnectOptionsList;
public DefaultInput(Vertx vertx, PoolOptions poolOptions, List<PgConnectOptions> pgConnectOptionsList) {
this.vertx = vertx;
this.poolOptions = poolOptions;
this.pgConnectOptionsList = pgConnectOptionsList;
}
@Override
public Vertx vertx() {
return vertx;
}
@Override
public PoolOptions poolOptions() {
return poolOptions;
}
@Override
public List<PgConnectOptions> pgConnectOptionsList() {
return pgConnectOptionsList;
}
}
public RuntimeValue<PgPoolSupport> createPgPoolSupport(Set<String> pgPoolNames) {
return new RuntimeValue<>(new PgPoolSupport(pgPoolNames));
}
}
| DefaultInput |
java | hibernate__hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/optlock/Document.java | {
"start": 173,
"end": 1604
} | class ____ {
private Long id;
private String author;
private String title;
private String summary;
private String text;
private PublicationDate pubDate;
private int totalSales;
/**
* @return Returns the author.
*/
public String getAuthor() {
return author;
}
/**
* @param author The author to set.
*/
public void setAuthor(String author) {
this.author = author;
}
/**
* @return Returns the id.
*/
public Long getId() {
return id;
}
/**
* @param id The id to set.
*/
public void setId(Long id) {
this.id = id;
}
/**
* @return Returns the summary.
*/
public String getSummary() {
return summary;
}
/**
* @param summary The summary to set.
*/
public void setSummary(String summary) {
this.summary = summary;
}
/**
* @return Returns the text.
*/
public String getText() {
return text;
}
/**
* @param text The text to set.
*/
public void setText(String text) {
this.text = text;
}
/**
* @return Returns the title.
*/
public String getTitle() {
return title;
}
/**
* @param title The title to set.
*/
public void setTitle(String title) {
this.title = title;
}
public PublicationDate getPubDate() {
return pubDate;
}
public void setPubDate(PublicationDate pubDate) {
this.pubDate = pubDate;
}
public int getTotalSales() {
return totalSales;
}
public void setTotalSales(int totalSales) {
this.totalSales = totalSales;
}
}
| Document |
java | apache__hadoop | hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/timeline/recovery/TimelineStateStore.java | {
"start": 1649,
"end": 5626
} | class ____ {
int latestSequenceNumber = 0;
Map<TimelineDelegationTokenIdentifier, Long> tokenState =
new HashMap<TimelineDelegationTokenIdentifier, Long>();
Set<DelegationKey> tokenMasterKeyState = new HashSet<DelegationKey>();
public int getLatestSequenceNumber() {
return latestSequenceNumber;
}
public Map<TimelineDelegationTokenIdentifier, Long> getTokenState() {
return tokenState;
}
public Set<DelegationKey> getTokenMasterKeyState() {
return tokenMasterKeyState;
}
}
public TimelineStateStore() {
super(TimelineStateStore.class.getName());
}
public TimelineStateStore(String name) {
super(name);
}
/**
* Initialize the state storage
*
* @param conf the configuration
* @throws IOException
*/
@Override
public void serviceInit(Configuration conf) throws IOException {
initStorage(conf);
}
/**
* Start the state storage for use
*
* @throws IOException
*/
@Override
public void serviceStart() throws IOException {
startStorage();
}
/**
* Shutdown the state storage.
*
* @throws IOException
*/
@Override
public void serviceStop() throws IOException {
closeStorage();
}
/**
* Implementation-specific initialization.
*
* @param conf the configuration
* @throws IOException
*/
protected abstract void initStorage(Configuration conf) throws IOException;
/**
* Implementation-specific startup.
*
* @throws IOException
*/
protected abstract void startStorage() throws IOException;
/**
* Implementation-specific shutdown.
*
* @throws IOException
*/
protected abstract void closeStorage() throws IOException;
/**
* Load the timeline service state from the state storage.
*
* @throws IOException
*/
public abstract TimelineServiceState loadState() throws IOException;
/**
* Blocking method to store a delegation token along with the current token
* sequence number to the state storage.
*
* Implementations must not return from this method until the token has been
* committed to the state store.
*
* @param tokenId the token to store
* @param renewDate the token renewal deadline
* @throws IOException
*/
public abstract void storeToken(TimelineDelegationTokenIdentifier tokenId,
Long renewDate) throws IOException;
/**
* Blocking method to update the expiration of a delegation token
* in the state storage.
*
* Implementations must not return from this method until the expiration
* date of the token has been updated in the state store.
*
* @param tokenId the token to update
* @param renewDate the new token renewal deadline
* @throws IOException
*/
public abstract void updateToken(TimelineDelegationTokenIdentifier tokenId,
Long renewDate) throws IOException;
/**
* Blocking method to remove a delegation token from the state storage.
*
* Implementations must not return from this method until the token has been
* removed from the state store.
*
* @param tokenId the token to remove
* @throws IOException
*/
public abstract void removeToken(TimelineDelegationTokenIdentifier tokenId)
throws IOException;
/**
* Blocking method to store a delegation token master key.
*
* Implementations must not return from this method until the key has been
* committed to the state store.
*
* @param key the master key to store
* @throws IOException
*/
public abstract void storeTokenMasterKey(
DelegationKey key) throws IOException;
/**
* Blocking method to remove a delegation token master key.
*
* Implementations must not return from this method until the key has been
* removed from the state store.
*
* @param key the master key to remove
* @throws IOException
*/
public abstract void removeTokenMasterKey(DelegationKey key)
throws IOException;
}
| TimelineServiceState |
java | spring-projects__spring-framework | spring-test/src/test/java/org/springframework/test/web/servlet/samples/client/standalone/resultmatches/ModelAssertionTests.java | {
"start": 4556,
"end": 4694
} | class ____ {
@ModelAttribute("globalAttrName")
String getAttribute() {
return "Global Attribute Value";
}
}
}
| ModelAttributeAdvice |
java | spring-projects__spring-framework | spring-webmvc/src/main/java/org/springframework/web/servlet/FrameworkServlet.java | {
"start": 37469,
"end": 47791
} | class ____ in order to intercept requests
* using PATCH or non-standard HTTP methods (WebDAV).
*/
@Override
protected void service(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
if (HTTP_SERVLET_METHODS.contains(request.getMethod())) {
super.service(request, response);
}
else {
processRequest(request, response);
}
}
/**
* Delegate GET requests to processRequest/doService.
* <p>Will also be invoked by HttpServlet's default implementation of {@code doHead},
* with a {@code NoBodyResponse} that just captures the content length.
* @see #doService
* @see #doHead
*/
@Override
protected final void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Delegate POST requests to {@link #processRequest}.
* @see #doService
*/
@Override
protected final void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Delegate PUT requests to {@link #processRequest}.
* @see #doService
*/
@Override
protected final void doPut(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Delegate DELETE requests to {@link #processRequest}.
* @see #doService
*/
@Override
protected final void doDelete(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Delegate OPTIONS requests to {@link #processRequest}, if desired.
* <p>Applies HttpServlet's standard OPTIONS processing otherwise,
* and also if there is still no 'Allow' header set after dispatching.
* @see #doService
*/
@Override
protected void doOptions(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
if (this.dispatchOptionsRequest || CorsUtils.isPreFlightRequest(request)) {
processRequest(request, response);
if (response.containsHeader(HttpHeaders.ALLOW)) {
// Proper OPTIONS response coming from a handler - we're done.
return;
}
}
// Use response wrapper in order to always add PATCH to the allowed methods
super.doOptions(request, new HttpServletResponseWrapper(response) {
@Override
public void setHeader(String name, String value) {
if (HttpHeaders.ALLOW.equals(name)) {
value = (StringUtils.hasLength(value) ? value + ", " : "") + HttpMethod.PATCH.name();
}
super.setHeader(name, value);
}
});
}
/**
* Delegate TRACE requests to {@link #processRequest}, if desired.
* <p>Applies HttpServlet's standard TRACE processing otherwise.
* @see #doService
*/
@Override
protected void doTrace(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
if (this.dispatchTraceRequest) {
processRequest(request, response);
if ("message/http".equals(response.getContentType())) {
// Proper TRACE response coming from a handler - we're done.
return;
}
}
// Work around until https://github.com/jakartaee/servlet/pull/545 is fixed and in use
if (request.getDispatcherType() != DispatcherType.ERROR) {
super.doTrace(request, response);
}
}
/**
* Process this request, publishing an event regardless of the outcome.
* <p>The actual event handling is performed by the abstract
* {@link #doService} template method.
*/
protected final void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
long startTime = System.currentTimeMillis();
Throwable failureCause = null;
LocaleContext previousLocaleContext = LocaleContextHolder.getLocaleContext();
LocaleContext localeContext = buildLocaleContext(request);
RequestAttributes previousAttributes = RequestContextHolder.getRequestAttributes();
ServletRequestAttributes requestAttributes = buildRequestAttributes(request, response, previousAttributes);
WebAsyncManager asyncManager = WebAsyncUtils.getAsyncManager(request);
asyncManager.registerCallableInterceptor(FrameworkServlet.class.getName(), new RequestBindingInterceptor());
initContextHolders(request, localeContext, requestAttributes);
try {
doService(request, response);
}
catch (ServletException | IOException ex) {
failureCause = ex;
throw ex;
}
catch (Throwable ex) {
failureCause = ex;
throw new ServletException("Request processing failed: " + ex, ex);
}
finally {
resetContextHolders(request, previousLocaleContext, previousAttributes);
if (requestAttributes != null) {
requestAttributes.requestCompleted();
}
logResult(request, response, failureCause, asyncManager);
publishRequestHandledEvent(request, response, startTime, failureCause);
}
}
/**
* Build a LocaleContext for the given request, exposing the request's
* primary locale as current locale.
* @param request current HTTP request
* @return the corresponding LocaleContext, or {@code null} if none to bind
* @see LocaleContextHolder#setLocaleContext
*/
protected @Nullable LocaleContext buildLocaleContext(HttpServletRequest request) {
return new SimpleLocaleContext(request.getLocale());
}
/**
* Build ServletRequestAttributes for the given request (potentially also
* holding a reference to the response), taking pre-bound attributes
* (and their type) into consideration.
* @param request current HTTP request
* @param response current HTTP response
* @param previousAttributes pre-bound RequestAttributes instance, if any
* @return the ServletRequestAttributes to bind, or {@code null} to preserve
* the previously bound instance (or not binding any, if none bound before)
* @see RequestContextHolder#setRequestAttributes
*/
protected @Nullable ServletRequestAttributes buildRequestAttributes(HttpServletRequest request,
@Nullable HttpServletResponse response, @Nullable RequestAttributes previousAttributes) {
if (previousAttributes == null || previousAttributes instanceof ServletRequestAttributes) {
return new ServletRequestAttributes(request, response);
}
else {
return null; // preserve the pre-bound RequestAttributes instance
}
}
private void initContextHolders(HttpServletRequest request,
@Nullable LocaleContext localeContext, @Nullable RequestAttributes requestAttributes) {
if (localeContext != null) {
LocaleContextHolder.setLocaleContext(localeContext, this.threadContextInheritable);
}
if (requestAttributes != null) {
RequestContextHolder.setRequestAttributes(requestAttributes, this.threadContextInheritable);
}
}
private void resetContextHolders(HttpServletRequest request,
@Nullable LocaleContext prevLocaleContext, @Nullable RequestAttributes previousAttributes) {
LocaleContextHolder.setLocaleContext(prevLocaleContext, this.threadContextInheritable);
RequestContextHolder.setRequestAttributes(previousAttributes, this.threadContextInheritable);
}
private void logResult(HttpServletRequest request, HttpServletResponse response,
@Nullable Throwable failureCause, WebAsyncManager asyncManager) {
if (!logger.isDebugEnabled()) {
return;
}
DispatcherType dispatchType = request.getDispatcherType();
boolean initialDispatch = (dispatchType == DispatcherType.REQUEST);
if (failureCause != null) {
if (!initialDispatch) {
// FORWARD/ERROR/ASYNC: minimal message (there should be enough context already)
if (logger.isDebugEnabled()) {
logger.debug("Unresolved failure from \"" + dispatchType + "\" dispatch: " + failureCause);
}
}
else if (logger.isTraceEnabled()) {
logger.trace("Failed to complete request", failureCause);
}
else {
logger.debug("Failed to complete request: " + failureCause);
}
return;
}
if (asyncManager.isConcurrentHandlingStarted()) {
logger.debug("Exiting but response remains open for further handling");
return;
}
int status = response.getStatus();
String headers = ""; // nothing below trace
if (logger.isTraceEnabled()) {
Collection<String> names = response.getHeaderNames();
if (this.enableLoggingRequestDetails) {
headers = names.stream().map(name -> name + ":" + response.getHeaders(name))
.collect(Collectors.joining(", "));
}
else {
headers = names.isEmpty() ? "" : "masked";
}
headers = ", headers={" + headers + "}";
}
if (!initialDispatch) {
logger.debug("Exiting from \"" + dispatchType + "\" dispatch, status " + status + headers);
}
else {
logger.debug("Completed " + HttpStatusCode.valueOf(status) + headers);
}
}
private void publishRequestHandledEvent(HttpServletRequest request, HttpServletResponse response,
long startTime, @Nullable Throwable failureCause) {
if (this.publishEvents && this.webApplicationContext != null) {
// Whether or not we succeeded, publish an event.
long processingTime = System.currentTimeMillis() - startTime;
this.webApplicationContext.publishEvent(
new ServletRequestHandledEvent(this,
request.getRequestURI(), request.getRemoteAddr(),
request.getMethod(), getServletConfig().getServletName(),
WebUtils.getSessionId(request), getUsernameForRequest(request),
processingTime, failureCause, response.getStatus()));
}
}
/**
* Determine the username for the given request.
* <p>The default implementation takes the name of the UserPrincipal, if any.
* Can be overridden in subclasses.
* @param request current HTTP request
* @return the username, or {@code null} if none found
* @see jakarta.servlet.http.HttpServletRequest#getUserPrincipal()
*/
protected @Nullable String getUsernameForRequest(HttpServletRequest request) {
Principal userPrincipal = request.getUserPrincipal();
return (userPrincipal != null ? userPrincipal.getName() : null);
}
/**
* Subclasses must implement this method to do the work of request handling,
* receiving a centralized callback for GET, POST, PUT and DELETE.
* <p>The contract is essentially the same as that for the commonly overridden
* {@code doGet} or {@code doPost} methods of HttpServlet.
* <p>This | implementation |
java | spring-cloud__spring-cloud-gateway | spring-cloud-gateway-server-webmvc/src/main/java/org/springframework/cloud/gateway/server/mvc/filter/BodyFilterFunctions.java | {
"start": 9198,
"end": 12598
} | class ____ implements ServerRequest {
private final ServerRequest delegate;
protected ServerRequestWrapper(ServerRequest delegate) {
this.delegate = delegate;
}
@Override
public <T> T bind(Class<T> bindType) throws BindException {
return delegate.bind(bindType);
}
@Override
public <T> T bind(Class<T> bindType, Consumer<WebDataBinder> dataBinderCustomizer) throws BindException {
return delegate.bind(bindType, dataBinderCustomizer);
}
@Override
public HttpMethod method() {
return delegate.method();
}
@Override
public URI uri() {
return delegate.uri();
}
@Override
public UriBuilder uriBuilder() {
return delegate.uriBuilder();
}
@Override
public String path() {
return delegate.path();
}
@Override
public RequestPath requestPath() {
return delegate.requestPath();
}
@Override
public Headers headers() {
return delegate.headers();
}
@Override
public MultiValueMap<String, Cookie> cookies() {
return delegate.cookies();
}
@Override
public Optional<InetSocketAddress> remoteAddress() {
return delegate.remoteAddress();
}
@Override
public List<HttpMessageConverter<?>> messageConverters() {
return delegate.messageConverters();
}
@Override
public <T> T body(Class<T> bodyType) throws ServletException, IOException {
return delegate.body(bodyType);
}
@Override
public <T> T body(ParameterizedTypeReference<T> bodyType) throws ServletException, IOException {
return delegate.body(bodyType);
}
@Override
public Optional<Object> attribute(String name) {
return delegate.attribute(name);
}
@Override
public Map<String, Object> attributes() {
return delegate.attributes();
}
@Override
public Optional<String> param(String name) {
return delegate.param(name);
}
@Override
public MultiValueMap<String, String> params() {
return delegate.params();
}
@Override
public MultiValueMap<String, Part> multipartData() throws IOException, ServletException {
return delegate.multipartData();
}
@Override
public String pathVariable(String name) {
return delegate.pathVariable(name);
}
@Override
public Map<String, String> pathVariables() {
return delegate.pathVariables();
}
@Override
public HttpSession session() {
return delegate.session();
}
@Override
public Optional<Principal> principal() {
return delegate.principal();
}
@Override
public HttpServletRequest servletRequest() {
return delegate.servletRequest();
}
@Override
public Optional<ServerResponse> checkNotModified(Instant lastModified) {
return delegate.checkNotModified(lastModified);
}
@Override
public Optional<ServerResponse> checkNotModified(String etag) {
return delegate.checkNotModified(etag);
}
@Override
public Optional<ServerResponse> checkNotModified(Instant lastModified, String etag) {
return delegate.checkNotModified(lastModified, etag);
}
@Override
public @Nullable ApiVersionStrategy apiVersionStrategy() {
return delegate.apiVersionStrategy();
}
public static ServerRequest create(HttpServletRequest servletRequest,
List<HttpMessageConverter<?>> messageReaders) {
return ServerRequest.create(servletRequest, messageReaders);
}
public static Builder from(ServerRequest other) {
return ServerRequest.from(other);
}
}
}
| ServerRequestWrapper |
java | hibernate__hibernate-orm | hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/JpaCrossJoinBaselineTests.java | {
"start": 615,
"end": 1580
} | class ____ {
@Test
public void testCrossJoin(SessionFactoryScope scope) {
final String qry = "from LineItem i cross join Order o join o.salesAssociate a on i.product.vendor.name = a.name.familyName";
scope.inTransaction( (session) -> session.createQuery( qry ).list() );
}
@Test
public void test2Roots(SessionFactoryScope scope) {
final String qry = "select i from LineItem i, Order o join o.salesAssociate a on i.quantity = a.id";
try {
scope.inTransaction( (session) -> session.createQuery( qry ).list() );
fail( "Expecting a failure" );
}
catch (Exception expected) {
}
}
@Test
public void test2Roots2(SessionFactoryScope scope) {
final String qry = "from LineItem i, Order o join o.salesAssociate a on i.product.vendor.name = a.name.familyName";
try {
scope.inTransaction( (session) -> session.createQuery( qry ).list() );
fail( "Expecting a failure" );
}
catch (Exception expected) {
}
}
}
| JpaCrossJoinBaselineTests |
java | spring-projects__spring-framework | spring-webflux/src/main/java/org/springframework/web/reactive/result/method/HandlerMethodArgumentResolverSupport.java | {
"start": 1094,
"end": 1354
} | class ____ {@link HandlerMethodArgumentResolver} implementations with access to a
* {@code ReactiveAdapterRegistry} and methods to check for method parameter support.
*
* @author Rossen Stoyanchev
* @author Juergen Hoeller
* @since 5.0
*/
public abstract | for |
java | hibernate__hibernate-orm | hibernate-core/src/main/java/org/hibernate/boot/jaxb/cfg/internal/TransactionTypeMarshalling.java | {
"start": 325,
"end": 740
} | class ____ {
public static PersistenceUnitTransactionType fromXml(String name) {
if ( StringHelper.isEmpty( name ) ) {
return PersistenceUnitTransactionType.RESOURCE_LOCAL;
}
return PersistenceUnitTransactionType.valueOf( name );
}
public static String toXml(PersistenceUnitTransactionType transactionType) {
return transactionType == null ? null : transactionType.name();
}
}
| TransactionTypeMarshalling |
java | apache__avro | lang/java/tools/src/main/java/org/apache/avro/tool/SpecificCompilerTool.java | {
"start": 12026,
"end": 12325
} | class ____ implements FilenameFilter {
private String extension;
private FileExtensionFilter(String extension) {
this.extension = extension;
}
@Override
public boolean accept(File dir, String name) {
return name.endsWith(this.extension);
}
}
}
| FileExtensionFilter |
java | apache__camel | components/camel-cxf/camel-cxf-rest/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducerStreamCacheTest.java | {
"start": 1645,
"end": 2486
} | class ____ extends CamelTestSupport {
private int port;
private Server rsServer;
@Override
protected boolean useJmx() {
return false;
}
@Override
protected void doPreSetup() throws Exception {
port = AvailablePortFinder.getNextAvailable();
startRsEchoServer();
}
@AfterEach
public void stopServer() {
if (rsServer != null) {
rsServer.stop();
rsServer.destroy();
}
}
private void startRsEchoServer() {
JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
sf.setAddress("http://localhost:" + port + "/rs");
sf.setServiceBeans(Collections.singletonList(new EchoResource()));
rsServer = sf.create();
rsServer.start();
}
@Path("/")
public static | CxfRsProducerStreamCacheTest |
java | apache__avro | lang/java/ipc/src/main/java/org/apache/avro/ipc/SaslSocketTransceiver.java | {
"start": 1749,
"end": 10475
} | enum ____ {
START, CONTINUE, FAIL, COMPLETE
}
private SaslParticipant sasl;
private SocketChannel channel;
private boolean dataIsWrapped;
private boolean saslResponsePiggybacked;
private Protocol remote;
private ByteBuffer readHeader = ByteBuffer.allocate(4);
private ByteBuffer writeHeader = ByteBuffer.allocate(4);
private ByteBuffer zeroHeader = ByteBuffer.allocate(4).putInt(0);
/**
* Create using SASL's anonymous
* (<a href="https://www.ietf.org/rfc/rfc2245.txt">RFC 2245) mechanism.
*/
public SaslSocketTransceiver(SocketAddress address) throws IOException {
this(address, new AnonymousClient());
}
/** Create using the specified {@link SaslClient}. */
public SaslSocketTransceiver(SocketAddress address, SaslClient saslClient) throws IOException {
this.sasl = new SaslParticipant(saslClient);
this.channel = SocketChannel.open(address);
this.channel.socket().setTcpNoDelay(true);
LOG.debug("open to {}", getRemoteName());
open(true);
}
/** Create using the specified {@link SaslServer}. */
public SaslSocketTransceiver(SocketChannel channel, SaslServer saslServer) throws IOException {
this.sasl = new SaslParticipant(saslServer);
this.channel = channel;
LOG.debug("open from {}", getRemoteName());
open(false);
}
@Override
public boolean isConnected() {
return remote != null;
}
@Override
public void setRemote(Protocol remote) {
this.remote = remote;
}
@Override
public Protocol getRemote() {
return remote;
}
@Override
public String getRemoteName() {
return channel.socket().getRemoteSocketAddress().toString();
}
@Override
public synchronized List<ByteBuffer> transceive(List<ByteBuffer> request) throws IOException {
if (saslResponsePiggybacked) { // still need to read response
saslResponsePiggybacked = false;
Status status = readStatus();
ByteBuffer frame = readFrame();
switch (status) {
case COMPLETE:
break;
case FAIL:
throw new SaslException("Fail: " + toString(frame));
default:
throw new IOException("Unexpected SASL status: " + status);
}
}
return super.transceive(request);
}
private void open(boolean isClient) throws IOException {
LOG.debug("beginning SASL negotiation");
if (isClient) {
ByteBuffer response = EMPTY;
if (sasl.client.hasInitialResponse())
response = ByteBuffer.wrap(sasl.evaluate(response.array()));
write(Status.START, sasl.getMechanismName(), response);
if (sasl.isComplete())
saslResponsePiggybacked = true;
}
while (!sasl.isComplete()) {
Status status = readStatus();
ByteBuffer frame = readFrame();
switch (status) {
case START:
String mechanism = toString(frame);
frame = readFrame();
if (!mechanism.equalsIgnoreCase(sasl.getMechanismName())) {
write(Status.FAIL, "Wrong mechanism: " + mechanism);
throw new SaslException("Wrong mechanism: " + mechanism);
}
case CONTINUE:
byte[] response;
try {
response = sasl.evaluate(frame.array());
status = sasl.isComplete() ? Status.COMPLETE : Status.CONTINUE;
} catch (SaslException e) {
response = e.toString().getBytes(StandardCharsets.UTF_8);
status = Status.FAIL;
}
write(status, response != null ? ByteBuffer.wrap(response) : EMPTY);
break;
case COMPLETE:
sasl.evaluate(frame.array());
if (!sasl.isComplete())
throw new SaslException("Expected completion!");
break;
case FAIL:
throw new SaslException("Fail: " + toString(frame));
default:
throw new IOException("Unexpected SASL status: " + status);
}
}
LOG.debug("SASL opened");
String qop = (String) sasl.getNegotiatedProperty(Sasl.QOP);
LOG.debug("QOP = {}", qop);
dataIsWrapped = (qop != null && !qop.equalsIgnoreCase("auth"));
}
private String toString(ByteBuffer buffer) {
return new String(buffer.array(), StandardCharsets.UTF_8);
}
@Override
public synchronized List<ByteBuffer> readBuffers() throws IOException {
List<ByteBuffer> buffers = new ArrayList<>();
while (true) {
ByteBuffer buffer = readFrameAndUnwrap();
if (((Buffer) buffer).remaining() == 0)
return buffers;
buffers.add(buffer);
}
}
private Status readStatus() throws IOException {
ByteBuffer buffer = ByteBuffer.allocate(1);
read(buffer);
int status = buffer.get();
if (status > Status.values().length)
throw new IOException("Unexpected SASL status byte: " + status);
return Status.values()[status];
}
private ByteBuffer readFrameAndUnwrap() throws IOException {
ByteBuffer frame = readFrame();
if (!dataIsWrapped)
return frame;
ByteBuffer unwrapped = ByteBuffer.wrap(sasl.unwrap(frame.array()));
LOG.debug("unwrapped data of length: {}", unwrapped.remaining());
return unwrapped;
}
private ByteBuffer readFrame() throws IOException {
read(readHeader);
ByteBuffer buffer = ByteBuffer.allocate(readHeader.getInt());
LOG.debug("about to read: {} bytes", buffer.capacity());
read(buffer);
return buffer;
}
private void read(ByteBuffer buffer) throws IOException {
((Buffer) buffer).clear();
while (buffer.hasRemaining())
if (channel.read(buffer) == -1)
throw new EOFException();
((Buffer) buffer).flip();
}
@Override
public synchronized void writeBuffers(List<ByteBuffer> buffers) throws IOException {
if (buffers == null)
return; // no data to write
List<ByteBuffer> writes = new ArrayList<>(buffers.size() * 2 + 1);
int currentLength = 0;
ByteBuffer currentHeader = writeHeader;
for (ByteBuffer buffer : buffers) { // gather writes
if (buffer.remaining() == 0)
continue; // ignore empties
if (dataIsWrapped) {
LOG.debug("wrapping data of length: {}", buffer.remaining());
buffer = ByteBuffer.wrap(sasl.wrap(buffer.array(), buffer.position(), buffer.remaining()));
}
int length = buffer.remaining();
if (!dataIsWrapped // can append buffers on wire
&& (currentLength + length) <= ByteBufferOutputStream.BUFFER_SIZE) {
if (currentLength == 0)
writes.add(currentHeader);
currentLength += length;
((Buffer) currentHeader).clear();
currentHeader.putInt(currentLength);
LOG.debug("adding {} to write, total now {}", length, currentLength);
} else {
currentLength = length;
currentHeader = ByteBuffer.allocate(4).putInt(length);
writes.add(currentHeader);
LOG.debug("planning write of {}", length);
}
((Buffer) currentHeader).flip();
writes.add(buffer);
}
((Buffer) zeroHeader).flip(); // zero-terminate
writes.add(zeroHeader);
writeFully(writes.toArray(new ByteBuffer[0]));
}
private void write(Status status, String prefix, ByteBuffer response) throws IOException {
LOG.debug("write status: {} {}", status, prefix);
write(status, prefix);
write(response);
}
private void write(Status status, String response) throws IOException {
write(status, ByteBuffer.wrap(response.getBytes(StandardCharsets.UTF_8)));
}
private void write(Status status, ByteBuffer response) throws IOException {
LOG.debug("write status: {}", status);
ByteBuffer statusBuffer = ByteBuffer.allocate(1);
((Buffer) statusBuffer).clear();
((Buffer) statusBuffer.put((byte) (status.ordinal()))).flip();
writeFully(statusBuffer);
write(response);
}
private void write(ByteBuffer response) throws IOException {
LOG.debug("writing: {}", response.remaining());
((Buffer) writeHeader).clear();
((Buffer) writeHeader.putInt(response.remaining())).flip();
writeFully(writeHeader, response);
}
private void writeFully(ByteBuffer... buffers) throws IOException {
int length = buffers.length;
int start = 0;
do {
channel.write(buffers, start, length - start);
while (buffers[start].remaining() == 0) {
start++;
if (start == length)
return;
}
} while (true);
}
@Override
public void close() throws IOException {
if (channel.isOpen()) {
LOG.info("closing to " + getRemoteName());
channel.close();
}
sasl.dispose();
}
/**
* Used to abstract over the <code>SaslServer</code> and <code>SaslClient</code>
* classes, which share a lot of their interface, but unfortunately don't share
* a common superclass.
*/
private static | Status |
java | quarkusio__quarkus | integration-tests/narayana-stm/src/test/java/org/acme/quickstart/stm/STMResourceTest.java | {
"start": 354,
"end": 1006
} | class ____ {
@Test
void testGet() {
given()
.when().get("/stm")
.then()
.statusCode(200);
}
@Test
void testPost() {
String responseString;
makeBooking();
responseString = makeBooking();
System.out.printf("%s%n", responseString);
assertThat(responseString, containsString("Booking Count=2"));
}
private String makeBooking() {
return RestAssured.post("/stm").then()
.assertThat()
.statusCode(HttpStatus.SC_OK)
.extract()
.asString();
}
}
| STMResourceTest |
java | apache__camel | components/camel-ldap/src/test/java/org/apache/directory/server/core/integ5/DSAnnotationProcessor.java | {
"start": 14791,
"end": 19149
} | class ____ classLoaded will be use to retrieve the resources
* @param service the DirectoryService
* @param ldifFiles array of LDIF file names (only )
* @throws Exception If we weren't able to inject LdifFiles
*/
public static void injectLdifFiles(
Class<?> clazz,
DirectoryService service, String[] ldifFiles)
throws Exception {
if (ldifFiles != null && ldifFiles.length > 0) {
for (String ldifFile : ldifFiles) {
InputStream is = clazz.getClassLoader().getResourceAsStream(
ldifFile);
if (is == null) {
throw new FileNotFoundException(
"LDIF file '" + ldifFile
+ "' not found.");
} else {
LdifReader ldifReader = new LdifReader(is);
for (LdifEntry entry : ldifReader) {
injectEntry(entry, service);
}
ldifReader.close();
}
}
}
}
/**
* Inject an ldif String into the server. Dn must be relative to the root.
*
* @param service the directory service to use
* @param ldif the ldif containing entries to add to the server.
* @throws Exception if there is a problem adding the entries from the LDIF
*/
public static void injectEntries(DirectoryService service, String ldif)
throws Exception {
LdifReader reader = new LdifReader();
List<LdifEntry> entries = reader.parseLdif(ldif);
for (LdifEntry entry : entries) {
injectEntry(entry, service);
}
// And close the reader
reader.close();
}
/**
* Load the schemas, and enable/disable them.
*
* @param desc The description
* @param service The DirectoryService instance
*/
public static void loadSchemas(Description desc, DirectoryService service) {
if (desc == null) {
return;
}
/*for ( Class<?> loadSchema : dsBuilder.additionalInterceptors() )
{
service.addLast( ( Interceptor ) interceptorClass.newInstance() );
}*/
LoadSchema loadSchema = desc
.getAnnotation(LoadSchema.class);
if (loadSchema != null) {
LOG.debug("Found LoadSchema annotation: {}", loadSchema);
}
}
/**
* Apply the LDIF entries to the given service
*
* @param desc The description
* @param service The DirectoryService instance
* @throws Exception If we can't apply the ldifs
*/
public static void applyLdifs(Description desc, DirectoryService service)
throws Exception {
if (desc == null) {
return;
}
ApplyLdifFiles applyLdifFiles = desc
.getAnnotation(ApplyLdifFiles.class);
if (applyLdifFiles != null) {
LOG.debug("Applying {} to {}", applyLdifFiles.value(),
desc.getDisplayName());
injectLdifFiles(applyLdifFiles.clazz(), service, applyLdifFiles.value());
}
ApplyLdifs applyLdifs = desc.getAnnotation(ApplyLdifs.class);
if (applyLdifs != null && applyLdifs.value() != null) {
String[] ldifs = applyLdifs.value();
String dnStart = "dn:";
StringBuilder sb = new StringBuilder();
for (int i = 0; i < ldifs.length;) {
String s = ldifs[i++].trim();
if (s.startsWith(dnStart)) {
sb.append(s).append('\n');
// read the rest of lines till we encounter Dn again
while (i < ldifs.length) {
s = ldifs[i++];
if (!s.startsWith(dnStart)) {
sb.append(s).append('\n');
} else {
break;
}
}
LOG.debug("Applying {} to {}", sb, desc.getDisplayName());
injectEntries(service, sb.toString());
sb.setLength(0);
i--; // step up a line
}
}
}
}
}
| which |
java | spring-projects__spring-security | ldap/src/test/java/org/springframework/security/ldap/userdetails/LdapUserDetailsServiceTests.java | {
"start": 1519,
"end": 2926
} | class ____ {
@Test
public void rejectsNullSearchObject() {
assertThatIllegalArgumentException()
.isThrownBy(() -> new LdapUserDetailsService(null, new NullLdapAuthoritiesPopulator()));
}
@Test
public void rejectsNullAuthoritiesPopulator() {
assertThatIllegalArgumentException().isThrownBy(() -> new LdapUserDetailsService(new MockUserSearch(), null));
}
@Test
public void correctAuthoritiesAreReturned() {
DirContextAdapter userData = new DirContextAdapter(LdapNameBuilder.newInstance("uid=joe").build());
LdapUserDetailsService service = new LdapUserDetailsService(new MockUserSearch(userData),
new MockAuthoritiesPopulator());
service.setUserDetailsMapper(new LdapUserDetailsMapper());
UserDetails user = service.loadUserByUsername("doesntmatterwegetjoeanyway");
Set<String> authorities = AuthorityUtils.authorityListToSet(user.getAuthorities());
assertThat(authorities).hasSize(1);
assertThat(authorities).contains("ROLE_FROM_POPULATOR");
}
@Test
public void nullPopulatorConstructorReturnsEmptyAuthoritiesList() {
DirContextAdapter userData = new DirContextAdapter(LdapNameBuilder.newInstance("uid=joe").build());
LdapUserDetailsService service = new LdapUserDetailsService(new MockUserSearch(userData));
UserDetails user = service.loadUserByUsername("doesntmatterwegetjoeanyway");
assertThat(user.getAuthorities()).isEmpty();
}
| LdapUserDetailsServiceTests |
java | alibaba__fastjson | src/test/java/com/alibaba/json/bvt/bug/Bug_for_jinghui70.java | {
"start": 407,
"end": 683
} | class ____ extends IdObject<Long> {
}
public void test_generic() throws Exception {
String str = "{\"id\":0}";
Child child = JSON.parseObject(str, Child.class);
Assert.assertEquals(Long.class, child.getId().getClass());
}
}
| Child |
java | quarkusio__quarkus | extensions/panache/rest-data-panache/runtime/src/main/java/io/quarkus/rest/data/panache/MethodProperties.java | {
"start": 413,
"end": 1023
} | interface ____ {
/**
* Expose this operation as a JAX-RS endpoint.
* <p>
* Default: true
*/
boolean exposed() default true;
/**
* URL path segment that should be used to access this operation.
* This path segment is appended to the segment specified with the {@link ResourceProperties} annotation used on this
* resource.
* <p>
* Default: ""
*/
String path() default "";
/**
* List of the security roles permitted to access this operation.
* <p>
* Default: ""
*/
String[] rolesAllowed() default {};
}
| MethodProperties |
java | apache__hadoop | hadoop-tools/hadoop-rumen/src/main/java/org/apache/hadoop/tools/rumen/LogRecordType.java | {
"start": 924,
"end": 1889
} | class ____ {
static Map<String, LogRecordType> internees = new HashMap<String, LogRecordType>();
final String name;
final int index;
private LogRecordType(String name) {
super();
this.name = name;
index = internees.size();
}
static LogRecordType intern(String typeName) {
LogRecordType result = internees.get(typeName);
if (result == null) {
result = new LogRecordType(typeName);
internees.put(typeName, result);
}
return result;
}
static LogRecordType internSoft(String typeName) {
return internees.get(typeName);
}
@Override
public String toString() {
return name;
}
static String[] lineTypes() {
Iterator<Map.Entry<String, LogRecordType>> iter = internees.entrySet()
.iterator();
String[] result = new String[internees.size()];
for (int i = 0; i < internees.size(); ++i) {
result[i] = iter.next().getKey();
}
return result;
}
}
| LogRecordType |
java | spring-projects__spring-framework | spring-core/src/main/java/org/springframework/util/Assert.java | {
"start": 860,
"end": 1578
} | class ____ assists in validating arguments.
*
* <p>Useful for identifying programmer errors early and clearly at runtime.
*
* <p>For example, if the contract of a public method states it does not
* allow {@code null} arguments, {@code Assert} can be used to validate that
* contract. Doing this clearly indicates a contract violation when it
* occurs and protects the class's invariants.
*
* <p>Typically used to validate method arguments rather than configuration
* properties, to check for cases that are usually programmer errors rather
* than configuration errors. In contrast to configuration initialization
* code, there is usually no point in falling back to defaults in such methods.
*
* <p>This | that |
java | apache__camel | dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/HazelcastReplicatedmapEndpointBuilderFactory.java | {
"start": 16078,
"end": 18744
} | interface ____ extends EndpointProducerBuilder {
default HazelcastReplicatedmapEndpointProducerBuilder basic() {
return (HazelcastReplicatedmapEndpointProducerBuilder) this;
}
/**
* Whether the producer should be started lazy (on the first message).
* By starting lazy you can use this to allow CamelContext and routes to
* startup in situations where a producer may otherwise fail during
* starting and cause the route to fail being started. By deferring this
* startup to be lazy then the startup failure can be handled during
* routing messages via Camel's routing error handlers. Beware that when
* the first message is processed then creating and starting the
* producer may take a little time and prolong the total processing time
* of the processing.
*
* The option is a: <code>boolean</code> type.
*
* Default: false
* Group: producer (advanced)
*
* @param lazyStartProducer the value to set
* @return the dsl builder
*/
default AdvancedHazelcastReplicatedmapEndpointProducerBuilder lazyStartProducer(boolean lazyStartProducer) {
doSetProperty("lazyStartProducer", lazyStartProducer);
return this;
}
/**
* Whether the producer should be started lazy (on the first message).
* By starting lazy you can use this to allow CamelContext and routes to
* startup in situations where a producer may otherwise fail during
* starting and cause the route to fail being started. By deferring this
* startup to be lazy then the startup failure can be handled during
* routing messages via Camel's routing error handlers. Beware that when
* the first message is processed then creating and starting the
* producer may take a little time and prolong the total processing time
* of the processing.
*
* The option will be converted to a <code>boolean</code> type.
*
* Default: false
* Group: producer (advanced)
*
* @param lazyStartProducer the value to set
* @return the dsl builder
*/
default AdvancedHazelcastReplicatedmapEndpointProducerBuilder lazyStartProducer(String lazyStartProducer) {
doSetProperty("lazyStartProducer", lazyStartProducer);
return this;
}
}
/**
* Builder for endpoint for the Hazelcast Replicated Map component.
*/
public | AdvancedHazelcastReplicatedmapEndpointProducerBuilder |
java | apache__flink | flink-table/flink-table-code-splitter/src/test/java/org/apache/flink/table/codesplit/CodeRewriterTestBase.java | {
"start": 1134,
"end": 3165
} | class ____<R extends CodeRewriter> {
private final String resourceDir;
private final Function<String, R> rewriterProvider;
public CodeRewriterTestBase(String resourceDir, Function<String, R> rewriterProvider) {
this.resourceDir = resourceDir;
this.rewriterProvider = rewriterProvider;
}
R runTest(String filename) {
try {
String code =
FileUtils.readFileUtf8(
new File(
CodeRewriterTestBase.class
.getClassLoader()
.getResource(
resourceDir + "/code/" + filename + ".java")
.toURI()));
String expected =
FileUtils.readFileUtf8(
new File(
CodeRewriterTestBase.class
.getClassLoader()
.getResource(
resourceDir + "/expected/" + filename + ".java")
.toURI()));
R rewriter = rewriterProvider.apply(code);
// Trying to mitigate any indentation issues between all sort of platforms by simply
// trim every line of the "class". Before this change, code-splitter test could fail on
// Windows machines while passing on Unix.
expected = trimLines(expected);
String actual = trimLines(rewriter.rewrite());
assertThat(actual).isEqualTo(expected);
return rewriter;
} catch (Exception e) {
throw new RuntimeException(e);
} finally {
// we reset the counter to ensure the variable names after rewrite are as expected
CodeSplitUtil.getCounter().set(0L);
}
}
}
| CodeRewriterTestBase |
java | FasterXML__jackson-databind | src/main/java/tools/jackson/databind/ser/jdk/JDKArraySerializers.java | {
"start": 16335,
"end": 19232
} | class ____ extends TypedPrimitiveArraySerializer<float[]>
{
// as above, assuming no one re-defines primitive/wrapper types
private final static JavaType VALUE_TYPE = simpleElementType(Float.TYPE);
// @since 2.20
final static FloatArraySerializer instance = new FloatArraySerializer();
public FloatArraySerializer() {
super(float[].class);
}
public FloatArraySerializer(FloatArraySerializer src, BeanProperty prop,
Boolean unwrapSingle) {
super(src, prop, unwrapSingle);
}
@Override
public ValueSerializer<?> _withResolved(BeanProperty prop, Boolean unwrapSingle) {
return new FloatArraySerializer(this, prop, unwrapSingle);
}
@Override
public JavaType getContentType() {
return VALUE_TYPE;
}
@Override
public ValueSerializer<?> getContentSerializer() {
// 14-Jan-2012, tatu: We could refer to an actual serializer if absolutely necessary
return null;
}
@Override
public boolean isEmpty(SerializationContext prov, float[] value) {
return value.length == 0;
}
@Override
public boolean hasSingleElement(float[] value) {
return (value.length == 1);
}
@Override
public ValueSerializer<?> createContextual(SerializationContext ctxt, BeanProperty property)
{
JsonFormat.Value format = findFormatOverrides(ctxt, property,
handledType());
if (format != null) {
if (format.getShape() == JsonFormat.Shape.BINARY) {
return BinaryFloatArraySerializer.instance;
}
}
return super.createContextual(ctxt, property);
}
@Override
public final void serialize(float[] value, JsonGenerator g, SerializationContext ctxt) throws JacksonException
{
final int len = value.length;
if ((len == 1) && _shouldUnwrapSingle(ctxt)) {
serializeContents(value, g, ctxt);
return;
}
g.writeStartArray(value, len);
serializeContents(value, g, ctxt);
g.writeEndArray();
}
@Override
public void serializeContents(float[] value, JsonGenerator g, SerializationContext provider)
throws JacksonException
{
for (int i = 0, len = value.length; i < len; ++i) {
g.writeNumber(value[i]);
}
}
@Override
public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint)
{
visitArrayFormat(visitor, typeHint, JsonFormatTypes.NUMBER);
}
}
@JacksonStdImpl
public static | FloatArraySerializer |
java | hibernate__hibernate-orm | hibernate-envers/src/test/java/org/hibernate/orm/test/envers/integration/reventity/OverrideCustomRevListenerTest.java | {
"start": 761,
"end": 843
} | class ____ extends GloballyConfiguredRevListenerTest {
}
| OverrideCustomRevListenerTest |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.