<commit_before>package it.com.atlassian.jira.plugins.dvcs.cleanup;

import com.atlassian.jira.pageobjects.JiraTestedProduct;
import com.atlassian.jira.plugins.dvcs.util.PasswordUtil;
import com.atlassian.pageobjects.TestedProductFactory;
import org.joda.time.DateTime;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testng.annotations.Test;

import java.io.IOException;

import static com.atlassian.jira.plugins.dvcs.pageobjects.common.OAuthUtils.TEST_OAUTH_PREFIX;
import static org.apache.commons.lang3.StringUtils.trim;

/**
 * Base class to delete orphan OAUTH Applications (expired applications) for multiple repo owners in Bitbucket and
 * Github.
 * <p/>
 * The orphan applications are created by webdriver tests and leaked when some unexpected failure happens and they have
 * a standard name Test_OAuth_[date/time in milliseconds].
 */
public abstract class DeleteOrphanAppsBaseTest
{
    protected static final Logger log = LoggerFactory.getLogger(DeleteOrphanAppsBaseTest.class);

    protected static final String[] REPO_OWNERS = { "dvcsconnectortest", "jirabitbucketconnector" };

    private static final int CONSUMER_EXPIRY_DAYS = 3;
    private static final DateTime CUT_OFF_DATE = new DateTime().minusDays(CONSUMER_EXPIRY_DAYS);

    protected JiraTestedProduct jira = TestedProductFactory.create(JiraTestedProduct.class);

    @Test
    public void deleteOrphanOAuthApplications()
    {
        for (String owner : REPO_OWNERS)
        {
            try
            {
                final String password = PasswordUtil.getPassword(owner);
                login(owner, password);
                deleteOrphanOAuthApplications(owner, password);
            }
            catch (Exception e)
            {
                log.warn("Failed to delete OAUTH expired consumers", e);
            }
            finally
            {
                logout();
            }<commit_msg>FUSE-2386: Reduced the expiry to one day for the orphaned OAuth applications<commit_after>package it.com.atlassian.jira.plugins.dvcs.cleanup;

import com.atlassian.jira.pageobjects.JiraTestedProduct;
import com.atlassian.jira.plugins.dvcs.util.PasswordUtil;
import com.atlassian.pageobjects.TestedProductFactory;
import org.joda.time.DateTime;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testng.annotations.Test;

import java.io.IOException;

import static com.atlassian.jira.plugins.dvcs.pageobjects.common.OAuthUtils.TEST_OAUTH_PREFIX;
import static org.apache.commons.lang3.StringUtils.trim;

/**
 * Base class to delete orphan OAUTH Applications (expired applications) for multiple repo owners in Bitbucket and
 * Github.
 * <p/>
 * The orphan applications are created by webdriver tests and leaked when some unexpected failure happens and they have
 * a standard name Test_OAuth_[date/time in milliseconds].
 */
public abstract class DeleteOrphanAppsBaseTest
{
    protected static final Logger log = LoggerFactory.getLogger(DeleteOrphanAppsBaseTest.class);

    protected static final String[] REPO_OWNERS = { "dvcsconnectortest", "jirabitbucketconnector" };

    private static final int CONSUMER_EXPIRY_DAYS = 1;
    private static final DateTime CUT_OFF_DATE = new DateTime().minusDays(CONSUMER_EXPIRY_DAYS);

    protected JiraTestedProduct jira = TestedProductFactory.create(JiraTestedProduct.class);

    @Test
    public void deleteOrphanOAuthApplications()
    {
        for (String owner : REPO_OWNERS)
        {
            try
            {
                final String password = PasswordUtil.getPassword(owner);
                login(owner, password);
                deleteOrphanOAuthApplications(owner, password);
            }
            catch (Exception e)
            {
                log.warn("Failed to delete OAUTH expired consumers", e);
            }
            finally
            {
                logout();
            }
{'fraction_non_alphanumeric': 0.07753530166880616, 'fraction_numerical': 0.0030808729139922978, 'mean_word_length': 3.1757770632368705, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5533718', 'n_tokens_mistral': 1133, 'n_tokens_neox': 1075, 'n_words': 269}