Skip to content
This repository has been archived by the owner on Apr 30, 2022. It is now read-only.

Commit

Permalink
Merge branch 'master' into Accessibility_FileManagement
Browse files Browse the repository at this point in the history
  • Loading branch information
jonreding2010 committed Oct 15, 2021
2 parents ce7fc30 + 08c2b7c commit 459ffc8
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 18 deletions.
9 changes: 4 additions & 5 deletions jmaqs-jacoco-reporting/pom.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2020 (C) Magenic, All rights Reserved
-->

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
Expand Down Expand Up @@ -57,7 +53,6 @@
</plugins>
</build>


<dependencies>
<dependency>
<groupId>com.magenic.jmaqs.appium</groupId>
Expand All @@ -79,6 +74,10 @@
<groupId>com.magenic.jmaqs.webservices</groupId>
<artifactId>jmaqs-webservices-jdk8</artifactId>
</dependency>
<dependency>
<groupId>com.magenic.jmaqs.webservices</groupId>
<artifactId>jmaqs-webservices-jdk11</artifactId>
</dependency>
<dependency>
<groupId>com.magenic.jmaqs.database</groupId>
<artifactId>jmaqs-database</artifactId>
Expand Down
8 changes: 3 additions & 5 deletions jmaqs-webservices-jdk11/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>jmaqs-framework</artifactId>
<groupId>com.magenic.jmaqs</groupId>
<version>${revision}</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<groupId>com.magenic.jmaqs.webservices</groupId>
<artifactId>jmaqs-webservices-jdk11</artifactId>

<name>JMAQS JDK11 WebServices Testing Module</name>
<version>${revision}</version>

<dependencies>
<dependency>
<groupId>com.magenic.jmaqs.utilities</groupId>
Expand All @@ -33,16 +34,13 @@
</dependency>
</dependencies>

<name>JMAQS JDK11 WebServices Testing Module</name>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>

<source>11</source>
<target>11</target>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ public class WebServiceUtilities {
*/
private static final ObjectMapper xmlMapper = new XmlMapper();

/**
* Error exception message.
*/
private static final String EXCEPTION_MESSAGE = "Only xml and json conversions are currently supported";

/**
* private class constructor.
*/
Expand Down Expand Up @@ -61,14 +66,14 @@ public static <T> T getResponseBody(HttpResponse<String> response, MediaType con
responseBody = deserializeXml(response, type);
} else {
throw new IllegalArgumentException(
StringProcessor.safeFormatter("Only xml and json conversions are currently supported"));
StringProcessor.safeFormatter(EXCEPTION_MESSAGE));
}

return responseBody;
}

/**
* Create string entity string entity.
* Create a string entity.
*
* @param <T> the type parameter
* @param body the body
Expand All @@ -85,7 +90,7 @@ public static <T> String createStringEntity(T body, MediaType contentType) throw
return body.toString();
} else {
throw new IllegalArgumentException(
StringProcessor.safeFormatter("Only xml and json conversions are currently supported"));
StringProcessor.safeFormatter(EXCEPTION_MESSAGE));
}
}

Expand Down Expand Up @@ -116,21 +121,21 @@ public static <T> String serializeXml(T body) throws JsonProcessingException {
/**
* Deserialize the response based on the media type.
* @param <T> the type parameter
* @param message the String Http Response message
* @param response the String Http Response message
* @param mediaType the type the message is going to be turned into
* @param type the class or java object to be transferred into
* @return the response type
* @throws IOException the io exception
*/
public static <T> T deserializeResponse(HttpResponse<String> message, MediaType mediaType, Type type)
public static <T> T deserializeResponse(HttpResponse<String> response, MediaType mediaType, Type type)
throws IOException {
if (mediaType.equals(MediaType.APP_XML)) {
return deserializeXml(message, type);
return deserializeXml(response, type);
} else if (mediaType.equals(MediaType.APP_JSON)) {
return deserializeJson(message, type);
return deserializeJson(response, type);
} else {
throw new IllegalArgumentException(
StringProcessor.safeFormatter("Only xml and json conversions are currently supported"));
StringProcessor.safeFormatter(EXCEPTION_MESSAGE));
}
}

Expand Down
6 changes: 6 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
<module>jmaqs-base</module>
<module>jmaqs-selenium</module>
<module>jmaqs-webservices-jdk8</module>
<module>jmaqs-webservices-jdk11</module>
<module>jmaqs-appium</module>
<module>jmaqs-database</module>
<module>jmaqs-cucumber</module>
Expand Down Expand Up @@ -317,6 +318,11 @@
<artifactId>jmaqs-webservices-jdk8</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.magenic.jmaqs.webservices</groupId>
<artifactId>jmaqs-webservices-jdk11</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</dependencyManagement>

Expand Down

0 comments on commit 459ffc8

Please sign in to comment.