Merge branch 'mikhail.golubev/configurable-issues-states'
[idea/community.git] / plugins / tasks / tasks-tests / test / com / intellij / tasks / integration / AssemblaIntegrationTest.java
1 /*
2  * Copyright 2000-2013 JetBrains s.r.o.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package com.intellij.tasks.integration;
17
18 import com.intellij.tasks.Task;
19 import com.intellij.tasks.generic.GenericRepository;
20 import com.intellij.tasks.generic.GenericRepositoryType;
21 import org.jetbrains.annotations.NotNull;
22
23 import static com.intellij.tasks.TaskTestUtil.TaskBuilder;
24 import static com.intellij.tasks.TaskTestUtil.assertTasksEqual;
25
26 /**
27  * @author Dmitry Avdeev
28  *         Date: 4/1/13
29  */
30 public class AssemblaIntegrationTest extends GenericSubtypeTestCase {
31
32   public static final String TASK_LIST_RESPONSE =
33     "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
34     "<tickets type=\"array\">\n" +
35     "<ticket>\n" +
36     "  <assigned-to-id>dsNkyYr0Gr4iEBeJe5cbCb</assigned-to-id>\n" +
37     "  <completed-date type=\"datetime\"></completed-date>\n" +
38     "  <component-id type=\"integer\"></component-id>\n" +
39     "  <created-on type=\"datetime\">2013-04-01T10:45:06+03:00</created-on>\n" +
40     "  <description></description>\n" +
41     "  <from-support type=\"integer\">0</from-support>\n" +
42     "  <id type=\"integer\">50351983</id>\n" +
43     "  <importance type=\"integer\">-1</importance>\n" +
44     "  <importance-float type=\"float\">-1.0</importance-float>\n" +
45     "  <is-story type=\"boolean\">false</is-story>\n" +
46     "  <milestone-id type=\"integer\"></milestone-id>\n" +
47     "  <notification-list>dsNkyYr0Gr4iEBeJe5cbCb</notification-list>\n" +
48     "  <number type=\"integer\">1</number>\n" +
49     "  <priority type=\"integer\">3</priority>\n" +
50     "  <reporter-id>dsNkyYr0Gr4iEBeJe5cbCb</reporter-id>\n" +
51     "  <space-id>ab1WOCMQar4QGgacwqjQWU</space-id>\n" +
52     "  <status type='integer'>0</status>\n" +
53     "  <status-name>New</status-name>\n" +
54     "  <story-importance type=\"integer\">0</story-importance>\n" +
55     "  <summary>&#1055;&#1088;&#1080;&#1074;&#1077;&#1090;</summary>\n" +
56     "  <updated-at type=\"datetime\">2013-04-01T10:48:19+03:00</updated-at>\n" +
57     "  <working-hours type=\"float\">0.0</working-hours>\n" +
58     "  <working-hour type=\"float\" warning=\"deprecated\">0.0</working-hour>\n" +
59     "  <estimate type=\"string\">Small</estimate>\n" +
60     "  <total-estimate type=\"float\">1.0</total-estimate>\n" +
61     "  <invested-hours type=\"float\">0.0</invested-hours>\n" +
62     "  <assigned-to><id>dsNkyYr0Gr4iEBeJe5cbCb</id><login>avdeev.dmitry</login><login_name warning=\"deprecated\">avdeev.dmitry</login_name><name>avdeev.dmitry</name></assigned-to>\n" +
63     "  <reporter><id>dsNkyYr0Gr4iEBeJe5cbCb</id><login>avdeev.dmitry</login><login_name warning=\"deprecated\">avdeev.dmitry</login_name><name>avdeev.dmitry</name></reporter>\n" +
64     "</ticket>\n" +
65     "</tickets>";
66
67   @NotNull
68   @Override
69   protected GenericRepository createRepository(GenericRepositoryType genericType) {
70     return (GenericRepository)genericType.new AssemblaRepository().createRepository();
71   }
72
73   public void testParsingTaskList() throws Exception {
74     Task[] tasks = myRepository.getActiveResponseHandler().parseIssues(TASK_LIST_RESPONSE, 50);
75     assertTasksEqual(
76       new Task[]{
77         new TaskBuilder("1", "\u041F\u0440\u0438\u0432\u0435\u0442", myRepository)
78           .withDescription("")
79           .withUpdated("2013-04-01T10:48:19+03:00")
80           .withCreated("2013-04-01T10:45:06+03:00")
81       },
82       tasks);
83   }
84 }