method2testcases stringlengths 118 3.08k |
|---|
### Question:
AbortPolicyWithReport extends ThreadPoolExecutor.AbortPolicy { @Override public void rejectedExecution(Runnable r, ThreadPoolExecutor e) { String msg = String.format("Thread pool is EXHAUSTED!" + " Thread Name: %s, Pool Size: %d (active: %d, core: %d, max: %d, largest: %d), Task: %d (completed: %d)," + " ... |
### Question:
WebServiceProtocol extends AbstractProxyProtocol { public WebServiceProtocol() { super(Fault.class); bus.setExtension(new ServletDestinationFactory(), HttpDestinationFactory.class); } WebServiceProtocol(); void setHttpBinder(HttpBinder httpBinder); @Override int getDefaultPort(); static final int DEFAULT_... |
### Question:
DaggerLifecycleDelegate { public Object onRetainCustomNonConfigurationInstance() { return daggerComponent; } DaggerLifecycleDelegate(@NonNull DaggerComponentFactory<T> daggerComponentFactory); @SuppressWarnings("unchecked") void onCreate(AppCompatActivity activity); Object onRetainCustomNonConfigurationIn... |
### Question:
DaggerLifecycleDelegate { public T daggerComponent() { return daggerComponent; } DaggerLifecycleDelegate(@NonNull DaggerComponentFactory<T> daggerComponentFactory); @SuppressWarnings("unchecked") void onCreate(AppCompatActivity activity); Object onRetainCustomNonConfigurationInstance(); T daggerComponent(... |
### Question:
CollectionsX { public static <T> List<T> concat(@NonNull List<T> list1, @NonNull List<T> list2) { final ArrayList<T> list = new ArrayList<>(list1.size() + list2.size()); if (!list1.isEmpty()) { list.addAll(list1); } if (!list2.isEmpty()) { list.addAll(list2); } return list; } private CollectionsX(); stat... |
### Question:
AppRouter { public Intent loginIntent(Context context) { return intentFactory.create(context, LoginActivity.class); } AppRouter(); @VisibleForTesting AppRouter(IntentFactory intentFactory); Intent loginIntent(Context context); }### Answer:
@Test public void should_return_loginIntent() throws Exception {... |
### Question:
EmailValidator { public boolean isValid(CharSequence email) { return email != null && EMAIL_ADDRESS.matcher(email).matches(); } boolean isValid(CharSequence email); Observable<Boolean> checkEmail(CharSequence email); }### Answer:
@Test public void should_return_false_when_email_is_null() throws Exceptio... |
### Question:
PolicyConditionCacheConfig { @Bean public GroovyConditionCache conditionCache( @Value("${ENABLE_DECISION_CACHING:true}") final boolean decisionCachingEnabled) { if (decisionCachingEnabled) { LOGGER.info( "In-memory condition caching disabled for policy evaluation (superseded by decision caching)."); retur... |
### Question:
GroovyConditionShell { public ConditionScript parse(final String script) throws ConditionParsingException { return parse(script, true); } GroovyConditionShell(final GroovyConditionCache conditionCache); ConditionScript parse(final String script); boolean execute(final String script, final Map<String, Obje... |
### Question:
GroovyConditionShell { public boolean execute(final String script, final Map<String, Object> boundVariables) throws ConditionParsingException { ConditionScript conditionScript = parse(script, false); try { return conditionScript.execute(boundVariables); } catch (ConditionAssertionFailedException e) { retu... |
### Question:
URL implements URLComponent, Validating, Comparable<URL> { public URL withProtocol(Protocol protocol) { if (protocol.equals(this.protocol)) { return this; } return new URL(userName, password, protocol, host, port, path, parameters, anchor); } URL(String userName, String password, Protocol protocol, Host h... |
### Question:
ChainRunner { @Inject public ChainRunner(ExecutorService svc, ReentrantScope scope) { Checks.notNull("svc", svc); Checks.notNull("scope", scope); this.svc = svc; this.scope = scope; } @Inject ChainRunner(ExecutorService svc, ReentrantScope scope); void submit(P chain, ChainCallback<A, S, P, T, R> onDone,... |
### Question:
ChainRunner { public <A extends AbstractActeur<T, R, S>, S extends ActeurState<T, R>, P extends Chain<? extends A, ?>, T, R extends T> void submit(P chain, ChainCallback<A, S, P, T, R> onDone, AtomicBoolean cancelled) { ActeurInvoker<A, S, P, T, R> cc = new ActeurInvoker<>(svc, scope, chain, onDone, cance... |
### Question:
StrictTransportSecurityHeader extends AbstractHeader<StrictTransportSecurity> { @Override public StrictTransportSecurity toValue(CharSequence value) { return StrictTransportSecurity.parse(value); } StrictTransportSecurityHeader(); @Override StrictTransportSecurity toValue(CharSequence value); @Override Ch... |
### Question:
CookieHeaderNetty428 extends AbstractHeader<Cookie[]> { @Override public Cookie[] toValue(CharSequence value) { ServerCookieDecoder decoder = strict ? ServerCookieDecoder.STRICT : ServerCookieDecoder.LAX; Set<Cookie> result = decoder.decode(notNull("value", value).toString()); return result == null ? EMPT... |
### Question:
FrameOptions { public static FrameOptions allowFrom(URI uri) { return new FrameOptions(FrameOptionType.ALLOW_FROM, notNull("uri", uri)); } FrameOptions(FrameOptionType type); FrameOptions(FrameOptionType type, URI value); FrameOptionType type(); URI uri(); String name(); String toString(); static FrameO... |
### Question:
RotatingRealmProvider implements Provider<Realm> { @Override public Realm get() { Duration since1970 = Duration.ofMillis(System.currentTimeMillis()); long minutesSince1970 = since1970.toMinutes(); long intervals = minutesSince1970 / interval.toMinutes(); return new Realm(Strings.interleave(Long.toString(i... |
### Question:
PagePathAndMethodFilter { public boolean match(HttpRequest req) { String path = this.basePathFilter.apply(req.uri()); if (path == null) { return false; } path = trimLeadingAndTrailingSlashes(trimQuery(path)); Method method = Method.get(req); MethodPath mp = new MethodPath(method, path); if (nonMatchesCach... |
### Question:
ValidationByResponseHandler { <T> Response validate(T object) { Set<ConstraintViolation<T>> errs = jeeValidator.validate(object); if (errs.isEmpty()) { return Response.status(200).entity(object).build(); } else { String msg = "Invalid Bean, constraint error(s) : "; for (ConstraintViolation<T> err : errs) ... |
### Question:
ValidationByExceptionHandler { <T> void validate(T object) { Set<ConstraintViolation<T>> errs = jeeValidator.validate(object); if (errs.size() > 0) { String msg = "Invalid Bean, constraint error(s) : "; for (ConstraintViolation<T> err : errs) { msg += err.getPropertyPath() + " " + err.getMessage() + ". ";... |
### Question:
HelloWorldBatch { public static void main(String[] args) { System.out.println("Executing batch"); if (args != null && args.length == 1 && args[0] != null) { System.out.println("input args ok"); } else { System.out.println("Error with input args"); throw new IllegalArgumentException("Error with input args"... |
### Question:
ProgressButton extends CompoundButton { public void setProgress(int progress) { if (progress > mMax || progress < 0) { throw new IllegalArgumentException( String.format("Progress (%d) must be between %d and %d", progress, 0, mMax)); } mProgress = progress; invalidate(); } ProgressButton(Context context); ... |
### Question:
ProgressButton extends CompoundButton { public void setMax(int max) { if (max <= 0 || max < mProgress) { throw new IllegalArgumentException( String.format("Max (%d) must be > 0 and >= %d", max, mProgress)); } mMax = max; invalidate(); } ProgressButton(Context context); ProgressButton(Context context, Att... |
### Question:
ProgressButton extends CompoundButton { public void setPinned(boolean pinned) { setChecked(pinned); invalidate(); } ProgressButton(Context context); ProgressButton(Context context, AttributeSet attrs); ProgressButton(Context context, AttributeSet attrs, int defStyle); int getMax(); void setMax(int max);... |
### Question:
ProgressButton extends CompoundButton { @Override public Parcelable onSaveInstanceState() { Parcelable superState = super.onSaveInstanceState(); if (isSaveEnabled()) { SavedState ss = new SavedState(superState); ss.mMax = mMax; ss.mProgress = mProgress; return ss; } return superState; } ProgressButton(Con... |
### Question:
ProgressButton extends CompoundButton { public void setProgressAndMax(int progress, int max) { if (progress > max || progress < 0) { throw new IllegalArgumentException( String.format("Progress (%d) must be between %d and %d", progress, 0, max)); } else if (max <= 0) { throw new IllegalArgumentException(St... |
### Question:
WriteController { @RequestMapping(value = "/{id}", method = RequestMethod.DELETE) @ResponseStatus(value = HttpStatus.OK) public void delete(@PathVariable(value = "id") String id, HttpServletResponse response) throws IOException { service.delete(id); } @RequestMapping(value = "/create", method = RequestMe... |
### Question:
ReadController { @RequestMapping(value = "/listspam/{id}") public List<CommentDTO> getSpamComments(@PathVariable(value = "id") String pageId) throws IOException { LOGGER.info("get spam comments for pageId {}", pageId); counterService.increment("commentstore.list_spamcomments"); List<CommentModel> r = serv... |
### Question:
Logger { public static void addLogPrinter(AbstractLogPrinter logPrinter) { if (logPrinter == null) throw new NullPointerException("logPrinter is null"); logAdapter.add(logPrinter); } private Logger(); static void addLogPrinter(AbstractLogPrinter logPrinter); static void removeLogPrint(AbstractLogPrinter ... |
### Question:
Logger { public static void removeLogPrint(AbstractLogPrinter logPrinter) { if (logPrinter == null) throw new NullPointerException("logPrinter is null"); logAdapter.remove(logPrinter); } private Logger(); static void addLogPrinter(AbstractLogPrinter logPrinter); static void removeLogPrint(AbstractLogPrin... |
### Question:
Logger { public static void d(String msg, Object...args) { logAdapter.d(msg, args); } private Logger(); static void addLogPrinter(AbstractLogPrinter logPrinter); static void removeLogPrint(AbstractLogPrinter logPrinter); static void clearLogPrint(); static void v(String msg, Object...args); static void v... |
### Question:
Decorator implements Component { @Override public double calc(String user ,int seniority) { return this.component.calc(user ,seniority); } Decorator(Component component); @Override double calc(String user ,int seniority); }### Answer:
@Test public void test() { String user = "zlikun" ; int seniority = 7 ... |
### Question:
Singleton2 { public static final Singleton2 getInstance() { if (INSTANCE == null) { INSTANCE = new Singleton2() ; } return INSTANCE ; } Singleton2(); static final Singleton2 getInstance(); }### Answer:
@Test public void test_multi() { final ConcurrentMap<Singleton2 ,Boolean> map = new ConcurrentHashMap<>... |
### Question:
TrainFactory { public String process() { StringBuilder sb = new StringBuilder() ; sb.append(builder.buildHeader()).append("-") ; sb.append(builder.buildBody()).append("-") ; sb.append(builder.buildFooter()) ; return sb.toString() ; } TrainFactory(TrainBuilder builder); String process(); }### Answer:
@Tes... |
### Question:
Singleton0 { public static final Singleton0 getInstance() { return INSTANCE ; } private Singleton0(); static final Singleton0 getInstance(); }### Answer:
@Test public void test_single() { Assert.assertTrue(Singleton0.getInstance() == Singleton0.getInstance()); }
@Test public void test_multi() { final Se... |
### Question:
Singleton5 { public static final Singleton5 getInstance() { if (INSTANCE == null) { try { if (LOCK.tryLock(100 , TimeUnit.MILLISECONDS)) { if (INSTANCE == null) { INSTANCE = new Singleton5(); } } } catch (InterruptedException e) { e.printStackTrace(); } finally { LOCK.unlock(); } } return INSTANCE ; } pri... |
### Question:
Singleton3 { public static final Singleton3 getInstance() { if (INSTANCE == null) { synchronized (Singleton3.class) { if (INSTANCE == null) { INSTANCE = new Singleton3() ; } } } return INSTANCE ; } private Singleton3(); static final Singleton3 getInstance(); }### Answer:
@Test public void test_single() ... |
### Question:
Singleton4 { public static final Singleton4 getInstance() { if (INSTANCE == null) { INSTANCE = Singleton4Holder.obj ; } return INSTANCE ; } private Singleton4(); static final Singleton4 getInstance(); }### Answer:
@Test public void test_single() { Assert.assertTrue(Singleton4.getInstance() == Singleton4... |
### Question:
QueryParser { public Collection<String> parseFeatures() { String featureValues = kvps.get(FEATURES.name()); return parseCommaSeparatedValues(featureValues); } QueryParser(String query, boolean compressed); Collection<String> parseServices(); Collection<String> parseVersions(); Collection<String> parseFeat... |
### Question:
QueryParser { public Collection<String> parsePhenomenons() { String phenomenonValues = kvps.get(PHENOMENONS.name()); return parseCommaSeparatedValues(phenomenonValues); } QueryParser(String query, boolean compressed); Collection<String> parseServices(); Collection<String> parseVersions(); Collection<Strin... |
### Question:
QueryParser { public Collection<String> parseProcedures() { String procedureValues = kvps.get(PROCEDURES.name()); return parseCommaSeparatedValues(procedureValues); } QueryParser(String query, boolean compressed); Collection<String> parseServices(); Collection<String> parseVersions(); Collection<String> p... |
### Question:
QueryParser { public TimeRange parseTimeRange() { String begin = kvps.get(BEGIN.name()); String end = kvps.get(END.name()); return TimeRange.createTimeRange(begin, end); } QueryParser(String query, boolean compressed); Collection<String> parseServices(); Collection<String> parseVersions(); Collection<Stri... |
### Question:
XmlHelper { public <T> T parseFirst(XmlObject from, String xPath, Class<T> ofType) { T[] results = parseAll(from, xPath, ofType); return results.length > 0 ? results[0] : null; } XmlHelper(Map<String, String> namespaceDecarations); String getShortName(IdentifierList identifiers); String getUniqueId(Identi... |
### Question:
SosMetadataUpdate { protected static String createPostfix(String url) { if (url.startsWith("http: url = url.substring("http: } return url.replaceAll("/", "_").replaceAll("\\?", "_").replaceAll(":", "_").replaceAll("@", "_"); } static void updateSosServices(Iterable<String> sosServices); static void updat... |
### Question:
SosMetadataUpdate { protected static File getCacheTarget(String serviceUrl) { String postfix = createPostfix(serviceUrl); return new File(generateCacheFilePath(postfix)); } static void updateSosServices(Iterable<String> sosServices); static void updateService(String serviceUrl); static void invalidateCac... |
### Question:
SosMetadataUpdate { protected static void prepareCacheTargetDirectory() throws IOException { File cacheDirectory = getCacheDir(); if (!cacheDirectory.exists() && !cacheDirectory.mkdirs()) { throw new IOException("Unable to create cache directory."); } } static void updateSosServices(Iterable<String> sosS... |
### Question:
SOSRequestBuilderGET_200 implements ISOSRequestBuilder { String encodePlusInParameter(String parameter) { return parameter.replace("+", "%2B"); } @Override String buildGetCapabilitiesRequest(ParameterContainer parameters); @Override String buildGetObservationRequest(ParameterContainer parameters); @Overr... |
### Question:
SOSRequestBuilderGET_200 implements ISOSRequestBuilder { String fixTimeZone(String timeString) { StringBuilder sb = new StringBuilder(timeString); int insertionIndex = timeString.length() - 2; if (sb.charAt(insertionIndex - 1) != ':') { sb.insert(insertionIndex, ":"); } return sb.toString(); } @Override ... |
### Question:
SOSRequestBuilderGET_200 implements ISOSRequestBuilder { public String encode(String parameter) { try { return encodePlusInParameter(URLEncoder.encode(parameter, "utf-8")); } catch (UnsupportedEncodingException e) { LOGGER.warn("Could not encode parameter {}!", parameter); return parameter; } } @Override... |
### Question:
SOSRequestBuilderGET_200 implements ISOSRequestBuilder { String createIso8601Duration(String start, String end) { StringBuilder sb = new StringBuilder(); sb.append(fixTimeZone(start)).append("/"); return sb.append(fixTimeZone(end)).toString(); } @Override String buildGetCapabilitiesRequest(ParameterConta... |
### Question:
ClientUtils { public static String[] splitJsonObjects(String value) { int openCurlies = 0; List<String> objects = new ArrayList<String>(); StringBuilder object = new StringBuilder(); for (int i=0; i < value.length() ; i++) { char currentChar = value.charAt(i); object.append(currentChar); if (currentChar =... |
### Question:
QueryBuilder { String encodeValue(String value) { value = value.replace("%", "%25"); value = value.replace("+", "%2B"); value = value.replace(" ", "+"); value = value.replace("!", "%21"); value = value.replace("#", "%23"); value = value.replace("$", "%24"); value = value.replace("&", "%26"); value = value... |
### Question:
EventSubscriptionController { String replaceNonAlphaNumerics(String toReplace) { return toReplace.replaceAll("[^0-9a-zA-Z_]", "_"); } void setTimeseries(TimeseriesLegendData timeseries); TimeseriesLegendData getTimeSeries(); String getServiceUrl(); String getOffering(); String getPhenomenon(); String get... |
### Question:
EventSubscriptionController { String replaceAllUmlauts(String toReplace) { toReplace = toReplace.replaceAll("[ö]", "oe"); toReplace = toReplace.replaceAll("^Ö", "Oe"); toReplace = toReplace.replaceAll("[Ö]", "OE"); toReplace = toReplace.replaceAll("[ä]", "ae"); toReplace = toReplace.replaceAll("^Ä", "Ae")... |
### Question:
EventSubscriptionController { String normalize(String toNormalize) { return replaceNonAlphaNumerics(replaceAllUmlauts(toNormalize)); } void setTimeseries(TimeseriesLegendData timeseries); TimeseriesLegendData getTimeSeries(); String getServiceUrl(); String getOffering(); String getPhenomenon(); String ge... |
### Question:
SensorNetworkParser { public Map<String, ComponentType> parseSensorDescriptions(InputStream stream) { Map<String, ComponentType> sensorDescriptions = new HashMap<String, ComponentType>(); ComponentDocument[] components = parseNetworkComponentsFromDescribeSensorResponse(stream); for (ComponentDocument comp... |
### Question:
ArcGISSoeEReportingMetadataHandler extends MetadataHandler { protected String parseCategory(String phenomenonLabel) { Pattern pattern = Pattern.compile("\\((.*)\\)$"); Matcher matcher = pattern.matcher(parseLastBraceGroup(phenomenonLabel)); return matcher.find() ? matcher.group(1) : phenomenonLabel; } Arc... |
### Question:
FeatureParser { public Map<Feature, Point> parseFeatures(InputStream stream) { Map<Feature, Point> featureLocations = new HashMap<Feature, Point>(); try { GetFeatureOfInterestResponseDocument responseDoc = GetFeatureOfInterestResponseDocument.Factory.parse(stream); GetFeatureOfInterestResponseType respons... |
### Question:
ArcGISSoeDescribeSensorParser { public String getUomFor(String phenomenonId) { String xPath = "$this String query = String.format(xPath, phenomenonId); Quantity output = xmlHelper.parseFirst(sensorML, query, Quantity.class); return output == null ? null : output.getUom().getCode(); } ArcGISSoeDescribeSens... |
### Question:
ArcGISSoeDescribeSensorParser { public String getShortName() { String query = "$this Identifier identifier = xmlHelper.parseFirst(sensorML, query, Identifier.class); return identifier == null ? null : identifier.getTerm().getValue(); } ArcGISSoeDescribeSensorParser(XmlObject sml); String getUomFor(String ... |
### Question:
SoapSOSRequestBuilder_200 extends SOSRequestBuilder_200_OXFExtension { @Override public String buildGetObservationRequest(ParameterContainer parameters) throws OXFException { parameters.removeParameterShell(parameters.getParameterShellWithCommonName(GET_OBSERVATION_RESPONSE_FORMAT_PARAMETER)); parameters.... |
### Question:
TimeseriesParameter implements Serializable { public String getLabel() { return label; } TimeseriesParameter(); TimeseriesParameter(String parameterId, String[] parametersToGenerateId); @JsonIgnore String getGlobalId(); void setLabel(String label); String getLabel(); }### Answer:
@Test public void shou... |
### Question:
TimeseriesParameter implements Serializable { @JsonIgnore public String getGlobalId() { return globalId; } TimeseriesParameter(); TimeseriesParameter(String parameterId, String[] parametersToGenerateId); @JsonIgnore String getGlobalId(); void setLabel(String label); String getLabel(); }### Answer:
@Tes... |
### Question:
ResultPage implements Serializable { public boolean isLastPage() { return offset + results.length >= total; } @SuppressWarnings("unused") private ResultPage(); ResultPage(T[] results, int offset, int total); int getOffset(); int getTotal(); T[] getResults(); boolean isLastPage(); }### Answer:
@Test pub... |
### Question:
QueryParser { String decodeValue(String value) { value = value.replace("%21", "!"); value = value.replace("%23", "#"); value = value.replace("%24", "$"); value = value.replace("%26", "&"); value = value.replace("%27", "'"); value = value.replace("%28", "("); value = value.replace("%29", ")"); value = valu... |
### Question:
QueryParser { public Collection<String> parseServices() { String serviceValues = kvps.get(SERVICES.name()); return parseCommaSeparatedValues(serviceValues); } QueryParser(String query, boolean compressed); Collection<String> parseServices(); Collection<String> parseVersions(); Collection<String> parseFeat... |
### Question:
QueryParser { public Collection<String> parseVersions() { String versionValues = kvps.get(VERSIONS.name()); return parseCommaSeparatedValues(versionValues); } QueryParser(String query, boolean compressed); Collection<String> parseServices(); Collection<String> parseVersions(); Collection<String> parseFeat... |
### Question:
QueryParser { public Collection<String> parseOfferings() { String offeringValues = kvps.get(OFFERINGS.name()); return parseCommaSeparatedValues(offeringValues); } QueryParser(String query, boolean compressed); Collection<String> parseServices(); Collection<String> parseVersions(); Collection<String> parse... |
### Question:
_1CTokenizer implements Tokenizer { public final void tokenize(SourceCode source, Tokens cpdTokens) { Lexer lexer = _1CLexer.create(new _1CConfiguration(charset)); String fileName = source.getFileName(); List<Token> tokens = lexer.lex(new File(fileName)); for (Token token : tokens) { TokenEntry cpdToken =... |
### Question:
_1CRuleRepository extends RuleRepository { @Override public List<Rule> createRules() { return annotationRuleParser.parse(CheckList.REPOSITORY_KEY, CheckList.getChecks()); } _1CRuleRepository(AnnotationRuleParser annotationRuleParser); @Override List<Rule> createRules(); }### Answer:
@Test public void tes... |
### Question:
_1CPlugin extends SonarPlugin { public List<Class<? extends Extension>> getExtensions() { return ImmutableList.of( _1C.class, _1CSourceImporter.class, _1CColorizerFormat.class, _1CCpdMapping.class, _1CSquidSensor.class, _1CRuleRepository.class, _1CProfile.class, _1CCommonRulesEngineProvider.class, LCOVSen... |
### Question:
_1CProfile extends ProfileDefinition { @Override public RulesProfile createProfile(ValidationMessages validation) { return annotationProfileParser.parse(CheckList.REPOSITORY_KEY, CheckList.SONAR_WAY_PROFILE, _1C.KEY, CheckList.getChecks(), validation); } _1CProfile(AnnotationProfileParser annotationProfil... |
### Question:
_1CSquidSensor implements Sensor { public boolean shouldExecuteOnProject(Project project) { return _1C.KEY.equalsIgnoreCase(project.getLanguageKey()); } _1CSquidSensor(RulesProfile profile, FileLinesContextFactory fileLinesContextFactory); boolean shouldExecuteOnProject(Project project); void analyse(Proj... |
### Question:
_1CConfigurationModel extends AbstractConfigurationModel { public List<ConfigurationProperty> getProperties() { return ImmutableList.of(charsetProperty); } List<ConfigurationProperty> getProperties(); @Override Charset getCharset(); @Override Parser<? extends Grammar> doGetParser(); @Override List<Tokeni... |
### Question:
LCOVParser { public Map<String, CoverageMeasuresBuilder> parseFile(File file) { final List<String> lines; try { lines = FileUtils.readLines(file); } catch (IOException e) { throw new SonarException("Could not read content from file: " + file, e); } return parse(lines); } Map<String, CoverageMeasuresBuild... |
### Question:
LCOVSensor implements Sensor { public boolean shouldExecuteOnProject(Project project) { return _1C.KEY.equalsIgnoreCase(project.getLanguageKey()) && StringUtils.isNotBlank(_1c.getSettings().getString(_1CPlugin.LCOV_REPORT_PATH)); } LCOVSensor(_1C _1c); boolean shouldExecuteOnProject(Project project); void... |
### Question:
LCOVSensor implements Sensor { @Override public String toString() { return getClass().getSimpleName(); } LCOVSensor(_1C _1c); boolean shouldExecuteOnProject(Project project); void analyse(Project project, SensorContext context); @Override String toString(); }### Answer:
@Test public void test_toString() ... |
### Question:
_1CColorizerFormat extends CodeColorizerFormat { @Override public List<Tokenizer> getTokenizers() { return ImmutableList.of( new StringTokenizer("<span class=\"s\">", "</span>"), new CDocTokenizer("<span class=\"cd\">", "</span>"), new JavadocTokenizer("<span class=\"cppd\">", "</span>"), new CppDocTokeni... |
### Question:
DockerAccessWithHcClient implements DockerAccess { @Override public void loadImage(String image, File tarArchive) throws DockerAccessException { String url = urlBuilder.loadImage(); try { delegate.post(url, tarArchive, new BodyAndStatusResponseHandler(), HTTP_OK); } catch (IOException e) { throw new Docke... |
### Question:
EcrExtendedAuth { public RegistryAuth extendedAuth(RegistryAuth localCredentials) throws IOException { JsonObject jo = getAuthorizationToken(localCredentials); JsonArray authorizationDatas = jo.getAsJsonArray("authorizationData"); JsonObject authorizationData = authorizationDatas.get(0).getAsJsonObject();... |
### Question:
FromConfigRegistryAuthHandler implements RegistryAuthHandler { @Override public RegistryAuth create(RegistryAuthConfig.Kind kind, String user, String registry, Function<String, String> decryptor) { if (registryAuthConfig.getUsername(kind) != null) { if (registryAuthConfig.getPassword(kind) == null) { thro... |
### Question:
DockerAccessWithHcClient implements DockerAccess { @Override public void saveImage(String image, String filename) throws DockerAccessException { ImageName name = new ImageName(image); String url = urlBuilder.getImage(name); try { delegate.get(url, getImageResponseHandler(filename), HTTP_OK); } catch (IOEx... |
### Question:
DockerFileBuilder { public DockerFileBuilder maintainer(String maintainer) { this.maintainer = maintainer; return this; } DockerFileBuilder(); File write(File destDir); String content(); DockerFileBuilder baseImage(String baseImage); DockerFileBuilder maintainer(String maintainer); DockerFileBuilder workd... |
### Question:
DockerFileBuilder { public DockerFileBuilder optimise() { this.shouldOptimise = true; return this; } DockerFileBuilder(); File write(File destDir); String content(); DockerFileBuilder baseImage(String baseImage); DockerFileBuilder maintainer(String maintainer); DockerFileBuilder workdir(String workdir); D... |
### Question:
DockerFileBuilder { public DockerFileBuilder user(String user) { this.user = user; return this; } DockerFileBuilder(); File write(File destDir); String content(); DockerFileBuilder baseImage(String baseImage); DockerFileBuilder maintainer(String maintainer); DockerFileBuilder workdir(String workdir); Dock... |
### Question:
BuildConfiguration implements Serializable { public String validate() throws IllegalArgumentException { if (entryPoint != null) { entryPoint.validate(); } if (cmd != null) { cmd.validate(); } if (healthCheck != null) { healthCheck.validate(); } if ((dockerFile != null || contextDir != null) && dockerArchi... |
### Question:
BuildConfiguration implements Serializable { public ArchiveCompression getCompression() { return compression; } BuildConfiguration(); boolean isDockerFileMode(); String getDockerFile(); String getDockerArchive(); String getContextDir(); String getFilter(); String getFrom(); Map<String, String> getFromExt(... |
### Question:
EnricherFactory { List<Enricher<P>> createEnrichers(String... descriptorPaths) { try { EnricherEntry.initDefaultOrder(); TreeMap<EnricherEntry,Enricher<P>> enricherMap = new TreeMap<>(); for (String descriptor : descriptorPaths) { readEnricherDefinitions(enricherMap, descriptor); } ArrayList<Enricher<P>> ... |
### Question:
KeyStoreUtil { public static KeyStore createDockerKeyStore(String certPath) throws IOException, GeneralSecurityException { PrivateKey privKey = loadPrivateKey(certPath + "/key.pem"); Certificate[] certs = loadCertificates(certPath + "/cert.pem"); KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaul... |
### Question:
KeyStoreUtil { static PrivateKey loadPrivateKey(String keyPath) throws IOException, GeneralSecurityException { try (Reader reader = new FileReader(keyPath); PEMParser parser = new PEMParser(reader)) { Object readObject; while ((readObject = parser.readObject()) != null) { if (readObject instanceof PEMKeyP... |
### Question:
EcrExtendedAuth { public boolean isAwsRegistry() { return isAwsRegistry; } EcrExtendedAuth(KitLogger logger, String registry); boolean isAwsRegistry(); RegistryAuth extendedAuth(RegistryAuth localCredentials); }### Answer:
@Test public void testIsNotAws() { assertFalse(new EcrExtendedAuth(logger, "joloki... |
### Question:
ObjModel extends IndexedModel { protected static void parseInts(String str, int[] ints) { int len = str.length(); int intIndex = 0; int currentInt = -1; ints[0] = -1; ints[1] = -1; ints[2] = -1; for (int i = 0; i < len; i++) { char c = str.charAt(i); if (c >= '0' && c <= '9') { if (currentInt == -1) { cur... |
### Question:
SignatureConfig { public void write(Writer out) throws IOException { Ini configIni = new Ini(); Section section = configIni.add(SECTION_NAME); section.put("algorithm", algorithm.toString()); section.put("provider", provider); section.put("destination", destination.toString()); if (destinationTable != null... |
### Question:
SignedBatchWriter implements BatchWriter { @Override public void addMutations(Iterable<Mutation> iterable) throws MutationsRejectedException { for (Mutation mutation : iterable) { addMutation(mutation); } } SignedBatchWriter(Connector connector, String tableName, BatchWriterConfig batchConfig, SignatureCo... |
### Question:
SignedBatchWriter implements BatchWriter { @Override public void flush() throws MutationsRejectedException { tableWriter.flush(); if (signatureTableWriter != null) { signatureTableWriter.flush(); } } SignedBatchWriter(Connector connector, String tableName, BatchWriterConfig batchConfig, SignatureConfig si... |
### Question:
SignedBatchWriter implements BatchWriter { @Override public void close() throws MutationsRejectedException { tableWriter.close(); if (signatureTableWriter != null) { signatureTableWriter.close(); } } SignedBatchWriter(Connector connector, String tableName, BatchWriterConfig batchConfig, SignatureConfig si... |
### Question:
EncryptedBatchScanner implements BatchScanner { @Override public void fetchColumnFamily(Text col) { checkArgument(col != null, "col is null"); ColumnFilterResult search = encryptor.getColumnFamilyFilter(col); for (Column filter : search.serverSideFilters) { scanner.fetchColumnFamily(new Text(filter.getCol... |
### Question:
EncryptedBatchScanner implements BatchScanner { @Override public void clearScanIterators() { scanner.clearScanIterators(); } EncryptedBatchScanner(Connector connector, String tableName, Authorizations authorizations, int numQueryThreads, EncryptionConfig cryptoConfig,
EncryptionKeyContainer keys); @... |
### Question:
EncryptedBatchScanner implements BatchScanner { @Override public void close() { scanner.close(); } EncryptedBatchScanner(Connector connector, String tableName, Authorizations authorizations, int numQueryThreads, EncryptionConfig cryptoConfig,
EncryptionKeyContainer keys); @Override void setRanges(Co... |
### Question:
EncryptedBatchScanner implements BatchScanner { @Override public Authorizations getAuthorizations() { return scanner.getAuthorizations(); } EncryptedBatchScanner(Connector connector, String tableName, Authorizations authorizations, int numQueryThreads, EncryptionConfig cryptoConfig,
EncryptionKeyCon... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.