Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
20 views28 pages

Arpna - GSOC Final

The document proposes adding support for MongoDB and RabbitMQ databases to the Keploy Java SDK. For MongoDB, the proposal involves installing the MongoDB driver, defining dependencies, connecting to MongoDB using MongoClient, and performing sample tests. For RabbitMQ, it involves downloading the RabbitMQ Java client, connecting to RabbitMQ using ConnectionFactory, declaring a queue, publishing messages to the queue as a producer, and consuming messages from the queue as a consumer. The proposed features would help the project and users by supporting additional databases like MongoDB and RabbitMQ.

Uploaded by

arpna sjs
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views28 pages

Arpna - GSOC Final

The document proposes adding support for MongoDB and RabbitMQ databases to the Keploy Java SDK. For MongoDB, the proposal involves installing the MongoDB driver, defining dependencies, connecting to MongoDB using MongoClient, and performing sample tests. For RabbitMQ, it involves downloading the RabbitMQ Java client, connecting to RabbitMQ using ConnectionFactory, declaring a queue, publishing messages to the queue as a producer, and consuming messages from the queue as a consumer. The proposed features would help the project and users by supporting additional databases like MongoDB and RabbitMQ.

Uploaded by

arpna sjs
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 28

GSoC’23 Proposal - Keploy

Keploy Java SDK

❖ Personal Details

Name:​Arpna
Course: ​BTech
Institute: Indian Institute Of Technology Varanasi(IIT BHU)
Email:​​[email protected]
Github:​https://github.com/Arpcoder
LinkedIn:https://www.linkedin.com/in/arpna-147a47216
Phone:​8429271529 , 8795901864
Address: Gorakhnath,Gorakhpur,Uttar Pradesh,India
Languages: English, Hindi (fluent and comfortable in both languages)
Current Country :India

Link to Resume / CV:​Resume

❖ About Yourself

1. I am a second year undergraduate from Indian Institute Of


Technology Varanasi(IIT BHU).I am pursuing a Bachelor's in the field
of Chemical Engineering.The idea of open-source projects has
fascinated me for quite some time now. I personally enjoy the fact that
people all around the world can connect and work together as a team
towards a common goal.
2. I use VS code,BlueJ,IntelliJ IDEA,Postman,and online compilers as
my development environments. I am learning docusaurus with an aim
2

of making changes in keploy’s documentation website.My expertise


lies in HTML , CSS , Java , C/C++. I am also learning React and also
interested in web development and competitive programming
(codeforces). I am familiar with all git commands and have been
using it for a long time.
3. I always wanted to explore API testing,while learning about it I started
contributing to organizations that use API testing like
Postman,Keploy. Since I was familiar with Java, therefore I was
inclined to choose this organization.
4. I have not participated in an open-source project before but I have
made pull requests during hacktoberfest and in some other
organizations as well.
Links for the same are- Postman , AllAlgorithms

❖ Commitment
1. No,I am not planning any vacations during the GSoC period.
2. I will be attending roughly 25 classes per week during the latter half of
the GSOC period (July-end onwards).
3. No,I don't have any other employment during the GSoC period.
4. I can manage to work for 35 hours(5 hours per day) in the initial
months(May,June,mid July) and 20 hours per week later on.I am
available the entire day on weekends and plan to spend at least 5-6
hrs per day over the weekends and holidays

Days Working-hours
Mon-Fri One hours
Sat-Sun Five hours

❖ Contributions so far-
➔ Contributions in Keploy-
3

Task Status Link


● Updated GSOC timeline link Merged ● #24
in readme,also added some
events in tabular form.

● Fixed broken installation link Mentioned a… ● #451.

● Updated readme of Under review ● #46


samples-java (adding
images and links)
● Added png images for java Under review ● #164
dependencies in
documentation website

➔ Contributions in other organizations-

Organization Pull request Task and link


status
● Postman Mention… ● Added GSOC events
timeline. (Link)

