forked from hygieia/hygieia
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Jira Features Widget creation via remote API (hygieia#2580)
* Updated the logback.xml for score collector to roll-off log files correctly * Updated the log file name and file path as per the existing pattern * Fix to create feature widget via remoteCreate api * Added additional check to match one of the fields from the collector * Adding unit tests for the changes made * Cleaned up the dependency on FeatureCollector coming from jira-collector module * Removed the toCollectorItem overridden method from FeatureEntry, and restored the original score collector logback.xml, will create a separate PR for it
- Loading branch information
1 parent
c099156
commit d04c648
Showing
7 changed files
with
123 additions
and
6 deletions.
There are no files selected for viewing
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
49 changes: 49 additions & 0 deletions
49
api/src/test/java/com/capitalone/dashboard/request/FeatureEntryTest.java
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 |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package com.capitalone.dashboard.request; | ||
|
||
import com.capitalone.dashboard.misc.HygieiaException; | ||
import com.capitalone.dashboard.model.Collector; | ||
import com.capitalone.dashboard.model.CollectorItem; | ||
import com.capitalone.dashboard.model.CollectorType; | ||
import com.capitalone.dashboard.util.FeatureCollectorConstants; | ||
import org.junit.Assert; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.mockito.runners.MockitoJUnitRunner; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
@RunWith(MockitoJUnitRunner.class) | ||
public class FeatureEntryTest { | ||
@Test | ||
public void FeatureEntry_toWidgetOptions_Test() throws HygieiaException { | ||
DashboardRemoteRequest.Entry entry = new DashboardRemoteRequest.FeatureEntry(); | ||
|
||
Map<String, Object> allOptions = new HashMap<>(); | ||
allOptions.put("featureTool", "Jira"); | ||
allOptions.put("projectName", "TestProject"); | ||
allOptions.put("projectId", "123"); | ||
allOptions.put("teamName", "TestTeam"); | ||
allOptions.put("teamId", "321"); | ||
allOptions.put("estimateMetricType", "storypoints"); | ||
allOptions.put("sprintType", "kanban"); | ||
allOptions.put("listType", "epics"); | ||
allOptions.put("showStatus", "showStatus"); | ||
|
||
entry.setOptions(allOptions); | ||
Map<String, Object> options = entry.toWidgetOptions(); | ||
|
||
Assert.assertEquals(10, options.size()); | ||
|
||
Assert.assertEquals("feature0", options.get("id")); | ||
Assert.assertEquals("Jira", options.get("featureTool")); | ||
Assert.assertEquals("TestProject", options.get("projectName")); | ||
Assert.assertEquals("123", options.get("projectId")); | ||
Assert.assertEquals("TestTeam", options.get("teamName")); | ||
Assert.assertEquals("321", options.get("teamId")); | ||
Assert.assertEquals("storypoints", options.get("estimateMetricType")); | ||
Assert.assertEquals("kanban", options.get("sprintType")); | ||
Assert.assertEquals("epics", options.get("listType")); | ||
Assert.assertEquals("showStatus", options.get("showStatus")); | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
api/src/test/java/com/capitalone/dashboard/request/WidgetRequestTest.java
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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.capitalone.dashboard.request; | ||
|
||
import com.capitalone.dashboard.model.Widget; | ||
import com.capitalone.dashboard.util.FeatureCollectorConstants; | ||
import org.junit.Assert; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.mockito.runners.MockitoJUnitRunner; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
@RunWith(MockitoJUnitRunner.class) | ||
public class WidgetRequestTest { | ||
@Test | ||
public void widgetTest() { | ||
Map<String, Object> allOptions = new HashMap<>(); | ||
allOptions.put("id", "feature0"); | ||
allOptions.put("featureTool", "Jira"); | ||
allOptions.put("projectName", "TestProject"); | ||
allOptions.put("projectId", "123"); | ||
allOptions.put("teamName", "TestTeam"); | ||
allOptions.put("teamId", "321"); | ||
|
||
WidgetRequest widgetRequest = new WidgetRequest(); | ||
widgetRequest.setName("feature"); | ||
widgetRequest.setOptions(allOptions); | ||
Widget widget = widgetRequest.widget(); | ||
|
||
Map<String, Object> options = widget.getOptions(); | ||
Assert.assertEquals(6, options.size()); | ||
Assert.assertEquals("feature0", options.get("id")); | ||
Assert.assertEquals("Jira", options.get("featureTool")); | ||
Assert.assertEquals("TestProject", options.get("projectName")); | ||
Assert.assertEquals("123", options.get("projectId")); | ||
Assert.assertEquals("TestTeam", options.get("teamName")); | ||
Assert.assertEquals("321", options.get("teamId")); | ||
} | ||
} |
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