language
stringclasses
1 value
repo
stringclasses
60 values
path
stringlengths
22
294
class_span
dict
source
stringlengths
13
1.16M
target
stringlengths
1
113
java
spring-projects__spring-boot
buildpack/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/docker/TotalProgressBarTests.java
{ "start": 923, "end": 2573 }
class ____ { @Test void withPrefixAndBookends() { TestPrintStream out = new TestPrintStream(); TotalProgressBar bar = new TotalProgressBar("prefix:", '#', true, out); assertThat(out).hasToString("prefix: [ "); bar.accept(new TotalProgressEvent(10)); assertThat(out).hasToString("prefix: [ #####"); bar.accept(new TotalProgressEvent(50)); assertThat(out).hasToString("prefix: [ #########################"); bar.accept(new TotalProgressEvent(100)); assertThat(out).hasToString(String.format("prefix: [ ################################################## ]%n")); } @Test void withoutPrefix() { TestPrintStream out = new TestPrintStream(); TotalProgressBar bar = new TotalProgressBar(null, '#', true, out); assertThat(out).hasToString("[ "); bar.accept(new TotalProgressEvent(10)); assertThat(out).hasToString("[ #####"); bar.accept(new TotalProgressEvent(50)); assertThat(out).hasToString("[ #########################"); bar.accept(new TotalProgressEvent(100)); assertThat(out).hasToString(String.format("[ ################################################## ]%n")); } @Test void withoutBookends() { TestPrintStream out = new TestPrintStream(); TotalProgressBar bar = new TotalProgressBar("", '.', false, out); assertThat(out).hasToString(""); bar.accept(new TotalProgressEvent(10)); assertThat(out).hasToString("....."); bar.accept(new TotalProgressEvent(50)); assertThat(out).hasToString("........................."); bar.accept(new TotalProgressEvent(100)); assertThat(out).hasToString(String.format("..................................................%n")); } static
TotalProgressBarTests
java
quarkusio__quarkus
independent-projects/arc/tcks/arquillian/src/main/java/io/quarkus/arc/arquillian/DeploymentDir.java
{ "start": 126, "end": 804 }
class ____ { final Path root; final Path appClasses; final Path appLibraries; final Path generatedClasses; final Path generatedServices; DeploymentDir() throws IOException { this.root = Files.createTempDirectory("ArcArquillian"); this.appClasses = Files.createDirectories(root.resolve("app").resolve("classes")); this.appLibraries = Files.createDirectories(root.resolve("app").resolve("libraries")); this.generatedClasses = Files.createDirectories(root.resolve("generated").resolve("classes")); this.generatedServices = Files.createDirectories(root.resolve("generated").resolve("services")); } }
DeploymentDir
java
elastic__elasticsearch
x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/inference/trainedmodel/Tokenization.java
{ "start": 1228, "end": 10592 }
enum ____ { FIRST, SECOND, NONE { @Override public boolean isInCompatibleWithSpan() { return false; } }, BALANCED; public boolean isInCompatibleWithSpan() { return true; } public static Truncate fromString(String value) { return valueOf(value.toUpperCase(Locale.ROOT)); } @Override public String toString() { return name().toLowerCase(Locale.ROOT); } } public record SpanSettings(@Nullable Integer maxSequenceLength, int span) implements Writeable { public SpanSettings(@Nullable Integer maxSequenceLength) { this(maxSequenceLength, UNSET_SPAN_VALUE); } SpanSettings(StreamInput in) throws IOException { this(in.readOptionalVInt(), in.readVInt()); } @Override public void writeTo(StreamOutput out) throws IOException { out.writeOptionalVInt(maxSequenceLength); out.writeVInt(span); } }; // TODO add global params like never_split, bos_token, eos_token, mask_token, tokenize_chinese_chars, strip_accents, etc. public static final ParseField DO_LOWER_CASE = new ParseField("do_lower_case"); public static final ParseField WITH_SPECIAL_TOKENS = new ParseField("with_special_tokens"); public static final ParseField MAX_SEQUENCE_LENGTH = new ParseField("max_sequence_length"); public static final ParseField TRUNCATE = new ParseField("truncate"); public static final ParseField SPAN = new ParseField("span"); public static final int DEFAULT_MAX_SEQUENCE_LENGTH = 512; private static final boolean DEFAULT_DO_LOWER_CASE = false; private static final boolean DEFAULT_WITH_SPECIAL_TOKENS = true; private static final Truncate DEFAULT_TRUNCATION = Truncate.FIRST; public static final int UNSET_SPAN_VALUE = -1; static <T extends Tokenization> void declareCommonFields(ConstructingObjectParser<T, ?> parser) { parser.declareBoolean(ConstructingObjectParser.optionalConstructorArg(), DO_LOWER_CASE); parser.declareBoolean(ConstructingObjectParser.optionalConstructorArg(), WITH_SPECIAL_TOKENS); parser.declareInt(ConstructingObjectParser.optionalConstructorArg(), MAX_SEQUENCE_LENGTH); parser.declareString(ConstructingObjectParser.optionalConstructorArg(), TRUNCATE); parser.declareInt(ConstructingObjectParser.optionalConstructorArg(), SPAN); } public static BertTokenization createDefault() { return new BertTokenization(null, null, null, Tokenization.DEFAULT_TRUNCATION, UNSET_SPAN_VALUE); } protected final boolean doLowerCase; protected final boolean withSpecialTokens; protected final int maxSequenceLength; protected final Truncate truncate; protected final int span; Tokenization( @Nullable Boolean doLowerCase, @Nullable Boolean withSpecialTokens, @Nullable Integer maxSequenceLength, @Nullable Truncate truncate, @Nullable Integer span ) { if (maxSequenceLength != null && maxSequenceLength <= 0) { throw new IllegalArgumentException("[" + MAX_SEQUENCE_LENGTH.getPreferredName() + "] must be positive"); } this.doLowerCase = Optional.ofNullable(doLowerCase).orElse(DEFAULT_DO_LOWER_CASE); this.withSpecialTokens = Optional.ofNullable(withSpecialTokens).orElse(DEFAULT_WITH_SPECIAL_TOKENS); this.maxSequenceLength = Optional.ofNullable(maxSequenceLength).orElse(DEFAULT_MAX_SEQUENCE_LENGTH); this.truncate = Optional.ofNullable(truncate).orElse(DEFAULT_TRUNCATION); this.span = Optional.ofNullable(span).orElse(UNSET_SPAN_VALUE); if (this.span < 0 && this.span != UNSET_SPAN_VALUE) { throw new IllegalArgumentException( "[" + SPAN.getPreferredName() + "] must be non-negative to indicate span length or [" + UNSET_SPAN_VALUE + "] to indicate no windowing should occur" ); } validateSpanAndMaxSequenceLength(this.maxSequenceLength, this.span); validateSpanAndTruncate(this.truncate, this.span); } public Tokenization(StreamInput in) throws IOException { this.doLowerCase = in.readBoolean(); this.withSpecialTokens = in.readBoolean(); this.maxSequenceLength = in.readVInt(); this.truncate = in.readEnum(Truncate.class); if (in.getTransportVersion().onOrAfter(TransportVersions.V_8_2_0)) { this.span = in.readInt(); } else { this.span = UNSET_SPAN_VALUE; } } /** * Return a copy of this with the tokenizer span settings updated * @param update The settings to update * @return An updated Tokenization */ public Tokenization updateWindowSettings(SpanSettings update) { int maxLength = update.maxSequenceLength() == null ? this.maxSequenceLength : update.maxSequenceLength(); if (update.maxSequenceLength() != null && update.maxSequenceLength() > this.maxSequenceLength) { throw new ElasticsearchStatusException( "Updated max sequence length [{}] cannot be greater " + "than the model's max sequence length [{}]", RestStatus.BAD_REQUEST, update.maxSequenceLength(), this.maxSequenceLength ); } int updatedSpan = update.span() == UNSET_SPAN_VALUE ? this.span : update.span(); validateSpanAndMaxSequenceLength(maxLength, updatedSpan); return buildWindowingTokenization(maxLength, updatedSpan); } /** * Build a copy of this with {@code Truncate == NONE} using * the specified max sequence length and span * @param updatedMaxSeqLength Max sequence length * @param updatedSpan Span * @return A new Tokenization object */ abstract Tokenization buildWindowingTokenization(int updatedMaxSeqLength, int updatedSpan); @Override public void writeTo(StreamOutput out) throws IOException { out.writeBoolean(doLowerCase); out.writeBoolean(withSpecialTokens); out.writeVInt(maxSequenceLength); out.writeEnum(truncate); if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_2_0)) { out.writeInt(span); } } public abstract String getMaskToken(); abstract XContentBuilder doXContentBody(XContentBuilder builder, Params params) throws IOException; @Override public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { builder.startObject(); builder.field(DO_LOWER_CASE.getPreferredName(), doLowerCase); builder.field(WITH_SPECIAL_TOKENS.getPreferredName(), withSpecialTokens); builder.field(MAX_SEQUENCE_LENGTH.getPreferredName(), maxSequenceLength); builder.field(TRUNCATE.getPreferredName(), truncate.toString()); builder.field(SPAN.getPreferredName(), span); builder = doXContentBody(builder, params); builder.endObject(); return builder; } public static void validateSpanAndMaxSequenceLength(int maxSequenceLength, int span) { if (span > maxSequenceLength) { throw new IllegalArgumentException( "[" + SPAN.getPreferredName() + "] provided [" + span + "] must not be greater than [" + MAX_SEQUENCE_LENGTH.getPreferredName() + "] provided [" + maxSequenceLength + "]" ); } } public static void validateSpanAndTruncate(@Nullable Truncate truncate, @Nullable Integer span) { if ((span != null && span != UNSET_SPAN_VALUE) && (truncate != null && truncate.isInCompatibleWithSpan())) { throw new IllegalArgumentException( "[" + SPAN.getPreferredName() + "] must not be provided when [" + TRUNCATE.getPreferredName() + "] is [" + truncate + "]" ); } } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Tokenization that = (Tokenization) o; return doLowerCase == that.doLowerCase && withSpecialTokens == that.withSpecialTokens && truncate == that.truncate && span == that.span && maxSequenceLength == that.maxSequenceLength; } @Override public int hashCode() { return Objects.hash(doLowerCase, truncate, withSpecialTokens, maxSequenceLength, span); } public boolean doLowerCase() { return doLowerCase; } public boolean withSpecialTokens() { return withSpecialTokens; } public int maxSequenceLength() { return maxSequenceLength; } public Truncate getTruncate() { return truncate; } public int getSpan() { return span; } public int getMaxSequenceLength() { return maxSequenceLength; } public void validateVocabulary(PutTrainedModelVocabularyAction.Request request) { } }
Truncate
java
apache__maven
impl/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuildingHelper.java
{ "start": 2567, "end": 11019 }
class ____ implements ProjectBuildingHelper { private final Logger logger = LoggerFactory.getLogger(getClass()); private final ClassRealmManager classRealmManager; private final ProjectRealmCache projectRealmCache; private final MavenRepositorySystem repositorySystem; private final MavenPluginManager pluginManager; @Inject public DefaultProjectBuildingHelper( ClassRealmManager classRealmManager, ProjectRealmCache projectRealmCache, MavenRepositorySystem repositorySystem, MavenPluginManager pluginManager) { this.classRealmManager = classRealmManager; this.projectRealmCache = projectRealmCache; this.repositorySystem = repositorySystem; this.pluginManager = pluginManager; } @Override public List<ArtifactRepository> createArtifactRepositories( List<Repository> pomRepositories, List<ArtifactRepository> externalRepositories, ProjectBuildingRequest request) throws InvalidRepositoryException { List<ArtifactRepository> internalRepositories = new ArrayList<>(); for (Repository repository : pomRepositories) { internalRepositories.add(MavenRepositorySystem.buildArtifactRepository(repository)); } repositorySystem.injectMirror(request.getRepositorySession(), internalRepositories); repositorySystem.injectProxy(request.getRepositorySession(), internalRepositories); repositorySystem.injectAuthentication(request.getRepositorySession(), internalRepositories); List<ArtifactRepository> dominantRepositories; List<ArtifactRepository> recessiveRepositories; if (ProjectBuildingRequest.RepositoryMerging.REQUEST_DOMINANT.equals(request.getRepositoryMerging())) { dominantRepositories = externalRepositories; recessiveRepositories = internalRepositories; } else { dominantRepositories = internalRepositories; recessiveRepositories = externalRepositories; } List<ArtifactRepository> artifactRepositories = new ArrayList<>(); Collection<String> repoIds = new HashSet<>(); if (dominantRepositories != null) { for (ArtifactRepository repository : dominantRepositories) { repoIds.add(repository.getId()); artifactRepositories.add(repository); } } if (recessiveRepositories != null) { for (ArtifactRepository repository : recessiveRepositories) { if (repoIds.add(repository.getId())) { artifactRepositories.add(repository); } } } artifactRepositories = repositorySystem.getEffectiveRepositories(artifactRepositories); return artifactRepositories; } @Override public synchronized ProjectRealmCache.CacheRecord createProjectRealm( MavenProject project, Model model, ProjectBuildingRequest request) throws PluginResolutionException, PluginVersionResolutionException, PluginManagerException { ClassRealm projectRealm; List<Plugin> extensionPlugins = new ArrayList<>(); Build build = model.getBuild(); if (build != null) { for (Extension extension : build.getExtensions()) { Plugin plugin = new Plugin(); plugin.setGroupId(extension.getGroupId()); plugin.setArtifactId(extension.getArtifactId()); plugin.setVersion(extension.getVersion()); XmlNode configuration = extension.getDelegate().getConfiguration(); if (configuration != null) { plugin.setConfiguration(new Xpp3Dom(configuration)); } extensionPlugins.add(plugin); } for (Plugin plugin : build.getPlugins()) { if (plugin.isExtensions()) { extensionPlugins.add(plugin); } } } if (extensionPlugins.isEmpty()) { if (logger.isDebugEnabled()) { logger.debug("Extension realms for project " + model.getId() + ": (none)"); } return new ProjectRealmCache.CacheRecord(null, null); } List<ClassRealm> extensionRealms = new ArrayList<>(); Map<ClassRealm, List<String>> exportedPackages = new HashMap<>(); Map<ClassRealm, List<String>> exportedArtifacts = new HashMap<>(); List<Artifact> publicArtifacts = new ArrayList<>(); for (Plugin plugin : extensionPlugins) { ExtensionRealmCache.CacheRecord recordRealm = pluginManager.setupExtensionsRealm(project, plugin, request.getRepositorySession()); final ClassRealm extensionRealm = recordRealm.getRealm(); final ExtensionDescriptor extensionDescriptor = recordRealm.getDescriptor(); final List<Artifact> artifacts = recordRealm.getArtifacts(); extensionRealms.add(extensionRealm); if (extensionDescriptor != null) { exportedPackages.put(extensionRealm, extensionDescriptor.getExportedPackages()); exportedArtifacts.put(extensionRealm, extensionDescriptor.getExportedArtifacts()); } if (!plugin.isExtensions() && artifacts.size() == 1 && artifacts.get(0).getFile() != null) { /* * This is purely for backward-compat with 2.x where <extensions> consisting of a single artifact where * loaded into the core and hence available to plugins, in contrast to bigger extensions that were * loaded into a dedicated realm which is invisible to plugins (MNG-2749). */ publicArtifacts.addAll(artifacts); } } if (logger.isDebugEnabled()) { logger.debug("Extension realms for project " + model.getId() + ": " + extensionRealms); } ProjectRealmCache.Key projectRealmKey = projectRealmCache.createKey(extensionRealms); ProjectRealmCache.CacheRecord record = projectRealmCache.get(projectRealmKey); if (record == null) { projectRealm = classRealmManager.createProjectRealm(model, toAetherArtifacts(publicArtifacts)); Set<String> exclusions = new LinkedHashSet<>(); for (ClassRealm extensionRealm : extensionRealms) { List<String> excludes = exportedArtifacts.get(extensionRealm); if (excludes != null) { exclusions.addAll(excludes); } List<String> exports = exportedPackages.get(extensionRealm); if (exports == null || exports.isEmpty()) { /* * Most existing extensions don't define exported packages, i.e. no classes are to be exposed to * plugins, yet the components provided by the extension (e.g. artifact handlers) must be * accessible, i.e. we still must import the extension realm into the project realm. */ exports = Arrays.asList(extensionRealm.getId()); } for (String export : exports) { projectRealm.importFrom(extensionRealm, export); } } DependencyFilter extensionArtifactFilter = null; if (!exclusions.isEmpty()) { extensionArtifactFilter = new ExclusionsDependencyFilter(exclusions); } record = projectRealmCache.put(projectRealmKey, projectRealm, extensionArtifactFilter); } projectRealmCache.register(project, projectRealmKey, record); return record; } @Override public void selectProjectRealm(MavenProject project) { ClassLoader projectRealm = project.getClassRealm(); if (projectRealm == null) { projectRealm = classRealmManager.getCoreRealm(); } Thread.currentThread().setContextClassLoader(projectRealm); } private List<org.eclipse.aether.artifact.Artifact> toAetherArtifacts(final List<Artifact> pluginArtifacts) { return new ArrayList<>(RepositoryUtils.toArtifacts(pluginArtifacts)); } }
DefaultProjectBuildingHelper
java
google__dagger
javatests/dagger/functional/producers/optional/OptionalBindingComponents.java
{ "start": 1585, "end": 1716 }
interface ____ {} /** A value object that contains various optionally-bound objects. */ @AutoValue abstract static
SomeQualifier
java
elastic__elasticsearch
qa/packaging/src/test/java/org/elasticsearch/packaging/util/Distribution.java
{ "start": 572, "end": 2472 }
class ____ { public final Path path; public final Packaging packaging; public final Platform platform; public final boolean hasJdk; public final String baseVersion; public final String version; public Distribution(Path path) { this.path = path; String filename = path.getFileName().toString(); if (filename.endsWith(".gz")) { this.packaging = Packaging.TAR; } else if (filename.endsWith(".docker.tar")) { this.packaging = Packaging.DOCKER; } else if (filename.endsWith(".ironbank.tar")) { this.packaging = Packaging.DOCKER_IRON_BANK; } else if (filename.endsWith(".cloud-ess.tar")) { this.packaging = Packaging.DOCKER_CLOUD_ESS; } else if (filename.endsWith(".wolfi.tar")) { this.packaging = Packaging.DOCKER_WOLFI; } else { int lastDot = filename.lastIndexOf('.'); this.packaging = Packaging.valueOf(filename.substring(lastDot + 1).toUpperCase(Locale.ROOT)); } this.platform = filename.contains("windows") ? Platform.WINDOWS : Platform.LINUX; this.hasJdk = filename.contains("no-jdk") == false; this.baseVersion = filename.split("-", 3)[1]; this.version = filename.contains("-SNAPSHOT") ? this.baseVersion + "-SNAPSHOT" : this.baseVersion; } public boolean isArchive() { return packaging == Packaging.TAR || packaging == Packaging.ZIP; } public boolean isPackage() { return packaging == Packaging.RPM || packaging == Packaging.DEB; } /** * @return whether this distribution is packaged as a Docker image. */ public boolean isDocker() { return switch (packaging) { case DOCKER, DOCKER_IRON_BANK, DOCKER_CLOUD_ESS, DOCKER_WOLFI -> true; default -> false; }; } public
Distribution
java
elastic__elasticsearch
x-pack/plugin/ent-search/src/main/java/org/elasticsearch/xpack/application/analytics/action/TransportDeleteAnalyticsCollectionAction.java
{ "start": 1672, "end": 3493 }
class ____ extends AcknowledgedTransportMasterNodeAction< DeleteAnalyticsCollectionAction.Request> { private final AnalyticsCollectionService analyticsCollectionService; private final ProjectResolver projectResolver; @Inject public TransportDeleteAnalyticsCollectionAction( TransportService transportService, ClusterService clusterService, ThreadPool threadPool, ActionFilters actionFilters, AnalyticsCollectionService analyticsCollectionService, ProjectResolver projectResolver ) { super( DeleteAnalyticsCollectionAction.NAME, transportService, clusterService, threadPool, actionFilters, DeleteAnalyticsCollectionAction.Request::new, EsExecutors.DIRECT_EXECUTOR_SERVICE ); this.analyticsCollectionService = analyticsCollectionService; this.projectResolver = projectResolver; } @Override protected ClusterBlockException checkBlock(DeleteAnalyticsCollectionAction.Request request, ClusterState state) { return state.blocks().globalBlockedException(projectResolver.getProjectId(), ClusterBlockLevel.METADATA_WRITE); } @Override protected void masterOperation( Task task, DeleteAnalyticsCollectionAction.Request request, ClusterState state, ActionListener<AcknowledgedResponse> listener ) { DeprecationLogger.getLogger(TransportDeleteAnalyticsCollectionAction.class) .warn(DeprecationCategory.API, BEHAVIORAL_ANALYTICS_API_ENDPOINT, BEHAVIORAL_ANALYTICS_DEPRECATION_MESSAGE); analyticsCollectionService.deleteAnalyticsCollection(state, request, listener.map(v -> AcknowledgedResponse.TRUE)); } }
TransportDeleteAnalyticsCollectionAction
java
mybatis__mybatis-3
src/main/java/org/apache/ibatis/jdbc/ScriptRunner.java
{ "start": 1323, "end": 9462 }
class ____ { private static final String LINE_SEPARATOR = System.lineSeparator(); private static final String DEFAULT_DELIMITER = ";"; private static final Pattern DELIMITER_PATTERN = Pattern .compile("^\\s*((--)|(//))?\\s*(//)?\\s*@DELIMITER\\s+([^\\s]+)", Pattern.CASE_INSENSITIVE); private final Connection connection; private boolean stopOnError; private boolean throwWarning; private boolean autoCommit; private boolean sendFullScript; private boolean removeCRs; private boolean escapeProcessing = true; private PrintWriter logWriter = new PrintWriter(System.out); private PrintWriter errorLogWriter = new PrintWriter(System.err); private String delimiter = DEFAULT_DELIMITER; private boolean fullLineDelimiter; public ScriptRunner(Connection connection) { this.connection = connection; } public void setStopOnError(boolean stopOnError) { this.stopOnError = stopOnError; } public void setThrowWarning(boolean throwWarning) { this.throwWarning = throwWarning; } public void setAutoCommit(boolean autoCommit) { this.autoCommit = autoCommit; } public void setSendFullScript(boolean sendFullScript) { this.sendFullScript = sendFullScript; } public void setRemoveCRs(boolean removeCRs) { this.removeCRs = removeCRs; } /** * Sets the escape processing. * * @param escapeProcessing * the new escape processing * * @since 3.1.1 */ public void setEscapeProcessing(boolean escapeProcessing) { this.escapeProcessing = escapeProcessing; } public void setLogWriter(PrintWriter logWriter) { this.logWriter = logWriter; } public void setErrorLogWriter(PrintWriter errorLogWriter) { this.errorLogWriter = errorLogWriter; } public void setDelimiter(String delimiter) { this.delimiter = delimiter; } public void setFullLineDelimiter(boolean fullLineDelimiter) { this.fullLineDelimiter = fullLineDelimiter; } public void runScript(Reader reader) { setAutoCommit(); try { if (sendFullScript) { executeFullScript(reader); } else { executeLineByLine(reader); } } finally { rollbackConnection(); } } private void executeFullScript(Reader reader) { StringBuilder script = new StringBuilder(); try { BufferedReader lineReader = new BufferedReader(reader); String line; while ((line = lineReader.readLine()) != null) { script.append(line); script.append(LINE_SEPARATOR); } String command = script.toString(); println(command); executeStatement(command); commitConnection(); } catch (Exception e) { String message = "Error executing: " + script + ". Cause: " + e; printlnError(message); throw new RuntimeSqlException(message, e); } } private void executeLineByLine(Reader reader) { StringBuilder command = new StringBuilder(); try { BufferedReader lineReader = new BufferedReader(reader); String line; while ((line = lineReader.readLine()) != null) { handleLine(command, line); } commitConnection(); checkForMissingLineTerminator(command); } catch (Exception e) { String message = "Error executing: " + command + ". Cause: " + e; printlnError(message); throw new RuntimeSqlException(message, e); } } /** * @deprecated Since 3.5.4, this method is deprecated. Please close the {@link Connection} outside of this class. */ @Deprecated public void closeConnection() { try { connection.close(); } catch (Exception e) { // ignore } } private void setAutoCommit() { try { if (autoCommit != connection.getAutoCommit()) { connection.setAutoCommit(autoCommit); } } catch (Throwable t) { throw new RuntimeSqlException("Could not set AutoCommit to " + autoCommit + ". Cause: " + t, t); } } private void commitConnection() { try { if (!connection.getAutoCommit()) { connection.commit(); } } catch (Throwable t) { throw new RuntimeSqlException("Could not commit transaction. Cause: " + t, t); } } private void rollbackConnection() { try { if (!connection.getAutoCommit()) { connection.rollback(); } } catch (Throwable t) { // ignore } } private void checkForMissingLineTerminator(StringBuilder command) { if (command != null && command.toString().trim().length() > 0) { throw new RuntimeSqlException("Line missing end-of-line terminator (" + delimiter + ") => " + command); } } private void handleLine(StringBuilder command, String line) throws SQLException { String trimmedLine = line.trim(); if (lineIsComment(trimmedLine)) { Matcher matcher = DELIMITER_PATTERN.matcher(trimmedLine); if (matcher.find()) { delimiter = matcher.group(5); } println(trimmedLine); } else if (commandReadyToExecute(trimmedLine)) { command.append(line, 0, line.lastIndexOf(delimiter)); command.append(LINE_SEPARATOR); println(command); executeStatement(command.toString()); command.setLength(0); } else if (trimmedLine.length() > 0) { command.append(line); command.append(LINE_SEPARATOR); } } private boolean lineIsComment(String trimmedLine) { return trimmedLine.startsWith("//") || trimmedLine.startsWith("--"); } private boolean commandReadyToExecute(String trimmedLine) { // issue #561 remove anything after the delimiter return !fullLineDelimiter && trimmedLine.contains(delimiter) || fullLineDelimiter && trimmedLine.equals(delimiter); } private void executeStatement(String command) throws SQLException { try (Statement statement = connection.createStatement()) { statement.setEscapeProcessing(escapeProcessing); String sql = command; if (removeCRs) { sql = sql.replace("\r\n", "\n"); } try { boolean hasResults = statement.execute(sql); // DO NOT try to 'improve' the condition even if IDE tells you to! // It's important that getUpdateCount() is called here. while (!(!hasResults && statement.getUpdateCount() == -1)) { checkWarnings(statement); printResults(statement, hasResults); hasResults = statement.getMoreResults(); } } catch (SQLWarning e) { throw e; } catch (SQLException e) { if (stopOnError) { throw e; } String message = "Error executing: " + command + ". Cause: " + e; printlnError(message); } } } private void checkWarnings(Statement statement) throws SQLException { if (!throwWarning) { return; } // In Oracle, CREATE PROCEDURE, FUNCTION, etc. returns warning // instead of throwing exception if there is compilation error. SQLWarning warning = statement.getWarnings(); if (warning != null) { throw warning; } } private void printResults(Statement statement, boolean hasResults) { if (!hasResults) { return; } try (ResultSet rs = statement.getResultSet()) { ResultSetMetaData md = rs.getMetaData(); int cols = md.getColumnCount(); for (int i = 0; i < cols; i++) { String name = md.getColumnLabel(i + 1); print(name + "\t"); } println(""); while (rs.next()) { for (int i = 0; i < cols; i++) { String value = rs.getString(i + 1); print(value + "\t"); } println(""); } } catch (SQLException e) { printlnError("Error printing results: " + e.getMessage()); } } private void print(Object o) { if (logWriter != null) { logWriter.print(o); logWriter.flush(); } } private void println(Object o) { if (logWriter != null) { logWriter.println(o); logWriter.flush(); } } private void printlnError(Object o) { if (errorLogWriter != null) { errorLogWriter.println(o); errorLogWriter.flush(); } } }
ScriptRunner
java
elastic__elasticsearch
server/src/internalClusterTest/java/org/elasticsearch/cluster/coordination/ZenDiscoveryIT.java
{ "start": 1550, "end": 4745 }
class ____ extends ESIntegTestCase { public void testNoShardRelocationsOccurWhenElectedMasterNodeFails() throws Exception { Settings masterNodeSettings = masterOnlyNode(); internalCluster().startNodes(2, masterNodeSettings); Settings dateNodeSettings = dataNode(); internalCluster().startNodes(2, dateNodeSettings); ClusterHealthResponse clusterHealthResponse = clusterAdmin().prepareHealth(TEST_REQUEST_TIMEOUT) .setWaitForEvents(Priority.LANGUID) .setWaitForNodes("4") .setWaitForNoRelocatingShards(true) .get(); assertThat(clusterHealthResponse.isTimedOut(), is(false)); createIndex("test"); ensureSearchable("test"); RecoveryResponse r = indicesAdmin().prepareRecoveries("test").get(); int numRecoveriesBeforeNewMaster = r.shardRecoveryStates().get("test").size(); final String oldMaster = internalCluster().getMasterName(); internalCluster().stopCurrentMasterNode(); assertBusy(() -> { String current = internalCluster().getMasterName(); assertThat(current, notNullValue()); assertThat(current, not(equalTo(oldMaster))); }); ensureSearchable("test"); r = indicesAdmin().prepareRecoveries("test").get(); int numRecoveriesAfterNewMaster = r.shardRecoveryStates().get("test").size(); assertThat(numRecoveriesAfterNewMaster, equalTo(numRecoveriesBeforeNewMaster)); } public void testDiscoveryStats() throws Exception { internalCluster().startNode(); ensureGreen(); // ensures that all events are processed (in particular state recovery fully completed) assertBusy( () -> assertThat( internalCluster().clusterService(internalCluster().getMasterName()).getMasterService().numberOfPendingTasks(), equalTo(0) ) ); // see https://github.com/elastic/elasticsearch/issues/24388 logger.info("--> request node discovery stats"); NodesStatsResponse statsResponse = clusterAdmin().prepareNodesStats().clear().setDiscovery(true).get(); assertThat(statsResponse.getNodes().size(), equalTo(1)); DiscoveryStats stats = statsResponse.getNodes().get(0).getDiscoveryStats(); assertThat(stats.getQueueStats(), notNullValue()); assertThat(stats.getQueueStats().getTotal(), equalTo(0)); assertThat(stats.getQueueStats().getCommitted(), equalTo(0)); assertThat(stats.getQueueStats().getPending(), equalTo(0)); assertThat(stats.getPublishStats(), notNullValue()); assertThat(stats.getPublishStats().getFullClusterStateReceivedCount(), greaterThanOrEqualTo(0L)); assertThat(stats.getPublishStats().getIncompatibleClusterStateDiffReceivedCount(), equalTo(0L)); assertThat(stats.getPublishStats().getCompatibleClusterStateDiffReceivedCount(), greaterThanOrEqualTo(0L)); XContentBuilder builder = XContentFactory.jsonBuilder().prettyPrint(); builder.startObject(); stats.toXContent(builder, ToXContent.EMPTY_PARAMS); builder.endObject(); } }
ZenDiscoveryIT
java
apache__avro
lang/java/avro/src/main/java/org/apache/avro/Conversions.java
{ "start": 1607, "end": 2953 }
class ____ extends Conversion<UUID> { @Override public Class<UUID> getConvertedType() { return UUID.class; } @Override public Schema getRecommendedSchema() { return LogicalTypes.uuid().addToSchema(Schema.create(Schema.Type.STRING)); } @Override public String getLogicalTypeName() { return "uuid"; } @Override public UUID fromCharSequence(CharSequence value, Schema schema, LogicalType type) { return UUID.fromString(value.toString()); } @Override public CharSequence toCharSequence(UUID value, Schema schema, LogicalType type) { return value.toString(); } @Override public UUID fromFixed(final GenericFixed value, final Schema schema, final LogicalType type) { ByteBuffer buffer = ByteBuffer.wrap(value.bytes()); long mostSigBits = buffer.getLong(); long leastSigBits = buffer.getLong(); return new UUID(mostSigBits, leastSigBits); } @Override public GenericFixed toFixed(final UUID value, final Schema schema, final LogicalType type) { ByteBuffer buffer = ByteBuffer.allocate(2 * Long.BYTES); buffer.putLong(value.getMostSignificantBits()); buffer.putLong(value.getLeastSignificantBits()); return new GenericData.Fixed(schema, buffer.array()); } } public static
UUIDConversion
java
spring-projects__spring-security
docs/src/test/java/org/springframework/security/docs/servlet/authentication/hasallauthorities/MultiFactorAuthenticationTests.java
{ "start": 2278, "end": 4559 }
class ____ { public final SpringTestContext spring = new SpringTestContext(this); @Autowired MockMvc mockMvc; @Test @WithMockUser(authorities = { FactorGrantedAuthority.PASSWORD_AUTHORITY, FactorGrantedAuthority.OTT_AUTHORITY }) void getWhenAuthenticatedWithPasswordAndOttThenPermits() throws Exception { this.spring.register(ListAuthoritiesConfiguration.class, Http200Controller.class).autowire(); // @formatter:off this.mockMvc.perform(get("/")) .andExpect(status().isOk()) .andExpect(authenticated().withUsername("user")); // @formatter:on } @Test @WithMockUser(authorities = FactorGrantedAuthority.PASSWORD_AUTHORITY) void getWhenAuthenticatedWithPasswordThenRedirectsToOtt() throws Exception { this.spring.register(ListAuthoritiesConfiguration.class, Http200Controller.class).autowire(); // @formatter:off this.mockMvc.perform(get("/")) .andExpect(status().is3xxRedirection()) .andExpect(redirectedUrl("/login?factor.type=ott&factor.reason=missing")); // @formatter:on } @Test @WithMockUser(authorities = FactorGrantedAuthority.OTT_AUTHORITY) void getWhenAuthenticatedWithOttThenRedirectsToPassword() throws Exception { this.spring.register(ListAuthoritiesConfiguration.class, Http200Controller.class).autowire(); // @formatter:off this.mockMvc.perform(get("/")) .andExpect(status().is3xxRedirection()) .andExpect(redirectedUrl("/login?factor.type=password&factor.reason=missing")); // @formatter:on } @Test @WithMockUser void getWhenAuthenticatedThenRedirectsToPassword() throws Exception { this.spring.register(ListAuthoritiesConfiguration.class, Http200Controller.class).autowire(); // @formatter:off this.mockMvc.perform(get("/")) .andExpect(status().is3xxRedirection()) .andExpect(redirectedUrl("/login?factor.type=password&factor.type=ott&factor.reason=missing&factor.reason=missing")); // @formatter:on } @Test void getWhenUnauthenticatedThenRedirectsToBoth() throws Exception { this.spring.register(ListAuthoritiesConfiguration.class, Http200Controller.class).autowire(); // @formatter:off this.mockMvc.perform(get("/")) .andExpect(status().is3xxRedirection()) .andExpect(redirectedUrl("/login")); // @formatter:on } @RestController static
MultiFactorAuthenticationTests
java
apache__camel
components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java
{ "start": 1880, "end": 28606 }
class ____ extends NettyServerBootstrapConfiguration implements Cloneable { private static final Logger LOG = LoggerFactory.getLogger(NettyConfiguration.class); private transient List<ChannelHandler> encodersList = new ArrayList<>(); private transient List<ChannelHandler> decodersList = new ArrayList<>(); @UriParam(label = "producer", description = "Allows to use a timeout for the Netty producer when calling a remote server. By default no timeout is in use. The" + " value is in milli seconds, so eg 30000 is 30 seconds. The requestTimeout is using Netty's ReadTimeoutHandler to" + " trigger the timeout.") private long requestTimeout; @UriParam(defaultValue = "true", description = "Setting to set endpoint as one-way (false) or request-response (true)") private boolean sync = true; @UriParam(label = "codec", description = "Only used for TCP. If no codec is specified, you can use this flag to indicate a text line based codec; if not" + " specified or the value is false, then Object Serialization is assumed over TCP - however only Strings are allowed" + " to be serialized by default.") private boolean textline; @UriParam(label = "codec", defaultValue = "LINE", description = "The delimiter to use for the textline codec. Possible values are LINE and NULL.") private TextLineDelimiter delimiter = TextLineDelimiter.LINE; @UriParam(label = "codec", defaultValue = "true", description = "Whether or not to auto append missing end delimiter when sending using the textline codec.") private boolean autoAppendDelimiter = true; @UriParam(label = "codec", defaultValue = "1024", description = "The max line length to use for the textline codec.") private int decoderMaxLineLength = 1024; @UriParam(label = "codec", description = "The encoding (a charset name) to use for the textline codec. If not provided, Camel will use the JVM default Charset.") private String encoding; @UriParam(label = "codec", description = "A list of encoders to be used. You can use a String which have values separated by comma, and have the values be" + " looked up in the Registry. Just remember to prefix the value with # so Camel knows it should lookup.") private String encoders; @UriParam(label = "codec", description = "A list of decoders to be used. You can use a String which have values separated by comma, and have the values be" + " looked up in the Registry. Just remember to prefix the value with # so Camel knows it should lookup.") private String decoders; @UriParam(label = "common,security", description = "To enable/disable hostname verification on SSLEngine") private boolean hostnameVerification; @UriParam(label = "common", description = "Whether or not to disconnect(close) from Netty Channel right after use.") private boolean disconnect; @UriParam(label = "producer,advanced", defaultValue = "true", description = "Channels can be lazily created to avoid exceptions, if the remote server is not up and running when the Camel producer is started.") private boolean lazyChannelCreation = true; @UriParam(label = "advanced", description = "Only used for TCP. You can transfer the exchange over the wire instead of just the body. The following fields are" + " transferred: In body, Out body, fault body, In headers, Out headers, fault headers, exchange properties, exchange" + " exception. This requires that the objects are serializable. Camel will exclude any non-serializable objects and" + " log it at WARN level.") private boolean transferExchange; @UriParam(label = "advanced", description = "Only used for TCP when transferExchange is true. When set to true, serializable objects in headers and properties" + " will be added to the exchange. Otherwise Camel will exclude any non-serializable objects and log it at WARN level.") private boolean allowSerializedHeaders; @UriParam(label = "consumer,advanced", defaultValue = "true", description = "If sync is enabled then this option dictates NettyConsumer if it should disconnect where there is no reply to send back.") private boolean disconnectOnNoReply = true; @UriParam(label = "consumer,advanced", defaultValue = "WARN", description = "If sync is enabled this option dictates NettyConsumer which logging level to use when logging a there is no reply to send back.") private LoggingLevel noReplyLogLevel = LoggingLevel.WARN; @UriParam(label = "consumer,advanced", defaultValue = "WARN", description = "If the server (NettyConsumer) catches an exception then its logged using this logging level.") private LoggingLevel serverExceptionCaughtLogLevel = LoggingLevel.WARN; @UriParam(label = "consumer,advanced", defaultValue = "DEBUG", description = "If the server (NettyConsumer) catches an java.nio.channels.ClosedChannelException then its logged using this" + " logging level. This is used to avoid logging the closed channel exceptions, as clients can disconnect abruptly" + " and then cause a flood of closed exceptions in the Netty server.") private LoggingLevel serverClosedChannelExceptionCaughtLogLevel = LoggingLevel.DEBUG; @UriParam(label = "codec", defaultValue = "true", description = "The netty component installs a default codec if both, encoder/decoder is null and textline is false. Setting" + " allowDefaultCodec to false prevents the netty component from installing a default codec as the first element in the filter chain.") private boolean allowDefaultCodec = true; @UriParam(label = "producer,advanced", description = "To use a custom ClientInitializerFactory") private ClientInitializerFactory clientInitializerFactory; @UriParam(label = "consumer,advanced", defaultValue = "true", description = "Whether to use ordered thread pool, to ensure events are processed orderly on the same channel.") private boolean usingExecutorService = true; @UriParam(label = "producer,advanced", defaultValue = "-1", description = "Sets the cap on the number of objects that can be allocated by the pool (checked out to clients, or idle awaiting" + " checkout) at a given time. Use a negative value for no limit. Be careful to not set this value too low (such as" + " 1) as the pool must have space to create a producer such as when performing retries. Be mindful that the option" + " producerPoolBlockWhenExhausted is default true, and the pool will then block when there is no space, which can" + " lead to the application to hang.") private int producerPoolMaxTotal = -1; @UriParam(label = "producer,advanced", description = "Sets the minimum number of instances allowed in the producer pool before the evictor thread (if active) spawns new objects.") private int producerPoolMinIdle; @UriParam(label = "producer,advanced", defaultValue = "100", description = "Sets the cap on the number of idle instances in the pool.") private int producerPoolMaxIdle = 100; @UriParam(label = "producer,advanced", defaultValue = "" + 5 * 60 * 1000L, description = "Sets the minimum amount of time (value in millis) an object may sit idle in the pool before it is eligible for eviction by the idle object evictor.") private long producerPoolMinEvictableIdle = 5 * 60 * 1000L; @UriParam(label = "producer,advanced", defaultValue = "-1", description = "Sets the maximum duration (value in millis) the borrowObject() method should block before throwing an exception" + " when the pool is exhausted and producerPoolBlockWhenExhausted is true. When less than 0, the borrowObject()" + " method may block indefinitely.") private long producerPoolMaxWait = -1; @UriParam(label = "producer,advanced", defaultValue = "true", description = "Sets the value for the blockWhenExhausted configuration attribute. It determines whether to block when the" + " borrowObject() method is invoked when the pool is exhausted (the maximum number of active objects has been reached).") private boolean producerPoolBlockWhenExhausted = true; @UriParam(label = "producer,advanced", defaultValue = "true", description = "Whether producer pool is enabled or not." + " Important: If you turn this off then a single shared connection is used for the producer, also if you are doing" + " request/reply. That means there is a potential issue with interleaved responses if replies comes back" + " out-of-order. Therefore you need to have a correlation id in both the request and reply messages so you can" + " properly correlate the replies to the Camel callback that is responsible for continue processing the message in" + " Camel. To do this you need to implement NettyCamelStateCorrelationManager as correlation manager and" + " configure it via the correlationManager option." + " See also the correlationManager option for more details.") private boolean producerPoolEnabled = true; @UriParam(label = "producer,advanced", description = "This option supports connection less udp sending which is a real fire and forget. A connected udp send receive" + " the PortUnreachableException if no one is listen on the receiving port.") private boolean udpConnectionlessSending; @UriParam(label = "consumer", description = "If the clientMode is true, netty consumer will connect the address as a TCP client.") private boolean clientMode; @UriParam(label = "producer,advanced", description = "If the useByteBuf is true, netty producer will turn the message body into ByteBuf before sending it out.") private boolean useByteBuf; @UriParam(label = "advanced", description = "For UDP only. If enabled the using byte array codec instead of Java serialization protocol.") private boolean udpByteArrayCodec; @UriParam(label = "common", description = "This option allows producers and consumers (in client mode) to reuse the same Netty Channel for the" + " lifecycle of processing the Exchange. This is useful if you need to call a server multiple times in a" + " Camel route and want to use the same network connection. When using this, the channel is not returned to the" + " connection pool until the Exchange is done; or disconnected if the disconnect option is set to true." + " The reused Channel is stored on the Exchange as an exchange property with the key" + " CamelNettyChannel which allows you to obtain the channel during routing and use it as well.") private boolean reuseChannel; @UriParam(label = "producer,advanced", description = "To use a custom correlation manager to manage how request and reply messages are mapped when using request/reply" + " with the netty producer. This should only be used if you have a way to map requests together with replies such as" + " if there is correlation ids in both the request and reply messages. This can be used if you want to multiplex" + " concurrent messages on the same channel (aka connection) in netty. When doing this you must have a way to" + " correlate the request and reply messages so you can store the right reply on the inflight Camel Exchange before" + " its continued routed." + " We recommend extending the TimeoutCorrelationManagerSupport when you build custom correlation managers." + " This provides support for timeout and other complexities you otherwise would need to implement as well." + " See also the producerPoolEnabled option for more details.") private NettyCamelStateCorrelationManager correlationManager; /** * Returns a copy of this configuration */ public NettyConfiguration copy() { try { NettyConfiguration answer = (NettyConfiguration) clone(); // make sure the lists is copied in its own instance answer.setEncodersAsList(new ArrayList<>(getEncodersAsList())); answer.setDecodersAsList(new ArrayList<>(getDecodersAsList())); return answer; } catch (CloneNotSupportedException e) { throw new RuntimeCamelException(e); } } public void validateConfiguration() { // validate that the encoders is either shareable or is a handler factory for (ChannelHandler encoder : encodersList) { if (encoder instanceof ChannelHandlerFactory) { continue; } if (ObjectHelper.getAnnotation(encoder, ChannelHandler.Sharable.class) != null) { continue; } LOG.warn( "The encoder {} is not @Shareable or an ChannelHandlerFactory instance. The encoder cannot safely be used.", encoder); } // validate that the decoders is either shareable or is a handler factory for (ChannelHandler decoder : decodersList) { if (decoder instanceof ChannelHandlerFactory) { continue; } if (ObjectHelper.getAnnotation(decoder, ChannelHandler.Sharable.class) != null) { continue; } LOG.warn( "The decoder {} is not @Shareable or an ChannelHandlerFactory instance. The decoder cannot safely be used.", decoder); } if (sslHandler != null) { boolean factory = sslHandler instanceof ChannelHandlerFactory; boolean shareable = ObjectHelper.getAnnotation(sslHandler, ChannelHandler.Sharable.class) != null; if (!factory && !shareable) { LOG.warn( "The sslHandler {} is not @Shareable or an ChannelHandlerFactory instance. The sslHandler cannot safely be used.", sslHandler); } } } public void parseURI(URI uri, Map<String, Object> parameters, NettyComponent component, String... supportedProtocols) throws Exception { protocol = uri.getScheme(); boolean found = false; for (String supportedProtocol : supportedProtocols) { if (protocol != null && protocol.equalsIgnoreCase(supportedProtocol)) { found = true; break; } } if (!found) { throw new IllegalArgumentException("Unrecognized Netty protocol: " + protocol + " for uri: " + uri); } setHost(uri.getHost()); if (uri.getPort() != -1) { setPort(uri.getPort()); } ssl = component.getAndRemoveOrResolveReferenceParameter(parameters, "ssl", boolean.class, ssl); sslHandler = component.getAndRemoveOrResolveReferenceParameter(parameters, "sslHandler", SslHandler.class, sslHandler); passphrase = component.getAndRemoveOrResolveReferenceParameter(parameters, "passphrase", String.class, passphrase); keyStoreFormat = component.getAndRemoveOrResolveReferenceParameter(parameters, "keyStoreFormat", String.class, keyStoreFormat == null ? "JKS" : keyStoreFormat); securityProvider = component.getAndRemoveOrResolveReferenceParameter(parameters, "securityProvider", String.class, securityProvider == null ? "SunX509" : securityProvider); keyStoreResource = uriRef(component, parameters, "keyStoreResource", keyStoreResource); trustStoreResource = uriRef(component, parameters, "trustStoreResource", trustStoreResource); clientInitializerFactory = component.getAndRemoveOrResolveReferenceParameter(parameters, "clientInitializerFactory", ClientInitializerFactory.class, clientInitializerFactory); serverInitializerFactory = component.getAndRemoveOrResolveReferenceParameter(parameters, "serverInitializerFactory", ServerInitializerFactory.class, serverInitializerFactory); // set custom encoders and decoders first List<ChannelHandler> referencedEncoders = component.resolveAndRemoveReferenceListParameter(parameters, "encoders", ChannelHandler.class, null); addToHandlersList(encodersList, referencedEncoders, ChannelHandler.class); List<ChannelHandler> referencedDecoders = component.resolveAndRemoveReferenceListParameter(parameters, "decoders", ChannelHandler.class, null); addToHandlersList(decodersList, referencedDecoders, ChannelHandler.class); // set custom encoders and decoders from config List<ChannelHandler> configEncoders = EndpointHelper.resolveReferenceListParameter(component.getCamelContext(), encoders, ChannelHandler.class); addToHandlersList(encodersList, configEncoders, ChannelHandler.class); List<ChannelHandler> configDecoders = EndpointHelper.resolveReferenceListParameter(component.getCamelContext(), decoders, ChannelHandler.class); addToHandlersList(decodersList, configDecoders, ChannelHandler.class); // then set parameters with the help of the camel context type converters // and use configurer to avoid any reflection calls PropertyConfigurer configurer = PluginHelper.getConfigurerResolver(component.getCamelContext()) .resolvePropertyConfigurer(this.getClass().getName(), component.getCamelContext()); PropertyBindingSupport.build() .withCamelContext(component.getCamelContext()) .withTarget(this) .withReflection(false) .withIgnoreCase(true) .withConfigurer(configurer) .withProperties(parameters) .bind(); addAdditionalOptions(PropertiesHelper.extractProperties(parameters, "option.")); // add default encoders and decoders if (encodersList.isEmpty() && decodersList.isEmpty()) { if (isAllowDefaultCodec()) { if ("udp".equalsIgnoreCase(protocol)) { encodersList.add(ChannelHandlerFactories.newDatagramPacketEncoder()); } // are we textline or byte array if (isTextline()) { Charset charset = getEncoding() != null ? Charset.forName(getEncoding()) : CharsetUtil.UTF_8; encodersList.add(ChannelHandlerFactories.newStringEncoder(charset, protocol)); ByteBuf[] delimiters = delimiter == TextLineDelimiter.LINE ? Delimiters.lineDelimiter() : Delimiters.nulDelimiter(); decodersList.add( ChannelHandlerFactories.newDelimiterBasedFrameDecoder(decoderMaxLineLength, delimiters, protocol)); decodersList.add(ChannelHandlerFactories.newStringDecoder(charset, protocol)); LOG.debug( "Using textline encoders and decoders with charset: {}, delimiter: {} and decoderMaxLineLength: {}", charset, delimiter, decoderMaxLineLength); } else if ("udp".equalsIgnoreCase(protocol) && isUdpByteArrayCodec()) { encodersList.add(ChannelHandlerFactories.newByteArrayEncoder(protocol)); decodersList.add(ChannelHandlerFactories.newByteArrayDecoder(protocol)); } else { // Fall back to allowing Strings to be serialized only Charset charset = getEncoding() != null ? Charset.forName(getEncoding()) : CharsetUtil.UTF_8; encodersList.add(ChannelHandlerFactories.newStringEncoder(charset, protocol)); decodersList.add(ChannelHandlerFactories.newStringDecoder(charset, protocol)); } if ("udp".equalsIgnoreCase(protocol)) { decodersList.add(ChannelHandlerFactories.newDatagramPacketDecoder()); } } else { LOG.debug("No encoders and decoders will be used"); } } else { LOG.debug("Using configured encoders and/or decoders"); } } private String uriRef(NettyComponent component, Map<String, Object> parameters, String key, String defaultValue) { Object value = parameters.remove(key); if (value == null) { value = defaultValue; } else if (value instanceof String && EndpointHelper.isReferenceParameter((String) value)) { String name = ((String) value).replace("#", ""); value = CamelContextHelper.mandatoryLookup(component.getCamelContext(), name); } if (value instanceof File) { return "file:" + value.toString(); } else if (value != null) { return value.toString(); } else { return null; } } public String getCharsetName() { if (encoding == null) { return null; } if (!Charset.isSupported(encoding)) { throw new IllegalArgumentException("The encoding: " + encoding + " is not supported"); } return Charset.forName(encoding).name(); } public long getRequestTimeout() { return requestTimeout; } /** * Allows to use a timeout for the Netty producer when calling a remote server. By default no timeout is in use. The * value is in milli seconds, so eg 30000 is 30 seconds. The requestTimeout is using Netty's ReadTimeoutHandler to * trigger the timeout. */ public void setRequestTimeout(long requestTimeout) { this.requestTimeout = requestTimeout; } public boolean isSync() { return sync; } /** * Setting to set endpoint as one-way or request-response */ public void setSync(boolean sync) { this.sync = sync; } public boolean isTextline() { return textline; } /** * Only used for TCP. If no codec is specified, you can use this flag to indicate a text line based codec; if not * specified or the value is false, then Object Serialization is assumed over TCP - however only Strings are allowed * to be serialized by default. */ public void setTextline(boolean textline) { this.textline = textline; } public int getDecoderMaxLineLength() { return decoderMaxLineLength; } /** * The max line length to use for the textline codec. */ public void setDecoderMaxLineLength(int decoderMaxLineLength) { this.decoderMaxLineLength = decoderMaxLineLength; } public TextLineDelimiter getDelimiter() { return delimiter; } /** * The delimiter to use for the textline codec. Possible values are LINE and NULL. */ public void setDelimiter(TextLineDelimiter delimiter) { this.delimiter = delimiter; } public boolean isAutoAppendDelimiter() { return autoAppendDelimiter; } /** * Whether or not to auto append missing end delimiter when sending using the textline codec. */ public void setAutoAppendDelimiter(boolean autoAppendDelimiter) { this.autoAppendDelimiter = autoAppendDelimiter; } public String getEncoding() { return encoding; } /** * The encoding (a charset name) to use for the textline codec. If not provided, Camel will use the JVM default * Charset. */ public void setEncoding(String encoding) { this.encoding = encoding; } public List<ChannelHandler> getDecodersAsList() { return decodersList; } public void setDecodersAsList(List<ChannelHandler> decoders) { this.decodersList = decoders; } /** * A list of decoders to be used. You can use a String which have values separated by comma, and have the values be * looked up in the Registry. Just remember to prefix the value with # so Camel knows it should lookup. */ public void setDecoders(List<ChannelHandler> decoders) { this.decodersList = decoders; } /** * A list of decoders to be used. You can use a String which have values separated by comma, and have the values be * looked up in the Registry. Just remember to prefix the value with # so Camel knows it should lookup. */ public void setDecoders(String decoders) { this.decoders = decoders; } public String getDecoders() { return decoders; } public List<ChannelHandler> getEncodersAsList() { return encodersList; } public void setEncodersAsList(List<ChannelHandler> encoders) { this.encodersList = encoders; } /** * A list of encoders to be used. You can use a String which have values separated by comma, and have the values be * looked up in the Registry. Just remember to prefix the value with # so Camel knows it should lookup. */ public void setEncoders(List<ChannelHandler> encoders) { this.encodersList = encoders; } /** * A list of encoders to be used. You can use a String which have values separated by comma, and have the values be * looked up in the Registry. Just remember to prefix the value with # so Camel knows it should lookup. */ public void setEncoders(String encoders) { this.encoders = encoders; } public String getEncoders() { return encoders; } /** * Adds a custom ChannelHandler
NettyConfiguration
java
spring-projects__spring-boot
documentation/spring-boot-docs/src/main/java/org/springframework/boot/docs/io/caching/provider/redis/MyRedisCacheManagerConfiguration.java
{ "start": 1039, "end": 1496 }
class ____ { @Bean public RedisCacheManagerBuilderCustomizer myRedisCacheManagerBuilderCustomizer() { // @formatter:off return (builder) -> builder .withCacheConfiguration("cache1", RedisCacheConfiguration .defaultCacheConfig().entryTtl(Duration.ofSeconds(10))) .withCacheConfiguration("cache2", RedisCacheConfiguration .defaultCacheConfig().entryTtl(Duration.ofMinutes(1))); // @formatter:on } }
MyRedisCacheManagerConfiguration
java
hibernate__hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/custom/basic/UserCollectionTypeAnnotationsVariantTest.java
{ "start": 457, "end": 685 }
class ____ extends UserCollectionTypeTest { @Override protected void checkEmailAddressInitialization(User user) { assertTrue( Hibernate.isInitialized( user.getEmailAddresses() ) ); } }
UserCollectionTypeAnnotationsVariantTest
java
elastic__elasticsearch
server/src/main/java/org/elasticsearch/action/admin/indices/resolve/ResolveIndexAction.java
{ "start": 8390, "end": 8833 }
class ____ { static final ParseField NAME_FIELD = new ParseField("name"); private String name; ResolvedIndexAbstraction() {} ResolvedIndexAbstraction(String name) { this.name = name; } protected void setName(String name) { this.name = name; } public String getName() { return name; } } public static
ResolvedIndexAbstraction
java
elastic__elasticsearch
x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/ForkingOperatorTestCase.java
{ "start": 16732, "end": 17194 }
class ____ implements Comparator<Float> { static final FloatComparator INSTANCE = new FloatComparator(); @Override public int compare(Float o1, Float o2) { float first = o1; float second = o2; if (first < second) { return -1; } else if (first == second) { return 0; } else { return 1; } } } }
FloatComparator
java
apache__dubbo
dubbo-config/dubbo-config-spring6/src/main/java/org/apache/dubbo/config/spring6/beans/factory/annotation/ServiceAnnotationWithAotPostProcessor.java
{ "start": 3510, "end": 4192 }
class ____ implements BeanRegistrationAotContribution { private final Class<?> cl; public DubboServiceBeanRegistrationAotContribution(Class<?> cl) { this.cl = cl; } @Override public void applyTo(GenerationContext generationContext, BeanRegistrationCode beanRegistrationCode) { generationContext .getRuntimeHints() .reflection() .registerType(TypeReference.of(cl), MemberCategory.INVOKE_PUBLIC_METHODS); AotUtils.registerSerializationForService(cl, generationContext.getRuntimeHints()); } } }
DubboServiceBeanRegistrationAotContribution
java
elastic__elasticsearch
x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/common/http/BasicAuth.java
{ "start": 4478, "end": 4620 }
interface ____ { ParseField USERNAME = new ParseField("username"); ParseField PASSWORD = new ParseField("password"); } }
Field
java
FasterXML__jackson-databind
src/test/java/tools/jackson/databind/jsontype/JsonTypeInfoCustomResolver2811Test.java
{ "start": 1387, "end": 3986 }
class ____ extends TypeIdResolverBase { private static final long serialVersionUID = 1L; JavaType superType; @Override public void init(JavaType bt) { this.superType = bt; } @Override public String idFromValue(DatabindContext ctxt, Object value) { return idFromValueAndType(ctxt, value, value.getClass()); } @Override public String idFromValueAndType(DatabindContext ctxt, Object value, Class<?> suggestedType) { // only to be called for default type but... return suggestedType.getSimpleName().toUpperCase(); } @Override public JavaType typeFromId(DatabindContext context, String id) { Class<? extends Vehicle> vehicleClass; try { vehicleClass = VehicleType.valueOf(id).vehicleClass; } catch (IllegalArgumentException e) { throw e; } return context.constructSpecializedType(superType, vehicleClass); } @Override public JsonTypeInfo.Id getMechanism() { return JsonTypeInfo.Id.NAME; } } private final ObjectMapper MAPPER = jsonMapperBuilder() .disable(DeserializationFeature.FAIL_ON_MISSING_EXTERNAL_TYPE_ID_PROPERTY) .disable(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE) .build(); // [databind#2811] @Test public void testTypeInfoWithCustomResolver2811NoTypeId() throws Exception { String json = "{ \"name\": \"kamil\", \"vehicle\": {\"wheels\": 4, \"color\": \"red\"}}"; Person<?> person = MAPPER.readValue(json, Person.class); assertEquals("kamil", person.name); assertNull(person.vehicleType); assertNotNull(person.vehicle); assertEquals(Car.class, person.vehicle.getClass()); } // Passing case for comparison /* @Test public void testTypeInfoWithCustomResolver2811WithTypeId() throws Exception { String json = "{\n" + " \"name\": \"kamil\",\n" + " \"vehicleType\": \"CAR\",\n" + " \"vehicle\": {\n" + " \"wheels\": 4,\n" + " \"color\": \"red\"\n" + " }\n" + "}" ; Person<?> person = MAPPER.readValue(json, Person.class); assertEquals("kamil", person.name); assertEquals(VehicleType.CAR, person.vehicleType); assertNotNull(person.vehicle); } */ }
VehicleTypeResolver
java
apache__hadoop
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestChRootedFileSystem.java
{ "start": 2068, "end": 15737 }
class ____ { FileSystem fSys; // The ChRoootedFs FileSystem fSysTarget; // Path chrootedTo; FileSystemTestHelper fileSystemTestHelper; @BeforeEach public void setUp() throws Exception { // create the test root on local_fs Configuration conf = new Configuration(); fSysTarget = FileSystem.getLocal(conf); fileSystemTestHelper = new FileSystemTestHelper(); chrootedTo = fileSystemTestHelper.getAbsoluteTestRootPath(fSysTarget); // In case previous test was killed before cleanup fSysTarget.delete(chrootedTo, true); fSysTarget.mkdirs(chrootedTo); // ChRoot to the root of the testDirectory fSys = new ChRootedFileSystem(chrootedTo.toUri(), conf); } @AfterEach public void tearDown() throws Exception { fSysTarget.delete(chrootedTo, true); } @Test public void testURI() { URI uri = fSys.getUri(); assertEquals(chrootedTo.toUri(), uri); } @Test public void testBasicPaths() { URI uri = fSys.getUri(); assertEquals(chrootedTo.toUri(), uri); assertEquals(fSys.makeQualified( new Path(System.getProperty("user.home"))), fSys.getWorkingDirectory()); assertEquals(fSys.makeQualified( new Path(System.getProperty("user.home"))), fSys.getHomeDirectory()); /* * ChRootedFs as its uri like file:///chrootRoot. * This is questionable since path.makequalified(uri, path) ignores * the pathPart of a uri. So our notion of chrooted URI is questionable. * But if we were to fix Path#makeQualified() then the next test should * have been: assertEquals( new Path(chrootedTo + "/foo/bar").makeQualified( FsConstants.LOCAL_FS_URI, null), fSys.makeQualified(new Path( "/foo/bar"))); */ assertEquals( new Path("/foo/bar").makeQualified(FsConstants.LOCAL_FS_URI, null), fSys.makeQualified(new Path("/foo/bar"))); } /** * Test modify operations (create, mkdir, delete, etc) * * Verify the operation via chrootedfs (ie fSys) and *also* via the * target file system (ie fSysTarget) that has been chrooted. */ @Test public void testCreateDelete() throws IOException { // Create file fileSystemTestHelper.createFile(fSys, "/foo"); assertTrue(fSys.isFile(new Path("/foo"))); assertTrue(fSysTarget.isFile(new Path(chrootedTo, "foo"))); // Create file with recursive dir fileSystemTestHelper.createFile(fSys, "/newDir/foo"); assertTrue(fSys.isFile(new Path("/newDir/foo"))); assertTrue(fSysTarget.isFile(new Path(chrootedTo, "newDir/foo"))); // Delete the created file assertTrue(fSys.delete(new Path("/newDir/foo"), false)); assertFalse(fSys.exists(new Path("/newDir/foo"))); assertFalse(fSysTarget.exists(new Path(chrootedTo, "newDir/foo"))); // Create file with a 2 component dirs recursively fileSystemTestHelper.createFile(fSys, "/newDir/newDir2/foo"); assertTrue(fSys.isFile(new Path("/newDir/newDir2/foo"))); assertTrue(fSysTarget.isFile(new Path(chrootedTo, "newDir/newDir2/foo"))); // Delete the created file assertTrue(fSys.delete(new Path("/newDir/newDir2/foo"), false)); assertFalse(fSys.exists(new Path("/newDir/newDir2/foo"))); assertFalse(fSysTarget.exists(new Path(chrootedTo, "newDir/newDir2/foo"))); } @Test public void testMkdirDelete() throws IOException { fSys.mkdirs(fileSystemTestHelper.getTestRootPath(fSys, "/dirX")); assertTrue(fSys.isDirectory(new Path("/dirX"))); assertTrue(fSysTarget.isDirectory(new Path(chrootedTo, "dirX"))); fSys.mkdirs(fileSystemTestHelper.getTestRootPath(fSys, "/dirX/dirY")); assertTrue(fSys.isDirectory(new Path("/dirX/dirY"))); assertTrue(fSysTarget.isDirectory(new Path(chrootedTo, "dirX/dirY"))); // Delete the created dir assertTrue(fSys.delete(new Path("/dirX/dirY"), false)); assertFalse(fSys.exists(new Path("/dirX/dirY"))); assertFalse(fSysTarget.exists(new Path(chrootedTo, "dirX/dirY"))); assertTrue(fSys.delete(new Path("/dirX"), false)); assertFalse(fSys.exists(new Path("/dirX"))); assertFalse(fSysTarget.exists(new Path(chrootedTo, "dirX"))); } @Test public void testRename() throws IOException { // Rename a file fileSystemTestHelper.createFile(fSys, "/newDir/foo"); fSys.rename(new Path("/newDir/foo"), new Path("/newDir/fooBar")); assertFalse(fSys.exists(new Path("/newDir/foo"))); assertFalse(fSysTarget.exists(new Path(chrootedTo, "newDir/foo"))); assertTrue(fSys.isFile(fileSystemTestHelper.getTestRootPath(fSys, "/newDir/fooBar"))); assertTrue(fSysTarget.isFile(new Path(chrootedTo, "newDir/fooBar"))); // Rename a dir fSys.mkdirs(new Path("/newDir/dirFoo")); fSys.rename(new Path("/newDir/dirFoo"), new Path("/newDir/dirFooBar")); assertFalse(fSys.exists(new Path("/newDir/dirFoo"))); assertFalse(fSysTarget.exists(new Path(chrootedTo, "newDir/dirFoo"))); assertTrue(fSys.isDirectory(fileSystemTestHelper.getTestRootPath(fSys, "/newDir/dirFooBar"))); assertTrue(fSysTarget.isDirectory(new Path(chrootedTo, "newDir/dirFooBar"))); } @Test public void testGetContentSummary() throws IOException { // GetContentSummary of a dir fSys.mkdirs(new Path("/newDir/dirFoo")); ContentSummary cs = fSys.getContentSummary(new Path("/newDir/dirFoo")); assertEquals(-1L, cs.getQuota()); assertEquals(-1L, cs.getSpaceQuota()); } /** * We would have liked renames across file system to fail but * Unfortunately there is not way to distinguish the two file systems * @throws IOException */ @Test public void testRenameAcrossFs() throws IOException { fSys.mkdirs(new Path("/newDir/dirFoo")); fSys.rename(new Path("/newDir/dirFoo"), new Path("file:///tmp/dirFooBar")); FileSystemTestHelper.isDir(fSys, new Path("/tmp/dirFooBar")); } @Test public void testList() throws IOException { FileStatus fs = fSys.getFileStatus(new Path("/")); assertTrue(fs.isDirectory()); // should return the full path not the chrooted path assertEquals(fs.getPath(), chrootedTo); // list on Slash FileStatus[] dirPaths = fSys.listStatus(new Path("/")); assertEquals(0, dirPaths.length); fileSystemTestHelper.createFile(fSys, "/foo"); fileSystemTestHelper.createFile(fSys, "/bar"); fSys.mkdirs(new Path("/dirX")); fSys.mkdirs(fileSystemTestHelper.getTestRootPath(fSys, "/dirY")); fSys.mkdirs(new Path("/dirX/dirXX")); dirPaths = fSys.listStatus(new Path("/")); assertEquals(4, dirPaths.length); // note 2 crc files // Note the the file status paths are the full paths on target fs = FileSystemTestHelper.containsPath(new Path(chrootedTo, "foo"), dirPaths); assertNotNull(fs); assertTrue(fs.isFile()); fs = FileSystemTestHelper.containsPath(new Path(chrootedTo, "bar"), dirPaths); assertNotNull(fs); assertTrue(fs.isFile()); fs = FileSystemTestHelper.containsPath(new Path(chrootedTo, "dirX"), dirPaths); assertNotNull(fs); assertTrue(fs.isDirectory()); fs = FileSystemTestHelper.containsPath(new Path(chrootedTo, "dirY"), dirPaths); assertNotNull(fs); assertTrue(fs.isDirectory()); } @Test public void testWorkingDirectory() throws Exception { // First we cd to our test root fSys.mkdirs(new Path("/testWd")); Path workDir = new Path("/testWd"); fSys.setWorkingDirectory(workDir); assertEquals(workDir, fSys.getWorkingDirectory()); fSys.setWorkingDirectory(new Path(".")); assertEquals(workDir, fSys.getWorkingDirectory()); fSys.setWorkingDirectory(new Path("..")); assertEquals(workDir.getParent(), fSys.getWorkingDirectory()); // cd using a relative path // Go back to our test root workDir = new Path("/testWd"); fSys.setWorkingDirectory(workDir); assertEquals(workDir, fSys.getWorkingDirectory()); Path relativeDir = new Path("existingDir1"); Path absoluteDir = new Path(workDir,"existingDir1"); fSys.mkdirs(absoluteDir); fSys.setWorkingDirectory(relativeDir); assertEquals(absoluteDir, fSys.getWorkingDirectory()); // cd using a absolute path absoluteDir = new Path("/test/existingDir2"); fSys.mkdirs(absoluteDir); fSys.setWorkingDirectory(absoluteDir); assertEquals(absoluteDir, fSys.getWorkingDirectory()); // Now open a file relative to the wd we just set above. Path absoluteFooPath = new Path(absoluteDir, "foo"); fSys.create(absoluteFooPath).close(); fSys.open(new Path("foo")).close(); // Now mkdir relative to the dir we cd'ed to fSys.mkdirs(new Path("newDir")); assertTrue(fSys.isDirectory(new Path(absoluteDir, "newDir"))); /* Filesystem impls (RawLocal and DistributedFileSystem do not check * for existing of working dir absoluteDir = getTestRootPath(fSys, "nonexistingPath"); try { fSys.setWorkingDirectory(absoluteDir); fail("cd to non existing dir should have failed"); } catch (Exception e) { // Exception as expected } */ // Try a URI final String LOCAL_FS_ROOT_URI = "file:///tmp/test"; absoluteDir = new Path(LOCAL_FS_ROOT_URI + "/existingDir"); fSys.mkdirs(absoluteDir); fSys.setWorkingDirectory(absoluteDir); assertEquals(absoluteDir, fSys.getWorkingDirectory()); } /* * Test resolvePath(p) */ @Test public void testResolvePath() throws IOException { assertEquals(chrootedTo, fSys.resolvePath(new Path("/"))); fileSystemTestHelper.createFile(fSys, "/foo"); assertEquals(new Path(chrootedTo, "foo"), fSys.resolvePath(new Path("/foo"))); } @Test public void testResolvePathNonExisting() throws IOException { assertThrows(FileNotFoundException.class, () -> { fSys.resolvePath(new Path("/nonExisting")); }); } @Test public void testDeleteOnExitPathHandling() throws IOException { Configuration conf = new Configuration(); conf.setClass("fs.mockfs.impl", MockFileSystem.class, FileSystem.class); URI chrootUri = URI.create("mockfs://foo/a/b"); ChRootedFileSystem chrootFs = new ChRootedFileSystem(chrootUri, conf); FileSystem mockFs = ((FilterFileSystem)chrootFs.getRawFileSystem()) .getRawFileSystem(); // ensure delete propagates the correct path Path chrootPath = new Path("/c"); Path rawPath = new Path("/a/b/c"); chrootFs.delete(chrootPath, false); verify(mockFs).delete(eq(rawPath), eq(false)); reset(mockFs); // fake that the path exists for deleteOnExit FileStatus stat = mock(FileStatus.class); when(mockFs.getFileStatus(eq(rawPath))).thenReturn(stat); // ensure deleteOnExit propagates the correct path chrootFs.deleteOnExit(chrootPath); chrootFs.close(); verify(mockFs).delete(eq(rawPath), eq(true)); } @Test public void testURIEmptyPath() throws IOException { Configuration conf = new Configuration(); conf.setClass("fs.mockfs.impl", MockFileSystem.class, FileSystem.class); URI chrootUri = URI.create("mockfs://foo"); new ChRootedFileSystem(chrootUri, conf); } /** * Tests that ChRootedFileSystem delegates calls for every ACL method to the * underlying FileSystem with all Path arguments translated as required to * enforce chroot. */ @Test public void testAclMethodsPathTranslation() throws IOException { Configuration conf = new Configuration(); conf.setClass("fs.mockfs.impl", MockFileSystem.class, FileSystem.class); URI chrootUri = URI.create("mockfs://foo/a/b"); ChRootedFileSystem chrootFs = new ChRootedFileSystem(chrootUri, conf); FileSystem mockFs = ((FilterFileSystem)chrootFs.getRawFileSystem()) .getRawFileSystem(); Path chrootPath = new Path("/c"); Path rawPath = new Path("/a/b/c"); List<AclEntry> entries = Collections.emptyList(); chrootFs.modifyAclEntries(chrootPath, entries); verify(mockFs).modifyAclEntries(rawPath, entries); chrootFs.removeAclEntries(chrootPath, entries); verify(mockFs).removeAclEntries(rawPath, entries); chrootFs.removeDefaultAcl(chrootPath); verify(mockFs).removeDefaultAcl(rawPath); chrootFs.removeAcl(chrootPath); verify(mockFs).removeAcl(rawPath); chrootFs.setAcl(chrootPath, entries); verify(mockFs).setAcl(rawPath, entries); chrootFs.getAclStatus(chrootPath); verify(mockFs).getAclStatus(rawPath); } @Test public void testListLocatedFileStatus() throws Exception { final Path mockMount = new Path("mockfs://foo/user"); final Path mockPath = new Path("/usermock"); final Configuration conf = new Configuration(); conf.setClass("fs.mockfs.impl", MockFileSystem.class, FileSystem.class); ConfigUtil.addLink(conf, mockPath.toString(), mockMount.toUri()); FileSystem vfs = FileSystem.get(URI.create("viewfs:///"), conf); vfs.listLocatedStatus(mockPath); final FileSystem mockFs = ((MockFileSystem) getChildFileSystem((ViewFileSystem) vfs, new URI("mockfs://foo/"))).getRawFileSystem(); verify(mockFs).listLocatedStatus(new Path(mockMount.toUri().getPath())); } static FileSystem getChildFileSystem(ViewFileSystem viewFs, URI uri) { for (FileSystem fs : viewFs.getChildFileSystems()) { if (Objects.equals(fs.getUri().getScheme(), uri.getScheme()) && Objects .equals(fs.getUri().getAuthority(), uri.getAuthority())) { return fs; } } return null; } static
TestChRootedFileSystem
java
google__auto
value/src/test/java/com/google/auto/value/processor/ExtensionTest.java
{ "start": 9548, "end": 10042 }
class ____ {", " abstract String foo();", " abstract String dizzle();", "}"); Compilation compilation = javac().withProcessors(new AutoValueProcessor(ImmutableList.of(ext1, ext2))).compile(impl); assertThat(compilation) .hadErrorContaining("wants to consume a method that was already consumed") .inFile(impl) .onLineContaining("String dizzle()"); } @Test public void testCantConsumeNonExistentProperty() {
Baz
java
spring-projects__spring-boot
module/spring-boot-webmvc/src/test/java/org/springframework/boot/webmvc/actuate/autoconfigure/health/WebMvcHealthEndpointExtensionAutoConfigurationTests.java
{ "start": 4176, "end": 4439 }
class ____ { @Bean HealthIndicator simpleHealthIndicator() { return () -> Health.up().withDetail("counter", 42).build(); } @Bean HealthIndicator additionalHealthIndicator() { return () -> Health.up().build(); } } }
HealthIndicatorsConfiguration
java
elastic__elasticsearch
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/aggregate/AvgSerializationTests.java
{ "start": 2332, "end": 4395 }
class ____ extends AggregateFunction { public OldAvg(Source source, Expression field, Expression filter) { super(source, field, filter, NO_WINDOW, List.of()); } @Override public AggregateFunction withFilter(Expression filter) { return new OldAvg(source(), filter, filter); } @Override public DataType dataType() { return field().dataType(); } @Override public Expression replaceChildren(List<Expression> newChildren) { return new OldAvg(source(), newChildren.get(0), newChildren.get(1)); } @Override protected NodeInfo<? extends Expression> info() { return NodeInfo.create(this, OldAvg::new, field(), filter()); } @Override public String getWriteableName() { return Avg.ENTRY.name; } } public void testSerializeOldAvg() throws IOException { var oldAvg = new OldAvg(randomSource(), randomChild(), randomChild()); try (BytesStreamOutput out = new BytesStreamOutput()) { PlanStreamOutput planOut = new PlanStreamOutput(out, configuration()); planOut.writeNamedWriteable(oldAvg); try (StreamInput in = new NamedWriteableAwareStreamInput(out.bytes().streamInput(), getNamedWriteableRegistry())) { PlanStreamInput planIn = new PlanStreamInput( in, getNamedWriteableRegistry(), configuration(), new SerializationTestUtils.TestNameIdMapper() ); Avg serialized = (Avg) planIn.readNamedWriteable(categoryClass()); assertThat(serialized.source(), equalTo(oldAvg.source())); assertThat(serialized.field(), equalTo(oldAvg.field())); assertThat(serialized.filter(), equalTo(oldAvg.filter())); assertThat(serialized.summationMode(), equalTo(SummationMode.COMPENSATED_LITERAL)); } } } }
OldAvg
java
elastic__elasticsearch
x-pack/plugin/ml-package-loader/src/main/java/org/elasticsearch/xpack/ml/packageloader/action/ModelLoaderUtils.java
{ "start": 5632, "end": 15447 }
class ____ { private final InputStream inputStream; private final MessageDigest digestSha256 = MessageDigests.sha256(); private final int chunkSize; private int totalBytesRead = 0; InputStreamChunker(InputStream inputStream, int chunkSize) { this.inputStream = inputStream; this.chunkSize = chunkSize; } public BytesArray next() throws IOException { int bytesRead = 0; byte[] buf = new byte[chunkSize]; while (bytesRead < chunkSize) { int read = inputStream.read(buf, bytesRead, chunkSize - bytesRead); // EOF?? if (read == -1) { break; } bytesRead += read; } digestSha256.update(buf, 0, bytesRead); totalBytesRead += bytesRead; return new BytesArray(buf, 0, bytesRead); } public String getSha256() { return MessageDigests.toHexString(digestSha256.digest()); } public int getTotalBytesRead() { return totalBytesRead; } } static InputStream getInputStreamFromModelRepository(URI uri) { String scheme = uri.getScheme().toLowerCase(Locale.ROOT); // if you add a scheme here, also add it to the bootstrap check in {@link MachineLearningPackageLoader#validateModelRepository} switch (scheme) { case "http": case "https": return getHttpOrHttpsInputStream(uri, null); case "file": return getFileInputStream(uri); default: throw new IllegalArgumentException("unsupported scheme"); } } static boolean uriIsFile(URI uri) { String scheme = uri.getScheme().toLowerCase(Locale.ROOT); return "file".equals(scheme); } static VocabularyParts loadVocabulary(URI uri) { if (uri.getPath().endsWith(".json")) { try (InputStream vocabInputStream = getInputStreamFromModelRepository(uri)) { return parseVocabParts(vocabInputStream); } catch (Exception e) { throw new ElasticsearchException("Failed to load vocabulary file", e); } } throw new IllegalArgumentException("unknown format vocabulary file format"); } // visible for testing static VocabularyParts parseVocabParts(InputStream vocabInputStream) throws IOException { Map<String, List<Object>> vocabParts; try ( XContentParser sourceParser = XContentType.JSON.xContent() .createParser(XContentParserConfiguration.EMPTY, Streams.limitStream(vocabInputStream, VOCABULARY_SIZE_LIMIT.getBytes())) ) { vocabParts = sourceParser.map(HashMap::new, XContentParser::list); } List<String> vocabulary = vocabParts.containsKey(VOCABULARY) ? vocabParts.get(VOCABULARY).stream().map(Object::toString).collect(Collectors.toList()) : List.of(); List<String> merges = vocabParts.containsKey(MERGES) ? vocabParts.get(MERGES).stream().map(Object::toString).collect(Collectors.toList()) : List.of(); List<Double> scores = vocabParts.containsKey(SCORES) ? vocabParts.get(SCORES).stream().map(o -> (Double) o).collect(Collectors.toList()) : List.of(); return new VocabularyParts(vocabulary, merges, scores); } static URI resolvePackageLocation(String repository, String artefact) throws URISyntaxException { URI baseUri = new URI(repository.endsWith("/") ? repository : repository + "/").normalize(); URI resolvedUri = baseUri.resolve(artefact).normalize(); if (Strings.isNullOrEmpty(baseUri.getScheme())) { throw new IllegalArgumentException("Repository must contain a scheme"); } if (baseUri.getScheme().equals(resolvedUri.getScheme()) == false) { throw new IllegalArgumentException("Illegal schema change in package location"); } if (resolvedUri.getPath().startsWith(baseUri.getPath()) == false) { throw new IllegalArgumentException("Illegal path in package location"); } return baseUri.resolve(artefact); } private ModelLoaderUtils() {} @SuppressWarnings("'java.lang.SecurityManager' is deprecated and marked for removal ") @SuppressForbidden(reason = "we need socket connection to download") private static InputStream getHttpOrHttpsInputStream(URI uri, @Nullable RequestRange range) { assert uri.getUserInfo() == null : "URI's with credentials are not supported"; SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(new SpecialPermission()); } PrivilegedAction<InputStream> privilegedHttpReader = () -> { try { HttpURLConnection conn = (HttpURLConnection) uri.toURL().openConnection(); if (range != null) { conn.setRequestProperty("Range", range.bytesRange()); } switch (conn.getResponseCode()) { case HTTP_OK: case HTTP_PARTIAL: return conn.getInputStream(); case HTTP_MOVED_PERM: case HTTP_MOVED_TEMP: case HTTP_SEE_OTHER: throw new IllegalStateException("redirects aren't supported yet"); case HTTP_NOT_FOUND: throw new ResourceNotFoundException("{} not found", uri); case 416: // Range not satisfiable, for some reason not in the list of constants throw new IllegalStateException("Invalid request range [" + range.bytesRange() + "]"); default: int responseCode = conn.getResponseCode(); throw new ElasticsearchStatusException( "error during downloading {}. Got response code {}", RestStatus.fromCode(responseCode), uri, responseCode ); } } catch (IOException e) { throw new UncheckedIOException(e); } }; return AccessController.doPrivileged(privilegedHttpReader); } @SuppressWarnings("'java.lang.SecurityManager' is deprecated and marked for removal ") @SuppressForbidden(reason = "we need load model data from a file") static InputStream getFileInputStream(URI uri) { SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(new SpecialPermission()); } PrivilegedAction<InputStream> privilegedFileReader = () -> { File file = new File(uri); if (file.exists() == false) { throw new ResourceNotFoundException("{} not found", uri); } try { return Files.newInputStream(file.toPath()); } catch (IOException e) { throw new UncheckedIOException(e); } }; return AccessController.doPrivileged(privilegedFileReader); } /** * Split a stream of size {@code sizeInBytes} into {@code numberOfStreams} +1 * ranges aligned on {@code chunkSizeBytes} boundaries. Each range contains a * whole number of chunks. * All ranges except the final range will be split approximately evenly * (in terms of number of chunks not the byte size), the final range split * is for the single final chunk and will be no more than {@code chunkSizeBytes} * in size. The separate range for the final chunk is because when streaming and * uploading a large model definition, writing the last part has to handled * as a special case. * Fewer ranges may be returned in case the stream size is too small. * @param sizeInBytes The total size of the stream * @param numberOfStreams Divide the bulk of the size into this many streams. * @param chunkSizeBytes The size of each chunk * @return List of {@code numberOfStreams} + 1 or fewer ranges. */ static List<RequestRange> split(long sizeInBytes, int numberOfStreams, long chunkSizeBytes) { int numberOfChunks = (int) ((sizeInBytes + chunkSizeBytes - 1) / chunkSizeBytes); int numberOfRanges = numberOfStreams + 1; if (numberOfStreams > numberOfChunks) { numberOfRanges = numberOfChunks; } var ranges = new ArrayList<RequestRange>(); int baseChunksPerRange = (numberOfChunks - 1) / (numberOfRanges - 1); int remainder = (numberOfChunks - 1) % (numberOfRanges - 1); long startOffset = 0; int startChunkIndex = 0; for (int i = 0; i < numberOfRanges - 1; i++) { int numChunksInRange = (i < remainder) ? baseChunksPerRange + 1 : baseChunksPerRange; long rangeEnd = startOffset + (((long) numChunksInRange) * chunkSizeBytes) - 1; // range index is 0 based ranges.add(new RequestRange(startOffset, rangeEnd, startChunkIndex, numChunksInRange)); startOffset = rangeEnd + 1; // range is inclusive start and end startChunkIndex += numChunksInRange; } // The final range is a single chunk the end of which should not exceed sizeInBytes long rangeEnd = Math.min(sizeInBytes, startOffset + (baseChunksPerRange * chunkSizeBytes)) - 1; ranges.add(new RequestRange(startOffset, rangeEnd, startChunkIndex, 1)); return ranges; } }
InputStreamChunker
java
apache__camel
components/camel-hl7/src/generated/java/org/apache/camel/component/hl7/HL7251ConverterLoader.java
{ "start": 879, "end": 169471 }
class ____ implements TypeConverterLoader, CamelContextAware { private CamelContext camelContext; public HL7251ConverterLoader() { } @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.v251.message.ACK.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toACK((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ACK.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toACK((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ADR_A19.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toAdrA19((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ADR_A19.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toAdrA19((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ADT_A01.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toAdtA01((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ADT_A01.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toAdtA01((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ADT_A02.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toAdtA02((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ADT_A02.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toAdtA02((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ADT_A03.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toAdtA03((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ADT_A03.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toAdtA03((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ADT_A05.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toAdtA05((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ADT_A05.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toAdtA05((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ADT_A06.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toAdtA06((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ADT_A06.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toAdtA06((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ADT_A09.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toAdtA09((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ADT_A09.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toAdtA09((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ADT_A12.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toAdtA12((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ADT_A12.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toAdtA12((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ADT_A15.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toAdtA15((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ADT_A15.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toAdtA15((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ADT_A16.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toAdtA16((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ADT_A16.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toAdtA16((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ADT_A17.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toAdtA17((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ADT_A17.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toAdtA17((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ADT_A18.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toAdtA18((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ADT_A18.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toAdtA18((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ADT_A20.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toAdtA20((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ADT_A20.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toAdtA20((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ADT_A21.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toAdtA21((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ADT_A21.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toAdtA21((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ADT_A24.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toAdtA24((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ADT_A24.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toAdtA24((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ADT_A30.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toAdtA30((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ADT_A30.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toAdtA30((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ADT_A37.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toAdtA37((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ADT_A37.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toAdtA37((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ADT_A38.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toAdtA38((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ADT_A38.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toAdtA38((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ADT_A39.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toAdtA39((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ADT_A39.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toAdtA39((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ADT_A43.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toAdtA43((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ADT_A43.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toAdtA43((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ADT_A45.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toAdtA45((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ADT_A45.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toAdtA45((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ADT_A50.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toAdtA50((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ADT_A50.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toAdtA50((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ADT_A52.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toAdtA52((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ADT_A52.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toAdtA52((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ADT_A54.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toAdtA54((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ADT_A54.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toAdtA54((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ADT_A60.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toAdtA60((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ADT_A60.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toAdtA60((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ADT_A61.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toAdtA61((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ADT_A61.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toAdtA61((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ADT_AXX.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toAdtAXX((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ADT_AXX.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toAdtAXX((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.BAR_P01.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toBarP01((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.BAR_P01.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toBarP01((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.BAR_P02.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toBarP02((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.BAR_P02.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toBarP02((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.BAR_P05.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toBarP05((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.BAR_P05.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toBarP05((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.BAR_P06.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toBarP06((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.BAR_P06.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toBarP06((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.BAR_P10.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toBarP10((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.BAR_P10.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toBarP10((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.BAR_P12.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toBarP12((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.BAR_P12.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toBarP12((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.BPS_O29.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toBpsO29((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.BPS_O29.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toBpsO29((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.BRP_O30.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toBrpO30((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.BRP_O30.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toBrpO30((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.BRT_O32.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toBrtO32((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.BRT_O32.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toBrtO32((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.BTS_O31.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toBtsO31((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.BTS_O31.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toBtsO31((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.CRM_C01.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toCrmC01((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.CRM_C01.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toCrmC01((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.CSU_C09.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toCsuC09((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.CSU_C09.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toCsuC09((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.DFT_P03.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toDftP03((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.DFT_P03.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toDftP03((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.DFT_P11.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toDftP11((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.DFT_P11.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toDftP11((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.DOC_T12.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toDocT12((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.DOC_T12.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toDocT12((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.DSR_Q01.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toDsrQ01((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.DSR_Q01.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toDsrQ01((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.DSR_Q03.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toDsrQ03((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.DSR_Q03.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toDsrQ03((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.EAC_U07.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toEacU07((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.EAC_U07.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toEacU07((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.EAN_U09.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toEanU09((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.EAN_U09.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toEanU09((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.EAR_U08.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toEarU08((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.EAR_U08.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toEarU08((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.EDR_R07.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toEdrR07((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.EDR_R07.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toEdrR07((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.EQQ_Q04.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toEqqQ04((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.EQQ_Q04.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toEqqQ04((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ERP_R09.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toErpR09((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ERP_R09.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toErpR09((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ESR_U02.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toEsrU02((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ESR_U02.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toEsrU02((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ESU_U01.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toEsuU01((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ESU_U01.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toEsuU01((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.INR_U06.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toInrU06((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.INR_U06.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toInrU06((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.INU_U05.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toInuU05((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.INU_U05.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toInuU05((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.LSU_U12.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toLsuU12((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.LSU_U12.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toLsuU12((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.MDM_T01.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toMdmT01((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.MDM_T01.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toMdmT01((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.MDM_T02.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toMdmT02((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.MDM_T02.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toMdmT02((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.MFK_M01.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toMfkM01((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.MFK_M01.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toMfkM01((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.MFN_M01.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toMfnM01((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.MFN_M01.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toMfnM01((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.MFN_M02.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toMfnM02((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.MFN_M02.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toMfnM02((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.MFN_M03.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toMfnM03((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.MFN_M03.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toMfnM03((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.MFN_M04.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toMfnM04((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.MFN_M04.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toMfnM04((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.MFN_M05.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toMfnM05((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.MFN_M05.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toMfnM05((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.MFN_M06.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toMfnM06((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.MFN_M06.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toMfnM06((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.MFN_M07.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toMfnM07((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.MFN_M07.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toMfnM07((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.MFN_M08.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toMfnM08((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.MFN_M08.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toMfnM08((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.MFN_M09.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toMfnM09((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.MFN_M09.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toMfnM09((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.MFN_M10.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toMfnM10((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.MFN_M10.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toMfnM10((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.MFN_M11.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toMfnM11((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.MFN_M11.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toMfnM11((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.MFN_M12.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toMfnM12((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.MFN_M12.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toMfnM12((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.MFN_M13.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toMfnM13((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.MFN_M13.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toMfnM13((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.MFN_M15.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toMfnM15((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.MFN_M15.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toMfnM15((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.MFN_Znn.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toMfnZnn((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.MFN_Znn.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toMfnZnn((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.MFQ_M01.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toMfqM01((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.MFQ_M01.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toMfqM01((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.MFR_M01.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toMfrM01((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.MFR_M01.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toMfrM01((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.MFR_M04.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toMfrM04((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.MFR_M04.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toMfrM04((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.MFR_M05.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toMfrM05((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.MFR_M05.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toMfrM05((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.MFR_M06.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toMfrM06((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.MFR_M06.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toMfrM06((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.MFR_M07.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toMfrM07((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.MFR_M07.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toMfrM07((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.NMD_N02.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toNmdN02((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.NMD_N02.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toNmdN02((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.NMQ_N01.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toNmqN01((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.NMQ_N01.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toNmqN01((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.NMR_N01.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toNmrN01((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.NMR_N01.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toNmrN01((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.OMB_O27.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toOmbO27((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.OMB_O27.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toOmbO27((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.OMD_O03.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toOmdO03((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.OMD_O03.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toOmdO03((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.OMG_O19.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toOmgO19((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.OMG_O19.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toOmgO19((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.OMI_O23.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toOmiO23((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.OMI_O23.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toOmiO23((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.OML_O21.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toOmlO21((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.OML_O21.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toOmlO21((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.OML_O33.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toOmlO33((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.OML_O33.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toOmlO33((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.OML_O35.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toOmlO35((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.OML_O35.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toOmlO35((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.OMN_O07.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toOmnO07((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.OMN_O07.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toOmnO07((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.OMP_O09.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toOmpO09((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.OMP_O09.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toOmpO09((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.OMS_O05.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toOmsO05((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.OMS_O05.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toOmsO05((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ORB_O28.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toOrbO28((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ORB_O28.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toOrbO28((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ORD_O04.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toOrdO04((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ORD_O04.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toOrdO04((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ORF_R04.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toOrfR04((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ORF_R04.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toOrfR04((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ORG_O20.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toOrgO20((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ORG_O20.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toOrgO20((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ORI_O24.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toOriO24((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ORI_O24.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toOriO24((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ORL_O22.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toOrlO22((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ORL_O22.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toOrlO22((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ORL_O34.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toOrlO34((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ORL_O34.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toOrlO34((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ORL_O36.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toOrlO36((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ORL_O36.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toOrlO36((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ORM_O01.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toOrmO01((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ORM_O01.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toOrmO01((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ORN_O08.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toOrnO08((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ORN_O08.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toOrnO08((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ORP_O10.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toOrpO10((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ORP_O10.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toOrpO10((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ORR_O02.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toOrrO02((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ORR_O02.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toOrrO02((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ORS_O06.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toOrsO06((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ORS_O06.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toOrsO06((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ORU_R01.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toOruR01((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ORU_R01.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toOruR01((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ORU_R30.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toOruR30((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ORU_R30.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toOruR30((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.OSQ_Q06.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toOsqQ06((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.OSQ_Q06.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toOsqQ06((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.OSR_Q06.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toOsrQ06((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.OSR_Q06.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toOsrQ06((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.OUL_R21.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toOulR21((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.OUL_R21.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toOulR21((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.OUL_R22.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toOulR22((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.OUL_R22.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toOulR22((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.OUL_R23.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toOulR23((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.OUL_R23.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toOulR23((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.OUL_R24.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toOulR24((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.OUL_R24.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toOulR24((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.PEX_P07.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toPexP07((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.PEX_P07.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toPexP07((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.PGL_PC6.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toPglPc6((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.PGL_PC6.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toPglPc6((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.PMU_B01.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toPmuB01((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.PMU_B01.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toPmuB01((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.PMU_B03.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toPmuB03((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.PMU_B03.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toPmuB03((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.PMU_B04.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toPmuB04((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.PMU_B04.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toPmuB04((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.PMU_B07.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toPmuB07((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.PMU_B07.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toPmuB07((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.PMU_B08.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toPmuB08((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.PMU_B08.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toPmuB08((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.PPG_PCG.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toPpgPcg((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.PPG_PCG.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toPpgPcg((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.PPP_PCB.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toPppPcb((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.PPP_PCB.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toPppPcb((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.PPR_PC1.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toPprPc1((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.PPR_PC1.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toPprPc1((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.PPT_PCL.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toPptPcl((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.PPT_PCL.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toPptPcl((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.PPV_PCA.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toPpvPca((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.PPV_PCA.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toPpvPca((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.PRR_PC5.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toPrrPc5((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.PRR_PC5.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toPrrPc5((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.PTR_PCF.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toPtrPcf((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.PTR_PCF.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toPtrPcf((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.QBP_Q11.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toQbpQ11((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.QBP_Q11.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toQbpQ11((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.QBP_Q13.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toQbpQ13((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.QBP_Q13.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toQbpQ13((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.QBP_Q15.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toQbpQ15((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.QBP_Q15.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toQbpQ15((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.QBP_Q21.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toQbpQ21((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.QBP_Q21.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toQbpQ21((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.QBP_Qnn.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toQbpQnn((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.QBP_Qnn.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toQbpQnn((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.QBP_Z73.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toQbpZ73((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.QBP_Z73.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toQbpZ73((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.QCK_Q02.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toQckQ02((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.QCK_Q02.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toQckQ02((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.QCN_J01.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toQcnJ01((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.QCN_J01.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toQcnJ01((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.QRY.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toQry((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.QRY.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toQry((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.QRY_A19.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toQryA19((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.QRY_A19.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toQryA19((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.QRY_PC4.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toQryPC4((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.QRY_PC4.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toQryPC4((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.QRY_Q01.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toQryQ01((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.QRY_Q01.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toQryQ01((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.QRY_Q02.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toQryQ02((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.QRY_Q02.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toQryQ02((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.QRY_R02.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toQryR02((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.QRY_R02.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toQryR02((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.QSB_Q16.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toQsbQ16((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.QSB_Q16.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toQsbQ16((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.QVR_Q17.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toQvrQ17((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.QVR_Q17.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toQvrQ17((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RAR_RAR.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRarRar((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RAR_RAR.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRarRar((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RAS_O17.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRasO17((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RAS_O17.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRasO17((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RCI_I05.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRciI05((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RCI_I05.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRciI05((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RCL_I06.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRclI06((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RCL_I06.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRclI06((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RDE_O11.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRdeO11((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RDE_O11.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRdeO11((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RDS_O13.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRdsO13((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RDS_O13.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRdsO13((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RDY_K15.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRdyK15((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RDY_K15.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRdyK15((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.REF_I12.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRefI12((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.REF_I12.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRefI12((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RER_RER.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRerRer((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RER_RER.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRerRer((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RGR_RGR.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRgrRgr((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RGR_RGR.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRgrRgr((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RGV_O15.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRgvO15((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RGV_O15.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRgvO15((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ROR_ROR.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRorRor((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.ROR_ROR.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRorRor((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RPA_I08.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRpaI08((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RPA_I08.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRpaI08((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RPI_I01.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRpiI01((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RPI_I01.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRpiI01((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RPI_I04.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRpiI04((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RPI_I04.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRpiI04((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RPL_I02.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRplI02((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RPL_I02.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRplI02((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RPR_I03.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRprI03((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RPR_I03.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRprI03((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RQA_I08.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRqaI08((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RQA_I08.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRqaI08((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RQC_I05.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRqcI05((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RQC_I05.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRqcI05((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RQI_I01.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRqiI01((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RQI_I01.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRqiI01((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RQP_I04.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRqpI04((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RQP_I04.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRqpI04((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RQQ_Q09.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRqqQ09((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RQQ_Q09.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRqqQ09((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RRA_O18.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRraO18((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RRA_O18.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRraO18((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RRD_O14.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRrdO14((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RRD_O14.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRrdO14((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RRE_O12.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRreO12((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RRE_O12.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRreO12((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RRG_O16.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRrgO16((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RRG_O16.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRrgO16((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RRI_I12.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRriI12((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RRI_I12.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRriI12((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RSP_K11.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRspK11((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RSP_K11.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRspK11((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RSP_K21.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRspK21((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RSP_K21.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRspK21((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RSP_K23.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRspK23((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RSP_K23.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRspK23((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RSP_K25.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRspK25((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RSP_K25.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRspK25((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RSP_K31.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRspK31((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RSP_K31.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRspK31((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RSP_Q11.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRspQ11((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RSP_Q11.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRspQ11((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RSP_Z82.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRspZ82((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RSP_Z82.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRspZ82((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RSP_Z86.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRspZ86((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RSP_Z86.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRspZ86((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RSP_Z88.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRspZ88((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RSP_Z88.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRspZ88((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RSP_Z90.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRspZ90((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RSP_Z90.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRspZ90((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RTB_K13.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRtbK13((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RTB_K13.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRtbK13((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RTB_Knn.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRtbKnn((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RTB_Knn.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRtbKnn((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RTB_Z74.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRtbZ74((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.RTB_Z74.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toRtbZ74((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.SIU_S12.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toSiuS12((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.SIU_S12.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toSiuS12((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.SPQ_Q08.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toSpqQ08((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.SPQ_Q08.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toSpqQ08((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.SQM_S25.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toSqmS25((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.SQM_S25.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toSqmS25((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.SQR_S25.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toSqrS25((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.SQR_S25.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toSqrS25((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.SRM_S01.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toSrmS01((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.SRM_S01.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toSrmS01((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.SRR_S01.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toSrrS01((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.SRR_S01.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toSrrS01((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.SSR_U04.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toSsrU04((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.SSR_U04.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toSsrU04((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.SSU_U03.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toSsuU03((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.SSU_U03.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toSsuU03((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.SUR_P09.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toSurP09((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.SUR_P09.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toSurP09((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.TBR_R08.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toTbrR08((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.TBR_R08.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toTbrR08((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.TCU_U10.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toTcuU10((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.TCU_U10.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toTcuU10((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.UDM_Q05.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toUdmQ05((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.UDM_Q05.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toUdmQ05((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.VQQ_Q07.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toVqqQ07((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.VQQ_Q07.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toVqqQ07((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.VXQ_V01.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toVxqV01((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.VXQ_V01.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toVxqV01((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.VXR_V03.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toVxrV03((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.VXR_V03.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toVxrV03((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.VXU_V04.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toVxuV04((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.VXU_V04.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toVxuV04((java.lang.String) value); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.VXX_V02.class, byte[].class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.toVxxV02((byte[]) value, exchange); if (false && answer == null) { answer = Void.class; } return answer; }); addTypeConverter(registry, ca.uhn.hl7v2.model.v251.message.VXX_V02.class, java.lang.String.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7251Converter.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)); } }
HL7251ConverterLoader
java
elastic__elasticsearch
server/src/internalClusterTest/java/org/elasticsearch/cluster/routing/DelayedAllocationIT.java
{ "start": 920, "end": 7833 }
class ____ extends ESIntegTestCase { /** * Verifies that when there is no delay timeout, a 1/1 index shard will immediately * get allocated to a free node when the node hosting it leaves the cluster. */ public void testNoDelayedTimeout() throws Exception { internalCluster().startNodes(3); prepareCreate("test").setSettings(indexSettings(1, 1).put(UnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.getKey(), 0)) .get(); ensureGreen("test"); indexRandomData(); internalCluster().stopNode(findNodeWithShard()); assertThat(clusterAdmin().prepareHealth(TEST_REQUEST_TIMEOUT).get().getDelayedUnassignedShards(), equalTo(0)); ensureGreen("test"); } /** * When we do have delayed allocation set, verifies that even though there is a node * free to allocate the unassigned shard when the node hosting it leaves, it doesn't * get allocated. Once we bring the node back, it gets allocated since it existed * on it before. */ public void testDelayedAllocationNodeLeavesAndComesBack() throws Exception { internalCluster().startNodes(3); prepareCreate("test").setSettings( indexSettings(1, 1).put(UnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.getKey(), TimeValue.timeValueHours(1)) ).get(); ensureGreen("test"); indexRandomData(); String nodeWithShard = findNodeWithShard(); Settings nodeWithShardDataPathSettings = internalCluster().dataPathSettings(nodeWithShard); internalCluster().stopNode(nodeWithShard); assertBusy( () -> assertThat( clusterAdmin().prepareState(TEST_REQUEST_TIMEOUT).all().get().getState().getRoutingNodes().unassigned().size() > 0, equalTo(true) ) ); assertThat(clusterAdmin().prepareHealth(TEST_REQUEST_TIMEOUT).get().getDelayedUnassignedShards(), equalTo(1)); internalCluster().startNode(nodeWithShardDataPathSettings); // this will use the same data location as the stopped node ensureGreen("test"); } /** * With a very small delay timeout, verify that it expires and we get to green even * though the node hosting the shard is not coming back. */ public void testDelayedAllocationTimesOut() throws Exception { internalCluster().startNodes(3); prepareCreate("test").setSettings( indexSettings(1, 1).put(UnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.getKey(), TimeValue.timeValueMillis(100)) ).get(); ensureGreen("test"); indexRandomData(); internalCluster().stopNode(findNodeWithShard()); ensureGreen("test"); internalCluster().startNode(); // do a second round with longer delay to make sure it happens updateIndexSettings( Settings.builder().put(UnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.getKey(), TimeValue.timeValueMillis(100)), "test" ); internalCluster().stopNode(findNodeWithShard()); ensureGreen("test"); } /** * Verify that when explicitly changing the value of the index setting for the delayed * allocation to a very small value, it kicks the allocation of the unassigned shard * even though the node it was hosted on will not come back. */ public void testDelayedAllocationChangeWithSettingTo100ms() throws Exception { internalCluster().startNodes(3); prepareCreate("test").setSettings( indexSettings(1, 1).put(UnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.getKey(), TimeValue.timeValueHours(1)) ).get(); ensureGreen("test"); indexRandomData(); internalCluster().stopNode(findNodeWithShard()); assertBusy( () -> assertThat( clusterAdmin().prepareState(TEST_REQUEST_TIMEOUT).all().get().getState().getRoutingNodes().unassigned().size() > 0, equalTo(true) ) ); assertThat(clusterAdmin().prepareHealth(TEST_REQUEST_TIMEOUT).get().getDelayedUnassignedShards(), equalTo(1)); logger.info("Setting shorter allocation delay"); updateIndexSettings( Settings.builder().put(UnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.getKey(), TimeValue.timeValueMillis(100)), "test" ); ensureGreen("test"); assertThat(clusterAdmin().prepareHealth(TEST_REQUEST_TIMEOUT).get().getDelayedUnassignedShards(), equalTo(0)); } /** * Verify that when explicitly changing the value of the index setting for the delayed * allocation to 0, it kicks the allocation of the unassigned shard * even though the node it was hosted on will not come back. */ public void testDelayedAllocationChangeWithSettingTo0() throws Exception { internalCluster().startNodes(3); prepareCreate("test").setSettings( indexSettings(1, 1).put(UnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.getKey(), TimeValue.timeValueHours(1)) ).get(); ensureGreen("test"); indexRandomData(); internalCluster().stopNode(findNodeWithShard()); assertBusy( () -> assertThat( clusterAdmin().prepareState(TEST_REQUEST_TIMEOUT).all().get().getState().getRoutingNodes().unassigned().size() > 0, equalTo(true) ) ); assertThat(clusterAdmin().prepareHealth(TEST_REQUEST_TIMEOUT).get().getDelayedUnassignedShards(), equalTo(1)); updateIndexSettings( Settings.builder().put(UnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.getKey(), TimeValue.timeValueMillis(0)), "test" ); ensureGreen("test"); assertThat(clusterAdmin().prepareHealth(TEST_REQUEST_TIMEOUT).get().getDelayedUnassignedShards(), equalTo(0)); } private void indexRandomData() throws Exception { int numDocs = scaledRandomIntBetween(100, 1000); IndexRequestBuilder[] builders = new IndexRequestBuilder[numDocs]; for (int i = 0; i < builders.length; i++) { builders[i] = prepareIndex("test").setSource("field", "value"); } // we want to test both full divergent copies of the shard in terms of segments, and // a case where they are the same (using sync flush), index Random does all this goodness // already indexRandom(true, builders); } private String findNodeWithShard() { ClusterState state = clusterAdmin().prepareState(TEST_REQUEST_TIMEOUT).get().getState(); List<ShardRouting> startedShards = RoutingNodesHelper.shardsWithState(state.getRoutingNodes(), ShardRoutingState.STARTED); return state.nodes().get(randomFrom(startedShards).currentNodeId()).getName(); } }
DelayedAllocationIT
java
apache__camel
dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/ActiveMQ6EndpointBuilderFactory.java
{ "start": 309888, "end": 312747 }
interface ____ { /** * ActiveMQ 6.x (camel-activemq6) * Send messages to (or consume from) Apache ActiveMQ 6.x. This * component extends the Camel JMS component. * * Category: messaging * Since: 4.7 * Maven coordinates: org.apache.camel:camel-activemq6 * * @return the dsl builder for the headers' name. */ default ActiveMQ6HeaderNameBuilder activemq6() { return ActiveMQ6HeaderNameBuilder.INSTANCE; } /** * ActiveMQ 6.x (camel-activemq6) * Send messages to (or consume from) Apache ActiveMQ 6.x. This * component extends the Camel JMS component. * * Category: messaging * Since: 4.7 * Maven coordinates: org.apache.camel:camel-activemq6 * * Syntax: <code>activemq6:destinationType:destinationName</code> * * Path parameter: destinationType * The kind of destination to use * Default value: queue * There are 4 enums and the value can be one of: queue, topic, * temp-queue, temp-topic * * Path parameter: destinationName (required) * Name of the queue or topic to use as destination * * @param path destinationType:destinationName * @return the dsl builder */ default ActiveMQ6EndpointBuilder activemq6(String path) { return ActiveMQ6EndpointBuilderFactory.endpointBuilder("activemq6", path); } /** * ActiveMQ 6.x (camel-activemq6) * Send messages to (or consume from) Apache ActiveMQ 6.x. This * component extends the Camel JMS component. * * Category: messaging * Since: 4.7 * Maven coordinates: org.apache.camel:camel-activemq6 * * Syntax: <code>activemq6:destinationType:destinationName</code> * * Path parameter: destinationType * The kind of destination to use * Default value: queue * There are 4 enums and the value can be one of: queue, topic, * temp-queue, temp-topic * * Path parameter: destinationName (required) * Name of the queue or topic to use as destination * * @param componentName to use a custom component name for the endpoint * instead of the default name * @param path destinationType:destinationName * @return the dsl builder */ default ActiveMQ6EndpointBuilder activemq6(String componentName, String path) { return ActiveMQ6EndpointBuilderFactory.endpointBuilder(componentName, path); } } /** * The builder of headers' name for the ActiveMQ 6.x component. */ public static
ActiveMQ6Builders
java
google__error-prone
core/src/test/java/com/google/errorprone/bugpatterns/ObjectToStringTest.java
{ "start": 5846, "end": 6179 }
class ____ extends BugChecker implements ClassTreeMatcher { @Override public Description matchClass(ClassTree tree, VisitorState state) { var unused = state.getSymbolFromString(One.class.getName()); return Description.NO_MATCH; } } // don't complain if we can't load the type hierarchy of a
CompletionChecker
java
apache__camel
dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/JooqEndpointBuilderFactory.java
{ "start": 36621, "end": 38121 }
interface ____ { /** * JOOQ (camel-jooq) * Store and retrieve Java objects from an SQL database using JOOQ. * * Category: database * Since: 3.0 * Maven coordinates: org.apache.camel:camel-jooq * * Syntax: <code>jooq:entityType</code> * * Path parameter: entityType * JOOQ entity class * * @param path entityType * @return the dsl builder */ default JooqEndpointBuilder jooq(String path) { return JooqEndpointBuilderFactory.endpointBuilder("jooq", path); } /** * JOOQ (camel-jooq) * Store and retrieve Java objects from an SQL database using JOOQ. * * Category: database * Since: 3.0 * Maven coordinates: org.apache.camel:camel-jooq * * Syntax: <code>jooq:entityType</code> * * Path parameter: entityType * JOOQ entity class * * @param componentName to use a custom component name for the endpoint * instead of the default name * @param path entityType * @return the dsl builder */ default JooqEndpointBuilder jooq(String componentName, String path) { return JooqEndpointBuilderFactory.endpointBuilder(componentName, path); } } static JooqEndpointBuilder endpointBuilder(String componentName, String path) {
JooqBuilders
java
quarkusio__quarkus
test-framework/junit5-component/src/test/java/io/quarkus/test/component/MockConfiguratorTest.java
{ "start": 434, "end": 1195 }
class ____ { @RegisterExtension static final QuarkusComponentTestExtension extension = QuarkusComponentTestExtension.builder() .mock(Charlie.class).createMockitoMock(charlie -> { Mockito.when(charlie.pong()).thenReturn("bar"); }) .configProperty("foo", "BAR") .build(); @Inject MyComponent myComponent; @InjectMock Charlie charlie; @Test public void testComponent() { when(charlie.ping()).thenReturn("foo"); assertEquals("foo and BAR", myComponent.ping()); assertEquals("bar and BAR", myComponent.pong()); when(charlie.ping()).thenReturn("baz"); assertEquals("baz and BAR", myComponent.ping()); } }
MockConfiguratorTest
java
elastic__elasticsearch
x-pack/plugin/core/src/main/java/org/elasticsearch/license/TransportPostStartBasicAction.java
{ "start": 1011, "end": 2296 }
class ____ extends TransportMasterNodeAction<PostStartBasicRequest, PostStartBasicResponse> { private final MutableLicenseService licenseService; @Inject public TransportPostStartBasicAction( TransportService transportService, ClusterService clusterService, MutableLicenseService licenseService, ThreadPool threadPool, ActionFilters actionFilters ) { super( PostStartBasicAction.NAME, transportService, clusterService, threadPool, actionFilters, PostStartBasicRequest::new, PostStartBasicResponse::new, EsExecutors.DIRECT_EXECUTOR_SERVICE ); this.licenseService = licenseService; } @Override protected void masterOperation( Task task, PostStartBasicRequest request, ClusterState state, ActionListener<PostStartBasicResponse> listener ) throws Exception { licenseService.startBasicLicense(request, listener); } @Override protected ClusterBlockException checkBlock(PostStartBasicRequest request, ClusterState state) { return state.blocks().globalBlockedException(ClusterBlockLevel.METADATA_WRITE); } }
TransportPostStartBasicAction
java
apache__camel
core/camel-core/src/test/java/org/apache/camel/builder/RouteTemplateRedeliveryTest.java
{ "start": 1070, "end": 2395 }
class ____ extends ContextTestSupport { @Test public void testCreateRouteFromRouteTemplate() throws Exception { assertEquals(1, context.getRouteTemplateDefinitions().size()); Map<String, Object> parameters = new HashMap<>(); parameters.put("myCount", "3"); parameters.put("myFac", "1"); context.addRouteFromTemplate("first", "myTemplate", parameters); String out = template.requestBody("direct:start", "Hello World", String.class); assertEquals("3", out); } @Override protected RouteBuilder createRouteBuilder() { return new RouteBuilder() { @Override public void configure() { routeTemplate("myTemplate").templateParameter("myCount").templateParameter("myFac") .from("direct:start") .onException(Exception.class).maximumRedeliveryDelay(1).maximumRedeliveries("{{myCount}}") .collisionAvoidanceFactor("{{myFac}}").onRedelivery(e -> { e.getMessage().setBody(e.getMessage().getHeader(Exchange.REDELIVERY_COUNTER)); }).handled(true).end() .throwException(new IllegalArgumentException("Forced")); } }; } }
RouteTemplateRedeliveryTest
java
apache__flink
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/functions/aggfunctions/MinAggFunction.java
{ "start": 4579, "end": 4814 }
class ____ extends MinAggFunction { @Override public DataType getResultType() { return DataTypes.FLOAT(); } } /** Built-in Double Min aggregate function. */ public static
FloatMinAggFunction
java
apache__hadoop
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/conf/Configuration.java
{ "start": 136113, "end": 136276 }
class ____ is used as a sentinel value in the caching * for getClassByName. {@link Configuration#getClassByNameOrNull(String)} */ private static abstract
which
java
alibaba__nacos
api/src/test/java/com/alibaba/nacos/api/config/model/SameConfigPolicyTest.java
{ "start": 974, "end": 2700 }
class ____ { private ObjectMapper mapper; @BeforeEach void setUp() { mapper = new ObjectMapper(); mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); } @Test public void testSerialize() throws Exception { String abortJson = mapper.writeValueAsString(SameConfigPolicy.ABORT); String skipJson = mapper.writeValueAsString(SameConfigPolicy.SKIP); String overwriteJson = mapper.writeValueAsString(SameConfigPolicy.OVERWRITE); assertTrue(abortJson.contains("\"ABORT\"")); assertTrue(skipJson.contains("\"SKIP\"")); assertTrue(overwriteJson.contains("\"OVERWRITE\"")); } @Test public void testDeserialize() throws Exception { assertEquals(SameConfigPolicy.ABORT, mapper.readValue("\"ABORT\"", SameConfigPolicy.class)); assertEquals(SameConfigPolicy.SKIP, mapper.readValue("\"SKIP\"", SameConfigPolicy.class)); assertEquals(SameConfigPolicy.OVERWRITE, mapper.readValue("\"OVERWRITE\"", SameConfigPolicy.class)); } @Test public void testValues() { SameConfigPolicy[] values = SameConfigPolicy.values(); assertEquals(3, values.length); assertEquals(SameConfigPolicy.ABORT, values[0]); assertEquals(SameConfigPolicy.SKIP, values[1]); assertEquals(SameConfigPolicy.OVERWRITE, values[2]); } @Test public void testValueOf() { assertEquals(SameConfigPolicy.ABORT, SameConfigPolicy.valueOf("ABORT")); assertEquals(SameConfigPolicy.SKIP, SameConfigPolicy.valueOf("SKIP")); assertEquals(SameConfigPolicy.OVERWRITE, SameConfigPolicy.valueOf("OVERWRITE")); } }
SameConfigPolicyTest
java
hibernate__hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/package-info.java
{ "start": 172, "end": 270 }
class ____ {@link org.hibernate.processor.HibernateProcessor}. */ package org.hibernate.processor;
is
java
apache__camel
dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java
{ "start": 291367, "end": 298990 }
class ____ description for more information. * There are 14 enums and the value can be one of: ADDCOMMENT, ADDISSUE, * ATTACH, DELETEISSUE, NEWISSUES, NEWCOMMENTS, WATCHUPDATES, UPDATEISSUE, * TRANSITIONISSUE, WATCHERS, ADDISSUELINK, ADDWORKLOG, FETCHISSUE, * FETCHCOMMENTS * * @param componentName to use a custom component name for the endpoint * instead of the default name * @param path type * @return the dsl builder */ public static JiraEndpointBuilderFactory.JiraEndpointBuilder jira(String componentName, String path) { return JiraEndpointBuilderFactory.endpointBuilder(componentName, path); } /** * JMS (camel-jms) * Send and receive messages to/from JMS message brokers. * * Category: messaging * Since: 1.0 * Maven coordinates: org.apache.camel:camel-jms * * Syntax: <code>jms:destinationType:destinationName</code> * * Path parameter: destinationType * The kind of destination to use * Default value: queue * There are 4 enums and the value can be one of: queue, topic, temp-queue, * temp-topic * * Path parameter: destinationName (required) * Name of the queue or topic to use as destination * * @param path destinationType:destinationName * @return the dsl builder */ public static JmsEndpointBuilderFactory.JmsEndpointBuilder jms(String path) { return jms("jms", path); } /** * JMS (camel-jms) * Send and receive messages to/from JMS message brokers. * * Category: messaging * Since: 1.0 * Maven coordinates: org.apache.camel:camel-jms * * Syntax: <code>jms:destinationType:destinationName</code> * * Path parameter: destinationType * The kind of destination to use * Default value: queue * There are 4 enums and the value can be one of: queue, topic, temp-queue, * temp-topic * * Path parameter: destinationName (required) * Name of the queue or topic to use as destination * * @param componentName to use a custom component name for the endpoint * instead of the default name * @param path destinationType:destinationName * @return the dsl builder */ public static JmsEndpointBuilderFactory.JmsEndpointBuilder jms(String componentName, String path) { return JmsEndpointBuilderFactory.endpointBuilder(componentName, path); } /** * JMX (camel-jmx) * Receive JMX notifications. * * Category: monitoring * Since: 2.6 * Maven coordinates: org.apache.camel:camel-jmx * * Syntax: <code>jmx:serverURL</code> * * Path parameter: serverURL * Server url comes from the remaining endpoint. Use platform to connect to * local JVM. * * @param path serverURL * @return the dsl builder */ public static JMXEndpointBuilderFactory.JMXEndpointBuilder jmx(String path) { return jmx("jmx", path); } /** * JMX (camel-jmx) * Receive JMX notifications. * * Category: monitoring * Since: 2.6 * Maven coordinates: org.apache.camel:camel-jmx * * Syntax: <code>jmx:serverURL</code> * * Path parameter: serverURL * Server url comes from the remaining endpoint. Use platform to connect to * local JVM. * * @param componentName to use a custom component name for the endpoint * instead of the default name * @param path serverURL * @return the dsl builder */ public static JMXEndpointBuilderFactory.JMXEndpointBuilder jmx(String componentName, String path) { return JMXEndpointBuilderFactory.endpointBuilder(componentName, path); } /** * JOLT (camel-jolt) * JSON to JSON transformation using JOLT. * * Category: transformation * Since: 2.16 * Maven coordinates: org.apache.camel:camel-jolt * * Syntax: <code>jolt:resourceUri</code> * * Path parameter: resourceUri (required) * Path to the resource. You can prefix with: classpath, file, http, ref, or * bean. classpath, file and http loads the resource using these protocols * (classpath is default). ref will lookup the resource in the registry. * bean will call a method on a bean to be used as the resource. For bean * you can specify the method name after dot, eg bean:myBean.myMethod. * This option can also be loaded from an existing file, by prefixing with * file: or classpath: followed by the location of the file. * * @param path resourceUri * @return the dsl builder */ public static JoltEndpointBuilderFactory.JoltEndpointBuilder jolt(String path) { return jolt("jolt", path); } /** * JOLT (camel-jolt) * JSON to JSON transformation using JOLT. * * Category: transformation * Since: 2.16 * Maven coordinates: org.apache.camel:camel-jolt * * Syntax: <code>jolt:resourceUri</code> * * Path parameter: resourceUri (required) * Path to the resource. You can prefix with: classpath, file, http, ref, or * bean. classpath, file and http loads the resource using these protocols * (classpath is default). ref will lookup the resource in the registry. * bean will call a method on a bean to be used as the resource. For bean * you can specify the method name after dot, eg bean:myBean.myMethod. * This option can also be loaded from an existing file, by prefixing with * file: or classpath: followed by the location of the file. * * @param componentName to use a custom component name for the endpoint * instead of the default name * @param path resourceUri * @return the dsl builder */ public static JoltEndpointBuilderFactory.JoltEndpointBuilder jolt(String componentName, String path) { return JoltEndpointBuilderFactory.endpointBuilder(componentName, path); } /** * JOOQ (camel-jooq) * Store and retrieve Java objects from an SQL database using JOOQ. * * Category: database * Since: 3.0 * Maven coordinates: org.apache.camel:camel-jooq * * Syntax: <code>jooq:entityType</code> * * Path parameter: entityType * JOOQ entity class * * @param path entityType * @return the dsl builder */ public static JooqEndpointBuilderFactory.JooqEndpointBuilder jooq(String path) { return jooq("jooq", path); } /** * JOOQ (camel-jooq) * Store and retrieve Java objects from an SQL database using JOOQ. * * Category: database * Since: 3.0 * Maven coordinates: org.apache.camel:camel-jooq * * Syntax: <code>jooq:entityType</code> * * Path parameter: entityType * JOOQ entity class * * @param componentName to use a custom component name for the endpoint * instead of the default name * @param path entityType * @return the dsl builder */ public static JooqEndpointBuilderFactory.JooqEndpointBuilder jooq(String componentName, String path) { return JooqEndpointBuilderFactory.endpointBuilder(componentName, path); } /** * JPA (camel-jpa) * Store and retrieve Java objects from databases using Java Persistence API * (JPA). * * Category: database * Since: 1.0 * Maven coordinates: org.apache.camel:camel-jpa * * Syntax: <code>jpa:entityType</code> * * Path parameter: entityType (required) * Entity
javadoc
java
apache__flink
flink-runtime/src/test/java/org/apache/flink/runtime/executiongraph/InteractionsCountingTaskManagerGateway.java
{ "start": 1235, "end": 2949 }
class ____ extends SimpleAckingTaskManagerGateway { private final AtomicInteger cancelTaskCount = new AtomicInteger(0); private final AtomicInteger submitTaskCount = new AtomicInteger(0); private final CountDownLatch submitOrCancelLatch; public InteractionsCountingTaskManagerGateway() { submitOrCancelLatch = new CountDownLatch(0); } public InteractionsCountingTaskManagerGateway(final int expectedSubmitCount) { this.submitOrCancelLatch = new CountDownLatch(expectedSubmitCount); } @Override public CompletableFuture<Acknowledge> cancelTask( ExecutionAttemptID executionAttemptID, Duration timeout) { cancelTaskCount.incrementAndGet(); submitOrCancelLatch.countDown(); return CompletableFuture.completedFuture(Acknowledge.get()); } @Override public CompletableFuture<Acknowledge> submitTask( TaskDeploymentDescriptor tdd, Duration timeout) { submitTaskCount.incrementAndGet(); submitOrCancelLatch.countDown(); return CompletableFuture.completedFuture(Acknowledge.get()); } void resetCounts() { cancelTaskCount.set(0); submitTaskCount.set(0); } int getCancelTaskCount() { return cancelTaskCount.get(); } int getSubmitTaskCount() { return submitTaskCount.get(); } int getInteractionsCount() { return cancelTaskCount.get() + submitTaskCount.get(); } void waitUntilAllTasksAreSubmitted() { try { submitOrCancelLatch.await(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } }
InteractionsCountingTaskManagerGateway
java
hibernate__hibernate-orm
hibernate-core/src/test/java/org/hibernate/orm/test/any/discriminator/many/Loan.java
{ "start": 1020, "end": 2097 }
class ____ { @Id private Integer id; @Basic private String name; //tag::associations-many-to-any-example[] @ManyToAny @AnyDiscriminator(DiscriminatorType.STRING) @Column(name = "payment_type") @AnyKeyJavaClass(Integer.class) @AnyDiscriminatorValue( discriminator = "CARD", entity = CardPayment.class ) @AnyDiscriminatorValue( discriminator = "CHECK", entity = CheckPayment.class ) @AnyDiscriminatorImplicitValues(SHORT_NAME) @JoinTable(name = "loan_payments", joinColumns = @JoinColumn(name = "loan_fk"), inverseJoinColumns = @JoinColumn(name = "payment_fk") ) private Set<Payment> payments; //end::associations-many-to-any-example[] protected Loan() { // for Hibernate use } public Loan(Integer id, String name) { this.id = id; this.name = name; } public Integer getId() { return id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Set<Payment> getPayments() { return payments; } public void setPayments(Set<Payment> payments) { this.payments = payments; } }
Loan
java
FasterXML__jackson-core
src/test/java/tools/jackson/core/unittest/json/TestDecorators.java
{ "start": 882, "end": 1805 }
class ____ extends InputDecorator { @Override public InputStream decorate(IOContext ctxt, InputStream in) throws JacksonException { try { return new ByteArrayInputStream("123".getBytes("UTF-8")); } catch (IOException e) { throw JacksonIOException.construct(e, null); } } @Override public InputStream decorate(IOContext ctxt, byte[] src, int offset, int length) throws JacksonException { try { return new ByteArrayInputStream("456".getBytes("UTF-8")); } catch (IOException e) { throw JacksonIOException.construct(e, null); } } @Override public Reader decorate(IOContext ctxt, Reader src) { return new StringReader("789"); } } static
SimpleInputDecorator
java
apache__camel
components/camel-aws/camel-aws2-sqs/src/test/java/org/apache/camel/component/aws2/sqs/integration/SqsDeadletterWithClientRegistryLocalstackIT.java
{ "start": 1300, "end": 2886 }
class ____ extends Aws2SQSBaseTest { @EndpointInject("direct:start") private ProducerTemplate template; @EndpointInject("mock:result") private MockEndpoint result; @Override protected CamelContext createCamelContext() throws Exception { CamelContext ctx = super.createCamelContextWithoutClient(); ctx.getRegistry().bind("awsSQSClient", AWSSDKClientUtils.newSQSClient()); return ctx; } @Test public void deadletter() throws Exception { result.expectedMessageCount(1); template.send("direct:start", ExchangePattern.InOnly, new Processor() { public void process(Exchange exchange) { exchange.getIn().setBody("test1"); } }); MockEndpoint.assertIsSatisfied(context); } @Override protected RouteBuilder createRouteBuilder() { return new RouteBuilder() { @Override public void configure() { String deadletterName = sharedNameGenerator.getName() + "_deadletter"; errorHandler(deadLetterChannel(String.format("aws2-sqs://%s?autoCreateQueue=true", deadletterName)) .useOriginalMessage()); from("direct:start").startupOrder(2).process(e -> { throw new IllegalStateException(); }).toF("aws2-sqs://%s?autoCreateQueue=true", sharedNameGenerator.getName()); fromF("aws2-sqs://%s", deadletterName).to("mock:result"); } }; } }
SqsDeadletterWithClientRegistryLocalstackIT
java
eclipse-vertx__vert.x
vertx-core/src/main/java/io/vertx/core/streams/Pipe.java
{ "start": 1580, "end": 1939 }
class ____ be used to pipe from any {@link ReadStream} to any {@link WriteStream}, * e.g. from an {@link io.vertx.core.http.HttpServerRequest} to an {@link io.vertx.core.file.AsyncFile}, * or from {@link io.vertx.core.net.NetSocket} to a {@link io.vertx.core.http.WebSocket}. * <p> * Please see the documentation for more information. */ @VertxGen public
can
java
micronaut-projects__micronaut-core
core/src/main/java/io/micronaut/core/annotation/AnnotationClassValue.java
{ "start": 2620, "end": 3251 }
class ____ for a type that is present. * * @param instance The instance * @since 1.1 */ @SuppressWarnings("unchecked") @UsedByGeneratedCode public AnnotationClassValue(@NonNull T instance) { ArgumentUtils.requireNonNull("instance", instance); this.theClass = (Class<T>) instance.getClass(); this.name = theClass.getName(); this.instance = instance; this.instantiated = !(instance instanceof AnnotationClassValue.UnresolvedClass); } /** * Returns the backing instance if there is one. Note this method will * not attempt to instantiate the
value
java
apache__flink
flink-core/src/main/java/org/apache/flink/types/parser/ByteValueParser.java
{ "start": 1079, "end": 3060 }
class ____ extends FieldParser<ByteValue> { private ByteValue result; @Override public int parseField( byte[] bytes, int startPos, int limit, byte[] delimiter, ByteValue reusable) { if (startPos == limit) { setErrorState(ParseErrorState.EMPTY_COLUMN); return -1; } int val = 0; boolean neg = false; this.result = reusable; final int delimLimit = limit - delimiter.length + 1; if (bytes[startPos] == '-') { neg = true; startPos++; // check for empty field with only the sign if (startPos == limit || (startPos < delimLimit && delimiterNext(bytes, startPos, delimiter))) { setErrorState(ParseErrorState.NUMERIC_VALUE_ORPHAN_SIGN); return -1; } } for (int i = startPos; i < limit; i++) { if (i < delimLimit && delimiterNext(bytes, i, delimiter)) { if (i == startPos) { setErrorState(ParseErrorState.EMPTY_COLUMN); return -1; } reusable.setValue((byte) (neg ? -val : val)); return i + delimiter.length; } if (bytes[i] < 48 || bytes[i] > 57) { setErrorState(ParseErrorState.NUMERIC_VALUE_ILLEGAL_CHARACTER); return -1; } val *= 10; val += bytes[i] - 48; if (val > Byte.MAX_VALUE && (!neg || val > -Byte.MIN_VALUE)) { setErrorState(ParseErrorState.NUMERIC_VALUE_OVERFLOW_UNDERFLOW); return -1; } } reusable.setValue((byte) (neg ? -val : val)); return limit; } @Override public ByteValue createValue() { return new ByteValue(); } @Override public ByteValue getLastResult() { return this.result; } }
ByteValueParser
java
assertj__assertj-core
assertj-core/src/main/java/org/assertj/core/error/ShouldHaveAtIndex.java
{ "start": 976, "end": 2023 }
class ____ extends BasicErrorMessageFactory { /** * Creates a new <code>{@link ShouldHaveAtIndex}</code>. * @param <T> guarantees that the type of the actual value and the generic type of the {@code Condition} are the same. * @param actual the actual value in the failed assertion. * @param condition the {@code Condition}. * @param index the index of the expected value. * @param found the value in {@code actual} stored under {@code index}. * @return the created {@code ErrorMessageFactory}. */ public static <T> ErrorMessageFactory shouldHaveAtIndex(List<? extends T> actual, Condition<? super T> condition, Index index, T found) { return new ShouldHaveAtIndex(actual, condition, index, found); } private <T> ShouldHaveAtIndex(List<? extends T> actual, Condition<? super T> condition, Index index, T found) { super("%nExpecting actual:%n %s%nat index %s to have:%n %s%nin:%n %s%n", found, index.value, condition, actual); } }
ShouldHaveAtIndex
java
netty__netty
transport-native-kqueue/src/test/java/io/netty/channel/kqueue/KQueueSocketCloseForciblyTest.java
{ "start": 908, "end": 1170 }
class ____ extends SocketCloseForciblyTest { @Override protected List<TestsuitePermutation.BootstrapComboFactory<ServerBootstrap, Bootstrap>> newFactories() { return KQueueSocketTestPermutation.INSTANCE.socket(); } }
KQueueSocketCloseForciblyTest
java
grpc__grpc-java
alts/src/main/java/io/grpc/alts/AltsChannelCredentials.java
{ "start": 1581, "end": 1993 }
class ____ { private static final Logger logger = Logger.getLogger(AltsChannelCredentials.class.getName()); private AltsChannelCredentials() {} public static ChannelCredentials create() { return newBuilder().build(); } public static Builder newBuilder() { return new Builder(); } @ExperimentalApi("https://github.com/grpc/grpc-java/issues/4151") public static final
AltsChannelCredentials
java
apache__logging-log4j2
log4j-core-test/src/test/java/org/apache/logging/log4j/core/appender/db/jdbc/AbstractJdbcAppenderFactoryMethodTest.java
{ "start": 1751, "end": 6679 }
class ____ { @Rule public final RuleChain rules; private final JdbcRule jdbcRule; protected AbstractJdbcAppenderFactoryMethodTest(final JdbcRule jdbcRule, final String databaseType) { this.rules = RuleChain.emptyRuleChain() .around(jdbcRule) .around(new LoggerContextRule("org/apache/logging/log4j/core/appender/db/jdbc/log4j2-" + databaseType + "-factory-method.xml")); this.jdbcRule = jdbcRule; } @Test public void testFactoryMethodConfig() throws Exception { try (final Connection connection = jdbcRule.getConnectionSource().getConnection()) { final SQLException exception = new SQLException("Some other error message!"); final ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); try (final PrintWriter writer = new PrintWriter(outputStream)) { exception.printStackTrace(writer); } final String stackTrace = outputStream.toString(); final long millis = System.currentTimeMillis(); ThreadContext.put("some_int", "42"); final Logger logger = LogManager.getLogger(this.getClass().getName() + ".testFactoryMethodConfig"); logger.debug("Factory logged message 01."); logger.error("Error from factory 02.", exception); try (final Statement statement = connection.createStatement(); final ResultSet resultSet = statement.executeQuery("SELECT * FROM fmLogEntry ORDER BY id")) { assertTrue("There should be at least one row.", resultSet.next()); long date = resultSet.getTimestamp("eventDate").getTime(); long anotherDate = resultSet.getTimestamp("anotherDate").getTime(); assertEquals(date, anotherDate); assertTrue("The date should be later than pre-logging (1).", date >= millis); assertTrue("The date should be earlier than now (1).", date <= System.currentTimeMillis()); assertEquals( "The literal column is not correct (1).", "Some Other Literal Value", resultSet.getString("literalColumn")); assertEquals("The level column is not correct (1).", "DEBUG", resultSet.getNString("level")); assertEquals("The logger column is not correct (1).", logger.getName(), resultSet.getNString("logger")); assertEquals( "The message column is not correct (1).", "Factory logged message 01.", resultSet.getString("message")); assertEquals( "The exception column is not correct (1).", Strings.EMPTY, IOUtils.readStringAndClose( resultSet.getNClob("exception").getCharacterStream(), -1)); assertTrue("There should be two rows.", resultSet.next()); date = resultSet.getTimestamp("eventDate").getTime(); anotherDate = resultSet.getTimestamp("anotherDate").getTime(); assertEquals(date, anotherDate); assertTrue("The date should be later than pre-logging (2).", date >= millis); assertTrue("The date should be earlier than now (2).", date <= System.currentTimeMillis()); assertEquals( "The literal column is not correct (2).", "Some Other Literal Value", resultSet.getString("literalColumn")); assertEquals("The level column is not correct (2).", "ERROR", resultSet.getNString("level")); assertEquals("The logger column is not correct (2).", logger.getName(), resultSet.getNString("logger")); assertEquals( "The message column is not correct (2).", "Error from factory 02.", resultSet.getString("message")); assertEquals( "The exception column is not correct (2).", stackTrace, IOUtils.readStringAndClose( resultSet.getNClob("exception").getCharacterStream(), -1)); assertFalse("There should not be three rows.", resultSet.next()); } } } @Test public void testTruncate() { final Logger logger = LogManager.getLogger(this.getClass().getName() + ".testFactoryMethodConfig"); // Some drivers and database will not allow more data than the column defines. // We really need a MySQL databases with a default configuration to test this. logger.debug(StringUtils.repeat('A', 1000)); } }
AbstractJdbcAppenderFactoryMethodTest
java
apache__flink
flink-runtime/src/main/java/org/apache/flink/runtime/io/disk/iomanager/AbstractFileIOChannel.java
{ "start": 1100, "end": 3731 }
class ____ implements FileIOChannel { /** Logger object for channel and its subclasses */ protected static final Logger LOG = LoggerFactory.getLogger(FileIOChannel.class); /** The ID of the underlying channel. */ protected final FileIOChannel.ID id; /** A file channel for NIO access to the file. */ protected final FileChannel fileChannel; /** * Creates a new channel to the path indicated by the given ID. The channel hands IO requests to * the given request queue to be processed. * * @param channelID The id describing the path of the file that the channel accessed. * @param writeEnabled Flag describing whether the channel should be opened in read/write mode, * rather than in read-only mode. * @throws IOException Thrown, if the channel could no be opened. */ protected AbstractFileIOChannel(FileIOChannel.ID channelID, boolean writeEnabled) throws IOException { this.id = Preconditions.checkNotNull(channelID); try { @SuppressWarnings("resource") RandomAccessFile file = new RandomAccessFile(id.getPath(), writeEnabled ? "rw" : "r"); this.fileChannel = file.getChannel(); } catch (IOException e) { throw new IOException( "Channel to path '" + channelID.getPath() + "' could not be opened.", e); } } // -------------------------------------------------------------------------------------------- @Override public final FileIOChannel.ID getChannelID() { return this.id; } @Override public long getSize() throws IOException { FileChannel channel = fileChannel; return channel == null ? 0 : channel.size(); } @Override public abstract boolean isClosed(); @Override public abstract void close() throws IOException; @Override public void deleteChannel() { if (!isClosed() || this.fileChannel.isOpen()) { throw new IllegalStateException("Cannot delete a channel that is open."); } // make a best effort to delete the file. Don't report exceptions. try { File f = new File(this.id.getPath()); if (f.exists()) { f.delete(); } } catch (Throwable t) { } } @Override public void closeAndDelete() throws IOException { try { close(); } finally { deleteChannel(); } } @Override public FileChannel getNioFileChannel() { return fileChannel; } }
AbstractFileIOChannel
java
apache__spark
common/kvstore/src/main/java/org/apache/spark/util/kvstore/ArrayWrappers.java
{ "start": 3083, "end": 4021 }
class ____ implements Comparable<ComparableLongArray> { private final long[] array; ComparableLongArray(long[] array) { this.array = array; } @Override public boolean equals(Object other) { if (!(other instanceof ComparableLongArray comparableLongArray)) { return false; } return Arrays.equals(array, comparableLongArray.array); } @Override public int hashCode() { int code = 0; for (long l : array) { code = (code * 31) + (int) l; } return code; } @Override public int compareTo(ComparableLongArray other) { int len = Math.min(array.length, other.array.length); for (int i = 0; i < len; i++) { long diff = array[i] - other.array[i]; if (diff != 0) { return diff > 0 ? 1 : -1; } } return array.length - other.array.length; } } private static
ComparableLongArray
java
spring-projects__spring-framework
spring-test/src/test/java/org/springframework/test/context/support/TestPropertySourceUtilsTests.java
{ "start": 14705, "end": 14858 }
class ____ { @TestPropertySource(locations = { "/foo1.xml", "/foo2.xml" }, properties = { "k1a=v1a", "k1b: v1b" })
LocationsAndPropertiesPropertySources
java
spring-projects__spring-framework
spring-core/src/main/java/org/springframework/cglib/core/DefaultNamingPolicy.java
{ "start": 1197, "end": 2281 }
class ____ implements NamingPolicy { public static final DefaultNamingPolicy INSTANCE = new DefaultNamingPolicy(); /** * This allows to test collisions of {@code key.hashCode()}. */ private static final boolean STRESS_HASH_CODE = Boolean.getBoolean("org.springframework.cglib.test.stressHashCodes"); @Override public String getClassName(String prefix, String source, Object key, Predicate names) { if (prefix == null) { prefix = "org.springframework.cglib.empty.Object"; } else if (prefix.startsWith("java")) { prefix = "$" + prefix; } String base = prefix + "$$" + source.substring(source.lastIndexOf('.') + 1) + getTag() + "$$" + Integer.toHexString(STRESS_HASH_CODE ? 0 : key.hashCode()); String attempt = base; int index = 2; while (names.evaluate(attempt)) { attempt = base + "_" + index++; } return attempt; } /** * Returns a string which is incorporated into every generated
DefaultNamingPolicy
java
spring-projects__spring-framework
spring-messaging/src/test/java/org/springframework/messaging/simp/broker/OrderedMessageChannelDecoratorTests.java
{ "start": 3278, "end": 4432 }
class ____ implements MessageHandler { private final AtomicInteger index; private final int end; private final AtomicReference<Object> result = new AtomicReference<>(); private final CountDownLatch latch = new CountDownLatch(1); TestHandler(int start, int end) { this.index = new AtomicInteger(start); this.end = end; } @Override public void handleMessage(Message<?> message) throws MessagingException { int expected = index.getAndIncrement(); Integer actual = (Integer) message.getHeaders().getOrDefault("seq", -1); if (actual != expected) { result.set("Expected: " + expected + ", but was: " + actual); latch.countDown(); return; } // Force messages to queue up periodically if (actual % 101 == 0) { try { Thread.sleep(50); } catch (InterruptedException ex) { result.set(ex.toString()); latch.countDown(); } } if (actual == end) { result.set("Done"); latch.countDown(); } } void verify() throws InterruptedException { assertThat(latch.await(5, TimeUnit.SECONDS)).isTrue(); assertThat(result.get()).isEqualTo("Done"); } } }
TestHandler
java
spring-projects__spring-boot
buildSrc/src/main/java/org/springframework/boot/build/artifacts/ArtifactRelease.java
{ "start": 864, "end": 1660 }
class ____ { private static final String SPRING_SNAPSHOT_REPO = "https://repo.spring.io/snapshot"; private static final String MAVEN_REPO = "https://repo.maven.apache.org/maven2"; private final Type type; private ArtifactRelease(Type type) { this.type = type; } public String getType() { return this.type.toString().toLowerCase(Locale.ROOT); } public String getDownloadRepo() { return (this.type == Type.SNAPSHOT) ? SPRING_SNAPSHOT_REPO : MAVEN_REPO; } public boolean isRelease() { return this.type == Type.RELEASE; } public static ArtifactRelease forProject(Project project) { return forVersion(project.getVersion().toString()); } public static ArtifactRelease forVersion(String version) { return new ArtifactRelease(Type.forVersion(version)); }
ArtifactRelease
java
apache__flink
flink-filesystems/flink-s3-fs-base/src/test/java/org/apache/flink/fs/s3/common/writer/S3RecoverableFsDataOutputStreamTest.java
{ "start": 2132, "end": 12492 }
class ____ { private static final long USER_DEFINED_MIN_PART_SIZE = 10L; private TestMultipartUpload multipartUploadUnderTest; private TestFileProvider fileProvider; private S3RecoverableFsDataOutputStream streamUnderTest; @TempDir static File tempFolder; @BeforeEach void beforeTest() throws IOException { fileProvider = new TestFileProvider(tempFolder); multipartUploadUnderTest = new TestMultipartUpload(fileProvider); RefCountedBufferingFileStream fileStream = RefCountedBufferingFileStream.openNew(fileProvider); streamUnderTest = new S3RecoverableFsDataOutputStream( multipartUploadUnderTest, fileProvider, fileStream, USER_DEFINED_MIN_PART_SIZE, 0L); } @Test void simpleUsage() throws IOException { streamUnderTest.write(bytesOf("hello world")); RecoverableFsDataOutputStream.Committer committer = streamUnderTest.closeForCommit(); committer.commit(); assertThat(multipartUploadUnderTest.getPublishedContents()) .isEqualTo(bytesOf("hello world")); } @Test void noWritesShouldResolveInAnEmptyFile() throws IOException { RecoverableFsDataOutputStream.Committer committer = streamUnderTest.closeForCommit(); committer.commit(); assertThat(multipartUploadUnderTest.getPublishedContents()).isEqualTo(new byte[0]); } @Test void closingWithoutCommittingDiscardsTheData() throws IOException { streamUnderTest.write(bytesOf("hello world")); streamUnderTest.close(); assertThat(multipartUploadUnderTest.getPublishedContents()).isEqualTo(bytesOf("")); } @Test void twoWritesAreConcatenated() throws IOException { streamUnderTest.write(bytesOf("hello")); streamUnderTest.write(bytesOf(" ")); streamUnderTest.write(bytesOf("world")); streamUnderTest.closeForCommit().commit(); assertThat(multipartUploadUnderTest.getPublishedContents()) .isEqualTo(bytesOf("hello world")); } @Test void writeLargeFile() throws IOException { List<byte[]> testDataBuffers = createRandomLargeTestDataBuffers(); for (byte[] buffer : testDataBuffers) { streamUnderTest.write(buffer); } streamUnderTest.closeForCommit().commit(); assertThatHasContent(multipartUploadUnderTest, testDataBuffers); } @Test void simpleRecovery() throws IOException { streamUnderTest.write(bytesOf("hello")); streamUnderTest.persist(); streamUnderTest = reopenStreamUnderTestAfterRecovery(); streamUnderTest.closeForCommit().commit(); assertThat(multipartUploadUnderTest.getPublishedContents()).isEqualTo(bytesOf("hello")); } @Test void multiplePersistsDoesNotIntroduceJunk() throws IOException { streamUnderTest.write(bytesOf("hello")); streamUnderTest.persist(); streamUnderTest.persist(); streamUnderTest.persist(); streamUnderTest.persist(); streamUnderTest.write(bytesOf(" ")); streamUnderTest.write(bytesOf("world")); streamUnderTest.closeForCommit().commit(); assertThat(multipartUploadUnderTest.getPublishedContents()) .isEqualTo(bytesOf("hello world")); } @Test void multipleWritesAndPersists() throws IOException { streamUnderTest.write(bytesOf("a")); streamUnderTest.persist(); streamUnderTest.write(bytesOf("b")); streamUnderTest.persist(); streamUnderTest.write(bytesOf("c")); streamUnderTest.persist(); streamUnderTest.write(bytesOf("d")); streamUnderTest.persist(); streamUnderTest.write(bytesOf("e")); streamUnderTest.closeForCommit().commit(); assertThat(multipartUploadUnderTest.getPublishedContents()).isEqualTo(bytesOf("abcde")); } @Test void multipleWritesAndPersistsWithBigChunks() throws IOException { List<byte[]> testDataBuffers = createRandomLargeTestDataBuffers(); for (byte[] buffer : testDataBuffers) { streamUnderTest.write(buffer); streamUnderTest.persist(); } streamUnderTest.closeForCommit().commit(); assertThatHasContent(multipartUploadUnderTest, testDataBuffers); } @Test void addDataAfterRecovery() throws IOException { streamUnderTest.write(bytesOf("hello")); streamUnderTest.persist(); streamUnderTest = reopenStreamUnderTestAfterRecovery(); streamUnderTest.write(bytesOf(" ")); streamUnderTest.write(bytesOf("world")); streamUnderTest.closeForCommit().commit(); assertThat(multipartUploadUnderTest.getPublishedContents()) .isEqualTo(bytesOf("hello world")); } @Test void discardingUnpersistedNotYetUploadedData() throws IOException { streamUnderTest.write(bytesOf("hello")); streamUnderTest.persist(); streamUnderTest.write(bytesOf("goodbye")); streamUnderTest = reopenStreamUnderTestAfterRecovery(); streamUnderTest.write(bytesOf(" world")); streamUnderTest.closeForCommit().commit(); assertThat(multipartUploadUnderTest.getPublishedContents()) .isEqualTo(bytesOf("hello world")); } @Test void discardingUnpersistedUploadedData() throws IOException { streamUnderTest.write(bytesOf("hello")); streamUnderTest.persist(); streamUnderTest.write(randomBuffer(RefCountedBufferingFileStream.BUFFER_SIZE + 1)); streamUnderTest = reopenStreamUnderTestAfterRecovery(); streamUnderTest.write(bytesOf(" world")); streamUnderTest.closeForCommit().commit(); assertThat(multipartUploadUnderTest.getPublishedContents()) .isEqualTo(bytesOf("hello world")); } @Test void commitEmptyStreamShouldBeSuccessful() throws IOException { streamUnderTest.closeForCommit().commit(); } @Test void closeForCommitOnClosedStreamShouldFail() throws IOException { streamUnderTest.closeForCommit().commit(); assertThatThrownBy(() -> streamUnderTest.closeForCommit().commit()) .isInstanceOf(IOException.class); } @Test void testSync() throws IOException { streamUnderTest.write(bytesOf("hello")); streamUnderTest.sync(); assertThat(multipartUploadUnderTest.getPublishedContents()).isEqualTo(bytesOf("hello")); streamUnderTest.write(bytesOf(" world")); streamUnderTest.sync(); assertThat(multipartUploadUnderTest.getPublishedContents()) .isEqualTo(bytesOf("hello world")); } // ------------------------------------------------------------------------------------------------------------ // Utils // ------------------------------------------------------------------------------------------------------------ private S3RecoverableFsDataOutputStream reopenStreamUnderTestAfterRecovery() throws IOException { final long bytesBeforeCurrentPart = multipartUploadUnderTest.numBytes; final Optional<File> incompletePart = multipartUploadUnderTest.getIncompletePart(); RefCountedBufferingFileStream fileStream = RefCountedBufferingFileStream.restore(fileProvider, incompletePart.get()); multipartUploadUnderTest.discardUnpersistedData(); return new S3RecoverableFsDataOutputStream( multipartUploadUnderTest, fileProvider, fileStream, USER_DEFINED_MIN_PART_SIZE, bytesBeforeCurrentPart); } private static List<byte[]> createRandomLargeTestDataBuffers() { final List<byte[]> testData = new ArrayList<>(); final SplittableRandom random = new SplittableRandom(); long totalSize = 0L; int expectedSize = (int) random.nextLong( USER_DEFINED_MIN_PART_SIZE * 5L, USER_DEFINED_MIN_PART_SIZE * 100L); while (totalSize < expectedSize) { int len = random.nextInt(0, (int) (2L * USER_DEFINED_MIN_PART_SIZE)); byte[] buffer = randomBuffer(random, len); totalSize += buffer.length; testData.add(buffer); } return testData; } private static byte[] randomBuffer(int len) { final SplittableRandom random = new SplittableRandom(); return randomBuffer(random, len); } private static byte[] randomBuffer(SplittableRandom random, int len) { byte[] buffer = new byte[len]; for (int i = 0; i < buffer.length; i++) { buffer[i] = (byte) (random.nextInt() & 0xFF); } return buffer; } private static byte[] bytesOf(String str) { return str.getBytes(StandardCharsets.UTF_8); } private static byte[] readFileContents(RefCountedFSOutputStream file) throws IOException { final byte[] content = new byte[MathUtils.checkedDownCast(file.getPos())]; File inputFile = file.getInputFile(); long bytesRead = new FileInputStream(inputFile) .read(content, 0, MathUtils.checkedDownCast(inputFile.length())); assertThat(bytesRead).isEqualTo(file.getPos()); return content; } private static void assertThatHasContent( TestMultipartUpload testMultipartUpload, Collection<byte[]> expectedContents) throws IOException { ByteArrayOutputStream stream = new ByteArrayOutputStream(); for (byte[] c : expectedContents) { stream.write(c); } byte[] expectedContent = stream.toByteArray(); assertThat(testMultipartUpload.getPublishedContents()).isEqualTo(expectedContent); } // ------------------------------------------------------------------------------------------------------------ // Test Classes // ------------------------------------------------------------------------------------------------------------ private static
S3RecoverableFsDataOutputStreamTest
java
quarkusio__quarkus
extensions/redis-client/runtime/src/main/java/io/quarkus/redis/runtime/datasource/BlockingStreamCommandsImpl.java
{ "start": 1036, "end": 7912 }
class ____<K, F, V> extends AbstractRedisCommandGroup implements StreamCommands<K, F, V> { private final ReactiveStreamCommands<K, F, V> reactive; public BlockingStreamCommandsImpl(RedisDataSource ds, ReactiveStreamCommands<K, F, V> reactive, Duration timeout) { super(ds, timeout); this.reactive = reactive; } @Override public int xack(K key, String group, String... ids) { return reactive.xack(key, group, ids).await().atMost(timeout); } @Override public String xadd(K key, Map<F, V> payload) { return reactive.xadd(key, payload).await().atMost(timeout); } @Override public String xadd(K key, XAddArgs args, Map<F, V> payload) { return reactive.xadd(key, args, payload).await().atMost(timeout); } @Override public ClaimedMessages<K, F, V> xautoclaim(K key, String group, String consumer, Duration minIdleTime, String start, int count) { return reactive.xautoclaim(key, group, consumer, minIdleTime, start, count).await().atMost(timeout); } @Override public ClaimedMessages<K, F, V> xautoclaim(K key, String group, String consumer, Duration minIdleTime, String start) { return reactive.xautoclaim(key, group, consumer, minIdleTime, start).await().atMost(timeout); } @Override public ClaimedMessages<K, F, V> xautoclaim(K key, String group, String consumer, Duration minIdleTime, String start, int count, boolean justId) { return reactive.xautoclaim(key, group, consumer, minIdleTime, start, count, justId).await().atMost(timeout); } @Override public List<StreamMessage<K, F, V>> xclaim(K key, String group, String consumer, Duration minIdleTime, String... id) { return reactive.xclaim(key, group, consumer, minIdleTime, id).await().atMost(timeout); } @Override public List<StreamMessage<K, F, V>> xclaim(K key, String group, String consumer, Duration minIdleTime, XClaimArgs args, String... id) { return reactive.xclaim(key, group, consumer, minIdleTime, args, id).await().atMost(timeout); } @Override public int xdel(K key, String... id) { return reactive.xdel(key, id).await().atMost(timeout); } @Override public void xgroupCreate(K key, String groupname, String from) { reactive.xgroupCreate(key, groupname, from).await().atMost(timeout); } @Override public void xgroupCreate(K key, String groupname, String from, XGroupCreateArgs args) { reactive.xgroupCreate(key, groupname, from, args).await().atMost(timeout); } @Override public boolean xgroupCreateConsumer(K key, String groupname, String consumername) { return reactive.xgroupCreateConsumer(key, groupname, consumername).await().atMost(timeout); } @Override public long xgroupDelConsumer(K key, String groupname, String consumername) { return reactive.xgroupDelConsumer(key, groupname, consumername).await().atMost(timeout); } @Override public boolean xgroupDestroy(K key, String groupname) { return reactive.xgroupDestroy(key, groupname).await().atMost(timeout); } @Override public void xgroupSetId(K key, String groupname, String from) { reactive.xgroupSetId(key, groupname, from).await().atMost(timeout); } @Override public void xgroupSetId(K key, String groupname, String from, XGroupSetIdArgs args) { reactive.xgroupSetId(key, groupname, from, args).await().atMost(timeout); } @Override public long xlen(K key) { return reactive.xlen(key).await().atMost(timeout); } @Override public List<StreamMessage<K, F, V>> xrange(K key, StreamRange range, int count) { return reactive.xrange(key, range, count).await().atMost(timeout); } @Override public List<StreamMessage<K, F, V>> xrange(K key, StreamRange range) { return reactive.xrange(key, range).await().atMost(timeout); } @Override public List<StreamMessage<K, F, V>> xread(K key, String id) { return reactive.xread(key, id).await().atMost(timeout); } @Override public List<StreamMessage<K, F, V>> xread(Map<K, String> lastIdsPerStream) { return reactive.xread(lastIdsPerStream).await().atMost(timeout); } @Override public List<StreamMessage<K, F, V>> xread(K key, String id, XReadArgs args) { return reactive.xread(key, id, args).await().atMost(timeout); } @Override public List<StreamMessage<K, F, V>> xread(Map<K, String> lastIdsPerStream, XReadArgs args) { return reactive.xread(lastIdsPerStream, args).await().atMost(timeout); } @Override public List<StreamMessage<K, F, V>> xreadgroup(String group, String consumer, K key, String id) { return reactive.xreadgroup(group, consumer, key, id).await().atMost(timeout); } @Override public List<StreamMessage<K, F, V>> xreadgroup(String group, String consumer, Map<K, String> lastIdsPerStream) { return reactive.xreadgroup(group, consumer, lastIdsPerStream).await().atMost(timeout); } @Override public List<StreamMessage<K, F, V>> xreadgroup(String group, String consumer, K key, String id, XReadGroupArgs args) { return reactive.xreadgroup(group, consumer, key, id, args).await().atMost(timeout); } @Override public List<StreamMessage<K, F, V>> xreadgroup(String group, String consumer, Map<K, String> lastIdsPerStream, XReadGroupArgs args) { return reactive.xreadgroup(group, consumer, lastIdsPerStream, args).await().atMost(timeout); } @Override public List<StreamMessage<K, F, V>> xrevrange(K key, StreamRange range, int count) { return reactive.xrevrange(key, range, count).await().atMost(timeout); } @Override public List<StreamMessage<K, F, V>> xrevrange(K key, StreamRange range) { return reactive.xrevrange(key, range).await().atMost(timeout); } @Override public long xtrim(K key, String threshold) { return reactive.xtrim(key, threshold).await().atMost(timeout); } @Override public long xtrim(K key, XTrimArgs args) { return reactive.xtrim(key, args).await().atMost(timeout); } @Override public XPendingSummary xpending(K key, String group) { return reactive.xpending(key, group).await().atMost(timeout); } @Override public List<PendingMessage> xpending(K key, String group, StreamRange range, int count) { return reactive.xpending(key, group, range, count).await().atMost(timeout); } @Override public List<PendingMessage> xpending(K key, String group, StreamRange range, int count, XPendingArgs args) { return reactive.xpending(key, group, range, count, args).await().atMost(timeout); } }
BlockingStreamCommandsImpl
java
apache__flink
flink-core/src/main/java/org/apache/flink/core/execution/CheckpointingMode.java
{ "start": 1597, "end": 4156 }
enum ____ { /** * Sets the checkpointing mode to "exactly once". This mode means that the system will * checkpoint the operator and user function state in such a way that, upon recovery, every * record will be reflected exactly once in the operator state. * * <p>For example, if a user function counts the number of elements in a stream, this number * will consistently be equal to the number of actual elements in the stream, regardless of * failures and recovery. * * <p>Note that this does not mean that each record flows through the streaming data flow only * once. It means that upon recovery, the state of operators/functions is restored such that the * resumed data streams pick up exactly at after the last modification to the state. * * <p>Note that this mode does not guarantee exactly-once behavior in the interaction with * external systems (only state in Flink's operators and user functions). The reason for that is * that a certain level of "collaboration" is required between two systems to achieve * exactly-once guarantees. However, for certain systems, connectors can be written that * facilitate this collaboration. * * <p>This mode sustains high throughput. Depending on the data flow graph and operations, this * mode may increase the record latency, because operators need to align their input streams, in * order to create a consistent snapshot point. The latency increase for simple dataflows (no * repartitioning) is negligible. For simple dataflows with repartitioning, the average latency * remains small, but the slowest records typically have an increased latency. */ EXACTLY_ONCE, /** * Sets the checkpointing mode to "at least once". This mode means that the system will * checkpoint the operator and user function state in a simpler way. Upon failure and recovery, * some records may be reflected multiple times in the operator state. * * <p>For example, if a user function counts the number of elements in a stream, this number * will equal to, or larger, than the actual number of elements in the stream, in the presence * of failure and recovery. * * <p>This mode has minimal impact on latency and may be preferable in very-low latency * scenarios, where a sustained very-low latency (such as few milliseconds) is needed, and where * occasional duplicate messages (on recovery) do not matter. */ AT_LEAST_ONCE }
CheckpointingMode
java
apache__camel
core/camel-api/src/main/java/org/apache/camel/spi/ExtendedPropertyConfigurerGetter.java
{ "start": 1224, "end": 1383 }
interface ____ extends PropertyConfigurerGetter { /** * Provides a map of which options the cofigurer supports and their
ExtendedPropertyConfigurerGetter
java
spring-projects__spring-boot
module/spring-boot-web-server/src/main/java/org/springframework/boot/web/server/servlet/ServletWebServerFactory.java
{ "start": 882, "end": 1033 }
interface ____ can be used to create a {@link WebServer}. * * @author Phillip Webb * @since 4.0.0 * @see WebServer */ @FunctionalInterface public
that
java
junit-team__junit5
junit-jupiter-api/src/main/java/org/junit/jupiter/api/DynamicContainer.java
{ "start": 5478, "end": 7424 }
interface ____ extends DynamicNode.Configuration<Configuration> { /** * Set the * {@linkplain DynamicContainer#getChildExecutionMode() child execution mode} * to use for the configured {@link DynamicContainer}. * * @return this configuration for method chaining */ Configuration childExecutionMode(ExecutionMode executionMode); /** * Set the {@linkplain DynamicContainer#getChildren() children} of the * configured {@link DynamicContainer}. * * <p>Any previously configured value is overridden. * * @param children the children; never {@code null} or containing * {@code null} elements * @return this configuration for method chaining */ default Configuration children(Iterable<? extends DynamicNode> children) { Preconditions.notNull(children, "children must not be null"); return children(StreamSupport.stream(children.spliterator(), false)); } /** * Set the {@linkplain DynamicContainer#getChildren() children} of the * configured {@link DynamicContainer}. * * <p>Any previously configured value is overridden. * * @param children the children; never {@code null} or containing * {@code null} elements * @return this configuration for method chaining */ default Configuration children(DynamicNode... children) { Preconditions.notNull(children, "children must not be null"); Preconditions.containsNoNullElements(children, "children must not contain null elements"); return children(List.of(children)); } /** * Set the {@linkplain DynamicContainer#getChildren() children} of the * configured {@link DynamicContainer}. * * <p>Any previously configured value is overridden. * * @param children the children; never {@code null} or containing * {@code null} elements * @return this configuration for method chaining */ Configuration children(Stream<? extends DynamicNode> children); } static final
Configuration
java
elastic__elasticsearch
server/src/test/java/org/elasticsearch/cluster/serialization/ClusterSerializationTests.java
{ "start": 17881, "end": 22094 }
class ____ extends AbstractNamedDiffable<Custom> implements Custom { public static final String TYPE = "test_custom_two"; private final Integer intObject; public TestCustomTwo(Integer intObject) { this.intObject = intObject; } public TestCustomTwo(StreamInput in) throws IOException { this.intObject = in.readInt(); } @Override public void writeTo(StreamOutput out) throws IOException { out.writeInt(intObject); } @Override public Iterator<? extends ToXContent> toXContentChunked(ToXContent.Params ignored) { return Iterators.concat( Iterators.single((builder, params) -> builder.startObject()), Iterators.single((builder, params) -> builder.field("custom_integer_object", intObject)), Iterators.single((builder, params) -> builder.endObject()) ); } @Override public String getWriteableName() { return TYPE; } public static NamedDiff<Custom> readDiffFrom(StreamInput in) throws IOException { return readDiffFrom(Custom.class, TYPE, in); } @Override public TransportVersion getMinimalSupportedVersion() { return TransportVersion.minimumCompatible(); } } public void testCustomSerialization() throws Exception { ClusterState.Builder builder = ClusterState.builder(ClusterState.EMPTY_STATE) .putCustom(TestCustomOne.TYPE, new TestCustomOne("test_custom_one")) .putCustom(TestCustomTwo.TYPE, new TestCustomTwo(10)); ClusterState clusterState = builder.incrementVersion().build(); Diff<ClusterState> diffs = clusterState.diff(ClusterState.EMPTY_STATE); // Add the new customs to named writeables final List<NamedWriteableRegistry.Entry> entries = ClusterModule.getNamedWriteables(); entries.add(new NamedWriteableRegistry.Entry(ClusterState.Custom.class, TestCustomOne.TYPE, TestCustomOne::new)); entries.add(new NamedWriteableRegistry.Entry(NamedDiff.class, TestCustomOne.TYPE, TestCustomOne::readDiffFrom)); entries.add(new NamedWriteableRegistry.Entry(ClusterState.Custom.class, TestCustomTwo.TYPE, TestCustomTwo::new)); entries.add(new NamedWriteableRegistry.Entry(NamedDiff.class, TestCustomTwo.TYPE, TestCustomTwo::readDiffFrom)); // serialize with current version BytesStreamOutput outStream = new BytesStreamOutput(); TransportVersion version = TransportVersion.current(); outStream.setTransportVersion(version); diffs.writeTo(outStream); StreamInput inStream = outStream.bytes().streamInput(); inStream = new NamedWriteableAwareStreamInput(inStream, new NamedWriteableRegistry(entries)); inStream.setTransportVersion(version); Diff<ClusterState> serializedDiffs = ClusterState.readDiffFrom(inStream, clusterState.nodes().getLocalNode()); ClusterState stateAfterDiffs = serializedDiffs.apply(ClusterState.EMPTY_STATE); // Current version - Both the customs are non null assertThat(stateAfterDiffs.custom(TestCustomOne.TYPE), notNullValue()); assertThat(stateAfterDiffs.custom(TestCustomTwo.TYPE), notNullValue()); // serialize with minimum compatibile version outStream = new BytesStreamOutput(); version = TransportVersion.minimumCompatible(); outStream.setTransportVersion(version); diffs.writeTo(outStream); inStream = outStream.bytes().streamInput(); inStream = new NamedWriteableAwareStreamInput(inStream, new NamedWriteableRegistry(entries)); inStream.setTransportVersion(version); serializedDiffs = ClusterState.readDiffFrom(inStream, clusterState.nodes().getLocalNode()); stateAfterDiffs = serializedDiffs.apply(ClusterState.EMPTY_STATE); // Old version - TestCustomOne is null and TestCustomTwo is not null assertThat(stateAfterDiffs.custom(TestCustomOne.TYPE), nullValue()); assertThat(stateAfterDiffs.custom(TestCustomTwo.TYPE), notNullValue()); } }
TestCustomTwo
java
alibaba__druid
core/src/main/java/com/alibaba/druid/support/http/util/IPRange.java
{ "start": 674, "end": 1351 }
class ____ an IP Range, which are represented by an IP address and and a subnet mask. The standards * describing modern routing protocols often refer to the extended-network-prefix-length rather than the subnet mask. * The prefix length is equal to the number of contiguous one-bits in the traditional subnet mask. This means that * specifying the network address 130.5.5.25 with a subnet mask of 255.255.255.0 can also be expressed as 130.5.5.25/24. * The prefix-length notation is more compact and easier to understand than writing out the mask in its traditional * dotted-decimal format. * * @author Marcel Dullaart * @version 1.0 * @see IPAddress */ public
represents
java
elastic__elasticsearch
server/src/main/java/org/elasticsearch/action/admin/indices/alias/get/GetAliasesRequest.java
{ "start": 1006, "end": 3032 }
class ____ extends LocalClusterStateRequest implements AliasesRequest { public static final IndicesOptions DEFAULT_INDICES_OPTIONS = IndicesOptions.strictExpandHiddenNoSelectors(); private String[] aliases; private String[] originalAliases; private String[] indices = Strings.EMPTY_ARRAY; private IndicesOptions indicesOptions = DEFAULT_INDICES_OPTIONS; public GetAliasesRequest(TimeValue masterTimeout, String... aliases) { super(masterTimeout); this.aliases = aliases; this.originalAliases = aliases; } @Override public GetAliasesRequest indices(String... indices) { this.indices = indices; return this; } public GetAliasesRequest aliases(String... aliases) { this.aliases = aliases; this.originalAliases = aliases; return this; } public GetAliasesRequest indicesOptions(IndicesOptions indicesOptions) { this.indicesOptions = indicesOptions; return this; } @Override public String[] indices() { return indices; } @Override public String[] aliases() { return aliases; } @Override public void replaceAliases(String... aliases) { this.aliases = aliases; } /** * Returns the aliases as was originally specified by the user */ public String[] getOriginalAliases() { return originalAliases; } @Override public boolean expandAliasesWildcards() { return true; } @Override public IndicesOptions indicesOptions() { return indicesOptions; } @Override public ActionRequestValidationException validate() { return null; } @Override public boolean includeDataStreams() { return true; } @Override public Task createTask(long id, String type, String action, TaskId parentTaskId, Map<String, String> headers) { return new CancellableTask(id, type, action, "", parentTaskId, headers); } }
GetAliasesRequest
java
quarkusio__quarkus
extensions/tls-registry/deployment/src/test/java/io/quarkus/tls/JKSKeyStoreFromClassPathTest.java
{ "start": 866, "end": 2126 }
class ____ { private static final String configuration = """ quarkus.tls.key-store.jks.path=/certs/keystore.jks quarkus.tls.key-store.jks.password=password """; @RegisterExtension static final QuarkusUnitTest config = new QuarkusUnitTest().setArchiveProducer( () -> ShrinkWrap.create(JavaArchive.class) .addAsResource(new File("target/certs/test-formats-keystore.jks"), "/certs/keystore.jks") .add(new StringAsset(configuration), "application.properties")); @Inject TlsConfigurationRegistry certificates; @Test void test() throws KeyStoreException, CertificateParsingException { TlsConfiguration def = certificates.getDefault().orElseThrow(); assertThat(def.getKeyStoreOptions()).isNotNull(); assertThat(def.getKeyStore()).isNotNull(); X509Certificate certificate = (X509Certificate) def.getKeyStore().getCertificate("test-formats"); assertThat(certificate).isNotNull(); assertThat(certificate.getSubjectAlternativeNames()).anySatisfy(l -> { assertThat(l.get(0)).isEqualTo(2); assertThat(l.get(1)).isEqualTo("localhost"); }); } }
JKSKeyStoreFromClassPathTest
java
apache__avro
lang/java/protobuf/src/test/java/org/apache/avro/protobuf/noopt/TestProto3.java
{ "start": 2454, "end": 3379 }
enum ____ with the given numeric wire value. */ public static Status forNumber(int value) { switch (value) { case 0: return STATUS_UNKNOWN; case 1: return STATUS_ACTIVE; case 2: return STATUS_INACTIVE; default: return null; } } public static com.google.protobuf.Internal.EnumLiteMap<Status> internalGetValueMap() { return internalValueMap; } private static final com.google.protobuf.Internal.EnumLiteMap<Status> internalValueMap = new com.google.protobuf.Internal.EnumLiteMap<Status>() { public Status findValueByNumber(int number) { return Status.forNumber(number); } }; public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { if (this == UNRECOGNIZED) { throw new java.lang.IllegalStateException("Can't get the descriptor of an unrecognized
associated
java
micronaut-projects__micronaut-core
http-server-netty/src/main/java/io/micronaut/http/server/netty/HttpPipelineBuilder.java
{ "start": 38989, "end": 40160 }
class ____ implements GracefulShutdownCapable { final ChannelHandlerContext ctx; Http23GracefulShutdownBase(ChannelHandlerContext ctx) { this.ctx = ctx; } @Override public OptionalLong reportActiveTasks() { return OptionalLong.of(1); // just count the connection, not each stream } @Override public CompletionStage<?> shutdownGracefully() { if (ctx.executor().inEventLoop()) { shutdownGracefully0(); } else { ctx.executor().execute(this::shutdownGracefully0); } return NettyHttpServer.toCompletionStage(ctx.channel().closeFuture()); } private void shutdownGracefully0() { goAway() .addListener((ChannelFutureListener) future -> { if (!future.isSuccess()) { ctx.close(); } }); ctx.flush(); } protected abstract int numberOfActiveStreams(); protected abstract ChannelFuture goAway(); } private static final
Http23GracefulShutdownBase
java
quarkusio__quarkus
extensions/panache/hibernate-reactive-rest-data-panache/deployment/src/main/java/io/quarkus/hibernate/reactive/rest/data/panache/deployment/ResourceImplementor.java
{ "start": 1775, "end": 10425 }
class ____ registered as beans and are later used in the generated JAX-RS controllers. */ String implement(ClassOutput classOutput, DataAccessImplementor dataAccessImplementor, ClassInfo resourceInterface, String entityType, List<ClassInfo> resourceMethodListeners) { String resourceType = resourceInterface.name().toString(); String className = resourceType + "Impl_" + HashUtil.sha1(resourceType); LOGGER.tracef("Starting generation of '%s'", className); ClassCreator classCreator = ClassCreator.builder() .classOutput(classOutput) .className(className) .interfaces(resourceType) .build(); classCreator.addAnnotation(ApplicationScoped.class); // The same resource is generated as part of the JaxRsResourceImplementor, so we need to avoid ambiguous resolution // when injecting the resource in user beans: classCreator.addAnnotation(Alternative.class); classCreator.addAnnotation(Priority.class).add("value", Integer.MAX_VALUE); classCreator.addAnnotation(WithSessionOnDemand.class); HibernateReactiveResourceMethodListenerImplementor resourceMethodListenerImplementor = new HibernateReactiveResourceMethodListenerImplementor( classCreator, resourceMethodListeners); implementList(classCreator, dataAccessImplementor); implementListWithQuery(classCreator, dataAccessImplementor); implementListPageCount(classCreator, dataAccessImplementor); implementCount(classCreator, dataAccessImplementor); implementGet(classCreator, dataAccessImplementor); implementAdd(classCreator, dataAccessImplementor, resourceMethodListenerImplementor); implementUpdate(classCreator, dataAccessImplementor, entityType, resourceMethodListenerImplementor); implementDelete(classCreator, dataAccessImplementor, resourceMethodListenerImplementor); classCreator.close(); LOGGER.tracef("Completed generation of '%s'", className); return className; } private void implementList(ClassCreator classCreator, DataAccessImplementor dataAccessImplementor) { MethodCreator methodCreator = classCreator.getMethodCreator("list", Uni.class, Page.class, Sort.class); ResultHandle page = methodCreator.getMethodParam(0); ResultHandle sort = methodCreator.getMethodParam(1); ResultHandle columns = methodCreator.invokeVirtualMethod(ofMethod(Sort.class, "getColumns", List.class), sort); ResultHandle isEmptySort = methodCreator.invokeInterfaceMethod(ofMethod(List.class, "isEmpty", boolean.class), columns); BranchResult isEmptySortBranch = methodCreator.ifTrue(isEmptySort); isEmptySortBranch.trueBranch().returnValue(dataAccessImplementor.findAll(isEmptySortBranch.trueBranch(), page)); isEmptySortBranch.falseBranch().returnValue(dataAccessImplementor.findAll(isEmptySortBranch.falseBranch(), page, sort)); methodCreator.close(); } private void implementListWithQuery(ClassCreator classCreator, DataAccessImplementor dataAccessImplementor) { MethodCreator methodCreator = classCreator.getMethodCreator("list", Uni.class, Page.class, Sort.class, String.class, Map.class); ResultHandle page = methodCreator.getMethodParam(0); ResultHandle sort = methodCreator.getMethodParam(1); ResultHandle query = methodCreator.getMethodParam(2); ResultHandle queryParams = methodCreator.getMethodParam(3); ResultHandle columns = methodCreator.invokeVirtualMethod(ofMethod(Sort.class, "getColumns", List.class), sort); ResultHandle isEmptySort = methodCreator.invokeInterfaceMethod(ofMethod(List.class, "isEmpty", boolean.class), columns); BranchResult isEmptySortBranch = methodCreator.ifTrue(isEmptySort); isEmptySortBranch.trueBranch().returnValue(dataAccessImplementor.findAll(isEmptySortBranch.trueBranch(), page, query, queryParams)); isEmptySortBranch.falseBranch().returnValue(dataAccessImplementor.findAll(isEmptySortBranch.falseBranch(), page, sort, query, queryParams)); methodCreator.close(); } /** * Generate count method. */ private void implementCount(ClassCreator classCreator, DataAccessImplementor dataAccessImplementor) { MethodCreator methodCreator = classCreator.getMethodCreator("count", Uni.class); methodCreator.returnValue(dataAccessImplementor.count(methodCreator)); methodCreator.close(); } /** * Generate list page count method. * This method is used when building page URLs for list operation response and is not exposed to a user. */ private void implementListPageCount(ClassCreator classCreator, DataAccessImplementor dataAccessImplementor) { MethodCreator methodCreator = classCreator.getMethodCreator(Constants.PAGE_COUNT_METHOD_PREFIX + "list", Uni.class, Page.class, String.class, Map.class); ResultHandle page = methodCreator.getMethodParam(0); ResultHandle query = methodCreator.getMethodParam(1); ResultHandle queryParams = methodCreator.getMethodParam(2); methodCreator.returnValue(dataAccessImplementor.pageCount(methodCreator, page, query, queryParams)); methodCreator.close(); } private void implementGet(ClassCreator classCreator, DataAccessImplementor dataAccessImplementor) { MethodCreator methodCreator = classCreator.getMethodCreator("get", Uni.class, Object.class); ResultHandle id = methodCreator.getMethodParam(0); methodCreator.returnValue(dataAccessImplementor.findById(methodCreator, id)); methodCreator.close(); } private void implementAdd(ClassCreator classCreator, DataAccessImplementor dataAccessImplementor, HibernateReactiveResourceMethodListenerImplementor resourceMethodListenerImplementor) { MethodCreator methodCreator = classCreator.getMethodCreator("add", Uni.class, Object.class); methodCreator.addAnnotation(WithTransaction.class); ResultHandle entity = methodCreator.getMethodParam(0); resourceMethodListenerImplementor.onBeforeAdd(methodCreator, entity); ResultHandle uni = dataAccessImplementor.persist(methodCreator, entity); uni = resourceMethodListenerImplementor.onAfterAdd(methodCreator, uni); methodCreator.returnValue(uni); methodCreator.close(); } private void implementUpdate(ClassCreator classCreator, DataAccessImplementor dataAccessImplementor, String entityType, HibernateReactiveResourceMethodListenerImplementor resourceMethodListenerImplementor) { MethodCreator methodCreator = classCreator.getMethodCreator("update", Uni.class, Object.class, Object.class); methodCreator.addAnnotation(WithTransaction.class); ResultHandle id = methodCreator.getMethodParam(0); ResultHandle entity = methodCreator.getMethodParam(1); // Set entity ID before executing an update to make sure that a requested object ID matches a given entity ID. setId(methodCreator, entityType, entity, id); resourceMethodListenerImplementor.onBeforeUpdate(methodCreator, entity); ResultHandle uni = dataAccessImplementor.update(methodCreator, entity); uni = resourceMethodListenerImplementor.onAfterUpdate(methodCreator, uni); methodCreator.returnValue(uni); methodCreator.close(); } private void implementDelete(ClassCreator classCreator, DataAccessImplementor dataAccessImplementor, HibernateReactiveResourceMethodListenerImplementor resourceMethodListenerImplementor) { MethodCreator methodCreator = classCreator.getMethodCreator("delete", Uni.class, Object.class); methodCreator.addAnnotation(WithTransaction.class); ResultHandle id = methodCreator.getMethodParam(0); resourceMethodListenerImplementor.onBeforeDelete(methodCreator, id); ResultHandle uni = dataAccessImplementor.deleteById(methodCreator, id); uni = resourceMethodListenerImplementor.onAfterDelete(methodCreator, uni, id); methodCreator.returnValue(uni); methodCreator.close(); } private void setId(BytecodeCreator creator, String entityType, ResultHandle entity, ResultHandle id) { FieldInfo idField = entityClassHelper.getIdField(entityType); MethodDescriptor idSetter = entityClassHelper.getSetter(entityType, idField); creator.invokeVirtualMethod(idSetter, entity, id); } }
are
java
alibaba__nacos
config/src/main/java/com/alibaba/nacos/config/server/monitor/MetricsMonitor.java
{ "start": 1181, "end": 7690 }
class ____ { private static final String METER_REGISTRY = NacosMeterRegistryCenter.CONFIG_STABLE_REGISTRY; private static AtomicInteger getConfig = new AtomicInteger(); private static AtomicInteger publish = new AtomicInteger(); /** * task for notify config change to sub client of http long polling. */ private static AtomicInteger longPolling = new AtomicInteger(); private static AtomicInteger configCount = new AtomicInteger(); /** * task for notify config change to cluster server. */ private static AtomicInteger notifyTask = new AtomicInteger(); /** * task for notify config change to sub client of long connection. */ private static AtomicInteger notifyClientTask = new AtomicInteger(); private static AtomicInteger dumpTask = new AtomicInteger(); /** * config fuzzy search count. */ private static AtomicInteger fuzzySearch = new AtomicInteger(); /** * version -> client config subscriber count. */ private static ConcurrentHashMap<String, AtomicInteger> configSubscriber = new ConcurrentHashMap<>(); /** * config change count. */ private static StringTopNCounter configChangeCount = new StringTopNCounter(); static { ImmutableTag immutableTag = new ImmutableTag("module", "config"); List<Tag> tags = new ArrayList<>(); tags.add(immutableTag); tags.add(new ImmutableTag("name", "getConfig")); NacosMeterRegistryCenter.gauge(METER_REGISTRY, "nacos_monitor", tags, getConfig); tags = new ArrayList<>(); tags.add(immutableTag); tags.add(new ImmutableTag("name", "publish")); NacosMeterRegistryCenter.gauge(METER_REGISTRY, "nacos_monitor", tags, publish); tags = new ArrayList<>(); tags.add(immutableTag); tags.add(new ImmutableTag("name", "longPolling")); NacosMeterRegistryCenter.gauge(METER_REGISTRY, "nacos_monitor", tags, longPolling); tags = new ArrayList<>(); tags.add(immutableTag); tags.add(new ImmutableTag("name", "configCount")); NacosMeterRegistryCenter.gauge(METER_REGISTRY, "nacos_monitor", tags, configCount); tags = new ArrayList<>(); tags.add(immutableTag); tags.add(new ImmutableTag("name", "notifyTask")); NacosMeterRegistryCenter.gauge(METER_REGISTRY, "nacos_monitor", tags, notifyTask); tags = new ArrayList<>(); tags.add(immutableTag); tags.add(new ImmutableTag("name", "notifyClientTask")); NacosMeterRegistryCenter.gauge(METER_REGISTRY, "nacos_monitor", tags, notifyClientTask); tags = new ArrayList<>(); tags.add(immutableTag); tags.add(new ImmutableTag("name", "dumpTask")); NacosMeterRegistryCenter.gauge(METER_REGISTRY, "nacos_monitor", tags, dumpTask); tags = new ArrayList<>(); tags.add(immutableTag); tags.add(new ImmutableTag("name", "fuzzySearch")); NacosMeterRegistryCenter.gauge(METER_REGISTRY, "nacos_monitor", tags, fuzzySearch); configSubscriber.put("v1", new AtomicInteger(0)); configSubscriber.put("v2", new AtomicInteger(0)); tags = new ArrayList<>(); tags.add(new ImmutableTag("version", "v1")); NacosMeterRegistryCenter.gauge(METER_REGISTRY, "nacos_config_subscriber", tags, configSubscriber.get("v1")); tags = new ArrayList<>(); tags.add(new ImmutableTag("version", "v2")); NacosMeterRegistryCenter.gauge(METER_REGISTRY, "nacos_config_subscriber", tags, configSubscriber.get("v2")); } public static AtomicInteger getConfigMonitor() { return getConfig; } public static AtomicInteger getPublishMonitor() { return publish; } public static AtomicInteger getLongPollingMonitor() { return longPolling; } public static AtomicInteger getConfigCountMonitor() { return configCount; } public static AtomicInteger getNotifyTaskMonitor() { return notifyTask; } public static AtomicInteger getNotifyClientTaskMonitor() { return notifyClientTask; } public static AtomicInteger getDumpTaskMonitor() { return dumpTask; } public static AtomicInteger getFuzzySearchMonitor() { return fuzzySearch; } public static AtomicInteger getConfigSubscriberMonitor(String version) { return configSubscriber.get(version); } public static StringTopNCounter getConfigChangeCount() { return configChangeCount; } public static Timer getReadConfigRtTimer() { return NacosMeterRegistryCenter .timer(METER_REGISTRY, "nacos_timer", "module", "config", "name", "readConfigRt"); } public static Timer getWriteConfigRtTimer() { return NacosMeterRegistryCenter .timer(METER_REGISTRY, "nacos_timer", "module", "config", "name", "writeConfigRt"); } public static Timer getNotifyRtTimer() { return NacosMeterRegistryCenter.timer(METER_REGISTRY, "nacos_timer", "module", "config", "name", "notifyRt"); } public static Timer getDumpRtTimer() { return NacosMeterRegistryCenter.timer(METER_REGISTRY, "nacos_timer", "module", "config", "name", "dumpRt"); } public static Counter getIllegalArgumentException() { return NacosMeterRegistryCenter .counter(METER_REGISTRY, "nacos_exception", "module", "config", "name", "illegalArgument"); } public static Counter getNacosException() { return NacosMeterRegistryCenter.counter(METER_REGISTRY, "nacos_exception", "module", "config", "name", "nacos"); } public static Counter getConfigNotifyException() { return NacosMeterRegistryCenter .counter(METER_REGISTRY, "nacos_exception", "module", "config", "name", "configNotify"); } public static Counter getUnhealthException() { return NacosMeterRegistryCenter .counter(METER_REGISTRY, "nacos_exception", "module", "config", "name", "unhealth"); } public static void incrementConfigChangeCount(String tenant, String group, String dataId) { configChangeCount.increment(tenant + "@" + group + "@" + dataId); } }
MetricsMonitor
java
elastic__elasticsearch
x-pack/plugin/sql/qa/server/single-node/src/javaRestTest/java/org/elasticsearch/xpack/sql/qa/single_node/RestSqlUsageIT.java
{ "start": 468, "end": 729 }
class ____ extends RestSqlUsageTestCase { @ClassRule public static final ElasticsearchCluster cluster = SqlTestCluster.getCluster(); @Override protected String getTestRestCluster() { return cluster.getHttpAddresses(); } }
RestSqlUsageIT
java
assertj__assertj-core
assertj-guava/src/main/java/org/assertj/guava/api/MultimapAssert.java
{ "start": 1979, "end": 16867 }
class ____<K, V> extends AbstractAssert<MultimapAssert<K, V>, Multimap<K, V>> { protected MultimapAssert(Multimap<K, V> actual) { super(actual, MultimapAssert.class); } // visible for test protected Multimap<K, V> getActual() { return actual; } /** * Verifies that the actual {@link Multimap} contains the given keys.<br> * <p> * Example : * * <pre><code class='java'> Multimap&lt;String, String&gt; actual = ArrayListMultimap.create(); * * actual.putAll("Lakers", newArrayList("Kobe Bryant", "Magic Johnson", "Kareem Abdul Jabbar")); * actual.putAll("Spurs", newArrayList("Tony Parker", "Tim Duncan", "Manu Ginobili")); * actual.putAll("Bulls", newArrayList("Michael Jordan", "Scottie Pippen", "Derrick Rose")); * * assertThat(actual).containsKeys(&quot;Lakers&quot;, &quot;Bulls&quot;);</code></pre> * <p> * If the <code>keys</code> argument is null or empty, an {@link IllegalArgumentException} is thrown. * <p> * * @param keys the keys to look for in actual {@link Multimap}. * @return this {@link MultimapAssert} for assertions chaining. * @throws IllegalArgumentException if no param keys have been set. * @throws AssertionError if the actual {@link Multimap} is {@code null}. * @throws AssertionError if the actual {@link Multimap} does not contain the given keys. */ public MultimapAssert<K, V> containsKeys(@SuppressWarnings("unchecked") K... keys) { isNotNull(); throwIllegalArgumentExceptionIfTrue(keys == null, "The keys to look for should not be null"); throwIllegalArgumentExceptionIfTrue(keys.length == 0, "The keys to look for should not be empty"); Set<K> keysNotFound = newLinkedHashSet(); for (K key : keys) { if (!actual.containsKey(key)) { keysNotFound.add(key); } } if (!keysNotFound.isEmpty()) { throw assertionError(shouldContainKeys(actual, keys, keysNotFound)); } return myself; } /** * Verifies that the actual {@link Multimap} contains the given entries.<br> * <p> * Example : * * <pre><code class='java'> Multimap&lt;String, String&gt; actual = ArrayListMultimap.create(); * * actual.putAll("Lakers", newArrayList("Kobe Bryant", "Magic Johnson", "Kareem Abdul Jabbar")); * actual.putAll("Spurs", newArrayList("Tony Parker", "Tim Duncan", "Manu Ginobili")); * actual.putAll("Bulls", newArrayList("Michael Jordan", "Scottie Pippen", "Derrick Rose")); * * // entry can be statically imported from org.assertj.guava.api.Assertions or org.assertj.guava.data.MapEntry * assertThat(actual).contains(entry("Lakers", "Kobe Bryant"), entry("Spurs", "Tim Duncan"));</code></pre> * <p> * If the <code>entries</code> argument is null or empty, an {@link IllegalArgumentException} is thrown. * <p> * * @param entries the entries to look for in actual {@link Multimap}. * @return this {@link MultimapAssert} for assertions chaining. * @throws IllegalArgumentException if no param entries have been set. * @throws AssertionError if the actual {@link Multimap} is {@code null}. * @throws AssertionError if the actual {@link Multimap} does not contain the given entries. */ @SafeVarargs public final MultimapAssert<K, V> contains(MapEntry<K, V>... entries) { isNotNull(); throwIllegalArgumentExceptionIfTrue(entries == null, "The entries to look for should not be null"); throwIllegalArgumentExceptionIfTrue(entries.length == 0, "The entries to look for should not be empty"); List<MapEntry<K, V>> entriesNotFound = newArrayList(); for (MapEntry<K, V> entry : entries) { if (!actual.containsEntry(entry.key, entry.value)) { entriesNotFound.add(entry); } } if (!entriesNotFound.isEmpty()) { throw assertionError(shouldContain(actual, entries, entriesNotFound)); } return myself; } /** * Verifies that the actual {@link Multimap} contains the given values for any key.<br> * <p> * Example : * * <pre><code class='java'> Multimap&lt;String, String&gt; actual = ArrayListMultimap.create(); * * actual.putAll("Lakers", newArrayList("Kobe Bryant", "Magic Johnson", "Kareem Abdul Jabbar")); * actual.putAll("Spurs", newArrayList("Tony Parker", "Tim Duncan", "Manu Ginobili")); * actual.putAll("Bulls", newArrayList("Michael Jordan", "Scottie Pippen", "Derrick Rose")); * * // note that given values are not linked to same key * assertThat(actual).containsValues(&quot;Kobe Bryant&quot;, &quot;Michael Jordan&quot;);</code></pre> * <p> * If the <code>values</code> argument is null or empty, an {@link IllegalArgumentException} is thrown. * <p> * * @param values the values to look for in actual {@link Multimap}. * @return this {@link MultimapAssert} for assertions chaining. * @throws IllegalArgumentException if no param values have been set. * @throws AssertionError if the actual {@link Multimap} is {@code null}. * @throws AssertionError if the actual {@link Multimap} does not contain the given values. */ public MultimapAssert<K, V> containsValues(@SuppressWarnings("unchecked") V... values) { isNotNull(); throwIllegalArgumentExceptionIfTrue(values == null, "The values to look for should not be null"); throwIllegalArgumentExceptionIfTrue(values.length == 0, "The values to look for should not be empty"); Set<V> valuesNotFound = newLinkedHashSet(); for (V value : values) { if (!actual.containsValue(value)) { valuesNotFound.add(value); } } if (!valuesNotFound.isEmpty()) { throw assertionError(shouldContainValues(actual, values, valuesNotFound)); } return myself; } /** * Verifies that the actual {@link Multimap} is empty. * * <p> * Example : * * <pre><code class='java'> Multimap&lt;String, String&gt; actual = ArrayListMultimap.create(); * * assertThat(actual).isEmpty();</code></pre> * * @throws AssertionError if the actual {@link Multimap} is {@code null}. * @throws AssertionError if the actual {@link Multimap} is not empty. */ public void isEmpty() { isNotNull(); if (!actual.isEmpty()) { throw assertionError(shouldBeEmpty(actual)); } } /** * Verifies that the actual {@link Multimap} is not empty. * * <p> * Example : * * <pre><code class='java'> Multimap&lt;String, String&gt; actual = ArrayListMultimap.create(); * nba.put("Bulls", "Derrick Rose"); * nba.put("Bulls", "Joachim Noah"); * * assertThat(nba).isNotEmpty();</code></pre> * * @throws AssertionError if the actual {@link Multimap} is {@code null}. * @throws AssertionError if the actual {@link Multimap} is empty. */ public void isNotEmpty() { isNotNull(); if (actual.isEmpty()) { throw assertionError(shouldNotBeEmpty()); } } /** * Verifies that the number of values in the actual {@link Multimap} is equal to the given one. * * <p> * Example : * * <pre><code class='java'> Multimap&lt;String, String&gt; actual = ArrayListMultimap.create(); * * actual.putAll("Lakers", newArrayList("Kobe Bryant", "Magic Johnson", "Kareem Abdul Jabbar")); * actual.putAll("Spurs", newArrayList("Tony Parker", "Tim Duncan", "Manu Ginobili")); * actual.putAll("Bulls", newArrayList("Michael Jordan", "Scottie Pippen", "Derrick Rose")); * * assertThat(actual).hasSize(9);</code></pre> * * @param expectedSize the expected size of actual {@link Multimap}. * @return this {@link MultimapAssert} for assertions chaining. * @throws AssertionError if the actual {@link Multimap} is {@code null}. * @throws AssertionError if the number of values of the actual {@link Multimap} is not equal to the given one. */ public MultimapAssert<K, V> hasSize(int expectedSize) { isNotNull(); int sizeOfActual = actual.size(); if (sizeOfActual == expectedSize) { return this; } throw assertionError(shouldHaveSize(actual, sizeOfActual, expectedSize)); } /** * Verifies that the actual {@link Multimap} has the same entries as the given one.<br> * It allows to compare two multimaps having the same content but who are not equal because being of different types * like {@link SetMultimap} and {@link ListMultimap}. * <p> * Example : * * <pre><code class='java'> Multimap&lt;String, String&gt; actual = ArrayListMultimap.create(); * listMultimap.putAll("Spurs", newArrayList("Tony Parker", "Tim Duncan", "Manu Ginobili")); * listMultimap.putAll("Bulls", newArrayList("Michael Jordan", "Scottie Pippen", "Derrick Rose")); * * Multimap&lt;String, String&gt; setMultimap = TreeMultimap.create(); * setMultimap.putAll("Spurs", newHashSet("Tony Parker", "Tim Duncan", "Manu Ginobili")); * setMultimap.putAll("Bulls", newHashSet("Michael Jordan", "Scottie Pippen", "Derrick Rose")); * * // assertion will pass as listMultimap and setMultimap have the same content * assertThat(listMultimap).hasSameEntriesAs(setMultimap); * * // this assertion FAILS even though both multimaps have the same content * assertThat(listMultimap).isEqualTo(setMultimap);</code></pre> * * @param other {@link Multimap} to compare actual's entries with. * @return this {@link MultimapAssert} for assertions chaining. * @throws AssertionError if the actual {@link Multimap} is {@code null}. * @throws IllegalArgumentException if the other {@link Multimap} is {@code null}. * @throws AssertionError if actual {@link Multimap} does not have the same entries as the other {@link Multimap}. */ public final MultimapAssert<K, V> hasSameEntriesAs(Multimap<? extends K, ? extends V> other) { isNotNull(); throwIllegalArgumentExceptionIfTrue(other == null, "The multimap to compare actual with should not be null"); Set<?> entriesNotExpectedInActual = difference(newLinkedHashSet(actual.entries()), newLinkedHashSet(other.entries())); Set<?> entriesNotFoundInActual = difference(newLinkedHashSet(other.entries()), newLinkedHashSet(actual.entries())); if (entriesNotFoundInActual.isEmpty() && entriesNotExpectedInActual.isEmpty()) return myself; throw assertionError(shouldContainOnly(actual, other, entriesNotFoundInActual, entriesNotExpectedInActual)); } /** * Verifies that the actual {@link Multimap} contains all entries of the given one (it might contain more entries). * <p> * Example : * * <pre><code class='java'> Multimap&lt;String, String&gt; actual = ArrayListMultimap.create(); * actual.putAll("Spurs", newArrayList("Tony Parker", "Tim Duncan", "Manu Ginobili")); * actual.putAll("Bulls", newArrayList("Michael Jordan", "Scottie Pippen", "Derrick Rose")); * * Multimap&lt;String, String&gt; other = TreeMultimap.create(); * other.putAll("Spurs", newHashSet("Tony Parker", "Tim Duncan")); * other.putAll("Bulls", newHashSet("Michael Jordan", "Scottie Pippen")); * * // assertion will pass as other is a subset of actual. * assertThat(actual).containsAllEntriesOf(other); * * // this assertion FAILS as other does not contain "Spurs -&gt; "Manu Ginobili" and "Bulls" -&gt; "Derrick Rose" * assertThat(other).containsAllEntriesOf(actual);</code></pre> * * @param other {@link Multimap} to compare actual's entries with. * @return this {@link MultimapAssert} for assertions chaining. * @throws AssertionError if the actual {@link Multimap} is {@code null}. * @throws IllegalArgumentException if the other {@link Multimap} is {@code null}. * @throws AssertionError if actual {@link Multimap} does not have contain all the given {@link Multimap} entries. */ public final MultimapAssert<K, V> containsAllEntriesOf(Multimap<? extends K, ? extends V> other) { isNotNull(); throwIllegalArgumentExceptionIfTrue(other == null, "The multimap to compare actual with should not be null"); Set<?> entriesNotFoundInActual = difference(newLinkedHashSet(other.entries()), newLinkedHashSet(actual.entries())); if (entriesNotFoundInActual.isEmpty()) return myself; throw assertionError(shouldContain(actual, other, entriesNotFoundInActual)); } /** * Verifies that the actual multimap does not contain the given key. * <p> * Examples: * <pre><code class='java'> Multimap&lt;Ring, TolkienCharacter&gt; elvesRingBearers = HashMultimap.create(); * elvesRingBearers.put(nenya, galadriel); * elvesRingBearers.put(narya, gandalf); * elvesRingBearers.put(vilya, elrond); * * // assertion will pass * assertThat(elvesRingBearers).doesNotContainKey(oneRing); * * // assertion will fail * assertThat(elvesRingBearers).doesNotContainKey(vilya);</code></pre> * * @param key the given key * @return {@code this} assertions object * @throws AssertionError if the actual map is {@code null}. * @throws AssertionError if the actual map contains the given key. * @since 3.26.0 */ public MultimapAssert<K, V> doesNotContainKey(K key) { return doesNotContainKeys(key); } /** * Verifies that the actual multimap does not contain any of the given keys. * <p> * Examples: * <pre><code class='java'> Multimap&lt;Ring, TolkienCharacter&gt; elvesRingBearers = HashMultimap.create(); * elvesRingBearers.put(nenya, galadriel); * elvesRingBearers.put(narya, gandalf); * elvesRingBearers.put(vilya, elrond); * * // assertion will pass * assertThat(elvesRingBearers).doesNotContainKeys(oneRing, someManRing); * * // assertions will fail * assertThat(elvesRingBearers).doesNotContainKeys(vilya, nenya); * assertThat(elvesRingBearers).doesNotContainKeys(vilya, oneRing);</code></pre> * * @param keys the given keys * @return {@code this} assertions object * @throws AssertionError if the actual map is {@code null}. * @throws AssertionError if the actual map contains the given key. * @throws NullPointerException if the varargs of keys is null * @since 3.26.0 */ public MultimapAssert<K, V> doesNotContainKeys(K... keys) { isNotNull(); assertDoesNotContainKeys(keys); return this; } private void assertDoesNotContainKeys(K[] keys) { requireNonNull(keys, "The array of keys to look for should not be null"); Set<K> foundKeys = findKeys(actual, keys); if (!foundKeys.isEmpty()) throw assertionError(shouldNotContainKeys(actual, foundKeys)); } private static <K> Set<K> findKeys(Multimap<K, ?> actual, K[] expectedKeys) { // Stream API avoided for performance reasons Set<K> foundKeys = new LinkedHashSet<>(); for (K expectedKey : expectedKeys) { if (actual.containsKey(expectedKey)) { foundKeys.add(expectedKey); } } return foundKeys; } }
MultimapAssert
java
quarkusio__quarkus
extensions/websockets-next/deployment/src/test/java/io/quarkus/websockets/next/test/telemetry/endpoints/onerror/DtoTextCodec.java
{ "start": 329, "end": 717 }
class ____ implements TextMessageCodec<Dto> { @Override public boolean supports(Type type) { return type.equals(Dto.class); } @Override public String encode(Dto dto) { return dto.property(); } @Override public Dto decode(Type type, String value) { throw new RuntimeException("Expected exception during decoding"); } }
DtoTextCodec
java
spring-projects__spring-boot
module/spring-boot-kafka/src/test/java/org/springframework/boot/kafka/autoconfigure/KafkaAutoConfigurationTests.java
{ "start": 55438, "end": 55638 }
class ____ { @Bean BatchInterceptor<Object, Object> batchInterceptor() { return (batch, consumer) -> batch; } } @Configuration(proxyBeanMethods = false) static
BatchInterceptorConfiguration
java
apache__hadoop
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/tools/TestHdfsConfigFields.java
{ "start": 5687, "end": 5987 }
class ____ the hadoop-hdfs-nfs module xmlPrefixToSkipCompare.add("nfs"); // Not a hardcoded property. Used by SaslRpcClient xmlPrefixToSkipCompare.add("dfs.namenode.kerberos.principal.pattern"); // Skip over example property xmlPrefixToSkipCompare.add("dfs.ha.namenodes"); } }
in
java
apache__camel
components/camel-google/camel-google-pubsub/src/test/java/org/apache/camel/component/google/pubsub/integration/CustomSerializerIT.java
{ "start": 1390, "end": 2817 }
class ____ extends PubsubTestSupport { private static final String TOPIC_NAME = "typesSend"; private static final String SUBSCRIPTION_NAME = "TypesReceive"; @EndpointInject("direct:from") private Endpoint directIn; @EndpointInject("google-pubsub:{{project.id}}:" + TOPIC_NAME) private Endpoint pubsubTopic; @EndpointInject("google-pubsub:{{project.id}}:" + SUBSCRIPTION_NAME + "?synchronousPull=true") private Endpoint pubsubSubscription; @EndpointInject("mock:receiveResult") private MockEndpoint receiveResult; @Produce("direct:from") private ProducerTemplate producer; @BindToRegistry private GooglePubsubSerializer serializer = new CustomSerializer(); @Override public void createTopicSubscription() { createTopicSubscriptionPair(TOPIC_NAME, SUBSCRIPTION_NAME); } @Override protected RouteBuilder createRouteBuilder() { return new RouteBuilder() { public void configure() { from(directIn).to(pubsubTopic); from(pubsubSubscription).to(receiveResult); } }; } @Test public void customSerializer() throws Exception { receiveResult.expectedBodiesReceived("12345 custom serialized".getBytes(StandardCharsets.UTF_8)); producer.sendBody(12345); receiveResult.assertIsSatisfied(); } private static final
CustomSerializerIT
java
apache__rocketmq
client/src/test/java/org/apache/rocketmq/client/impl/consumer/RebalanceLitePullImplTest.java
{ "start": 1644, "end": 4973 }
class ____ { private MessageQueue mq = new MessageQueue("topic1", "broker1", 0); private MessageQueue retryMq = new MessageQueue(MixAll.RETRY_GROUP_TOPIC_PREFIX + "group", "broker1", 0); private DefaultLitePullConsumerImpl consumerImpl = mock(DefaultLitePullConsumerImpl.class); private RebalanceLitePullImpl rebalanceImpl = new RebalanceLitePullImpl(consumerImpl); private OffsetStore offsetStore = mock(OffsetStore.class); private DefaultLitePullConsumer consumer = new DefaultLitePullConsumer(); private MQClientInstance client = mock(MQClientInstance.class); private MQAdminImpl admin = mock(MQAdminImpl.class); public RebalanceLitePullImplTest() { when(consumerImpl.getDefaultLitePullConsumer()).thenReturn(consumer); when(consumerImpl.getOffsetStore()).thenReturn(offsetStore); rebalanceImpl.setmQClientFactory(client); when(client.getMQAdminImpl()).thenReturn(admin); } @Test public void testComputePullFromWhereWithException_ne_minus1() throws MQClientException { for (ConsumeFromWhere where : new ConsumeFromWhere[]{ ConsumeFromWhere.CONSUME_FROM_LAST_OFFSET, ConsumeFromWhere.CONSUME_FROM_FIRST_OFFSET, ConsumeFromWhere.CONSUME_FROM_TIMESTAMP}) { consumer.setConsumeFromWhere(where); when(offsetStore.readOffset(any(MessageQueue.class), any(ReadOffsetType.class))).thenReturn(0L); assertEquals(0, rebalanceImpl.computePullFromWhereWithException(mq)); when(offsetStore.readOffset(any(MessageQueue.class), any(ReadOffsetType.class))).thenReturn(-2L); assertEquals(-1, rebalanceImpl.computePullFromWhereWithException(mq)); } } @Test public void testComputePullFromWhereWithException_eq_minus1_last() throws MQClientException { when(offsetStore.readOffset(any(MessageQueue.class), any(ReadOffsetType.class))).thenReturn(-1L); consumer.setConsumeFromWhere(ConsumeFromWhere.CONSUME_FROM_LAST_OFFSET); when(admin.maxOffset(any(MessageQueue.class))).thenReturn(12345L); assertEquals(12345L, rebalanceImpl.computePullFromWhereWithException(mq)); assertEquals(0L, rebalanceImpl.computePullFromWhereWithException(retryMq)); } @Test public void testComputePullFromWhereWithException_eq_minus1_first() throws MQClientException { when(offsetStore.readOffset(any(MessageQueue.class), any(ReadOffsetType.class))).thenReturn(-1L); consumer.setConsumeFromWhere(ConsumeFromWhere.CONSUME_FROM_FIRST_OFFSET); assertEquals(0, rebalanceImpl.computePullFromWhereWithException(mq)); } @Test public void testComputePullFromWhereWithException_eq_minus1_timestamp() throws MQClientException { when(offsetStore.readOffset(any(MessageQueue.class), any(ReadOffsetType.class))).thenReturn(-1L); consumer.setConsumeFromWhere(ConsumeFromWhere.CONSUME_FROM_TIMESTAMP); when(admin.searchOffset(any(MessageQueue.class), anyLong())).thenReturn(12345L); when(admin.maxOffset(any(MessageQueue.class))).thenReturn(23456L); assertEquals(12345L, rebalanceImpl.computePullFromWhereWithException(mq)); assertEquals(23456L, rebalanceImpl.computePullFromWhereWithException(retryMq)); } }
RebalanceLitePullImplTest
java
FasterXML__jackson-databind
src/main/java/tools/jackson/databind/deser/bean/PropertyValue.java
{ "start": 455, "end": 1661 }
class ____ { public final PropertyValue next; /** * Value to assign when POJO has been instantiated. */ public final Object value; protected PropertyValue(PropertyValue next, Object value) { this.next = next; this.value = value; } /** * Method called to assign stored value of this property to specified * bean instance */ public abstract void assign(DeserializationContext ctxt, Object bean) throws JacksonException; /** * Method called to assign stored value of this property to specified * parameter object. */ public void setValue(DeserializationContext ctxt, Object parameterObject) throws JacksonException { throw new UnsupportedOperationException("Should not be called on type: " + getClass().getName()); } /* /********************************************************************** /* Concrete property value classes /********************************************************************** */ /** * Property value that used when assigning value to property using * a setter method or direct field access. */ final static
PropertyValue
java
apache__flink
flink-table/flink-table-api-java/src/test/java/org/apache/flink/table/module/ModuleManagerTest.java
{ "start": 1366, "end": 8568 }
class ____ { private ModuleManager manager; @BeforeEach public void before() { manager = new ModuleManager(); } @Test void testLoadModuleTwice() { // CoreModule is loaded by default assertThat(manager.getUsedModules()) .isEqualTo(Collections.singletonList(CoreModuleFactory.IDENTIFIER)); assertThat(manager.getLoadedModules().get(CoreModuleFactory.IDENTIFIER)) .isSameAs(CoreModule.INSTANCE); assertThatThrownBy( () -> manager.loadModule(CoreModuleFactory.IDENTIFIER, CoreModule.INSTANCE)) .isInstanceOf(ValidationException.class) .hasMessage("A module with name 'core' already exists"); } @Test void testLoadModuleWithoutUnusedModulesExist() { ModuleMock x = new ModuleMock("x"); ModuleMock y = new ModuleMock("y"); ModuleMock z = new ModuleMock("z"); manager.loadModule(x.getType(), x); manager.loadModule(y.getType(), y); manager.loadModule(z.getType(), z); Map<String, Module> expectedLoadedModules = new HashMap<>(); expectedLoadedModules.put(CoreModuleFactory.IDENTIFIER, CoreModule.INSTANCE); expectedLoadedModules.put("x", x); expectedLoadedModules.put("y", y); expectedLoadedModules.put("z", z); assertThat(manager.getUsedModules()) .containsSequence(CoreModuleFactory.IDENTIFIER, "x", "y", "z"); assertThat(manager.getLoadedModules()).isEqualTo(expectedLoadedModules); } @Test void testLoadModuleWithUnusedModulesExist() { ModuleMock y = new ModuleMock("y"); ModuleMock z = new ModuleMock("z"); manager.loadModule(y.getType(), y); manager.loadModule(z.getType(), z); Map<String, Module> expectedLoadedModules = new HashMap<>(); expectedLoadedModules.put(CoreModuleFactory.IDENTIFIER, CoreModule.INSTANCE); expectedLoadedModules.put("y", y); expectedLoadedModules.put("z", z); assertThat(manager.getUsedModules()) .containsSequence(CoreModuleFactory.IDENTIFIER, "y", "z"); assertThat(manager.getLoadedModules()).isEqualTo(expectedLoadedModules); // disable module y and z manager.useModules(CoreModuleFactory.IDENTIFIER); // load module x to test the order ModuleMock x = new ModuleMock("x"); manager.loadModule(x.getType(), x); expectedLoadedModules.put("x", x); assertThat(manager.getUsedModules()).containsSequence(CoreModuleFactory.IDENTIFIER, "x"); assertThat(manager.getLoadedModules()).isEqualTo(expectedLoadedModules); } @Test void testUnloadModuleTwice() { assertThat(manager.getUsedModules()).containsSequence(CoreModuleFactory.IDENTIFIER); manager.unloadModule(CoreModuleFactory.IDENTIFIER); assertThat(manager.getUsedModules()).isEmpty(); assertThat(manager.getLoadedModules()).isEmpty(); assertThatThrownBy(() -> manager.unloadModule(CoreModuleFactory.IDENTIFIER)) .isInstanceOf(ValidationException.class) .hasMessage("No module with name 'core' exists"); } @Test void testUseUnloadedModules() { assertThatThrownBy(() -> manager.useModules(CoreModuleFactory.IDENTIFIER, "x")) .isInstanceOf(ValidationException.class) .hasMessage("No module with name 'x' exists"); } @Test void testUseModulesWithDuplicateModuleName() { assertThatThrownBy( () -> manager.useModules( CoreModuleFactory.IDENTIFIER, CoreModuleFactory.IDENTIFIER)) .isInstanceOf(ValidationException.class) .hasMessage("Module 'core' appears more than once"); } @Test void testUseModules() { ModuleMock x = new ModuleMock("x"); ModuleMock y = new ModuleMock("y"); ModuleMock z = new ModuleMock("z"); manager.loadModule(x.getType(), x); manager.loadModule(y.getType(), y); manager.loadModule(z.getType(), z); assertThat(manager.getUsedModules()) .containsSequence(CoreModuleFactory.IDENTIFIER, "x", "y", "z"); // test order for used modules manager.useModules("z", CoreModuleFactory.IDENTIFIER); assertThat(manager.getUsedModules()).containsSequence("z", CoreModuleFactory.IDENTIFIER); // test unmentioned modules are still loaded Map<String, Module> expectedLoadedModules = new HashMap<>(); expectedLoadedModules.put(CoreModuleFactory.IDENTIFIER, CoreModule.INSTANCE); expectedLoadedModules.put("x", x); expectedLoadedModules.put("y", y); expectedLoadedModules.put("z", z); assertThat(manager.getLoadedModules()).isEqualTo(expectedLoadedModules); } @Test void testListModules() { ModuleMock y = new ModuleMock("y"); ModuleMock z = new ModuleMock("z"); manager.loadModule("y", y); manager.loadModule("z", z); manager.useModules("z", "y"); assertThat(manager.listModules()).containsSequence("z", "y"); } @Test void testListFullModules() { ModuleMock x = new ModuleMock("x"); ModuleMock y = new ModuleMock("y"); ModuleMock z = new ModuleMock("z"); manager.loadModule("y", y); manager.loadModule("x", x); manager.loadModule("z", z); manager.useModules("z", "y"); assertThat(manager.listFullModules()) .isEqualTo( getExpectedModuleEntries(2, "z", "y", CoreModuleFactory.IDENTIFIER, "x")); } @Test void testListFunctions() { ModuleMock x = new ModuleMock("x"); manager.loadModule(x.getType(), x); assertThat(manager.listFunctions()).contains(ModuleMock.DUMMY_FUNCTION_NAME); // hidden functions not in the default list assertThat(manager.listFunctions()).doesNotContain(ModuleMock.INTERNAL_FUNCTION_NAME); // should not return function name of an unused module manager.useModules(CoreModuleFactory.IDENTIFIER); assertThat(manager.listFunctions()).doesNotContain(ModuleMock.DUMMY_FUNCTION_NAME); } @Test void testGetFunctionDefinition() { ModuleMock x = new ModuleMock("x"); manager.loadModule(x.getType(), x); assertThat(manager.getFunctionDefinition(ModuleMock.DUMMY_FUNCTION_NAME)).isPresent(); assertThat(manager.getFunctionDefinition(ModuleMock.INTERNAL_FUNCTION_NAME)).isPresent(); // should not return function definition of an unused module manager.useModules(CoreModuleFactory.IDENTIFIER); assertThat(manager.getFunctionDefinition(ModuleMock.DUMMY_FUNCTION_NAME)).isEmpty(); } private static List<ModuleEntry> getExpectedModuleEntries(int index, String... names) { return IntStream.range(0, names.length) .mapToObj(i -> new ModuleEntry(names[i], i < index)) .collect(Collectors.toList()); } }
ModuleManagerTest
java
apache__kafka
tools/src/main/java/org/apache/kafka/tools/VerifiableShareConsumer.java
{ "start": 4541, "end": 5086 }
class ____ extends PartitionData { private final long count; private final Set<Long> offsets; public RecordSetSummary(String topic, int partition, Set<Long> offsets) { super(topic, partition); this.offsets = offsets; this.count = offsets.size(); } @JsonProperty public long count() { return count; } @JsonProperty public Set<Long> offsets() { return offsets; } } protected static
RecordSetSummary
java
grpc__grpc-java
xds/src/test/java/io/grpc/xds/internal/security/CommonTlsContextTestsUtil.java
{ "start": 20288, "end": 20872 }
class ____ extends SslContextProvider.Callback { public AbstractMap.SimpleImmutableEntry<SslContext, X509TrustManager> updatedSslContext; public Throwable updatedThrowable; public TestCallback(Executor executor) { super(executor); } @Override public void updateSslContextAndExtendedX509TrustManager( AbstractMap.SimpleImmutableEntry<SslContext, X509TrustManager> sslContext) { updatedSslContext = sslContext; } @Override public void onException(Throwable throwable) { updatedThrowable = throwable; } } }
TestCallback
java
quarkusio__quarkus
extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/CustomizerTest.java
{ "start": 867, "end": 1657 }
class ____ { @RegisterExtension static final QuarkusUnitTest unitTest = new QuarkusUnitTest() .setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class).addClass(MyCustomizer.class)) .overrideConfigKey("quarkus.redis.hosts", "redis://wont-work") .overrideConfigKey("quarkus.redis.my-redis.hosts", "redis://wont-work"); @Inject RedisAPI api; @Inject @RedisClientName("my-redis") RedisAPI myapi; @Test public void testCustomization() { String key = UUID.randomUUID().toString(); api.setAndAwait(List.of(key, "test-" + key)); String v = myapi.getAndAwait(key).toString(); Assertions.assertThat(v).isEqualTo("test-" + key); } @ApplicationScoped public static
CustomizerTest
java
elastic__elasticsearch
x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/services/alibabacloudsearch/embeddings/AlibabaCloudSearchEmbeddingsServiceSettings.java
{ "start": 1658, "end": 6055 }
class ____ implements ServiceSettings { public static final String NAME = "alibabacloud_search_embeddings_service_settings"; public static AlibabaCloudSearchEmbeddingsServiceSettings fromMap(Map<String, Object> map, ConfigurationParseContext context) { ValidationException validationException = new ValidationException(); var commonServiceSettings = AlibabaCloudSearchServiceSettings.fromMap(map, context); SimilarityMeasure similarity = extractSimilarity(map, ModelConfigurations.SERVICE_SETTINGS, validationException); Integer dims = removeAsType(map, DIMENSIONS, Integer.class); Integer maxInputTokens = removeAsType(map, MAX_INPUT_TOKENS, Integer.class); if (validationException.validationErrors().isEmpty() == false) { throw validationException; } return new AlibabaCloudSearchEmbeddingsServiceSettings(commonServiceSettings, similarity, dims, maxInputTokens); } private final AlibabaCloudSearchServiceSettings commonSettings; private final SimilarityMeasure similarity; private final Integer dimensions; private final Integer maxInputTokens; public AlibabaCloudSearchEmbeddingsServiceSettings( AlibabaCloudSearchServiceSettings commonSettings, @Nullable SimilarityMeasure similarity, @Nullable Integer dimensions, @Nullable Integer maxInputTokens ) { this.commonSettings = commonSettings; this.similarity = similarity; this.dimensions = dimensions; this.maxInputTokens = maxInputTokens; } public AlibabaCloudSearchEmbeddingsServiceSettings(StreamInput in) throws IOException { commonSettings = new AlibabaCloudSearchServiceSettings(in); similarity = in.readOptionalEnum(SimilarityMeasure.class); dimensions = in.readOptionalVInt(); maxInputTokens = in.readOptionalVInt(); } public AlibabaCloudSearchServiceSettings getCommonSettings() { return commonSettings; } public SimilarityMeasure getSimilarity() { return similarity; } @Override public Integer dimensions() { return dimensions; } @Override public SimilarityMeasure similarity() { return similarity; } @Override public DenseVectorFieldMapper.ElementType elementType() { return DenseVectorFieldMapper.ElementType.FLOAT; } public Integer getMaxInputTokens() { return maxInputTokens; } @Override public String modelId() { return commonSettings.modelId(); } @Override public String getWriteableName() { return NAME; } @Override public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { builder.startObject(); commonSettings.toXContentFragment(builder, params); if (similarity != null) { builder.field(SIMILARITY, similarity); } if (dimensions != null) { builder.field(DIMENSIONS, dimensions); } if (maxInputTokens != null) { builder.field(MAX_INPUT_TOKENS, maxInputTokens); } builder.endObject(); return builder; } @Override public ToXContentObject getFilteredXContentObject() { return this; } @Override public TransportVersion getMinimalSupportedVersion() { return TransportVersions.V_8_16_0; } @Override public void writeTo(StreamOutput out) throws IOException { commonSettings.writeTo(out); out.writeOptionalEnum(similarity); out.writeOptionalVInt(dimensions); out.writeOptionalVInt(maxInputTokens); } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; AlibabaCloudSearchEmbeddingsServiceSettings that = (AlibabaCloudSearchEmbeddingsServiceSettings) o; return Objects.equals(commonSettings, that.commonSettings) && Objects.equals(similarity, that.similarity) && Objects.equals(dimensions, that.dimensions) && Objects.equals(maxInputTokens, that.maxInputTokens); } @Override public int hashCode() { return Objects.hash(commonSettings, similarity, dimensions, maxInputTokens); } }
AlibabaCloudSearchEmbeddingsServiceSettings
java
apache__kafka
metadata/src/test/java/org/apache/kafka/metadata/BrokerRegistrationInControlledShutdownChangeTest.java
{ "start": 1020, "end": 1912 }
class ____ { @Test public void testValues() { assertEquals((byte) 0, BrokerRegistrationInControlledShutdownChange.NONE.value()); assertEquals((byte) 1, BrokerRegistrationInControlledShutdownChange.IN_CONTROLLED_SHUTDOWN.value()); } @Test public void testAsBoolean() { assertEquals(Optional.empty(), BrokerRegistrationInControlledShutdownChange.NONE.asBoolean()); assertEquals(Optional.of(true), BrokerRegistrationInControlledShutdownChange.IN_CONTROLLED_SHUTDOWN.asBoolean()); } @Test public void testValueRoundTrip() { for (BrokerRegistrationInControlledShutdownChange change : BrokerRegistrationInControlledShutdownChange.values()) { assertEquals(Optional.of(change), BrokerRegistrationInControlledShutdownChange.fromValue(change.value())); } } }
BrokerRegistrationInControlledShutdownChangeTest
java
alibaba__druid
core/src/main/java/com/alibaba/druid/sql/ast/statement/SQLDescribeStatement.java
{ "start": 835, "end": 2862 }
class ____ extends SQLStatementImpl implements SQLReplaceable { protected SQLName object; protected SQLName column; protected boolean extended; protected boolean formatted; // for odps protected SQLObjectType objectType; protected List<SQLExpr> partition = new ArrayList<SQLExpr>(); public SQLName getObject() { return object; } public void setObject(SQLName object) { this.object = object; } public SQLName getColumn() { return column; } public void setColumn(SQLName column) { if (column != null) { column.setParent(this); } this.column = column; } public List<SQLExpr> getPartition() { return partition; } public void setPartition(List<SQLExpr> partition) { this.partition = partition; } public SQLObjectType getObjectType() { return objectType; } public void setObjectType(SQLObjectType objectType) { this.objectType = objectType; } public boolean isExtended() { return extended; } public void setExtended(boolean extended) { this.extended = extended; } public boolean isFormatted() { return formatted; } public void setFormatted(boolean formatted) { this.formatted = formatted; } @Override protected void accept0(SQLASTVisitor visitor) { if (visitor.visit(this)) { acceptChild(visitor, object); acceptChild(visitor, column); } visitor.endVisit(this); } @Override public List<SQLObject> getChildren() { return Arrays.<SQLObject>asList(this.object, column); } public boolean replace(SQLExpr expr, SQLExpr target) { if (object == expr) { setObject((SQLName) target); return true; } if (column == expr) { setColumn((SQLName) target); return true; } return false; } }
SQLDescribeStatement
java
apache__kafka
trogdor/src/test/java/org/apache/kafka/trogdor/coordinator/CoordinatorTest.java
{ "start": 3188, "end": 14046 }
class ____ { private static final Logger log = LoggerFactory.getLogger(CoordinatorTest.class); @Test public void testCoordinatorStatus() throws Exception { try (MiniTrogdorCluster cluster = new MiniTrogdorCluster.Builder(). addCoordinator("node01"). build()) { CoordinatorStatusResponse status = cluster.coordinatorClient().status(); assertEquals(cluster.coordinator().status(), status); } } @Test public void testCoordinatorUptime() throws Exception { MockTime time = new MockTime(0, 200, 0); Scheduler scheduler = new MockScheduler(time); try (MiniTrogdorCluster cluster = new MiniTrogdorCluster.Builder(). addCoordinator("node01"). scheduler(scheduler). build()) { UptimeResponse uptime = cluster.coordinatorClient().uptime(); assertEquals(cluster.coordinator().uptime(), uptime); time.setCurrentTimeMs(250); assertNotEquals(cluster.coordinator().uptime(), uptime); } } @Test public void testCreateTask() throws Exception { MockTime time = new MockTime(0, 0, 0); Scheduler scheduler = new MockScheduler(time); try (MiniTrogdorCluster cluster = new MiniTrogdorCluster.Builder(). addCoordinator("node01"). addAgent("node02"). scheduler(scheduler). build()) { new ExpectedTasks().waitFor(cluster.coordinatorClient()); NoOpTaskSpec fooSpec = new NoOpTaskSpec(1, 2); cluster.coordinatorClient().createTask( new CreateTaskRequest("foo", fooSpec)); new ExpectedTasks(). addTask(new ExpectedTaskBuilder("foo"). taskState(new TaskPending(fooSpec)). build()). waitFor(cluster.coordinatorClient()); // Re-creating a task with the same arguments is not an error. cluster.coordinatorClient().createTask( new CreateTaskRequest("foo", fooSpec)); // Re-creating a task with different arguments gives a RequestConflictException. NoOpTaskSpec barSpec = new NoOpTaskSpec(1000, 2000); assertThrows(RequestConflictException.class, () -> cluster.coordinatorClient().createTask( new CreateTaskRequest("foo", barSpec)), "Recreating task with different task spec is not allowed"); time.sleep(2); new ExpectedTasks(). addTask(new ExpectedTaskBuilder("foo"). taskState(new TaskRunning(fooSpec, 2, new TextNode("active"))). workerState(new WorkerRunning("foo", fooSpec, 2, new TextNode("active"))). build()). waitFor(cluster.coordinatorClient()). waitFor(cluster.agentClient("node02")); time.sleep(3); new ExpectedTasks(). addTask(new ExpectedTaskBuilder("foo"). taskState(new TaskDone(fooSpec, 2, 5, "", false, new TextNode("done"))). build()). waitFor(cluster.coordinatorClient()); } } @Test public void testTaskDistribution() throws Exception { MockTime time = new MockTime(0, 0, 0); Scheduler scheduler = new MockScheduler(time); try (MiniTrogdorCluster cluster = new MiniTrogdorCluster.Builder(). addCoordinator("node01"). addAgent("node01"). addAgent("node02"). scheduler(scheduler). build()) { CoordinatorClient coordinatorClient = cluster.coordinatorClient(); AgentClient agentClient1 = cluster.agentClient("node01"); AgentClient agentClient2 = cluster.agentClient("node02"); new ExpectedTasks(). waitFor(coordinatorClient). waitFor(agentClient1). waitFor(agentClient2); NoOpTaskSpec fooSpec = new NoOpTaskSpec(5, 7); coordinatorClient.createTask(new CreateTaskRequest("foo", fooSpec)); new ExpectedTasks(). addTask(new ExpectedTaskBuilder("foo").taskState( new TaskPending(fooSpec)).build()). waitFor(coordinatorClient). waitFor(agentClient1). waitFor(agentClient2); time.sleep(11); ObjectNode status1 = new ObjectNode(JsonNodeFactory.instance); status1.set("node01", new TextNode("active")); status1.set("node02", new TextNode("active")); new ExpectedTasks(). addTask(new ExpectedTaskBuilder("foo"). taskState(new TaskRunning(fooSpec, 11, status1)). workerState(new WorkerRunning("foo", fooSpec, 11, new TextNode("active"))). build()). waitFor(coordinatorClient). waitFor(agentClient1). waitFor(agentClient2); time.sleep(7); ObjectNode status2 = new ObjectNode(JsonNodeFactory.instance); status2.set("node01", new TextNode("done")); status2.set("node02", new TextNode("done")); new ExpectedTasks(). addTask(new ExpectedTaskBuilder("foo"). taskState(new TaskDone(fooSpec, 11, 18, "", false, status2)). workerState(new WorkerDone("foo", fooSpec, 11, 18, new TextNode("done"), "")). build()). waitFor(coordinatorClient). waitFor(agentClient1). waitFor(agentClient2); } } @Test public void testTaskCancellation() throws Exception { MockTime time = new MockTime(0, 0, 0); Scheduler scheduler = new MockScheduler(time); try (MiniTrogdorCluster cluster = new MiniTrogdorCluster.Builder(). addCoordinator("node01"). addAgent("node01"). addAgent("node02"). scheduler(scheduler). build()) { CoordinatorClient coordinatorClient = cluster.coordinatorClient(); AgentClient agentClient1 = cluster.agentClient("node01"); AgentClient agentClient2 = cluster.agentClient("node02"); new ExpectedTasks(). waitFor(coordinatorClient). waitFor(agentClient1). waitFor(agentClient2); NoOpTaskSpec fooSpec = new NoOpTaskSpec(5, 7); coordinatorClient.createTask(new CreateTaskRequest("foo", fooSpec)); new ExpectedTasks(). addTask(new ExpectedTaskBuilder("foo").taskState(new TaskPending(fooSpec)).build()). waitFor(coordinatorClient). waitFor(agentClient1). waitFor(agentClient2); time.sleep(11); ObjectNode status1 = new ObjectNode(JsonNodeFactory.instance); status1.set("node01", new TextNode("active")); status1.set("node02", new TextNode("active")); new ExpectedTasks(). addTask(new ExpectedTaskBuilder("foo"). taskState(new TaskRunning(fooSpec, 11, status1)). workerState(new WorkerRunning("foo", fooSpec, 11, new TextNode("active"))). build()). waitFor(coordinatorClient). waitFor(agentClient1). waitFor(agentClient2); ObjectNode status2 = new ObjectNode(JsonNodeFactory.instance); status2.set("node01", new TextNode("done")); status2.set("node02", new TextNode("done")); time.sleep(7); coordinatorClient.stopTask(new StopTaskRequest("foo")); new ExpectedTasks(). addTask(new ExpectedTaskBuilder("foo"). taskState(new TaskDone(fooSpec, 11, 18, "", true, status2)). workerState(new WorkerDone("foo", fooSpec, 11, 18, new TextNode("done"), "")). build()). waitFor(coordinatorClient). waitFor(agentClient1). waitFor(agentClient2); coordinatorClient.destroyTask(new DestroyTaskRequest("foo")); new ExpectedTasks(). waitFor(coordinatorClient). waitFor(agentClient1). waitFor(agentClient2); } } @Test public void testTaskDestruction() throws Exception { MockTime time = new MockTime(0, 0, 0); Scheduler scheduler = new MockScheduler(time); try (MiniTrogdorCluster cluster = new MiniTrogdorCluster.Builder(). addCoordinator("node01"). addAgent("node01"). addAgent("node02"). scheduler(scheduler). build()) { CoordinatorClient coordinatorClient = cluster.coordinatorClient(); AgentClient agentClient1 = cluster.agentClient("node01"); AgentClient agentClient2 = cluster.agentClient("node02"); new ExpectedTasks(). waitFor(coordinatorClient). waitFor(agentClient1). waitFor(agentClient2); NoOpTaskSpec fooSpec = new NoOpTaskSpec(2, 12); coordinatorClient.destroyTask(new DestroyTaskRequest("foo")); coordinatorClient.createTask(new CreateTaskRequest("foo", fooSpec)); NoOpTaskSpec barSpec = new NoOpTaskSpec(20, 20); coordinatorClient.createTask(new CreateTaskRequest("bar", barSpec)); coordinatorClient.destroyTask(new DestroyTaskRequest("bar")); new ExpectedTasks(). addTask(new ExpectedTaskBuilder("foo").taskState(new TaskPending(fooSpec)).build()). waitFor(coordinatorClient). waitFor(agentClient1). waitFor(agentClient2); time.sleep(10); ObjectNode status1 = new ObjectNode(JsonNodeFactory.instance); status1.set("node01", new TextNode("active")); status1.set("node02", new TextNode("active")); new ExpectedTasks(). addTask(new ExpectedTaskBuilder("foo"). taskState(new TaskRunning(fooSpec, 10, status1)). build()). waitFor(coordinatorClient). waitFor(agentClient1). waitFor(agentClient2); coordinatorClient.destroyTask(new DestroyTaskRequest("foo")); new ExpectedTasks(). waitFor(coordinatorClient). waitFor(agentClient1). waitFor(agentClient2); } } public static
CoordinatorTest
java
apache__camel
dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/AMQPEndpointBuilderFactory.java
{ "start": 231239, "end": 245419 }
interface ____ extends AMQPEndpointConsumerBuilder, AMQPEndpointProducerBuilder { default AdvancedAMQPEndpointBuilder advanced() { return (AdvancedAMQPEndpointBuilder) this; } /** * Sets the JMS client ID to use. Note that this value, if specified, * must be unique and can only be used by a single JMS connection * instance. It is typically only required for durable topic * subscriptions with JMS 1.1. * * The option is a: <code>java.lang.String</code> type. * * Group: common * * @param clientId the value to set * @return the dsl builder */ default AMQPEndpointBuilder clientId(String clientId) { doSetProperty("clientId", clientId); return this; } /** * The connection factory to be use. A connection factory must be * configured either on the component or endpoint. * * The option is a: <code>jakarta.jms.ConnectionFactory</code> type. * * Group: common * * @param connectionFactory the value to set * @return the dsl builder */ default AMQPEndpointBuilder connectionFactory(jakarta.jms.ConnectionFactory connectionFactory) { doSetProperty("connectionFactory", connectionFactory); return this; } /** * The connection factory to be use. A connection factory must be * configured either on the component or endpoint. * * The option will be converted to a * <code>jakarta.jms.ConnectionFactory</code> type. * * Group: common * * @param connectionFactory the value to set * @return the dsl builder */ default AMQPEndpointBuilder connectionFactory(String connectionFactory) { doSetProperty("connectionFactory", connectionFactory); return this; } /** * Specifies whether Camel ignores the JMSReplyTo header in messages. If * true, Camel does not send a reply back to the destination specified * in the JMSReplyTo header. You can use this option if you want Camel * to consume from a route and you do not want Camel to automatically * send back a reply message because another component in your code * handles the reply message. You can also use this option if you want * to use Camel as a proxy between different message brokers and you * want to route message from one system to another. * * The option is a: <code>boolean</code> type. * * Default: false * Group: common * * @param disableReplyTo the value to set * @return the dsl builder */ default AMQPEndpointBuilder disableReplyTo(boolean disableReplyTo) { doSetProperty("disableReplyTo", disableReplyTo); return this; } /** * Specifies whether Camel ignores the JMSReplyTo header in messages. If * true, Camel does not send a reply back to the destination specified * in the JMSReplyTo header. You can use this option if you want Camel * to consume from a route and you do not want Camel to automatically * send back a reply message because another component in your code * handles the reply message. You can also use this option if you want * to use Camel as a proxy between different message brokers and you * want to route message from one system to another. * * The option will be converted to a <code>boolean</code> type. * * Default: false * Group: common * * @param disableReplyTo the value to set * @return the dsl builder */ default AMQPEndpointBuilder disableReplyTo(String disableReplyTo) { doSetProperty("disableReplyTo", disableReplyTo); return this; } /** * The durable subscriber name for specifying durable topic * subscriptions. The clientId option must be configured as well. * * The option is a: <code>java.lang.String</code> type. * * Group: common * * @param durableSubscriptionName the value to set * @return the dsl builder */ default AMQPEndpointBuilder durableSubscriptionName(String durableSubscriptionName) { doSetProperty("durableSubscriptionName", durableSubscriptionName); return this; } /** * Allows you to force the use of a specific jakarta.jms.Message * implementation for sending JMS messages. Possible values are: Bytes, * Map, Object, Stream, Text. By default, Camel would determine which * JMS message type to use from the In body type. This option allows you * to specify it. * * The option is a: * <code>org.apache.camel.component.jms.JmsMessageType</code> type. * * Group: common * * @param jmsMessageType the value to set * @return the dsl builder */ default AMQPEndpointBuilder jmsMessageType(org.apache.camel.component.jms.JmsMessageType jmsMessageType) { doSetProperty("jmsMessageType", jmsMessageType); return this; } /** * Allows you to force the use of a specific jakarta.jms.Message * implementation for sending JMS messages. Possible values are: Bytes, * Map, Object, Stream, Text. By default, Camel would determine which * JMS message type to use from the In body type. This option allows you * to specify it. * * The option will be converted to a * <code>org.apache.camel.component.jms.JmsMessageType</code> type. * * Group: common * * @param jmsMessageType the value to set * @return the dsl builder */ default AMQPEndpointBuilder jmsMessageType(String jmsMessageType) { doSetProperty("jmsMessageType", jmsMessageType); return this; } /** * Provides an explicit ReplyTo destination (overrides any incoming * value of Message.getJMSReplyTo() in consumer). * * The option is a: <code>java.lang.String</code> type. * * Group: common * * @param replyTo the value to set * @return the dsl builder */ default AMQPEndpointBuilder replyTo(String replyTo) { doSetProperty("replyTo", replyTo); return this; } /** * Specifies whether to test the connection on startup. This ensures * that when Camel starts that all the JMS consumers have a valid * connection to the JMS broker. If a connection cannot be granted then * Camel throws an exception on startup. This ensures that Camel is not * started with failed connections. The JMS producers is tested as well. * * The option is a: <code>boolean</code> type. * * Default: false * Group: common * * @param testConnectionOnStartup the value to set * @return the dsl builder */ default AMQPEndpointBuilder testConnectionOnStartup(boolean testConnectionOnStartup) { doSetProperty("testConnectionOnStartup", testConnectionOnStartup); return this; } /** * Specifies whether to test the connection on startup. This ensures * that when Camel starts that all the JMS consumers have a valid * connection to the JMS broker. If a connection cannot be granted then * Camel throws an exception on startup. This ensures that Camel is not * started with failed connections. The JMS producers is tested as well. * * The option will be converted to a <code>boolean</code> type. * * Default: false * Group: common * * @param testConnectionOnStartup the value to set * @return the dsl builder */ default AMQPEndpointBuilder testConnectionOnStartup(String testConnectionOnStartup) { doSetProperty("testConnectionOnStartup", testConnectionOnStartup); return this; } /** * Password to use with the ConnectionFactory. You can also configure * username/password directly on the ConnectionFactory. * * The option is a: <code>java.lang.String</code> type. * * Group: security * * @param password the value to set * @return the dsl builder */ default AMQPEndpointBuilder password(String password) { doSetProperty("password", password); return this; } /** * Username to use with the ConnectionFactory. You can also configure * username/password directly on the ConnectionFactory. * * The option is a: <code>java.lang.String</code> type. * * Group: security * * @param username the value to set * @return the dsl builder */ default AMQPEndpointBuilder username(String username) { doSetProperty("username", username); return this; } /** * Specifies whether to use transacted mode. * * The option is a: <code>boolean</code> type. * * Default: false * Group: transaction * * @param transacted the value to set * @return the dsl builder */ default AMQPEndpointBuilder transacted(boolean transacted) { doSetProperty("transacted", transacted); return this; } /** * Specifies whether to use transacted mode. * * The option will be converted to a <code>boolean</code> type. * * Default: false * Group: transaction * * @param transacted the value to set * @return the dsl builder */ default AMQPEndpointBuilder transacted(String transacted) { doSetProperty("transacted", transacted); return this; } /** * Specifies whether InOut operations (request reply) default to using * transacted mode If this flag is set to true, then Spring JmsTemplate * will have sessionTransacted set to true, and the acknowledgeMode as * transacted on the JmsTemplate used for InOut operations. Note from * Spring JMS: that within a JTA transaction, the parameters passed to * createQueue, createTopic methods are not taken into account. * Depending on the Java EE transaction context, the container makes its * own decisions on these values. Analogously, these parameters are not * taken into account within a locally managed transaction either, since * Spring JMS operates on an existing JMS Session in this case. Setting * this flag to true will use a short local JMS transaction when running * outside of a managed transaction, and a synchronized local JMS * transaction in case of a managed transaction (other than an XA * transaction) being present. This has the effect of a local JMS * transaction being managed alongside the main transaction (which might * be a native JDBC transaction), with the JMS transaction committing * right after the main transaction. * * The option is a: <code>boolean</code> type. * * Default: false * Group: transaction * * @param transactedInOut the value to set * @return the dsl builder */ default AMQPEndpointBuilder transactedInOut(boolean transactedInOut) { doSetProperty("transactedInOut", transactedInOut); return this; } /** * Specifies whether InOut operations (request reply) default to using * transacted mode If this flag is set to true, then Spring JmsTemplate * will have sessionTransacted set to true, and the acknowledgeMode as * transacted on the JmsTemplate used for InOut operations. Note from * Spring JMS: that within a JTA transaction, the parameters passed to * createQueue, createTopic methods are not taken into account. * Depending on the Java EE transaction context, the container makes its * own decisions on these values. Analogously, these parameters are not * taken into account within a locally managed transaction either, since * Spring JMS operates on an existing JMS Session in this case. Setting * this flag to true will use a short local JMS transaction when running * outside of a managed transaction, and a synchronized local JMS * transaction in case of a managed transaction (other than an XA * transaction) being present. This has the effect of a local JMS * transaction being managed alongside the main transaction (which might * be a native JDBC transaction), with the JMS transaction committing * right after the main transaction. * * The option will be converted to a <code>boolean</code> type. * * Default: false * Group: transaction * * @param transactedInOut the value to set * @return the dsl builder */ default AMQPEndpointBuilder transactedInOut(String transactedInOut) { doSetProperty("transactedInOut", transactedInOut); return this; } } /** * Advanced builder for endpoint for the AMQP component. */ public
AMQPEndpointBuilder
java
apache__flink
flink-runtime/src/test/java/org/apache/flink/runtime/messages/GenericMessageTester.java
{ "start": 7422, "end": 7633 }
class ____ implements Instantiator<Integer> { @Override public Integer instantiate(Random rnd) { return rnd.nextInt(Integer.MAX_VALUE); } } public static
IntInstantiator
java
apache__camel
components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/JaxbDataFormat.java
{ "start": 2836, "end": 21239 }
class ____ extends ServiceSupport implements DataFormat, DataFormatName, DataFormatContentTypeHeader, CamelContextAware { private static final Logger LOG = LoggerFactory.getLogger(JaxbDataFormat.class); private SchemaFactory schemaFactory; private CamelContext camelContext; private JAXBContext context; private JAXBIntrospector introspector; private String contextPath; private boolean contextPathIsClassName; private String schema; private int schemaSeverityLevel; // 0 = warning, 1 = error, 2 = fatal private String schemaLocation; private String noNamespaceSchemaLocation; private boolean prettyPrint = true; private boolean objectFactory = true; private boolean ignoreJAXBElement = true; private boolean mustBeJAXBElement; private boolean filterNonXmlChars; private String encoding; private boolean fragment; // partial support private QName partNamespace; private Class<?> partClass; private Map<String, String> namespacePrefix; private JaxbNamespacePrefixMapper namespacePrefixMapper; private JaxbXmlStreamWriterWrapper xmlStreamWriterWrapper; private TypeConverter typeConverter; private Schema cachedSchema; private Map<String, Object> jaxbProviderProperties; private boolean contentTypeHeader = true; private String accessExternalSchemaProtocols; public JaxbDataFormat() { } public JaxbDataFormat(JAXBContext context) { this.context = context; } public JaxbDataFormat(String contextPath) { this.contextPath = contextPath; } @Override public String getDataFormatName() { return "jaxb"; } @Override public void marshal(Exchange exchange, Object graph, OutputStream stream) throws IOException { try { // must create a new instance of marshaller as its not thread safe Marshaller marshaller = createMarshaller(); if (isPrettyPrint()) { marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); } // exchange take precedence over encoding option String charset = exchange.getProperty(ExchangePropertyKey.CHARSET_NAME, String.class); if (charset == null) { charset = encoding; //Propagate the encoding of the exchange if (charset != null) { exchange.setProperty(ExchangePropertyKey.CHARSET_NAME, charset); } } if (charset != null) { marshaller.setProperty(Marshaller.JAXB_ENCODING, charset); } if (isFragment()) { marshaller.setProperty(Marshaller.JAXB_FRAGMENT, Boolean.TRUE); } if (ObjectHelper.isNotEmpty(schemaLocation)) { marshaller.setProperty(Marshaller.JAXB_SCHEMA_LOCATION, schemaLocation); } if (ObjectHelper.isNotEmpty(noNamespaceSchemaLocation)) { marshaller.setProperty(Marshaller.JAXB_NO_NAMESPACE_SCHEMA_LOCATION, noNamespaceSchemaLocation); } if (namespacePrefixMapper != null) { marshaller.setProperty(namespacePrefixMapper.getRegistrationKey(), namespacePrefixMapper); } // Inject any JAX-RI custom properties from the exchange or from the instance into the marshaller injectCustomProperties(exchange, marshaller); doMarshal(exchange, graph, stream, marshaller, charset); if (contentTypeHeader) { exchange.getMessage().setHeader(Exchange.CONTENT_TYPE, "application/xml"); } } catch (Exception e) { throw new IOException(e); } } private void injectCustomProperties(Exchange exchange, Marshaller marshaller) throws PropertyException { Map<String, Object> customProperties = exchange.getProperty(JaxbConstants.JAXB_PROVIDER_PROPERTIES, Map.class); if (customProperties == null) { customProperties = getJaxbProviderProperties(); } if (customProperties != null) { for (Entry<String, Object> property : customProperties.entrySet()) { if (LOG.isDebugEnabled()) { LOG.debug("Using JAXB Provider Property {}={}", property.getKey(), property.getValue()); } marshaller.setProperty(property.getKey(), property.getValue()); } } } void doMarshal(Exchange exchange, Object graph, OutputStream stream, Marshaller marshaller, String charset) throws Exception { Object element = graph; QName partNamespaceOnDataFormat = getPartNamespace(); String partClassFromHeader = exchange.getIn().getHeader(JaxbConstants.JAXB_PART_CLASS, String.class); String partNamespaceFromHeader = exchange.getIn().getHeader(JaxbConstants.JAXB_PART_NAMESPACE, String.class); if ((partClass != null || partClassFromHeader != null) && (partNamespaceOnDataFormat != null || partNamespaceFromHeader != null)) { element = toElement(graph, partClassFromHeader, partNamespaceFromHeader, partNamespaceOnDataFormat); } // only marshal if its possible if (introspector.isElement(element)) { tryMarshal(exchange, stream, marshaller, charset, element); return; } else if (objectFactory && element != null) { if (tryFromFactory(exchange, stream, marshaller, charset, element)) { return; } } // cannot marshal if (!mustBeJAXBElement) { // write the graph as is to the output stream writeGraph(exchange, graph, stream); } else { throw new InvalidPayloadException(exchange, JAXBElement.class); } } private boolean tryFromFactory( Exchange exchange, OutputStream stream, Marshaller marshaller, String charset, Object element) throws IllegalAccessException, InvocationTargetException, JAXBException, InstantiationException { Method objectFactoryMethod = JaxbHelper.getJaxbElementFactoryMethod(camelContext, element.getClass()); if (objectFactoryMethod != null) { try { tryMarshallFromInstance(exchange, stream, marshaller, charset, objectFactoryMethod, element); return true; } catch (Exception e) { // if a schema is set then an MarshallException is thrown when the XML is not valid // and the method must throw this exception as it would when the object in the body is a root element // or a partial class (the other alternatives above) // // it would be best to completely remove the exception handler here but it's left for backwards compatibility reasons. if (MarshalException.class.isAssignableFrom(e.getClass()) && schema != null) { throw e; } LOG.debug("Unable to create JAXBElement object for type {} due to {}", element.getClass(), e.getMessage(), e); } } return false; } private static void writeGraph(Exchange exchange, Object graph, OutputStream stream) throws NoTypeConversionAvailableException, IOException { if (LOG.isDebugEnabled()) { LOG.debug("Attempt to marshalling non JAXBElement with type {} as InputStream", ObjectHelper.classCanonicalName(graph)); } InputStream is = exchange.getContext().getTypeConverter().mandatoryConvertTo(InputStream.class, exchange, graph); IOHelper.copyAndCloseInput(is, stream); } private void tryMarshallFromInstance( Exchange exchange, OutputStream stream, Marshaller marshaller, String charset, Method objectFactoryMethod, Object element) throws IllegalAccessException, InvocationTargetException, JAXBException, InstantiationException { Object instance = objectFactoryMethod.getDeclaringClass().newInstance(); Object toMarshall = objectFactoryMethod.invoke(instance, element); if (asXmlStreamWriter(exchange)) { XMLStreamWriter writer = typeConverter.convertTo(XMLStreamWriter.class, exchange, stream); if (needFiltering(exchange)) { writer = new FilteringXmlStreamWriter(writer, charset); } if (xmlStreamWriterWrapper != null) { writer = xmlStreamWriterWrapper.wrapWriter(writer); } marshaller.marshal(toMarshall, writer); } else { marshaller.marshal(toMarshall, stream); } return; } private void tryMarshal(Exchange exchange, OutputStream stream, Marshaller marshaller, String charset, Object element) throws JAXBException { if (asXmlStreamWriter(exchange)) { XMLStreamWriter writer = typeConverter.convertTo(XMLStreamWriter.class, exchange, stream); if (needFiltering(exchange)) { writer = new FilteringXmlStreamWriter(writer, charset); } if (xmlStreamWriterWrapper != null) { writer = xmlStreamWriterWrapper.wrapWriter(writer); } marshaller.marshal(element, writer); } else { marshaller.marshal(element, stream); } } private Object toElement( Object graph, String partClassFromHeader, String partNamespaceFromHeader, QName partNamespaceOnDataFormat) throws JAXBException { if (partClassFromHeader != null) { try { partClass = camelContext.getClassResolver().resolveMandatoryClass(partClassFromHeader, Object.class); } catch (ClassNotFoundException e) { throw new JAXBException(e); } } if (partNamespaceFromHeader != null) { partNamespaceOnDataFormat = QName.valueOf(partNamespaceFromHeader); } return new JAXBElement<>(partNamespaceOnDataFormat, (Class<Object>) partClass, graph); } private boolean asXmlStreamWriter(Exchange exchange) { return needFiltering(exchange) || xmlStreamWriterWrapper != null; } @Override public Object unmarshal(Exchange exchange, InputStream stream) throws Exception { return unmarshal(exchange, (Object) stream); } @Override public Object unmarshal(Exchange exchange, Object body) throws Exception { try { Object answer; XMLStreamReader xmlReader; if (needFiltering(exchange)) { xmlReader = typeConverter.convertTo(XMLStreamReader.class, exchange, createNonXmlFilterReader(exchange, body)); } else { xmlReader = typeConverter.tryConvertTo(XMLStreamReader.class, exchange, body); if (xmlReader == null) { // fallback to input stream InputStream is = getCamelContext().getTypeConverter().mandatoryConvertTo(InputStream.class, exchange, body); xmlReader = typeConverter.convertTo(XMLStreamReader.class, exchange, is); } } String partClassFromHeader = exchange.getIn().getHeader(JaxbConstants.JAXB_PART_CLASS, String.class); if (partClass != null || partClassFromHeader != null) { // partial unmarshalling if (partClassFromHeader != null) { try { partClass = camelContext.getClassResolver().resolveMandatoryClass(partClassFromHeader, Object.class); } catch (ClassNotFoundException e) { throw new JAXBException(e); } } answer = createUnmarshaller().unmarshal(xmlReader, partClass); } else { answer = createUnmarshaller().unmarshal(xmlReader); } if (answer instanceof JAXBElement && isIgnoreJAXBElement()) { answer = ((JAXBElement<?>) answer).getValue(); } return answer; } catch (JAXBException e) { throw new IOException(e); } } private NonXmlFilterReader createNonXmlFilterReader(Exchange exchange, Object body) throws NoTypeConversionAvailableException { Reader reader = getCamelContext().getTypeConverter().tryConvertTo(Reader.class, exchange, body); if (reader == null) { // fallback to input stream InputStream is = getCamelContext().getTypeConverter().mandatoryConvertTo(InputStream.class, exchange, body); reader = new InputStreamReader(is); } return new NonXmlFilterReader(reader); } protected boolean needFiltering(Exchange exchange) { // exchange property takes precedence over data format property return exchange == null ? filterNonXmlChars : exchange.getProperty(Exchange.FILTER_NON_XML_CHARS, filterNonXmlChars, Boolean.class); } // Properties // ------------------------------------------------------------------------- public boolean isIgnoreJAXBElement() { return ignoreJAXBElement; } public void setIgnoreJAXBElement(boolean flag) { ignoreJAXBElement = flag; } public boolean isMustBeJAXBElement() { return mustBeJAXBElement; } public void setMustBeJAXBElement(boolean mustBeJAXBElement) { this.mustBeJAXBElement = mustBeJAXBElement; } public JAXBContext getContext() { return context; } public void setContext(JAXBContext context) { this.context = context; } public String getContextPath() { return contextPath; } public void setContextPath(String contextPath) { this.contextPath = contextPath; } public boolean isContextPathIsClassName() { return contextPathIsClassName; } public void setContextPathIsClassName(boolean contextPathIsClassName) { this.contextPathIsClassName = contextPathIsClassName; } public SchemaFactory getSchemaFactory() throws SAXException { return schemaFactory; } public void setSchemaFactory(SchemaFactory schemaFactory) { this.schemaFactory = schemaFactory; } public String getSchema() { return schema; } public void setSchema(String schema) { this.schema = schema; } public int getSchemaSeverityLevel() { return schemaSeverityLevel; } public void setSchemaSeverityLevel(int schemaSeverityLevel) { this.schemaSeverityLevel = schemaSeverityLevel; } public boolean isPrettyPrint() { return prettyPrint; } public void setPrettyPrint(boolean prettyPrint) { this.prettyPrint = prettyPrint; } public boolean isObjectFactory() { return objectFactory; } public void setObjectFactory(boolean objectFactory) { this.objectFactory = objectFactory; } public boolean isFragment() { return fragment; } public void setFragment(boolean fragment) { this.fragment = fragment; } public boolean isFilterNonXmlChars() { return filterNonXmlChars; } public void setFilterNonXmlChars(boolean filterNonXmlChars) { this.filterNonXmlChars = filterNonXmlChars; } public String getEncoding() { return encoding; } public void setEncoding(String encoding) { this.encoding = encoding; } public QName getPartNamespace() { return partNamespace; } public void setPartNamespace(QName partNamespace) { this.partNamespace = partNamespace; } public Class<?> getPartClass() { return partClass; } public void setPartClass(Class<?> partClass) { this.partClass = partClass; } public Map<String, String> getNamespacePrefix() { return namespacePrefix; } public void setNamespacePrefix(Map<String, String> namespacePrefix) { this.namespacePrefix = namespacePrefix; } @Override public CamelContext getCamelContext() { return camelContext; } @Override public void setCamelContext(CamelContext camelContext) { this.camelContext = camelContext; } public JaxbXmlStreamWriterWrapper getXmlStreamWriterWrapper() { return xmlStreamWriterWrapper; } public void setXmlStreamWriterWrapper(JaxbXmlStreamWriterWrapper xmlStreamWriterWrapper) { this.xmlStreamWriterWrapper = xmlStreamWriterWrapper; } public String getSchemaLocation() { return schemaLocation; } public void setSchemaLocation(String schemaLocation) { this.schemaLocation = schemaLocation; } public String getNoNamespaceSchemaLocation() { return noNamespaceSchemaLocation; } public void setNoNamespaceSchemaLocation(String schemaLocation) { this.noNamespaceSchemaLocation = schemaLocation; } public Map<String, Object> getJaxbProviderProperties() { return jaxbProviderProperties; } public void setJaxbProviderProperties(Map<String, Object> jaxbProviderProperties) { this.jaxbProviderProperties = jaxbProviderProperties; } public boolean isContentTypeHeader() { return contentTypeHeader; } /** * If enabled then JAXB will set the Content-Type header to <tt>application/xml</tt> when marshalling. */ public void setContentTypeHeader(boolean contentTypeHeader) { this.contentTypeHeader = contentTypeHeader; } public String getAccessExternalSchemaProtocols() { return accessExternalSchemaProtocols; } public void setAccessExternalSchemaProtocols(String accessExternalSchemaProtocols) { this.accessExternalSchemaProtocols = accessExternalSchemaProtocols; } @Override @SuppressWarnings("unchecked") protected void doStart() throws Exception { ObjectHelper.notNull(camelContext, "CamelContext"); if (context == null) { // if context not injected, create one and resolve partial
JaxbDataFormat
java
apache__hadoop
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/monitor/probe/Probe.java
{ "start": 1045, "end": 1086 }
class ____ all probes. */ public abstract
of
java
apache__kafka
clients/src/test/java/org/apache/kafka/common/requests/RequestTestUtils.java
{ "start": 15812, "end": 16382 }
interface ____ { MetadataResponse.PartitionMetadata supply(Errors error, TopicPartition partition, Optional<Integer> leaderId, Optional<Integer> leaderEpoch, List<Integer> replicas, List<Integer> isr, List<Integer> offlineReplicas); } }
PartitionMetadataSupplier
java
apache__camel
tests/camel-itest/src/test/java/org/apache/camel/itest/sql/FromJmsToJdbcIdempotentConsumerToJmsTest.java
{ "start": 1922, "end": 9921 }
class ____ extends CamelSpringTestSupport { @RegisterExtension public static JmsServiceExtension jmsServiceExtension = JmsServiceExtension.createExtension(); private final Logger logger = LoggerFactory.getLogger(this.getClass()); private JdbcTemplate jdbcTemplate; @EndpointInject("mock:a") private MockEndpoint mockA; @EndpointInject("mock:b") private MockEndpoint mockB; @Override protected AbstractApplicationContext createApplicationContext() { return new ClassPathXmlApplicationContext("org/apache/camel/itest/sql/FromJmsToJdbcIdempotentConsumerToJmsTest.xml"); } @BeforeEach public void setupDataSources() { DataSource dataSource = context.getRegistry().lookupByNameAndType(getDatasourceName(), DataSource.class); jdbcTemplate = new JdbcTemplate(dataSource); jdbcTemplate.afterPropertiesSet(); } protected String getDatasourceName() { return "myNonXADataSource"; } @Test void testJmsToJdbcJmsCommit() { checkInitialState(); mockA.expectedMessageCount(1); mockB.expectedMessageCount(1); // use NotifyBuilder to know when the message is done NotifyBuilder notify = new NotifyBuilder(context).whenExactlyCompleted(1).whenDoneSatisfied(mockA).whenDoneSatisfied(mockB).create(); template.sendBodyAndHeader("activemq2:queue:inbox", "A", "uid", 123); assertTrue(notify.matchesWaitTime(), "Should complete 1 message"); // check that there is a message in the database and JMS queue assertEquals(1, jdbcTemplate.queryForObject("select count(*) from CAMEL_MESSAGEPROCESSED", int.class)); Object out = consumer.receiveBody("activemq2:queue:outbox", 3000); assertEquals("DONE-A", out); } @Test void testJmsToJdbcJmsRollbackAtA() { checkInitialState(); mockA.expectedMessageCount(7); mockA.whenAnyExchangeReceived(exchange -> { throw new ConnectException("Forced cannot connect to database"); }); mockB.expectedMessageCount(0); // use NotifyBuilder to know that after 1+6 (1 original + 6 redelivery) attempts from ActiveMQ NotifyBuilder notify = new NotifyBuilder(context).whenExactlyDone(7).whenDoneSatisfied(mockA).whenDoneSatisfied(mockB).create(); template.sendBodyAndHeader("activemq2:queue:inbox", "A", "uid", 123); assertTrue(notify.matchesWaitTime(), "Should complete 7 messages"); // Start by checking the DLQ queue to prevent a mix-up between client and server resources being part of the same transaction // the message should have been moved to the AMQ DLQ queue assertEquals("A", consumer.receiveBody("activemq2:queue:DLQ", 3000)); // check that there is no message in the database and JMS queue assertEquals(0, jdbcTemplate.queryForObject("select count(*) from CAMEL_MESSAGEPROCESSED", int.class)); assertNull(consumer.receiveBody("activemq2:queue:outbox", 100)); } @Test void testJmsToJdbcJmsRollbackAtB() { checkInitialState(); mockA.expectedMessageCount(7); mockB.expectedMessageCount(7); mockB.whenAnyExchangeReceived(exchange -> { throw new ConnectException("Forced cannot send to AMQ queue"); }); // use NotifyBuilder to know that after 1+6 (1 original + 6 redelivery) attempts from ActiveMQ NotifyBuilder notify = new NotifyBuilder(context).whenExactlyDone(7).whenDoneSatisfied(mockA).whenDoneSatisfied(mockB).create(); template.sendBodyAndHeader("activemq2:queue:inbox", "B", "uid", 456); assertTrue(notify.matchesWaitTime(), "Should complete 7 messages"); // Start by checking the DLQ queue to prevent a mix-up between client and server resources being part of the same transaction // the message should have been moved to the AMQ DLQ queue assertEquals("B", consumer.receiveBody("activemq2:queue:DLQ", 3000)); // check that there is no message in the database and JMS queue assertEquals(0, jdbcTemplate.queryForObject("select count(*) from CAMEL_MESSAGEPROCESSED", int.class)); assertNull(consumer.receiveBody("activemq2:queue:outbox", 100)); } @Test void testFilterIdempotent() { checkInitialState(); mockA.expectedMessageCount(3); mockB.expectedMessageCount(2); // use NotifyBuilder to know when the message is done NotifyBuilder notify = new NotifyBuilder(context).whenExactlyDone(3).whenDoneSatisfied(mockA).whenDoneSatisfied(mockB).create(); template.sendBodyAndHeader("activemq2:queue:inbox", "D", "uid", 111); template.sendBodyAndHeader("activemq2:queue:inbox", "E", "uid", 222); template.sendBodyAndHeader("activemq2:queue:inbox", "D", "uid", 111); assertTrue(notify.matchesWaitTime(), "Should complete 3 messages"); // check that there is two messages in the database and JMS queue assertEquals(2, jdbcTemplate.queryForObject("select count(*) from CAMEL_MESSAGEPROCESSED", int.class)); assertEquals("DONE-D", consumer.receiveBody("activemq2:queue:outbox", 3000)); assertEquals("DONE-E", consumer.receiveBody("activemq2:queue:outbox", 3000)); } @Test void testRetryAfterException() { checkInitialState(); mockA.expectedMessageCount(4); mockB.expectedMessageCount(4); mockB.whenAnyExchangeReceived(new Processor() { private boolean alreadyErrorThrown; @Override public void process(Exchange exchange) throws Exception { if (!alreadyErrorThrown) { alreadyErrorThrown = true; throw new ConnectException("Forced cannot send to AMQ queue"); } else { logger.info("Now successfully recovered from the error and can connect to AMQ queue"); } } }); // use NotifyBuilder to know when the message is done NotifyBuilder notify = new NotifyBuilder(context).whenExactlyDone(4).whenDoneSatisfied(mockA).whenDoneSatisfied(mockB).create(); template.sendBodyAndHeader("activemq2:queue:inbox", "D", "uid", 111); template.sendBodyAndHeader("activemq2:queue:inbox", "E", "uid", 222); template.sendBodyAndHeader("activemq2:queue:inbox", "F", "uid", 333); assertTrue(notify.matchesWaitTime(), "Should complete 4 messages"); // check that there is three messages in the database and JMS queue assertEquals(3, jdbcTemplate.queryForObject("select count(*) from CAMEL_MESSAGEPROCESSED", int.class)); assertEquals("DONE-D", consumer.receiveBody("activemq2:queue:outbox", 3000)); assertEquals("DONE-E", consumer.receiveBody("activemq2:queue:outbox", 3000)); assertEquals("DONE-F", consumer.receiveBody("activemq2:queue:outbox", 3000)); } protected void checkInitialState() { // check there are no messages in the database and JMS queue assertEquals(0, jdbcTemplate.queryForObject("select count(*) from CAMEL_MESSAGEPROCESSED", int.class)); assertNull(consumer.receiveBody("activemq2:queue:outbox", 100)); } @Override protected RouteBuilder createRouteBuilder() { return new RouteBuilder() { @Override public void configure() { from("activemq2:queue:inbox") .transacted("required") .to(mockA) .idempotentConsumer(header("uid")) .idempotentRepository("messageIdRepository") .to(mockB) .transform(simple("DONE-${body}")) .to("activemq2:queue:outbox"); } }; } }
FromJmsToJdbcIdempotentConsumerToJmsTest
java
apache__hadoop
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-tests/src/test/java/org/apache/hadoop/yarn/server/timelineservice/TestTimelineServiceClientIntegration.java
{ "start": 7341, "end": 8178 }
class ____ extends NodeTimelineCollectorManager { public MockNodeTimelineCollectorManager() { super(); } @Override protected CollectorNodemanagerProtocol getNMCollectorService() { CollectorNodemanagerProtocol protocol = mock(CollectorNodemanagerProtocol.class); try { GetTimelineCollectorContextResponse response = GetTimelineCollectorContextResponse.newInstance( UserGroupInformation.getCurrentUser().getShortUserName(), "test_flow_name", "test_flow_version", 1L); when(protocol.getTimelineCollectorContext(any( GetTimelineCollectorContextRequest.class))).thenReturn(response); } catch (YarnException | IOException e) { fail(); } return protocol; } } }
MockNodeTimelineCollectorManager
java
apache__hadoop
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/FsUsage.java
{ "start": 1561, "end": 2378 }
class ____ extends FsCommand { public static void registerCommands(CommandFactory factory) { factory.addClass(Df.class, "-df"); factory.addClass(Du.class, "-du"); factory.addClass(Dus.class, "-dus"); } private boolean humanReadable = false; private TableBuilder usagesTable; protected String formatSize(long size) { return humanReadable ? StringUtils.TraditionalBinaryPrefix.long2String(size, "", 1) : String.valueOf(size); } public TableBuilder getUsagesTable() { return usagesTable; } public void setUsagesTable(TableBuilder usagesTable) { this.usagesTable = usagesTable; } public void setHumanReadable(boolean humanReadable) { this.humanReadable = humanReadable; } /** Show the size of a partition in the filesystem */ public static
FsUsage
java
quarkusio__quarkus
independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/instance/InjectableInstanceTest.java
{ "start": 2282, "end": 2487 }
class ____ { @Inject InjectableInstance<Washcloth> washcloth; @Inject Instance<Sponge> sponge; void doSomething() { } } @Dependent static
Alpha
java
elastic__elasticsearch
test/framework/src/main/java/org/elasticsearch/test/TestEsExecutors.java
{ "start": 603, "end": 1402 }
class ____ { /** * Other than EsExecutors.daemonThreadFactory this doesn't follow the general naming pattern of ES threads: * {@code elasticsearch[<nodeName>][<executorName>][T#<threadNumber>]}. * This is sometimes desirable to easily distinguish test threads from ES threads. */ public static ThreadFactory testOnlyDaemonThreadFactory(final String name) { assert name != null && name.isEmpty() == false; final AtomicInteger threadNumber = new AtomicInteger(1); final ThreadGroup group = Thread.currentThread().getThreadGroup(); return runnable -> { Thread t = new Thread(group, runnable, name + "[T#" + threadNumber.getAndIncrement() + "]"); t.setDaemon(true); return t; }; } }
TestEsExecutors
java
apache__commons-lang
src/main/java/org/apache/commons/lang3/function/ToBooleanBiFunction.java
{ "start": 1250, "end": 1532 }
interface ____<T, U> { /** * Applies this function to the given arguments. * * @param t the first function argument. * @param u the second function argument. * @return the function result. */ boolean applyAsBoolean(T t, U u); }
ToBooleanBiFunction
java
hibernate__hibernate-orm
hibernate-core/src/main/java/org/hibernate/sql/results/graph/entity/internal/DiscriminatedEntityFetch.java
{ "start": 916, "end": 2897 }
class ____ extends AbstractDiscriminatedEntityResultGraphNode implements Fetch, InitializerProducer<DiscriminatedEntityFetch> { private final FetchTiming fetchTiming; private final FetchParent fetchParent; public DiscriminatedEntityFetch( NavigablePath navigablePath, JavaType<?> baseAssociationJtd, DiscriminatedAssociationModelPart fetchedPart, FetchTiming fetchTiming, FetchParent fetchParent, DomainResultCreationState creationState) { super( navigablePath, fetchedPart, baseAssociationJtd ); this.fetchTiming = fetchTiming; this.fetchParent = fetchParent; afterInitialize( creationState ); } @Override public FetchParent getFetchParent() { return fetchParent; } @Override public DiscriminatedAssociationModelPart getFetchedMapping() { return getReferencedMappingContainer(); } @Override public FetchTiming getTiming() { return fetchTiming; } @Override public boolean hasTableGroup() { return false; } @Override public DomainResultAssembler<?> createAssembler( InitializerParent<?> parent, AssemblerCreationState creationState) { return new EntityAssembler<>( getReferencedMappingContainer().getJavaType(), creationState.resolveInitializer( this, parent, this ).asEntityInitializer() ); } @Override public Initializer<?> createInitializer( DiscriminatedEntityFetch resultGraphNode, InitializerParent<?> parent, AssemblerCreationState creationState) { return resultGraphNode.createInitializer( parent, creationState ); } @Override public Initializer<?> createInitializer(InitializerParent<?> parent, AssemblerCreationState creationState) { return new DiscriminatedEntityInitializer( parent, getReferencedMappingType(), getNavigablePath(), getDiscriminatorValueFetch(), getKeyValueFetch(), fetchTiming == FetchTiming.IMMEDIATE, false, creationState ); } @Override public FetchParent asFetchParent() { return this; } }
DiscriminatedEntityFetch
java
spring-projects__spring-framework
spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/AspectJAdvisorFactory.java
{ "start": 1837, "end": 1950 }
class ____ recognized by AspectJ as an aspect class */ boolean isAspect(Class<?> clazz); /** * Is the given
is
java
apache__flink
flink-table/flink-table-api-scala/src/main/java/org/apache/flink/table/api/typeutils/ScalaEitherSerializerSnapshot.java
{ "start": 1238, "end": 2535 }
class ____<L, R> extends CompositeTypeSerializerSnapshot<Either<L, R>, EitherSerializer<L, R>> { private static final int CURRENT_VERSION = 1; /** Constructor for read instantiation. */ public ScalaEitherSerializerSnapshot() {} /** Constructor to create the snapshot for writing. */ public ScalaEitherSerializerSnapshot(EitherSerializer<L, R> eitherSerializer) { super(eitherSerializer); } @Override public int getCurrentOuterSnapshotVersion() { return CURRENT_VERSION; } @Override protected EitherSerializer<L, R> createOuterSerializerWithNestedSerializers( TypeSerializer<?>[] nestedSerializers) { @SuppressWarnings("unchecked") TypeSerializer<L> leftSerializer = (TypeSerializer<L>) nestedSerializers[0]; @SuppressWarnings("unchecked") TypeSerializer<R> rightSerializer = (TypeSerializer<R>) nestedSerializers[1]; return new EitherSerializer<>(leftSerializer, rightSerializer); } @Override protected TypeSerializer<?>[] getNestedSerializers(EitherSerializer<L, R> outerSerializer) { return new TypeSerializer<?>[] { outerSerializer.getLeftSerializer(), outerSerializer.getRightSerializer() }; } }
ScalaEitherSerializerSnapshot
java
elastic__elasticsearch
x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/aggs/changepoint/ChangePointAggregatorTests.java
{ "start": 1814, "end": 15298 }
class ____ extends AggregatorTestCase { private static final Logger logger = LogManager.getLogger(ChangePointAggregator.class); @Override protected List<SearchPlugin> getSearchPlugins() { return List.of(MachineLearningTests.createTrialLicensedMachineLearning(Settings.EMPTY)); } private static final DateHistogramInterval INTERVAL = DateHistogramInterval.minutes(1); private static final String NUMERIC_FIELD_NAME = "value"; private static final String TIME_FIELD_NAME = "timestamp"; public void testConstant() throws IOException { double[] bucketValues = DoubleStream.generate(() -> 10).limit(100).toArray(); testChangeType( bucketValues, changeType -> assertThat(Arrays.toString(bucketValues), changeType, instanceOf(ChangeType.Stationary.class)) ); } public void testSlopeUp() throws IOException { NormalDistribution normal = new NormalDistribution(RandomGeneratorFactory.createRandomGenerator(Randomness.get()), 0, 2); AtomicInteger i = new AtomicInteger(); double[] bucketValues = DoubleStream.generate(() -> i.addAndGet(1) + normal.sample()).limit(40).toArray(); testChangeType(bucketValues, changeType -> { if (changeType instanceof ChangeType.NonStationary) { assertThat(Arrays.toString(bucketValues), ((ChangeType.NonStationary) changeType).getTrend(), equalTo("increasing")); } else { // Handle infrequent false positives. assertThat(changeType, instanceOf(ChangeType.TrendChange.class)); } }); } public void testSlopeDown() throws IOException { NormalDistribution normal = new NormalDistribution(RandomGeneratorFactory.createRandomGenerator(Randomness.get()), 0, 2); AtomicInteger i = new AtomicInteger(40); double[] bucketValues = DoubleStream.generate(() -> i.decrementAndGet() + normal.sample()).limit(40).toArray(); testChangeType(bucketValues, changeType -> { if (changeType instanceof ChangeType.NonStationary) { assertThat(Arrays.toString(bucketValues), ((ChangeType.NonStationary) changeType).getTrend(), equalTo("decreasing")); } else { // Handle infrequent false positives. assertThat(changeType, instanceOf(ChangeType.TrendChange.class)); } }); } public void testSlopeChange() throws IOException { NormalDistribution normal = new NormalDistribution(RandomGeneratorFactory.createRandomGenerator(Randomness.get()), 0, 1); AtomicInteger i = new AtomicInteger(); double[] bucketValues = DoubleStream.concat( DoubleStream.generate(() -> 10 + normal.sample()).limit(30), DoubleStream.generate(() -> (11 + 2 * i.incrementAndGet()) + normal.sample()).limit(20) ).toArray(); testChangeType(bucketValues, changeType -> { assertThat( Arrays.toString(bucketValues), changeType, anyOf(instanceOf(ChangeType.TrendChange.class), instanceOf(ChangeType.NonStationary.class)) ); if (changeType instanceof ChangeType.NonStationary nonStationary) { assertThat(nonStationary.getTrend(), equalTo("increasing")); } }); } public void testSpike() throws IOException { NormalDistribution normal = new NormalDistribution(RandomGeneratorFactory.createRandomGenerator(Randomness.get()), 0, 2); double[] bucketValues = DoubleStream.concat( DoubleStream.generate(() -> 10 + normal.sample()).limit(40), DoubleStream.concat(DoubleStream.of(30 + normal.sample()), DoubleStream.generate(() -> 10 + normal.sample()).limit(40)) ).toArray(); testChangeType(bucketValues, changeType -> { assertThat( Arrays.toString(bucketValues), changeType, anyOf(instanceOf(ChangeType.Spike.class), instanceOf(ChangeType.DistributionChange.class)) ); if (changeType instanceof ChangeType.Spike) { assertThat(changeType.changePoint(), equalTo(40)); } }); } public void testDip() throws IOException { NormalDistribution normal = new NormalDistribution(RandomGeneratorFactory.createRandomGenerator(Randomness.get()), 0, 1); double[] bucketValues = DoubleStream.concat( DoubleStream.generate(() -> 100 + normal.sample()).limit(40), DoubleStream.concat(DoubleStream.of(30 + normal.sample()), DoubleStream.generate(() -> 100 + normal.sample()).limit(40)) ).toArray(); testChangeType(bucketValues, changeType -> { assertThat( Arrays.toString(bucketValues), changeType, anyOf(instanceOf(ChangeType.Dip.class), instanceOf(ChangeType.DistributionChange.class)) ); if (changeType instanceof ChangeType.Dip) { assertThat(changeType.changePoint(), equalTo(40)); } }); } public void testStepChange() throws IOException { NormalDistribution normal = new NormalDistribution(RandomGeneratorFactory.createRandomGenerator(Randomness.get()), 0, 1); double[] bucketValues = DoubleStream.concat( DoubleStream.generate(() -> 10 + normal.sample()).limit(20), DoubleStream.generate(() -> 30 + normal.sample()).limit(20) ).toArray(); testChangeType(bucketValues, changeType -> { assertThat( Arrays.toString(bucketValues), changeType, anyOf( // Due to the random nature of the values generated, either of these could be detected instanceOf(ChangeType.StepChange.class), instanceOf(ChangeType.TrendChange.class) ) ); assertThat(changeType.changePoint(), equalTo(20)); }); } public void testDistributionChange() throws IOException { NormalDistribution first = new NormalDistribution(RandomGeneratorFactory.createRandomGenerator(Randomness.get()), 0, 1); NormalDistribution second = new NormalDistribution(RandomGeneratorFactory.createRandomGenerator(Randomness.get()), 0, 5); double[] bucketValues = DoubleStream.concat( DoubleStream.generate(first::sample).limit(50), DoubleStream.generate(second::sample).limit(50) ).toArray(); testChangeType( bucketValues, changeType -> assertThat( Arrays.toString(bucketValues), changeType, anyOf( // Due to the random nature of the values generated, any of these could be detected // Distribution change is a "catch anything weird" if previous checks didn't find anything instanceOf(ChangeType.DistributionChange.class), instanceOf(ChangeType.Stationary.class), instanceOf(ChangeType.Spike.class), instanceOf(ChangeType.Dip.class), instanceOf(ChangeType.TrendChange.class) ) ) ); } public void testZeroDeviation() throws IOException { { double[] bucketValues = DoubleStream.generate(() -> 4243.1621621621625).limit(30).toArray(); testChangeType(bucketValues, changeType -> { assertThat(changeType, instanceOf(ChangeType.Stationary.class)); }); } { double[] bucketValues = DoubleStream.generate(() -> -4243.1621621621625).limit(30).toArray(); testChangeType(bucketValues, changeType -> { assertThat(changeType, instanceOf(ChangeType.Stationary.class)); }); } } public void testStepChangeEdgeCaseScenarios() throws IOException { double[] bucketValues = new double[] { 214505.0, 193747.0, 204368.0, 193905.0, 152777.0, 203945.0, 163390.0, 163597.0, 214807.0, 224819.0, 214245.0, 21482.0, 22264.0, 21972.0, 22309.0, 21506.0, 21365.0, 21928.0, 21973.0, 23105.0, 22118.0, 22165.0, 21388.0 }; testChangeType(bucketValues, changeType -> { assertThat(changeType, instanceOf(ChangeType.StepChange.class)); assertThat(Arrays.toString(bucketValues), changeType.changePoint(), equalTo(11)); }); } public void testSpikeSelectionVsChange() throws IOException { double[] bucketValues = new double[] { 3443.0, 3476.0, 3466.0, 3567.0, 3658.0, 3445.0, 3523.0, 3477.0, 3585.0, 3645.0, 3371.0, 3361.0, 3542.0, 3471.0, 3511.0, 3485.0, 3400.0, 3386.0, 3405.0, 3387.0, 3523.0, 3492.0, 3543.0, 3374.0, 3327.0, 3320.0, 3432.0, 3413.0, 3439.0, 3378.0, 3595.0, 3364.0, 3461.0, 3418.0, 3410.0, 3410.0, 3429.0, 3504.0, 3485.0, 3514.0, 3413.0, 3482.0, 3390.0, 3337.0, 3548.0, 3446.0, 3409.0, 3359.0, 3358.0, 3543.0, 3441.0, 3545.0, 3491.0, 3424.0, 3375.0, 3413.0, 3403.0, 3500.0, 3415.0, 3453.0, 3404.0, 3466.0, 3448.0, 3603.0, 3479.0, 3295.0, 3322.0, 3445.0, 3482.0, 3393.0, 3520.0, 3413.0, 7568.0, 4747.0, 3386.0, 3406.0, 3444.0, 3494.0, 3375.0, 3305.0, 3434.0, 3429.0, 3867.0, 5147.0, 3560.0, 3359.0, 3347.0, 3391.0, 3338.0, 3278.0, 3251.0, 3373.0, 3450.0, 3356.0, 3285.0, 3357.0, 3338.0, 3361.0, 3400.0, 3281.0, 3346.0, 3345.0, 3380.0, 3383.0, 3405.0, 3308.0, 3286.0, 3356.0, 3384.0, 3326.0, 3441.0, 3445.0, 3377.0, 3379.0, 3473.0, 3366.0, 3317.0, 3352.0, 3267.0, 3345.0, 3465.0, 3309.0, 3455.0, 3379.0, 3305.0, 3287.0, 3442.0, 3389.0, 3365.0, 3442.0, 3339.0, 3298.0, 3348.0, 3377.0, 3371.0, 3428.0, 3460.0, 3376.0, 3306.0, 3300.0, 3404.0, 3469.0, 3393.0, 3302.0 }; testChangeType(bucketValues, changeType -> { assertThat(changeType, instanceOf(ChangeType.Spike.class)); assertThat(Arrays.toString(bucketValues), changeType.changePoint(), equalTo(72)); }); } void testChangeType(double[] bucketValues, Consumer<ChangeType> changeTypeAssertions) throws IOException { FilterAggregationBuilder dummy = AggregationBuilders.filter("dummy", new MatchAllQueryBuilder()) .subAggregation( new DateHistogramAggregationBuilder("time").field(TIME_FIELD_NAME) .fixedInterval(INTERVAL) .subAggregation(AggregationBuilders.max("max").field(NUMERIC_FIELD_NAME)) ) .subAggregation(new ChangePointAggregationBuilder("changes", "time>max")); testCase(w -> writeTestDocs(w, bucketValues), (InternalFilter result) -> { InternalChangePointAggregation agg = result.getAggregations().get("changes"); changeTypeAssertions.accept(agg.getChangeType()); }, new AggTestConfig(dummy, longField(TIME_FIELD_NAME), doubleField(NUMERIC_FIELD_NAME))); } private static void writeTestDocs(RandomIndexWriter w, double[] bucketValues) throws IOException { long epoch_timestamp = 0; for (double bucketValue : bucketValues) { w.addDocument( Arrays.asList( new NumericDocValuesField(NUMERIC_FIELD_NAME, NumericUtils.doubleToSortableLong(bucketValue)), new SortedNumericDocValuesField(TIME_FIELD_NAME, epoch_timestamp) ) ); epoch_timestamp += INTERVAL.estimateMillis(); } } }
ChangePointAggregatorTests
java
junit-team__junit5
jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/TestClassPredicatesTests.java
{ "start": 13211, "end": 13358 }
class ____ { @TestTemplate void template(int a) { } } @SuppressWarnings("InnerClassMayBeStatic") private
PrivateClassWithTestTemplate