Skip to content

Commit ed4388a

Browse files
Merge pull request #123 from appirio-tech/revert-122-dev
Revert "Fix group checks"
2 parents de4125a + a4520af commit ed4388a

File tree

14 files changed

+222
-709
lines changed

14 files changed

+222
-709
lines changed

.circleci/config.yml

Lines changed: 62 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,74 @@
11
version: 2
2-
3-
# Java image for java project
4-
java_env: &java_env
2+
jobs:
3+
"build-dev":
54
docker:
65
- image: circleci/openjdk:8-jdk
7-
8-
install_deploysuite: &install_deploysuite
9-
name: Installation of install_deploysuite.
6+
steps:
7+
# Initialization1.
8+
- run: git clone --branch master https://github.com/topcoder-platform/tc-deploy-scripts ../buildscript
9+
- checkout
10+
- run:
11+
name: Installation of build dependencies.
12+
command: |
13+
sudo apt install jq
14+
sudo apt install awscli
15+
- run:
16+
name: Configuring maven
17+
command: |
18+
MVNSERVERSETTING='<server>\n <id>tcrepo</id> \n <username>${env.MVNUSERNAME}</username> \n <password>${env.MVNPASSWD}</password> \n </server> '
19+
C=$(echo $MVNSERVERSETTING | sed 's/\//\\\//g')
20+
sudo sed -i.bak "/<\/servers>/ s/.*/${C}\n&/" /opt/apache-maven/conf/settings.xml
21+
MVNSERVERSETTING='<server>\n <id>tcreposnap</id> \n <username>${env.MVNUSERNAME}</username> \n <password>${env.MVNPASSWD}</password> \n </server> '
22+
C=$(echo $MVNSERVERSETTING | sed 's/\//\\\//g')
23+
sudo sed -i.bak "/<\/servers>/ s/.*/${C}\n&/" /opt/apache-maven/conf/settings.xml
24+
- setup_remote_docker
25+
- restore_cache:
26+
key: ap-review-microservice-{{ checksum "~/project/service/pom.xml" }}
27+
- run: mvn -f ~/project/service/pom.xml dependency:go-offline
28+
- save_cache:
29+
paths:
30+
- ~/.m2
31+
key: ap-review-microservice-{{ checksum "~/project/service/pom.xml" }}
32+
- run: mvn -f ~/project/service/pom.xml clean site package
33+
- run:
34+
name: Save test results
1035
command: |
11-
git clone --branch v1.3 https://github.com/topcoder-platform/tc-deploy-scripts ../buildscript
12-
cp ./../buildscript/master_deploy.sh .
13-
cp ./../buildscript/buildenv.sh .
14-
cp ./../buildscript/awsconfiguration.sh .
36+
mkdir -p ~/junit/
37+
find . -type f -regex ".*/target/site/cobertura/coverage.xml" -exec cp {} ~/junit/ \;
38+
# find . -type f -regex ".*/target/surefire-reports/.*xml" -exec cp {} ~/junit/ \;
39+
when: always
40+
- store_test_results:
41+
path: ~/junit
42+
- store_artifacts:
43+
path: ~/junit
44+
- run: docker --version
45+
- run:
46+
name: Deploy to AWS
47+
command: |
48+
chmod +x /home/circleci/project/service/build/deploy.sh
49+
/home/circleci/project/service/build/deploy.sh /home/circleci/project /home/circleci/project/service/build ap-review dev
1550
16-
build_steps: &build_steps
51+
"build-prod":
52+
docker:
53+
- image: circleci/openjdk:8-jdk
54+
steps:
1755
# Initialization1.
56+
- run: git clone --branch master https://github.com/topcoder-platform/tc-deploy-scripts ../buildscript
1857
- checkout
19-
- run: *install_deploysuite
2058
- run:
2159
name: Installation of build dependencies.
2260
command: |
2361
sudo apt install jq
24-
sudo apt install awscli
62+
sudo apt install awscli
63+
- run:
64+
name: Configuring maven
65+
command: |
66+
MVNSERVERSETTING='<server>\n <id>tcrepo</id> \n <username>${env.MVNUSERNAME}</username> \n <password>${env.MVNPASSWD}</password> \n </server> '
67+
C=$(echo $MVNSERVERSETTING | sed 's/\//\\\//g')
68+
sudo sed -i.bak "/<\/servers>/ s/.*/${C}\n&/" /opt/apache-maven/conf/settings.xml
69+
MVNSERVERSETTING='<server>\n <id>tcreposnap</id> \n <username>${env.MVNUSERNAME}</username> \n <password>${env.MVNPASSWD}</password> \n </server> '
70+
C=$(echo $MVNSERVERSETTING | sed 's/\//\\\//g')
71+
sudo sed -i.bak "/<\/servers>/ s/.*/${C}\n&/" /opt/apache-maven/conf/settings.xml
2572
- setup_remote_docker
2673
- restore_cache:
2774
key: ap-review-microservice-{{ checksum "~/project/service/pom.xml" }}
@@ -46,37 +93,19 @@ build_steps: &build_steps
4693
- run:
4794
name: Deploy to AWS
4895
command: |
49-
./awsconfiguration.sh $DEPLOY_ENV
50-
source awsenvconf
5196
chmod +x /home/circleci/project/service/build/deploy.sh
52-
/home/circleci/project/service/build/deploy.sh /home/circleci/project /home/circleci/project/service/build ap-review $DEPLOY_APP_ENV
53-
54-
jobs:
55-
"build-dev":
56-
<<: *java_env
57-
environment:
58-
DEPLOY_APP_ENV: "dev"
59-
DEPLOY_ENV: "DEV"
60-
steps: *build_steps
61-
"build-prod":
62-
<<: *java_env
63-
environment:
64-
DEPLOY_APP_ENV: "prod"
65-
DEPLOY_ENV: "PROD"
66-
steps: *build_steps
97+
/home/circleci/project/service/build/deploy.sh /home/circleci/project /home/circleci/project/service/build ap-review prod
6798
6899
workflows:
69100
version: 2
70101
build:
71102
jobs:
72103
# Development builds are executed on "develop" branch only.
73104
- "build-dev":
74-
context : org-global
75105
filters:
76106
branches:
77107
only: dev
78108
- "build-prod":
79-
context : org-global
80109
filters:
81110
branches:
82-
only: master
111+
only: master

