Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorspingel2007-12-16 07:09:45 +0000
committerspingel2007-12-16 07:09:45 +0000
commit2c2fceea8ee327f094650b5f0a704cbebde7698e (patch)
tree4072196185889d9bbfbc1f68c26178aa4b34a025 /org.eclipse.mylyn.trac.core/src/org/eclipse
parent82fd64006414689410bb5dfbdd35b1de77e88b36 (diff)
downloadorg.eclipse.mylyn.tasks-2c2fceea8ee327f094650b5f0a704cbebde7698e.tar.gz
org.eclipse.mylyn.tasks-2c2fceea8ee327f094650b5f0a704cbebde7698e.tar.xz
org.eclipse.mylyn.tasks-2c2fceea8ee327f094650b5f0a704cbebde7698e.zip
NEW - bug 213100: automate publishing failed tests
https://bugs.eclipse.org/bugs/show_bug.cgi?id=213100
Diffstat (limited to 'org.eclipse.mylyn.trac.core/src/org/eclipse')
-rw-r--r--org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracClientManager.java7
-rw-r--r--org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracCorePlugin.java26
-rw-r--r--org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracRepositoryConnector.java44
-rw-r--r--org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracTask.java15
-rw-r--r--org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/model/TracTicket.java2
5 files changed, 50 insertions, 44 deletions
diff --git a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracClientManager.java b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracClientManager.java
index 5e81fd5df..4164cf71a 100644
--- a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracClientManager.java
+++ b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracClientManager.java
@@ -17,7 +17,10 @@ import java.io.ObjectOutputStream;
import java.util.HashMap;
import java.util.Map;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
import org.eclipse.mylyn.internal.trac.core.ITracClient.Version;
+import org.eclipse.mylyn.monitor.core.StatusHandler;
import org.eclipse.mylyn.tasks.core.ITaskRepositoryListener;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.core.TaskRepositoryLocationFactory;
@@ -100,7 +103,7 @@ public class TracClientManager implements ITaskRepositoryListener {
}
}
} catch (Throwable e) {
- TracCorePlugin.log(e);
+ StatusHandler.log(new Status(IStatus.WARNING, TracCorePlugin.PLUGIN_ID, "The Trac respository configuration cache could not be read", e));
} finally {
if (in != null) {
try {
@@ -127,7 +130,7 @@ public class TracClientManager implements ITaskRepositoryListener {
out.writeObject(clientDataByUrl.get(url));
}
} catch (IOException e) {
- TracCorePlugin.log(e);
+ StatusHandler.log(new Status(IStatus.WARNING, TracCorePlugin.PLUGIN_ID, "The Trac respository configuration cache could not be written", e));
} finally {
if (out != null) {
try {
diff --git a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracCorePlugin.java b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracCorePlugin.java
index db3315cab..9f67399e9 100644
--- a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracCorePlugin.java
+++ b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracCorePlugin.java
@@ -71,7 +71,7 @@ public class TracCorePlugin extends Plugin {
* Returns the path to the file caching repository attributes.
*/
protected IPath getRepostioryAttributeCachePath() {
- IPath stateLocation = Platform.getStateLocation(TracCorePlugin.getDefault().getBundle());
+ IPath stateLocation = Platform.getStateLocation(getBundle());
IPath cacheFile = stateLocation.append("repositoryConfigurations");
return cacheFile;
}
@@ -99,28 +99,4 @@ public class TracCorePlugin extends Plugin {
}
}
- /**
- * Convenience method for logging statuses to the plug-in log
- *
- * @param status
- * the status to log
- */
- public static void log(IStatus status) {
- getDefault().getLog().log(status);
- }
-
- /**
- * Convenience method for logging exceptions to the plug-in log
- *
- * @param e
- * the exception to log
- */
- public static void log(Throwable e) {
- String message = e.getMessage();
- if (e.getMessage() == null) {
- message = e.getClass().toString();
- }
- log(new Status(Status.ERROR, TracCorePlugin.PLUGIN_ID, 0, message, e));
- }
-
}
diff --git a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracRepositoryConnector.java b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracRepositoryConnector.java
index e28dcb0d8..aaf175235 100644
--- a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracRepositoryConnector.java
+++ b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracRepositoryConnector.java
@@ -15,6 +15,7 @@ import java.util.List;
import java.util.Set;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.OperationCanceledException;
@@ -52,9 +53,20 @@ public class TracRepositoryConnector extends AbstractRepositoryConnector {
private TracAttachmentHandler attachmentHandler = new TracAttachmentHandler(this);
private TaskRepositoryLocationFactory taskRepositoryLocationFactory = new TaskRepositoryLocationFactory();
-
+
+ private File repositoryConfigurationCacheFile;
+
+ public TracRepositoryConnector(File repositoryConfigurationCacheFile) {
+ this.repositoryConfigurationCacheFile = repositoryConfigurationCacheFile;
+
+ }
+
public TracRepositoryConnector() {
- TracCorePlugin.getDefault().setConnector(this);
+ if (TracCorePlugin.getDefault() != null) {
+ TracCorePlugin.getDefault().setConnector(this);
+ IPath path = TracCorePlugin.getDefault().getRepostioryAttributeCachePath();
+ repositoryConfigurationCacheFile = path.toFile();
+ }
}
@Override
@@ -198,8 +210,10 @@ public class TracRepositoryConnector extends AbstractRepositoryConnector {
}
if (ids.size() == 1) {
- // getChangedTickets() is expected to always return at least one ticket because
- // the repository synchronization timestamp is set to the most recent modification date
+ // getChangedTickets() is expected to always return at least
+ // one ticket because
+ // the repository synchronization timestamp is set to the
+ // most recent modification date
Integer id = ids.iterator().next();
Date lastChanged = client.getTicketLastChanged(id);
if (since.equals(lastChanged)) {
@@ -264,7 +278,8 @@ public class TracRepositoryConnector extends AbstractRepositoryConnector {
repositoryTask.setOwner(taskData.getAttributeValue(RepositoryTaskAttribute.USER_ASSIGNED));
repositoryTask.setCompleted(TracTask.isCompleted(taskData.getStatus()));
repositoryTask.setUrl(repository.getUrl() + ITracClient.TICKET_URL + taskData.getId());
- repositoryTask.setPriority(TracTask.getMylynPriority(taskData.getAttributeValue(Attribute.PRIORITY.getTracKey())));
+ repositoryTask.setPriority(TracTask.getMylynPriority(taskData.getAttributeValue(Attribute.PRIORITY
+ .getTracKey())));
Kind kind = TracTask.Kind.fromType(taskData.getAttributeValue(Attribute.TYPE.getTracKey()));
repositoryTask.setTaskKind((kind != null) ? kind.toString() : null);
// TODO: Completion Date
@@ -282,11 +297,7 @@ public class TracRepositoryConnector extends AbstractRepositoryConnector {
public synchronized TracClientManager getClientManager() {
if (clientManager == null) {
- File cacheFile = null;
- if (TracCorePlugin.getDefault().getRepostioryAttributeCachePath() != null) {
- cacheFile = TracCorePlugin.getDefault().getRepostioryAttributeCachePath().toFile();
- }
- clientManager = new TracClientManager(cacheFile, taskRepositoryLocationFactory);
+ clientManager = new TracClientManager(repositoryConfigurationCacheFile, taskRepositoryLocationFactory);
}
return clientManager;
}
@@ -402,16 +413,16 @@ public class TracRepositoryConnector extends AbstractRepositoryConnector {
String action = operation.getKnobName();
if (!"leave".equals(action)) {
if ("accept".equals(action)) {
- ticket.putValue("status", "assigned");
+ ticket.putValue("status", TracTask.Status.ASSIGNED.toStatusString());
ticket.putValue("owner", getDisplayUsername(repository));
} else if ("resolve".equals(action)) {
- ticket.putValue("status", "closed");
+ ticket.putValue("status", TracTask.Status.CLOSED.toStatusString());
ticket.putValue("resolution", operation.getOptionSelection());
} else if ("reopen".equals(action)) {
- ticket.putValue("status", "reopened");
+ ticket.putValue("status", TracTask.Status.REOPENED.toStatusString());
ticket.putValue("resolution", "");
} else if ("reassign".equals(operation.getKnobName())) {
- ticket.putValue("status", "new");
+ ticket.putValue("status", TracTask.Status.NEW.toStatusString());
ticket.putValue("owner", operation.getInputValue());
}
}
@@ -423,8 +434,9 @@ public class TracRepositoryConnector extends AbstractRepositoryConnector {
public TaskRepositoryLocationFactory getTaskRepositoryLocationFactory() {
return taskRepositoryLocationFactory;
}
-
- public synchronized void setTaskRepositoryLocationFactory(TaskRepositoryLocationFactory taskRepositoryLocationFactory) {
+
+ public synchronized void setTaskRepositoryLocationFactory(
+ TaskRepositoryLocationFactory taskRepositoryLocationFactory) {
this.taskRepositoryLocationFactory = taskRepositoryLocationFactory;
if (this.clientManager != null) {
clientManager.setTaskRepositoryLocationFactory(taskRepositoryLocationFactory);
diff --git a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracTask.java b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracTask.java
index 2be1ea387..57a7f143f 100644
--- a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracTask.java
+++ b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracTask.java
@@ -129,6 +129,21 @@ public class TracTask extends AbstractTask {
return null;
}
+ public String toStatusString() {
+ switch (this) {
+ case NEW:
+ return "new";
+ case ASSIGNED:
+ return "assigned";
+ case REOPENED:
+ return "reopened";
+ case CLOSED:
+ return "closed";
+ default:
+ return "";
+ }
+ }
+
}
public TracTask(String repositoryUrl, String id, String label) {
diff --git a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/model/TracTicket.java b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/model/TracTicket.java
index b7d92e13a..dfc6fbb7f 100644
--- a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/model/TracTicket.java
+++ b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/model/TracTicket.java
@@ -92,7 +92,7 @@ public class TracTicket {
* Constructs a Trac ticket.
*
* @param id
- * the nummeric Trac ticket id
+ * the numeric Trac ticket id
*/
public TracTicket(int id) {
this.id = id;

Back to the top