method2testcases stringlengths 118 6.63k |
|---|
### Question:
JsonWebTokenAuthenticator implements Authenticator<String, Principal> { public static String createJwtToken(SignatureAlgorithm alg, Key secretKey, Principal principal) { return Jwts.builder().setSubject(principal.getName()).signWith(alg, secretKey).compact(); } JsonWebTokenAuthenticator(Key secretKey, Sig... |
### Question:
CustomAuthenticatorConfig implements AuthenticationConfig { @Override public AuthFilter<?, Principal> createAuthFilter(AuthenticationBootstrap bootstrap) { final ClassLoader classLoader = getClassLoader(classPath); final Class<?> klass = loadClass(classLoader, className); final Class<AuthenticationConfig>... |
### Question:
UserResource { @GET @Path("current") @PermitAll @Operation( summary = "Get the current user", description = "Returns the current user that Jobson believes is calling the API. This entrypoint *always* returns " + "*something*. If authentication is disabled (e.g. guest auth is enabled) then the client's ID ... |
### Question:
JoinFunction implements FreeFunction { @Override public Object call(Object... args) { if (args.length != 2) { throw new RuntimeException(String.format("Invalid number of arguments (%s) supplied to a join function", args.length)); } else if (args[0].getClass() != String.class) { throw new RuntimeException(... |
### Question:
ToStringFunction implements FreeFunction { @Override public Object call(Object... args) { if (args.length != 1) { throw new RuntimeException(String.format("Incorrect number of arguments (%s), expected 1", args.length)); } else { return args[0].toString(); } } @Override Object call(Object... args); }### ... |
### Question:
FileInput implements JobInput { public String getFilename() { return this.filename; } @JsonCreator FileInput(@JsonProperty(value = "filename") String filename,
@JsonProperty(value = "data", required = true) String b64data); FileInput(String filename,
byte[] b64d... |
### Question:
FilesystemJobSpecDAO implements JobSpecDAO { @Override public Optional<JobSpecSummary> getJobSpecSummaryById(JobSpecId jobSpecId) { return getJobSpecById(jobSpecId).map(JobSpec::toSummary); } FilesystemJobSpecDAO(Path jobSpecsDir); @Override Optional<JobSpec> getJobSpecById(JobSpecId jobSpecId); @Override... |
### Question:
FilesystemJobSpecDAO implements JobSpecDAO { @Override public Map<String, HealthCheck> getHealthChecks() { return singletonMap( FILESYSTEM_SPECS_DAO_DISK_SPACE_HEALTHCHECK, new DiskSpaceHealthCheck( jobSpecsDir.toFile(), FILESYSTEM_SPECS_DAO_DISK_SPACE_WARNING_THRESHOLD_IN_BYTES)); } FilesystemJobSpecDAO(... |
### Question:
FilesystemJobsDAO implements JobDAO { @Override public Optional<JobSpec> getSpecJobWasSubmittedAgainst(JobId jobId) { return resolveJobDir(jobId).map(Path::toFile).flatMap(this::loadJobSpec); } FilesystemJobsDAO(Path jobsDirectory, IdGenerator idGenerator); @Override boolean jobExists(JobId jobId); @Overr... |
### Question:
FilesystemJobsDAO implements JobDAO { @Override public PersistedJob persist(ValidJobRequest validJobRequest) { final JobId jobId = generateUniqueJobId(); final PersistedJob persistedJob = PersistedJob.createFromValidRequest(validJobRequest, jobId); createNewJobDirectory(persistedJob); return persistedJob;... |
### Question:
FilesystemJobsDAO implements JobDAO { @Override public void persistOutput(JobId jobId, JobOutput jobOutput) { final Optional<Path> maybeJobDir = resolveJobDir(jobId); if (!maybeJobDir.isPresent()) throw new RuntimeException(jobOutput.getId() + ": cannot be persisted to job " + jobId + ": job dir does not ... |
### Question:
FilesystemJobsDAO implements JobDAO { @Override public Map<String, HealthCheck> getHealthChecks() { return singletonMap( FILESYSTEM_JOBS_DAO_DISK_SPACE_HEALTHCHECK, new DiskSpaceHealthCheck( this.jobsDirectory.toFile(), FILESYSTEM_JOBS_DAO_DISK_SPACE_WARNING_THRESHOLD_IN_BYTES)); } FilesystemJobsDAO(Path ... |
### Question:
FilesystemUserDAO implements UserDAO { @Override public Optional<UserCredentials> getUserCredentialsById(UserId id) { requireNonNull(id); try { return readUserCredentials() .filter(c -> c.getId().equals(id)) .findFirst(); } catch (IOException e) { throw new RuntimeException(e); } } FilesystemUserDAO(File ... |
### Question:
SpectralUtils { public static void fft2D_inplace(ComplexDoubleMatrix A) { ComplexDoubleMatrix aTemp = A.transpose(); DoubleFFT_2D fft2d = new DoubleFFT_2D(aTemp.rows, aTemp.columns); fft2d.complexForward(aTemp.data); A.data = aTemp.transpose().data; } static void fft1D_inplace(ComplexDoubleMatrix vector,... |
### Question:
MathUtils { public static boolean isOdd(long value) { return !isEven(value); } static boolean isEven(long value); static boolean isOdd(long value); static boolean isPower2(long value); static double rad2deg(double valueInRadians); static double deg2rad(double valueInDegrees); static int[][] distributePoi... |
### Question:
MathUtils { public static boolean isEven(long value) { return value % 2 == 0; } static boolean isEven(long value); static boolean isOdd(long value); static boolean isPower2(long value); static double rad2deg(double valueInRadians); static double deg2rad(double valueInDegrees); static int[][] distributePo... |
### Question:
MathUtils { public static boolean isPower2(long value) { return value == 1 || value == 2 || value == 4 || value == 8 || value == 16 || value == 32 || value == 64 || value == 128 || value == 256 || value == 512 || value == 1024 || value == 2048 || value == 4096; } static boolean isEven(long value); static... |
### Question:
MathUtils { public static double rad2deg(double valueInRadians) { return valueInRadians * Constants.RTOD; } static boolean isEven(long value); static boolean isOdd(long value); static boolean isPower2(long value); static double rad2deg(double valueInRadians); static double deg2rad(double valueInDegrees);... |
### Question:
MathUtils { public static double deg2rad(double valueInDegrees) { return valueInDegrees * Constants.DTOR; } static boolean isEven(long value); static boolean isOdd(long value); static boolean isPower2(long value); static double rad2deg(double valueInRadians); static double deg2rad(double valueInDegrees);... |
### Question:
MathUtils { public static int[][] distributePoints(final int numOfPoints, final Window window) { final float lines = window.lines(); final float pixels = window.pixels(); int[][] result = new int[numOfPoints][2]; float winP = (float) Math.sqrt(numOfPoints / (lines / pixels)); float winL = numOfPoints / wi... |
### Question:
MathUtils { public static double[] increment(int m, double begin, double pitch) { double[] array = new double[m]; for (int i = 0; i < m; i++) { array[i] = begin + i * pitch; } return array; } static boolean isEven(long value); static boolean isOdd(long value); static boolean isPower2(long value); static ... |
### Question:
MathUtils { @Deprecated public static double sqr(double value) { return Math.pow(value, 2); } static boolean isEven(long value); static boolean isOdd(long value); static boolean isPower2(long value); static double rad2deg(double valueInRadians); static double deg2rad(double valueInDegrees); static int[][... |
### Question:
MathUtils { @Deprecated public static double sqrt(double value) { return Math.sqrt(value); } static boolean isEven(long value); static boolean isOdd(long value); static boolean isPower2(long value); static double rad2deg(double valueInRadians); static double deg2rad(double valueInDegrees); static int[][]... |
### Question:
MathUtils { public static DoubleMatrix lying(DoubleMatrix inMatrix) { return new DoubleMatrix(inMatrix.toArray()).transpose(); } static boolean isEven(long value); static boolean isOdd(long value); static boolean isPower2(long value); static double rad2deg(double valueInRadians); static double deg2rad(do... |
### Question:
MathUtils { public static DoubleMatrix ramp(final int nRows, final int nColumns) { final double maxHeight = 1; return DoubleMatrix.ones(nRows, 1).mmul(lying(new DoubleMatrix(increment(nColumns, 0, maxHeight / (nColumns - 1))))); } static boolean isEven(long value); static boolean isOdd(long value); stati... |
### Question:
PolyUtils { public static double normalize2(double data, final int min, final int max) { data -= (0.5 * (min + max)); data /= (0.25 * (max - min)); return data; } static double normalize2(double data, final int min, final int max); static double normalize2(double data, final double min, final double max)... |
### Question:
PolyUtils { public static DoubleMatrix normalize(DoubleMatrix t) { return t.sub(t.get(t.length / 2)).div(10.0); } static double normalize2(double data, final int min, final int max); static double normalize2(double data, final double min, final double max); static DoubleMatrix normalize(DoubleMatrix t); ... |
### Question:
PolyUtils { public static int degreeFromCoefficients(int numOfCoefficients) { return (int) (0.5 * (-1 + (int) (Math.sqrt((double) (1 + 8 * numOfCoefficients))))) - 1; } static double normalize2(double data, final int min, final int max); static double normalize2(double data, final double min, final doubl... |
### Question:
PolyUtils { public static int numberOfCoefficients(final int degree) { return (int) (0.5 * (Math.pow(degree + 1, 2) + degree + 1)); } static double normalize2(double data, final int min, final int max); static double normalize2(double data, final double min, final double max); static DoubleMatrix normali... |
### Question:
PolyUtils { public static double[] polyFitNormalized(DoubleMatrix t, DoubleMatrix y, final int degree) throws IllegalArgumentException { return polyFit(normalize(t), y, degree); } static double normalize2(double data, final int min, final int max); static double normalize2(double data, final double min, ... |
### Question:
PolyUtils { public static double polyVal1D(double x, double[] coeffs) { double sum = 0.0; for (int d = coeffs.length - 1; d >= 0; --d) { sum *= x; sum += coeffs[d]; } return sum; } static double normalize2(double data, final int min, final int max); static double normalize2(double data, final double min,... |
### Question:
SarUtils { public static ComplexDoubleMatrix multilook(final ComplexDoubleMatrix inputMatrix, final int factorRow, final int factorColumn) { if (factorRow == 1 && factorColumn == 1) { return inputMatrix; } logger.debug("multilook input [inputMatrix] size: " + inputMatrix.length + " lines: " + inputMatrix.... |
### Question:
SarUtils { public static ComplexDoubleMatrix computeIfg(final ComplexDoubleMatrix masterData, final ComplexDoubleMatrix slaveData) throws Exception { return LinearAlgebraUtils.dotmult(masterData, slaveData.conj()); } static ComplexDoubleMatrix oversample(ComplexDoubleMatrix inputMatrix, final int factorR... |
### Question:
SarUtils { public static DoubleMatrix intensity(final ComplexDoubleMatrix inputMatrix) { return pow(inputMatrix.real(), 2).add(pow(inputMatrix.imag(), 2)); } static ComplexDoubleMatrix oversample(ComplexDoubleMatrix inputMatrix, final int factorRow, final int factorCol); static DoubleMatrix intensity(fin... |
### Question:
SarUtils { public static DoubleMatrix magnitude(final ComplexDoubleMatrix inputMatrix) { return sqrt(intensity(inputMatrix)); } static ComplexDoubleMatrix oversample(ComplexDoubleMatrix inputMatrix, final int factorRow, final int factorCol); static DoubleMatrix intensity(final ComplexDoubleMatrix inputMa... |
### Question:
Ellipsoid { public void showdata() { logger.info("ELLIPSOID: \tEllipsoid used (orbit, output): " + name + "."); logger.info("ELLIPSOID: a = " + a); logger.info("ELLIPSOID: b = " + b); logger.info("ELLIPSOID: e2 = " + e2); logger.info("ELLIPSOID: e2' = " + e2b); } Ellipsoid(); Ellipsoid(final double semiM... |
### Question:
Ellipsoid { public static double[] xyz2ell(final Point xyz) { final double r = Math.sqrt(Math.pow(xyz.x, 2) + Math.pow(xyz.y, 2)); final double nu = Math.atan2((xyz.z * a), (r * b)); final double sin3 = Math.pow(Math.sin(nu), 3); final double cos3 = Math.pow(Math.cos(nu), 3); final double phi = Math.atan2... |
### Question:
Ellipsoid { public static Point ell2xyz(final double phi, final double lambda, final double height) throws IllegalArgumentException { if (phi > Math.PI || phi < -Math.PI || lambda > Math.PI || lambda < -Math.PI) { throw new IllegalArgumentException("Ellipsoid.ell2xyz : input values for phi/lambda have to ... |
### Question:
DInSAR { public DInSAR(SLCImage masterMeta, Orbit masterOrbit, SLCImage slaveDefoMeta, Orbit slaveDefoOrbit, SLCImage topoSlaveMeta, Orbit slaveTopoOrbit) { this.masterMeta = masterMeta; this.masterOrbit = masterOrbit; this.slaveDefoMeta = slaveDefoMeta; this.slaveDefoOrbit = slaveDefoOrbit; this.topoSlav... |
### Question:
SLCImage { public double pix2tr(double pixel) { return tRange1 + ((pixel - 1.0) / rsr2x); } SLCImage(); SLCImage(MetadataElement element); void parseResFile(File resFileName); double pix2tr(double pixel); double pix2range(double pixel); double tr2pix(double rangeTime); double line2ta(double line); double... |
### Question:
SLCImage { public double tr2pix(double rangeTime) { return 1.0 + (rsr2x * (rangeTime - tRange1)); } SLCImage(); SLCImage(MetadataElement element); void parseResFile(File resFileName); double pix2tr(double pixel); double pix2range(double pixel); double tr2pix(double rangeTime); double line2ta(double line)... |
### Question:
SLCImage { public double line2ta(double line) { return tAzi1 + ((line - 1.0) / PRF); } SLCImage(); SLCImage(MetadataElement element); void parseResFile(File resFileName); double pix2tr(double pixel); double pix2range(double pixel); double tr2pix(double rangeTime); double line2ta(double line); double ta2l... |
### Question:
SLCImage { public double ta2line(double azitime) { return 1.0 + PRF * (azitime - tAzi1); } SLCImage(); SLCImage(MetadataElement element); void parseResFile(File resFileName); double pix2tr(double pixel); double pix2range(double pixel); double tr2pix(double rangeTime); double line2ta(double line); double ... |
### Question:
SLCImage { public Point lp2t(Point p) { return new Point(pix2tr(p.x), line2ta(p.y)); } SLCImage(); SLCImage(MetadataElement element); void parseResFile(File resFileName); double pix2tr(double pixel); double pix2range(double pixel); double tr2pix(double rangeTime); double line2ta(double line); double ta2l... |
### Question:
SLCImage { public double computeDeltaRange(double pixel) { return mlRg * (pix2range(pixel + 1) - pix2range(pixel)); } SLCImage(); SLCImage(MetadataElement element); void parseResFile(File resFileName); double pix2tr(double pixel); double pix2range(double pixel); double tr2pix(double rangeTime); double li... |
### Question:
SLCImage { public double computeRangeResolution(double pixel) { return ((rsr2x / 2.) / rangeBandwidth) * (computeDeltaRange(pixel) / mlRg); } SLCImage(); SLCImage(MetadataElement element); void parseResFile(File resFileName); double pix2tr(double pixel); double pix2range(double pixel); double tr2pix(doub... |
### Question:
CrossGeometry { public void computeCoeffsFromOffsets() { constructGrids(); DoubleMatrix sourceY = new DoubleMatrix(numberOfWindows, 1); DoubleMatrix sourceX = new DoubleMatrix(numberOfWindows, 1); DoubleMatrix offsetY = new DoubleMatrix(numberOfWindows, 1); DoubleMatrix offsetX = new DoubleMatrix(numberOf... |
### Question:
GeoUtils { public static GeoPoint[] computeCorners(final SLCImage meta, final Orbit orbit, final Window tile, final float height[]) throws Exception { if (height.length != 4) { throw new IllegalArgumentException("input height array has to have 4 elements"); } GeoPoint[] corners = new GeoPoint[2]; double[]... |
### Question:
TimeData implements RowData<T> { @NonNull @Override public ContentProviderOperation.Builder updatedBuilder(@NonNull TransactionContext transactionContext, @NonNull ContentProviderOperation.Builder builder) { if (mDue.isPresent() && mStart.isAllDay() != mDue.value().isAllDay()) { throw new IllegalArgumentE... |
### Question:
Overridden implements Single<ContentValues> { @Override public ContentValues value() { ContentValues values = mDelegate.value(); values.put(TaskContract.Instances.INSTANCE_ORIGINAL_TIME, new Backed<Long>( new FirstPresent<>( new Seq<>( new Mapped<>(DateTime::getTimestamp, mOriginalTime), new NullSafe<>(va... |
### Question:
Enduring implements Single<ContentValues> { @Override public ContentValues value() { ContentValues values = mDelegate.value(); values.put(TaskContract.Instances.INSTANCE_DURATION, new Backed<Long>( new Zipped<>( new NullSafe<>(values.getAsLong(TaskContract.Instances.INSTANCE_START)), new NullSafe<>(values... |
### Question:
DateTimeIterableFieldAdapter extends SimpleFieldAdapter<Iterable<DateTime>, EntityType> { @Override String fieldName() { return mDateTimeListFieldName; } DateTimeIterableFieldAdapter(String datetimeListFieldName, String timezoneFieldName); @Override Iterable<DateTime> getFrom(ContentValues values); @Overr... |
### Question:
DateTimeIterableFieldAdapter extends SimpleFieldAdapter<Iterable<DateTime>, EntityType> { @Override public Iterable<DateTime> getFrom(ContentValues values) { String datetimeList = values.getAsString(mDateTimeListFieldName); if (datetimeList == null) { return EmptyIterable.instance(); } String timezoneStri... |
### Question:
Toggled implements NotificationSignal { @Override public int value() { if (mFlag != Notification.DEFAULT_VIBRATE && mFlag != Notification.DEFAULT_SOUND && mFlag != Notification.DEFAULT_LIGHTS) { throw new IllegalArgumentException("Notification signal flag is not valid: " + mFlag); } return mEnable ? addFl... |
### Question:
ContainsValues implements Predicate<Cursor> { @Override public boolean satisfiedBy(Cursor testedInstance) { for (String key : mValues.keySet()) { int columnIdx = testedInstance.getColumnIndex(key); if (columnIdx < 0) { return false; } if (testedInstance.getType(columnIdx) == Cursor.FIELD_TYPE_BLOB) { if (... |
### Question:
VanillaInstanceData implements Single<ContentValues> { @Override public ContentValues value() { ContentValues values = new ContentValues(6); values.putNull(TaskContract.Instances.INSTANCE_START); values.putNull(TaskContract.Instances.INSTANCE_START_SORTING); values.putNull(TaskContract.Instances.INSTANCE_... |
### Question:
TaskRelated implements Single<ContentValues> { @Override public ContentValues value() { ContentValues values = mDelegate.value(); values.put(TaskContract.Instances.TASK_ID, mTaskId); return values; } TaskRelated(long taskId, Single<ContentValues> delegate); @Override ContentValues value(); }### Answer:
@... |
### Question:
MavenScm { public boolean isEmpty() { return this.connection == null && this.developerConnection == null && this.tag == null && this.url == null; } MavenScm(Builder builder); boolean isEmpty(); String getConnection(); String getDeveloperConnection(); String getTag(); String getUrl(); }### Answer:
@Test v... |
### Question:
MyFirstActor extends AbstractActor { static public Props props() { return Props.create(MyFirstActor.class, () -> new MyFirstActor()); } static Props props(); @Override Receive createReceive(); }### Answer:
@Test public void testMyFirstActor_Greeting() { final TestKit probe = new TestKit(actorSystem); fi... |
### Question:
Calculator implements ICalculator { @Override public String add(int... values) { int sum = 0; for (int value : values) { sum += value; } return format(sum); } @Override String add(int... values); @Override String multiply(int... values); @Override String evaluate(String value); }### Answer:
@Test public... |
### Question:
CalcApi { public String getEvaluateSumUrl(final int a, final int b) { return getEvaluateUrl(a + "+" + b); } CalcApi(final String pBasePath); String getEvaluateSumUrl(final int a, final int b); String getEvaluateUrl(String input); }### Answer:
@Test public void calculateSum() throws Exception { assertEqua... |
### Question:
CalcApi { public String getEvaluateUrl(String input) { try { return mBasePath + CALC + URLEncoder.encode(input, "UTF-8"); } catch (final UnsupportedEncodingException pE) { throw new IllegalStateException(pE); } } CalcApi(final String pBasePath); String getEvaluateSumUrl(final int a, final int b); String g... |
### Question:
ExcludeFilter implements ArtifactsFilter { @Override public boolean isArtifactIncluded(final Artifact artifact) throws ArtifactFilterException { return !(artifact.getGroupId().equals(excludedGroupId) && artifact.getArtifactId().equals(excludedArtifactId)); } ExcludeFilter(final String excludedGroupId, fin... |
### Question:
SpecificationResourceCustomizer implements ComponentProxyCustomizer { @Override public void customize(final ComponentProxyComponent component, final Map<String, Object> options) { if (options.containsKey(ComponentProperties.WSDL_URL)) { options.remove(ComponentProperties.SPECIFICATION); } else if (options... |
### Question:
EndpointCustomizer implements ComponentProxyCustomizer { @Override public void customize(final ComponentProxyComponent component, final Map<String, Object> options) { consumeOption(options, SERVICE_NAME, serviceObject -> { final String serviceName = (String) serviceObject; final QName service = QName.valu... |
### Question:
BoxVerifierExtension extends DefaultComponentVerifierExtension { @Override protected Result verifyParameters(Map<String, Object> parameters) { ResultBuilder builder = ResultBuilder.withStatusAndScope(Result.Status.OK, Scope.PARAMETERS) .error(ResultErrorHelper.requiresOption("userName", parameters)) .erro... |
### Question:
BoxVerifierExtension extends DefaultComponentVerifierExtension { @Override protected Result verifyConnectivity(Map<String, Object> parameters) { return ResultBuilder.withStatusAndScope(Result.Status.OK, Scope.CONNECTIVITY) .error(parameters, this::verifyCredentials).build(); } protected BoxVerifierExtens... |
### Question:
BoxDownloadCustomizer implements ComponentProxyCustomizer { private void afterProducer(Exchange exchange) { BoxFile file = new BoxFile(); Message in = exchange.getIn(); file.setId(fileId); ByteArrayOutputStream output = in.getBody(ByteArrayOutputStream.class); try { file.setContent(new String(output.toByt... |
### Question:
ServiceNowMetaDataExtension extends AbstractMetaDataExtension { @Override public Optional<MetaData> meta(Map<String, Object> parameters) { final String objectType = ConnectorOptions.extractOption(parameters, OBJECT_TYPE); final String metaType = ConnectorOptions.extractOption(parameters, META_TYPE, "defin... |
### Question:
GoogleSheetsUpdateSpreadsheetCustomizer implements ComponentProxyCustomizer { private static void afterProducer(Exchange exchange) { final Message in = exchange.getIn(); final BatchUpdateSpreadsheetResponse batchUpdateResponse = in.getBody(BatchUpdateSpreadsheetResponse.class); GoogleSpreadsheet model = n... |
### Question:
CellCoordinate { public static CellCoordinate fromCellId(String cellId) { CellCoordinate coordinate = new CellCoordinate(); if (cellId != null) { coordinate.setRowIndex(getRowIndex(cellId)); coordinate.setColumnIndex(getColumnIndex(cellId)); } return coordinate; } CellCoordinate(); static CellCoordinate f... |
### Question:
CellCoordinate { public static String getColumnName(int columnIndex) { String alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; StringBuilder columnName = new StringBuilder(); int index = columnIndex; int overflowIndex = -1; while (index > 25) { overflowIndex++; index -= 26; } if (overflowIndex >= 0) { columnName.... |
### Question:
RangeCoordinate extends CellCoordinate { public static RangeCoordinate fromRange(String range) { RangeCoordinate coordinate = new RangeCoordinate(); String rangeExpression = normalizeRange(range); if (rangeExpression.contains(":")) { String[] coordinates = rangeExpression.split(":", -1); coordinate.setRow... |
### Question:
GoogleSheetsCreateSpreadsheetCustomizer implements ComponentProxyCustomizer { @Override public void customize(ComponentProxyComponent component, Map<String, Object> options) { setApiMethod(options); component.setBeforeProducer(this::beforeProducer); component.setAfterProducer(GoogleSheetsCreateSpreadsheet... |
### Question:
GoogleSheetsCreateSpreadsheetCustomizer implements ComponentProxyCustomizer { private static void afterProducer(Exchange exchange) { final Message in = exchange.getIn(); final Spreadsheet spreadsheet = in.getBody(Spreadsheet.class); GoogleSpreadsheet model = new GoogleSpreadsheet(); if (ObjectHelper.isNot... |
### Question:
GoogleSheetsGetValuesCustomizer implements ComponentProxyCustomizer { private void beforeConsumer(Exchange exchange) throws JsonProcessingException { final Message in = exchange.getIn(); if (splitResults) { in.setBody(createModelFromSplitValues(in)); } else { in.setBody(createModelFromValueRange(in)); } }... |
### Question:
GoogleSheetsGetSpreadsheetCustomizer implements ComponentProxyCustomizer { private static void beforeConsumer(Exchange exchange) { final Message in = exchange.getIn(); final Spreadsheet spreadsheet = exchange.getIn().getBody(Spreadsheet.class); GoogleSpreadsheet model = new GoogleSpreadsheet(); if (Object... |
### Question:
SpecificationResourceCustomizer implements ComponentProxyCustomizer { @Override public void customize(final ComponentProxyComponent component, final Map<String, Object> options) { consumeOption(options, "specification", specificationObject -> { try { final String authenticationType = ConnectorOptions.extr... |
### Question:
SwaggerProxyComponent extends ComponentProxyComponent { public SwaggerProxyComponent(final String componentId, final String componentScheme) { super(componentId, componentScheme); } SwaggerProxyComponent(final String componentId, final String componentScheme); @Override Endpoint createEndpoint(final Strin... |
### Question:
ResponseCustomizer implements ComponentProxyCustomizer, OutputDataShapeAware { static boolean isUnifiedDataShape(final DataShape dataShape) { if (dataShape == null || dataShape.getKind() != DataShapeKinds.JSON_SCHEMA) { return false; } final String specification = dataShape.getSpecification(); if (ObjectH... |
### Question:
SetHttpHeader extends SetHeader { @Override public void process(final Exchange exchange) throws Exception { super.process(exchange); SyndesisHeaderStrategy.whitelist(exchange, headerName); } SetHttpHeader(final String headerName, final String headerValue); @Override void process(final Exchange exchange); ... |
### Question:
LogStepHandler implements IntegrationStepHandler { @Override public Optional<ProcessorDefinition<?>> handle(Step step, ProcessorDefinition<?> route, IntegrationRouteBuilder builder, String flowIndex, String stepIndex) { final String message = createMessage(step); if (message.isEmpty()) { return Optional.e... |
### Question:
AWSSNSMetaDataExtension 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... |
### Question:
GenerateConnectorInspectionsMojo extends AbstractMojo { public JsonNode validateWithSchema(File jsonFile) throws MojoExecutionException { InputStream jsonStream = null; try { jsonStream = new FileInputStream(jsonFile); JsonNode jsonNode = JsonUtils.reader().readTree(jsonStream); ProcessingReport report = ... |
### Question:
KeyStoreHelper { public KeyStoreHelper store() { try { KeyStore keyStore = CertificateUtil.createKeyStore(certificate, alias); tempFile = Files.createTempFile(alias, ".ks", PosixFilePermissions.asFileAttribute(PosixFilePermissions.fromString("rw-------"))); password = generatePassword(); try (OutputStream... |
### Question:
ConnectorOptions { public static String extractOption(Map<String, ?> options, String key, String defaultValue) { if (options == null) { return defaultValue; } return Optional.ofNullable(options.get(key)) .map(Object::toString) .filter(v -> v.length() > 0) .orElse(defaultValue); } private ConnectorOptions... |
### Question:
ConnectorOptions { public static <T> T extractOptionAndMap(Map<String, ?> options, String key, Function<? super String, T> mappingFn, T defaultValue) { if (options == null) { return defaultValue; } try { return Optional.ofNullable(options.get(key)) .map(Object::toString) .filter(v -> v.length() > 0) .map(... |
### Question:
ConnectorOptions { public static void extractOptionAndConsume(Map<String, ?> options, String key, Consumer<String> consumer) { if (options == null) { return; } try { Optional.ofNullable(options.get(key)) .map(Object::toString) .ifPresent(consumer); } catch (Exception ex) { LOG.error("Evaluation of option ... |
### Question:
ConnectorOptions { public static <T> T extractOptionAsType(Map<String, ?> options, String key, Class<T> requiredClass, T defaultValue) { if (options == null) { return defaultValue; } return Optional.ofNullable(options.get(key)) .filter(requiredClass::isInstance) .map(requiredClass::cast) .orElse(defaultVa... |
### Question:
CertificateUtil { public static KeyManager[] createKeyManagers(String clientCertificate, String alias) throws GeneralSecurityException, IOException { final KeyStore clientKs = createKeyStore(clientCertificate, alias); KeyManagerFactory kmFactory = KeyManagerFactory.getInstance("PKIX"); kmFactory.init(clie... |
### Question:
LogStepHandler implements IntegrationStepHandler { static String createMessage(Step l) { StringBuilder sb = new StringBuilder(128); String customText = getCustomText(l.getConfiguredProperties()); boolean isContextLoggingEnabled = isContextLoggingEnabled(l.getConfiguredProperties()); boolean isBodyLoggingE... |
### Question:
CertificateUtil { public static TrustManager[] createTrustManagers(String brokerCertificate, String alias) throws GeneralSecurityException, IOException { TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance("X509"); trustManagerFactory.init(createKeyStore(brokerCertificate, alias)); r... |
### Question:
HttpRequestUnwrapperProcessor implements Processor { @Override public void process(final Exchange exchange) throws Exception { final Message message = exchange.getIn(); final Object body = message.getBody(); final JsonNode data = parseBody(body); if (data == null) { return; } final JsonNode paramMap = dat... |
### Question:
ErrorMapper { public static Map<String, Integer> jsonToMap(String property) { try { if (ObjectHelper.isEmpty(property)) { return Collections.emptyMap(); } return JsonUtils.reader().forType(STRING_MAP_TYPE).readValue(property); } catch (IOException e) { LOG.warn(String.format("Failed to read error code map... |
### Question:
ErrorMapper { public static ErrorStatusInfo mapError(final Exception exception, final Map<String, Integer> httpResponseCodeMappings, final Integer defaultResponseCode) { SyndesisConnectorException sce; if (isOrCausedBySyndesisConnectorException(exception)) { sce = extract(exception); } else { sce = fromRu... |
### Question:
ExcludeFilter implements ArtifactsFilter { @Override public Set<Artifact> filter(final Set<Artifact> artifacts) throws ArtifactFilterException { final Set<Artifact> included = new HashSet<>(); for (final Artifact given : artifacts) { if (isArtifactIncluded(given)) { included.add(given); } } return include... |
### Question:
PrometheusMetricsProviderImpl implements MetricsProvider { @Override public IntegrationMetricsSummary getIntegrationMetricsSummary(String integrationId) { final Map<String, Long> totalMessagesMap = getMetricValues(integrationId, METRIC_TOTAL, deploymentVersionLabel, Long.class, PrometheusMetricsProviderIm... |
### Question:
PrometheusMetricsProviderImpl implements MetricsProvider { @Override public IntegrationMetricsSummary getTotalIntegrationMetricsSummary() { final Optional<Long> totalMessages = getSummaryMetricValue(METRIC_TOTAL, Long.class, "sum"); final Optional<Long> failedMessages = getSummaryMetricValue(METRIC_FAILED... |
### Question:
PodMetricsReader implements Runnable { @Override public void run() { try { LOGGER.debug("Collecting stats from integrationId: {}", integrationId); List<Map<String, String>> routeStats = getRoutes(integration, "[a-zA-z0-9_-]+"); routeStats.forEach( m -> { long messages = toLong(m.getOrDefault(EXCHANGES_TOT... |
### Question:
MetricsCollector implements Runnable, Closeable { @Override public void close() throws IOException { LOGGER.info("Stopping metrics collector."); close(scheduler); close(executor); } @Autowired MetricsCollector(DataManager dataManager, JsonDB jsonDB, KubernetesClient kubernetes); @PostConstruct @SuppressW... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.