-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding test config via properties file, the file is in gitignored
- Loading branch information
1 parent
956ccfd
commit 9ee6ad4
Showing
2 changed files
with
34 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
target/ | ||
.idea/ | ||
jiraRestClient.iml | ||
src/test/resource/config.properties |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,10 +5,12 @@ | |
import de.micromata.jira.rest.core.misc.RestPathConstants; | ||
import org.junit.Before; | ||
|
||
import java.io.FileInputStream; | ||
import java.io.IOException; | ||
import java.net.URI; | ||
import java.net.URISyntaxException; | ||
import java.text.SimpleDateFormat; | ||
import java.util.Properties; | ||
import java.util.concurrent.ExecutionException; | ||
import java.util.concurrent.ExecutorService; | ||
import java.util.concurrent.Executors; | ||
|
@@ -17,30 +19,53 @@ | |
* Junit-Test for JiraRestClient. | ||
* You need a running Jira-Instance with the TEST_SYSTEM_URL. | ||
* Best use is the atlassian-plugin-sdk | ||
* | ||
* <p> | ||
* User: Christian Schulze | ||
* Email: [email protected] | ||
* Date: 09.08.2014 | ||
*/ | ||
class BaseTest implements JqlConstants, RestPathConstants { | ||
|
||
private static final String TEST_SYSTEM_URL = "http://localhost:2990/jira"; | ||
private static final String USERNAME = "admin"; | ||
private static final String PASSWORD = "admin"; | ||
static final String CONFIGFILENAME = "config.properties"; | ||
|
||
static final String URL_PARAM = "url"; | ||
static final String LOGIN_PARAM = "login"; | ||
static final String PASSWORD_PARAM = "password"; | ||
|
||
static final String USERNAME_TO_SEARCH = "admin"; | ||
static final String ISSUEKEY_TO_SEARCH = "DEMO-1"; | ||
static final String PROJECT_TO_SEARCH = "DEMO"; | ||
|
||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | ||
String testSystemUrl = "http://localhost:2990/jira"; | ||
String login = "admin"; | ||
String password = "admin"; | ||
|
||
JiraRestClient jiraRestClient; | ||
|
||
public BaseTest() { | ||
try { | ||
loadConfig(); | ||
} catch (IOException e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
@Before | ||
public void connect() throws URISyntaxException, IOException, ExecutionException, InterruptedException { | ||
ExecutorService executorService = Executors.newFixedThreadPool(100); | ||
ExecutorService executorService = Executors.newFixedThreadPool(100); | ||
// ProxyHost proxy = new ProxyHost("proxy", 3128); | ||
URI uri = new URI(TEST_SYSTEM_URL); | ||
URI uri = new URI(testSystemUrl); | ||
jiraRestClient = new JiraRestClient(executorService); | ||
jiraRestClient.connect(uri, USERNAME, PASSWORD); | ||
jiraRestClient.connect(uri, login, password); | ||
} | ||
|
||
private void loadConfig() throws IOException { | ||
String path = Thread.currentThread().getContextClassLoader().getResource("").getPath(); | ||
Properties config = new Properties(); | ||
config.load(new FileInputStream(path + CONFIGFILENAME)); | ||
testSystemUrl = config.getProperty(URL_PARAM); | ||
login = config.getProperty(LOGIN_PARAM); | ||
password = config.getProperty(PASSWORD_PARAM); | ||
|
||
} | ||
} |