method2testcases stringlengths 118 6.63k |
|---|
### Question:
SyncUpdate implements Origin { @Override public String getName() { return "sync update"; } SyncUpdate(final DateTimeProvider dateTimeProvider, final String remoteAddress); @Override boolean isDefaultOverride(); @Override boolean allowAdminOperations(); @Override String getId(); @Override String getFrom();... |
### Question:
SyncUpdate implements Origin { @Override public String getResponseHeader() { return getHeader(); } SyncUpdate(final DateTimeProvider dateTimeProvider, final String remoteAddress); @Override boolean isDefaultOverride(); @Override boolean allowAdminOperations(); @Override String getId(); @Override String ge... |
### Question:
SyncUpdate implements Origin { @Override public String getNotificationHeader() { return getHeader(); } SyncUpdate(final DateTimeProvider dateTimeProvider, final String remoteAddress); @Override boolean isDefaultOverride(); @Override boolean allowAdminOperations(); @Override String getId(); @Override Strin... |
### Question:
DelegatedStatsService implements EmbeddedValueResolverAware { public URI getUriForRedirect(final String requestPath, final Query query) { final Optional<ObjectType> objectType = query.getObjectTypes().stream() .filter(ALLOWED_OBJECTTYPES::contains) .findFirst(); if (objectType.isPresent()) { for (Map.Entr... |
### Question:
DummifierCurrent implements Dummifier { @Override public boolean isAllowed(final int version, final RpslObject object) { return version >= 3; } @Override RpslObject dummify(final int version, final RpslObject rpslObject); @Override boolean isAllowed(final int version, final RpslObject object); }### Answ... |
### Question:
RdapObjectMapper { public Object mapSearch(final String requestUrl, final List<RpslObject> objects, final Iterable<LocalDateTime> localDateTimes, final int maxResultSize) { final SearchResult searchResult = new SearchResult(); final Iterator<LocalDateTime> iterator = localDateTimes.iterator(); for (final ... |
### Question:
RdapObjectMapper { public RdapObject mapHelp(final String requestUrl) { return mapCommons(new RdapObject(), requestUrl); } @Autowired RdapObjectMapper(
final NoticeFactory noticeFactory,
@Qualifier("jdbcRpslObjectSlaveDao") final RpslObjectDao rpslObjectDao,
final Ipv4... |
### Question:
RdapRequestValidator { public void validateEntity(final String key) { if (key.toUpperCase().startsWith("ORG-")) { if (!AttributeType.ORGANISATION.isValidValue(ORGANISATION, key)) { throw new NotFoundException("Invalid syntax."); } } else { if (!AttributeType.MNTNER.isValidValue(MNTNER, key)) { throw new N... |
### Question:
RdapRequestValidator { public void validateAutnum(final String key) { try { AutNum.parse(key); } catch (AttributeParseException e) { throw new BadRequestException("Invalid syntax."); } } @Autowired RdapRequestValidator(final ReservedAutnum reservedAutnum); void validateDomain(final String key); void vali... |
### Question:
RdapRequestValidator { public void validateIp(final String rawUri, final String key) { try { IpInterval.parse(key); } catch (IllegalArgumentException e) { throw new BadRequestException("Invalid syntax."); } if (rawUri.contains(" throw new BadRequestException("Invalid syntax."); } } @Autowired RdapRequest... |
### Question:
ExtensionOverridesAcceptHeaderFilter implements Filter { @Override public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain) throws IOException, ServletException { if (request instanceof HttpServletRequest) { chain.doFilter(OverrideAcceptHeaderWrapper.wrap... |
### Question:
RemoteAddressFilter implements Filter { @Override public void init(final FilterConfig filterConfig) throws ServletException { } @Override void init(final FilterConfig filterConfig); @Override void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain); @Override v... |
### Question:
RemoteAddressFilter implements Filter { @Override public void destroy() { } @Override void init(final FilterConfig filterConfig); @Override void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain); @Override void destroy(); }### Answer:
@Test public void destr... |
### Question:
RemoteAddressFilter implements Filter { @Override public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain) throws IOException, ServletException { if (request instanceof HttpServletRequest) { chain.doFilter(new RemoteAddressRequestWrapper((HttpServletReque... |
### Question:
MailMessage implements Origin { public String getUpdateMessage() { StringBuilder builder = new StringBuilder(); Iterator<ContentWithCredentials> iterator = contentWithCredentials.iterator(); while (iterator.hasNext()) { builder.append(iterator.next().getContent()); if (iterator.hasNext()) { builder.append... |
### Question:
MessageFilter { public boolean shouldProcess(final MailMessage message) { String replyToEmail = message.getReplyToEmail(); if (replyToEmail == null) { loggerContext.log(new Message(Messages.Type.INFO, "Not processing message, missing reply address")); return false; } try { new InternetAddress(replyToEmail... |
### Question:
MessageDequeue implements ApplicationService { @Override public void stop(final boolean force) { LOGGER.info("Message dequeue stopping"); if (stopExecutor(pollerExecutor)) { pollerExecutor = null; } if (stopExecutor(handlerExecutor)) { handlerExecutor = null; } LOGGER.info("Message dequeue stopped"); } @A... |
### Question:
MessageDequeue implements ApplicationService { private void handleMessage(final String messageId) { final MimeMessage message = mailMessageDao.getMessage(messageId); try { loggerContext.init(getMessageIdLocalPart(message)); try { handleMessageInContext(messageId, message); } finally { loggerContext.remove... |
### Question:
MessageDequeue implements ApplicationService { String getMessageIdLocalPart(final Message message) throws MessagingException { final String[] headers = message.getHeader("Message-Id"); if (headers != null && headers.length > 0) { Matcher matcher = MESSAGE_ID_PATTERN.matcher(headers[0]); if (matcher.matche... |
### Question:
MessageParser { Charset getCharset(final ContentType contentType) { final String charset = contentType.getParameter("charset"); if (charset != null) { try { return Charset.forName(MimeUtility.javaCharset(charset)); } catch (UnsupportedCharsetException e) { loggerContext.log(new Message(Messages.Type.WARNI... |
### Question:
DnsCheckRequest { @Override public boolean equals(final Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; final DnsCheckRequest that = (DnsCheckRequest) o; return Objects.equals(domain, that.domain) && Objects.equals(glue, that.glue); } DnsCheckRequest(fina... |
### Question:
AutnumAuthentication extends AuthenticationStrategyBase { @Override public boolean supports(final PreparedUpdate update) { return update.getType().equals(ObjectType.AUT_NUM) && update.getAction().equals(Action.CREATE); } @Autowired AutnumAuthentication(final RpslObjectDao objectDao, final AuthenticationM... |
### Question:
MntIrtAuthentication extends AuthenticationStrategyBase { @Override public boolean supports(final PreparedUpdate update) { return !update.getNewValues(AttributeType.MNT_IRT).isEmpty(); } @Autowired MntIrtAuthentication(final AuthenticationModule credentialValidators, final RpslObjectDao rpslObjectDao); @... |
### Question:
MntIrtAuthentication extends AuthenticationStrategyBase { @Override public List<RpslObject> authenticate(final PreparedUpdate update, final UpdateContext updateContext) { final Collection<CIString> keys = update.getNewValues(AttributeType.MNT_IRT); final List<RpslObject> candidates = rpslObjectDao.getByKe... |
### Question:
MntByAuthentication extends AuthenticationStrategyBase { @Override public boolean supports(final PreparedUpdate update) { return ObjectTemplate.getTemplate(update.getType()).hasAttribute(AttributeType.MNT_BY); } @Autowired MntByAuthentication(final Maintainers maintainers,
final A... |
### Question:
DomainAuthentication extends AuthenticationStrategyBase { @Override public boolean supports(final PreparedUpdate update) { return update.getAction().equals(Action.CREATE) && (update.getType().equals(ObjectType.DOMAIN)); } @Autowired DomainAuthentication(final Ipv4Tree ipv4Tree,
... |
### Question:
OrgRefAuthentication extends AuthenticationStrategyBase { @Override public boolean supports(final PreparedUpdate update) { return !update.getNewValues(AttributeType.ORG).isEmpty(); } @Autowired OrgRefAuthentication(final AuthenticationModule credentialValidators, final RpslObjectDao rpslObjectDao); @Over... |
### Question:
InetnumAuthentication extends AuthenticationStrategyBase { @Override public boolean supports(final PreparedUpdate update) { return update.getAction().equals(Action.CREATE) && (update.getType().equals(ObjectType.INETNUM) || update.getType().equals(ObjectType.INET6NUM)); } @Autowired InetnumAuthentication(... |
### Question:
X509CredentialValidator implements CredentialValidator<X509Credential, X509Credential> { @Override public boolean hasValidCredential(final PreparedUpdate update, final UpdateContext updateContext, final Collection<X509Credential> offeredCredentials, final X509Credential knownCredential) { for (final X509C... |
### Question:
SsoCredentialValidator implements CredentialValidator<SsoCredential, SsoCredential> { @Override public Class<SsoCredential> getSupportedCredentials() { return SsoCredential.class; } @Autowired SsoCredentialValidator(final LoggerContext loggerContext); @Override Class<SsoCredential> getSupportedCredential... |
### Question:
PasswordCredentialValidator implements CredentialValidator<PasswordCredential, PasswordCredential> { @Override public Class<PasswordCredential> getSupportedCredentials() { return PasswordCredential.class; } @Autowired PasswordCredentialValidator(LoggerContext loggerContext); @Override Class<PasswordCrede... |
### Question:
AutnumAttributeGenerator extends AttributeGenerator { @Override public RpslObject generateAttributes(final RpslObject originalObject, final RpslObject updatedObject, final Update update, final UpdateContext updateContext) { switch (updatedObject.getType()) { case AUT_NUM: return generateStatus(originalObj... |
### Question:
SsoTranslator { public RpslObject translateFromCacheAuthToUsername(final UpdateContext updateContext, final RpslObject rpslObject) { return translateAuthFromCache(updateContext, rpslObject); } @Autowired SsoTranslator(final CrowdClient crowdClient); void populateCacheAuthToUsername(final UpdateContext up... |
### Question:
RepoScanner { public RepoScanner() { githubUser = System.getProperty("githubUser"); githubToken = System.getProperty("githubToken"); if (githubUser == null || githubToken == null) { String msg = ("To scan GitHub for submissions please provide your username and a valid Personal Access Token.\n" + "Without ... |
### Question:
ModelInterchangeMojo extends AbstractMojo { public void execute() throws MojoExecutionException { getLog().info("Running BPMN-MIWG test suite..."); if (!outputDirectory.exists()) { outputDirectory.mkdirs(); } try { Collection<String> inputFolders = new LinkedList<String>(); if (!resources.isEmpty()) { for... |
### Question:
DebugWebViewClient extends WebViewClient implements LogControl { @Override @Deprecated @SuppressWarnings("deprecation") public void onTooManyRedirects(WebView view, Message cancelMsg, Message continueMsg) { logger.onTooManyRedirects(view, cancelMsg, continueMsg); client.onTooManyRedirects(view, cancelMsg,... |
### Question:
DebugWebViewClient extends WebViewClient implements LogControl { @Override public void onReceivedHttpAuthRequest(WebView view, HttpAuthHandler handler, String host, String realm) { logger.onReceivedHttpAuthRequest(view, handler, host, realm); client.onReceivedHttpAuthRequest(view, handler, host, realm); }... |
### Question:
DebugWebViewClient extends WebViewClient implements LogControl { @Override public void onPageStarted(WebView view, String url, Bitmap facIcon) { logger.onPageStarted(view, url, facIcon); client.onPageStarted(view, url, facIcon); } DebugWebViewClient(); DebugWebViewClient(@NonNull final WebViewClient clie... |
### Question:
DebugWebViewClient extends WebViewClient implements LogControl { @Override public void onPageFinished(WebView view, String url) { logger.onPageFinished(view, url); client.onPageFinished(view, url); } DebugWebViewClient(); DebugWebViewClient(@NonNull final WebViewClient client); @SuppressWarnings("WeakerA... |
### Question:
DebugWebViewClient extends WebViewClient implements LogControl { @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) @Override public void onReceivedClientCertRequest(WebView view, ClientCertRequest request) { logger.onReceivedClientCertRequest(view, request); client.onReceivedClientCertRequest(view, request... |
### Question:
DebugWebViewClient extends WebViewClient implements LogControl { @Override public void onFormResubmission(final WebView view, final Message dontResend, final Message resend) { logger.onFormResubmission(view, dontResend, resend); client.onFormResubmission(view, dontResend, resend); } DebugWebViewClient(); ... |
### Question:
DebugWebViewClient extends WebViewClient implements LogControl { @Override public void doUpdateVisitedHistory(final WebView view, final String url, final boolean isReload) { logger.doUpdateVisitedHistory(view, url, isReload); client.doUpdateVisitedHistory(view, url, isReload); } DebugWebViewClient(); Deb... |
### Question:
DebugWebViewClient extends WebViewClient implements LogControl { @Override public boolean shouldOverrideKeyEvent(final WebView view, final KeyEvent event) { final boolean retVal = client.shouldOverrideKeyEvent(view, event); logger.shouldOverrideKeyEvent(view, event, retVal); return retVal; } DebugWebViewC... |
### Question:
DebugWebViewClient extends WebViewClient implements LogControl { @Override public void onUnhandledKeyEvent(final WebView view, final KeyEvent event) { logger.onUnhandledKeyEvent(view, event); client.onUnhandledKeyEvent(view, event); } DebugWebViewClient(); DebugWebViewClient(@NonNull final WebViewClient ... |
### Question:
DebugWebViewClient extends WebViewClient implements LogControl { @Override public void onScaleChanged(final WebView view, final float oldScale, final float newScale) { logger.onScaleChanged(view, oldScale, newScale); client.onScaleChanged(view, oldScale, newScale); } DebugWebViewClient(); DebugWebViewCli... |
### Question:
DebugWebViewClient extends WebViewClient implements LogControl { @Override public void onReceivedLoginRequest(final WebView view, final String realm, final String account, final String args) { logger.onReceivedLoginRequest(view, realm, account, args); client.onReceivedLoginRequest(view, realm, account, ar... |
### Question:
DebugWebViewClient extends WebViewClient implements LogControl { @RequiresApi(api = Build.VERSION_CODES.O) @Override public boolean onRenderProcessGone(final WebView view, final RenderProcessGoneDetail detail) { final boolean retVal = client.onRenderProcessGone(view, detail); logger.onRenderProcessGone(vi... |
### Question:
DebugWebViewClient extends WebViewClient implements LogControl { @RequiresApi(api = Build.VERSION_CODES.O_MR1) @Override public void onSafeBrowsingHit(final WebView view, final WebResourceRequest request, final int threatType, final SafeBrowsingResponse callback) { logger.onSafeBrowsingHit(view, request, ... |
### Question:
DebugWebViewClientLogger implements LogControl { public void onReceivedSslError(final WebView view, final SslErrorHandler handler, final SslError error) { if (loggingEnabled) { logger.logError(String.format(LOCALE, "%s onReceivedSslError() ERR: %s", SPACE, error)); } } DebugWebViewClientLogger(); DebugWe... |
### Question:
DebugWebViewClientLogger implements LogControl { public void onLoadResource(WebView view, String url) { if (loggingEnabled) { logger.log(String.format(LOCALE, "%s onLoadResource() %s", SPACE, url)); } } DebugWebViewClientLogger(); DebugWebViewClientLogger(@NonNull final String tag); @VisibleForTesting(ot... |
### Question:
DebugWebViewClientLogger implements LogControl { @TargetApi(Build.VERSION_CODES.M) public void onPageCommitVisible(WebView view, String url) { if (loggingEnabled) { logger.log(String.format(LOCALE, "%s onPageCommitVisible() %s", SPACE, url)); } } DebugWebViewClientLogger(); DebugWebViewClientLogger(@NonN... |
### Question:
DebugWebViewClientLogger implements LogControl { @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) public void shouldInterceptRequest(WebView view, String url, WebResourceResponse retVal) { if (loggingEnabled) { final String result = retVal == null ? "false" : StringUtils.toString(retVal); logger.log(Strin... |
### Question:
DebugWebViewClient extends WebViewClient implements LogControl { @RequiresApi(api = Build.VERSION_CODES.M) @Override public void onReceivedHttpError(final WebView view, final WebResourceRequest request, final WebResourceResponse errorResponse) { logger.onReceivedHttpError(view, request, errorResponse); cl... |
### Question:
DebugWebViewClientLogger implements LogControl { public void onTooManyRedirects(WebView view, Message cancelMsg, Message continueMsg) { if (loggingEnabled) { logger.logError(String.format(LOCALE, "%s onTooManyRedirects()", SPACE)); } } DebugWebViewClientLogger(); DebugWebViewClientLogger(@NonNull final S... |
### Question:
DebugWebViewClientLogger implements LogControl { public void onReceivedHttpAuthRequest(WebView view, HttpAuthHandler handler, String host, String realm) { if (loggingEnabled) { logger.logSecurity(String.format(LOCALE, "%s onReceivedHttpAuthRequest() %s %s %s", SPACE, host, realm, handler)); } } DebugWebVi... |
### Question:
DebugWebViewClientLogger implements LogControl { public void onPageStarted(WebView view, String url, Bitmap facIcon) { if (loggingEnabled) { logger.log(String.format(LOCALE, "%s onPageStarted() %s", IN, url)); } } DebugWebViewClientLogger(); DebugWebViewClientLogger(@NonNull final String tag); @VisibleFo... |
### Question:
DebugWebViewClientLogger implements LogControl { public void onPageFinished(WebView view, String url) { if (loggingEnabled) { logger.log(String.format(LOCALE, "%s onPageFinished() %s", OUT, url)); } } DebugWebViewClientLogger(); DebugWebViewClientLogger(@NonNull final String tag); @VisibleForTesting(othe... |
### Question:
DebugWebViewClientLogger implements LogControl { @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) public void onReceivedClientCertRequest(WebView view, ClientCertRequest request) { if (loggingEnabled) { logger.logSecurity(String.format(LOCALE, "%s onReceivedClientCertRequest() %s", SPACE, StringUtils.toSt... |
### Question:
DebugWebViewClientLogger implements LogControl { public void onFormResubmission(final WebView view, final Message dontResend, final Message resend) { if (loggingEnabled) { logger.log(String.format(LOCALE, "%s onFormResubmission()", SPACE)); } } DebugWebViewClientLogger(); DebugWebViewClientLogger(@NonNul... |
### Question:
DebugWebViewClientLogger implements LogControl { public void doUpdateVisitedHistory(final WebView view, final String url, final boolean isReload) { if (loggingEnabled) { logger.log(String.format(LOCALE, "%s doUpdateVisitedHistory() %s, isReload: %s", SPACE, url, isReload)); } } DebugWebViewClientLogger();... |
### Question:
DebugWebViewClientLogger implements LogControl { public void onUnhandledInputEvent(final WebView view, final InputEvent event) { if (loggingEnabled && logKeyEventsEnabled) { logger.logKeyEvent(String.format(LOCALE, "%s onUnhandledInputEvent() %s", SPACE, event)); } } DebugWebViewClientLogger(); DebugWebV... |
### Question:
DebugWebViewClientLogger implements LogControl { public void onUnhandledKeyEvent(final WebView view, final KeyEvent event) { if (loggingEnabled && logKeyEventsEnabled) { logger.logKeyEvent(String.format(LOCALE, "%s onUnhandledKeyEvent() %s", SPACE, event)); } } DebugWebViewClientLogger(); DebugWebViewCli... |
### Question:
DebugWebViewClient extends WebViewClient implements LogControl { @Override public void onReceivedSslError(final WebView view, final SslErrorHandler handler, final SslError error) { logger.onReceivedSslError(view, handler, error); client.onReceivedSslError(view, handler, error); } DebugWebViewClient(); De... |
### Question:
DebugWebViewClientLogger implements LogControl { public void onScaleChanged(final WebView view, final float oldScale, final float newScale) { if (loggingEnabled) { logger.log(String.format(LOCALE, "%s onScaleChanged() old: %s, new: %s", SPACE, oldScale, newScale)); } } DebugWebViewClientLogger(); DebugWe... |
### Question:
DebugWebViewClientLogger implements LogControl { public void onReceivedLoginRequest(final WebView view, final String realm, final String account, final String args) { if (loggingEnabled) { logger.logSecurity(String.format(LOCALE, "%s onReceivedLoginRequest() %s, %s, %s", SPACE, realm, account, args)); } }... |
### Question:
DebugWebViewClientLogger implements LogControl { @RequiresApi(api = Build.VERSION_CODES.O) public void onRenderProcessGone(final WebView view, final RenderProcessGoneDetail detail, boolean retVal) { if (loggingEnabled) { logger.log(String.format(LOCALE, "%s onRenderProcessGone() 1/2 DETAIL: %s", SPACE, de... |
### Question:
DebugWebViewClient extends WebViewClient implements LogControl { @RequiresApi(api = Build.VERSION_CODES.N) @Override public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) { final boolean retVal = client.shouldOverrideUrlLoading(view, request); logger.shouldOverrideUrlLoading(vi... |
### Question:
DebugWebViewClient extends WebViewClient implements LogControl { @Override public void onLoadResource(WebView view, String url) { logger.onLoadResource(view, url); client.onLoadResource(view, url); } DebugWebViewClient(); DebugWebViewClient(@NonNull final WebViewClient client); @SuppressWarnings("WeakerA... |
### Question:
DebugWebViewClient extends WebViewClient implements LogControl { @TargetApi(Build.VERSION_CODES.M) @Override public void onPageCommitVisible(WebView view, String url) { logger.onPageCommitVisible(view, url); client.onPageCommitVisible(view, url); } DebugWebViewClient(); DebugWebViewClient(@NonNull final ... |
### Question:
AbstractCloudConnector implements CloudConnector { @Override public List<ServiceInfo> getServiceInfos() { List<ServiceInfo> serviceInfos = new ArrayList<ServiceInfo>(); for (SD serviceData : getServicesData()) { serviceInfos.add(getServiceInfo(serviceData)); } return serviceInfos; } AbstractCloudConnector... |
### Question:
RelationalServiceInfo extends UriBasedServiceInfo { @ServiceProperty(category = "connection") public String getJdbcUrl() { return jdbcUrl == null ? buildJdbcUrl() : jdbcUrl; } RelationalServiceInfo(String id, String uriString, String jdbcUrlDatabaseType); RelationalServiceInfo(String id, String uriString... |
### Question:
Cloud { public <SC> SC getServiceConnector(String serviceId, Class<SC> serviceConnectorType, ServiceConnectorConfig serviceConnectorConfig) { ServiceInfo serviceInfo = getServiceInfo(serviceId); return getServiceConnector(serviceInfo, serviceConnectorType, serviceConnectorConfig); } Cloud(CloudConnector c... |
### Question:
Cloud { public <SC> SC getSingletonServiceConnector(Class<SC> serviceConnectorType, ServiceConnectorConfig serviceConnectorConfig) { List<ServiceInfo> matchingServiceInfos = getServiceInfos(serviceConnectorType); if (matchingServiceInfos.size() != 1) { throw new CloudException("No unique service matching ... |
### Question:
Cloud { public List<ServiceInfo> getServiceInfos() { return flatten(cloudConnector.getServiceInfos()); } Cloud(CloudConnector cloudConnector, List<ServiceConnectorCreator<?, ? extends ServiceInfo>> serviceConnectorCreators); ApplicationInstanceInfo getApplicationInstanceInfo(); ServiceInfo getServiceInfo(... |
### Question:
CloudFactory { List<CloudConnector> getCloudConnectors() { return cloudConnectors; } CloudFactory(); Cloud getCloud(); void registerCloudConnector(CloudConnector cloudConnector); }### Answer:
@Test public void cloudConnectorRegistration() { CloudFactory cloudFactory = new CloudFactory(); List<CloudConnec... |
### Question:
Cloud { @SuppressWarnings("unchecked") public <T extends ServiceInfo> List<T> getServiceInfosByType(Class<T> serviceInfoType) { List<ServiceInfo> allServiceInfos = getServiceInfos(); List<T> matchingServiceInfos = new ArrayList<>(); for (ServiceInfo serviceInfo : allServiceInfos) { if (serviceInfoType.isA... |
### Question:
Cloud { public <T extends ServiceInfo> T getSingletonServiceInfoByType(Class<T> serviceInfoType) { List<T> serviceInfos = getServiceInfosByType(serviceInfoType); if (serviceInfos.size() != 1) { throw new CloudException( "No unique service info " + serviceInfoType + " found. Expected 1, found " + serviceIn... |
### Question:
CloudFactory { List<ServiceConnectorCreator<?, ? extends ServiceInfo>> getServiceCreators() { return serviceCreators; } CloudFactory(); Cloud getCloud(); void registerCloudConnector(CloudConnector cloudConnector); }### Answer:
@Test public void cloudServiceConnectorCreatorRegistration() { CloudFactory cl... |
### Question:
LocalConfigUtil { static Map<String, String> readServices(Properties properties) { Map<String, String> services = new HashMap<String, String>(); for (String propertyName : properties.stringPropertyNames()) { if (LocalConfigConnector.META_PROPERTIES.contains(propertyName)) { logger.finer("skipping meta pro... |
### Question:
LocalConfigUtil { static List<UriBasedServiceData> readServicesData(LinkedHashMap<String, Properties> propertySources) { Map<String, String> collectedServices = new HashMap<String, String>(); for (Map.Entry<String, Properties> propertySource : propertySources.entrySet()) { if (propertySource.getValue().is... |
### Question:
LocalConfigConnector extends AbstractCloudConnector<UriBasedServiceData> { @Override public boolean isInMatchingCloud() { if (fileProperties == null) readFileProperties(); String appId = findProperty(APP_ID_PROPERTY); if (appId == null) logger.info("the property " + APP_ID_PROPERTY + " was not found in th... |
### Question:
PropertiesFileResolver { File findCloudPropertiesFileFromSystem() { String filename = null; try { filename = env.getSystemProperty(LocalConfigConnector.PROPERTIES_FILE_PROPERTY); } catch (SecurityException e) { logger.log(Level.WARNING, "SecurityManager prevented reading system property " + LocalConfigCon... |
### Question:
PropertiesFileResolver { File findCloudPropertiesFileFromClasspath() { InputStream in = getClass().getClassLoader().getResourceAsStream(classpathPropertiesFilename); if (in == null) { logger.info("no " + classpathPropertiesFilename + " found on the classpath to direct us to an external properties file"); ... |
### Question:
CloudFactory { public Cloud getCloud() { CloudConnector suitableCloudConnector = null; for (CloudConnector cloudConnector : cloudConnectors) { if (cloudConnector.isInMatchingCloud()) { suitableCloudConnector = cloudConnector; break; } } if (suitableCloudConnector == null) { throw new CloudException("No su... |
### Question:
PropertiesFileResolver { File findCloudPropertiesFile() { File file = findCloudPropertiesFileFromSystem(); if (file != null) { logger.info("using configuration file from system properties"); return file; } file = findCloudPropertiesFileFromClasspath(); if (file != null) logger.info("using configuration fi... |
### Question:
CassandraClusterCreator extends AbstractServiceConnectorCreator<Cluster, CassandraServiceInfo> { @Override public Cluster create(CassandraServiceInfo serviceInfo, ServiceConnectorConfig serviceConnectorConfig) { Builder builder = Cluster.builder() .addContactPoints(serviceInfo.getContactPoints().toArray(n... |
### Question:
UrlDecodingDataSource extends DelegatingDataSource { @Override public Connection getConnection() throws SQLException { if (successfullyConnected) return super.getConnection(); synchronized (this) { Connection connection; try { connection = super.getConnection(); successfullyConnected = true; } catch (SQLE... |
### Question:
CloudFoundryServiceInfoCreator implements ServiceInfoCreator<SI, Map<String, Object>> { @SuppressWarnings("unchecked") protected boolean tagsMatch(Map<String, Object> serviceData) { List<String> serviceTags = (List<String>) serviceData.get("tags"); return tags.containsOne(serviceTags); } CloudFoundryServi... |
### Question:
CloudFoundryServiceInfoCreator implements ServiceInfoCreator<SI, Map<String, Object>> { protected boolean uriKeyMatchesScheme(Map<String, Object> serviceData) { if (uriSchemes == null) { return false; } Map<String, Object> credentials = getCredentials(serviceData); if (credentials != null) { for (String u... |
### Question:
Tags { public boolean containsOne(List<String> tags) { if (tags != null) { for (String value : values) { for (String tag : tags) { if (tag.equalsIgnoreCase(value)) { return true; } } } } return false; } Tags(String... values); String[] getTags(); boolean containsOne(List<String> tags); boolean contains(St... |
### Question:
Tags { public boolean contains(String tag) { if (tag != null) { for (String value : values) { if (tag.equalsIgnoreCase(value)) { return true; } } } return false; } Tags(String... values); String[] getTags(); boolean containsOne(List<String> tags); boolean contains(String tag); boolean startsWith(String ta... |
### Question:
Tags { public boolean startsWith(String tag) { if (tag != null) { for (String value : values) { if (startsWithIgnoreCase(tag, value)) { return true; } } } return false; } Tags(String... values); String[] getTags(); boolean containsOne(List<String> tags); boolean contains(String tag); boolean startsWith(St... |
### Question:
QueryBuilderFactoryImpl implements QueryBuilderFactory { public <T> QueryBuilder<T> newQueryBuilder( final Class<T> resultType ) { NotQueryableException.throwIfNotQueryable( resultType ); final ServiceReference<EntityFinder> serviceReference; try { serviceReference = finder.findService( EntityFinder.class... |
### Question:
ValueBuilderTemplate { public T newInstance(Module module) { ValueBuilder<T> builder = module.newValueBuilder( type ); build( builder.prototype() ); return builder.newInstance(); } protected ValueBuilderTemplate( Class<T> type ); T newInstance(Module module); }### Answer:
@Test public void testTemplate(... |
### Question:
Classes { public static Set<Class<?>> interfacesWithMethods( Set<Class<?>> interfaces ) { Set<Class<?>> newSet = new LinkedHashSet<Class<?>>(); for( Class type : interfaces ) { if( type.isInterface() && type.getDeclaredMethods().length > 0 ) { newSet.add( type ); } } return newSet; } static Specification... |
### Question:
Classes { public static String toURI( final Class clazz ) throws NullPointerException { return toURI( clazz.getName() ); } static Specification<Class<?>> isAssignableFrom( final Class clazz); static Specification<Object> instanceOf( final Class clazz); static Specification<Class<?>> hasModifier( final in... |
### Question:
Classes { public static String toClassName( String uri ) throws NullPointerException { uri = uri.substring( "urn:qi4j:type:".length() ); uri = denormalizeURIToClass( uri ); return uri; } static Specification<Class<?>> isAssignableFrom( final Class clazz); static Specification<Object> instanceOf( final Cl... |
### Question:
Classes { public static Type resolveTypeVariable( TypeVariable name, Class declaringClass, Class topClass ) { Type type = resolveTypeVariable( name, declaringClass, new HashMap<TypeVariable, Type>(), topClass ); if( type == null ) { type = Object.class; } return type; } static Specification<Class<?>> isA... |
### Question:
UnitOfWorkTemplate { public RESULT withModule(Module module) throws ThrowableType, UnitOfWorkCompletionException { int loop = 0; ThrowableType ex = null; do { UnitOfWork uow = module.newUnitOfWork( usecase ); try { RESULT result = withUnitOfWork( uow ); if (complete) { try { uow.complete(); return result;... |
### Question:
QualifiedName implements Comparable<QualifiedName>, Serializable { public String type() { return typeName.normalized(); } QualifiedName( TypeName typeName, String name ); static QualifiedName fromAccessor( AccessibleObject method ); static QualifiedName fromClass( Class type, String name ); static Qualifi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.