Reduce the number of raw-type related warnings in aai-common 99/132099/2
authorFiete Ostkamp <Fiete.Ostkamp@telekom.de>
Wed, 9 Nov 2022 12:41:32 +0000 (12:41 +0000)
committerFiete Ostkamp <Fiete.Ostkamp@telekom.de>
Wed, 9 Nov 2022 15:58:51 +0000 (15:58 +0000)
Issue-ID: AAI-3586

Signed-off-by: Fiete Ostkamp <Fiete.Ostkamp@telekom.de>
Change-Id: If4affb02cfe40b4b82ecbdbb1a25d919d88be25c

25 files changed:
aai-aaf-auth/src/main/java/org/onap/aai/aaf/auth/AafRequestFilter.java
aai-core/src/main/java/org/onap/aai/dmaap/AAIDmaapEventJMSConsumer.java
aai-core/src/main/java/org/onap/aai/introspection/JSONStrategy.java
aai-core/src/main/java/org/onap/aai/introspection/MoxyStrategy.java
aai-core/src/main/java/org/onap/aai/introspection/sideeffect/PrivateEdge.java
aai-core/src/main/java/org/onap/aai/prevalidation/ValidationService.java
aai-core/src/main/java/org/onap/aai/query/builder/GraphTraversalBuilder.java
aai-core/src/main/java/org/onap/aai/restcore/RESTAPI.java
aai-core/src/main/java/org/onap/aai/serialization/db/DBSerializer.java
aai-core/src/main/java/org/onap/aai/serialization/queryformats/Aggregate.java
aai-core/src/main/java/org/onap/aai/serialization/queryformats/GraphSON.java
aai-core/src/main/java/org/onap/aai/serialization/queryformats/HistoryFormat.java
aai-core/src/main/java/org/onap/aai/serialization/queryformats/SimpleFormat.java
aai-core/src/main/java/org/onap/aai/serialization/queryformats/TreeFormat.java
aai-core/src/main/java/org/onap/aai/util/RestController.java
aai-core/src/test/java/org/onap/aai/prevalidation/ValidationServiceTest.java
aai-core/src/test/java/org/onap/aai/restcore/RESTAPITest.java
aai-core/src/test/java/org/onap/aai/serialization/db/DbSerializerTest.java
aai-core/src/test/java/org/onap/aai/serialization/queryformats/ResourceFormatTest.java
aai-core/src/test/java/org/onap/aai/serialization/queryformats/SimpleFormatTest.java
aai-els-onap-logging/src/main/java/org/onap/aai/logging/LoggingContext.java
aai-rest/src/main/java/org/onap/aai/restclient/RestClient.java
aai-rest/src/main/java/org/onap/aai/restclient/RestClientFactoryConfiguration.java
aai-schema-ingest/src/test/java/org/onap/aai/restclient/MockRestClient.java
aai-schema-ingest/src/test/java/org/onap/aai/restclient/SchemaRestClientTest.java

index cfaa61b..2c8aaf2 100644 (file)
@@ -99,7 +99,7 @@ public class AafRequestFilter {
             return;
         }
         issuer = issuer.replaceAll("\\s+", "").toUpperCase();