local/run.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,5 @@ export DW_PW=1nf0rm1x
77
export DW_URL=jdbc:informix-sqli://$IP:2021/common_dw:INFORMIXSERVER=informixoltp_tcp;IFX_LOCK_MODE_WAIT=5;OPTCOMPIND=0;STMT_CACHE=1
88
export TC_JWT_KEY=secret
99
export GROUP_SERVICE_ENDPOINT="http://$IP:8080/v3/groups?memberId=%s&membershipType=User-Group"
10-
export PARENT_GROUP_SERVICE_ENDPOINT="http://$IP:8080/v3/groups/%s/getParentGroup?oneLevel=false"
1110

1211
java -jar ../service/target/review-microservice-*.jar server ../service/src/main/resources/review-service.yaml

service/build/deploy.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ AWS_S3_KEY="services/docker/$IMAGE"
2525
ENV_JAVA_PARAMS=" "
2626
ENV_CONFIG=`echo "$ENV" | tr '[:lower:]' '[:upper:]'`
2727

28-
# AWS_REGION=$(eval "echo \$${ENV_CONFIG}_AWS_REGION")
29-
# AWS_ACCESS_KEY_ID=$(eval "echo \$${ENV_CONFIG}_AWS_ACCESS_KEY_ID")
30-
# AWS_SECRET_ACCESS_KEY=$(eval "echo \$${ENV_CONFIG}_AWS_SECRET_ACCESS_KEY")
28+
AWS_REGION=$(eval "echo \$${ENV_CONFIG}_AWS_REGION")
29+
AWS_ACCESS_KEY_ID=$(eval "echo \$${ENV_CONFIG}_AWS_ACCESS_KEY_ID")
30+
AWS_SECRET_ACCESS_KEY=$(eval "echo \$${ENV_CONFIG}_AWS_SECRET_ACCESS_KEY")
3131

