<commit_before>/*
 * Copyright 2006-2007 The Kuali Foundation.
 * 
 * Licensed under the Educational Community License, Version 1.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 * http://www.opensource.org/licenses/ecl1.php
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.kuali.test.suite;

import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import java.util.regex.Pattern;
import java.lang.reflect.Method;

import com.meterware.httpunit.WebResponse;
import com.meterware.httpunit.WebConversation;
import com.meterware.httpunit.GetMethodWebRequest;
import org.w3c.dom.NodeList;
import org.kuali.core.util.AssertionUtils;
import junit.framework.TestSuite;
import junit.framework.TestCase;

/**
 * The abstract superclass of suites of all test classes or methods which {@link RelatesTo} a Kuali JIRA issue
 * that is currently in a certain state (e.g., in-progress).  IDEs or Ant can run the concrete subclasses as JUnit tests.
 *
 * @see org.kuali.test.suite.RelatesTo
 */
public abstract class JiraRelatedSuite {

    public static enum State {
        IN_PROGRESS("status=3&tempMax=1000"),
        OPEN_OR_IN_PROGRESS("status=1&status=3&tempMax=9999"),
        OPEN_OR_IN_PROGRESS_OR_REOPENED("status=1&status=3&status=4&tempMax=9999");

        public final String filterUrl;

        State(String uniquePart) {
            this.filterUrl = "https://test.kuali.org/jira/secure/IssueNavigator.jspa?os_username=kuali-rss-feed-user&os_password=<PASSWORD>&view=rss&reset=true&decorator=none&" + uniquePart;
        }
    }

    private static Map<State, Collection<String>> jiraIssuesByState = new HashMap<State, Collection<String>>();
    private static RuntimeException initializationException = null;
    private final static Pattern EXPECTED_JIRA_KEY = Pattern.compile("KUL\\p{Upper}+-\\p{Digit}+");

    /**
     * Gets the JIRA issues currently in the given state.  Caches the results, to avoid queries to the JIRA server, for speed.
     * 
     * @param state the state to get
     * @return a Set of the names of all JIRA issues currently in the given state
     * @throws RuntimeException if the JIRA server cannot be queried for this list, or its response cannot be understood.<commit_msg>KULCG-20 - testing CVS conflict<commit_after>/*
 * Copyright 2006-2007 The Kuali Foundation.
 * 
 * Licensed under the Educational Community License, Version 1.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 * http://www.opensource.org/licenses/ecl1.php
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.kuali.test.suite;

import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import java.util.regex.Pattern;
import java.lang.reflect.Method;

import com.meterware.httpunit.WebResponse;
import com.meterware.httpunit.WebConversation;
import com.meterware.httpunit.GetMethodWebRequest;
import org.w3c.dom.NodeList;
import org.kuali.core.util.AssertionUtils;
import junit.framework.TestSuite;
import junit.framework.TestCase;

/**
 * The abstract superclass of suites of all test classes or methods which {@link RelatesTo} a Kuali JIRA issue
 * that is currently in a certain state (e.g., in-progress).  IDEs or Ant can run the concrete subclasses as JUnit tests.
 *
 * @see org.kuali.test.suite.RelatesTo
 */
public abstract class JiraRelatedSuite {

    public static enum State {
        TEST1("foo"),
        IN_PROGRESS("status=3&tempMax=1000"),
        OPEN_OR_IN_PROGRESS("status=1&status=3&tempMax=9999"),
        OPEN_OR_IN_PROGRESS_OR_REOPENED("status=1&status=3&status=4&tempMax=9999");

        public final String filterUrl;

        State(String uniquePart) {
            this.filterUrl = "https://test.kuali.org/jira/secure/IssueNavigator.jspa?os_username=kuali-rss-feed-user&os_password=<PASSWORD>&view=rss&reset=true&decorator=none&" + uniquePart;
        }
    }

    private static Map<State, Collection<String>> jiraIssuesByState = new HashMap<State, Collection<String>>();
    private static RuntimeException initializationException = null;
    private final static Pattern EXPECTED_JIRA_KEY = Pattern.compile("KUL\\p{Upper}+-\\p{Digit}+");

    /**
     * Gets the JIRA issues currently in the given state.  Caches the results, to avoid queries to the JIRA server, for speed.
     * 
     * @param state the state to get
     * @return a Set of the names of all JIRA issues currently in the given state
     * @throws RuntimeException if the JIRA server cannot be queried for this list, or its response cannot be understood.
{'fraction_non_alphanumeric': 0.092880978865406, 'fraction_numerical': 0.01167964404894327, 'mean_word_length': 4.089622641509434, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '5217317', 'n_tokens_mistral': 1637, 'n_tokens_neox': 1565, 'n_words': 519}