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
|
elastic__elasticsearch
|
server/src/main/java/org/elasticsearch/common/lucene/uid/Versions.java
|
{
"start": 528,
"end": 1181
}
|
class ____ {
/** used to indicate the write operation should succeed regardless of current version **/
public static final long MATCH_ANY = -3L;
/** indicates that the current document was not found in lucene and in the version map */
public static final long NOT_FOUND = -1L;
// -2 was used for docs that can be found in the index but do not have a version
/**
* used to indicate that the write operation should be executed if the document is currently deleted
* i.e., not found in the index and/or found as deleted (with version) in the version map
*/
public static final long MATCH_DELETED = -4L;
}
|
Versions
|
java
|
apache__kafka
|
connect/runtime/src/test/resources/test-plugins/read-version-from-resource-v1/test/plugins/ReadVersionFromResource.java
|
{
"start": 1347,
"end": 1698
}
|
class ____ testing classloading isolation
* See {@link org.apache.kafka.connect.runtime.isolation.TestPlugins}
* <p>Load resource(s) from the isolated classloader instance.
* Exfiltrates data via {@link ReadVersionFromResource#fromConnectData(String, Schema, Object)}
* and {@link ReadVersionFromResource#toConnectData(String, byte[])}.
*/
public
|
for
|
java
|
quarkusio__quarkus
|
extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/applicationfieldaccess/PublicFieldAccessFinalFieldTest.java
|
{
"start": 1068,
"end": 5999
}
|
class ____ {
@RegisterExtension
static QuarkusUnitTest runner = new QuarkusUnitTest()
.withApplicationRoot((jar) -> jar
.addClass(TransactionTestUtils.class)
.addClasses(
EntityWithFinalField.class,
EntityWithEmbeddedIdWithFinalField.class, EntityWithEmbeddedIdWithFinalField.EmbeddableId.class,
EntityWithEmbeddedNonIdWithFinalField.class,
EntityWithEmbeddedNonIdWithFinalField.EmbeddableNonId.class))
.withConfigurationResource("application.properties");
@Inject
EntityManager em;
@Inject
UserTransaction transaction;
@Test
public void entityWithFinalField_constructor() {
EntityWithFinalField entity = new EntityWithFinalField("foo");
assertThat(entity.immutableProperty).isEqualTo("foo");
}
// Just test that the embedded non-ID works correctly over a persist/retrieve cycle
@Test
public void entityWithFinalField_smokeTest() {
EntityWithFinalField persistedEntity = new EntityWithFinalField("foo");
persistedEntity.name = "Some name";
inTransaction(() -> {
em.persist(persistedEntity);
});
inTransaction(() -> {
EntityWithFinalField entity = em.find(EntityWithFinalField.class, persistedEntity.id);
assertThat(entity).extracting(e -> e.immutableProperty)
.isEqualTo(persistedEntity.immutableProperty);
});
}
// Just test that the embedded ID works correctly over a persist/retrieve cycle
@Test
public void embeddableIdWithFinalField_smokeTest() {
EntityWithEmbeddedIdWithFinalField persistedEntity = new EntityWithEmbeddedIdWithFinalField();
persistedEntity.name = "Some name";
inTransaction(() -> {
em.persist(persistedEntity);
});
// Read with the same ID instance
inTransaction(() -> {
EntityWithEmbeddedIdWithFinalField entity = em.find(EntityWithEmbeddedIdWithFinalField.class,
persistedEntity.id);
assertThat(entity).extracting(e -> e.id).extracting(i -> i.id)
.isEqualTo(persistedEntity.id.id);
});
// Read with a new ID instance
inTransaction(() -> {
EntityWithEmbeddedIdWithFinalField entity = em.find(EntityWithEmbeddedIdWithFinalField.class,
EntityWithEmbeddedIdWithFinalField.EmbeddableId.of(persistedEntity.id.id));
assertThat(entity).extracting(e -> e.id).extracting(i -> i.id)
.isEqualTo(persistedEntity.id.id);
});
// Read with a query
// This is special because in this particular test,
// we know Hibernate ORM *has to* instantiate the EmbeddableIdType itself:
// it cannot reuse the ID we passed.
// And since the EmbeddableIdType has a final field, instantiation will not be able to use a no-arg constructor...
inTransaction(() -> {
EntityWithEmbeddedIdWithFinalField entity = em
.createQuery("from embidwithfinal e where e.name = :name", EntityWithEmbeddedIdWithFinalField.class)
.setParameter("name", persistedEntity.name)
.getSingleResult();
assertThat(entity).extracting(e -> e.id).extracting(i -> i.id)
.isEqualTo(persistedEntity.id.id);
});
}
@Test
public void embeddableNonIdWithFinalField_constructor() {
EntityWithEmbeddedNonIdWithFinalField.EmbeddableNonId embeddable = new EntityWithEmbeddedNonIdWithFinalField.EmbeddableNonId(
"foo");
assertThat(embeddable.immutableProperty).isEqualTo("foo");
}
// Just test that the embedded non-ID works correctly over a persist/retrieve cycle
@Test
public void embeddableNonIdWithFinalField_smokeTest() {
EntityWithEmbeddedNonIdWithFinalField persistedEntity = new EntityWithEmbeddedNonIdWithFinalField();
persistedEntity.name = "Some name";
persistedEntity.embedded = new EntityWithEmbeddedNonIdWithFinalField.EmbeddableNonId("foo");
inTransaction(() -> {
em.persist(persistedEntity);
});
inTransaction(() -> {
EntityWithEmbeddedNonIdWithFinalField entity = em.find(EntityWithEmbeddedNonIdWithFinalField.class,
persistedEntity.id);
assertThat(entity).extracting(e -> e.embedded)
.extracting(emb -> emb.immutableProperty)
.isEqualTo(persistedEntity.embedded.immutableProperty);
});
}
private void inTransaction(Runnable runnable) {
TransactionTestUtils.inTransaction(transaction, runnable);
}
@Entity(name = "withfinal")
public static
|
PublicFieldAccessFinalFieldTest
|
java
|
quarkusio__quarkus
|
integration-tests/main/src/main/java/io/quarkus/it/validator/TestValidatorEndpoint.java
|
{
"start": 328,
"end": 766
}
|
class ____ {
@Inject
Validator validator;
@POST
@Path("/manual")
@Consumes("application/json")
public String manualValidation(MyData data) {
Set<ConstraintViolation<MyData>> result = validator.validate(data);
if (result.isEmpty()) {
return "passed";
}
return "failed:" + result.iterator().next().getPropertyPath().toString();
}
public static
|
TestValidatorEndpoint
|
java
|
elastic__elasticsearch
|
modules/lang-painless/src/test/java/org/elasticsearch/painless/TestFieldScript.java
|
{
"start": 622,
"end": 798
}
|
class ____ {
private final List<Long> values = new ArrayList<>();
@SuppressWarnings("unused")
public static final String[] PARAMETERS = {};
public
|
TestFieldScript
|
java
|
elastic__elasticsearch
|
x-pack/plugin/text-structure/src/main/java/org/elasticsearch/xpack/textstructure/structurefinder/TextStructureFinderFactory.java
|
{
"start": 430,
"end": 3453
}
|
interface ____ {
/**
* Can this factory create a {@link TextStructureFinder} that can find the supplied format?
* @param format The format to query, or <code>null</code>.
* @return <code>true</code> if {@code format} is <code>null</code> or the factory
* can produce a {@link TextStructureFinder} that can find {@code format}.
*/
boolean canFindFormat(TextStructure.Format format);
/**
* Given some sample text, decide whether this factory will be able
* to create an appropriate object to represent its ingestion configs.
* @param explanation List of reasons for making decisions. May contain items when passed and new reasons
* can be appended by this method.
* @param sample A sample from the text to be ingested.
* @param allowedFractionOfBadLines How many lines of the passed sample are allowed to be considered "bad".
* Provided as a fraction from interval [0, 1]
* @return <code>true</code> if this factory can create an appropriate
* text structure given the sample; otherwise <code>false</code>.
*/
boolean canCreateFromSample(List<String> explanation, String sample, double allowedFractionOfBadLines);
boolean canCreateFromMessages(List<String> explanation, List<String> messages, double allowedFractionOfBadMessages);
/**
* Create an object representing the structure of some text.
* @param explanation List of reasons for making decisions. May contain items when passed and new reasons
* can be appended by this method.
* @param sample A sample from the text to be ingested.
* @param charsetName The name of the character set in which the sample was provided.
* @param hasByteOrderMarker Did the sample have a byte order marker? <code>null</code> means "not relevant".
* @param lineMergeSizeLimit Maximum number of characters permitted when lines are merged to create messages.
* @param overrides Stores structure decisions that have been made by the end user, and should
* take precedence over anything the {@link TextStructureFinder} may decide.
* @param timeoutChecker Will abort the operation if its timeout is exceeded.
* @return A {@link TextStructureFinder} object suitable for determining the structure of the supplied sample.
* @throws Exception if something goes wrong during creation.
*/
TextStructureFinder createFromSample(
List<String> explanation,
String sample,
String charsetName,
Boolean hasByteOrderMarker,
int lineMergeSizeLimit,
TextStructureOverrides overrides,
TimeoutChecker timeoutChecker
) throws Exception;
TextStructureFinder createFromMessages(
List<String> explanation,
List<String> messages,
TextStructureOverrides overrides,
TimeoutChecker timeoutChecker
) throws Exception;
}
|
TextStructureFinderFactory
|
java
|
apache__hadoop
|
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileSystemTestHelper.java
|
{
"start": 1329,
"end": 1362
}
|
class ____ unit tests.
*/
public
|
for
|
java
|
apache__hadoop
|
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/TestFcHdfsPermission.java
|
{
"start": 1318,
"end": 2717
}
|
class ____ extends FileContextPermissionBase {
private static final FileContextTestHelper fileContextTestHelper =
new FileContextTestHelper("/tmp/TestFcHdfsPermission");
private static FileContext fc;
private static MiniDFSCluster cluster;
private static Path defaultWorkingDirectory;
@Override
protected FileContextTestHelper getFileContextHelper() {
return fileContextTestHelper;
}
@Override
protected FileContext getFileContext() {
return fc;
}
@BeforeAll
public static void clusterSetupAtBegining()
throws IOException, LoginException, URISyntaxException {
Configuration conf = new HdfsConfiguration();
cluster = new MiniDFSCluster.Builder(conf).numDataNodes(2).build();
fc = FileContext.getFileContext(cluster.getURI(0), conf);
defaultWorkingDirectory = fc.makeQualified( new Path("/user/" +
UserGroupInformation.getCurrentUser().getShortUserName()));
fc.mkdir(defaultWorkingDirectory, FileContext.DEFAULT_PERM, true);
}
@AfterAll
public static void ClusterShutdownAtEnd() throws Exception {
if (cluster != null) {
cluster.shutdown();
}
}
@Override
@BeforeEach
public void setUp() throws Exception {
super.setUp();
}
@Override
@AfterEach
public void tearDown() throws Exception {
super.tearDown();
}
}
|
TestFcHdfsPermission
|
java
|
hibernate__hibernate-orm
|
hibernate-core/src/test/java/org/hibernate/orm/test/filter/CriteriaQueryWithAppliedFilterTest.java
|
{
"start": 10788,
"end": 11051
}
|
class ____ implements Serializable {
private Integer id1;
@Embedded
private Identifier2 id2;
public Identifier() {
}
public Identifier(Integer id1, Identifier2 id2) {
this.id1 = id1;
this.id2 = id2;
}
}
@Embeddable
public static
|
Identifier
|
java
|
elastic__elasticsearch
|
server/src/test/java/org/elasticsearch/index/search/nested/AbstractNumberNestedSortingTestCase.java
|
{
"start": 1997,
"end": 18762
}
|
class ____ extends AbstractFieldDataTestCase {
@Override
protected boolean hasDocValues() {
return true;
}
public void testNestedSorting() throws Exception {
List<Document> docs = new ArrayList<>();
Document document = new Document();
document.add(createField("field2", 3));
document.add(new StringField("filter_1", "T", Field.Store.NO));
docs.add(document);
document = new Document();
document.add(createField("field2", 3));
document.add(new StringField("filter_1", "T", Field.Store.NO));
docs.add(document);
document = new Document();
document.add(createField("field2", 3));
document.add(new StringField("filter_1", "T", Field.Store.NO));
docs.add(document);
document = new Document();
document.add(new StringField("__type", "parent", Field.Store.NO));
document.add(createField("field1", 1));
docs.add(document);
writer.addDocuments(docs);
writer.commit();
docs.clear();
document = new Document();
document.add(createField("field2", 3));
document.add(new StringField("filter_1", "T", Field.Store.NO));
docs.add(document);
document = new Document();
document.add(createField("field2", 3));
document.add(new StringField("filter_1", "T", Field.Store.NO));
docs.add(document);
document = new Document();
document.add(createField("field2", 2));
document.add(new StringField("filter_1", "T", Field.Store.NO));
docs.add(document);
document = new Document();
document.add(new StringField("__type", "parent", Field.Store.NO));
document.add(createField("field1", 2));
docs.add(document);
writer.addDocuments(docs);
docs.clear();
document = new Document();
document.add(createField("field2", 3));
document.add(new StringField("filter_1", "T", Field.Store.NO));
docs.add(document);
document = new Document();
document.add(createField("field2", 3));
document.add(new StringField("filter_1", "T", Field.Store.NO));
docs.add(document);
document = new Document();
document.add(createField("field2", 1));
document.add(new StringField("filter_1", "T", Field.Store.NO));
docs.add(document);
document = new Document();
document.add(new StringField("__type", "parent", Field.Store.NO));
document.add(createField("field1", 3));
docs.add(document);
writer.addDocuments(docs);
docs.clear();
document = new Document();
document.add(createField("field2", 3));
document.add(new StringField("filter_1", "T", Field.Store.NO));
docs.add(document);
document = new Document();
document.add(createField("field2", 3));
document.add(new StringField("filter_1", "F", Field.Store.NO));
docs.add(document);
document = new Document();
document.add(createField("field2", 4));
document.add(new StringField("filter_1", "F", Field.Store.NO));
docs.add(document);
document = new Document();
document.add(new StringField("__type", "parent", Field.Store.NO));
document.add(createField("field1", 4));
docs.add(document);
writer.addDocuments(docs);
writer.commit();
docs.clear();
document = new Document();
document.add(createField("field2", 3));
document.add(new StringField("filter_1", "F", Field.Store.NO));
docs.add(document);
document = new Document();
document.add(createField("field2", 3));
document.add(new StringField("filter_1", "F", Field.Store.NO));
docs.add(document);
document = new Document();
document.add(createField("field2", 5));
document.add(new StringField("filter_1", "F", Field.Store.NO));
docs.add(document);
document = new Document();
document.add(new StringField("__type", "parent", Field.Store.NO));
document.add(createField("field1", 5));
docs.add(document);
writer.addDocuments(docs);
writer.commit();
docs.clear();
document = new Document();
document.add(createField("field2", 3));
document.add(new StringField("filter_1", "T", Field.Store.NO));
docs.add(document);
document = new Document();
document.add(createField("field2", 3));
document.add(new StringField("filter_1", "T", Field.Store.NO));
docs.add(document);
document = new Document();
document.add(createField("field2", 6));
document.add(new StringField("filter_1", "T", Field.Store.NO));
docs.add(document);
document = new Document();
document.add(new StringField("__type", "parent", Field.Store.NO));
document.add(createField("field1", 6));
docs.add(document);
writer.addDocuments(docs);
writer.commit();
// This doc will not be included, because it doesn't have nested docs
document = new Document();
document.add(new StringField("__type", "parent", Field.Store.NO));
document.add(createField("field1", 7));
writer.addDocument(document);
writer.commit();
docs.clear();
document = new Document();
document.add(createField("field2", 3));
document.add(new StringField("filter_1", "T", Field.Store.NO));
docs.add(document);
document = new Document();
document.add(createField("field2", 3));
document.add(new StringField("filter_1", "F", Field.Store.NO));
docs.add(document);
document = new Document();
document.add(createField("field2", 7));
document.add(new StringField("filter_1", "F", Field.Store.NO));
docs.add(document);
document = new Document();
document.add(new StringField("__type", "parent", Field.Store.NO));
document.add(createField("field1", 8));
docs.add(document);
writer.addDocuments(docs);
writer.commit();
// Some garbage docs, just to check if the NestedFieldComparator can deal with this.
document = new Document();
document.add(new StringField("fieldXXX", "x", Field.Store.NO));
writer.addDocument(document);
document = new Document();
document.add(new StringField("fieldXXX", "x", Field.Store.NO));
writer.addDocument(document);
document = new Document();
document.add(new StringField("fieldXXX", "x", Field.Store.NO));
writer.addDocument(document);
MultiValueMode sortMode = MultiValueMode.SUM;
DirectoryReader directoryReader = DirectoryReader.open(writer);
directoryReader = ElasticsearchDirectoryReader.wrap(directoryReader, new ShardId(indexService.index(), 0));
IndexSearcher searcher = newSearcher(directoryReader, false);
Query parentFilter = new TermQuery(new Term("__type", "parent"));
Query childFilter = Queries.not(parentFilter);
XFieldComparatorSource nestedComparatorSource = createFieldComparator(
"field2",
sortMode,
null,
createNested(searcher, parentFilter, childFilter)
);
ToParentBlockJoinQuery query = new ToParentBlockJoinQuery(
new ConstantScoreQuery(childFilter),
new QueryBitSetProducer(parentFilter),
ScoreMode.None
);
Sort sort = new Sort(new SortField("field2", nestedComparatorSource));
TopFieldDocs topDocs = searcher.search(query, 5, sort);
assertThat(topDocs.totalHits.value(), equalTo(7L));
assertThat(topDocs.scoreDocs.length, equalTo(5));
assertThat(topDocs.scoreDocs[0].doc, equalTo(11));
assertThat(((Number) ((FieldDoc) topDocs.scoreDocs[0]).fields[0]).intValue(), equalTo(7));
assertThat(topDocs.scoreDocs[1].doc, equalTo(7));
assertThat(((Number) ((FieldDoc) topDocs.scoreDocs[1]).fields[0]).intValue(), equalTo(8));
assertThat(topDocs.scoreDocs[2].doc, equalTo(3));
assertThat(((Number) ((FieldDoc) topDocs.scoreDocs[2]).fields[0]).intValue(), equalTo(9));
assertThat(topDocs.scoreDocs[3].doc, equalTo(15));
assertThat(((Number) ((FieldDoc) topDocs.scoreDocs[3]).fields[0]).intValue(), equalTo(10));
assertThat(topDocs.scoreDocs[4].doc, equalTo(19));
assertThat(((Number) ((FieldDoc) topDocs.scoreDocs[4]).fields[0]).intValue(), equalTo(11));
sort = new Sort(new SortField("field2", nestedComparatorSource, true));
topDocs = searcher.search(query, 5, sort);
assertThat(topDocs.totalHits.value(), equalTo(7L));
assertThat(topDocs.scoreDocs.length, equalTo(5));
assertThat(topDocs.scoreDocs[0].doc, equalTo(28));
assertThat(((Number) ((FieldDoc) topDocs.scoreDocs[0]).fields[0]).intValue(), equalTo(13));
assertThat(topDocs.scoreDocs[1].doc, equalTo(23));
assertThat(((Number) ((FieldDoc) topDocs.scoreDocs[1]).fields[0]).intValue(), equalTo(12));
assertThat(topDocs.scoreDocs[2].doc, equalTo(19));
assertThat(((Number) ((FieldDoc) topDocs.scoreDocs[2]).fields[0]).intValue(), equalTo(11));
assertThat(topDocs.scoreDocs[3].doc, equalTo(15));
assertThat(((Number) ((FieldDoc) topDocs.scoreDocs[3]).fields[0]).intValue(), equalTo(10));
assertThat(topDocs.scoreDocs[4].doc, equalTo(3));
assertThat(((Number) ((FieldDoc) topDocs.scoreDocs[4]).fields[0]).intValue(), equalTo(9));
childFilter = new TermQuery(new Term("filter_1", "T"));
nestedComparatorSource = createFieldComparator("field2", sortMode, null, createNested(searcher, parentFilter, childFilter));
query = new ToParentBlockJoinQuery(new ConstantScoreQuery(childFilter), new QueryBitSetProducer(parentFilter), ScoreMode.None);
sort = new Sort(new SortField("field2", nestedComparatorSource, true));
topDocs = searcher.search(query, 5, sort);
assertThat(topDocs.totalHits.value(), equalTo(6L));
assertThat(topDocs.scoreDocs.length, equalTo(5));
assertThat(topDocs.scoreDocs[0].doc, equalTo(23));
assertThat(((Number) ((FieldDoc) topDocs.scoreDocs[0]).fields[0]).intValue(), equalTo(12));
assertThat(topDocs.scoreDocs[1].doc, equalTo(3));
assertThat(((Number) ((FieldDoc) topDocs.scoreDocs[1]).fields[0]).intValue(), equalTo(9));
assertThat(topDocs.scoreDocs[2].doc, equalTo(7));
assertThat(((Number) ((FieldDoc) topDocs.scoreDocs[2]).fields[0]).intValue(), equalTo(8));
assertThat(topDocs.scoreDocs[3].doc, equalTo(11));
assertThat(((Number) ((FieldDoc) topDocs.scoreDocs[3]).fields[0]).intValue(), equalTo(7));
assertThat(topDocs.scoreDocs[4].doc, equalTo(15));
assertThat(((Number) ((FieldDoc) topDocs.scoreDocs[4]).fields[0]).intValue(), equalTo(3));
sort = new Sort(new SortField("field2", nestedComparatorSource));
topDocs = searcher.search(query, 5, sort);
assertThat(topDocs.totalHits.value(), equalTo(6L));
assertThat(topDocs.scoreDocs.length, equalTo(5));
assertThat(topDocs.scoreDocs[0].doc, equalTo(15));
assertThat(((Number) ((FieldDoc) topDocs.scoreDocs[0]).fields[0]).intValue(), equalTo(3));
assertThat(topDocs.scoreDocs[1].doc, equalTo(28));
assertThat(((Number) ((FieldDoc) topDocs.scoreDocs[1]).fields[0]).intValue(), equalTo(3));
assertThat(topDocs.scoreDocs[2].doc, equalTo(11));
assertThat(((Number) ((FieldDoc) topDocs.scoreDocs[2]).fields[0]).intValue(), equalTo(7));
assertThat(topDocs.scoreDocs[3].doc, equalTo(7));
assertThat(((Number) ((FieldDoc) topDocs.scoreDocs[3]).fields[0]).intValue(), equalTo(8));
assertThat(topDocs.scoreDocs[4].doc, equalTo(3));
assertThat(((Number) ((FieldDoc) topDocs.scoreDocs[4]).fields[0]).intValue(), equalTo(9));
nestedComparatorSource = createFieldComparator("field2", sortMode, 127, createNested(searcher, parentFilter, childFilter));
sort = new Sort(new SortField("field2", nestedComparatorSource, true));
topDocs = searcher.search(new TermQuery(new Term("__type", "parent")), 5, sort);
assertThat(topDocs.totalHits.value(), equalTo(8L));
assertThat(topDocs.scoreDocs.length, equalTo(5));
assertThat(topDocs.scoreDocs[0].doc, equalTo(19));
assertThat(((Number) ((FieldDoc) topDocs.scoreDocs[0]).fields[0]).intValue(), equalTo(127));
assertThat(topDocs.scoreDocs[1].doc, equalTo(24));
assertThat(((Number) ((FieldDoc) topDocs.scoreDocs[1]).fields[0]).intValue(), equalTo(127));
assertThat(topDocs.scoreDocs[2].doc, equalTo(23));
assertThat(((Number) ((FieldDoc) topDocs.scoreDocs[2]).fields[0]).intValue(), equalTo(12));
assertThat(topDocs.scoreDocs[3].doc, equalTo(3));
assertThat(((Number) ((FieldDoc) topDocs.scoreDocs[3]).fields[0]).intValue(), equalTo(9));
assertThat(topDocs.scoreDocs[4].doc, equalTo(7));
assertThat(((Number) ((FieldDoc) topDocs.scoreDocs[4]).fields[0]).intValue(), equalTo(8));
nestedComparatorSource = createFieldComparator("field2", sortMode, -127, createNested(searcher, parentFilter, childFilter));
sort = new Sort(new SortField("field2", nestedComparatorSource));
topDocs = searcher.search(new TermQuery(new Term("__type", "parent")), 5, sort);
assertThat(topDocs.totalHits.value(), equalTo(8L));
assertThat(topDocs.scoreDocs.length, equalTo(5));
assertThat(topDocs.scoreDocs[0].doc, equalTo(19));
assertThat(((Number) ((FieldDoc) topDocs.scoreDocs[0]).fields[0]).intValue(), equalTo(-127));
assertThat(topDocs.scoreDocs[1].doc, equalTo(24));
assertThat(((Number) ((FieldDoc) topDocs.scoreDocs[1]).fields[0]).intValue(), equalTo(-127));
assertThat(topDocs.scoreDocs[2].doc, equalTo(15));
assertThat(((Number) ((FieldDoc) topDocs.scoreDocs[2]).fields[0]).intValue(), equalTo(3));
assertThat(topDocs.scoreDocs[3].doc, equalTo(28));
assertThat(((Number) ((FieldDoc) topDocs.scoreDocs[3]).fields[0]).intValue(), equalTo(3));
assertThat(topDocs.scoreDocs[4].doc, equalTo(11));
assertThat(((Number) ((FieldDoc) topDocs.scoreDocs[4]).fields[0]).intValue(), equalTo(7));
// Moved to method, because floating point based XFieldComparatorSource have different outcome for SortMode avg,
// than integral number based implementations...
assertAvgScoreMode(parentFilter, searcher);
searcher.getIndexReader().close();
}
protected void assertAvgScoreMode(Query parentFilter, IndexSearcher searcher) throws IOException {
MultiValueMode sortMode = MultiValueMode.AVG;
Query childFilter = Queries.not(parentFilter);
XFieldComparatorSource nestedComparatorSource = createFieldComparator(
"field2",
sortMode,
-127,
createNested(searcher, parentFilter, childFilter)
);
Query query = new ToParentBlockJoinQuery(
new ConstantScoreQuery(childFilter),
new QueryBitSetProducer(parentFilter),
ScoreMode.None
);
Sort sort = new Sort(new SortField("field2", nestedComparatorSource));
TopDocs topDocs = searcher.search(query, 5, sort);
assertThat(topDocs.totalHits.value(), equalTo(7L));
assertThat(topDocs.scoreDocs.length, equalTo(5));
assertThat(topDocs.scoreDocs[0].doc, equalTo(11));
assertThat(((Number) ((FieldDoc) topDocs.scoreDocs[0]).fields[0]).intValue(), equalTo(2));
assertThat(topDocs.scoreDocs[1].doc, equalTo(3));
assertThat(((Number) ((FieldDoc) topDocs.scoreDocs[1]).fields[0]).intValue(), equalTo(3));
assertThat(topDocs.scoreDocs[2].doc, equalTo(7));
assertThat(((Number) ((FieldDoc) topDocs.scoreDocs[2]).fields[0]).intValue(), equalTo(3));
assertThat(topDocs.scoreDocs[3].doc, equalTo(15));
assertThat(((Number) ((FieldDoc) topDocs.scoreDocs[3]).fields[0]).intValue(), equalTo(3));
assertThat(topDocs.scoreDocs[4].doc, equalTo(19));
assertThat(((Number) ((FieldDoc) topDocs.scoreDocs[4]).fields[0]).intValue(), equalTo(4));
}
protected abstract IndexableField createField(String name, int value);
protected abstract IndexFieldData.XFieldComparatorSource createFieldComparator(
String fieldName,
MultiValueMode sortMode,
Object missingValue,
Nested nested
);
}
|
AbstractNumberNestedSortingTestCase
|
java
|
hibernate__hibernate-orm
|
hibernate-core/src/test/java/org/hibernate/orm/test/query/results/ImplicitInstantiationTests.java
|
{
"start": 895,
"end": 5049
}
|
class ____ {
@BeforeEach
void prepareTestData(SessionFactoryScope sessions) {
sessions.inTransaction( (session) -> {
session.persist( new SimpleEntity( 1, "first", new SimpleComposite( "value1", "value2" ) ) );
} );
}
@AfterEach
public void dropTestData(SessionFactoryScope scope) {
scope.getSessionFactory().getSchemaManager().truncate();
}
@Test
void testCreateQuery(SessionFactoryScope sessions) {
sessions.inTransaction( (session) -> {
final Dto rtn = session.createQuery( Queries.ID_NAME, Dto.class ).getSingleResultOrNull();
assertThat( rtn ).isNotNull();
assertThat( rtn.getKey() ).isEqualTo( 1 );
assertThat( rtn.getText() ).isEqualTo( "first" );
} );
sessions.inTransaction( (session) -> {
final Dto rtn = session.createQuery( Queries.ID_COMP_VAL, Dto.class ).getSingleResultOrNull();
assertThat( rtn ).isNotNull();
assertThat( rtn.getKey() ).isEqualTo( 1 );
assertThat( rtn.getText() ).isEqualTo( "value1" );
} );
}
@Test
void testCreateSelectionQuery(SessionFactoryScope sessions) {
sessions.inTransaction( (session) -> {
final Dto rtn = session.createSelectionQuery( Queries.ID_NAME, Dto.class ).getSingleResultOrNull();
assertThat( rtn ).isNotNull();
assertThat( rtn.getKey() ).isEqualTo( 1 );
assertThat( rtn.getText() ).isEqualTo( "first" );
} );
sessions.inTransaction( (session) -> {
final Dto rtn = session.createSelectionQuery( Queries.ID_COMP_VAL, Dto.class ).getSingleResultOrNull();
assertThat( rtn ).isNotNull();
assertThat( rtn.getKey() ).isEqualTo( 1 );
assertThat( rtn.getText() ).isEqualTo( "value1" );
} );
}
@Test
void testCriteria(SessionFactoryScope sessions) {
sessions.inTransaction( (session) -> {
final HibernateCriteriaBuilder criteriaBuilder = session.getCriteriaBuilder();
final JpaCriteriaQuery<Dto> criteria = criteriaBuilder.createQuery( Dto.class );
final JpaRoot<SimpleEntity> root = criteria.from( SimpleEntity.class );
criteria.multiselect( root.get( "id" ), root.get( "name" ) );
final Dto rtn = session.createQuery( criteria ).getSingleResultOrNull();
assertThat( rtn ).isNotNull();
assertThat( rtn.getKey() ).isEqualTo( 1 );
assertThat( rtn.getText() ).isEqualTo( "first" );
} );
}
@Test
@Jira( "https://hibernate.atlassian.net/browse/HHH-18306" )
void testCreateQuerySingleSelectItem(SessionFactoryScope sessions) {
sessions.inTransaction( (session) -> {
final Dto2 rtn = session.createQuery( Queries.NAME, Dto2.class ).getSingleResultOrNull();
assertThat( rtn ).isNotNull();
assertThat( rtn.getText() ).isEqualTo( "first" );
} );
sessions.inTransaction( (session) -> {
final Dto2 rtn = session.createQuery( Queries.COMP_VAL, Dto2.class ).getSingleResultOrNull();
assertThat( rtn ).isNotNull();
assertThat( rtn.getText() ).isEqualTo( "value1" );
} );
}
@Test
@Jira( "https://hibernate.atlassian.net/browse/HHH-18306" )
void testCreateSelectionQuerySingleSelectItem(SessionFactoryScope sessions) {
sessions.inTransaction( (session) -> {
final Dto2 rtn = session.createSelectionQuery( Queries.NAME, Dto2.class ).getSingleResultOrNull();
assertThat( rtn ).isNotNull();
assertThat( rtn.getText() ).isEqualTo( "first" );
} );
sessions.inTransaction( (session) -> {
final Dto2 rtn = session.createSelectionQuery( Queries.COMP_VAL, Dto2.class ).getSingleResultOrNull();
assertThat( rtn ).isNotNull();
assertThat( rtn.getText() ).isEqualTo( "value1" );
} );
}
@Test
@Jira( "https://hibernate.atlassian.net/browse/HHH-18306" )
void testCriteriaSingleSelectItem(SessionFactoryScope sessions) {
sessions.inTransaction( (session) -> {
final HibernateCriteriaBuilder criteriaBuilder = session.getCriteriaBuilder();
final JpaCriteriaQuery<Dto2> criteria = criteriaBuilder.createQuery( Dto2.class );
final JpaRoot<SimpleEntity> root = criteria.from( SimpleEntity.class );
criteria.multiselect( root.get( "name" ) );
final Dto2 rtn = session.createQuery( criteria ).getSingleResultOrNull();
assertThat( rtn ).isNotNull();
assertThat( rtn.getText() ).isEqualTo( "first" );
} );
}
}
|
ImplicitInstantiationTests
|
java
|
elastic__elasticsearch
|
x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/function/scalar/geo/GeoProcessor.java
|
{
"start": 708,
"end": 763
}
|
class ____ implements Processor {
private
|
GeoProcessor
|
java
|
assertj__assertj-core
|
assertj-core/src/test/java/org/assertj/core/api/map/MapAssert_hasSizeGreaterThanOrEqualTo_Test.java
|
{
"start": 782,
"end": 1153
}
|
class ____ extends MapAssertBaseTest {
@Override
protected MapAssert<Object, Object> invoke_api_method() {
return assertions.hasSizeGreaterThanOrEqualTo(6);
}
@Override
protected void verify_internal_effects() {
verify(maps).assertHasSizeGreaterThanOrEqualTo(getInfo(assertions), getActual(assertions), 6);
}
}
|
MapAssert_hasSizeGreaterThanOrEqualTo_Test
|
java
|
apache__flink
|
flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/TableEnvironment.java
|
{
"start": 18026,
"end": 20051
}
|
class ____ the implementation.
*/
void createTemporarySystemFunction(
String name, Class<? extends UserDefinedFunction> functionClass);
/**
* Registers a {@link UserDefinedFunction} instance as a temporary system function.
*
* <p>Compared to {@link #createTemporarySystemFunction(String, Class)}, this method takes a
* function instance that might have been parameterized before (e.g. through its constructor).
* This might be useful for more interactive sessions. Make sure that the instance is {@link
* Serializable}.
*
* <p>Compared to {@link #createTemporaryFunction(String, UserDefinedFunction)}, system
* functions are identified by a global name that is independent of the current catalog and
* current database. Thus, this method allows to extend the set of built-in system functions
* like {@code TRIM}, {@code ABS}, etc.
*
* <p>Temporary functions can shadow permanent ones. If a permanent function under a given name
* exists, it will be inaccessible in the current session. To make the permanent function
* available again one can drop the corresponding temporary system function.
*
* @param name The name under which the function will be registered globally.
* @param functionInstance The (possibly pre-configured) function instance containing the
* implementation.
*/
void createTemporarySystemFunction(String name, UserDefinedFunction functionInstance);
/**
* Drops a temporary system function registered under the given name.
*
* <p>If a permanent function with the given name exists, it will be used from now on for any
* queries that reference this name.
*
* @param name The name under which the function has been registered globally.
* @return true if a function existed under the given name and was removed
*/
boolean dropTemporarySystemFunction(String name);
/**
* Registers a {@link UserDefinedFunction}
|
containing
|
java
|
FasterXML__jackson-databind
|
src/test/java/tools/jackson/databind/deser/jdk/MapKeyDeserializationTest.java
|
{
"start": 638,
"end": 1338
}
|
class ____ {
String _firstname, _lastname;
private FullName(String firstname, String lastname) {
_firstname = firstname;
_lastname = lastname;
}
@JsonCreator
public static FullName valueOf(String value) {
String[] mySplit = value.split("\\.");
return new FullName(mySplit[0], mySplit[1]);
}
public static FullName valueOf(String firstname, String lastname) {
return new FullName(firstname, lastname);
}
@JsonValue
@Override
public String toString() {
return _firstname + "." + _lastname;
}
}
// [databind#2725]
|
FullName
|
java
|
quarkusio__quarkus
|
integration-tests/vertx-http-compressors/app/src/main/java/io/quarkus/compressors/it/CompressedResource.java
|
{
"start": 286,
"end": 8679
}
|
class ____ {
// If you touch this block of text, you need to adjust byte numbers in RESTEndpointsTest too.
// The text is not entirely arbitrary, it shows different compress ratios for
// Brotli and GZip while still being reasonably short.
public static final String TEXT = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor "
+ "incididunt ut labore et <SOME TAG></SOME TAG> <SOME TAG></SOME TAG> minim veniam, quis nostrud exercitation"
+ "dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip "
+ "ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu "
+ "fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt "
+ "mollit anim id est laborum. consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et "
+ "dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip "
+ "ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu "
+ "fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt "
+ "mollit anim id est laborum. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia XXX "
+ "❀ੈ✩‧₊˚✧˚༘ ☹#️©️®️‼️⁉️™️ℹ️↔️↕️↖️↗️↘️↙️↩️↪️⌚⌛⌨️⏏️⏩⏬⏭️⏮️⏯️⏰⏱️⏲️⏳⏸️⏹️⏺️Ⓜ️▪️▫️▶️◀️◻️◼️◽◾☀️☁️☂️☃️☄️☎️☑️☔☕☘️☝️☝☝☝☝☝☠️☢️☣️☦️☪️"
+ "☮️☯️☸️☹️☺️♀️♂️♈♓♟️♠️♣️♥️♦️♨️♻️♾️♿⚒️⚓⚔️⚕️⚖️⚗️⚙️⚛️⚜️⚠️⚡⚧️⚪⚫⚰️⚱️⚽⚾⛄⛅⛈️⛎⛏️⛑️⛓️⛔⛩️⛪⛰️⛱️⛲⛳⛴️⛵⛷️⛸️⛹️⛹⛹⛹⛹⛹⛺"
+ "⛽✂️✅✈️✉️✊✋✊✊✊✊✊✋✋✋✋✋✌️✌✌✌✌✌✍️✍✍✍✍✍✏️✒️✔️✖️✝️✡️✨✳️✴️❄️❇️❌❎❓❕❗❣️❤️➕➗➡️➰➿⤴️⤵️⬅️⬆️⬇️⬛⬜⭐"
+ "⭕〰️〽️㊗️㊙️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️⋆。♡˚✧˚ ༘ ⋆。♡˚ consectetur adipiscing elit. Phasellus interdum erat ligula, eget consectetur consect"
+ "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus interdum erat ligula, eget consectetur justo"
+ "porttitor nec. Sed at est auctor, suscipit erat at, volutpat purus. Nulla facilisi. Praesent suscipit purus vel"
+ "nisl pharetra, in sagittis neque tincidunt. Curabitur sit amet ligula nec nisi mollis vehicula. Morbi sit amet "
+ "magna vitae arcu bibendum interdum. Vestibulum luctus felis sed tellus egestas, non suscipit risus dignissim. "
+ "Integer auctor tincidunt purus, ac posuere massa tristique id. Fusce varius eu ex ut cursus. Vestibulum vehicula"
+ "purus ut orci fermentum, ut feugiat dui fringilla. Ut in turpis at odio bibendum lacinia. 4231032147093284721037"
+ "Duis ultrices semper velit ut varius. Nam porttitor magna sed dui vestibulum, nec bibendum tortor convallis. 666"
+ "Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. In at augue quis "
+ "justo aliquet aliquet ut non eros. Vestibulum finibus ligula magna, at euismod tortor efficitur sit amet. Aliquam"
+ "erat volutpat. Curabitur bibendum orci vel risus fermentum, a gravida nulla placerat. Morbi condimentum dolor et "
+ "ex finibus, et finibus magna congue. Integer et odio ut sapien aliquam pharetra. Curabitur pharetra urna id felis"
+ "fringilla tincidunt. Suspendisse a erat quis enim pharetra mollis. Fusce vel est non odio tincidunt vulputate a "
+ "nec sem. Donec finibus sapien sed purus tincidunt, ac venenatis felis hendrerit. Ut consectetur lacus vel urna "
+ "suscipit, sed laoreet nulla volutpat.\n\r\n\r\n\r\n\t\t\t\n\r\n\r\n\r\n\r\n\t\t\t\n\r\n\r\n\r\n\r\n\t\t\t\n\r\r\r"
+ "Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Donec consequat "
+ "purus a odio gravida, vel convallis justo volutpat. Integer in magna a ante porttitor ultricies at id dui. Nullam "
+ "elementum sapien ut magna posuere suscipit. Proin aliquam dolor et quam suscipit bibendum. Aenean suscipit velit "
+ "vel lectus posuere, ut convallis nulla consequat. In at lorem fermentum, dignissim nulla ut, consectetur enim. "
+ "Maecenas vestibulum felis id justo blandit suscipit. Nulla facilisi. Duis elementum orci nec sapien accumsan, eget "
+ "tempus turpis rhoncus. Quisque porttitor, mi in auctor fermentum, mi orci hendrerit risus, in dignissim erat nunc "
+ "Morbi faucibus quam vel libero pharetra, non ultricies felis laoreet. Duis vulputate purus id sem interdum, vel "
+ "risus gravida. Vestibulum vulputate purus non lorem ultricies varius. Donec bibendum libero a mi sollicitudin \n"
+ "Praesent sed diam nec nunc pharetra malesuada nec ac urna. Nam id dui id eros vulputate pellentesque. Nulla malesuada e"
+ "ros eu enim finibus, sit amet posuere leo condimentum. Curabitur in mauris lacus. Aenean nec enim ut elit bibendum suscipit ac "
+ "nec nunc. Vestibulum vitae libero ac ipsum faucibus scelerisque. Curabitur ut lorem feugiat, pellentesque risus sit amet, "
+ "vehicula metus. Quisque vulputate arcu et magna vehicula pharetra. Integer gravida diam et dolor hendrerit, nec suscipit odio "
+ "vehicula. Donec sit amet turpis ut nulla viverra pharetra. Aenean commodo nisl ut risus fermentum vehicula. Suspendisse "
+ "at augue in lorem suscipit venenatis. Morbi interdum nibh eget ex posuere, sed convallis ipsum pharetra. Aliquam auctor "
+ "tincidunt urna, non dapibus risus fermentum ut. Phasellus convallis ipsum a diam consectetur, sit amet posuere erat viverra.\n"
+ "Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Quisque non orci scelerisque, "
+ "dapibus ipsum nec, laoreet magna. Suspendisse eget bibendum dui. Aenean bibendum augue vel risus laoreet faucibus. Donec "
+ "quis massa sapien. Nulla facilisi. Nulla facilisi. Nullam vel varius ipsum. Cras a tincidunt libero. Fusce efficitur felis "
+ "et pharetra cursus. Nullam venenatis mi nec libero auctor, nec cursus ligula dignissim. Phasellus eget libero consequat, "
+ "elementum erat sed, viverra odio. Suspendisse potenti. Aenean feugiat mi a tincidunt tristique. Sed fringilla magna nec "
+ "magna ultricies, id bibendum lacus faucibus. Maecenas porttitor libero sed lacus efficitur bibendum. Proin eget felis "
+ "dictum, malesuada ipsum ac, finibus nisl. ipsum ac, finibus nisl. 1234567890 148130 01394829387293 932583275295 2938573592\n";
@GET
@Path("/yes/text")
@Produces(MediaType.TEXT_PLAIN)
@Compressed
public Response textCompressed() {
return Response.ok(TEXT).build();
}
@GET
@Path("/no/text")
@Produces(MediaType.TEXT_PLAIN)
@Uncompressed
public String textUncompressed() {
return TEXT;
}
@GET
@Path("/yes/json")
@Produces(MediaType.APPLICATION_JSON)
@Compressed
public String jsonCompressed() {
// Doesn't matter the text ain't JSON, the test doesn't care.
// We need just the correct header.
return TEXT;
}
@GET
@Path("/no/json")
@Produces(MediaType.APPLICATION_JSON)
@Uncompressed
public String jsonUncompressed() {
return TEXT;
}
@GET
@Path("/yes/xml")
@Produces(MediaType.TEXT_XML)
// This one is compressed via default quarkus.http.compress-media-types
public String xmlCompressed() {
// Doesn't matter the text ain't XML, the test doesn't care.
// We need just the correct header.
return TEXT;
}
@GET
@Path("/no/xml")
@Produces(MediaType.TEXT_XML)
@Uncompressed
public String xmlUncompressed() {
return TEXT;
}
@GET
@Path("/yes/xhtml")
@Produces(MediaType.APPLICATION_XHTML_XML)
// This one is compressed quarkus.http.compress-media-types setting
public String xhtmlCompressed() {
// Doesn't matter the text ain't XML, the test doesn't care.
// We need just the correct header.
return TEXT;
}
}
|
CompressedResource
|
java
|
google__dagger
|
java/dagger/example/atm/CommandProcessor.java
|
{
"start": 1327,
"end": 2554
}
|
class ____ {
private final Deque<CommandRouter> commandRouterStack = new ArrayDeque<>();
@Inject
CommandProcessor(CommandRouter firstCommandRouter) {
commandRouterStack.push(firstCommandRouter);
}
Status process(String input) {
if (commandRouterStack.isEmpty()) {
throw new IllegalStateException("No command router is available!");
}
Result result = commandRouterStack.peek().route(input);
switch (result.status()) {
case INPUT_COMPLETED:
commandRouterStack.pop();
return commandRouterStack.isEmpty() ? Status.INPUT_COMPLETED : Status.HANDLED;
case HANDLED:
// TODO(ronshapiro): We currently have a case of using a subcomponent for nested commands,
// which requires maintaining a binding indicating whether we are in the subcomponent are
// not. We can include another example where there's a CommandRouter that is created from an
// entirely different component, that way there are no inherited commands.
result.nestedCommandRouter().ifPresent(commandRouterStack::push);
// fall through
case INVALID:
return result.status();
}
throw new AssertionError(result.status());
}
}
|
CommandProcessor
|
java
|
hibernate__hibernate-orm
|
hibernate-core/src/main/java/org/hibernate/boot/archive/scan/spi/ClassDescriptor.java
|
{
"start": 382,
"end": 573
}
|
class ____, not the file name.
*
* @return The name (FQN) of the class
*/
String getName();
Categorization getCategorization();
/**
* Retrieves access to the InputStream for the
|
name
|
java
|
spring-projects__spring-framework
|
spring-core/src/main/java/org/springframework/cglib/proxy/MixinBeanEmitter.java
|
{
"start": 954,
"end": 1391
}
|
class ____ extends MixinEmitter {
public MixinBeanEmitter(ClassVisitor v, String className, Class[] classes) {
super(v, className, classes, null);
}
@Override
protected Class[] getInterfaces(Class[] classes) {
return null;
}
@Override
protected Method[] getMethods(Class type) {
return ReflectUtils.getPropertyMethods(ReflectUtils.getBeanProperties(type), true, true);
}
}
|
MixinBeanEmitter
|
java
|
apache__hadoop
|
hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/auth/delegation/AbstractDTService.java
|
{
"start": 1702,
"end": 4894
}
|
class ____
extends AbstractService {
/**
* URI of the filesystem.
* Valid after {@link #bindToFileSystem(URI, StoreContext, DelegationOperations)}.
*/
private URI canonicalUri;
/**
* Owner of the filesystem.
* Valid after {@link #bindToFileSystem(URI, StoreContext, DelegationOperations)}.
*/
private UserGroupInformation owner;
/**
* Store Context for callbacks into the FS.
* Valid after {@link #bindToFileSystem(URI, StoreContext, DelegationOperations)}.
*/
private StoreContext storeContext;
/**
* Callbacks for DT-related operations.
*/
private DelegationOperations policyProvider;
/**
* Protected constructor.
* @param name service name.
*/
protected AbstractDTService(final String name) {
super(name);
}
/**
* Bind to the filesystem.
* Subclasses can use this to perform their own binding operations -
* but they must always call their superclass implementation.
* This <i>Must</i> be called before calling {@code init()}.
*
* <b>Important:</b>
* This binding will happen during FileSystem.initialize(); the FS
* is not live for actual use and will not yet have interacted with
* AWS services.
* @param uri the canonical URI of the FS.
* @param context store context
* @param delegationOperations delegation operations
* @throws IOException failure.
*/
public void bindToFileSystem(
final URI uri,
final StoreContext context,
final DelegationOperations delegationOperations) throws IOException {
requireServiceState(STATE.NOTINITED);
Preconditions.checkState(canonicalUri == null,
"bindToFileSystem called twice");
this.canonicalUri = requireNonNull(uri);
this.storeContext = requireNonNull(context);
this.owner = context.getOwner();
this.policyProvider = delegationOperations;
}
/**
* Get the canonical URI of the filesystem, which is what is
* used to identify the tokens.
* @return the URI.
*/
public URI getCanonicalUri() {
return canonicalUri;
}
/**
* Get the owner of this Service.
* @return owner; non-null after binding to an FS.
*/
public UserGroupInformation getOwner() {
return owner;
}
protected StoreContext getStoreContext() {
return storeContext;
}
protected DelegationOperations getPolicyProvider() {
return policyProvider;
}
/**
* Require that the service is in a given state.
* @param state desired state.
* @throws IllegalStateException if the condition is not met
*/
protected void requireServiceState(final STATE state)
throws IllegalStateException {
Preconditions.checkState(isInState(state),
"Required State: %s; Actual State %s", state, getServiceState());
}
/**
* Require the service to be started.
* @throws IllegalStateException if it is not.
*/
protected void requireServiceStarted() throws IllegalStateException {
requireServiceState(STATE.STARTED);
}
@Override
protected void serviceInit(final Configuration conf) throws Exception {
super.serviceInit(conf);
requireNonNull(canonicalUri, "service does not have a canonical URI");
}
}
|
AbstractDTService
|
java
|
apache__flink
|
flink-table/flink-table-common/src/main/java/org/apache/flink/table/functions/TableSemantics.java
|
{
"start": 1237,
"end": 1477
}
|
class ____ only available for table arguments (i.e. arguments of a {@link
* ProcessTableFunction} that are annotated with {@code @ArgumentHint(SET_SEMANTIC_TABLE)} or
* {@code @ArgumentHint(ROW_SEMANTIC_TABLE)}).
*/
@PublicEvolving
public
|
is
|
java
|
apache__hadoop
|
hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/async/RouterAsyncRpcClient.java
|
{
"start": 4940,
"end": 10351
}
|
class ____ extends RouterRpcClient{
private static final Logger LOG =
LoggerFactory.getLogger(RouterAsyncRpcClient.class);
/** Router using this RPC client. */
private final Router router;
/** Interface to identify the active NN for a nameservice or blockpool ID. */
private final ActiveNamenodeResolver namenodeResolver;
/** Optional perf monitor. */
private final RouterRpcMonitor rpcMonitor;
/**
* Create a router async RPC client to manage remote procedure calls to NNs.
*
* @param conf Hdfs Configuration.
* @param router A router using this RPC client.
* @param resolver A NN resolver to determine the currently active NN in HA.
* @param monitor Optional performance monitor.
* @param routerStateIdContext the router state context object to hold the state ids for all
* namespaces.
*/
public RouterAsyncRpcClient(Configuration conf,
Router router, ActiveNamenodeResolver resolver, RouterRpcMonitor monitor,
RouterStateIdContext routerStateIdContext) {
super(conf, router, resolver, monitor, routerStateIdContext);
this.router = router;
this.namenodeResolver = resolver;
this.rpcMonitor = monitor;
}
@Override
protected void initConcurrentCallExecutorService(Configuration conf) {
// No need to initialize the thread pool for concurrent call.
}
/**
* Invoke method in all locations and return success if any succeeds.
*
* @param <T> The type of the remote location.
* @param locations List of remote locations to call concurrently.
* @param method The remote method and parameters to invoke.
* @return If the call succeeds in any location.
* @throws IOException If any of the calls return an exception.
*/
@Override
public <T extends RemoteLocationContext> boolean invokeAll(
final Collection<T> locations, final RemoteMethod method)
throws IOException {
invokeConcurrent(locations, method, false, false,
Boolean.class);
asyncApply((ApplyFunction<Map<T, Boolean>, Object>)
results -> results.containsValue(true));
return asyncReturn(boolean.class);
}
/**
* Invokes a method against the ClientProtocol proxy server. If a standby
* exception is generated by the call to the client, retries using the
* alternate server.
* <p>
* Re-throws exceptions generated by the remote RPC call as either
* RemoteException or IOException.
*
* @param ugi User group information.
* @param namenodes A prioritized list of namenodes within the same
* nameservice.
* @param useObserver Whether to use observer namenodes.
* @param protocol the protocol of the connection.
* @param method Remote ClientProtocol method to invoke.
* @param params Variable list of parameters matching the method.
* @return The result of invoking the method.
* @throws ConnectException If it cannot connect to any Namenode.
* @throws StandbyException If all Namenodes are in Standby.
* @throws IOException If it cannot invoke the method.
*/
@Override
public Object invokeMethod(
UserGroupInformation ugi,
List<? extends FederationNamenodeContext> namenodes,
boolean useObserver, Class<?> protocol,
Method method, Object... params) throws IOException {
if (namenodes == null || namenodes.isEmpty()) {
throw new IOException("No namenodes to invoke " + method.getName() +
" with params " + Arrays.deepToString(params) + " from "
+ router.getRouterId());
}
String nsid = namenodes.get(0).getNameserviceId();
// transfer threadLocalContext to worker threads of executor.
ThreadLocalContext threadLocalContext = new ThreadLocalContext();
asyncComplete(null);
asyncApplyUseExecutor((AsyncApplyFunction<Object, Object>) o -> {
if (LOG.isDebugEnabled()) {
LOG.debug("Async invoke method : {}, {}, {}, {}", method.getName(), useObserver,
namenodes.toString(), params);
}
threadLocalContext.transfer();
RouterRpcFairnessPolicyController controller = getRouterRpcFairnessPolicyController();
acquirePermit(nsid, ugi, method.getName(), controller);
invokeMethodAsync(ugi, (List<FederationNamenodeContext>) namenodes,
useObserver, protocol, method, params);
asyncFinally(object -> {
releasePermit(nsid, ugi, method, controller);
return object;
});
}, router.getRpcServer().getAsyncRouterHandlerExecutors().getOrDefault(nsid,
router.getRpcServer().getRouterAsyncHandlerDefaultExecutor()));
return null;
}
/**
* Asynchronously invokes a method on the specified NameNodes for a given user and operation.
* This method is responsible for the actual execution of the remote method call on the
* NameNodes in a non-blocking manner, allowing for concurrent processing.
*
* <p>In case of exceptions, the method includes logic to handle retries, failover to standby
* NameNodes, and proper exception handling to ensure that the calling code can respond
* appropriately to different error conditions.
*
* @param ugi The user information under which the method is to be invoked.
* @param namenodes The list of NameNode contexts on which the method will be invoked.
* @param useObserver Whether to use an observer node for the invocation if available.
* @param protocol The protocol
|
RouterAsyncRpcClient
|
java
|
FasterXML__jackson-databind
|
src/main/java/tools/jackson/databind/deser/bean/CreatorCollector.java
|
{
"start": 462,
"end": 617
}
|
class ____ storing information on creators (based on annotations,
* visibility), to be able to build actual {@code ValueInstantiator} later on.
*/
public
|
for
|
java
|
google__error-prone
|
core/src/test/java/com/google/errorprone/bugpatterns/StatementSwitchToExpressionSwitchTest.java
|
{
"start": 85998,
"end": 86859
}
|
class ____ {
public void foo(Suit suit) {
switch (suit) {
case HEART:
// Fall through
case DIAMOND:
return;
case SPADE:
throw new RuntimeException();
default:
throw new NullPointerException();
}
}
}
""")
.setArgs(
"-XepOpt:StatementSwitchToExpressionSwitch:EnableReturnSwitchConversion",
"-XepOpt:StatementSwitchToExpressionSwitch:EnableDirectConversion=false")
.doTest();
}
@Test
public void switchByEnum_returnLabelledContinue_noError() {
// Control jumps outside the switch for HEART
helper
.addSourceLines(
"Test.java",
"""
|
Test
|
java
|
assertj__assertj-core
|
assertj-core/src/test/java/org/assertj/core/api/file/FileAssert_usingCharset_Test.java
|
{
"start": 943,
"end": 1247
}
|
class ____ extends FileAssertBaseTest {
@Override
protected FileAssert invoke_api_method() {
return assertions.usingCharset(otherCharset);
}
@Override
protected void verify_internal_effects() {
assertThat(getCharset(assertions)).isEqualTo(otherCharset);
}
}
|
FileAssert_usingCharset_Test
|
java
|
FasterXML__jackson-databind
|
src/test/java/tools/jackson/databind/jsontype/TestMultipleTypeNames.java
|
{
"start": 1108,
"end": 1256
}
|
class ____ {
List<BaseForNamesTest> base;
public List<BaseForNamesTest> getBase() { return base; }
}
static
|
WrapperForNamesTest
|
java
|
alibaba__nacos
|
common/src/main/java/com/alibaba/nacos/common/trace/event/naming/SubscribeServiceTraceEvent.java
|
{
"start": 747,
"end": 1296
}
|
class ____ extends NamingTraceEvent {
private static final long serialVersionUID = -8856834879168816801L;
private final String clientIp;
public String getClientIp() {
return clientIp;
}
public SubscribeServiceTraceEvent(long eventTime, String clientIp, String serviceNamespace, String serviceGroup,
String serviceName) {
super("SUBSCRIBE_SERVICE_TRACE_EVENT", eventTime, serviceNamespace, serviceGroup, serviceName);
this.clientIp = clientIp;
}
}
|
SubscribeServiceTraceEvent
|
java
|
apache__logging-log4j2
|
log4j-core-test/src/test/java/org/apache/logging/log4j/core/appender/rolling/action/IfAccumulatedFileCountTest.java
|
{
"start": 1135,
"end": 3004
}
|
class ____ {
@Test
void testGetThresholdCount() {
assertEquals(123, IfAccumulatedFileCount.createFileCountCondition(123).getThresholdCount());
assertEquals(456, IfAccumulatedFileCount.createFileCountCondition(456).getThresholdCount());
}
@Test
void testAccept() {
final int[] counts = {3, 5, 9};
for (final int count : counts) {
final IfAccumulatedFileCount condition = IfAccumulatedFileCount.createFileCountCondition(count);
for (int i = 0; i < count; i++) {
assertFalse(condition.accept(null, null, null));
// exact match: does not accept
}
// accept when threshold is exceeded
assertTrue(condition.accept(null, null, null));
assertTrue(condition.accept(null, null, null));
}
}
@Test
void testAcceptCallsNestedConditionsOnlyIfPathAccepted() {
final CountingCondition counter = new CountingCondition(true);
final IfAccumulatedFileCount condition = IfAccumulatedFileCount.createFileCountCondition(3, counter);
for (int i = 1; i < 10; i++) {
if (i <= 3) {
assertFalse(condition.accept(null, null, null), "i=" + i);
assertEquals(0, counter.getAcceptCount());
} else {
assertTrue(condition.accept(null, null, null));
assertEquals(i - 3, counter.getAcceptCount());
}
}
}
@Test
void testBeforeTreeWalk() {
final CountingCondition counter = new CountingCondition(true);
final IfAccumulatedFileCount filter =
IfAccumulatedFileCount.createFileCountCondition(30, counter, counter, counter);
filter.beforeFileTreeWalk();
assertEquals(3, counter.getBeforeFileTreeWalkCount());
}
}
|
IfAccumulatedFileCountTest
|
java
|
google__dagger
|
dagger-producers/main/java/dagger/producers/internal/SetOfProducedProducer.java
|
{
"start": 2422,
"end": 7539
}
|
class ____<T> {
private final List<Producer<T>> individualProducers;
private final List<Producer<Collection<T>>> collectionProducers;
private Builder(int individualProducerSize, int collectionProducerSize) {
individualProducers = presizedList(individualProducerSize);
collectionProducers = presizedList(collectionProducerSize);
}
@SuppressWarnings("unchecked")
public Builder<T> addProducer(Producer<? extends T> individualProducer) {
assert individualProducer != null : "Codegen error? Null producer";
individualProducers.add((Producer<T>) individualProducer);
return this;
}
@SuppressWarnings("unchecked")
public Builder<T> addCollectionProducer(
Producer<? extends Collection<? extends T>> multipleProducer) {
assert multipleProducer != null : "Codegen error? Null producer";
collectionProducers.add((Producer<Collection<T>>) multipleProducer);
return this;
}
public SetOfProducedProducer<T> build() {
assert !hasDuplicates(individualProducers)
: "Codegen error? Duplicates in the producer list";
assert !hasDuplicates(collectionProducers)
: "Codegen error? Duplicates in the producer list";
return new SetOfProducedProducer<T>(individualProducers, collectionProducers);
}
}
private final List<Producer<T>> individualProducers;
private final List<Producer<Collection<T>>> collectionProducers;
private SetOfProducedProducer(
List<Producer<T>> individualProducers, List<Producer<Collection<T>>> collectionProducers) {
this.individualProducers = individualProducers;
this.collectionProducers = collectionProducers;
}
/**
* Returns a future {@link Set} of {@link Produced} elements given by each of the producers.
*
* <p>If any of the delegate collections, or any elements therein, are null, then that
* corresponding {@code Produced} element will fail with a NullPointerException.
*
* <p>Canceling this future will attempt to cancel all of the component futures; but if any of the
* delegate futures fail or are canceled, this future succeeds, with the appropriate failed {@link
* Produced}.
*
* @throws NullPointerException if any of the delegate producers return null
*/
@Override
public ListenableFuture<Set<Produced<T>>> compute() {
List<ListenableFuture<? extends Produced<? extends Collection<T>>>> futureProducedCollections =
new ArrayList<ListenableFuture<? extends Produced<? extends Collection<T>>>>(
individualProducers.size() + collectionProducers.size());
for (Producer<T> producer : individualProducers) {
// TODO(ronshapiro): Don't require individual productions to be added to a collection just to
// be materialized into futureProducedCollections.
futureProducedCollections.add(
Producers.createFutureProduced(
Producers.createFutureSingletonSet(checkNotNull(producer.get()))));
}
for (Producer<Collection<T>> producer : collectionProducers) {
futureProducedCollections.add(Producers.createFutureProduced(checkNotNull(producer.get())));
}
return Futures.transform(
Futures.allAsList(futureProducedCollections),
new Function<List<Produced<? extends Collection<T>>>, Set<Produced<T>>>() {
@Override
public Set<Produced<T>> apply(
List<Produced<? extends Collection<T>>> producedCollections) {
ImmutableSet.Builder<Produced<T>> builder = ImmutableSet.builder();
for (Produced<? extends Collection<T>> producedCollection : producedCollections) {
try {
Collection<T> collection = producedCollection.get();
if (collection == null) {
// TODO(beder): This is a vague exception. Can we somehow point to the failing
// producer? See the similar comment in the component writer about null
// provisions.
builder.add(
Produced.<T>failed(
new NullPointerException(
"Cannot contribute a null collection into a producer set binding when"
+ " it's injected as Set<Produced<T>>.")));
} else {
for (T value : collection) {
if (value == null) {
builder.add(
Produced.<T>failed(
new NullPointerException(
"Cannot contribute a null element into a producer set binding"
+ " when it's injected as Set<Produced<T>>.")));
} else {
builder.add(Produced.successful(value));
}
}
}
} catch (ExecutionException e) {
builder.add(Produced.<T>failed(e.getCause()));
}
}
return builder.build();
}
},
directExecutor());
}
}
|
Builder
|
java
|
redisson__redisson
|
redisson/src/main/java/org/redisson/api/RedissonClient.java
|
{
"start": 10231,
"end": 10378
}
|
interface ____ mass operations with Bucket objects.
*
* @return Buckets object
*/
RBuckets getBuckets();
/**
* Returns
|
for
|
java
|
quarkusio__quarkus
|
extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/TrafficShapingConfig.java
|
{
"start": 1396,
"end": 2975
}
|
interface ____ {
/**
* Enables the traffic shaping.
*/
@WithDefault("false")
boolean enabled();
/**
* Set bandwidth limit in bytes per second for inbound connections, up to {@code Long.MAX_VALUE} bytes.
* If not set, no limits are applied.
*/
Optional<MemorySize> inboundGlobalBandwidth();
/**
* Set bandwidth limit in bytes per second for outbound connections, up to {@code Long.MAX_VALUE} bytes.
* If not set, no limits are applied.
*/
Optional<MemorySize> outboundGlobalBandwidth();
/**
* Set the maximum delay to wait in case of traffic excess.
* Default is 15s. Must be less than the HTTP timeout.
*/
Optional<Duration> maxDelay();
/**
* Set the delay between two computations of performances for channels.
* If set to 0, no stats are computed.
* Despite 0 is accepted (no accounting), it is recommended to set a positive value for the check interval,
* even if it is high since the precision of the traffic shaping depends on the period where the traffic is computed.
* In this case, a suggested value is something close to 5 or 10 minutes.
* <p>
* If not default, it defaults to 1s.
*/
Optional<Duration> checkInterval();
/**
* Set the maximum global write size in bytes per second allowed in the buffer globally for all channels before write
* are suspended, up to {@code Long.MAX_VALUE} bytes.
* The default value is 400 MB.
*/
Optional<MemorySize> peakOutboundGlobalBandwidth();
}
|
TrafficShapingConfig
|
java
|
google__error-prone
|
core/src/main/java/com/google/errorprone/bugpatterns/time/TimeUnitMismatch.java
|
{
"start": 18344,
"end": 18757
}
|
class ____ it's called on.
String member = memberSelect.getIdentifier().toString();
return member.equals("get") ? extractArgumentName(memberSelect.getExpression()) : member;
}
case MethodInvocationTree methodInvocation -> {
// If we have a 'call expression' we use the name of the method we are calling. Exception:
// If the method is named "get," we use the object or
|
that
|
java
|
quarkusio__quarkus
|
extensions/security/deployment/src/main/java/io/quarkus/security/deployment/PermissionSecurityChecks.java
|
{
"start": 24335,
"end": 25226
}
|
class ____ if respective method haven't already been annotated
if (target.kind() == AnnotationTarget.Kind.CLASS) {
final ClassInfo clazz = target.asClass();
// ignore PermissionsAllowedInterceptor in security module
// we also need to check string as long as duplicate "PermissionsAllowedInterceptor" exists
// in RESTEasy Reactive, however this workaround should be removed when the interceptor is dropped
if (isPermissionsAllowedInterceptor(clazz)) {
continue;
}
if (clazz.isAnnotation()) {
// meta-annotations are handled separately
continue;
}
// check that
|
annotation
|
java
|
spring-projects__spring-framework
|
spring-tx/src/test/java/org/springframework/transaction/event/ReactiveTransactionalEventListenerTests.java
|
{
"start": 14347,
"end": 14779
}
|
class ____ extends BaseTransactionalTestListener {
@TransactionalEventListener(phase = AFTER_COMMIT)
public void handleAfterCommit(String data) {
handleEvent(EventCollector.AFTER_COMMIT, data);
}
@TransactionalEventListener(phase = AFTER_ROLLBACK)
public void handleAfterRollback(String data) {
handleEvent(EventCollector.AFTER_ROLLBACK, data);
}
}
@Transactional
@Component
|
AfterCompletionExplicitTestListener
|
java
|
alibaba__fastjson
|
src/test/java/com/derbysoft/spitfire/fastjson/dto/AvailRoomStayDTO.java
|
{
"start": 104,
"end": 1766
}
|
class ____ extends AbstractDTO {
private RoomTypeDTO roomType;
private RatePlanDTO ratePlan;
private RoomRateDTO roomRate;
private Integer quantity;
private ProviderChainDTO providerChain;
private LanguageType languageType;
private TPAExtensionsDTO tpaExtensions;
public RoomTypeDTO getRoomType() {
return roomType;
}
public void setRoomType(RoomTypeDTO roomType) {
this.roomType = roomType;
}
public RatePlanDTO getRatePlan() {
return ratePlan;
}
public void setRatePlan(RatePlanDTO ratePlan) {
this.ratePlan = ratePlan;
}
public RoomRateDTO getRoomRate() {
return roomRate;
}
public void setRoomRate(RoomRateDTO roomRate) {
this.roomRate = roomRate;
}
public Integer getQuantity() {
return quantity;
}
public void setQuantity(Integer quantity) {
this.quantity = quantity;
}
@JSONField(name="PC")
public ProviderChainDTO getProviderChain() {
return providerChain;
}
@JSONField(name="PC")
public void setProviderChain(ProviderChainDTO providerChain) {
this.providerChain = providerChain;
}
@JSONField(name="LT")
public LanguageType getLanguageType() {
return languageType;
}
@JSONField(name="LT")
public void setLanguageType(LanguageType languageType) {
this.languageType = languageType;
}
public TPAExtensionsDTO getTpaExtensions() {
return tpaExtensions;
}
public void setTpaExtensions(TPAExtensionsDTO tpaExtensions) {
this.tpaExtensions = tpaExtensions;
}
}
|
AvailRoomStayDTO
|
java
|
quarkusio__quarkus
|
independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/codestarts/extension/QuarkusExtensionCodestartCatalog.java
|
{
"start": 618,
"end": 956
}
|
class ____ extends GenericCodestartCatalog<QuarkusExtensionCodestartProjectInput> {
public static final String QUARKUS_EXTENSION_CODESTARTS_DIR = "codestarts/quarkus-extension";
private QuarkusExtensionCodestartCatalog(Collection<Codestart> codestarts) {
super(codestarts);
}
public
|
QuarkusExtensionCodestartCatalog
|
java
|
google__error-prone
|
core/src/test/java/com/google/errorprone/bugpatterns/time/InvalidJavaTimeConstantTest.java
|
{
"start": 5094,
"end": 5616
}
|
class ____ {
private static LocalDate foo(LocalDate localDate) {
// BUG: Diagnostic contains: DayOfMonth (valid values 1 - 28/31): 0
return localDate.withDayOfMonth(0);
}
}
""")
.doTest();
}
@Test
public void localTime_withBadHour() {
compilationHelper
.addSourceLines(
"test/TestCase.java",
"""
package test;
import java.time.LocalTime;
public
|
TestCase
|
java
|
apache__flink
|
flink-table/flink-table-common/src/main/java/org/apache/flink/table/catalog/TableChange.java
|
{
"start": 14983,
"end": 16383
}
|
class ____ implements CatalogTableChange {
private final UniqueConstraint constraint;
private AddUniqueConstraint(UniqueConstraint constraint) {
this.constraint = constraint;
}
/** Returns the unique constraint to add. */
public UniqueConstraint getConstraint() {
return constraint;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof AddUniqueConstraint)) {
return false;
}
AddUniqueConstraint that = (AddUniqueConstraint) o;
return Objects.equals(constraint, that.constraint);
}
@Override
public int hashCode() {
return Objects.hash(constraint);
}
@Override
public String toString() {
return "AddUniqueConstraint{" + "constraint=" + constraint + '}';
}
}
/**
* A table change to add a distribution.
*
* <p>It is equal to the following statement:
*
* <pre>
* ALTER TABLE <table_name> ADD DISTRIBUTION ...;
* </pre>
*
* <p>or in case of materialized tables:
*
* <pre>
* ALTER MATERIALIZED TABLE <table_name> ADD DISTRIBUTION ...;
* </pre>
*/
@PublicEvolving
|
AddUniqueConstraint
|
java
|
mapstruct__mapstruct
|
processor/src/test/java/org/mapstruct/ap/test/bugs/_1339/Issue1339Mapper.java
|
{
"start": 399,
"end": 508
}
|
interface ____ {
Issue1339Mapper INSTANCE = Mappers.getMapper( Issue1339Mapper.class );
|
Issue1339Mapper
|
java
|
assertj__assertj-core
|
assertj-core/src/test/java/org/assertj/core/api/InstanceOfAssertFactoriesTest.java
|
{
"start": 78858,
"end": 79566
}
|
class ____ {
private final Object actual = Lists.list("Homer", "Marge", "Bart", "Lisa", "Maggie").iterator();
@Test
void createAssert() {
// WHEN
IteratorAssert<String> result = iterator(String.class).createAssert(actual);
// THEN
result.hasNext();
}
@Test
void createAssert_with_ValueProvider() {
// GIVEN
ValueProvider<?> valueProvider = mockThatDelegatesTo(type -> actual);
// WHEN
IteratorAssert<String> result = iterator(String.class).createAssert(valueProvider);
// THEN
result.hasNext();
verify(valueProvider).apply(parameterizedType(Iterator.class, String.class));
}
}
@Nested
|
Iterator_Typed_Factory
|
java
|
spring-cloud__spring-cloud-gateway
|
spring-cloud-gateway-server-webflux/src/test/java/org/springframework/cloud/gateway/cors/SimpleUrlHandlerCorsTests.java
|
{
"start": 1938,
"end": 3768
}
|
class ____ extends BaseWebClientTests {
@Test
public void testPreFlightCorsRequestNotHandledByGW() {
ResponseEntity<String> response = webClient.options()
.uri("/abc/123/function")
.header("Origin", "domain.com")
.header("Access-Control-Request-Method", "GET")
.retrieve()
.toEntity(String.class)
.block();
HttpHeaders asHttpHeaders = response.getHeaders();
// pre-flight request shouldn't return the response body
assertThat(response.getBody()).isNull();
assertThat(asHttpHeaders.getAccessControlAllowOrigin())
.as("Missing header value in response: " + HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN)
.isEqualTo("*");
assertThat(asHttpHeaders.getAccessControlAllowMethods())
.as("Missing header value in response: " + HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS)
.isEqualTo(List.of(HttpMethod.GET));
assertThat(response.getStatusCode()).as("Pre Flight call failed.").isEqualTo(HttpStatus.OK);
}
@Test
public void testCorsRequestNotHandledByGW() {
ResponseEntity<String> responseEntity = webClient.get()
.uri("/abc/123/function")
.header("Origin", "domain.com")
.header(HttpHeaders.HOST, "www.path.org")
.retrieve()
.onStatus(HttpStatusCode::isError, t -> Mono.empty())
.toEntity(String.class)
.block();
HttpHeaders asHttpHeaders = responseEntity.getHeaders();
assertThat(responseEntity.getBody()).isNotNull();
assertThat(asHttpHeaders.getAccessControlAllowOrigin())
.as("Missing header value in response: " + HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN)
.isEqualTo("*");
assertThat(responseEntity.getStatusCode()).as("CORS request failed.").isEqualTo(HttpStatus.NOT_FOUND);
}
@EnableAutoConfiguration
@SpringBootConfiguration
@AutoConfigureBefore(GatewayAutoConfiguration.class)
@Import(DefaultTestConfig.class)
public static
|
SimpleUrlHandlerCorsTests
|
java
|
spring-projects__spring-boot
|
core/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jmx/ParentAwareNamingStrategy.java
|
{
"start": 1491,
"end": 3651
}
|
class ____ extends MetadataNamingStrategy implements ApplicationContextAware {
@SuppressWarnings("NullAway.Init")
private ApplicationContext applicationContext;
private boolean ensureUniqueRuntimeObjectNames;
public ParentAwareNamingStrategy(JmxAttributeSource attributeSource) {
super(attributeSource);
}
/**
* Set if unique runtime object names should be ensured.
* @param ensureUniqueRuntimeObjectNames {@code true} if unique names should be
* ensured.
*/
public void setEnsureUniqueRuntimeObjectNames(boolean ensureUniqueRuntimeObjectNames) {
this.ensureUniqueRuntimeObjectNames = ensureUniqueRuntimeObjectNames;
}
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
this.applicationContext = applicationContext;
}
@Override
public ObjectName getObjectName(Object managedBean, @Nullable String beanKey) throws MalformedObjectNameException {
ObjectName name = super.getObjectName(managedBean, beanKey);
if (this.ensureUniqueRuntimeObjectNames) {
return JmxUtils.appendIdentityToObjectName(name, managedBean);
}
if (parentContextContainsSameBean(this.applicationContext, beanKey)) {
return appendToObjectName(name, "context", ObjectUtils.getIdentityHexString(this.applicationContext));
}
return name;
}
private boolean parentContextContainsSameBean(ApplicationContext context, @Nullable String beanKey) {
if (context.getParent() == null) {
return false;
}
try {
ApplicationContext parent = this.applicationContext.getParent();
Assert.state(parent != null, "'parent' must not be null");
Assert.state(beanKey != null, "'beanKey' must not be null");
parent.getBean(beanKey);
return true;
}
catch (BeansException ex) {
return parentContextContainsSameBean(context.getParent(), beanKey);
}
}
private ObjectName appendToObjectName(ObjectName name, String key, String value)
throws MalformedObjectNameException {
Hashtable<String, String> keyProperties = name.getKeyPropertyList();
keyProperties.put(key, value);
return ObjectNameManager.getInstance(name.getDomain(), keyProperties);
}
}
|
ParentAwareNamingStrategy
|
java
|
spring-projects__spring-framework
|
spring-tx/src/main/java/org/springframework/transaction/annotation/EnableTransactionManagement.java
|
{
"start": 4485,
"end": 4650
}
|
class ____ implements TransactionManagementConfigurer {
*
* @Bean
* public FooRepository fooRepository() {
* // configure and return a
|
AppConfig
|
java
|
google__guava
|
android/guava-testlib/src/com/google/common/testing/ArbitraryInstances.java
|
{
"start": 18900,
"end": 19059
}
|
class ____ extends Random {
@Keep
public DeterministicRandom() {
super(0);
}
}
@Keep
public static final
|
DeterministicRandom
|
java
|
apache__camel
|
components/camel-univocity-parsers/src/main/java/org/apache/camel/dataformat/univocity/UniVocityTsvDataFormat.java
|
{
"start": 1276,
"end": 2476
}
|
class ____
extends
AbstractUniVocityDataFormat<TsvFormat, TsvWriterSettings, TsvWriter, TsvParserSettings, TsvParser, UniVocityTsvDataFormat> {
private Character escapeChar;
public Character getEscapeChar() {
return escapeChar;
}
public void setEscapeChar(Character escapeChar) {
this.escapeChar = escapeChar;
}
@Override
protected TsvWriterSettings createWriterSettings() {
return new TsvWriterSettings();
}
@Override
protected TsvWriter createWriter(Writer writer, TsvWriterSettings settings) {
return new TsvWriter(writer, settings);
}
@Override
protected TsvParserSettings createParserSettings() {
return new TsvParserSettings();
}
@Override
protected TsvParser createParser(TsvParserSettings settings) {
return new TsvParser(settings);
}
@Override
protected void configureFormat(TsvFormat format) {
super.configureFormat(format);
if (escapeChar != null) {
format.setEscapeChar(escapeChar);
}
}
@Override
public String getDataFormatName() {
return "univocityTsv";
}
}
|
UniVocityTsvDataFormat
|
java
|
ReactiveX__RxJava
|
src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleConcatDelayErrorTest.java
|
{
"start": 810,
"end": 1771
}
|
class ____ {
@Test
public void normalIterable() {
Single.concatDelayError(Arrays.asList(
Single.just(1),
Single.<Integer>error(new TestException()),
Single.just(2)
))
.test()
.assertFailure(TestException.class, 1, 2);
}
@Test
public void normalPublisher() {
Single.concatDelayError(Flowable.fromArray(
Single.just(1),
Single.<Integer>error(new TestException()),
Single.just(2)
))
.test()
.assertFailure(TestException.class, 1, 2);
}
@Test
public void normalPublisherPrefetch() {
Single.concatDelayError(Flowable.fromArray(
Single.just(1),
Single.<Integer>error(new TestException()),
Single.just(2)
), 1)
.test()
.assertFailure(TestException.class, 1, 2);
}
}
|
SingleConcatDelayErrorTest
|
java
|
apache__flink
|
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/operations/converters/SchemaReferencesManager.java
|
{
"start": 1680,
"end": 10001
}
|
class ____ {
/** Available columns in the table. */
private final Set<String> columns;
/**
* Mappings about the column refers which columns, e.g. column `b` refers to the column `a` in
* the expression "b as a+1".
*/
private final Map<String, Set<String>> columnToReferences;
/**
* Reverse mappings about the column refers which columns, e.g. column `a` has the dependency of
* column `b` in the expression "b as a+1".
*/
private final Map<String, Set<String>> columnToDependencies;
/** Primary keys defined on the table. */
private final Set<String> primaryKeys;
/** The name of the column watermark expression depends on. */
private final Set<String> watermarkReferences;
/** The name of the column partition keys contains. */
private final Set<String> partitionKeys;
/** The names of the columns used as distribution keys. */
private final Set<String> distributionKeys;
private SchemaReferencesManager(
Set<String> columns,
Map<String, Set<String>> columnToReferences,
Map<String, Set<String>> columnToDependencies,
Set<String> primaryKeys,
Set<String> watermarkReferences,
Set<String> partitionKeys,
Set<String> distributionKeys) {
this.columns = columns;
this.columnToReferences = columnToReferences;
this.columnToDependencies = columnToDependencies;
this.primaryKeys = primaryKeys;
this.watermarkReferences = watermarkReferences;
this.partitionKeys = partitionKeys;
this.distributionKeys = distributionKeys;
}
public static SchemaReferencesManager create(ResolvedCatalogTable catalogTable) {
Map<String, Set<String>> columnToReferences = new HashMap<>();
Map<String, Set<String>> columnToDependencies = new HashMap<>();
catalogTable.getResolvedSchema().getColumns().stream()
.filter(column -> column instanceof Column.ComputedColumn)
.forEach(
column -> {
Set<String> referencedColumns =
ColumnReferenceFinder.findReferencedColumn(
column.getName(), catalogTable.getResolvedSchema());
for (String referencedColumn : referencedColumns) {
columnToReferences
.computeIfAbsent(referencedColumn, key -> new HashSet<>())
.add(column.getName());
columnToDependencies
.computeIfAbsent(column.getName(), key -> new HashSet<>())
.add(referencedColumn);
}
});
return new SchemaReferencesManager(
new HashSet<>(catalogTable.getResolvedSchema().getColumnNames()),
columnToReferences,
columnToDependencies,
catalogTable
.getResolvedSchema()
.getPrimaryKey()
.map(constraint -> new HashSet<>(constraint.getColumns()))
.orElse(new HashSet<>()),
ColumnReferenceFinder.findWatermarkReferencedColumn(
catalogTable.getResolvedSchema()),
new HashSet<>(catalogTable.getPartitionKeys()),
new HashSet<>(
catalogTable
.getDistribution()
.map(TableDistribution::getBucketKeys)
.orElse(List.of())));
}
public void dropColumn(String columnName, Supplier<String> errorMsg) {
checkReferences(columnName, errorMsg);
if (primaryKeys.contains(columnName)) {
throw new ValidationException(
String.format(
"%sThe column %s is used as the primary key.",
errorMsg.get(), EncodingUtils.escapeIdentifier(columnName)));
}
columnToDependencies
.getOrDefault(columnName, Set.of())
.forEach(
referredColumn ->
columnToReferences.get(referredColumn).remove(columnName));
columnToDependencies.remove(columnName);
columns.remove(columnName);
}
public int getColumnDependencyCount(String columnName) {
return columnToDependencies.getOrDefault(columnName, Set.of()).size();
}
public void checkReferences(String columnName, Supplier<String> errorMsg) {
if (!columns.contains(columnName)) {
throw new ValidationException(
String.format(
"%sThe column `%s` does not exist in the base table.",
errorMsg.get(), columnName));
}
if (columnToReferences.containsKey(columnName)
&& !columnToReferences.get(columnName).isEmpty()) {
throw new ValidationException(
String.format(
"%sThe column %s is referenced by computed column %s.",
errorMsg.get(),
EncodingUtils.escapeIdentifier(columnName),
columnToReferences.get(columnName).stream()
.map(EncodingUtils::escapeIdentifier)
.sorted()
.collect(Collectors.joining(", "))));
}
if (partitionKeys.contains(columnName)) {
throw new ValidationException(
String.format(
"%sThe column `%s` is used as the partition keys.",
errorMsg.get(), columnName));
}
if (watermarkReferences.contains(columnName)) {
throw new ValidationException(
String.format(
"%sThe column `%s` is referenced by watermark expression.",
errorMsg.get(), columnName));
}
if (distributionKeys.contains(columnName)) {
throw new ValidationException(
String.format(
"%sThe column `%s` is used as a distribution key.",
errorMsg.get(), columnName));
}
}
public static void buildUpdatedColumn(
Schema.Builder builder,
ResolvedCatalogBaseTable<?> oldTable,
BiConsumer<Schema.Builder, Schema.UnresolvedColumn> columnConsumer) {
// build column
oldTable.getUnresolvedSchema()
.getColumns()
.forEach(column -> columnConsumer.accept(builder, column));
}
public static void buildUpdatedWatermark(
Schema.Builder builder, ResolvedCatalogBaseTable<?> oldTable) {
oldTable.getUnresolvedSchema()
.getWatermarkSpecs()
.forEach(
watermarkSpec ->
builder.watermark(
watermarkSpec.getColumnName(),
watermarkSpec.getWatermarkExpression()));
}
public static void buildUpdatedPrimaryKey(
Schema.Builder builder,
ResolvedCatalogBaseTable<?> oldTable,
Function<String, String> columnRenamer) {
oldTable.getUnresolvedSchema()
.getPrimaryKey()
.ifPresent(
pk -> {
List<String> oldPrimaryKeyNames = pk.getColumnNames();
String constrainName = pk.getConstraintName();
List<String> newPrimaryKeyNames =
oldPrimaryKeyNames.stream()
.map(columnRenamer)
.collect(Collectors.toList());
builder.primaryKeyNamed(constrainName, newPrimaryKeyNames);
});
}
}
|
SchemaReferencesManager
|
java
|
apache__camel
|
core/camel-core/src/test/java/org/apache/camel/processor/intercept/InterceptFromWithPredicateTest.java
|
{
"start": 904,
"end": 1620
}
|
class ____ extends InterceptFromRouteTestSupport {
@Override
protected RouteBuilder createRouteBuilder() {
return new RouteBuilder() {
public void configure() {
// intercept with a predicate test
interceptFrom().onWhen(header("foo").isEqualTo("bar")).to("mock:b").stop();
from("direct:start").to("mock:a");
}
};
}
@Override
protected void prepareMatchingTest() {
a.expectedMessageCount(0);
b.expectedMessageCount(1);
}
@Override
protected void prepareNonMatchingTest() {
a.expectedMessageCount(1);
b.expectedMessageCount(0);
}
}
|
InterceptFromWithPredicateTest
|
java
|
apache__avro
|
lang/java/avro/src/test/java/org/apache/avro/TestUnionError.java
|
{
"start": 1552,
"end": 4410
}
|
class ____ {
@Test
void unionErrorMessage() throws IOException {
String writerSchemaJson = " {\n" + " \"type\" : \"record\",\n"
+ " \"name\" : \"C\",\n" + " \"fields\" : [ {\n"
+ " \"name\" : \"c\",\n" + " \"type\" : [ {\n"
+ " \"type\" : \"record\",\n" + " \"name\" : \"A\",\n"
+ " \"fields\" : [ {\n" + " \"name\" : \"amount\",\n"
+ " \"type\" : \"int\"\n" + " } ]\n" + " }, {\n"
+ " \"type\" : \"record\",\n" + " \"name\" : \"B\",\n"
+ " \"fields\" : [ {\n" + " \"name\" : \"amount1\",\n"
+ " \"type\" : \"int\"\n" + " } ]\n" + " } ]\n"
+ " } ]\n" + " }";
Schema writerSchema = new Schema.Parser().parse(writerSchemaJson);
String readerSchemaJson = " {\n" + " \"type\" : \"record\",\n" + " \"name\" : \"C1\",\n"
+ " \"fields\" : [ {\n" + " \"name\" : \"c\",\n"
+ " \"type\" : [ {\n" + " \"type\" : \"record\",\n"
+ " \"name\" : \"A\",\n" + " \"fields\" : [ {\n"
+ " \"name\" : \"amount\",\n" + " \"type\" : \"int\"\n"
+ " } ]\n" + " }, \"float\" ]\n" + " } ]\n" + " }";
Schema readerSchema = new Schema.Parser().parse(readerSchemaJson);
List<Schema> unionSchemas = writerSchema.getField("c").schema().getTypes();
GenericRecord r = new GenericData.Record(writerSchema);
GenericRecord b = new GenericData.Record(unionSchemas.get(1));
b.put("amount1", 12);
r.put("c", b);
ByteArrayOutputStream outs = new ByteArrayOutputStream();
GenericDatumWriter<GenericRecord> datumWriter = new GenericDatumWriter<>(writerSchema);
BinaryEncoder encoder = EncoderFactory.get().binaryEncoder(outs, null);
datumWriter.write(r, encoder);
encoder.flush();
InputStream ins = new ByteArrayInputStream(outs.toByteArray());
BinaryDecoder decoder = DecoderFactory.get().binaryDecoder(ins, null);
GenericData data = new GenericData();
data.setFastReaderEnabled(false);
GenericDatumReader<GenericRecord> datumReader = new GenericDatumReader<>(writerSchema, readerSchema, data);
AvroTypeException avroException = assertThrows(AvroTypeException.class, () -> datumReader.read(null, decoder));
assertEquals("Field \"c\" content mismatch: Found B, expecting union[A, float]", avroException.getMessage());
}
}
|
TestUnionError
|
java
|
spring-projects__spring-framework
|
spring-context/src/main/java/org/springframework/context/annotation/EnableLoadTimeWeaving.java
|
{
"start": 3821,
"end": 4142
}
|
class ____} to
* be registered through {@link LoadTimeWeaver#addTransformer}. AspectJ weaving will be
* activated by default if a "META-INF/aop.xml" resource is present on the classpath.
* Example:
*
* <pre class="code">
* @Configuration
* @EnableLoadTimeWeaving(aspectjWeaving=ENABLED)
* public
|
transformer
|
java
|
quarkusio__quarkus
|
independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/interceptors/privatemethod/PrivateInterceptorMethodTest.java
|
{
"start": 1015,
"end": 1182
}
|
class ____ {
@Simple
String foo() {
return "foo";
}
}
@Simple
@Priority(1)
@Interceptor
public static
|
SimpleBean
|
java
|
apache__spark
|
common/variant/src/main/java/org/apache/spark/types/variant/VariantSchema.java
|
{
"start": 1347,
"end": 1456
}
|
class ____ {
// Represents one field of an object in the shredding schema.
public static final
|
VariantSchema
|
java
|
netty__netty
|
testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketAutoReadTest.java
|
{
"start": 5633,
"end": 7177
}
|
class ____ extends ChannelInboundHandlerAdapter {
private final AtomicInteger count = new AtomicInteger();
private final CountDownLatch latch = new CountDownLatch(1);
private final CountDownLatch latch2;
private final boolean callRead;
AutoReadHandler(boolean callRead) {
this.callRead = callRead;
latch2 = new CountDownLatch(callRead ? 3 : 2);
}
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
ReferenceCountUtil.release(msg);
if (count.incrementAndGet() == 1) {
ctx.channel().config().setAutoRead(false);
}
if (callRead) {
// Test calling read in the EventLoop thread to ensure a read is eventually done.
ctx.read();
}
}
@Override
public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
latch.countDown();
latch2.countDown();
}
void assertSingleRead() throws InterruptedException {
assertTrue(latch.await(5, TimeUnit.SECONDS));
assertTrue(count.get() > 0);
}
void assertSingleReadSecondTry() throws InterruptedException {
assertTrue(latch2.await(5, TimeUnit.SECONDS));
assertEquals(callRead ? 3 : 2, count.get());
}
}
/**
* Designed to keep reading as long as autoread is enabled.
*/
private static final
|
AutoReadHandler
|
java
|
apache__commons-lang
|
src/test/java/org/apache/commons/lang3/builder/EqualsBuilderTest.java
|
{
"start": 8121,
"end": 8364
}
|
class ____ extends TestObject {
@SuppressWarnings("unused")
private final transient int t;
TestTSubObject(final int a, final int t) {
super(a);
this.t = t;
}
}
static
|
TestTSubObject
|
java
|
apache__kafka
|
clients/src/test/java/org/apache/kafka/common/security/scram/internals/ScramMessagesTest.java
|
{
"start": 1835,
"end": 15343
}
|
class ____ {
private static final String[] VALID_EXTENSIONS = {
"ext=val1",
"anotherext=name1=value1 name2=another test value \"\'!$[]()",
"first=val1,second=name1 = value ,third=123"
};
private static final String[] INVALID_EXTENSIONS = {
"ext1=value",
"ext",
"ext=value1,value2",
"ext=,",
"ext =value"
};
private static final String[] VALID_RESERVED = {
"m=reserved-value",
"m=name1=value1 name2=another test value \"\'!$[]()"
};
private static final String[] INVALID_RESERVED = {
"m",
"m=name,value",
"m=,"
};
private ScramFormatter formatter;
@BeforeEach
public void setUp() throws Exception {
formatter = new ScramFormatter(ScramMechanism.SCRAM_SHA_256);
}
@Test
public void validClientFirstMessage() throws SaslException {
String nonce = formatter.secureRandomString();
ClientFirstMessage m = new ClientFirstMessage("someuser", nonce, Collections.emptyMap());
checkClientFirstMessage(m, "someuser", nonce, "");
// Default format used by Kafka client: only user and nonce are specified
String str = String.format("n,,n=testuser,r=%s", nonce);
m = createScramMessage(ClientFirstMessage.class, str);
checkClientFirstMessage(m, "testuser", nonce, "");
m = new ClientFirstMessage(m.toBytes());
checkClientFirstMessage(m, "testuser", nonce, "");
// Username containing comma, encoded as =2C
str = String.format("n,,n=test=2Cuser,r=%s", nonce);
m = createScramMessage(ClientFirstMessage.class, str);
checkClientFirstMessage(m, "test=2Cuser", nonce, "");
assertEquals("test,user", ScramFormatter.username(m.saslName()));
// Username containing equals, encoded as =3D
str = String.format("n,,n=test=3Duser,r=%s", nonce);
m = createScramMessage(ClientFirstMessage.class, str);
checkClientFirstMessage(m, "test=3Duser", nonce, "");
assertEquals("test=user", ScramFormatter.username(m.saslName()));
// Optional authorization id specified
str = String.format("n,a=testauthzid,n=testuser,r=%s", nonce);
checkClientFirstMessage(createScramMessage(ClientFirstMessage.class, str), "testuser", nonce, "testauthzid");
// Optional reserved value specified
for (String reserved : VALID_RESERVED) {
str = String.format("n,,%s,n=testuser,r=%s", reserved, nonce);
checkClientFirstMessage(createScramMessage(ClientFirstMessage.class, str), "testuser", nonce, "");
}
// Optional extension specified
for (String extension : VALID_EXTENSIONS) {
str = String.format("n,,n=testuser,r=%s,%s", nonce, extension);
checkClientFirstMessage(createScramMessage(ClientFirstMessage.class, str), "testuser", nonce, "");
}
//optional tokenauth specified as extensions
str = String.format("n,,n=testuser,r=%s,%s", nonce, "tokenauth=true");
m = createScramMessage(ClientFirstMessage.class, str);
assertTrue(m.extensions().tokenAuthenticated(), "Token authentication not set from extensions");
}
@Test
public void invalidClientFirstMessage() {
String nonce = formatter.secureRandomString();
// Invalid entry in gs2-header
String invalid = String.format("n,x=something,n=testuser,r=%s", nonce);
checkInvalidScramMessage(ClientFirstMessage.class, invalid);
// Invalid reserved entry
for (String reserved : INVALID_RESERVED) {
invalid = String.format("n,,%s,n=testuser,r=%s", reserved, nonce);
checkInvalidScramMessage(ClientFirstMessage.class, invalid);
}
// Invalid extension
for (String extension : INVALID_EXTENSIONS) {
invalid = String.format("n,,n=testuser,r=%s,%s", nonce, extension);
checkInvalidScramMessage(ClientFirstMessage.class, invalid);
}
}
@Test
public void validServerFirstMessage() throws SaslException {
String clientNonce = formatter.secureRandomString();
String serverNonce = formatter.secureRandomString();
String nonce = clientNonce + serverNonce;
String salt = randomBytesAsString();
ServerFirstMessage m = new ServerFirstMessage(clientNonce, serverNonce, toBytes(salt), 8192);
checkServerFirstMessage(m, nonce, salt, 8192);
// Default format used by Kafka clients, only nonce, salt and iterations are specified
String str = String.format("r=%s,s=%s,i=4096", nonce, salt);
m = createScramMessage(ServerFirstMessage.class, str);
checkServerFirstMessage(m, nonce, salt, 4096);
m = new ServerFirstMessage(m.toBytes());
checkServerFirstMessage(m, nonce, salt, 4096);
// Optional reserved value
for (String reserved : VALID_RESERVED) {
str = String.format("%s,r=%s,s=%s,i=4096", reserved, nonce, salt);
checkServerFirstMessage(createScramMessage(ServerFirstMessage.class, str), nonce, salt, 4096);
}
// Optional extension
for (String extension : VALID_EXTENSIONS) {
str = String.format("r=%s,s=%s,i=4096,%s", nonce, salt, extension);
checkServerFirstMessage(createScramMessage(ServerFirstMessage.class, str), nonce, salt, 4096);
}
}
@Test
public void invalidServerFirstMessage() {
String nonce = formatter.secureRandomString();
String salt = randomBytesAsString();
// Invalid iterations
String invalid = String.format("r=%s,s=%s,i=0", nonce, salt);
checkInvalidScramMessage(ServerFirstMessage.class, invalid);
// Invalid salt
invalid = String.format("r=%s,s=%s,i=4096", nonce, "=123");
checkInvalidScramMessage(ServerFirstMessage.class, invalid);
// Invalid format
invalid = String.format("r=%s,invalid,s=%s,i=4096", nonce, salt);
checkInvalidScramMessage(ServerFirstMessage.class, invalid);
// Invalid reserved entry
for (String reserved : INVALID_RESERVED) {
invalid = String.format("%s,r=%s,s=%s,i=4096", reserved, nonce, salt);
checkInvalidScramMessage(ServerFirstMessage.class, invalid);
}
// Invalid extension
for (String extension : INVALID_EXTENSIONS) {
invalid = String.format("r=%s,s=%s,i=4096,%s", nonce, salt, extension);
checkInvalidScramMessage(ServerFirstMessage.class, invalid);
}
}
@Test
public void validClientFinalMessage() throws SaslException {
String nonce = formatter.secureRandomString();
String channelBinding = randomBytesAsString();
String proof = randomBytesAsString();
ClientFinalMessage m = new ClientFinalMessage(toBytes(channelBinding), nonce);
assertNull(m.proof(), "Invalid proof");
m.proof(toBytes(proof));
checkClientFinalMessage(m, channelBinding, nonce, proof);
// Default format used by Kafka client: channel-binding, nonce and proof are specified
String str = String.format("c=%s,r=%s,p=%s", channelBinding, nonce, proof);
m = createScramMessage(ClientFinalMessage.class, str);
checkClientFinalMessage(m, channelBinding, nonce, proof);
m = new ClientFinalMessage(m.toBytes());
checkClientFinalMessage(m, channelBinding, nonce, proof);
// Optional extension specified
for (String extension : VALID_EXTENSIONS) {
str = String.format("c=%s,r=%s,%s,p=%s", channelBinding, nonce, extension, proof);
checkClientFinalMessage(createScramMessage(ClientFinalMessage.class, str), channelBinding, nonce, proof);
}
}
@Test
public void invalidClientFinalMessage() {
String nonce = formatter.secureRandomString();
String channelBinding = randomBytesAsString();
String proof = randomBytesAsString();
// Invalid channel binding
String invalid = String.format("c=ab,r=%s,p=%s", nonce, proof);
checkInvalidScramMessage(ClientFirstMessage.class, invalid);
// Invalid proof
invalid = String.format("c=%s,r=%s,p=123", channelBinding, nonce);
checkInvalidScramMessage(ClientFirstMessage.class, invalid);
// Invalid extensions
for (String extension : INVALID_EXTENSIONS) {
invalid = String.format("c=%s,r=%s,%s,p=%s", channelBinding, nonce, extension, proof);
checkInvalidScramMessage(ClientFinalMessage.class, invalid);
}
}
@Test
public void validServerFinalMessage() throws SaslException {
String serverSignature = randomBytesAsString();
ServerFinalMessage m = new ServerFinalMessage("unknown-user", null);
checkServerFinalMessage(m, "unknown-user", null);
m = new ServerFinalMessage(null, toBytes(serverSignature));
checkServerFinalMessage(m, null, serverSignature);
// Default format used by Kafka clients for successful final message
String str = String.format("v=%s", serverSignature);
m = createScramMessage(ServerFinalMessage.class, str);
checkServerFinalMessage(m, null, serverSignature);
m = new ServerFinalMessage(m.toBytes());
checkServerFinalMessage(m, null, serverSignature);
// Default format used by Kafka clients for final message with error
str = "e=other-error";
m = createScramMessage(ServerFinalMessage.class, str);
checkServerFinalMessage(m, "other-error", null);
m = new ServerFinalMessage(m.toBytes());
checkServerFinalMessage(m, "other-error", null);
// Optional extension
for (String extension : VALID_EXTENSIONS) {
str = String.format("v=%s,%s", serverSignature, extension);
checkServerFinalMessage(createScramMessage(ServerFinalMessage.class, str), null, serverSignature);
}
}
@Test
public void invalidServerFinalMessage() {
String serverSignature = randomBytesAsString();
// Invalid error
String invalid = "e=error1,error2";
checkInvalidScramMessage(ServerFinalMessage.class, invalid);
// Invalid server signature
invalid = "v=1=23";
checkInvalidScramMessage(ServerFinalMessage.class, invalid);
// Invalid extensions
for (String extension : INVALID_EXTENSIONS) {
invalid = String.format("v=%s,%s", serverSignature, extension);
checkInvalidScramMessage(ServerFinalMessage.class, invalid);
invalid = String.format("e=unknown-user,%s", extension);
checkInvalidScramMessage(ServerFinalMessage.class, invalid);
}
}
private String randomBytesAsString() {
return Base64.getEncoder().encodeToString(formatter.secureRandomBytes());
}
private byte[] toBytes(String base64Str) {
return Base64.getDecoder().decode(base64Str);
}
private void checkClientFirstMessage(ClientFirstMessage message, String saslName, String nonce, String authzid) {
assertEquals(saslName, message.saslName());
assertEquals(nonce, message.nonce());
assertEquals(authzid, message.authorizationId());
}
private void checkServerFirstMessage(ServerFirstMessage message, String nonce, String salt, int iterations) {
assertEquals(nonce, message.nonce());
assertArrayEquals(Base64.getDecoder().decode(salt), message.salt());
assertEquals(iterations, message.iterations());
}
private void checkClientFinalMessage(ClientFinalMessage message, String channelBinding, String nonce, String proof) {
assertArrayEquals(Base64.getDecoder().decode(channelBinding), message.channelBinding());
assertEquals(nonce, message.nonce());
assertArrayEquals(Base64.getDecoder().decode(proof), message.proof());
}
private void checkServerFinalMessage(ServerFinalMessage message, String error, String serverSignature) {
assertEquals(error, message.error());
if (serverSignature == null)
assertNull(message.serverSignature(), "Unexpected server signature");
else
assertArrayEquals(Base64.getDecoder().decode(serverSignature), message.serverSignature());
}
@SuppressWarnings("unchecked")
private <T extends AbstractScramMessage> T createScramMessage(Class<T> clazz, String message) throws SaslException {
byte[] bytes = message.getBytes(StandardCharsets.UTF_8);
if (clazz == ClientFirstMessage.class)
return (T) new ClientFirstMessage(bytes);
else if (clazz == ServerFirstMessage.class)
return (T) new ServerFirstMessage(bytes);
else if (clazz == ClientFinalMessage.class)
return (T) new ClientFinalMessage(bytes);
else if (clazz == ServerFinalMessage.class)
return (T) new ServerFinalMessage(bytes);
else
throw new IllegalArgumentException("Unknown message type: " + clazz);
}
private <T extends AbstractScramMessage> void checkInvalidScramMessage(Class<T> clazz, String message) {
try {
createScramMessage(clazz, message);
fail("Exception not throws for invalid message of type " + clazz + " : " + message);
} catch (SaslException e) {
// Expected exception
}
}
}
|
ScramMessagesTest
|
java
|
google__dagger
|
javatests/dagger/functional/producers/monitoring/MonitoringModule.java
|
{
"start": 814,
"end": 1138
}
|
class ____ {
private final ProductionComponentMonitor.Factory monitorFactory;
MonitoringModule(ProductionComponentMonitor.Factory monitorFactory) {
this.monitorFactory = monitorFactory;
}
@Provides
@IntoSet
ProductionComponentMonitor.Factory monitorFactory() {
return monitorFactory;
}
}
|
MonitoringModule
|
java
|
apache__rocketmq
|
broker/src/test/java/org/apache/rocketmq/broker/longpolling/PullRequestHoldServiceTest.java
|
{
"start": 1704,
"end": 4620
}
|
class ____ {
@Mock
private BrokerController brokerController;
private PullRequestHoldService pullRequestHoldService;
@Mock
private PullRequest pullRequest;
private BrokerConfig brokerConfig = new BrokerConfig();
@Mock
private DefaultMessageStore defaultMessageStore;
@Mock
private DefaultMessageFilter defaultMessageFilter;
@Mock
private RemotingCommand remotingCommand;
@Mock
private Channel channel;
private SubscriptionData subscriptionData;
private static final String TEST_TOPIC = "TEST_TOPIC";
private static final int DEFAULT_QUEUE_ID = 0;
private static final long MAX_OFFSET = 100L;
@Before
public void before() {
when(brokerController.getBrokerConfig()).thenReturn(brokerConfig);
when(brokerController.getPullMessageProcessor()).thenReturn(new PullMessageProcessor(brokerController));
when(brokerController.getPullMessageExecutor()).thenReturn(Executors.newCachedThreadPool());
pullRequestHoldService = new PullRequestHoldService(brokerController);
subscriptionData = new SubscriptionData(TEST_TOPIC, "*");
pullRequest = new PullRequest(remotingCommand, channel, 3000, 3000, 0L, subscriptionData, defaultMessageFilter);
pullRequestHoldService.start();
}
@After
public void after() {
pullRequestHoldService.shutdown();
}
@Test
public void suspendPullRequestTest() {
Assertions.assertThatCode(() -> pullRequestHoldService.suspendPullRequest(TEST_TOPIC, DEFAULT_QUEUE_ID, pullRequest)).doesNotThrowAnyException();
}
@Test
public void getServiceNameTest() {
final String name = pullRequestHoldService.getServiceName();
assert StringUtils.isNotEmpty(name);
}
@Test
public void checkHoldRequestTest() {
Assertions.assertThatCode(() -> pullRequestHoldService.checkHoldRequest()).doesNotThrowAnyException();
}
@Test
public void notifyMessageArrivingTest() {
Assertions.assertThatCode(() -> pullRequestHoldService.notifyMessageArriving(TEST_TOPIC, DEFAULT_QUEUE_ID, MAX_OFFSET)).doesNotThrowAnyException();
Assertions.assertThatCode(() -> pullRequestHoldService.suspendPullRequest(TEST_TOPIC, DEFAULT_QUEUE_ID, pullRequest)).doesNotThrowAnyException();
Assertions.assertThatCode(() -> pullRequestHoldService.notifyMessageArriving(TEST_TOPIC, DEFAULT_QUEUE_ID, MAX_OFFSET,
1L, System.currentTimeMillis(), new byte[10], new HashMap<>())).doesNotThrowAnyException();
}
@Test
public void notifyMasterOnlineTest() {
Assertions.assertThatCode(() -> pullRequestHoldService.suspendPullRequest(TEST_TOPIC, DEFAULT_QUEUE_ID, pullRequest)).doesNotThrowAnyException();
Assertions.assertThatCode(() -> pullRequestHoldService.notifyMasterOnline()).doesNotThrowAnyException();
}
}
|
PullRequestHoldServiceTest
|
java
|
spring-projects__spring-framework
|
spring-core/src/main/java/org/springframework/asm/ClassReader.java
|
{
"start": 9321,
"end": 13430
}
|
class ____ major version " + readShort(classFileOffset + 6));
// }
// END OF PATCH
// Create the constant pool arrays. The constant_pool_count field is after the magic,
// minor_version and major_version fields, which use 4, 2 and 2 bytes respectively.
int constantPoolCount = readUnsignedShort(classFileOffset + 8);
cpInfoOffsets = new int[constantPoolCount];
constantUtf8Values = new String[constantPoolCount];
// Compute the offset of each constant pool entry, as well as a conservative estimate of the
// maximum length of the constant pool strings. The first constant pool entry is after the
// magic, minor_version, major_version and constant_pool_count fields, which use 4, 2, 2 and 2
// bytes respectively.
int currentCpInfoIndex = 1;
int currentCpInfoOffset = classFileOffset + 10;
int currentMaxStringLength = 0;
boolean hasBootstrapMethods = false;
boolean hasConstantDynamic = false;
// The offset of the other entries depend on the total size of all the previous entries.
while (currentCpInfoIndex < constantPoolCount) {
cpInfoOffsets[currentCpInfoIndex++] = currentCpInfoOffset + 1;
int cpInfoSize;
switch (classFileBuffer[currentCpInfoOffset]) {
case Symbol.CONSTANT_FIELDREF_TAG:
case Symbol.CONSTANT_METHODREF_TAG:
case Symbol.CONSTANT_INTERFACE_METHODREF_TAG:
case Symbol.CONSTANT_INTEGER_TAG:
case Symbol.CONSTANT_FLOAT_TAG:
case Symbol.CONSTANT_NAME_AND_TYPE_TAG:
cpInfoSize = 5;
break;
case Symbol.CONSTANT_DYNAMIC_TAG:
cpInfoSize = 5;
hasBootstrapMethods = true;
hasConstantDynamic = true;
break;
case Symbol.CONSTANT_INVOKE_DYNAMIC_TAG:
cpInfoSize = 5;
hasBootstrapMethods = true;
break;
case Symbol.CONSTANT_LONG_TAG:
case Symbol.CONSTANT_DOUBLE_TAG:
cpInfoSize = 9;
currentCpInfoIndex++;
break;
case Symbol.CONSTANT_UTF8_TAG:
cpInfoSize = 3 + readUnsignedShort(currentCpInfoOffset + 1);
if (cpInfoSize > currentMaxStringLength) {
// The size in bytes of this CONSTANT_Utf8 structure provides a conservative estimate
// of the length in characters of the corresponding string, and is much cheaper to
// compute than this exact length.
currentMaxStringLength = cpInfoSize;
}
break;
case Symbol.CONSTANT_METHOD_HANDLE_TAG:
cpInfoSize = 4;
break;
case Symbol.CONSTANT_CLASS_TAG:
case Symbol.CONSTANT_STRING_TAG:
case Symbol.CONSTANT_METHOD_TYPE_TAG:
case Symbol.CONSTANT_PACKAGE_TAG:
case Symbol.CONSTANT_MODULE_TAG:
cpInfoSize = 3;
break;
default:
throw new IllegalArgumentException();
}
currentCpInfoOffset += cpInfoSize;
}
maxStringLength = currentMaxStringLength;
// The Classfile's access_flags field is just after the last constant pool entry.
header = currentCpInfoOffset;
// Allocate the cache of ConstantDynamic values, if there is at least one.
constantDynamicValues = hasConstantDynamic ? new ConstantDynamic[constantPoolCount] : null;
// Read the BootstrapMethods attribute, if any (only get the offset of each method).
bootstrapMethodOffsets =
hasBootstrapMethods ? readBootstrapMethodsAttribute(currentMaxStringLength) : null;
}
/**
* Constructs a new {@link ClassReader} object.
*
* @param inputStream an input stream of the JVMS ClassFile structure to be read. This input
* stream must contain nothing more than the ClassFile structure itself. It is read from its
* current position to its end.
* @throws IOException if a problem occurs during reading.
*/
public ClassReader(final InputStream inputStream) throws IOException {
this(readStream(inputStream, false));
}
/**
* Constructs a new {@link ClassReader} object.
*
* @param className the fully qualified name of the
|
file
|
java
|
hibernate__hibernate-orm
|
hibernate-core/src/main/java/org/hibernate/engine/transaction/jta/platform/internal/WeblogicJtaPlatform.java
|
{
"start": 418,
"end": 898
}
|
class ____ extends AbstractJtaPlatform {
public static final String TM_NAME = "jakarta.transaction.TransactionManager";
public static final String UT_NAME = "jakarta.transaction.UserTransaction";
@Override
protected TransactionManager locateTransactionManager() {
return (TransactionManager) jndiService().locate( TM_NAME );
}
@Override
protected UserTransaction locateUserTransaction() {
return (UserTransaction) jndiService().locate( UT_NAME );
}
}
|
WeblogicJtaPlatform
|
java
|
apache__camel
|
core/camel-api/src/main/java/org/apache/camel/spi/DataFormatContentTypeHeader.java
|
{
"start": 886,
"end": 1334
}
|
interface ____ {
/**
* Whether the data format should set the <tt>Content-Type</tt> header with the type from the data format if the
* data format is capable of doing so.
* <p/>
* For example <tt>application/xml</tt> for data formats marshalling to XML, or <tt>application/json</tt> for data
* formats marshalling to JSON etc.
*/
void setContentTypeHeader(boolean contentTypeHeader);
}
|
DataFormatContentTypeHeader
|
java
|
elastic__elasticsearch
|
x-pack/plugin/esql/src/main/generated/org/elasticsearch/xpack/esql/expression/function/scalar/convert/ToDateNanosFromDatetimeEvaluator.java
|
{
"start": 4286,
"end": 4893
}
|
class ____ implements EvalOperator.ExpressionEvaluator.Factory {
private final Source source;
private final EvalOperator.ExpressionEvaluator.Factory in;
public Factory(Source source, EvalOperator.ExpressionEvaluator.Factory in) {
this.source = source;
this.in = in;
}
@Override
public ToDateNanosFromDatetimeEvaluator get(DriverContext context) {
return new ToDateNanosFromDatetimeEvaluator(source, in.get(context), context);
}
@Override
public String toString() {
return "ToDateNanosFromDatetimeEvaluator[" + "in=" + in + "]";
}
}
}
|
Factory
|
java
|
hibernate__hibernate-orm
|
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/MappedSuperclassWithGenericsTest.java
|
{
"start": 2880,
"end": 3017
}
|
class ____<T> {
private T whateverType;
}
@MappedSuperclass
@IdClass( PK.class )
public static abstract
|
AbstractGenericMappedSuperType
|
java
|
apache__dubbo
|
dubbo-maven-plugin/src/main/java/org/apache/dubbo/maven/plugin/protoc/DubboProtocCompilerMojo.java
|
{
"start": 3541,
"end": 24050
}
|
class ____ extends AbstractMojo {
@Parameter(property = "protoSourceDir", defaultValue = "${basedir}/src/main/proto")
private File protoSourceDir;
@Parameter(property = "outputDir", defaultValue = "${project.build.directory}/generated-sources/protobuf/java")
private File outputDir;
@Parameter(required = false, property = "dubboVersion")
private String dubboVersion;
@Parameter(required = true, readonly = true, defaultValue = "${project.remoteArtifactRepositories}")
private List<ArtifactRepository> remoteRepositories;
@Parameter(required = false, property = "protocExecutable")
private String protocExecutable;
@Parameter(required = false, property = "protocArtifact")
private String protocArtifact;
@Parameter(required = false, property = "protocVersion")
private String protocVersion;
@Parameter(required = false, defaultValue = "${project.build.directory}/protoc-plugins")
private File protocPluginDirectory;
@Parameter(required = true, defaultValue = "${project.build.directory}/protoc-dependencies")
private File temporaryProtoFileDirectory;
@Parameter(required = true, property = "dubboGenerateType", defaultValue = "tri")
private String dubboGenerateType;
@Parameter(defaultValue = "${project}", readonly = true)
protected MavenProject project;
@Parameter(defaultValue = "${session}", readonly = true)
protected MavenSession session;
@Parameter(required = true, readonly = true, property = "localRepository")
private ArtifactRepository localRepository;
@Component
private ArtifactFactory artifactFactory;
@Component
private RepositorySystem repositorySystem;
@Component
private ResolutionErrorHandler resolutionErrorHandler;
@Component
protected MavenProjectHelper projectHelper;
@Component
protected BuildContext buildContext;
final CommandLineUtils.StringStreamConsumer output = new CommandLineUtils.StringStreamConsumer();
final CommandLineUtils.StringStreamConsumer error = new CommandLineUtils.StringStreamConsumer();
private final DefaultProtocCommandBuilder defaultProtocCommandBuilder = new DefaultProtocCommandBuilder();
private final DubboProtocPluginWrapperFactory dubboProtocPluginWrapperFactory = new DubboProtocPluginWrapperFactory();
public void execute() throws MojoExecutionException, MojoFailureException {
Properties versionMatrix = new Properties();
ClassLoader loader = Thread.currentThread().getContextClassLoader();
try (InputStream stream = loader.getResourceAsStream("version-matrix.properties")) {
versionMatrix.load(stream);
} catch (IOException e) {
getLog().warn("Unable to load default version matrix", e);
}
if (dubboVersion == null) {
dubboVersion = versionMatrix.getProperty("dubbo.version");
}
if (protocVersion == null) {
protocVersion = versionMatrix.getProperty("protoc.version");
}
if (protocArtifact == null) {
final String osName = SystemPropertyConfigUtils.getSystemProperty(CommonConstants.SystemProperty.SYSTEM_OS_NAME);
final String osArch = SystemPropertyConfigUtils.getSystemProperty(CommonConstants.SystemProperty.OS_ARCH);
final String detectedName = normalizeOs(osName);
final String detectedArch = normalizeArch(osArch);
protocArtifact = "com.google.protobuf:protoc:" + protocVersion + ":exe:" + detectedName + '-' + detectedArch;
}
if (protocExecutable == null && protocArtifact != null) {
final Artifact artifact = createProtocArtifact(protocArtifact);
final File file = resolveBinaryArtifact(artifact);
protocExecutable = file.getAbsolutePath();
}
if (protocExecutable == null) {
getLog().warn("No 'protocExecutable' parameter is configured, using the default: 'protoc'");
protocExecutable = "protoc";
}
getLog().info("using protocExecutable: " + protocExecutable);
DubboProtocPlugin dubboProtocPlugin = buildDubboProtocPlugin(dubboVersion, dubboGenerateType, protocPluginDirectory);
getLog().info("build dubbo protoc plugin:" + dubboProtocPlugin + " success");
List<String> commandArgs = defaultProtocCommandBuilder.buildProtocCommandArgs(new ProtocMetaData(protocExecutable, makeAllProtoPaths(), findAllProtoFiles(protoSourceDir), outputDir, dubboProtocPlugin
));
if (!outputDir.exists()) {
FileUtils.mkdir(outputDir.getAbsolutePath());
}
try {
int exitStatus = executeCommandLine(commandArgs);
getLog().info("execute commandLine finished with exit code: " + exitStatus);
if (exitStatus != 0) {
getLog().error("PROTOC FAILED: " + getError());
throw new MojoFailureException(
"protoc did not exit cleanly. Review output for more information.");
} else if (StringUtils.isNotBlank(getError())) {
getLog().warn("PROTOC: " + getError());
}
linkProtoFilesToMaven();
} catch (CommandLineException e) {
throw new MojoExecutionException(e);
}
}
private static String normalizeOs(String value) {
value = normalize(value);
if (value.startsWith("linux")) {
return "linux";
}
if (value.startsWith("mac") || value.startsWith("osx")) {
return "osx";
}
if (value.startsWith("windows")) {
return "windows";
}
return "unknown";
}
private static String normalize(String value) {
if (value == null) {
return "";
}
return value.toLowerCase(Locale.US).replaceAll("[^a-z0-9]+", "");
}
private static String normalizeArch(String value) {
value = normalize(value);
if (value.matches("^(x8664|amd64|ia32e|em64t|x64)$")) {
return "x86_64";
}
if ("aarch64".equals(value)) {
return "aarch_64";
}
return "unknown";
}
public void linkProtoFilesToMaven() {
linkProtoSources();
linkGeneratedFiles();
}
public void linkProtoSources() {
projectHelper.addResource(project, protoSourceDir.getAbsolutePath(),
Collections.singletonList("**/*.proto*"), Collections.singletonList(""));
}
public void linkGeneratedFiles() {
project.addCompileSourceRoot(outputDir.getAbsolutePath());
buildContext.refresh(outputDir);
}
public List<File> findAllProtoFiles(final File protoSourceDir) {
if (protoSourceDir == null) {
throw new RuntimeException("'protoSourceDir' is null");
}
if (!protoSourceDir.isDirectory()) {
throw new RuntimeException(format("%s is not a directory", protoSourceDir));
}
final List<File> protoFilesInDirectory;
try {
protoFilesInDirectory = getFiles(protoSourceDir, "**/*.proto*", "");
} catch (IOException e) {
throw new RuntimeException("Unable to retrieve the list of files: " + e.getMessage(), e);
}
getLog().info("protoFilesInDirectory: " + protoFilesInDirectory);
return protoFilesInDirectory;
}
public int executeCommandLine(List<String> commandArgs) throws CommandLineException {
final Commandline cl = new Commandline();
cl.setExecutable(protocExecutable);
cl.addArguments(commandArgs.toArray(new String[]{}));
int attemptsLeft = 3;
while (true) {
try {
getLog().info("commandLine:" + cl.toString());
return CommandLineUtils.executeCommandLine(cl, null, output, error);
} catch (CommandLineException e) {
if (--attemptsLeft == 0 || e.getCause() == null) {
throw e;
}
getLog().warn("[PROTOC] Unable to invoke protoc, will retry " + attemptsLeft + " time(s)", e);
try {
Thread.sleep(1000L);
} catch (InterruptedException ex) {
Thread.currentThread().interrupt();
throw new RuntimeException(ex);
}
}
}
}
private DubboProtocPlugin buildDubboProtocPlugin(String dubboVersion, String dubboGenerateType, File protocPluginDirectory) {
DubboProtocPlugin dubboProtocPlugin = new DubboProtocPlugin();
DubboGenerateTypeEnum dubboGenerateTypeEnum = DubboGenerateTypeEnum.getByType(dubboGenerateType);
if (dubboGenerateTypeEnum == null) {
throw new RuntimeException(" can not find the dubboGenerateType: " + dubboGenerateType + ",please check it !");
}
dubboProtocPlugin.setId(dubboGenerateType);
dubboProtocPlugin.setMainClass(dubboGenerateTypeEnum.getMainClass());
dubboProtocPlugin.setDubboVersion(dubboVersion);
dubboProtocPlugin.setPluginDirectory(protocPluginDirectory);
dubboProtocPlugin.setJavaHome(SystemPropertyConfigUtils.getSystemProperty(CommonConstants.SystemProperty.JAVA_HOME));
DubboProtocPluginWrapper protocPluginWrapper = dubboProtocPluginWrapperFactory.findByOs();
dubboProtocPlugin.setResolvedJars(resolvePluginDependencies());
File protocPlugin = protocPluginWrapper.createProtocPlugin(dubboProtocPlugin, getLog());
boolean debugEnabled = getLog().isDebugEnabled();
if (debugEnabled) {
getLog().debug("protocPlugin: " + protocPlugin.getAbsolutePath());
}
dubboProtocPlugin.setProtocPlugin(protocPlugin);
return dubboProtocPlugin;
}
private List<File> resolvePluginDependencies() {
List<File> resolvedJars = new ArrayList<>();
final VersionRange versionSpec;
try {
versionSpec = VersionRange.createFromVersionSpec(dubboVersion);
} catch (InvalidVersionSpecificationException e) {
throw new RuntimeException("Invalid plugin version specification", e);
}
final Artifact protocPluginArtifact =
artifactFactory.createDependencyArtifact(
"org.apache.dubbo",
"dubbo-compiler",
versionSpec,
"jar",
"",
Artifact.SCOPE_RUNTIME);
final ArtifactResolutionRequest request = new ArtifactResolutionRequest()
.setArtifact(project.getArtifact())
.setResolveRoot(false)
.setArtifactDependencies(Collections.singleton(protocPluginArtifact))
.setManagedVersionMap(emptyMap())
.setLocalRepository(localRepository)
.setRemoteRepositories(remoteRepositories)
.setOffline(session.isOffline())
.setForceUpdate(session.getRequest().isUpdateSnapshots())
.setServers(session.getRequest().getServers())
.setMirrors(session.getRequest().getMirrors())
.setProxies(session.getRequest().getProxies());
final ArtifactResolutionResult result = repositorySystem.resolve(request);
try {
resolutionErrorHandler.throwErrors(request, result);
} catch (ArtifactResolutionException e) {
throw new RuntimeException("Unable to resolve plugin artifact: " + e.getMessage(), e);
}
final Set<Artifact> artifacts = result.getArtifacts();
if (artifacts == null || artifacts.isEmpty()) {
throw new RuntimeException("Unable to resolve plugin artifact");
}
for (final Artifact artifact : artifacts) {
resolvedJars.add(artifact.getFile());
}
if (getLog().isDebugEnabled()) {
getLog().debug("Resolved jars: " + resolvedJars);
}
return resolvedJars;
}
protected Artifact createProtocArtifact(final String artifactSpec) {
final String[] parts = artifactSpec.split(":");
if (parts.length < 3 || parts.length > 5) {
throw new RuntimeException(
"Invalid artifact specification format"
+ ", expected: groupId:artifactId:version[:type[:classifier]]"
+ ", actual: " + artifactSpec);
}
final String type = parts.length >= 4 ? parts[3] : "exe";
final String classifier = parts.length == 5 ? parts[4] : null;
// parts: [com.google.protobuf, protoc, 3.6.0, exe, osx-x86_64]
getLog().info("parts: " + Arrays.toString(parts));
return createDependencyArtifact(parts[0], parts[1], parts[2], type, classifier);
}
protected Artifact createDependencyArtifact(
final String groupId,
final String artifactId,
final String version,
final String type,
final String classifier
) {
final VersionRange versionSpec;
try {
versionSpec = VersionRange.createFromVersionSpec(version);
} catch (final InvalidVersionSpecificationException e) {
throw new RuntimeException("Invalid version specification", e);
}
return artifactFactory.createDependencyArtifact(
groupId,
artifactId,
versionSpec,
type,
classifier,
Artifact.SCOPE_RUNTIME);
}
protected File resolveBinaryArtifact(final Artifact artifact) {
final ArtifactResolutionResult result;
final ArtifactResolutionRequest request = new ArtifactResolutionRequest()
.setArtifact(project.getArtifact())
.setResolveRoot(false)
.setResolveTransitively(false)
.setArtifactDependencies(singleton(artifact))
.setManagedVersionMap(emptyMap())
.setLocalRepository(localRepository)
.setRemoteRepositories(remoteRepositories)
.setOffline(session.isOffline())
.setForceUpdate(session.getRequest().isUpdateSnapshots())
.setServers(session.getRequest().getServers())
.setMirrors(session.getRequest().getMirrors())
.setProxies(session.getRequest().getProxies());
result = repositorySystem.resolve(request);
try {
resolutionErrorHandler.throwErrors(request, result);
} catch (final ArtifactResolutionException e) {
throw new RuntimeException("Unable to resolve artifact: " + e.getMessage(), e);
}
final Set<Artifact> artifacts = result.getArtifacts();
if (artifacts == null || artifacts.isEmpty()) {
throw new RuntimeException("Unable to resolve artifact");
}
final Artifact resolvedBinaryArtifact = artifacts.iterator().next();
if (getLog().isDebugEnabled()) {
getLog().debug("Resolved artifact: " + resolvedBinaryArtifact);
}
final File sourceFile = resolvedBinaryArtifact.getFile();
final String sourceFileName = sourceFile.getName();
final String targetFileName;
if (Os.isFamily(Os.FAMILY_WINDOWS) && !sourceFileName.endsWith(".exe")) {
targetFileName = sourceFileName + ".exe";
} else {
targetFileName = sourceFileName;
}
final File targetFile = new File(protocPluginDirectory, targetFileName);
if (targetFile.exists()) {
getLog().debug("Executable file already exists: " + targetFile.getAbsolutePath());
return targetFile;
}
try {
FileUtils.forceMkdir(protocPluginDirectory);
} catch (final IOException e) {
throw new RuntimeException("Unable to create directory " + protocPluginDirectory, e);
}
try {
FileUtils.copyFile(sourceFile, targetFile);
} catch (final IOException e) {
throw new RuntimeException("Unable to copy the file to " + protocPluginDirectory, e);
}
if (!Os.isFamily(Os.FAMILY_WINDOWS)) {
boolean b = targetFile.setExecutable(true);
if (!b) {
throw new RuntimeException("Unable to make executable: " + targetFile.getAbsolutePath());
}
}
if (getLog().isDebugEnabled()) {
getLog().debug("Executable file: " + targetFile.getAbsolutePath());
}
return targetFile;
}
protected Set<File> makeAllProtoPaths() {
File temp = temporaryProtoFileDirectory;
if (temp.exists()) {
try {
cleanDirectory(temp);
} catch (IOException e) {
throw new RuntimeException("Unable to clean up temporary proto file directory", e);
}
}
Set<File> protoDirectories = new LinkedHashSet<>();
if (protoSourceDir.exists()) {
protoDirectories.add(protoSourceDir);
}
//noinspection deprecation
for (Artifact artifact : project.getCompileArtifacts()) {
File file = artifact.getFile();
if (file.isFile() && file.canRead() && !file.getName().endsWith(".xml")) {
try (JarFile jar = new JarFile(file)) {
Enumeration<JarEntry> jarEntries = jar.entries();
while (jarEntries.hasMoreElements()) {
JarEntry jarEntry = jarEntries.nextElement();
String jarEntryName = jarEntry.getName();
if (jarEntryName.endsWith(".proto")) {
File targetDirectory;
try {
targetDirectory = new File(temp, hash(jar.getName()));
String canonicalTargetDirectoryPath = targetDirectory.getCanonicalPath();
File target = new File(targetDirectory, jarEntryName);
String canonicalTargetPath = target.getCanonicalPath();
if (!canonicalTargetPath.startsWith(canonicalTargetDirectoryPath + File.separator)) {
throw new RuntimeException(
"ZIP SLIP: Entry " + jarEntry.getName() + " in " + jar.getName()
+ " is outside of the target dir");
}
FileUtils.mkdir(target.getParentFile().getAbsolutePath());
copyStreamToFile(new RawInputStreamFacade(jar.getInputStream(jarEntry)), target);
} catch (IOException e) {
throw new RuntimeException("Unable to unpack proto files", e);
}
protoDirectories.add(targetDirectory);
}
}
} catch (IOException e) {
throw new RuntimeException("Not a readable JAR artifact: " + file.getAbsolutePath(), e);
}
} else if (file.isDirectory()) {
List<File> protoFiles;
try {
protoFiles = getFiles(file, "**/*.proto", null);
} catch (IOException e) {
throw new RuntimeException("Unable to scan for proto files in: " + file.getAbsolutePath(), e);
}
if (!protoFiles.isEmpty()) {
protoDirectories.add(file);
}
}
}
return protoDirectories;
}
private static String hash(String input) {
try {
byte[] bytes = MessageDigest.getInstance("MD5").digest(input.getBytes(StandardCharsets.UTF_8));
StringBuilder sb = new StringBuilder(32);
for (byte b : bytes) {
sb.append(String.format("%02x", b));
}
return sb.toString();
} catch (Exception e) {
throw new RuntimeException("Unable to create MD5 digest", e);
}
}
public String getError() {
return fixUnicodeOutput(error.getOutput());
}
public String getOutput() {
return fixUnicodeOutput(output.getOutput());
}
private static String fixUnicodeOutput(final String message) {
// TODO default charset is not UTF-8 ?
return new String(message.getBytes(), StandardCharsets.UTF_8);
}
}
|
DubboProtocCompilerMojo
|
java
|
quarkusio__quarkus
|
extensions/oidc-client/deployment/src/main/java/io/quarkus/oidc/client/deployment/OidcClientAlwaysEnabledProcessor.java
|
{
"start": 299,
"end": 465
}
|
class ____ {
@BuildStep
FeatureBuildItem featureBuildItem() {
return new FeatureBuildItem(Feature.OIDC_CLIENT);
}
}
|
OidcClientAlwaysEnabledProcessor
|
java
|
elastic__elasticsearch
|
x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/evaluator/mapper/ExpressionMapper.java
|
{
"start": 792,
"end": 1191
}
|
class ____<E extends Expression> {
public final Class<E> typeToken;
public ExpressionMapper() {
typeToken = ReflectionUtils.detectSuperTypeForRuleLike(getClass());
}
public abstract ExpressionEvaluator.Factory map(
FoldContext foldCtx,
E expression,
Layout layout,
IndexedByShardId<? extends ShardContext> shardContexts
);
}
|
ExpressionMapper
|
java
|
apache__camel
|
core/camel-core-processor/src/main/java/org/apache/camel/processor/RemoveHeadersProcessor.java
|
{
"start": 1120,
"end": 2472
}
|
class ____ extends BaseProcessorSupport implements Traceable, IdAware, RouteIdAware {
private String id;
private String routeId;
private final String pattern;
private final String[] excludePattern;
public RemoveHeadersProcessor(String pattern, String[] excludePattern) {
this.pattern = pattern;
this.excludePattern = excludePattern;
}
@Override
public boolean process(Exchange exchange, AsyncCallback callback) {
try {
exchange.getMessage().removeHeaders(pattern, excludePattern);
} catch (Exception e) {
exchange.setException(e);
}
callback.done(true);
return true;
}
@Override
public String toString() {
return id;
}
@Override
public String getTraceLabel() {
return "removeHeaders[" + pattern + "]";
}
@Override
public String getId() {
return id;
}
@Override
public void setId(String id) {
this.id = id;
}
@Override
public String getRouteId() {
return routeId;
}
@Override
public void setRouteId(String routeId) {
this.routeId = routeId;
}
public String getPattern() {
return pattern;
}
public String[] getExcludePattern() {
return excludePattern;
}
}
|
RemoveHeadersProcessor
|
java
|
google__error-prone
|
core/src/test/java/com/google/errorprone/bugpatterns/nullness/ReturnMissingNullableTest.java
|
{
"start": 31391,
"end": 31933
}
|
class ____ {
public <T> T getMessage(boolean b, T t) {
return b ? null : t;
}
}
""")
.doTest();
}
@Test
public void negativeCases_alreadyAnnotated() {
createCompilationTestHelper()
.addSourceLines(
"com/google/errorprone/bugpatterns/nullness/LiteralNullReturnTest.java",
"""
package com.google.errorprone.bugpatterns.nullness;
import javax.annotation.Nullable;
public
|
LiteralNullReturnTest
|
java
|
spring-projects__spring-framework
|
spring-web/src/main/java/org/springframework/web/util/ContentCachingRequestWrapper.java
|
{
"start": 2110,
"end": 7573
}
|
class ____ extends HttpServletRequestWrapper {
private final FastByteArrayOutputStream cachedContent;
private final @Nullable Integer contentCacheLimit;
private @Nullable ServletInputStream inputStream;
private @Nullable BufferedReader reader;
/**
* Create a new ContentCachingRequestWrapper for the given servlet request.
* @param request the original servlet request
* @param cacheLimit the maximum number of bytes to cache per request;
* no limit is set if the value is 0 or less. It is recommended to set a
* concrete limit in order to avoid using too much memory.
* @since 4.3.6
* @see #handleContentOverflow(int)
*/
public ContentCachingRequestWrapper(HttpServletRequest request, int cacheLimit) {
super(request);
int contentLength = request.getContentLength();
this.cachedContent = (contentLength > 0 ?
new FastByteArrayOutputStream((cacheLimit > 0 ? Math.min(contentLength, cacheLimit) : contentLength)) :
new FastByteArrayOutputStream());
this.contentCacheLimit = (cacheLimit > 0 ? cacheLimit : null);
}
@Override
public ServletInputStream getInputStream() throws IOException {
if (this.inputStream == null) {
this.inputStream = new ContentCachingInputStream(getRequest().getInputStream());
}
return this.inputStream;
}
@Override
public String getCharacterEncoding() {
String enc = super.getCharacterEncoding();
return (enc != null ? enc : WebUtils.DEFAULT_CHARACTER_ENCODING);
}
@Override
public BufferedReader getReader() throws IOException {
if (this.reader == null) {
this.reader = new BufferedReader(new InputStreamReader(getInputStream(), getCharacterEncoding()));
}
return this.reader;
}
@Override
public String getParameter(String name) {
if (this.cachedContent.size() == 0 && isFormPost()) {
writeRequestParametersToCachedContent();
}
return super.getParameter(name);
}
@Override
public Map<String, String[]> getParameterMap() {
if (this.cachedContent.size() == 0 && isFormPost()) {
writeRequestParametersToCachedContent();
}
return super.getParameterMap();
}
@Override
public Enumeration<String> getParameterNames() {
if (this.cachedContent.size() == 0 && isFormPost()) {
writeRequestParametersToCachedContent();
}
return super.getParameterNames();
}
@Override
public String[] getParameterValues(String name) {
if (this.cachedContent.size() == 0 && isFormPost()) {
writeRequestParametersToCachedContent();
}
return super.getParameterValues(name);
}
private boolean isFormPost() {
String contentType = getContentType();
return (contentType != null && contentType.contains(MediaType.APPLICATION_FORM_URLENCODED_VALUE) &&
HttpMethod.POST.matches(getMethod()));
}
private void writeRequestParametersToCachedContent() {
try {
if (this.cachedContent.size() == 0) {
String requestEncoding = getCharacterEncoding();
Map<String, String[]> form = super.getParameterMap();
for (Iterator<String> nameIterator = form.keySet().iterator(); nameIterator.hasNext(); ) {
String name = nameIterator.next();
List<String> values = Arrays.asList(form.get(name));
for (Iterator<String> valueIterator = values.iterator(); valueIterator.hasNext(); ) {
String value = valueIterator.next();
this.cachedContent.write(URLEncoder.encode(name, requestEncoding).getBytes());
if (value != null) {
this.cachedContent.write('=');
this.cachedContent.write(URLEncoder.encode(value, requestEncoding).getBytes());
if (valueIterator.hasNext()) {
this.cachedContent.write('&');
}
}
}
if (nameIterator.hasNext()) {
this.cachedContent.write('&');
}
}
}
}
catch (IOException ex) {
throw new IllegalStateException("Failed to write request parameters to cached content", ex);
}
}
/**
* Return the cached request content as a byte array.
* <p>The returned array will never be larger than the content cache limit.
* <p><strong>Note:</strong> The byte array returned from this method
* reflects the amount of content that has been read at the time when it
* is called. If the application does not read the content, this method
* returns an empty array.
* @see #ContentCachingRequestWrapper(HttpServletRequest, int)
*/
public byte[] getContentAsByteArray() {
return this.cachedContent.toByteArray();
}
/**
* Return the cached request content as a String, using the configured
* {@link Charset}.
* <p><strong>Note:</strong> The String returned from this method
* reflects the amount of content that has been read at the time when it
* is called. If the application does not read the content, this method
* returns an empty String.
* @since 6.1
* @see #getContentAsByteArray()
*/
public String getContentAsString() {
return this.cachedContent.toString(Charset.forName(getCharacterEncoding()));
}
/**
* Template method for handling a content overflow: specifically, a request
* body being read that exceeds the specified content cache limit.
* <p>The default implementation is empty. Subclasses may override this to
* throw a payload-too-large exception or the like.
* @param contentCacheLimit the maximum number of bytes to cache per request
* which has just been exceeded
* @since 4.3.6
* @see #ContentCachingRequestWrapper(HttpServletRequest, int)
*/
protected void handleContentOverflow(int contentCacheLimit) {
}
private
|
ContentCachingRequestWrapper
|
java
|
elastic__elasticsearch
|
server/src/main/java/org/elasticsearch/index/mapper/RuntimeField.java
|
{
"start": 4142,
"end": 11182
}
|
class ____ {
private final Function<String, Builder> builderFunction;
public Parser(Function<String, RuntimeField.Builder> builderFunction) {
this.builderFunction = builderFunction;
}
RuntimeField.Builder parse(String name, Map<String, Object> node, MappingParserContext parserContext)
throws MapperParsingException {
RuntimeField.Builder builder = builderFunction.apply(name);
builder.parse(name, parserContext, node);
return builder;
}
}
/**
* Parse runtime fields from the provided map, using the provided parser context.
* @param node the map that holds the runtime fields configuration
* @param parserContext the parser context that holds info needed when parsing mappings
* @param supportsRemoval whether a null value for a runtime field should be properly parsed and
* translated to the removal of such runtime field
* @return the parsed runtime fields
*/
static Map<String, RuntimeField> parseRuntimeFields(
Map<String, Object> node,
MappingParserContext parserContext,
boolean supportsRemoval
) {
return parseRuntimeFields(node, parserContext, b -> b.createRuntimeField(parserContext), supportsRemoval);
}
/**
* Parse runtime fields from the provided map, using the provided parser context.
*
* This method also allows you to define how the runtime field will be created from its
* builder, so that it can be used by composite fields to build child fields using
* parent factory parameters.
*
* @param node the map that holds the runtime fields configuration
* @param parserContext the parser context that holds info needed when parsing mappings
* @param builder a function to convert a RuntimeField.Builder into a RuntimeField
* @param supportsRemoval whether a null value for a runtime field should be properly parsed and
* translated to the removal of such runtime field
* @return the parsed runtime fields
*/
static Map<String, RuntimeField> parseRuntimeFields(
Map<String, Object> node,
MappingParserContext parserContext,
Function<RuntimeField.Builder, RuntimeField> builder,
boolean supportsRemoval
) {
Map<String, RuntimeField> runtimeFields = new HashMap<>();
Iterator<Map.Entry<String, Object>> iterator = node.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry<String, Object> entry = iterator.next();
String fieldName = entry.getKey();
if (entry.getValue() == null) {
if (supportsRemoval) {
runtimeFields.put(fieldName, null);
} else {
throw new MapperParsingException(
"Runtime field [" + fieldName + "] was set to null but its removal is not supported in this context"
);
}
} else if (entry.getValue() instanceof Map) {
@SuppressWarnings("unchecked")
Map<String, Object> propNode = new HashMap<>(((Map<String, Object>) entry.getValue()));
Object typeNode = propNode.get("type");
String type;
if (typeNode == null) {
throw new MapperParsingException("No type specified for runtime field [" + fieldName + "]");
} else {
type = typeNode.toString();
}
Parser typeParser = parserContext.runtimeFieldParser(type);
if (typeParser == null) {
throw new MapperParsingException(
"The mapper type ["
+ type
+ "] declared on runtime field ["
+ fieldName
+ "] does not exist."
+ " It might have been created within a future version or requires a plugin to be installed."
+ " Check the documentation."
);
}
if (parserContext.getNamespaceValidator() != null) {
parserContext.getNamespaceValidator().validateNamespace(null, fieldName);
}
runtimeFields.put(fieldName, builder.apply(typeParser.parse(fieldName, propNode, parserContext)));
propNode.remove("type");
MappingParser.checkNoRemainingFields(fieldName, propNode);
iterator.remove();
} else {
throw new MapperParsingException(
"Expected map for runtime field [" + fieldName + "] definition but got a " + entry.getValue().getClass().getName()
);
}
}
return Collections.unmodifiableMap(runtimeFields);
}
/**
* Collect and return all {@link MappedFieldType} exposed by the provided {@link RuntimeField}s.
* Note that validation is performed to make sure that there are no name clashes among the collected runtime fields.
* This is because runtime fields with the same name are not accepted as part of the same section.
* @param runtimeFields the runtime to extract the mapped field types from
* @return the collected mapped field types
*/
static Map<String, MappedFieldType> collectFieldTypes(Collection<RuntimeField> runtimeFields) {
return runtimeFields.stream().flatMap(runtimeField -> {
List<String> names = runtimeField.asMappedFieldTypes()
.map(MappedFieldType::name)
.filter(
name -> name.equals(runtimeField.name()) == false
&& (name.startsWith(runtimeField.name() + ".") == false
|| name.length() > runtimeField.name().length() + 1 == false)
)
.toList();
if (names.isEmpty() == false) {
throw new IllegalStateException("Found sub-fields with name not belonging to the parent field they are part of " + names);
}
return runtimeField.asMappedFieldTypes();
}).collect(Collectors.toUnmodifiableMap(MappedFieldType::name, mappedFieldType -> mappedFieldType, (t, t2) -> {
throw new IllegalArgumentException("Found two runtime fields with same name [" + t.name() + "]");
}));
}
static <T> Function<FieldMapper, T> initializerNotSupported() {
return mapper -> { throw new UnsupportedOperationException(); };
}
static Script parseScript(String name, MappingParserContext parserContext, Object scriptObject) {
Script script = Script.parse(scriptObject);
if (script.getType() == ScriptType.STORED) {
throw new IllegalArgumentException("stored scripts are not supported for runtime field [" + name + "]");
}
return script;
}
}
|
Parser
|
java
|
spring-projects__spring-boot
|
core/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystem.java
|
{
"start": 3172,
"end": 18215
}
|
class ____ extends AbstractLoggingSystem implements BeanFactoryInitializationAotProcessor {
private static final String BRIDGE_HANDLER = "org.slf4j.bridge.SLF4JBridgeHandler";
private static final String CONFIGURATION_FILE_PROPERTY = "logback.configurationFile";
private static final LogLevels<Level> LEVELS = createLogLevels();
@SuppressWarnings("deprecation")
private static LogLevels<Level> createLogLevels() {
LogLevels<Level> levels = new LogLevels<>();
levels.map(LogLevel.TRACE, Level.TRACE);
levels.map(LogLevel.TRACE, Level.ALL);
levels.map(LogLevel.DEBUG, Level.DEBUG);
levels.map(LogLevel.INFO, Level.INFO);
levels.map(LogLevel.WARN, Level.WARN);
levels.map(LogLevel.ERROR, Level.ERROR);
levels.map(LogLevel.FATAL, Level.ERROR);
levels.map(LogLevel.OFF, Level.OFF);
return levels;
}
private static final TurboFilter SUPPRESS_ALL_FILTER = new TurboFilter() {
@Override
public FilterReply decide(Marker marker, ch.qos.logback.classic.Logger logger, Level level, String format,
Object[] params, Throwable t) {
return FilterReply.DENY;
}
};
private final StatusPrinter2 statusPrinter = new StatusPrinter2();
public LogbackLoggingSystem(ClassLoader classLoader) {
super(classLoader);
}
@Override
public LoggingSystemProperties getSystemProperties(ConfigurableEnvironment environment) {
return new LogbackLoggingSystemProperties(environment, getDefaultValueResolver(environment), null);
}
@Override
protected String[] getStandardConfigLocations() {
return new String[] { "logback-test.groovy", "logback-test.xml", "logback.groovy", "logback.xml" };
}
@Override
public void beforeInitialize() {
LoggerContext loggerContext = getLoggerContext();
if (isAlreadyInitialized(loggerContext)) {
return;
}
super.beforeInitialize();
configureJdkLoggingBridgeHandler();
loggerContext.getTurboFilterList().add(SUPPRESS_ALL_FILTER);
}
private void configureJdkLoggingBridgeHandler() {
try {
if (isBridgeJulIntoSlf4j()) {
removeJdkLoggingBridgeHandler();
SLF4JBridgeHandler.install();
}
}
catch (Throwable ex) {
// Ignore. No java.util.logging bridge is installed.
}
}
private boolean isBridgeJulIntoSlf4j() {
return isBridgeHandlerAvailable() && isJulUsingASingleConsoleHandlerAtMost();
}
private boolean isBridgeHandlerAvailable() {
return ClassUtils.isPresent(BRIDGE_HANDLER, getClassLoader());
}
private boolean isJulUsingASingleConsoleHandlerAtMost() {
java.util.logging.Logger rootLogger = LogManager.getLogManager().getLogger("");
Handler[] handlers = rootLogger.getHandlers();
return handlers.length == 0 || (handlers.length == 1 && handlers[0] instanceof ConsoleHandler);
}
private void removeJdkLoggingBridgeHandler() {
try {
removeDefaultRootHandler();
SLF4JBridgeHandler.uninstall();
}
catch (Throwable ex) {
// Ignore and continue
}
}
private void removeDefaultRootHandler() {
try {
java.util.logging.Logger rootLogger = LogManager.getLogManager().getLogger("");
Handler[] handlers = rootLogger.getHandlers();
if (handlers.length == 1 && handlers[0] instanceof ConsoleHandler) {
rootLogger.removeHandler(handlers[0]);
}
}
catch (Throwable ex) {
// Ignore and continue
}
}
@Override
public void initialize(LoggingInitializationContext initializationContext, @Nullable String configLocation,
@Nullable LogFile logFile) {
LoggerContext loggerContext = getLoggerContext();
putInitializationContextObjects(loggerContext, initializationContext);
if (isAlreadyInitialized(loggerContext)) {
return;
}
if (!initializeFromAotGeneratedArtifactsIfPossible(initializationContext, logFile)) {
super.initialize(initializationContext, configLocation, logFile);
}
loggerContext.getTurboFilterList().remove(SUPPRESS_ALL_FILTER);
markAsInitialized(loggerContext);
if (StringUtils.hasText(System.getProperty(CONFIGURATION_FILE_PROPERTY))) {
getLogger(LogbackLoggingSystem.class.getName()).warn("Ignoring '" + CONFIGURATION_FILE_PROPERTY
+ "' system property. Please use 'logging.config' instead.");
}
}
private boolean initializeFromAotGeneratedArtifactsIfPossible(LoggingInitializationContext initializationContext,
@Nullable LogFile logFile) {
if (!AotDetector.useGeneratedArtifacts()) {
return false;
}
if (initializationContext != null) {
Environment environment = initializationContext.getEnvironment();
Assert.state(environment != null, "'environment' must not be null");
applySystemProperties(environment, logFile);
}
LoggerContext loggerContext = getLoggerContext();
stopAndReset(loggerContext);
withLoggingSuppressed(() -> putInitializationContextObjects(loggerContext, initializationContext));
SystemStatusListener.addTo(loggerContext);
SpringBootJoranConfigurator configurator = new SpringBootJoranConfigurator(initializationContext);
configurator.setContext(loggerContext);
boolean configuredUsingAotGeneratedArtifacts = configurator.configureUsingAotGeneratedArtifacts();
if (configuredUsingAotGeneratedArtifacts) {
reportConfigurationErrorsIfNecessary(loggerContext);
}
return configuredUsingAotGeneratedArtifacts;
}
@Override
protected void loadDefaults(LoggingInitializationContext initializationContext, @Nullable LogFile logFile) {
LoggerContext loggerContext = getLoggerContext();
stopAndReset(loggerContext);
withLoggingSuppressed(() -> {
boolean debug = Boolean.getBoolean("logback.debug");
putInitializationContextObjects(loggerContext, initializationContext);
SystemStatusListener.addTo(loggerContext, debug);
Environment environment = initializationContext.getEnvironment();
Assert.state(environment != null, "'environment' must not be null");
// Apply system properties directly in case the same JVM runs multiple apps
new LogbackLoggingSystemProperties(environment, getDefaultValueResolver(environment),
loggerContext::putProperty)
.apply(logFile);
LogbackConfigurator configurator = (!debug) ? new LogbackConfigurator(loggerContext)
: new DebugLogbackConfigurator(loggerContext);
new DefaultLogbackConfiguration(logFile).apply(configurator);
loggerContext.setPackagingDataEnabled(true);
loggerContext.start();
});
}
@Override
protected void loadConfiguration(LoggingInitializationContext initializationContext, String location,
@Nullable LogFile logFile) {
LoggerContext loggerContext = getLoggerContext();
stopAndReset(loggerContext);
withLoggingSuppressed(() -> {
putInitializationContextObjects(loggerContext, initializationContext);
if (initializationContext != null) {
Environment environment = initializationContext.getEnvironment();
Assert.state(environment != null, "'environment' must not be null");
applySystemProperties(environment, logFile);
}
SystemStatusListener.addTo(loggerContext);
try {
Resource resource = ApplicationResourceLoader.get().getResource(location);
configureByResourceUrl(initializationContext, loggerContext, resource.getURL());
}
catch (Exception ex) {
throw new IllegalStateException("Could not initialize Logback logging from " + location, ex);
}
loggerContext.start();
});
reportConfigurationErrorsIfNecessary(loggerContext);
}
private void reportConfigurationErrorsIfNecessary(LoggerContext loggerContext) {
StringBuilder errors = new StringBuilder();
List<Throwable> suppressedExceptions = new ArrayList<>();
for (Status status : loggerContext.getStatusManager().getCopyOfStatusList()) {
if (status.getLevel() == Status.ERROR) {
errors.append((!errors.isEmpty()) ? String.format("%n") : "");
errors.append(status);
if (status.getThrowable() != null) {
suppressedExceptions.add(status.getThrowable());
}
}
}
if (errors.isEmpty()) {
if (!StatusUtil.contextHasStatusListener(loggerContext)) {
this.statusPrinter.printInCaseOfErrorsOrWarnings(loggerContext);
}
return;
}
IllegalStateException ex = new IllegalStateException(
String.format("Logback configuration error detected: %n%s", errors));
suppressedExceptions.forEach(ex::addSuppressed);
throw ex;
}
private void configureByResourceUrl(LoggingInitializationContext initializationContext, LoggerContext loggerContext,
URL url) throws JoranException {
JoranConfigurator configurator = new SpringBootJoranConfigurator(initializationContext);
configurator.setContext(loggerContext);
configurator.doConfigure(url);
}
private void stopAndReset(LoggerContext loggerContext) {
loggerContext.stop();
loggerContext.reset();
if (isBridgeHandlerInstalled()) {
addLevelChangePropagator(loggerContext);
}
}
private boolean isBridgeHandlerInstalled() {
if (!isBridgeHandlerAvailable()) {
return false;
}
java.util.logging.Logger rootLogger = LogManager.getLogManager().getLogger("");
Handler[] handlers = rootLogger.getHandlers();
return handlers.length == 1 && handlers[0] instanceof SLF4JBridgeHandler;
}
private void addLevelChangePropagator(LoggerContext loggerContext) {
LevelChangePropagator levelChangePropagator = new LevelChangePropagator();
levelChangePropagator.setResetJUL(true);
levelChangePropagator.setContext(loggerContext);
loggerContext.addListener(levelChangePropagator);
}
@Override
public void cleanUp() {
LoggerContext context = getLoggerContext();
markAsUninitialized(context);
super.cleanUp();
if (isBridgeHandlerAvailable()) {
removeJdkLoggingBridgeHandler();
}
context.getStatusManager().clear();
context.getTurboFilterList().remove(SUPPRESS_ALL_FILTER);
}
@Override
protected void reinitialize(LoggingInitializationContext initializationContext) {
LoggerContext loggerContext = getLoggerContext();
loggerContext.reset();
loggerContext.getStatusManager().clear();
String location = getSelfInitializationConfig();
Assert.state(location != null, "location must not be null");
loadConfiguration(initializationContext, location, null);
}
private void putInitializationContextObjects(LoggerContext loggerContext,
LoggingInitializationContext initializationContext) {
withLoggingSuppressed(
() -> loggerContext.putObject(Environment.class.getName(), initializationContext.getEnvironment()));
}
@Override
public List<LoggerConfiguration> getLoggerConfigurations() {
List<LoggerConfiguration> result = new ArrayList<>();
for (ch.qos.logback.classic.Logger logger : getLoggerContext().getLoggerList()) {
result.add(getLoggerConfiguration(logger));
}
result.sort(CONFIGURATION_COMPARATOR);
return result;
}
@Override
public @Nullable LoggerConfiguration getLoggerConfiguration(String loggerName) {
String name = getLoggerName(loggerName);
LoggerContext loggerContext = getLoggerContext();
return getLoggerConfiguration(loggerContext.exists(name));
}
private String getLoggerName(@Nullable String name) {
if (!StringUtils.hasLength(name) || Logger.ROOT_LOGGER_NAME.equals(name)) {
return ROOT_LOGGER_NAME;
}
return name;
}
private @Nullable LoggerConfiguration getLoggerConfiguration(ch.qos.logback.classic.@Nullable Logger logger) {
if (logger == null) {
return null;
}
LogLevel level = LEVELS.convertNativeToSystem(logger.getLevel());
LogLevel effectiveLevel = LEVELS.convertNativeToSystem(logger.getEffectiveLevel());
String name = getLoggerName(logger.getName());
Assert.state(effectiveLevel != null, "effectiveLevel must not be null");
return new LoggerConfiguration(name, level, effectiveLevel);
}
@Override
public Set<LogLevel> getSupportedLogLevels() {
return LEVELS.getSupported();
}
@Override
public void setLogLevel(@Nullable String loggerName, @Nullable LogLevel level) {
ch.qos.logback.classic.Logger logger = getLogger(loggerName);
if (logger != null) {
logger.setLevel(LEVELS.convertSystemToNative(level));
}
}
@Override
public Runnable getShutdownHandler() {
return () -> getLoggerContext().stop();
}
private ch.qos.logback.classic.Logger getLogger(@Nullable String name) {
LoggerContext factory = getLoggerContext();
return factory.getLogger(getLoggerName(name));
}
private LoggerContext getLoggerContext() {
ILoggerFactory factory = getLoggerFactory();
Assert.state(factory instanceof LoggerContext,
() -> String.format(
"LoggerFactory is not a Logback LoggerContext but Logback is on "
+ "the classpath. Either remove Logback or the competing "
+ "implementation (%s loaded from %s). If you are using "
+ "WebLogic you will need to add 'org.slf4j' to "
+ "prefer-application-packages in WEB-INF/weblogic.xml",
factory.getClass(), getLocation(factory)));
return (LoggerContext) factory;
}
private ILoggerFactory getLoggerFactory() {
ILoggerFactory factory = LoggerFactory.getILoggerFactory();
while (factory instanceof SubstituteLoggerFactory) {
try {
Thread.sleep(50);
}
catch (InterruptedException ex) {
Thread.currentThread().interrupt();
throw new IllegalStateException("Interrupted while waiting for non-substitute logger factory", ex);
}
factory = LoggerFactory.getILoggerFactory();
}
return factory;
}
private Object getLocation(ILoggerFactory factory) {
try {
ProtectionDomain protectionDomain = factory.getClass().getProtectionDomain();
CodeSource codeSource = protectionDomain.getCodeSource();
if (codeSource != null) {
return codeSource.getLocation();
}
}
catch (SecurityException ex) {
// Unable to determine location
}
return "unknown location";
}
private boolean isAlreadyInitialized(LoggerContext loggerContext) {
return loggerContext.getObject(LoggingSystem.class.getName()) != null;
}
private void markAsInitialized(LoggerContext loggerContext) {
loggerContext.putObject(LoggingSystem.class.getName(), new Object());
}
private void markAsUninitialized(LoggerContext loggerContext) {
loggerContext.removeObject(LoggingSystem.class.getName());
}
@Override
protected String getDefaultLogCorrelationPattern() {
return "%correlationId";
}
@Override
public BeanFactoryInitializationAotContribution processAheadOfTime(ConfigurableListableBeanFactory beanFactory) {
String key = BeanFactoryInitializationAotContribution.class.getName();
LoggerContext context = getLoggerContext();
BeanFactoryInitializationAotContribution contribution = (BeanFactoryInitializationAotContribution) context
.getObject(key);
context.removeObject(key);
return contribution;
}
private void withLoggingSuppressed(Runnable action) {
TurboFilterList turboFilters = getLoggerContext().getTurboFilterList();
turboFilters.add(SUPPRESS_ALL_FILTER);
try {
action.run();
}
finally {
turboFilters.remove(SUPPRESS_ALL_FILTER);
}
}
void setStatusPrinterStream(PrintStream stream) {
this.statusPrinter.setPrintStream(stream);
}
/**
* {@link LoggingSystemFactory} that returns {@link LogbackLoggingSystem} if possible.
*/
@Order(Ordered.HIGHEST_PRECEDENCE + 1024)
public static
|
LogbackLoggingSystem
|
java
|
spring-projects__spring-framework
|
spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/OptionTagTests.java
|
{
"start": 16794,
"end": 17128
}
|
class ____ extends PropertyEditorSupport {
@Override
public void setAsText(String text) throws IllegalArgumentException {
setValue(new TestBean(text + "k", 123));
}
@Override
public String getAsText() {
return ((TestBean) getValue()).getName();
}
}
@SuppressWarnings("serial")
public static
|
TestBeanPropertyEditor
|
java
|
spring-projects__spring-framework
|
spring-core/src/test/java/org/springframework/core/annotation/AnnotatedElementUtilsTests.java
|
{
"start": 57866,
"end": 57954
}
|
class ____ extends TxConfig {
}
@TxInheritedComposed
@TxComposed
static
|
DerivedTxConfig
|
java
|
apache__camel
|
dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/ClasComponentBuilderFactory.java
|
{
"start": 6066,
"end": 7058
}
|
class ____
extends AbstractComponentBuilder<ClassComponent>
implements ClasComponentBuilder {
@Override
protected ClassComponent buildConcreteComponent() {
return new ClassComponent();
}
@Override
protected boolean setPropertyOnComponent(
Component component,
String name,
Object value) {
switch (name) {
case "lazyStartProducer": ((ClassComponent) component).setLazyStartProducer((boolean) value); return true;
case "scope": ((ClassComponent) component).setScope((org.apache.camel.BeanScope) value); return true;
case "autowiredEnabled": ((ClassComponent) component).setAutowiredEnabled((boolean) value); return true;
case "beanInfoCacheSize": ((ClassComponent) component).setBeanInfoCacheSize((int) value); return true;
default: return false;
}
}
}
}
|
ClasComponentBuilderImpl
|
java
|
assertj__assertj-core
|
assertj-core/src/test/java/org/assertj/core/api/shortarray/ShortArrayAssert_containsExactly_Test.java
|
{
"start": 1150,
"end": 1812
}
|
class ____ extends ShortArrayAssertBaseTest {
@Override
protected ShortArrayAssert invoke_api_method() {
return assertions.containsExactly((short) 1, (short) 2);
}
@Override
protected void verify_internal_effects() {
verify(arrays).assertContainsExactly(getInfo(assertions), getActual(assertions), arrayOf(1, 2));
}
@Test
void should_honor_the_given_element_comparator() {
short[] actual = new short[] { (short) 1, (short) 2, (short) 3 };
assertThat(actual).usingElementComparator(new AbsValueComparator<Short>())
.containsExactly((short) -1, (short) 2, (short) 3);
}
}
|
ShortArrayAssert_containsExactly_Test
|
java
|
dropwizard__dropwizard
|
dropwizard-core/src/test/java/io/dropwizard/core/ConfigurationTest.java
|
{
"start": 420,
"end": 1934
}
|
class ____ {
private final Configuration configuration = new Configuration();
@Test
void hasAnHttpConfiguration() throws Exception {
assertThat(configuration.getServerFactory())
.isNotNull();
}
@Test
void hasALoggingConfiguration() throws Exception {
assertThat(configuration.getLoggingFactory())
.isNotNull();
}
@Test
void ensureConfigSerializable() throws Exception {
final ObjectMapper mapper = Jackson.newObjectMapper();
Class<?>[] dummyArray = {};
mapper.getSubtypeResolver()
.registerSubtypes(StreamSupport.stream(ServiceLoader.load(AppenderFactory.class).spliterator(), false)
.map(Object::getClass)
.collect(Collectors.toList())
.toArray(dummyArray));
mapper.getSubtypeResolver()
.registerSubtypes(StreamSupport.stream(ServiceLoader.load(ConnectorFactory.class).spliterator(), false)
.map(Object::getClass)
.collect(Collectors.toList())
.toArray(dummyArray));
// Issue-96: some types were not serializable
final String json = mapper.writeValueAsString(configuration);
assertThat(json)
.isNotNull();
// and as an added bonus, let's see we can also read it back:
final Configuration cfg = mapper.readValue(json, Configuration.class);
assertThat(cfg)
.isNotNull();
}
}
|
ConfigurationTest
|
java
|
assertj__assertj-core
|
assertj-core/src/test/java/org/assertj/core/api/comparable/AbstractComparableAssert_isGreaterThan_Test.java
|
{
"start": 992,
"end": 1354
}
|
class ____ extends AbstractComparableAssertBaseTest {
@Override
protected ConcreteComparableAssert invoke_api_method() {
return assertions.isGreaterThan(6);
}
@Override
protected void verify_internal_effects() {
verify(comparables).assertGreaterThan(getInfo(assertions), getActual(assertions), 6);
}
}
|
AbstractComparableAssert_isGreaterThan_Test
|
java
|
alibaba__druid
|
core/src/test/java/com/alibaba/druid/bvt/sql/oracle/OracleDropPackageTest.java
|
{
"start": 462,
"end": 1089
}
|
class ____ extends OracleTest {
public void test_0() throws Exception {
String sql = "DROP PACKAGE TEST.PACK_TEST1";
OracleStatementParser parser = new OracleStatementParser(sql);
List<SQLStatement> statementList = parser.parseStatementList();
print(statementList);
SQLStatement statement = statementList.get(0);
assertTrue(statement instanceof OracleDropPackageStatement);
assertEquals("TEST.PACK_TEST1", ((OracleDropPackageStatement) statement).getName().toString());
assertFalse(((OracleDropPackageStatement) statement).isBody());
}
}
|
OracleDropPackageTest
|
java
|
alibaba__nacos
|
client-basic/src/main/java/com/alibaba/nacos/client/auth/ram/identify/Credentials.java
|
{
"start": 721,
"end": 2318
}
|
class ____ implements SpasCredential {
private volatile String accessKey;
private volatile String secretKey;
private volatile String tenantId;
public Credentials() {
this(null, null, null);
}
public Credentials(String accessKey, String secretKey, String tenantId) {
this.accessKey = accessKey;
this.secretKey = secretKey;
this.tenantId = tenantId;
}
@Override
public String getAccessKey() {
return accessKey;
}
public void setAccessKey(String accessKey) {
this.accessKey = accessKey;
}
@Override
public String getSecretKey() {
return secretKey;
}
public void setSecretKey(String secretKey) {
this.secretKey = secretKey;
}
public String getTenantId() {
return tenantId;
}
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
public boolean valid() {
return accessKey != null && !accessKey.isEmpty() && secretKey != null && !secretKey.isEmpty();
}
/**
* Identical.
*
* @param other other
* @return true if identical
*/
public boolean identical(Credentials other) {
return this == other || (other != null && (accessKey == null && other.accessKey == null
|| accessKey != null && accessKey.equals(other.accessKey)) && (
secretKey == null && other.secretKey == null || secretKey != null && secretKey
.equals(other.secretKey)));
}
}
|
Credentials
|
java
|
apache__camel
|
core/camel-core-catalog/src/main/java/org/apache/camel/catalog/impl/AbstractCamelCatalog.java
|
{
"start": 2951,
"end": 13294
}
|
class ____ {
private static final Pattern SYNTAX_PATTERN = Pattern.compile("([\\w.]+)");
private static final Pattern ENV_OR_SYS_PATTERN = Pattern.compile("\\{\\{(env|sys):\\w+\\}\\}");
private static final Pattern SYNTAX_DASH_PATTERN = Pattern.compile("([\\w.-]+)");
private static final Pattern COMPONENT_SYNTAX_PARSER = Pattern.compile("([^\\w-]*)([\\w-]+)");
private SuggestionStrategy suggestionStrategy;
private JSonSchemaResolver jsonSchemaResolver;
public String componentJSonSchema(String name) {
return jsonSchemaResolver.getComponentJSonSchema(name);
}
public String modelJSonSchema(String name) {
return getJSonSchemaResolver().getModelJSonSchema(name);
}
public EipModel eipModel(String name) {
String json = modelJSonSchema(name);
return json != null ? JsonMapper.generateEipModel(json) : null;
}
public ComponentModel componentModel(String name) {
String json = componentJSonSchema(name);
return json != null ? JsonMapper.generateComponentModel(json) : null;
}
public String dataFormatJSonSchema(String name) {
return getJSonSchemaResolver().getDataFormatJSonSchema(name);
}
public DataFormatModel dataFormatModel(String name) {
String json = dataFormatJSonSchema(name);
return json != null ? JsonMapper.generateDataFormatModel(json) : null;
}
public String languageJSonSchema(String name) {
// if we try to look method then its in the bean.json file
if ("method".equals(name)) {
name = "bean";
}
return getJSonSchemaResolver().getLanguageJSonSchema(name);
}
public LanguageModel languageModel(String name) {
String json = languageJSonSchema(name);
return json != null ? JsonMapper.generateLanguageModel(json) : null;
}
public String transformerJSonSchema(String name) {
return getJSonSchemaResolver().getTransformerJSonSchema(name);
}
public TransformerModel transformerModel(String name) {
String json = transformerJSonSchema(name);
return json != null ? JsonMapper.generateTransformerModel(json) : null;
}
public PojoBeanModel pojoBeanModel(String name) {
String json = pojoBeanJSonSchema(name);
return json != null ? JsonMapper.generatePojoBeanModel(json) : null;
}
public String pojoBeanJSonSchema(String name) {
return getJSonSchemaResolver().getPojoBeanJSonSchema(name);
}
public String devConsoleJSonSchema(String name) {
return getJSonSchemaResolver().getDevConsoleJSonSchema(name);
}
public DevConsoleModel devConsoleModel(String name) {
String json = devConsoleJSonSchema(name);
return json != null ? JsonMapper.generateDevConsoleModel(json) : null;
}
public String otherJSonSchema(String name) {
return getJSonSchemaResolver().getOtherJSonSchema(name);
}
public OtherModel otherModel(String name) {
String json = otherJSonSchema(name);
return json != null ? JsonMapper.generateOtherModel(json) : null;
}
public String mainJSonSchema() {
return getJSonSchemaResolver().getMainJsonSchema();
}
public MainModel mainModel() {
String json = mainJSonSchema();
return json != null ? JsonMapper.generateMainModel(json) : null;
}
public String jbangJSonSchema() {
return getJSonSchemaResolver().getJBangJsonSchema();
}
public JBangModel jbangModel() {
String json = jbangJSonSchema();
return json != null ? JsonMapper.generateJBangModel(json) : null;
}
public SuggestionStrategy getSuggestionStrategy() {
return suggestionStrategy;
}
public void setSuggestionStrategy(SuggestionStrategy suggestionStrategy) {
this.suggestionStrategy = suggestionStrategy;
}
public JSonSchemaResolver getJSonSchemaResolver() {
return jsonSchemaResolver;
}
public void setJSonSchemaResolver(JSonSchemaResolver resolver) {
this.jsonSchemaResolver = resolver;
}
public boolean validateTimePattern(String pattern) {
return validateDuration(pattern);
}
public EndpointValidationResult validateEndpointProperties(String uri) {
return validateEndpointProperties(uri, false, false, false);
}
public EndpointValidationResult validateEndpointProperties(String uri, boolean ignoreLenientProperties) {
return validateEndpointProperties(uri, ignoreLenientProperties, false, false);
}
public EndpointValidationResult validateProperties(String scheme, Map<String, String> properties) {
boolean lenient = Boolean.getBoolean(properties.getOrDefault("lenient", "false"));
return validateProperties(scheme, properties, lenient, false, false);
}
private EndpointValidationResult validateProperties(
String scheme, Map<String, String> properties,
boolean lenient, boolean consumerOnly,
boolean producerOnly) {
EndpointValidationResult result = new EndpointValidationResult(scheme);
ComponentModel model = componentModel(scheme);
Map<String, BaseOptionModel> rows = new HashMap<>();
model.getComponentOptions().forEach(o -> rows.put(o.getName(), o));
// endpoint options have higher priority so overwrite component options
model.getEndpointOptions().forEach(o -> rows.put(o.getName(), o));
model.getEndpointPathOptions().forEach(o -> rows.put(o.getName(), o));
if (model.isApi()) {
String[] apiSyntax = StringHelper.splitWords(model.getApiSyntax());
String key = properties.get(apiSyntax[0]);
String key2 = apiSyntax.length > 1 ? properties.get(apiSyntax[1]) : null;
Map<String, BaseOptionModel> apiProperties = extractApiProperties(model, key, key2);
rows.putAll(apiProperties);
}
// the dataformat component refers to a data format so lets add the properties for the selected
// data format to the list of rows
if ("dataformat".equals(scheme)) {
String dfName = properties.get("name");
if (dfName != null) {
DataFormatModel dfModel = dataFormatModel(dfName);
if (dfModel != null) {
dfModel.getOptions().forEach(o -> rows.put(o.getName(), o));
}
}
}
for (Map.Entry<String, String> property : properties.entrySet()) {
String value = property.getValue();
String originalName = property.getKey();
// the name may be using an optional prefix, so lets strip that because the options
// in the schema are listed without the prefix
String name = stripOptionalPrefixFromName(rows, originalName);
// the name may be using a prefix, so lets see if we can find the real property name
String propertyName = getPropertyNameFromNameWithPrefix(rows, name);
if (propertyName != null) {
name = propertyName;
}
BaseOptionModel row = rows.get(name);
if (row == null) {
// unknown option
// only add as error if the component is not lenient properties, or not stub component
// and the name is not a property placeholder for one or more values
boolean namePlaceholder = name.startsWith("{{") && name.endsWith("}}");
if (!namePlaceholder && !"stub".equals(scheme)) {
if (lenient) {
// as if we are lenient then the option is a dynamic extra option which we cannot validate
result.addLenient(name);
} else {
// its unknown
result.addUnknown(name);
if (suggestionStrategy != null) {
String[] suggestions = suggestionStrategy.suggestEndpointOptions(rows.keySet(), name);
if (suggestions != null) {
result.addUnknownSuggestions(name, suggestions);
}
}
}
}
} else {
if ("parameter".equals(row.getKind())) {
// consumer only or producer only mode for parameters
String label = row.getLabel();
if (consumerOnly) {
if (label != null && label.contains("producer")) {
// the option is only for producer so you cannot use it in consumer mode
result.addNotConsumerOnly(name);
}
} else if (producerOnly) {
if (label != null && label.contains("consumer")) {
// the option is only for consumer so you cannot use it in producer mode
result.addNotProducerOnly(name);
}
}
}
String prefix = row.getPrefix();
boolean valuePlaceholder = value.startsWith("{{") || value.startsWith("${") || value.startsWith("$simple{");
boolean lookup = value.startsWith("#") && value.length() > 1;
// we cannot evaluate multi values as strict as the others, as we don't know their expected types
boolean multiValue = prefix != null && originalName.startsWith(prefix)
&& row.isMultiValue();
// default value
Object defaultValue = row.getDefaultValue();
if (defaultValue != null) {
result.addDefaultValue(name, defaultValue.toString());
}
// is required but the value is empty
if (row.isRequired() && CatalogHelper.isEmpty(value)) {
result.addRequired(name);
}
// is the option deprecated
boolean deprecated = row.isDeprecated();
if (deprecated) {
result.addDeprecated(name);
}
// is
|
AbstractCamelCatalog
|
java
|
quarkusio__quarkus
|
extensions/security/deployment/src/test/java/io/quarkus/security/test/permissionsallowed/checker/PermissionChecker3rdMethodArg.java
|
{
"start": 243,
"end": 480
}
|
class ____ extends AbstractNthMethodArgChecker {
@PermissionChecker("3rd-arg")
boolean is3rdMethodArgOk(Object three, SecurityIdentity identity) {
return this.argsOk(3, three, identity);
}
}
|
PermissionChecker3rdMethodArg
|
java
|
spring-projects__spring-framework
|
spring-test/src/test/java/org/springframework/test/context/support/ContextLoaderUtilsContextHierarchyTests.java
|
{
"start": 19916,
"end": 20048
}
|
class ____ {
}
@ContextHierarchy(@ContextConfiguration("two.xml"))
private static
|
TestClass1WithBareContextConfigurationInSuperclass
|
java
|
micronaut-projects__micronaut-core
|
inject-java/src/test/groovy/io/micronaut/inject/qualifiers/replaces/defaultimpl/F1.java
|
{
"start": 834,
"end": 860
}
|
class ____ implements F {
}
|
F1
|
java
|
apache__camel
|
components/camel-stax/src/test/java/org/apache/camel/component/stax/StAXComponentTest.java
|
{
"start": 1310,
"end": 2500
}
|
class ____ extends CamelTestSupport {
@EndpointInject("mock:records")
private MockEndpoint recordsEndpoint;
@BeforeAll
public static void initRouteExample() {
RecordsUtil.createXMLFile();
}
@Override
public RouteBuilder createRouteBuilder() {
return new RouteBuilder() {
@Override
public void configure() {
from("file:target/in")
.routeId("stax-parser")
.to("stax:" + CountingHandler.class.getName())
.process(new Processor() {
@Override
public void process(Exchange exchange) {
assertEquals(11, exchange.getIn().getBody(CountingHandler.class).getNumber());
}
})
.to("mock:records");
}
};
}
@Test
public void testStax() throws Exception {
recordsEndpoint.expectedMessageCount(1);
recordsEndpoint.message(0).body().isInstanceOf(CountingHandler.class);
recordsEndpoint.assertIsSatisfied();
}
}
|
StAXComponentTest
|
java
|
square__retrofit
|
retrofit/java-test/src/test/java/retrofit2/RequestFactoryTest.java
|
{
"start": 26615,
"end": 27137
}
|
class ____ {
@PUT("/foo/bar/") //
Call<ResponseBody> method(@Body RequestBody body) {
return null;
}
}
RequestBody body = RequestBody.create(TEXT_PLAIN, "hi");
Request request = buildRequest(Example.class, body);
assertThat(request.method()).isEqualTo("PUT");
assertThat(request.headers().size()).isEqualTo(0);
assertThat(request.url().toString()).isEqualTo("http://example.com/foo/bar/");
assertBody(request.body(), "hi");
}
@Test
public void patch() {
|
Example
|
java
|
google__error-prone
|
core/src/test/java/com/google/errorprone/bugpatterns/LiteProtoToStringTest.java
|
{
"start": 4747,
"end": 5316
}
|
class ____ {
static void w(String s) {}
}
private void test(GeneratedMessageLite message) {
// BUG: Diagnostic contains:
Log.w(message.toString());
}
}
""")
.doTest();
}
@Test
public void customFormatMethod() {
compilationHelper
.addSourceLines(
"Test.java",
"""
import com.google.errorprone.annotations.FormatMethod;
import com.google.protobuf.GeneratedMessageLite;
|
Log
|
java
|
google__error-prone
|
core/src/main/java/com/google/errorprone/bugpatterns/UnsafeLocaleUsage.java
|
{
"start": 1865,
"end": 5584
}
|
class ____ extends BugChecker
implements MethodInvocationTreeMatcher, NewClassTreeMatcher {
private static final Matcher<ExpressionTree> LOCALE_TO_STRING =
instanceMethod().onExactClass("java.util.Locale").named("toString");
private static final Matcher<ExpressionTree> LOCALE_OF =
staticMethod().onClass("java.util.Locale").named("of");
private static final Matcher<ExpressionTree> LOCALE_CONSTRUCTOR =
constructor().forClass("java.util.Locale");
/** Used for both Locale constructors and Locale.of static methods. */
private static final String DESCRIPTION =
" They do not check their arguments for"
+ " well-formedness. Prefer using Locale.forLanguageTag(String)"
+ " (which takes in an IETF BCP 47-formatted string) or a Locale.Builder"
+ " (which throws exceptions when the input is not well-formed).";
@Override
public Description matchMethodInvocation(MethodInvocationTree tree, VisitorState state) {
if (LOCALE_TO_STRING.matches(tree, state)) {
return buildDescription(tree)
.setMessage(
"Avoid using Locale.toString() since it produces a value that"
+ " misleadingly looks like a locale identifier. Prefer using"
+ " Locale.toLanguageTag() since it produces an IETF BCP 47-formatted string"
+ " that can be deserialized back into a Locale.")
.addFix(SuggestedFixes.renameMethodInvocation(tree, "toLanguageTag", state))
.build();
}
if (LOCALE_OF.matches(tree, state)) {
Description.Builder descriptionBuilder =
buildDescription(tree)
.setMessage("Avoid using the Locale.of static methods." + DESCRIPTION);
fixCallableWithArguments(
descriptionBuilder, ImmutableList.copyOf(tree.getArguments()), tree, state);
return descriptionBuilder.build();
}
return Description.NO_MATCH;
}
@Override
public Description matchNewClass(NewClassTree tree, VisitorState state) {
if (LOCALE_CONSTRUCTOR.matches(tree, state)) {
Description.Builder descriptionBuilder =
buildDescription(tree).setMessage("Avoid using the Locale constructors." + DESCRIPTION);
fixCallableWithArguments(
descriptionBuilder, ImmutableList.copyOf(tree.getArguments()), tree, state);
return descriptionBuilder.build();
}
return Description.NO_MATCH;
}
/** Something that can be called with arguments, for example a method or constructor. */
private static void fixCallableWithArguments(
Description.Builder descriptionBuilder,
ImmutableList<? extends ExpressionTree> arguments,
ExpressionTree tree,
VisitorState state) {
// Only suggest a fix for constructor or Locale.of calls with one parameter since there's
// too much variance in multi-parameter calls to be able to make a confident suggestion
if (arguments.size() == 1) {
// Locale.forLanguageTag() doesn't support underscores in language tags. We can replace this
// ourselves when the constructor arg is a string literal. Otherwise, we can only append a
// .replace() to it.
ExpressionTree arg = arguments.get(0);
String replacementArg =
arg instanceof JCLiteral
? String.format( // Something like `new Locale("en_US")` or `Locale.of("en_US")`
"\"%s\"", ASTHelpers.constValue(arg, String.class).replace('_', '-'))
: String.format("%s.replace('_', '-')", state.getSourceForNode(arguments.get(0)));
descriptionBuilder.addFix(
SuggestedFix.replace(tree, String.format("Locale.forLanguageTag(%s)", replacementArg)));
}
}
}
|
UnsafeLocaleUsage
|
java
|
apache__hadoop
|
hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamingStatus.java
|
{
"start": 2337,
"end": 12056
}
|
class ____ {
protected static String TEST_ROOT_DIR =
new File(System.getProperty("test.build.data","/tmp"),
TestStreamingStatus.class.getSimpleName())
.toURI().toString().replace(' ', '+');
protected String INPUT_FILE = TEST_ROOT_DIR + "/input.txt";
protected String OUTPUT_DIR = TEST_ROOT_DIR + "/out";
protected String input = "roses.are.red\nviolets.are.blue\nbunnies.are.pink\n";
protected String map = null;
protected String reduce = null;
protected String scriptFile = TEST_ROOT_DIR + "/perlScript.pl";
protected String scriptFileName = new Path(scriptFile).toUri().getPath();
String expectedStderr = "my error msg before consuming input\n" +
"my error msg after consuming input\n";
String expectedOutput = null;// inited in setUp()
String expectedStatus = "before consuming input";
// This script does the following
// (a) setting task status before reading input
// (b) writing to stderr before reading input and after reading input
// (c) writing to stdout before reading input
// (d) incrementing user counter before reading input and after reading input
// Write lines to stdout before reading input{(c) above} is to validate
// the hanging task issue when input to task is empty(because of not starting
// output thread).
protected String script =
"#!/usr/bin/perl\n" +
"print STDERR \"reporter:status:" + expectedStatus + "\\n\";\n" +
"print STDERR \"reporter:counter:myOwnCounterGroup,myOwnCounter,1\\n\";\n" +
"print STDERR \"my error msg before consuming input\\n\";\n" +
"for($count = 1500; $count >= 1; $count--) {print STDOUT \"$count \";}" +
"while(<STDIN>) {chomp;}\n" +
"print STDERR \"my error msg after consuming input\\n\";\n" +
"print STDERR \"reporter:counter:myOwnCounterGroup,myOwnCounter,1\\n\";\n";
private MiniMRClientCluster mr;
FileSystem fs = null;
JobConf conf = null;
/**
* Start the cluster and create input file before running the actual test.
*
* @throws IOException
*/
@BeforeEach
public void setUp() throws IOException {
conf = new JobConf();
conf.setBoolean(JTConfig.JT_RETIREJOBS, false);
conf.setBoolean(JTConfig.JT_PERSIST_JOBSTATUS, false);
mr = MiniMRClientClusterFactory.create(this.getClass(), 3, conf);
Path inFile = new Path(INPUT_FILE);
fs = inFile.getFileSystem(mr.getConfig());
clean(fs);
buildExpectedJobOutput();
}
/**
* Kill the cluster after the test is done.
*/
@AfterEach
public void tearDown() throws IOException {
if (fs != null) {
clean(fs);
}
if (mr != null) {
mr.stop();
}
}
// Updates expectedOutput to have the expected job output as a string
void buildExpectedJobOutput() {
if (expectedOutput == null) {
expectedOutput = "";
for(int i = 1500; i >= 1; i--) {
expectedOutput = expectedOutput.concat(Integer.toString(i) + " ");
}
expectedOutput = expectedOutput.trim();
}
}
// Create empty/nonempty input file.
// Create script file with the specified content.
protected void createInputAndScript(boolean isEmptyInput,
String script) throws IOException {
makeInput(fs, isEmptyInput ? "" : input);
// create script file
DataOutputStream file = fs.create(new Path(scriptFileName));
file.writeBytes(script);
file.close();
}
protected String[] genArgs(String jobtracker, String rmAddress,
String mapper, String reducer)
{
return new String[] {
"-input", INPUT_FILE,
"-output", OUTPUT_DIR,
"-mapper", mapper,
"-reducer", reducer,
"-jobconf", MRJobConfig.NUM_MAPS + "=1",
"-jobconf", MRJobConfig.NUM_REDUCES + "=1",
"-jobconf", MRJobConfig.PRESERVE_FAILED_TASK_FILES + "=true",
"-jobconf", YarnConfiguration.RM_ADDRESS + "=" + rmAddress,
"-jobconf", "stream.tmpdir=" +
new Path(TEST_ROOT_DIR).toUri().getPath(),
"-jobconf", JTConfig.JT_IPC_ADDRESS + "="+jobtracker,
"-jobconf", "fs.default.name=file:///",
"-jobconf", "mapred.jar=" + TestStreaming.STREAMING_JAR,
"-jobconf", "mapreduce.framework.name=yarn"
};
}
// create input file with the given content
public void makeInput(FileSystem fs, String input) throws IOException {
Path inFile = new Path(INPUT_FILE);
DataOutputStream file = fs.create(inFile);
file.writeBytes(input);
file.close();
}
// Delete output directory
protected void deleteOutDir(FileSystem fs) {
try {
Path outDir = new Path(OUTPUT_DIR);
fs.delete(outDir, true);
} catch (Exception e) {}
}
// Delete input file, script file and output directory
public void clean(FileSystem fs) {
deleteOutDir(fs);
try {
Path file = new Path(INPUT_FILE);
if (fs.exists(file)) {
fs.delete(file, false);
}
file = new Path(scriptFile);
if (fs.exists(file)) {
fs.delete(file, false);
}
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* Check if mapper/reducer with empty/nonempty input works properly if
* reporting is done using lines like "reporter:status:" and
* "reporter:counter:" before map()/reduce() method is called.
* Validate the task's log of STDERR if messages are written
* to stderr before map()/reduce() is called.
* Also validate job output.
*
* @throws IOException
*/
@Test
public void testReporting() throws Exception {
testStreamJob(false);// nonempty input
testStreamJob(true);// empty input
}
/**
* Run a streaming job with the given script as mapper and validate.
* Run another streaming job with the given script as reducer and validate.
*
* @param isEmptyInput Should the input to the script be empty ?
*/
private void testStreamJob(boolean isEmptyInput)
throws Exception {
createInputAndScript(isEmptyInput, script);
// Check if streaming mapper works as expected
map = scriptFileName;
reduce = "/bin/cat";
runStreamJob(TaskType.MAP, isEmptyInput);
deleteOutDir(fs);
// Check if streaming reducer works as expected.
map = "/bin/cat";
reduce = scriptFileName;
runStreamJob(TaskType.REDUCE, isEmptyInput);
clean(fs);
}
// Run streaming job for the specified input file, mapper and reducer and
// (1) Validate if the job succeeds.
// (2) Validate if user counter is incremented properly for the cases of
// (a) nonempty input to map
// (b) empty input to map and
// (c) nonempty input to reduce
// (3) Validate task status for the cases of (2)(a),(2)(b),(2)(c).
// Because empty input to reduce task => reporter is dummy and ignores
// all "reporter:status" and "reporter:counter" lines.
// (4) Validate stderr of task of given task type.
// (5) Validate job output
private void runStreamJob(TaskType type, boolean isEmptyInput)
throws Exception {
StreamJob job = new StreamJob();
int returnValue = job.run(genArgs(
mr.getConfig().get(JTConfig.JT_IPC_ADDRESS),
mr.getConfig().get(YarnConfiguration.RM_ADDRESS), map, reduce));
assertEquals(0, returnValue);
// If input to reducer is empty, dummy reporter(which ignores all
// reporting lines) is set for MRErrorThread in waitOutputThreads(). So
// expectedCounterValue is 0 for empty-input-to-reducer case.
// Output of reducer is also empty for empty-input-to-reducer case.
int expectedCounterValue = 0;
if (type == TaskType.MAP || !isEmptyInput) {
validateTaskStatus(job, type);
// output is from "print STDOUT" statements in perl script
validateJobOutput(job.getConf());
expectedCounterValue = 2;
}
validateUserCounter(job, expectedCounterValue);
validateTaskStderr(job, type);
deleteOutDir(fs);
}
// validate task status of task of given type(validates 1st task of that type)
void validateTaskStatus(StreamJob job, TaskType type) throws IOException {
// Map Task has 2 phases: map, sort
// Reduce Task has 3 phases: copy, sort, reduce
String finalPhaseInTask;
TaskReport[] reports;
if (type == TaskType.MAP) {
reports = job.jc_.getMapTaskReports(job.jobId_);
finalPhaseInTask = "sort";
} else {// reduce task
reports = job.jc_.getReduceTaskReports(job.jobId_);
finalPhaseInTask = "reduce";
}
assertEquals(1, reports.length);
assertEquals(expectedStatus + " > " + finalPhaseInTask,
reports[0].getState());
}
// Validate the job output
void validateJobOutput(Configuration conf)
throws IOException {
String output = MapReduceTestUtil.readOutput(
new Path(OUTPUT_DIR), conf).trim();
assertTrue(output.equals(expectedOutput));
}
// Validate stderr task log of given task type(validates 1st
// task of that type).
void validateTaskStderr(StreamJob job, TaskType type)
throws IOException {
TaskAttemptID attemptId =
new TaskAttemptID(new TaskID(job.jobId_, type, 0), 0);
String log = MapReduceTestUtil.readTaskLog(TaskLog.LogName.STDERR,
attemptId, false);
// trim() is called on expectedStderr here because the method
// MapReduceTestUtil.readTaskLog() returns trimmed String.
assertTrue(log.equals(expectedStderr.trim()));
}
// Validate if user counter is incremented properly
void validateUserCounter(StreamJob job, int expectedCounterValue)
throws IOException {
Counters counters = job.running_.getCounters();
assertEquals(expectedCounterValue, counters.findCounter(
"myOwnCounterGroup", "myOwnCounter").getValue());
}
}
|
TestStreamingStatus
|
java
|
apache__hadoop
|
hadoop-tools/hadoop-aliyun/src/main/java/org/apache/hadoop/fs/aliyun/oss/OSSDataBlocks.java
|
{
"start": 1903,
"end": 4029
}
|
class ____ {
private static final Logger LOG =
LoggerFactory.getLogger(OSSDataBlocks.class);
private OSSDataBlocks() {
}
/**
* Validate args to a write command. These are the same validation checks
* expected for any implementation of {@code OutputStream.write()}.
* @param b byte array containing data
* @param off offset in array where to start
* @param len number of bytes to be written
* @throws NullPointerException for a null buffer
* @throws IndexOutOfBoundsException if indices are out of range
*/
static void validateWriteArgs(byte[] b, int off, int len)
throws IOException {
Preconditions.checkNotNull(b);
if ((off < 0) || (off > b.length) || (len < 0) ||
((off + len) > b.length) || ((off + len) < 0)) {
throw new IndexOutOfBoundsException(
"write (b[" + b.length + "], " + off + ", " + len + ')');
}
}
/**
* Create a factory.
* @param owner factory owner
* @param name factory name -the option from {@link Constants}.
* @return the factory, ready to be initialized.
* @throws IllegalArgumentException if the name is unknown.
*/
static BlockFactory createFactory(AliyunOSSFileSystem owner,
String name) {
switch (name) {
case Constants.FAST_UPLOAD_BUFFER_ARRAY:
return new ArrayBlockFactory(owner);
case Constants.FAST_UPLOAD_BUFFER_DISK:
return new DiskBlockFactory(owner);
case Constants.FAST_UPLOAD_BYTEBUFFER:
return new ByteBufferBlockFactory(owner);
case Constants.FAST_UPLOAD_BUFFER_ARRAY_DISK:
return new MemoryAndDiskBlockFactory(
owner, new ArrayBlockFactory(owner));
case Constants.FAST_UPLOAD_BYTEBUFFER_DISK:
return new MemoryAndDiskBlockFactory(
owner, new ByteBufferBlockFactory(owner));
default:
throw new IllegalArgumentException("Unsupported block buffer" +
" \"" + name + '"');
}
}
/**
* The output information for an upload.
* It can be one of a file or an input stream.
* When closed, any stream is closed. Any source file is untouched.
*/
static final
|
OSSDataBlocks
|
java
|
apache__flink
|
flink-table/flink-sql-gateway/src/test/java/org/apache/flink/table/gateway/rest/StatementRelatedITCase.java
|
{
"start": 2031,
"end": 3212
}
|
class ____ extends RestAPIITCaseBase {
private SessionHandle sessionHandle;
private SessionMessageParameters sessionMessageParameters;
@BeforeEach
void setUp() throws Exception {
CompletableFuture<OpenSessionResponseBody> response =
sendRequest(
OpenSessionHeaders.getInstance(),
EmptyMessageParameters.getInstance(),
new OpenSessionRequestBody(null, null));
sessionHandle = new SessionHandle(UUID.fromString(response.get().getSessionHandle()));
sessionMessageParameters = new SessionMessageParameters(sessionHandle);
}
@Test
void testCompleteStatement() throws Exception {
CompletableFuture<CompleteStatementResponseBody> completeStatementResponse =
sendRequest(
CompleteStatementHeaders.getInstance(),
sessionMessageParameters,
new CompleteStatementRequestBody("CREATE TA", 9));
assertThat(completeStatementResponse.get().getCandidates())
.isEqualTo(Collections.singletonList("TABLE"));
}
}
|
StatementRelatedITCase
|
java
|
elastic__elasticsearch
|
x-pack/plugin/ent-search/src/main/java/org/elasticsearch/xpack/application/connector/action/TransportUpdateConnectorLastSyncStatsAction.java
|
{
"start": 817,
"end": 1863
}
|
class ____ extends HandledTransportAction<
UpdateConnectorLastSyncStatsAction.Request,
ConnectorUpdateActionResponse> {
protected final ConnectorIndexService connectorIndexService;
@Inject
public TransportUpdateConnectorLastSyncStatsAction(TransportService transportService, ActionFilters actionFilters, Client client) {
super(
UpdateConnectorLastSyncStatsAction.NAME,
transportService,
actionFilters,
UpdateConnectorLastSyncStatsAction.Request::new,
EsExecutors.DIRECT_EXECUTOR_SERVICE
);
this.connectorIndexService = new ConnectorIndexService(client);
}
@Override
protected void doExecute(
Task task,
UpdateConnectorLastSyncStatsAction.Request request,
ActionListener<ConnectorUpdateActionResponse> listener
) {
connectorIndexService.updateConnectorLastSyncStats(request, listener.map(r -> new ConnectorUpdateActionResponse(r.getResult())));
}
}
|
TransportUpdateConnectorLastSyncStatsAction
|
java
|
spring-projects__spring-framework
|
spring-test/src/test/java/org/springframework/test/context/junit/jupiter/nested/SqlScriptNestedTests.java
|
{
"start": 2952,
"end": 3475
}
|
class ____ {
@BeforeTransaction
@AfterTransaction
void checkInitialDatabaseState() {
assertThat(countRowsInTable("user")).isEqualTo(0);
}
@Test
@Sql("/org/springframework/test/context/jdbc/data.sql")
void nestedSqlScripts() {
assertThat(countRowsInTable("user")).isEqualTo(1);
}
}
@Nested
@NestedTestConfiguration(EnclosingConfiguration.OVERRIDE)
@Sql({
"/org/springframework/test/context/jdbc/recreate-schema.sql",
"/org/springframework/test/context/jdbc/data-add-catbert.sql"
})
|
NestedTests
|
java
|
apache__hadoop
|
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFilterFileSystem.java
|
{
"start": 1971,
"end": 2569
}
|
class ____ {
private static final Logger LOG = FileSystem.LOG;
private static final Configuration conf = new Configuration();
@BeforeAll
public static void setup() {
conf.set("fs.flfs.impl", FilterLocalFileSystem.class.getName());
conf.setBoolean("fs.flfs.impl.disable.cache", true);
conf.setBoolean("fs.file.impl.disable.cache", true);
}
/**
* FileSystem methods that must not be overwritten by
* {@link FilterFileSystem}. Either because there is a default implementation
* already available or because it is not relevant.
*/
public static
|
TestFilterFileSystem
|
java
|
apache__logging-log4j2
|
log4j-core/src/main/java/org/apache/logging/log4j/core/appender/mom/kafka/KafkaAppender.java
|
{
"start": 2040,
"end": 2222
}
|
class ____ extends AbstractAppender {
/**
* Builds KafkaAppender instances.
*
* @param <B>
* The type to build
*/
public static
|
KafkaAppender
|
java
|
quarkusio__quarkus
|
extensions/smallrye-reactive-messaging/deployment/src/test/java/io/quarkus/smallrye/reactivemessaging/wiring/TwoConnectorsAttachmentOutgoingTest.java
|
{
"start": 1873,
"end": 2364
}
|
class ____ implements OutgoingConnectorFactory {
private final List<Message<?>> list = new CopyOnWriteArrayList<>();
@Override
public SubscriberBuilder<? extends Message<?>, Void> getSubscriberBuilder(Config config) {
return ReactiveStreams.<Message<?>> builder().forEach(list::add);
}
public List<Message<?>> getList() {
return list;
}
}
@ApplicationScoped
@Connector("dummy-2")
static
|
MyDummyConnector
|
java
|
apache__hadoop
|
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSEditLog.java
|
{
"start": 23028,
"end": 28107
}
|
class ____ as follows:
* - Log items are written synchronized into an in-memory buffer,
* and each assigned a transaction ID.
* - When a thread (client) would like to sync all of its edits, logSync()
* uses a ThreadLocal transaction ID to determine what edit number must
* be synced to.
* - The isSyncRunning volatile boolean tracks whether a sync is currently
* under progress.
*
* The data is double-buffered within each edit log implementation so that
* in-memory writing can occur in parallel with the on-disk writing.
*
* Each sync occurs in three steps:
* 1. synchronized, it swaps the double buffer and sets the isSyncRunning
* flag.
* 2. unsynchronized, it flushes the data to storage
* 3. synchronized, it resets the flag and notifies anyone waiting on the
* sync.
*
* The lack of synchronization on step 2 allows other threads to continue
* to write into the memory buffer while the sync is in progress.
* Because this step is unsynchronized, actions that need to avoid
* concurrency with sync() should be synchronized and also call
* waitForSyncToFinish() before assuming they are running alone.
*/
public void logSync() {
// Fetch the transactionId of this thread.
logSync(myTransactionId.get().txid);
}
protected void logSync(long mytxid) {
long lastJournalledTxId = HdfsServerConstants.INVALID_TXID;
boolean sync = false;
long editsBatchedInSync = 0;
try {
EditLogOutputStream logStream = null;
synchronized (this) {
try {
printStatistics(false);
// if somebody is already syncing, then wait
while (mytxid > synctxid && isSyncRunning) {
try {
wait(1000);
} catch (InterruptedException ie) {
}
}
//
// If this transaction was already flushed, then nothing to do
//
if (mytxid <= synctxid) {
return;
}
// now, this thread will do the sync. track if other edits were
// included in the sync - ie. batched. if this is the only edit
// synced then the batched count is 0
lastJournalledTxId = editLogStream.getLastJournalledTxId();
LOG.debug("logSync(tx) synctxid={} lastJournalledTxId={} mytxid={}",
synctxid, lastJournalledTxId, mytxid);
assert lastJournalledTxId <= txid : "lastJournalledTxId exceeds txid";
// The stream has already been flushed, or there are no active streams
// We still try to flush up to mytxid
if(lastJournalledTxId <= synctxid) {
lastJournalledTxId = mytxid;
}
editsBatchedInSync = lastJournalledTxId - synctxid - 1;
isSyncRunning = true;
sync = true;
// swap buffers
try {
if (journalSet.isEmpty()) {
throw new IOException("No journals available to flush");
}
editLogStream.setReadyToFlush();
} catch (IOException e) {
final String msg =
"Could not sync enough journals to persistent storage " +
"due to " + e.getMessage() + ". " +
"Unsynced transactions: " + (txid - synctxid);
LOG.error(msg, new Exception());
synchronized(journalSetLock) {
IOUtils.cleanupWithLogger(LOG, journalSet);
}
terminate(1, msg);
}
} finally {
// Prevent RuntimeException from blocking other log edit write
doneWithAutoSyncScheduling();
}
//editLogStream may become null,
//so store a local variable for flush.
logStream = editLogStream;
}
// do the sync
long start = monotonicNow();
try {
if (logStream != null) {
logStream.flush();
}
} catch (IOException ex) {
synchronized (this) {
final String msg =
"Could not sync enough journals to persistent storage. "
+ "Unsynced transactions: " + (txid - synctxid);
LOG.error(msg, new Exception());
synchronized(journalSetLock) {
IOUtils.cleanupWithLogger(LOG, journalSet);
}
terminate(1, msg);
}
}
long elapsed = monotonicNow() - start;
if (metrics != null) { // Metrics non-null only when used inside name node
metrics.addSync(elapsed);
metrics.incrTransactionsBatchedInSync(editsBatchedInSync);
numTransactionsBatchedInSync.add(editsBatchedInSync);
}
} finally {
// Prevent RuntimeException from blocking other log edit sync
synchronized (this) {
if (sync) {
synctxid = lastJournalledTxId;
for (JournalManager jm : journalSet.getJournalManagers()) {
/**
* {@link FileJournalManager#lastReadableTxId} is only meaningful
* for file-based journals. Therefore the
|
is
|
java
|
apache__camel
|
components/camel-hl7/src/generated/java/org/apache/camel/component/hl7/HL725ConverterLoader.java
|
{
"start": 879,
"end": 170325
}
|
class ____ implements TypeConverterLoader, CamelContextAware {
private CamelContext camelContext;
public HL725ConverterLoader() {
}
@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.v25.message.ACK.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toACK((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ACK.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toACK((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ADR_A19.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toAdrA19((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ADR_A19.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toAdrA19((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ADT_A01.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toAdtA01((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ADT_A01.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toAdtA01((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ADT_A02.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toAdtA02((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ADT_A02.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toAdtA02((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ADT_A03.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toAdtA03((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ADT_A03.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toAdtA03((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ADT_A05.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toAdtA05((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ADT_A05.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toAdtA05((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ADT_A06.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toAdtA06((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ADT_A06.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toAdtA06((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ADT_A09.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toAdtA09((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ADT_A09.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toAdtA09((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ADT_A12.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toAdtA12((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ADT_A12.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toAdtA12((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ADT_A15.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toAdtA15((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ADT_A15.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toAdtA15((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ADT_A16.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toAdtA16((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ADT_A16.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toAdtA16((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ADT_A17.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toAdtA17((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ADT_A17.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toAdtA17((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ADT_A18.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toAdtA18((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ADT_A18.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toAdtA18((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ADT_A20.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toAdtA20((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ADT_A20.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toAdtA20((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ADT_A21.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toAdtA21((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ADT_A21.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toAdtA21((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ADT_A24.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toAdtA24((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ADT_A24.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toAdtA24((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ADT_A30.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toAdtA30((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ADT_A30.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toAdtA30((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ADT_A37.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toAdtA37((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ADT_A37.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toAdtA37((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ADT_A38.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toAdtA38((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ADT_A38.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toAdtA38((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ADT_A39.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toAdtA39((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ADT_A39.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toAdtA39((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ADT_A43.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toAdtA43((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ADT_A43.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toAdtA43((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ADT_A45.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toAdtA45((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ADT_A45.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toAdtA45((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ADT_A50.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toAdtA50((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ADT_A50.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toAdtA50((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ADT_A52.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toAdtA52((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ADT_A52.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toAdtA52((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ADT_A54.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toAdtA54((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ADT_A54.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toAdtA54((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ADT_A60.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toAdtA60((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ADT_A60.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toAdtA60((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ADT_A61.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toAdtA61((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ADT_A61.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toAdtA61((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ADT_AXX.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toAdtAXX((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ADT_AXX.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toAdtAXX((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.BAR_P01.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toBarP01((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.BAR_P01.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toBarP01((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.BAR_P02.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toBarP02((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.BAR_P02.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toBarP02((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.BAR_P05.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toBarP05((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.BAR_P05.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toBarP05((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.BAR_P06.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toBarP06((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.BAR_P06.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toBarP06((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.BAR_P10.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toBarP10((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.BAR_P10.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toBarP10((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.BAR_P12.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toBarP12((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.BAR_P12.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toBarP12((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.BPS_O29.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toBpsO29((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.BPS_O29.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toBpsO29((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.BRP_O30.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toBrpO30((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.BRP_O30.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toBrpO30((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.BRT_O32.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toBrtO32((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.BRT_O32.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toBrtO32((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.BTS_O31.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toBtsO31((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.BTS_O31.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toBtsO31((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.CRM_C01.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toCrmC01((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.CRM_C01.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toCrmC01((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.CSU_C09.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toCsuC09((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.CSU_C09.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toCsuC09((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.DFT_P03.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toDftP03((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.DFT_P03.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toDftP03((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.DFT_P11.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toDftP11((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.DFT_P11.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toDftP11((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.DOC_T12.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toDocT12((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.DOC_T12.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toDocT12((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.DSR_Q01.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toDsrQ01((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.DSR_Q01.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toDsrQ01((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.DSR_Q03.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toDsrQ03((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.DSR_Q03.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toDsrQ03((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.EAC_U07.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toEacU07((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.EAC_U07.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toEacU07((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.EAN_U09.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toEanU09((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.EAN_U09.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toEanU09((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.EAR_U08.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toEarU08((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.EAR_U08.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toEarU08((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.EDR_R07.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toEdrR07((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.EDR_R07.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toEdrR07((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.EQQ_Q04.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toEqqQ04((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.EQQ_Q04.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toEqqQ04((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ERP_R09.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toErpR09((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ERP_R09.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toErpR09((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ESR_U02.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toEsrU02((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ESR_U02.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toEsrU02((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ESU_U01.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toEsuU01((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ESU_U01.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toEsuU01((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.INR_U06.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toInrU06((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.INR_U06.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toInrU06((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.INU_U05.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toInuU05((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.INU_U05.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toInuU05((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.LSU_U12.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toLsuU12((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.LSU_U12.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toLsuU12((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.MDM_T01.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toMdmT01((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.MDM_T01.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toMdmT01((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.MDM_T02.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toMdmT02((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.MDM_T02.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toMdmT02((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.MFK_M01.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toMfkM01((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.MFK_M01.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toMfkM01((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.MFN_M01.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toMfnM01((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.MFN_M01.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toMfnM01((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.MFN_M02.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toMfnM02((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.MFN_M02.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toMfnM02((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.MFN_M03.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toMfnM03((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.MFN_M03.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toMfnM03((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.MFN_M04.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toMfnM04((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.MFN_M04.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toMfnM04((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.MFN_M05.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toMfnM05((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.MFN_M05.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toMfnM05((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.MFN_M06.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toMfnM06((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.MFN_M06.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toMfnM06((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.MFN_M07.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toMfnM07((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.MFN_M07.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toMfnM07((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.MFN_M08.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toMfnM08((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.MFN_M08.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toMfnM08((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.MFN_M09.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toMfnM09((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.MFN_M09.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toMfnM09((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.MFN_M10.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toMfnM10((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.MFN_M10.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toMfnM10((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.MFN_M11.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toMfnM11((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.MFN_M11.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toMfnM11((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.MFN_M12.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toMfnM12((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.MFN_M12.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toMfnM12((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.MFN_M13.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toMfnM13((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.MFN_M13.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toMfnM13((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.MFN_M15.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toMfnM15((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.MFN_M15.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toMfnM15((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.MFN_Znn.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toMfnZnn((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.MFN_Znn.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toMfnZnn((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.MFQ_M01.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toMfqM01((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.MFQ_M01.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toMfqM01((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.MFR_M01.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toMfrM01((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.MFR_M01.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toMfrM01((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.MFR_M04.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toMfrM04((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.MFR_M04.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toMfrM04((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.MFR_M05.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toMfrM05((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.MFR_M05.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toMfrM05((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.MFR_M06.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toMfrM06((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.MFR_M06.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toMfrM06((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.MFR_M07.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toMfrM07((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.MFR_M07.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toMfrM07((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.NMD_N02.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toNmdN02((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.NMD_N02.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toNmdN02((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.NMQ_N01.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toNmqN01((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.NMQ_N01.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toNmqN01((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.NMR_N01.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toNmrN01((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.NMR_N01.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toNmrN01((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.OMB_O27.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toOmbO27((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.OMB_O27.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toOmbO27((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.OMD_O03.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toOmdO03((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.OMD_O03.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toOmdO03((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.OMG_O19.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toOmgO19((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.OMG_O19.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toOmgO19((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.OMI_O23.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toOmiO23((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.OMI_O23.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toOmiO23((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.OML_O21.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toOmlO21((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.OML_O21.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toOmlO21((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.OML_O33.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toOmlO33((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.OML_O33.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toOmlO33((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.OML_O35.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toOmlO35((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.OML_O35.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toOmlO35((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.OMN_O07.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toOmnO07((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.OMN_O07.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toOmnO07((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.OMP_O09.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toOmpO09((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.OMP_O09.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toOmpO09((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.OMS_O05.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toOmsO05((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.OMS_O05.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toOmsO05((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ORB_O28.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toOrbO28((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ORB_O28.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toOrbO28((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ORD_O04.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toOrdO04((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ORD_O04.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toOrdO04((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ORF_R04.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toOrfR04((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ORF_R04.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toOrfR04((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ORG_O20.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toOrgO20((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ORG_O20.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toOrgO20((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ORI_O24.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toOriO24((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ORI_O24.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toOriO24((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ORL_O22.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toOrlO22((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ORL_O22.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toOrlO22((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ORL_O34.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toOrlO34((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ORL_O34.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toOrlO34((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ORL_O36.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toOrlO36((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ORL_O36.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toOrlO36((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ORM_O01.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toOrmO01((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ORM_O01.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toOrmO01((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ORN_O08.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toOrnO08((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ORN_O08.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toOrnO08((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ORP_O10.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toOrpO10((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ORP_O10.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toOrpO10((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ORR_O02.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toOrrO02((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ORR_O02.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toOrrO02((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ORS_O06.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toOrsO06((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ORS_O06.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toOrsO06((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ORU_R01.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toOruR01((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ORU_R01.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toOruR01((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ORU_R30.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toOruR30((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ORU_R30.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toOruR30((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.OSQ_Q06.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toOsqQ06((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.OSQ_Q06.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toOsqQ06((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.OSR_Q06.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toOsrQ06((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.OSR_Q06.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toOsrQ06((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.OUL_R21.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toOulR21((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.OUL_R21.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toOulR21((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.OUL_R22.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toOulR22((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.OUL_R22.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toOulR22((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.OUL_R23.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toOulR23((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.OUL_R23.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toOulR23((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.OUL_R24.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toOulR24((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.OUL_R24.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toOulR24((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.PEX_P07.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toPexP07((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.PEX_P07.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toPexP07((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.PGL_PC6.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toPglPc6((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.PGL_PC6.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toPglPc6((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.PMU_B01.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toPmuB01((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.PMU_B01.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toPmuB01((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.PMU_B03.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toPmuB03((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.PMU_B03.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toPmuB03((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.PMU_B04.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toPmuB04((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.PMU_B04.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toPmuB04((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.PMU_B07.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toPmuB07((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.PMU_B07.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toPmuB07((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.PMU_B08.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toPmuB08((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.PMU_B08.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toPmuB08((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.PPG_PCG.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toPpgPcg((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.PPG_PCG.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toPpgPcg((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.PPP_PCB.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toPppPcb((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.PPP_PCB.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toPppPcb((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.PPR_PC1.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toPprPc1((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.PPR_PC1.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toPprPc1((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.PPT_PCL.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toPptPcl((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.PPT_PCL.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toPptPcl((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.PPV_PCA.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toPpvPca((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.PPV_PCA.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toPpvPca((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.PRR_PC5.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toPrrPc5((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.PRR_PC5.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toPrrPc5((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.PTR_PCF.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toPtrPcf((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.PTR_PCF.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toPtrPcf((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.QBP_K13.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toQbpK13((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.QBP_K13.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toQbpK13((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.QBP_Q11.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toQbpQ11((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.QBP_Q11.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toQbpQ11((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.QBP_Q13.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toQbpQ13((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.QBP_Q13.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toQbpQ13((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.QBP_Q15.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toQbpQ15((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.QBP_Q15.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toQbpQ15((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.QBP_Q21.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toQbpQ21((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.QBP_Q21.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toQbpQ21((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.QBP_Qnn.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toQbpQnn((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.QBP_Qnn.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toQbpQnn((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.QBP_Z73.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toQbpZ73((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.QBP_Z73.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toQbpZ73((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.QCK_Q02.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toQckQ02((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.QCK_Q02.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toQckQ02((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.QCN_J01.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toQcnJ01((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.QCN_J01.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toQcnJ01((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.QRY.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toQry((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.QRY.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toQry((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.QRY_A19.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toQryA19((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.QRY_A19.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toQryA19((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.QRY_PC4.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toQryPC4((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.QRY_PC4.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toQryPC4((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.QRY_Q01.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toQryQ01((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.QRY_Q01.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toQryQ01((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.QRY_Q02.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toQryQ02((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.QRY_Q02.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toQryQ02((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.QRY_R02.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toQryR02((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.QRY_R02.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toQryR02((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.QSB_Q16.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toQsbQ16((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.QSB_Q16.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toQsbQ16((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.QVR_Q17.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toQvrQ17((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.QVR_Q17.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toQvrQ17((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RAR_RAR.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRarRar((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RAR_RAR.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRarRar((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RAS_O17.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRasO17((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RAS_O17.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRasO17((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RCI_I05.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRciI05((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RCI_I05.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRciI05((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RCL_I06.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRclI06((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RCL_I06.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRclI06((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RDE_O11.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRdeO11((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RDE_O11.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRdeO11((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RDR_RDR.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRdrRdr((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RDR_RDR.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRdrRdr((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RDS_O13.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRdsO13((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RDS_O13.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRdsO13((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RDY_K15.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRdyK15((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RDY_K15.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRdyK15((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.REF_I12.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRefI12((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.REF_I12.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRefI12((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RER_RER.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRerRer((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RER_RER.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRerRer((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RGR_RGR.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRgrRgr((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RGR_RGR.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRgrRgr((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RGV_O15.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRgvO15((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RGV_O15.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRgvO15((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ROR_ROR.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRorRor((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.ROR_ROR.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRorRor((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RPA_I08.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRpaI08((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RPA_I08.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRpaI08((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RPI_I01.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRpiI01((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RPI_I01.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRpiI01((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RPI_I04.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRpiI04((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RPI_I04.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRpiI04((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RPL_I02.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRplI02((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RPL_I02.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRplI02((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RPR_I03.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRprI03((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RPR_I03.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRprI03((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RQA_I08.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRqaI08((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RQA_I08.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRqaI08((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RQC_I05.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRqcI05((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RQC_I05.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRqcI05((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RQI_I01.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRqiI01((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RQI_I01.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRqiI01((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RQP_I04.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRqpI04((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RQP_I04.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRqpI04((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RQQ_Q09.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRqqQ09((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RQQ_Q09.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRqqQ09((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RRA_O18.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRraO18((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RRA_O18.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRraO18((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RRD_O14.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRrdO14((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RRD_O14.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRrdO14((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RRE_O12.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRreO12((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RRE_O12.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRreO12((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RRG_O16.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRrgO16((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RRG_O16.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRrgO16((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RRI_I12.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRriI12((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RRI_I12.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRriI12((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RSP_K11.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRspK11((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RSP_K11.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRspK11((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RSP_K21.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRspK21((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RSP_K21.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRspK21((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RSP_K23.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRspK23((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RSP_K23.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRspK23((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RSP_K25.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRspK25((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RSP_K25.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRspK25((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RSP_K31.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRspK31((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RSP_K31.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRspK31((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RSP_Q11.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRspQ11((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RSP_Q11.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRspQ11((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RSP_Z82.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRspZ82((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RSP_Z82.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRspZ82((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RSP_Z86.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRspZ86((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RSP_Z86.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRspZ86((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RSP_Z88.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRspZ88((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RSP_Z88.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRspZ88((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RSP_Z90.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRspZ90((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RSP_Z90.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRspZ90((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RTB_K13.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRtbK13((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RTB_K13.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRtbK13((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RTB_Knn.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRtbKnn((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RTB_Knn.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRtbKnn((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RTB_Z74.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRtbZ74((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.RTB_Z74.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toRtbZ74((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.SIU_S12.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toSiuS12((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.SIU_S12.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toSiuS12((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.SPQ_Q08.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toSpqQ08((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.SPQ_Q08.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toSpqQ08((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.SQM_S25.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toSqmS25((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.SQM_S25.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toSqmS25((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.SQR_S25.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toSqrS25((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.SQR_S25.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toSqrS25((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.SRM_S01.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toSrmS01((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.SRM_S01.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toSrmS01((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.SRR_S01.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toSrrS01((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.SRR_S01.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toSrrS01((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.SSR_U04.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toSsrU04((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.SSR_U04.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toSsrU04((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.SSU_U03.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toSsuU03((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.SSU_U03.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toSsuU03((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.SUR_P09.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toSurP09((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.SUR_P09.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toSurP09((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.TBR_R08.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toTbrR08((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.TBR_R08.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toTbrR08((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.TCU_U10.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toTcuU10((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.TCU_U10.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toTcuU10((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.UDM_Q05.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toUdmQ05((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.UDM_Q05.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toUdmQ05((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.VQQ_Q07.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toVqqQ07((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.VQQ_Q07.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toVqqQ07((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.VXQ_V01.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toVxqV01((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.VXQ_V01.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toVxqV01((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.VXR_V03.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toVxrV03((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.VXR_V03.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toVxrV03((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.VXU_V04.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toVxuV04((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.VXU_V04.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toVxuV04((java.lang.String) value);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.VXX_V02.class, byte[].class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.toVxxV02((byte[]) value, exchange);
if (false && answer == null) {
answer = Void.class;
}
return answer;
});
addTypeConverter(registry, ca.uhn.hl7v2.model.v25.message.VXX_V02.class, java.lang.String.class, false,
(type, exchange, value) -> {
Object answer = org.apache.camel.component.hl7.HL725Converter.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));
}
}
|
HL725ConverterLoader
|
java
|
quarkusio__quarkus
|
extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/i18n/MessageDefaultValueTest.java
|
{
"start": 480,
"end": 1880
}
|
class ____ {
@RegisterExtension
static final QuarkusUnitTest config = new QuarkusUnitTest()
.withApplicationRoot(root -> root
.addClasses(Messages.class)
.addAsResource(new StringAsset("""
alpha=Hi {foo}!
delta=Hey {foo}!
"""), "messages/msg_en.properties")
.addAsResource(new StringAsset("""
alpha=Ahoj {foo}!
delta=Hej {foo}!
"""), "messages/msg_cs.properties")
.addAsResource(new StringAsset(
"{msg:alpha('baz')}::{msg:bravo('baz')}::{msg:charlie('baz')}"),
"templates/foo.html")
.addAsResource(new StringAsset(
"{msg:delta('baz')}::{msg:echo('baz')}"),
"templates/bar.html"))
.overrideConfigKey("quarkus.default-locale", "en");
@Inject
Template foo;
@Inject
Template bar;
@Test
public void testMessages() {
assertEquals("Hi baz!::Bravo baz!::Hey baz!", foo.instance().setLocale("en").render());
assertEquals("Hej baz!::Echo cs baz!", bar.instance().setLocale("cs").render());
}
@MessageBundle("msg")
public
|
MessageDefaultValueTest
|
java
|
spring-projects__spring-security
|
test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsCsrfDebugFilterTests.java
|
{
"start": 2574,
"end": 3009
}
|
class ____ {
static CsrfTokenRepository cookieCsrfTokenRepository = new CookieCsrfTokenRepository();
@Bean
SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
http.csrf((csrf) -> csrf.csrfTokenRepository(cookieCsrfTokenRepository));
return http.build();
}
@Bean
WebSecurityCustomizer webSecurityCustomizer() {
// Enable the DebugFilter
return (web) -> web.debug(true);
}
}
}
|
Config
|
java
|
apache__camel
|
components/camel-jira/src/test/java/org/apache/camel/component/jira/producer/FetchIssueProducerTest.java
|
{
"start": 2516,
"end": 5074
}
|
class ____ extends CamelTestSupport {
@Mock
private JiraRestClient jiraClient;
@Mock
private JiraRestClientFactory jiraRestClientFactory;
@Mock
private IssueRestClient issueRestClient;
@Mock
private Issue backendIssue;
@Produce("direct:start")
private ProducerTemplate template;
@EndpointInject("mock:result")
private MockEndpoint mockResult;
@Override
protected void bindToRegistry(Registry registry) {
registry.bind(JIRA_REST_CLIENT_FACTORY, jiraRestClientFactory);
}
public void setMocks() {
lenient().when(jiraRestClientFactory.createWithBasicHttpAuthentication(any(), any(), any())).thenReturn(jiraClient);
lenient().when(jiraClient.getIssueClient()).thenReturn(issueRestClient);
}
@Override
protected CamelContext createCamelContext() throws Exception {
setMocks();
CamelContext camelContext = super.createCamelContext();
camelContext.disableJMX();
JiraComponent component = new JiraComponent(camelContext);
camelContext.addComponent(JIRA, component);
return camelContext;
}
@Override
protected RouteBuilder createRouteBuilder() {
return new RouteBuilder() {
@Override
public void configure() {
from("direct:start")
.to("jira://fetchIssue?jiraUrl=" + JIRA_CREDENTIALS)
.to(mockResult);
}
};
}
@Test
public void testFetchIssue() throws InterruptedException {
when(backendIssue.getKey()).thenReturn("TEST-123");
when(issueRestClient.getIssue(any())).then(inv -> Promises.promise(backendIssue));
template.sendBodyAndHeader(null, ISSUE_KEY, backendIssue.getKey());
mockResult.expectedMessageCount(1);
mockResult.assertIsSatisfied();
verify(issueRestClient).getIssue(backendIssue.getKey());
}
@Test
public void testFetchIssueMissingIssueKey() throws InterruptedException {
try {
template.sendBody(null);
fail("Should have thrown an exception");
} catch (CamelExecutionException e) {
IllegalArgumentException cause = assertIsInstanceOf(IllegalArgumentException.class, e.getCause());
assertStringContains(cause.getMessage(), ISSUE_KEY);
}
mockResult.expectedMessageCount(0);
mockResult.assertIsSatisfied();
verify(issueRestClient, never()).getIssue(backendIssue.getKey());
}
}
|
FetchIssueProducerTest
|
java
|
qos-ch__slf4j
|
osgi-over-slf4j/src/main/java/org/slf4j/osgi/logservice/impl/Activator.java
|
{
"start": 2082,
"end": 3058
}
|
class ____ implements BundleActivator {
/**
*
* Implements <code>BundleActivator.start()</code> to register a
* LogServiceFactory.
*
* @param bundleContext the framework context for the bundle
* @throws Exception
*/
public void start(BundleContext bundleContext) throws Exception {
Properties props = new Properties();
props.put("description", "An SLF4J LogService implementation.");
ServiceFactory factory = new LogServiceFactory();
bundleContext.registerService(LogService.class.getName(), factory, props);
}
/**
*
* Implements <code>BundleActivator.stop()</code>.
*
* @param bundleContext the framework context for the bundle
* @throws Exception
*/
public void stop(BundleContext bundleContext) throws Exception {
// Note: It is not required that we remove the service here, since
// the framework will do it automatically.
}
}
|
Activator
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.