repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
partition
stringclasses
1 value
hsiafan/requests
src/main/java/net/dongliu/requests/body/RequestBody.java
RequestBody.form
public static RequestBody<Collection<? extends Map.Entry<String, ?>>> form(Collection<? extends Map.Entry<String, ?>> value) { return new FormRequestBody(requireNonNull(value)); }
java
public static RequestBody<Collection<? extends Map.Entry<String, ?>>> form(Collection<? extends Map.Entry<String, ?>> value) { return new FormRequestBody(requireNonNull(value)); }
[ "public", "static", "RequestBody", "<", "Collection", "<", "?", "extends", "Map", ".", "Entry", "<", "String", ",", "?", ">", ">", ">", "form", "(", "Collection", "<", "?", "extends", "Map", ".", "Entry", "<", "String", ",", "?", ">", ">", "value", ...
Create request body send x-www-form-encoded data
[ "Create", "request", "body", "send", "x", "-", "www", "-", "form", "-", "encoded", "data" ]
a6cc6f8293e808cc937d3789aec2616a8383dee0
https://github.com/hsiafan/requests/blob/a6cc6f8293e808cc937d3789aec2616a8383dee0/src/main/java/net/dongliu/requests/body/RequestBody.java#L134-L137
train
hsiafan/requests
src/main/java/net/dongliu/requests/body/RequestBody.java
RequestBody.multiPart
public static RequestBody<Collection<? extends Part>> multiPart(Collection<? extends Part> parts) { return new MultiPartRequestBody(requireNonNull(parts)); }
java
public static RequestBody<Collection<? extends Part>> multiPart(Collection<? extends Part> parts) { return new MultiPartRequestBody(requireNonNull(parts)); }
[ "public", "static", "RequestBody", "<", "Collection", "<", "?", "extends", "Part", ">", ">", "multiPart", "(", "Collection", "<", "?", "extends", "Part", ">", "parts", ")", "{", "return", "new", "MultiPartRequestBody", "(", "requireNonNull", "(", "parts", ")...
Create multi-part post request body
[ "Create", "multi", "-", "part", "post", "request", "body" ]
a6cc6f8293e808cc937d3789aec2616a8383dee0
https://github.com/hsiafan/requests/blob/a6cc6f8293e808cc937d3789aec2616a8383dee0/src/main/java/net/dongliu/requests/body/RequestBody.java#L173-L175
train
hsiafan/requests
src/main/java/net/dongliu/requests/Headers.java
Headers.getHeaders
public List<String> getHeaders(String name) { requireNonNull(name); List<String> values = lazyMap.get().get(name.toLowerCase()); if (values == null) { return Lists.of(); } return Collections.unmodifiableList(values); }
java
public List<String> getHeaders(String name) { requireNonNull(name); List<String> values = lazyMap.get().get(name.toLowerCase()); if (values == null) { return Lists.of(); } return Collections.unmodifiableList(values); }
[ "public", "List", "<", "String", ">", "getHeaders", "(", "String", "name", ")", "{", "requireNonNull", "(", "name", ")", ";", "List", "<", "String", ">", "values", "=", "lazyMap", ".", "get", "(", ")", ".", "get", "(", "name", ".", "toLowerCase", "("...
Get headers by name. If not exists, return empty list
[ "Get", "headers", "by", "name", ".", "If", "not", "exists", "return", "empty", "list" ]
a6cc6f8293e808cc937d3789aec2616a8383dee0
https://github.com/hsiafan/requests/blob/a6cc6f8293e808cc937d3789aec2616a8383dee0/src/main/java/net/dongliu/requests/Headers.java#L52-L59
train
hsiafan/requests
src/main/java/net/dongliu/requests/Headers.java
Headers.getLongHeader
public long getLongHeader(String name, long defaultValue) { String firstHeader = getHeader(name); if (firstHeader == null) { return defaultValue; } try { return Long.parseLong(firstHeader.trim()); } catch (NumberFormatException e) { return defa...
java
public long getLongHeader(String name, long defaultValue) { String firstHeader = getHeader(name); if (firstHeader == null) { return defaultValue; } try { return Long.parseLong(firstHeader.trim()); } catch (NumberFormatException e) { return defa...
[ "public", "long", "getLongHeader", "(", "String", "name", ",", "long", "defaultValue", ")", "{", "String", "firstHeader", "=", "getHeader", "(", "name", ")", ";", "if", "(", "firstHeader", "==", "null", ")", "{", "return", "defaultValue", ";", "}", "try", ...
Get header value as long. If not exists, return defaultValue
[ "Get", "header", "value", "as", "long", ".", "If", "not", "exists", "return", "defaultValue" ]
a6cc6f8293e808cc937d3789aec2616a8383dee0
https://github.com/hsiafan/requests/blob/a6cc6f8293e808cc937d3789aec2616a8383dee0/src/main/java/net/dongliu/requests/Headers.java#L89-L99
train
hsiafan/requests
src/main/java/net/dongliu/requests/Headers.java
Headers.getCharset
public Charset getCharset(Charset defaultCharset) { String contentType = getHeader(HttpHeaders.NAME_CONTENT_TYPE); if (contentType == null) { return defaultCharset; } String[] items = contentType.split(";"); for (String item : items) { item = item.trim(); ...
java
public Charset getCharset(Charset defaultCharset) { String contentType = getHeader(HttpHeaders.NAME_CONTENT_TYPE); if (contentType == null) { return defaultCharset; } String[] items = contentType.split(";"); for (String item : items) { item = item.trim(); ...
[ "public", "Charset", "getCharset", "(", "Charset", "defaultCharset", ")", "{", "String", "contentType", "=", "getHeader", "(", "HttpHeaders", ".", "NAME_CONTENT_TYPE", ")", ";", "if", "(", "contentType", "==", "null", ")", "{", "return", "defaultCharset", ";", ...
Get charset set in content type header. @return the charset, or defaultCharset if no charset is set.
[ "Get", "charset", "set", "in", "content", "type", "header", "." ]
a6cc6f8293e808cc937d3789aec2616a8383dee0
https://github.com/hsiafan/requests/blob/a6cc6f8293e808cc937d3789aec2616a8383dee0/src/main/java/net/dongliu/requests/Headers.java#L110-L135
train
hsiafan/requests
src/main/java/net/dongliu/requests/body/ContentTypes.java
ContentTypes.isText
static boolean isText(String contentType) { return contentType.contains("text") || contentType.contains("json") || contentType.contains("xml") || contentType.contains("html"); }
java
static boolean isText(String contentType) { return contentType.contains("text") || contentType.contains("json") || contentType.contains("xml") || contentType.contains("html"); }
[ "static", "boolean", "isText", "(", "String", "contentType", ")", "{", "return", "contentType", ".", "contains", "(", "\"text\"", ")", "||", "contentType", ".", "contains", "(", "\"json\"", ")", "||", "contentType", ".", "contains", "(", "\"xml\"", ")", "||"...
If content type looks like a text content.
[ "If", "content", "type", "looks", "like", "a", "text", "content", "." ]
a6cc6f8293e808cc937d3789aec2616a8383dee0
https://github.com/hsiafan/requests/blob/a6cc6f8293e808cc937d3789aec2616a8383dee0/src/main/java/net/dongliu/requests/body/ContentTypes.java#L26-L29
train
hsiafan/requests
src/main/java/net/dongliu/requests/RawResponse.java
RawResponse.charset
public RawResponse charset(Charset charset) { return new RawResponse(method, url, statusCode, statusLine, cookies, headers, body, charset, decompress); }
java
public RawResponse charset(Charset charset) { return new RawResponse(method, url, statusCode, statusLine, cookies, headers, body, charset, decompress); }
[ "public", "RawResponse", "charset", "(", "Charset", "charset", ")", "{", "return", "new", "RawResponse", "(", "method", ",", "url", ",", "statusCode", ",", "statusLine", ",", "cookies", ",", "headers", ",", "body", ",", "charset", ",", "decompress", ")", "...
Set response read charset. If not set, would get charset from response headers. If not found, would use UTF-8.
[ "Set", "response", "read", "charset", ".", "If", "not", "set", "would", "get", "charset", "from", "response", "headers", ".", "If", "not", "found", "would", "use", "UTF", "-", "8", "." ]
a6cc6f8293e808cc937d3789aec2616a8383dee0
https://github.com/hsiafan/requests/blob/a6cc6f8293e808cc937d3789aec2616a8383dee0/src/main/java/net/dongliu/requests/RawResponse.java#L93-L95
train
hsiafan/requests
src/main/java/net/dongliu/requests/RawResponse.java
RawResponse.decompress
public RawResponse decompress(boolean decompress) { return new RawResponse(method, url, statusCode, statusLine, cookies, headers, body, charset, decompress); }
java
public RawResponse decompress(boolean decompress) { return new RawResponse(method, url, statusCode, statusLine, cookies, headers, body, charset, decompress); }
[ "public", "RawResponse", "decompress", "(", "boolean", "decompress", ")", "{", "return", "new", "RawResponse", "(", "method", ",", "url", ",", "statusCode", ",", "statusLine", ",", "cookies", ",", "headers", ",", "body", ",", "charset", ",", "decompress", ")...
If decompress http response body. Default is true.
[ "If", "decompress", "http", "response", "body", ".", "Default", "is", "true", "." ]
a6cc6f8293e808cc937d3789aec2616a8383dee0
https://github.com/hsiafan/requests/blob/a6cc6f8293e808cc937d3789aec2616a8383dee0/src/main/java/net/dongliu/requests/RawResponse.java#L108-L110
train
hsiafan/requests
src/main/java/net/dongliu/requests/RawResponse.java
RawResponse.readToText
public String readToText() { Charset charset = getCharset(); try (InputStream in = body(); Reader reader = new InputStreamReader(in, charset)) { return Readers.readAll(reader); } catch (IOException e) { throw new RequestsException(e); } finally { ...
java
public String readToText() { Charset charset = getCharset(); try (InputStream in = body(); Reader reader = new InputStreamReader(in, charset)) { return Readers.readAll(reader); } catch (IOException e) { throw new RequestsException(e); } finally { ...
[ "public", "String", "readToText", "(", ")", "{", "Charset", "charset", "=", "getCharset", "(", ")", ";", "try", "(", "InputStream", "in", "=", "body", "(", ")", ";", "Reader", "reader", "=", "new", "InputStreamReader", "(", "in", ",", "charset", ")", "...
Read response body to string. return empty string if response has no body
[ "Read", "response", "body", "to", "string", ".", "return", "empty", "string", "if", "response", "has", "no", "body" ]
a6cc6f8293e808cc937d3789aec2616a8383dee0
https://github.com/hsiafan/requests/blob/a6cc6f8293e808cc937d3789aec2616a8383dee0/src/main/java/net/dongliu/requests/RawResponse.java#L115-L125
train
hsiafan/requests
src/main/java/net/dongliu/requests/RawResponse.java
RawResponse.readToBytes
public byte[] readToBytes() { try { try (InputStream in = body()) { return InputStreams.readAll(in); } } catch (IOException e) { throw new RequestsException(e); } finally { close(); } }
java
public byte[] readToBytes() { try { try (InputStream in = body()) { return InputStreams.readAll(in); } } catch (IOException e) { throw new RequestsException(e); } finally { close(); } }
[ "public", "byte", "[", "]", "readToBytes", "(", ")", "{", "try", "{", "try", "(", "InputStream", "in", "=", "body", "(", ")", ")", "{", "return", "InputStreams", ".", "readAll", "(", "in", ")", ";", "}", "}", "catch", "(", "IOException", "e", ")", ...
Read response body to byte array. return empty byte array if response has no body
[ "Read", "response", "body", "to", "byte", "array", ".", "return", "empty", "byte", "array", "if", "response", "has", "no", "body" ]
a6cc6f8293e808cc937d3789aec2616a8383dee0
https://github.com/hsiafan/requests/blob/a6cc6f8293e808cc937d3789aec2616a8383dee0/src/main/java/net/dongliu/requests/RawResponse.java#L137-L147
train
hsiafan/requests
src/main/java/net/dongliu/requests/RawResponse.java
RawResponse.toResponse
public <T> Response<T> toResponse(ResponseHandler<T> handler) { ResponseInfo responseInfo = new ResponseInfo(this.url, this.statusCode, this.headers, body()); try { T result = handler.handle(responseInfo); return new Response<>(this.url, this.statusCode, this.cookies, this.header...
java
public <T> Response<T> toResponse(ResponseHandler<T> handler) { ResponseInfo responseInfo = new ResponseInfo(this.url, this.statusCode, this.headers, body()); try { T result = handler.handle(responseInfo); return new Response<>(this.url, this.statusCode, this.cookies, this.header...
[ "public", "<", "T", ">", "Response", "<", "T", ">", "toResponse", "(", "ResponseHandler", "<", "T", ">", "handler", ")", "{", "ResponseInfo", "responseInfo", "=", "new", "ResponseInfo", "(", "this", ".", "url", ",", "this", ".", "statusCode", ",", "this"...
Handle response body with handler, return a new response with content as handler result. The response is closed whether this call succeed or failed with exception.
[ "Handle", "response", "body", "with", "handler", "return", "a", "new", "response", "with", "content", "as", "handler", "result", ".", "The", "response", "is", "closed", "whether", "this", "call", "succeed", "or", "failed", "with", "exception", "." ]
a6cc6f8293e808cc937d3789aec2616a8383dee0
https://github.com/hsiafan/requests/blob/a6cc6f8293e808cc937d3789aec2616a8383dee0/src/main/java/net/dongliu/requests/RawResponse.java#L153-L163
train
hsiafan/requests
src/main/java/net/dongliu/requests/RawResponse.java
RawResponse.readToJson
public <T> T readToJson(Type type) { try { return JsonLookup.getInstance().lookup().unmarshal(body(), getCharset(), type); } catch (IOException e) { throw new RequestsException(e); } finally { close(); } }
java
public <T> T readToJson(Type type) { try { return JsonLookup.getInstance().lookup().unmarshal(body(), getCharset(), type); } catch (IOException e) { throw new RequestsException(e); } finally { close(); } }
[ "public", "<", "T", ">", "T", "readToJson", "(", "Type", "type", ")", "{", "try", "{", "return", "JsonLookup", ".", "getInstance", "(", ")", ".", "lookup", "(", ")", ".", "unmarshal", "(", "body", "(", ")", ",", "getCharset", "(", ")", ",", "type",...
Deserialize response content as json @return null if json value is null or empty
[ "Deserialize", "response", "content", "as", "json" ]
a6cc6f8293e808cc937d3789aec2616a8383dee0
https://github.com/hsiafan/requests/blob/a6cc6f8293e808cc937d3789aec2616a8383dee0/src/main/java/net/dongliu/requests/RawResponse.java#L177-L185
train
hsiafan/requests
src/main/java/net/dongliu/requests/RawResponse.java
RawResponse.toFileResponse
public Response<File> toFileResponse(Path path) { File file = path.toFile(); this.writeToFile(file); return new Response<>(this.url, this.statusCode, this.cookies, this.headers, file); }
java
public Response<File> toFileResponse(Path path) { File file = path.toFile(); this.writeToFile(file); return new Response<>(this.url, this.statusCode, this.cookies, this.headers, file); }
[ "public", "Response", "<", "File", ">", "toFileResponse", "(", "Path", "path", ")", "{", "File", "file", "=", "path", ".", "toFile", "(", ")", ";", "this", ".", "writeToFile", "(", "file", ")", ";", "return", "new", "Response", "<>", "(", "this", "."...
Write response body to file, and return response contains the file.
[ "Write", "response", "body", "to", "file", "and", "return", "response", "contains", "the", "file", "." ]
a6cc6f8293e808cc937d3789aec2616a8383dee0
https://github.com/hsiafan/requests/blob/a6cc6f8293e808cc937d3789aec2616a8383dee0/src/main/java/net/dongliu/requests/RawResponse.java#L268-L272
train
hsiafan/requests
src/main/java/net/dongliu/requests/RawResponse.java
RawResponse.writeTo
public void writeTo(OutputStream out) { try { InputStreams.transferTo(body(), out); } catch (IOException e) { throw new RequestsException(e); } finally { close(); } }
java
public void writeTo(OutputStream out) { try { InputStreams.transferTo(body(), out); } catch (IOException e) { throw new RequestsException(e); } finally { close(); } }
[ "public", "void", "writeTo", "(", "OutputStream", "out", ")", "{", "try", "{", "InputStreams", ".", "transferTo", "(", "body", "(", ")", ",", "out", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "RequestsException", "(", "e...
Write response body to OutputStream. OutputStream will not be closed.
[ "Write", "response", "body", "to", "OutputStream", ".", "OutputStream", "will", "not", "be", "closed", "." ]
a6cc6f8293e808cc937d3789aec2616a8383dee0
https://github.com/hsiafan/requests/blob/a6cc6f8293e808cc937d3789aec2616a8383dee0/src/main/java/net/dongliu/requests/RawResponse.java#L277-L285
train
hsiafan/requests
src/main/java/net/dongliu/requests/RawResponse.java
RawResponse.discardBody
public void discardBody() { try (InputStream in = body) { InputStreams.discardAll(in); } catch (IOException e) { throw new RequestsException(e); } finally { close(); } }
java
public void discardBody() { try (InputStream in = body) { InputStreams.discardAll(in); } catch (IOException e) { throw new RequestsException(e); } finally { close(); } }
[ "public", "void", "discardBody", "(", ")", "{", "try", "(", "InputStream", "in", "=", "body", ")", "{", "InputStreams", ".", "discardAll", "(", "in", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "RequestsException", "(", "...
Consume and discard this response body.
[ "Consume", "and", "discard", "this", "response", "body", "." ]
a6cc6f8293e808cc937d3789aec2616a8383dee0
https://github.com/hsiafan/requests/blob/a6cc6f8293e808cc937d3789aec2616a8383dee0/src/main/java/net/dongliu/requests/RawResponse.java#L308-L316
train
hsiafan/requests
src/main/java/net/dongliu/requests/RawResponse.java
RawResponse.decompressBody
private InputStream decompressBody() { if (!decompress) { return body; } // if has no body, some server still set content-encoding header, // GZIPInputStream wrap empty input stream will cause exception. we should check this if (method.equals(Methods.HEAD) ...
java
private InputStream decompressBody() { if (!decompress) { return body; } // if has no body, some server still set content-encoding header, // GZIPInputStream wrap empty input stream will cause exception. we should check this if (method.equals(Methods.HEAD) ...
[ "private", "InputStream", "decompressBody", "(", ")", "{", "if", "(", "!", "decompress", ")", "{", "return", "body", ";", "}", "// if has no body, some server still set content-encoding header,", "// GZIPInputStream wrap empty input stream will cause exception. we should check this...
Wrap response input stream if it is compressed, return input its self if not use compress
[ "Wrap", "response", "input", "stream", "if", "it", "is", "compressed", "return", "input", "its", "self", "if", "not", "use", "compress" ]
a6cc6f8293e808cc937d3789aec2616a8383dee0
https://github.com/hsiafan/requests/blob/a6cc6f8293e808cc937d3789aec2616a8383dee0/src/main/java/net/dongliu/requests/RawResponse.java#L378-L412
train
play2war/play2-war-plugin
samples/jboss-ebean/app/controllers/Application.java
Application.list
public static Result list(int page, String sortBy, String order, String filter) { return ok( list.render( Computer.page(page, 10, sortBy, order, filter), sortBy, order, filter ) ); }
java
public static Result list(int page, String sortBy, String order, String filter) { return ok( list.render( Computer.page(page, 10, sortBy, order, filter), sortBy, order, filter ) ); }
[ "public", "static", "Result", "list", "(", "int", "page", ",", "String", "sortBy", ",", "String", "order", ",", "String", "filter", ")", "{", "return", "ok", "(", "list", ".", "render", "(", "Computer", ".", "page", "(", "page", ",", "10", ",", "sort...
Display the paginated list of computers. @param page Current page number (starts from 0) @param sortBy Column to be sorted @param order Sort order (either asc or desc) @param filter Filter applied on computer names
[ "Display", "the", "paginated", "list", "of", "computers", "." ]
230f035eb1b51de021fad3aff18cc790af5ce28d
https://github.com/play2war/play2-war-plugin/blob/230f035eb1b51de021fad3aff18cc790af5ce28d/samples/jboss-ebean/app/controllers/Application.java#L41-L48
train
play2war/play2-war-plugin
samples/jboss-ebean/app/controllers/Application.java
Application.edit
public static Result edit(Long id) { Form<Computer> computerForm = form(Computer.class).fill( Computer.find.byId(id) ); return ok( editForm.render(id, computerForm) ); }
java
public static Result edit(Long id) { Form<Computer> computerForm = form(Computer.class).fill( Computer.find.byId(id) ); return ok( editForm.render(id, computerForm) ); }
[ "public", "static", "Result", "edit", "(", "Long", "id", ")", "{", "Form", "<", "Computer", ">", "computerForm", "=", "form", "(", "Computer", ".", "class", ")", ".", "fill", "(", "Computer", ".", "find", ".", "byId", "(", "id", ")", ")", ";", "ret...
Display the 'edit form' of a existing Computer. @param id Id of the computer to edit
[ "Display", "the", "edit", "form", "of", "a", "existing", "Computer", "." ]
230f035eb1b51de021fad3aff18cc790af5ce28d
https://github.com/play2war/play2-war-plugin/blob/230f035eb1b51de021fad3aff18cc790af5ce28d/samples/jboss-ebean/app/controllers/Application.java#L55-L62
train
play2war/play2-war-plugin
samples/jboss-ebean/app/controllers/Application.java
Application.update
public static Result update(Long id) { Form<Computer> computerForm = form(Computer.class).bindFromRequest(); if(computerForm.hasErrors()) { return badRequest(editForm.render(id, computerForm)); } computerForm.get().update(id); flash("success", "Computer " + computerFo...
java
public static Result update(Long id) { Form<Computer> computerForm = form(Computer.class).bindFromRequest(); if(computerForm.hasErrors()) { return badRequest(editForm.render(id, computerForm)); } computerForm.get().update(id); flash("success", "Computer " + computerFo...
[ "public", "static", "Result", "update", "(", "Long", "id", ")", "{", "Form", "<", "Computer", ">", "computerForm", "=", "form", "(", "Computer", ".", "class", ")", ".", "bindFromRequest", "(", ")", ";", "if", "(", "computerForm", ".", "hasErrors", "(", ...
Handle the 'edit form' submission @param id Id of the computer to edit
[ "Handle", "the", "edit", "form", "submission" ]
230f035eb1b51de021fad3aff18cc790af5ce28d
https://github.com/play2war/play2-war-plugin/blob/230f035eb1b51de021fad3aff18cc790af5ce28d/samples/jboss-ebean/app/controllers/Application.java#L69-L77
train
play2war/play2-war-plugin
samples/jboss-ebean/app/controllers/Application.java
Application.create
public static Result create() { Form<Computer> computerForm = form(Computer.class); return ok( createForm.render(computerForm) ); }
java
public static Result create() { Form<Computer> computerForm = form(Computer.class); return ok( createForm.render(computerForm) ); }
[ "public", "static", "Result", "create", "(", ")", "{", "Form", "<", "Computer", ">", "computerForm", "=", "form", "(", "Computer", ".", "class", ")", ";", "return", "ok", "(", "createForm", ".", "render", "(", "computerForm", ")", ")", ";", "}" ]
Display the 'new computer form'.
[ "Display", "the", "new", "computer", "form", "." ]
230f035eb1b51de021fad3aff18cc790af5ce28d
https://github.com/play2war/play2-war-plugin/blob/230f035eb1b51de021fad3aff18cc790af5ce28d/samples/jboss-ebean/app/controllers/Application.java#L82-L87
train
play2war/play2-war-plugin
samples/jboss-ebean/app/controllers/Application.java
Application.save
public static Result save() { Form<Computer> computerForm = form(Computer.class).bindFromRequest(); if(computerForm.hasErrors()) { return badRequest(createForm.render(computerForm)); } computerForm.get().save(); flash("success", "Computer " + computerForm.get().name +...
java
public static Result save() { Form<Computer> computerForm = form(Computer.class).bindFromRequest(); if(computerForm.hasErrors()) { return badRequest(createForm.render(computerForm)); } computerForm.get().save(); flash("success", "Computer " + computerForm.get().name +...
[ "public", "static", "Result", "save", "(", ")", "{", "Form", "<", "Computer", ">", "computerForm", "=", "form", "(", "Computer", ".", "class", ")", ".", "bindFromRequest", "(", ")", ";", "if", "(", "computerForm", ".", "hasErrors", "(", ")", ")", "{", ...
Handle the 'new computer form' submission
[ "Handle", "the", "new", "computer", "form", "submission" ]
230f035eb1b51de021fad3aff18cc790af5ce28d
https://github.com/play2war/play2-war-plugin/blob/230f035eb1b51de021fad3aff18cc790af5ce28d/samples/jboss-ebean/app/controllers/Application.java#L92-L100
train
play2war/play2-war-plugin
samples/jboss-ebean/app/controllers/Application.java
Application.delete
public static Result delete(Long id) { Computer.find.ref(id).delete(); flash("success", "Computer has been deleted"); return GO_HOME; }
java
public static Result delete(Long id) { Computer.find.ref(id).delete(); flash("success", "Computer has been deleted"); return GO_HOME; }
[ "public", "static", "Result", "delete", "(", "Long", "id", ")", "{", "Computer", ".", "find", ".", "ref", "(", "id", ")", ".", "delete", "(", ")", ";", "flash", "(", "\"success\"", ",", "\"Computer has been deleted\"", ")", ";", "return", "GO_HOME", ";",...
Handle computer deletion
[ "Handle", "computer", "deletion" ]
230f035eb1b51de021fad3aff18cc790af5ce28d
https://github.com/play2war/play2-war-plugin/blob/230f035eb1b51de021fad3aff18cc790af5ce28d/samples/jboss-ebean/app/controllers/Application.java#L105-L109
train
play2war/play2-war-plugin
samples/jboss-ebean/app/models/Computer.java
Computer.page
public static Page<Computer> page(int page, int pageSize, String sortBy, String order, String filter) { return find.where() .ilike("name", "%" + filter + "%") .orderBy(sortBy + " " + order) .fetch("company") .findPagingList(pageSize) ...
java
public static Page<Computer> page(int page, int pageSize, String sortBy, String order, String filter) { return find.where() .ilike("name", "%" + filter + "%") .orderBy(sortBy + " " + order) .fetch("company") .findPagingList(pageSize) ...
[ "public", "static", "Page", "<", "Computer", ">", "page", "(", "int", "page", ",", "int", "pageSize", ",", "String", "sortBy", ",", "String", "order", ",", "String", "filter", ")", "{", "return", "find", ".", "where", "(", ")", ".", "ilike", "(", "\"...
Return a page of computer @param page Page to display @param pageSize Number of computers per page @param sortBy Computer property used for sorting @param order Sort order (either or asc or desc) @param filter Filter applied on the name column
[ "Return", "a", "page", "of", "computer" ]
230f035eb1b51de021fad3aff18cc790af5ce28d
https://github.com/play2war/play2-war-plugin/blob/230f035eb1b51de021fad3aff18cc790af5ce28d/samples/jboss-ebean/app/models/Computer.java#L47-L55
train
lukas-krecan/json2xml
src/main/java/net/javacrumbs/json2xml/JsonSaxAdapter.java
JsonSaxAdapter.parse
public void parse() throws ParserException { try { jsonParser.nextToken(); contentHandler.startDocument(); if (shouldAddArtificialRoot()) { startElement(artificialRootName); parseElement(artificialRootName, false); endElement(ar...
java
public void parse() throws ParserException { try { jsonParser.nextToken(); contentHandler.startDocument(); if (shouldAddArtificialRoot()) { startElement(artificialRootName); parseElement(artificialRootName, false); endElement(ar...
[ "public", "void", "parse", "(", ")", "throws", "ParserException", "{", "try", "{", "jsonParser", ".", "nextToken", "(", ")", ";", "contentHandler", ".", "startDocument", "(", ")", ";", "if", "(", "shouldAddArtificialRoot", "(", ")", ")", "{", "startElement",...
Method parses JSON and emits SAX events.
[ "Method", "parses", "JSON", "and", "emits", "SAX", "events", "." ]
8fba4f942ebed5d6f7ad851390c634fff8559cac
https://github.com/lukas-krecan/json2xml/blob/8fba4f942ebed5d6f7ad851390c634fff8559cac/src/main/java/net/javacrumbs/json2xml/JsonSaxAdapter.java#L159-L179
train
lukas-krecan/json2xml
src/main/java/net/javacrumbs/json2xml/JsonSaxAdapter.java
JsonSaxAdapter.parseObject
private int parseObject() throws Exception { int elementsWritten = 0; while (jsonParser.nextToken() != null && jsonParser.getCurrentToken() != END_OBJECT) { if (FIELD_NAME.equals(jsonParser.getCurrentToken())) { String elementName = convertName(jsonParser.getCurrentName()); ...
java
private int parseObject() throws Exception { int elementsWritten = 0; while (jsonParser.nextToken() != null && jsonParser.getCurrentToken() != END_OBJECT) { if (FIELD_NAME.equals(jsonParser.getCurrentToken())) { String elementName = convertName(jsonParser.getCurrentName()); ...
[ "private", "int", "parseObject", "(", ")", "throws", "Exception", "{", "int", "elementsWritten", "=", "0", ";", "while", "(", "jsonParser", ".", "nextToken", "(", ")", "!=", "null", "&&", "jsonParser", ".", "getCurrentToken", "(", ")", "!=", "END_OBJECT", ...
Parses generic object. @return number of elements written @throws IOException @throws JsonParseException @throws Exception
[ "Parses", "generic", "object", "." ]
8fba4f942ebed5d6f7ad851390c634fff8559cac
https://github.com/lukas-krecan/json2xml/blob/8fba4f942ebed5d6f7ad851390c634fff8559cac/src/main/java/net/javacrumbs/json2xml/JsonSaxAdapter.java#L193-L209
train
lukas-krecan/json2xml
src/main/java/net/javacrumbs/json2xml/JsonSaxAdapter.java
JsonSaxAdapter.parseElement
private void parseElement(final String elementName, final boolean inArray) throws Exception { JsonToken currentToken = jsonParser.getCurrentToken(); if (inArray) { startElement(elementName); } if (START_OBJECT.equals(currentToken)) { parseObject(); } else ...
java
private void parseElement(final String elementName, final boolean inArray) throws Exception { JsonToken currentToken = jsonParser.getCurrentToken(); if (inArray) { startElement(elementName); } if (START_OBJECT.equals(currentToken)) { parseObject(); } else ...
[ "private", "void", "parseElement", "(", "final", "String", "elementName", ",", "final", "boolean", "inArray", ")", "throws", "Exception", "{", "JsonToken", "currentToken", "=", "jsonParser", ".", "getCurrentToken", "(", ")", ";", "if", "(", "inArray", ")", "{"...
Pares JSON element. @param elementName @param inArray if the element is in an array @throws Exception
[ "Pares", "JSON", "element", "." ]
8fba4f942ebed5d6f7ad851390c634fff8559cac
https://github.com/lukas-krecan/json2xml/blob/8fba4f942ebed5d6f7ad851390c634fff8559cac/src/main/java/net/javacrumbs/json2xml/JsonSaxAdapter.java#L225-L240
train
lukas-krecan/json2xml
src/main/java/net/javacrumbs/json2xml/JsonXmlHelper.java
JsonXmlHelper.convertToDom
public static Node convertToDom(final String json, final String namespace, final boolean addTypeAttributes, final String artificialRootName) throws TransformerConfigurationException, TransformerException { Transformer transformer = TransformerFactory.newInstance().newTransformer(); InputSource source = ...
java
public static Node convertToDom(final String json, final String namespace, final boolean addTypeAttributes, final String artificialRootName) throws TransformerConfigurationException, TransformerException { Transformer transformer = TransformerFactory.newInstance().newTransformer(); InputSource source = ...
[ "public", "static", "Node", "convertToDom", "(", "final", "String", "json", ",", "final", "String", "namespace", ",", "final", "boolean", "addTypeAttributes", ",", "final", "String", "artificialRootName", ")", "throws", "TransformerConfigurationException", ",", "Trans...
Helper method to convert JSON string to XML DOM @param json String containing the json document @param namespace Namespace that will contain the generated dom nodes @param addTypeAttributes Set to true to generate type attributes @param artificialRootName Name of the artificial root element node @return Document DOM n...
[ "Helper", "method", "to", "convert", "JSON", "string", "to", "XML", "DOM" ]
8fba4f942ebed5d6f7ad851390c634fff8559cac
https://github.com/lukas-krecan/json2xml/blob/8fba4f942ebed5d6f7ad851390c634fff8559cac/src/main/java/net/javacrumbs/json2xml/JsonXmlHelper.java#L67-L73
train
lukas-krecan/json2xml
src/main/java/net/javacrumbs/json2xml/JsonXmlHelper.java
JsonXmlHelper.convertElement
private static void convertElement(JsonGenerator generator, Element element, boolean isArrayItem, ElementNameConverter converter) throws IOException { TYPE type = toTYPE(element.getAttribute("type")); String name = element.getTagName(); if (!isArrayItem) { generator.writeFieldName(c...
java
private static void convertElement(JsonGenerator generator, Element element, boolean isArrayItem, ElementNameConverter converter) throws IOException { TYPE type = toTYPE(element.getAttribute("type")); String name = element.getTagName(); if (!isArrayItem) { generator.writeFieldName(c...
[ "private", "static", "void", "convertElement", "(", "JsonGenerator", "generator", ",", "Element", "element", ",", "boolean", "isArrayItem", ",", "ElementNameConverter", "converter", ")", "throws", "IOException", "{", "TYPE", "type", "=", "toTYPE", "(", "element", ...
Convert a DOM element to Json, with special handling for arrays since arrays don't exist in XML. @param generator @param element @param isArrayItem @throws IOException
[ "Convert", "a", "DOM", "element", "to", "Json", "with", "special", "handling", "for", "arrays", "since", "arrays", "don", "t", "exist", "in", "XML", "." ]
8fba4f942ebed5d6f7ad851390c634fff8559cac
https://github.com/lukas-krecan/json2xml/blob/8fba4f942ebed5d6f7ad851390c634fff8559cac/src/main/java/net/javacrumbs/json2xml/JsonXmlHelper.java#L130-L163
train
lukas-krecan/json2xml
src/main/java/net/javacrumbs/json2xml/JsonXmlHelper.java
JsonXmlHelper.convertChildren
private static void convertChildren(JsonGenerator generator, Element element, boolean isArray, ElementNameConverter converter) throws IOException { NodeList list = element.getChildNodes(); int len = list.getLength(); for (int i = 0; i < len; i++) { Node node = list.item(i); ...
java
private static void convertChildren(JsonGenerator generator, Element element, boolean isArray, ElementNameConverter converter) throws IOException { NodeList list = element.getChildNodes(); int len = list.getLength(); for (int i = 0; i < len; i++) { Node node = list.item(i); ...
[ "private", "static", "void", "convertChildren", "(", "JsonGenerator", "generator", ",", "Element", "element", ",", "boolean", "isArray", ",", "ElementNameConverter", "converter", ")", "throws", "IOException", "{", "NodeList", "list", "=", "element", ".", "getChildNo...
Method to recurse within children elements and convert them to JSON too. @param generator @param element @param isArray @throws IOException
[ "Method", "to", "recurse", "within", "children", "elements", "and", "convert", "them", "to", "JSON", "too", "." ]
8fba4f942ebed5d6f7ad851390c634fff8559cac
https://github.com/lukas-krecan/json2xml/blob/8fba4f942ebed5d6f7ad851390c634fff8559cac/src/main/java/net/javacrumbs/json2xml/JsonXmlHelper.java#L172-L181
train
coveo/fmt-maven-plugin
src/main/java/com/coveo/Check.java
Check.postExecute
@Override protected void postExecute(List<String> filesProcessed, int nonComplyingFiles) throws MojoFailureException { if (nonComplyingFiles > 0) { String message = "Found " + nonComplyingFiles + " non-complying files, failing build"; getLog().error(message); getLog().error("To fix formatt...
java
@Override protected void postExecute(List<String> filesProcessed, int nonComplyingFiles) throws MojoFailureException { if (nonComplyingFiles > 0) { String message = "Found " + nonComplyingFiles + " non-complying files, failing build"; getLog().error(message); getLog().error("To fix formatt...
[ "@", "Override", "protected", "void", "postExecute", "(", "List", "<", "String", ">", "filesProcessed", ",", "int", "nonComplyingFiles", ")", "throws", "MojoFailureException", "{", "if", "(", "nonComplyingFiles", ">", "0", ")", "{", "String", "message", "=", "...
Post Execute action. It is called at the end of the execute method. Subclasses can add extra checks. @param filesProcessed the list of processed files by the formatter @param nonComplyingFiles the number of files that are not compliant @throws MojoFailureException if there is an exception
[ "Post", "Execute", "action", ".", "It", "is", "called", "at", "the", "end", "of", "the", "execute", "method", ".", "Subclasses", "can", "add", "extra", "checks", "." ]
9368be6985ecc2126c875ff4aabe647c7e57ecca
https://github.com/coveo/fmt-maven-plugin/blob/9368be6985ecc2126c875ff4aabe647c7e57ecca/src/main/java/com/coveo/Check.java#L42-L65
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/slim/StringFixture.java
StringFixture.lengthOf
public int lengthOf(String value) { int length = 0; if (value != null) { length = value.length(); } return length; }
java
public int lengthOf(String value) { int length = 0; if (value != null) { length = value.length(); } return length; }
[ "public", "int", "lengthOf", "(", "String", "value", ")", "{", "int", "length", "=", "0", ";", "if", "(", "value", "!=", "null", ")", "{", "length", "=", "value", ".", "length", "(", ")", ";", "}", "return", "length", ";", "}" ]
Determines length of string. @param value value to determine length of @return length of value
[ "Determines", "length", "of", "string", "." ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/slim/StringFixture.java#L28-L34
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/slim/StringFixture.java
StringFixture.textContains
public boolean textContains(String value, String expectedSubstring) { boolean result = false; if (value != null) { result = value.contains(expectedSubstring); } return result; }
java
public boolean textContains(String value, String expectedSubstring) { boolean result = false; if (value != null) { result = value.contains(expectedSubstring); } return result; }
[ "public", "boolean", "textContains", "(", "String", "value", ",", "String", "expectedSubstring", ")", "{", "boolean", "result", "=", "false", ";", "if", "(", "value", "!=", "null", ")", "{", "result", "=", "value", ".", "contains", "(", "expectedSubstring", ...
Checks whether values contains a specific sub string. @param value value to find substring in. @param expectedSubstring text that is expected to occur in value. @return true if value contained the expected substring.
[ "Checks", "whether", "values", "contains", "a", "specific", "sub", "string", "." ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/slim/StringFixture.java#L72-L78
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/slim/StringFixture.java
StringFixture.convertToUpperCase
public String convertToUpperCase(String value) { String result = null; if (value != null) { result = value.toUpperCase(); } return result; }
java
public String convertToUpperCase(String value) { String result = null; if (value != null) { result = value.toUpperCase(); } return result; }
[ "public", "String", "convertToUpperCase", "(", "String", "value", ")", "{", "String", "result", "=", "null", ";", "if", "(", "value", "!=", "null", ")", "{", "result", "=", "value", ".", "toUpperCase", "(", ")", ";", "}", "return", "result", ";", "}" ]
Converts the value to upper case. @param value value to put in upper case. @return value in capital letters.
[ "Converts", "the", "value", "to", "upper", "case", "." ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/slim/StringFixture.java#L85-L91
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/slim/StringFixture.java
StringFixture.convertToLowerCase
public String convertToLowerCase(String value) { String result = null; if (value != null) { result = value.toLowerCase(); } return result; }
java
public String convertToLowerCase(String value) { String result = null; if (value != null) { result = value.toLowerCase(); } return result; }
[ "public", "String", "convertToLowerCase", "(", "String", "value", ")", "{", "String", "result", "=", "null", ";", "if", "(", "value", "!=", "null", ")", "{", "result", "=", "value", ".", "toLowerCase", "(", ")", ";", "}", "return", "result", ";", "}" ]
Converts the value to lower case. @param value value to put in lower case. @return value with all capital letters replaced by normal letters.
[ "Converts", "the", "value", "to", "lower", "case", "." ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/slim/StringFixture.java#L98-L104
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/slim/StringFixture.java
StringFixture.replaceAllInWith
public String replaceAllInWith(String regEx, String value, String replace) { String result = null; if (value != null) { if (replace == null) { // empty cell in table is sent as null replace = ""; } result = getMatcher(regEx, value).repl...
java
public String replaceAllInWith(String regEx, String value, String replace) { String result = null; if (value != null) { if (replace == null) { // empty cell in table is sent as null replace = ""; } result = getMatcher(regEx, value).repl...
[ "public", "String", "replaceAllInWith", "(", "String", "regEx", ",", "String", "value", ",", "String", "replace", ")", "{", "String", "result", "=", "null", ";", "if", "(", "value", "!=", "null", ")", "{", "if", "(", "replace", "==", "null", ")", "{", ...
Replaces all occurrences of the regular expression in the value with the replacement value. @param regEx regular expression to match. @param value value to replace in. @param replace replacement pattern. @return result.
[ "Replaces", "all", "occurrences", "of", "the", "regular", "expression", "in", "the", "value", "with", "the", "replacement", "value", "." ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/slim/StringFixture.java#L166-L176
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/slim/StringFixture.java
StringFixture.extractIntFromUsingGroup
public Integer extractIntFromUsingGroup(String value, String regEx, int groupIndex) { Integer result = null; if (value != null) { Matcher matcher = getMatcher(regEx, value); if (matcher.matches()) { String intStr = matcher.group(groupIndex); result...
java
public Integer extractIntFromUsingGroup(String value, String regEx, int groupIndex) { Integer result = null; if (value != null) { Matcher matcher = getMatcher(regEx, value); if (matcher.matches()) { String intStr = matcher.group(groupIndex); result...
[ "public", "Integer", "extractIntFromUsingGroup", "(", "String", "value", ",", "String", "regEx", ",", "int", "groupIndex", ")", "{", "Integer", "result", "=", "null", ";", "if", "(", "value", "!=", "null", ")", "{", "Matcher", "matcher", "=", "getMatcher", ...
Extracts a whole number for a string using a regular expression. @param value input string. @param regEx regular expression to match against value. @param groupIndex index of group in regular expression containing the number. @return extracted number.
[ "Extracts", "a", "whole", "number", "for", "a", "string", "using", "a", "regular", "expression", "." ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/slim/StringFixture.java#L185-L195
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/XmlHttpResponse.java
XmlHttpResponse.getRawXPath
public String getRawXPath(String xPathExpr, Object... params) { return getRawXPath(getResponse(), xPathExpr, params); }
java
public String getRawXPath(String xPathExpr, Object... params) { return getRawXPath(getResponse(), xPathExpr, params); }
[ "public", "String", "getRawXPath", "(", "String", "xPathExpr", ",", "Object", "...", "params", ")", "{", "return", "getRawXPath", "(", "getResponse", "(", ")", ",", "xPathExpr", ",", "params", ")", ";", "}" ]
Gets XPath value without checking whether response is valid. @param xPathExpr expression to apply to response. @param params values to put inside expression before evaluation @return result of xpath expression.
[ "Gets", "XPath", "value", "without", "checking", "whether", "response", "is", "valid", "." ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/XmlHttpResponse.java#L63-L65
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/XmlHttpResponse.java
XmlHttpResponse.checkXPaths
public XPathCheckResult checkXPaths(Map<String, Object> values, Map<String, String> expressionsToCheck) { XPathCheckResult result; String content = getResponse(); if (content == null) { result = new XPathCheckResult(); result.setMismatchDetail("NOK: no response available....
java
public XPathCheckResult checkXPaths(Map<String, Object> values, Map<String, String> expressionsToCheck) { XPathCheckResult result; String content = getResponse(); if (content == null) { result = new XPathCheckResult(); result.setMismatchDetail("NOK: no response available....
[ "public", "XPathCheckResult", "checkXPaths", "(", "Map", "<", "String", ",", "Object", ">", "values", ",", "Map", "<", "String", ",", "String", ">", "expressionsToCheck", ")", "{", "XPathCheckResult", "result", ";", "String", "content", "=", "getResponse", "("...
Checks whether input values are present at correct locations in the response. @param values keyName -> value, input parameters supplied to get request. @param expressionsToCheck xpath -> keyName, each xpath in this map is expected to evaluate to the value present in values for that key (i.e. values[keyName]) @return OK...
[ "Checks", "whether", "input", "values", "are", "present", "at", "correct", "locations", "in", "the", "response", "." ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/XmlHttpResponse.java#L143-L155
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/selenium/by/LazyPatternBy.java
LazyPatternBy.fillPattern
private String fillPattern(String pattern, String[] parameters) { boolean containsSingleQuote = false; boolean containsDoubleQuote = false; Object[] escapedParams = new Object[parameters.length]; for (int i = 0; i < parameters.length; i++) { String param = parameters[i]; ...
java
private String fillPattern(String pattern, String[] parameters) { boolean containsSingleQuote = false; boolean containsDoubleQuote = false; Object[] escapedParams = new Object[parameters.length]; for (int i = 0; i < parameters.length; i++) { String param = parameters[i]; ...
[ "private", "String", "fillPattern", "(", "String", "pattern", ",", "String", "[", "]", "parameters", ")", "{", "boolean", "containsSingleQuote", "=", "false", ";", "boolean", "containsDoubleQuote", "=", "false", ";", "Object", "[", "]", "escapedParams", "=", "...
Fills in placeholders in pattern using the supplied parameters. @param pattern pattern to fill (in String.format style). @param parameters parameters to use. @return filled in pattern.
[ "Fills", "in", "placeholders", "in", "pattern", "using", "the", "supplied", "parameters", "." ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/selenium/by/LazyPatternBy.java#L86-L106
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/slim/XmlFixture.java
XmlFixture.registerPrefixForNamespace
public void registerPrefixForNamespace(String prefix, String namespace) { getEnvironment().registerNamespace(prefix, getUrl(namespace)); }
java
public void registerPrefixForNamespace(String prefix, String namespace) { getEnvironment().registerNamespace(prefix, getUrl(namespace)); }
[ "public", "void", "registerPrefixForNamespace", "(", "String", "prefix", ",", "String", "namespace", ")", "{", "getEnvironment", "(", ")", ".", "registerNamespace", "(", "prefix", ",", "getUrl", "(", "namespace", ")", ")", ";", "}" ]
Register a prefix to use in XPath expressions. @param prefix prefix to be used in xPath expressions. @param namespace XML namespace the prefix should point to.
[ "Register", "a", "prefix", "to", "use", "in", "XPath", "expressions", "." ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/slim/XmlFixture.java#L52-L54
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/slim/XmlFixture.java
XmlFixture.validateAgainstXsdFile
public boolean validateAgainstXsdFile(String xsdFileName) { String xsdContent = new FileFixture().textIn(xsdFileName); return new XMLValidator().validateAgainst(content, xsdContent); }
java
public boolean validateAgainstXsdFile(String xsdFileName) { String xsdContent = new FileFixture().textIn(xsdFileName); return new XMLValidator().validateAgainst(content, xsdContent); }
[ "public", "boolean", "validateAgainstXsdFile", "(", "String", "xsdFileName", ")", "{", "String", "xsdContent", "=", "new", "FileFixture", "(", ")", ".", "textIn", "(", "xsdFileName", ")", ";", "return", "new", "XMLValidator", "(", ")", ".", "validateAgainst", ...
Validate the loaded xml against a schema in file xsdFileName @param xsdFileName filename of the xsd to use @return true if the xml validates against the schema. Throws a descriptive exception otherwise
[ "Validate", "the", "loaded", "xml", "against", "a", "schema", "in", "file", "xsdFileName" ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/slim/XmlFixture.java#L98-L101
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/slim/XmlFixture.java
XmlFixture.validateAgainstXsd
public boolean validateAgainstXsd(String xsdSchema) { String xsdContent = cleanupValue(xsdSchema); return new XMLValidator().validateAgainst(content, xsdContent); }
java
public boolean validateAgainstXsd(String xsdSchema) { String xsdContent = cleanupValue(xsdSchema); return new XMLValidator().validateAgainst(content, xsdContent); }
[ "public", "boolean", "validateAgainstXsd", "(", "String", "xsdSchema", ")", "{", "String", "xsdContent", "=", "cleanupValue", "(", "xsdSchema", ")", ";", "return", "new", "XMLValidator", "(", ")", ".", "validateAgainst", "(", "content", ",", "xsdContent", ")", ...
Validate the loaded xml against a schema provided from the wiki @param xsdSchema xsd schema to use @return true if the xml validates against the schema. Throws a descriptive exception otherwise
[ "Validate", "the", "loaded", "xml", "against", "a", "schema", "provided", "from", "the", "wiki" ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/slim/XmlFixture.java#L108-L111
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/CalendarUtil.java
CalendarUtil.addDays
public XMLGregorianCalendar addDays(final XMLGregorianCalendar cal, final int amount) { XMLGregorianCalendar to = buildXMLGregorianCalendarDate(cal); // Add amount of months to.add(addDays(amount)); return to; }
java
public XMLGregorianCalendar addDays(final XMLGregorianCalendar cal, final int amount) { XMLGregorianCalendar to = buildXMLGregorianCalendarDate(cal); // Add amount of months to.add(addDays(amount)); return to; }
[ "public", "XMLGregorianCalendar", "addDays", "(", "final", "XMLGregorianCalendar", "cal", ",", "final", "int", "amount", ")", "{", "XMLGregorianCalendar", "to", "=", "buildXMLGregorianCalendarDate", "(", "cal", ")", ";", "// Add amount of months", "to", ".", "add", ...
Add Days to a Gregorian Calendar. @param cal The XMLGregorianCalendar source @param amount The amount of days. Can be a negative Integer to substract. @return A XMLGregorianCalendar with the new Date
[ "Add", "Days", "to", "a", "Gregorian", "Calendar", "." ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/CalendarUtil.java#L33-L38
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/CalendarUtil.java
CalendarUtil.addMonths
public XMLGregorianCalendar addMonths(final XMLGregorianCalendar cal, final int amount) { XMLGregorianCalendar to = buildXMLGregorianCalendarDate(cal); // Add amount of months to.add(addMonths(amount)); return to; }
java
public XMLGregorianCalendar addMonths(final XMLGregorianCalendar cal, final int amount) { XMLGregorianCalendar to = buildXMLGregorianCalendarDate(cal); // Add amount of months to.add(addMonths(amount)); return to; }
[ "public", "XMLGregorianCalendar", "addMonths", "(", "final", "XMLGregorianCalendar", "cal", ",", "final", "int", "amount", ")", "{", "XMLGregorianCalendar", "to", "=", "buildXMLGregorianCalendarDate", "(", "cal", ")", ";", "// Add amount of months", "to", ".", "add", ...
Add Months to a Gregorian Calendar. @param cal The XMLGregorianCalendar source @param amount The amount of months. Can be a negative Integer to substract. @return A XMLGregorianCalendar with the new Date
[ "Add", "Months", "to", "a", "Gregorian", "Calendar", "." ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/CalendarUtil.java#L48-L53
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/CalendarUtil.java
CalendarUtil.addYears
public XMLGregorianCalendar addYears(final XMLGregorianCalendar cal, final int amount) { XMLGregorianCalendar to = buildXMLGregorianCalendarDate(cal); // Add amount of months to.add(addYears(amount)); return to; }
java
public XMLGregorianCalendar addYears(final XMLGregorianCalendar cal, final int amount) { XMLGregorianCalendar to = buildXMLGregorianCalendarDate(cal); // Add amount of months to.add(addYears(amount)); return to; }
[ "public", "XMLGregorianCalendar", "addYears", "(", "final", "XMLGregorianCalendar", "cal", ",", "final", "int", "amount", ")", "{", "XMLGregorianCalendar", "to", "=", "buildXMLGregorianCalendarDate", "(", "cal", ")", ";", "// Add amount of months", "to", ".", "add", ...
Add Years to a Gregorian Calendar. @param cal The XMLGregorianCalendar source @param amount The amount of years. Can be a negative Integer to substract. @return A XMLGregorianCalendar with the new Date
[ "Add", "Years", "to", "a", "Gregorian", "Calendar", "." ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/CalendarUtil.java#L63-L68
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/CalendarUtil.java
CalendarUtil.getDurationInYears
public int getDurationInYears(XMLGregorianCalendar startDate, XMLGregorianCalendar endDate) { int startYear = startDate.getYear(); final int dec = 12; if (startDate.getMonth() == dec) { // started in December, increase year with one startYear++; } int endY...
java
public int getDurationInYears(XMLGregorianCalendar startDate, XMLGregorianCalendar endDate) { int startYear = startDate.getYear(); final int dec = 12; if (startDate.getMonth() == dec) { // started in December, increase year with one startYear++; } int endY...
[ "public", "int", "getDurationInYears", "(", "XMLGregorianCalendar", "startDate", ",", "XMLGregorianCalendar", "endDate", ")", "{", "int", "startYear", "=", "startDate", ".", "getYear", "(", ")", ";", "final", "int", "dec", "=", "12", ";", "if", "(", "startDate...
Determines number of years between two dates so that premium duration can be established. @param startDate start date of a period (e.g. date of birth of insured party). @param endDate end date (e.g. premium end date of an insurance). @return number of years between start and end.
[ "Determines", "number", "of", "years", "between", "two", "dates", "so", "that", "premium", "duration", "can", "be", "established", "." ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/CalendarUtil.java#L150-L159
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/CalendarUtil.java
CalendarUtil.addDays
Duration addDays(final int amount) { Duration duration; if (amount < 0) { duration = getDatatypeFactory().newDuration(false, 0, 0, Math.abs(amount), 0, 0, 0); } else { duration = getDatatypeFactory().newDuration(true, 0, 0, amount, 0, 0, 0); } return durat...
java
Duration addDays(final int amount) { Duration duration; if (amount < 0) { duration = getDatatypeFactory().newDuration(false, 0, 0, Math.abs(amount), 0, 0, 0); } else { duration = getDatatypeFactory().newDuration(true, 0, 0, amount, 0, 0, 0); } return durat...
[ "Duration", "addDays", "(", "final", "int", "amount", ")", "{", "Duration", "duration", ";", "if", "(", "amount", "<", "0", ")", "{", "duration", "=", "getDatatypeFactory", "(", ")", ".", "newDuration", "(", "false", ",", "0", ",", "0", ",", "Math", ...
Create a Duration of x days. @param amount The number of days. Use negative numbers to substract days @return a Duration
[ "Create", "a", "Duration", "of", "x", "days", "." ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/CalendarUtil.java#L179-L187
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/JsonHelper.java
JsonHelper.format
public String format(String json) { String result = null; if (json != null){ if (json.startsWith("{")) { result = new JSONObject(json).toString(4); } else if (json.startsWith("[")) { JSONObject jsonObject = new JSONObject("{'a': " + json + "}"); ...
java
public String format(String json) { String result = null; if (json != null){ if (json.startsWith("{")) { result = new JSONObject(json).toString(4); } else if (json.startsWith("[")) { JSONObject jsonObject = new JSONObject("{'a': " + json + "}"); ...
[ "public", "String", "format", "(", "String", "json", ")", "{", "String", "result", "=", "null", ";", "if", "(", "json", "!=", "null", ")", "{", "if", "(", "json", ".", "startsWith", "(", "\"{\"", ")", ")", "{", "result", "=", "new", "JSONObject", "...
Creates formatted version of the supplied JSON. @param json JSON to format. @return formatted version.
[ "Creates", "formatted", "version", "of", "the", "supplied", "JSON", "." ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/JsonHelper.java#L25-L37
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/JsonHelper.java
JsonHelper.jsonStringToMap
public Map<String, Object> jsonStringToMap(String jsonString) { if (StringUtils.isEmpty(jsonString)) { return null; } JSONObject jsonObject; try { jsonObject = new JSONObject(jsonString); return jsonObjectToMap(jsonObject); } catch (JSONExcepti...
java
public Map<String, Object> jsonStringToMap(String jsonString) { if (StringUtils.isEmpty(jsonString)) { return null; } JSONObject jsonObject; try { jsonObject = new JSONObject(jsonString); return jsonObjectToMap(jsonObject); } catch (JSONExcepti...
[ "public", "Map", "<", "String", ",", "Object", ">", "jsonStringToMap", "(", "String", "jsonString", ")", "{", "if", "(", "StringUtils", ".", "isEmpty", "(", "jsonString", ")", ")", "{", "return", "null", ";", "}", "JSONObject", "jsonObject", ";", "try", ...
Interprets supplied String as Json and converts it into a Map. @param jsonString string to interpret as Json object. @return property -> value.
[ "Interprets", "supplied", "String", "as", "Json", "and", "converts", "it", "into", "a", "Map", "." ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/JsonHelper.java#L44-L55
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/JsonHelper.java
JsonHelper.sort
public String sort(String json, String arrayExpr, String nestedPathExpr) { JsonPathHelper pathHelper = getPathHelper(); Object topLevel = pathHelper.getJsonPath(json, arrayExpr); if (topLevel instanceof JSONArray) { JSONArray a = (JSONArray) topLevel; JSONArray aSorted = ...
java
public String sort(String json, String arrayExpr, String nestedPathExpr) { JsonPathHelper pathHelper = getPathHelper(); Object topLevel = pathHelper.getJsonPath(json, arrayExpr); if (topLevel instanceof JSONArray) { JSONArray a = (JSONArray) topLevel; JSONArray aSorted = ...
[ "public", "String", "sort", "(", "String", "json", ",", "String", "arrayExpr", ",", "String", "nestedPathExpr", ")", "{", "JsonPathHelper", "pathHelper", "=", "getPathHelper", "(", ")", ";", "Object", "topLevel", "=", "pathHelper", ".", "getJsonPath", "(", "js...
Sorts an array in a json object. @param json json document. @param arrayExpr JsonPath expression to select array to sort. @param nestedPathExpr JsonPath expression to select value of array's elements to sort them on. @return json document with specified array sorted.
[ "Sorts", "an", "array", "in", "a", "json", "object", "." ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/JsonHelper.java#L88-L98
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/selenium/SeleniumHelper.java
SeleniumHelper.setWebDriver
public void setWebDriver(WebDriver aWebDriver, int defaultTimeout) { if (webDriver != null && !webDriver.equals(aWebDriver)) { webDriver.quit(); } webDriver = aWebDriver; if (webDriver == null) { webDriverWait = null; } else { webDriverWait = ...
java
public void setWebDriver(WebDriver aWebDriver, int defaultTimeout) { if (webDriver != null && !webDriver.equals(aWebDriver)) { webDriver.quit(); } webDriver = aWebDriver; if (webDriver == null) { webDriverWait = null; } else { webDriverWait = ...
[ "public", "void", "setWebDriver", "(", "WebDriver", "aWebDriver", ",", "int", "defaultTimeout", ")", "{", "if", "(", "webDriver", "!=", "null", "&&", "!", "webDriver", ".", "equals", "(", "aWebDriver", ")", ")", "{", "webDriver", ".", "quit", "(", ")", "...
Sets up webDriver to be used. @param aWebDriver web driver to use. @param defaultTimeout default timeout to wait, in seconds.
[ "Sets", "up", "webDriver", "to", "be", "used", "." ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/selenium/SeleniumHelper.java#L101-L112
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/selenium/SeleniumHelper.java
SeleniumHelper.getElementToCheckVisibility
public T getElementToCheckVisibility(String place) { return findByTechnicalSelectorOr(place, () -> { T result = findElement(TextBy.partial(place)); if (!IsDisplayedFilter.mayPass(result)) { result = findElement(ToClickBy.heuristic(place)); } return...
java
public T getElementToCheckVisibility(String place) { return findByTechnicalSelectorOr(place, () -> { T result = findElement(TextBy.partial(place)); if (!IsDisplayedFilter.mayPass(result)) { result = findElement(ToClickBy.heuristic(place)); } return...
[ "public", "T", "getElementToCheckVisibility", "(", "String", "place", ")", "{", "return", "findByTechnicalSelectorOr", "(", "place", ",", "(", ")", "->", "{", "T", "result", "=", "findElement", "(", "TextBy", ".", "partial", "(", "place", ")", ")", ";", "i...
Finds element to determine whether it is on screen, by searching in multiple locations. @param place identifier for element. @return first interactable element found, first element found if no interactable element could be found, null if none could be found.
[ "Finds", "element", "to", "determine", "whether", "it", "is", "on", "screen", "by", "searching", "in", "multiple", "locations", "." ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/selenium/SeleniumHelper.java#L175-L183
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/selenium/SeleniumHelper.java
SeleniumHelper.getNumberFor
public Integer getNumberFor(WebElement element) { Integer number = null; if ("li".equalsIgnoreCase(element.getTagName()) && element.isDisplayed()) { int num; String ownVal = element.getAttribute("value"); if (ownVal != null && !"0".equals(ownVal)) { ...
java
public Integer getNumberFor(WebElement element) { Integer number = null; if ("li".equalsIgnoreCase(element.getTagName()) && element.isDisplayed()) { int num; String ownVal = element.getAttribute("value"); if (ownVal != null && !"0".equals(ownVal)) { ...
[ "public", "Integer", "getNumberFor", "(", "WebElement", "element", ")", "{", "Integer", "number", "=", "null", ";", "if", "(", "\"li\"", ".", "equalsIgnoreCase", "(", "element", ".", "getTagName", "(", ")", ")", "&&", "element", ".", "isDisplayed", "(", ")...
Determines number displayed for item in ordered list. @param element ordered list item. @return number, if one could be determined.
[ "Determines", "number", "displayed", "for", "item", "in", "ordered", "list", "." ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/selenium/SeleniumHelper.java#L233-L262
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/selenium/SeleniumHelper.java
SeleniumHelper.getAvailableOptions
public ArrayList<String> getAvailableOptions(WebElement element) { ArrayList<String> result = null; if (isInteractable(element) && "select".equalsIgnoreCase(element.getTagName())) { result = new ArrayList<String>(); List<WebElement> options = element.findElements(...
java
public ArrayList<String> getAvailableOptions(WebElement element) { ArrayList<String> result = null; if (isInteractable(element) && "select".equalsIgnoreCase(element.getTagName())) { result = new ArrayList<String>(); List<WebElement> options = element.findElements(...
[ "public", "ArrayList", "<", "String", ">", "getAvailableOptions", "(", "WebElement", "element", ")", "{", "ArrayList", "<", "String", ">", "result", "=", "null", ";", "if", "(", "isInteractable", "(", "element", ")", "&&", "\"select\"", ".", "equalsIgnoreCase"...
Returns the texts of all available options for the supplied select element. @param element select element to find options for. @return text per option.
[ "Returns", "the", "texts", "of", "all", "available", "options", "for", "the", "supplied", "select", "element", "." ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/selenium/SeleniumHelper.java#L281-L294
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/selenium/SeleniumHelper.java
SeleniumHelper.getText
public String getText(WebElement element) { String text = element.getText(); if (text != null) { // Safari driver does not return &nbsp; as normal spacce, while others do text = text.replace(NON_BREAKING_SPACE, ' '); // Safari driver does not return trim, while others...
java
public String getText(WebElement element) { String text = element.getText(); if (text != null) { // Safari driver does not return &nbsp; as normal spacce, while others do text = text.replace(NON_BREAKING_SPACE, ' '); // Safari driver does not return trim, while others...
[ "public", "String", "getText", "(", "WebElement", "element", ")", "{", "String", "text", "=", "element", ".", "getText", "(", ")", ";", "if", "(", "text", "!=", "null", ")", "{", "// Safari driver does not return &nbsp; as normal spacce, while others do", "text", ...
Gets element's text content. @param element element to get text() of. @return text, without trailing whitespace and with &nbsp; as normal spaces.
[ "Gets", "element", "s", "text", "content", "." ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/selenium/SeleniumHelper.java#L375-L384
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/selenium/SeleniumHelper.java
SeleniumHelper.setHiddenInputValue
public boolean setHiddenInputValue(String idOrName, String value) { T element = findElement(By.id(idOrName)); if (element == null) { element = findElement(By.name(idOrName)); if (element != null) { executeJavascript("document.getElementsByName('%s')[0].value='%s'"...
java
public boolean setHiddenInputValue(String idOrName, String value) { T element = findElement(By.id(idOrName)); if (element == null) { element = findElement(By.name(idOrName)); if (element != null) { executeJavascript("document.getElementsByName('%s')[0].value='%s'"...
[ "public", "boolean", "setHiddenInputValue", "(", "String", "idOrName", ",", "String", "value", ")", "{", "T", "element", "=", "findElement", "(", "By", ".", "id", "(", "idOrName", ")", ")", ";", "if", "(", "element", "==", "null", ")", "{", "element", ...
Sets value of hidden input field. @param idOrName id or name of input field to set. @param value value to set. @return whether input field was found.
[ "Sets", "value", "of", "hidden", "input", "field", "." ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/selenium/SeleniumHelper.java#L413-L424
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/selenium/SeleniumHelper.java
SeleniumHelper.executeJavascript
public Object executeJavascript(String statementPattern, Object... parameters) { Object result; String script = String.format(statementPattern, parameters); if (statementPattern.contains("arguments")) { result = executeScript(script, parameters); } else { result =...
java
public Object executeJavascript(String statementPattern, Object... parameters) { Object result; String script = String.format(statementPattern, parameters); if (statementPattern.contains("arguments")) { result = executeScript(script, parameters); } else { result =...
[ "public", "Object", "executeJavascript", "(", "String", "statementPattern", ",", "Object", "...", "parameters", ")", "{", "Object", "result", ";", "String", "script", "=", "String", ".", "format", "(", "statementPattern", ",", "parameters", ")", ";", "if", "("...
Executes Javascript in browser. If statementPattern contains the magic variable 'arguments' the parameters will also be passed to the statement. In the latter case the parameters must be a number, a boolean, a String, WebElement, or a List of any combination of the above. @link http://selenium.googlecode.com/git/docs/a...
[ "Executes", "Javascript", "in", "browser", ".", "If", "statementPattern", "contains", "the", "magic", "variable", "arguments", "the", "parameters", "will", "also", "be", "passed", "to", "the", "statement", ".", "In", "the", "latter", "case", "the", "parameters",...
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/selenium/SeleniumHelper.java#L435-L444
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/selenium/SeleniumHelper.java
SeleniumHelper.setImplicitlyWait
public void setImplicitlyWait(int implicitWait) { try { driver().manage().timeouts().implicitlyWait(implicitWait, TimeUnit.MILLISECONDS); } catch (Exception e) { // https://code.google.com/p/selenium/issues/detail?id=6015 System.err.println("Unable to set implicit tim...
java
public void setImplicitlyWait(int implicitWait) { try { driver().manage().timeouts().implicitlyWait(implicitWait, TimeUnit.MILLISECONDS); } catch (Exception e) { // https://code.google.com/p/selenium/issues/detail?id=6015 System.err.println("Unable to set implicit tim...
[ "public", "void", "setImplicitlyWait", "(", "int", "implicitWait", ")", "{", "try", "{", "driver", "(", ")", ".", "manage", "(", ")", ".", "timeouts", "(", ")", ".", "implicitlyWait", "(", "implicitWait", ",", "TimeUnit", ".", "MILLISECONDS", ")", ";", "...
Sets how long to wait before deciding an element does not exists. @param implicitWait time in milliseconds to wait.
[ "Sets", "how", "long", "to", "wait", "before", "deciding", "an", "element", "does", "not", "exists", "." ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/selenium/SeleniumHelper.java#L509-L516
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/selenium/SeleniumHelper.java
SeleniumHelper.setScriptWait
public void setScriptWait(int scriptTimeout) { try { driver().manage().timeouts().setScriptTimeout(scriptTimeout, TimeUnit.MILLISECONDS); } catch (Exception e) { // https://code.google.com/p/selenium/issues/detail?id=6015 System.err.println("Unable to set script timeo...
java
public void setScriptWait(int scriptTimeout) { try { driver().manage().timeouts().setScriptTimeout(scriptTimeout, TimeUnit.MILLISECONDS); } catch (Exception e) { // https://code.google.com/p/selenium/issues/detail?id=6015 System.err.println("Unable to set script timeo...
[ "public", "void", "setScriptWait", "(", "int", "scriptTimeout", ")", "{", "try", "{", "driver", "(", ")", ".", "manage", "(", ")", ".", "timeouts", "(", ")", ".", "setScriptTimeout", "(", "scriptTimeout", ",", "TimeUnit", ".", "MILLISECONDS", ")", ";", "...
Sets how long to wait when executing asynchronous script calls. @param scriptTimeout time in milliseconds to wait.
[ "Sets", "how", "long", "to", "wait", "when", "executing", "asynchronous", "script", "calls", "." ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/selenium/SeleniumHelper.java#L522-L529
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/selenium/SeleniumHelper.java
SeleniumHelper.setPageLoadWait
public void setPageLoadWait(int pageLoadWait) { try { driver().manage().timeouts().pageLoadTimeout(pageLoadWait, TimeUnit.MILLISECONDS); } catch (Exception e) { // https://code.google.com/p/selenium/issues/detail?id=6015 System.err.println("Unable to set page load tim...
java
public void setPageLoadWait(int pageLoadWait) { try { driver().manage().timeouts().pageLoadTimeout(pageLoadWait, TimeUnit.MILLISECONDS); } catch (Exception e) { // https://code.google.com/p/selenium/issues/detail?id=6015 System.err.println("Unable to set page load tim...
[ "public", "void", "setPageLoadWait", "(", "int", "pageLoadWait", ")", "{", "try", "{", "driver", "(", ")", ".", "manage", "(", ")", ".", "timeouts", "(", ")", ".", "pageLoadTimeout", "(", "pageLoadWait", ",", "TimeUnit", ".", "MILLISECONDS", ")", ";", "}...
Sets how long to wait on opening a page. @param pageLoadWait time in milliseconds to wait.
[ "Sets", "how", "long", "to", "wait", "on", "opening", "a", "page", "." ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/selenium/SeleniumHelper.java#L535-L542
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/selenium/SeleniumHelper.java
SeleniumHelper.clickWithKeyDown
public void clickWithKeyDown(WebElement element, CharSequence key) { getActions().keyDown(key).click(element).keyUp(key).perform(); }
java
public void clickWithKeyDown(WebElement element, CharSequence key) { getActions().keyDown(key).click(element).keyUp(key).perform(); }
[ "public", "void", "clickWithKeyDown", "(", "WebElement", "element", ",", "CharSequence", "key", ")", "{", "getActions", "(", ")", ".", "keyDown", "(", "key", ")", ".", "click", "(", "element", ")", ".", "keyUp", "(", "key", ")", ".", "perform", "(", ")...
Simulates clicking with the supplied key pressed on the supplied element. Key will be released after click. @param element element to click on
[ "Simulates", "clicking", "with", "the", "supplied", "key", "pressed", "on", "the", "supplied", "element", ".", "Key", "will", "be", "released", "after", "click", "." ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/selenium/SeleniumHelper.java#L573-L575
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/selenium/SeleniumHelper.java
SeleniumHelper.dragAndDrop
public void dragAndDrop(WebElement source, WebElement target) { getActions().dragAndDrop(source, target).perform(); }
java
public void dragAndDrop(WebElement source, WebElement target) { getActions().dragAndDrop(source, target).perform(); }
[ "public", "void", "dragAndDrop", "(", "WebElement", "source", ",", "WebElement", "target", ")", "{", "getActions", "(", ")", ".", "dragAndDrop", "(", "source", ",", "target", ")", ".", "perform", "(", ")", ";", "}" ]
Simulates a drag from source element and drop to target element @param source element to start the drag @param target element to end the drag
[ "Simulates", "a", "drag", "from", "source", "element", "and", "drop", "to", "target", "element" ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/selenium/SeleniumHelper.java#L582-L584
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/selenium/SeleniumHelper.java
SeleniumHelper.findByXPath
public T findByXPath(String pattern, String... parameters) { By by = byXpath(pattern, parameters); return findElement(by); }
java
public T findByXPath(String pattern, String... parameters) { By by = byXpath(pattern, parameters); return findElement(by); }
[ "public", "T", "findByXPath", "(", "String", "pattern", ",", "String", "...", "parameters", ")", "{", "By", "by", "=", "byXpath", "(", "pattern", ",", "parameters", ")", ";", "return", "findElement", "(", "by", ")", ";", "}" ]
Finds element using xPath, supporting placeholder replacement. @param pattern basic XPATH, possibly with placeholders. @param parameters values for placeholders. @return element if found, null if none could be found.
[ "Finds", "element", "using", "xPath", "supporting", "placeholder", "replacement", "." ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/selenium/SeleniumHelper.java#L698-L701
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/selenium/SeleniumHelper.java
SeleniumHelper.findElement
public T findElement(By by, int index) { T element = null; List<T> elements = findElements(by); if (elements.size() > index) { element = elements.get(index); } return element; }
java
public T findElement(By by, int index) { T element = null; List<T> elements = findElements(by); if (elements.size() > index) { element = elements.get(index); } return element; }
[ "public", "T", "findElement", "(", "By", "by", ",", "int", "index", ")", "{", "T", "element", "=", "null", ";", "List", "<", "T", ">", "elements", "=", "findElements", "(", "by", ")", ";", "if", "(", "elements", ".", "size", "(", ")", ">", "index...
Finds the nth element matching the By supplied. @param by criteria. @param index (zero based) matching element to return. @return element if found, null if none could be found.
[ "Finds", "the", "nth", "element", "matching", "the", "By", "supplied", "." ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/selenium/SeleniumHelper.java#L797-L804
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/selenium/SeleniumHelper.java
SeleniumHelper.waitUntil
public <T> T waitUntil(int maxSecondsToWait, ExpectedCondition<T> condition) { ExpectedCondition<T> cHandlingStale = getConditionIgnoringStaleElement(condition); FluentWait<WebDriver> wait = waitDriver().withTimeout(Duration.ofSeconds(maxSecondsToWait)); return wait.until(cHandlingStale); }
java
public <T> T waitUntil(int maxSecondsToWait, ExpectedCondition<T> condition) { ExpectedCondition<T> cHandlingStale = getConditionIgnoringStaleElement(condition); FluentWait<WebDriver> wait = waitDriver().withTimeout(Duration.ofSeconds(maxSecondsToWait)); return wait.until(cHandlingStale); }
[ "public", "<", "T", ">", "T", "waitUntil", "(", "int", "maxSecondsToWait", ",", "ExpectedCondition", "<", "T", ">", "condition", ")", "{", "ExpectedCondition", "<", "T", ">", "cHandlingStale", "=", "getConditionIgnoringStaleElement", "(", "condition", ")", ";", ...
Executes condition until it returns a value other than null or false. It does not forward StaleElementReferenceExceptions, but keeps waiting. @param maxSecondsToWait number of seconds to wait at most. @param condition condition to check. @param <T> return type. @return result of condition (if not null). @throws Timeout...
[ "Executes", "condition", "until", "it", "returns", "a", "value", "other", "than", "null", "or", "false", ".", "It", "does", "not", "forward", "StaleElementReferenceExceptions", "but", "keeps", "waiting", "." ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/selenium/SeleniumHelper.java#L903-L907
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/selenium/SeleniumHelper.java
SeleniumHelper.isStaleElementException
public boolean isStaleElementException(WebDriverException e) { boolean result = false; if (e instanceof StaleElementReferenceException) { result = true; } else { String msg = e.getMessage(); if (msg != null) { result = msg.contains("Element doe...
java
public boolean isStaleElementException(WebDriverException e) { boolean result = false; if (e instanceof StaleElementReferenceException) { result = true; } else { String msg = e.getMessage(); if (msg != null) { result = msg.contains("Element doe...
[ "public", "boolean", "isStaleElementException", "(", "WebDriverException", "e", ")", "{", "boolean", "result", "=", "false", ";", "if", "(", "e", "instanceof", "StaleElementReferenceException", ")", "{", "result", "=", "true", ";", "}", "else", "{", "String", ...
Check whether exception indicates a 'stale element', not all drivers throw the exception one would expect... @param e exception caught @return true if exception indicated the element is no longer part of the page in the browser.
[ "Check", "whether", "exception", "indicates", "a", "stale", "element", "not", "all", "drivers", "throw", "the", "exception", "one", "would", "expect", "..." ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/selenium/SeleniumHelper.java#L935-L949
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/selenium/SeleniumHelper.java
SeleniumHelper.findScreenshot
public byte[] findScreenshot(Throwable t) { byte[] result = null; if (t != null) { if (t instanceof ScreenshotException) { String encodedScreenshot = ((ScreenshotException)t).getBase64EncodedScreenshot(); result = Base64.getDecoder().decode(encodedScreenshot);...
java
public byte[] findScreenshot(Throwable t) { byte[] result = null; if (t != null) { if (t instanceof ScreenshotException) { String encodedScreenshot = ((ScreenshotException)t).getBase64EncodedScreenshot(); result = Base64.getDecoder().decode(encodedScreenshot);...
[ "public", "byte", "[", "]", "findScreenshot", "(", "Throwable", "t", ")", "{", "byte", "[", "]", "result", "=", "null", ";", "if", "(", "t", "!=", "null", ")", "{", "if", "(", "t", "instanceof", "ScreenshotException", ")", "{", "String", "encodedScreen...
Finds screenshot embedded in throwable, if any. @param t exception to search in. @return content of screenshot (if any is present), null otherwise.
[ "Finds", "screenshot", "embedded", "in", "throwable", "if", "any", "." ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/selenium/SeleniumHelper.java#L997-L1008
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/selenium/SeleniumHelper.java
SeleniumHelper.switchToFrame
public void switchToFrame(T iframe) { getTargetLocator().frame(iframe); setCurrentContext(null); currentIFramePath.add(iframe); }
java
public void switchToFrame(T iframe) { getTargetLocator().frame(iframe); setCurrentContext(null); currentIFramePath.add(iframe); }
[ "public", "void", "switchToFrame", "(", "T", "iframe", ")", "{", "getTargetLocator", "(", ")", ".", "frame", "(", "iframe", ")", ";", "setCurrentContext", "(", "null", ")", ";", "currentIFramePath", ".", "add", "(", "iframe", ")", ";", "}" ]
Activates specified child frame of current iframe. @param iframe frame to activate.
[ "Activates", "specified", "child", "frame", "of", "current", "iframe", "." ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/selenium/SeleniumHelper.java#L1141-L1145
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/selenium/CookieConverter.java
CookieConverter.copySeleniumCookies
public void copySeleniumCookies(Set<Cookie> browserCookies, CookieStore cookieStore) { for (Cookie browserCookie : browserCookies) { ClientCookie cookie = convertCookie(browserCookie); cookieStore.addCookie(cookie); } }
java
public void copySeleniumCookies(Set<Cookie> browserCookies, CookieStore cookieStore) { for (Cookie browserCookie : browserCookies) { ClientCookie cookie = convertCookie(browserCookie); cookieStore.addCookie(cookie); } }
[ "public", "void", "copySeleniumCookies", "(", "Set", "<", "Cookie", ">", "browserCookies", ",", "CookieStore", "cookieStore", ")", "{", "for", "(", "Cookie", "browserCookie", ":", "browserCookies", ")", "{", "ClientCookie", "cookie", "=", "convertCookie", "(", "...
Converts Selenium cookies to Apache http client ones. @param browserCookies cookies in Selenium format. @param cookieStore store to place coverted cookies in.
[ "Converts", "Selenium", "cookies", "to", "Apache", "http", "client", "ones", "." ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/selenium/CookieConverter.java#L19-L24
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/selenium/CookieConverter.java
CookieConverter.convertCookie
protected ClientCookie convertCookie(Cookie browserCookie) { BasicClientCookie cookie = new BasicClientCookie(browserCookie.getName(), browserCookie.getValue()); String domain = browserCookie.getDomain(); if (domain != null && domain.startsWith(".")) { // http client does not like do...
java
protected ClientCookie convertCookie(Cookie browserCookie) { BasicClientCookie cookie = new BasicClientCookie(browserCookie.getName(), browserCookie.getValue()); String domain = browserCookie.getDomain(); if (domain != null && domain.startsWith(".")) { // http client does not like do...
[ "protected", "ClientCookie", "convertCookie", "(", "Cookie", "browserCookie", ")", "{", "BasicClientCookie", "cookie", "=", "new", "BasicClientCookie", "(", "browserCookie", ".", "getName", "(", ")", ",", "browserCookie", ".", "getValue", "(", ")", ")", ";", "St...
Converts Selenium cookie to Apache http client. @param browserCookie selenium cookie. @return http client format.
[ "Converts", "Selenium", "cookie", "to", "Apache", "http", "client", "." ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/selenium/CookieConverter.java#L31-L46
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/HttpServer.java
HttpServer.waitForRequest
public T waitForRequest(long maxWait) { long start = System.currentTimeMillis(); try { while (requestsReceived.get() < 1 && (System.currentTimeMillis() - start) < maxWait) { try { Thread.sleep(50); } catch (InterruptedEx...
java
public T waitForRequest(long maxWait) { long start = System.currentTimeMillis(); try { while (requestsReceived.get() < 1 && (System.currentTimeMillis() - start) < maxWait) { try { Thread.sleep(50); } catch (InterruptedEx...
[ "public", "T", "waitForRequest", "(", "long", "maxWait", ")", "{", "long", "start", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "try", "{", "while", "(", "requestsReceived", ".", "get", "(", ")", "<", "1", "&&", "(", "System", ".", "current...
Waits until at least one request is received, and then stops the server. @param maxWait ms to wait at most. @return response with last request filled, if at least one was received.
[ "Waits", "until", "at", "least", "one", "request", "is", "received", "and", "then", "stops", "the", "server", "." ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/HttpServer.java#L121-L137
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/HttpServer.java
HttpServer.bind
public static com.sun.net.httpserver.HttpServer bind(InetAddress address, int startPort, int maxPort) { com.sun.net.httpserver.HttpServer aServer = createServer(); int port = -1; for (int possiblePort = startPort; port == -1 && possiblePort <= maxPort; possiblePort++) { try { ...
java
public static com.sun.net.httpserver.HttpServer bind(InetAddress address, int startPort, int maxPort) { com.sun.net.httpserver.HttpServer aServer = createServer(); int port = -1; for (int possiblePort = startPort; port == -1 && possiblePort <= maxPort; possiblePort++) { try { ...
[ "public", "static", "com", ".", "sun", ".", "net", ".", "httpserver", ".", "HttpServer", "bind", "(", "InetAddress", "address", ",", "int", "startPort", ",", "int", "maxPort", ")", "{", "com", ".", "sun", ".", "net", ".", "httpserver", ".", "HttpServer",...
Finds free port number and binds a server to it. @param address address to listen on. @param startPort lowest allowed port. @param maxPort highest (inclusive) port. @return server created.
[ "Finds", "free", "port", "number", "and", "binds", "a", "server", "to", "it", "." ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/HttpServer.java#L155-L172
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/selenium/JavascriptHelper.java
JavascriptHelper.getJavascriptExecutor
public static JavascriptExecutor getJavascriptExecutor(SearchContext searchContext) { JavascriptExecutor executor = null; if (searchContext instanceof JavascriptExecutor) { executor = (JavascriptExecutor) searchContext; } else { if (searchContext instanceof WrapsDriver) {...
java
public static JavascriptExecutor getJavascriptExecutor(SearchContext searchContext) { JavascriptExecutor executor = null; if (searchContext instanceof JavascriptExecutor) { executor = (JavascriptExecutor) searchContext; } else { if (searchContext instanceof WrapsDriver) {...
[ "public", "static", "JavascriptExecutor", "getJavascriptExecutor", "(", "SearchContext", "searchContext", ")", "{", "JavascriptExecutor", "executor", "=", "null", ";", "if", "(", "searchContext", "instanceof", "JavascriptExecutor", ")", "{", "executor", "=", "(", "Jav...
Obtains executor based on Selenium context. @param searchContext context in which javascript should be executed. @return JavascriptExecutor based on search context. @throws IllegalArgumentException when no executor could be obtained from context.
[ "Obtains", "executor", "based", "on", "Selenium", "context", "." ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/selenium/JavascriptHelper.java#L19-L37
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/selenium/JavascriptHelper.java
JavascriptHelper.executeScript
public static Object executeScript(JavascriptExecutor jse, String script, Object... parameters) { Object result; try { result = jse.executeScript(script, parameters); } catch (WebDriverException e) { String msg = e.getMessage(); if (msg != null && msg.contains...
java
public static Object executeScript(JavascriptExecutor jse, String script, Object... parameters) { Object result; try { result = jse.executeScript(script, parameters); } catch (WebDriverException e) { String msg = e.getMessage(); if (msg != null && msg.contains...
[ "public", "static", "Object", "executeScript", "(", "JavascriptExecutor", "jse", ",", "String", "script", ",", "Object", "...", "parameters", ")", "{", "Object", "result", ";", "try", "{", "result", "=", "jse", ".", "executeScript", "(", "script", ",", "para...
Executes Javascript in browser. If script contains the magic variable 'arguments' the parameters will also be passed to the statement. In the latter case the parameters must be a number, a boolean, a String, WebElement, or a List of any combination of the above. @link http://selenium.googlecode.com/git/docs/api/java/or...
[ "Executes", "Javascript", "in", "browser", ".", "If", "script", "contains", "the", "magic", "variable", "arguments", "the", "parameters", "will", "also", "be", "passed", "to", "the", "statement", ".", "In", "the", "latter", "case", "the", "parameters", "must",...
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/selenium/JavascriptHelper.java#L48-L62
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/fit/ServiceAndCheckMapColumnFixture.java
ServiceAndCheckMapColumnFixture.getRawCheckResponse
public CheckResponse getRawCheckResponse() { if (!checkCalled) { setupMaxTries(); setupWaitTime(); addResultsToValuesForCheck(getCurrentRowValues()); long startTime = currentTimeMillis(); try { executeCheckWithRetry(); } fi...
java
public CheckResponse getRawCheckResponse() { if (!checkCalled) { setupMaxTries(); setupWaitTime(); addResultsToValuesForCheck(getCurrentRowValues()); long startTime = currentTimeMillis(); try { executeCheckWithRetry(); } fi...
[ "public", "CheckResponse", "getRawCheckResponse", "(", ")", "{", "if", "(", "!", "checkCalled", ")", "{", "setupMaxTries", "(", ")", ";", "setupWaitTime", "(", ")", ";", "addResultsToValuesForCheck", "(", "getCurrentRowValues", "(", ")", ")", ";", "long", "sta...
Trigger to actually call check. @return raw check response
[ "Trigger", "to", "actually", "call", "check", "." ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/fit/ServiceAndCheckMapColumnFixture.java#L90-L104
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/slim/JsonFixture.java
JsonFixture.setJsonPathTo
public void setJsonPathTo(String path, Object value) { Object cleanValue = cleanupValue(value); String jsonPath = getPathExpr(path); String newContent = getPathHelper().updateJsonPathWithValue(content, jsonPath, cleanValue); content = newContent; }
java
public void setJsonPathTo(String path, Object value) { Object cleanValue = cleanupValue(value); String jsonPath = getPathExpr(path); String newContent = getPathHelper().updateJsonPathWithValue(content, jsonPath, cleanValue); content = newContent; }
[ "public", "void", "setJsonPathTo", "(", "String", "path", ",", "Object", "value", ")", "{", "Object", "cleanValue", "=", "cleanupValue", "(", "value", ")", ";", "String", "jsonPath", "=", "getPathExpr", "(", "path", ")", ";", "String", "newContent", "=", "...
Update a value in a the content by supplied jsonPath @param path the jsonPath to locate the key whose value needs changing @param value the new value to set
[ "Update", "a", "value", "in", "a", "the", "content", "by", "supplied", "jsonPath" ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/slim/JsonFixture.java#L107-L112
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/selenium/PageSourceSaver.java
PageSourceSaver.savePageSource
public String savePageSource(String fileName) { List<WebElement> framesWithFakeSources = new ArrayList<>(2); Map<String, String> sourceReplacements = new HashMap<>(); List<WebElement> frames = getFrames(); for (WebElement frame : frames) { String newLocation = saveFrameSource...
java
public String savePageSource(String fileName) { List<WebElement> framesWithFakeSources = new ArrayList<>(2); Map<String, String> sourceReplacements = new HashMap<>(); List<WebElement> frames = getFrames(); for (WebElement frame : frames) { String newLocation = saveFrameSource...
[ "public", "String", "savePageSource", "(", "String", "fileName", ")", "{", "List", "<", "WebElement", ">", "framesWithFakeSources", "=", "new", "ArrayList", "<>", "(", "2", ")", ";", "Map", "<", "String", ",", "String", ">", "sourceReplacements", "=", "new",...
Saves current page's source, as new file. @param fileName filename to use for saved page. @return wiki Url, if file was created inside wiki's files dir, absolute filename otherwise.
[ "Saves", "current", "page", "s", "source", "as", "new", "file", "." ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/selenium/PageSourceSaver.java#L46-L70
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/RandomUtil.java
RandomUtil.randomLowerMaxLength
public String randomLowerMaxLength(int minLength, int maxLength) { int range = maxLength - minLength; int randomLength = 0; if (range > 0) { randomLength = random(range); } return randomLower(minLength + randomLength); }
java
public String randomLowerMaxLength(int minLength, int maxLength) { int range = maxLength - minLength; int randomLength = 0; if (range > 0) { randomLength = random(range); } return randomLower(minLength + randomLength); }
[ "public", "String", "randomLowerMaxLength", "(", "int", "minLength", ",", "int", "maxLength", ")", "{", "int", "range", "=", "maxLength", "-", "minLength", ";", "int", "randomLength", "=", "0", ";", "if", "(", "range", ">", "0", ")", "{", "randomLength", ...
Creates a random string consisting of lowercase letters. @param minLength minimum length of String to create. @param maxLength maximum length (non inclusive) of String to create. @return lowercase letters.
[ "Creates", "a", "random", "string", "consisting", "of", "lowercase", "letters", "." ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/RandomUtil.java#L26-L33
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/RandomUtil.java
RandomUtil.randomString
public String randomString(String permitted, int length) { StringBuilder result = new StringBuilder(length); int maxIndex = permitted.length(); for (int i = 0; i < length; i++) { int index = random(maxIndex); char value = permitted.charAt(index); result.append...
java
public String randomString(String permitted, int length) { StringBuilder result = new StringBuilder(length); int maxIndex = permitted.length(); for (int i = 0; i < length; i++) { int index = random(maxIndex); char value = permitted.charAt(index); result.append...
[ "public", "String", "randomString", "(", "String", "permitted", ",", "int", "length", ")", "{", "StringBuilder", "result", "=", "new", "StringBuilder", "(", "length", ")", ";", "int", "maxIndex", "=", "permitted", ".", "length", "(", ")", ";", "for", "(", ...
Creates a random string consisting only of supplied characters. @param permitted string consisting of permitted characters. @param length length of string to create. @return random string.
[ "Creates", "a", "random", "string", "consisting", "only", "of", "supplied", "characters", "." ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/RandomUtil.java#L50-L59
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/fit/MapColumnFixture.java
MapColumnFixture.getSymbolArrayValue
private Object getSymbolArrayValue(Object arraySymbol, int index) { Object result = null; if (index > -1 && index < ((Object[]) arraySymbol).length) { result = ((Object[]) arraySymbol)[index]; } return result; }
java
private Object getSymbolArrayValue(Object arraySymbol, int index) { Object result = null; if (index > -1 && index < ((Object[]) arraySymbol).length) { result = ((Object[]) arraySymbol)[index]; } return result; }
[ "private", "Object", "getSymbolArrayValue", "(", "Object", "arraySymbol", ",", "int", "index", ")", "{", "Object", "result", "=", "null", ";", "if", "(", "index", ">", "-", "1", "&&", "index", "<", "(", "(", "Object", "[", "]", ")", "arraySymbol", ")",...
Fetch the value from arraySymbol on specified index. @param arraySymbol symbol from Fixture that is array @param index to find element from array @return the element from the symbol array
[ "Fetch", "the", "value", "from", "arraySymbol", "on", "specified", "index", "." ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/fit/MapColumnFixture.java#L496-L502
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/junit/HsacFitNesseRunner.java
HsacFitNesseRunner.configureSeleniumIfNeeded
protected boolean configureSeleniumIfNeeded() { setSeleniumDefaultTimeOut(); try { DriverFactory factory = null; SeleniumDriverFactoryFactory factoryFactory = getSeleniumDriverFactoryFactory(); if (factoryFactory != null) { factory = factoryFactory.get...
java
protected boolean configureSeleniumIfNeeded() { setSeleniumDefaultTimeOut(); try { DriverFactory factory = null; SeleniumDriverFactoryFactory factoryFactory = getSeleniumDriverFactoryFactory(); if (factoryFactory != null) { factory = factoryFactory.get...
[ "protected", "boolean", "configureSeleniumIfNeeded", "(", ")", "{", "setSeleniumDefaultTimeOut", "(", ")", ";", "try", "{", "DriverFactory", "factory", "=", "null", ";", "SeleniumDriverFactoryFactory", "factoryFactory", "=", "getSeleniumDriverFactoryFactory", "(", ")", ...
Determines whether system properties should override Selenium configuration in wiki. If so Selenium will be configured according to property values, and locked so that wiki pages no longer control Selenium setup. @return true if Selenium was configured.
[ "Determines", "whether", "system", "properties", "should", "override", "Selenium", "configuration", "in", "wiki", ".", "If", "so", "Selenium", "will", "be", "configured", "according", "to", "property", "values", "and", "locked", "so", "that", "wiki", "pages", "n...
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/junit/HsacFitNesseRunner.java#L304-L322
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/ProgramHelper.java
ProgramHelper.execute
public void execute(ProgramResponse response, int timeout) { ProcessBuilder builder = createProcessBuilder(response); invokeProgram(builder, response, timeout); }
java
public void execute(ProgramResponse response, int timeout) { ProcessBuilder builder = createProcessBuilder(response); invokeProgram(builder, response, timeout); }
[ "public", "void", "execute", "(", "ProgramResponse", "response", ",", "int", "timeout", ")", "{", "ProcessBuilder", "builder", "=", "createProcessBuilder", "(", "response", ")", ";", "invokeProgram", "(", "builder", ",", "response", ",", "timeout", ")", ";", "...
Calls a program and returns any output generated. @param response details of what to invoke (output will be added). @param timeout maximum time (in milliseconds) for program execution.
[ "Calls", "a", "program", "and", "returns", "any", "output", "generated", "." ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/ProgramHelper.java#L32-L35
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/XMLFormatter.java
XMLFormatter.format
public String format(String xml) { try { boolean keepDeclaration = DECL_PATTERN.matcher(xml).find(); if (trimElements) { xml = trimElements(xml); } Source xmlInput = new StreamSource(new StringReader(xml)); StreamResult xmlOutput = new ...
java
public String format(String xml) { try { boolean keepDeclaration = DECL_PATTERN.matcher(xml).find(); if (trimElements) { xml = trimElements(xml); } Source xmlInput = new StreamSource(new StringReader(xml)); StreamResult xmlOutput = new ...
[ "public", "String", "format", "(", "String", "xml", ")", "{", "try", "{", "boolean", "keepDeclaration", "=", "DECL_PATTERN", ".", "matcher", "(", "xml", ")", ".", "find", "(", ")", ";", "if", "(", "trimElements", ")", "{", "xml", "=", "trimElements", "...
Creates formatted version of the supplied XML. @param xml XML to format. @return formatted version.
[ "Creates", "formatted", "version", "of", "the", "supplied", "XML", "." ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/XMLFormatter.java#L28-L46
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/XMLFormatter.java
XMLFormatter.trim
public static String trim(String xml) { String content = removeDeclaration(xml); return trimElements(content); }
java
public static String trim(String xml) { String content = removeDeclaration(xml); return trimElements(content); }
[ "public", "static", "String", "trim", "(", "String", "xml", ")", "{", "String", "content", "=", "removeDeclaration", "(", "xml", ")", ";", "return", "trimElements", "(", "content", ")", ";", "}" ]
Removes both XML declaration and trims all elements. @param xml XML to trim. @return trimmed version.
[ "Removes", "both", "XML", "declaration", "and", "trims", "all", "elements", "." ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/XMLFormatter.java#L67-L70
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/LambdaMetaHelper.java
LambdaMetaHelper.getConstructor
public <T> Supplier<T> getConstructor(Class<? extends T> clazz) { return getConstructorAs(Supplier.class, "get", clazz); }
java
public <T> Supplier<T> getConstructor(Class<? extends T> clazz) { return getConstructorAs(Supplier.class, "get", clazz); }
[ "public", "<", "T", ">", "Supplier", "<", "T", ">", "getConstructor", "(", "Class", "<", "?", "extends", "T", ">", "clazz", ")", "{", "return", "getConstructorAs", "(", "Supplier", ".", "class", ",", "\"get\"", ",", "clazz", ")", ";", "}" ]
Gets no-arg constructor as Supplier. @param clazz class to get constructor for. @param <T> clazz. @return supplier.
[ "Gets", "no", "-", "arg", "constructor", "as", "Supplier", "." ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/LambdaMetaHelper.java#L25-L27
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/LambdaMetaHelper.java
LambdaMetaHelper.getConstructor
public <T, A> Function<A, T> getConstructor(Class<? extends T> clazz, Class<A> arg) { return getConstructorAs(Function.class, "apply", clazz, arg); }
java
public <T, A> Function<A, T> getConstructor(Class<? extends T> clazz, Class<A> arg) { return getConstructorAs(Function.class, "apply", clazz, arg); }
[ "public", "<", "T", ",", "A", ">", "Function", "<", "A", ",", "T", ">", "getConstructor", "(", "Class", "<", "?", "extends", "T", ">", "clazz", ",", "Class", "<", "A", ">", "arg", ")", "{", "return", "getConstructorAs", "(", "Function", ".", "class...
Gets single arg constructor as Function. @param clazz class to get constructor for. @param arg constructor argument type. @param <T> clazz. @param <A> argument class. @return function.
[ "Gets", "single", "arg", "constructor", "as", "Function", "." ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/LambdaMetaHelper.java#L37-L39
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/LambdaMetaHelper.java
LambdaMetaHelper.getConstructor
public <A1, A2, T> BiFunction<A1, A2, T> getConstructor(Class<? extends T> clazz, Class<A1> arg1, Class<A2> arg2) { return getConstructorAs(BiFunction.class, "apply", clazz, new Class<?>[] {arg1, arg2}); }
java
public <A1, A2, T> BiFunction<A1, A2, T> getConstructor(Class<? extends T> clazz, Class<A1> arg1, Class<A2> arg2) { return getConstructorAs(BiFunction.class, "apply", clazz, new Class<?>[] {arg1, arg2}); }
[ "public", "<", "A1", ",", "A2", ",", "T", ">", "BiFunction", "<", "A1", ",", "A2", ",", "T", ">", "getConstructor", "(", "Class", "<", "?", "extends", "T", ">", "clazz", ",", "Class", "<", "A1", ">", "arg1", ",", "Class", "<", "A2", ">", "arg2"...
Gets two arg constructor as BiFunction. @param clazz class to get constructor for. @param arg1 first argument class. @param arg2 second argument class. @param <T> clazz. @param <A1> first argument class @param <A2> second argument class. @return bifunction.
[ "Gets", "two", "arg", "constructor", "as", "BiFunction", "." ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/LambdaMetaHelper.java#L51-L53
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/FileUtil.java
FileUtil.loadFile
public static String loadFile(String filename) { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); InputStream is = classLoader.getResourceAsStream(filename); if (is == null) { throw new IllegalArgumentException("Unable to locate: " + filename); } ...
java
public static String loadFile(String filename) { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); InputStream is = classLoader.getResourceAsStream(filename); if (is == null) { throw new IllegalArgumentException("Unable to locate: " + filename); } ...
[ "public", "static", "String", "loadFile", "(", "String", "filename", ")", "{", "ClassLoader", "classLoader", "=", "Thread", ".", "currentThread", "(", ")", ".", "getContextClassLoader", "(", ")", ";", "InputStream", "is", "=", "classLoader", ".", "getResourceAsS...
Reads content of UTF-8 file on classpath to String. @param filename file to read. @return file's content. @throws IllegalArgumentException if file could not be found. @throws IllegalStateException if file could not be read.
[ "Reads", "content", "of", "UTF", "-", "8", "file", "on", "classpath", "to", "String", "." ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/FileUtil.java#L38-L45
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/FileUtil.java
FileUtil.copyFile
public static File copyFile(String source, String target) throws IOException { FileChannel inputChannel = null; FileChannel outputChannel = null; try { inputChannel = new FileInputStream(source).getChannel(); outputChannel = new FileOutputStream(target).getChannel(); ...
java
public static File copyFile(String source, String target) throws IOException { FileChannel inputChannel = null; FileChannel outputChannel = null; try { inputChannel = new FileInputStream(source).getChannel(); outputChannel = new FileOutputStream(target).getChannel(); ...
[ "public", "static", "File", "copyFile", "(", "String", "source", ",", "String", "target", ")", "throws", "IOException", "{", "FileChannel", "inputChannel", "=", "null", ";", "FileChannel", "outputChannel", "=", "null", ";", "try", "{", "inputChannel", "=", "ne...
Copies source file to target. @param source source file to copy. @param target destination to copy to. @return target as File. @throws IOException when unable to copy.
[ "Copies", "source", "file", "to", "target", "." ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/FileUtil.java#L114-L130
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/FileUtil.java
FileUtil.writeFile
public static File writeFile(String filename, String content) { PrintWriter pw = null; try { pw = new PrintWriter(filename, FILE_ENCODING); pw.write(content); pw.flush(); } catch (FileNotFoundException e) { throw new IllegalArgumentException("Unabl...
java
public static File writeFile(String filename, String content) { PrintWriter pw = null; try { pw = new PrintWriter(filename, FILE_ENCODING); pw.write(content); pw.flush(); } catch (FileNotFoundException e) { throw new IllegalArgumentException("Unabl...
[ "public", "static", "File", "writeFile", "(", "String", "filename", ",", "String", "content", ")", "{", "PrintWriter", "pw", "=", "null", ";", "try", "{", "pw", "=", "new", "PrintWriter", "(", "filename", ",", "FILE_ENCODING", ")", ";", "pw", ".", "write...
Writes content to file, in UTF-8 encoding. @param filename file to create or overwrite. @param content content to write. @return file reference to file.
[ "Writes", "content", "to", "file", "in", "UTF", "-", "8", "encoding", "." ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/FileUtil.java#L173-L189
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/FileUtil.java
FileUtil.appendToFile
public static File appendToFile(String filename, String extraContent, boolean onNewLine){ PrintWriter pw = null; try { pw = new PrintWriter( new BufferedWriter( new OutputStreamWriter( new FileOutputStream(fi...
java
public static File appendToFile(String filename, String extraContent, boolean onNewLine){ PrintWriter pw = null; try { pw = new PrintWriter( new BufferedWriter( new OutputStreamWriter( new FileOutputStream(fi...
[ "public", "static", "File", "appendToFile", "(", "String", "filename", ",", "String", "extraContent", ",", "boolean", "onNewLine", ")", "{", "PrintWriter", "pw", "=", "null", ";", "try", "{", "pw", "=", "new", "PrintWriter", "(", "new", "BufferedWriter", "("...
Appends the extra content to the file, in UTF-8 encoding. @param filename file to create or append to. @param extraContent extraContent to write. @param onNewLine whether a new line should be created before appending the extra content @return file reference to file.
[ "Appends", "the", "extra", "content", "to", "the", "file", "in", "UTF", "-", "8", "encoding", "." ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/FileUtil.java#L287-L311
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/slim/ValuesFileFixture.java
ValuesFileFixture.createContainingBase64Value
public String createContainingBase64Value(String basename, String key) { String file; Object value = value(key); if (value == null) { throw new SlimFixtureException(false, "No value for key: " + key); } else if (value instanceof String) { file = createFileFromBase...
java
public String createContainingBase64Value(String basename, String key) { String file; Object value = value(key); if (value == null) { throw new SlimFixtureException(false, "No value for key: " + key); } else if (value instanceof String) { file = createFileFromBase...
[ "public", "String", "createContainingBase64Value", "(", "String", "basename", ",", "String", "key", ")", "{", "String", "file", ";", "Object", "value", "=", "value", "(", "key", ")", ";", "if", "(", "value", "==", "null", ")", "{", "throw", "new", "SlimF...
Saves content of a key's value as file in the files section. @param basename filename to use. @param key key to get value from. @return file created.
[ "Saves", "content", "of", "a", "key", "s", "value", "as", "file", "in", "the", "files", "section", "." ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/slim/ValuesFileFixture.java#L63-L74
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/slim/ListFixture.java
ListFixture.addTo
public void addTo(Object value, List aList) { Object cleanValue = cleanupValue(value); aList.add(cleanValue); }
java
public void addTo(Object value, List aList) { Object cleanValue = cleanupValue(value); aList.add(cleanValue); }
[ "public", "void", "addTo", "(", "Object", "value", ",", "List", "aList", ")", "{", "Object", "cleanValue", "=", "cleanupValue", "(", "value", ")", ";", "aList", ".", "add", "(", "cleanValue", ")", ";", "}" ]
Adds new element to end of list. @param value value to add. @param aList list to add to.
[ "Adds", "new", "element", "to", "end", "of", "list", "." ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/slim/ListFixture.java#L106-L109
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/slim/ListFixture.java
ListFixture.copyValuesFromTo
public void copyValuesFromTo(Collection<Object> source, List<Object> target) { target.addAll(source); }
java
public void copyValuesFromTo(Collection<Object> source, List<Object> target) { target.addAll(source); }
[ "public", "void", "copyValuesFromTo", "(", "Collection", "<", "Object", ">", "source", ",", "List", "<", "Object", ">", "target", ")", "{", "target", ".", "addAll", "(", "source", ")", ";", "}" ]
Adds values to list. @param source list whose values are to be copied. @param target list to get element value from.
[ "Adds", "values", "to", "list", "." ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/slim/ListFixture.java#L166-L168
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/leanapps/ReportXmlFixture.java
ReportXmlFixture.getReportXml
private XmlHttpResponse getReportXml(String reportXmlFilename) { String url = LalCallColumnFixture.getLalUrl() + "/xmlrr/archive/Report/" + reportXmlFilename; return env.doHttpGetXml(url); }
java
private XmlHttpResponse getReportXml(String reportXmlFilename) { String url = LalCallColumnFixture.getLalUrl() + "/xmlrr/archive/Report/" + reportXmlFilename; return env.doHttpGetXml(url); }
[ "private", "XmlHttpResponse", "getReportXml", "(", "String", "reportXmlFilename", ")", "{", "String", "url", "=", "LalCallColumnFixture", ".", "getLalUrl", "(", ")", "+", "\"/xmlrr/archive/Report/\"", "+", "reportXmlFilename", ";", "return", "env", ".", "doHttpGetXml"...
Gets content of reportXmlFile @param reportXmlFilename file to retrieve @return report XML
[ "Gets", "content", "of", "reportXmlFile" ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/leanapps/ReportXmlFixture.java#L38-L41
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/slim/SlimFixtureWithMap.java
SlimFixtureWithMap.setValueFor
public void setValueFor(Object value, String name) { getMapHelper().setValueForIn(value, name, getCurrentValues()); }
java
public void setValueFor(Object value, String name) { getMapHelper().setValueForIn(value, name, getCurrentValues()); }
[ "public", "void", "setValueFor", "(", "Object", "value", ",", "String", "name", ")", "{", "getMapHelper", "(", ")", ".", "setValueForIn", "(", "value", ",", "name", ",", "getCurrentValues", "(", ")", ")", ";", "}" ]
Stores value. @param value value to be stored. @param name name to use this value for.
[ "Stores", "value", "." ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/slim/SlimFixtureWithMap.java#L63-L65
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/slim/SlimFixtureWithMap.java
SlimFixtureWithMap.clearValue
public boolean clearValue(String name) { String cleanName = cleanupValue(name); boolean result = getCurrentValues().containsKey(cleanName); getCurrentValues().remove(cleanName); return result; }
java
public boolean clearValue(String name) { String cleanName = cleanupValue(name); boolean result = getCurrentValues().containsKey(cleanName); getCurrentValues().remove(cleanName); return result; }
[ "public", "boolean", "clearValue", "(", "String", "name", ")", "{", "String", "cleanName", "=", "cleanupValue", "(", "name", ")", ";", "boolean", "result", "=", "getCurrentValues", "(", ")", ".", "containsKey", "(", "cleanName", ")", ";", "getCurrentValues", ...
Clears a values previously set. @param name value to remove. @return true if value was present.
[ "Clears", "a", "values", "previously", "set", "." ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/slim/SlimFixtureWithMap.java#L126-L131
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/Environment.java
Environment.getRequiredSymbol
public String getRequiredSymbol(String key) { String result = null; Object symbol = getSymbol(key); if (symbol == null) { throw new FitFailureException("No Symbol defined with key: " + key); } else { result = symbol.toString(); } return result; ...
java
public String getRequiredSymbol(String key) { String result = null; Object symbol = getSymbol(key); if (symbol == null) { throw new FitFailureException("No Symbol defined with key: " + key); } else { result = symbol.toString(); } return result; ...
[ "public", "String", "getRequiredSymbol", "(", "String", "key", ")", "{", "String", "result", "=", "null", ";", "Object", "symbol", "=", "getSymbol", "(", "key", ")", ";", "if", "(", "symbol", "==", "null", ")", "{", "throw", "new", "FitFailureException", ...
Gets symbol value, or throws exception if no symbol by that key exists. @param key symbol's key. @return symbol's value.
[ "Gets", "symbol", "value", "or", "throws", "exception", "if", "no", "symbol", "by", "that", "key", "exists", "." ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/Environment.java#L180-L189
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/Environment.java
Environment.doHttpPost
public void doHttpPost(String url, String templateName, Object model, HttpResponse result, Map<String, Object> headers, String contentType) { String request = processTemplate(templateName, model); result.setRequest(request); doHttpPost(url, result, headers, contentType); }
java
public void doHttpPost(String url, String templateName, Object model, HttpResponse result, Map<String, Object> headers, String contentType) { String request = processTemplate(templateName, model); result.setRequest(request); doHttpPost(url, result, headers, contentType); }
[ "public", "void", "doHttpPost", "(", "String", "url", ",", "String", "templateName", ",", "Object", "model", ",", "HttpResponse", "result", ",", "Map", "<", "String", ",", "Object", ">", "headers", ",", "String", "contentType", ")", "{", "String", "request",...
Performs POST to supplied url of result of applying template with model. @param url url to post to. @param templateName name of template to use. @param model model for template. @param result result to populate with response. @param headers headers to add. @param contentType contentType for request.
[ "Performs", "POST", "to", "supplied", "url", "of", "result", "of", "applying", "template", "with", "model", "." ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/Environment.java#L272-L276
train
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/Environment.java
Environment.doHttpPost
public void doHttpPost(String url, HttpResponse result, Map<String, Object> headers, String contentType) { httpClient.post(url, result, headers, contentType); }
java
public void doHttpPost(String url, HttpResponse result, Map<String, Object> headers, String contentType) { httpClient.post(url, result, headers, contentType); }
[ "public", "void", "doHttpPost", "(", "String", "url", ",", "HttpResponse", "result", ",", "Map", "<", "String", ",", "Object", ">", "headers", ",", "String", "contentType", ")", "{", "httpClient", ".", "post", "(", "url", ",", "result", ",", "headers", "...
Performs POST to supplied url of result's request. @param url url to post to. @param result result containing request, its response will be filled. @param headers headers to add. @param contentType contentType for request.
[ "Performs", "POST", "to", "supplied", "url", "of", "result", "s", "request", "." ]
4e9018d7386a9aa65bfcbf07eb28ae064edd1732
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/Environment.java#L285-L287
train