● Postman Under r… ● Fixed typos. (Link)

● Postman Unmerged ● updated HTML paragraphs


(Link)

● AllAlgorithms Unmerged ● Added merge sort


(Hacktoberfest) algorithm (Link)

❖ Proposal
4

Goals Ideas
Goal-1 Add support for MongoDB database

Goal-2 Add support for RabbitMQ database

Goal-3 Add support for Google Cloud Platform & Azure SDKs

➔ GOAL 1:- Add support for MongoDB database


● Overview

● I will be using java , MongoDB to implement the above goals.

Detailed
5

Task1-Firstly we should install MongoDB driver.We can download the


MongoDB-driver jar directly from sonatype.

Task2-Then we need to start by defining the dependency of a Java Driver


for MongoDB in pom.xml.

After this we need to import all necessary libraries.

Task3-We can connect to and communicate with MongoDB using the


MongoClient instance (eg.standalone).Use MongoClients.create()
method to construct a MongoClient. As each MongoClient represents a
thread-safe pool of connections to the database, most applications only
require a single instance of a MongoClient, even across multiple threads.

Task4-Now, to connect to a standalone / replica / shared cluster MongoDB


instance we can explicitly specify the hostname to connect to a MongoDB
instance running on the specified host on port 27017.
6

Task5-At last we can perform sample tests.


The rough code is-

In the above code, in the setup() method, we create a MongoClient object


and connect to the MongoDB database.
We then get a reference to the database using getDatabase() and store it
in the database variable.Then in the testAPIWithMongoDB() method, we
can perform our API tests that require database access. We can use the
database object to perform MongoDB operations.In the teardown()
method, we close the MongoDB connection using the close() method of the
7

MongoClient object. This ensures that we release the resources used by


the connection when the tests are done running.
Why these features are a good idea. How will the features you
propose help the project or its users?

● MongoDB allows us to immediately start building applications


without spending time configuring a database.
● Instead of storing data in tables of rows or columns like SQL
databases, each record in a MongoDB database is a document
described in BSON, a binary representation of the data. Applications
can then retrieve this information in a JSON format.
● MongoDB is a non-relational document database. Document
databases are highly flexible , making it easy for developers to store
structured or unstructured data allowing variations in the structure
of documents and storing documents that are partially complete. One
document can have others embedded in it.
● MongoDB supports field, range, and regular-expression queries
which can return entire documents, specific fields of documents, or
random samples of results.
● Fields in a MongoDB document can be indexed with primary and
secondary indices. MongoDB supports a number of different index
types, including single field, compound (multiple fields), multikey
(array), geospatial, text, and hashed.
● MongoDB provides high availability with replica sets including two
or more copies of the data. Writes are handled by the primary replica,
while any replica is capable of serving read requests. If the primary
replica fails, a secondary replica is promoted to become the primary
replica.
8

➔ GOAL 2:- Add support for RabbitMQ database


● Overview
9

● I will be using java , RabbitMQ to implement the above goals.

Detailed
Task1-Firstly we have to download the latest version (3.11.10) of RabbitMQ
from here.We'll naturally use the Java client for interacting with RabbitMQ
server.The Maven dependencies for this client is-

Task2-After this we need to connect it to it using a java client. We use


object ConnectionFactory to set up the connection with the server using
newconnection. Here we connect to the server on localhost, we can
modify the host name by using the setHost function.

Task-3Now we will set the username and the password.A channel is created
using the connection. Now we declare a queue using the queueDeclare
method on the channel. The arguments to queueDeclare specify the name
of the queue, whether it should be durable, whether it should be exclusive
to the current connection, whether it should be auto-deleted when there are
no consumers, and any additional arguments (in this case, we pass null for
the additional arguments).
10

Each time when users add a new product, we will publish a message to a
queue using the basicPublish method on the channel. The arguments to
basicPublish specify the exchange to publish to (in this case, the default
exchange), the name of the queue to publish to, any message properties (in
this case, we pass null), and the message content.

Task4-Lastly, we close the channel and the connection using the close
method.
The rough code for producer is-
11

Task5-This message will be consumed by another service, which is


responsible for sending emails to customers. For consumer side we're
going to declare the same queue.We define the consumer that will process
messages from queue asynchronously-
12

In the above code we create a new DefaultConsumer for the channel. This
overrides the handleDelivery method of DefaultConsumer to print the
message to the console and process it as needed.

Finally, we start consuming messages from the queue using the


basicConsume method on the channel, passing in the name of the queue,
true to auto-acknowledge messages as they are received, and the
DefaultConsumer we created earlier.

Why these features are a good idea. How will the features you
propose help the project or its users?

● Several RabbitMQ servers on a local network can be clustered


together, forming a single logical broker.
● For servers that need to be more loosely and unreliably connected
than clustering allows, RabbitMQ offers a federation model.
● RabbitMQ supports messaging over a variety of messaging
protocols.
● RabbitMQ supports replicated queues and streams. machines in a
cluster, ensuring that even in the event of hardware failure, messages
are safe as long as there is a majority of cluster nodes online.
● There are RabbitMQ clients for almost any language.
● RabbitMQ ships with an easy-to-use management UI that allows
users to monitor and control every aspect of the user's message
broker.
● If a user's messaging system is misbehaving, RabbitMQ offers
tracing support to let the user find out what's going on.
● RabbitMQ offers a variety of features to let you trade off performance
with reliability, including persistence, delivery acknowledgements,
publisher confirms, and high availability.
● Messages are routed through exchanges before arriving at queues.
RabbitMQ features several built-in exchange types for typical routing
logic. For more complex routing you can bind exchanges together or
even write your own exchange type as a plugin.
13

● Benefits from the user side can be understood by image below.

➔GOAL 3:- Add support for Google Cloud Platform &


Azure SDKs
● Overview
14

● I will be using Java , Google cloud,CLI tools,cloud tools,client


libraries to implement the above goals.

Detailed
Task1-Firstly we need to install google cloud CLI from here. Then after
installing cloud client libraries to integrate with Google Cloud services, such
as Datastore and Cloud Storage, also install azure-storage-blob library.

Task2-Now we need to add google-cloud-SDK and Azure-SDK


dependencies to pom.xml (maven project).
15

Task3-Now we need to create one new azure and google cloud storage
account.Before we can connect to Google Cloud, we need to configure
authentication. Google Cloud Platform (GCP) applications load a private
key and configuration information from a JSON configuration file. We
generate this file via the GCP console. Access to the console requires a
valid Google Cloud Platform Account. Authentication can be created from
here. Configuration can be done by following steps under 2.2 section of
this. For Azure, we can create a new storage account key.

Task4-Next we need to install the authentication key. For this we copy the
file downloaded from GCP console to a convenient location and point the
GOOGLE_APPLICATION_CREDENTIALS to the path of your JSON key file.
For Azure, set AZURE_STORAGE_CONNECTION_STRING to the
connection string for your storage account.

Task4-Now Initialize the client libraries for Google Cloud Storage and Azure
Blob Storage in your Java application. Now install cloud SDK from here,
and follow quickstart from here.

Before we can use Google Cloud storage, we have to create a service


object.
16

Task5-As a next step we can create a bucket. Buckets are containers that
hold objects. They can be used to organize and control data access.
Bucket names must be globally unique. If we choose a name that is
already used, create() will fail.

We can examine our bucket using gsutil.

Task6-Create a connection string: To connect to Azure services, we


will need to create a connection string that contains your Azure Storage
account name and access key. We can find your account name and
access key in the Azure portal.
17

Task7-Create an instance of the Azure service client: Use the


connection string and the Azure SDK classes to create an instance of
the Azure service client. For example, to create a BlobServiceClient
object, you can use the following code:

