Search in sources :

Example 1 with YouTrackRepository

use of com.intellij.tasks.youtrack.YouTrackRepository 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)

Example 2 with YouTrackRepository

use of com.intellij.tasks.youtrack.YouTrackRepository in project intellij-community by JetBrains.

the class TaskSettingsTest method testCarriageReturnInFormat.

public void testCarriageReturnInFormat() throws Exception {
    TaskRepository repository = new YouTrackRepository();
    String format = "foo \n bar";
    repository.setCommitMessageFormat(format);
    ((TaskManagerImpl) myTaskManager).setRepositories(Collections.singletonList(repository));
    TaskManagerImpl.Config config = ((TaskManagerImpl) myTaskManager).getState();
    Element element = XmlSerializer.serialize(config);
    ByteArrayOutputStream stream = new ByteArrayOutputStream();
    JDOMUtil.writeDocument(new Document(element), stream, "\n");
    Element element1 = JDOMUtil.load(new ByteArrayInputStream(stream.toByteArray()));
    TaskManagerImpl.Config deserialize = XmlSerializer.deserialize(element1, TaskManagerImpl.Config.class);
    ((TaskManagerImpl) myTaskManager).loadState(deserialize);
    TaskRepository[] repositories = myTaskManager.getAllRepositories();
    assertEquals(format, repositories[0].getCommitMessageFormat());
}
Also used : YouTrackRepository(com.intellij.tasks.youtrack.YouTrackRepository) ByteArrayInputStream(java.io.ByteArrayInputStream) Element(org.jdom.Element) TaskManagerImpl(com.intellij.tasks.impl.TaskManagerImpl) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Document(org.jdom.Document)

Example 3 with YouTrackRepository

use of com.intellij.tasks.youtrack.YouTrackRepository in project intellij-community by JetBrains.

the class YouTrackIntegrationTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    myRepository = new YouTrackRepository(new YouTrackRepositoryType());
    myRepository.setUrl(YOUTRACK_4_TEST_SERVER_URL);
    myRepository.setUsername("buildtest");
    myRepository.setPassword("buildtest");
}
Also used : YouTrackRepositoryType(com.intellij.tasks.youtrack.YouTrackRepositoryType) YouTrackRepository(com.intellij.tasks.youtrack.YouTrackRepository)

Aggregations

YouTrackRepository (com.intellij.tasks.youtrack.YouTrackRepository)3 YouTrackRepositoryType (com.intellij.tasks.youtrack.YouTrackRepositoryType)2 Element (org.jdom.Element)2 TaskManagerImpl (com.intellij.tasks.impl.TaskManagerImpl)1 TaskProjectConfiguration (com.intellij.tasks.impl.TaskProjectConfiguration)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 Document (org.jdom.Document)1