summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteffen Pingel2012-03-02 18:48:15 (EST)
committer Steffen Pingel2012-03-02 18:48:15 (EST)
commit25a9b1bbbbc9ca6c86e3863373d2e0eb43b70909 (patch)
tree499db1fb0c4be2cb27439079721a25ea02122e5d
parent2dd3ba240a7362674684f723816afbba886833d9 (diff)
downloadorg.eclipse.mylyn.commons-25a9b1bbbbc9ca6c86e3863373d2e0eb43b70909.zip
org.eclipse.mylyn.commons-25a9b1bbbbc9ca6c86e3863373d2e0eb43b70909.tar.gz
org.eclipse.mylyn.commons-25a9b1bbbbc9ca6c86e3863373d2e0eb43b70909.tar.bz2
NEW - bug 373165: deprecate TestUtil in favor of CommonTestUtil
https://bugs.eclipse.org/bugs/show_bug.cgi?id=373165 Change-Id: I980935f29483e3d36266fbbee8cd7134e4428a05
-rw-r--r--org.eclipse.mylyn.commons.sdk.util/src/org/eclipse/mylyn/commons/sdk/util/CommonTestUtil.java12
-rw-r--r--org.eclipse.mylyn.commons.sdk.util/testdata/credentials.properties2
2 files changed, 12 insertions, 2 deletions
diff --git a/org.eclipse.mylyn.commons.sdk.util/src/org/eclipse/mylyn/commons/sdk/util/CommonTestUtil.java b/org.eclipse.mylyn.commons.sdk.util/src/org/eclipse/mylyn/commons/sdk/util/CommonTestUtil.java
index bd6c0dd..0ac3d87 100644
--- a/org.eclipse.mylyn.commons.sdk.util/src/org/eclipse/mylyn/commons/sdk/util/CommonTestUtil.java
+++ b/org.eclipse.mylyn.commons.sdk.util/src/org/eclipse/mylyn/commons/sdk/util/CommonTestUtil.java
@@ -197,12 +197,12 @@ public class CommonTestUtil {
String filename = System.getProperty(KEY_CREDENTIALS_FILE);
if (filename == null) {
try {
- file = getFile(CommonTestUtil.class, "credentials.properties");
+ file = new File(new File(System.getProperty("user.home"), ".mylyn"), "credentials.properties");
if (!file.exists()) {
throw new AssertionFailedError();
}
} catch (AssertionFailedError e) {
- file = new File(new File(System.getProperty("user.home"), ".mylyn"), "credentials.properties");
+ file = getFile(CommonTestUtil.class, "testdata/credentials.properties");
}
} else {
file = new File(filename);
@@ -449,4 +449,12 @@ public class CommonTestUtil {
}
}
+ public static String getShortUserName(UserCredentials credentials) {
+ String username = credentials.getUserName();
+ if (username.contains("@")) {
+ return username.substring(0, username.indexOf("@"));
+ }
+ return username;
+ }
+
}
diff --git a/org.eclipse.mylyn.commons.sdk.util/testdata/credentials.properties b/org.eclipse.mylyn.commons.sdk.util/testdata/credentials.properties
new file mode 100644
index 0000000..39f9211
--- /dev/null
+++ b/org.eclipse.mylyn.commons.sdk.util/testdata/credentials.properties
@@ -0,0 +1,2 @@
+user: tests@mylyn.eclipse.org
+pass: mylyntest