method2testcases stringlengths 118 3.08k |
|---|
### Question:
StaticDatabaseMappingService implements MappingEventListener { @Override public void onUnregister(AbstractMetaStore metaStore) { synchronized (mappingsByMetaStoreName) { remove(metaStore); } } StaticDatabaseMappingService(
MetaStoreMappingFactory metaStoreMappingFactory,
List<AbstractMetaStore... |
### Question:
StaticDatabaseMappingService implements MappingEventListener { @Override public DatabaseMapping primaryDatabaseMapping() { if (primaryDatabaseMapping == null) { throw new NoPrimaryMetastoreException("Waggle Dance error no primary database mapping available"); } return primaryDatabaseMapping; } StaticDatab... |
### Question:
StaticDatabaseMappingService implements MappingEventListener { @Override public void close() throws IOException { if (mappingsByMetaStoreName != null) { for (MetaStoreMapping metaStoreMapping : mappingsByMetaStoreName.values()) { metaStoreMapping.close(); } } } StaticDatabaseMappingService(
MetaStor... |
### Question:
LowerCasePrefixNamingStrategy implements PrefixNamingStrategy { @Override public String apply(AbstractMetaStore federatedMetaStore) { return federatedMetaStore.getDatabasePrefix().toLowerCase(Locale.ROOT); } @Override String apply(AbstractMetaStore federatedMetaStore); }### Answer:
@Test public void app... |
### Question:
PrefixBasedDatabaseMappingService implements MappingEventListener { @Override public void onRegister(AbstractMetaStore metaStore) { synchronized (mappingsByPrefix) { if (mappingsByPrefix.containsKey(metaStore.getDatabasePrefix())) { throw new WaggleDanceException("MetaStore with prefix '" + metaStore.getD... |
### Question:
PrefixBasedDatabaseMappingService implements MappingEventListener { @Override public void onUpdate(AbstractMetaStore oldMetaStore, AbstractMetaStore newMetaStore) { synchronized (mappingsByPrefix) { remove(oldMetaStore); add(newMetaStore); } } PrefixBasedDatabaseMappingService(
MetaStoreMappingFacto... |
### Question:
PrefixBasedDatabaseMappingService implements MappingEventListener { @Override public List<DatabaseMapping> getDatabaseMappings() { Builder<DatabaseMapping> builder = ImmutableList.builder(); synchronized (mappingsByPrefix) { for (DatabaseMapping databaseMapping : mappingsByPrefix.values()) { if (includeIn... |
### Question:
PrefixBasedDatabaseMappingService implements MappingEventListener { @Override public void onUnregister(AbstractMetaStore metaStore) { synchronized (mappingsByPrefix) { remove(metaStore); } } PrefixBasedDatabaseMappingService(
MetaStoreMappingFactory metaStoreMappingFactory,
List<AbstractMetaSt... |
### Question:
PrefixBasedDatabaseMappingService implements MappingEventListener { @Override public DatabaseMapping primaryDatabaseMapping() { if (primaryDatabaseMapping == null) { throw new NoPrimaryMetastoreException("Waggle Dance error no primary database mapping available"); } return primaryDatabaseMapping; } Prefix... |
### Question:
PrefixBasedDatabaseMappingService implements MappingEventListener { @Override public void close() throws IOException { if (mappingsByPrefix != null) { for (MetaStoreMapping metaStoreMapping : mappingsByPrefix.values()) { metaStoreMapping.close(); } } } PrefixBasedDatabaseMappingService(
MetaStoreMap... |
### Question:
AdvancedPropertyUtils extends PropertyUtils { @Override public Property getProperty(Class<?> type, String name) { if (name.indexOf('-') > -1) { name = CaseFormat.LOWER_HYPHEN.to(CaseFormat.LOWER_CAMEL, name); } return super.getProperty(type, name); } @Override Property getProperty(Class<?> type, String n... |
### Question:
NotifyingFederationService implements FederationService { @PreDestroy public void preDestroy() { List<? extends AbstractMetaStore> federatedMetaStores = getAll(); for (AbstractMetaStore federatedMetaStore : federatedMetaStores) { onUnregister(federatedMetaStore); } } @Autowired NotifyingFederationService... |
### Question:
NotifyingFederationService implements FederationService { @Override public void register(@NotNull @Valid AbstractMetaStore metaStore) { checkNotNull(metaStore, "federatedMetaStore cannot be null"); boolean metastoreDoesNotExist = federatedMetaStoreStorage.get(metaStore.getName()) == null; checkIsTrue(meta... |
### Question:
NotifyingFederationService implements FederationService { @Override public void update(AbstractMetaStore oldMetaStore, AbstractMetaStore newMetaStore) { checkNotNull(oldMetaStore, "old federatedMetaStore cannot be null"); checkNotNull(newMetaStore, "new federatedMetaStore cannot be null"); boolean metasto... |
### Question:
NotifyingFederationService implements FederationService { @Override public void unregister(@NotNull String name) { checkNotNull(name, "name cannot be null"); checkNotNull(federatedMetaStoreStorage.get(name), "MeataStore with name '" + name + "' is not registered"); LOG.debug("Unregistering federation with... |
### Question:
NotifyingFederationService implements FederationService { @Override public AbstractMetaStore get(@NotNull String name) { AbstractMetaStore federatedMetaStore = federatedMetaStoreStorage.get(name); return checkNotNull(federatedMetaStore, "No federation with name '" + name + "' found"); } @Autowired Notify... |
### Question:
NotifyingFederationService implements FederationService { @Override public List<AbstractMetaStore> getAll() { return federatedMetaStoreStorage.getAll(); } @Autowired NotifyingFederationService(FederatedMetaStoreStorage federatedMetaStoreStorage); @PostConstruct void postConstruct(); @PreDestroy void preD... |
### Question:
NotifyingFederationService implements FederationService { public void unsubscribe(FederationEventListener listener) { listeners.remove(listener); } @Autowired NotifyingFederationService(FederatedMetaStoreStorage federatedMetaStoreStorage); @PostConstruct void postConstruct(); @PreDestroy void preDestroy(... |
### Question:
SimpleFederationStatusService implements FederationStatusService { @Override public MetaStoreStatus checkStatus(AbstractMetaStore abstractMetaStore) { try (MetaStoreMapping mapping = metaStoreMappingFactory.newInstance(abstractMetaStore)) { if (!mapping.isAvailable()) { return MetaStoreStatus.UNAVAILABLE;... |
### Question:
YamlFederatedMetaStoreStorage implements FederatedMetaStoreStorage { @Override public void update(AbstractMetaStore oldMetaStore, AbstractMetaStore newMetaStore) { validate(newMetaStore); synchronized (federationsMapLock) { LOG.debug("Updating federation {} to {}", oldMetaStore, newMetaStore); if (newMeta... |
### Question:
YamlFederatedMetaStoreStorage implements FederatedMetaStoreStorage { @Override public AbstractMetaStore delete(String name) { AbstractMetaStore federatedMetaStore; synchronized (federationsMapLock) { federatedMetaStore = federationsMap.remove(name); if (federatedMetaStore != null && federatedMetaStore.get... |
### Question:
MonitoredDatabaseMappingService implements MappingEventListener { @Override public DatabaseMapping primaryDatabaseMapping() { DatabaseMapping primaryDatabaseMapping = wrapped.primaryDatabaseMapping(); CurrentMonitoredMetaStoreHolder.monitorMetastore(primaryDatabaseMapping.getMetastoreMappingName()); retur... |
### Question:
MonitoredDatabaseMappingService implements MappingEventListener { @Override public DatabaseMapping databaseMapping(@NotNull String databaseName) throws NoSuchObjectException { DatabaseMapping databaseMapping = wrapped.databaseMapping(databaseName); CurrentMonitoredMetaStoreHolder.monitorMetastore(database... |
### Question:
AdvancedPropertyUtils extends PropertyUtils { @Override protected Set<Property> createPropertySet(Class<?> type, BeanAccess beanAccess) { Set<Property> properties = new TreeSet<>(); Collection<Property> props = getPropertiesMap(type, beanAccess).values(); for (Property property : props) { if (include(prop... |
### Question:
MonitoredDatabaseMappingService implements MappingEventListener { @Override public PanopticOperationHandler getPanopticOperationHandler() { PanopticOperationHandler handler = wrapped.getPanopticOperationHandler(); CurrentMonitoredMetaStoreHolder.monitorMetastore(); return handler; } MonitoredDatabaseMappi... |
### Question:
MonitoredDatabaseMappingService implements MappingEventListener { @Override public void onRegister(AbstractMetaStore federatedMetaStore) { wrapped.onRegister(federatedMetaStore); } MonitoredDatabaseMappingService(MappingEventListener wrapped); @Override DatabaseMapping primaryDatabaseMapping(); @Override ... |
### Question:
MonitoredDatabaseMappingService implements MappingEventListener { @Override public void onUnregister(AbstractMetaStore federatedMetaStore) { wrapped.onUnregister(federatedMetaStore); } MonitoredDatabaseMappingService(MappingEventListener wrapped); @Override DatabaseMapping primaryDatabaseMapping(); @Overr... |
### Question:
MonitoredDatabaseMappingService implements MappingEventListener { @Override public void onUpdate(AbstractMetaStore oldMetaStore, AbstractMetaStore newMetaStore) { wrapped.onUpdate(oldMetaStore, newMetaStore); } MonitoredDatabaseMappingService(MappingEventListener wrapped); @Override DatabaseMapping primar... |
### Question:
MonitoredDatabaseMappingService implements MappingEventListener { @Override public void close() throws IOException { wrapped.close(); } MonitoredDatabaseMappingService(MappingEventListener wrapped); @Override DatabaseMapping primaryDatabaseMapping(); @Override DatabaseMapping databaseMapping(@NotNull Stri... |
### Question:
MonitoredDatabaseMappingService implements MappingEventListener { @Override public List<DatabaseMapping> getDatabaseMappings() { return wrapped.getDatabaseMappings(); } MonitoredDatabaseMappingService(MappingEventListener wrapped); @Override DatabaseMapping primaryDatabaseMapping(); @Override DatabaseMapp... |
### Question:
GetAllFunctionsRequest implements RequestCallable<List<GetAllFunctionsResponse>> { @Override public DatabaseMapping getMapping() { return mapping; } GetAllFunctionsRequest(DatabaseMapping mapping); @Override List<GetAllFunctionsResponse> call(); @Override DatabaseMapping getMapping(); }### Answer:
@Test ... |
### Question:
TTransportMonitor { public void monitor(@WillClose TTransport transport, @WillClose Closeable action) { transports.offer(new ActionContainer(transport, action)); } @Autowired TTransportMonitor(WaggleDanceConfiguration waggleDanceConfiguration); @VisibleForTesting TTransportMonitor(WaggleDanceConfigurati... |
### Question:
ReadWriteCreateAccessControlHandler implements AccessControlHandler { @Override public boolean hasWritePermission(String databaseName) { return true; } ReadWriteCreateAccessControlHandler(AbstractMetaStore metaStore,
FederationService federationService); @Override boolean hasWritePermission(String d... |
### Question:
ReadWriteCreateAccessControlHandler implements AccessControlHandler { @Override public boolean hasCreatePermission() { return true; } ReadWriteCreateAccessControlHandler(AbstractMetaStore metaStore,
FederationService federationService); @Override boolean hasWritePermission(String databaseName); @Ove... |
### Question:
ReadOnlyAccessControlHandler implements AccessControlHandler { @Override public boolean hasWritePermission(String databaseName) { return false; } @Override boolean hasWritePermission(String databaseName); @Override boolean hasCreatePermission(); @Override void databaseCreatedNotification(String name); }... |
### Question:
ReadOnlyAccessControlHandler implements AccessControlHandler { @Override public boolean hasCreatePermission() { return false; } @Override boolean hasWritePermission(String databaseName); @Override boolean hasCreatePermission(); @Override void databaseCreatedNotification(String name); }### Answer:
@Test ... |
### Question:
ReadOnlyAccessControlHandler implements AccessControlHandler { @Override public void databaseCreatedNotification(String name) { } @Override boolean hasWritePermission(String databaseName); @Override boolean hasCreatePermission(); @Override void databaseCreatedNotification(String name); }### Answer:
@Tes... |
### Question:
DatabaseWhitelistAccessControlHandler implements AccessControlHandler { @Override public boolean hasWritePermission(String databaseName) { return writableDatabaseWhiteList.contains(databaseName); } DatabaseWhitelistAccessControlHandler(
AbstractMetaStore metaStore,
FederationService federation... |
### Question:
DatabaseWhitelistAccessControlHandler implements AccessControlHandler { @Override public boolean hasCreatePermission() { return hasCreatePermission; } DatabaseWhitelistAccessControlHandler(
AbstractMetaStore metaStore,
FederationService federationService,
boolean hasCreatePermission); @O... |
### Question:
Whitelist { public void add(String databaseName) { whiteList.add(Pattern.compile(trimToLowerCase(databaseName))); } Whitelist(); Whitelist(List<String> writableDatabaseWhiteList); void add(String databaseName); boolean contains(String databaseName); }### Answer:
@Test public void add() { Whitelist white... |
### Question:
Whitelist { public boolean contains(String databaseName) { if (databaseName == null) { return true; } databaseName = trimToLowerCase(databaseName); for (Pattern whiteListEntry : whiteList) { Matcher matcher = whiteListEntry.matcher(databaseName); if (matcher.matches()) { return true; } } return false; } W... |
### Question:
CommonBeans { @Bean public HiveConf hiveConf(WaggleDanceConfiguration waggleDanceConfiguration) { Map<String, String> confProps = waggleDanceConfiguration.getConfigurationProperties(); final HiveConf hiveConf = new HiveConf(new Configuration(false), getClass()); if (confProps != null) { for (Map.Entry<Str... |
### Question:
YamlStorageConfiguration { public boolean isOverwriteConfigOnShutdown() { return overwriteConfigOnShutdown; } void setOverwriteConfigOnShutdown(boolean overwriteConfigOnShutdown); boolean isOverwriteConfigOnShutdown(); }### Answer:
@Test public void defaultOverwriteConfigOnShutdown() { assertThat(config... |
### Question:
YamlStorageConfiguration { public void setOverwriteConfigOnShutdown(boolean overwriteConfigOnShutdown) { this.overwriteConfigOnShutdown = overwriteConfigOnShutdown; } void setOverwriteConfigOnShutdown(boolean overwriteConfigOnShutdown); boolean isOverwriteConfigOnShutdown(); }### Answer:
@Test public vo... |
### Question:
GraphiteConfiguration { public void setPort(int port) { this.port = port; } @PostConstruct void init(); boolean isEnabled(); int getPort(); void setPort(int port); String getHost(); void setHost(String host); String getPrefix(); void setPrefix(String prefix); long getPollInterval(); void setPollInterval(... |
### Question:
TSetIpAddressProcessorFactory extends TProcessorFactory { @Override public TProcessor getProcessor(TTransport transport) { try { if (transport instanceof TSocket) { Socket socket = ((TSocket) transport).getSocket(); log.debug("Received a connection from ip: {}", socket.getInetAddress().getHostAddress()); ... |
### Question:
FederatedHMSHandlerFactory { public CloseableIHMSHandler create() { MappingEventListener service = createDatabaseMappingService(); MonitoredDatabaseMappingService monitoredService = new MonitoredDatabaseMappingService(service); CloseableIHMSHandler baseHandler = new FederatedHMSHandler(monitoredService, n... |
### Question:
GraphiteConfiguration { public void setPollInterval(long pollInterval) { this.pollInterval = pollInterval; } @PostConstruct void init(); boolean isEnabled(); int getPort(); void setPort(int port); String getHost(); void setHost(String host); String getPrefix(); void setPrefix(String prefix); long getPoll... |
### Question:
GraphiteConfiguration { public void setPollIntervalTimeUnit(TimeUnit pollIntervalTimeUnit) { this.pollIntervalTimeUnit = pollIntervalTimeUnit; } @PostConstruct void init(); boolean isEnabled(); int getPort(); void setPort(int port); String getHost(); void setHost(String host); String getPrefix(); void se... |
### Question:
WaggleDanceConfiguration { public void setPort(Integer port) { this.port = port; } Integer getPort(); void setPort(Integer port); boolean isVerbose(); void setVerbose(boolean verbose); int getDisconnectConnectionDelay(); void setDisconnectConnectionDelay(int disconnectConnectionDelay); TimeUnit getDiscon... |
### Question:
WaggleDanceConfiguration { public void setDisconnectConnectionDelay(int disconnectConnectionDelay) { this.disconnectConnectionDelay = disconnectConnectionDelay; } Integer getPort(); void setPort(Integer port); boolean isVerbose(); void setVerbose(boolean verbose); int getDisconnectConnectionDelay(); void... |
### Question:
WaggleDanceConfiguration { public void setDisconnectTimeUnit(TimeUnit disconnectTimeUnit) { this.disconnectTimeUnit = disconnectTimeUnit; } Integer getPort(); void setPort(Integer port); boolean isVerbose(); void setVerbose(boolean verbose); int getDisconnectConnectionDelay(); void setDisconnectConnectio... |
### Question:
WaggleDanceConfiguration { public void setConfigurationProperties(Map<String, String> configurationProperties) { this.configurationProperties = configurationProperties; } Integer getPort(); void setPort(Integer port); boolean isVerbose(); void setVerbose(boolean verbose); int getDisconnectConnectionDelay... |
### Question:
WaggleDanceConfiguration { public void setDatabaseResolution(DatabaseResolution databaseResolution) { this.databaseResolution = databaseResolution; } Integer getPort(); void setPort(Integer port); boolean isVerbose(); void setVerbose(boolean verbose); int getDisconnectConnectionDelay(); void setDisconnec... |
### Question:
WaggleDanceConfiguration { public int getStatusPollingDelay() { return statusPollingDelay; } Integer getPort(); void setPort(Integer port); boolean isVerbose(); void setVerbose(boolean verbose); int getDisconnectConnectionDelay(); void setDisconnectConnectionDelay(int disconnectConnectionDelay); TimeUnit... |
### Question:
WaggleDanceConfiguration { public TimeUnit getStatusPollingDelayTimeUnit() { return statusPollingDelayTimeUnit; } Integer getPort(); void setPort(Integer port); boolean isVerbose(); void setVerbose(boolean verbose); int getDisconnectConnectionDelay(); void setDisconnectConnectionDelay(int disconnectConne... |
### Question:
TunnelableFactorySupplier { public TunnelableFactory<CloseableThriftHiveMetastoreIface> get(MetastoreTunnel metastoreTunnel) { return new TunnelableFactory<>(buildSshSettings(metastoreTunnel)); } TunnelableFactory<CloseableThriftHiveMetastoreIface> get(MetastoreTunnel metastoreTunnel); }### Answer:
@Tes... |
### Question:
TunnelableFactorySupplier { @VisibleForTesting SshSettings buildSshSettings(MetastoreTunnel metastoreTunnel) { return SshSettings .builder() .withSshPort(metastoreTunnel.getPort()) .withSessionTimeout(metastoreTunnel.getTimeout()) .withRoute(metastoreTunnel.getRoute()) .withKnownHosts(metastoreTunnel.getK... |
### Question:
HiveMetaStoreClientSupplier implements TunnelableSupplier<CloseableThriftHiveMetastoreIface> { @Override public CloseableThriftHiveMetastoreIface get() { return factory.newInstance(hiveConf, name, reconnectionRetries, connectionTimeout); } HiveMetaStoreClientSupplier(MetaStoreClientFactory factory, HiveCo... |
### Question:
LocalHiveConfFactory { HiveConf newInstance(String localHost, int localPort, HiveConf hiveConf) { HiveConf localHiveConf = new HiveConf(hiveConf); String proxyMetaStoreUris = "thrift: localHiveConf.setVar(HiveConf.ConfVars.METASTOREURIS, proxyMetaStoreUris); return localHiveConf; } }### Answer:
@Test p... |
### Question:
MetaStoreMappingDecorator implements MetaStoreMapping { @Override public MetaStoreMapping checkWritePermissions(String databaseName) { return metaStoreMapping.checkWritePermissions(databaseName); } MetaStoreMappingDecorator(MetaStoreMapping metaStoreMapping); @Override String transformOutboundDatabaseName... |
### Question:
MetaStoreMappingDecorator implements MetaStoreMapping { @Override public void close() throws IOException { metaStoreMapping.close(); } MetaStoreMappingDecorator(MetaStoreMapping metaStoreMapping); @Override String transformOutboundDatabaseName(String databaseName); @Override List<String> transformOutbound... |
### Question:
MetaStoreMappingDecorator implements MetaStoreMapping { @Override public void createDatabase(Database database) throws AlreadyExistsException, InvalidObjectException, MetaException, TException { metaStoreMapping.createDatabase(database); } MetaStoreMappingDecorator(MetaStoreMapping metaStoreMapping); @Ove... |
### Question:
MetaStoreMappingDecorator implements MetaStoreMapping { @Override public Iface getClient() { return metaStoreMapping.getClient(); } MetaStoreMappingDecorator(MetaStoreMapping metaStoreMapping); @Override String transformOutboundDatabaseName(String databaseName); @Override List<String> transformOutboundDat... |
### Question:
MetaStoreMappingDecorator implements MetaStoreMapping { @Override public String getDatabasePrefix() { return metaStoreMapping.getDatabasePrefix(); } MetaStoreMappingDecorator(MetaStoreMapping metaStoreMapping); @Override String transformOutboundDatabaseName(String databaseName); @Override List<String> tra... |
### Question:
MetaStoreMappingDecorator implements MetaStoreMapping { @Override public long getLatency() { return metaStoreMapping.getLatency(); } MetaStoreMappingDecorator(MetaStoreMapping metaStoreMapping); @Override String transformOutboundDatabaseName(String databaseName); @Override List<String> transformOutboundDa... |
### Question:
SimpleXPathBasedCheck extends SonarXmlCheck { public XPathExpression getXPathExpression(String expression) { try { return xpath.compile(expression); } catch (XPathExpressionException e) { throw new IllegalStateException(String.format("[%s] Fail to compile XPath expression '%s'.", ruleKey(), expression), e... |
### Question:
RuleMetadataLoader { public void addRulesByRuleKey(NewRepository repository, List<String> ruleKeys) { for (String ruleKey : ruleKeys) { addRuleByRuleKey(repository, ruleKey); } } RuleMetadataLoader(String resourceFolder); RuleMetadataLoader(String resourceFolder, String defaultProfilePath); private Rule... |
### Question:
SafetyFactory { @Deprecated public static XMLInputFactory createXMLInputFactory() { return SafeStaxParserFactory.createXMLInputFactory(); } private SafetyFactory(); @Deprecated static XMLInputFactory createXMLInputFactory(); @Deprecated static DocumentBuilder createDocumentBuilder(boolean namespaceAware)... |
### Question:
RuleMetadataLoader { static String[] getStringArray(Map<String, Object> map, String propertyName) { Object propertyValue = map.get(propertyName); if (!(propertyValue instanceof List)) { throw new IllegalStateException(String.format(INVALID_PROPERTY_MESSAGE, propertyName)); } return ((List<String>) propert... |
### Question:
SafetyFactory { @Deprecated public static DocumentBuilder createDocumentBuilder(boolean namespaceAware) { return SafeDomParserFactory.createDocumentBuilder(namespaceAware); } private SafetyFactory(); @Deprecated static XMLInputFactory createXMLInputFactory(); @Deprecated static DocumentBuilder createDocu... |
### Question:
Resources { static String toString(String path, Charset charset) throws IOException { try (InputStream input = Resources.class.getClassLoader().getResourceAsStream(path)) { if (input == null) { throw new IOException("Resource not found in the classpath: " + path); } ByteArrayOutputStream out = new ByteArr... |
### Question:
ExternalReportProvider { public static List<File> getReportFiles(SensorContext context, String externalReportsProperty) { boolean externalIssuesSupported = context.getSonarQubeVersion().isGreaterThanOrEqual(Version.create(7, 2)); String[] reportPaths = context.config().getStringArray(externalReportsProper... |
### Question:
ContainsDetector extends Detector { @Override public int scan(String line) { String lineWithoutWhitespaces = StringUtils.deleteWhitespace(line); int matchers = 0; for (String str : strs) { matchers += StringUtils.countMatches(lineWithoutWhitespaces, str); } return matchers; } ContainsDetector(double proba... |
### Question:
EndWithDetector extends Detector { @Override public int scan(String line) { for (int index = line.length() - 1; index >= 0; index--) { char character = line.charAt(index); for (char endOfLine : endOfLines) { if (character == endOfLine) { return 1; } } if (!Character.isWhitespace(character) && character !=... |
### Question:
CamelCaseDetector extends Detector { @Override public int scan(String line) { char previousChar = ' '; char indexChar; for (int i = 0; i < line.length(); i++) { indexChar = line.charAt(i); if (isLowerCaseThenUpperCase(previousChar, indexChar)) { return 1; } previousChar = indexChar; } return 0; } CamelCas... |
### Question:
XmlFile { @CheckForNull public static Node nodeAttribute(Node node, String attribute) { NamedNodeMap attributes = node.getAttributes(); if (attributes == null) { return null; } return attributes.getNamedItem(attribute); } private XmlFile(InputFile inputFile); private XmlFile(String str); static XmlFile ... |
### Question:
KeywordsDetector extends Detector { @Override public int scan(String line) { int matchers = 0; if (toUpperCase) { line = line.toUpperCase(Locale.getDefault()); } StringTokenizer tokenizer = new StringTokenizer(line, " \t(),{}"); while (tokenizer.hasMoreTokens()) { String word = tokenizer.nextToken(); if (... |
### Question:
CodeRecognizer { public final boolean isLineOfCode(String line) { return recognition(line) - threshold > 0; } CodeRecognizer(double threshold, LanguageFootprint language); final double recognition(String line); final List<String> extractCodeLines(List<String> lines); final boolean isLineOfCode(String line... |
### Question:
CodeRecognizer { public final List<String> extractCodeLines(List<String> lines) { List<String> codeLines = new ArrayList<>(); for (String line : lines) { if (recognition(line) >= threshold) { codeLines.add(line); } } return codeLines; } CodeRecognizer(double threshold, LanguageFootprint language); final d... |
### Question:
ProgressReport implements Runnable { public synchronized void cancel() { thread.interrupt(); join(); } ProgressReport(String threadName, long period, Logger logger, String adjective); ProgressReport(String threadName, long period, String adjective); ProgressReport(String threadName, long period); @Overr... |
### Question:
JsonParser { Map<String, Object> parse(String data) { try { return (Map<String, Object>) parser.parse(data); } catch (ParseException e) { throw new IllegalArgumentException("Could not parse JSON", e); } } }### Answer:
@Test public void parse() throws Exception { JsonParser parser = new JsonParser(); Ma... |
### Question:
ReflectionResource { @DELETE @Path("/{id}") public Response deleteReflection(@PathParam("id") String id) { reflectionServiceHelper.removeReflection(id); return Response.ok().build(); } @Inject ReflectionResource(ReflectionServiceHelper reflectionServiceHelper, CatalogServiceHelper catalogServiceHelper); ... |
### Question:
SourceResource { @GET @RolesAllowed({"admin", "user"}) public ResponseList<Source> getSources() { final ResponseList<Source> sources = new ResponseList<>(); final List<SourceConfig> sourceConfigs = sourceService.getSources(); for (SourceConfig sourceConfig : sourceConfigs) { Source source = fromSourceConf... |
### Question:
SourceResource { @POST @RolesAllowed({"admin"}) public SourceDeprecated addSource(SourceDeprecated source) { try { SourceConfig newSourceConfig = sourceService.createSource(source.toSourceConfig()); return fromSourceConfig(newSourceConfig); } catch (NamespaceException | ExecutionSetupException e) { throw ... |
### Question:
SourceResource { @GET @RolesAllowed({"admin", "user"}) @Path("/{id}") public SourceDeprecated getSource(@PathParam("id") String id) throws NamespaceException { SourceConfig sourceConfig = sourceService.getById(id); return fromSourceConfig(sourceConfig); } @Inject SourceResource(SourceService sourceServic... |
### Question:
SourceResource { @VisibleForTesting protected SourceDeprecated fromSourceConfig(SourceConfig sourceConfig) { return new SourceDeprecated(sourceService.fromSourceConfig(sourceConfig)); } @Inject SourceResource(SourceService sourceService, SabotContext sabotContext); @GET @RolesAllowed({"admin", "user"}) R... |
### Question:
UserResource { @RolesAllowed({"admin"}) @POST public User createUser(User user) throws IOException { final com.dremio.service.users.User userConfig = UserResource.addUser(of(user, Optional.empty()), user.getPassword(), userGroupService, namespaceService); return User.fromUser(userConfig); } @Inject UserR... |
### Question:
UserResource { @GET @Path("/by-name/{name}") public User getUserByName(@PathParam("name") String name) throws UserNotFoundException { return User.fromUser(userGroupService.getUser(name)); } @Inject UserResource(UserService userGroupService,
NamespaceService namespaceService,
@Context SecurityCont... |
### Question:
UserStats { public String getEdition() { return edition; } String getEdition(); List<Map<String, Object>> getUserStatsByDate(); List<Map<String, Object>> getUserStatsByWeek(); List<Map<String, Object>> getUserStatsByMonth(); }### Answer:
@Test public void testGetEdition() { UserStats.Builder stats = new... |
### Question:
UserStats { public List<Map<String, Object>> getUserStatsByMonth() { return userStatsByMonth; } String getEdition(); List<Map<String, Object>> getUserStatsByDate(); List<Map<String, Object>> getUserStatsByWeek(); List<Map<String, Object>> getUserStatsByMonth(); }### Answer:
@Test public void testGetStat... |
### Question:
MediaTypeFilter implements ContainerRequestFilter { @Override public void filter(ContainerRequestContext requestContext) throws IOException { final UriInfo info = requestContext.getUriInfo(); MultivaluedMap<String, String> parameters = info.getQueryParameters(); String format = parameters.getFirst("format... |
### Question:
ClasspathHealthMonitor implements LiveHealthMonitor { @Override public boolean isHealthy() { logger.debug("Checking jars {}", necessaryJarFoldersSet.size()); for(String jarFolderPath : necessaryJarFoldersSet) { File jarFolder = new File(jarFolderPath); boolean folderAccessible = false; try { folderAccessi... |
### Question:
JSONJobDataFilter implements ContainerResponseFilter { @Override public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) throws IOException { if (!APPLICATION_JSON_TYPE.equals(responseContext.getMediaType()) || !WebServer.X_DREMIO_JOB_DATA_NUMBERS_AS_STRINGS_SU... |
### Question:
JSONPrettyPrintFilter implements ContainerResponseFilter { @Override public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) throws IOException { UriInfo info = requestContext.getUriInfo(); if (!info.getQueryParameters().containsKey("pretty")) { return; } Objec... |
### Question:
AttemptsHelper { public Long getPlanningTime() { return getDuration(State.PLANNING); } AttemptsHelper(JobAttempt jobAttempt); boolean hasStateDurations(); static long getCommandPoolWaitTime(JobAttempt jobAttempt); static long getLegacyEnqueuedTime(JobAttempt jobAttempt); static long getPoolWaitTime(JobAtt... |
### Question:
AttemptsHelper { public static long getLegacyExecutionTime(JobAttempt jobAttempt) { final JobInfo jobInfo = jobAttempt.getInfo(); if (jobInfo == null) { return 0; } final JobDetails jobDetails = jobAttempt.getDetails(); if (jobDetails == null) { return 0; } final long startTime = Optional.ofNullable(jobIn... |
### Question:
AttemptsHelper { public Long getPendingTime() { return getDuration(State.PENDING); } AttemptsHelper(JobAttempt jobAttempt); boolean hasStateDurations(); static long getCommandPoolWaitTime(JobAttempt jobAttempt); static long getLegacyEnqueuedTime(JobAttempt jobAttempt); static long getPoolWaitTime(JobAttem... |
### Question:
AttemptsHelper { public Long getMetadataRetrievalTime() { return getDuration(State.METADATA_RETRIEVAL); } AttemptsHelper(JobAttempt jobAttempt); boolean hasStateDurations(); static long getCommandPoolWaitTime(JobAttempt jobAttempt); static long getLegacyEnqueuedTime(JobAttempt jobAttempt); static long get... |
### Question:
AttemptsHelper { public Long getEngineStartTime() { return getDuration(State.ENGINE_START); } AttemptsHelper(JobAttempt jobAttempt); boolean hasStateDurations(); static long getCommandPoolWaitTime(JobAttempt jobAttempt); static long getLegacyEnqueuedTime(JobAttempt jobAttempt); static long getPoolWaitTime... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.