3232
configure_aws_cli() {
3333
aws --version
@@ -38,7 +38,7 @@ configure_aws_cli() {
3838
echo "Configured AWS CLI."
3939
}
4040

41-
# configure_aws_cli
41+
configure_aws_cli
4242

4343
# Elastic Beanstalk Application name
4444
# dev
@@ -110,4 +110,4 @@ aws elasticbeanstalk create-application-version --application-name $APPNAME --ve
110110

111111
echo "Updating EBS with the version $IMAGE \n"
112112
# assumes beanstalk app for this service has already been created and configured
113-
aws elasticbeanstalk update-environment --environment-name $SERVICE-$ENV --version-label $IMAGE
113+
aws elasticbeanstalk update-environment --environment-name $SERVICE-$ENV --version-label $IMAGE

service/pom.xml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<dropwizard.version>1.0.0</dropwizard.version>
1111
<powermock.version>1.5.4</powermock.version>
1212
<jackson-version>2.7.3</jackson-version>
13-
<core.api.version>4.3.1</core.api.version>
13+
<core.api.version>4.2.0</core.api.version>
1414
<supply-library.version>1.0.20-SNAPSHOT</supply-library.version>
1515
</properties>
1616

@@ -60,9 +60,6 @@
6060
<plugin>
6161
<artifactId>maven-surefire-plugin</artifactId>
6262
<version>2.18.1</version>
63-
<configuration>
64-
<forkCount>0</forkCount>
65-
</configuration>
6663
</plugin>
6764
<plugin>
6865
<groupId>org.apache.maven.plugins</groupId>
@@ -291,7 +288,7 @@
291288
<plugin>
292289
<groupId>org.codehaus.mojo</groupId>
293290
<artifactId>findbugs-maven-plugin</artifactId>
294-
<version>3.0.4</version>
291+
<version>3.0.0</version>
295292
<configuration>
296293
<onlyAnalyze>com.appirio.service.-</onlyAnalyze>
297294
<effort>Max</effort>
@@ -304,7 +301,7 @@
304301
<repositories>
305302
<repository>
306303
<id>tcrepo</id>
307-
<url>http://tc-mvn-repo.s3-website-us-east-1.amazonaws.com/release</url>
304+
<url>s3://tc-mvn-repo/release</url>
308305
<snapshots>
309306
<enabled>false</enabled>
310307
<updatePolicy>always</updatePolicy>
@@ -316,7 +313,7 @@
316313
</repository>
317314
<repository>
318315
<id>tcreposnap</id>
319-
<url>http://tc-mvn-repo.s3-website-us-east-1.amazonaws.com/snapshot</url>
316+
<url>s3://tc-mvn-repo/snapshot</url>
320317
<snapshots>
321318
<enabled>true</enabled>
322319
<updatePolicy>always</updatePolicy>

service/src/main/java/com/appirio/service/resourcefactory/ReviewOpportunitiesFactory.java

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
import com.appirio.service.review.manager.ReviewOpportunitiesManager;
66
import com.appirio.service.review.resources.ReviewOpportunitiesResource;
77
import com.appirio.service.review.util.GroupServiceClient;
8-
import com.appirio.service.review.util.ParentGroupServiceClient;
98
import com.appirio.service.supply.resources.ResourceFactory;
109
import com.appirio.supply.DAOFactory;
1110
import com.appirio.supply.SupplyException;
11+
import com.appirio.supply.dataaccess.db.IdGenerator;
1212

1313
/**
1414
* ReviewOpportunitiesFactory is used to create the ReviewOpportunitiesResource
@@ -42,15 +42,9 @@
4242
* </ul>
4343
* </p>
4444
*
45-
* <p>
46-
* Version 1.5 (Topcoder Review Service - Fix Group Checks v1.0)
47-
* <ul>
48-
* <li>Create ReviewOpportunitiesManager with the GroupServiceClient and ParentGroupServiceClient</li>
49-
* </ul>
50-
* </p>
5145
*
5246
* @author TCCoder
53-
* @version 1.5
47+
* @version 1.4
5448
*
5549
*/
5650
public class ReviewOpportunitiesFactory implements ResourceFactory<ReviewOpportunitiesResource> {
@@ -60,20 +54,13 @@ public class ReviewOpportunitiesFactory implements ResourceFactory<ReviewOpportu
6054
*/
6155
private final GroupServiceClient groupServiceClient;
6256

63-
/**
64-
* The parent group service client
65-
*/
66-
private final ParentGroupServiceClient parentGroupServiceClient;
67-
6857
/**
6958
* Simple constructor to initialize ReviewOpportunitiesFactory
7059
*
7160
* @param groupServiceClient the groupServiceClient to use
72-
* @param parentGroupServiceClient the parent groupServiceClient to use
7361
*/
74-
public ReviewOpportunitiesFactory(GroupServiceClient groupServiceClient, ParentGroupServiceClient parentGroupServiceClient) {
62+
public ReviewOpportunitiesFactory(GroupServiceClient groupServiceClient) {
7563
this.groupServiceClient = groupServiceClient;
76-
this.parentGroupServiceClient = parentGroupServiceClient;
7764
}
7865

7966
/**
@@ -86,7 +73,7 @@ public ReviewOpportunitiesResource getResourceInstance() throws SupplyException
8673
final ReviewOpportunitiesDAO dao = DAOFactory.getInstance().createDAO(ReviewOpportunitiesDAO.class);
8774
final ChallengeDAO challengeDao = DAOFactory.getInstance().createDAO(ChallengeDAO.class);
8875
final ReviewOpportunitiesManager reviewOpportunitiesManager =
89-
new ReviewOpportunitiesManager(dao, challengeDao, this.groupServiceClient, this.parentGroupServiceClient);
76+
new ReviewOpportunitiesManager(dao, challengeDao, this.groupServiceClient);
9077
return new ReviewOpportunitiesResource(reviewOpportunitiesManager);
9178
}
9279
}

service/src/main/java/com/appirio/service/review/M2mAuthConfiguration.java

Lines changed: 0 additions & 70 deletions
This file was deleted.

0 commit comments

Comments
 (0)