Skip to content

Commit

Permalink
Merge pull request hygieia#322 from amp5208/master
Browse files Browse the repository at this point in the history
Updated Feature collectors manually with upstream modifications included
  • Loading branch information
Tapabrata "Topo" Pal committed Feb 9, 2016
2 parents 4a28e21 + 32d1d4c commit e808d88
Show file tree
Hide file tree
Showing 12 changed files with 322 additions and 128 deletions.
20 changes: 10 additions & 10 deletions jira-feature-collector/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,20 @@ for information about sourcing this properties file.
###Sample application.properties file
--------------------------------------

#Database Name
database=dashboarddb
#Database Name - default is test
spring.data.mongodb.database=dashboarddb

#Database HostName - default is localhost
dbhost=10.0.1.1
spring.data.mongodb.host=10.0.1.1

#Database Port - default is 27017
dbport=9999
spring.data.mongodb.port=9999

#Database Username - default is blank
dbusername=db
spring.data.mongodb.username=db

#Database Password - default is blank
dbpassword=dbpass
spring.data.mongodb.password=dbpass

#Collector schedule (required)
feature.cron=0 * * * * *
Expand Down
9 changes: 9 additions & 0 deletions jira-feature-collector/pom.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http:https://maven.apache.org/POM/4.0.0" xmlns:xsi="http:https://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http:https://maven.apache.org/POM/4.0.0 http:https://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.capitalone.dashboard</groupId>
<artifactId>jira-feature-collector</artifactId>
<packaging>jar</packaging>
<name>${project.groupId}:${project.artifactId}</name>
Expand Down Expand Up @@ -187,6 +189,13 @@
<artifactId>findbugs</artifactId>
<version>3.0.1</version>
</dependency>

<!-- apache commons -->
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.9</version>
</dependency>

<!-- Logging Dependencies -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ public class ProjectDataClientImpl extends ProjectDataClientSetupImpl implements
/**
* Extends the constructor from the super class.
*
* @param featureSettings
* @param projectRepository
* @param featureCollectorRepository
* @param teamRepository
*/
public ProjectDataClientImpl(FeatureSettings featureSettings,
ScopeRepository projectRepository, FeatureCollectorRepository featureCollectorRepository) {
Expand Down Expand Up @@ -135,7 +133,8 @@ public void updateProjectInformation() {
* Validates current entry and removes new entry if an older item exists in
* the repo
*
* @param localId repository item ID (not the precise mongoID)
* @param A
* local repository item ID (not the precise mongoID)
*/
protected Boolean removeExistingEntity(String localId) {
boolean deleted = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ public ProjectDataClientSetupImpl(FeatureSettings featureSettings,
/**
* This method is used to update the database with model defined in the
* collector model definitions.
*
*
* @see Story
*/
public void updateObjectInformation() {
LOGGER.info("Beginning collection of project data at " + Calendar.getInstance().getTime());
Expand All @@ -90,7 +91,11 @@ public void updateObjectInformation() {
proxyUri, proxyPort);
try {
List<BasicProject> rs = jiraDataFactory.getJiraTeams();
updateMongoInfo(rs);
if ((rs != null) && (!rs.isEmpty())) {
updateMongoInfo(rs);
} else {
LOGGER.error("The response from Jira was blank or non existant - please check your property configurations");
}
} catch (Exception e) {
LOGGER.error("Unexpected error in Jira paging request of " + e.getClass().getName()
+ "\n[" + e.getMessage() + "]");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ public FeatureDataClientSetupImpl(FeatureSettings featureSettings,
/**
* This method is used to update the database with model defined in the
* collector model definitions.
*
*
* @see Story
*/
public void updateObjectInformation() {
LOGGER.info("Beginning collection of feature data at " + Calendar.getInstance().getTime());
Expand All @@ -89,15 +90,19 @@ public void updateObjectInformation() {
proxyUri = this.featureSettings.getJiraProxyUrl();
proxyPort = this.featureSettings.getJiraProxyPort();
}
JiraDataFactoryImpl jiraDataFactory = new JiraDataFactoryImpl(1000, jiraCredentials,
JiraDataFactoryImpl jiraDataFactory = new JiraDataFactoryImpl(pageSize, jiraCredentials,
jiraBaseUrl, proxyUri, proxyPort);
jiraDataFactory.setQuery(query);
boolean hasMore = true;
try {
for (int i = 0; hasMore; i += pageSize) {
jiraDataFactory.setPageIndex(i);
List<Issue> rs = jiraDataFactory.getJiraIssues();
if (rs.isEmpty()) {

if (rs == null) {
hasMore = false;
LOGGER.error("The response from Jira was blank or non existant - please check your property configurations");
} else if (rs.isEmpty()) {
hasMore = false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,7 @@ public class StoryDataClientImpl extends FeatureDataClientSetupImpl implements S
/**
* Extends the constructor from the super class.
*
* @param coreFeatureSettings
* @param featureSettings
* @param featureRepository
* @param featureCollectorRepository
* @param teamRepository
*/
public StoryDataClientImpl(CoreFeatureSettings coreFeatureSettings,
FeatureSettings featureSettings, FeatureRepository featureRepository,
Expand Down Expand Up @@ -521,7 +518,8 @@ public void updateStoryInformation() {
* Validates current entry and removes new entry if an older item exists in
* the repo
*
* @param localId repository item ID (not the precise mongoID)
* @param A
* local repository item ID (not the precise mongoID)
*/
protected Boolean removeExistingEntity(String localId) {
boolean deleted = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ public void updateTeamInformation() {
* Validates current entry and removes new entry if an older item exists in
* the repo
*
* @param localId repository item ID (not the precise mongoID)
* @param A
* local repository item ID (not the precise mongoID)
*/
protected Boolean removeExistingEntity(String localId) {
boolean deleted = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,12 @@ public void updateObjectInformation() {
proxyUri, proxyPort);
try {
List<BasicProject> rs = jiraDataFactory.getJiraTeams();
updateMongoInfo(rs);

if ((rs != null) && (!rs.isEmpty())) {
updateMongoInfo(rs);
} else {
LOGGER.error("The response from Jira was blank or non existant - please check your property configurations");
}
} catch (Exception e) {
LOGGER.error("Unexpected error in Jira paging request of " + e.getClass().getName()
+ "\n[" + e.getMessage() + "]");
Expand Down
Loading

0 comments on commit e808d88

Please sign in to comment.