-        Enumeration hdrs = request.getHeaders(CertUtil.AAF_USER_CHAIN_HDR);
+        Enumeration<String> hdrs = request.getHeaders(CertUtil.AAF_USER_CHAIN_HDR);
         while (hdrs.hasMoreElements()) {
             String headerValue = (String) hdrs.nextElement();
             LOGGER.debug("authorizationFilter user chain headerValue=" + headerValue);
index 2858ece..d3addeb 100644 (file)
@@ -119,7 +119,7 @@ public class AAIDmaapEventJMSConsumer implements MessageListener {
                 }
                 metricLog.pre(eventName, aaiEvent, transactionId, serviceName);
 
-                HttpEntity httpEntity = new HttpEntity(aaiEvent, httpHeaders);
+                HttpEntity<String> httpEntity = new HttpEntity<String>(aaiEvent, httpHeaders);
 
                 String transportType = environment.getProperty("dmaap.ribbon.transportType", "http");
                 String baseUrl = transportType + "://" + environment.getProperty("dmaap.ribbon.listOfServers");
index 4035236..02288c3 100644 (file)
@@ -150,7 +150,7 @@ public class JSONStrategy extends Introspector {
         Class<?> resultClass = null;
         Object resultObject = this.getValue(name);
         if (resultObject instanceof JSONArray) {
-            resultClass = ((List) resultObject).get(0).getClass();
+            resultClass = ((List<?>) resultObject).get(0).getClass();
         }
 
         return resultClass;
index df8e923..55980c3 100644 (file)
@@ -25,8 +25,15 @@ import com.google.common.base.Joiner;
 
 import java.io.StringWriter;
 import java.io.UnsupportedEncodingException;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
 import java.util.Map.Entry;
+import java.util.Set;
 
 import javax.xml.bind.JAXBException;
 import javax.xml.bind.Marshaller;
@@ -170,12 +177,12 @@ public class MoxyStrategy extends Introspector {
         DatabaseMapping mapping = cd.getMappingForAttributeName(propName);
         Map<PropertyMetadata, String> result = new HashMap<>();
         if (mapping != null) {
-            Set<Entry> entrySet = mapping.getProperties().entrySet();
-            for (Entry<?, ?> entry : entrySet) {
+            Set<Map.Entry<String, String>> entrySet = mapping.getProperties().entrySet();
+            for (Entry<String, String> entry : entrySet) {
                 result.put(
-                        PropertyMetadata.valueOf(
-                                CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, (String) entry.getKey())),
-                        (String) entry.getValue());
+                        PropertyMetadata
+                                .valueOf(CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, entry.getKey())),
+                        entry.getValue());
             }
         }
 
index 9e32ef4..e58ff9b 100644 (file)
@@ -25,8 +25,12 @@ import com.google.common.collect.Multimap;
 import java.io.UnsupportedEncodingException;
 import java.net.URI;
 import java.net.URISyntaxException;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
 import java.util.Map.Entry;
+import java.util.Optional;
 
 import javax.ws.rs.core.MultivaluedMap;
 
@@ -92,7 +96,7 @@ public class PrivateEdge extends SideEffect {
             List<Vertex> results = uriQuery.getQueryBuilder().toList();
             if (results.size() == 1) {
                 Vertex otherVertex = results.get(0);
-                VertexProperty otherVProperty = otherVertex.property("aai-node-type");
+                VertexProperty<Object> otherVProperty = otherVertex.property("aai-node-type");
 
                 if (otherVProperty.isPresent()) {
 
index c66511f..70e16e2 100644 (file)
@@ -222,7 +222,7 @@ public class ValidationService {
         httpHeaders.put("Content-Type", "application/json");
 
         List<String> violations = new ArrayList<>();
-        ResponseEntity responseEntity;
+        ResponseEntity<String> responseEntity;
         try {
 
             responseEntity = validationRestClient.execute(VALIDATION_ENDPOINT, HttpMethod.POST, httpHeaders, body);
@@ -267,7 +267,7 @@ public class ValidationService {
         return violations;
     }
 
-    boolean isSuccess(ResponseEntity responseEntity) {
+    boolean isSuccess(ResponseEntity<String> responseEntity) {
         return responseEntity != null && responseEntity.getStatusCode().is2xxSuccessful();
     }
 
index 2517e2c..312be4f 100644 (file)
@@ -23,7 +23,12 @@ package org.onap.aai.query.builder;
 import com.google.common.collect.ArrayListMultimap;
 import com.google.common.collect.Multimap;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Set;
 
 import org.apache.tinkerpop.gremlin.process.traversal.P;
 import org.apache.tinkerpop.gremlin.process.traversal.Path;
@@ -904,7 +909,7 @@ public abstract class GraphTraversalBuilder<E> extends QueryBuilder<E> {
 
     protected void executeQuery() {
 
-        Admin admin;
+        Admin<Vertex, Vertex> admin;
         if (start != null) {
             this.completeTraversal = traversal.asAdmin();
         } else {
index 3666eb6..31805fd 100644 (file)
@@ -341,7 +341,7 @@ public class RESTAPI {
      * @return the response
      */
     public Response runner(String toe, String tba, String tdl, HttpHeaders headers, UriInfo info, HttpMethod httpMethod,
-            Callable c) {
+            Callable<Response> c) {
         Response response = null;
         Future<Response> handler = null;
         ExecutorService executor = null;
index dc47833..3be88df 100644 (file)
@@ -723,7 +723,7 @@ public class DBSerializer {
             throws IllegalArgumentException, SecurityException, UnsupportedEncodingException, AAIException {
 
         HashMap<String, Introspector> relatedVertices = new HashMap<>();
-        VertexProperty aaiUriProperty = v.property(AAIProperties.AAI_URI);
+        VertexProperty<Object> aaiUriProperty = v.property(AAIProperties.AAI_URI);
 
         if (!aaiUriProperty.isPresent()) {
             if (LOGGER.isDebugEnabled()) {
@@ -1232,7 +1232,7 @@ public class DBSerializer {
             throw new AAIException("AAI_6136",
                     "query object mismatch: this object cannot hold multiple items." + obj.getDbName());
         } else if (obj.isContainer()) {
-            final List getList;
+            final List<Object> getList;
             String listProperty = null;
             for (String property : obj.getProperties()) {
                 if (obj.isListType(property) && obj.isComplexGenericType(property)) {
@@ -1565,7 +1565,7 @@ public class DBSerializer {
             throws UnsupportedEncodingException, AAIException {
 
         List<Object> relationshipObjList = obj.getValue(RELATIONSHIP);
-        VertexProperty nodeTypeProperty = v.property(AAIProperties.NODE_TYPE);
+        VertexProperty<Object> nodeTypeProperty = v.property(AAIProperties.NODE_TYPE);
 
         if (!nodeTypeProperty.isPresent()) {
             LOGGER.warn("Not processing the vertex {} because its missing required property aai-node-type", v.id());
@@ -1651,7 +1651,7 @@ public class DBSerializer {
     private Object processEdgeRelationship(Introspector relationshipObj, Vertex cousin, String cleanUp,
             String edgeLabel, boolean isSkipRelatedTo) throws UnsupportedEncodingException, AAIUnknownObjectException {
 
-        VertexProperty aaiUriProperty = cousin.property("aai-uri");
+        VertexProperty<Object> aaiUriProperty = cousin.property("aai-uri");
 
         if (!aaiUriProperty.isPresent()) {
             return null;
@@ -1670,7 +1670,7 @@ public class DBSerializer {
             return null;
         }
 
-        VertexProperty cousinVertexNodeType = cousin.property(AAIProperties.NODE_TYPE);
+        VertexProperty<Object> cousinVertexNodeType = cousin.property(AAIProperties.NODE_TYPE);
 
         if (cousinVertexNodeType.isPresent()) {
             String cousinType = cousinVertexNodeType.value().toString();
index 2836282..457c0b8 100644 (file)
 
 package org.onap.aai.serialization.queryformats;
 
-import com.google.gson.*;
+import com.google.gson.Gson;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
 
 import java.io.UnsupportedEncodingException;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Set;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
@@ -194,7 +203,8 @@ public class Aggregate extends MultiFormatMapper {
         return Optional.of(json);
     }
 
-    private Optional<JsonArray> processInput(Object input, Map properties) throws AAIFormatVertexException {
+    private Optional<JsonArray> processInput(Object input, Map<String, List<String>> properties)
+            throws AAIFormatVertexException {
         JsonArray json = new JsonArray();
         for (Object l : (ArrayList) input) {
             if (l instanceof ArrayList) {
index fc3316d..e73b990 100644 (file)
@@ -105,7 +105,7 @@ public class GraphSON implements FormatMapper {
      */
     private void removePrivateEdges(JsonObject jsonObject, JsonObject edges, String edgeDirection) {
 
-        Iterator it = edges.entrySet().iterator();
+        Iterator<Map.Entry<String, JsonElement>> it = edges.entrySet().iterator();
         while (it.hasNext()) {
             Map.Entry<String, JsonElement> outEntry = (Map.Entry<String, JsonElement>) it.next();
             JsonArray edgePropertiesArray = outEntry.getValue().getAsJsonArray();
index fccc17c..5d583c5 100644 (file)
@@ -31,7 +31,11 @@ import java.util.Set;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
-import org.apache.tinkerpop.gremlin.structure.*;
+import org.apache.tinkerpop.gremlin.structure.Direction;
+import org.apache.tinkerpop.gremlin.structure.Edge;
+import org.apache.tinkerpop.gremlin.structure.Property;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.apache.tinkerpop.gremlin.structure.VertexProperty;
 import org.onap.aai.db.props.AAIProperties;
 import org.onap.aai.introspection.Loader;
 import org.onap.aai.serialization.db.DBSerializer;
@@ -90,10 +94,10 @@ public abstract class HistoryFormat extends MultiFormatMapper {
 
     protected JsonObject createMetaPropertiesObject(VertexProperty<Object> prop) {
         JsonObject json = new JsonObject();
-        Iterator iter = prop.properties();
+        Iterator<Property<Object>> iter = prop.properties();
 
         while (iter.hasNext()) {
-            Property<Object> metaProp = (Property) iter.next();
+            Property<Object> metaProp = iter.next();
             mapPropertyValues(json, metaProp.key(), metaProp.value());
         }
 
index f1d1c26..ea4cd1c 100644 (file)
@@ -77,7 +77,7 @@ public class SimpleFormat extends RawFormat {
     @Override
     protected void addEdge(Edge e, Vertex v, JsonArray array) throws AAIFormatVertexException {
 
-        Property property = e.property("private");
+        Property<Object> property = e.property("private");
 
         if (property.isPresent()) {
             if ("true".equals(e.property("private").value().toString())) {
index 2e1cbf6..d816730 100644 (file)
@@ -28,8 +28,11 @@ import com.google.gson.JsonObject;
 import com.google.gson.JsonParser;
 
 import java.io.UnsupportedEncodingException;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
 import java.util.Map.Entry;
+import java.util.Optional;
 
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.BulkSet;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.Tree;
@@ -181,9 +184,9 @@ public class TreeFormat extends MultiFormatMapper {
 
             // DSL Query
             if (o instanceof BulkSet) {
-                BulkSet bs = (BulkSet) o;
-                for (Object o1 : bs) {
-                    Optional<JsonObject> obj = this.getJsonFromVertex((Vertex) o1);
+                BulkSet<Vertex> bs = (BulkSet<Vertex>) o;
+                for (Vertex o1 : bs) {
+                    Optional<JsonObject> obj = this.getJsonFromVertex(o1);
                     if (obj.isPresent()) {
                         jsonObject = obj.get();
                         for (Map.Entry<String, JsonElement> mapEntry : jsonObject.entrySet()) {
index 6c57040..18a85e4 100644 (file)
@@ -256,7 +256,7 @@ public class RestController implements RestControllerInterface {
      * @return the list
      * @throws Exception the exception
      */
-    private <T> List<T> mapJsonToObjectList(T typeDef, String json, Class clazz) throws Exception {
+    private <T> List<T> mapJsonToObjectList(T typeDef, String json, Class<?> clazz) throws Exception {
         List<T> list;
         ObjectMapper mapper = new ObjectMapper();
         System.out.println(json);
index 7f6e561..d017408 100644 (file)
@@ -115,7 +115,7 @@ public class ValidationServiceTest {
         String validationResponse =
                 PayloadUtil.getResourcePayload("prevalidation/success-response-with-empty-violations.json");
 
-        ResponseEntity responseEntity = Mockito.mock(ResponseEntity.class, Mockito.RETURNS_DEEP_STUBS);
+        ResponseEntity<String> responseEntity = Mockito.mock(ResponseEntity.class, Mockito.RETURNS_DEEP_STUBS);
 
         Mockito.when(restClient.execute(eq(ValidationService.VALIDATION_ENDPOINT), eq(HttpMethod.POST), any(),
                 eq(pserverRequest))).thenReturn(responseEntity);
index 3c099c7..4b73a7d 100644 (file)
@@ -27,7 +27,11 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.Callable;
 
-import javax.ws.rs.core.*;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MultivaluedHashMap;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
 
 import org.junit.Assert;
 import org.junit.BeforeClass;
@@ -38,7 +42,7 @@ import org.onap.aai.exceptions.AAIException;
 public class RESTAPITest extends AAISetup {
     private static RESTAPI restapi;
     private static HttpHeaders httpHeaders;
-    private static Callable callable;
+    private static Callable<Response> callable;
     private static UriInfo info;
     private static Response response;
 
index 282f645..f921a77 100644 (file)
 package org.onap.aai.serialization.db;
 
 import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.when;
 
 import java.io.UnsupportedEncodingException;
 import java.net.URI;
 import java.net.URISyntaxException;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.UUID;
 
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
 import org.apache.tinkerpop.gremlin.structure.Edge;
@@ -37,7 +50,12 @@ import org.apache.tinkerpop.gremlin.structure.T;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph;
 import org.janusgraph.core.JanusGraphFactory;
-import org.junit.*;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Rule;
+import org.junit.Test;
 import org.junit.rules.ExpectedException;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
@@ -987,7 +1005,7 @@ public class DbSerializerTest extends AAISetup {
     @Test
     public void cascadeL3NetworkPreventDeleteTest() throws AAIException, UnsupportedEncodingException {
         l3NetworkSetup();
-        ArrayList expected_messages = new ArrayList<String>();
+        ArrayList<String> expected_messages = new ArrayList<>();
         expected_messages.add(
                 "Object is being reference by additional objects preventing it from being deleted. Please clean up references from the following types [l3-interface-ipv4-address-list, l3-interface-ipv6-address-list]");
         expected_messages.add(
index 1017893..e26c56e 100644 (file)
@@ -20,7 +20,9 @@
 
 package org.onap.aai.serialization.queryformats;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.when;
 
@@ -130,7 +132,7 @@ public class ResourceFormatTest extends AAISetup {
 
         FormatFactory ff =
                 new FormatFactory(loader, serializer, schemaVersions, basePath, "https://localhost:8447/aai/");
-        MultivaluedMap mvm = new MultivaluedHashMap();
+        MultivaluedMap<String, String> mvm = new MultivaluedHashMap<>();
         mvm.add("depth", "0");
         Formatter formatter = ff.get(Format.resource, mvm);
 
index 279c3e8..d09c2e1 100644 (file)
@@ -142,7 +142,7 @@ public class SimpleFormatTest extends AAISetup {
 
         FormatFactory ff =
                 new FormatFactory(loader, serializer, schemaVersions, basePath, "https://localhost:8447/aai/");
-        MultivaluedMap mvm = new MultivaluedHashMap();
+        MultivaluedMap<String, String> mvm = new MultivaluedHashMap<>();
         mvm.add("depth", "0");
         Formatter formatter = ff.get(Format.simple, mvm);
 
index 97288af..d3fbd95 100644 (file)
@@ -41,7 +41,7 @@ public class LoggingContext {
     public static final String BUSINESS_PROCESS_ERROR = "500";
     public static final String UNKNOWN_ERROR = "900";
 
-    public static final Map<String, String> responseMap = new HashMap();
+    public static final Map<String, String> responseMap = new HashMap<>();
 
     // Specific Log Event Fields
     public static enum LoggingField {
index 6fd2ab6..44b1fe4 100644 (file)
@@ -53,7 +53,7 @@ public abstract class RestClient {
      * @return response of request
      * @throws RestClientException on internal rest template exception or invalid url
      */
-    public ResponseEntity execute(String uri, HttpMethod method, Map<String, String> headers, String body)
+    public ResponseEntity<String> execute(String uri, HttpMethod method, Map<String, String> headers, String body)
             throws RestClientException {
 
         HttpEntity<String> httpEntity;
@@ -79,7 +79,7 @@ public abstract class RestClient {
             throw new RestClientException(e.getMessage());
         }
         log.debug("METHOD={}, URL={}, BODY={}", method, url, httpEntity.getBody());
-        ResponseEntity responseEntity = getRestTemplate().exchange(url, method, httpEntity, String.class);
+        ResponseEntity<String> responseEntity = getRestTemplate().exchange(url, method, httpEntity, String.class);
         log.trace("RESPONSE={}", responseEntity);
         return responseEntity;
     }
@@ -94,7 +94,7 @@ public abstract class RestClient {
      * @return response of request
      * @throws RestClientException on internal rest template exception or invalid url
      */
-    public ResponseEntity execute(String uri, String method, Map<String, String> headers, String body)
+    public ResponseEntity<String> execute(String uri, String method, Map<String, String> headers, String body)
             throws RestClientException {
         return execute(uri, HttpMethod.valueOf(method), headers, body);
     }
@@ -108,7 +108,7 @@ public abstract class RestClient {
      * @return response of request
      * @throws RestClientException on internal rest template exception or invalid url
      */
-    public ResponseEntity execute(String uri, HttpMethod method, Map<String, String> headers)
+    public ResponseEntity<String> execute(String uri, HttpMethod method, Map<String, String> headers)
             throws RestClientException {
         return execute(uri, method, headers, null);
     }
@@ -122,14 +122,15 @@ public abstract class RestClient {
      * @return response of request
      * @throws RestClientException on internal rest template exception or invalid url
      */
-    public ResponseEntity execute(String uri, String method, Map<String, String> headers) throws RestClientException {
+    public ResponseEntity<String> execute(String uri, String method, Map<String, String> headers)
+            throws RestClientException {
         return execute(uri, HttpMethod.valueOf(method), headers, null);
     }
 
-    public ResponseEntity executeResource(String uri, HttpMethod method, Map<String, String> headers, String body)
-            throws RestClientException {
+    public ResponseEntity<Resource> executeResource(String uri, HttpMethod method, Map<String, String> headers,
+            String body) throws RestClientException {
 
-        HttpEntity httpEntity;
+        HttpEntity<String> httpEntity;
         log.debug("Headers: " + headers.toString());
         if (body == null) {
             httpEntity = new HttpEntity(getHeaders(headers));
@@ -140,12 +141,12 @@ public abstract class RestClient {
         return getRestTemplate().exchange(url, method, httpEntity, Resource.class);
     }
 
-    public ResponseEntity getGetRequest(String content, String uri, Map<String, String> headersMap) {
+    public ResponseEntity<String> getGetRequest(String content, String uri, Map<String, String> headersMap) {
         return this.execute(uri, HttpMethod.GET, headersMap, content);
 
     }
 
-    public ResponseEntity getGetResource(String content, String uri, Map<String, String> headersMap) {
+    public ResponseEntity<Resource> getGetResource(String content, String uri, Map<String, String> headersMap) {
         return this.executeResource(uri, HttpMethod.GET, headersMap, content);
 
     }
index 0806023..9a28c1c 100644 (file)
@@ -20,7 +20,6 @@
 
 package org.onap.aai.restclient;
 
-import org.springframework.beans.factory.FactoryBean;
 import org.springframework.beans.factory.config.ServiceLocatorFactoryBean;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
@@ -28,8 +27,9 @@ import org.springframework.context.annotation.Configuration;
 @Configuration
 public class RestClientFactoryConfiguration {
 
+    // ServiceLocatorFactoryBean
     @Bean
-    public FactoryBean restClientFactoryBean() {
+    public ServiceLocatorFactoryBean restClientFactoryBean() {
         ServiceLocatorFactoryBean factoryBean = new ServiceLocatorFactoryBean();
         factoryBean.setServiceLocatorInterface(RestClientFactory.class);
         return factoryBean;
index 74d254b..9715f0e 100644 (file)
@@ -191,7 +191,7 @@ public class MockRestClient extends RestClient {
     }
 
     @Override
-    public ResponseEntity execute(String uri, HttpMethod method, Map<String, String> headers, String body) {
+    public ResponseEntity<String> execute(String uri, HttpMethod method, Map<String, String> headers, String body) {
 
         String url = "https://localhost:8447/aai/v14/" + uri;
 
@@ -227,16 +227,17 @@ public class MockRestClient extends RestClient {
         headersMap.add("X-FromAppId", "JUNIT");
         headersMap.add("X-TransactionId", "JUNIT");
 
-        HttpEntity httpEntity = new HttpEntity(headers);
+        HttpEntity<String> httpEntity = new HttpEntity(headers);
 
-        ResponseEntity responseEntity = restTemplate.exchange(url, HttpMethod.GET, httpEntity, String.class);
+        ResponseEntity<String> responseEntity = restTemplate.exchange(url, HttpMethod.GET, httpEntity, String.class);
 
         // mockRestServiceServer.verify();
         return responseEntity;
     }
 
     @Override
-    public ResponseEntity executeResource(String uri, HttpMethod method, Map<String, String> headers, String body) {
+    public ResponseEntity<Resource> executeResource(String uri, HttpMethod method, Map<String, String> headers,
+            String body) {
 
         String url = "https://localhost:8447/aai/v14/" + uri;
 
@@ -272,9 +273,10 @@ public class MockRestClient extends RestClient {
         headersMap.add("X-FromAppId", "JUNIT");
         headersMap.add("X-TransactionId", "JUNIT");
 
-        HttpEntity httpEntity = new HttpEntity(headers);
+        HttpEntity<String> httpEntity = new HttpEntity(headers);
 
-        ResponseEntity responseEntity = restTemplate.exchange(url, HttpMethod.GET, httpEntity, Resource.class);
+        ResponseEntity<Resource> responseEntity =
+                restTemplate.exchange(url, HttpMethod.GET, httpEntity, Resource.class);
 
         // mockRestServiceServer.verify();
         return responseEntity;
index cbbc63d..4b12936 100644 (file)
@@ -50,7 +50,7 @@ public class SchemaRestClientTest {
 
     @Test
     public void testGetRequestToSchemaService() {
-        ResponseEntity aaiResponse;
+        ResponseEntity<String> aaiResponse;
         RestClient restClient = null;
 
         restClient = restClientFactory.getRestClient(SCHEMA_SERVICE);