List of commits:
Subject Hash Author Date (UTC)
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
Refactoring Test packages e916b5f3f15beb28f5a7373bc046cc81fb2b7630 mandas04 2019-01-31 04:36:10
Commit a3373d4cb0c1659664a1949f70d13e832170e27b - instance level thread implementation and build snapshot for tiers snapshot active in db.
Author: chatta06
Author date (UTC): 2019-02-15 13:45
Committer name: chatta06
Committer date (UTC): 2019-02-15 13:45
Parent(s): f854bbc4abedf7e4db3178d6394be70f252ea2d6
Signing key:
Tree: aa1c2df13488a531ef2952ece8ab97bdf0270829
File Lines added Lines deleted
ch.qos.logback.classic.Logger.class 0 0
com.kingfisher.deployment.audit.rest.client.IIBRestClient.class 0 0
org.springframework.asm.ClassReader.class 0 0
org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData.class 0 0
org.springframework.cglib.core.AbstractClassGenerator.class 0 0
org.springframework.cglib.core.ClassNameReader.class 0 0
org.springframework.cglib.core.DefaultGeneratorStrategy.class 0 0
org.springframework.cglib.core.KeyFactory$Generator.class 0 0
org.springframework.cglib.core.ReflectUtils.class 0 0
org.springframework.cglib.proxy.Enhancer.class 0 0
org.springframework.cglib.reflect.FastClass$Generator.class 0 0
org.springframework.context.annotation.ConfigurationClassEnhancer$BeanFactoryAwareGeneratorStrategy.class 0 0
org.springframework.http.HttpEntity.class 0 0
org.springframework.web.client.RestTemplate.class 0 0
src/main/java/com/kingfisher/deployment/audit/controller/DeploymentAuditController.java 21 13
src/main/java/com/kingfisher/deployment/audit/data/builder/DeploymentStatusBuidler.java 91 19
src/main/java/com/kingfisher/deployment/audit/repository/DeploymentRepository.java 9 3
src/main/java/com/kingfisher/deployment/audit/service/DeploymentAuditService.java 10 5
src/test/java/com/kingfisher/deployment/audit/test/smoke/DeploymentAuditControllerTest.java 16 3
File ch.qos.logback.classic.Logger.class added (mode: 100644) (index 0000000..c8a11e3)
File com.kingfisher.deployment.audit.rest.client.IIBRestClient.class added (mode: 100644) (index 0000000..e9821d3)
File org.springframework.asm.ClassReader.class added (mode: 100644) (index 0000000..c491242)
File org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData.class added (mode: 100644) (index 0000000..3891fb8)
File org.springframework.cglib.core.AbstractClassGenerator.class added (mode: 100644) (index 0000000..9439af0)
File org.springframework.cglib.core.ClassNameReader.class added (mode: 100644) (index 0000000..2000d29)
File org.springframework.cglib.core.DefaultGeneratorStrategy.class added (mode: 100644) (index 0000000..535a98b)
File org.springframework.cglib.core.KeyFactory$Generator.class added (mode: 100644) (index 0000000..77410a6)
File org.springframework.cglib.core.ReflectUtils.class added (mode: 100644) (index 0000000..24c97e4)
File org.springframework.cglib.proxy.Enhancer.class added (mode: 100644) (index 0000000..052062e)
File org.springframework.cglib.reflect.FastClass$Generator.class added (mode: 100644) (index 0000000..0d29cf1)
File org.springframework.context.annotation.ConfigurationClassEnhancer$BeanFactoryAwareGeneratorStrategy.class added (mode: 100644) (index 0000000..7767d99)
File org.springframework.http.HttpEntity.class added (mode: 100644) (index 0000000..e699e26)
File org.springframework.web.client.RestTemplate.class added (mode: 100644) (index 0000000..5986575)
File src/main/java/com/kingfisher/deployment/audit/controller/DeploymentAuditController.java changed (mode: 100644) (index a3df54a..05dca1c)
... ... package com.kingfisher.deployment.audit.controller;
2 2
3 3 import java.util.List; import java.util.List;
4 4
5 import org.slf4j.Logger;
6 import org.slf4j.LoggerFactory;
5 7 import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
6 8 import org.springframework.http.HttpHeaders; import org.springframework.http.HttpHeaders;
7 9 import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
8 10 import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
9 import org.springframework.web.bind.annotation.PathVariable;
10 11 import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
11 12 import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
12 13 import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
 
