Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
ipgallery
/
mde
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Registry
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
77faff9a
authored
Mar 29, 2017
by
Adi Amir
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
improve prints
parent
a1729340
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
6 deletions
src/main/java/logic/CiscoManager.java
src/main/java/logic/adapter/HttpAdapter/model/MapJsonToJsonOperation.java
src/main/java/logic/adapter/HttpAdapter/model/MapStringToJsonOperation.java
src/main/java/logic/CiscoManager.java
View file @
77faff9a
...
...
@@ -38,6 +38,7 @@ import java.nio.file.Paths;
public
class
CiscoManager
{
// consts
public
static
String
CISCO
=
"cisco"
;
public
static
String
CISCO_DOMAIN
=
"10.10.20.6"
;
public
static
String
API_URI
=
"/apigw/devnetlabapi/cdp/v1/"
;
public
static
String
API_TOKEN_URI
=
"/apigw/devnetlabtokenapi/"
;
...
...
@@ -125,8 +126,8 @@ public class CiscoManager {
// if the request failed due to invalid token - fetch a new one & try again
if
(
isAccessDenied
(
brr
))
{
logger
.
info
(
"cisco.executeRequest() - access denied.
fetch a new token & try again
"
);
brr
=
reL
ogin
(
loginInfo
);
logger
.
info
(
"cisco.executeRequest() - access denied.
login again ...
"
);
brr
=
l
ogin
(
loginInfo
);
if
(
brr
.
success
)
{
brr
=
executeRequest
(
serviceId
,
apiIdAsParams
,
requestContext
);
}
...
...
@@ -214,7 +215,7 @@ public class CiscoManager {
}
}
catch
(
Exception
e
)
{
String
err
=
"ge.getCameraList
() failed with exception. e="
+
e
.
toString
();
String
err
=
CISCO
+
".getParkingSpots
() failed with exception. e="
+
e
.
toString
();
logger
.
error
(
err
);
return
errorResponse
(
err
);
}
...
...
@@ -385,7 +386,7 @@ public class CiscoManager {
ObjectNode
ps
=
objMapper
.
createObjectNode
();
// location uid
ps
.
put
(
"location-uid"
,
csParkingSpot
.
at
(
"/ParkingSpot/
parkingSpaceI
d"
).
asText
());
ps
.
put
(
"location-uid"
,
csParkingSpot
.
at
(
"/ParkingSpot/
si
d"
).
asText
());
// coordinates
JsonNode
csCoordinates
=
csParkingSpot
.
at
(
"/ParkingSpot/geocoordinates"
);
String
p1Loc
=
csCoordinates
.
at
(
"/latitude"
).
asText
()
+
","
+
csCoordinates
.
at
(
"/longitude"
).
asText
();
...
...
@@ -405,6 +406,8 @@ public class CiscoManager {
parkingSpotsResult
.
add
(
ps
);
}
logger
.
info
(
"parseParkingSpotsResp() - found "
+
parkingSpotsResult
.
size
()
+
" parking spots. tenant="
+
CISCO
);
return
successResponse
(
parkingSpotsResult
);
}
catch
(
Exception
e
)
{
...
...
src/main/java/logic/adapter/HttpAdapter/model/MapJsonToJsonOperation.java
View file @
77faff9a
...
...
@@ -40,7 +40,7 @@ public class MapJsonToJsonOperation extends MapIntermediateOperation<JsonNode, J
throw
new
Exception
(
"MapJsonToJsonOperation: http action failed with status code: "
+
resp
.
getStatusCode
()+
" errorMsg: "
+
resp
.
getContent
()
);
else
{
content
=
resp
.
getContent
();
System
.
out
.
println
(
"MapJsonToJsonOperation params="
+
getOperationParams
().
toString
()+
" convert node= "
+
node
.
toString
()+
" to convertedNode= "
+
content
);
//
System.out.println("MapJsonToJsonOperation params="+ getOperationParams().toString()+" convert node= "+node.toString()+" to convertedNode= "+content);
return
JsonHandler
.
getJsonNodeFromObject
(
content
);
}
...
...
src/main/java/logic/adapter/HttpAdapter/model/MapStringToJsonOperation.java
View file @
77faff9a
...
...
@@ -38,7 +38,7 @@ public class MapStringToJsonOperation extends MapIntermediateOperation<JsonNode,
throw
new
Exception
(
"MapJsonToJsonOperation: http action failed with status code: "
+
resp
.
getStatusCode
()+
" errorMsg: "
+
resp
.
getContent
()
);
content
=
resp
.
getContent
();
System
.
out
.
println
(
"MapStringToJsonOperation params="
+
getOperationParams
().
toString
()+
" convert node= "
+
node
.
toString
()+
" to convertedNode= "
+
content
.
toString
());
//
System.out.println("MapStringToJsonOperation params="+ getOperationParams().toString()+" convert node= "+node.toString()+" to convertedNode= "+content.toString());
return
JsonHandler
.
getJsonNodeFromString
(
resp
.
getContent
());
}
...
...
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