Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
AI-github-demo
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Iswarabhotla Sunder
AI-github-demo
Commits
255b6940
Commit
255b6940
authored
Nov 26, 2024
by
Rakesh Mareddy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Delete ProfileAPISteps.java
parent
ab6c664c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
94 deletions
+0
-94
ProfileAPISteps.java
ProfileAPISteps.java
+0
-94
No files found.
ProfileAPISteps.java
deleted
100644 → 0
View file @
ab6c664c
import
com.google.gson.Gson
;
import
com.napt.framework.api.runner.EnvVariables
;
import
com.nisum.api.ApiEngine
;
import
com.nisum.api.Globals
;
import
io.cucumber.java.en.And
;
import
io.cucumber.java.en.Given
;
import
io.cucumber.java.en.Then
;
import
io.cucumber.java.en.When
;
import
io.restassured.response.Response
;
import
org.apache.log4j.Logger
;
import
org.junit.Assert
;
import
java.net.URISyntaxException
;
import
java.time.Instant
;
import
java.util.HashMap
;
import
java.util.Map
;
/*
* API Code
*/
public
class
ProfileAPISteps
{
ApiEngine
api
=
new
ApiEngine
();
private
static
final
Logger
log
=
Logger
.
getLogger
(
ProfileAPISteps
.
class
);
public
static
String
webUrl
=
EnvVariables
.
getEnvVariables
().
get
(
"webURL"
);
private
static
Response
response
;
private
String
customerURI
=
"/resources/customers"
;
private
String
customerSearchURI
=
"/resources/customers/search"
;
private
String
userEmailId
=
""
;
private
String
body
;
@Given
(
"I have all the profile headers configured"
)
public
void
iHaveAllTheProfileHeadersConfigured
()
throws
Throwable
{
set_header_param
(
"headers.Content-Type"
,
"application/json"
);
set_header_param
(
"headers.Accept"
,
"application/json"
);
set_header_param
(
"headers.Authorization"
,
"Basic cHJlZWNvbXdzY2xpZW50OlBAc3N3b3JkJDE="
);
set_header_param
(
"base_url.url"
,
"http://ws-profile.vdev.gid.gap.com"
);
}
private
void
set_header_param
(
String
dictionaryKey
,
String
value
)
throws
Throwable
{
String
[]
paramCategory
=
dictionaryKey
.
split
(
"\\."
);
switch
(
paramCategory
[
0
])
{
case
"headers"
:
Globals
.
headers
.
put
(
paramCategory
[
1
],
value
);
break
;
case
"base_url"
:
Globals
.
globalVariables
.
put
(
paramCategory
[
1
],
value
);
break
;
}
}
@Given
(
"I have all the data required for a profile creation"
)
public
void
iHaveAllTheDataRequiredForAProfileCreation
(
Map
<
String
,
String
>
userinfo
)
{
HashMap
<
String
,
String
>
userdata
=
new
HashMap
<
String
,
String
>();
userdata
.
putAll
(
userinfo
);
String
randomizeEmail
=
new
StringBuilder
().
append
(
Instant
.
now
().
toEpochMilli
()).
append
(
userinfo
.
get
(
"emailAddress"
)).
toString
();
userdata
.
replace
(
"emailAddress"
,
randomizeEmail
);
Gson
gson
=
new
Gson
();
this
.
body
=
gson
.
toJson
(
userdata
);
}
@When
(
"^I (GET|PUT|POST|PATCH) the request to (.*) profile$"
)
public
void
iHitTheAPIRequestToPOSTCreateProfile
(
String
apiType
,
String
requestType
)
throws
URISyntaxException
{
String
URI
;
switch
(
requestType
){
case
"create"
:
URI
=
customerURI
;
break
;
case
"search"
:
URI
=
customerSearchURI
;
break
;
default
:
URI
=
"NOPATHYET"
;
}
Response
rs
=
api
.
callAPI
(
apiType
,
Globals
.
headers
,
body
.
toString
(),
Globals
.
globalVariables
.
get
(
"url"
).
toString
()
+
customerURI
);
Globals
.
globalVariables
.
put
(
requestType
,
rs
);
}
@Then
(
"I should see (.*) profile succeeded"
)
public
void
iShouldSeeAPIRequestSucceeded
(
String
requestType
)
{
Response
rs
=
(
Response
)
Globals
.
globalVariables
.
get
(
requestType
);
Assert
.
assertTrue
(
"Actual Response Code is "
+
rs
.
getStatusCode
()
+
" vs Expected Response Code 200"
,
String
.
valueOf
(
rs
.
getStatusCode
()).
equals
(
"200"
));
}
@Given
(
"I have a profile with <emailId> emailid"
)
public
void
iHaveAProfileWithEmailIdEmailid
()
{
}
@And
(
"I prepare the request to POST retrieve profile"
)
public
void
iPrepareTheRequestToPOSTRetrieveProfile
()
{
}
@Then
(
"I should see the profile information retrieved"
)
public
void
iShouldSeeTheProfileInformationRetrieved
()
{
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment