forked from eclipse-mylyn/org.eclipse.mylyn
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request eclipse-mylyn#498 from eclipse-mylyn/415-resolve-l…
…ight-warnings-for-mylyn-bugzilla-rest-connector resolve light warnings for mylyn bugzilla rest connector eclipse-mylyn#415
- Loading branch information
Showing
45 changed files
with
659 additions
and
282 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
.../connectors/bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/META-INF/MANIFEST.MF
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
* | ||
* Contributors: | ||
* Frank Becker - initial API and implementation | ||
* See git history | ||
*******************************************************************************/ | ||
|
||
package org.eclipse.mylyn.bugzilla.rest.core.tests; | ||
|
@@ -27,6 +28,7 @@ | |
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.io.OutputStream; | ||
import java.nio.charset.Charset; | ||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.Collection; | ||
|
@@ -88,7 +90,7 @@ | |
|
||
import com.google.gson.Gson; | ||
|
||
@SuppressWarnings("restriction") | ||
@SuppressWarnings({ "nls", "restriction" }) | ||
@RunWith(Junit4TestFixtureRunner.class) | ||
@FixtureDefinition(fixtureClass = BugzillaRestTestFixture.class, fixtureType = "bugzillaREST") | ||
// use this if you only want to run the test class if the property exists with | ||
|
@@ -232,28 +234,32 @@ public void testGetConfiguration() throws Exception { | |
Collection<Field> fieldCollection = fields.values(); | ||
assertConfigurationFieldNames(fieldCollection); | ||
assertEquals( | ||
IOUtils.toString(CommonTestUtil.getResource(this, actualFixture.getTestDataFolder() + "/fields.json")), | ||
IOUtils.toString(CommonTestUtil.getResource(this, actualFixture.getTestDataFolder() + "/fields.json"), | ||
Charset.defaultCharset()), | ||
new Gson().toJson(fields)); | ||
Map<String, Product> products = configuration.getProducts(); | ||
assertEquals( | ||
IOUtils.toString( | ||
CommonTestUtil.getResource(this, actualFixture.getTestDataFolder() + "/products.json")), | ||
CommonTestUtil.getResource(this, actualFixture.getTestDataFolder() + "/products.json"), | ||
Charset.defaultCharset()), | ||
new Gson().toJson(products)); | ||
Parameters parameter = configuration.getParameters(); | ||
assertEquals( | ||
IOUtils.toString( | ||
CommonTestUtil.getResource(this, actualFixture.getTestDataFolder() + "/parameters.json")), | ||
CommonTestUtil.getResource(this, actualFixture.getTestDataFolder() + "/parameters.json"), | ||
Charset.defaultCharset()), | ||
new Gson().toJson(parameter) | ||
.replaceAll(repository.getRepositoryUrl(), "http://dummy.url") | ||
.replaceAll(repository.getRepositoryUrl().replaceFirst("https://", "http://"), | ||
"http://dummy.url")); | ||
.replaceAll(repository.getRepositoryUrl(), "http://dummy.url") | ||
.replaceAll(repository.getRepositoryUrl().replaceFirst("https://", "http://"), | ||
"http://dummy.url")); | ||
assertEquals( | ||
IOUtils.toString( | ||
CommonTestUtil.getResource(this, actualFixture.getTestDataFolder() + "/configuration.json")), | ||
CommonTestUtil.getResource(this, actualFixture.getTestDataFolder() + "/configuration.json"), | ||
Charset.defaultCharset()), | ||
new Gson().toJson(configuration) | ||
.replaceAll(repository.getRepositoryUrl(), "http://dummy.url") | ||
.replaceAll(repository.getRepositoryUrl().replaceFirst("https://", "http://"), | ||
"http://dummy.url")); | ||
.replaceAll(repository.getRepositoryUrl(), "http://dummy.url") | ||
.replaceAll(repository.getRepositoryUrl().replaceFirst("https://", "http://"), | ||
"http://dummy.url")); | ||
} | ||
|
||
private void assertConfigurationFieldNames(Collection<Field> fields) throws IOException { | ||
|
@@ -264,7 +270,8 @@ private void assertConfigurationFieldNames(Collection<Field> fields) throws IOEx | |
Collections.sort(fieldNameList); | ||
assertEquals( | ||
IOUtils.toString( | ||
CommonTestUtil.getResource(this, actualFixture.getTestDataFolder() + "/fieldName.json")), | ||
CommonTestUtil.getResource(this, actualFixture.getTestDataFolder() + "/fieldName.json"), | ||
Charset.defaultCharset()), | ||
new Gson().toJson(fieldNameList)); | ||
} | ||
|
||
|
@@ -294,19 +301,22 @@ public String getProduct() { | |
TaskData taskData = new TaskData(mapper, repository.getConnectorKind(), repository.getRepositoryUrl(), ""); | ||
assertTrue(taskDataHandler.initializeTaskData(repository, taskData, null, null)); | ||
assertEquals( | ||
IOUtils.toString(CommonTestUtil.getResource(this, actualFixture.getTestDataFolder() + "/taskData.txt")), | ||
IOUtils.toString(CommonTestUtil.getResource(this, actualFixture.getTestDataFolder() + "/taskData.txt"), | ||
Charset.defaultCharset()), | ||
taskData.getRoot().toString()); | ||
taskData = new TaskData(mapper, repository.getConnectorKind(), repository.getRepositoryUrl(), ""); | ||
assertTrue(taskDataHandler.initializeTaskData(repository, taskData, taskMappingInit, null)); | ||
assertEquals( | ||
IOUtils.toString( | ||
CommonTestUtil.getResource(this, actualFixture.getTestDataFolder() + "/taskData1.txt")), | ||
CommonTestUtil.getResource(this, actualFixture.getTestDataFolder() + "/taskData1.txt"), | ||
Charset.defaultCharset()), | ||
taskData.getRoot().toString()); | ||
taskData = new TaskData(mapper, repository.getConnectorKind(), repository.getRepositoryUrl(), ""); | ||
assertTrue(taskDataHandler.initializeTaskData(repository, taskData, taskMappingSelect, null)); | ||
assertEquals( | ||
IOUtils.toString( | ||
CommonTestUtil.getResource(this, actualFixture.getTestDataFolder() + "/taskData2.txt")), | ||
CommonTestUtil.getResource(this, actualFixture.getTestDataFolder() + "/taskData2.txt"), | ||
Charset.defaultCharset()), | ||
taskData.getRoot().toString()); | ||
} | ||
|
||
|
@@ -419,8 +429,8 @@ public String getVersion() { | |
taskDataHandler.initializeTaskData(actualFixture.repository(), taskData, taskMappingInit, null); | ||
taskData.getRoot().getAttribute("cf_dropdown").setValue("one"); | ||
taskData.getRoot() | ||
.getAttribute(BugzillaRestCreateTaskSchema.getDefault().TARGET_MILESTONE.getKey()) | ||
.setValue("M2"); | ||
.getAttribute(BugzillaRestCreateTaskSchema.getDefault().TARGET_MILESTONE.getKey()) | ||
.setValue("M2"); | ||
RepositoryResponse reposonse = connector.getClient(actualFixture.repository()) | ||
.postTaskData(taskData, null, null); | ||
assertEquals(ResponseKind.TASK_CREATED, reposonse.getReposonseKind()); | ||
|
@@ -461,8 +471,8 @@ public String getVersion() { | |
taskDataHandler.initializeTaskData(actualFixture.repository(), taskData, taskMappingInit, null); | ||
taskData.getRoot().getAttribute("cf_dropdown").setValue("one"); | ||
taskData.getRoot() | ||
.getAttribute(BugzillaRestCreateTaskSchema.getDefault().TARGET_MILESTONE.getKey()) | ||
.setValue("M2"); | ||
.getAttribute(BugzillaRestCreateTaskSchema.getDefault().TARGET_MILESTONE.getKey()) | ||
.setValue("M2"); | ||
|
||
TaskData taskDataSubmit = new TaskData(mapper, actualFixture.repository().getConnectorKind(), | ||
actualFixture.repository().getRepositoryUrl(), ""); | ||
|
@@ -507,8 +517,8 @@ public String getVersion() { | |
|
||
taskData.getRoot().getAttribute("cf_dropdown").setValue("one"); | ||
taskData.getRoot() | ||
.getAttribute(BugzillaRestCreateTaskSchema.getDefault().TARGET_MILESTONE.getKey()) | ||
.setValue("M2"); | ||
.getAttribute(BugzillaRestCreateTaskSchema.getDefault().TARGET_MILESTONE.getKey()) | ||
.setValue("M2"); | ||
String taskId = harness.submitNewTask(taskData); | ||
TaskData taskDataGet = harness.getTaskFromServer(taskId); | ||
|
||
|
@@ -522,9 +532,9 @@ public String getVersion() { | |
|
||
// resolution is only for new tasks readonly | ||
taskData.getRoot() | ||
.getAttribute(BugzillaRestTaskSchema.getDefault().RESOLUTION.getKey()) | ||
.getMetaData() | ||
.setReadOnly(false); | ||
.getAttribute(BugzillaRestTaskSchema.getDefault().RESOLUTION.getKey()) | ||
.getMetaData() | ||
.setReadOnly(false); | ||
|
||
// attributes we know that they can not be equal | ||
taskData.getRoot().removeAttribute(BugzillaRestTaskSchema.getDefault().STATUS.getKey()); | ||
|
@@ -571,7 +581,8 @@ public String getVersion() { | |
assertEquals(taskData.getRoot().toString(), taskDataGet.getRoot().toString()); | ||
assertEquals( | ||
IOUtils.toString( | ||
CommonTestUtil.getResource(this, actualFixture.getTestDataFolder() + "/taskDataFlags.txt")), | ||
CommonTestUtil.getResource(this, actualFixture.getTestDataFolder() + "/taskDataFlags.txt"), | ||
Charset.defaultCharset()), | ||
flags.toString()); | ||
} | ||
|
||
|
@@ -859,11 +870,11 @@ public String getVersion() { | |
taskDataHandler.initializeTaskData(actualFixture.repository(), taskData, taskMappingInit, null); | ||
taskData.getRoot().getAttribute("cf_dropdown").setValue("one"); | ||
taskData.getRoot() | ||
.getAttribute(BugzillaRestCreateTaskSchema.getDefault().TARGET_MILESTONE.getKey()) | ||
.setValue("M2"); | ||
.getAttribute(BugzillaRestCreateTaskSchema.getDefault().TARGET_MILESTONE.getKey()) | ||
.setValue("M2"); | ||
taskData.getRoot() | ||
.getAttribute(BugzillaRestCreateTaskSchema.getDefault().CC.getKey()) | ||
.setValue("[email protected], [email protected]"); | ||
.getAttribute(BugzillaRestCreateTaskSchema.getDefault().CC.getKey()) | ||
.setValue("[email protected], [email protected]"); | ||
RepositoryResponse reposonse = connector.getClient(actualFixture.repository()) | ||
.postTaskData(taskData, null, null); | ||
assertNotNull(reposonse); | ||
|
@@ -913,11 +924,11 @@ public String getVersion() { | |
taskDataHandler.initializeTaskData(actualFixture.repository(), taskData, taskMappingInit, null); | ||
taskData.getRoot().getAttribute("cf_dropdown").setValue("one"); | ||
taskData.getRoot() | ||
.getAttribute(BugzillaRestCreateTaskSchema.getDefault().TARGET_MILESTONE.getKey()) | ||
.setValue("M2"); | ||
.getAttribute(BugzillaRestCreateTaskSchema.getDefault().TARGET_MILESTONE.getKey()) | ||
.setValue("M2"); | ||
taskData.getRoot() | ||
.getAttribute(BugzillaRestCreateTaskSchema.getDefault().BLOCKS.getKey()) | ||
.setValue(taskIdRel[0] + ", " + taskIdRel[1]); | ||
.getAttribute(BugzillaRestCreateTaskSchema.getDefault().BLOCKS.getKey()) | ||
.setValue(taskIdRel[0] + ", " + taskIdRel[1]); | ||
RepositoryResponse reposonse = connector.getClient(actualFixture.repository()) | ||
.postTaskData(taskData, null, null); | ||
assertNotNull(reposonse); | ||
|
@@ -967,11 +978,11 @@ public String getVersion() { | |
taskDataHandler.initializeTaskData(actualFixture.repository(), taskData, taskMappingInit, null); | ||
taskData.getRoot().getAttribute("cf_dropdown").setValue("one"); | ||
taskData.getRoot() | ||
.getAttribute(BugzillaRestCreateTaskSchema.getDefault().TARGET_MILESTONE.getKey()) | ||
.setValue("M2"); | ||
.getAttribute(BugzillaRestCreateTaskSchema.getDefault().TARGET_MILESTONE.getKey()) | ||
.setValue("M2"); | ||
taskData.getRoot() | ||
.getAttribute(BugzillaRestCreateTaskSchema.getDefault().DEPENDS_ON.getKey()) | ||
.setValue(taskIdRel[0] + ", " + taskIdRel[1]); | ||
.getAttribute(BugzillaRestCreateTaskSchema.getDefault().DEPENDS_ON.getKey()) | ||
.setValue(taskIdRel[0] + ", " + taskIdRel[1]); | ||
RepositoryResponse reposonse = connector.getClient(actualFixture.repository()) | ||
.postTaskData(taskData, null, null); | ||
assertNotNull(reposonse); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.