Task8-In Google Cloud Storage, objects are stored in Blobs.Now


creating a new blob-

In this way we have saved a string to our bucket.

Why these features are a good idea. How will the features you
propose help the project or its users-
● Cloud storage enables you to make data available anywhere you
are, anytime you need it. Instead of being tied to a location or specific
18

device, people can access data from anywhere in the world from any
device.
● Cloud computing can actually strengthen your security posture
because of the depth and breadth of security features, automatic
maintenance, and centralized management.
● Cloud providers offer backup and disaster recovery features. Storing
data in the cloud rather than locally can help prevent data loss in the
event of an emergency, such as hardware malfunction, malicious
threats, or even simple user error.
● Google Cloud provides a platform for innovation, with access to
cutting-edge technologies such as artificial intelligence, machine
learning, and data analytics, as well as tools and services that enable
developers to build and deploy applications quickly and efficiently.
● The Azure SDK delivers a platform for developers to leverage the
wide variety of Azure services in their language of choice.
● Improved application performance: Azure SDK provides optimized
code and pre-built modules that enable developers to build highly
scalable and efficient applications that can handle a large number of
requests.
● Cross-platform support: Azure SDK supports multiple programming
languages and platforms, including .NET, Java, Python, Node.js, and
many more. This allows developers to build applications on their
preferred platform and language.
● Reduced development time: Azure SDK provides developers with
pre-built APIs and libraries that can be easily integrated into their
applications, reducing the time and effort required to build a complete
solution.
19

❖ Project Plan
My major task in my summer break would be working for this project and
preparing for my intern season (as I am in my second year). I will be giving
tests and interviews for internships, so I won’t be able to devote above
described hours of work.But I will complete major tasks in May, June and
mid July, as in these months I will be on my summer break. In September I
will be giving my mid term examination, therefore I will be taking a break of
two weeks(although my project would have been completed by that time).I
assure you that I will complete my tasks.I will make up for these days either
by completing the task beforehand or by spending 2-4 hrs extra the next
day. I will compensate for the remaining break days by working extra hours.
I will keep the mentors informed about this. I assure you that this will not
affect the time I’m willing to devote for my project.
20

❖ Integrations
KEPLOY uses no-code integration for integrating dependencies. It uses
ASM tool Byte Buddy for creating classes which can be extended using
Kclasses. It intercepts Redis requests by overloading methods to capture
Redis request. A Logger object is created which is used to log messages.
By creating Redis serializer data converts its state to a byte stream so that
the byte stream can be reverted back into a copy of the object. By default,
Redis uses a binary-safe protocol for storing and retrieving data, but a
custom serializer can be used to convert data to and from this format in a
way that is optimized for the specific use case. Gson is used to convert
Java Objects into their JSON UTF-16 representation using tochars(). Now
constructors are overloaded depending upon port, host, ssl, etc. Mock
object meta hashmap is created into which data is filled using key-value
pair if KEPLOY is in test mode. Then after different-different functions have
been overridden according to the needs. A sendCommand function is
created in which, if the KEPLOY is in record mode it means that the request
did not send byte data instead request sent objects. So Redis uses its
default serializer to serialize the data. And if the mode is test mode, super
class logic is implemented and functions of this class are called. For this
byte matrix is created in which encoded byte string is stored. Now check if
serializer is already set or not(for record mode), if not that means the
request sent bytes data hence data is captured. For test mode this is
returned. Again many functions are overrided to set host and port. At last
many jedis methods named as getStatusCodeReply(), getBulkReply(),
getBinaryBulkReply(), getIntegerReply(), and getMultiBulkReply(), etc are
overridden. Each method first checks the current mode (record or test). If in
record mode, the response from Jedis is captured and saved as metadata
using a key-value pair. The metadata is then sent to the server. If in test
mode, the response is retrieved from the metadata and is returned. Some
methods also check whether a custom serializer has been set. If so, the
method will use the custom serializer to deserialize and serialize the data to
ensure proper encoding and decoding. For multi-bulk reply the responses
are recorded and saves it as a list of objects. The metadata is then updated
with the key-value pair and then the JSON string is serialized using the
21

