_id stringlengths 2 7 | title stringlengths 3 140 | partition stringclasses 3
values | text stringlengths 73 34.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q170300 | UrlUtils.isAbsoluteUrl | test | public static boolean isAbsoluteUrl(String url) {
if (url == null) {
return false;
}
final Pattern ABSOLUTE_URL = Pattern.compile("\\A[a-z0-9.+-]+://.*",
Pattern.CASE_INSENSITIVE);
return ABSOLUTE_URL.matcher(url).matches();
} | java | {
"resource": ""
} |
q170301 | RegexBasedAxFetchListFactory.createAttributeList | test | public List<OpenIDAttribute> createAttributeList(String identifier) {
for (Map.Entry<Pattern, List<OpenIDAttribute>> entry : idToAttributes.entrySet()) {
if (entry.getKey().matcher(identifier).matches()) {
return entry.getValue();
}
}
return Collections.emptyList();
} | java | {
"resource": ""
} |
q170302 | AclClassIdUtils.identifierFrom | test | Serializable identifierFrom(Serializable identifier, ResultSet resultSet) throws SQLException {
if (isString(identifier) && hasValidClassIdType(resultSet)
&& canConvertFromStringTo(classIdTypeFrom(resultSet))) {
identifier = convertFromStringTo((String) identifier, classIdTypeFrom(resultSet));
} else {
// Assume it should be a Long type
identifier = convertToLong(identifier);
}
return identifier;
} | java | {
"resource": ""
} |
q170303 | JdbcMutableAclService.createEntries | test | protected void createEntries(final MutableAcl acl) {
if (acl.getEntries().isEmpty()) {
return;
}
jdbcOperations.batchUpdate(insertEntry, new BatchPreparedStatementSetter() {
public int getBatchSize() {
return acl.getEntries().size();
}
public void setValues(PreparedStatement stmt, int i) throws SQLException {
AccessControlEntry entry_ = acl.getEntries().get(i);
Assert.isTrue(entry_ instanceof AccessControlEntryImpl,
"Unknown ACE class");
AccessControlEntryImpl entry = (AccessControlEntryImpl) entry_;
stmt.setLong(1, ((Long) acl.getId()).longValue());
stmt.setInt(2, i);
stmt.setLong(3, createOrRetrieveSidPrimaryKey(entry.getSid(), true)
.longValue());
stmt.setInt(4, entry.getPermission().getMask());
stmt.setBoolean(5, entry.isGranting());
stmt.setBoolean(6, entry.isAuditSuccess());
stmt.setBoolean(7, entry.isAuditFailure());
}
});
} | java | {
"resource": ""
} |
q170304 | JdbcMutableAclService.createObjectIdentity | test | protected void createObjectIdentity(ObjectIdentity object, Sid owner) {
Long sidId = createOrRetrieveSidPrimaryKey(owner, true);
Long classId = createOrRetrieveClassPrimaryKey(object.getType(), true, object.getIdentifier().getClass());
jdbcOperations.update(insertObjectIdentity, classId, object.getIdentifier().toString(), sidId,
Boolean.TRUE);
} | java | {
"resource": ""
} |
q170305 | JdbcMutableAclService.updateObjectIdentity | test | protected void updateObjectIdentity(MutableAcl acl) {
Long parentId = null;
if (acl.getParentAcl() != null) {
Assert.isInstanceOf(ObjectIdentityImpl.class, acl.getParentAcl()
.getObjectIdentity(),
"Implementation only supports ObjectIdentityImpl");
ObjectIdentityImpl oii = (ObjectIdentityImpl) acl.getParentAcl()
.getObjectIdentity();
parentId = retrieveObjectIdentityPrimaryKey(oii);
}
Assert.notNull(acl.getOwner(), "Owner is required in this implementation");
Long ownerSid = createOrRetrieveSidPrimaryKey(acl.getOwner(), true);
int count = jdbcOperations.update(updateObjectIdentity, parentId, ownerSid,
Boolean.valueOf(acl.isEntriesInheriting()), acl.getId());
if (count != 1) {
throw new NotFoundException("Unable to locate ACL to update");
}
} | java | {
"resource": ""
} |
q170306 | HttpSessionRequestCache.saveRequest | test | public void saveRequest(HttpServletRequest request, HttpServletResponse response) {
if (requestMatcher.matches(request)) {
DefaultSavedRequest savedRequest = new DefaultSavedRequest(request,
portResolver);
if (createSessionAllowed || request.getSession(false) != null) {
// Store the HTTP request itself. Used by
// AbstractAuthenticationProcessingFilter
// for redirection after successful authentication (SEC-29)
request.getSession().setAttribute(this.sessionAttrName, savedRequest);
logger.debug("DefaultSavedRequest added to Session: " + savedRequest);
}
}
else {
logger.debug("Request not saved as configured RequestMatcher did not match");
}
} | java | {
"resource": ""
} |
q170307 | ServerWebExchangeMatchers.pathMatchers | test | public static ServerWebExchangeMatcher pathMatchers(HttpMethod method, String... patterns) {
List<ServerWebExchangeMatcher> matchers = new ArrayList<>(patterns.length);
for (String pattern : patterns) {
matchers.add(new PathPatternParserServerWebExchangeMatcher(pattern, method));
}
return new OrServerWebExchangeMatcher(matchers);
} | java | {
"resource": ""
} |
q170308 | ServerWebExchangeMatchers.anyExchange | test | public static ServerWebExchangeMatcher anyExchange() {
// we don't use a lambda to ensure a unique equals and hashcode
// which otherwise can cause problems with adding multiple entries to an ordered LinkedHashMap
return new ServerWebExchangeMatcher() {
@Override
public Mono<MatchResult> matches(ServerWebExchange exchange) {
return ServerWebExchangeMatcher.MatchResult.match();
}
};
} | java | {
"resource": ""
} |
q170309 | Encryptors.delux | test | public static TextEncryptor delux(CharSequence password, CharSequence salt) {
return new HexEncodingTextEncryptor(stronger(password, salt));
} | java | {
"resource": ""
} |
q170310 | Encryptors.text | test | public static TextEncryptor text(CharSequence password, CharSequence salt) {
return new HexEncodingTextEncryptor(standard(password, salt));
} | java | {
"resource": ""
} |
q170311 | Encryptors.queryableText | test | public static TextEncryptor queryableText(CharSequence password, CharSequence salt) {
return new HexEncodingTextEncryptor(new AesBytesEncryptor(password.toString(),
salt));
} | java | {
"resource": ""
} |
q170312 | XFrameOptionsHeaderWriter.writeHeaders | test | public void writeHeaders(HttpServletRequest request, HttpServletResponse response) {
if (XFrameOptionsMode.ALLOW_FROM.equals(frameOptionsMode)) {
String allowFromValue = this.allowFromStrategy.getAllowFromValue(request);
if (XFrameOptionsMode.DENY.getMode().equals(allowFromValue)) {
if (!response.containsHeader(XFRAME_OPTIONS_HEADER)) {
response.setHeader(XFRAME_OPTIONS_HEADER, XFrameOptionsMode.DENY.getMode());
}
} else if (allowFromValue != null) {
if (!response.containsHeader(XFRAME_OPTIONS_HEADER)) {
response.setHeader(XFRAME_OPTIONS_HEADER,
XFrameOptionsMode.ALLOW_FROM.getMode() + " " + allowFromValue);
}
}
}
else {
response.setHeader(XFRAME_OPTIONS_HEADER, frameOptionsMode.getMode());
}
} | java | {
"resource": ""
} |
q170313 | AbstractAuthenticationTargetUrlRequestHandler.determineTargetUrl | test | protected String determineTargetUrl(HttpServletRequest request,
HttpServletResponse response, Authentication authentication) {
return determineTargetUrl(request, response);
} | java | {
"resource": ""
} |
q170314 | AbstractAuthenticationTargetUrlRequestHandler.determineTargetUrl | test | protected String determineTargetUrl(HttpServletRequest request,
HttpServletResponse response) {
if (isAlwaysUseDefaultTargetUrl()) {
return defaultTargetUrl;
}
// Check for the parameter and use that if available
String targetUrl = null;
if (targetUrlParameter != null) {
targetUrl = request.getParameter(targetUrlParameter);
if (StringUtils.hasText(targetUrl)) {
logger.debug("Found targetUrlParameter in request: " + targetUrl);
return targetUrl;
}
}
if (useReferer && !StringUtils.hasLength(targetUrl)) {
targetUrl = request.getHeader("Referer");
logger.debug("Using Referer header: " + targetUrl);
}
if (!StringUtils.hasText(targetUrl)) {
targetUrl = defaultTargetUrl;
logger.debug("Using default Url: " + targetUrl);
}
return targetUrl;
} | java | {
"resource": ""
} |
q170315 | AbstractAuthenticationTargetUrlRequestHandler.setTargetUrlParameter | test | public void setTargetUrlParameter(String targetUrlParameter) {
if (targetUrlParameter != null) {
Assert.hasText(targetUrlParameter, "targetUrlParameter cannot be empty");
}
this.targetUrlParameter = targetUrlParameter;
} | java | {
"resource": ""
} |
q170316 | DocumentDaoImpl.getDirectoryWithImmediateParentPopulated | test | private Directory getDirectoryWithImmediateParentPopulated(final Long id) {
return getJdbcTemplate().queryForObject(SELECT_FROM_DIRECTORY_SINGLE,
new Object[] { id }, new RowMapper<Directory>() {
public Directory mapRow(ResultSet rs, int rowNumber)
throws SQLException {
Long parentDirectoryId = new Long(rs
.getLong("parent_directory_id"));
Directory parentDirectory = Directory.ROOT_DIRECTORY;
if (parentDirectoryId != null
&& !parentDirectoryId.equals(new Long(-1))) {
// Need to go and lookup the parent, so do that first
parentDirectory = getDirectoryWithImmediateParentPopulated(parentDirectoryId);
}
Directory directory = new Directory(rs
.getString("directory_name"), parentDirectory);
FieldUtils.setProtectedFieldValue("id", directory,
new Long(rs.getLong("id")));
return directory;
}
});
} | java | {
"resource": ""
} |
q170317 | DefaultLdapUsernameToDnMapper.buildDn | test | public DistinguishedName buildDn(String username) {
DistinguishedName dn = new DistinguishedName(userDnBase);
dn.add(usernameAttribute, username);
return dn;
} | java | {
"resource": ""
} |
q170318 | WebSecurityConfigurerAdapter.createSharedObjects | test | private Map<Class<? extends Object>, Object> createSharedObjects() {
Map<Class<? extends Object>, Object> sharedObjects = new HashMap<Class<? extends Object>, Object>();
sharedObjects.putAll(localConfigureAuthenticationBldr.getSharedObjects());
sharedObjects.put(UserDetailsService.class, userDetailsService());
sharedObjects.put(ApplicationContext.class, context);
sharedObjects.put(ContentNegotiationStrategy.class, contentNegotiationStrategy);
sharedObjects.put(AuthenticationTrustResolver.class, trustResolver);
return sharedObjects;
} | java | {
"resource": ""
} |
q170319 | JaasAuthenticationProvider.configureJaasUsingLoop | test | private void configureJaasUsingLoop() throws IOException {
String loginConfigUrl = convertLoginConfigToUrl();
boolean alreadySet = false;
int n = 1;
final String prefix = "login.config.url.";
String existing;
while ((existing = Security.getProperty(prefix + n)) != null) {
alreadySet = existing.equals(loginConfigUrl);
if (alreadySet) {
break;
}
n++;
}
if (!alreadySet) {
String key = prefix + n;
log.debug("Setting security property [" + key + "] to: " + loginConfigUrl);
Security.setProperty(key, loginConfigUrl);
}
} | java | {
"resource": ""
} |
q170320 | FastHttpDateFormat.getCurrentDate | test | public static String getCurrentDate() {
long now = System.currentTimeMillis();
if ((now - currentDateGenerated) > 1000) {
synchronized (format) {
if ((now - currentDateGenerated) > 1000) {
currentDateGenerated = now;
currentDate = format.format(new Date(now));
}
}
}
return currentDate;
} | java | {
"resource": ""
} |
q170321 | FastHttpDateFormat.internalParseDate | test | private static Long internalParseDate(String value, DateFormat[] formats) {
Date date = null;
for (int i = 0; (date == null) && (i < formats.length); i++) {
try {
date = formats[i].parse(value);
}
catch (ParseException ignored) {
}
}
if (date == null) {
return null;
}
return new Long(date.getTime());
} | java | {
"resource": ""
} |
q170322 | FastHttpDateFormat.updateCache | test | @SuppressWarnings("unchecked")
private static void updateCache(HashMap cache, Object key, Object value) {
if (value == null) {
return;
}
if (cache.size() > 1000) {
cache.clear();
}
cache.put(key, value);
} | java | {
"resource": ""
} |
q170323 | UsernamePasswordAuthenticationFilter.setDetails | test | protected void setDetails(HttpServletRequest request,
UsernamePasswordAuthenticationToken authRequest) {
authRequest.setDetails(authenticationDetailsSource.buildDetails(request));
} | java | {
"resource": ""
} |
q170324 | DefaultWASUsernameAndGroupsExtractor.getSecurityName | test | private static String getSecurityName(final Subject subject) {
if (logger.isDebugEnabled()) {
logger.debug("Determining Websphere security name for subject " + subject);
}
String userSecurityName = null;
if (subject != null) {
// SEC-803
Object credential = subject.getPublicCredentials(getWSCredentialClass())
.iterator().next();
if (credential != null) {
userSecurityName = (String) invokeMethod(getSecurityNameMethod(),
credential);
}
}
if (logger.isDebugEnabled()) {
logger.debug("Websphere security name is " + userSecurityName
+ " for subject " + subject);
}
return userSecurityName;
} | java | {
"resource": ""
} |
q170325 | DefaultWASUsernameAndGroupsExtractor.getWebSphereGroups | test | @SuppressWarnings("unchecked")
private static List<String> getWebSphereGroups(final String securityName) {
Context ic = null;
try {
// TODO: Cache UserRegistry object
ic = new InitialContext();
Object objRef = ic.lookup(USER_REGISTRY);
Object userReg = invokeMethod(getNarrowMethod(), null , objRef, Class.forName("com.ibm.websphere.security.UserRegistry"));
if (logger.isDebugEnabled()) {
logger.debug("Determining WebSphere groups for user " + securityName
+ " using WebSphere UserRegistry " + userReg);
}
final Collection groups = (Collection) invokeMethod(getGroupsForUserMethod(),
userReg, new Object[] { securityName });
if (logger.isDebugEnabled()) {
logger.debug("Groups for user " + securityName + ": " + groups.toString());
}
return new ArrayList(groups);
}
catch (Exception e) {
logger.error("Exception occured while looking up groups for user", e);
throw new RuntimeException(
"Exception occured while looking up groups for user", e);
}
finally {
try {
if (ic != null) {
ic.close();
}
}
catch (NamingException e) {
logger.debug("Exception occured while closing context", e);
}
}
} | java | {
"resource": ""
} |
q170326 | LdapUserDetailsManager.changePassword | test | public void changePassword(final String oldPassword, final String newPassword) {
Authentication authentication = SecurityContextHolder.getContext()
.getAuthentication();
Assert.notNull(
authentication,
"No authentication object found in security context. Can't change current user's password!");
String username = authentication.getName();
logger.debug("Changing password for user '" + username);
DistinguishedName userDn = usernameMapper.buildDn(username);
if (usePasswordModifyExtensionOperation) {
changePasswordUsingExtensionOperation(userDn, oldPassword, newPassword);
} else {
changePasswordUsingAttributeModification(userDn, oldPassword, newPassword);
}
} | java | {
"resource": ""
} |
q170327 | LdapUserDetailsManager.buildGroupDn | test | protected DistinguishedName buildGroupDn(String group) {
DistinguishedName dn = new DistinguishedName(groupSearchBase);
dn.add(groupRoleAttributeName, group.toLowerCase());
return dn;
} | java | {
"resource": ""
} |
q170328 | ConcurrentSessionControlAuthenticationStrategy.allowableSessionsExceeded | test | protected void allowableSessionsExceeded(List<SessionInformation> sessions,
int allowableSessions, SessionRegistry registry)
throws SessionAuthenticationException {
if (exceptionIfMaximumExceeded || (sessions == null)) {
throw new SessionAuthenticationException(messages.getMessage(
"ConcurrentSessionControlAuthenticationStrategy.exceededAllowed",
new Object[] { Integer.valueOf(allowableSessions) },
"Maximum sessions of {0} for this principal exceeded"));
}
// Determine least recently used session, and mark it for invalidation
SessionInformation leastRecentlyUsed = null;
for (SessionInformation session : sessions) {
if ((leastRecentlyUsed == null)
|| session.getLastRequest()
.before(leastRecentlyUsed.getLastRequest())) {
leastRecentlyUsed = session;
}
}
leastRecentlyUsed.expireNow();
} | java | {
"resource": ""
} |
q170329 | ProviderManager.copyDetails | test | private void copyDetails(Authentication source, Authentication dest) {
if ((dest instanceof AbstractAuthenticationToken) && (dest.getDetails() == null)) {
AbstractAuthenticationToken token = (AbstractAuthenticationToken) dest;
token.setDetails(source.getDetails());
}
} | java | {
"resource": ""
} |
q170330 | FilterChainProxy.getFilters | test | private List<Filter> getFilters(HttpServletRequest request) {
for (SecurityFilterChain chain : filterChains) {
if (chain.matches(request)) {
return chain.getFilters();
}
}
return null;
} | java | {
"resource": ""
} |
q170331 | FilterChainProxy.getFilters | test | public List<Filter> getFilters(String url) {
return getFilters(firewall.getFirewalledRequest((new FilterInvocation(url, "GET")
.getRequest())));
} | java | {
"resource": ""
} |
q170332 | AccessControlListTag.getContext | test | protected ApplicationContext getContext(PageContext pageContext) {
ServletContext servletContext = pageContext.getServletContext();
return SecurityWebApplicationContextUtils.findRequiredWebApplicationContext(servletContext);
} | java | {
"resource": ""
} |
q170333 | LdapUtils.getFullDn | test | public static DistinguishedName getFullDn(DistinguishedName dn, Context baseCtx)
throws NamingException {
DistinguishedName baseDn = new DistinguishedName(baseCtx.getNameInNamespace());
if (dn.contains(baseDn)) {
return dn;
}
baseDn.append(dn);
return baseDn;
} | java | {
"resource": ""
} |
q170334 | MockMvcRequestSpecificationImpl.sessionAttrs | test | public MockMvcRequestSpecification sessionAttrs(Map<String, Object> sessionAttributes) {
notNull(sessionAttributes, "sessionAttributes");
parameterUpdater.updateParameters(convert(cfg.getMockMvcParamConfig().sessionAttributesUpdateStrategy()), sessionAttributes, this.sessionAttributes);
return this;
} | java | {
"resource": ""
} |
q170335 | PreemptiveAuthProvider.basic | test | public AuthenticationScheme basic(String userName, String password) {
final PreemptiveBasicAuthScheme preemptiveBasicAuthScheme = new PreemptiveBasicAuthScheme();
preemptiveBasicAuthScheme.setUserName(userName);
preemptiveBasicAuthScheme.setPassword(password);
return preemptiveBasicAuthScheme;
} | java | {
"resource": ""
} |
q170336 | RestAssured.filters | test | public static void filters(List<Filter> filters) {
Validate.notNull(filters, "Filter list cannot be null");
RestAssured.filters.addAll(filters);
} | java | {
"resource": ""
} |
q170337 | RestAssured.filters | test | public static void filters(Filter filter, Filter... additionalFilters) {
Validate.notNull(filter, "Filter cannot be null");
RestAssured.filters.add(filter);
if (additionalFilters != null) {
Collections.addAll(RestAssured.filters, additionalFilters);
}
} | java | {
"resource": ""
} |
q170338 | RestAssured.basic | test | public static AuthenticationScheme basic(String userName, String password) {
final BasicAuthScheme scheme = new BasicAuthScheme();
scheme.setUserName(userName);
scheme.setPassword(password);
return scheme;
} | java | {
"resource": ""
} |
q170339 | RestAssured.ntlm | test | public static AuthenticationScheme ntlm(String userName, String password, String workstation, String domain) {
final NTLMAuthScheme scheme = new NTLMAuthScheme();
scheme.setUserName(userName);
scheme.setPassword(password);
scheme.setWorkstation(workstation);
scheme.setDomain(domain);
return scheme;
} | java | {
"resource": ""
} |
q170340 | RestAssured.form | test | public static AuthenticationScheme form(String userName, String password, FormAuthConfig config) {
if (userName == null) {
throw new IllegalArgumentException("Username cannot be null");
}
if (password == null) {
throw new IllegalArgumentException("Password cannot be null");
}
final FormAuthScheme scheme = new FormAuthScheme();
scheme.setUserName(userName);
scheme.setPassword(password);
scheme.setConfig(config);
return scheme;
} | java | {
"resource": ""
} |
q170341 | RestAssured.proxy | test | public static void proxy(URI uri) {
if (uri == null) {
throw new IllegalArgumentException("Proxy URI cannot be null");
}
proxy(new ProxySpecification(uri.getHost(), uri.getPort(), uri.getScheme()));
} | java | {
"resource": ""
} |
q170342 | ResponsePrinter.print | test | public static String print(ResponseOptions responseOptions, ResponseBody responseBody, PrintStream stream, LogDetail logDetail, boolean shouldPrettyPrint) {
final StringBuilder builder = new StringBuilder();
if (logDetail == ALL || logDetail == STATUS) {
builder.append(responseOptions.statusLine());
}
if (logDetail == ALL || logDetail == HEADERS) {
final Headers headers = responseOptions.headers();
if (headers.exist()) {
appendNewLineIfAll(logDetail, builder).append(toString(headers));
}
} else if (logDetail == COOKIES) {
final Cookies cookies = responseOptions.detailedCookies();
if (cookies.exist()) {
appendNewLineIfAll(logDetail, builder).append(cookies.toString());
}
}
if (logDetail == ALL || logDetail == BODY) {
String responseBodyToAppend;
if (shouldPrettyPrint) {
responseBodyToAppend = new Prettifier().getPrettifiedBodyIfPossible(responseOptions, responseBody);
} else {
responseBodyToAppend = responseBody.asString();
}
if (logDetail == ALL && !isBlank(responseBodyToAppend)) {
builder.append(SystemUtils.LINE_SEPARATOR).append(SystemUtils.LINE_SEPARATOR);
}
builder.append(responseBodyToAppend);
}
String response = builder.toString();
stream.println(response);
return response;
} | java | {
"resource": ""
} |
q170343 | RestAssuredConfig.redirect | test | public RestAssuredConfig redirect(RedirectConfig redirectConfig) {
notNull(redirectConfig, "Redirect config");
return new RestAssuredConfig(redirectConfig, conf(HttpClientConfig.class), conf(LogConfig.class), conf(EncoderConfig.class),
conf(DecoderConfig.class), conf(SessionConfig.class), conf(ObjectMapperConfig.class), conf(ConnectionConfig.class),
conf(JsonConfig.class), conf(XmlConfig.class), conf(SSLConfig.class), conf(MatcherConfig.class),
conf(HeaderConfig.class), conf(MultiPartConfig.class), conf(ParamConfig.class), conf(OAuthConfig.class), conf(FailureConfig.class));
} | java | {
"resource": ""
} |
q170344 | EncoderConfig.defaultQueryParameterCharset | test | public EncoderConfig defaultQueryParameterCharset(String charset) {
return new EncoderConfig(defaultContentCharset, charset, shouldAppendDefaultContentCharsetToContentTypeIfUndefined, contentEncoders, contentTypeToDefaultCharset, true);
} | java | {
"resource": ""
} |
q170345 | ObjectMapperConfig.defaultObjectMapperType | test | public ObjectMapperConfig defaultObjectMapperType(ObjectMapperType defaultObjectMapperType) {
return new ObjectMapperConfig(defaultObjectMapper, defaultObjectMapperType, gsonObjectMapperFactory,
jackson1ObjectMapperFactory, jackson2ObjectMapperFactory, jaxbObjectMapperFactory,
johnzonObjectMapperFactory, true);
} | java | {
"resource": ""
} |
q170346 | ObjectMapperConfig.jaxbObjectMapperFactory | test | public ObjectMapperConfig jaxbObjectMapperFactory(JAXBObjectMapperFactory jaxbObjectMapperFactory) {
return new ObjectMapperConfig(defaultObjectMapper, defaultObjectMapperType, gsonObjectMapperFactory,
jackson1ObjectMapperFactory, jackson2ObjectMapperFactory, jaxbObjectMapperFactory,
johnzonObjectMapperFactory, true);
} | java | {
"resource": ""
} |
q170347 | RestAssuredMockMvcConfig.logConfig | test | public RestAssuredMockMvcConfig logConfig(LogConfig logConfig) {
notNull(logConfig, "Log config");
return new RestAssuredMockMvcConfig(logConfig, encoderConfig, decoderConfig, sessionConfig, objectMapperConfig, jsonConfig, xmlConfig, headerConfig, asyncConfig, multiPartConfig, mockMvcConfig, paramConfig, matcherConfig);
} | java | {
"resource": ""
} |
q170348 | RestAssuredMockMvcConfig.sessionConfig | test | public RestAssuredMockMvcConfig sessionConfig(SessionConfig sessionConfig) {
notNull(sessionConfig, "Session config");
return new RestAssuredMockMvcConfig(logConfig, encoderConfig, decoderConfig, sessionConfig, objectMapperConfig, jsonConfig, xmlConfig, headerConfig, asyncConfig, multiPartConfig, mockMvcConfig, paramConfig, matcherConfig);
} | java | {
"resource": ""
} |
q170349 | RestAssuredMockMvcConfig.objectMapperConfig | test | public RestAssuredMockMvcConfig objectMapperConfig(ObjectMapperConfig objectMapperConfig) {
notNull(objectMapperConfig, "Object mapper config");
return new RestAssuredMockMvcConfig(logConfig, encoderConfig, decoderConfig, sessionConfig, objectMapperConfig, jsonConfig, xmlConfig, headerConfig, asyncConfig, multiPartConfig, mockMvcConfig, paramConfig, matcherConfig);
} | java | {
"resource": ""
} |
q170350 | RestAssuredMockMvcConfig.jsonConfig | test | public RestAssuredMockMvcConfig jsonConfig(JsonConfig jsonConfig) {
notNull(jsonConfig, "JsonConfig");
return new RestAssuredMockMvcConfig(logConfig, encoderConfig, decoderConfig, sessionConfig,
objectMapperConfig, jsonConfig, xmlConfig, headerConfig, asyncConfig, multiPartConfig, mockMvcConfig, paramConfig, matcherConfig);
} | java | {
"resource": ""
} |
q170351 | RestAssuredMockMvcConfig.xmlConfig | test | public RestAssuredMockMvcConfig xmlConfig(XmlConfig xmlConfig) {
notNull(xmlConfig, "XmlConfig");
return new RestAssuredMockMvcConfig(logConfig, encoderConfig, decoderConfig, sessionConfig,
objectMapperConfig, jsonConfig, xmlConfig, headerConfig, asyncConfig, multiPartConfig, mockMvcConfig, paramConfig, matcherConfig);
} | java | {
"resource": ""
} |
q170352 | RestAssuredMockMvcConfig.encoderConfig | test | public RestAssuredMockMvcConfig encoderConfig(EncoderConfig encoderConfig) {
notNull(encoderConfig, "EncoderConfig");
return new RestAssuredMockMvcConfig(logConfig, encoderConfig, decoderConfig, sessionConfig,
objectMapperConfig, jsonConfig, xmlConfig, headerConfig, asyncConfig, multiPartConfig, mockMvcConfig, paramConfig, matcherConfig);
} | java | {
"resource": ""
} |
q170353 | RestAssuredMockMvcConfig.headerConfig | test | public RestAssuredMockMvcConfig headerConfig(HeaderConfig headerConfig) {
notNull(headerConfig, "HeaderConfig");
return new RestAssuredMockMvcConfig(logConfig, encoderConfig, decoderConfig, sessionConfig,
objectMapperConfig, jsonConfig, xmlConfig, headerConfig, asyncConfig, multiPartConfig, mockMvcConfig, paramConfig, matcherConfig);
} | java | {
"resource": ""
} |
q170354 | RestAssuredMockMvcConfig.asyncConfig | test | public RestAssuredMockMvcConfig asyncConfig(AsyncConfig asyncConfig) {
notNull(asyncConfig, AsyncConfig.class);
return new RestAssuredMockMvcConfig(logConfig, encoderConfig, decoderConfig, sessionConfig,
objectMapperConfig, jsonConfig, xmlConfig, headerConfig, asyncConfig, multiPartConfig, mockMvcConfig, paramConfig, matcherConfig);
} | java | {
"resource": ""
} |
q170355 | RestAssuredMockMvcConfig.mockMvcConfig | test | public RestAssuredMockMvcConfig mockMvcConfig(MockMvcConfig mockMvcConfig) {
notNull(mockMvcConfig, MockMvcConfig.class);
return new RestAssuredMockMvcConfig(logConfig, encoderConfig, decoderConfig, sessionConfig,
objectMapperConfig, jsonConfig, xmlConfig, headerConfig, asyncConfig, multiPartConfig, mockMvcConfig, paramConfig, matcherConfig);
} | java | {
"resource": ""
} |
q170356 | RestAssuredMockMvcConfig.multiPartConfig | test | public RestAssuredMockMvcConfig multiPartConfig(MultiPartConfig multiPartConfig) {
notNull(multiPartConfig, MultiPartConfig.class);
return new RestAssuredMockMvcConfig(logConfig, encoderConfig, decoderConfig, sessionConfig,
objectMapperConfig, jsonConfig, xmlConfig, headerConfig, asyncConfig, multiPartConfig, mockMvcConfig, paramConfig, matcherConfig);
} | java | {
"resource": ""
} |
q170357 | RestAssuredMockMvcConfig.paramConfig | test | public RestAssuredMockMvcConfig paramConfig(MockMvcParamConfig paramConfig) {
notNull(paramConfig, MultiPartConfig.class);
return new RestAssuredMockMvcConfig(logConfig, encoderConfig, decoderConfig, sessionConfig,
objectMapperConfig, jsonConfig, xmlConfig, headerConfig, asyncConfig, multiPartConfig, mockMvcConfig, paramConfig, matcherConfig);
} | java | {
"resource": ""
} |
q170358 | RestAssuredMockMvcConfig.matcherConfig | test | public RestAssuredMockMvcConfig matcherConfig(MatcherConfig matcherConfig) {
notNull(matcherConfig, MatcherConfig.class);
return new RestAssuredMockMvcConfig(logConfig, encoderConfig, decoderConfig, sessionConfig,
objectMapperConfig, jsonConfig, xmlConfig, headerConfig, asyncConfig, multiPartConfig, mockMvcConfig, paramConfig, matcherConfig);
} | java | {
"resource": ""
} |
q170359 | CertificateAuthSettings.allowAllHostnames | test | public CertificateAuthSettings allowAllHostnames() {
return new CertificateAuthSettings(keystoreType, trustStoreType, port, trustStore, keyStore, ALLOW_ALL_HOSTNAME_VERIFIER, sslSocketFactory);
} | java | {
"resource": ""
} |
q170360 | XmlPathConfig.declareNamespaces | test | public XmlPathConfig declareNamespaces(Map<String, String> namespacesToDeclare) {
return new XmlPathConfig(jaxbObjectMapperFactory, defaultParserType, defaultDeserializer, charset, features, namespacesToDeclare,
properties, validating, namespaceAware, allowDocTypeDeclaration);
} | java | {
"resource": ""
} |
q170361 | XmlPathConfig.declaredNamespace | test | public XmlPathConfig declaredNamespace(String prefix, String namespaceURI) {
Validate.notEmpty(prefix, "Prefix cannot be empty");
Validate.notEmpty(namespaceURI, "Namespace URI cannot be empty");
Map<String, String> updatedNamespaces = new HashMap<String, String>(declaredNamespaces);
updatedNamespaces.put(prefix, namespaceURI);
return new XmlPathConfig(jaxbObjectMapperFactory, defaultParserType, defaultDeserializer, charset, features, updatedNamespaces,
properties, validating, true, allowDocTypeDeclaration);
} | java | {
"resource": ""
} |
q170362 | HTTPBuilder.request | test | public Object request(String method, boolean hasBody, Closure configClosure) throws ClientProtocolException, IOException {
return this.doRequest(this.defaultURI.toURI(), method, this.defaultContentType, hasBody, configClosure);
} | java | {
"resource": ""
} |
q170363 | HTTPBuilder.setHeaders | test | public void setHeaders(Map<?, ?> headers) {
this.defaultRequestHeaders.clear();
if (headers == null) return;
for (Object key : headers.keySet()) {
Object val = headers.get(key);
if (val == null) continue;
this.defaultRequestHeaders.put(key.toString(), val.toString());
}
} | java | {
"resource": ""
} |
q170364 | HTTPBuilder.setProxy | test | public void setProxy(String host, int port, String scheme) {
getClient().getParams().setParameter(
ConnRoutePNames.DEFAULT_PROXY,
new HttpHost(host, port, scheme));
} | java | {
"resource": ""
} |
q170365 | MultiPartSpecBuilder.controlName | test | public MultiPartSpecBuilder controlName(String controlName) {
Validate.notEmpty(controlName, "Control name cannot be empty");
this.controlName = controlName;
this.isControlNameExplicit = true;
return this;
} | java | {
"resource": ""
} |
q170366 | MultiPartSpecBuilder.header | test | public MultiPartSpecBuilder header(String name, String value) {
Validate.notEmpty(name, "Header name cannot be empty");
Validate.notEmpty(value, "Header value cannot be empty");
// Replace previous header if exists
final Set<String> headerNames = headers.keySet();
final String trimmedName = name.trim();
for (String headerName : headerNames) {
if (headerName.equalsIgnoreCase(trimmedName)) {
headers.remove(headerName);
}
}
// Put the name header in the header list
headers.put(name, value);
return this;
} | java | {
"resource": ""
} |
q170367 | AuthConfig.basic | test | public void basic(String host, int port, String user, String pass) {
builder.getClient().getCredentialsProvider().setCredentials(
new AuthScope(host, port),
new UsernamePasswordCredentials(user, pass)
);
} | java | {
"resource": ""
} |
q170368 | AuthConfig.ntlm | test | public void ntlm(String host, int port, String user, String pass, String workstation, String domain) {
builder.getClient().getCredentialsProvider().setCredentials(
new AuthScope(host, port),
new NTCredentials(user, pass, workstation, domain)
);
} | java | {
"resource": ""
} |
q170369 | Headers.headers | test | public static Headers headers(Header header, Header... additionalHeaders) {
notNull(header, "Header");
final List<Header> headerList = new LinkedList<Header>();
headerList.add(header);
if (additionalHeaders != null) {
Collections.addAll(headerList, additionalHeaders);
}
return new Headers(headerList);
} | java | {
"resource": ""
} |
q170370 | RestAssuredMockMvc.reset | test | public static void reset() {
mockMvcFactory = null;
config = null;
basePath = "/";
resultHandlers.clear();
requestPostProcessors.clear();
responseSpecification = null;
requestSpecification = null;
authentication = null;
} | java | {
"resource": ""
} |
q170371 | ResponseBuilder.setHeader | test | public ResponseBuilder setHeader(String name, String value) {
notNull(name, "Header name");
notNull(value, "Header value");
List<Header> newHeaders = new ArrayList<Header>(restAssuredResponse.headers().asList());
newHeaders.add(new Header(name, value));
restAssuredResponse.setResponseHeaders(new Headers(newHeaders));
if (trim(name).equalsIgnoreCase(CONTENT_TYPE)) {
restAssuredResponse.setContentType(value);
}
return this;
} | java | {
"resource": ""
} |
q170372 | ResponseBuilder.build | test | public Response build() {
final int statusCode = restAssuredResponse.statusCode();
if (statusCode < 100 || statusCode >= 600) {
throw new IllegalArgumentException(format("Status code must be greater than 100 and less than 600, was %d.", statusCode));
}
if (StringUtils.isBlank(restAssuredResponse.statusLine())) {
restAssuredResponse.setStatusLine(restAssuredResponse.statusCode());
}
restAssuredResponse.setRpr(new ResponseParserRegistrar());
return restAssuredResponse;
} | java | {
"resource": ""
} |
q170373 | DetailedCookieMatcher.value | test | public DetailedCookieMatcher value(Matcher<? super String> valueMatcher) {
return new DetailedCookieMatcher(and(Matchers.hasProperty("value", valueMatcher)));
} | java | {
"resource": ""
} |
q170374 | DetailedCookieMatcher.comment | test | public DetailedCookieMatcher comment(Matcher<? super String> commentMatcher) {
return new DetailedCookieMatcher(and(Matchers.hasProperty("comment", commentMatcher)));
} | java | {
"resource": ""
} |
q170375 | DetailedCookieMatcher.expiryDate | test | public DetailedCookieMatcher expiryDate(Matcher<? super Date> expiryDateMatcher) {
return new DetailedCookieMatcher(and(Matchers.hasProperty("expiryDate", expiryDateMatcher)));
} | java | {
"resource": ""
} |
q170376 | DetailedCookieMatcher.domain | test | public DetailedCookieMatcher domain(Matcher<? super String> domainMatcher) {
return new DetailedCookieMatcher(and(Matchers.hasProperty("domain", domainMatcher)));
} | java | {
"resource": ""
} |
q170377 | DetailedCookieMatcher.path | test | public DetailedCookieMatcher path(Matcher<? super String> pathMatcher) {
return new DetailedCookieMatcher(and(Matchers.hasProperty("path", pathMatcher)));
} | java | {
"resource": ""
} |
q170378 | DetailedCookieMatcher.secured | test | public DetailedCookieMatcher secured(Matcher<? super Boolean> securedMatcher) {
return new DetailedCookieMatcher(and(Matchers.hasProperty("secured", securedMatcher)));
} | java | {
"resource": ""
} |
q170379 | DetailedCookieMatcher.httpOnly | test | public DetailedCookieMatcher httpOnly(Matcher<? super Boolean> httpOnlyMatcher) {
return new DetailedCookieMatcher(and(Matchers.hasProperty("httpOnly", httpOnlyMatcher)));
} | java | {
"resource": ""
} |
q170380 | DetailedCookieMatcher.version | test | public DetailedCookieMatcher version(Matcher<? super Integer> versionMatcher) {
return new DetailedCookieMatcher(and(Matchers.hasProperty("version", versionMatcher)));
} | java | {
"resource": ""
} |
q170381 | DetailedCookieMatcher.maxAge | test | public DetailedCookieMatcher maxAge(Matcher<? super Integer> maxAgeMatcher) {
return new DetailedCookieMatcher(and(Matchers.hasProperty("maxAge", maxAgeMatcher)));
} | java | {
"resource": ""
} |
q170382 | ResponseSpecBuilder.expectHeader | test | public ResponseSpecBuilder expectHeader(String headerName, Matcher<String> expectedValueMatcher) {
spec.header(headerName, expectedValueMatcher);
return this;
} | java | {
"resource": ""
} |
q170383 | ResponseSpecBuilder.expectHeader | test | public ResponseSpecBuilder expectHeader(String headerName, String expectedValue) {
spec.header(headerName, expectedValue);
return this;
} | java | {
"resource": ""
} |
q170384 | ResponseSpecBuilder.expectCookie | test | public ResponseSpecBuilder expectCookie(String cookieName, String expectedValue) {
spec.cookie(cookieName, expectedValue);
return this;
} | java | {
"resource": ""
} |
q170385 | ProxySpecification.withHost | test | public ProxySpecification withHost(String host) {
return new ProxySpecification(host, port, scheme, username, password);
} | java | {
"resource": ""
} |
q170386 | JsonPathConfig.numberReturnType | test | public JsonPathConfig numberReturnType(NumberReturnType numberReturnType) {
return new JsonPathConfig(numberReturnType, defaultParserType, gsonObjectMapperFactory,
jackson1ObjectMapperFactory, jackson2ObjectMapperFactory,
johnzonObjectMapperFactory, defaultDeserializer, charset);
} | java | {
"resource": ""
} |
q170387 | JsonPathConfig.defaultParserType | test | public JsonPathConfig defaultParserType(JsonParserType defaultParserType) {
return new JsonPathConfig(numberReturnType, defaultParserType, gsonObjectMapperFactory,
jackson1ObjectMapperFactory, jackson2ObjectMapperFactory,
johnzonObjectMapperFactory, defaultDeserializer, charset);
} | java | {
"resource": ""
} |
q170388 | LogConfig.defaultStream | test | public LogConfig defaultStream(PrintStream printStream) {
return new LogConfig(printStream, true, logDetailIfValidationFails, urlEncodeRequestUri, true);
} | java | {
"resource": ""
} |
q170389 | LogConfig.enableLoggingOfRequestAndResponseIfValidationFails | test | public LogConfig enableLoggingOfRequestAndResponseIfValidationFails(LogDetail logDetail) {
return new LogConfig(defaultPrintStream, prettyPrintingEnabled, logDetail, urlEncodeRequestUri, true);
} | java | {
"resource": ""
} |
q170390 | HttpRequestFactory.createHttpRequest | test | static HttpRequestBase createHttpRequest(URI uri, String httpMethod, boolean hasBody) {
String method = notNull(upperCase(trimToNull(httpMethod)), "Http method");
Class<? extends HttpRequestBase> type = HTTP_METHOD_TO_HTTP_REQUEST_TYPE.get(method);
final HttpRequestBase httpRequest;
// If we are sending HTTP method that does not allow body (like GET) then HTTP library prevents
// us from including it, however we chose to allow deviations from standard if user wants so,
// so it needs custom handling - hence the second condition below.
// Otherwise we should use standard implementation found in the map
if (type == null || (!(type.isInstance(HttpEntityEnclosingRequest.class)) && hasBody)) {
httpRequest = new CustomHttpMethod(method, uri);
} else {
try {
httpRequest = type.newInstance();
} catch (Exception e) {
throw new RuntimeException(e);
}
httpRequest.setURI(uri);
}
return httpRequest;
} | java | {
"resource": ""
} |
q170391 | MultiPartConfig.defaultBoundary | test | public MultiPartConfig defaultBoundary(String defaultBoundary) {
return new MultiPartConfig(defaultControlName, defaultFileName, defaultSubtype, defaultBoundary, defaultCharset, true);
} | java | {
"resource": ""
} |
q170392 | MockMvcRequestSpecBuilder.addAttribute | test | public MockMvcRequestSpecBuilder addAttribute(String attributeName, Object attributeValue) {
spec.attribute(attributeName, attributeValue);
return this;
} | java | {
"resource": ""
} |
q170393 | MockMvcRequestSpecBuilder.addHeader | test | public MockMvcRequestSpecBuilder addHeader(String headerName, String headerValue) {
spec.header(headerName, headerValue);
return this;
} | java | {
"resource": ""
} |
q170394 | MockMvcRequestSpecBuilder.addMultiPart | test | public MockMvcRequestSpecBuilder addMultiPart(String controlName, String contentBody, String mimeType) {
spec.multiPart(controlName, mimeType);
return this;
} | java | {
"resource": ""
} |
q170395 | MockMvcRequestSpecBuilder.addResultHandlers | test | public MockMvcRequestSpecBuilder addResultHandlers(ResultHandler resultHandler, ResultHandler... additionalResultHandlers) {
spec.resultHandlers(resultHandler, additionalResultHandlers);
return this;
} | java | {
"resource": ""
} |
q170396 | HttpClientConfig.setParam | test | public <T> HttpClientConfig setParam(String parameterName, T parameterValue) {
notNull(parameterName, "Parameter name");
final Map<String, Object> newParams = new HashMap<String, Object>(httpClientParams);
newParams.put(parameterName, parameterValue);
return new HttpClientConfig(httpClientFactory, newParams, httpMultipartMode, shouldReuseHttpClientInstance, NO_HTTP_CLIENT, true);
} | java | {
"resource": ""
} |
q170397 | HttpClientConfig.addParams | test | public HttpClientConfig addParams(Map<String, ?> httpClientParams) {
notNull(httpClientParams, "httpClientParams");
final Map<String, Object> newParams = new HashMap<String, Object>(this.httpClientParams);
newParams.putAll(httpClientParams);
return new HttpClientConfig(httpClientFactory, newParams, httpMultipartMode, shouldReuseHttpClientInstance, NO_HTTP_CLIENT, true);
} | java | {
"resource": ""
} |
q170398 | HttpClientConfig.httpClientFactory | test | public HttpClientConfig httpClientFactory(HttpClientFactory httpClientFactory) {
return new HttpClientConfig(httpClientFactory, httpClientParams, httpMultipartMode, shouldReuseHttpClientInstance, NO_HTTP_CLIENT, true);
} | java | {
"resource": ""
} |
q170399 | HttpClientConfig.httpMultipartMode | test | public HttpClientConfig httpMultipartMode(HttpMultipartMode httpMultipartMode) {
return new HttpClientConfig(httpClientFactory, httpClientParams, httpMultipartMode, shouldReuseHttpClientInstance, httpClient, true);
} | java | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.