Search in sources :

Example 1 with TaskProjectConfiguration

use of com.intellij.tasks.impl.TaskProjectConfiguration in project intellij-community by JetBrains.

the class TaskManagerTest method testSharedServers.

public void testSharedServers() throws Exception {
    TaskRepository repository = new YouTrackRepository(new YouTrackRepositoryType());
    repository.setShared(true);
    myTaskManager.setRepositories(Collections.singletonList(repository));
    TaskProjectConfiguration configuration = ServiceManager.getService(getProject(), TaskProjectConfiguration.class);
    TaskProjectConfiguration state = configuration.getState();
    assertNotNull(state);
    assertEquals(1, state.servers.size());
    Element element = XmlSerializer.serialize(state);
    configuration.servers.clear();
    myTaskManager.setRepositories(Collections.emptyList());
    configuration.loadState(XmlSerializer.deserialize(element, TaskProjectConfiguration.class));
    assertEquals(1, state.servers.size());
    myTaskManager.projectOpened();
    TaskRepository[] repositories = myTaskManager.getAllRepositories();
    assertEquals(1, repositories.length);
    assertTrue(repositories[0].isShared());
}
Also used : TaskProjectConfiguration(com.intellij.tasks.impl.TaskProjectConfiguration) YouTrackRepositoryType(com.intellij.tasks.youtrack.YouTrackRepositoryType) YouTrackRepository(com.intellij.tasks.youtrack.YouTrackRepository) Element(org.jdom.Element)

Aggregations

TaskProjectConfiguration (com.intellij.tasks.impl.TaskProjectConfiguration)1 YouTrackRepository (com.intellij.tasks.youtrack.YouTrackRepository)1 YouTrackRepositoryType (com.intellij.tasks.youtrack.YouTrackRepositoryType)1 Element (org.jdom.Element)1