mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-200933 Explicitly set ID of the unspecified project in Redmine
in the same fashion it was done for Gitlab because of IDEA-198199.
This commit is contained in:
@@ -44,24 +44,26 @@ public class RedmineRepository extends NewBaseRepositoryImpl {
|
||||
private static final Pattern ID_PATTERN = Pattern.compile("\\d+");
|
||||
private static final Logger LOG = Logger.getInstance(RedmineRepository.class);
|
||||
|
||||
public static final RedmineProject UNSPECIFIED_PROJECT = new RedmineProject() {
|
||||
@NotNull
|
||||
@Override
|
||||
public String getName() {
|
||||
return "-- from all projects --";
|
||||
}
|
||||
public static final RedmineProject UNSPECIFIED_PROJECT = createUnspecifiedProject();
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public String getIdentifier() {
|
||||
return getName();
|
||||
}
|
||||
@NotNull
|
||||
private static RedmineProject createUnspecifiedProject() {
|
||||
final RedmineProject unspecified = new RedmineProject() {
|
||||
@NotNull
|
||||
@Override
|
||||
public String getName() {
|
||||
return "-- from all projects --";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return -1;
|
||||
}
|
||||
};
|
||||
@Nullable
|
||||
@Override
|
||||
public String getIdentifier() {
|
||||
return getName();
|
||||
}
|
||||
};
|
||||
unspecified.setId(-1);
|
||||
return unspecified;
|
||||
}
|
||||
|
||||
private String myAPIKey = "";
|
||||
private RedmineProject myCurrentProject;
|
||||
|
||||
+15
@@ -1,5 +1,6 @@
|
||||
package com.intellij.tasks.integration;
|
||||
|
||||
import com.intellij.configurationStore.XmlSerializer;
|
||||
import com.intellij.tasks.Task;
|
||||
import com.intellij.tasks.TaskBundle;
|
||||
import com.intellij.tasks.TaskManagerTestCase;
|
||||
@@ -9,6 +10,8 @@ import com.intellij.tasks.redmine.RedmineRepository;
|
||||
import com.intellij.tasks.redmine.RedmineRepositoryType;
|
||||
import com.intellij.tasks.redmine.model.RedmineProject;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import one.util.streamex.StreamEx;
|
||||
import org.jdom.Element;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -133,6 +136,18 @@ public class RedmineIntegrationTest extends TaskManagerTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
// IDEA-200933
|
||||
public void testUnspecifiedProjectIdSerialized() {
|
||||
myRepository.setCurrentProject(RedmineRepository.UNSPECIFIED_PROJECT);
|
||||
final List<Element> options = XmlSerializer.serialize(myRepository).getChildren("option");
|
||||
final String serializedId = StreamEx.of(options)
|
||||
.findFirst(elem -> "currentProject".equals(elem.getAttributeValue("name")))
|
||||
.map(elem -> elem.getChild("RedmineProject"))
|
||||
.map(elem -> elem.getAttributeValue("id"))
|
||||
.orElse(null);
|
||||
assertEquals("-1", serializedId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
|
||||
Reference in New Issue
Block a user