method2testcases stringlengths 118 6.63k |
|---|
### Question:
IntegrationRouteBuilder extends RouteBuilder { public IntegrationRouteBuilder(String configurationUri) { this(configurationUri, Resources.loadServices(IntegrationStepHandler.class)); } IntegrationRouteBuilder(String configurationUri); IntegrationRouteBuilder(String configurationUri, Collection<Integratio... |
### Question:
PaginationFilter implements Function<ListResult<T>, ListResult<T>> { @Override public ListResult<T> apply(ListResult<T> result) { List<T> list = result.getItems(); if (startIndex >= list.size()) { list = Collections.emptyList(); } else { list = list.subList(startIndex, Math.min(list.size(), endIndex)); } ... |
### Question:
StaticEdition extends Edition { @Override protected KeySource keySource() { return keySource; } StaticEdition(final ClientSideStateProperties properties); }### Answer:
@Test public void shouldCreateEditionFromProperties() { final ClientSideStateProperties properties = new ClientSideStateProperties(); pr... |
### Question:
ClientSideState { @SuppressWarnings("JdkObsolete") public NewCookie persist(final String key, final String path, final Object value) { final Date expiry = Date.from(ZonedDateTime.now(ZoneOffset.UTC).plusSeconds(timeout).toInstant()); return new NewCookie(key, protect(value), path, null, Cookie.DEFAULT_VER... |
### Question:
ErrorMap { public static String from(String rawMsg) { if (rawMsg.matches("^\\s*\\<.*")) { return parseWith(rawMsg, new XmlMapper()); } if (rawMsg.matches("^\\s*\\{.*")) { return parseWith(rawMsg, new ObjectMapper()); } return rawMsg; } private ErrorMap(); static String from(String rawMsg); }### Answer:
... |
### Question:
ErrorMap { static Optional<String> tryLookingUp(final JsonNode node, final String... pathElements) { JsonNode current = node; for (String pathElement : pathElements) { current = current.get(pathElement); if (current != null && current.isArray() && current.iterator().hasNext()) { current = current.iterator... |
### Question:
ChoiceMetadataHandler implements StepMetadataHandler { @Override public DynamicActionMetadata createMetadata(Step step, List<Step> previousSteps, List<Step> subsequentSteps) { DataShape outputShape = StepMetadataHelper.getLastWithOutputShape(previousSteps) .flatMap(Step::outputDataShape) .orElse(StepMetad... |
### Question:
ProjectGenerator implements IntegrationProjectGenerator { @Override public Properties generateApplicationProperties(final Integration integrationDefinition) { final Integration integration = resourceManager.sanitize(integrationDefinition); final Properties properties = new Properties(); properties.putAll(... |
### Question:
CustomConnectorHandler extends BaseConnectorGeneratorHandler { @POST @Path("/info") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @Operation(description = "Provides a summary of the connector as it would be built using a ConnectorTemplate identified by the provided `connector... |
### Question:
ConnectionHandler extends BaseHandler implements Lister<ConnectionOverview>, Getter<ConnectionOverview>, Creator<Connection>, Deleter<Connection>, Updater<Connection>, Validating<Connection> { @Override public void delete(String id) { final DataManager dataManager = getDataManager(); dataManager.fetchIdsB... |
### Question:
ConnectorPropertiesHandler { @POST @Produces(MediaType.APPLICATION_JSON) public DynamicConnectionPropertiesMetadata dynamicConnectionProperties(@PathParam("id") final String connectorId) { final HystrixExecutable<DynamicConnectionPropertiesMetadata> meta = createMetadataConnectionPropertiesCommand(connect... |
### Question:
UserHandler extends BaseHandler implements Lister<User>, Getter<User> { @Path("~") @GET @Produces(MediaType.APPLICATION_JSON) public User whoAmI(@Context SecurityContext sec) { String username = sec.getUserPrincipal().getName(); io.fabric8.openshift.api.model.User openShiftUser = this.openShiftService.who... |
### Question:
KeyGenerator { public static String createKey() { final long now = clock.getAsLong(); final ByteBuffer buffer = ByteBuffer.wrap(new byte[8 + 1 + 8]); buffer.putLong(now); buffer.put(randomnessByte); buffer.putLong(getRandomPart(now)); return encodeKey(buffer.array()); } private KeyGenerator(); static Str... |
### Question:
DataShapeUtils { static Optional<DataShape> buildDataShape(final JsonNode root) { if (root == null) { return Optional.empty(); } final DataShape.Builder builder = new DataShape.Builder(); addKindAndTypeTo(builder, root); addValueTo(root, "name", builder::name); addValueTo(root, "description", builder::des... |
### Question:
IntegrationDeploymentHandler extends BaseHandler { @GET @Produces(MediaType.APPLICATION_JSON) @Path("/{version}") public IntegrationDeployment get(@NotNull @PathParam("id") @Parameter(required = true) final String id, @NotNull @PathParam("version") @Parameter(required = true) final int version) { final St... |
### Question:
IntegrationHandler extends BaseHandler implements Lister<IntegrationOverview>, Getter<IntegrationOverview>,
Creator<Integration>, Deleter<Integration>, Updater<Integration>, Validating<Integration> { @POST @Produces(MediaType.APPLICATION_JSON) @Path(value = "/filters/options") public FilterOptions get... |
### Question:
IntegrationHandler extends BaseHandler implements Lister<IntegrationOverview>, Getter<IntegrationOverview>,
Creator<Integration>, Deleter<Integration>, Updater<Integration>, Validating<Integration> { @Override public Integration create(@Context final SecurityContext sec, final Integration integration)... |
### Question:
KeyGenerator { public static long getKeyTimeMillis(String key) throws IOException { byte[] decoded = Base64.decode(stripPreAndSuffix(key), Base64.ORDERED); if (decoded.length != 15) { throw new IOException("Invalid key: size is incorrect."); } ByteBuffer buffer = ByteBuffer.allocate(8); buffer.position(2)... |
### Question:
IntegrationIdFilter implements Function<ListResult<IntegrationDeployment>, ListResult<IntegrationDeployment>> { @Override public ListResult<IntegrationDeployment> apply(final ListResult<IntegrationDeployment> list) { if (integrationId == null) { return list; } final List<IntegrationDeployment> filtered = ... |
### Question:
OAuthConnectorFilter implements Function<ListResult<Connector>, ListResult<Connector>> { @Override public ListResult<Connector> apply(final ListResult<Connector> result) { final List<Connector> oauthConnectors = result.getItems().stream() .filter(c -> c.propertyEntryTaggedWith(Credentials.CLIENT_ID_TAG).i... |
### Question:
DeploymentStateMonitorController implements Runnable, Closeable, DeploymentStateMonitor { @PostConstruct @SuppressWarnings("FutureReturnValueIgnored") public void open() { LOGGER.info("Starting deployment state monitor."); scheduler.scheduleWithFixedDelay(this, configuration.getInitialDelay(), configurati... |
### Question:
JaegerActivityTrackingService implements ActivityTrackingService { @Override @SuppressWarnings({"PMD.NPathComplexity"}) public List<Activity> getActivities(String integrationId, String from, Integer requestedLimit) { int lookbackDays = 30; int limit = 10; if (requestedLimit != null) { limit = requestedLim... |
### Question:
ExposureDeploymentDataCustomizer implements DeploymentDataCustomizer { EnumSet<Exposure> determineExposure(final IntegrationDeployment integrationDeployment) { if (integrationDeployment.getSpec().isExposable()) { return exposureHelper.determineExposure(integrationDeployment.getSpec().getExposure()); } ret... |
### Question:
CamelKPublishHandler extends BaseCamelKHandler implements StateChangeHandler { protected Secret createIntegrationSecret(IntegrationDeployment integrationDeployment) { final Integration integration = integrationDeployment.getSpec(); Properties applicationProperties = projectGenerator.generateApplicationPro... |
### Question:
JsonUtils { public static boolean isJson(String value) { if (value == null) { return false; } return isJsonObject(value) || isJsonArray(value); } private JsonUtils(); static ObjectReader reader(); static T readFromStream(final InputStream stream, final Class<T> type); static ObjectWriter writer(); static... |
### Question:
OpenApiCustomizer implements CamelKIntegrationCustomizer { public OpenApiCustomizer( ControllersConfigurationProperties configuration, IntegrationResourceManager resourceManager) { this.configuration = configuration; this.resourceManager = resourceManager; } OpenApiCustomizer(
ControllersConfi... |
### Question:
DependenciesCustomizer implements CamelKIntegrationCustomizer { public DependenciesCustomizer(VersionService versionService, IntegrationResourceManager resourceManager) { this.versionService = versionService; this.resourceManager = resourceManager; } DependenciesCustomizer(VersionService versionService, I... |
### Question:
WebhookCustomizer implements CamelKIntegrationCustomizer { @Override public Integration customize(IntegrationDeployment deployment, Integration integration, EnumSet<Exposure> exposure) { IntegrationSpec.Builder spec = new IntegrationSpec.Builder(); if (integration.getSpec() != null) { spec = spec.from(int... |
### Question:
CamelVersionCustomizer extends AbstractTraitCustomizer { public CamelVersionCustomizer(VersionService versionService) { this.versionService = versionService; } CamelVersionCustomizer(VersionService versionService); }### Answer:
@Test public void testCamelVersionCustomizer() { VersionService versionServi... |
### Question:
TemplatingCustomizer implements CamelKIntegrationCustomizer { @Override public Integration customize(IntegrationDeployment deployment, Integration integration, EnumSet<Exposure> exposure) { Set<TemplateStepLanguage> languages = deployment.getSpec().getFlows().stream() .flatMap(f -> f.getSteps().stream()) ... |
### Question:
JsonUtils { public static boolean isJsonObject(String value) { if (Strings.isEmptyOrBlank(value)) { return false; } final String trimmed = value.trim(); return trimmed.charAt(0) == '{' && trimmed.charAt(trimmed.length() - 1) == '}'; } private JsonUtils(); static ObjectReader reader(); static T readFromSt... |
### Question:
JsonRecordSupport { public static String toLexSortableString(long value) { return toLexSortableString(Long.toString(value)); } private JsonRecordSupport(); static void jsonStreamToRecords(Set<String> indexes, String dbPath, InputStream is, Consumer<JsonRecord> consumer); static String convertToDBPath(Str... |
### Question:
SimpleEventBus implements EventBus { @Override public void send(String subscriberId, String event, String data) { Subscription sub = subscriptions.get(subscriberId); if( sub!=null ) { sub.onEvent(event, data); } } @Override Subscription subscribe(String subscriberId, Subscription handler); @Override Subs... |
### Question:
SimpleEventBus implements EventBus { @Override public void broadcast(String event, String data) { for (Map.Entry<String, Subscription> entry : subscriptions.entrySet()) { entry.getValue().onEvent(event, data); } } @Override Subscription subscribe(String subscriberId, Subscription handler); @Override Subs... |
### Question:
ModelConverter extends ModelResolver { @Override protected boolean ignore(final Annotated member, final XmlAccessorType xmlAccessorTypeAnnotation, final String propName, final Set<String> propertiesToIgnore) { final JsonIgnore ignore = member.getAnnotation(JsonIgnore.class); if (ignore != null && !ignore.... |
### Question:
IconGenerator { public static String generate(final String template, final String name) { Mustache mustache; try { mustache = MUSTACHE_FACTORY.compile("/icon-generator/" + template + ".svg.mustache"); } catch (final MustacheNotFoundException e) { LOG.warn("Unable to load icon template for: `{}`, will use ... |
### Question:
ActionComparator implements Comparator<ConnectorAction> { private static String name(final ConnectorAction action) { return trimToNull(action.getName()); } private ActionComparator(); @Override int compare(final ConnectorAction left, final ConnectorAction right); static final Comparator<ConnectorAction> ... |
### Question:
OasModelHelper { public static Stream<String> sanitizeTags(final List<String> list) { if (list == null || list.isEmpty()) { return Stream.empty(); } return list.stream().map(OasModelHelper::sanitizeTag).filter(Objects::nonNull).distinct(); } private OasModelHelper(); static OperationDescription operation... |
### Question:
OasModelHelper { public static String sanitizeTag(final String tag) { if (StringUtils.isEmpty(tag)) { return null; } final String sanitized = JSONDB_DISALLOWED_KEY_CHARS.matcher(tag).replaceAll("").trim(); if (sanitized.length() > 768) { return sanitized.substring(0, Math.min(tag.length(), 768)); } return... |
### Question:
JsonUtils { public static boolean isJsonArray(String value) { if (Strings.isEmptyOrBlank(value)) { return false; } final String trimmed = value.trim(); return trimmed.charAt(0) == '[' && trimmed.charAt(trimmed.length() - 1) == ']'; } private JsonUtils(); static ObjectReader reader(); static T readFromStr... |
### Question:
XmlSchemaHelper { public static String toXsdType(final String type) { switch (type) { case "boolean": return XML_SCHEMA_PREFIX + ":boolean"; case "number": return XML_SCHEMA_PREFIX + ":decimal"; case "string": return XML_SCHEMA_PREFIX + ":string"; case "integer": return XML_SCHEMA_PREFIX + ":integer"; def... |
### Question:
OpenApiModelParser { static JsonNode convertToJson(final String specification) throws IOException { final JsonNode specRoot; if (isJsonSpec(specification)) { specRoot = JsonUtils.reader().readTree(specification); } else { specRoot = JsonUtils.convertValue(YAML_PARSER.load(specification), JsonNode.class); ... |
### Question:
JsonUtils { public static List<String> arrayToJsonBeans(JsonNode json) throws JsonProcessingException { List<String> jsonBeans = new ArrayList<>(); if (json.isArray()) { Iterator<JsonNode> it = json.elements(); while (it.hasNext()) { jsonBeans.add(writer().writeValueAsString(it.next())); } return jsonBean... |
### Question:
OpenApiPropertyGenerator { public static String createHostUri(final String scheme, final String host, final int port) { try { if (port == -1) { return new URI(scheme, host, null, null).toString(); } return new URI(scheme, null, host, port, null, null, null).toString(); } catch (final URISyntaxException e)... |
### Question:
JsonUtils { public static String jsonBeansToArray(List<?> jsonBeans) { final StringJoiner joiner = new StringJoiner(",", "[", "]"); for (Object jsonBean : jsonBeans) { joiner.add(String.valueOf(jsonBean)); } return joiner.toString(); } private JsonUtils(); static ObjectReader reader(); static T readFromS... |
### Question:
OpenApiGenerator implements APIGenerator { @Override public APISummary info(final String specification, final APIValidationContext validation) { final OpenApiModelInfo modelInfo = OpenApiModelParser.parse(specification, validation); final OasDocument model = modelInfo.getModel(); if (model == null) { retu... |
### Question:
OpenApiGenerator implements APIGenerator { @Override @SuppressWarnings({"PMD.ExcessiveMethodLength"}) public APIIntegration generateIntegration(final String specification, final ProvidedApiTemplate template) { final OpenApiModelInfo info = OpenApiModelParser.parse(specification, APIValidationContext.NONE)... |
### Question:
UnifiedDataShapeGenerator implements DataShapeGenerator<Oas30Document, Oas30Operation> { static boolean supports(final String mime, final Set<String> mimes) { if (mimes != null && !mimes.isEmpty()) { return mimes.contains(mime); } return false; } @Override DataShape createShapeFromRequest(final ObjectNod... |
### Question:
Oas30ParameterGenerator extends OpenApiParameterGenerator<Oas30Document> { static String javaTypeFor(final Oas30Schema schema) { if (OasModelHelper.isArrayType(schema)) { final Oas30Schema items = (Oas30Schema) schema.items; final String elementType = items.type; final String elementFormat = items.format;... |
### Question:
Oas30ModelHelper { static String getBasePath(Oas30Document openApiDoc) { if (openApiDoc.servers == null || openApiDoc.servers.isEmpty()) { return "/"; } return getBasePath(openApiDoc.servers.get(0)); } private Oas30ModelHelper(); static final String HTTP; }### Answer:
@Test public void shouldGetBasePath... |
### Question:
Labels { public static boolean isValid(String name) { return name.matches(VALID_VALUE_REGEX) && name.length() <= MAXIMUM_NAME_LENGTH; } private Labels(); static String sanitize(String name); static boolean isValid(String name); static String validate(String name); }### Answer:
@Test public void testVali... |
### Question:
Oas30ModelHelper { static String getScheme(Server server) { String serverUrl = resolveUrl(server); if (serverUrl.startsWith(HTTP)) { try { return new URL(serverUrl).getProtocol(); } catch (MalformedURLException e) { LOG.warn(String.format("Unable to determine base path from server URL: %s", serverUrl)); }... |
### Question:
Oas30ModelHelper { static String getHost(Oas30Document openApiDoc) { if (openApiDoc.servers == null || openApiDoc.servers.isEmpty()) { return null; } String serverUrl = resolveUrl(openApiDoc.servers.get(0)); if (serverUrl.startsWith(HTTP)) { try { return new URL(serverUrl).getHost(); } catch (MalformedURL... |
### Question:
Oas30ValidationRules extends OpenApiValidationRules<Oas30Response, Oas30SecurityScheme, Oas30SchemaDefinition> { static OpenApiModelInfo validateServerBasePaths(OpenApiModelInfo info) { if (info.getModel() == null) { return info; } final Oas30Document openApiDoc = info.getV3Model(); if (openApiDoc.servers... |
### Question:
UnifiedDataShapeGenerator implements DataShapeGenerator<Oas20Document, Oas20Operation> { static boolean supports(final String mime, final List<String> defaultMimes, final List<String> mimes) { boolean supports = false; if (mimes != null && !mimes.isEmpty()) { supports = mimes.contains(mime); } if (default... |
### Question:
OpenApiConnectorGenerator extends ConnectorGenerator { @Override protected final String determineConnectorDescription(final ConnectorTemplate connectorTemplate, final ConnectorSettings connectorSettings) { final OasDocument openApiDoc = parseSpecification(connectorSettings, APIValidationContext.NONE).getM... |
### Question:
OpenApiConnectorGenerator extends ConnectorGenerator { @Override protected final String determineConnectorName(final ConnectorTemplate connectorTemplate, final ConnectorSettings connectorSettings) { final OpenApiModelInfo modelInfo = parseSpecification(connectorSettings, APIValidationContext.NONE); if (!m... |
### Question:
OpenApiConnectorGenerator extends ConnectorGenerator { final Connector configureConnector(final ConnectorTemplate connectorTemplate, final Connector connector, final ConnectorSettings connectorSettings) { final Connector.Builder builder = new Connector.Builder().createFrom(connector); final OpenApiModelIn... |
### Question:
Strings { public static boolean isEmptyOrBlank(final String given) { if (given == null || given.isEmpty()) { return true; } final int len = given.length(); for (int i = 0; i < len; i++) { final char ch = given.charAt(i); if (!Character.isWhitespace(ch)) { return false; } } return true; } private Strings(... |
### Question:
OpenApiConnectorGenerator extends ConnectorGenerator { static OpenApiModelInfo parseSpecification(final ConnectorSettings connectorSettings, final APIValidationContext validationContext) { final String specification = requiredSpecification(connectorSettings); return OpenApiModelParser.parse(specification,... |
### Question:
SoapApiModelParser { public static SoapApiModelInfo parseSoapAPI(final String specification, final String wsdlURL) { SoapApiModelInfo.Builder builder = new SoapApiModelInfo.Builder(); try { final String resolvedSpecification; final Optional<String> resolvedWsdlURL; final boolean isHttpUrl = specification.... |
### Question:
ConnectorGenerator { protected final Connector baseConnectorFrom(final ConnectorTemplate connectorTemplate, final ConnectorSettings connectorSettings) { final Set<String> properties = connectorTemplate.getProperties().keySet(); final Map<String, String> configuredProperties = connectorSettings.getConfigur... |
### Question:
UniquePropertyValidator implements ConstraintValidator<UniqueProperty, WithId<?>> { @Override public boolean isValid(final WithId<?> value, final ConstraintValidatorContext context) { if (value == null) { return true; } final PropertyAccessor bean = new BeanWrapperImpl(value); final String propertyValue =... |
### Question:
CredentialProviderRegistry implements CredentialProviderLocator { @Override public CredentialProvider providerWithId(final String providerId) { final Connector connector = dataManager.fetch(Connector.class, providerId); if (connector == null) { throw new IllegalArgumentException("Unable to find connector ... |
### Question:
RelativeUriValidator implements ConstraintValidator<RelativeUri, URI> { @Override public boolean isValid(final URI value, final ConstraintValidatorContext context) { return value != null && !value.isAbsolute(); } @Override void initialize(final RelativeUri constraintAnnotation); @Override boolean isValid... |
### Question:
CredentialFlowStateHelper { static Set<CredentialFlowState> restoreFrom(final Restorer restore, final HttpServletRequest request) { final Cookie[] servletCookies = request.getCookies(); if (ArrayUtils.isEmpty(servletCookies)) { return Collections.emptySet(); } final List<javax.ws.rs.core.Cookie> credentia... |
### Question:
CredentialFlowStateHelper { static javax.ws.rs.core.Cookie toJaxRsCookie(final Cookie cookie) { return new javax.ws.rs.core.Cookie(cookie.getName(), cookie.getValue(), cookie.getPath(), cookie.getDomain()); } private CredentialFlowStateHelper(); }### Answer:
@Test public void shouldConvertServletCookie... |
### Question:
OAuth1CredentialProvider extends BaseCredentialProvider { @Override public AcquisitionMethod acquisitionMethod() { return new AcquisitionMethod.Builder() .label(labelFor(id)) .icon(iconFor(id)) .type(Type.OAUTH1) .description(descriptionFor(id)) .configured(configured) .build(); } OAuth1CredentialProvider... |
### Question:
BaseCredentialProvider implements CredentialProvider { protected static String callbackUrlFor(final URI baseUrl, final MultiValueMap<String, String> additionalParams) { final String path = baseUrl.getPath(); final String callbackPath = path + "credentials/callback"; try { final URI base = new URI(baseUrl.... |
### Question:
OAuth2CredentialProvider extends BaseCredentialProvider { @Override public AcquisitionMethod acquisitionMethod() { return new AcquisitionMethod.Builder() .label(labelFor(id)) .icon(iconFor(id)) .type(Type.OAUTH2) .description(descriptionFor(id)) .configured(configured) .build(); } OAuth2CredentialProvider... |
### Question:
Credentials { public Connection apply(final Connection updatedConnection, final CredentialFlowState flowState) { final CredentialProvider credentialProvider = providerFrom(flowState); final Connection withDerivedFlag = new Connection.Builder().createFrom(updatedConnection).isDerived(true).build(); final C... |
### Question:
StaticResourceClassInspector extends DataMapperBaseInspector<Void> { @Override protected String fetchJsonFor(final String fullyQualifiedName, final Context<Void> context) throws IOException { final String path = PREFIX + fullyQualifiedName + SUFFIX; final Resource[] resources = resolver.getResources(path)... |
### Question:
JsonSchemaInspector implements Inspector { @Override public List<String> getPaths(final String kind, final String type, final String specification, final Optional<byte[]> exemplar) { final JsonSchema schema; try { schema = JsonSchemaUtils.reader().readValue(specification); } catch (final IOException e) { ... |
### Question:
JsonSchemaInspector implements Inspector { static void fetchPaths(final String context, final List<String> paths, final Map<String, JsonSchema> properties) { for (final Map.Entry<String, JsonSchema> entry : properties.entrySet()) { final JsonSchema subschema = entry.getValue(); String path; final String k... |
### Question:
SpecificationClassInspector extends DataMapperBaseInspector<JsonNode> { @Override protected String fetchJsonFor(final String fullyQualifiedName, final Context<JsonNode> context) throws IOException { final JsonNode classNode = findClassNode(fullyQualifiedName, context.getState()); final JsonNode javaClass ... |
### Question:
JsonInstanceInspector implements Inspector { @Override @SuppressWarnings("unchecked") public List<String> getPaths(String kind, String type, String specification, Optional<byte[]> exemplar) { if (specification == null) { return Collections.emptyList(); } String context = null; final List<String> paths = n... |
### Question:
UsageUpdateHandler implements ResourceUpdateHandler { void processInternal(final ChangeEvent event) { LOG.debug("Processing event: {}", event); final ListResult<Integration> integrationsResult = dataManager.fetchAll(Integration.class); final List<Integration> integrations = integrationsResult.getItems(); ... |
### Question:
ConnectionUpdateHandler extends AbstractResourceUpdateHandler<ConnectionBulletinBoard> { ConnectionBulletinBoard computeBoard(Connection connection, Connector oldConnector, Connector newConnector) { final DataManager dataManager = getDataManager(); final String id = connection.getId().get(); final Connect... |
### Question:
ResourceUpdateController { CompletableFuture<Void> onEventInternal(final String event, final String data) { if (!running.get()) { return CompletableFuture.completedFuture(null); } if (!Objects.equals(event, EventBus.Type.CHANGE_EVENT)) { return CompletableFuture.completedFuture(null); } final ChangeEvent ... |
### Question:
Threads { public static ThreadFactory newThreadFactory(final String groupName) { return new ThreadFactory() { @SuppressWarnings("PMD.AvoidThreadGroup") final ThreadGroup initialization = new ThreadGroup(groupName); final AtomicInteger threadNumber = new AtomicInteger(-1); @Override public Thread newThread... |
### Question:
LRUCacheManager implements CacheManager { @SuppressWarnings("unchecked") @Override public <K, V> Cache<K, V> getCache(final String name, boolean soft) { Cache<K, V> cache = (Cache<K, V>) caches.computeIfAbsent(name, n -> this.newCache(soft)); if ((soft && !(cache instanceof LRUSoftCache)) || (!soft && (ca... |
### Question:
RandomValueGenerator { public static String generate(final String generator) { if (generator == null) { throw new IllegalArgumentException("Generator cannot be null"); } final int split = generator.indexOf(':'); if (split < 0) { return generate(generator, null); } return generate(generator.substring(0, sp... |
### Question:
MustacheTemplatePreProcessor extends AbstractTemplatePreProcessor { @SuppressWarnings("PMD.PrematureDeclaration") @Override public String preProcess(String template) throws TemplateProcessingException { String newTemplate = super.preProcess(template); if (inSectionSymbol) { throw new TemplateProcessingExc... |
### Question:
SlackMetaDataExtension extends AbstractMetaDataExtension { @SuppressWarnings("unchecked") @Override public Optional<MetaData> meta(Map<String, Object> parameters) { final String token = ConnectorOptions.extractOption(parameters, "token"); if (token != null) { LOG.debug("Retrieving channels for connection ... |
### Question:
FilterUtil { public static List<String> extractParameters(String filter) { List<String> result = new ArrayList<>(); Matcher matcher = PARAM_PATTERN.matcher(filter); while (matcher.find()) { String param = matcher.group(); result.add(param.substring(2)); } return result; } private FilterUtil(); static Lis... |
### Question:
HttpConnectorFactories { public static String computeHttpUri(String scheme, Map<String, Object> options) { String baseUrl = (String)options.remove("baseUrl"); if (ObjectHelper.isEmpty(baseUrl)) { throw new IllegalArgumentException("baseUrl si mandatory"); } String uriScheme = StringHelper.before(baseUrl, ... |
### Question:
ODataMetadata implements ODataConstants { public Set<String> getEntityNames() { return entityNames; } boolean hasEntityProperties(); Set<PropertyMetadata> getEntityProperties(); void addEntityProperty(PropertyMetadata property); void setEntityProperties(Set<PropertyMetadata> properties); boolean hasEntit... |
### Question:
IntegrationRouteLoader implements SourceLoader { public IntegrationRouteLoader() { } IntegrationRouteLoader(); IntegrationRouteLoader(ActivityTracker activityTracker,
Set<IntegrationStepHandler> integrationStepHandlers, Tracer tracer); @Override List<String> getSupported... |
### Question:
DebeziumConsumerCustomizer implements ComponentProxyCustomizer, CamelContextAware { @Override public void customize(final ComponentProxyComponent component, final Map<String, Object> options) { kafkaConnectionCustomizer.customize(component, options); component.setBeforeConsumer(DebeziumConsumerCustomizer:... |
### Question:
DebeziumMySQLDatashapeStrategy implements DebeziumDatashapeStrategy { static String buildJsonSchema(final String tableName, final List<String> properties) { final StringBuilder jsonSchemaBuilder = new StringBuilder("{\"$schema\": \"http: .append(tableName) .append("\",\"type\": \"object\",\"properties\": ... |
### Question:
DebeziumMySQLDatashapeStrategy implements DebeziumDatashapeStrategy { static String convertDDLtoJsonSchema(final String ddl, final String tableName) { int firstParentheses = ddl.indexOf('('); final Matcher matcher = PATTERN.matcher(ddl.substring(firstParentheses)); final List<String> properties = new Arra... |
### Question:
KafkaConnectionCustomizer implements ComponentProxyCustomizer, CamelContextAware { @Override public void customize(ComponentProxyComponent component, Map<String, Object> options) { KafkaConfiguration configuration = new KafkaConfiguration(); if (ConnectorOptions.extractOption(options, CERTIFICATE_OPTION) ... |
### Question:
SyndesisHeaderStrategy extends HttpHeaderFilterStrategy { @Override public boolean applyFilterToCamelHeaders(final String headerName, final Object headerValue, final Exchange exchange) { if (isWhitelisted(exchange, headerName)) { return false; } return super.applyFilterToCamelHeaders(headerName, headerVal... |
### Question:
KafkaMetaDataRetrieval extends ComponentMetadataRetrieval { @Override public SyndesisMetadataProperties fetchProperties(CamelContext context, String componentId, Map<String, Object> properties) { List<PropertyPair> brokers = new ArrayList<>(); try (KubernetesClient client = createKubernetesClient()) { Kaf... |
### Question:
GoogleCalendarEventsCustomizer implements ComponentProxyCustomizer { static void beforeConsumer(Exchange exchange) { final Message in = exchange.getIn(); final Event event = exchange.getIn().getBody(Event.class); GoogleCalendarEventModel model = GoogleCalendarEventModel.newFrom(event); in.setBody(model); ... |
### Question:
GoogleCalendarUtils { static String formatAtendees(final List<EventAttendee> attendees) { if (attendees == null || attendees.isEmpty()) { return null; } return attendees.stream() .map(EventAttendee::getEmail) .collect(Collectors.joining(",")); } private GoogleCalendarUtils(); }### Answer:
@Test public ... |
### Question:
GoogleCalendarUtils { static List<EventAttendee> parseAtendees(final String attendeesString) { if (ObjectHelper.isEmpty(attendeesString)) { return Collections.emptyList(); } return Splitter.on(',').trimResults().splitToList(attendeesString) .stream() .map(GoogleCalendarUtils::attendee) .collect(Collectors... |
### Question:
JsonSimplePredicate implements Predicate { @SuppressWarnings("JdkObsolete") static String convertSimpleToOGNLForMaps(final String simple) { final Matcher matcher = SIMPLE_EXPRESSION.matcher(simple); final StringBuffer ognl = new StringBuffer(simple.length() + 5); while (matcher.find()) { final String expr... |
### Question:
GoogleCalendarEventModel { public static GoogleCalendarEventModel newFrom(final Event event) { final GoogleCalendarEventModel model = new GoogleCalendarEventModel(); if (event == null) { return model; } model.title = StringHelper.trimToNull(event.getSummary()); model.description = StringHelper.trimToNull(... |
### Question:
AWSSQSMetaDataExtension extends AbstractMetaDataExtension { @Override public Optional<MetaData> meta(Map<String, Object> parameters) { final String accessKey = ConnectorOptions.extractOption(parameters, "accessKey"); final String secretKey = ConnectorOptions.extractOption(parameters, "secretKey"); final S... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.