... ... import io.swagger.annotations.ApiParam;
24 25 import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponse;
25 26 import io.swagger.annotations.ApiResponses; import io.swagger.annotations.ApiResponses;
26 27
27 import org.slf4j.Logger;
28 import org.slf4j.LoggerFactory;
29
30 28 @RestController @RestController
31 29 @Api(value = "DeploymentAudit") @Api(value = "DeploymentAudit")
32 30 @RequestMapping("/v1/deployments") @RequestMapping("/v1/deployments")
 
... ... public class DeploymentAuditController {
45 43 * @throws DeploymentAuditException * @throws DeploymentAuditException
46 44 */ */
47 45 @ApiOperation("Add a set of deployments audits") @ApiOperation("Add a set of deployments audits")
48 @ApiResponses(value = { @ApiResponse(code = 201, message = "Success"), @ApiResponse(code = 400, message = "Bad Request") })
46 @ApiResponses(value = { @ApiResponse(code = 201, message = "Success"),
47 @ApiResponse(code = 400, message = "Bad Request") })
49 48 @PostMapping(value = "", consumes = "application/json", produces = "application/json") @PostMapping(value = "", consumes = "application/json", produces = "application/json")
50 public ResponseEntity<String> audit(@ApiParam(value = "Deployments that need adding to the audit", required = true) @RequestBody List<JenkinsDeploymentStatus> jenkinsDeploymentStatuses) throws DeploymentAuditException {
49 public ResponseEntity<String> audit(
50 @ApiParam(value = "Deployments that need adding to the audit", required = true) @RequestBody List<JenkinsDeploymentStatus> jenkinsDeploymentStatuses)
51 throws DeploymentAuditException {
51 52 LOGGER.debug("Enter class: {} method: {}", this.getClass().getSimpleName(), "audit"); LOGGER.debug("Enter class: {} method: {}", this.getClass().getSimpleName(), "audit");
52 53 deploymentAuditService.recordDeployments(jenkinsDeploymentStatuses); deploymentAuditService.recordDeployments(jenkinsDeploymentStatuses);
53 54 LOGGER.debug("Exit class: {} method: {}", this.getClass().getSimpleName(), "audit"); LOGGER.debug("Exit class: {} method: {}", this.getClass().getSimpleName(), "audit");
 
... ... public class DeploymentAuditController {
67 68 * @throws DeploymentAuditException * @throws DeploymentAuditException
68 69 */ */
69 70 @ApiOperation("Generates an Excel Report with application status across environments") @ApiOperation("Generates an Excel Report with application status across environments")
70 @ApiResponses(value = { @ApiResponse(code = 201, message = "Success", response = Byte[].class), @ApiResponse(code = 400, message = "Invalid request parameterts", response = AuditError.class) })
71 @ApiResponses(value = { @ApiResponse(code = 201, message = "Success", response = Byte[].class),
72 @ApiResponse(code = 400, message = "Invalid request parameterts", response = AuditError.class) })
71 73 @PostMapping(value = "/report", produces = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet") @PostMapping(value = "/report", produces = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
72 public ResponseEntity<byte[]> report(@ApiParam(value = "List of environments to extract info for and compared against reference environment", required = true) @RequestBody ReportParam param) throws DeploymentAuditException {
74 public ResponseEntity<byte[]> report(
75 @ApiParam(value = "List of environments to extract info for and compared against reference environment", required = true) @RequestBody ReportParam param)
76 throws DeploymentAuditException {
73 77 LOGGER.debug("Enter class: {} method: {}", this.getClass().getSimpleName(), "report"); LOGGER.debug("Enter class: {} method: {}", this.getClass().getSimpleName(), "report");
74 78 byte[] data = deploymentAuditService.createReport(param.getReferenceEnv(), param.getReportingEnv()); byte[] data = deploymentAuditService.createReport(param.getReferenceEnv(), param.getReportingEnv());
75 79 LOGGER.debug("Exit class: {} method: {}", this.getClass().getSimpleName(), "report"); LOGGER.debug("Exit class: {} method: {}", this.getClass().getSimpleName(), "report");
76 return ResponseEntity.status(HttpStatus.CREATED).header(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + deploymentAuditService.getReportFileName()).contentLength(data.length).body(data);
80 return ResponseEntity.status(HttpStatus.CREATED)
81 .header(HttpHeaders.CONTENT_DISPOSITION,
82 "attachment;filename=" + deploymentAuditService.getReportFileName())
83 .contentLength(data.length).body(data);
77 84 } }
78 85
79 86 @ApiOperation("To build snapshot") @ApiOperation("To build snapshot")
80 @ApiResponses(value = { @ApiResponse(code = 201, message = "Success", response = Byte[].class), @ApiResponse(code = 400, message = "Invalid request parameterts", response = AuditError.class) })
81 @PostMapping(value = "/build/snapshot/{tier}", produces = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
82 public ResponseEntity<byte[]> buildSnapshot(@ApiParam(value = "Tier name to create snapshot", required = true) @PathVariable("tier") String tier) throws DeploymentAuditException {
87 @ApiResponses(value = { @ApiResponse(code = 201, message = "Success", response = Byte[].class),
88 @ApiResponse(code = 400, message = "Invalid request parameterts", response = AuditError.class) })
89 @PostMapping(value = "/build/snapshot", produces = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
90 public ResponseEntity<byte[]> buildSnapshot() throws DeploymentAuditException {
83 91 LOGGER.debug("Enter class: {} method: {}", this.getClass().getSimpleName(), "report"); LOGGER.debug("Enter class: {} method: {}", this.getClass().getSimpleName(), "report");
84 deploymentAuditService.createSnapshot(tier);
92 deploymentAuditService.createSnapshot();
85 93 LOGGER.debug("Exit class: {} method: {}", this.getClass().getSimpleName(), "report"); LOGGER.debug("Exit class: {} method: {}", this.getClass().getSimpleName(), "report");
86 94 return ResponseEntity.status(HttpStatus.CREATED).build(); return ResponseEntity.status(HttpStatus.CREATED).build();
87 95 } }
File src/main/java/com/kingfisher/deployment/audit/data/builder/DeploymentStatusBuidler.java changed (mode: 100644) (index ec099ec..77af0ce)
... ... import java.util.ArrayList;
6 6 import java.util.Collections; import java.util.Collections;
7 7 import java.util.Date; import java.util.Date;
8 8 import java.util.List; import java.util.List;
9 import java.util.concurrent.ExecutorService;
10 import java.util.concurrent.Executors;
11 import java.util.concurrent.ThreadPoolExecutor;
9 12
10 13 import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
11 14 import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
 
... ... public class DeploymentStatusBuidler {
38 41 @Autowired @Autowired
39 42 PasswordCodec passwordCodec; PasswordCodec passwordCodec;
40 43
44 public static ExecutorService pool = Executors.newFixedThreadPool(20);
45 public static ExecutorService instancePool = Executors.newFixedThreadPool(20);
46
41 47 public Deployment build(JenkinsDeploymentStatus jenkinsDeploymentStatus) throws DeploymentAuditException { public Deployment build(JenkinsDeploymentStatus jenkinsDeploymentStatus) throws DeploymentAuditException {
42 48 String applicationName = jenkinsDeploymentStatus.getApplicationName(); String applicationName = jenkinsDeploymentStatus.getApplicationName();
43 49 String environment = jenkinsDeploymentStatus.getEnvironment(); String environment = jenkinsDeploymentStatus.getEnvironment();
 
... ... public class DeploymentStatusBuidler {
65 71 deployedByUserId, createdByProcess); deployedByUserId, createdByProcess);
66 72 } }
67 73
68 public List<Deployment> getSnapshotFromIIB(final String tier) throws DeploymentAuditException {
74 public List<Deployment> getSnapshotFromIIB(final List<String> tiers) throws DeploymentAuditException {
75
76 List<Instance> instances = new ArrayList<>();
77 for (String tier : tiers) {
78 instances.addAll(instanceRepository.findByTier(tier));
79 }
69 80 List<Deployment> iibList = new ArrayList<>(); List<Deployment> iibList = new ArrayList<>();
70 List<Instance> instances = instanceRepository.findByTier(tier);
71 for (Instance instance : instances) {
72 IntegrationServers integrationServers = iibRestClient.getIntegrationServers(instance.getHost(),
73 instance.getApiPort(), instance.getApiUsername(), passwordCodec.decrypt(instance.getApiPassword()));
74 for (IntegrationServer integrationServer : integrationServers.getExecutionGroup()) {
75 Applications applications = iibRestClient.getApplications(integrationServer.getName(),
76 instance.getHost(), instance.getApiPort(), instance.getApiUsername(),
77 passwordCodec.decrypt(instance.getApiPassword()));
78 for (Application application : applications.getApplication()) {
79 IIBDeploymentStatus iibDeploymentStatus = iibRestClient.getDeployemntProperties(
80 integrationServer.getName(), application.getName(), instance.getHost(),
81 instance.getApiPort(), instance.getApiUsername(),
82 passwordCodec.decrypt(instance.getApiPassword()));
83 iibList.add(new Deployment(application.getName(), getBarFileName(iibDeploymentStatus),
84 instance.getTier(), instance.getInstanceName(), integrationServer.getName(),
85 getBarDeploymentTime(iibDeploymentStatus), new Date(),
86 getBarModifyTime(iibDeploymentStatus), getBarReleaseId(iibDeploymentStatus),
87 getBarCheckSum(iibDeploymentStatus), "api", "api", "snapshot"));
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
88 147 } }
148
149 }
150 });
151 instancePool.execute(instanceThread);
152
153 while (true) {
154 if (executor.getActiveCount() == 0 && instanceExecutor.getActiveCount() == 0) {
155 pool.shutdown();
156 instancePool.shutdown();
157 break;
89 158 } }
90 159 } }
160 System.out.println("calling shutdown");
161
91 162 return iibList; return iibList;
163
92 164 } }
93 165
94 166 public List<Deployment> compareDeploymentsAndRectify(final List<Deployment> iibList, public List<Deployment> compareDeploymentsAndRectify(final List<Deployment> iibList,
File src/main/java/com/kingfisher/deployment/audit/repository/DeploymentRepository.java changed (mode: 100644) (index e39d0dd..ed3bc8d)
... ... import com.kingfisher.deployment.audit.model.Deployment;
17 17 public interface DeploymentRepository extends JpaRepository<Deployment, Integer> { public interface DeploymentRepository extends JpaRepository<Deployment, Integer> {
18 18
19 19 @Query(value = "select * from deployment where environment=:env and application_name=:app and exclude_from_report=0", nativeQuery = true) @Query(value = "select * from deployment where environment=:env and application_name=:app and exclude_from_report=0", nativeQuery = true)
20 List<Deployment> findLatestDeploymentByApplicationNameAndEnvironment(@Param("env") String env, @Param("app") String app);
20 List<Deployment> findLatestDeploymentByApplicationNameAndEnvironment(@Param("env") String env,
21 @Param("app") String app);
21 22
22 23 @Query(value = "select distinct application_name from deployment where environment in :envs", nativeQuery = true) @Query(value = "select distinct application_name from deployment where environment in :envs", nativeQuery = true)
23 24 List<String> findApplicationName(@Param("envs") List<String> environments); List<String> findApplicationName(@Param("envs") List<String> environments);
 
... ... public interface DeploymentRepository extends JpaRepository<Deployment, Integer>
25 26 @Modifying(clearAutomatically = true) @Modifying(clearAutomatically = true)
26 27 @Transactional @Transactional
27 28 @Query(value = "update deployment set exclude_from_report=1 where application_name=:applicationName and instance_name=:instanceName and integration_server=:integrationServer and exclude_from_report=0", nativeQuery = true) @Query(value = "update deployment set exclude_from_report=1 where application_name=:applicationName and instance_name=:instanceName and integration_server=:integrationServer and exclude_from_report=0", nativeQuery = true)
28 int hideFromReport(@Param("applicationName") String applicationName, @Param("instanceName") String instanceName, @Param("integrationServer") String integrationServer);
29 int hideFromReport(@Param("applicationName") String applicationName, @Param("instanceName") String instanceName,
30 @Param("integrationServer") String integrationServer);
29 31
30 Optional<Deployment> findByApplicationNameAndInstanceNameAndIntegrationServerAndBarDeploymentTime(String applicationName, String instanceName, String integrationServer, Date barDeploymentTime);
32 Optional<Deployment> findByApplicationNameAndInstanceNameAndIntegrationServerAndBarDeploymentTime(
33 String applicationName, String instanceName, String integrationServer, Date barDeploymentTime);
31 34
32 35 @Query(value = "select * from deployment where exclude_from_report=0 and environment=:tier", nativeQuery = true) @Query(value = "select * from deployment where exclude_from_report=0 and environment=:tier", nativeQuery = true)
33 36 List<Deployment> findAllInReport(@Param("tier") String tier); List<Deployment> findAllInReport(@Param("tier") String tier);
37
38 @Query(value = "select tier from snapshot_config where snapshot=1", nativeQuery = true)
39 List<String> findAllSnapshotActiveTier();
34 40 } }
File src/main/java/com/kingfisher/deployment/audit/service/DeploymentAuditService.java changed (mode: 100644) (index b7567fc..ee9ae8a)
... ... public class DeploymentAuditService {
110 110 return "report_" + new SimpleDateFormat("yyyy_MM_dd_HH_mm_ss").format(new Date()) + ".xlsx"; return "report_" + new SimpleDateFormat("yyyy_MM_dd_HH_mm_ss").format(new Date()) + ".xlsx";
111 111 } }
112 112
113 public void createSnapshot(String tier) throws DeploymentAuditException {
114 List<Deployment> iibList = deploymentStatusBuidler.getSnapshotFromIIB(tier);
115 List<Deployment> dbList = deploymentRepository.findAllInReport(tier);
116 for (Deployment deployment : deploymentStatusBuidler.compareDeploymentsAndRectify(iibList, dbList)) {
117 deploymentRepository.save(deployment);
113 public void createSnapshot() throws DeploymentAuditException {
114 List<String> tiers = deploymentRepository.findAllSnapshotActiveTier();
115 List<Deployment> dbList = new ArrayList<>();
116
117 List<Deployment> iibList = deploymentStatusBuidler.getSnapshotFromIIB(tiers);
118 for (String tier : tiers) {
119 dbList.addAll(deploymentRepository.findAllInReport(tier));
118 120 } }
121
122 deploymentRepository.saveAll(deploymentStatusBuidler.compareDeploymentsAndRectify(iibList, dbList));
123
119 124 } }
120 125
121 126 } }
File src/test/java/com/kingfisher/deployment/audit/test/smoke/DeploymentAuditControllerTest.java changed (mode: 100644) (index c35dff1..f8c4494)
... ... public class DeploymentAuditControllerTest {
46 46 String deployedByUserName = "test user"; String deployedByUserName = "test user";
47 47 String deployedByUserId = "TEST_USER"; String deployedByUserId = "TEST_USER";
48 48 String createdByProcess = "auto test"; String createdByProcess = "auto test";
49 JenkinsDeploymentStatus jenkinsDeploymentStatus = new JenkinsDeploymentStatus(applicationName, environment, instanceName, integrationServer, deployedByUserName, deployedByUserId, createdByProcess);
49 JenkinsDeploymentStatus jenkinsDeploymentStatus = new JenkinsDeploymentStatus(applicationName, environment,
50 instanceName, integrationServer, deployedByUserName, deployedByUserId, createdByProcess);
50 51 List<JenkinsDeploymentStatus> JenkinsDeploymentStatuses = new ArrayList<>(); List<JenkinsDeploymentStatus> JenkinsDeploymentStatuses = new ArrayList<>();
51 52 JenkinsDeploymentStatuses.add(jenkinsDeploymentStatus); JenkinsDeploymentStatuses.add(jenkinsDeploymentStatus);
52 53
53 this.mockMvc.perform(post("/v1/deployments").contentType(ApplicationConstant.CONTENT_TYPE_APPLICATION_JSON).content(IntegrationTestUtil.convertObjectToJsonString(JenkinsDeploymentStatuses))).andDo(print()).andExpect(status().isCreated());
54 this.mockMvc
55 .perform(post("/v1/deployments").contentType(ApplicationConstant.CONTENT_TYPE_APPLICATION_JSON)
56 .content(IntegrationTestUtil.convertObjectToJsonString(JenkinsDeploymentStatuses)))
57 .andDo(print()).andExpect(status().isCreated());
54 58 } }
55 59
56 60 @Test @Test
 
... ... public class DeploymentAuditControllerTest {
60 64 List<String> reportingEnv = Arrays.asList(new String[] { "F", "V" }); List<String> reportingEnv = Arrays.asList(new String[] { "F", "V" });
61 65 ReportParam reportParam = new ReportParam(referenceEnv, reportingEnv); ReportParam reportParam = new ReportParam(referenceEnv, reportingEnv);
62 66
63 this.mockMvc.perform(post("/v1/deployments/report").contentType(ApplicationConstant.CONTENT_TYPE_APPLICATION_JSON).content(IntegrationTestUtil.convertObjectToJsonString(reportParam))).andDo(print()).andExpect(status().isCreated());
67 this.mockMvc
68 .perform(post("/v1/deployments/report").contentType(ApplicationConstant.CONTENT_TYPE_APPLICATION_JSON)
69 .content(IntegrationTestUtil.convertObjectToJsonString(reportParam)))
70 .andDo(print()).andExpect(status().isCreated());
71 }
72
73 @Test
74 @WithMockUser(username = MOCK_AUDITOR_USERNAME, password = MOCK_AUDITOR_PASSWORD, roles = ApplicationConstant.SECURITY_ROLE_AUDITOR)
75 public void testBuildingSnapshot() throws Exception {
76 this.mockMvc.perform(post("/v1/deployments/build/snapshot")).andDo(print()).andExpect(status().isCreated());
64 77 } }
65 78 } }
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