diff --git a/.circleci/config.yml b/.circleci/config.yml
index 79c0208..3b565c4 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -94,8 +94,7 @@ workflows:
branches:
only:
- dev
- - feature/jira-plat-130
- - dev-ecs
+
- "build-prod":
context : org-global
filters:
diff --git a/.gitignore b/.gitignore
index 136f46a..1a8f35e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,4 @@
.classpath
-.project
service/dependency-reduced-pom.xml
service/run-config/*/target
service/target
@@ -10,3 +9,4 @@ service/log
*.iml
/target/
.settings
+.project
diff --git a/.project b/.project
index 78648aa..259a91a 100644
--- a/.project
+++ b/.project
@@ -20,4 +20,15 @@
org.eclipse.jdt.core.javanature
org.eclipse.m2e.core.maven2Nature
+
+
+ 1650210132504
+
+ 30
+
+ org.eclipse.core.resources.regexFilterMatcher
+ node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__
+
+
+
diff --git a/service/.gitignore b/service/.gitignore
index b83d222..e4984d4 100644
--- a/service/.gitignore
+++ b/service/.gitignore
@@ -1 +1,2 @@
/target/
+.idea
\ No newline at end of file
diff --git a/service/src/main/java/com/appirio/service/resourcefactory/ReviewOpportunitiesFactory.java b/service/src/main/java/com/appirio/service/resourcefactory/ReviewOpportunitiesFactory.java
index 4224809..d0fd5e0 100644
--- a/service/src/main/java/com/appirio/service/resourcefactory/ReviewOpportunitiesFactory.java
+++ b/service/src/main/java/com/appirio/service/resourcefactory/ReviewOpportunitiesFactory.java
@@ -5,7 +5,6 @@
import com.appirio.service.review.manager.ReviewOpportunitiesManager;
import com.appirio.service.review.resources.ReviewOpportunitiesResource;
import com.appirio.service.review.util.GroupServiceClient;
-import com.appirio.service.review.util.ParentGroupServiceClient;
import com.appirio.service.supply.resources.ResourceFactory;
import com.appirio.supply.DAOFactory;
import com.appirio.supply.SupplyException;
@@ -49,8 +48,12 @@
*
*
*
+ *
+ * Version 1.6 (Topcoder Review Service - Migrate Groups API to V5)
+ *
+ *
* @author TCCoder
- * @version 1.5
+ * @version 1.6
*
*/
public class ReviewOpportunitiesFactory implements ResourceFactory {
@@ -60,20 +63,13 @@ public class ReviewOpportunitiesFactory implements ResourceFactory
*
*
+ *
+ * Version 1.4 (Topcoder Review Service - Migrate Groups API to V5)
+ *
+ *
*
* @author TCDEVELOPER, TCSCODER
- * @version 1.3
+ * @version 1.4
*/
public class ReviewServiceApplication extends BaseApplication {
/**
@@ -138,7 +141,6 @@ public String getName() {
protected void prepare(ReviewServiceConfiguration config, Environment env) throws Exception {
configDatabases(config, config.getDatabases(), env);
config.getGroupServiceClientConfig().setEndpoint(getConfigValueFromEnv(ENV_VAR_PATTERN, config.getGroupServiceClientConfig().getEndpoint()));
- config.getParentGroupServiceClientConfig().setEndpoint(getConfigValueFromEnv(ENV_VAR_PATTERN, config.getParentGroupServiceClientConfig().getEndpoint()));
}
/**
@@ -156,8 +158,6 @@ protected void logServiceSpecificConfigs(ReviewServiceConfiguration config) {
}
logger.info("\tGroup Service Client Configuration ");
logger.info("\t\tGroup Service Client Endpoint : " + config.getGroupServiceClientConfig().getEndpoint());
- logger.info("\tParent Group Service Client Configuration ");
- logger.info("\t\tParent Group Service Client Endpoint : " + config.getParentGroupServiceClientConfig().getEndpoint());
logger.info("\r\n");
}
@@ -179,8 +179,7 @@ protected void registerResources(ReviewServiceConfiguration config, Environment
env.jersey().register(new ScorecardQuestionFactory(config, env).getResourceInstance());
GroupServiceClient groupServiceClient = new GroupServiceClient(ClientBuilder.newClient(), config.getGroupServiceClientConfig(), config.getM2mAuthConfiguration());
- ParentGroupServiceClient parentGroupServiceClient = new ParentGroupServiceClient(ClientBuilder.newClient(), config.getParentGroupServiceClientConfig(), config.getM2mAuthConfiguration());
- env.jersey().register(new ReviewOpportunitiesFactory(groupServiceClient, parentGroupServiceClient).getResourceInstance());
+ env.jersey().register(new ReviewOpportunitiesFactory(groupServiceClient).getResourceInstance());
}
/**
diff --git a/service/src/main/java/com/appirio/service/review/ReviewServiceConfiguration.java b/service/src/main/java/com/appirio/service/review/ReviewServiceConfiguration.java
index 39bed5f..9d86da6 100644
--- a/service/src/main/java/com/appirio/service/review/ReviewServiceConfiguration.java
+++ b/service/src/main/java/com/appirio/service/review/ReviewServiceConfiguration.java
@@ -28,8 +28,12 @@
*
*
*
+ *
+ * Version 1.3 (Topcoder Review Service - Migrate Groups API to V5)
+ *
+ *
* @author TCDEVELOPER, TCSCODER
- * @version 1.2
+ * @version 1.3
*
*/
public class ReviewServiceConfiguration extends BaseAppConfiguration {
@@ -58,14 +62,6 @@ public class ReviewServiceConfiguration extends BaseAppConfiguration {
@JsonProperty("groupServiceClient")
private final BaseClientConfiguration groupServiceClientConfig = new BaseClientConfiguration();
- /**
- * The parent group service client configuration
- */
- @Valid
- @NotNull
- @JsonProperty("parentGroupServiceClient")
- private final BaseClientConfiguration parentGroupServiceClientConfig = new BaseClientConfiguration();
-
/**
* Get the data source factory
*
@@ -85,15 +81,6 @@ public BaseClientConfiguration getGroupServiceClientConfig() {
return this.groupServiceClientConfig;
}
- /**
- * Return the sub group service client configuration
- *
- * @return the sub group service client configuration
- */
- public BaseClientConfiguration getParentGroupServiceClientConfig() {
- return parentGroupServiceClientConfig;
- }
-
/**
* Get m2m auth configuration
*
diff --git a/service/src/main/java/com/appirio/service/review/manager/ReviewOpportunitiesManager.java b/service/src/main/java/com/appirio/service/review/manager/ReviewOpportunitiesManager.java
index 830cf39..a493994 100644
--- a/service/src/main/java/com/appirio/service/review/manager/ReviewOpportunitiesManager.java
+++ b/service/src/main/java/com/appirio/service/review/manager/ReviewOpportunitiesManager.java
@@ -9,7 +9,6 @@
import com.appirio.service.review.dao.ChallengeDAO;
import com.appirio.service.review.dao.ReviewOpportunitiesDAO;
import com.appirio.service.review.util.GroupServiceClient;
-import com.appirio.service.review.util.ParentGroupServiceClient;
import com.appirio.supply.SupplyException;
import com.appirio.tech.core.api.v3.TCID;
import com.appirio.tech.core.api.v3.request.FieldSelector;
@@ -98,8 +97,12 @@
* - add the support for the design spec review
*
*
+ *
+ * Version 1.8 (Topcoder Review Service - Migrate Groups API to V5)
+ *
+ *
* @author TCCoder
- * @version 1.7
+ * @version 1.8
*/
public class ReviewOpportunitiesManager {
/**
@@ -242,11 +245,6 @@ public class ReviewOpportunitiesManager {
*/
private final GroupServiceClient groupServiceClient;
- /**
- * The parent group service client
- */
- private final ParentGroupServiceClient parentGroupServiceClient;
-
private final ChallengeDAO challengeDao;
/**
@@ -255,15 +253,13 @@ public class ReviewOpportunitiesManager {
* @param reviewOpportunitiesDAO the reviewOpportunitiesDAO to use
* @param challengeDao the challengeDao to use
* @param groupServiceClient the groupServiceClient to use
- * @param parentGroupServiceClient the parent groupServiceClient to use
* @throws SupplyException if any error occurs
*/
public ReviewOpportunitiesManager(ReviewOpportunitiesDAO reviewOpportunitiesDAO, ChallengeDAO challengeDao,
- GroupServiceClient groupServiceClient, ParentGroupServiceClient parentGroupServiceClient) throws SupplyException {
+ GroupServiceClient groupServiceClient) throws SupplyException {
this.reviewOpportunitiesDAO = reviewOpportunitiesDAO;
this.challengeDao = challengeDao;
this.groupServiceClient = groupServiceClient;
- this.parentGroupServiceClient = parentGroupServiceClient;
}
/**
@@ -846,15 +842,7 @@ private Map> checkUserChallengeEligibility(AuthUser authUser, Li
private Set getAllGroupIds(long userId) throws SupplyException {
try {
Set groupIds = groupServiceClient.getGroups(userId);
-
- // get parent groups
- Set allGroupIds = new HashSet<>(groupIds);
- for (Long groupId : groupIds) {
- Set parentGroupIds = parentGroupServiceClient.getGroups(groupId);
- allGroupIds.addAll(parentGroupIds);
- }
-
- return allGroupIds;
+ return groupIds;
} catch (Exception e) {
throw new SupplyException(e);
}
diff --git a/service/src/main/java/com/appirio/service/review/util/GroupServiceClient.java b/service/src/main/java/com/appirio/service/review/util/GroupServiceClient.java
index 1a739dd..54dd490 100644
--- a/service/src/main/java/com/appirio/service/review/util/GroupServiceClient.java
+++ b/service/src/main/java/com/appirio/service/review/util/GroupServiceClient.java
@@ -76,18 +76,10 @@ public Set getGroups(long userId) throws Exception {
throw new SupplyException("Unable to get groups from the API, the returned status code is: " + response.getStatusInfo().getStatusCode());
}
- JsonNode apiResponse = response.readEntity(JsonNode.class);
- JsonNode result = apiResponse.path("result");
- if (result.path("status").asInt() != HttpStatus.OK_200) {
- LOGGER.error("Unable to get groups: {}", apiResponse);
-
- throw new SupplyException("Unable to get groups from the API, the error is: " + result.path("content").asText());
- }
-
- JsonNode groups = result.path("content");
+ JsonNode result = response.readEntity(JsonNode.class);
Set groupIds = new HashSet();
- for (JsonNode group : groups) {
- groupIds.add(group.path("id").asLong());
+ for (JsonNode group : result) {
+ groupIds.add(group.asLong());
}
return groupIds;
diff --git a/service/src/main/java/com/appirio/service/review/util/ParentGroupServiceClient.java b/service/src/main/java/com/appirio/service/review/util/ParentGroupServiceClient.java
deleted file mode 100644
index 8e66ae6..0000000
--- a/service/src/main/java/com/appirio/service/review/util/ParentGroupServiceClient.java
+++ /dev/null
@@ -1,101 +0,0 @@
-package com.appirio.service.review.util;
-
-import com.appirio.clients.BaseClient;
-import com.appirio.clients.BaseClientConfiguration;
-import com.appirio.service.review.M2mAuthConfiguration;
-import com.appirio.supply.SupplyException;
-import com.fasterxml.jackson.databind.JsonNode;
-import org.eclipse.jetty.http.HttpStatus;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.ws.rs.client.Client;
-import javax.ws.rs.client.WebTarget;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * The client to fetch the parent groups information from the REST API.
- *
- * Version 1.0 (Topcoder Review Service - Fix Group Checks v1.0)
- *
- * @author TCSCODER
- * @version 1.0
- */
-public class ParentGroupServiceClient extends BaseClient {
- /**
- * The logger
- */
- private final static Logger LOGGER = LoggerFactory.getLogger(ParentGroupServiceClient.class);
-
- /**
- * The M2M auth configuration
- */
- private final M2mAuthConfiguration m2mAuthConfiguration;
-
- /**
- * Constructor
- *
- * @param client the Jersey client
- * @param config the configuration
- * @param m2mAuthConfiguration the M2M auth configuration
- */
- public ParentGroupServiceClient(Client client, BaseClientConfiguration config, M2mAuthConfiguration m2mAuthConfiguration) {
- super(client, config);
- this.m2mAuthConfiguration = m2mAuthConfiguration;
- }
-
- /**
- * Get the group including the sub groups
- *
- * @param groupId the group id
- * @return the group including its sub groups
- * @throws Exception if fail to fetch the sub groups
- */
- public Set getGroups(long groupId) throws Exception {
- String url = String.format(this.config.getEndpoint(), groupId);
- WebTarget target = this.client.target(url);
-
- String m2mToken = Helper.generateAuthToken(this.m2mAuthConfiguration);
-
- Response response = target.request(MediaType.APPLICATION_JSON).header("Authorization", "Bearer " + m2mToken).get();
-
- if (response.getStatusInfo().getStatusCode() != HttpStatus.OK_200) {
- LOGGER.error("Unable to get groups: {}", response);
- throw new SupplyException("Unable to get groups from the API, the returned status code is: " + response.getStatusInfo().getStatusCode());
- }
-
- JsonNode apiResponse = response.readEntity(JsonNode.class);
- JsonNode result = apiResponse.path("result");
- if (result.path("status").asInt() != HttpStatus.OK_200) {
- LOGGER.error("Unable to get groups: {}", apiResponse);
-
- throw new SupplyException("Unable to get groups from the API, the error is: " + result.path("content").asText());
- }
-
- JsonNode group = result.path("content");
- return parseGroup(group);
- }
-
- /**
- * Parse the group from the JSON node
- * @param groupNode the JSON node
- * @return the group
- */
- private Set parseGroup(JsonNode groupNode) {
- Set parentGroupIds = new HashSet<>();
- long parentGroupId = groupNode.path("id").asLong();
- if (parentGroupId != 0) {
- // exclude null node
- parentGroupIds.add(groupNode.path("id").asLong());
- }
-
- if (groupNode.has("parentGroup")) {
- parentGroupIds.addAll(parseGroup(groupNode.path("parentGroup")));
- }
-
- return parentGroupIds;
- }
-}
diff --git a/service/src/main/resources/review-service.yaml b/service/src/main/resources/review-service.yaml
index d6a4418..73ac802 100644
--- a/service/src/main/resources/review-service.yaml
+++ b/service/src/main/resources/review-service.yaml
@@ -64,9 +64,6 @@ databases:
groupServiceClient:
endpoint: "${GROUP_SERVICE_ENDPOINT}"
-parentGroupServiceClient:
- endpoint: "${PARENT_GROUP_SERVICE_ENDPOINT}"
-
m2mAuthConfig:
clientId: "${M2M_AUTH_CLIENT_ID:-dummy}"
clientSecret: "${M2M_AUTH_CLIENT_SECRET:-dummy}"
diff --git a/service/src/test/java/com/appirio/service/test/manager/ReviewOpportunitiesManagerTest.java b/service/src/test/java/com/appirio/service/test/manager/ReviewOpportunitiesManagerTest.java
index 02e80c4..0b101c3 100644
--- a/service/src/test/java/com/appirio/service/test/manager/ReviewOpportunitiesManagerTest.java
+++ b/service/src/test/java/com/appirio/service/test/manager/ReviewOpportunitiesManagerTest.java
@@ -4,23 +4,22 @@
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.Assert.fail;
-import com.appirio.service.review.api.Phase;
-import com.appirio.service.review.api.ReviewApplication;
+import com.appirio.service.review.api.Phase;
+import com.appirio.service.review.api.ReviewApplication;
import com.appirio.service.review.api.ReviewOpportunitiesDTO;
import com.appirio.service.review.api.ReviewOpportunityItem;
-import com.appirio.service.review.api.TermsOfUse;
-import com.appirio.service.review.dao.ChallengeDAO;
+import com.appirio.service.review.api.TermsOfUse;
+import com.appirio.service.review.dao.ChallengeDAO;
import com.appirio.service.review.dao.ReviewOpportunitiesDAO;
import com.appirio.service.review.manager.ReviewOpportunitiesManager;
import com.appirio.service.review.util.GroupServiceClient;
-import com.appirio.service.review.util.ParentGroupServiceClient;
import com.appirio.service.test.dao.GenericDAOTest;
-import com.appirio.service.test.dao.TestHelper;
+import com.appirio.service.test.dao.TestHelper;
import com.appirio.supply.SupplyException;
-import com.appirio.supply.dataaccess.db.IdGenerator;
-import com.appirio.tech.core.api.v3.TCID;
+import com.appirio.supply.dataaccess.db.IdGenerator;
+import com.appirio.tech.core.api.v3.TCID;
import com.appirio.tech.core.api.v3.request.LimitQuery;
import com.appirio.tech.core.api.v3.request.QueryParameter;
import com.appirio.tech.core.auth.AuthUser;
@@ -31,8 +30,8 @@
import org.mockito.Mockito;
import org.powermock.api.mockito.PowerMockito;
-import java.io.IOException;
-import java.math.BigDecimal;
+import java.io.IOException;
+import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -47,43 +46,45 @@
/**
* Test ReviewOpportunitiesManager
- *
- * Version 1.1 - Topcoder - Create Review Opportunity Application Endpoints v1.0
+ *
+ * Version 1.1 - Topcoder - Create Review Opportunity Application Endpoints v1.0
* - add more tests for the review application methods
*
* Version 1.2 - Topcoder Review Service - Fix Group Checks
- * - add parent group client when creating manager
+ * - add parent group client when creating manager
+ *
+ * Version 1.3 - Topcoder Review Service - Migrate Groups API to V5
*
* @author TCCoder
- * @version 1.2
+ * @version 1.3
*/
public class ReviewOpportunitiesManagerTest extends GenericDAOTest {
/**
- * The SUB_TRACK_MAP field holds the map for the project category names
- */
- private static final Map SUB_TRACK_MAP = new HashMap();
- static {
- SUB_TRACK_MAP.put("Design", "DESIGN");
- SUB_TRACK_MAP.put("Development", "DEVELOPMENT");
- SUB_TRACK_MAP.put("Testing Competition", "TESTING_COMPETITION");
- SUB_TRACK_MAP.put("Specification", "SPECIFICATION");
- SUB_TRACK_MAP.put("Architecture", "ARCHITECTURE");
- SUB_TRACK_MAP.put("Bug Hunt", "BUG_HUNT");
- SUB_TRACK_MAP.put("Test Suites", "TEST_SUITES");
- SUB_TRACK_MAP.put("Assembly Competition", "ASSEMBLY_COMPETITION");
- SUB_TRACK_MAP.put("Conceptualization", "CONCEPTUALIZATION");
- SUB_TRACK_MAP.put("UI Prototypes", "UI_PROTOTYPES");
- SUB_TRACK_MAP.put("RIA Build", "RIA_BUILD");
- SUB_TRACK_MAP.put("RIA Component", "RIA_COMPONENT");
- SUB_TRACK_MAP.put("Test Scenarios", "TEST_SCENARIOS");
- SUB_TRACK_MAP.put("Copilot Posting", "COPILOT_POSTING");
- SUB_TRACK_MAP.put("Content Creation", "CONTENT_CREATION");
- SUB_TRACK_MAP.put("Reporting", "REPORTING");
- SUB_TRACK_MAP.put("First2Finish", "FIRST_2_FINISH");
- SUB_TRACK_MAP.put("Code", "CODE");
- }
-
- /**
+ * The SUB_TRACK_MAP field holds the map for the project category names
+ */
+ private static final Map SUB_TRACK_MAP = new HashMap();
+ static {
+ SUB_TRACK_MAP.put("Design", "DESIGN");
+ SUB_TRACK_MAP.put("Development", "DEVELOPMENT");
+ SUB_TRACK_MAP.put("Testing Competition", "TESTING_COMPETITION");
+ SUB_TRACK_MAP.put("Specification", "SPECIFICATION");
+ SUB_TRACK_MAP.put("Architecture", "ARCHITECTURE");
+ SUB_TRACK_MAP.put("Bug Hunt", "BUG_HUNT");
+ SUB_TRACK_MAP.put("Test Suites", "TEST_SUITES");
+ SUB_TRACK_MAP.put("Assembly Competition", "ASSEMBLY_COMPETITION");
+ SUB_TRACK_MAP.put("Conceptualization", "CONCEPTUALIZATION");
+ SUB_TRACK_MAP.put("UI Prototypes", "UI_PROTOTYPES");
+ SUB_TRACK_MAP.put("RIA Build", "RIA_BUILD");
+ SUB_TRACK_MAP.put("RIA Component", "RIA_COMPONENT");
+ SUB_TRACK_MAP.put("Test Scenarios", "TEST_SCENARIOS");
+ SUB_TRACK_MAP.put("Copilot Posting", "COPILOT_POSTING");
+ SUB_TRACK_MAP.put("Content Creation", "CONTENT_CREATION");
+ SUB_TRACK_MAP.put("Reporting", "REPORTING");
+ SUB_TRACK_MAP.put("First2Finish", "FIRST_2_FINISH");
+ SUB_TRACK_MAP.put("Code", "CODE");
+ }
+
+ /**
* The user id for testing.
*/
private static final String USER_ID = "123";
@@ -92,26 +93,21 @@ public class ReviewOpportunitiesManagerTest extends GenericDAOTest {
* The DAO used for testing.
*/
private final ReviewOpportunitiesDAO dao = PowerMockito.mock(ReviewOpportunitiesDAO.class);
-
- /**
- * The DAO used for testing.
- */
- private final ChallengeDAO challengeDao = PowerMockito.mock(ChallengeDAO.class);
/**
- * The group service client used for testing.
+ * The DAO used for testing.
*/
- private final GroupServiceClient groupclient = PowerMockito.mock(GroupServiceClient.class);
+ private final ChallengeDAO challengeDao = PowerMockito.mock(ChallengeDAO.class);
/**
- * The parent group service client used for testing.
+ * The group service client used for testing.
*/
- private final ParentGroupServiceClient parentGroupclient = PowerMockito.mock(ParentGroupServiceClient.class);
+ private final GroupServiceClient groupclient = PowerMockito.mock(GroupServiceClient.class);
/**
* The review opportunity data.
*/
- private List data = new ArrayList();
+ private List data = new ArrayList();
/**
* Manager being tested
@@ -133,11 +129,11 @@ public void before() throws Exception {
// prepare some review opportunities data
ReviewOpportunitiesDTO dto1 = new ReviewOpportunitiesDTO(1L, 5, 30005520L, 0, TestHelper.toDate(
"2017-12-17 22:21:00.000"), TestHelper.toDate("2017-12-19 22:21:00.000"), 2, "Code", 39, "Contest Review",
- "Code1", "1.0", 9L, 4L, 0.00, 0.13, 0.05, 350.0, 0, "Java, JavaScript", "NodeJS, Other", "detailedRequirement1", "submission guidelines1");
+ "Code1", "1.0", 9L, 4L, 0.00, 0.13, 0.05, 350.0, 0, "Java, JavaScript", "NodeJS, Other", "detailedRequirement1", "submission guidelines1");
ReviewOpportunitiesDTO dto2 = new ReviewOpportunitiesDTO(2L, 4, 30005521L, 0, TestHelper.toDate(
"2017-12-12 22:32:02.583"), TestHelper.toDate("2017-12-13 22:32:00.0"), 1, "First2Finish", 38,
"Iterative Review", "F2FRev", "1.0", 8L, 21L, 0.00, 0.02, 0.04, 800.0, 0, "ActionScript, Active Directory",
- "Beanstalk, Brivo Labs", "detailedRequirement2", "submission guidelines2");
+ "Beanstalk, Brivo Labs", "detailedRequirement2", "submission guidelines2");
ReviewOpportunitiesDTO dto3 = new ReviewOpportunitiesDTO(3L, 3, 30005530L, 0, TestHelper.toDate(
"2017-12-14 19:40:23.546"), TestHelper.toDate("2017-12-14 21:40:00.000"), 1, "Assembly Competition", 14,
"Spec Review", "Assembly1", "1.0", 1L, 18L, 50.00, 0.0, 0.0, 1400.0, 0, "JavaScript", "Facebook, Google", "detailedRequirement3", "submission guidelines3");
@@ -147,56 +143,56 @@ public void before() throws Exception {
data.add(dto3);
// return correct review opportunities for specific challenge
- Mockito.when(dao.getReviewOpportunities(Mockito.argThat(new IdMatcher("challenge_type_id", 39)))).thenReturn(Arrays
+ Mockito.when(dao.getReviewOpportunities(Mockito.argThat(new IdMatcher("challenge_type_id", 39)))).thenReturn(Arrays
.asList(dto1));
- Mockito.when(dao.getReviewOpportunities(Mockito.argThat(new IdMatcher("challenge_type_id", 38)))).thenReturn(Arrays
+ Mockito.when(dao.getReviewOpportunities(Mockito.argThat(new IdMatcher("challenge_type_id", 38)))).thenReturn(Arrays
.asList(dto2));
- Mockito.when(dao.getReviewOpportunities(Mockito.argThat(new IdMatcher("challenge_type_id", 14)))).thenReturn(Arrays
+ Mockito.when(dao.getReviewOpportunities(Mockito.argThat(new IdMatcher("challenge_type_id", 14)))).thenReturn(Arrays
.asList(dto3));
Mockito.when(dao.getReviewOpportunities(Mockito.argThat(new IdMatcher("challenge_type_id", 18)))).thenReturn(Arrays
.asList(designSpecDto));
// all challenge
- Mockito.when(dao.getReviewOpportunities(Mockito.argThat(new IdMatcher("challenge_type_id", 0)))).thenReturn(data);
-
-
- // setup tests for the review applications
+ Mockito.when(dao.getReviewOpportunities(Mockito.argThat(new IdMatcher("challenge_type_id", 0)))).thenReturn(data);
+
+
+ // setup tests for the review applications
Mockito.when(challengeDao.getChallenge(Mockito.eq(30005530L))).thenReturn(Mockito.mock(com.appirio.service.review.api.Challenge.class));
- Mockito.when(challengeDao.getChallenge(Mockito.eq(30005521L))).thenReturn(Mockito.mock(com.appirio.service.review.api.Challenge.class));
-
- IdGenerator idGenerator = Mockito.mock(IdGenerator.class);
- Mockito.when(idGenerator.getNextId()).thenReturn(1L);
-
- Mockito.doNothing().when(dao).deleteReviewApplications(Mockito.eq(132456L), Mockito.eq(3L), Mockito.anyObject());
- Mockito.doNothing().when(dao).updateReviewApplicationStatus(Mockito.eq(1L), Mockito.eq(2L), Mockito.eq(1L), Mockito.eq(132456L), Mockito.eq(3L));
- Mockito.doNothing().when(dao).addReviewApplication(Mockito.eq(132456L), Mockito.eq(3L), Mockito.eq(1), Mockito.eq(1));
-
- List pendingIds = new ArrayList();
- TCID pid = new TCID(2);
- pendingIds.add(pid);
- Mockito.when(dao.getReviewApplicationRoleIds(Mockito.eq(132456L), Mockito.eq(3L), Mockito.argThat(new IdMatcher("reviewApplicationStatusId", 1)))).thenReturn(pendingIds);
-
- List cancelIds = new ArrayList();
- TCID cid = new TCID(1);
- cancelIds.add(cid);
- Mockito.when(dao.getReviewApplicationRoleIds(Mockito.eq(132456L), Mockito.eq(3L), Mockito.argThat(new IdMatcher("reviewApplicationStatusId", 2)))).thenReturn(cancelIds);
-
-
+ Mockito.when(challengeDao.getChallenge(Mockito.eq(30005521L))).thenReturn(Mockito.mock(com.appirio.service.review.api.Challenge.class));
+
+ IdGenerator idGenerator = Mockito.mock(IdGenerator.class);
+ Mockito.when(idGenerator.getNextId()).thenReturn(1L);
+
+ Mockito.doNothing().when(dao).deleteReviewApplications(Mockito.eq(132456L), Mockito.eq(3L), Mockito.anyObject());
+ Mockito.doNothing().when(dao).updateReviewApplicationStatus(Mockito.eq(1L), Mockito.eq(2L), Mockito.eq(1L), Mockito.eq(132456L), Mockito.eq(3L));
+ Mockito.doNothing().when(dao).addReviewApplication(Mockito.eq(132456L), Mockito.eq(3L), Mockito.eq(1), Mockito.eq(1));
+
+ List pendingIds = new ArrayList();
+ TCID pid = new TCID(2);
+ pendingIds.add(pid);
+ Mockito.when(dao.getReviewApplicationRoleIds(Mockito.eq(132456L), Mockito.eq(3L), Mockito.argThat(new IdMatcher("reviewApplicationStatusId", 1)))).thenReturn(pendingIds);
+
+ List cancelIds = new ArrayList();
+ TCID cid = new TCID(1);
+ cancelIds.add(cid);
+ Mockito.when(dao.getReviewApplicationRoleIds(Mockito.eq(132456L), Mockito.eq(3L), Mockito.argThat(new IdMatcher("reviewApplicationStatusId", 2)))).thenReturn(cancelIds);
+
+
Mockito.when(challengeDao.getChallenge(Mockito.eq(30005530L))).thenReturn(Mockito.mock(com.appirio.service.review.api.Challenge.class));
- Mockito.when(challengeDao.getChallenge(Mockito.eq(30005531L))).thenReturn(Mockito.mock(com.appirio.service.review.api.Challenge.class));
- Phase phase = new Phase(30005530L, 1L, "Spec Review", "Opened", TestHelper.toDate("2017-12-19 22:21:00.000"),
- TestHelper.toDate("2017-12-20 22:21:00.000"), TestHelper.toDate("2017-12-19 22:21:00.000"), TestHelper.toDate("2017-12-20 22:21:00.000"));
- Mockito.when(dao.getChallengePhases(Mockito.argThat(new InQueryMatcher("challengeIds", new long[]{30005530L})))).thenReturn(Arrays.asList(phase));
-
- TermsOfUse termsOfUse = new TermsOfUse(30005530L, 1L, "role", "agreeabilityType", "title", "url", false);
- Mockito.when(dao.getTermsOfUse(Mockito.argThat(new InQueryMatcher("challengeIds", new long[]{30005530L})))).thenReturn(Arrays.asList(termsOfUse));
-
- ReviewApplication application = new ReviewApplication(3L, "handle", "role", "pending", TestHelper.toDate("2017-12-19 22:21:00.000"));
- Mockito.when(dao.getReviewApplications(Mockito.argThat(new InQueryMatcher("reviewAuctionIds", new long[]{3L})))).thenReturn(Arrays.asList(application));
-
- Map ct = new HashMap<>();
- ct.put("ct", new BigDecimal(1));
- Mockito.when(dao.allowToReviewChallenge(Mockito.anyLong(), Mockito.anyLong())).thenReturn(ct);
-
+ Mockito.when(challengeDao.getChallenge(Mockito.eq(30005531L))).thenReturn(Mockito.mock(com.appirio.service.review.api.Challenge.class));
+ Phase phase = new Phase(30005530L, 1L, "Spec Review", "Opened", TestHelper.toDate("2017-12-19 22:21:00.000"),
+ TestHelper.toDate("2017-12-20 22:21:00.000"), TestHelper.toDate("2017-12-19 22:21:00.000"), TestHelper.toDate("2017-12-20 22:21:00.000"));
+ Mockito.when(dao.getChallengePhases(Mockito.argThat(new InQueryMatcher("challengeIds", new long[]{30005530L})))).thenReturn(Arrays.asList(phase));
+
+ TermsOfUse termsOfUse = new TermsOfUse(30005530L, 1L, "role", "agreeabilityType", "title", "url", false);
+ Mockito.when(dao.getTermsOfUse(Mockito.argThat(new InQueryMatcher("challengeIds", new long[]{30005530L})))).thenReturn(Arrays.asList(termsOfUse));
+
+ ReviewApplication application = new ReviewApplication(3L, "handle", "role", "pending", TestHelper.toDate("2017-12-19 22:21:00.000"));
+ Mockito.when(dao.getReviewApplications(Mockito.argThat(new InQueryMatcher("reviewAuctionIds", new long[]{3L})))).thenReturn(Arrays.asList(application));
+
+ Map ct = new HashMap<>();
+ ct.put("ct", new BigDecimal(1));
+ Mockito.when(dao.allowToReviewChallenge(Mockito.anyLong(), Mockito.anyLong())).thenReturn(ct);
+
// prepare some group permissions
List