Project-Document-COMS (1)
Project-Document-COMS (1)
Module – 1:
1. Tell me about yourself or May i know about your or can you briefly introduce about yourself?
Sol: we need to cover topics like Experience Companies (Current Company and past companies if you have), Technologies,
and Domains
Hi this is Sreenu; I have completed my Btech from JNTU
I am having 3+ years’ experience in java and j2ee technologies.
Presently i am work as software engineer in TCS.
During my experience i got the chance to work on different domains like telecom, banking and also
I have worked on different technologies like jdk8, spring framework , spring boot , micro services,
distributedtechnologies using rest api and also hands-on on some real-time tools like
Git,maven,junit,mockito,powermockio,log4j,Jenkins
1. Batch Job is used to execute the millions of the transactions per day without user interaction.
2. Here Batch job will get the list of offers from different sources and update into destination systems.
3. Generally batch jobs will be executed in non business (12:00 AM IST) without impacting customers txns.
4. Quartz scheduler - Cron expression: It is used to execute the batch job for the specified time interval.
5. Batch Job will read the data from mainframes and get the list of offer details of the
customer card number.
6. It will process the data like filter the data and remove the invalid records.
7. Write the resultant offer details into destination database.
8. This process will be continued every day without user interaction.
Sol: Architecture means how the different systems can communicate with each other.
1
Approach 2: with micro services
Note: There are 6 micro services has been developed for this COMS product
1. offer-details-service 2. customer-enrollment-service 3. Card-verify-service 4. User-Auth-Service service
9. Consumer/Client
Consumers will be coming from web and mobile
We are exposing secure services. i.e. using SSL (https)
When the request will come from consumers to service ie. consumer will send the authorize token in request header
Service will Authenticate by verify the token. If it is valid then redirect to actual service else, it will give error message
to consumer like 401 unauthorized client.
Microservice FAQs:
• Difference between monolithic and micro services?
• How to communicate/access from one micro service to another micro service?
• What is API gateway, how it works?
• How to trace the logs?
• How spring batch will work?
4. Can you explain your project technical flow?
Sol: we need to explain each and every class how it works. i.e. it should cover all the classes like controller, validator, service,
request builder, dao ,database integration, response handling, exceptions, response builder,
i.e. The flow should explain from client microserivce service backend systems
Based on the client requirements we have developed swagger documentation, since it is distributed application then we should
follow Layered Architecture. There are 3 layers
3
1. Controller Layer: Get the request from consumer in json format and convert json to java object by JACKSON. Validate
the request, throws the exception if the request is invalid. Prepare the req for Service layer. Call the Service. If the
format is XML, then JAXB will take care to convert Java Object to XML and XML to java object
2. Service Layer: Get the request from controller layer and perform some business logic like data filtering,
transformation, implement parallel calls, aggregate the integrations data..etc
3. Integration Layer: It is used to communicate with backend systems. For every backend communication we need to
write corresponding client code.
We have implemented different type’s security in our project like SSL, OAUTH 2.0
SSL: To implement this SSL we need JKS file and Password Client has provided these details.
We will share these details to network team; they will be configured JKS file at server level.
We will share public key to the entire consumer. They will be configuring at their approver level.
So that for every interaction between client and server will be transferred in encryption form.
6. What are the problems/riks you have been faced in your project?
Java Config :
@Component
@Scope("prototype")
public class CardTask {
}
@Component
@Scope("prototype")
public class PaymentTask {
We have implemented parallel calls in my project, unfortunately we didn’t close the threads because of this issue in production
servers will be down for every week, after more analysis we identify that issue with thread are not closed properly.
Scenario: Application is working but for sometimes success and for sometimes getting 500 errors
Sev 3 IMR: Fix this issue. Move the changes to live in next 1 month
8. How are you deploying the application or what is deployment process? (or)
How you will move the code from lower environment to higher environment (or)
How to move the code from dev to test and test to production?
Sol :
We have developed the code and commit & push the code into GIT.
Build all the maven modules into Jenkins. Jenkins will clone the source code from GIT
Perform the CI (Continues Integration) like
1. Compile the Code
2. Execute the unit test cases
3. Generate reports like code quality, code coverage using SonarQube
4. Execute security scanning
5. Generate the jar
6. Build the docker image
7. Push the docker image into docker hub/nexus
Perform the CD (Continuous Deployment) like
1. Jenkins will get the image from docker hub/nexus/Jfrog
2. Jenkins will deploy the image into dev environment, if dev environment is working as expected then deploy into test
environment. Similarly deploy into uat environment
3. Once Non prod is working fine then deploy the application into production environment
6
test offer details are coming or not
test no offers found scenario?
test list of transactions are coming or not
test the transaction status
Can you write the snippet code?
@Test
Public void testCardNumber_Invalid_Scenario(){
---
Assert.assertEquals(--,--);
}
Questions on Junit,Mockito,PowerMockito?
junit, mockito, powermockito?
what is the tool you are using for code coverage? Sol : JACOCO
what is the percentage for code coverage? 80%
Sol:
If our application will not have any backend then we can use only Junit is enough. So not required Mockito and Power Mockito.
If our application needs to communicate with backend, then using junit we cannot test all the scenarios. So that Code coverage
will be less.To improve the code coverage we should use Mockito
If already Mockito is there why you should use PowerMockito?
Sol: Actually, in our project we have used initially Mockito only.We have written some of the test cases using Mockito to mock
the external/back end systems.In some of the scenarios Mockito is unable to mock an object because of this issue we are
unable to test the all the scenarios. We did Google to resolve this issue then we came to know that PowerMockito can resolve
these issue. So we have implemented Power Mockito in our project.
7
11. Have you worked on parallel calls? Can you explain how it works?
Sol : Yes, we have worked on parallel calls . Please explain our poc stuff how the parallel calls will work
Sol: In services layer what business logic we have implemented like, making sequential calls
based on credit score response, we were able to call proceed other service calls, once got the response
from other service calls then prepared final response
13. How are you monitoring logs? what tool you have used?
Sol : There are so many logging monitoring tools are there, some of them are ELK (kibana), SPLUNK, DataDog..etc
We have implemented ELK, using kibana dashboard to monitor the logs, based on logs alerts on errors
We will get the error logs and find the root cause of the issue and fix the issue.
Sol : If any issues will come in production then support team will inform to dev team with provided
necessary details like what date & time, what errors, how many errors ..etc. based on the details
dev team will search the logs in kibana or splunk and get the error logs.based on error logs try to
find the RCA (Root Cause Analysis)
Same error we should try to replicate in non production (Dev, Test), get the same error logs
Once we will fix those issues non prod, try to test it. If no errors found in non prod then only
move the changes into production.
15. Have you implemented Kafka in the project? Can you explain how it works?
Sol : Yes, we have implemented KAFKA in our project, implemented at publisher part
once the payment has been successful then push the customer details along payment details to KAFKA server
whoever subscriber they would pull the details from kafka server and process the request
Usecase 1:
We haven't implement Kafka in our current project, didn't get opportunity to implementbut i did
some poc on Kafka and helped to other project on implementation.
Usecase 2:
Devops team or infra team setup the kafka cluster in AWS
Shared the kafka server details like url, portnum, topic name, ..etc
We have written kafka publisher client code and using KafkaTemplate push the changes into kafka server
8
return new KafkaTemplate(); kafkaTemplate.send(message);
} }
16. Have you implemented redis cache in the project? Can you explain how it works?
Sol:
Use case 1:
We haven't implement Redis cache in our current project, didn't get opportunity to implementbut
i did some poc on Redis cache and helped to other project on implementation.
Use case 2:
Yes, we have implemented Redis cache in our project to store all the customer transactions details , these
transacation will be not be changed in next 3 hours.
We got the redis cache details from infra/devops team, using these details we can connect redis
server
Configured these redis details like url, port, timeout, username..etc in application.properties file
Added the spring-bootd-starter-data-redis dependency in pom.xml and configure cache
annotations like @EnableCaching and @Cacheble annotations in class and method levels
Always the first request will goto backend systems and get the success response, store the
success into response into cache, from second request onwords first it will check data is present
in cache or not, if it is present get it from cache, else will goto backend to get the data.
17. What are the Linux commands you have used in your project?
Sol: To communicate with remote servers (Dev or test or prod ) which are deployed on Linux servers then we should use linux
commands using putty.
1. ls
2. cd
3. pwd
4. chmod -Rf 7777 filename
5. rm -Rf 777 filename
6. tail -f catalina.out
7. ./startup.sh
8 ./shutdown.sh
9. clear
10. cat filename
18. What is the tool you are using for code quality? Sol : Sonarqube
9
Module 2:
1. Core java : Logical Questions using jdk8 stream api
I have a List Employees, each employee has empid, name, salary, location, dob..etc
a. how to get the Hyderabad location employee details
b. how to sort the employees based on emp name or salary
c. how to get max salary emp details or how to get Nth ( 2nd or 3rd ) salary emp details
d. who is the highest salary emp of each location
2. What are the collections (List or Set or Map) you have used in the project? Can you write skeleton code?
3. What is polymorphism? Have you used in the project? Write Skelton code?
4. What is encapsulation? have you used in the project? Write Skelton code?
5. What is the different String, StringBuffer, and StirngBuilder?
6. Can you explain how you have handled exceptions in your project and write the snippet code?
Sol: Generally, to implement exceptions in our we should use custom exceptions or use defined exceptions. According to client
requirement. We have categorized custom exceptions into different kind of exceptions
1. RequestInvalidException
2. BusinessException
3. SystemException
4. UnknownErrorException
Can you write snippet code how to write custom exception?
Public class RequestInvalidException extends Exception {
Private String errorCode;
Private String errorMsg;
Public ReqInvalidException (String errorCode,String errorMsg){
this.errorCode= errorCode;
this.errorMsg =errorMsg;
}//getters
}
Exception VS RuntimeException :
==============================
Exception: It is checked exception, which are enabled at compile time Runtime Exception: It is unchecked exception, which are
enabled at runtime. Note: either checked or unchecked exceptions will be raised at runtime only
Q) Difference between try, catch and throws
Q) Difference between throws and throws
}
Public OffersResponse buildOffersResponse (String errorCode, String errormsg) {
------------
}
10. What is encapsulation? Where have you used in project?
Sol: Encapsulation: Data hiding + Abstraction
Data hiding: By declaring all the member variables as private in a class.
Abstraction: Hide the implementation details.
Public class Account {
Private int amount;
Public void setAmount(String amount){ if( amount > 100 ){
this.amount = amount;
}
}
In our project we have used to create the beans like DTO,VO.These beans we have applied Encapsulation.
11. What are the collections you have used in project?
Sol : In our project we have used List and Map
Map : To invoke the stored procedure using spring jdbc. Here execute() method will expect argument input and output as map.
Can you write snippet code how you implement in the project?
How to insert and retrieve the values in Map?
How HashMap internally will work?
List : We are getting list of products from database, to process these products we have used List
How List is internally will work?
Can you write our own ArrayList?How it is ?
Can you write List snippet code how you have used in project?
12. What are the day to day activities in your office?
1. Our office official timings: 9:00 AM to 6:00 PM
11
2. We will reach office @ 9 or 9:30 AM.
3. First will check the client emails .So we came to know that what work we need to do.
4. Attending the scrum call or onshore status call @10:00 AM This will be around 10:00 AM to 10:30 AM
I will get clarify if any doubts in call.
5. Will go for tea break 10:15 AM to 10 :45 AM
6. I will start project work and continue until 1 or 1:30 PM
7. Will go for lunch 1 hour 1:30 PM to 2:30 PM
8. Start work from 2:30 PM to 4:30 PM .
9. Tea break 15 mins
10. Start work from 4:45 PM to 6 :30 PM or 7:00 PM
11. Before leave office sent status mail to onshore team.
12
=============================Spring Core===================================================
1. What is Spring Framework? What are it's main modules? What are the benefits of using Spring Framework?
2. What are some of the important features of spring framework? What is Inversion of Control (IoC) ?
3. What are the important roles of an IOC Container? what is Dependency Injection(DI)?
4. How do we implement DI in Spring Framework? Difference between Spring IOC and DI?
5. What is Loose Coupling?
6. What are types of IoC containers?
7. How to create Application Context in a Java Program? Difference between Bean Factory and Application Context?
What is a Spring Bean?
8. What is the importance of Spring bean configuration file? What are different ways to configure a class as Spring Bean?
What is Spring XML-Based Configuration?
9. What is Spring Java-Based Configuration?
10. What is Spring Annotation-based Configuration?
11. Can we have multiple Spring configuration files in one project? what are the different ways of injecting spring beans?
12. Which is the best way of injecting beans and why? Are singleton beans thread-safe?
13. Does Spring Bean provide thread safety? Explain Spring Bean lifecycle?
14. What are different Spring Bean Scopes? What are inner beans in Spring?
15. How to inject a java.util.Properties into a Spring Bean? What is Bean wiring?
16. Explain Spring Bean Autowiring?
17. Explain different modes of bean autowiring?
18. How do you turn on annotation based autowiring? Explain @Required annotation with example?
19. Explain @Autowired annotation with example?
20. Name some of the Design Patterns used in the Spring Framework? How does the scope Prototype work?
21. What Spring sub-projects do you know? Describe them briefly? Explain @Qualifier annotation with example?
22. Difference between constructor injection and setter injection? What are the different types of events in spring
framework?
23. Difference between FileSystemResource and ClassPathResource?
24. Which Dependency Inject would you suggest Constructor-based or setter-based?
25. How do you inject values into collection types List, Set, Map and Properties in a Spring bean? What are the types of
the transaction management Spring supports?
26. How is event handling done in Spring and what are the different types of events in spring framework? How do you
create an application context with Spring?
27. How does Spring know where to search for Components or Beans? What is a Component Scan?
28. How do you define a component scan in XML and Java Configurations? What does @Component signify?
29. What’s the difference Between @Controller, @Component, @Repository, and @Service Annotations in Spring?
30. How do you choose between setter and constructor injections?
31. What are the different options available to create Application Contexts for Spring? What are the different kinds of
matching used by Spring for Auto wiring?
32. How do you solve NoUniqueBeanDefinitionException? How do you solve NoSuchBeanDefinitionException?
33. What is @Primary? What is @Qualifier?
34. What are new features in Spring Framework 4.0? What are new features in Spring Framework 5.0?
35. What is the simplest way of ensuring that we are using single version of all Spring related dependencies? Why is Spring
Popular?
36. Which steps of beans life-cycle can be overridden or controlled?
37. What is a Spring Bean Factory? What are some of the implementations available?
38. In the context of Spring, what is a “stereotype”? What are the existing stereotypes and what is the difference between
them?
39. What are the different components of a Spring application? What are the various ways of using Spring Framework?
=================================SpringMvc======================================
1. What is Spring MVC framework?
2. What is DispatcherServlet and ContextLoaderListener?
3. Explain Spring MVC Flow or Can you explain How one request is processed? What is the front controller class of Spring
MVC?
4. How do you create a controller in Spring? @Controller vs @RestController? What is the difference in Spring MVC and
Spring core?
5. What are different implementations of View interface you have used in Spring MVC?
6. MVC is an abbreviation for a design pattern. What does it stand for and what is the idea behind it? How to use Java
based configuration?
7. How can we use Spring to create Restful Web Service returning JSON response? Can we have multiple Spring
configuration files?
8. Difference between <context:annotation-config> vs <context:component-scan>? Difference between @Component,
@Controller, @Repository & @Service annotations?
9. What does the ViewResolver class?
10. What is a MultipartResolver and when its used? How to upload file in Spring MVC Application? How does Spring MVC
provide validation support?
11. How to validate form data in Spring Web MVC Framework? What is Spring MVC Interceptor and how to use it?
12. How to handle exceptions in Spring MVC Framework? How to achieve localization in Spring MVC applications?
13. How to get ServletContext and ServletConfig object in a Spring Bean? How to use Tomcat JNDI DataSource in Spring
Web Application?
14. How would you relate Spring MVC Framework to 3-tier architecture? Is the DispatcherServlet instantiated via an
application context?
15. What is the root application context? How is it loaded?
16. What is the @Controller annotation used for? How can you create a controller without an annotation? What is the
ContextLoaderListener and what does it do?
17. What are you going to do in the web.xml. Where do you place it?
18. How is an incoming request mapped to a controller and mapped to a method? What is the @RequestParam used for?
14
19. What are the differences between @RequestParam and @PathVariable? What are some of the valid return types of a
controller method?
20. What is a View and what’s the idea behind supporting different types of View? How is the right View chosen when it
comes to the rendering phase?
21. What is the Model?
22. Why do you have access to the model in your View? Where does it come from? What is the purpose of the session
scope?
23. What is the default scope in the web context? Why are controllers testable artifacts?
24. What does the InternalResourceViewResolver do? What’s internal resource views?
=====Spring boot=================
1. What is Spring Boot?
2. Why we need Spring Boot?
3. What are the advantages of using Spring Boot? What are the disadvantages of using Spring Boot? What is Spring Boot
Starter?
4. What is spring-boot-starter-parent? What is spring-boot-starter-web?
5. How do you run and stop spring boot executable jar? How to disable specific auto-configuration in spring boot?
6. Why is it “opinionated”?
7. How does it work? How does it know what to configure? How are properties defined? Where?
8. What is Spring Boot CLI?
9. Spring Boot Components?
10. What is Spring Boot Starter?
11. What is Spring Boot AutoConfigurator? What is Spring Boot Initilizer?
12. What is the difference between an embedded container and a WAR? What embedded containers does Spring Boot
support?
13. What does @EnableAutoConfiguration do? What about @SpringBootApplication? What is a Spring Boot starter POM?
Why is it useful?
14. Spring Boot supports both Java properties and YML files. Would you recognize and understand them if you saw them?
15. Can you control logging with Spring Boot? How?
16. How to reload my changes on Spring Boot without having to restart server? What is Actuator in Spring Boot?
17. How to run Spring boot application to custom port? How to implement security for Spring boot application?
18. What is the configuration file name used by Spring Boot? How to implement Spring web using Spring boot?
19. How to configure database using Spring boot? What is YAML?
20. What are the advantages of YAML file than Properties file? What are the different ways to load YAML file in Spring
boot? What are the advantages of spring Externalized Configuration? What are Profiles in spring boot?
21. How to write custom log configuration in spring boot?
22. How do you customize Favicon in spring boot web application? How spring boot handles error in application?
23. How do you Create a deployable war file in spring boot? What is Hot swapping in spring boot?
24. How to execute Spring Batch jobs on startup?
25. Does spring boot need Logging? What is the default one? How do you configure Configure Logback for logging?
26. How do you Configure Log4j for logging?
27. How do you write a Write a JSON REST service in spring boot? How do you Write an XML REST service in spring boot?
28. What is the default Multipart File Uploads size in spring boot? How do you Enable HTTP response compression in
spring boot? How do you add Add a Servlet, Filter or Listener to an application ?
29. How do you Switch off the Spring Boot security configuration? What is “Transitively Dependency Resolution
Management”? What is spring-boot-devtools ?
30. How do you Change tomcat or jetty HTTP port? What is LiveReload?
31. How to exclude auto restart for static files?
32. ========Spring AOP=====
33. What is the concept of AOP? Which problem does it solve?
34. What is a pointcut, a join point, an advice, an aspect, weaving, Introduction, Target Object, AOP Proxy? How does
Spring solve (implement) a cross cutting concern?
35. Which are the limitations of the two proxy-types?
15
36. How many advice types does Spring support. What are they used for?
37. What do you have to do to enable the detection of the @Aspect annotation? Name three typical cross cutting
concerns?
38. What two problems arise if you don’t solve a cross cutting concern via AOP? What does @EnableAspectJAutoProxy
do?
39. What is a named pointcut?
40. How do you externalize pointcuts? What is the advantage of doing this? What is the JoinPoint argument used for?
41. What is a ProceedingJoinPoint?
42. What are the five advice types called?
43. Which advice do you have to use if you would like to try and catch exceptions? Limitations of Spring AOP?
44. What are the supported AspectJ pointcut designators in Spring AOP? How to declare aspect in Spring AOP?
45. How to declare a pointcut in Spring AOP?
46. What do you understand by Load-time weaving (LTW) in Spring?
16