5353import org .eclipse .mylyn .commons .sdk .util .IFixtureJUnitClass ;
5454import org .eclipse .mylyn .commons .sdk .util .Junit4TestFixtureRunner ;
5555import org .eclipse .mylyn .commons .sdk .util .Junit4TestFixtureRunner .FixtureDefinition ;
56+ import org .eclipse .mylyn .commons .sdk .util .MustRunOnCIServerRule ;
5657import org .eclipse .mylyn .internal .bugzilla .rest .core .BugzillaRestAttachmentMapper ;
5758import org .eclipse .mylyn .internal .bugzilla .rest .core .BugzillaRestClient ;
5859import org .eclipse .mylyn .internal .bugzilla .rest .core .BugzillaRestConfiguration ;
8384import org .eclipse .mylyn .tasks .core .data .TaskDataCollector ;
8485import org .eclipse .mylyn .tasks .core .data .TaskMapper ;
8586import org .junit .Before ;
86- import org .junit .Ignore ;
8787import org .junit .Rule ;
8888import org .junit .Test ;
8989import org .junit .rules .ExpectedException ;
9898// the value in the fixture.
9999// Note: When there is no fixture with this property no tests get executed
100100//@RunOnlyWhenProperty(property = "default", value = "1")
101- @ Ignore ( "No CI Server" )
101+
102102public class BugzillaRestClientTest implements IFixtureJUnitClass {
103103 private final BugzillaRestTestFixture actualFixture ;
104104
@@ -128,12 +128,14 @@ public AbstractTestFixture getActualFixture() {
128128 }
129129
130130 @ Test
131+ @ ConditionalIgnoreRule .ConditionalIgnore (condition = MustRunOnCIServerRule .class )
131132 public void testConnectorClientCache () throws Exception {
132133 BugzillaRestClient client1 = connector .getClient (actualFixture .repository ());
133134 assertNotNull (client1 );
134135 }
135136
136137 @ Test
138+ @ ConditionalIgnoreRule .ConditionalIgnore (condition = MustRunOnCIServerRule .class )
137139 public void testGetVersion () throws Exception {
138140 BugzillaRestClient client = new BugzillaRestClient (actualFixture .location (), connector );
139141 assertNotNull (client .getClient ());
@@ -143,13 +145,15 @@ public void testGetVersion() throws Exception {
143145 }
144146
145147 @ Test
148+ @ ConditionalIgnoreRule .ConditionalIgnore (condition = MustRunOnCIServerRule .class )
146149 public void testValidate () throws Exception {
147150 BugzillaRestClient client = new BugzillaRestClient (actualFixture .location (), connector );
148151 assertNotNull (client .getClient ());
149152 assertTrue (client .validate (new NullOperationMonitor ()));
150153 }
151154
152155 @ Test
156+ @ ConditionalIgnoreRule .ConditionalIgnore (condition = MustRunOnCIServerRule .class )
153157 public void testInvalidUserValidate () throws BugzillaRestException {
154158 RepositoryLocation location = new RepositoryLocation ();
155159 location .setUrl (actualFixture .getRepositoryUrl ());
@@ -165,6 +169,7 @@ public void testInvalidUserValidate() throws BugzillaRestException {
165169 }
166170
167171 @ Test
172+ @ ConditionalIgnoreRule .ConditionalIgnore (condition = MustRunOnCIServerRule .class )
168173 public void testNoUserValidate () throws BugzillaRestException {
169174 RepositoryLocation location = new RepositoryLocation ();
170175 location .setUrl (actualFixture .getRepositoryUrl ());
@@ -179,6 +184,7 @@ public void testNoUserValidate() throws BugzillaRestException {
179184 }
180185
181186 @ Test
187+ @ ConditionalIgnoreRule .ConditionalIgnore (condition = MustRunOnCIServerRule .class )
182188 public void testInvalidPasswordValidate () throws BugzillaRestException {
183189 RepositoryLocation location = new RepositoryLocation ();
184190 location .setUrl (actualFixture .getRepositoryUrl ());
@@ -228,6 +234,7 @@ public void testInvalidApikeyValidate() throws BugzillaRestException {
228234 }
229235
230236 @ Test
237+ @ ConditionalIgnoreRule .ConditionalIgnore (condition = MustRunOnCIServerRule .class )
231238 public void testGetConfiguration () throws Exception {
232239 TaskRepository repository = actualFixture .repository ();
233240 BugzillaRestClient client = connector .getClient (repository );
@@ -251,17 +258,17 @@ public void testGetConfiguration() throws Exception {
251258 CommonTestUtil .getResource (this , actualFixture .getTestDataFolder () + "/parameters.json" ),
252259 Charset .defaultCharset ()),
253260 new Gson ().toJson (parameter )
254- .replaceAll (repository .getRepositoryUrl (), "http://dummy.url" )
261+ .replaceAll (repository .getRepositoryUrl (), "http://dummy.url/ " )
255262 .replaceAll (repository .getRepositoryUrl ().replaceFirst ("https://" , "http://" ),
256- "http://dummy.url" ));
263+ "http://dummy.url/ " ));
257264 assertEquals (
258265 IOUtils .toString (
259266 CommonTestUtil .getResource (this , actualFixture .getTestDataFolder () + "/configuration.json" ),
260267 Charset .defaultCharset ()),
261268 new Gson ().toJson (configuration )
262- .replaceAll (repository .getRepositoryUrl (), "http://dummy.url" )
269+ .replaceAll (repository .getRepositoryUrl (), "http://dummy.url/ " )
263270 .replaceAll (repository .getRepositoryUrl ().replaceFirst ("https://" , "http://" ),
264- "http://dummy.url" ));
271+ "http://dummy.url/ " ));
265272 }
266273
267274 private void assertConfigurationFieldNames (Collection <Field > fields ) throws IOException {
@@ -278,6 +285,7 @@ private void assertConfigurationFieldNames(Collection<Field> fields) throws IOEx
278285 }
279286
280287 @ Test
288+ @ ConditionalIgnoreRule .ConditionalIgnore (condition = MustRunOnCIServerRule .class )
281289 public void testinitializeTaskData () throws Exception {
282290 final TaskMapping taskMappingInit = new TaskMapping () {
283291 @ Override
@@ -323,6 +331,7 @@ public String getProduct() {
323331 }
324332
325333 @ Test
334+ @ ConditionalIgnoreRule .ConditionalIgnore (condition = MustRunOnCIServerRule .class )
326335 public void testPostTaskDataWithoutProduct () throws Exception {
327336 final TaskMapping taskMappingInit = new TaskMapping () {
328337 @ Override
@@ -347,12 +356,16 @@ public String getDescription() {
347356 fail ("never reach this!" );
348357 } catch (BugzillaRestException e ) {
349358 String url = actualFixture .getRepositoryUrl ();
359+ if (url .endsWith ("/" )) {
360+ url = url .substring (0 , url .length ()-1 );
361+ }
350362 assertEquals ("You must select/enter a product. (status: Bad Request from "
351- + url .substring (url .lastIndexOf ('/' )) + "/rest.cgi/bug)" , e .getMessage ());
363+ + url .substring (url .lastIndexOf ('/' )) + "// rest.cgi/bug)" , e .getMessage ());
352364 }
353365 }
354366
355367 @ Test
368+ @ ConditionalIgnoreRule .ConditionalIgnore (condition = MustRunOnCIServerRule .class )
356369 public void testPostTaskDataWithoutMilestone () throws Exception {
357370 final TaskMapping taskMappingInit = new TaskMapping () {
358371 @ Override
@@ -391,12 +404,16 @@ public String getVersion() {
391404 fail ("never reach this!" );
392405 } catch (BugzillaRestException e ) {
393406 String url = actualFixture .getRepositoryUrl ();
407+ if (url .endsWith ("/" )) {
408+ url = url .substring (0 , url .length () - 1 );
409+ }
394410 assertEquals ("You must select/enter a milestone. (status: Bad Request from "
395- + url .substring (url .lastIndexOf ('/' )) + "/rest.cgi/bug)" , e .getMessage ());
411+ + url .substring (url .lastIndexOf ('/' )) + "// rest.cgi/bug)" , e .getMessage ());
396412 }
397413 }
398414
399415 @ Test
416+ @ ConditionalIgnoreRule .ConditionalIgnore (condition = MustRunOnCIServerRule .class )
400417 public void testPostTaskData () throws Exception {
401418 final TaskMapping taskMappingInit = new TaskMapping () {
402419 @ Override
@@ -439,6 +456,7 @@ public String getVersion() {
439456 }
440457
441458 @ Test
459+ @ ConditionalIgnoreRule .ConditionalIgnore (condition = MustRunOnCIServerRule .class )
442460 public void testPostTaskDataFromTaskdata () throws Exception {
443461 final TaskMapping taskMappingInit = new TaskMapping () {
444462 @ Override
@@ -488,6 +506,7 @@ public String getVersion() {
488506 }
489507
490508 @ Test
509+ @ ConditionalIgnoreRule .ConditionalIgnore (condition = MustRunOnCIServerRule .class )
491510 public void testGetTaskData () throws Exception {
492511 final TaskMapping taskMappingInit = new TaskMapping () {
493512 @ Override
@@ -589,6 +608,7 @@ public String getVersion() {
589608 }
590609
591610 @ Test
611+ @ ConditionalIgnoreRule .ConditionalIgnore (condition = MustRunOnCIServerRule .class )
592612 public void testUpdateTaskData () throws Exception {
593613 String taskId = harness .getNewTaksId4TestProduct ();
594614 TaskData taskDataGet = harness .getTaskFromServer (taskId );
@@ -647,6 +667,7 @@ public void testUpdateTaskData() throws Exception {
647667 }
648668
649669 @ Test
670+ @ ConditionalIgnoreRule .ConditionalIgnore (condition = MustRunOnCIServerRule .class )
650671 public void testAddComment () throws Exception {
651672 String taskId = harness .getNewTaksId4TestProduct ();
652673 TaskData taskDataGet = harness .getTaskFromServer (taskId );
@@ -681,6 +702,7 @@ public void testAddComment() throws Exception {
681702 }
682703
683704 @ Test
705+ @ ConditionalIgnoreRule .ConditionalIgnore (condition = MustRunOnCIServerRule .class )
684706 public void testGifAttachment () throws Exception {
685707 TaskAttribute attachmentAttribute = null ;
686708 TaskRepository repository = actualFixture .repository ();
@@ -750,6 +772,7 @@ public String getVersion() {
750772 }
751773
752774 @ Test
775+ @ ConditionalIgnoreRule .ConditionalIgnore (condition = MustRunOnCIServerRule .class )
753776 public void testTextAttachment () throws Exception {
754777 TaskAttribute attachmentAttribute = null ;
755778 TaskRepository repository = actualFixture .repository ();
@@ -838,6 +861,7 @@ public void accept(TaskData taskData) {
838861 }
839862
840863 @ Test
864+ @ ConditionalIgnoreRule .ConditionalIgnore (condition = MustRunOnCIServerRule .class )
841865 public void testCreateCCAttribute () throws Exception {
842866 final TaskMapping taskMappingInit = new TaskMapping () {
843867 @ Override
@@ -891,6 +915,7 @@ public String getVersion() {
891915 }
892916
893917 @ Test
918+ @ ConditionalIgnoreRule .ConditionalIgnore (condition = MustRunOnCIServerRule .class )
894919 public void testCreateBlocksAttribute () throws Exception {
895920 final TaskMapping taskMappingInit = new TaskMapping () {
896921 @ Override
@@ -945,6 +970,7 @@ public String getVersion() {
945970 }
946971
947972 @ Test
973+ @ ConditionalIgnoreRule .ConditionalIgnore (condition = MustRunOnCIServerRule .class )
948974 public void testCreateDependsOnAttribute () throws Exception {
949975 final TaskMapping taskMappingInit = new TaskMapping () {
950976 @ Override
@@ -999,6 +1025,7 @@ public String getVersion() {
9991025 }
10001026
10011027 @ Test
1028+ @ ConditionalIgnoreRule .ConditionalIgnore (condition = MustRunOnCIServerRule .class )
10021029 public void testCCAttribute () throws Exception {
10031030 String taskId = harness .getNewTaksId4TestProduct ();
10041031 TaskData taskDataGet = harness .getTaskFromServer (taskId );
@@ -1046,6 +1073,7 @@ public void testCCAttribute() throws Exception {
10461073 }
10471074
10481075 @ Test
1076+ @ ConditionalIgnoreRule .ConditionalIgnore (condition = MustRunOnCIServerRule .class )
10491077 public void testBlocksAttributeV1 () throws Exception {
10501078 String taskId = harness .getNewTaksId4TestProduct ();
10511079 String [] taskIdRel = harness .getRelationTasks ();
@@ -1093,6 +1121,7 @@ public void testBlocksAttributeV1() throws Exception {
10931121 }
10941122
10951123 @ Test
1124+ @ ConditionalIgnoreRule .ConditionalIgnore (condition = MustRunOnCIServerRule .class )
10961125 public void testBlocksAttributeV2 () throws Exception {
10971126 String taskId = harness .getNewTaksId4TestProduct ();
10981127 String [] taskIdRel = harness .getRelationTasks ();
@@ -1143,6 +1172,7 @@ public void testBlocksAttributeV2() throws Exception {
11431172 }
11441173
11451174 @ Test
1175+ @ ConditionalIgnoreRule .ConditionalIgnore (condition = MustRunOnCIServerRule .class )
11461176 public void testDependsOnAttributeV1 () throws Exception {
11471177 String taskId = harness .getNewTaksId4TestProduct ();
11481178 String [] taskIdRel = harness .getRelationTasks ();
@@ -1191,6 +1221,7 @@ public void testDependsOnAttributeV1() throws Exception {
11911221 }
11921222
11931223 @ Test
1224+ @ ConditionalIgnoreRule .ConditionalIgnore (condition = MustRunOnCIServerRule .class )
11941225 public void testDependsOnAttributeV2 () throws Exception {
11951226 String taskId = harness .getNewTaksId4TestProduct ();
11961227 String [] taskIdRel = harness .getRelationTasks ();
@@ -1242,6 +1273,7 @@ public void testDependsOnAttributeV2() throws Exception {
12421273 }
12431274
12441275 @ Test
1276+ @ ConditionalIgnoreRule .ConditionalIgnore (condition = MustRunOnCIServerRule .class )
12451277 public void testFlagsSet () throws Exception {
12461278 String taskId = harness .getNewTaksId4TestProduct ();
12471279
@@ -1358,6 +1390,7 @@ public void testFlagsSet() throws Exception {
13581390 }
13591391
13601392 @ Test
1393+ @ ConditionalIgnoreRule .ConditionalIgnore (condition = MustRunOnCIServerRule .class )
13611394 public void testFlagsReset () throws Exception {
13621395 String taskId = harness .getNewTaksId4TestProduct ();
13631396
@@ -1546,6 +1579,7 @@ public void testFlagsReset() throws Exception {
15461579 }
15471580
15481581 @ Test
1582+ @ ConditionalIgnoreRule .ConditionalIgnore (condition = MustRunOnCIServerRule .class )
15491583 public void testFlagsChange () throws Exception {
15501584 String taskId = harness .getNewTaksId4TestProduct ();
15511585
@@ -1745,6 +1779,7 @@ public void testFlagsChange() throws Exception {
17451779 }
17461780
17471781 @ Test
1782+ @ ConditionalIgnoreRule .ConditionalIgnore (condition = MustRunOnCIServerRule .class )
17481783 public void testTextAttachmentWithFlags () throws Exception {
17491784 TaskAttribute attachmentAttribute = null ;
17501785 TaskRepository repository = actualFixture .repository ();
0 commit comments