Gson library. Finally, the updated metadata is sent to the server using the
sendToServer() method.

My understanding with Byte Buddy and No-code:-

Byte Buddy is a code generation and manipulation library for creating and
modifying Java classes during the runtime of a Java application and without
the help of a compiler. Byte Buddy is written in Java 5 but supports the
generation of classes for any Java version. Byte Buddy is a light-weight
library and only depends on the visitor API of the Java byte code parser
library ASM which does not require any further dependencies.

The created type will extend the Object class and overrides its toString
method which should return a fixed value of Hello World!. The method to be
overridden is identified by a so-called ElementMatcher. In the above
example, a predefined element matcher named(String) is used which
identifies methods by their exact names. Byte Buddy comes with numerous
predefined and well-tested matchers which are collected in the
ElementMatchers class and which can be easily composed. The creation of
custom matchers is however as simple as implementing the (functional)
ElementMatcher interface.

For implementing the toString method, the FixedValue class defines a


constant return value for the overridden method. Defining a constant value
is only one example of many method interceptors that ship with Byte Buddy.
22

By implementing the Implementation interface, a method could however


even be defined by custom byte code.

❖ Project Plan - Preliminary Plan:


● Discussing with the mentors the best approach of the project
● Installing required softwares for individual goals.
● Working according to the detailed solution discussed above for each
goals(if the approaches remain unchanged)
● Collecting information and learning the new approach proposed by
the mentor and working according to it(if mentor suggests new
approach to the project)

❖ Work schedule:-

Timeline Date Target


Proposal evaluation 04 April - 04 May ● Get existing prs merged
period ● Try to resolve issues and
bugs
● Continue contributing to
the project.
● Keep learning and dive
deeper into the codebase
● Explore alternative
approaches to the project
● Stay connected with the
community
23

Community Bonding 04 May - 28 May ● Interact with the


period community
● Interact with the mentors,
discuss the proposal and
implement their
suggestions
● Try to look for more ways
to enhance my algorithms
● Learn more about the
structure and workflow of
the repositories.
● Decide and finalize
approaches to the chosen
ideas.

Goal1 Two weeks Add support for MongoDB


Week 1 29 May - 04 June ● Install required softwares
● Creating class and objects
to connect to database
● Set hostname and port
● Get database references
Week 2 05 June - 11 June ● Perform API tests and fix
any bug/error found
Goal2 Two weeks Adding support for
RabbitMQ
Week 3 12 June - 18 June ● Installing RabbitMQ
● Adding dependencies
● Creating objects to
connect
● Declaring queue
Week 4 19 June - 25 June ● Publishing message from
queue
● Creating consumer to
receive message
● Processing messages and
24

performing API tests(if


required)
Goal3 3-4 weeks Adding Google cloud and
Azure-SDK
Week 5 26 June - 02 July ● Install required softwares
Week 6 03 July - 09 July ● Create required accounts
● Set up authentication key
Week 7 14 July - 20 July ● Creating connection to
storage
● Creating a connection
string
● Creating instance of Azure
service client
Week 8 21 July - 26 July ● Creating a bucket
● Examining a bucket
● Making changes in bucket
Week 9 27 Jul - 02 Aug ● Additional time for fixing
bugs and other minor
issues (if any)
Furthur weeks ● Buffer period

Major Milestones

Goals/Milestones Date
Add support for MongoDB 29 May - 11 June
Adding support for RabbitMQ 12 June - 25 June
Adding Google cloud and Azure-SDK 26 June - 26 July
25

Additional Information-

➔ Why me?
I believe that I am the right choice for this project due to the following
reasons:
● I have developed the right level of knowledge and skills to
successfully complete this project,also I am ready to learn more (if
required). Working under the guidance of and along with experts and
active contributors will be an opportunity for me to learn a lot of new
things which cannot be taught in any course.During this entire March I
learned working with IntelIiJ Idea,Springboot,MongoDB,Postman,
Docker.
● The KEPLOY community is a really nice community. The KEPLOY
community has been very welcoming and I never felt hesitant to ask
any questions. The mentors are very supportive and always respond
promptly. Their guidance for this proposal has been very helpful and
insightful for me. For the short duration in which I have been
associated with this community, I have really enjoyed the way the
community works and I would definitely want to be a part of the
community and further contribute to the projects after the completion
of this project.
● I have setup KEPLOY locally with a java application, and have gone
through its codebase. I have been using Java for the past 5 years.I
have built a project using java. Currently I am working on a GOOGLE
CLOUD project(Agrotech) as well which will be finished by 15th April.
As a part of my college course, I have taken a course on C++ in my
previous semester.I am also learning how to use docusaurus to
understand the codebase of KEPLOY documentation website.
26

● Since the beginning of March, when I decided that I would like to work
on this project, I have spent time everyday learning it and I’m
currently making good progress.I can switch over to whichever
software the organization and project requires me to. I will be able to
switch over very easily as I am usually very quick to grasp new
software.
● I do not have any other commitments this summer (May 2023 -
September 2023). I do not plan on taking up any internships or other
activities this summer as I want to keep myself available for this
project. I am available the entire day on weekends and plan to spend
at least 5-6 hrs per day over the weekends and holidays.
● I’m flexible with timings and can work with significant overlapping time
zones between India and USA in this project.I will inform them about
my progress on a weekly basis and update my work on Github on a
daily basis. I can alter the frequency depending on the mentors’
preference.
I have not applied for GSOC in any other organization.

➔ Pre-GSOC:
I will get a time of 1 month between the time of submission of this
proposal and the community bonding period. I will be using this time
to complete any left out groundwork (if any) which is necessary for
this project.I will be completing all the tasks required for
implementing my goals and will explore more deep methods to fulfill
the project demands.

➔ Post-GSOC:
By the end of the project, I hope to be a part of the KEPLOY
community. After the completion of Google Summer of Code 2023, I
27

would be more than happy to make regular contributions to other


KEPLOY projects. Further, I would love to take part in more meetings
and interact with the community. While being associated with
KEPLOY, I have learned a lot of things in a very short duration of
time. I'm really thankful to the community who have been very helpful
and played an integral role in my growth.

➔Expected Results at the end:


● Required dependencies would be added in the pom.xml of the
java-sdk repository.
● Separate files for MongoDB,RabbitMQ,Google cloud and Azure
would have been added to the java-sdk repository.
● Following the detailed discussed methods, under each goal, the
project will be completed.

What to expect from your mentor (and what your mentor expects from you)
If you are selected to GSoC with Keploy, you can expect the following:
● We recognize that the goals may change during the project, and the
mentors will accept modifications to the goals at any time. But they
are also expecting to see the reasonable effort go into the initial
project timeline. Any changes to your goals or plan are expected to
be immediately communicated to your mentor.
● The scope of the project might change so as to fit in the duration of
GSoC
● Your mentor will establish a weekly, synchronous check-in with you.
● In addition to that check-in, your mentor will discuss with you any
specific status updates or any other regular communication they
expect from you as well as which methods they prefer for
documentation and collaboration (Google Docs, wiki, etc.).
28

● The project plan and timeline you set forth in your application will also
form a significant part of your midterm and final evaluations.

What to expect from GSoC at Keploy


We want you to have a productive, engaging summer. To that end:
● We will schedule several events throughout the summer where you
can interact with other GSoC students and the rest of the Keploy
community.
● You will have the opportunity to present your work to this broader
community.

You might also like