_id
stringlengths 2
7
| title
stringlengths 3
140
| partition
stringclasses 3
values | text
stringlengths 73
34.1k
| language
stringclasses 1
value | meta_information
dict |
---|---|---|---|---|---|
q178500
|
MyRemoteLibrary.getIntro
|
test
|
private String getIntro() {
try {
InputStream introStream = MyRemoteLibrary.class.getResourceAsStream("__intro__.txt");
StringWriter writer = new StringWriter();
IOUtils.copy(introStream, writer, Charset.defaultCharset());
return writer.toString();
}
catch (IOException e) {
throw new RuntimeException(e);
}
}
|
java
|
{
"resource": ""
}
|
q178501
|
ServerMethods.get_keyword_names
|
test
|
public String[] get_keyword_names() {
try {
String[] names = servlet.getLibrary().getKeywordNames();
if (names == null || names.length == 0)
throw new RuntimeException("No keywords found in the test library");
String[] newNames = Arrays.copyOf(names, names.length + 1);
newNames[names.length] = "stop_remote_server";
return newNames;
} catch (Throwable e) {
log.warn("", e);
throw new RuntimeException(e);
}
}
|
java
|
{
"resource": ""
}
|
q178502
|
ServerMethods.get_keyword_arguments
|
test
|
public String[] get_keyword_arguments(String keyword) {
if (keyword.equalsIgnoreCase("stop_remote_server")) {
return new String[0];
}
try {
String[] args = servlet.getLibrary().getKeywordArguments(keyword);
return args == null ? new String[0] : args;
} catch (Throwable e) {
log.warn("", e);
throw new RuntimeException(e);
}
}
|
java
|
{
"resource": ""
}
|
q178503
|
ServerMethods.get_keyword_documentation
|
test
|
public String get_keyword_documentation(String keyword) {
if (keyword.equalsIgnoreCase("stop_remote_server")) {
return "Stops the remote server.\n\nThe server may be configured so that users cannot stop it.";
}
try {
String doc = servlet.getLibrary().getKeywordDocumentation(keyword);
return doc == null ? "" : doc;
} catch (Throwable e) {
log.warn("", e);
throw new RuntimeException(e);
}
}
|
java
|
{
"resource": ""
}
|
q178504
|
RemoteServer.main
|
test
|
public static void main(String[] args) throws Exception {
configureLogging();
CommandLineHelper helper = new CommandLineHelper(args);
if (helper.getHelpRequested()) {
System.out.print(helper.getUsage());
System.exit(0);
}
RemoteServer remoteServer = new RemoteServer();
String error = helper.getError();
if (error == null) {
try {
for (String path : helper.getLibraryMap().keySet())
remoteServer.putLibrary(path, helper.getLibraryMap().get(path));
} catch (IllegalPathException e) {
error = e.getMessage();
}
}
if (error != null) {
System.out.println("Error: " + error);
System.out.println();
System.out.println(helper.getUsage());
System.exit(1);
}
remoteServer.setPort(helper.getPort());
remoteServer.setAllowStop(helper.getAllowStop());
remoteServer.setHost(helper.getHost());
remoteServer.start();
}
|
java
|
{
"resource": ""
}
|
q178505
|
RemoteServer.stop
|
test
|
public void stop(int timeoutMS) throws Exception {
log.info("Robot Framework remote server stopping");
if (timeoutMS > 0) {
server.setGracefulShutdown(timeoutMS);
Thread stopper = new Thread() {
@Override
public void run() {
try {
server.stop();
} catch (Throwable e) {
log.error(String.format("Failed to stop the server: %s", e.getMessage()), e);
}
}
};
stopper.start();
} else {
server.stop();
}
}
|
java
|
{
"resource": ""
}
|
q178506
|
RemoteServer.start
|
test
|
public void start() throws Exception {
log.info("Robot Framework remote server starting");
server.start();
log.info(String.format("Robot Framework remote server started on port %d.", getLocalPort()));
}
|
java
|
{
"resource": ""
}
|
q178507
|
PropertiesToJsonConverter.convertPropertiesFromFileToJson
|
test
|
public String convertPropertiesFromFileToJson(String pathToFile, String... includeDomainKeys) throws ReadInputException, ParsePropertiesException {
return convertPropertiesFromFileToJson(new File(pathToFile), includeDomainKeys);
}
|
java
|
{
"resource": ""
}
|
q178508
|
PropertiesToJsonConverter.convertPropertiesFromFileToJson
|
test
|
public String convertPropertiesFromFileToJson(File file, String... includeDomainKeys) throws ReadInputException, ParsePropertiesException {
try {
InputStream targetStream = new FileInputStream(file);
return convertToJson(targetStream, includeDomainKeys);
} catch (FileNotFoundException e) {
throw new ReadInputException(e);
}
}
|
java
|
{
"resource": ""
}
|
q178509
|
PropertiesToJsonConverter.convertToJson
|
test
|
public String convertToJson(InputStream inputStream, String... includeDomainKeys) throws ReadInputException, ParsePropertiesException {
return convertToJson(inputStreamToProperties(inputStream), includeDomainKeys);
}
|
java
|
{
"resource": ""
}
|
q178510
|
PropertiesToJsonConverter.convertToJson
|
test
|
public String convertToJson(Properties properties) throws ParsePropertiesException {
for (Map.Entry<Object, Object> entry : properties.entrySet()) {
if (!(entry.getKey() instanceof String)) {
throw new ParsePropertiesException(format(PROPERTY_KEY_NEEDS_TO_BE_STRING_TYPE,
entry.getKey().getClass(),
entry.getKey() == null ? "null" : entry.getKey()));
}
}
return convertFromValuesAsObjectMap(propertiesToMap(properties));
}
|
java
|
{
"resource": ""
}
|
q178511
|
PropertiesToJsonConverter.convertToJson
|
test
|
public String convertToJson(Map<String, String> properties) throws ParsePropertiesException {
return convertFromValuesAsObjectMap(stringValueMapToObjectValueMap(properties));
}
|
java
|
{
"resource": ""
}
|
q178512
|
PropertiesToJsonConverter.convertFromValuesAsObjectMap
|
test
|
public String convertFromValuesAsObjectMap(Map<String, Object> properties) throws ParsePropertiesException {
ObjectJsonType coreObjectJsonType = new ObjectJsonType();
for (String propertiesKey : getAllKeysFromProperties(properties)) {
addFieldsToJsonObject(properties, coreObjectJsonType, propertiesKey);
}
return prettifyOfJson(coreObjectJsonType.toStringJson());
}
|
java
|
{
"resource": ""
}
|
q178513
|
PropertiesToJsonConverter.convertFromValuesAsObjectMap
|
test
|
public String convertFromValuesAsObjectMap(Map<String, Object> properties, String... includeDomainKeys) throws ParsePropertiesException {
Map<String, Object> filteredProperties = new HashMap<>();
for (String key : properties.keySet()) {
for (String requiredKey : includeDomainKeys) {
checkKey(properties, filteredProperties, key, requiredKey);
}
}
return convertFromValuesAsObjectMap(filteredProperties);
}
|
java
|
{
"resource": ""
}
|
q178514
|
PropertiesToJsonConverter.convertToJson
|
test
|
public String convertToJson(Properties properties, String... includeDomainKeys) throws ParsePropertiesException {
return convertFromValuesAsObjectMap(propertiesToMap(properties), includeDomainKeys);
}
|
java
|
{
"resource": ""
}
|
q178515
|
FloatingActionButton.getShadowRadius
|
test
|
protected static int getShadowRadius(Drawable shadow, Drawable circle) {
int radius = 0;
if (shadow != null && circle != null) {
Rect rect = new Rect();
radius = (circle.getIntrinsicWidth() + (shadow.getPadding(rect) ? rect.left + rect.right : 0)) / 2;
}
return Math.max(1, radius);
}
|
java
|
{
"resource": ""
}
|
q178516
|
ApacheOcspFetcher.builder
|
test
|
public static Builder<OcspFetcher> builder() {
return new Builder<>(new BuildHandler<OcspFetcher>() {
@Override
public OcspFetcher build(Properties properties) {
return new ApacheOcspFetcher(properties);
}
});
}
|
java
|
{
"resource": ""
}
|
q178517
|
AbstractOcspClient.findIntermediate
|
test
|
protected X509Certificate findIntermediate(X509Certificate certificate) throws OcspException {
for (X509Certificate issuer : properties.get(INTERMEDIATES))
if (issuer.getSubjectX500Principal().equals(certificate.getIssuerX500Principal()))
return issuer;
throw new OcspException("Unable to find issuer '%s'.", certificate.getIssuerX500Principal().getName());
}
|
java
|
{
"resource": ""
}
|
q178518
|
MdPageGeneratorMojo.execute
|
test
|
@Override
public void execute() throws MojoExecutionException {
// First, if filtering is enabled, perform that using the Maven magic
if (applyFiltering) {
performMavenPropertyFiltering(new File(inputDirectory), filteredOutputDirectory, getInputEncoding());
inputDirectory = filteredOutputDirectory.getAbsolutePath();
}
getLog().info("Pre-processing markdown files from input directory: " + inputDirectory);
preprocessMarkdownFiles(new File(inputDirectory));
if (!markdownDTOs.isEmpty()) {
getLog().info("Process Pegdown extension options");
int options = getPegdownExtensions(pegdownExtensions);
final Map<String, Attributes> attributesMap = processAttributes(attributes);
getLog().info("Parse Markdown to HTML");
processMarkdown(markdownDTOs, options, attributesMap);
}
// FIXME: This will possibly overwrite any filtering updates made in the maven property filtering step above
if (StringUtils.isNotEmpty(copyDirectories)) {
getLog().info("Copy files from directories");
for (String dir : copyDirectories.split(",")) {
for ( Entry<String, String> copyAction : getFoldersToCopy(inputDirectory, outputDirectory, dir).entrySet()){
copyFiles(copyAction.getKey(), copyAction.getValue());
}
}
}
}
|
java
|
{
"resource": ""
}
|
q178519
|
MdPageGeneratorMojo.preprocessMarkdownFiles
|
test
|
@SuppressWarnings("UnusedReturnValue")
private boolean preprocessMarkdownFiles(File inputDirectory) throws MojoExecutionException {
getLog().debug("Read files from: " + inputDirectory);
try {
if (!inputDirectory.exists()) {
getLog().info("There is no input folder for the project. Skipping.");
return false;
}
int baseDepth = StringUtils.countMatches(inputDirectory.getAbsolutePath(), File.separator);
// Reading just the markdown dir and sub dirs if recursive option set
List<File> markdownFiles = getFilesAsArray(FileUtils.iterateFiles(inputDirectory, getInputFileExtensions(), recursiveInput));
for (File file : markdownFiles) {
getLog().debug("File getName() " + file.getName());
getLog().debug("File getAbsolutePath() " + file.getAbsolutePath());
getLog().debug("File getPath() " + file.getPath());
MarkdownDTO dto = new MarkdownDTO();
dto.markdownFile = file;
dto.folderDepth = StringUtils.countMatches(file.getAbsolutePath(), File.separator) - (baseDepth + 1);
if (alwaysUseDefaultTitle) {
dto.title = defaultTitle;
} else {
List<String> raw = FileUtils.readLines(file, getInputEncoding());
dto.title = getTitle(raw);
}
if (applyFiltering) {
for (String line : FileUtils.readLines(file, getInputEncoding())) {
if (isVariableLine(line)) {
String key = line.replaceAll("(^\\{)|(=.*)", "");
String value = line.replaceAll("(^\\{(.*?)=)|(}$)", "");
getLog().debug("Substitute: '" + key + "' -> '" + value + "'");
dto.substitutes.put(key, value);
}
}
}
String inputFileExtension = FilenameUtils.getExtension(file.getName());
dto.htmlFile = new File(
recursiveInput
? outputDirectory + File.separator + file.getParentFile().getPath().substring(inputDirectory.getPath().length()) + File.separator + file.getName().replaceAll(
"." + inputFileExtension,
".html"
)
: outputDirectory + File.separator + file.getName().replaceAll("." + inputFileExtension, ".html")
);
getLog().debug("File htmlFile() " + dto.htmlFile);
markdownDTOs.add(dto);
}
} catch (IOException e) {
throw new MojoExecutionException("Unable to load file " + e.getMessage(), e);
}
return true;
}
|
java
|
{
"resource": ""
}
|
q178520
|
MdPageGeneratorMojo.substituteVariables
|
test
|
private String substituteVariables(String template, String patternString, Map<String, String> variables) {
Pattern pattern = Pattern.compile(patternString);
Matcher matcher = pattern.matcher(template);
StringBuffer buffer = new StringBuffer();
while (matcher.find()) {
if (variables.containsKey(matcher.group(1))) {
String replacement = variables.get(matcher.group(1));
// quote to work properly with $ and {,} signs
matcher.appendReplacement(buffer, replacement != null ? Matcher.quoteReplacement(replacement) : "null");
}
}
matcher.appendTail(buffer);
return buffer.toString();
}
|
java
|
{
"resource": ""
}
|
q178521
|
MdPageGeneratorMojo.getTitle
|
test
|
private String getTitle(List<String> raw) {
if (raw == null) {
return defaultTitle;
}
String previousLine = "";
for (String line : raw) {
line = line.trim();
if (line.startsWith("#")) {
line = line.replace("#", "");
return line;
}
//Checking for Setext style headers.
//Line is considered a match if it passes:
//Starts with either = or -
//It has the same number of characters as the previous line
//It only contains - or = and nothing else.
//
//If there is a match we consider the previous line to be the title.
if ((line.startsWith("=") && StringUtils.countMatches(line, "=") == previousLine.length() && line.matches("^=+$"))
|| (line.startsWith("-") && StringUtils.countMatches(line, "-") == previousLine.length() && line.matches("^-+$"))) {
return previousLine;
}
previousLine = line;
}
return defaultTitle;
}
|
java
|
{
"resource": ""
}
|
q178522
|
MdPageGeneratorMojo.addTitleToHtmlFile
|
test
|
private String addTitleToHtmlFile(String html, String title) {
if (html == null) {
return html;
}
if (title != null) {
getLog().debug("Setting the title in the HTML file to: " + title);
return html.replaceFirst("titleToken", title);
} else {
getLog().debug("Title was null, setting the title in the HTML file to an empty string");
return html.replaceFirst("titleToken", "");
}
}
|
java
|
{
"resource": ""
}
|
q178523
|
MdPageGeneratorMojo.replaceVariables
|
test
|
private String replaceVariables(String initialContent, Map<String, String> variables) {
String newContent = initialContent;
// Only apply substitution if filtering is enabled and there is actually something to
// substitute, otherwise just return the original content.
if (applyFiltering && newContent != null) {
newContent = newContent.replaceAll("\\{\\w*=.*}", "");
if (variables != null) {
newContent = substituteVariables(newContent, "\\$\\{(.+?)\\}", variables);
}
}
return newContent;
}
|
java
|
{
"resource": ""
}
|
q178524
|
MdPageGeneratorMojo.updateRelativePaths
|
test
|
private String updateRelativePaths(String html, int folderDepth) {
if (html == null) {
return html;
}
getLog().debug("Updating relative paths in html includes (css, js).");
return html.replaceAll("##SITE_BASE##", getSiteBasePrefix(folderDepth));
}
|
java
|
{
"resource": ""
}
|
q178525
|
MdPageGeneratorMojo.copyFiles
|
test
|
private void copyFiles(String fromDir, String toDir) throws MojoExecutionException {
getLog().debug("fromDir=" + fromDir + "; toDir=" + toDir);
try {
File fromDirFile = new File(fromDir);
if (fromDirFile.exists()) {
Iterator<File> files = FileUtils.iterateFiles(new File(fromDir), null, false);
while (files.hasNext()) {
File file = files.next();
if (file.exists()) {
FileUtils.copyFileToDirectory(file, new File(toDir));
} else {
getLog().error("File '" + file.getAbsolutePath() + "' does not exist. Skipping copy");
}
}
}
} catch (IOException e) {
throw new MojoExecutionException("Unable to copy file " + e.getMessage(), e);
}
}
|
java
|
{
"resource": ""
}
|
q178526
|
BaseClient.checkPath
|
test
|
protected String checkPath(String path){
if (path.toLowerCase().contains("statements") && path.toLowerCase().contains("more")){
int pathLength = this._host.getPath().length();
return path.substring(pathLength, path.length());
}
return path;
}
|
java
|
{
"resource": ""
}
|
q178527
|
CrossfadeDrawerLayout.wrapSliderContent
|
test
|
private View wrapSliderContent(View child, int index) {
//TODO !!
if (index == 1 && child.getId() != -1) {
mLargeView = (ViewGroup) child;
mContainer = new ScrimInsetsRelativeLayout(getContext());
mContainer.setGravity(Gravity.START);
mContainer.setLayoutParams(child.getLayoutParams());
mContainer.addView(mLargeView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
mSmallView = new LinearLayout(getContext());
mContainer.addView(mSmallView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
mLargeView.setAlpha(0);
mLargeView.setVisibility(View.GONE);
//correct fitsSystemWindows handling
mContainer.setFitsSystemWindows(true);
mSmallView.setFitsSystemWindows(true);
return mContainer;
}
return child;
}
|
java
|
{
"resource": ""
}
|
q178528
|
CrossfadeDrawerLayout.fadeUp
|
test
|
public void fadeUp(int duration) {
//animate up
mContainer.clearAnimation();
ResizeWidthAnimation anim = new ResizeWidthAnimation(mContainer, mMaxWidth, new ApplyTransformationListener() {
@Override
public void applyTransformation(int width) {
overlapViews(width);
}
});
anim.setDuration(duration);
mContainer.startAnimation(anim);
}
|
java
|
{
"resource": ""
}
|
q178529
|
CrossfadeDrawerLayout.fadeDown
|
test
|
public void fadeDown(int duration) {
//fade down
mContainer.clearAnimation();
ResizeWidthAnimation anim = new ResizeWidthAnimation(mContainer, mMinWidth, new ApplyTransformationListener() {
@Override
public void applyTransformation(int width) {
overlapViews(width);
}
});
anim.setDuration(duration);
mContainer.startAnimation(anim);
}
|
java
|
{
"resource": ""
}
|
q178530
|
CrossfadeDrawerLayout.calculatePercentage
|
test
|
private float calculatePercentage(int width) {
int absolute = mMaxWidth - mMinWidth;
int current = width - mMinWidth;
float percentage = 100.0f * current / absolute;
//we can assume that we are crossfaded if the percentage is > 90
mIsCrossfaded = percentage > 90;
return percentage;
}
|
java
|
{
"resource": ""
}
|
q178531
|
CrossfadeDrawerLayout.overlapViews
|
test
|
private void overlapViews(int width) {
if (width == mWidth) {
return;
}
//remember this width so it is't processed twice
mWidth = width;
float percentage = calculatePercentage(width);
float alpha = percentage / 100;
mSmallView.setAlpha(1);
mSmallView.setClickable(false);
mLargeView.bringToFront();
mLargeView.setAlpha(alpha);
mLargeView.setClickable(true);
mLargeView.setVisibility(alpha > 0.01f ? View.VISIBLE : View.GONE);
//notify the crossfadeListener
if (mCrossfadeListener != null) {
mCrossfadeListener.onCrossfade(mContainer, calculatePercentage(width), width);
}
}
|
java
|
{
"resource": ""
}
|
q178532
|
UseActivityInterceptor.getLaunchIntent
|
test
|
protected <T extends Activity> Intent getLaunchIntent(String targetPackage,
Class<T> activityClass, BundleCreator bundleCreator) {
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setClassName(targetPackage, activityClass.getName());
intent.putExtras(bundleCreator.createBundle());
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
return intent;
}
|
java
|
{
"resource": ""
}
|
q178533
|
UseActivityInterceptor.launchActivity
|
test
|
@SuppressWarnings("unchecked")
private void launchActivity() {
if (activity != null && ActivityRunMode.SPECIFICATION.equals(activityRunMode)) return;
String targetPackage = instrumentation.getTargetContext().getPackageName();
Intent intent = getLaunchIntent(targetPackage, activityClass, bundleCreator);
activity = instrumentation.startActivitySync(intent);
instrumentation.waitForIdleSync();
}
|
java
|
{
"resource": ""
}
|
q178534
|
TodosApi.getTodos
|
test
|
public TodoListResponse getTodos(String type, String status, UUID factSheetId, UUID userId, UUID workspaceId, Boolean getArchived, Integer size, Integer page) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/todos".replaceAll("\\{format\\}","json");
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarQueryParams.addAll(apiClient.parameterToPairs("", "type", type));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "status", status));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "factSheetId", factSheetId));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "userId", userId));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "workspaceId", workspaceId));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "getArchived", getArchived));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "size", size));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "page", page));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "token" };
GenericType<TodoListResponse> localVarReturnType = new GenericType<TodoListResponse>() {};
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
|
java
|
{
"resource": ""
}
|
q178535
|
FactSheetsApi.getFactSheets
|
test
|
public FactSheetListResponse getFactSheets(String type, String relationTypes, Integer pageSize, String cursor, Boolean permissions) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/factSheets".replaceAll("\\{format\\}","json");
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarQueryParams.addAll(apiClient.parameterToPairs("", "type", type));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "relationTypes", relationTypes));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "pageSize", pageSize));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "cursor", cursor));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "permissions", permissions));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "token" };
GenericType<FactSheetListResponse> localVarReturnType = new GenericType<FactSheetListResponse>() {};
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
|
java
|
{
"resource": ""
}
|
q178536
|
ApiClient.downloadFileFromResponse
|
test
|
public File downloadFileFromResponse(Response response) throws ApiException {
try {
File file = prepareDownloadFile(response);
Files.copy(response.readEntity(InputStream.class), file.toPath());
return file;
} catch (IOException e) {
throw new ApiException(e);
}
}
|
java
|
{
"resource": ""
}
|
q178537
|
ApiClient.buildHttpClient
|
test
|
private Client buildHttpClient(boolean debugging) {
final ClientConfig clientConfig = new ClientConfig();
clientConfig.register(MultiPartFeature.class);
clientConfig.register(json);
clientConfig.register(JacksonFeature.class);
if (debugging) {
clientConfig.register(LoggingFilter.class);
}
return ClientBuilder.newClient(clientConfig);
}
|
java
|
{
"resource": ""
}
|
q178538
|
ModelsApi.createAccessControlEntity
|
test
|
public AccessControlEntityResponse createAccessControlEntity(AccessControlEntity body) throws ApiException {
Object localVarPostBody = body;
// create path and map variables
String localVarPath = "/models/accessControlEntities".replaceAll("\\{format\\}","json");
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "token" };
GenericType<AccessControlEntityResponse> localVarReturnType = new GenericType<AccessControlEntityResponse>() {};
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
|
java
|
{
"resource": ""
}
|
q178539
|
ModelsApi.updateDataModel
|
test
|
public DataModelUpdateResponse updateDataModel(DataModel body, Boolean force, String workspaceId) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling updateDataModel");
}
// create path and map variables
String localVarPath = "/models/dataModel".replaceAll("\\{format\\}","json");
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarQueryParams.addAll(apiClient.parameterToPairs("", "force", force));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "workspaceId", workspaceId));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "token" };
GenericType<DataModelUpdateResponse> localVarReturnType = new GenericType<DataModelUpdateResponse>() {};
return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
|
java
|
{
"resource": ""
}
|
q178540
|
ExportsApi.createFullExport
|
test
|
public JobResponse createFullExport(String exportType, String startDate, String endDate) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/exports/fullExport".replaceAll("\\{format\\}","json");
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarQueryParams.addAll(apiClient.parameterToPairs("", "exportType", exportType));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "startDate", startDate));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "endDate", endDate));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { };
GenericType<JobResponse> localVarReturnType = new GenericType<JobResponse>() {};
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
|
java
|
{
"resource": ""
}
|
q178541
|
ExportsApi.getExports
|
test
|
public ExportListResponse getExports(String exportType, UUID userId, Integer pageSize, String cursor, String sorting, String sortDirection) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/exports".replaceAll("\\{format\\}","json");
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarQueryParams.addAll(apiClient.parameterToPairs("", "exportType", exportType));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "userId", userId));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "pageSize", pageSize));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "cursor", cursor));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "sorting", sorting));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "sortDirection", sortDirection));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { };
GenericType<ExportListResponse> localVarReturnType = new GenericType<ExportListResponse>() {};
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
|
java
|
{
"resource": ""
}
|
q178542
|
ApiClientBuilder.withTokenProviderHost
|
test
|
public ApiClientBuilder withTokenProviderHost(String host) {
withOAuth2TokenUrl(URI.create(String.format("https://%s/services/mtm/v1/oauth2/token", host)));
return this;
}
|
java
|
{
"resource": ""
}
|
q178543
|
ApiClientBuilder.withClientCredentials
|
test
|
public ApiClientBuilder withClientCredentials(String clientId, String clientSecret) {
this.clientId = clientId;
this.clientSecret = clientSecret;
return this;
}
|
java
|
{
"resource": ""
}
|
q178544
|
GraphqlApi.processGraphQLMultipart
|
test
|
public GraphQLResult processGraphQLMultipart(String graphQLRequest, File file) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'graphQLRequest' is set
if (graphQLRequest == null) {
throw new ApiException(400, "Missing the required parameter 'graphQLRequest' when calling processGraphQLMultipart");
}
// verify the required parameter 'file' is set
if (file == null) {
throw new ApiException(400, "Missing the required parameter 'file' when calling processGraphQLMultipart");
}
// create path and map variables
String localVarPath = "/graphql/upload".replaceAll("\\{format\\}","json");
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
if (graphQLRequest != null)
localVarFormParams.put("graphQLRequest", graphQLRequest);
if (file != null)
localVarFormParams.put("file", file);
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"multipart/form-data"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "token" };
GenericType<GraphQLResult> localVarReturnType = new GenericType<GraphQLResult>() {};
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
|
java
|
{
"resource": ""
}
|
q178545
|
BookmarksApi.getBookmarks
|
test
|
public BookmarkListResponse getBookmarks(String bookmarkType, String groupKey, String sharingType) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'bookmarkType' is set
if (bookmarkType == null) {
throw new ApiException(400, "Missing the required parameter 'bookmarkType' when calling getBookmarks");
}
// create path and map variables
String localVarPath = "/bookmarks".replaceAll("\\{format\\}","json");
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarQueryParams.addAll(apiClient.parameterToPairs("", "bookmarkType", bookmarkType));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "groupKey", groupKey));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "sharingType", sharingType));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "token" };
GenericType<BookmarkListResponse> localVarReturnType = new GenericType<BookmarkListResponse>() {};
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
|
java
|
{
"resource": ""
}
|
q178546
|
MarkLogicDatasetGraph.addPermissions
|
test
|
public void addPermissions(Node graphName, GraphPermissions permissions) {
checkIsOpen();
client.mergeGraphPermissions(graphName.getURI(), permissions);
}
|
java
|
{
"resource": ""
}
|
q178547
|
MarkLogicDatasetGraph.writePermissions
|
test
|
public void writePermissions(Node graphName, GraphPermissions permissions) {
checkIsOpen();
client.writeGraphPermissions(graphName.getURI(), permissions);
}
|
java
|
{
"resource": ""
}
|
q178548
|
MarkLogicDatasetGraph.withRulesets
|
test
|
public MarkLogicDatasetGraph withRulesets(SPARQLRuleset... rulesets) {
if (this.rulesets == null) {
this.rulesets = rulesets;
} else {
Collection<SPARQLRuleset> collection = new ArrayList<SPARQLRuleset>();
collection.addAll(Arrays.asList(this.rulesets));
collection.addAll(Arrays.asList(rulesets));
this.rulesets = collection.toArray(new SPARQLRuleset[] {});
}
return this;
}
|
java
|
{
"resource": ""
}
|
q178549
|
JenaDatabaseClient.close
|
test
|
public void close() {
if (writeBuffer != null) {
writeBuffer.cancel();
}
if (timer != null) {
timer.cancel();
}
client = null;
}
|
java
|
{
"resource": ""
}
|
q178550
|
JenaDatabaseClient.executeSelect
|
test
|
public synchronized InputStreamHandle executeSelect(SPARQLQueryDefinition qdef,
InputStreamHandle handle, Long offset, Long limit) {
if (limit == null) {
this.sparqlQueryManager.clearPageLength();
} else {
this.sparqlQueryManager.setPageLength(limit);
}
if (offset != null) {
return this.sparqlQueryManager.executeSelect(qdef, handle, offset,
currentTransaction);
} else {
return this.sparqlQueryManager.executeSelect(qdef, handle,
currentTransaction);
}
}
|
java
|
{
"resource": ""
}
|
q178551
|
MarkLogicDatasetGraphFactory.createDatasetGraph
|
test
|
static public MarkLogicDatasetGraph createDatasetGraph(String host,
int port, String user, String password, Authentication type) {
DatabaseClient client = DatabaseClientFactory.newClient(host, port,
user, password, type);
return MarkLogicDatasetGraphFactory.createDatasetGraph(client);
}
|
java
|
{
"resource": ""
}
|
q178552
|
GMOperation.limitThreads
|
test
|
public GMOperation limitThreads(final int threadsPerProcess) {
final List<String> args = getCmdArgs();
args.add("-limit");
args.add("threads");
args.add(Integer.toString(threadsPerProcess));
return this;
}
|
java
|
{
"resource": ""
}
|
q178553
|
GMOperation.resize
|
test
|
public GMOperation resize(final int width, final int height, final Collection<GeometryAnnotation> annotations) {
final List<String> args = getCmdArgs();
args.add("-resize");
args.add(resample(width, height, annotations));
return this;
}
|
java
|
{
"resource": ""
}
|
q178554
|
GMOperation.rotate
|
test
|
public GMOperation rotate(final double degrees, final RotationAnnotation annotation) {
if (annotation == null) {
throw new IllegalArgumentException("Rotation annotation must be defined");
}
final List<String> args = getCmdArgs();
args.add("-rotate");
args.add(String.format(Locale.ENGLISH,"%.1f%s", degrees, annotation.asAnnotation()));
return this;
}
|
java
|
{
"resource": ""
}
|
q178555
|
GMOperation.gravity
|
test
|
public GMOperation gravity(final Gravity value) {
if (value == null) {
throw new IllegalArgumentException("Gravity value must be defined");
}
gravity(value.toString());
return this;
}
|
java
|
{
"resource": ""
}
|
q178556
|
GMOperation.stripProfiles
|
test
|
public GMOperation stripProfiles() {
final List<String> args = getCmdArgs();
args.add("+profile");
args.add("*");
return this;
}
|
java
|
{
"resource": ""
}
|
q178557
|
GMOperation.font
|
test
|
public GMOperation font(final String style, final int size, final String color) {
if (isBlank(style)) {
throw new IllegalArgumentException("Text font style must be defined");
}
if (isBlank(color)) {
throw new IllegalArgumentException("Text font color must be defined");
}
font(style);
pointsize(size);
fill(color);
return this;
}
|
java
|
{
"resource": ""
}
|
q178558
|
GMOperation.source
|
test
|
public GMOperation source(final File file, @CheckForNull final Integer width, @CheckForNull final Integer height)
throws IOException {
if (file != null && !file.exists()) {
throw new IOException("Source file '" + file + "' does not exist");
}
if ((width != null) && (height != null) && (width > 0) && (height > 0)) {
size(width, height);
}
return addImage(file);
}
|
java
|
{
"resource": ""
}
|
q178559
|
GMOperation.addImage
|
test
|
public GMOperation addImage(final File file) {
if (file == null) {
throw new IllegalArgumentException("file must be defined");
}
getCmdArgs().add(file.getPath());
return this;
}
|
java
|
{
"resource": ""
}
|
q178560
|
Args.parse
|
test
|
public static List<String> parse(Object target, String[] args) {
List<String> arguments = new ArrayList<String>();
arguments.addAll(Arrays.asList(args));
Class<?> clazz;
if (target instanceof Class) {
clazz = (Class) target;
} else {
clazz = target.getClass();
try {
BeanInfo info = Introspector.getBeanInfo(clazz);
for (PropertyDescriptor pd : info.getPropertyDescriptors()) {
processProperty(target, pd, arguments);
}
} catch (IntrospectionException e) {
// If its not a JavaBean we ignore it
}
}
// Check fields of 'target' class and its superclasses
for (Class<?> currentClazz = clazz; currentClazz != null; currentClazz = currentClazz.getSuperclass()) {
for (Field field : currentClazz.getDeclaredFields()) {
processField(target, field, arguments);
}
}
for (String argument : arguments) {
if (argument.startsWith("-")) {
throw new IllegalArgumentException("Invalid argument: " + argument);
}
}
return arguments;
}
|
java
|
{
"resource": ""
}
|
q178561
|
Args.usage
|
test
|
public static void usage(PrintStream errStream, Object target) {
Class<?> clazz;
if (target instanceof Class) {
clazz = (Class) target;
} else {
clazz = target.getClass();
}
errStream.println("Usage: " + clazz.getName());
for (Class<?> currentClazz = clazz; currentClazz != null; currentClazz = currentClazz.getSuperclass()) {
for (Field field : currentClazz.getDeclaredFields()) {
fieldUsage(errStream, target, field);
}
}
try {
BeanInfo info = Introspector.getBeanInfo(clazz);
for (PropertyDescriptor pd : info.getPropertyDescriptors()) {
propertyUsage(errStream, target, pd);
}
} catch (IntrospectionException e) {
// If its not a JavaBean we ignore it
}
}
|
java
|
{
"resource": ""
}
|
q178562
|
UnitConverter.extractTimeUnitFromString
|
test
|
public static TimeUnit extractTimeUnitFromString(String timeString){
timeString=timeString.toLowerCase();
if(timeString.contains("minute")){
return TimeUnit.MINUTES;
}
else if(timeString.contains("microsecond")){
return TimeUnit.MICROSECONDS;
}
else if(timeString.contains("millisecond")){
return TimeUnit.MILLISECONDS;
}
else if(timeString.contains("second")){
return TimeUnit.SECONDS;
}
else if(timeString.contains("hour")){
return TimeUnit.HOURS;
}
else if(timeString.toLowerCase().contains("day")){
return TimeUnit.DAYS;
}
else
return null;
}
|
java
|
{
"resource": ""
}
|
q178563
|
PropertiesArgs.parse
|
test
|
public static void parse(Object target, Properties arguments) {
Class clazz;
if (target instanceof Class) {
clazz = (Class) target;
} else {
clazz = target.getClass();
}
for (Field field : clazz.getDeclaredFields()) {
processField(target, field, arguments);
}
try {
BeanInfo info = Introspector.getBeanInfo(clazz);
for (PropertyDescriptor pd : info.getPropertyDescriptors()) {
processProperty(target, pd, arguments);
}
} catch (IntrospectionException e) {
// If its not a JavaBean we ignore it
}
}
|
java
|
{
"resource": ""
}
|
q178564
|
Slides.execute
|
test
|
static public void execute(URL url) throws SlideExecutionException {
checkNotNull(url);
ScreenRegion screenRegion = new DesktopScreenRegion();
Context context = new Context(screenRegion);
execute(url, context);
}
|
java
|
{
"resource": ""
}
|
q178565
|
Slides.execute
|
test
|
static public void execute(File file) throws SlideExecutionException {
checkNotNull(file);
try {
execute(file.toURI().toURL());
} catch (MalformedURLException e) {
throw new SlideExecutionException(e);
}
}
|
java
|
{
"resource": ""
}
|
q178566
|
Slides.interpret
|
test
|
public static List<Action> interpret(File file) throws IOException {
checkNotNull(file);
Interpreter interpreter = new DefaultInterpreter();
SlidesReader reader = new PPTXSlidesReader();
List<Slide> slides;
slides = reader.read(file);
List<Action> actions = Lists.newArrayList();
for (Slide slide : slides){
Action action = interpreter.interpret(slide);
actions.add(action);
logger.info("Action interpreted: {}", action);
}
return actions;
}
|
java
|
{
"resource": ""
}
|
q178567
|
CrossSearchStrategy.sortBySize
|
test
|
static public List<Rectangle> sortBySize(List<Rectangle> list){
List<Rectangle> result = Lists.newArrayList();
Collections.sort(list, new Comparator<Rectangle>(){
@Override
public int compare(Rectangle r1, Rectangle r2) {
return (r1.height * r1.width) - (r2.height * r2.width);
}
});
return result;
}
|
java
|
{
"resource": ""
}
|
q178568
|
Context.render
|
test
|
public String render(String templateText) {
checkNotNull(templateText);
ST st = new ST(templateText);
for (Map.Entry<String, Object> e : parameters.entrySet()){
st.add(e.getKey(), e.getValue());
}
return st.render();
}
|
java
|
{
"resource": ""
}
|
q178569
|
PPTXBundle.getSlideXMLRel
|
test
|
File getSlideXMLRel(int slideNumber){
String filename = String.format("slide%d.xml.rels", slideNumber);
return new File(getRelationshipsDirectory(), filename);
}
|
java
|
{
"resource": ""
}
|
q178570
|
ScreenRegionLatch.inRange
|
test
|
protected boolean inRange(NativeMouseEvent e){
Rectangle r = screenRegion.getBounds();
r.x += screenOffsetX;
r.y += screenOffsetY;
int x = e.getX();
int y = e.getY();
return r.contains(x,y);
}
|
java
|
{
"resource": ""
}
|
q178571
|
Selector.overlapVerticallyWith
|
test
|
public Selector overlapVerticallyWith(final SlideElement element, final float minOverlapRatio){
checkNotNull(element);
final Rectangle r1 = element.getBounds();
r1.x = 0; r1.width = 1;
elements = Collections2.filter(elements, new Predicate<SlideElement>(){
@Override
public boolean apply(SlideElement e) {
if (e == element){
return false;
}
if (r1.height == 0){
return false;
}
Rectangle r2 =e.getBounds();
r2.x = 0; r2.width = 1;
Rectangle intersection = r1.intersection(r2);
float yOverlapRatio = 1f * intersection.height / r1.height;
return yOverlapRatio > minOverlapRatio;
}
});
return this;
}
|
java
|
{
"resource": ""
}
|
q178572
|
SqsExecutor.executeOutboundOperation
|
test
|
public Object executeOutboundOperation(final Message<?> message) {
try {
String serializedMessage = messageMarshaller.serialize(message);
if (queue == null) {
SendMessageRequest request = new SendMessageRequest(queueUrl,
serializedMessage);
SendMessageResult result = sqsClient.sendMessage(request);
log.debug("Message sent, Id:" + result.getMessageId());
} else {
queue.add(serializedMessage);
}
} catch (MessageMarshallerException e) {
log.error(e.getMessage(), e);
throw new MessagingException(e.getMessage(), e.getCause());
}
return message.getPayload();
}
|
java
|
{
"resource": ""
}
|
q178573
|
SnsExecutor.executeOutboundOperation
|
test
|
public Object executeOutboundOperation(final Message<?> message) {
try {
String serializedMessage = messageMarshaller.serialize(message);
if (snsTestProxy == null) {
PublishRequest request = new PublishRequest();
PublishResult result = client.publish(request.withTopicArn(
topicArn).withMessage(serializedMessage));
log.debug("Published message to topic: "
+ result.getMessageId());
} else {
snsTestProxy.dispatchMessage(serializedMessage);
}
} catch (MessageMarshallerException e) {
log.error(e.getMessage(), e);
throw new MessagingException(e.getMessage(), e.getCause());
}
return message.getPayload();
}
|
java
|
{
"resource": ""
}
|
q178574
|
JNE.requireFile
|
test
|
synchronized static public File requireFile(String name, Options options) throws IOException {
File file = findFile(name, options);
if (file == null) {
throw new ResourceNotFoundException("Resource file " + name + " not found");
}
return file;
}
|
java
|
{
"resource": ""
}
|
q178575
|
JNE.getOrCreateTempDirectory
|
test
|
static private File getOrCreateTempDirectory(boolean deleteOnExit) throws ExtractException {
// return the single instance if already created
if ((TEMP_DIRECTORY != null) && TEMP_DIRECTORY.exists()) {
return TEMP_DIRECTORY;
}
// use jvm supplied temp directory in case multiple jvms compete
// try {
// Path tempDirectory = Files.createTempDirectory("jne.");
// File tempDirectoryAsFile = tempDirectory.toFile();
// if (deleteOnExit) {
// tempDirectoryAsFile.deleteOnExit();
// }
// return tempDirectoryAsFile;
// } catch (IOException e) {
// throw new ExtractException("Unable to create temporary dir", e);
// }
// use totally unique name to avoid race conditions
try {
Path baseDir = Paths.get(System.getProperty("java.io.tmpdir"));
Path tempDirectory = baseDir.resolve("jne." + UUID.randomUUID().toString());
Files.createDirectories(tempDirectory);
File tempDirectoryAsFile = tempDirectory.toFile();
if (deleteOnExit) {
tempDirectoryAsFile.deleteOnExit();
}
// save temp directory so its only exactracted once
TEMP_DIRECTORY = tempDirectoryAsFile;
return TEMP_DIRECTORY;
} catch (IOException e) {
throw new ExtractException("Unable to create temporary dir", e);
}
// File baseDir = new File(System.getProperty("java.io.tmpdir"));
// String baseName = System.currentTimeMillis() + "-";
//
// for (int counter = 0; counter < TEMP_DIR_ATTEMPTS; counter++) {
// File d = new File(baseDir, baseName + counter);
// if (d.mkdirs()) {
// // schedule this directory to be deleted on exit
// if (deleteOnExit) {
// d.deleteOnExit();
// }
// tempDirectory = d;
// return d;
// }
// }
//
// throw new ExtractException("Failed to create temporary directory within " + TEMP_DIR_ATTEMPTS + " attempts (tried " + baseName + "0 to " + baseName + (TEMP_DIR_ATTEMPTS - 1) + ')');
}
|
java
|
{
"resource": ""
}
|
q178576
|
LogValueMapFactory.of
|
test
|
public static LogValueMap of(final String k1, final Object v1) {
return builder()
.put(k1, v1)
.build();
}
|
java
|
{
"resource": ""
}
|
q178577
|
Logger.trace
|
test
|
public void trace(@Nullable final String message) {
log(LogLevel.TRACE, DEFAULT_EVENT, message, EMPTY_STRING_ARRAY, EMPTY_OBJECT_ARRAY, DEFAULT_THROWABLE);
}
|
java
|
{
"resource": ""
}
|
q178578
|
Logger.trace
|
test
|
public void trace(@Nullable final String event, @Nullable final String message) {
log(LogLevel.TRACE, event, message, EMPTY_STRING_ARRAY, EMPTY_OBJECT_ARRAY, DEFAULT_THROWABLE);
}
|
java
|
{
"resource": ""
}
|
q178579
|
Logger.debug
|
test
|
public void debug(@Nullable final String message) {
log(LogLevel.DEBUG, DEFAULT_EVENT, message, EMPTY_STRING_ARRAY, EMPTY_OBJECT_ARRAY, DEFAULT_THROWABLE);
}
|
java
|
{
"resource": ""
}
|
q178580
|
Logger.debug
|
test
|
public void debug(@Nullable final String event, @Nullable final String message) {
log(LogLevel.DEBUG, event, message, EMPTY_STRING_ARRAY, EMPTY_OBJECT_ARRAY, DEFAULT_THROWABLE);
}
|
java
|
{
"resource": ""
}
|
q178581
|
Logger.info
|
test
|
public void info(@Nullable final String message) {
log(LogLevel.INFO, DEFAULT_EVENT, message, EMPTY_STRING_ARRAY, EMPTY_OBJECT_ARRAY, DEFAULT_THROWABLE);
}
|
java
|
{
"resource": ""
}
|
q178582
|
Logger.info
|
test
|
public void info(@Nullable final String event, @Nullable final String message) {
log(LogLevel.INFO, event, message, EMPTY_STRING_ARRAY, EMPTY_OBJECT_ARRAY, DEFAULT_THROWABLE);
}
|
java
|
{
"resource": ""
}
|
q178583
|
Logger.info
|
test
|
public void info(
@Nullable final String event,
@Nullable final String message,
@Nullable final String dataKey1,
@Nullable final String dataKey2,
@Nullable final Object dataValue1,
@Nullable final Object dataValue2) {
info(event, message, dataKey1, dataKey2, dataValue1, dataValue2, DEFAULT_THROWABLE);
}
|
java
|
{
"resource": ""
}
|
q178584
|
Logger.warn
|
test
|
public void warn(@Nullable final String message) {
log(LogLevel.WARN, DEFAULT_EVENT, message, EMPTY_STRING_ARRAY, EMPTY_OBJECT_ARRAY, DEFAULT_THROWABLE);
}
|
java
|
{
"resource": ""
}
|
q178585
|
Logger.warn
|
test
|
public void warn(@Nullable final String event, @Nullable final String message) {
log(LogLevel.WARN, event, message, EMPTY_STRING_ARRAY, EMPTY_OBJECT_ARRAY, DEFAULT_THROWABLE);
}
|
java
|
{
"resource": ""
}
|
q178586
|
Logger.error
|
test
|
public void error(@Nullable final String message) {
log(LogLevel.ERROR, DEFAULT_EVENT, message, EMPTY_STRING_ARRAY, EMPTY_OBJECT_ARRAY, DEFAULT_THROWABLE);
}
|
java
|
{
"resource": ""
}
|
q178587
|
Logger.error
|
test
|
public void error(@Nullable final String event, @Nullable final String message) {
log(LogLevel.ERROR, event, message, EMPTY_STRING_ARRAY, EMPTY_OBJECT_ARRAY, DEFAULT_THROWABLE);
}
|
java
|
{
"resource": ""
}
|
q178588
|
LogBuilderAspect.addToContextLineAndMethod
|
test
|
@Before("call(* com.arpnetworking.steno.LogBuilder.log())")
public void addToContextLineAndMethod(final JoinPoint joinPoint) {
final SourceLocation sourceLocation = joinPoint.getSourceLocation();
final LogBuilder targetLogBuilder = (LogBuilder) joinPoint.getTarget();
targetLogBuilder.addContext("line", String.valueOf(sourceLocation.getLine()));
targetLogBuilder.addContext("file", sourceLocation.getFileName());
targetLogBuilder.addContext("class", sourceLocation.getWithinType());
}
|
java
|
{
"resource": ""
}
|
q178589
|
StenoSerializationHelper.startStenoWrapper
|
test
|
public static void startStenoWrapper(
final ILoggingEvent event,
final String eventName,
final JsonGenerator jsonGenerator,
final ObjectMapper objectMapper)
throws IOException {
final StenoSerializationHelper.StenoLevel level = StenoSerializationHelper.StenoLevel.findByLogbackLevel(
event.getLevel());
jsonGenerator.writeStartObject();
jsonGenerator.writeObjectField("time",
ISO_DATE_TIME_FORMATTER.format(Instant.ofEpochMilli(event.getTimeStamp())));
jsonGenerator.writeObjectField("name", eventName);
jsonGenerator.writeObjectField("level", level.name());
}
|
java
|
{
"resource": ""
}
|
q178590
|
StenoSerializationHelper.writeKeyValuePairs
|
test
|
public static void writeKeyValuePairs(
@Nullable final List<String> keys,
@Nullable final List<Object> values,
final JsonGenerator jsonGenerator,
final ObjectMapper objectMapper,
final StenoEncoder encoder)
throws IOException {
if (keys != null) {
final int contextValuesLength = values == null ? 0 : values.size();
for (int i = 0; i < keys.size(); ++i) {
final String key = keys.get(i);
if (i >= contextValuesLength) {
jsonGenerator.writeObjectField(key, null);
} else {
final Object value = values.get(i);
if (isSimpleType(value)) {
jsonGenerator.writeObjectField(key, value);
} else {
jsonGenerator.writeFieldName(key);
objectMapper.writeValue(
jsonGenerator,
value);
}
}
}
}
}
|
java
|
{
"resource": ""
}
|
q178591
|
StenoSerializationHelper.serializeThrowable
|
test
|
public static void serializeThrowable(
final IThrowableProxy throwableProxy,
final JsonGenerator jsonGenerator,
final ObjectMapper objectMapper)
throws IOException {
jsonGenerator.writeStringField("type", throwableProxy.getClassName());
jsonGenerator.writeStringField("message", throwableProxy.getMessage());
jsonGenerator.writeArrayFieldStart("backtrace");
for (final StackTraceElementProxy ste : throwableProxy.getStackTraceElementProxyArray()) {
jsonGenerator.writeString(ste.toString());
}
jsonGenerator.writeEndArray();
jsonGenerator.writeObjectFieldStart("data");
if (throwableProxy instanceof ThrowableProxy) {
final JsonNode jsonNode = objectMapper.valueToTree(((ThrowableProxy) throwableProxy).getThrowable());
for (final Iterator<Map.Entry<String, JsonNode>> iterator = jsonNode.fields(); iterator.hasNext();) {
final Map.Entry<String, JsonNode> field = iterator.next();
jsonGenerator.writeFieldName(field.getKey());
objectMapper.writeValue(
jsonGenerator,
field.getValue());
}
}
// Although Throwable has a final getSuppressed which cannot return a null array, the
// proxy in Logback provides no such guarantees.
if (throwableProxy.getSuppressed() != null && throwableProxy.getSuppressed().length > 0) {
jsonGenerator.writeArrayFieldStart("suppressed");
for (final IThrowableProxy suppressed : throwableProxy.getSuppressed()) {
jsonGenerator.writeStartObject();
serializeThrowable(suppressed, jsonGenerator, objectMapper);
jsonGenerator.writeEndObject();
}
jsonGenerator.writeEndArray();
}
if (throwableProxy.getCause() != null) {
jsonGenerator.writeObjectFieldStart("cause");
serializeThrowable(throwableProxy.getCause(), jsonGenerator, objectMapper);
jsonGenerator.writeEndObject();
}
jsonGenerator.writeEndObject();
}
|
java
|
{
"resource": ""
}
|
q178592
|
RateLimitLogBuilder.toLogValue
|
test
|
@LogValue
public Object toLogValue() {
return LogValueMapFactory.<String, Object>builder()
.put("logBuilder", _logBuilder)
.put("duration", _duration)
.put("lastLogTime", _lastLogTime)
.put("skipped", _skipped)
.build();
}
|
java
|
{
"resource": ""
}
|
q178593
|
AbstractStenoCallerConverter.getCallerData
|
test
|
protected StackTraceElement getCallerData(final ILoggingEvent loggingEvent) {
final StackTraceElement[] callerData = loggingEvent.getCallerData();
if (callerData != null) {
for (int i = 0; i < callerData.length; ++i) {
final String callerClassName = callerData[i].getClassName();
if (!callerClassName.startsWith(STENO_CLASS_NAME_PREFIX)) {
return callerData[i];
}
}
}
return null;
}
|
java
|
{
"resource": ""
}
|
q178594
|
SafeSerializationHelper.safeEncodeValue
|
test
|
public static void safeEncodeValue(final StringBuilder encoder, @Nullable final Object value) {
if (value == null) {
encoder.append("null");
} else if (value instanceof Map) {
safeEncodeMap(encoder, (Map<?, ?>) value);
} else if (value instanceof List) {
safeEncodeList(encoder, (List<?>) value);
} else if (value.getClass().isArray()) {
safeEncodeArray(encoder, value);
} else if (value instanceof LogValueMapFactory.LogValueMap) {
safeEncodeLogValueMap(encoder, (LogValueMapFactory.LogValueMap) value);
} else if (value instanceof Throwable) {
safeEncodeThrowable(encoder, (Throwable) value);
} else if (StenoSerializationHelper.isSimpleType(value)) {
if (value instanceof Boolean) {
encoder.append(BooleanNode.valueOf((Boolean) value).toString());
} else if (value instanceof Double) {
encoder.append(DoubleNode.valueOf((Double) value).toString());
} else if (value instanceof Float) {
encoder.append(FloatNode.valueOf((Float) value).toString());
} else if (value instanceof Long) {
encoder.append(LongNode.valueOf((Long) value).toString());
} else if (value instanceof Integer) {
encoder.append(IntNode.valueOf((Integer) value).toString());
} else {
encoder.append(new TextNode(value.toString()).toString());
}
} else {
safeEncodeValue(encoder, LogReferenceOnly.of(value).toLogValue());
}
}
|
java
|
{
"resource": ""
}
|
q178595
|
BeejuJUnitRule.createDatabase
|
test
|
public void createDatabase(String databaseName) throws TException {
HiveMetaStoreClient client = new HiveMetaStoreClient(conf());
String databaseFolder = new File(temporaryFolder.getRoot(), databaseName).toURI().toString();
try {
client.createDatabase(new Database(databaseName, null, databaseFolder, null));
} finally {
client.close();
}
}
|
java
|
{
"resource": ""
}
|
q178596
|
AbsObjectPool.checkMappings
|
test
|
protected void checkMappings(int arrayPosition) {
final int index = positions.indexOfValue(arrayPosition);
if (index >= 0) {
positions.removeAt(index);
}
}
|
java
|
{
"resource": ""
}
|
q178597
|
SaveAttrsUtility.parseSaveAttr
|
test
|
public static String parseSaveAttr(final Cell cell, final Map<String, String> saveCommentsMap) {
if (cell != null) {
String key = cell.getSheet().getSheetName() + "!"
+ CellUtility.getCellIndexNumberKey(cell.getColumnIndex(), cell.getRowIndex());
String saveAttr = null;
if (saveCommentsMap != null) {
saveAttr = ParserUtility.getStringBetweenBracket(saveCommentsMap.get(key));
}
if ((saveAttr == null) && (cell.getCellTypeEnum() == CellType.STRING)) {
saveAttr = SaveAttrsUtility.parseSaveAttrString(cell.getStringCellValue());
}
if ((saveAttr != null) && (!saveAttr.isEmpty())) {
return TieConstants.CELL_ADDR_PRE_FIX + cell.getColumnIndex() + "=" + saveAttr + ",";
}
}
return "";
}
|
java
|
{
"resource": ""
}
|
q178598
|
SaveAttrsUtility.saveDataToObjectInContext
|
test
|
public static void saveDataToObjectInContext(final Map<String, Object> context, final String saveAttr,
final String strValue, final ExpressionEngine engine) {
int index = saveAttr.lastIndexOf('.');
if (index > 0) {
String strObject = saveAttr.substring(0, index);
String strMethod = saveAttr.substring(index + 1);
strObject = TieConstants.METHOD_PREFIX + strObject + TieConstants.METHOD_END;
Object object = CommandUtility.evaluate(strObject, context, engine);
CellControlsUtility.setObjectProperty(object, strMethod, strValue, true);
}
}
|
java
|
{
"resource": ""
}
|
q178599
|
SaveAttrsUtility.refreshSheetRowFromContext
|
test
|
public static void refreshSheetRowFromContext(final Map<String, Object> context, final String fullSaveAttr,
final Row row, final ExpressionEngine engine) {
if (!fullSaveAttr.startsWith(TieConstants.CELL_ADDR_PRE_FIX)) {
return;
}
int ipos = fullSaveAttr.indexOf('=');
if (ipos > 0) {
String columnIndex = fullSaveAttr.substring(1, ipos);
String saveAttr = fullSaveAttr.substring(ipos + 1);
Cell cell = row.getCell(Integer.parseInt(columnIndex));
if (cell.getCellTypeEnum() != CellType.FORMULA) {
CommandUtility.evaluateNormalCells(cell,
TieConstants.METHOD_PREFIX + saveAttr + TieConstants.METHOD_END, context, engine);
}
}
}
|
java
|
{
"resource": ""
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.