List of commits:
Subject Hash Author Date (UTC)
Converting linear thread implementation to class wise threading. f9a8951c46fbd56ac6b76a68eba5576e13efdec7 chatta06 2019-02-17 17:02:02
instance level thread implementation and build snapshot for tiers snapshot active in db. a3373d4cb0c1659664a1949f70d13e832170e27b chatta06 2019-02-15 13:45:20
changes for logic of comparision. f854bbc4abedf7e4db3178d6394be70f252ea2d6 chatta06 2019-02-12 15:56:43
Snapshot impl 6ae9413b66358a4dbf9144aaade3828cc5a1aa8b mandas04 2019-02-04 09:40:22
Adding custom Swagger UI c0fa959950e032efd4eee4e84456e0f5a8a667ca mandas04 2019-02-02 14:58:01
Refactor build.gradle 0348a38a7bc46a35a466d59c3f67bbb0e430493d mandas04 2019-02-02 11:00:49
Updating code covergae ratio check to 90% 49684bdc879b14c55bd080a381827938fa44b56a mandas04 2019-02-01 10:36:37
[AP] Set jvm args to make builds faster 34c27cf2d35d97d82d06a6a675561843b389552b Pai, Ashwin 2019-02-01 10:05:55
Excluding models from code coverage reprot f22c7d1833e8c9a36057894195294c174334e03d mandas04 2019-02-01 09:37:57
Update sanity check URL for prod c499fd864c92cf5e01187270f3ab8bbfcc05faed mandas04 2019-02-01 04:48:11
[AP] Adding sanity test in dev & prod ceeabd906af4e2cf2266fa6429fb6a0cef916dce Pai, Ashwin 2019-01-31 20:14:35
[AP] Check runList exist before accessing it. 182194ab3988dbd0049005dc97be0cfbdbf16fd0 Pai, Ashwin 2019-01-31 17:34:03
[AP] Get runList var from the -P command line 5b6699ca61da8597ba3a7900ab0d14e1b9f35a44 Pai, Ashwin 2019-01-31 17:26:19
[AP] Fix the credential id for gitlab 9bba45b10eb93688e11435219a7cdffafbbee8d7 Pai, Ashwin 2019-01-31 17:18:45
Refactor Jenkins cred 36acd3adbb192d251ccdc83802fc6a54798d3493 mandas04 2019-01-31 15:55:35
Update test cases 351a1f00250e293ff49fd66c852a3bced9c296be mandas04 2019-01-31 15:21:06
Skipped testing during gradle build 37352f5b876e311a19a8b2aea5759c9c1be8f037 mandas04 2019-01-31 13:29:27
Adjust JaCoCo test coverage 3eca68000e279756223fc5d27accf3a12988ad1d mandas04 2019-01-31 13:17:55
update resttemplate configurations bd1da0c99a2f97c0f7ac1537121a093b7229cba5 mandas04 2019-01-31 13:10:04
Refactor test packages ddc3aae04e4ebceb21b5a421813be6e0cc7733ad mandas04 2019-01-31 11:46:57
Commit f9a8951c46fbd56ac6b76a68eba5576e13efdec7 - Converting linear thread implementation to class wise threading.
Author: chatta06
Author date (UTC): 2019-02-17 17:02
Committer name: chatta06
Committer date (UTC): 2019-02-17 17:02
Parent(s): a3373d4cb0c1659664a1949f70d13e832170e27b
Signing key:
Tree: b6aa83a65a94181224f72389248630c7845b2166
File Lines added Lines deleted
src/main/java/com/kingfisher/deployment/audit/data/builder/DeploymentStatusBuidler.java 14 79
src/main/java/com/kingfisher/deployment/audit/thread/model/ApplicationThread.java 88 0
src/main/java/com/kingfisher/deployment/audit/thread/model/InstanceThread.java 56 0
src/main/java/com/kingfisher/deployment/audit/thread/model/IntegrationServerThread.java 69 0
File src/main/java/com/kingfisher/deployment/audit/data/builder/DeploymentStatusBuidler.java changed (mode: 100644) (index 77af0ce..8f6dc68)
... ... import org.springframework.stereotype.Component;
15 15
16 16 import com.kingfisher.deployment.audit.constant.ApplicationConstant; import com.kingfisher.deployment.audit.constant.ApplicationConstant;
17 17 import com.kingfisher.deployment.audit.exception.model.DeploymentAuditException; import com.kingfisher.deployment.audit.exception.model.DeploymentAuditException;
18 import com.kingfisher.deployment.audit.model.Application;
19 import com.kingfisher.deployment.audit.model.Applications;
20 18 import com.kingfisher.deployment.audit.model.Deployment; import com.kingfisher.deployment.audit.model.Deployment;
21 19 import com.kingfisher.deployment.audit.model.DeploymentProperties; import com.kingfisher.deployment.audit.model.DeploymentProperties;
22 import com.kingfisher.deployment.audit.model.IntegrationServers;
23 20 import com.kingfisher.deployment.audit.model.IIBDeploymentStatus; import com.kingfisher.deployment.audit.model.IIBDeploymentStatus;
24 21 import com.kingfisher.deployment.audit.model.IndexedDeployment; import com.kingfisher.deployment.audit.model.IndexedDeployment;
25 22 import com.kingfisher.deployment.audit.model.Instance; import com.kingfisher.deployment.audit.model.Instance;
26 import com.kingfisher.deployment.audit.model.IntegrationServer;
27 23 import com.kingfisher.deployment.audit.model.JenkinsDeploymentStatus; import com.kingfisher.deployment.audit.model.JenkinsDeploymentStatus;
28 24 import com.kingfisher.deployment.audit.repository.InstanceRepository; import com.kingfisher.deployment.audit.repository.InstanceRepository;
29 25 import com.kingfisher.deployment.audit.rest.client.IIBRestClient; import com.kingfisher.deployment.audit.rest.client.IIBRestClient;
30 26 import com.kingfisher.deployment.audit.security.PasswordCodec; import com.kingfisher.deployment.audit.security.PasswordCodec;
27 import com.kingfisher.deployment.audit.thread.model.InstanceThread;
31 28
32 29 @Component @Component
33 30 public class DeploymentStatusBuidler { public class DeploymentStatusBuidler {
 
... ... public class DeploymentStatusBuidler {
42 39 PasswordCodec passwordCodec; PasswordCodec passwordCodec;
43 40
44 41 public static ExecutorService pool = Executors.newFixedThreadPool(20); public static ExecutorService pool = Executors.newFixedThreadPool(20);
42
45 43 public static ExecutorService instancePool = Executors.newFixedThreadPool(20); public static ExecutorService instancePool = Executors.newFixedThreadPool(20);
46 44
45 public static ThreadPoolExecutor executor = (ThreadPoolExecutor) pool;
46
47 public static ThreadPoolExecutor instanceExecutor = (ThreadPoolExecutor) instancePool;
48
49 public static final List<Deployment> iibList = new ArrayList<>();
50
47 51 public Deployment build(JenkinsDeploymentStatus jenkinsDeploymentStatus) throws DeploymentAuditException { public Deployment build(JenkinsDeploymentStatus jenkinsDeploymentStatus) throws DeploymentAuditException {
48 52 String applicationName = jenkinsDeploymentStatus.getApplicationName(); String applicationName = jenkinsDeploymentStatus.getApplicationName();
49 53 String environment = jenkinsDeploymentStatus.getEnvironment(); String environment = jenkinsDeploymentStatus.getEnvironment();
 
... ... public class DeploymentStatusBuidler {
77 81 for (String tier : tiers) { for (String tier : tiers) {
78 82 instances.addAll(instanceRepository.findByTier(tier)); instances.addAll(instanceRepository.findByTier(tier));
79 83 } }
80 List<Deployment> iibList = new ArrayList<>();
81 ThreadPoolExecutor executor = (ThreadPoolExecutor) pool;
82 ThreadPoolExecutor instanceExecutor = (ThreadPoolExecutor) instancePool;
83
84 Thread instanceThread = new Thread(new Runnable() {
85
86 @Override
87 public void run() {
88 for (Instance instance : instances) {
89 IntegrationServers integrationServers;
90 try {
91 integrationServers = iibRestClient.getIntegrationServers(instance.getHost(),
92 instance.getApiPort(), instance.getApiUsername(),
93 passwordCodec.decrypt(instance.getApiPassword()));
94
95 System.out.println("calling execute 1");
96 Thread t1 = new Thread(new Runnable() {
97
98 @Override
99 public void run() {
100 for (IntegrationServer integrationServer : integrationServers.getExecutionGroup()) {
101 Applications applications;
102 try {
103 applications = iibRestClient.getApplications(integrationServer.getName(),
104 instance.getHost(), instance.getApiPort(), instance.getApiUsername(),
105 passwordCodec.decrypt(instance.getApiPassword()));
106 System.out.println("calling execute 2");
107 Thread t2 = new Thread(new Runnable() {
108 @Override
109 public void run() {
110 for (Application application : applications.getApplication()) {
111 IIBDeploymentStatus iibDeploymentStatus;
112 try {
113 iibDeploymentStatus = iibRestClient.getDeployemntProperties(
114 integrationServer.getName(), application.getName(),
115 instance.getHost(), instance.getApiPort(),
116 instance.getApiUsername(),
117 passwordCodec.decrypt(instance.getApiPassword()));
118
119 iibList.add(new Deployment(application.getName(),
120 getBarFileName(iibDeploymentStatus), instance.getTier(),
121 instance.getInstanceName(), integrationServer.getName(),
122 getBarDeploymentTime(iibDeploymentStatus), new Date(),
123 getBarModifyTime(iibDeploymentStatus),
124 getBarReleaseId(iibDeploymentStatus),
125 getBarCheckSum(iibDeploymentStatus), "api", "api",
126 "snapshot"));
127 } catch (DeploymentAuditException e) {
128 e.printStackTrace();
129 }
130 }
131
132 }
133 });
134 pool.execute(t2);
135
136 } catch (DeploymentAuditException e) {
137 }
138 }
139
140 }
141 });
142 pool.execute(t1);
143 } catch (DeploymentAuditException e1) {
144 e1.printStackTrace();
145 }
146
147 }
148 84
149 }
150 });
85 Thread instanceThread = new Thread(new InstanceThread(iibRestClient, passwordCodec, instances));
151 86 instancePool.execute(instanceThread); instancePool.execute(instanceThread);
152 87
153 88 while (true) { while (true) {
 
... ... public class DeploymentStatusBuidler {
214 149 return indexedDeployments; return indexedDeployments;
215 150 } }
216 151
217 private String getBarReleaseId(IIBDeploymentStatus iibDeploymentStatus) {
152 public String getBarReleaseId(IIBDeploymentStatus iibDeploymentStatus) {
218 153 List<DeploymentProperties> basicProperties = iibDeploymentStatus.getBasicProperties(); List<DeploymentProperties> basicProperties = iibDeploymentStatus.getBasicProperties();
219 154 return extractproperty(basicProperties, ApplicationConstant.IIB_API_RESPONSE_VERSION); return extractproperty(basicProperties, ApplicationConstant.IIB_API_RESPONSE_VERSION);
220 155 } }
221 156
222 private String getBarCheckSum(IIBDeploymentStatus iibDeploymentStatus) {
157 public String getBarCheckSum(IIBDeploymentStatus iibDeploymentStatus) {
223 158 List<DeploymentProperties> deployedProperties = iibDeploymentStatus.getDeployedProperties(); List<DeploymentProperties> deployedProperties = iibDeploymentStatus.getDeployedProperties();
224 159 return extractproperty(deployedProperties, ApplicationConstant.IIB_API_RESPONSE_BAR_CHECKSUM); return extractproperty(deployedProperties, ApplicationConstant.IIB_API_RESPONSE_BAR_CHECKSUM);
225 160 } }
226 161
227 private Date getBarModifyTime(IIBDeploymentStatus iibDeploymentStatus) throws DeploymentAuditException {
162 public Date getBarModifyTime(IIBDeploymentStatus iibDeploymentStatus) throws DeploymentAuditException {
228 163 List<DeploymentProperties> deployedProperties = iibDeploymentStatus.getDeployedProperties(); List<DeploymentProperties> deployedProperties = iibDeploymentStatus.getDeployedProperties();
229 164 return convertToDate(extractproperty(deployedProperties, ApplicationConstant.IIB_API_RESPONSE_MODIFY_TIME)); return convertToDate(extractproperty(deployedProperties, ApplicationConstant.IIB_API_RESPONSE_MODIFY_TIME));
230 165 } }
231 166
232 private Date getBarDeploymentTime(IIBDeploymentStatus iibDeploymentStatus) throws DeploymentAuditException {
167 public Date getBarDeploymentTime(IIBDeploymentStatus iibDeploymentStatus) throws DeploymentAuditException {
233 168 List<DeploymentProperties> deployedProperties = iibDeploymentStatus.getDeployedProperties(); List<DeploymentProperties> deployedProperties = iibDeploymentStatus.getDeployedProperties();
234 169 return convertToDate(extractproperty(deployedProperties, ApplicationConstant.IIB_API_RESPONSE_DEPLOY_TIME)); return convertToDate(extractproperty(deployedProperties, ApplicationConstant.IIB_API_RESPONSE_DEPLOY_TIME));
235 170 } }
236 171
237 private String getBarFileName(IIBDeploymentStatus iibDeploymentStatus) {
172 public String getBarFileName(IIBDeploymentStatus iibDeploymentStatus) {
238 173 List<DeploymentProperties> deployedProperties = iibDeploymentStatus.getDeployedProperties(); List<DeploymentProperties> deployedProperties = iibDeploymentStatus.getDeployedProperties();
239 174 return extractproperty(deployedProperties, ApplicationConstant.IIB_API_RESPONSE_BAR_FILE_NAME); return extractproperty(deployedProperties, ApplicationConstant.IIB_API_RESPONSE_BAR_FILE_NAME);
240 175 } }
File src/main/java/com/kingfisher/deployment/audit/thread/model/ApplicationThread.java added (mode: 100644) (index 0000000..8534156)
1 package com.kingfisher.deployment.audit.thread.model;
2
3 import java.util.Date;
4
5 import com.kingfisher.deployment.audit.data.builder.DeploymentStatusBuidler;
6 import com.kingfisher.deployment.audit.exception.model.DeploymentAuditException;
7 import com.kingfisher.deployment.audit.model.Application;
8 import com.kingfisher.deployment.audit.model.Applications;
9 import com.kingfisher.deployment.audit.model.Deployment;
10 import com.kingfisher.deployment.audit.model.IIBDeploymentStatus;
11 import com.kingfisher.deployment.audit.model.Instance;
12 import com.kingfisher.deployment.audit.model.IntegrationServer;
13 import com.kingfisher.deployment.audit.rest.client.IIBRestClient;
14 import com.kingfisher.deployment.audit.security.PasswordCodec;
15
16 public class ApplicationThread extends Thread {
17
18 private IIBRestClient iibRestClient;
19
20 private PasswordCodec passwordCodec;
21
22 private Instance instance;
23
24 private IntegrationServer integrationServer;
25
26 private Applications applications;
27
28 public ApplicationThread() {
29 super();
30 }
31
32 public ApplicationThread(IIBRestClient iibRestClient, PasswordCodec passwordCodec, Instance instance,
33 IntegrationServer integrationServer, Applications applications) {
34 super();
35 this.iibRestClient = iibRestClient;
36 this.passwordCodec = passwordCodec;
37 this.instance = instance;
38 this.integrationServer = integrationServer;
39 this.applications = applications;
40 }
41
42 public Instance getInstance() {
43 return instance;
44 }
45
46 public void setInstance(Instance instance) {
47 this.instance = instance;
48 }
49
50 public IntegrationServer getIntegrationServer() {
51 return integrationServer;
52 }
53
54 public void setIntegrationServer(IntegrationServer integrationServer) {
55 this.integrationServer = integrationServer;
56 }
57
58 public Applications getApplications() {
59 return applications;
60 }
61
62 public void setApplications(Applications applications) {
63 this.applications = applications;
64 }
65
66 public void run() {
67 for (Application application : applications.getApplication()) {
68 IIBDeploymentStatus iibDeploymentStatus;
69 try {
70 DeploymentStatusBuidler deploymentStatusBuidler = new DeploymentStatusBuidler();
71 iibDeploymentStatus = iibRestClient.getDeployemntProperties(integrationServer.getName(),
72 application.getName(), instance.getHost(), instance.getApiPort(), instance.getApiUsername(),
73 passwordCodec.decrypt(instance.getApiPassword()));
74
75 DeploymentStatusBuidler.iibList.add(new Deployment(application.getName(),
76 deploymentStatusBuidler.getBarFileName(iibDeploymentStatus), instance.getTier(),
77 instance.getInstanceName(), integrationServer.getName(),
78 deploymentStatusBuidler.getBarDeploymentTime(iibDeploymentStatus), new Date(),
79 deploymentStatusBuidler.getBarModifyTime(iibDeploymentStatus),
80 deploymentStatusBuidler.getBarReleaseId(iibDeploymentStatus),
81 deploymentStatusBuidler.getBarCheckSum(iibDeploymentStatus), "api", "api", "snapshot"));
82 } catch (DeploymentAuditException e) {
83 e.printStackTrace();
84 }
85 }
86 }
87
88 }
File src/main/java/com/kingfisher/deployment/audit/thread/model/InstanceThread.java added (mode: 100644) (index 0000000..e07997c)
1 package com.kingfisher.deployment.audit.thread.model;
2
3 import java.util.List;
4
5 import com.kingfisher.deployment.audit.data.builder.DeploymentStatusBuidler;
6 import com.kingfisher.deployment.audit.exception.model.DeploymentAuditException;
7 import com.kingfisher.deployment.audit.model.Instance;
8 import com.kingfisher.deployment.audit.model.IntegrationServers;
9 import com.kingfisher.deployment.audit.rest.client.IIBRestClient;
10 import com.kingfisher.deployment.audit.security.PasswordCodec;
11
12 public class InstanceThread extends Thread {
13
14 private IIBRestClient iibRestClient;
15
16 private PasswordCodec passwordCodec;
17
18 private List<Instance> instances;
19
20 public InstanceThread() {
21 super();
22 }
23
24 public InstanceThread(IIBRestClient iibRestClient, PasswordCodec passwordCodec, List<Instance> instances) {
25 super();
26 this.iibRestClient = iibRestClient;
27 this.passwordCodec = passwordCodec;
28 this.instances = instances;
29 }
30
31 public List<Instance> getInstances() {
32 return instances;
33 }
34
35 public void setInstances(List<Instance> instances) {
36 this.instances = instances;
37 }
38
39 public void run() {
40 for (Instance instance : instances) {
41 IntegrationServers integrationServers;
42 try {
43 integrationServers = iibRestClient.getIntegrationServers(instance.getHost(), instance.getApiPort(),
44 instance.getApiUsername(), passwordCodec.decrypt(instance.getApiPassword()));
45
46 System.out.println("calling execute 1");
47 Thread integrationServerThread = new Thread(
48 new IntegrationServerThread(iibRestClient, passwordCodec, instance, integrationServers));
49 DeploymentStatusBuidler.pool.execute(integrationServerThread);
50 } catch (DeploymentAuditException e1) {
51 e1.printStackTrace();
52 }
53
54 }
55 }
56 }
File src/main/java/com/kingfisher/deployment/audit/thread/model/IntegrationServerThread.java added (mode: 100644) (index 0000000..f91a5ed)
1 package com.kingfisher.deployment.audit.thread.model;
2
3 import com.kingfisher.deployment.audit.data.builder.DeploymentStatusBuidler;
4 import com.kingfisher.deployment.audit.exception.model.DeploymentAuditException;
5 import com.kingfisher.deployment.audit.model.Applications;
6 import com.kingfisher.deployment.audit.model.Instance;
7 import com.kingfisher.deployment.audit.model.IntegrationServer;
8 import com.kingfisher.deployment.audit.model.IntegrationServers;
9 import com.kingfisher.deployment.audit.rest.client.IIBRestClient;
10 import com.kingfisher.deployment.audit.security.PasswordCodec;
11
12
13 public class IntegrationServerThread extends Thread {
14
15 private IIBRestClient iibRestClient;
16
17 private PasswordCodec passwordCodec;
18
19 private Instance instance;
20
21 private IntegrationServers integrationServers;
22
23 public IntegrationServerThread() {
24 super();
25 }
26
27 public IntegrationServerThread(IIBRestClient iibRestClient, PasswordCodec passwordCodec, Instance instance,
28 IntegrationServers integrationServers) {
29 super();
30 this.iibRestClient = iibRestClient;
31 this.passwordCodec = passwordCodec;
32 this.instance = instance;
33 this.integrationServers = integrationServers;
34 }
35
36 public Instance getInstance() {
37 return instance;
38 }
39
40 public void setInstance(Instance instance) {
41 this.instance = instance;
42 }
43
44 public IntegrationServers getIntegrationServers() {
45 return integrationServers;
46 }
47
48 public void setIntegrationServers(IntegrationServers integrationServers) {
49 this.integrationServers = integrationServers;
50 }
51
52 public void run() {
53 for (IntegrationServer integrationServer : integrationServers.getExecutionGroup()) {
54 Applications applications;
55 try {
56 applications = iibRestClient.getApplications(integrationServer.getName(), instance.getHost(),
57 instance.getApiPort(), instance.getApiUsername(),
58 passwordCodec.decrypt(instance.getApiPassword()));
59 System.out.println("calling execute 2");
60 Thread applicationThread = new Thread(
61 new ApplicationThread(iibRestClient, passwordCodec, instance, integrationServer, applications));
62 DeploymentStatusBuidler.pool.execute(applicationThread);
63
64 } catch (DeploymentAuditException e) {
65 }
66 }
67 }
68
69 }
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/Sumangal-IN/deployment-audit

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/Sumangal-IN/deployment-audit

Clone this repository using git:
git clone git://git.rocketgit.com/user/Sumangal-IN/deployment-audit

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main